www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 12efce878659e8b915e1b02e07f131872dfa7710
parent 51f8c11ea0fa60c9f75797774d0ddd8e230234fa
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 19 May 2011 22:48:26 +0000

A better way of getting browser and window in proxy.js


Diffstat:
Mchrome/content/zotero/xpcom/proxy.js | 13+++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js @@ -398,16 +398,9 @@ Zotero.Proxies = new function() { * @return {Array} Array containing a browser object and a DOM window object */ function _getBrowserAndWindow(notificationCallbacks) { - try { - var pageDOMDocument = notificationCallbacks.getInterface(Components.interfaces.nsIDOMWindow).top.document; - if(!pageDOMDocument) return false; - var enumerator = windowMediator.getZOrderDOMWindowEnumerator("navigator:browser", true); - while(enumerator.hasMoreElements()) { - var window = enumerator.getNext(); - browser = window.gBrowser.getBrowserForDocument(pageDOMDocument); - if(browser) break; - } - } catch(e) {} + var browser = notificationCallbacks.getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell).chromeEventHandler; + var window = browser.ownerDocument.defaultView; return [browser, window]; }