Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/aardvark.js

Issue 29323426: Issue 2878 - Element Hiding Helper is stuck in a bad state after a tab crash (Closed)
Patch Set: Improved comments Created Aug. 10, 2015, 9:09 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/aardvark.js
===================================================================
--- a/lib/aardvark.js
+++ b/lib/aardvark.js
@@ -248,16 +248,21 @@ let Aardvark = exports.Aardvark =
},
onMouseMove: function(event)
{
this.mouseX = event.screenX;
this.mouseY = event.screenY;
this.hideSelection();
+ if (!this.browser)
+ {
+ // hideSelection() called quit()
+ return;
+ }
let x = event.clientX;
let y = event.clientY;
// We might have coordinates relative to a frame, recalculate relative to top window
let node = event.target;
while (node && node.ownerDocument && node.ownerDocument.defaultView && node.ownerDocument.defaultView.frameElement)
{
@@ -388,21 +393,34 @@ let Aardvark = exports.Aardvark =
{
this.prevPos = pos;
this.paintNode.addEventListener("MozAfterPaint", this.onAfterPaint, false);
}
},
hideSelection: function()
{
- if (this.boxElem.parentNode)
- this.boxElem.parentNode.removeChild(this.boxElem);
+ try
+ {
+ if (this.boxElem.parentNode)
+ this.boxElem.parentNode.removeChild(this.boxElem);
+ }
+ catch (e)
+ {
+ // Are we using CPOW whose process is gone? Quit!
+ // Clear some variables to prevent recursion (quit will call us again).
+ this.boxElem = {};
+ this.paintNode = null;
+ this.quit();
+ return;
+ }
if (this.paintNode)
this.paintNode.removeEventListener("MozAfterPaint", this.onAfterPaint, false);
+
this.paintNode = null;
this.prevPos = null;
},
getWindowSize: function(wnd)
{
return [wnd.innerWidth, wnd.document.documentElement.clientHeight];
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld