Fire the pageshow event at the end of the page load r=jdm

This commit is contained in:
Fabrice Desré 2018-03-02 22:58:20 -08:00
parent 476a0764f5
commit 3dd015b2d9
4 changed files with 57 additions and 7 deletions

View file

@ -29,12 +29,28 @@ async_test(function() {
}, "load");
async_test(function() {
var seen = false;
document.addEventListener("DOMContentLoaded", this.step_func(function() {
seen = true;
window.addEventListener("pageshow", this.step_func_done(function(e) {
assert_equals(e.type, "pageshow");
assert_false(e.bubbles, "bubbles should be false");
assert_false(e.cancelable, "cancelable should be false");
assert_equals(e.target, document, "target should be document");
assert_true(e.isTrusted, "isTrusted should be true");
assert_class_string(e, "PageTransitionEvent");
}));
window.addEventListener("load", this.step_func_done(function() {
assert_true(seen, "DOMContentLoaded should be fired before load");
}, "pageshow");
async_test(function() {
var seen_dcl = false;
var seen_load = false;
document.addEventListener("DOMContentLoaded", this.step_func(function() {
seen_dcl = true;
}));
window.addEventListener("load", this.step_func(function() {
seen_load = true;
assert_true(seen_dcl, "DOMContentLoaded should be fired before load");
}));
window.addEventListener("pageshow", this.step_func_done(function() {
assert_true(seen_load, "load should be fired before pageshow")
}));
}, "order");
</script>