0

I'm trying to write an extension that only runs on *://github.com/notifications or *://github.*.com/notifications (to cover Github Enterprise URLs). Unfortunately the second match pattern is one of the invalid match patterns in the firefox docs and the google docs, see picture:

Invalid match patterns

This presumably means I'd have to use *://*/notifications instead, and then filter it in the app, which seems like a pain, as it means I have to use a wider scope than I'd need to.

So my question is, is there an easy way to match these urls that I'm missing? Is there a reason that this match is disallowed?

App is here in case that helps.

  • 1
    Use include_globs. – wOxxOm Sep 22 '17 at 12:32
  • Such matches are disallowed for security reasons. The matches you list could match almost any domain. – Makyen Sep 25 '17 at 7:17
  • But you can match "*://*/*", which matches any domain. – gib Sep 25 '17 at 16:50
0

Okay, fixed it with the include_globs option as suggested in the comment

  "content_scripts": [
    {
      "matches": [
        "*://*/*"
      ],
      "include_globs": [
        "*://*github*notifications*"
      ],
      "js": [
        "browser-polyfill.js",
        "button.js"
      ]
    }
]

Still seems odd that you are forced to do this more general match and then filter down with include_globs, but maybe this makes it clear that you're actually matching any domain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.