Open Bug 1468162 Opened 7 years ago Updated 3 years ago

Ports in match patterns match no URLs

Categories

(WebExtensions :: General, defect, P5)

60 Branch
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: ds, Unassigned)

References

Details

(Whiteboard: [design-decision-denied])

Attachments

(1 file)

Attached file http-response.zip
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID: 20180605171542 Steps to reproduce: 1. Unzip the attached file 'http-response.zip'. It's a slightly modified version of the web extension from here: https://github.com/mdn/webextensions-examples/tree/master/http-response 2. Open 'about:debugging' and this add-on via 'Load temporary add-on' 3. Click 'Debug', open the debug window 4. Open in browser http://example.com (note HTTP, not https). 5. Run something locally on port 3000 (any hello-world app would do). 6. Open in browser http://localhost:3000 Actual results: 1. On step 4, observe in the debug window, that the listener is called (which is expected). 2. On step 6, observe in the debug window, that the listener is *not* called Expected results: The listener should be called on step 6 as well as on step 4.
If in background.js I change {urls: ["http://localhost:3000/*", "http://example.com/*"], types: ["main_frame"]} to {urls: ["*://*/*"], types: ["main_frame"]} the listener is called for both URLs (as expected).
I tried to test this on Mac but when I want to open the add-on from "Load temporary add-on" I have this error "does not contain a valid manifest"
Flags: needinfo?(ds)
I recorded the video on how to reproduce the issue. Please, take a look: https://youtu.be/gZ9C_vtrmeM In the video, I also show that when I edit URLs to "*://*/*", the listener is called (as intended). Hope, this helps!
Flags: needinfo?(ds)
Thanks for your video, I tried to reproduce it but after I load the temporary add-on and try to click on debug I receive this error in console: "TypeError: can't access dead object[Learn More]" I will set a component for this, maybe someone with more experience can tell us what's the problem here.
Component: Untriaged → Networking
Product: Firefox → Core
This appears to be a bug in the extension pattern matching code for URLs: https://searchfox.org/mozilla-central/rev/d0a41d2e7770fc00df7844d5f840067cc35ba26f/toolkit/components/extensions/MatchPattern.cpp#430 has no mention of looking at the port, so "localhost:3000" (the pattern) will not match "localhost" (what the matcher looks at).
Component: Networking → General
Product: Core → WebExtensions
Summary: webRequest listeners are not called if specifically target localhost → Ports in match patterns match no URLs
Whiteboard: [design-decision-denied]
See Also: → 1362809
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: