Implement synchronous about:blank loading.

Based on initial work by jdm in <https://github.com/servo/servo/pull/8600>.
This commit is contained in:
Ms2ger 2016-11-28 10:23:04 +01:00
parent 2677540cd0
commit b86965f394
34 changed files with 456 additions and 906 deletions

View file

@ -1,6 +1,5 @@
[htmllabel-activation.html]
type: testharness
[If label's 1st child (submit) is disabled, click should have no impact]
expected: FAIL

View file

@ -0,0 +1,5 @@
[mozbrowser_loadevents.html]
type: testharness
[mozbrowserloadstart, mozbrowserconnected and mozbrowserloadend are dispatched]
expected: FAIL

View file

@ -12,13 +12,13 @@ async_test(function(t) {
var url1 = `data:text/html,<script>setTimeout(() => location.assign("${url2}"), 0)</${"script"}>`;
var locations = []
var expected_locations = [url1, url2, url1];
var expected_locations = ["about:blank", url1, url2, url1];
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = url1;
iframe.addEventListener("mozbrowserlocationchange", e => {
iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => {
locations.push(e.detail.url);
if (e.detail.url == url2) {
iframe.goBack();
@ -27,7 +27,7 @@ async_test(function(t) {
assert_array_equals(locations, expected_locations);
t.done();
}
});
}));
document.body.appendChild(iframe);

View file

@ -14,24 +14,29 @@ async_test(function(t) {
var received_events = []
var expected_events = [
url1, false, false,
"about:blank", false, false,
url1, true, false,
url2, true, false,
url3, true, false,
url2, true, true,
url1, false, true,
url1, true, true,
"about:blank", false, true,
url1, true, true,
url2, true, true,
url3, true, false,
];
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = url1;
var actions = [
function() {iframe.src = url1},
function() {iframe.src = url2},
function() {iframe.src = url3},
function() {iframe.goBack()},
function() {iframe.goBack()},
function() {iframe.goBack()},
function() {iframe.goForward()},
function() {iframe.goForward()},
function() {iframe.goForward()},
];

View file

@ -9,9 +9,17 @@
var iframe = document.createElement("iframe");
iframe.mozbrowser = "true";
iframe.src = "redirect_init.html?pipe=status(302)|header(Location,redirect_final.html)";
var i = 0;
iframe.addEventListener("mozbrowserlocationchange", t.step_func(e => {
assert_equals(e.detail.url, new URL("redirect_final.html", location).href);
t.done();
switch (++i) {
case 1:
assert_equals(e.detail.url, "about:blank");
break;
case 2:
assert_equals(e.detail.url, new URL("redirect_final.html", location).href);
t.done();
break;
}
}));
document.body.appendChild(iframe);
});