Skip to content

Commit 9bc4205

Browse files
emiliomoz-wptsync-bot
authored andcommitted
Avoid inflating inline stylesheet text just to turn it into utf-8 again.
Most inline stylesheets are actually ascii / use Latin1 storage, so it's faster to just copy it out that to inflate just to deflate it before parsing. Do the same trick we use for <script> elements and CSP and retrieve the two-byte text there instead. Chances are we want to just use the utf-8 text there, since that's what we end up using for the hash / nonce: https://searchfox.org/firefox-main/rev/2916f047242de012d1aa0c572be9e5239644cc48/dom/security/nsCSPUtils.cpp#1020-1021 But plumbing that through gets a bit annoying. Differential Revision: https://phabricator.services.mozilla.com/D320598 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2065672 gecko-commit: d67e01c46a66136be42b53e85251d46a27f35212 gecko-commit-git: a2666940ab8875cce1d1970501f67a5f30efb481 gecko-reviewers: dom-core-reviewers, smaug
1 parent 1d0c771 commit 9bc4205

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!doctype html>
2+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2065672">
3+
<link rel="match" href="/css/reference/green.html">
4+
<style id=s></style>
5+
<script>
6+
s.append(":root{background-color:green}", "/*\u2192*/"); // two text nodes; the 2nd is two-byte
7+
</script>

0 commit comments

Comments
 (0)