From bc477eeef9212f6f90de40ec096bf83255bf8346 Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 30 Jan 2016 18:17:25 -0600 Subject: [PATCH] Check for onHistoryStateUpdated before use #166 --- background.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/background.js b/background.js index 9077a3a..2d09016 100644 --- a/background.js +++ b/background.js @@ -9,7 +9,10 @@ runTryCatch(function() { // This happens right away, sometimes so fast that the content script isn't even ready. That's // why the content script also asks for this stuff. chrome.webNavigation.onCommitted.addListener(webNavigationListener.bind(this, "styleApply")); -chrome.webNavigation.onHistoryStateUpdated.addListener(webNavigationListener.bind(this, "styleReplaceAll")); +// Not supported in Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1239349 +if ("onHistoryStateUpdated" in chrome.webNavigation) { + chrome.webNavigation.onHistoryStateUpdated.addListener(webNavigationListener.bind(this, "styleReplaceAll")); +} chrome.webNavigation.onBeforeNavigate.addListener(webNavigationListener.bind(this, null)); function webNavigationListener(method, data) { // Until Chrome 41, we can't target a frame with a message