www

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

commit 4f467568fb0488a194a4f5e85f6f3fba7617069a
parent 3c005729906d4fbacc1c3fe7208f120d75ccc547
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun, 11 Jan 2009 10:08:53 +0000

fix frame handling


Diffstat:
Mchrome/content/zotero/browser.js | 24+++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js @@ -360,22 +360,31 @@ var Zotero_Browser = new function() { * called to unregister Zotero icon, etc. */ function contentHide(event) { - if(event.originalTarget instanceof HTMLDocument && !event.originalTarget.defaultView.frameElement) { + if(event.originalTarget instanceof HTMLDocument) { + // Get root document if this is a frameset var doc = event.originalTarget; + var rootDoc = doc; + while(rootDoc.defaultView.frameElement) { + rootDoc = rootDoc.defaultView.frameElement.ownerDocument; + } // Figure out what browser this contentDocument is associated with var browser; for(var i=0; i<this.tabbrowser.browsers.length; i++) { - if(doc == this.tabbrowser.browsers[i].contentDocument) { + if(rootDoc == this.tabbrowser.browsers[i].contentDocument) { browser = this.tabbrowser.browsers[i]; break; } } - // clear data object var tab = _getTabObject(browser); if(!tab) return; - tab.clear(); + if(doc == tab.page.document || doc == rootDoc) { + // clear translator only if the page on which the pagehide event was called is + // either the page to which the translator corresponded, or the root document + // (the second check is probably paranoid, but won't hurt) + tab.clear(); + } // update status if(this.tabbrowser.selectedBrowser == browser) { @@ -581,11 +590,8 @@ Zotero_Browser.Tab.prototype.detectTranslators = function(rootDoc, doc) { // if there's already a scrapable page in the browser window, and it's // still there, ensure it is actually part of the page, then return if(this.page.translators && this.page.translators.length && this.page.document.location) { - if(this._searchFrames(rootDoc, this.page.document)) { - return; - } else { - this.page.document = null; - } + if(this._searchFrames(rootDoc, this.page.document)) return; + this.clear(); } if(doc instanceof HTMLDocument && doc.documentURI.substr(0, 6) != "about:") {