question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option for running extension on restricted URLs

See original GitHub issue

https://github.com/darkreader/darkreader/blob/b9408082d7bec6880119a2086982b11d648ddce0/src/background/utils/extension-api.ts#L15

With Dark Reader, restricted sites like addons.mozilla.org can’t be themed with the restriction in about:config turned off in: ‘privacy.resistFingerprinting.block_mozAddonManager’. For such sites to be themed please edit the file, ‘background/index.js’. Then publish the addon on firefox’s addon site.

Change the following in background/index.js from:

 function canInjectScript(url) {
        if (isFirefox()) {
            return (url
                && url.indexOf('about:') !== 0
                && url.indexOf('moz') !== 0
                && url.indexOf('view-source:') !== 0
                && url.indexOf('https://addons.mozilla.org') !== 0);
        }
        return (url
            && url.indexOf('chrome') !== 0
            && url.indexOf('https://chrome.google.com/webstore') !== 0);
    }

…and change it to:

   function canInjectScript(url) {
        if (isFirefox()) {
            return (url
                && url.indexOf('about:') !== 0
                && url.indexOf('moz') !== 0
                && url.indexOf('view-source:') !== 0);
        }
        return (url
            && url.indexOf('chrome') !== 0
            && url.indexOf('https://chrome.google.com/webstore') !== 0);
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Gustedcommented, Aug 15, 2020

Hi!

I’ve made a PR(#3426) that let’s you disable the check if a site is protected(Extension wise, browser still can say it’s protected).

Also

to be fixed?

Added as option*

Fenix only supports dark reader so cannot use a different extension.

I’m not quite sure if you can disable the protected pages in Fenix still.

It would be great if dark reader worked properly

Properly? I don’t think your understanding the issue. Browsers have hard coded values for protected pages. We have implemented this system so it would:

  1. Not inject in those pages
  2. Show in the UI that it’s protected.

We are just adjusting to the browser and is working properly.

and allowed user-overrides.

That’s being added by #3426

Regards, Gusted

1reaction
User486375commented, Nov 25, 2019

I don’t understand why you actually disable your extension on addons.mozilla.org especially, as Firefox itself prevents extensions from running on that page either way. It’s like protecting your extension from itself which is meaningless.

If you remove addons.mozilla.org from the about:config extensions.webextensions.restrictedDomains on Firefox then your extension should run. Just like how when you remove other restricted domains such asaccounts.firefox.com the same about:config it runs fine there. So I don’t see this as a “causing errors issue” if you don’t have issues with all the other restricted domains currently.

As for Chrome they only actually restrict access to chrome.google.com alone unlike Firefox so you can actually run extensions such as uBlock Origin on the page see here, it just won’t be able to block anything coming from chrome.google.com, unlike in Firefox it just won’t see anything. Though I’m guessing without enabling the Extensions on chrome:// URLs flag as mentioned above, it won’t allow you to inject anything into the page, but I could be wrong.

Lastly, any ETA on this? Doesn’t seem like a hard fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to restrict extensions to select websites in ... - AddictiveTips
Open it and select the 'On specific sites' option. A pop-up will open asking you to enter the URL for the websites you...
Read more >
How to restrict extensions to select websites in Chrome
When you install an extension in Chrome, it shows you a comprehensive list of the permissions it needs to run. You can accept...
Read more >
Restrictions on File Urls - text/plain
By default, extensions are forbidden to run on file:// URIs. To allow the user to run extensions on file: -sourced content, the user...
Read more >
Allow or block access to websites - Google Support
Define exceptions to very restrictive blocklists—Use the blocklist to block access to all URLs. Then, use the allowlist to let users access certain...
Read more >
Chrome Extensions: declare permissions and warn users
An extension's ability to access websites and most Chrome APIs is determined by its declared permissions. Permissions should be restricted ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found