Title: [288617] trunk/Source/WebCore
Revision
288617
Author
[email protected]
Date
2022-01-26 06:35:52 -0800 (Wed, 26 Jan 2022)

Log Message

ASSERTION FAILED: !hasPendingSheets() under WebCore::Style::Scope::~Scope()
https://bugs.webkit.org/show_bug.cgi?id=235612
<rdar://problem/88046988>

Reviewed by Alan Bujtas.

* dom/Document.cpp:
(WebCore::Document::didRemoveAllPendingStylesheet):

Don't try to scroll to anchor if we don't have a view. This avoids hitting ASSERT(!m_inRemovedLastRefFunction)
trying to ref the document during teardown (with refererencing node count still non-zero).

* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::removedFromDocument):

Ensure we always remove the Element from the pending sheet list when it is removed from the document.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288616 => 288617)


--- trunk/Source/WebCore/ChangeLog	2022-01-26 14:13:04 UTC (rev 288616)
+++ trunk/Source/WebCore/ChangeLog	2022-01-26 14:35:52 UTC (rev 288617)
@@ -1,3 +1,22 @@
+2022-01-26  Antti Koivisto  <[email protected]>
+
+        ASSERTION FAILED: !hasPendingSheets() under WebCore::Style::Scope::~Scope()
+        https://bugs.webkit.org/show_bug.cgi?id=235612
+        <rdar://problem/88046988>
+
+        Reviewed by Alan Bujtas.
+
+        * dom/Document.cpp:
+        (WebCore::Document::didRemoveAllPendingStylesheet):
+
+        Don't try to scroll to anchor if we don't have a view. This avoids hitting ASSERT(!m_inRemovedLastRefFunction)
+        trying to ref the document during teardown (with refererencing node count still non-zero).
+
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::InlineStyleSheetOwner::removedFromDocument):
+
+        Ensure we always remove the Element from the pending sheet list when it is removed from the document.
+
 2022-01-26  Jean-Yves Avenard  <[email protected]>
 
         REGRESSION(r287684) speedtest.net uses many GB of memory

Modified: trunk/Source/WebCore/dom/Document.cpp (288616 => 288617)


--- trunk/Source/WebCore/dom/Document.cpp	2022-01-26 14:13:04 UTC (rev 288616)
+++ trunk/Source/WebCore/dom/Document.cpp	2022-01-26 14:35:52 UTC (rev 288617)
@@ -3703,7 +3703,7 @@
     if (RefPtr parser = scriptableDocumentParser())
         parser->executeScriptsWaitingForStylesheetsSoon();
 
-    if (m_gotoAnchorNeededAfterStylesheetsLoad) {
+    if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) {
         // https://html.spec.whatwg.org/multipage/browsing-the-web.html#try-to-scroll-to-the-fragment
         eventLoop().queueTask(TaskSource::Networking, [protectedThis = Ref { *this }, this] {
             RefPtr frameView = view();

Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (288616 => 288617)


--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2022-01-26 14:13:04 UTC (rev 288616)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2022-01-26 14:35:52 UTC (rev 288617)
@@ -96,7 +96,7 @@
 void InlineStyleSheetOwner::removedFromDocument(Element& element)
 {
     if (m_styleScope) {
-        if (m_sheet && m_sheet->isLoading())
+        if (m_styleScope->hasPendingSheet(element))
             m_styleScope->removePendingSheet(element);
         m_styleScope->removeStyleSheetCandidateNode(element);
         m_styleScope = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to