Closed Bug 1198405 Opened 9 years ago Closed 9 years ago

chrome.tabs.query’s url parameter doesn't match “one or more URL patterns”.

Categories

(WebExtensions :: Untriaged, defect, P1)

defect

Tracking

(firefox43 affected, firefox44 fixed)

RESOLVED FIXED
mozilla44
Tracking Status
firefox43 --- affected
firefox44 --- fixed

People

(Reporter: bwinton, Assigned: johannh, Mentored)

References

Details

(Whiteboard: [tabs])

Attachments

(1 file, 2 obsolete files)

The documents say it should match one or more url patterns[0].
Our code does a simple != match on the string value[1].

It would be awesome if we handled not only a single pattern, but also arrays of patterns and strings, intermingled!  :)

[0] https://developer.chrome.com/extensions/tabs#property-queryInfo-url
[1] https://dxr.mozilla.org/mozilla-central/source/browser/components/extensions/ext-tabs.js#366
Whiteboard: [tabs]
Blocks: webext
Priority: -- → P1
I'm guessing Blake's link was meant to refer to something about MatchPattern, which is how we would implement this:
https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/addons/MatchPattern.jsm
Assignee: nobody → mail
Attachment #8675592 - Flags: review?(wmccloskey)
Comment on attachment 8675592 [details] [diff] [review]
Match one or more URL patterns in tabs.query

Review of attachment 8675592 [details] [diff] [review]:
-----------------------------------------------------------------

Looks great! Thanks.

::: browser/components/extensions/ext-tabs.js
@@ +428,5 @@
>                return false;
>              }
>            }
>  
> +          if (pattern && !pattern.matches(ioService.newURI(tab.url, null, null))) {

It's a bit easier to do Services.io.newURI. You'll want to import Services.jsm at the top using Cu.import.
Attachment #8675592 - Flags: review?(wmccloskey) → review+
Attachment #8675592 - Attachment is obsolete: true
Comment on attachment 8676715 [details] [diff] [review]
Match one or more URL patterns in tabs.query

Done :)
Attachment #8676715 - Flags: review?(wmccloskey)
Attachment #8676715 - Flags: review?(wmccloskey) → review+
Attachment #8676715 - Attachment is obsolete: true
Attachment #8677286 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2676b3f48d03
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Flags: blocking-webextensions+
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: