Bug 232313 - error event should be fired at <style> element when @import rule fails parsing due to MIME type
Summary: error event should be fired at <style> element when @import rule fails parsin...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-26 09:50 PDT by Chris Dumez
Modified: 2021-10-26 14:37 PDT (History)
13 users (show)

See Also:


Attachments
Patch (5.57 KB, patch)
2021-10-26 09:53 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.82 KB, patch)
2021-10-26 11:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.98 KB, patch)
2021-10-26 13:31 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-10-26 09:50:07 PDT
error event should be fired at <style> element when @import rule fails parsing due to MIME type.
Comment 1 Chris Dumez 2021-10-26 09:53:44 PDT
Created attachment 442501 [details]
Patch
Comment 2 Chris Dumez 2021-10-26 11:19:04 PDT
Created attachment 442512 [details]
Patch
Comment 3 Darin Adler 2021-10-26 13:27:21 PDT
Comment on attachment 442512 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=442512&action=review

> Source/WebCore/css/StyleRuleImport.cpp:78
> +    if (!m_styleSheet->parseAuthorStyleSheet(cachedStyleSheet, document ? &document->securityOrigin() : nullptr)) {

These are so similar I think a boolean for success would be better:

    bool parseSucceeded = m_styleSheet->parseAuthorStyleSheet(cachedStyleSheet, document ? &document->securityOrigin() : nullptr);

    ...

    if (m_parentStyleSheet) {
        if (parseSucceeded)
            m_parentStyleSheet->notifyLoadedSheet(cachedStyleSheet);
        else
            m_parentStyleSheet->setLoadErrorOccured();
        ...
Comment 4 Chris Dumez 2021-10-26 13:31:29 PDT
Created attachment 442523 [details]
Patch
Comment 5 EWS 2021-10-26 14:36:18 PDT
Committed r284898 (243575@main): <https://commits.webkit.org/243575@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 442523 [details].
Comment 6 Radar WebKit Bug Importer 2021-10-26 14:37:19 PDT
<rdar://problem/84681815>