Open Bug 1402043 Opened 8 years ago Updated 3 years ago

MatchPattern subsumption checks mishandle *://

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(firefox57 affected)

Tracking Status
firefox57 --- affected

People

(Reporter: Kwan, Unassigned)

Details

(Keywords: dev-doc-complete)

let matcher = new MatchPatternSet(["http://*.example.com/*", "https://*.example.com/*"]); let newPerm = new MatchPattern("*://*.example.com/*"); matcher.subsumes(newPerm); // false This should return true from reading the docs since https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns#scheme specifies that *:// matches only http:// and https:// ...however looking at the code the docs are out of date, and ws: and wss: should be listed since https://hg.mozilla.org/mozilla-central/rev/62e44a827308 and bug 1367478. Though even adjusting the code to include websockets still gives an incorrect false: let wsMatcher = new MatchPatternSet(["http://*.example.com/*", "https://*.example.com/*", "ws://*.example.com/*", "wss://*.example.com/*"]); wsMatcher.subsumes(newPerm); // false overlapsAll also seems to give incorrect results: matcher.overlapsAll(new MatchPatternSet(["*://*.example.com/*"])); // true // should be false since matcher is missing wss?:// it's possible I'm misunderstanding the code somewhere
Looks like the docs need fixing up, added flag. ni'ing mixedpuppy for the rest.
Flags: needinfo?(mixedpuppy)
Keywords: dev-doc-needed
Priority: -- → P3
Summary: MatchPattern doesn't treat *:// as equivalent to its component protocols → MatchPattern subsumption checks mishandle *://
Pretty much as Kris updated. ws/s is somewhat of an alias to http/s, we're treating it as such for pattern matching.
Flags: needinfo?(mixedpuppy)
Product: Toolkit → WebExtensions

Looks like the docs have been fixed since then, to cover ws/wss

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.