Open Bug 1635328 Opened 5 years ago Updated 4 years ago

When using tabs.duplicate(), tab is reported as complete, then loading, then complete

Categories

(WebExtensions :: General, defect, P5)

defect

Tracking

(Not tracked)

People

(Reporter: aria, Unassigned)

References

Details

Attachments

(1 file)

627 bytes, application/zip
Details
Attached file extension.zip

Here’s an example of the console output (in devtools) of the extension demonstrating the bug:

Object { title: "mozilla.org/en-US/privacy/firefox/" }
Object { status: "complete", url: "https://www.mozilla.org/en-US/privacy/firefox/" }
Object { title: "Firefox Privacy Notice — Mozilla" }
Object { title: "mozilla.org/en-US/privacy/firefox/" }
Object { status: "loading", url: "https://www.mozilla.org/en-US/privacy/firefox/" }
Object { title: "Firefox Privacy Notice — Mozilla" }
Object { status: "complete" }

This is confusing and makes it more difficult for add-ons to use the tabs.duplicate API.

I'll check what Chrome does and what's happening behind the scenes in Firefox.

Severity: -- → S3
Flags: needinfo?(rob)
Priority: -- → P5

Chrome triggers the following reasonable set of events:

{status: "loading", url: "https://www.mozilla.org/en-US/privacy/firefox/"}
{favIconUrl: "https://www.mozilla.org/media/img/favicons/mozilla/favicon.d25d81d39065.ico"}
{status: "complete"}

Firefox reports the events from comment 0. The first four are not expected (from the extension's perspective).
To see the internal source of these events, I opened the Browser Toolbox, searched for parent/ext-tabs.js and added a breakpoint in the code that fires the tabs.onUpdated event with value (changed.title || changed.status) && console.log(new Error().stack). Then I called browser.tabs.duplicate to duplicate the test tab. The resulting stack traces are shown below.

From the first three traces, it's obvious that the events are from the initial placeholder tab that is set up before restoring the tab's content. If it isn't too much efforts, we should probably consider hiding these events.

Object { title: "mozilla.org/en-US/privacy/firefox/" } *unexpected

source of listener

listener@chrome://browser/content/parent/ext-tabs.js:348:9
_tabAttrModified@chrome://browser/content/tabbrowser.js:1358:12
_setTabLabel@chrome://browser/content/tabbrowser.js:1524:14
setInitialTabTitle@chrome://browser/content/tabbrowser.js:1424:14
updateTabLabelAndIcon@resource:///modules/sessionstore/SessionStore.jsm:3504:22
restoreTab@resource:///modules/sessionstore/SessionStore.jsm:4810:10
ssi_duplicateTab/<@resource:///modules/sessionstore/SessionStore.jsm:3166:12
promise callback*ssi_duplicateTab@resource:///modules/sessionstore/SessionStore.jsm:3139:36
ss_duplicateTab@resource:///modules/sessionstore/SessionStore.jsm:321:33
duplicateTab@chrome://browser/content/tabbrowser.js:4585:27
duplicate@chrome://browser/content/parent/ext-tabs.js:1096:33

Object { status: "complete", url: "https://www.mozilla.org/en-US/privacy/firefox/" } *unexpected

source of statusListener

statusListener@chrome://browser/content/parent/ext-tabs.js:364:21
onLocationChange@chrome://extensions/content/parent/ext-tabs-base.js:1367:12
callListeners@chrome://browser/content/tabbrowser.js:817:31
_callProgressListeners@chrome://browser/content/tabbrowser.js:837:22
_callProgressListeners@chrome://browser/content/tabbrowser.js:5779:46
onLocationChange@chrome://browser/content/tabbrowser.js:6197:14
_callProgressListeners@resource://gre/modules/RemoteWebProgress.jsm:75:31
onLocationChange@resource://gre/modules/RemoteWebProgress.jsm:119:10

Object { title: "Firefox Privacy Notice — Mozilla" } *unexpected

listener@chrome://browser/content/parent/ext-tabs.js:348:19
_tabAttrModified@chrome://browser/content/tabbrowser.js:1358:12
_setTabLabel@chrome://browser/content/tabbrowser.js:1524:14
setInitialTabTitle@chrome://browser/content/tabbrowser.js:1424:14
updateTabLabelAndIcon@resource:///modules/sessionstore/SessionStore.jsm:3504:22
receiveMessage@resource:///modules/sessionstore/SessionStore.jsm:1408:14
MessageListener.receiveMessage*onLoad/<@resource:///modules/sessionstore/SessionStore.jsm:1634:10
onLoad@resource:///modules/sessionstore/SessionStore.jsm:1632:14
onBeforeBrowserWindowShown@resource:///modules/sessionstore/SessionStore.jsm:1851:10
ssi_observe@resource:///modules/sessionstore/SessionStore.jsm:901:14
onLoad@chrome://browser/content/browser.js:1844:18
EventHandlerNonNull*@chrome://browser/content/browser.xhtml:123:39

Object { title: "mozilla.org/en-US/privacy/firefox/" } *unexpected

listener@chrome://browser/content/parent/ext-tabs.js:348:9
_tabAttrModified@chrome://browser/content/tabbrowser.js:1358:12
_setTabLabel@chrome://browser/content/tabbrowser.js:1524:14
setTabTitle@chrome://browser/content/tabbrowser.js:1490:19
onLocationChange@chrome://browser/content/tabbrowser.js:6146:22
_callProgressListeners@resource://gre/modules/RemoteWebProgress.jsm:75:31
onLocationChange@resource://gre/modules/RemoteWebProgress.jsm:119:10

Object { status: "loading", url: "https://www.mozilla.org/en-US/privacy/firefox/" }

(same stack as previous event triggered from statusListener)

Object { title: "Firefox Privacy Notice — Mozilla" }

listener@chrome://browser/content/parent/ext-tabs.js:348:9
_tabAttrModified@chrome://browser/content/tabbrowser.js:1358:12
_setTabLabel@chrome://browser/content/tabbrowser.js:1524:14
setTabTitle@chrome://browser/content/tabbrowser.js:1490:19
receiveMessage@chrome://browser/content/tabbrowser.js:5129:35
MessageListener.receiveMessage*init@chrome://browser/content/tabbrowser.js:60:24
onDOMContentLoaded@chrome://browser/content/browser.js:1771:14
EventListener.handleEvent*@chrome://browser/content/browser.xhtml:134:10

Object { status: "complete" }

statusListener@chrome://browser/content/parent/ext-tabs.js:364:21
onStateChange@chrome://extensions/content/parent/ext-tabs-base.js:1360:12
callListeners@chrome://browser/content/tabbrowser.js:817:31
_callProgressListeners@chrome://browser/content/tabbrowser.js:837:22
_callProgressListeners@chrome://browser/content/tabbrowser.js:5779:46
onStateChange@chrome://browser/content/tabbrowser.js:6057:12
_callProgressListeners@resource://gre/modules/RemoteWebProgress.jsm:75:31
onStateChange@resource://gre/modules/RemoteWebProgress.jsm:88:10
Flags: needinfo?(rob)
Status: UNCONFIRMED → NEW
Ever confirmed: true
See Also: → 1669356
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: