Title: [239529] trunk/Source/WebCore
Revision
239529
Author
rn...@webkit.org
Date
2018-12-21 16:28:44 -0800 (Fri, 21 Dec 2018)

Log Message

REGRESSION(r239353): iOS WK1 Assertion failure in notifyChildNodeRemoved while running
TestWebKitAPI.QuickLook.LegacyQuickLookContent
https://bugs.webkit.org/show_bug.cgi?id=192859
<rdar://problem/46887237>

Reviewed by Antti Koivisto.

After r239353, ScriptDisallowedScope::InMainThread::isScriptAllowed() may return false when the web thread
is inside a delegate callback even when there is a ScriptDisallowedScope defined.

Replace the existign debug assertions which assert !ScriptDisallowedScope::InMainThread::isScriptAllowed()
by a newly added ScriptDisallowedScope::InMainThread::hasDisallowedScope to avoid hitting this assertion.

Tests: TestWebKitAPI.QuickLook.LegacyQuickLookContent

* dom/ContainerNodeAlgorithms.cpp:
(WebCore::notifyChildNodeInserted):
(WebCore::notifyChildNodeRemoved):
* dom/Document.cpp:
(WebCore::Document::nodeChildrenWillBeRemoved):
(WebCore::Document::nodeWillBeRemoved):
* dom/ScriptDisallowedScope.h:
(WebCore::ScriptDisallowedScope::InMainThread::hasDisallowedScope):
* html/HTMLFormElement.cpp:
(WebCore:: const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239528 => 239529)


--- trunk/Source/WebCore/ChangeLog	2018-12-22 00:26:28 UTC (rev 239528)
+++ trunk/Source/WebCore/ChangeLog	2018-12-22 00:28:44 UTC (rev 239529)
@@ -1,3 +1,31 @@
+2018-12-20  Ryosuke Niwa  <rn...@webkit.org>
+
+        REGRESSION(r239353): iOS WK1 Assertion failure in notifyChildNodeRemoved while running
+        TestWebKitAPI.QuickLook.LegacyQuickLookContent
+        https://bugs.webkit.org/show_bug.cgi?id=192859
+        <rdar://problem/46887237>
+
+        Reviewed by Antti Koivisto.
+
+        After r239353, ScriptDisallowedScope::InMainThread::isScriptAllowed() may return false when the web thread
+        is inside a delegate callback even when there is a ScriptDisallowedScope defined.
+
+        Replace the existign debug assertions which assert !ScriptDisallowedScope::InMainThread::isScriptAllowed()
+        by a newly added ScriptDisallowedScope::InMainThread::hasDisallowedScope to avoid hitting this assertion.
+
+        Tests: TestWebKitAPI.QuickLook.LegacyQuickLookContent
+
+        * dom/ContainerNodeAlgorithms.cpp:
+        (WebCore::notifyChildNodeInserted):
+        (WebCore::notifyChildNodeRemoved):
+        * dom/Document.cpp:
+        (WebCore::Document::nodeChildrenWillBeRemoved):
+        (WebCore::Document::nodeWillBeRemoved):
+        * dom/ScriptDisallowedScope.h:
+        (WebCore::ScriptDisallowedScope::InMainThread::hasDisallowedScope):
+        * html/HTMLFormElement.cpp:
+        (WebCore:: const):
+
 2018-12-21  Joseph Pecoraro  <pecor...@apple.com>
 
         Update status of some WebCore features in features.json

Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (239528 => 239529)


--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2018-12-22 00:26:28 UTC (rev 239528)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2018-12-22 00:28:44 UTC (rev 239529)
@@ -88,7 +88,7 @@
 
 NodeVector notifyChildNodeInserted(ContainerNode& parentOfInsertedTree, Node& node)
 {
-    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
+    ASSERT(ScriptDisallowedScope::InMainThread::hasDisallowedScope());
 
     InspectorInstrumentation::didInsertDOMNode(node.document(), node);
 
@@ -152,7 +152,7 @@
 void notifyChildNodeRemoved(ContainerNode& oldParentOfRemovedTree, Node& child)
 {
     // Assert that the caller of this function has an instance of ScriptDisallowedScope.
-    ASSERT(!isMainThread() || !ScriptDisallowedScope::InMainThread::isScriptAllowed());
+    ASSERT(!isMainThread() || ScriptDisallowedScope::InMainThread::hasDisallowedScope());
     ContainerChildRemovalScope removalScope(oldParentOfRemovedTree, child);
 
     // Tree scope has changed if the container node from which "node" is removed is in a document or a shadow root.

Modified: trunk/Source/WebCore/dom/Document.cpp (239528 => 239529)


--- trunk/Source/WebCore/dom/Document.cpp	2018-12-22 00:26:28 UTC (rev 239528)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-12-22 00:28:44 UTC (rev 239529)
@@ -4358,7 +4358,7 @@
 
 void Document::nodeChildrenWillBeRemoved(ContainerNode& container)
 {
-    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
+    ASSERT(ScriptDisallowedScope::InMainThread::hasDisallowedScope());
 
     adjustFocusedNodeOnNodeRemoval(container, NodeRemoval::ChildrenOfNode);
     adjustFocusNavigationNodeOnNodeRemoval(container, NodeRemoval::ChildrenOfNode);
@@ -4391,7 +4391,7 @@
 
 void Document::nodeWillBeRemoved(Node& node)
 {
-    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
+    ASSERT(ScriptDisallowedScope::InMainThread::hasDisallowedScope());
 
     adjustFocusedNodeOnNodeRemoval(node);
     adjustFocusNavigationNodeOnNodeRemoval(node);

Modified: trunk/Source/WebCore/dom/ScriptDisallowedScope.h (239528 => 239529)


--- trunk/Source/WebCore/dom/ScriptDisallowedScope.h	2018-12-22 00:26:28 UTC (rev 239528)
+++ trunk/Source/WebCore/dom/ScriptDisallowedScope.h	2018-12-22 00:28:44 UTC (rev 239529)
@@ -87,6 +87,12 @@
 #endif
         }
 
+        static bool hasDisallowedScope()
+        {
+            ASSERT(isMainThread());
+            return s_count;
+        }
+
         static bool isScriptAllowed()
         {
             ASSERT(isMainThread());

Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (239528 => 239529)


--- trunk/Source/WebCore/html/HTMLFormElement.cpp	2018-12-22 00:26:28 UTC (rev 239528)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp	2018-12-22 00:28:44 UTC (rev 239529)
@@ -863,7 +863,7 @@
 
 const Vector<FormAssociatedElement*>& HTMLFormElement::unsafeAssociatedElements() const
 {
-    ASSERT(!ScriptDisallowedScope::InMainThread::isScriptAllowed());
+    ASSERT(ScriptDisallowedScope::InMainThread::hasDisallowedScope());
     return m_associatedElements;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to