Bug 897428 - Fix JS error "markupDocumentViewer is undefined" in browser-fullZoom.js. r=gavin

This commit is contained in:
Drew Willcoxon 2013-08-08 20:36:15 -07:00
parent 058a80f632
commit 9f2ee70d3b

View File

@ -439,9 +439,9 @@ var FullZoom = {
* operations that access the given browser's zoom should use this method to
* capture the token before starting and use token.isCurrent to determine if
* it's safe to access the zoom when done. If token.isCurrent is false, then
* the zoom of the browser was changed after the async operation started, and
* depending on what the operation is doing, it may no longer be safe to set
* the zoom or get it to then use in some manner.
* after the async operation started, either the browser's zoom was changed or
* the browser was destroyed, and depending on what the operation is doing, it
* may no longer be safe to set and get its zoom.
*
* @param browser The token of this browser will be returned.
* @return An object with an "isCurrent" getter.
@ -454,7 +454,12 @@ var FullZoom = {
return {
token: map.get(outerID),
get isCurrent() {
return map.get(outerID) === this.token;
// At this point, the browser may have been destructed and unbound but
// its outer ID not removed from the map because outer-window-destroyed
// hasn't been received yet. In that case, the browser is unusable, it
// has no properties, so return false. Check for this case by getting a
// property, say, docShell.
return map.get(outerID) === this.token && browser.docShell;
},
};
},