diff --git a/lib/urlbarbutton.js b/lib/urlbarbutton.js index 71caf57..ebb6e55 100644 --- a/lib/urlbarbutton.js +++ b/lib/urlbarbutton.js @@ -30,7 +30,7 @@ UrlbarButton = function (options) { button, window; for (window in winUtils.windowIterator()) { - if (!href || href === getPageDocument(window.gBrowser.selectedTab).location.href) { + if (!href || (window.gBrowser && href === getPageDocument(window.gBrowser.selectedTab).location.href)) { button = window.document.getElementById(options.id); if (button) { elements.push(button); @@ -136,7 +136,7 @@ UrlbarButton = function (options) { console.log('LocationChange!'); options.onLocationChange.call(tabbrowser.contentDocument, doc.location.href, visibilityCallback.bind(undefined, doc.location.href)); } - }, Ci.nsIWebProgress.NOTIFY_LOCATION); + }); } }, onUntrack: function (tabbrowser) {