Fix for #1072: Listen to DOMTitleChanged as additional navigation event for Fennec

pull/2/head
AlexVallat 9 years ago committed by gorhill
parent a179821f3d
commit ed43097de8

@ -295,6 +295,8 @@ var windowWatcher = {
if ( tabBrowser.deck ) { if ( tabBrowser.deck ) {
// Fennec // Fennec
tabContainer = tabBrowser.deck; tabContainer = tabBrowser.deck;
tabContainer.addEventListener('DOMTitleChanged', tabWatcher.onFennecLocationChange);
} else if ( tabBrowser.tabContainer ) { } else if ( tabBrowser.tabContainer ) {
// desktop Firefox // desktop Firefox
tabContainer = tabBrowser.tabContainer; tabContainer = tabBrowser.tabContainer;
@ -375,6 +377,23 @@ var tabWatcher = {
url: location.asciiSpec url: location.asciiSpec
}); });
}, },
onFennecLocationChange: function({target: doc}) {
// Fennec "equivalent" to onLocationChange
// note that DOMTitleChanged is selected as it fires very early
// (before DOMContentLoaded), and it does fire even if there is no title
var win = doc.defaultView;
if ( win !== win.top ) {
return;
}
vAPI.tabs.onNavigation({
frameId: 0,
tabId: vAPI.tabs.getTabId(getOwnerWindow(win).BrowserApp.getTabForWindow(win)),
url: Services.io.newURI(win.location.href, null, null).asciiSpec
});
}
}; };
/******************************************************************************/ /******************************************************************************/

Loading…
Cancel
Save