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

RESOLVED FIXED in Firefox 44

Status

()

Toolkit
WebExtensions: Untriaged
P1
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: bwinton, Assigned: johannh, Mentored)

Tracking

Trunk
mozilla44
Points:
---
Bug Flags:
blocking-webextensions +

Firefox Tracking Flags

(firefox43 affected, firefox44 fixed)

Details

(Whiteboard: [tabs])

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

2 years ago
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
(Reporter)

Comment 1

2 years ago
https://dxr.mozilla.org/mozilla-central/source/toolkit/components/extensions/ExtensionContent.jsm?offset=100#95 looks like it might be helpful in implementing this…
Mentor: gkrizsanits@mozilla.com

Updated

2 years ago
Whiteboard: [tabs]

Updated

2 years ago
Blocks: 1214433
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)

Updated

2 years ago
Assignee: nobody → mail
(Assignee)

Comment 3

2 years ago
Created attachment 8675592 [details] [diff] [review]
Match one or more URL patterns in tabs.query
(Assignee)

Updated

2 years ago
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+
(Assignee)

Comment 5

2 years ago
Created attachment 8676715 [details] [diff] [review]
Match one or more URL patterns in tabs.query
(Assignee)

Updated

2 years ago
Attachment #8675592 - Attachment is obsolete: true
(Assignee)

Comment 6

2 years ago
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+
(Assignee)

Comment 7

2 years ago
Created attachment 8677286 [details] [diff] [review]
Use MatchPattern to match URLs in tabs.query
(Assignee)

Updated

2 years ago
Attachment #8676715 - Attachment is obsolete: true
(Assignee)

Updated

2 years ago
Attachment #8677286 - Flags: review+
(Assignee)

Comment 8

2 years ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=dce1dcb8f88c
(Assignee)

Updated

2 years ago
Keywords: checkin-needed

Comment 9

2 years ago
https://hg.mozilla.org/integration/fx-team/rev/2676b3f48d03
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2676b3f48d03
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox44: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44

Updated

2 years ago
Flags: blocking-webextensions+
You need to log in before you can comment on or make changes to this bug.