Bug 235930 - Blank page when removing CSS @import
Summary: Blank page when removing CSS @import
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Oriol Brufau
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-31 17:04 PST by Oriol Brufau
Modified: 2022-02-01 08:43 PST (History)
10 users (show)

See Also:


Attachments
Patch (5.74 KB, patch)
2022-01-31 17:11 PST, Oriol Brufau
no flags Details | Formatted Diff | Diff
Patch (5.78 KB, patch)
2022-02-01 04:29 PST, Oriol Brufau
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oriol Brufau 2022-01-31 17:04:28 PST
Run the script from bug 235434:

```html
You should see this text!!!
<script>
const style = document.createElement("style");
document.head.append(style);

style.sheet.insertRule('@import url("nonexist.css")');
style.sheet.cssRules[0];
style.sheet.deleteRule(0);
</script>
```

Actual: completely blank page

Expected: page with "You should see this text!!!"

Reason: the import rule is removed before it finishes loading, and the hasPendingSheet() flag is not cleared.
Comment 1 Oriol Brufau 2022-01-31 17:11:18 PST
Created attachment 450478 [details]
Patch
Comment 2 EWS Watchlist 2022-01-31 17:14:14 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 3 Antti Koivisto 2022-01-31 23:45:16 PST
Comment on attachment 450478 [details]
Patch

looks like the debug bot is hitting assert under StyleRuleImport::cancelLoad
Comment 4 Antti Koivisto 2022-01-31 23:46:10 PST
in imported/w3c/web-platform-tests/css/cssom/cssimportrule-parent.html sonf inspector/css/stylesheet-events-imports.html
Comment 5 Oriol Brufau 2022-02-01 04:29:35 PST
Created attachment 450515 [details]
Patch
Comment 6 Oriol Brufau 2022-02-01 04:31:39 PST
Should work now. It's just that cancelLoad() shouldn't do anything if it had already loaded.
Comment 7 Antti Koivisto 2022-02-01 04:33:51 PST
Comment on attachment 450515 [details]
Patch

Good find, thanks!
Comment 8 Radar WebKit Bug Importer 2022-02-01 04:52:45 PST
<rdar://problem/88322836>
Comment 9 EWS 2022-02-01 08:42:56 PST
Committed r288879 (246631@main): <https://commits.webkit.org/246631@main>

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