| Index: safari/ext/popup.js |
| =================================================================== |
| --- a/safari/ext/popup.js |
| +++ b/safari/ext/popup.js |
| @@ -9,11 +9,13 @@ |
| var backgroundPage = safari.extension.globalPage.contentWindow; |
| var readyState = backgroundPage.document.readyState; |
| var activeTab = safari.application.activeBrowserWindow.activeTab; |
| + var stopResizing = function() {}; |
| safari.self.addEventListener("popover", function() |
| { |
| if (activeTab != safari.application.activeBrowserWindow.activeTab || readyState != "complete") |
| { |
| + stopResizing(); |
| document.documentElement.style.display = "none"; |
| document.location.reload(); |
| } |
| @@ -36,13 +38,26 @@ |
| var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; |
| if (MutationObserver) |
| { |
| - new MutationObserver(updateSize).observe(document, { |
| + var mo = new MutationObserver(updateSize); |
| + mo.observe(document, { |
| childList: true, attributes: true, |
| characterData: true, subtree: true |
| }); |
| + |
| + stopResizing = function() |
| + { |
| + mo.disconnect(); |
| + }; |
| } |
| else |
| + { |
| document.addEventListener("DOMSubtreeModified", updateSize); |
| + |
| + stopResizing = function() |
| + { |
| + document.removeEventListener("DOMSubtreeModified", updateSize); |
| + }; |
| + } |
| }); |