1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 11:18:42 +02:00

this fixes console warning when view-source:

This commit is contained in:
gorhill 2015-06-01 08:11:25 -04:00
parent bd16670824
commit 10740a28ff

View File

@ -415,15 +415,22 @@ vAPI.tabs.registerListeners = function() {
// currentURI // currentURI
// ownerDocument (XULDocument) // ownerDocument (XULDocument)
// defaultView (ChromeWindow) // defaultView (ChromeWindow)
// gBrowser (tabbrowser) // gBrowser (tabbrowser OR browser)
// browsers (browser) // browsers (browser)
// selectedBrowser // selectedBrowser
// selectedTab // selectedTab
// tabs (tab.tabbrowser-tab) // tabs (tab.tabbrowser-tab)
// //
// Fennec: // Fennec: (what I figured so far)
// //
// ??? // tab --> browser windows --> window --> BrowserApp --> tabs --+
// ^ window |
// | |
// +---------------------------------------------------------------+
//
// tab
// browser
// [manual search to go back to tab from list of windows]
vAPI.tabs.get = function(tabId, callback) { vAPI.tabs.get = function(tabId, callback) {
var win, browser; var win, browser;
@ -691,6 +698,12 @@ var tabWatcher = (function() {
if ( !tabbrowser ) { if ( !tabbrowser ) {
return -1; return -1;
} }
// This can happen, for example, the `view-source:` window, there is
// no tabbrowser object, the browser object sits directly in the
// window.
if ( tabbrowser === browser ) {
return 0;
}
return vAPI.fennec ? return vAPI.fennec ?
tabbrowser.tabs.indexOf(browser) : tabbrowser.tabs.indexOf(browser) :
tabbrowser.browsers.indexOf(browser); tabbrowser.browsers.indexOf(browser);
@ -2058,7 +2071,7 @@ vAPI.contextMenu.create = function(details, callback) {
if ( gContextMenu.inFrame ) { if ( gContextMenu.inFrame ) {
details.tagName = 'iframe'; details.tagName = 'iframe';
// Probably won't work with e10s // Probably won't work with e10s
details.frameUrl = gContextMenu.focusedWindow.location.href; details.frameUrl = gContextMenu.focusedWindow && gContextMenu.focusedWindow.location.href || '';
} else if ( gContextMenu.onImage ) { } else if ( gContextMenu.onImage ) {
details.tagName = 'img'; details.tagName = 'img';
details.srcUrl = gContextMenu.mediaURL; details.srcUrl = gContextMenu.mediaURL;