A better way of getting browser and window in proxy.js
This commit is contained in:
parent
51f8c11ea0
commit
12efce8786
|
@ -398,16 +398,9 @@ Zotero.Proxies = new function() {
|
||||||
* @return {Array} Array containing a browser object and a DOM window object
|
* @return {Array} Array containing a browser object and a DOM window object
|
||||||
*/
|
*/
|
||||||
function _getBrowserAndWindow(notificationCallbacks) {
|
function _getBrowserAndWindow(notificationCallbacks) {
|
||||||
try {
|
var browser = notificationCallbacks.getInterface(Ci.nsIWebNavigation)
|
||||||
var pageDOMDocument = notificationCallbacks.getInterface(Components.interfaces.nsIDOMWindow).top.document;
|
.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
|
||||||
if(!pageDOMDocument) return false;
|
var window = browser.ownerDocument.defaultView;
|
||||||
var enumerator = windowMediator.getZOrderDOMWindowEnumerator("navigator:browser", true);
|
|
||||||
while(enumerator.hasMoreElements()) {
|
|
||||||
var window = enumerator.getNext();
|
|
||||||
browser = window.gBrowser.getBrowserForDocument(pageDOMDocument);
|
|
||||||
if(browser) break;
|
|
||||||
}
|
|
||||||
} catch(e) {}
|
|
||||||
return [browser, window];
|
return [browser, window];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user