Title: [206046] trunk/Source/WebInspectorUI
Revision
206046
Author
commit-qu...@webkit.org
Date
2016-09-16 13:49:16 -0700 (Fri, 16 Sep 2016)

Log Message

Web Inspector: make Object.awaitEvent synchronously add an event listener
https://bugs.webkit.org/show_bug.cgi?id=162066

 Reviewed by Brian Burg.

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2016-09-16

* UserInterface/Base/Object.js:
(WebInspector.Object.awaitEvent):
Utilize a WebInspector.WrappedPromise to not worry about adding the singleFireEventListener
on the next tick due to the promise construction.

* UserInterface/TestStub.html:
Add WebInspector.WrappedPromise.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (206045 => 206046)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-09-16 20:46:58 UTC (rev 206045)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-09-16 20:49:16 UTC (rev 206046)
@@ -1,3 +1,18 @@
+2016-09-16  Devin Rousso  <dcrousso+web...@gmail.com>
+
+        Web Inspector: make Object.awaitEvent synchronously add an event listener
+        https://bugs.webkit.org/show_bug.cgi?id=162066
+
+         Reviewed by Brian Burg.
+
+        * UserInterface/Base/Object.js:
+        (WebInspector.Object.awaitEvent):
+        Utilize a WebInspector.WrappedPromise to not worry about adding the singleFireEventListener
+        on the next tick due to the promise construction.
+
+        * UserInterface/TestStub.html:
+        Add WebInspector.WrappedPromise.
+
 2016-09-16  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Include _javascript_ completion for ES6 keywords and global variables

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (206045 => 206046)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Object.js	2016-09-16 20:46:58 UTC (rev 206045)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Object.js	2016-09-16 20:49:16 UTC (rev 206046)
@@ -100,9 +100,9 @@
 
     static awaitEvent(eventType)
     {
-        return new Promise((resolve, reject) => {
-            this.singleFireEventListener(eventType, (event) => resolve(event), null);
-        });
+        let wrapper = new WebInspector.WrappedPromise;
+        this.singleFireEventListener(eventType, (event) => wrapper.resolve(event));
+        return wrapper.promise;
     }
 
     // Only used by tests.

Modified: trunk/Source/WebInspectorUI/UserInterface/TestStub.html (206045 => 206046)


--- trunk/Source/WebInspectorUI/UserInterface/TestStub.html	2016-09-16 20:46:58 UTC (rev 206045)
+++ trunk/Source/WebInspectorUI/UserInterface/TestStub.html	2016-09-16 20:49:16 UTC (rev 206046)
@@ -37,6 +37,7 @@
 
     <script src=""
     <script src=""
+    <script src=""
 
     <script src=""
     <script src=""
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to