aboutsummaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-06-01 08:11:25 -0400
committergorhill <rhill@raymondhill.net>2015-06-01 08:11:25 -0400
commit10740a28ff5c7c5966d8a633c3d361227d9985a6 (patch)
treee98e2da679176eaca311512c975d6cb8b0c2814e /platform
parentbd1667082404e66adcbe7777e8219cd172edffb7 (diff)
downloaduBlock-10740a28ff5c7c5966d8a633c3d361227d9985a6.zip
uBlock-10740a28ff5c7c5966d8a633c3d361227d9985a6.tar.gz
uBlock-10740a28ff5c7c5966d8a633c3d361227d9985a6.tar.bz2
this fixes console warning when view-source:
Diffstat (limited to 'platform')
-rw-r--r--platform/firefox/vapi-background.js21
1 files changed, 17 insertions, 4 deletions
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index b8d5bf7..b998548 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -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;