Title: [238695] trunk/Source/WebCore
Revision
238695
Author
za...@apple.com
Date
2018-11-29 14:22:15 -0800 (Thu, 29 Nov 2018)

Log Message

[ContentObservation] DOMTimer::install should explicitly check if timer observation is on
https://bugs.webkit.org/show_bug.cgi?id=192181

Reviewed by Simon Fraser.

* page/DOMTimer.cpp:
(WebCore::DOMTimer::install):
* platform/ios/wak/WKContentObservation.cpp:
(WKIsObservingDOMTimerScheduling):
* platform/ios/wak/WKContentObservation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238694 => 238695)


--- trunk/Source/WebCore/ChangeLog	2018-11-29 21:58:30 UTC (rev 238694)
+++ trunk/Source/WebCore/ChangeLog	2018-11-29 22:22:15 UTC (rev 238695)
@@ -1,3 +1,16 @@
+2018-11-29  Zalan Bujtas  <za...@apple.com>
+
+        [ContentObservation] DOMTimer::install should explicitly check if timer observation is on
+        https://bugs.webkit.org/show_bug.cgi?id=192181
+
+        Reviewed by Simon Fraser.
+
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::install):
+        * platform/ios/wak/WKContentObservation.cpp:
+        (WKIsObservingDOMTimerScheduling):
+        * platform/ios/wak/WKContentObservation.h:
+
 2018-11-29  Ryosuke Niwa  <rn...@webkit.org>
 
         Executing "insertunorderedlist" while selecting a contenteditable element inside a shadow dom hangs the browser

Modified: trunk/Source/WebCore/page/DOMTimer.cpp (238694 => 238695)


--- trunk/Source/WebCore/page/DOMTimer.cpp	2018-11-29 21:58:30 UTC (rev 238694)
+++ trunk/Source/WebCore/page/DOMTimer.cpp	2018-11-29 22:22:15 UTC (rev 238695)
@@ -220,11 +220,11 @@
     // is destroyed, or if explicitly cancelled by removeById. 
     DOMTimer* timer = new DOMTimer(context, WTFMove(action), timeout, singleShot);
 #if PLATFORM(IOS_FAMILY)
-    if (is<Document>(context)) {
+    if (WKIsObservingDOMTimerScheduling() && is<Document>(context)) {
         bool didDeferTimeout = context.activeDOMObjectsAreSuspended();
         if (!didDeferTimeout && timeout <= 100_ms && singleShot) {
             WKSetObservedContentChange(WKContentIndeterminateChange);
-            WebThreadAddObservedDOMTimer(timer); // Will only take affect if not already visibility change.
+            WebThreadAddObservedDOMTimer(timer);
         }
     }
 #endif

Modified: trunk/Source/WebCore/platform/ios/wak/WKContentObservation.cpp (238694 => 238695)


--- trunk/Source/WebCore/platform/ios/wak/WKContentObservation.cpp	2018-11-29 21:58:30 UTC (rev 238694)
+++ trunk/Source/WebCore/platform/ios/wak/WKContentObservation.cpp	2018-11-29 22:22:15 UTC (rev 238695)
@@ -67,6 +67,11 @@
     _WKObservingDOMTimerScheduling = false;
 }
 
+bool WKIsObservingDOMTimerScheduling(void)
+{
+    return _WKObservingDOMTimerScheduling;
+}
+
 WKContentChange WKObservedContentChange(void)
 {
     return _WKContentChange;
@@ -106,7 +111,8 @@
 
 void WebThreadAddObservedDOMTimer(void* timer)
 {
-    if (_WKContentChange != WKContentVisibilityChange && _WKObservingDOMTimerScheduling)
+    ASSERT(_WKObservingDOMTimerScheduling);
+    if (_WKContentChange != WKContentVisibilityChange)
         WebThreadGetObservedDOMTimers().add(timer);
 }
 

Modified: trunk/Source/WebCore/platform/ios/wak/WKContentObservation.h (238694 => 238695)


--- trunk/Source/WebCore/platform/ios/wak/WKContentObservation.h	2018-11-29 21:58:30 UTC (rev 238694)
+++ trunk/Source/WebCore/platform/ios/wak/WKContentObservation.h	2018-11-29 22:22:15 UTC (rev 238695)
@@ -44,6 +44,7 @@
 
 WEBCORE_EXPORT void WKStartObservingDOMTimerScheduling(void);
 WEBCORE_EXPORT void WKStopObservingDOMTimerScheduling(void);
+WEBCORE_EXPORT bool WKIsObservingDOMTimerScheduling(void);
 
 WEBCORE_EXPORT WKContentChange WKObservedContentChange(void);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to