1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +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
// ownerDocument (XULDocument)
// defaultView (ChromeWindow)
// gBrowser (tabbrowser)
// gBrowser (tabbrowser OR browser)
// browsers (browser)
// selectedBrowser
// selectedTab
// 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) {
var win, browser;
@ -691,6 +698,12 @@ var tabWatcher = (function() {
if ( !tabbrowser ) {
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 ?
tabbrowser.tabs.indexOf(browser) :
tabbrowser.browsers.indexOf(browser);
@ -2058,7 +2071,7 @@ vAPI.contextMenu.create = function(details, callback) {
if ( gContextMenu.inFrame ) {
details.tagName = 'iframe';
// Probably won't work with e10s
details.frameUrl = gContextMenu.focusedWindow.location.href;
details.frameUrl = gContextMenu.focusedWindow && gContextMenu.focusedWindow.location.href || '';
} else if ( gContextMenu.onImage ) {
details.tagName = 'img';
details.srcUrl = gContextMenu.mediaURL;