Auto merge of #15011 - nox:load-fixes, r=jdm

Various script loading fixes

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15011)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-14 06:18:31 -08:00 committed by GitHub
commit c2d2c38b0f
21 changed files with 31 additions and 110 deletions

View file

@ -680,6 +680,17 @@ impl HTMLScriptElementMethods for HTMLScriptElement {
// https://html.spec.whatwg.org/multipage/#dom-script-charset
make_setter!(SetCharset, "charset");
// https://html.spec.whatwg.org/multipage/#dom-script-async
fn Async(&self) -> bool {
self.non_blocking.get() || self.upcast::<Element>().has_attribute(&local_name!("async"))
}
// https://html.spec.whatwg.org/multipage/#dom-script-async
fn SetAsync(&self, value: bool) {
self.non_blocking.set(false);
self.upcast::<Element>().set_bool_attribute(&local_name!("async"), value);
}
// https://html.spec.whatwg.org/multipage/#dom-script-defer
make_bool_getter!(Defer, "defer");
// https://html.spec.whatwg.org/multipage/#dom-script-defer

View file

@ -7,7 +7,7 @@ interface HTMLScriptElement : HTMLElement {
attribute DOMString src;
attribute DOMString type;
attribute DOMString charset;
// attribute boolean async;
attribute boolean async;
attribute boolean defer;
attribute DOMString? crossOrigin;
[Pure]

View file

@ -45843,7 +45843,9 @@
]
},
"local_changes": {
"deleted": [],
"deleted": [
"old-tests/submission/Opera/script_scheduling/098.html"
],
"deleted_reftests": {},
"items": {
"testharness": {

View file

@ -1,5 +1,3 @@
[noreferrer.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13400

View file

@ -3849,12 +3849,6 @@
[HTMLDialogElement interface: operation showModal([object Object\],[object Object\])]
expected: FAIL
[HTMLScriptElement interface: attribute async]
expected: FAIL
[HTMLScriptElement interface: document.createElement("script") must inherit property "async" with the proper type (3)]
expected: FAIL
[HTMLCanvasElement interface: operation probablySupportsContext(DOMString,any)]
expected: FAIL

View file

@ -1,5 +0,0 @@
[async_001.htm]
type: testharness
[Async property on a dynamically-created script is true by default]
expected: FAIL

View file

@ -1,5 +0,0 @@
[async_002.htm]
type: testharness
[Test 'async' attribute are reflected in the async property with setAttribute]
expected: FAIL

View file

@ -1,5 +0,0 @@
[async_007.htm]
type: testharness
[Ordered async script execution when script.async == false]
expected: FAIL

View file

@ -1,5 +0,0 @@
[async_010.htm]
type: testharness
[Removing an async script before execution]
expected: FAIL

View file

@ -1,5 +0,0 @@
[async_011.htm]
type: testharness
[An empty parser-inserted script element should return async=true]
expected: FAIL

View file

@ -1,5 +0,0 @@
[091.html]
type: testharness
[ scheduler: force-async off on non-parser-inserted script]
expected: FAIL

View file

@ -1,5 +0,0 @@
[096.html]
type: testharness
[ scheduler: defer script added from document.write relative to DOMContentLoaded]
expected: FAIL

View file

@ -1,5 +0,0 @@
[098.html]
type: testharness
[ scheduler: defer script added from document.write]
expected: FAIL

View file

@ -1,5 +0,0 @@
[105.html]
type: testharness
[ scheduler: adding async attribute at runtime]
expected: FAIL

View file

@ -1,5 +0,0 @@
[122.html]
type: testharness
[Reinserted script async IDL attribute]
expected: FAIL

View file

@ -1,5 +0,0 @@
[123.html]
type: testharness
[scheduler: altering the type attribute and adding/removing external script with async=false ]
expected: FAIL

View file

@ -1,5 +0,0 @@
[126.html]
type: testharness
[scheduler: altering the type attribute and changing script data external script async=false ]
expected: FAIL

View file

@ -1,5 +0,0 @@
[128.html]
type: testharness
[scheduler: appending script element to script ]
expected: FAIL

View file

@ -9,16 +9,22 @@
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<script>
log("inline script #1");
document.write("<script defer src='scripts/include-1.js'><\/script>")
</script>
<script>
log("inline script #1");
document.write("<script defer src='scripts/include-1.js'><\/script>")
</script>
<script>
log("inline script #2");
var t = async_test();
log("inline script #2");
var t = async_test();
addEventListener("DOMContentLoaded", t.step_func(function() {assert_array_equals(eventOrder, ["inline script #1", "inline script #2"])}), false);
addEventListener("DOMContentLoaded", t.step_func(function() {
assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "external script #1"]);
log("inline script #3");
}), false);
onload = t.step_func(function() {assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "external script #1"]); t.done();});
</script>
onload = t.step_func(function() {
assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "external script #1", "inline script #3"]);
t.done();
});
</script>
</body></html>

View file

@ -1,25 +0,0 @@
<!DOCTYPE html>
<html><head>
<title> scheduler: defer script added from document.write</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
</head>
<body>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<script>
log("inline script #1");
document.write("<script defer src='scripts/include-1.js'><\/script>")
</script>
<script>
log("inline script #2");
var t = async_test();
addEventListener("DOMContentLoaded", t.step_func(function() {assert_array_equals(eventOrder, ["inline script #1", "inline script #2"])}), false);
onload = t.step_func(function() {assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "external script #1"]); t.done();});
</script>
</body>
</html>

View file

@ -28,7 +28,7 @@ t.step(function() {
});
onload = t.step_func(function() {
assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "inline script #3", "end inline script #2", "end inline script #1"]);
assert_array_equals(eventOrder, ["inline script #1", "inline script #3", "inline script #2", "end inline script #2", "end inline script #1"]);
t.done();
});
</script>