Closed
Bug 1395278
Opened 8 years ago
Closed 8 years ago
Expose MatchPattern API to WebExtensions
Categories
(WebExtensions :: General, defect, P5)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: salar2k, Unassigned)
Details
(Whiteboard: [design-decision-denied])
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170824053622
Expected results:
It would be very helpful to expose MatchPattern API to WebExtensions both in extension context and PAC script context.
This is quite useful for proxies.
My suggestion is an API like this:
if( browser.matchPattern.matches("*://mozilla.org/","https://mozilla.org/") ){
// ...
}
or an efficient one:
var match = new MatchPattern("*://mozilla.org/");
match.matches("https://mozilla.org/"); // < true
match.matches("https://mozilla.org/path"); // < false
(the API: https://hg.mozilla.org/mozilla-central/file/f8f4a6c06549/toolkit/modules/addons/MatchPattern.jsm)
(https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Match_patterns)
Component: Untriaged → WebExtensions: General
Product: Firefox → Toolkit
Updated•8 years ago
|
Priority: -- → P5
Whiteboard: [design-decision-needed]
Comment 1•8 years ago
|
||
Hi Salar, this has been added to the agenda for the February 6, 2018 WebExtensions APIs triage. Would you be able to join us?
Here’s a quick overview of what to expect at the triage:
* We normally spend 5 minutes per bug
* The more information in the bug, the better
* The goal of the triage is to give a general thumbs up or thumbs down on a proposal; we won't be going deep into implementation details
Relevant Links:
* Wiki for the meeting: https://wiki.mozilla.org/WebExtensions/Triage#Next_Meeting
* Meeting agenda: https://docs.google.com/document/d/1731b2kkN1wndNzVvo--5gwUcagbOSKGNYv4769r68NM/edit#
* Vision doc for WebExtensions: https://wiki.mozilla.org/WebExtensions/Vision
Updated•8 years ago
|
Flags: needinfo?(aswan)
Whiteboard: [design-decision-needed] → [design-decision-denied]
Comment 2•8 years ago
|
||
During the meeting yesterday we discussed the fact that MatchPattern is currently tailored to some specific uses inside the WebExtensions framework (eg the list of protocol schemes that * matches) so exposing this API would mean either generalizing it or documenting and freezing the current API. The consensus was that this wouldn't provide enough benefit to justify doing either of those.
Note that you scan do most (all?) of what MatchPattern does with the DOM URL API:
https://developer.mozilla.org/en-US/docs/Web/API/URL
Your example from the description could be written something like:
```
function match(url) {
return new URL(url).hostname == "www.mozilla.org";
// or:
return new URL(url).hostname.endsWith(".mozilla.org");
}
```
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Updated•8 years ago
|
Flags: needinfo?(aswan)
Updated•8 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•