Skip to content

Commit

Permalink
Check for onHistoryStateUpdated before use #166
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonBarnabe committed Jan 31, 2016
1 parent a01bdf7 commit bc477ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc477ee

Please sign in to comment.