Is it possible to match ccTTL domains to webRequest listener?

Viewed 42

I am trying to make firefox addon redirects connection to another link, translating ccTLD domain name to gTLD one. (http://foo.bar.co.baz/GETdata)->(http://foo.qux.com/GETdata)

I tried match pattern and other options, without any luck.

var pattern = "https://mdn.mozillademos.org/*";

function redirect(requestDetails) {
    console.log("Redirecting: " + requestDetails.url);
    return {
         redirectUrl: "https://38.media.tumblr.com/tumblr_ldbj01lZiP1qe0eclo1_500.gif"
    };
}

browser.webRequest.onBeforeRequest.addListener(
    redirect,
    {urls:[pattern], types:["image"]},
    ["blocking"]
);

//used MDN example code. permission is given to entire hosts in manifest.json

I can't get ccTLD filtered with any options. It seems internal parser simply can't handle it since 3rd option also failed. Am I missing something?

0 Answers
Related