Do not try to observe the timer when Page is nullptr
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2019 00:36:36 +0000 (00:36 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2019 00:36:36 +0000 (00:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195076

Reviewed by Tim Horton.

Covered by fast/dom/Window/timer-null-script-execution-context.html.

* page/DOMTimer.cpp:
(WebCore::DOMTimer::install):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242115 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/DOMTimer.cpp

index d4e5691..745dc29 100644 (file)
@@ -1,3 +1,15 @@
+2019-02-26  Zalan Bujtas  <zalan@apple.com>
+
+        Do not try to observe the timer when Page is nullptr
+        https://bugs.webkit.org/show_bug.cgi?id=195076
+
+        Reviewed by Tim Horton.
+
+        Covered by fast/dom/Window/timer-null-script-execution-context.html.
+
+        * page/DOMTimer.cpp:
+        (WebCore::DOMTimer::install):
+
 2019-02-20  Jer Noble  <jer.noble@apple.com>
 
         [Cocoa] Media elements will restart network buffering just before suspending
index 601a47c..7737e7c 100644 (file)
@@ -222,7 +222,7 @@ int DOMTimer::install(ScriptExecutionContext& context, std::unique_ptr<Scheduled
     if (NestedTimersMap* nestedTimers = NestedTimersMap::instanceForContext(context))
         nestedTimers->add(timer->m_timeoutId, *timer);
 #if PLATFORM(IOS_FAMILY)
-    if (is<Document>(context))
+    if (is<Document>(context) && downcast<Document>(context).page())
         downcast<Document>(context).page()->contentChangeObserver().didInstallDOMTimer(*timer, timeout, singleShot);
 #endif
     return timer->m_timeoutId;