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: Created Aug. 10, 2015, 11:45 a.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,18 @@ let Aardvark = exports.Aardvark =
},
onMouseMove: function(event)
{
this.mouseX = event.screenX;
this.mouseY = event.screenY;
this.hideSelection();
+ if (!this.browser)
+ return; // hideSelection() called quit()
saroyanm 2015/08/10 14:58:12 Nit: I think make sense to move comment before if
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 +390,33 @@ 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)
saroyanm 2015/08/10 14:58:12 I wander if this is the only case where we are usi
Wladimir Palant 2015/08/10 21:10:11 No, it's not, and the other places might still pro
+ this.boxElem.parentNode.removeChild(this.boxElem);
+ }
+ catch (e)
+ {
+ // Are we using CPOW whose process is gone? Quit!
+ this.boxElem = {};
saroyanm 2015/08/10 14:58:12 Shouldn't we reset this.boxElem value and paintNod
Wladimir Palant 2015/08/10 21:10:11 No, because quit() will call hideSelection() again
+ 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