Closed Bug 1573045 Opened 3 months ago Closed 3 months ago

chrome.tabs.query fails with "about:blank" url

Categories

(WebExtensions :: Compatibility, defect, P1)

68 Branch
defect

Tracking

(firefox68 wontfix, firefox69 wontfix, firefox70 verified)

VERIFIED FIXED
mozilla70
Tracking Status
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- verified

People

(Reporter: feedbro.reader, Assigned: Tomislav)

Details

(Keywords: parity-chrome, Whiteboard: webext?)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

Steps to reproduce:

Create a WebExtension with "tabs" permission.

Run this:

chrome.tabs.query({url: "about:blank"}, function(tabs) { if( chrome.runtime.lastError) { console.log(chrome.runtime.lastError); } else { console.log(tabs); } });

Actual results:

It displays:

Error: "An unexpected error occurred"

Expected results:

If there are no tabs with "about:blank" URL open, it should return an empty array []. This is how Chrome works.

Component: Untriaged → Frontend
Keywords: parity-chrome
Product: Firefox → WebExtensions
Version: 68 Branch → Firefox 68

Hello,

I have managed to successfully reproduce the issue using the provided STR on the latest Nightly (70.0a1/20190813215212), Beta (69.0b13/20190812173625) and Release (68.0.1/20190717172542) under Windows 10 Pro 64-bit and macOS High Sierra 10.13.6.

I will also update the tracking flags accordingly to reflect this.

Status: UNCONFIRMED → NEW
Ever confirmed: true

Long standing compat bug, needs a priority.

Component: Frontend → Compatibility
Whiteboard: webext?
Flags: needinfo?(tomica)

The error happens because making a match pattern from "about:blank" is only allowed if restrictedSchemes: false is passed in options:

https://searchfox.org/mozilla-central/source/mobile/android/components/extensions/ext-tabs.js#459

But overall, this behavior doesn't make much sense: with the tabs permission, authors can already get urls for any tab if they just call .query({}) without any filters.

Assignee: nobody → tomica
Flags: needinfo?(tomica)
Priority: -- → P1
Pushed by tomica@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/51f44b58102d
Use {restrictedSchemes: false} for tabs.query MatchPattern r=mixedpuppy
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Verified the fix using the latest Nightly (70.0a1/20190829214656) under Windows 10 Pro 64-bit and macOS High Sierra 10.13.6.

Running chrome.tabs.query({url: "about:blank"}, function(tabs) { if( chrome.runtime.lastError) { console.log(chrome.runtime.lastError); } else { console.log(tabs); } }); will no longer produce the mentioned error, instead it will return an empty Array[] if no tabs with about:blank are opened. If tabs with about:blank are present, it will return an array with the id, index and windowID of the tabs with about:blank.

Status: RESOLVED → VERIFIED
Version: Firefox 68 → 68 Branch
You need to log in before you can comment on or make changes to this bug.