Bug 233283 - [CSS Cascade Layers] [Debug] ASSERTION FAILED: m_childRules.isEmpty() when using @import with layer name
Summary: [CSS Cascade Layers] [Debug] ASSERTION FAILED: m_childRules.isEmpty() when us...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antti Koivisto
URL:
Keywords: InRadar
Depends on:
Blocks: 233208
  Show dependency treegraph
 
Reported: 2021-11-17 14:17 PST by Patrick Angle
Modified: 2021-11-19 09:09 PST (History)
9 users (show)

See Also:


Attachments
Reproduction Test Case (1.13 KB, application/zip)
2021-11-17 14:17 PST, Patrick Angle
no flags Details
Patch (4.10 KB, patch)
2021-11-19 03:55 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch (4.05 KB, patch)
2021-11-19 05:03 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Angle 2021-11-17 14:17:00 PST
Created attachment 444573 [details]
Reproduction Test Case

In the process of writing tests for bug 233208, I've run into this assertion in debug builds when I `@import url("./external-layers.css") layer(imported);` in a style tag. I've attached a sample page and external stylesheet the reproduce the issue. The `@import` rule behaves as expected in release builds and imports the styles scoped within the named layer.

Full crash trace:
```
ASSERTION FAILED: m_childRules.isEmpty()
./css/StyleSheetContents.cpp(146) : void WebCore::StyleSheetContents::parserAppendRule(Ref<WebCore::StyleRuleBase> &&)
1   0x4f43daf39 WTFCrash
2   0x506f89dcb WTFCrashWithInfo(int, char const*, char const*, int)
3   0x509dcb63c WebCore::StyleSheetContents::parserAppendRule(WTF::Ref<WebCore::StyleRuleBase, WTF::RawPtrTraits<WebCore::StyleRuleBase> >&&)
4   0x509e1b0f7 WebCore::CSSParserImpl::parseStyleSheet(WTF::String const&, WebCore::CSSParserContext const&, WebCore::StyleSheetContents&, WebCore::CSSParser::RuleParsing)::$_3::operator()(WTF::RefPtr<WebCore::StyleRuleBase, WTF::RawPtrTraits<WebCore::StyleRuleBase>, WTF::DefaultRefDerefTraits<WebCore::StyleRuleBase> >) const
5   0x509e0a011 bool WebCore::CSSParserImpl::consumeRuleList<WebCore::CSSParserImpl::parseStyleSheet(WTF::String const&, WebCore::CSSParserContext const&, WebCore::StyleSheetContents&, WebCore::CSSParser::RuleParsing)::$_3>(WebCore::CSSParserTokenRange, WebCore::CSSParserImpl::RuleListType, WebCore::CSSParserImpl::parseStyleSheet(WTF::String const&, WebCore::CSSParserContext const&, WebCore::StyleSheetContents&, WebCore::CSSParser::RuleParsing)::$_3)
6   0x509e004d1 WebCore::CSSParserImpl::parseStyleSheet(WTF::String const&, WebCore::CSSParserContext const&, WebCore::StyleSheetContents&, WebCore::CSSParser::RuleParsing)
7   0x509e0042b WebCore::CSSParser::parseSheet(WebCore::StyleSheetContents&, WTF::String const&, WebCore::CSSParser::RuleParsing)
8   0x509dcd72e WebCore::StyleSheetContents::parseString(WTF::String const&)
9   0x50a0d4cee WebCore::InlineStyleSheetOwner::createSheet(WebCore::Element&, WTF::String const&)
10  0x50a0d44fe WebCore::InlineStyleSheetOwner::createSheetFromTextContents(WebCore::Element&)
11  0x50a0d468b WebCore::InlineStyleSheetOwner::finishParsingChildren(WebCore::Element&)
12  0x50a4f4b13 WebCore::HTMLStyleElement::finishParsingChildren()
13  0x50a652a18 WebCore::HTMLElementStack::popCommon()
14  0x50a64de4a WebCore::HTMLElementStack::pop()
15  0x50a688f0d WebCore::HTMLTreeBuilder::processEndTag(WebCore::AtomHTMLToken&&)
16  0x50a6855f6 WebCore::HTMLTreeBuilder::processToken(WebCore::AtomHTMLToken&&)
17  0x50a684455 WebCore::HTMLTreeBuilder::constructTree(WebCore::AtomHTMLToken&&)
18  0x50a650d79 WebCore::HTMLDocumentParser::constructTreeFromHTMLToken(WebCore::HTMLTokenizer::TokenPtr&)
19  0x50a650b20 WebCore::HTMLDocumentParser::pumpTokenizerLoop(WebCore::HTMLDocumentParser::SynchronousMode, bool, WebCore::PumpSession&)
20  0x50a64fd38 WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
21  0x50a64f540 WebCore::HTMLDocumentParser::pumpTokenizerIfPossible(WebCore::HTMLDocumentParser::SynchronousMode)
22  0x50a651b27 WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution()
23  0x50a651ebc WebCore::HTMLDocumentParser::notifyFinished(WebCore::PendingScript&)
24  0x50a14a8da WebCore::PendingScript::notifyClientFinished()
25  0x50a14a939 WebCore::PendingScript::notifyFinished(WebCore::LoadableScript&)
26  0x50a0f2673 WebCore::LoadableScript::notifyClientFinished()
27  0x50a0f2493 WebCore::LoadableClassicScript::notifyFinished(WebCore::CachedResource&, WebCore::NetworkLoadMetrics const&)
28  0x50ababa2f WebCore::CachedResource::checkNotify(WebCore::NetworkLoadMetrics const&)
29  0x50ab9f934 WebCore::CachedResource::finishLoading(WebCore::SharedBuffer*, WebCore::NetworkLoadMetrics const&)
30  0x50abda78c WebCore::CachedScript::finishLoading(WebCore::SharedBuffer*, WebCore::NetworkLoadMetrics const&)
31  0x50ab30112 WebCore::SubresourceLoader::didFinishLoading(WebCore::NetworkLoadMetrics const&)
```
Comment 1 Radar WebKit Bug Importer 2021-11-17 14:18:30 PST
<rdar://problem/85520733>
Comment 2 Antti Koivisto 2021-11-19 03:55:07 PST
Created attachment 444799 [details]
Patch
Comment 3 Antti Koivisto 2021-11-19 05:03:00 PST
Created attachment 444803 [details]
Patch
Comment 4 EWS 2021-11-19 09:09:39 PST
Committed r286064 (244451@main): <https://commits.webkit.org/244451@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 444803 [details].