mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Switch to synchronous script loading
This removes the old code for asyncronously loading scripts during HTML parsing and then executing them afterward. Fixes #3356.
This commit is contained in:
parent
65a0d1fe9a
commit
fe123ad07c
39 changed files with 284 additions and 1006 deletions
|
@ -5,6 +5,64 @@
|
|||
page </title>
|
||||
<base href="./"></base>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="first" name="test">fffff<br><br><br><br>fffffffffffffffff</div>
|
||||
<div id="second">ggg</div>
|
||||
<span id="third" name="test">hhhhhhhh</span>
|
||||
<div id="fourth">iiiiiiiiiiiiiiiiiii</div>
|
||||
<a href="http://www.mozilla.org"></a>
|
||||
<img src="test.jpg"/>
|
||||
<embed></embed>
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>legend</legend>
|
||||
<label for="">label<input type="text" value="input" /></label>
|
||||
</fieldset>
|
||||
</form>
|
||||
<hr />
|
||||
<canvas/>
|
||||
<p>pppppppppp</p>
|
||||
<q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
|
||||
<progress max="100" value="80">80%</progress>
|
||||
<applet></applet>
|
||||
<input type="text" value="input"/>
|
||||
<iframe></iframe>
|
||||
<ol type="1">
|
||||
<li>li</li>
|
||||
</ol>
|
||||
<table>
|
||||
<caption>sample table</caption>
|
||||
<colgroup>
|
||||
<col/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr><th>head</th></tr>
|
||||
<tr><td>data</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<section>section</section>
|
||||
<aside>aside</aside>
|
||||
<b>b</b>
|
||||
<i>i</i>
|
||||
<small>small</small>
|
||||
<textarea>textarea</textarea>
|
||||
<time datetime="2014-02-14">Valentines day</time>
|
||||
<area></area>
|
||||
<data></data>
|
||||
<template></template>
|
||||
<pre>pre</pre>
|
||||
<audio>
|
||||
<source src="horse.ogg" type="audio/ogg">
|
||||
<source src="horse.mp3" type="audio/mpeg">
|
||||
</audio>
|
||||
<video src="">
|
||||
<track></track>
|
||||
</video>
|
||||
|
||||
<foo-á>hi</foo-á>
|
||||
|
||||
<script>
|
||||
function check_collection(obj, num, classes, name) {
|
||||
is_a(obj, HTMLCollection);
|
||||
|
@ -81,63 +139,5 @@ check_tag("foo-á", 1, [HTMLUnknownElement], "FOO-á");
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="first" name="test">fffff<br><br><br><br>fffffffffffffffff</div>
|
||||
<div id="second">ggg</div>
|
||||
<span id="third" name="test">hhhhhhhh</span>
|
||||
<div id="fourth">iiiiiiiiiiiiiiiiiii</div>
|
||||
<a href="http://www.mozilla.org"></a>
|
||||
<img src="test.jpg"/>
|
||||
<embed></embed>
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend>legend</legend>
|
||||
<label for="">label<input type="text" value="input" /></label>
|
||||
</fieldset>
|
||||
</form>
|
||||
<hr />
|
||||
<canvas/>
|
||||
<p>pppppppppp</p>
|
||||
<q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
|
||||
<progress max="100" value="80">80%</progress>
|
||||
<applet></applet>
|
||||
<input type="text" value="input"/>
|
||||
<iframe></iframe>
|
||||
<ol type="1">
|
||||
<li>li</li>
|
||||
</ol>
|
||||
<table>
|
||||
<caption>sample table</caption>
|
||||
<colgroup>
|
||||
<col/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr><th>head</th></tr>
|
||||
<tr><td>data</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<section>section</section>
|
||||
<aside>aside</aside>
|
||||
<b>b</b>
|
||||
<i>i</i>
|
||||
<small>small</small>
|
||||
<textarea>textarea</textarea>
|
||||
<time datetime="2014-02-14">Valentines day</time>
|
||||
<area></area>
|
||||
<data></data>
|
||||
<template></template>
|
||||
<pre>pre</pre>
|
||||
<audio>
|
||||
<source src="horse.ogg" type="audio/ogg">
|
||||
<source src="horse.mp3" type="audio/mpeg">
|
||||
</audio>
|
||||
<video src="">
|
||||
<track></track>
|
||||
</video>
|
||||
|
||||
<foo-á>hi</foo-á>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"><div id="bar"></div></div>
|
||||
<script>
|
||||
let foo = document.getElementById("foo");
|
||||
let doc = document.implementation.createHTMLDocument("title");
|
||||
|
@ -18,8 +21,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"><div id="bar"></div></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var links = document.links;
|
||||
is(links, document.links);
|
||||
|
@ -33,5 +35,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<!-- gNumChanges should be 2 once synchronous script execution is supported -->
|
||||
<body onload="is(document.readyState, 'complete'); is(gNumChanges, 1); finish()">
|
||||
<body onload="is(document.readyState, 'complete'); is(gNumChanges, 2); finish()">
|
||||
<script>
|
||||
gNumChanges = 0;
|
||||
document.addEventListener('readystatechange', function() {
|
||||
gNumChanges++;
|
||||
}, true);
|
||||
is(document.readyState, "interactive");
|
||||
is(document.readyState, "loading");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo-1" class="foo"></div>
|
||||
<div id="foo-2" class="baz"></div>
|
||||
<script>
|
||||
let foo1 = document.getElementById("foo-1");
|
||||
let foo2 = document.getElementById("foo-2");
|
||||
|
@ -30,9 +34,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo-1" class="foo"></div>
|
||||
<div id="foo-2" class="baz"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -3,6 +3,54 @@
|
|||
<head>
|
||||
<title>Tests for :enabled and :disabled selectors</title>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<button id="button-1"></button>
|
||||
<button id="button-2" disabled></button>
|
||||
|
||||
<input id="input-1"></input>
|
||||
<input id="input-2" disabled></input>
|
||||
|
||||
<option id="option-1"></option>
|
||||
<option id="option-2" disabled></option>
|
||||
|
||||
<select id="select-1"></select>
|
||||
<select id="select-2" disabled></select>
|
||||
|
||||
<textarea id="textarea-1"></textarea>
|
||||
<textarea id="textarea-2" disabled></textarea>
|
||||
|
||||
<optgroup disabled>
|
||||
<option id="option-3"></option>
|
||||
</optgroup>
|
||||
|
||||
<fieldset disabled>
|
||||
<fieldset>
|
||||
<button id="button-3"></button>
|
||||
<input id="input-3"></input>
|
||||
<select id="select-3"></select>
|
||||
<textarea id="textarea-3"></textarea>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<fieldset disabled>
|
||||
<legend>
|
||||
<button id="button-4"></button>
|
||||
<input id="input-4"></input>
|
||||
<select id="select-4"></select>
|
||||
<textarea id="textarea-4"></textarea>
|
||||
</legend>
|
||||
</fieldset>
|
||||
|
||||
<fieldset disabled>
|
||||
<legend></legend>
|
||||
<legend>
|
||||
<button id="button-5"></button>
|
||||
<input id="input-5"></input>
|
||||
<select id="select-5"></select>
|
||||
<textarea id="textarea-5"></textarea>
|
||||
</legend>
|
||||
</fieldset>
|
||||
<script>
|
||||
{ // Simple initialization checks.
|
||||
var list, i, elem;
|
||||
|
@ -127,53 +175,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<button id="button-1"></button>
|
||||
<button id="button-2" disabled></button>
|
||||
|
||||
<input id="input-1"></input>
|
||||
<input id="input-2" disabled></input>
|
||||
|
||||
<option id="option-1"></option>
|
||||
<option id="option-2" disabled></option>
|
||||
|
||||
<select id="select-1"></select>
|
||||
<select id="select-2" disabled></select>
|
||||
|
||||
<textarea id="textarea-1"></textarea>
|
||||
<textarea id="textarea-2" disabled></textarea>
|
||||
|
||||
<optgroup disabled>
|
||||
<option id="option-3"></option>
|
||||
</optgroup>
|
||||
|
||||
<fieldset disabled>
|
||||
<fieldset>
|
||||
<button id="button-3"></button>
|
||||
<input id="input-3"></input>
|
||||
<select id="select-3"></select>
|
||||
<textarea id="textarea-3"></textarea>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<fieldset disabled>
|
||||
<legend>
|
||||
<button id="button-4"></button>
|
||||
<input id="input-4"></input>
|
||||
<select id="select-4"></select>
|
||||
<textarea id="textarea-4"></textarea>
|
||||
</legend>
|
||||
</fieldset>
|
||||
|
||||
<fieldset disabled>
|
||||
<legend></legend>
|
||||
<legend>
|
||||
<button id="button-5"></button>
|
||||
<input id="input-5"></input>
|
||||
<select id="select-5"></select>
|
||||
<textarea id="textarea-5"></textarea>
|
||||
</legend>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,25 +1,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
<script>
|
||||
is_function(DOMRect, "DOMRect");
|
||||
|
||||
var elems = document.getElementsByTagName('div');
|
||||
var rect = elems[0].getBoundingClientRect();
|
||||
is_a(rect, DOMRect);
|
||||
|
||||
geq(rect.top, 100);
|
||||
geq(rect.bottom, 200);
|
||||
geq(rect.left, 100);
|
||||
geq(rect.right, 200);
|
||||
|
||||
is(rect.width, 100);
|
||||
is(rect.height, 100);
|
||||
is(rect.width, rect.right - rect.left);
|
||||
is(rect.height, rect.bottom - rect.top);
|
||||
|
||||
finish();
|
||||
</script>
|
||||
<style>
|
||||
div {
|
||||
margin-top: 100px;
|
||||
|
@ -31,5 +12,24 @@ div {
|
|||
</head>
|
||||
<body>
|
||||
<div>my div</div>
|
||||
<script>
|
||||
is_function(DOMRect, "DOMRect");
|
||||
|
||||
var elems = document.getElementsByTagName('div');
|
||||
var rect = elems[0].getBoundingClientRect();
|
||||
is_a(rect, DOMRect);
|
||||
|
||||
geq(rect.top, 100);
|
||||
geq(rect.bottom, 200);
|
||||
geq(rect.left, 100);
|
||||
geq(rect.right, 200);
|
||||
|
||||
is(rect.width, 100);
|
||||
is(rect.height, 100);
|
||||
is(rect.width, rect.right - rect.left);
|
||||
is(rect.height, rect.bottom - rect.top);
|
||||
|
||||
finish();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,17 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo-1" class="foo"></div>
|
||||
<div id="foo-2" class="foo"></div>
|
||||
<div id="bar" class="bar"></div>
|
||||
<div id="live" class="live"></div>
|
||||
<div id="class-example">
|
||||
<p id="p1" class="aaa bbb"/>
|
||||
<p id="p2" class="aaa ccc"/>
|
||||
<p id="p3" class="bbb ccc"/>
|
||||
</div>
|
||||
<script>
|
||||
let foo1 = document.getElementById("foo-1");
|
||||
let foo2 = document.getElementById("foo-2");
|
||||
|
@ -104,16 +115,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo-1" class="foo"></div>
|
||||
<div id="foo-2" class="foo"></div>
|
||||
<div id="bar" class="bar"></div>
|
||||
<div id="live" class="live"></div>
|
||||
<div id="class-example">
|
||||
<p id="p1" class="aaa bbb"/>
|
||||
<p id="p2" class="aaa ccc"/>
|
||||
<p id="p3" class="bbb ccc"/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
<script>
|
||||
is(document.getElementsByClassName("foo").length, 6);
|
||||
is_not(document.getElementById("bar").className, "ggg foo");
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- \u0020 Space -->
|
||||
|
@ -23,5 +18,10 @@
|
|||
<div id="foo-6" class="fff foo"></div>
|
||||
<!-- Non-HTML space character -->
|
||||
<div id="bar" class="gggfoo"></div>
|
||||
<script>
|
||||
is(document.getElementsByClassName("foo").length, 6);
|
||||
is_not(document.getElementById("bar").className, "ggg foo");
|
||||
finish();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"></div>
|
||||
<div id="foo\bar"></div>
|
||||
<div id="foo:bar"></div>
|
||||
<div id="bar" class="myClass"></p>
|
||||
<script>
|
||||
{ // document.querySelector
|
||||
let div = document.getElementById("foo");
|
||||
|
@ -60,11 +66,5 @@
|
|||
}
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"></div>
|
||||
<div id="foo\bar"></div>
|
||||
<div id="foo:bar"></div>
|
||||
<div id="bar" class="myClass"></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="parent">
|
||||
<div id="foo" class="test"></div>
|
||||
<div id="bar" class="test"></div>
|
||||
<div id="baz" class="test"></div>
|
||||
</div>
|
||||
<script>
|
||||
let foo = document.getElementById("foo");
|
||||
let bar = document.getElementById("bar");
|
||||
|
@ -48,12 +55,5 @@
|
|||
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="parent">
|
||||
<div id="foo" class="test"></div>
|
||||
<div id="bar" class="test"></div>
|
||||
<div id="baz" class="test"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -3,22 +3,24 @@
|
|||
<meta charset="utf-8">
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<body onload="test()">
|
||||
<foo-á>foo</foo-á>
|
||||
<script>
|
||||
is_a(window.document, Node);
|
||||
gc(); // ensure that our document rooting works; subsequent accesses should be valid.
|
||||
is_a(window.document, Node);
|
||||
is(window.document.nodeType, Node.DOCUMENT_NODE);
|
||||
is_a(window.document.documentElement, Node);
|
||||
is_a(window.document.documentElement, Element);
|
||||
is_a(window.document.documentElement, HTMLElement);
|
||||
is_a(window.document.documentElement, HTMLHtmlElement);
|
||||
is_a(window.document, Document);
|
||||
is(window.document.documentElement.tagName, "HTML");
|
||||
is_a(window.document.getElementsByTagName('foo-á')[0], HTMLUnknownElement);
|
||||
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
|
||||
finish();
|
||||
function test() {
|
||||
is_a(window.document, Node);
|
||||
gc(); // ensure that our document rooting works; subsequent accesses should be valid.
|
||||
is_a(window.document, Node);
|
||||
is(window.document.nodeType, Node.DOCUMENT_NODE);
|
||||
is_a(window.document.documentElement, Node);
|
||||
is_a(window.document.documentElement, Element);
|
||||
is_a(window.document.documentElement, HTMLElement);
|
||||
is_a(window.document.documentElement, HTMLHtmlElement);
|
||||
is_a(window.document, Document);
|
||||
is(window.document.documentElement.tagName, "HTML");
|
||||
is_a(window.document.getElementsByTagName('foo-á')[0], HTMLUnknownElement);
|
||||
is(window.document.getElementsByTagName('foo-á')[0].tagName, "FOO-á");
|
||||
finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="harness.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div>this is
|
||||
text content</div>
|
||||
<script>
|
||||
var div = document.getElementsByTagName('div')[0];
|
||||
is(div.textContent, "this is\n text content");
|
||||
|
@ -9,9 +13,5 @@
|
|||
is(div.textContent, newContent);
|
||||
finish();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>this is
|
||||
text content</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue