Title: [199227] trunk/Source/WebInspectorUI
Revision
199227
Author
[email protected]
Date
2016-04-08 09:05:20 -0700 (Fri, 08 Apr 2016)

Log Message

Web Inspector: Attempting to dismiss a popover that is already being dismissed causes an error
https://bugs.webkit.org/show_bug.cgi?id=156385
<rdar://problem/25617962>

Reviewed by Timothy Hatcher.

The Popover element is removed from the DOM once it's fade-out transition
completes. Since Popover.dismiss proceeds as long as it's element has a
parent, successive calls to dismiss can run before the popover is removed.

Rather than rely on the presence of the popover in the DOM, set a "dismissing"
flag the first time dismiss is called, before the fade-out animation begins.

* UserInterface/Controllers/BreakpointPopoverController.js:
(WebInspector.BreakpointPopoverController.prototype._conditionCodeMirrorEscapeOrEnterKey):
Check for null popover.

* UserInterface/Views/Popover.js:
(WebInspector.Popover):
(WebInspector.Popover.prototype.dismiss):
Do nothing if already dismissing.

(WebInspector.Popover.prototype.handleEvent):
Reset dismissing flag after style transition completes.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (199226 => 199227)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-04-08 16:04:24 UTC (rev 199226)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-04-08 16:05:20 UTC (rev 199227)
@@ -1,5 +1,32 @@
 2016-04-08  Matt Baker  <[email protected]>
 
+        Web Inspector: Attempting to dismiss a popover that is already being dismissed causes an error
+        https://bugs.webkit.org/show_bug.cgi?id=156385
+        <rdar://problem/25617962>
+
+        Reviewed by Timothy Hatcher.
+
+        The Popover element is removed from the DOM once it's fade-out transition
+        completes. Since Popover.dismiss proceeds as long as it's element has a
+        parent, successive calls to dismiss can run before the popover is removed.
+
+        Rather than rely on the presence of the popover in the DOM, set a "dismissing"
+        flag the first time dismiss is called, before the fade-out animation begins.
+
+        * UserInterface/Controllers/BreakpointPopoverController.js:
+        (WebInspector.BreakpointPopoverController.prototype._conditionCodeMirrorEscapeOrEnterKey):
+        Check for null popover.
+
+        * UserInterface/Views/Popover.js:
+        (WebInspector.Popover):
+        (WebInspector.Popover.prototype.dismiss):
+        Do nothing if already dismissing.
+
+        (WebInspector.Popover.prototype.handleEvent):
+        Reset dismissing flag after style transition completes.
+
+2016-04-08  Matt Baker  <[email protected]>
+
         Web Inspector: Quick Open fails to match pattern "bB" in file "abBc"
         https://bugs.webkit.org/show_bug.cgi?id=156398
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (199226 => 199227)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2016-04-08 16:04:24 UTC (rev 199226)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2016-04-08 16:05:20 UTC (rev 199227)
@@ -246,6 +246,9 @@
 
     _conditionCodeMirrorEscapeOrEnterKey()
     {
+        if (!this._popover)
+            return;
+
         this._popover.dismiss();
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js (199226 => 199227)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js	2016-04-08 16:04:24 UTC (rev 199226)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Popover.js	2016-04-08 16:05:20 UTC (rev 199227)
@@ -38,6 +38,7 @@
         this._preferredEdges = null;
 
         this._contentNeedsUpdate = false;
+        this._dismissing = false;
 
         this._element = document.createElement("div");
         this._element.className = "popover";
@@ -132,9 +133,11 @@
 
     dismiss()
     {
-        if (this._element.parentNode !== document.body)
+        if (this._dismissing || this._element.parentNode !== document.body)
             return;
 
+        this._dismissing = true;
+
         console.assert(this._isListeningForPopoverEvents);
         this._isListeningForPopoverEvents = false;
         window.removeEventListener("mousedown", this, true);
@@ -161,6 +164,8 @@
                 this._container.textContent = "";
                 if (this.delegate && typeof this.delegate.didDismissPopover === "function")
                     this.delegate.didDismissPopover(this);
+
+                this._dismissing = false;
                 break;
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to