Closed Bug 1419356 Opened 7 years ago Closed 7 years ago

[WebExtensions API] Permissions "https://<host>/*" not working.

Categories

(WebExtensions :: Request Handling, defect)

59 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: limkokhole, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0 Build ID: 20171118211007 Steps to reproduce: 1. Follow this tutorial at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Intercept_HTTP_requests#Redirecting_requests 2. Save the code, run with `web-ext run --bc` Actual results: 3. It will shows error in about:debugging page: Reading manifest: Error processing permissions.2: Value "https://mdn.mozillademos.org" must either: must either [be one of ["clipboardRead", "clipboardWrite", "geolocation", "idle", "notifications"], must either [be one of ["<all_urls>"], match the pattern /^(https?|wss?|file|ftp|\*):\/\/(\*|\*\.[^*/]+|[^*/]+)\/.*$/, or match the pattern /^file:\/\/\/.*$/], be one of ["bookmarks"], be one of ["find"], be one of ["history"], be one of ["activeTab", "tabs"], be one of ["browserSettings"], be one of ["cookies"], be one of ["topSites"], be one of ["webNavigation"], or be one of ["webRequest", "webRequestBlocking"]], be one of ["alarms", "storage", "unlimitedStorage"], be one of ["browsingData"], be one of ["devtools"], be one of ["identity"], be one of ["menus", "contextMenus"], be one of ["geckoProfiler"], be one of ["sessions"], be one of ["contextualIdentities"], be one of ["downloads", "downloads.open"], be one of ["management"], be one of ["privacy"], be one of ["proxy"], be one of ["nativeMessaging"], be one of ["theme"], or match the pattern /^experiments(\.\w+)+$/ 4. If I append trailing slash '/' on "https://mdn.mozillademos.org", e.g.: "permissions": [ "webRequest", "webRequestBlocking", "https://mdn.mozillademos.org/" ], 5. The error dismiss, but it's not working, I also tried "https://mdn.mozillademos.org/*", it's not working either. But "https://*/" OR "https://*/*" is working. 6. Note that I always use Ctrl+F5 to clear image cache to test. 7. Refer to https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/permissions , the `"permissions": ["*://developer.mozilla.org/*"]` should work, but `"*://mdn.mozillademos.org/*"` is not working. Expected results: "https://mdn.mozillademos.org" not working is fine, but `"*://mdn.mozillademos.org/*" and "https://mdn.mozillademos.org/" should work, conforms to https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns
Version: 59 Branch → 57 Branch
Version: 57 Branch → 59 Branch
The trailing / is required. What exactly do you mean by "is not working"?
(In reply to Kris Maglione [:kmag] (long backlog; ping on IRC if you're blocked) from comment #1) > The trailing / is required. What exactly do you mean by "is not working"? Even you added trailing '/',the error did dismiss, but it doesn't change to https://38.media.tumblr.com/tumblr_ldbj01lZiP1qe0eclo1_500.gif with that code.
Only if I change "permissions": [' from "https://mdn.mozillademos.org/" to "https://*/*" , then it able to redirect to https://38.media.tumblr.com/tumblr_ldbj01lZiP1qe0eclo1_500.gif . Look at the comment at https://www.youtube.com/watch?v=ix5RrXGr0wA&lc=UgztM5bS00e1qyeQxZ94AaABAg , I'm not the only person encounter this bug.
The MDN example was out of date, a host permission is needed for both the origin of the image (mdn.mozillademos.org in this case) and the origin of the page containing the image (developer.mozilla.org). I've updated the example. :wbamberg, is this requirement documented somewhere?
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(wbamberg)
Resolution: --- → INVALID
What is a suitably generic way of expressing this requirement? "To intercept subresources loaded by a page, the extension must have the host permission for the subresource as well as for the main page requesting the subresource. For example..."
Flags: needinfo?(wbamberg) → needinfo?(aswan)
Yes, that's accurate. The word subresource throws me a bit but I think if you follow this with an example it will be clear.
Flags: needinfo?(aswan)
OK, I added a bit here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest where it talks about host permissions. I didn't use "subresource", in case that is confusing.
Looks good, thanks!
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.