mirror of
https://github.com/servo/servo.git
synced 2025-10-03 10:09:20 +01:00
Block scripts with text/csv, audio/*, video/* and image/* mime types
This commit is contained in:
parent
c31ee6e300
commit
29a56c4d1a
4 changed files with 83 additions and 1 deletions
|
@ -43604,6 +43604,11 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"fetch/api/resources/script-with-header.py": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"fetch/api/resources/status.py": [
|
||||
[
|
||||
{}
|
||||
|
@ -87238,6 +87243,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"fetch/api/basic/block-mime-as-script.html": [
|
||||
[
|
||||
"/fetch/api/basic/block-mime-as-script.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"fetch/api/basic/conditional-get.html": [
|
||||
[
|
||||
"/fetch/api/basic/conditional-get.html",
|
||||
|
@ -163675,6 +163686,10 @@
|
|||
"f6d0b4fe4850c1dda40fab0f83ca04cba49e2e84",
|
||||
"support"
|
||||
],
|
||||
"fetch/api/basic/block-mime-as-script.html": [
|
||||
"1dd503f1537b09f7aa875ea9a636d587b03601e3",
|
||||
"testharness"
|
||||
],
|
||||
"fetch/api/basic/conditional-get.html": [
|
||||
"77822a239b405b0b5c0259a335bac6cbe26b7fed",
|
||||
"testharness"
|
||||
|
@ -164411,6 +164426,10 @@
|
|||
"387c35bf1e576f00a10ce5abb4cc92e78da56845",
|
||||
"support"
|
||||
],
|
||||
"fetch/api/resources/script-with-header.py": [
|
||||
"0c988e869e2e7af06bef67a2eba8211554b38323",
|
||||
"support"
|
||||
],
|
||||
"fetch/api/resources/status.py": [
|
||||
"d521bae08fa1ee19e7bbf4301157703e567ad5c6",
|
||||
"support"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Block mime type as script</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div></div>
|
||||
<script>
|
||||
var noop = function() {};
|
||||
|
||||
["text/csv",
|
||||
"audio/aiff",
|
||||
"audio/midi",
|
||||
"audio/whatever",
|
||||
"video/avi",
|
||||
"video/fli",
|
||||
"video/whatever",
|
||||
"image/jpeg",
|
||||
"image/gif",
|
||||
"image/whatever"].forEach(function(test_case) {
|
||||
async_test(function(t) {
|
||||
var script = document.createElement("script");
|
||||
script.onerror = t.step_func_done(noop);
|
||||
script.onload = t.unreached_func("Unexpected load event");
|
||||
script.src = "../resources/script-with-header.py?mime=" + test_case;
|
||||
document.body.appendChild(script);
|
||||
}, "Should fail loading script with " + test_case + " MIME type");
|
||||
});
|
||||
|
||||
["html", "plain"].forEach(function(test_case) {
|
||||
async_test(function(t) {
|
||||
var script = document.createElement("script");
|
||||
script.onerror = t.unreached_func("Unexpected error event");
|
||||
script.onload = t.step_func_done(noop);
|
||||
script.src = "../resources/script-with-header.py?mime=text/" + test_case;
|
||||
document.body.appendChild(script);
|
||||
}, "Should load script with text/" + test_case + " MIME type");
|
||||
});
|
||||
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-type", request.GET.first("mime"))]
|
||||
content = "console.log('Script loaded')"
|
||||
return 200, headers, content
|
Loading…
Add table
Add a link
Reference in a new issue