1

I am currently trying to write a compatibility extension for raindrop.io. Some hosts I am working with a lot require some additional fields added to the header, otherwise they reject the request. Because of this, the image preview of raindrop.io does not work properly.

Long story short, I got this working via WebRequestBlocking already for when raindrop.io is opened in the main frame. It's a rather standard issue after all. Here's the relevant code (Yes, I'm not filtering the url at all right now... I'm still experimenting)

{
    "manifest_version": 2,
    "name": "Referer Modifier",
    "version": "1.0",
    "permissions": [
        "webRequest",
        "webRequestBlocking",
        "<all_urls>"
    ],
    "background": {
        "scripts": ["background.js"]
    },
    "applications": {
        "gecko": {
            "id": "[email protected]"
        }
    }
}

browser.webRequest.onBeforeSendHeaders.addListener(
    function(details) {
        const headers = details.requestHeaders;
        /* DO HEADER MODIFICATION
        It works in main frame. Not releveant for the question, so I cut it out.
        */
        return {requestHeaders: headers};
    },
    {urls: ["<all_urls>"]},
    ["blocking", "requestHeaders"]
);

Again, it's basically the absolut basic example straight from documentation. It works in the main frame.

My question is... is there some way I can set this up, so it can also intercept requests made by the other extension, so that the sidebar and such work too? I tried searching through the documentation, but I'm not really deep into extension development, so I have no idea what terms I should even be looking for.

6
  • No, it's impossible, intentionally so.
    – woxxom
    Commented Apr 19 at 0:09
  • Ok, thank you. Not a big surprise to be honest. I still need to solve the underlying issue somehow... Does anyone have some suggestions what some alternative options would be in this case? Commented Apr 20 at 5:25
  • It might be possible using chrome.debugger API and definitely possible via chrome.devtools API which works while you inspect another extension's page.
    – woxxom
    Commented Apr 20 at 5:53
  • Either of those does not really sound like something suitable for a permanent setup. Hmm... Is there a way that I can register an extension as a "patch" of another extension of sorts? ... or maybe I should simply pack my own version of the raindrop.io extension instead. Commented Apr 20 at 7:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.