Closed Bug 893689 Opened 11 years ago Closed 11 years ago

Tabs 'ready' event not fired on location change

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: alexander, Assigned: jsantell)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0 (Beta/Release)
Build ID: 20130618035212

Steps to reproduce:

1. Create an add-on using SDK 1.14 with the main.js containing the JavaScript below.
2. Start the add-on, load different URLs in one tab.
3. Navigate backward and forward in the history, observe the console output.

main.js:

let tabs = require('sdk/tabs');
exports.main = function () {
  tabs.on('ready', function (tab) { console.log('tabs ready: ' + tab.url); });
  tabs.activeTab.on('ready', function (tab) { console.log('tab ready: ' + tab.url); });
};



Actual results:

The 'ready' event is fired when the page loads the first time or is reloaded. It is not fired when switching back and forth in the history.


Expected results:

The SDK documentation states that the 'ready' event "will be emitted again if the tab's location changes".
Assignee: nobody → jsantell
The `ready` event is fired via DOMContentReady -- when DOM pages are loaded from hitting back/forward, the content is loaded via bfcache (https://developer.mozilla.org/en-US/docs/Working_with_BFCache) and a DOMContentReady event is not fired. However, a `pageshow` event is fired on the first, and all subsequent visits, even from back/forward.

That being said, the `pageshow` event for tabs was implemented in bug 671305, currently in Beta (Firefox 23).

Does this solve your issue?
Flags: needinfo?(alexander)
I think I can work with this. Thanks!

Should I file a bug against SDK documentation then?
Flags: needinfo?(alexander)
The docs have been updated and will appear on the site with the release of FF23! So this should be available in release, with documentation, in a couple of weeks, or you can check out Firefox Beta. A bug (bug 896311) for declaring a `onPageShow` like one would with `onReady` or `onOpen` has been filed, but using `tabs.on('pageshow')` will work. If you encounter any issues with it, please file another bug and we'll check it out!
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.