mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibWeb: Implement HTMLOrSVGElement.nonce
There are two FIXMEs remaining that depend on a functional PolicyContainer, which we ignore for now and always behave like a CSP is set.
This commit is contained in:
parent
8dcab69779
commit
84fe8d675b
Notes:
github-actions[bot]
2024-10-31 09:47:17 +00:00
Author: https://github.com/gmta
Commit: 84fe8d675b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2036
Reviewed-by: https://github.com/tcl3
12 changed files with 174 additions and 7 deletions
31
Tests/LibWeb/Text/input/HTML/HTMLOrSVGElement-nonce.html
Normal file
31
Tests/LibWeb/Text/input/HTML/HTMLOrSVGElement-nonce.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const printNonce = (elm) => println(`nonce: "${elm.nonce}" attribute: ${elm.getAttribute('nonce')};`);
|
||||
|
||||
println('generic IDL and attribute interaction');
|
||||
const s1 = document.createElement('script');
|
||||
printNonce(s1);
|
||||
s1.nonce = '123';
|
||||
printNonce(s1);
|
||||
s1.setAttribute('nonce', '456');
|
||||
printNonce(s1);
|
||||
s1.nonce = null;
|
||||
printNonce(s1);
|
||||
|
||||
println('insertion');
|
||||
const s2 = document.createElement('script');
|
||||
s2.setAttribute('nonce', 'foo');
|
||||
printNonce(s2);
|
||||
document.body.appendChild(s2);
|
||||
printNonce(s2);
|
||||
|
||||
println('cloning');
|
||||
const s3 = document.createElement('script');
|
||||
s3.setAttribute('nonce', 'bar');
|
||||
printNonce(s3);
|
||||
const cs3 = s3.cloneNode();
|
||||
printNonce(cs3);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue