Title: [228466] trunk/Source/WebCore
Revision
228466
Author
bfulg...@apple.com
Date
2018-02-14 10:07:17 -0800 (Wed, 14 Feb 2018)

Log Message

Confirm proper thread in UserGestureIndicator constructor
https://bugs.webkit.org/show_bug.cgi?id=175980

Reviewed by Daniel Bates.

Document is a main-thread object. If we enter the UserGestureIndicator constructor
on a non-main thread, we should ASSERT, not return silently.

* dom/UserGestureIndicator.cpp:
(WebCore::UserGestureIndicator::UserGestureIndicator):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (228465 => 228466)


--- trunk/Source/WebCore/ChangeLog	2018-02-14 17:47:15 UTC (rev 228465)
+++ trunk/Source/WebCore/ChangeLog	2018-02-14 18:07:17 UTC (rev 228466)
@@ -1,3 +1,16 @@
+2018-02-14  Brent Fulgham  <bfulg...@apple.com>
+
+        Confirm proper thread in UserGestureIndicator constructor
+        https://bugs.webkit.org/show_bug.cgi?id=175980
+
+        Reviewed by Daniel Bates.
+
+        Document is a main-thread object. If we enter the UserGestureIndicator constructor
+        on a non-main thread, we should ASSERT, not return silently.
+
+        * dom/UserGestureIndicator.cpp:
+        (WebCore::UserGestureIndicator::UserGestureIndicator):
+
 2018-02-14  Zalan Bujtas  <za...@apple.com>
 
         [RenderTreeBuilder] Remove redundant RenderTreeBuilder methods

Modified: trunk/Source/WebCore/dom/UserGestureIndicator.cpp (228465 => 228466)


--- trunk/Source/WebCore/dom/UserGestureIndicator.cpp	2018-02-14 17:47:15 UTC (rev 228465)
+++ trunk/Source/WebCore/dom/UserGestureIndicator.cpp	2018-02-14 18:07:17 UTC (rev 228466)
@@ -47,14 +47,10 @@
 }
 
 UserGestureIndicator::UserGestureIndicator(std::optional<ProcessingUserGestureState> state, Document* document, UserGestureType gestureType, ProcessInteractionStyle processInteractionStyle)
+    : m_previousToken { currentToken() }
 {
-    // Silently ignore UserGestureIndicators on non main threads.
-    if (!isMainThread())
-        return;
+    ASSERT(isMainThread());
 
-    // It is only safe to use currentToken() on the main thread.
-    m_previousToken = currentToken();
-
     if (state)
         currentToken() = UserGestureToken::create(state.value(), gestureType);
 
@@ -68,6 +64,7 @@
 
 UserGestureIndicator::UserGestureIndicator(RefPtr<UserGestureToken> token)
 {
+    // Silently ignore UserGestureIndicators on non main threads.
     if (!isMainThread())
         return;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to