1
0
Fork 0
firefox/dom/security/test/csp/file_image_nonce.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

39 lines
1.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<title>Bug 1355801: Nonce should not apply to images</title>
</head>
<body>
<img id='matchingNonce' src='http://mochi.test:8888/tests/image/test/mochitest/blue.png?a' nonce='abc'></img>
<img id='nonMatchingNonce' src='http://mochi.test:8888/tests/image/test/mochitest/blue.png?b' nonce='bca'></img>
<img id='noNonce' src='http://mochi.test:8888/tests/image/test/mochitest/blue.png?c'></img>
<script type='application/javascript'>
var matchingNonce = document.getElementById('matchingNonce');
matchingNonce.onload = function(e) {
window.parent.postMessage({result: 'img-with-matching-nonce-loaded'}, '*');
};
matchingNonce.onerror = function(e) {
window.parent.postMessage({result: 'img-with-matching-nonce-blocked'}, '*');
}
var nonMatchingNonce = document.getElementById('nonMatchingNonce');
nonMatchingNonce.onload = function(e) {
window.parent.postMessage({result: 'img-with_non-matching-nonce-loaded'}, '*');
};
nonMatchingNonce.onerror = function(e) {
window.parent.postMessage({result: 'img-with_non-matching-nonce-blocked'}, '*');
}
var noNonce = document.getElementById('noNonce');
noNonce.onload = function(e) {
window.parent.postMessage({result: 'img-without-nonce-loaded'}, '*');
};
noNonce.onerror = function(e) {
window.parent.postMessage({result: 'img-without-nonce-blocked'}, '*');
}
</script>
</body>
</html>