mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-11-03 13:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Async property on a dynamically-created script is true by default</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test checks the Async property on a dynamically-created script element. By default it should be true." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-script-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
test(function() {assert_true(document.createElement("script").async)}, "Async property on a dynamically-created script is true by default");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Changes to the 'async' attribute are reflected in the async property</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures changes to the 'async' attribute are reflected in the async property." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-script-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
test(function() {
|
||||
var s = document.createElement("script");
|
||||
s.async = false;
|
||||
s.setAttribute('async', ''); /*Should change s.async to true*/
|
||||
assert_true(s.async)
|
||||
}, "Test 'async' attribute are reflected in the async property with setAttribute");
|
||||
|
||||
test(function() {
|
||||
var s = document.createElement("script");
|
||||
s.async = false;
|
||||
s.setAttribute('async', ''); /*Should change s.async to true*/
|
||||
s.removeAttribute('async'); /*Should change s.async to false*/
|
||||
assert_false(s.async)
|
||||
}, "Test 'async' attribute are reflected in the async property with removeAttribute");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>An async script does not block the parser while downloading</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures an async script does not block the parser while downloading." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-script-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("An async script does not block the parser while downloading");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "21")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 4000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
|
||||
<script src="log.py?sec=3&id=1" async></script>
|
||||
<script>
|
||||
log('2');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>An async script executes as soon as possible after a download is complete</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures an async script executes as soon as possible after a download is complete." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-script-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("async script executes as soon as possible after a download is complete");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "21")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 4000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
|
||||
<script src="log.py?sec=3&id=1" async></script>
|
||||
<script src="log.py?sec=1&id=2" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A script element with both async and defer set should execute asynchronously</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures a script element with both async and defer set should execute asynchronously." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-script-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("A script element with both async and defer set should execute asynchronously");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "2134")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 5000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
|
||||
<script type="text/javascript" src="log.py?sec=1&id=1" defer async></script>
|
||||
<script type="text/javascript">log('2');</script>
|
||||
<script type="text/javascript" src="log.py?sec=3&id=3"></script>
|
||||
<script type="text/javascript">log('4');</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>A dynamically created external script executes asynchronously</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures a dynamically created external script executes asynchronously." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#force-async"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("dynamically created external script executes asynchronously");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "321")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 4000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
<script type="text/javascript">
|
||||
var one = document.createElement("script");
|
||||
one.src="log.py?sec=3&id=1";
|
||||
document.head.appendChild(one);
|
||||
|
||||
var two = document.createElement("script");
|
||||
two.src="log.py?sec=1&id=2";
|
||||
document.head.appendChild(two);
|
||||
|
||||
log('3');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ordered async script execution when script.async == false</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures Ordered async script execution when script.async == false" />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#script-processing-src-sync"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("Ordered async script execution when script.async == false");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "312")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 8000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
<script type="text/javascript">
|
||||
var one = document.createElement("script");
|
||||
one.src="log.py?sec=3&id=1";
|
||||
one.async = false;
|
||||
document.head.appendChild(one);
|
||||
|
||||
var two = document.createElement("script");
|
||||
two.src="log.py?sec=1&id=2";
|
||||
two.async = false;
|
||||
document.head.appendChild(two);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
log('3');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Async script element execution delays the window's load event</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures an async script element's execution delays the window's load event." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#delay-the-load-event"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("Async script element execution delays the window's load event");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "213")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 8000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<span id="testresult"></span>
|
||||
<script type="text/javascript">
|
||||
window.addEventListener("load", function() {
|
||||
log("3");
|
||||
timeout();
|
||||
}, false);
|
||||
|
||||
var s1 = document.createElement("script");
|
||||
s1.src = "log.py?sec=2&id=1";
|
||||
document.head.appendChild(s1);
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
log('2');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Document.write() silently fails from an Async script</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures Document.write() silently fails from an Async script." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("Document.write() silently fails from an Async script");
|
||||
|
||||
var log = t.step_func(function() {
|
||||
document.write("<span id='writtenText'/>");
|
||||
assert_equals(null, document.getElementById('writtenText'));
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script type="text/javascript" src="log.py?sec=1&id=1" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Removing an async script before execution</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="This test ensures that an async script still executes if it is removed from a markup before the download is complete. The other two scripts that come after it in insertion order should execute as well." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
var t = async_test("Removing an async script before execution");
|
||||
|
||||
function timeout()
|
||||
{
|
||||
t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "4123")});
|
||||
t.done();
|
||||
}
|
||||
|
||||
var timer = setTimeout(timeout, 8000);
|
||||
|
||||
function log(text)
|
||||
{
|
||||
var textNode = document.createTextNode(text);
|
||||
document.getElementById("testresult").appendChild(textNode);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<span id="testresult"></span>
|
||||
<script type="text/javascript">
|
||||
var s1 = document.createElement("script");
|
||||
s1.src="log.py?sec=2&id=1";
|
||||
s1.async = false;
|
||||
document.body.appendChild(s1);
|
||||
|
||||
var s2 = document.createElement("script");
|
||||
s2.src="log.py?sec=1&id=2";
|
||||
s2.async = false;
|
||||
document.body.appendChild(s2);
|
||||
|
||||
var s3 = document.createElement("script");
|
||||
s3.id = "s3";
|
||||
s3.src="log.py?sec=0&id=3";
|
||||
s3.async = false;
|
||||
document.body.appendChild(s3);
|
||||
|
||||
//Remove s1 (Should still execute)
|
||||
document.body.removeChild(s1);
|
||||
</script>
|
||||
<script type="text/javascript">log('4');</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>An empty parser-inserted script element should return async=true</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta description="An empty parser-inserted script element should return async=true." />
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script></script>
|
||||
<script type="text/javascript">
|
||||
test(function() { assert_true(document.getElementsByTagName("script")[2].async)}, "An empty parser-inserted script element should return async=true");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
{
|
||||
"id": "scriptinglanguages",
|
||||
"original_id": "scriptingLanguages"
|
||||
},
|
||||
{
|
||||
"id": "restrictions-for-contents-of-script-elements",
|
||||
"original_id": "restrictions-for-contents-of-script-elements"
|
||||
},
|
||||
{
|
||||
"id": "inline-documentation-for-external-scripts",
|
||||
"original_id": "inline-documentation-for-external-scripts"
|
||||
},
|
||||
{
|
||||
"id": "scripttagxslt",
|
||||
"original_id": "scriptTagXSLT"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(function() {
|
||||
window.getSomeString = function() {
|
||||
return "śćążź"; //<- these are five Polish letters, similar to scazz. It can be read correctly only with windows 1250 encoding.
|
||||
};
|
||||
})();
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(function() {
|
||||
window.getSomeString = function() {
|
||||
return "œæ¹¿Ÿ"; //<- these are five Polish letters, similar to scazz. It can be read correctly only with windows 1250 encoding.
|
||||
};
|
||||
})();
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Script src with a base URL</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<base href=../beta/>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function do_test(path) {
|
||||
test(function() {
|
||||
assert_equals(path, "beta");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src=test.js></script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
do_test("alpha");
|
||||
|
|
@ -0,0 +1 @@
|
|||
do_test("beta");
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Script src with an empty URL</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<base href=unreachable.js>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
window.unreachable = this.unreached_func("Should not load unreachable.js");
|
||||
var queued = false;
|
||||
var script = document.createElement("script");
|
||||
script.onerror = this.step_func_done(function(ev) {
|
||||
assert_equals(ev.type, "error");
|
||||
assert_false(ev.bubbles, "bubbles");
|
||||
assert_false(ev.cancelable, "cancelable");
|
||||
assert_true(ev.isTrusted, "isTrusted");
|
||||
assert_equals(ev.target, script);
|
||||
assert_true(ev instanceof Event, "instanceof Event");
|
||||
assert_class_string(ev, "Event");
|
||||
assert_true(queued, "event should not be dispatched synchronously");
|
||||
});
|
||||
script.setAttribute("src", "");
|
||||
document.body.appendChild(script);
|
||||
queued = true;
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Script src with an empty URL</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
// For a better error message in case the UA tries to load "" (which resolves
|
||||
// to this document).
|
||||
setup({
|
||||
"allow_uncaught_exception": true,
|
||||
});
|
||||
async_test(function(t) {
|
||||
window.onerror = this.unreached_func("Should not get an error reported to " +
|
||||
"the window before the script");
|
||||
var queued = false;
|
||||
var script = document.createElement("script");
|
||||
script.onerror = this.step_func_done(function(ev) {
|
||||
assert_equals(ev.type, "error");
|
||||
assert_false(ev.bubbles, "bubbles");
|
||||
assert_false(ev.cancelable, "cancelable");
|
||||
assert_true(ev.isTrusted, "isTrusted");
|
||||
assert_equals(ev.target, script);
|
||||
assert_true(ev instanceof Event, "instanceof Event");
|
||||
assert_class_string(ev, "Event");
|
||||
assert_true(queued, "event should not be dispatched synchronously");
|
||||
});
|
||||
script.setAttribute("src", "");
|
||||
document.body.appendChild(script);
|
||||
queued = true;
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Script src with an invalid URL</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var queued = false;
|
||||
var script = document.createElement("script");
|
||||
script.onerror = this.step_func_done(function(ev) {
|
||||
assert_equals(ev.type, "error");
|
||||
assert_false(ev.bubbles, "bubbles");
|
||||
assert_false(ev.cancelable, "cancelable");
|
||||
assert_true(ev.isTrusted, "isTrusted");
|
||||
assert_equals(ev.target, script);
|
||||
assert_true(ev instanceof Event, "instanceof Event");
|
||||
assert_class_string(ev, "Event");
|
||||
assert_true(queued, "event should not be dispatched synchronously");
|
||||
});
|
||||
script.setAttribute("src", "//[]");
|
||||
document.body.appendChild(script);
|
||||
queued = true;
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
unreachable();
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<!doctype html>
|
||||
<title>Historical script element features should not be supported</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
function t(property) {
|
||||
test(function() {
|
||||
assert_false(property in document.createElement('script'));
|
||||
}, 'script.' + property + ' should not be supported');
|
||||
}
|
||||
// added in https://github.com/whatwg/html/commit/69f83cf2eacf4543860ccb7abab0ff5bb1e8b594
|
||||
// removed in https://github.com/whatwg/html/commit/1a0b5e8377d59462e05a5cffda4b8592324a2785
|
||||
t('onbeforescriptexecute');
|
||||
t('onafterscriptexecute');
|
||||
|
||||
var t_onbeforescriptexecute_attr = async_test('onbeforescriptexecute content attribute should not be supported');
|
||||
var t_onafterscriptexecute_attr = async_test('onafterscriptexecute content attribute should not be supported');
|
||||
var t_beforescriptexecute_event = async_test(function() {
|
||||
addEventListener('beforescriptexecute', this.step_func(function() {
|
||||
assert_unreached();
|
||||
}), true);
|
||||
}, 'beforescriptexecute event should not be supported');
|
||||
var t_afterscriptexecute_event = async_test(function() {
|
||||
addEventListener('afterscriptexecute', this.step_func(function() {
|
||||
assert_unreached();
|
||||
}), true);
|
||||
}, 'afterscriptexecute event should not be supported');
|
||||
|
||||
var a = false;
|
||||
|
||||
onload = function() {
|
||||
t_onbeforescriptexecute_attr.step(function() {
|
||||
assert_true(a);
|
||||
this.done();
|
||||
});
|
||||
t_onafterscriptexecute_attr.step(function() {
|
||||
assert_true(a);
|
||||
this.done();
|
||||
});
|
||||
t_beforescriptexecute_event.step(function() {
|
||||
assert_true(a);
|
||||
this.done();
|
||||
});
|
||||
t_afterscriptexecute_event.step(function() {
|
||||
assert_true(a);
|
||||
this.done();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<script onbeforescriptexecute="t_onbeforescriptexecute_attr.step(function() { assert_unreached(); });"
|
||||
onafterscriptexecute="t_onafterscriptexecute_attr.step(function() { assert_unreached(); });">
|
||||
a = true;
|
||||
</script>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#execute-the-script-block">
|
||||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
async_test(function(t) {
|
||||
window.scriptExecuting = function () {
|
||||
setTimeout(t.step_func_done(() => {
|
||||
assert_equals(window.onloadHappened, undefined);
|
||||
}), 0);
|
||||
};
|
||||
}, "load events should not be fired for inline scripts");
|
||||
</script>
|
||||
|
||||
|
||||
<script onload="window.onloadHappened = true;">
|
||||
"use strict";
|
||||
window.scriptExecuting();
|
||||
</script>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import time
|
||||
|
||||
def main(request, response):
|
||||
response.headers.append("Content-Type", "text/javascript")
|
||||
try:
|
||||
script_id = int(request.GET.first("id"))
|
||||
delay = int(request.GET.first("sec"))
|
||||
except:
|
||||
response.set_error(400, "Invalid parameter")
|
||||
|
||||
time.sleep(int(delay))
|
||||
|
||||
return "log('%s')" % script_id
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
milk = request.cookies.first("milk", None)
|
||||
|
||||
if milk is None:
|
||||
return headers, "var included = false;"
|
||||
elif milk.value == "yes":
|
||||
return headers, "var included = true;"
|
||||
|
||||
return headers, "var included = false;"
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Script @type: unknown parameters</title>
|
||||
<link rel="author" title="askalski" href="github.com/askalski">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
|
||||
<!-- "Step1" tests -->
|
||||
<!-- charset is set incorrectly via Content Type "text/javascript;charset=utf-8" in response
|
||||
which has priority before a correct setting in "charset" attribute of script tag.
|
||||
-->
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript%3Bcharset=utf-8" charset="windows-1250">
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
//these strings should not match, since the file charset is set incorrectly
|
||||
assert_not_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
<!-- charset is set correctly via Content Type "text/javascript;charset=utf-8" in response
|
||||
which has priority before a incorrect setting in "charset" attribute of script tag.
|
||||
-->
|
||||
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript%3Bcharset=windows-1250" charset="utf-8">
|
||||
</script>
|
||||
<script>
|
||||
//the charset is set correctly via Content Type "text/javascript;charset=windows-1250" in respones
|
||||
test(function() {
|
||||
assert_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- end of step1 tests, now step2 tests -->
|
||||
<!-- in this case, the response's Content Type does not bring charset information.
|
||||
Second step takes block character encoding if available.-->
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript" charset="utf-8">
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
//these strings should not match, since the file charset is set incorrectly in "charset" tag of <script> above
|
||||
assert_not_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
<!-- charset is set correctly via Content Type "text/javascript;charset=utf-8" in response
|
||||
which has priority before a incorrect setting in "charset" attribute of script tag.
|
||||
-->
|
||||
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript" charset="windows-1250">
|
||||
</script>
|
||||
<script>
|
||||
//the charset is set correctly via content attribute in <script> above
|
||||
test(function() {
|
||||
assert_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- end of step2 tests, now step3 tests -->
|
||||
<!-- in this case, neither response's Content Type nor charset attribute bring correct charset information.
|
||||
Third step takes this document's character encoding (declared correctly as UTF-8).-->
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
//these strings should not match, since the tested file is in windows-1250, and document is utf-8
|
||||
assert_not_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-utf8.js&ct=text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
//these strings should match, both document and tested file are utf-8
|
||||
test(function() {
|
||||
assert_equals(window.getSomeString(), "śćążź");
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- the last portion of tests (step4) are in file script-charset-02.html
|
||||
|
||||
</head>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<!-- TODO:
|
||||
askalski: while this test pass, it does not test anything now.
|
||||
It should test, whether with no document.charset set in any way, the
|
||||
external scripts will get decoded using utf-8 as fallback character encoding.
|
||||
It seems like utf-8 is also a fallback encoding to html (my guess), so
|
||||
the part of the code I was attempting to test is never reached.
|
||||
-->
|
||||
<title>Script @type: unknown parameters</title>
|
||||
<link rel="author" title="askalski" href="github.com/askalski">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
|
||||
<!-- test of step4, which is taking utf-8 as fallback -->
|
||||
<!-- in this case, neither response's Content Type nor charset attribute bring correct charset information.
|
||||
Furthermore, document's encoding is not set.-->
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
//these strings should not match, since the tested file is in windows-1250, and fallback is defined as utf-8
|
||||
assert_not_equals(window.getSomeString().length, 5);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript"
|
||||
src="serve-with-content-type.py?fn=external-script-utf8.js&ct=text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
//these strings should match, since fallback utf-8 is the correct setting.
|
||||
test(function() {
|
||||
assert_equals(window.getSomeString().length, 5);
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Script changing @charset</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var s = document.createElement("script");
|
||||
s.src = "external-script-windows1250.js";
|
||||
s.charset = "windows-1250";
|
||||
document.body.appendChild(s);
|
||||
s.charset = "utf-8";
|
||||
window.onload = this.step_func_done(function() {
|
||||
assert_equals(window.getSomeString(), "\u015b\u0107\u0105\u017c\u017a");
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLScriptElement: crossorigin attribute network test</title>
|
||||
<link rel="author" title="KiChjang" href="mailto:kungfukeith11@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#cors-settings-attribute">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
var test1 = async_test(document.title + "1");
|
||||
var test2 = async_test(document.title + "2");
|
||||
var test3 = async_test(document.title + "3");
|
||||
|
||||
var script1 = document.createElement("script");
|
||||
script1.src = "resources/cross-origin.py";
|
||||
script1.crossOrigin = "use-credentials";
|
||||
var script2 = document.createElement("script");
|
||||
script2.src = "resources/cross-origin.py";
|
||||
script2.crossOrigin = "gibberish";
|
||||
var script3 = document.createElement("script");
|
||||
script3.src = "resources/cross-origin.py";
|
||||
|
||||
document.cookie = "milk=yes";
|
||||
document.body.appendChild(script1);
|
||||
script1.onload = function() {
|
||||
test1.step(function() {
|
||||
assert_true(included, "credentials should be included in script request");
|
||||
test1.done();
|
||||
});
|
||||
};
|
||||
|
||||
document.body.appendChild(script2);
|
||||
script2.onload = function() {
|
||||
test2.step(function() {
|
||||
assert_true(included, "invalid values should default to include credentials due to response tainting");
|
||||
test2.done();
|
||||
});
|
||||
};
|
||||
|
||||
document.body.appendChild(script3);
|
||||
script3.onload = function() {
|
||||
test3.step(function() {
|
||||
assert_true(included, "missing value should default to include credentials");
|
||||
test3.done();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLScriptElement: crossOrigin IDL attribute</title>
|
||||
<link rel="author" title="KiChjang" href="mailto:kungfukeith11@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#cors-settings-attribute">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script id="script1"></script>
|
||||
<script id="script2" crossorigin=""></script>
|
||||
<script id="script3" crossorigin="foo"></script>
|
||||
<script id="script4" crossorigin="anonymous"></script>
|
||||
<script id="script5" crossorigin="use-credentials"></script>
|
||||
<script>
|
||||
test(function() {
|
||||
var script1 = document.getElementById("script1");
|
||||
var script2 = document.getElementById("script2");
|
||||
var script3 = document.getElementById("script3");
|
||||
var script4 = document.getElementById("script4");
|
||||
var script5 = document.getElementById("script5");
|
||||
|
||||
assert_equals(script1.crossOrigin, null, "Missing value default should be null");
|
||||
assert_equals(script2.crossOrigin, "anonymous", "Empty string should map to anonymous");
|
||||
assert_equals(script3.crossOrigin, "anonymous", "Invalid value default should be anonymous");
|
||||
assert_equals(script4.crossOrigin, "anonymous", "anonymous should be parsed correctly");
|
||||
assert_equals(script5.crossOrigin, "use-credentials", "use-credentials should be parsed correctly");
|
||||
|
||||
script1.crossOrigin = "bar";
|
||||
assert_equals(script1.crossOrigin, "anonymous", "Setting to invalid value would default to anonymous");
|
||||
|
||||
script2.crossOrigin = null;
|
||||
assert_equals(script2.crossOrigin, null, "Resetting to null should work");
|
||||
|
||||
script4.crossOrigin = "use-credentials";
|
||||
assert_equals(script4.crossOrigin, "use-credentials", "Switching from anonymous to use-credentials should work");
|
||||
|
||||
script5.crossOrigin = "anonymous";
|
||||
assert_equals(script5.crossOrigin, "anonymous", "Switching from use-credentials to anonymous should work");
|
||||
}, document.title);
|
||||
</script>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Scripts with for and event attributes</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var run = false;
|
||||
</script>
|
||||
<script for="window" event="bar">
|
||||
// This script should not run, but should not cause a parse error either.
|
||||
run = true;
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_false(run, "Script was unexpectedly run.")
|
||||
}, "Scripts with for and event attributes should not run.")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Scripts with for and event attributes</title>
|
||||
<link rel="author" title="Matheus Kerschbaum" href="mailto:matjk7@gmail.com">
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var expected = [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
];
|
||||
var run = expected.map(function() { return false });
|
||||
</script>
|
||||
<script for="wİndow" event="onload">
|
||||
run[0] = true;
|
||||
</script>
|
||||
<script for="window" event="onload x">
|
||||
run[1] = true;
|
||||
</script>
|
||||
<script for="window" event="onload(x">
|
||||
run[2] = true;
|
||||
</script>
|
||||
<script for="window" event="onload(x)">
|
||||
run[3] = true;
|
||||
</script>
|
||||
<script for="window" event="onclick">
|
||||
run[4] = true;
|
||||
</script>
|
||||
<script for="" event="onload">
|
||||
run[5] = true;
|
||||
</script>
|
||||
<script for="window" event="">
|
||||
run[6] = true;
|
||||
</script>
|
||||
<script for="" event="">
|
||||
run[7] = true;
|
||||
</script>
|
||||
<script for=" window" event="onload">
|
||||
run[8] = true;
|
||||
</script>
|
||||
<script for="window " event="onload">
|
||||
run[9] = true;
|
||||
</script>
|
||||
<script for="window" event=" onload">
|
||||
run[10] = true;
|
||||
</script>
|
||||
<script for="window" event="onload ">
|
||||
run[11] = true;
|
||||
</script>
|
||||
<script for=" window " event=" onload ">
|
||||
run[12] = true;
|
||||
</script>
|
||||
<script for=" window " event=" onload() ">
|
||||
run[13] = true;
|
||||
</script>
|
||||
<script for="object" event="handler">
|
||||
run[14] = true;
|
||||
</script>
|
||||
<script event="handler">
|
||||
run[15] = true;
|
||||
</script>
|
||||
<script for="object">
|
||||
run[16] = true;
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
for (var i = 0; i < run.length; ++i) {
|
||||
test(function() {
|
||||
var script = document.querySelectorAll("script[for], script[event]")[i];
|
||||
assert_equals(run[i], expected[i],
|
||||
"script for=" + format_value(script.getAttribute("for")) +
|
||||
" event=" + format_value(script.getAttribute("event")));
|
||||
}, "Script " + i);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script: combinations of @type and @language</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#prepare-a-script">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var run = false;
|
||||
</script>
|
||||
<script type="" language="foo">
|
||||
run = true;
|
||||
</script>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_equals(run, true);
|
||||
}, "A script with empty type should run");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script @type: unknown parameters</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<script type="text/javascript;charset=UTF-8">
|
||||
test(function() {
|
||||
assert_unreached("'charset' should have prevented this script from executing.");
|
||||
})
|
||||
</script>
|
||||
<script type="text/javascript;x-test=abc">
|
||||
test(function() {
|
||||
assert_unreached("'x-test' should have prevented this script from executing.");
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_true(true)
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script @type: JavaScript types</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function testAttribute(attr, val, shouldRun) {
|
||||
test(function() {
|
||||
assert_false(ran, "ran variable not reset");
|
||||
var script = document.createElement("script");
|
||||
script.setAttribute(attr, val);
|
||||
script.textContent = "ran = true;"
|
||||
document.body.appendChild(script);
|
||||
assert_equals(ran, shouldRun);
|
||||
}, "Script should" + (shouldRun ? "" : "n't") + " run with " + attr + "=" + format_value(val));
|
||||
ran = false
|
||||
}
|
||||
function testType(type) {
|
||||
testAttribute("type", type, true);
|
||||
}
|
||||
function testLanguage(lang) {
|
||||
testAttribute("language", lang, true);
|
||||
}
|
||||
function testTypeIgnored(type) {
|
||||
testAttribute("type", type, false);
|
||||
}
|
||||
function testLanguageIgnored(lang) {
|
||||
testAttribute("language", lang, false);
|
||||
}
|
||||
var application = [
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"x-ecmascript",
|
||||
"x-javascript"
|
||||
];
|
||||
var text = [
|
||||
"ecmascript",
|
||||
"javascript",
|
||||
"javascript1.0",
|
||||
"javascript1.1",
|
||||
"javascript1.2",
|
||||
"javascript1.3",
|
||||
"javascript1.4",
|
||||
"javascript1.5",
|
||||
"jscript",
|
||||
"livescript",
|
||||
"x-ecmascript",
|
||||
"x-javascript"
|
||||
];
|
||||
var spaces = [" ", "\t", "\n", "\r", "\f"];
|
||||
|
||||
var ran = false;
|
||||
|
||||
// Type attribute
|
||||
|
||||
testType("");
|
||||
testTypeIgnored(" ");
|
||||
|
||||
application.map(function(t) { return "application/" + t; }).forEach(testType);
|
||||
application.map(function(t) { return ("application/" + t).toUpperCase(); }).forEach(testType);
|
||||
|
||||
spaces.forEach(function(s) {
|
||||
application.map(function(t) { return "application/" + t + s; }).forEach(testType);
|
||||
application.map(function(t) { return s + "application/" + t; }).forEach(testType);
|
||||
})
|
||||
|
||||
application.map(function(t) { return "application/" + t + "\0"; }).forEach(testTypeIgnored);
|
||||
application.map(function(t) { return "application/" + t + "\0foo"; }).forEach(testTypeIgnored);
|
||||
|
||||
text.map(function(t) { return "text/" + t; }).forEach(testType);
|
||||
text.map(function(t) { return ("text/" + t).toUpperCase(); }).forEach(testType);
|
||||
|
||||
spaces.forEach(function(s) {
|
||||
text.map(function(t) { return "text/" + t + s; }).forEach(testType);
|
||||
text.map(function(t) { return s + "text/" + t; }).forEach(testType);
|
||||
})
|
||||
|
||||
text.map(function(t) { return "text/" + t + "\0"; }).forEach(testTypeIgnored);
|
||||
text.map(function(t) { return "text/" + t + "\0foo"; }).forEach(testTypeIgnored);
|
||||
|
||||
// Language attribute
|
||||
|
||||
testLanguage("");
|
||||
testLanguageIgnored(" ");
|
||||
|
||||
text.forEach(testLanguage);
|
||||
text.map(function(t) { return t.toUpperCase(); }).forEach(testLanguage);
|
||||
|
||||
text.map(function(t) { return t + " "; }).forEach(testLanguageIgnored);
|
||||
text.map(function(t) { return " " + t; }).forEach(testLanguageIgnored);
|
||||
text.map(function(t) { return t + "xyz"; }).forEach(testLanguageIgnored);
|
||||
text.map(function(t) { return "xyz" + t; }).forEach(testLanguageIgnored);
|
||||
|
||||
text.map(function(t) { return t + "\0"; }).forEach(testLanguageIgnored);
|
||||
text.map(function(t) { return t + "\0foo"; }).forEach(testLanguageIgnored);
|
||||
</script>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Script inside noembed, noframes and iframe</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var run = [];
|
||||
</script>
|
||||
<div id="test">
|
||||
<noembed>
|
||||
<script>
|
||||
run.push("noembed");
|
||||
</script>
|
||||
</noembed>
|
||||
<noframes>
|
||||
<script>
|
||||
run.push("noframes");
|
||||
</script>
|
||||
</noframes>
|
||||
<iframe>
|
||||
<script>
|
||||
run.push("iframe");
|
||||
</script>
|
||||
</iframe>
|
||||
</div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_array_equals(run, ["noembed", "noframes", "iframe"], "Haven't run.");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Script is not executed after script thread is shutdown</title>
|
||||
<script>
|
||||
onload = function() {
|
||||
script_executed = parent.script_executed;
|
||||
s = document.createElement('script');
|
||||
s.type = 'text/javascript';
|
||||
s.src = 'script-not-executed-after-shutdown.js?pipe=trickle(d3)';
|
||||
document.body.appendChild(s);
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Script is not executed after script thread is shutdown</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe id="testiframe" src="script-not-executed-after-shutdown-child.html"></iframe>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
window.script_executed = t.unreached_func("script executed in removed iframe");
|
||||
let iframe = document.getElementById("testiframe");
|
||||
iframe.onload = function() {
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
};
|
||||
setTimeout(function() {
|
||||
t.done();
|
||||
}, 5000);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
script_executed();
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
body = "test2_token = \"script executed\";"
|
||||
return 200, headers, body
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>var test1_token = "script not executed";</script>
|
||||
<script src="script-not-found-not-executed.py"></script>
|
||||
<script>
|
||||
test(function(){
|
||||
assert_equals(test1_token, "script not executed");
|
||||
}, "Script that 404");
|
||||
</script>
|
||||
<script>var test2_token = "script not executed";</script>
|
||||
<script src="script-not-found-not-executed-2.py"></script>
|
||||
<script>
|
||||
test(function(){
|
||||
assert_equals(test2_token, "script executed");
|
||||
}, "Script that does not 404");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
body = "test1_token = \"script executed\";"
|
||||
return 404, headers, body
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that the insertion point is defined in the error event of a parser-inserted script that actually started a fetch (but just had it fail).</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
var writeDone = t.step_func_done(function(text) {
|
||||
assert_equals(text, "Some text");
|
||||
});
|
||||
</script>
|
||||
<iframe src="support/script-onerror-insertion-point-1-helper.html"></iframe>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that the insertion point is not defined in the error event of a
|
||||
parser-inserted script that has an unparseable URL</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
var writeDone = t.step_func_done(function(text) {
|
||||
assert_equals(text, "text");
|
||||
});
|
||||
</script>
|
||||
<iframe src="support/script-onerror-insertion-point-2-helper.html"></iframe>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that the insertion point is defined in the load event of a parser-inserted script.</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
var t = async_test("");
|
||||
var writeDone = t.step_func_done(function(text) {
|
||||
assert_equals(text, "Some text");
|
||||
});
|
||||
</script>
|
||||
<iframe src="support/script-onload-insertion-point-helper.html"></iframe>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Script: setting onload to a string</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var s = document.createElement("script");
|
||||
assert_equals(s.onload, null);
|
||||
var dummy = function() {};
|
||||
s.onload = dummy;
|
||||
assert_equals(s.onload, dummy);
|
||||
s.onload = "w('load DOM appended')";
|
||||
assert_equals(s.onload, null);
|
||||
}, "Setting onload to a string should convert to null.");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>HTMLScriptElement.text</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-script-text"/>
|
||||
<script src="/resources/testharness.js"/>
|
||||
<script src="/resources/testharnessreport.js"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
<x>7;</x>
|
||||
<![CDATA[
|
||||
var x = "y";
|
||||
]]>
|
||||
</script>
|
||||
<script>
|
||||
var script;
|
||||
setup(function() {
|
||||
script = document.body.getElementsByTagName("script")[0];
|
||||
})
|
||||
test(function() {
|
||||
assert_equals(script.text, '\n\n\n var x = "y";\n\n')
|
||||
assert_equals(script.textContent, '\n7;\n\n var x = "y";\n\n')
|
||||
}, "Getter with CDATA section")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLScriptElement.text</title>
|
||||
<link rel=help href="https://html.spec.whatwg.org/multipage/#dom-script-text">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var script;
|
||||
setup(function() {
|
||||
script = document.createElement("script")
|
||||
script.appendChild(document.createComment("COMMENT"))
|
||||
script.appendChild(document.createTextNode(" TEXT "))
|
||||
script.appendChild(document.createProcessingInstruction("P", "I"))
|
||||
script.appendChild(document.createElement("a"))
|
||||
.appendChild(document.createTextNode("ELEMENT"))
|
||||
})
|
||||
|
||||
test(function() {
|
||||
assert_equals(script.text, " TEXT ")
|
||||
assert_equals(script.textContent, " TEXT ELEMENT")
|
||||
}, "Getter")
|
||||
|
||||
test(function() {
|
||||
script.text = " text "
|
||||
assert_equals(script.text, " text ")
|
||||
assert_equals(script.textContent, " text ")
|
||||
assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
|
||||
assert_equals(script.firstChild.data, " text ")
|
||||
assert_equals(script.firstChild, script.lastChild)
|
||||
assert_array_equals(script.childNodes, [script.firstChild])
|
||||
}, "Setter (non-empty string)")
|
||||
|
||||
test(function() {
|
||||
script.text = ""
|
||||
assert_equals(script.text, "")
|
||||
assert_equals(script.textContent, "")
|
||||
assert_equals(script.firstChild, null)
|
||||
}, "Setter (empty string)")
|
||||
|
||||
test(function() {
|
||||
script.text = null
|
||||
assert_equals(script.text, "null")
|
||||
assert_equals(script.textContent, "null")
|
||||
assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
|
||||
assert_equals(script.firstChild.data, "null")
|
||||
assert_equals(script.firstChild, script.lastChild)
|
||||
}, "Setter (null)")
|
||||
|
||||
test(function() {
|
||||
script.text = undefined
|
||||
assert_equals(script.text, "undefined")
|
||||
assert_equals(script.textContent, "undefined")
|
||||
assert_equals(script.firstChild.nodeType, Node.TEXT_NODE)
|
||||
assert_equals(script.firstChild.data, "undefined")
|
||||
assert_equals(script.firstChild, script.lastChild)
|
||||
}, "Setter (undefined)")
|
||||
|
||||
test(function() {
|
||||
var s = document.createElement("script");
|
||||
var text = document.createTextNode("one");
|
||||
s.appendChild(text);
|
||||
|
||||
assert_equals(s.firstChild, text);
|
||||
assert_equals(text.nodeValue, "one");
|
||||
|
||||
s.text = "two";
|
||||
assert_not_equals(s.firstChild, text);
|
||||
assert_equals(text.nodeValue, "one");
|
||||
assert_equals(s.firstChild.nodeValue, "two");
|
||||
}, "Setter (text node reuse)")
|
||||
</script>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>JS is disabled on documents created without a browsing context</title>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-n-script">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(function(t) {
|
||||
var doc = document.implementation.createHTMLDocument();
|
||||
window.fail_test = t.unreached_func('should not have been called');
|
||||
|
||||
var script = doc.createElement('script');
|
||||
script.textContent = 'fail_test();';
|
||||
doc.documentElement.appendChild(script);
|
||||
}, 'script on document returned by createHTMLDocument should not execute');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import os
|
||||
|
||||
def main(request, response):
|
||||
directory = os.path.dirname(__file__)
|
||||
|
||||
try:
|
||||
file_name = request.GET.first("fn")
|
||||
content_type = request.GET.first("ct")
|
||||
with open(os.path.join(directory, file_name), "rb") as fh:
|
||||
content = fh.read()
|
||||
|
||||
response.headers.set("Content-Type", content_type)
|
||||
response.content = content
|
||||
except:
|
||||
response.set_error(400, "Not enough parameters or file not found")
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Some <script src="nosuchscripthere.js"
|
||||
onerror="document.write('text'); parent.writeDone(document.documentElement.textContent)"></script>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Some <script src="http://this is not parseable"
|
||||
onerror="document.write('text'); parent.writeDone(document.documentElement.textContent)"></script>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Some <script src="script-onload-insertion-point-helper.js"
|
||||
onload="document.write('xt'); parent.writeDone(document.documentElement.textContent)"></script>
|
||||
|
|
@ -0,0 +1 @@
|
|||
document.write("te");
|
||||
Loading…
Add table
Add a link
Reference in a new issue