jenkins-bot has submitted this change and it was merged.

Change subject: FocusableNode: Protect against calculateHighlights being called 
on null surface
......................................................................


FocusableNode: Protect against calculateHighlights being called on null surface

This can happen if a debounced call runs after teardown.

Bug: T129549
Change-Id: Ibcadac8c6ee1feabf03822cf9b3f623544e03728
---
M src/ce/ve.ce.FocusableNode.js
1 file changed, 12 insertions(+), 3 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ce/ve.ce.FocusableNode.js b/src/ce/ve.ce.FocusableNode.js
index fcf543f..d2856b3 100644
--- a/src/ce/ve.ce.FocusableNode.js
+++ b/src/ce/ve.ce.FocusableNode.js
@@ -490,11 +490,20 @@
  * Calculate position of highlights
  */
 ve.ce.FocusableNode.prototype.calculateHighlights = function () {
-       var i, l, $set, columnCount, columnWidth,
+       var i, l, $set, columnCount, columnWidth, surfaceOffset,
                rects = [],
                filteredRects = [],
-               webkitColumns = 'webkitColumnCount' in document.createElement( 
'div' ).style,
-               surfaceOffset = 
this.focusableSurface.getSurface().getBoundingClientRect();
+               webkitColumns = 'webkitColumnCount' in document.createElement( 
'div' ).style;
+
+       // Protect against calling before/after surface setup/teardown
+       if ( !this.focusableSurface ) {
+               this.boundingRect = null;
+               this.startAndEndRects = null;
+               this.rects = [];
+               return;
+       }
+
+       surfaceOffset = 
this.focusableSurface.getSurface().getBoundingClientRect();
 
        function contains( rect1, rect2 ) {
                return rect2.left >= rect1.left &&

-- 
To view, visit https://gerrit.wikimedia.org/r/277226
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcadac8c6ee1feabf03822cf9b3f623544e03728
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to