|
|
@ -269,7 +269,14 @@ var windowWatcher = {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( tabBrowser.tabContainer ) {
|
|
|
|
if ( tabBrowser.deck ) {
|
|
|
|
|
|
|
|
// Fennec
|
|
|
|
|
|
|
|
tabContainer = tabBrowser.deck;
|
|
|
|
|
|
|
|
tabContainer.addEventListener(
|
|
|
|
|
|
|
|
'DOMTitleChanged',
|
|
|
|
|
|
|
|
tabWatcher.onFennecLocationChange
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else if ( tabBrowser.tabContainer ) {
|
|
|
|
// desktop Firefox
|
|
|
|
// desktop Firefox
|
|
|
|
tabContainer = tabBrowser.tabContainer;
|
|
|
|
tabContainer = tabBrowser.tabContainer;
|
|
|
|
tabBrowser.addTabsProgressListener(tabWatcher);
|
|
|
|
tabBrowser.addTabsProgressListener(tabWatcher);
|
|
|
@ -346,6 +353,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: getOwnerWindow(win).getTabForWindow(win).id,
|
|
|
|
|
|
|
|
url: Services.io.newURI(win.location.href, null, null).asciiSpec
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
@ -417,7 +441,14 @@ vAPI.tabs.registerListeners = function() {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( tabBrowser.tabContainer ) {
|
|
|
|
if ( tabBrowser.deck ) {
|
|
|
|
|
|
|
|
// Fennec
|
|
|
|
|
|
|
|
tabContainer = tabBrowser.deck;
|
|
|
|
|
|
|
|
tabContainer.removeEventListener(
|
|
|
|
|
|
|
|
'DOMTitleChanged',
|
|
|
|
|
|
|
|
tabWatcher.onFennecLocationChange
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else if ( tabBrowser.tabContainer ) {
|
|
|
|
tabContainer = tabBrowser.tabContainer;
|
|
|
|
tabContainer = tabBrowser.tabContainer;
|
|
|
|
tabBrowser.removeTabsProgressListener(tabWatcher);
|
|
|
|
tabBrowser.removeTabsProgressListener(tabWatcher);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -451,7 +482,7 @@ vAPI.tabs.getTabId = function(target) {
|
|
|
|
|
|
|
|
|
|
|
|
for ( var win of this.getWindows() ) {
|
|
|
|
for ( var win of this.getWindows() ) {
|
|
|
|
var tab = win.BrowserApp.getTabForBrowser(target);
|
|
|
|
var tab = win.BrowserApp.getTabForBrowser(target);
|
|
|
|
if ( tab && tab.id !== undefined ) {
|
|
|
|
if ( tab && tab.id ) {
|
|
|
|
return tab.id;
|
|
|
|
return tab.id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -562,9 +593,6 @@ vAPI.tabs.get = function(tabId, callback) {
|
|
|
|
var tabIndex = vAPI.fennec
|
|
|
|
var tabIndex = vAPI.fennec
|
|
|
|
? tabBrowser.tabs.indexOf(tab)
|
|
|
|
? tabBrowser.tabs.indexOf(tab)
|
|
|
|
: tabBrowser.browsers.indexOf(browser);
|
|
|
|
: tabBrowser.browsers.indexOf(browser);
|
|
|
|
var tabTitle = vAPI.fennec
|
|
|
|
|
|
|
|
? browser.contentTitle
|
|
|
|
|
|
|
|
: tab.label;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback({
|
|
|
|
callback({
|
|
|
|
id: tabId,
|
|
|
|
id: tabId,
|
|
|
@ -572,7 +600,7 @@ vAPI.tabs.get = function(tabId, callback) {
|
|
|
|
windowId: windows.indexOf(win),
|
|
|
|
windowId: windows.indexOf(win),
|
|
|
|
active: tab === tabBrowser.selectedTab,
|
|
|
|
active: tab === tabBrowser.selectedTab,
|
|
|
|
url: browser.currentURI.asciiSpec,
|
|
|
|
url: browser.currentURI.asciiSpec,
|
|
|
|
title: tabTitle
|
|
|
|
title: tab.label
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -1140,9 +1168,6 @@ var httpObserver = {
|
|
|
|
if ( !(channel instanceof Ci.nsIHttpChannel) ) {
|
|
|
|
if ( !(channel instanceof Ci.nsIHttpChannel) ) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var reqDataKey = location.host + 'reqdata';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var URI = channel.URI;
|
|
|
|
var URI = channel.URI;
|
|
|
|
var channelData, result;
|
|
|
|
var channelData, result;
|
|
|
@ -1160,7 +1185,7 @@ var httpObserver = {
|
|
|
|
frameId,
|
|
|
|
frameId,
|
|
|
|
parentFrameId
|
|
|
|
parentFrameId
|
|
|
|
]*/
|
|
|
|
]*/
|
|
|
|
channelData = channel.getProperty(reqDataKey);
|
|
|
|
channelData = channel.getProperty(location.host + 'reqdata');
|
|
|
|
} catch (ex) {
|
|
|
|
} catch (ex) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1242,14 +1267,6 @@ var httpObserver = {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( lastRequest.type === this.MAIN_FRAME && lastRequest.frameId === 0 ) {
|
|
|
|
|
|
|
|
vAPI.tabs.onNavigation({
|
|
|
|
|
|
|
|
frameId: 0,
|
|
|
|
|
|
|
|
tabId: lastRequest.tabId,
|
|
|
|
|
|
|
|
url: URI.asciiSpec
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( this.handleRequest(channel, URI, lastRequest) ) {
|
|
|
|
if ( this.handleRequest(channel, URI, lastRequest) ) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -1258,7 +1275,7 @@ var httpObserver = {
|
|
|
|
// If request is not handled we may use the data in on-modify-request
|
|
|
|
// If request is not handled we may use the data in on-modify-request
|
|
|
|
if ( channel instanceof Ci.nsIWritablePropertyBag ) {
|
|
|
|
if ( channel instanceof Ci.nsIWritablePropertyBag ) {
|
|
|
|
channel.setProperty(
|
|
|
|
channel.setProperty(
|
|
|
|
reqDataKey,
|
|
|
|
location.host + 'reqdata',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
lastRequest.type,
|
|
|
|
lastRequest.type,
|
|
|
|
lastRequest.tabId,
|
|
|
|
lastRequest.tabId,
|
|
|
|