Update web-platform-tests to revision 7da6acfd668e66adae5ab4e2d389810d3b1460be

This commit is contained in:
James Graham 2015-10-05 17:15:15 +01:00
parent 50db64a20e
commit bae87d193d
307 changed files with 35826 additions and 209 deletions

View file

@ -0,0 +1,11 @@
<!doctype html>
001-1
<script>
addEventListener("pageshow",
function(e) {
parent.events.push(e);
if (parent.events.length == 2) {
parent.do_test();
}
}, false);
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
001-2
<script>
onload = function() {setTimeout(function() {history.go(-1)}, 500)}
</script>

View file

@ -0,0 +1,30 @@
<!doctype html>
<title>pageshow event from traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="001-1.html"></iframe>
<script>
var t = async_test();
var events = [];
var iframe = document.getElementsByTagName("iframe")[0];
onload = t.step_func(function() {
setTimeout(t.step_func(
function() {
assert_equals(iframe.contentDocument.readyState, "complete")
iframe.src = "001-2.html";
}), 500);
onload = null;
})
do_test = t.step_func(function() {
assert_equals(events.length, 2);
events.forEach(function(e, i) {
phase = i ? "after" : "before";
assert_equals(e.type, "pageshow", "type " + phase + " navigation");
assert_equals(e.persisted, i == 0 ? false : true, "persisted " + phase + " navigation");
t.done();
});
});
</script>

View file

@ -0,0 +1,16 @@
support 001-1.html
support 001-2.html
001.html
support browsing_context_name-1.html
support browsing_context_name-2.html
support browsing_context_name-3.html
support browsing_context_name-4.html
browsing_context_name_cross_origin_2.html
browsing_context_name_cross_origin_3.html
browsing_context_name_cross_origin.html
browsing_context_name.html
events.html
hashchange_event.html
popstate_event.html
support unset_context_name-1.html
unset_context_name.html

View file

@ -0,0 +1,6 @@
document 1
<script>
if (!parent.navigated) {
window.name = "test";
}
</script>

View file

@ -0,0 +1,4 @@
document 2
<script>
window.name = "test1";
</script>

View file

@ -0,0 +1,6 @@
document 3
<script>
if (!parent.navigated) {
window.name = "test3";
}
</script>

View file

@ -0,0 +1,6 @@
document 4
<script>
if (!parent.navigated) {
window.name = "test4";
}
</script>

View file

@ -0,0 +1,42 @@
<!doctype html>
<title>Retaining window.name on history traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<pre id="step_log"></pre>
<iframe id="test"></iframe>
<script>
var t = async_test(undefined, {timeout:10000});
var f = document.getElementById("test");
var l = document.getElementById("step_log");
var navigated = false;
log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
function() {f.src = "browsing_context_name-2.html"; setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test1");
setTimeout(next, 0);
},
function() {history.back(); setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test1", "After navigation");
t.done();
}
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
var step = 0;
next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
</script>

View file

@ -0,0 +1,41 @@
<!doctype html>
<title>Restoring window.name on cross-origin history traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<pre id="step_log"></pre>
<iframe id="test"></iframe>
<script>
var t = async_test(undefined, {timeout:10000});
var f = document.getElementById("test");
var l = document.getElementById("step_log");
var navigated = false;
log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");},
function() {
setTimeout(next, 0);
},
function() {history.back(); setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test", "After navigation");
t.done();
}
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
var step = 0;
next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
</script>

View file

@ -0,0 +1,47 @@
<!doctype html>
<title>Restoring window.name on cross-origin history traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<pre id="step_log"></pre>
<iframe id="test"></iframe>
<script>
var t = async_test(undefined, {timeout:10000});
var f = document.getElementById("test");
var l = document.getElementById("step_log");
var navigated = false;
log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
function() {f.src = "browsing_context_name-3.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test3", "Initial load");
setTimeout(next, 0);
},
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-3", "browsing_context_name-2");},
function() {
setTimeout(next, 0);
},
function() {history.go(-2); setTimeout(next, 500)},
function() {
assert_equals(f.contentWindow.name, "test3", "After navigation");
t.done();
}
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
var step = 0;
next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
</script>

View file

@ -0,0 +1,47 @@
<!doctype html>
<title>Restoring window.name on cross-origin history traversal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<pre id="step_log"></pre>
<iframe id="test"></iframe>
<script>
var t = async_test(undefined, {timeout:10000});
var f = document.getElementById("test");
var l = document.getElementById("step_log");
var navigated = false;
log = function(t) {l.textContent += ("\n" + t)}
var steps = [
function() {f.src = "browsing_context_name-1.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test", "Initial load");
setTimeout(next, 0);
},
function() {f.src = "browsing_context_name-3.html"},
function() {
var navigated = true;
assert_equals(f.contentWindow.name, "test3", "Initial load");
setTimeout(next, 0);
},
function() {f.src = f.src.replace("http://", "http://www.").replace("browsing_context_name-1", "browsing_context_name-2");},
function() {f.src = f.src.replace("http://www.", "http://").replace("browsing_context_name-2", "browsing_context_name-4");},
function() {
assert_equals(f.contentWindow.name, "test3", "After navigation");
history.go(-3); setTimeout(next, 500)
},
function() {
assert_equals(f.contentWindow.name, "test3", "After navigation");
t.done();
}
].map(function(x) {return t.step_func(function() {log("Step " + step + " " + f.contentWindow.location); x()})});
var step = 0;
next = t.step_func(function() {steps[step++]()});
f.onload=next;
onload = setTimeout(next, 0);
</script>

View file

@ -0,0 +1,151 @@
<!doctype html>
<title> PageTransitionEffect Event </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var e = new PageTransitionEvent("pageshow", {persisted:false, cancelable:false, bubbles:false});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
assert_false(e.persisted, "persisted");
}, "Constructing pageshow event");
test(function() {
var e = new PageTransitionEvent("pagehide", {persisted:false, cancelable:false, bubbles:false});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event");
test(function() {
var e = new PageTransitionEvent("pageshow", {persisted:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_true(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, persisted true");
test(function() {
var e = new PageTransitionEvent("pagehide", {persisted:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_true(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, persisted true");
test(function() {
var e = new PageTransitionEvent("pageshow", {});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, empty options");
test(function() {
var e = new PageTransitionEvent("pagehide", {});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, empty options");
test(function() {
var e = new PageTransitionEvent("pageshow");
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, missing options");
test(function() {
var e = new PageTransitionEvent("pagehide");
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, missing options");
test(function() {
var e = new PageTransitionEvent("pageshow", {persisted:null});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, persisted:null");
test(function() {
var e = new PageTransitionEvent("pagehide", {persisted:null});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, persisted:null");
test(function() {
var e = new PageTransitionEvent("pageshow", {persisted:undefined});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, persisted:undefined");
test(function() {
var e = new PageTransitionEvent("pagehide", {persisted:undefined});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, persisted:undefined");
test(function() {
var e = new PageTransitionEvent("pageshow", {bubbles:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_true(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pageshow event, bubbles:true");
test(function() {
var e = new PageTransitionEvent("pagehide", {bubbles:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_true(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}, "Constructing pagehide event, bubbles:true");
test(function() {
var e = new PageTransitionEvent("pageshow", {cancelable:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pageshow");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "cancelable");
}, "Constructing pageshow event, cancelable:true");
test(function() {
var e = new PageTransitionEvent("pagehide", {cancelable:true});
assert_true(e instanceof PageTransitionEvent);
assert_equals(e.type, "pagehide");
assert_false(e.persisted, "persisted");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "cancelable");
}, "Constructing pagehide event, cancelable:true");
</script>

View file

@ -0,0 +1,43 @@
<!doctype html>
<title>Queue a task to fire hashchange event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
t = async_test();
window.onload = t.step_func(function () {
if (location.href.toString().indexOf("#") > -1) {
location.href = location.href.replace(/#.*$/,'');
return;
}
var root = location.href;
var oldURLs = [];
var newURLs = [];
var timer = null;
location.hash = 'foo';
window.onhashchange = t.step_func(function (e) {
oldURLs.push(e.oldURL);
newURLs.push(e.newURL);
if (newURLs.length === 2) {
check_result();
} else if (timer === null) {
timer = setTimeout(function() {check_result()}, 500);
}
})
check_result = t.step_func(function() {
clearTimeout(timer);
try {
assert_array_equals([root, root+"#foo"], oldURLs, "e.newURL");
assert_array_equals([root+"#foo", root+"#bar"], newURLs, "e.newURL");
t.done();
} finally {
location.hash = "";
}
});
location.hash = 'bar';
});
</script>

View file

@ -0,0 +1,40 @@
<!doctype html>
<title>Queue a task to fire popstate event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
t = async_test();
window.onload = t.step_func(function () {
var states = [];
var timer = null;
history.pushState("a", "State a", "/a");
history.pushState("b", "State b", "/b");
history.back();
window.onpopstate = t.step_func(function (e) {
states.push(e.state);
if (states.length === 2) {
check_result();
} else if (timer === null) {
timer = setTimeout(function() {check_result()}, 500);
}
})
check_result = t.step_func(function() {
clearTimeout(timer);
try {
assert_array_equals(states, ["a", null]);
t.done();
} finally {
location.hash = "";
}
});
setTimeout(function() {history.back()}, 0);
});
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
<title>window.name after navigating to a different origin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {assert_equals(window.name, "")})
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
<!-- test must be run in a top level browsing context -->
<title>window.name after navigating to a different origin</title>
<script>
window.name = "test_window";
location.href = location.href.replace("http://", "http://www.").replace("unset_context_name", "unset_context_name-1");
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
001-1
<script>
addEventListener("unload", function() {
location = location.href.replace("http://", "http://www.").replace(/\d{3}-\d\.html/, "001-3.html");
}, false);
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
001-2
<script>
parent.postMessage("001-2", "*");
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
001-3.html
<script>
parent.postMessage("001-3", "*");
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>Cross-origin navigation started from unload handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="001-1.html"></iframe>
<script>
var t = async_test();
onload = t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
var new_src = iframe.src.replace(/\d{3}-\d\.html/, "001-2.html");
iframe.src = new_src;
});
onmessage = t.step_func(function(e) {
assert_equals(e.data, "001-2");
t.done();
});
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
002-1
<script>
parent.postMessage("002-1", "*");
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
002-2
<script>
parent.postMessage("002-2", "*");
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<title>Multiple simultaneous navigations</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="about:blank"></iframe>
<script>
var t = async_test();
onload = t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
setTimeout(t.step_func(function() {
iframe.src = "002-1.html?pipe=trickle(d1)";
setTimeout(t.step_func(function(){iframe.src = "002-2.html"}), 500);
}), 100);
});
onmessage = t.step_func(function(e) {
assert_equals(e.data, "002-2");
t.done();
});
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
<script>
onload = function() {
parent.postMessage("003-1", "*");
setTimeout(function() {location = "003-2.html";}, 100);
}
</script>

View file

@ -0,0 +1,9 @@
<!doctype html>
003-2
<script>
onload = function() {
parent.postMessage("003-2", "*")
setTimeout(function() {history.go(-1)})
}
onunload = function() {location = "003-3.html"}
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
parent.postMessage("003-3", "*");
</script>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>Navigation from unload whilst traversing history</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="003-1.html"></iframe>
<script>
var t = async_test();
var pages = [];
var iframe = document.getElementsByTagName("iframe")[0];
onmessage = t.step_func(function(e) {
pages.push(e.data);
if(pages.length == 3) {
assert_array_equals(pages, ["003-1", "003-2", "003-1"]);
t.done();
iframe.parentNode.removeChild(iframe);
}
});
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
<script>
onload = function() {
parent.postMessage("003-1", "*");
setTimeout(function() {location = location.replace("http://", "http://www.").replace("004-1.html", "004-2.html");}, 100);
}
</script>

View file

@ -0,0 +1,9 @@
<!doctype html>
003-2
<script>
onload = function() {
parent.postMessage("004-2", "*")
setTimeout(function() {history.go(-1)})
}
onunload = function() {location = "004-3.html"}
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
parent.postMessage("004-3", "*");
</script>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>Navigation from unload whilst traversing cross-origin history</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="004-1.html"></iframe>
<script>
var t = async_test();
var pages = [];
var iframe = document.getElementsByTagName("iframe")[0];
onmessage = t.step_func(function(e) {
pages.push(e.data);
if(pages.length == 3) {
assert_array_equals(pages, ["004-1", "004-2", "004-1"]);
t.done();
iframe.parentNode.removeChild(iframe);
}
});
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<title>Link with onclick navigation and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe name="test"></iframe>
<a target="test" onclick="document.getElementById('test').contentWindow.location='click.html'" href="href.html">Test</a>
<script>
var t = async_test();
t.step(function() {document.links[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>Link with onclick form submit and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe name="test"></iframe>
<form target="test" action="click.html"></form>
<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
<script>
var t = async_test();
t.step(function() {document.links[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<title>Link with onclick javascript url and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" onclick="document.getElementById('test').contentWindow.location = 'javascript:\'abc<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>\'';" href="href.html">Test</a>
<script>
var t = async_test();
t.step(function() {document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>Link with onclick form submit to javascript url and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:'<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'"></form>
<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
<script>
var t = async_test();
t.step(function() {document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>Link with onclick form submit to javascript url with document.write and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:(function() {document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()"></form>
<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
<script>
var t = async_test();
var events = [];
t.step(function() {
document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
events.push(e.data);
if (events.length === 2) {
assert_array_equals(events, ["write", "href"]);
t.done();
}
});
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>Link with onclick form submit to javascript url with delayed document.write and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<form target="test" action="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()"></form>
<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});
t.step(function() {document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,21 @@
<!doctype html>
<title>Link with onclick navigation to javascript url with document.write and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" onclick="javascript:(function() {document.write('<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()" href="href.html">Test</a>
<script>
var t = async_test();
var events = [];
t.step(function() {
document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
events.push(e.data);
if (events.length === 2) {
assert_array_equals(events, ["write", "href"]);
t.done();
}
});
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" onclick="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('write<script>parent.postMessage(&quot;write&quot;, &quot;*&quot;)</script>'); return '<script>parent.postMessage(&quot;click&quot;, &quot;*&quot;)</script>'})()" href="href.html">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});
t.step(function() {document.getElementsByTagName("a")[0].click()});
onmessage = t.step_func(
function(e) {
assert_equals(e.data, "href");
t.done();
});
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" href="javascript:parent.events.push('javascript');">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});
var events = [];
t.step(function() {
document.getElementsByTagName("a")[0].click();
events.push('after script');
});
onload = t.step_func(function() {
//assuming the order is sync
assert_array_equals(events, ['javascript', 'after script']);
t.done();
});
</script>

View file

@ -0,0 +1,21 @@
<!doctype html>
<title> Link with javascript onclick form submission script order </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<form action="javascript:parent.events.push('submit')"></form>
<a target="test" onclick="document.forms[0].submit()">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});
var events = [];
t.step(function() {
document.getElementsByTagName("a")[0].click();
events.push('after script');
});
onload = t.step_func(function() {
//assuming the order is sync
assert_array_equals(events, ['javascript', 'after script']);
t.done();
});
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title> Link with javascript onclick and href script order </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe id="test" name="test"></iframe>
<a target="test" onclick="parent.events.push('click');" href="javascript:parent.events.push('href')">Test</a>
<script>
var t = async_test(undefined, {timeout:4000});
var events = [];
t.step(function() {
document.getElementsByTagName("a")[0].click();
events.push('after script');
});
onload = t.step_func(function() {
//assuming the order is sync
assert_array_equals(events, ['click', 'href', 'after script']);
t.done();
});
</script>

View file

@ -0,0 +1,42 @@
support 001-1.html
support 001-2.html
support 001-3.html
http 001.html
support 002-1.html
support 002-2.html
002.html
support 003-1.html
support 003-2.html
support 003-3.html
003.html
support 004-1.html
support 004-2.html
support 004-3.html
004.html
005.html
006.html
007.html
008.html
009.html
010.html
011.html
012.html
013.html
014.html
015.html
support blank.html
support child_navigates_parent_location-1.html
support child_navigates_parent_location-2.html
support child_navigates_parent_location-3.html
child_navigates_parent_location.html
support child_navigates_parent_submit-1.html
support child_navigates_parent_submit-2.html
support child_navigates_parent_submit-3.html
child_navigates_parent_submit.html
support click.html
support href.html
support navigation_unload_data_url-1.html
navigation_unload_data_url.html
support navigation_unload_same_origin-1.html
navigation_unload_same_origin.html
support slice-and-dice.php

View file

@ -0,0 +1,3 @@
<!doctype html>
<script>parent.postMessage("initial", "*")</script>
<iframe src="child_navigates_parent_location-2.html"></iframe>

View file

@ -0,0 +1,5 @@
<!doctype html>
<script>
parent.parent.postMessage("inner", "*");
parent.location = "child_navigates_parent_location-3.html"
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
parent.postMessage("destination", "*");
</script>

View file

@ -0,0 +1,17 @@
<!doctype html>
<title>Child document navigating parent via location </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var events = [];
onmessage = t.step_func(function(e) {
events.push(e.data);
if (events.length == 3) {
assert_array_equals(events, ["initial", "inner", "destination"]);
t.done();
}
});
</script>
<iframe src="child_navigates_parent_location-1.html"></iframe>

View file

@ -0,0 +1,3 @@
<!doctype html>
<script>parent.postMessage("initial", "*")</script>
<iframe src="child_navigates_parent_submit-2.html"></iframe>

View file

@ -0,0 +1,6 @@
<!doctype html>
<form action="child_navigates_parent_submit-3.html" target="_parent"></form>
<script>
parent.parent.postMessage("inner", "*");
document.forms[0].submit()
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
parent.postMessage("destination", "*");
</script>

View file

@ -0,0 +1,18 @@
<!doctype html>
<title>Child document navigating parent via submit </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var events = [];
onmessage = t.step_func(function(e) {
events.push(e.data);
if (events.length == 3) {
assert_array_equals(events, ["initial", "inner", "destination"]);
t.done();
}
});
</script>
<iframe src="child_navigates_parent_submit-1.html"></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
parent.postMessage("click", "*");
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
<script>
parent.postMessage("href", "*");
</script>
href

View file

@ -0,0 +1,7 @@
<!doctype html>
001-1
<script>
addEventListener("unload", function() {
location = "data:text/html,unload<script>parent.postMessage('fail', '*');<\/script>";
}, false);
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>Same-origin navigation started from unload handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="navigation_unload_data_url-1.html"></iframe>
<script>
var t = async_test();
onload = t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
var new_src = "data:text/html,load<script>parent.postMessage('pass', '*')<\/script>";
iframe.src = new_src;
});
onmessage = t.step_func(function(e) {
assert_equals(e.data, "pass");
t.done();
});
</script>

View file

@ -0,0 +1,7 @@
<!doctype html>
001-1
<script>
addEventListener("unload", function() {
location = location.href.replace(/[^\/\.]*\.html/, "001-3.html");
}, false);
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>Same-origin navigation started from unload handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="navigation_unload_same_origin-1.html"></iframe>
<script>
var t = async_test();
onload = t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0];
var new_src = iframe.src.replace(/[^\/\.]*\.html/, "001-2.html");
iframe.src = new_src;
});
onmessage = t.step_func(function(e) {
assert_equals(e.data, "001-3");
t.done();
});
</script>

View file

@ -0,0 +1,16 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: Updating document address</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_equals(location.hash, "", "Page must be loaded with no hash")
var original_location = location.href;
location.hash = "test";
assert_equals(location.hash, "#test");
assert_equals(location.href, original_location + "#test");
location.hash = ""
});
</script>

View file

@ -0,0 +1,21 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: Updating document address twice</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
assert_equals(location.hash, "", "Page must be loaded with no hash")
var original_location = location.href;
location.hash = "test";
assert_equals(location.hash, "#test");
assert_equals(location.href, original_location + "#test");
location.hash = "test1";
assert_equals(location.hash, "#test1");
assert_equals(location.href, original_location + "#test1");
location.hash = "";
});
</script>

View file

@ -0,0 +1,25 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: Updating scroll position</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<div id="test">scroll 1</div>
<div style="height:10000px">Filler</div>
<div id="test1">scroll 2</div>
<script>
test(function() {
assert_equals(document.body.scrollTop, 0);
location.hash = "test";
var scroll1 = document.body.scrollTop;
assert_true(scroll1 > 0);
location.hash = "test1";
var scroll2 = document.body.scrollTop;
assert_true(scroll2 > scroll1);
location.hash = ""
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: hashchange event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<script>
var t = async_test();
t.step(function() {
assert_equals(location.hash, "", "Page must be loaded with no hash");
location.hash = "test";
addEventListener("hashchange",
t.step_func(function(e) {
assert_equals(e.target, window);
assert_equals(e.type, "hashchange");
assert_true(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
t.done();
}), true)
});
</script>

View file

@ -0,0 +1,23 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: hashchange event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<script>
var t = async_test();
t.step(function() {
var original_url = location.href;
assert_equals(location.hash, "", "Page must be loaded with no hash");
location.hash = "test";
addEventListener("hashchange",
t.step_func(function(e) {
assert_equals(e.oldURL, original_url, "oldURL property");
assert_equals(e.newURL, location.href, "newURL property");
location.hash = "";
t.done();
}), true);
});
</script>

View file

@ -0,0 +1,34 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: hashchange event multiple changes old/newURL</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<script>
var t = async_test();
t.step(function() {
var original_url = location.href;
assert_equals(location.hash, "", "Page must be loaded with no hash");
location.hash = "test";
var count = 0;
var mid_url = location.href;
addEventListener("hashchange",
t.step_func(function(e) {
if (count === 0) {
assert_equals(e.oldURL, original_url, "oldURL property first update");
assert_equals(e.newURL, mid_url, "newURL property first update");
count = 1;
} else if (count === 1) {
assert_equals(e.oldURL, mid_url, "oldURL property second update");
assert_equals(e.newURL, location.href, "newURL property second update");
location.hash = "";
t.done();
}
}), true);
location.hash = "test1";
});
</script>

View file

@ -0,0 +1,36 @@
<!doctype html>
<!-- this tests the spec as it hopefully will be once bug https://www.w3.org/Bugs/Public/show_bug.cgi?id=17155 is fixed -->
<title>Fragment Navigation: hashchange event multiple changes old/newURL</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<script>
var t = async_test(undefined, {timeout:30000});
t.step(function() {
var original_url = location.href;
assert_equals(location.hash, "", "Page must be loaded with no hash");
var count = 0;
location.hash = "test";
hashes = [];
addEventListener("hashchange",
t.step_func(function(e) {
if (count < 1000) {
location.hash = "test" + count++;
hashes.push(location.hash);
} else if (count === 1000) {
expected = [];
for (var i=0; i<1000; i++) {
expected.push("#test" + i);
}
assert_array_equals(hashes, expected);
location.hash = "";
t.done();
}
}), true);
});
</script>

View file

@ -0,0 +1,7 @@
001.html
002.html
003.html
004.html
005.html
006.html
007.html

View file

@ -0,0 +1,33 @@
support 001-1.html
support 001a.html
support 001b.html
001.html
support 002-1.html
support 002a.html
support 002b.html
002.html
support 003-1.html
support 003a.html
support 003b.html
003.html
support 004-1.html
support 004a.html
support 004b.html
004.html
support 005-1.html
support 005a.html
support 005b.html
005.html
base.html
support beforeunload-on-history-back-1.html
beforeunload-on-history-back.html
support beforeunload-on-navigation-of-parent-1.html
support beforeunload-on-navigation-of-parent-2.html
beforeunload-on-navigation-of-parent.html
support navigation-within-beforeunload-1.html
support navigation-within-beforeunload-2.html
navigation-within-beforeunload.html
support pagehide-on-history-forward-1.html
pagehide-on-history-forward.html
dir prompt
dir unload

View file

@ -0,0 +1,14 @@
<!doctype html>
Base
<script>
onpagehide = function() {
if(top.base_hide) {
top.base_hide();
}
}
onpageshow = function() {
if (top.base_show) {
top.base_show();
}
}
</script>

View file

@ -0,0 +1,5 @@
<!doctype html>
001-1
<script>
addEventListener("beforeunload", function() {top.t.step(function() {top.beforeunload_fired = true})}, false);
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<title>beforeunload event fires on history navigation back</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = t.step_func(function() {
iframe.onload = null;
history.go(-1);
});
iframe.src = "beforeunload-on-history-back-1.html";
}), 100)};
base_show = t.step_func(function() {
base_count++;
if (base_count > 1) {
assert_true(beforeunload_fired);
t.done();
}
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,2 @@
<!doctype html>
<iframe src="beforeunload-on-navigation-of-parent-2.html"></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("beforeunload", function() {parent.parent.beforeunload_fired=true}, false)
</script>

View file

@ -0,0 +1,31 @@
<!doctype html>
<title>beforeunload in iframe on navigation of parent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = t.step_func(function() {
iframe.onload = null;
history.go(-1);
});
iframe.src = "beforeunload-on-navigation-of-parent-1.html";
}), 100)};
base_show = t.step_func(function() {
base_count++;
if (base_count > 1) {
assert_true(beforeunload_fired);
t.done();
}
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,10 @@
<!doctype html>
004-1
<script>
addEventListener("beforeunload",
function() {
if (top.counter++ < 999) {
location = "navigation-within-beforeunload-2.html?" + top.counter;
}
}, false);
</script>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
document.write(location)
</script>

View file

@ -0,0 +1,26 @@
<!doctype html>
<title>Triggering navigation from withing beforeunload event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
var base_count = 0;
var counter = 0;
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {iframe.contentWindow.location="navigation-within-beforeunload-2.html";}, 100);
iframe.onload = t.step_func(function() {assert_equals(counter, 1000); t.done()});
};
iframe.src = "navigation-within-beforeunload-1.html?" + Math.random();
}, 100)};
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,19 @@
<!doctype html>
<title>pagehide event fires on history navigation forward</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
onload = function() {setTimeout(t.step_func(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.src = "pagehide-on-history-forward-1.html";
}), 100)};
base_hide = t.step_func(function() {
t.done()
});
</script>
<iframe src="base.html"></iframe>

View file

@ -0,0 +1,10 @@
<script>
addEventListener("beforeunload",
function() {
parent.events.push("beforeunload");
}, false);
parent.events.push("before src change");
location.href = "001-2.html&pipe=trickle(d2)";
parent.events.push("after src change");
</script>

View file

@ -0,0 +1,14 @@
<!doctype html>
<title>beforeunload event order</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
events = [];
onload = t.step_func(function() {
assert_array_equals(events, ["before src change", "beforeunload", "after src change"]);
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,7 @@
<script>
addEventListsner("beforeunload", parent.t.step_func(
function(e) {
parent.do_test(e);
}, false);
location.href = "001-2.html&pipe=trickle(d2)";
</script>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>beforeunload event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
function do_test(e) {
assert_equals(e.type, "beforeunload");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "bubbles");
assert_equals(e.returnValue, "");
}
onload = t.step_func(function() {
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,20 @@
<!doctype html>
<title>beforeunload event in child frame for parent navigation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
function do_test(e) {
assert_equals(e.type, "beforeunload");
assert_false(e.bubbles, "bubbles");
assert_true(e.cancelable, "bubbles");
assert_equals(e.returnValue, "");
}
onload = t.step_func(function() {
t.done();
})
</script>
<iframe src="001-1.html"></iframe>

View file

@ -0,0 +1,14 @@
support 001-1.html
support 001-2.html
001.html
support 002-1.html
002.html
003.html
manual manual-001.html
manual manual-002.html
manual manual-003.html
manual manual-004.html
manual manual-005.html
manual manual-006.html
support next.html
support slice-and-dice.php

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload is canceled</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload has returnValue set</title>
<script>
addEventListener("beforeunload",
function(e) {e.returnValue = "PASS if you see this"},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>Prompt when beforeunload is canceled</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
<form method="get" action="next.html">
<input type="submit" value="Click here">
</form>

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>Prompt on form submit</title>
<script>
addEventListener("beforeunload",
function(e) {e.preventDefault()},
false);
</script>
<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p>
<form method="get" action="next.html">
<input type="submit" value="Click here">
</form>

View file

@ -0,0 +1,22 @@
<!doctype html>
<title>Event loop pause for beforeunload</title>
<script>
var counter = 0;
onload = function count() {
document.getElementById("log").textContent = counter++
setTimeout(count, 200);
}
addEventListener("beforeunload",
function(e) {
e.preventDefault()
},
false);
</script>
<ul>
<li>Click on the link below. When the prompt appears the counter at the bottom must stop incrementing.
<li>Opt not to leave the page. The counter must start incrementing again
</ul>
<p><a href="">Click here</a>
<div id="log"></div>

View file

@ -0,0 +1,9 @@
<!doctype html>
<title>Prompt when beforeunload returns string value</title>
<script>
addEventListener("beforeunload",
function(e) {return "PASS if you see this"},
false);
</script>
<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p>
<a href="next.html">Click here</a>

View file

@ -0,0 +1,2 @@
<!doctype html>
<p>You should have seen a prompt asking you to unload the previous document

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("pagehide", parent.t.step_func(function() {parent.pagehide_fired = true}), false);
</script>

View file

@ -0,0 +1,2 @@
<!doctype html>
Filler

View file

@ -0,0 +1,25 @@
<!doctype html>
<title>pagehide event on unload</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
pagehide_fired = false;
var t = async_test();
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="001-2.html";
}, 100);
iframe.onload = t.step_func(function() {assert_true(pagehide_fired); t.done()});
};
iframe.src = "001-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("pagehide", parent.t.step_func(parent.do_test()), false);
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<title>pagehide event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="001-2.html";
}, 100);
iframe.onload = t.step_func(function() {t.done()});
};
function do_test(e) {
assert_equals(e.type, "pagehide");
assert_equals(e.target, iframe.contentDocument);
assert_equals(e.currentTarget, iframe.contentWindow);
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
assert_true(e.persisted, "persisted");
}
iframe.src = "002-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

View file

@ -0,0 +1,4 @@
<!doctype html>
<script>
addEventListener("unload", parent.t.step_func(function(e) {parent.do_test(e)}), false);
</script>

View file

@ -0,0 +1,33 @@
<!doctype html>
<title>unload event properties</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var do_test;
onload = function() {setTimeout(function() {
var iframe = document.getElementsByTagName("iframe")[0]
iframe.onload = function() {
setTimeout(function() {
iframe.contentWindow.location="002-2.html";
}, 100);
iframe.onload = t.step_func(function() {t.done()});
};
do_test = function(e) {
assert_equals(e.type, "unload");
assert_equals(e.target, iframe.contentDocument);
assert_equals(e.currentTarget, iframe.contentWindow);
assert_false(e.bubbles, "bubbles");
assert_false(e.cancelable, "cancelable");
}
iframe.src = "003-1.html?" + Math.random();
}, 100)};
</script>
<iframe></iframe>

Some files were not shown because too many files have changed in this diff Show more