servo: Merge #3929 - Make content tests synchronous by default. Fixes #884 (from jdm:finish); r=larsbergstrom

Source-Repo: https://github.com/servo/servo
Source-Revision: bb7621f5dc33dd5068a3a4de7cdfe3af8b3d4130
This commit is contained in:
Josh Matthews 2014-11-06 22:51:29 -07:00
Родитель 467520dfc0
Коммит 83e2e14c53
72 изменённых файлов: 20 добавлений и 105 удалений

Просмотреть файл

@ -75,6 +75,9 @@ function check_disabled_selector(elem, disabled) {
var _test_complete = false;
var _test_timeout = 10000; //10 seconds
function finish() {
if (_test_complete) {
_fail('finish called multiple times');
}
if (_expectations > _tests) {
_fail('expected ' + _expectations + ' tests, fullfilled ' + _tests);
}
@ -90,3 +93,14 @@ function _test_timed_out() {
}
setTimeout(_test_timed_out, _test_timeout);
var _needs_finish = false;
function waitForExplicitFinish() {
_needs_finish = true;
}
addEventListener('load', function() {
if (!_needs_finish) {
finish();
}
});

Просмотреть файл

@ -6,7 +6,6 @@ is_function(DOMParser, "DOMParser");
let parser = new DOMParser();
is_a(parser, DOMParser);
is_a(parser.parseFromString("", "text/html"), Document);
finish();
</script>
</head>
</html>

Просмотреть файл

@ -11,8 +11,6 @@ is(ev.type, 'foopy');
is(ev.defaultPrevented, false);
ev.preventDefault();
is(ev.defaultPrevented, true);
finish();
</script>
</head>
</html>

Просмотреть файл

@ -11,8 +11,6 @@ is_a(ev, UIEvent);
is_a(ev, MouseEvent);
is(ev.screenX, 150);
is(ev.detail, 100);
finish();
</script>
</head>
</html>

Просмотреть файл

@ -2,6 +2,7 @@
<head>
<script src="harness.js"></script>
<script>
waitForExplicitFinish();
function check_onload(listener) {
is(listener, window);
var ev = new Event('click', {bubbles: true, cancelable: true});

Просмотреть файл

@ -17,7 +17,5 @@
t.caption = newCaption;
is(newCaption.parentNode, t);
is(t.caption, newCaption);
finish();
</script>
</html>

Просмотреть файл

@ -136,8 +136,6 @@ check_tag("video", 1, [HTMLMediaElement, HTMLVideoElement]);
// Test non-ASCII tag names. Uppercasing is ASCII-only per spec:
// http://dom.spec.whatwg.org/#dom-element-tagname
check_tag("foo-á", 1, [HTMLUnknownElement], "FOO-á");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -14,7 +14,6 @@
output += "end";
is(output, "start middle end");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -13,7 +13,6 @@
is_a(elem, HTMLSpanElement);
var text = document.createTextNode("hello");
is_a(text, Text);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -7,7 +7,6 @@ is_a(document.documentElement, HTMLHtmlElement);
is_a(document.documentElement.firstChild, HTMLHeadElement);
is(document.documentElement.nextSibling, null);
is_a(document, Document);
finish();
</script>
</head>
</html>

Просмотреть файл

@ -18,8 +18,6 @@
is(foo.ownerDocument, doc);
is(foo.parentNode, null);
is(foo.childNodes.length, 1);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -66,8 +66,6 @@
new_document.body = new_frameset;
is(new_document.body, new_frameset, "test6-3, append frameset to a new document");
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -14,8 +14,6 @@
var htmldoc = document.implementation.createHTMLDocument("title");
is(htmldoc.characterSet, "utf-8", "test2-2, characterSet");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -8,8 +8,6 @@
// FIXME: https://github.com/mozilla-servo/libhubbub/issues/5
is(document.characterSet, "utf-8", "test1-0, default characterSet");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -8,8 +8,6 @@
{
is(document.characterSet, "utf-8", "test1-0, unknown charset");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -15,7 +15,6 @@
var htmldoc = document.implementation.createHTMLDocument("title");
is(htmldoc.compatMode, "CSS1Compat", "test2-1, Non-parsed documents");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -7,7 +7,6 @@
{
is(document.compatMode, "BackCompat", "test1-0, Loose HTML");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -7,7 +7,6 @@
{
is(document.compatMode, "CSS1Compat", "test1-0, Strict HTML");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -15,8 +15,6 @@
is_a(doc, Document, "test2-0, XML document");
is(doc.contentType, "application/xml", "test2-1, XML document");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -15,6 +15,5 @@
is_a(datalist.options[0], HTMLOptionElement);
is_a(datalist.options[1], HTMLOptionElement);
is_a(datalist.options[2], HTMLOptionElement);
finish();
</script>
</html>

Просмотреть файл

@ -19,8 +19,6 @@
let result = document.getElementById(TEST_ID);
is(result, b, "test 9-0");
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -9,7 +9,6 @@
let nameList = document.getElementsByName("foo");
is_a(nameList, NodeList);
is_not_a(nameList, HTMLCollection);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -40,7 +40,6 @@
foo.appendChild(head);
is(new_document.head, null, "test3-0, head's parent should be document element");
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -74,8 +74,6 @@
is(doc.doctype, doctype, "test4-9, createDocument");
is_a(doc.documentElement, Element, "test4-10, createDocument");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -32,8 +32,6 @@
document.body.removeChild(document.getElementById("anchor-with-href"));
is(links, document.links);
is(links.length, 0);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -4,6 +4,8 @@
</head>
<body onload="is(document.readyState, 'complete'); is(gNumChanges, 2); finish()">
<script>
waitForExplicitFinish();
gNumChanges = 0;
document.addEventListener('readystatechange', function() {
gNumChanges++;

Просмотреть файл

@ -13,7 +13,6 @@
is(div.firstChild.nodeValue, "B");
var commentNode = document.createComment("comment node");
is(commentNode.nodeValue, "comment node");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -4,6 +4,5 @@
<script>
document.head.firstChild.appendChild(document.createElement("foo"));
is(document.title, "x");
finish();
</script>
</html>

Просмотреть файл

@ -23,8 +23,6 @@
is(url[0], "file:", "test3-0, current document");
is(url[url.length-1], "test_document_url.html", "test3-1, current document");
}
finish();
</script>
</head>
<body>

Просмотреть файл

@ -38,8 +38,6 @@
is(classList.contains("bar"), true);
is(classList.contains("baz"), false);
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -59,8 +59,6 @@
should_throw(function () {
test.setAttributeNS("http://www.w3.org/2000/xmlns/", "prefix:attr", "value");
});
finish();
</script>
</body>
</html>

Просмотреть файл

@ -15,7 +15,6 @@
is(attributes[i].name, String.fromCharCode(i + 'a'.charCodeAt(0)));
is(attributes[i].value, (i + 'a'.charCodeAt(0)).toString());
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -12,8 +12,6 @@
is(classList.item(0), null, "classList.item(0) must return null when all classes have been removed");
is(classList[0], undefined, "classList[0] must be undefined when all classes have been removed");
finish();
</script>
</head>
<body>

Просмотреть файл

@ -31,8 +31,6 @@
collection = document.getElementsByClassName("baz");
is(collection.length, 1);
is(collection[0].id, foo2.id);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -11,8 +11,6 @@
is(test.matches("#foo"), true, "test-1");
is(test.matches("#not-foo"), false, "test-2");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -12,7 +12,6 @@ is(rect.right, 0);
is(rect.width, 0);
is(rect.height, 0);
is(rects.length, 0);
finish();
</script>
</head>
</html>

Просмотреть файл

@ -172,8 +172,6 @@
optgroup.removeChild(option);
check_disabled_selector(option, false);
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -44,8 +44,6 @@
is(bodyTimes, 2, 'body listener should be called multiple times');
is(divTimes, 1, 'target listener should be called once');
is(spanTimes, 1, 'span listener should be called while bubbling');
finish();
</script>
</body>
</html>

Просмотреть файл

@ -17,5 +17,4 @@ outerb.addEventListener("x", function() {
innerb.dispatchEvent(new Event("x"));
is(sawmiddle, 1);
is(sawouter, 0);
finish();
</script>

Просмотреть файл

@ -36,7 +36,6 @@
is(sawBubble, true);
is(sawCapture, true);
is(sawBubbleTwice, true);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -16,8 +16,6 @@
is(document.body.getAttribute("onx"), "{");
is(document.body.getAttribute("ony"), "}");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -32,8 +32,6 @@
var ev = new constructors[i]('foopy', {cancelable: true, bubbles: true});
window.dispatchEvent(ev);
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -28,8 +28,6 @@ div {
is(rect.height, 100);
is(rect.width, rect.right - rect.left);
is(rect.height, rect.bottom - rect.top);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -7,7 +7,6 @@ is(window, this);
for (var key in this) {
is(this[key], window[key]);
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -112,8 +112,6 @@
is(from_element.item(0), p1);
is(from_element.item(1), p3);
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -40,6 +40,5 @@
is_a(fs.elements[7], HTMLInputElement);
is_a(fs.elements[8], HTMLOutputElement);
is_a(fs.elements[9], HTMLObjectElement);
finish();
</script>
</html>

Просмотреть файл

@ -21,7 +21,6 @@
<script>
is(document.getElementsByClassName("foo").length, 6);
is_not(document.getElementById("bar").className, "ggg foo");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -4,6 +4,7 @@
</head>
<body onload="is_a(event, Event); finish()">
<script>
waitForExplicitFinish();
</script>
</body>
</html>

Просмотреть файл

@ -5,7 +5,6 @@
var a = document.createElement("div");
a.appendChild(document.createElement("pre")).appendChild(new Text(""));
is(a.innerHTML, "<pre></pre>");
finish();
</script>
</head>
</html>

Просмотреть файл

@ -206,5 +206,4 @@ for (var name of Object.keys(interfaceMap)) {
}
is(Object.keys(interfaceMap).length, 0,
"The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", "));
finish();
</script>

Просмотреть файл

@ -21,8 +21,6 @@
is(Document.prototype.onreadystatechange, undefined, "test2-1, property access returns undefined");
});
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -4,6 +4,8 @@
</head>
<body>
<script>
waitForExplicitFinish();
var onloads = 0;
function check(ev) {
is_a(ev, Event);

Просмотреть файл

@ -14,7 +14,6 @@ is(nav.taintEnabled(), false);
is(nav.appName, "Netscape");
is(nav.appCodeName, "Mozilla");
is(nav.platform, "");
finish();
</script>
</body>
</html>

Просмотреть файл

@ -226,8 +226,6 @@
check_copy(parent, copy, HTMLDivElement);
is(copy.childNodes.length, 0);
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -29,7 +29,6 @@
is(another.compareDocumentPosition(follower), Node.DOCUMENT_POSITION_FOLLOWING);
is(follower.compareDocumentPosition(another), Node.DOCUMENT_POSITION_PRECEDING);
is(follower.compareDocumentPosition(preceder), Node.DOCUMENT_POSITION_PRECEDING);
finish();
}
</script>
</head>

Просмотреть файл

@ -18,8 +18,6 @@
is(parent.contains(child_of_child), true, "test1-2, Node.contains");
is(parent.contains(other), false, "test1-3, Node.contains");
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -17,8 +17,6 @@
is(root.insertBefore(before, after), before, "test1-0, insertBefore");
is(root.childNodes[0], before, "test1-1, insertBefore");
is(root.childNodes[1], after, "test1-2, insertBefore");
finish();
}
</script>
</body>

Просмотреть файл

@ -32,8 +32,6 @@
is(parent_elem.isEqualNode(other_parent), false);
is(child_elem.isEqualNode(other_child), false);
}
finish();
</script>
</head>
</html>

Просмотреть файл

@ -28,8 +28,6 @@
is(parent2.childNodes.length, 0, "Node.normalize removes empty text nodes even if there is only one text node");
is(child2.textContent, "", "Node.normalize doesn't change removed children original content")
is(child3.textContent, "bb", "Node.normalize doesn't change removed children original content")
finish();
</script>
</body>
</html>

Просмотреть файл

@ -45,8 +45,6 @@
is(document.replaceChild(new_elem, doc_elem), doc_elem, "test3-1, documentElement");
is(document.documentElement, new_elem, "test3-2, documentElement");
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -64,7 +64,6 @@
is(docfrag.querySelector(".myClass"), div);
is(docfrag.querySelector("div > div"), child);
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -52,8 +52,6 @@
nodelist = docfrag.querySelectorAll("#foo:nth-child(1)");
is(nodelist.item(0), div);
}
finish();
</script>
</body>
</html>

Просмотреть файл

@ -18,8 +18,6 @@
is(child.parentNode, elem);
is(child.parentElement, elem);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -19,7 +19,6 @@ function test() {
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>

Просмотреть файл

@ -8,7 +8,6 @@
is(window.document.title, '');
window.document.title = 'foo';
is(window.document.title, 'foo');
finish();
</script>
</body>
</html>

Просмотреть файл

@ -92,10 +92,6 @@
<script language="text/javascript">
fail('language is text/javascript');
</script>
<script>
finish();
</script>
</body>
</html>

Просмотреть файл

@ -11,7 +11,6 @@
var newContent = "new text con\ntent";
div.textContent = newContent;
is(div.textContent, newContent);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -6,7 +6,6 @@
is(document.title, "starting title");
document.title = "new title";
is(document.title, "new title");
finish();
</script>
</head>
</html>

Просмотреть файл

@ -3,5 +3,4 @@
<script>
new CustomEvent("foo", { detail: null });
gc();
finish();
</script>

Просмотреть файл

@ -19,8 +19,6 @@
should_throw(function() { sel.add(div) });
should_not_throw(function() { sel.add(optgroup, function() {}) });
finish();
</script>
</head>
</html>

Просмотреть файл

@ -7,7 +7,6 @@
<script>
is(window, window.self);
is_a(window.self, Window);
finish();
</script>
</body>
</html>

Просмотреть файл

@ -22,7 +22,6 @@
gt(next, last);
last = next;
}
finish();
</script>
</body>
</html>