mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Rewrite scrollingElement.html to fail reliably when URL.createObjectURL is not implemented.
This commit is contained in:
parent
17ffc6cf71
commit
5fc5891e04
2 changed files with 21 additions and 30 deletions
|
@ -1,5 +1,8 @@
|
||||||
[scrollingElement.html]
|
[scrollingElement.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
[Tests for scrollingElement]
|
[scrollingElement in quirks mode]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[scrollingElement in no-quirks mode]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -7,34 +7,12 @@
|
||||||
<iframe id="nonquirksframe"></iframe>
|
<iframe id="nonquirksframe"></iframe>
|
||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
<script>
|
<script>
|
||||||
|
async_test(function() {
|
||||||
var quirksFrame;
|
var quirksFrame = document.getElementById("quirksframe");
|
||||||
var nonQuirksFrame;
|
quirksFrame.onload = this.step_func(function() {
|
||||||
|
|
||||||
function loadTestFrames(callback) {
|
|
||||||
quirksFrame = document.getElementById("quirksframe");
|
|
||||||
quirksFrame.onload = function() {
|
|
||||||
nonQuirksFrame = document.getElementById("nonquirksframe");
|
|
||||||
nonQuirksFrame.onload = callback;
|
|
||||||
nonQuirksFrame.src =
|
|
||||||
URL.createObjectURL(new Blob(["<!doctype html>"], { type: "text/html" }));
|
|
||||||
}
|
|
||||||
quirksFrame.src =
|
|
||||||
URL.createObjectURL(new Blob([""], { type: "text/html" }));
|
|
||||||
}
|
|
||||||
|
|
||||||
var test = async_test("Tests for scrollingElement");
|
|
||||||
loadTestFrames(function() {
|
|
||||||
test.step(function() {
|
|
||||||
var quirksDoc = quirksFrame.contentDocument;
|
var quirksDoc = quirksFrame.contentDocument;
|
||||||
var nonQuirksDoc = nonQuirksFrame.contentDocument;
|
|
||||||
|
|
||||||
// Initial checks that we have the expected kinds of documents.
|
|
||||||
assert_equals(quirksDoc.compatMode, "BackCompat", "Should be in quirks mode.");
|
assert_equals(quirksDoc.compatMode, "BackCompat", "Should be in quirks mode.");
|
||||||
assert_equals(nonQuirksDoc.compatMode, "CSS1Compat", "Should be in standards mode.");
|
|
||||||
|
|
||||||
assert_not_equals(quirksDoc.body, null, "Should have a body element");
|
assert_not_equals(quirksDoc.body, null, "Should have a body element");
|
||||||
assert_not_equals(nonQuirksDoc.body, null, "Should have a body element");
|
|
||||||
|
|
||||||
// Tests for quirks mode document.
|
// Tests for quirks mode document.
|
||||||
assert_equals(quirksDoc.scrollingElement, quirksDoc.body,
|
assert_equals(quirksDoc.scrollingElement, quirksDoc.body,
|
||||||
|
@ -78,8 +56,18 @@ loadTestFrames(function() {
|
||||||
quirksDoc.removeChild(quirksDoc.documentElement);
|
quirksDoc.removeChild(quirksDoc.documentElement);
|
||||||
quirksDoc.appendChild(quirksDoc.createElement("body"));
|
quirksDoc.appendChild(quirksDoc.createElement("body"));
|
||||||
assert_equals(quirksDoc.scrollingElement, null);
|
assert_equals(quirksDoc.scrollingElement, null);
|
||||||
|
});
|
||||||
|
quirksFrame.src =
|
||||||
|
URL.createObjectURL(new Blob([""], { type: "text/html" }));
|
||||||
|
}, "scrollingElement in quirks mode");
|
||||||
|
|
||||||
|
async_test(function() {
|
||||||
|
var nonQuirksFrame = document.getElementById("nonquirksframe");
|
||||||
|
nonQuirksFrame.onload = this.step_func_done(function() {
|
||||||
|
var nonQuirksDoc = nonQuirksFrame.contentDocument;
|
||||||
|
assert_equals(nonQuirksDoc.compatMode, "CSS1Compat", "Should be in standards mode.");
|
||||||
|
assert_not_equals(nonQuirksDoc.body, null, "Should have a body element");
|
||||||
|
|
||||||
// Tests for standards mode document.
|
|
||||||
assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement,
|
assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement,
|
||||||
"scrollingElement in standards mode should be the document element.");
|
"scrollingElement in standards mode should be the document element.");
|
||||||
nonQuirksDoc.documentElement.style.overflow = "scroll";
|
nonQuirksDoc.documentElement.style.overflow = "scroll";
|
||||||
|
@ -90,8 +78,8 @@ loadTestFrames(function() {
|
||||||
assert_equals(nonQuirksDoc.scrollingElement, null);
|
assert_equals(nonQuirksDoc.scrollingElement, null);
|
||||||
nonQuirksDoc.appendChild(nonQuirksDoc.createElement("foobar"));
|
nonQuirksDoc.appendChild(nonQuirksDoc.createElement("foobar"));
|
||||||
assert_equals(nonQuirksDoc.scrollingElement.localName, "foobar");
|
assert_equals(nonQuirksDoc.scrollingElement.localName, "foobar");
|
||||||
|
|
||||||
});
|
});
|
||||||
test.done();
|
nonQuirksFrame.src =
|
||||||
});
|
URL.createObjectURL(new Blob(["<!doctype html>"], { type: "text/html" }));
|
||||||
|
}, "scrollingElement in no-quirks mode");
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue