Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbamberg/fd02ea935eb6ca051fa8 to your computer and use it in GitHub Desktop.
Save wbamberg/fd02ea935eb6ca051fa8 to your computer and use it in GitHub Desktop.
let {WebRequest} = Cu.import("resource://gre/modules/WebRequest.jsm", {});
let pattern = /https:\/\/mdn\.mozillademos\.org\/.*/;
function listen(event) {
event.addListener(redirect, {urls: [pattern], types: ["image"]},
["blocking"]);
}
function redirect(e) {
console.log("Redirecting: " + e.url);
return {redirectUrl: "https://38.media.tumblr.com/tumblr_ldbj01lZiP1qe0eclo1_500.gif"};
}
function unlisten(event) {
event.removeListener(redirect);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment