chrome.tabs.query fails with "about:blank" url
Categories
(WebExtensions :: Compatibility, defect, P1)
Tracking
(firefox68 wontfix, firefox69 wontfix, firefox70 verified)
People
(Reporter: feedbro.reader, Assigned: zombie)
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.
Updated•2 years ago
|
Comment 1•2 years ago
|
||
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.
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Long standing compat bug, needs a priority.
Updated•2 years ago
|
| Assignee | ||
Comment 3•2 years ago
|
||
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 | ||
Comment 4•2 years ago
|
||
Updated•2 years ago
|
Pushed by tomica@gmail.com: https://hg.mozilla.org/integration/autoland/rev/51f44b58102d Use {restrictedSchemes: false} for tabs.query MatchPattern r=mixedpuppy
Comment 6•2 years ago
|
||
| bugherder | ||
Updated•2 years ago
|
Comment 7•2 years ago
|
||
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.
Updated•2 years ago
|
Description
•