From 0f7dc32a5ef0b3c834f762f1b4eff8662254c684 Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 19 Nov 2015 18:51:55 -0500 Subject: [PATCH 1/2] this fixes #948 --- platform/chromium/manifest.json | 2 +- platform/firefox/vapi-background.js | 5 ++++- platform/opera/manifest.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index eae426f1f..a7361b27a 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.3.4", + "version": "1.3.5", "default_locale": "en", "description": "__MSG_extShortDesc__", diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index b622458e8..360cc5aad 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -2240,7 +2240,10 @@ vAPI.net.registerListeners = function() { var browser = e.target; // I have seen this happens (at startup time) - if ( !browser.currentURI ) { + // https://github.com/gorhill/uBlock/issues/948 + // On older version of Firefox, `browser.webNavigation` can be null, + // which would cause currentURI to fail. + if ( !browser.webNavigation || !browser.currentURI ) { return; } diff --git a/platform/opera/manifest.json b/platform/opera/manifest.json index 6814c9635..0ce690e8a 100644 --- a/platform/opera/manifest.json +++ b/platform/opera/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.3.4", + "version": "1.3.5", "default_locale": "en", "description": "__MSG_extShortDesc__", From c4e3e1e8e510aeb5ec7b19c12d09e2c7a4a33832 Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 19 Nov 2015 20:19:15 -0500 Subject: [PATCH 2/2] reportedly this fixes #948 --- platform/firefox/vapi-background.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index 360cc5aad..c9f970dfa 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -2240,10 +2240,7 @@ vAPI.net.registerListeners = function() { var browser = e.target; // I have seen this happens (at startup time) - // https://github.com/gorhill/uBlock/issues/948 - // On older version of Firefox, `browser.webNavigation` can be null, - // which would cause currentURI to fail. - if ( !browser.webNavigation || !browser.currentURI ) { + if ( !browser.currentURI ) { return; } @@ -3278,7 +3275,19 @@ var optionsObserver = { cleanupTasks.push(this.unregister.bind(this)); var browser = tabWatcher.currentBrowser(); - if ( browser && browser.currentURI && browser.currentURI.spec === 'about:addons' ) { + if ( !browser ) { + return; + } + + // https://github.com/gorhill/uBlock/issues/948 + // Older versions of Firefox can throw here when looking up `currentURI`. + var currentURI; + try { + currentURI = browser.currentURI; + } catch (ex) { + } + + if ( currentURI && currentURI.spec === 'about:addons' ) { this.observe(browser.contentDocument, 'addon-enabled', this.addonId); } },