Closed
Bug 1340739
Opened 7 years ago
Closed 7 years ago
currentWindow does not match any tabs in query from sidebar
Categories
(WebExtensions :: General, defect, P2)
WebExtensions
General
Tracking
(firefox54 fixed)
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: andy+bugzilla, Assigned: mixedpuppy)
References
Details
(Whiteboard: triaged)
Attachments
(2 files)
In a sidebar add-on I do tabs.query({currentWindow: true}), I notice that consistently the first tab is not included. Later tabs that are created are included. Attached is a simple add-on that (I think) should detect 1 tabs in both cases. However it outputs when loaded in about:debugging as a temporary add-on: Got 1 tabs from query. Got 0 tabs from query with currentWindow.
Updated•7 years ago
|
Summary: tabs.query({currentWindow: true}) in a sidebar, returns 1 less window → currentWindow does not match any tabs in query from sidebar
Reporter | ||
Updated•7 years ago
|
Summary: currentWindow does not match any tabs in query from sidebar → currentWindow does not match first tab in query from sidebar
Reporter | ||
Comment 1•7 years ago
|
||
Ok, Kris, you were right :)
Summary: currentWindow does not match first tab in query from sidebar → currentWindow does not match any tabs in query from sidebar
Comment hidden (mozreview-request) |
Assignee | ||
Comment 3•7 years ago
|
||
This happens because the sidebar frame is contained in a xul frame [ie. chrome://browser/content/webext-panels.xul], thus context.currentWindow is the sidebar xul frame. We need to grab the parent of that.
Assignee | ||
Updated•7 years ago
|
Attachment #8839277 -
Flags: feedback?(kmaglione+bmo)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → mixedpuppy
Assignee | ||
Updated•7 years ago
|
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: triaged
Comment 4•7 years ago
|
||
mozreview-review |
Comment on attachment 8839277 [details] Bug 1340739 sidebar window is not the browser window, https://reviewboard.mozilla.org/r/113954/#review115672 ::: toolkit/components/extensions/ExtensionParent.jsm:369 (Diff revision 1) > + if (this.viewType == "sidebar") { > + return this.xulBrowser.ownerGlobal.document.parentWindow; > + } > return this.xulBrowser.ownerGlobal; Let's just always return the root window: win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDocShell); .QueryInterface(nsIDocShellTreeItem).rootTreeItem .QueryInterface(nsIInterfaceRequestor).getInterface(nsIDOMWindow);
Updated•7 years ago
|
Attachment #8839277 -
Flags: feedback?(kmaglione+bmo)
Comment hidden (mozreview-request) |
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8839277 [details] Bug 1340739 sidebar window is not the browser window, https://reviewboard.mozilla.org/r/113954/#review115718 ::: browser/components/extensions/test/browser/browser_ext_sidebarAction.js:155 (Diff revision 2) > + `, > + "sidebar.js": function() { > + Promise.all([ > + browser.tabs.query({}).then((tabs) => { > + browser.test.assertEq(1, tabs.length, "got tab without currentWindow"); > + return true; No need for either `return true`.
Attachment #8839277 -
Flags: review?(kmaglione+bmo) → review+
Comment hidden (mozreview-request) |
Pushed by mixedpuppy@gmail.com: https://hg.mozilla.org/integration/autoland/rev/3ad2f410d2e7 sidebar window is not the browser window, r=kmag
Comment 9•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3ad2f410d2e7
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•