mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 08:18:41 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
9
testing/web-platform/tests/html/OWNERS
Normal file
9
testing/web-platform/tests/html/OWNERS
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
@ayg
|
||||
@Ms2ger
|
||||
@gsnedders
|
||||
@jdm
|
||||
@jgraham
|
||||
@plehegar
|
||||
@sideshowbarker
|
||||
@zcorpan
|
||||
@zqzhang
|
||||
0
testing/web-platform/tests/html/browsers/.gitkeep
Normal file
0
testing/web-platform/tests/html/browsers/.gitkeep
Normal 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>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
001-2
|
||||
<script>
|
||||
onload = function() {setTimeout(function() {history.go(-1)}, 500)}
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Synthetic popstate events</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function () {
|
||||
var e = document.createEvent('PopStateEvent');
|
||||
var eProto = Object.getPrototypeOf(e);
|
||||
assert_equals(eProto, PopStateEvent.prototype);
|
||||
}, 'document.createEvent');
|
||||
|
||||
test(function () {
|
||||
assert_false('initPopStateEvent' in PopStateEvent.prototype,
|
||||
'There should be no PopStateEvent#initPopStateEvent');
|
||||
}, 'initPopStateEvent');
|
||||
|
||||
test(function () {
|
||||
var state = history.state;
|
||||
var data;
|
||||
window.addEventListener('popstate', function (e) {
|
||||
data = e.state;
|
||||
});
|
||||
window.dispatchEvent(new PopStateEvent('popstate', {
|
||||
'state': {testdata:true}
|
||||
}));
|
||||
assert_true(data.testdata,'state data was corrupted');
|
||||
assert_equals(history.state, state, "history.state was NOT set by dispatching the event");
|
||||
}, 'Dispatching a synthetic PopStateEvent');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<iframe id="test"></iframe>
|
||||
<script>
|
||||
var opener = window.opener;
|
||||
var t = opener.t;
|
||||
var f = document.getElementById("test");
|
||||
var l = opener.document.getElementById("step_log");
|
||||
|
||||
log = function(t) {l.textContent += ("\n" + t)}
|
||||
var navigated = false;
|
||||
var steps = [
|
||||
() => f.src = "browsing_context_name-1.html",
|
||||
() => {
|
||||
navigated = true;
|
||||
opener.assert_equals(f.contentWindow.name, "test", "Initial load");
|
||||
f.src = "browsing_context_name-2.html"
|
||||
},
|
||||
() => {
|
||||
opener.assert_equals(f.contentWindow.name, "test1");
|
||||
opener.assert_equals(history.length, 2);
|
||||
history.back()
|
||||
},
|
||||
() => {
|
||||
opener.assert_equals(f.contentWindow.name, "test1", "After navigation");
|
||||
t.done();
|
||||
}
|
||||
].map((x, i) => t.step_func(() => {log("Step " + (i+1)); x()}));
|
||||
|
||||
next = () => steps.shift()();
|
||||
|
||||
onload = () => {
|
||||
log("page load");
|
||||
f.onload = () => {log("iframe onload"); next()};
|
||||
setTimeout(next, 0);
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
document 1
|
||||
<script>
|
||||
if (!parent.navigated) {
|
||||
window.name = "test";
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
document 2
|
||||
<script>
|
||||
window.name = "test1";
|
||||
</script>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
document 3
|
||||
<script>
|
||||
if (!parent.navigated) {
|
||||
window.name = "test3";
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
document 4
|
||||
<script>
|
||||
if (!parent.navigated) {
|
||||
window.name = "test4";
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<title>Retaining window.name on history traversal</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<pre id="step_log"></pre>
|
||||
|
||||
<script>
|
||||
var t = async_test();
|
||||
t.step(() => {
|
||||
win = window.open("browsing_context_name-0.html");
|
||||
t.add_cleanup(() => win.close());
|
||||
});
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
{
|
||||
"id": "event-definitions-0",
|
||||
"original_id": "event-definitions-0"
|
||||
}
|
||||
]
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
body {
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
}
|
||||
</style>
|
||||
<body> Blank 1 </body>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
body {
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
}
|
||||
</style>
|
||||
<body> Blank 2 </body>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
body {
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
}
|
||||
#fragment {
|
||||
position: absolute;
|
||||
top: 800px;
|
||||
background-color: #faa;
|
||||
display: block;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<body>
|
||||
Page with fragment
|
||||
<a id="fragment" name="fragment" class='box'></a>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
addEventListener('load', _ => {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
window.opener.postMessage(params.get('name'), '*');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<!doctype html>
|
||||
<title>Verify history.back() on a persisted page resumes timers</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function make_post_back_url(name) {
|
||||
return new URL('resources/post_name_on_load.html?name=' + name,
|
||||
window.location).href;
|
||||
}
|
||||
|
||||
function wait_for_message(name) {
|
||||
return new Promise(resolve => {
|
||||
addEventListener('message', function onMsg(evt) {
|
||||
if (evt.data !== name) {
|
||||
return;
|
||||
}
|
||||
removeEventListener('message', onMsg);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function with_window_by_name(name) {
|
||||
let win = window.open(make_post_back_url(name));
|
||||
return wait_for_message(name).then(_ => {
|
||||
return win;
|
||||
});
|
||||
}
|
||||
|
||||
function with_nested_frame(win, url) {
|
||||
return new Promise(resolve => {
|
||||
let frame = win.document.createElement('iframe');
|
||||
frame.addEventListener('load', function onLoad(evt) {
|
||||
removeEventListener('load', onLoad);
|
||||
resolve(frame);
|
||||
});
|
||||
frame.src = url;
|
||||
win.document.body.appendChild(frame);
|
||||
});
|
||||
}
|
||||
|
||||
function delay(win, delay) {
|
||||
return new Promise(resolve => {
|
||||
win.setTimeout(_ => {
|
||||
resolve(win);
|
||||
}, delay);
|
||||
});
|
||||
}
|
||||
|
||||
function navigate_by_name(win, name) {
|
||||
win.location = make_post_back_url(name);
|
||||
return wait_for_message(name).then(_ => {
|
||||
return win;
|
||||
});
|
||||
}
|
||||
|
||||
function go_back(win) {
|
||||
return new Promise(resolve => {
|
||||
win.onpagehide = e => resolve(win);
|
||||
win.history.back();
|
||||
});
|
||||
}
|
||||
|
||||
let DELAY = 500;
|
||||
|
||||
promise_test(t => {
|
||||
// Create a new window so we can navigate it later.
|
||||
return with_window_by_name('foo').then(win => {
|
||||
// Schedule a timer within the new window. Our intent is
|
||||
// to navigate the window before the timer fires.
|
||||
let delayFired = false;
|
||||
let innerDelay = delay(win, DELAY);
|
||||
innerDelay.then(_ => {
|
||||
delayFired = true;
|
||||
});
|
||||
|
||||
return navigate_by_name(win, 'bar').then(_ => {
|
||||
// Since the window has navigated the timer should not
|
||||
// fire. We set a timer on our current test window
|
||||
// to verify the other timer is not received.
|
||||
assert_false(delayFired);
|
||||
return delay(window, DELAY * 2);
|
||||
}).then(_ => {
|
||||
// The navigated window's timer should not have fired.
|
||||
assert_false(delayFired);
|
||||
// Now go back to the document that set the timer.
|
||||
return go_back(win);
|
||||
}).then(_ => {
|
||||
// We wait for one of two conditions here. For browsers
|
||||
// with a bfcache the original suspended timer will fire.
|
||||
// Alternatively, if the browser reloads the page the original
|
||||
// message will be sent again. Wait for either of these
|
||||
// two events.
|
||||
return Promise.race([wait_for_message('foo'), innerDelay]);
|
||||
}).then(_ => {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
}, 'history.back() handles top level page timer correctly');
|
||||
|
||||
promise_test(t => {
|
||||
let win;
|
||||
// Create a new window so we can navigate it later.
|
||||
return with_window_by_name('foo').then(w => {
|
||||
win = w;
|
||||
|
||||
// Create a nested frame so we check if navigation and history.back()
|
||||
// properly handle child window state.
|
||||
return with_nested_frame(win, 'about:blank');
|
||||
|
||||
}).then(frame => {
|
||||
// Schedule a timer within the nested frame contained by the new window.
|
||||
// Our intent is to navigate the window before the timer fires.
|
||||
let delayFired = false;
|
||||
let innerDelay = delay(frame.contentWindow, DELAY);
|
||||
innerDelay.then(_ => {
|
||||
delayFired = true;
|
||||
});
|
||||
|
||||
return navigate_by_name(win, 'bar').then(_ => {
|
||||
// Since the window has navigated the timer should not
|
||||
// fire. We set a timer on our current test window
|
||||
// to verify the other timer is not received.
|
||||
assert_false(delayFired);
|
||||
return delay(window, DELAY * 2);
|
||||
}).then(_ => {
|
||||
// The navigated window's timer should not have fired.
|
||||
assert_false(delayFired);
|
||||
// Now go back to the document containing the frame that set the timer.
|
||||
return go_back(win);
|
||||
}).then(_ => {
|
||||
// We wait for one of two conditions here. For browsers
|
||||
// with a bfcache the original suspended timer will fire.
|
||||
// Alternatively, if the browser reloads the page the original
|
||||
// message will be sent again. Wait for either of these
|
||||
// two events.
|
||||
return Promise.race([wait_for_message('foo'), innerDelay]);
|
||||
}).then(_ => {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
}, 'history.back() handles nested iframe timer correctly');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<title>Verify existence and basic read/write function of history.scrollRestoration</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
|
||||
test(function() {
|
||||
assert_equals(history.scrollRestoration, 'auto');
|
||||
}, 'Default value is "auto"');
|
||||
|
||||
test(function() {
|
||||
history.scrollRestoration = 'manual';
|
||||
assert_equals(history.scrollRestoration, 'manual', 'should be able to set "manual"');
|
||||
history.scrollRestoration = 'auto';
|
||||
assert_equals(history.scrollRestoration, 'auto', 'should be able to set "auto"');
|
||||
}, 'It is writable');
|
||||
|
||||
test(function() {
|
||||
history.scrollRestoration = 'auto';
|
||||
for (var v of [3.1415, {}, 'bogus']) {
|
||||
history.scrollRestoration = v;
|
||||
assert_equals(history.scrollRestoration, 'auto', `setting to invalid value (${v}) should be ignored`);
|
||||
}
|
||||
}, 'Invalid values are ignored');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name=timeout content=long>
|
||||
<title>Precedence of scroll restoration mode over fragment scrolling in cross-origin history traversal</title>
|
||||
<style>
|
||||
iframe {
|
||||
height: 300px;
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<iframe></iframe>
|
||||
</body>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
|
||||
// The test does the following navigation steps for iframe
|
||||
// 1. load page-with-fragment.html#fragment
|
||||
// 2. load blank1
|
||||
// 3. go back to page-with-fragment.html
|
||||
async_test(function(t) {
|
||||
var iframe = document.querySelector('iframe');
|
||||
var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
|
||||
|
||||
var steps = [
|
||||
function() {
|
||||
iframe.src = 'resources/page-with-fragment.html#fragment';
|
||||
}, function() {
|
||||
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be on page-with-fragment page');
|
||||
// wait one animation frame to ensure layout is run and fragment scrolling is complete
|
||||
iframe.contentWindow.requestAnimationFrame(function() {
|
||||
assert_equals(iframe.contentWindow.scrollY, 800, 'should scroll to fragment');
|
||||
|
||||
iframe.contentWindow.history.scrollRestoration = 'manual';
|
||||
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
|
||||
setTimeout(next, 0);
|
||||
});
|
||||
}, function() {
|
||||
// navigate to a new page from a different origin
|
||||
iframe.src = iframe.src.replace("http://", "http://www.").replace("page-with-fragment.html#fragment", "blank1.html");
|
||||
}, function() {
|
||||
// going back causes the iframe to traverse back
|
||||
history.back();
|
||||
}, function() {
|
||||
// coming back from history, scrollRestoration should be set to manual and respected
|
||||
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/page-with-fragment.html#fragment', 'should be back on page-with-fragment page');
|
||||
iframe.contentWindow.requestAnimationFrame(function() {
|
||||
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
|
||||
assert_equals(iframe.contentWindow.scrollX, 0, 'should not scroll to fragment');
|
||||
assert_equals(iframe.contentWindow.scrollY, 0, 'should not scroll to fragment');
|
||||
t.done();
|
||||
});
|
||||
}
|
||||
];
|
||||
|
||||
var stepCount = 0;
|
||||
var next = t.step_func(function() {
|
||||
steps[stepCount++]();
|
||||
});
|
||||
|
||||
iframe.onload = next;
|
||||
next();
|
||||
}, 'Manual scroll restoration should take precedent over scrolling to fragment in cross origin navigation');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
body {
|
||||
height: 2000px;
|
||||
width: 2000px;
|
||||
}
|
||||
|
||||
#fragment {
|
||||
position: absolute;
|
||||
top: 800px;
|
||||
background-color: #faa;
|
||||
display: block;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<a id="fragment" name="fragment" class='box'></a>
|
||||
</body>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
history.scrollRestoration = 'manual';
|
||||
assert_equals(history.scrollRestoration, 'manual');
|
||||
|
||||
location.hash = '#fragment';
|
||||
assert_equals(window.scrollY, 800, 'new navigations should scroll to fragment');
|
||||
|
||||
// create a new entry and reset the scroll before verification
|
||||
history.pushState(null, null, '#done');
|
||||
window.scrollTo(0, 0);
|
||||
assert_equals(window.scrollY, 0, 'should reset scroll before verification');
|
||||
|
||||
setTimeout(function() {
|
||||
// setup verification
|
||||
window.addEventListener('hashchange', t.step_func(function() {
|
||||
assert_equals(location.hash, '#fragment');
|
||||
assert_equals(history.scrollRestoration, 'manual');
|
||||
// navigating back should give precedent to history restoration which is 'manual'
|
||||
assert_equals(window.scrollX, 0, 'should not scroll to fragment');
|
||||
assert_equals(window.scrollY, 0, 'should not scroll to fragment');
|
||||
t.done();
|
||||
}));
|
||||
// kick off verification
|
||||
window.history.back();
|
||||
}, 0);
|
||||
|
||||
}, 'Manual scroll restoration should take precedent over scrolling to fragment in cross doc navigation');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<meta name=timeout content=long>
|
||||
<title>Correct behaviour of scroll restoration mode is cross origin history traversal</title>
|
||||
|
||||
<style>
|
||||
iframe {
|
||||
height: 300px;
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<iframe></iframe>
|
||||
</body>
|
||||
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
|
||||
// The test does the following navigation steps for iframe
|
||||
// 1. load blank1
|
||||
// 2. load blank2
|
||||
// 3. go back to blank1
|
||||
async_test(function(t) {
|
||||
var iframe = document.querySelector('iframe');
|
||||
var baseURL = location.href.substring(0, location.href.lastIndexOf('/'));
|
||||
|
||||
var steps = [
|
||||
function() {
|
||||
iframe.src = 'resources/blank1.html';
|
||||
},
|
||||
function() {
|
||||
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be on first blank page');
|
||||
iframe.contentWindow.history.scrollRestoration = 'manual';
|
||||
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual');
|
||||
iframe.contentWindow.scrollTo(500, 500);
|
||||
assert_equals(iframe.contentWindow.scrollX, 500, 'scripted scrolling should take effect');
|
||||
assert_equals(iframe.contentWindow.scrollY, 500, 'scripted scrolling should take effect');
|
||||
setTimeout(next, 0);
|
||||
},
|
||||
function() {
|
||||
// navigate to new page
|
||||
iframe.src = 'resources/blank2.html';
|
||||
},
|
||||
function() {
|
||||
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank2.html', 'should be on second blank page');
|
||||
assert_equals(iframe.contentWindow.history.scrollRestoration, 'auto', 'new page loads should set scrollRestoration to "auto"');
|
||||
setTimeout(next, 0);
|
||||
}, function() {
|
||||
iframe.contentWindow.history.back();
|
||||
}, function() {
|
||||
// coming back scrollRestoration should be restored to 'manual' and respected
|
||||
assert_equals(iframe.contentWindow.location.href, baseURL + '/resources/blank1.html', 'should be back on first blank page');
|
||||
assert_equals(iframe.contentWindow.history.scrollRestoration, 'manual', 'navigating back should retain scrollRestoration value');
|
||||
assert_equals(iframe.contentWindow.scrollX, 0, 'horizontal scroll offset should not be restored');
|
||||
assert_equals(iframe.contentWindow.scrollY, 0, 'vertical scroll offset should not be restored');
|
||||
t.done();
|
||||
}
|
||||
];
|
||||
|
||||
var stepCount = 0;
|
||||
var next = t.step_func(function() {
|
||||
steps[stepCount++]();
|
||||
});
|
||||
|
||||
iframe.onload = next;
|
||||
next();
|
||||
}, 'Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode');
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Correct behaviour of scroll restoration mode in same document history traversals</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
height: 10000px;
|
||||
width: 10000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body></body>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
history.scrollRestoration = 'auto';
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
// create history entries and then verify the impact of scrollRestoration
|
||||
// when they are popped
|
||||
var entries = {
|
||||
/* For scroll restoration mode 'auto', the spec does not require scroll
|
||||
position to be restored at any particular value. */
|
||||
'#1': {type: 'push', expectedScroll: null, scrollRestoration: 'auto'},
|
||||
'#2': {type: 'replace', expectedScroll: null, scrollRestoration: 'auto'},
|
||||
/* For scroll restoration mode 'manual', the spec requires scroll position
|
||||
not to be restored. So we expect [555,555] which is the latest position
|
||||
before navigation. */
|
||||
'#3': {type: 'push', expectedScroll: [555, 555], scrollRestoration: 'manual'},
|
||||
'#4': {type: 'replace', expectedScroll: [555, 555], scrollRestoration: 'manual'}
|
||||
};
|
||||
|
||||
// setup entries
|
||||
for (var key in entries) {
|
||||
var entry = entries[key],
|
||||
beforeValue = history.scrollRestoration,
|
||||
newValue = entry.scrollRestoration;
|
||||
|
||||
var args = [{key: key}, '', key];
|
||||
if (entry.type == 'push') {
|
||||
history.pushState.apply(history, args);
|
||||
} else {
|
||||
history.pushState(null, '', key);
|
||||
history.replaceState.apply(history, args);
|
||||
}
|
||||
assert_equals(history.scrollRestoration, beforeValue, `history.scrollRestoration value is retained after pushing new state`);
|
||||
history.scrollRestoration = newValue;
|
||||
assert_equals(history.scrollRestoration, newValue, `Setting scrollRestoration to ${newValue} works as expected`);
|
||||
window.scrollBy(50, 100);
|
||||
}
|
||||
|
||||
// setup verification
|
||||
window.addEventListener('hashchange', t.step_func(function() {
|
||||
var key = location.hash,
|
||||
entry = entries[key];
|
||||
|
||||
if (key === '') {
|
||||
t.done();
|
||||
return;
|
||||
}
|
||||
assert_equals(history.state.key, key, `state should have key: ${key}`);
|
||||
assert_equals(history.scrollRestoration, entry.scrollRestoration, 'scrollRestoration is updated correctly');
|
||||
if (entry.expectedScroll) {
|
||||
assert_equals(window.scrollX, entry.expectedScroll[0], `scrollX is correct for ${key}`);
|
||||
assert_equals(window.scrollY, entry.expectedScroll[1], `scrollY is correct for ${key}`);
|
||||
}
|
||||
|
||||
window.history.back();
|
||||
}));
|
||||
|
||||
// reset the scroll and kick off the verification
|
||||
setTimeout(function() {
|
||||
history.pushState(null, null, '#done');
|
||||
window.scrollTo(555, 555);
|
||||
window.history.back();
|
||||
}, 0);
|
||||
|
||||
}, 'history.{push,replace}State retain scroll restoration mode and navigation in the same document respects it');
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
001-2
|
||||
<script>
|
||||
parent.postMessage("001-2", "*");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
001-3.html
|
||||
<script>
|
||||
parent.postMessage("001-3", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
002-1
|
||||
<script>
|
||||
parent.postMessage("002-1", "*");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
002-2
|
||||
<script>
|
||||
parent.postMessage("002-2", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
onload = function() {
|
||||
parent.postMessage("003-1", "*");
|
||||
setTimeout(function() {location = "003-2.html";}, 100);
|
||||
}
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("003-3", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
onload = function() {
|
||||
parent.postMessage("004-1", "*");
|
||||
setTimeout(function() {location = location.href.replace("http://", "http://www.").replace("004-1.html", "004-2.html");}, 100);
|
||||
}
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("004-3", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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 id="test" 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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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("click", "*")</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>
|
||||
|
|
@ -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("click", "*")</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>
|
||||
|
|
@ -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("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</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>
|
||||
|
|
@ -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("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</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>
|
||||
|
|
@ -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("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</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>
|
||||
|
|
@ -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>
|
||||
<!-- XXX: What is this test trying to do? It's navigating the subframe, but
|
||||
doing a write() to _this_ document, and the "javascript:" in there is
|
||||
completely a red herring: it's a label, not a protocol. There is no
|
||||
javascript url involved here, unlike what the title claims! -->
|
||||
<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("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</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>
|
||||
|
|
@ -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() {
|
||||
// javascript: executions are async.
|
||||
assert_array_equals(events, ['after script', 'javascript']);
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -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 target="test" 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() {
|
||||
// javascript: executions are async.
|
||||
assert_array_equals(events, ['after script', 'submit']);
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -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() {
|
||||
// javascript: executions are async.
|
||||
assert_array_equals(events, ['click', 'after script', 'href']);
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1 @@
|
|||
<!doctype html>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<script>parent.postMessage("initial", "*")</script>
|
||||
<iframe src="child_navigates_parent_location-2.html"></iframe>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.parent.postMessage("inner", "*");
|
||||
parent.location = "child_navigates_parent_location-3.html"
|
||||
</script>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("destination", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<script>parent.postMessage("initial", "*")</script>
|
||||
<iframe src="child_navigates_parent_submit-2.html"></iframe>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("destination", "*");
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("click", "*");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Navigating to the same URL with an empty fragment aborts the navigation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<iframe src="empty_fragment_iframe.html"></iframe>
|
||||
<script>
|
||||
// If the navigation were not aborted, we would expect multiple load events
|
||||
// as the page continually reloads itself.
|
||||
async_test(function(t) {
|
||||
var count = 0;
|
||||
var iframe = document.querySelector('iframe');
|
||||
iframe.onload = t.step_func(function() {
|
||||
count++;
|
||||
});
|
||||
window.child_succeeded = t.step_func_done(function() {
|
||||
assert_equals(count, 1);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<script>
|
||||
var timeout;
|
||||
onload = function() {
|
||||
location.hash = "";
|
||||
timeout = setTimeout(function() { parent.child_succeeded() }, 2000);
|
||||
};
|
||||
|
||||
onbeforeunload = function() {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
parent.postMessage("href", "*");
|
||||
</script>
|
||||
href
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title> javascript url with query and fragment components </title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
var a = null;
|
||||
var b = null;
|
||||
var c = null;
|
||||
</script>
|
||||
|
||||
<iframe id="a" src='javascript:"nope" ? "yep" : "what";'></iframe>
|
||||
<iframe id="b" src='javascript:"wrong"; // # %0a "ok";'></iframe>
|
||||
<iframe id="c" src='javascript:"%252525 ? %252525 # %252525"'></iframe>
|
||||
|
||||
<script>
|
||||
var t = async_test("iframes with javascript src", {timeout:1000});
|
||||
function check(id, expected) {
|
||||
assert_equals(
|
||||
document.getElementById(id).contentDocument.body.textContent,
|
||||
expected);
|
||||
}
|
||||
onload = t.step_func(function() {
|
||||
check("a", "yep");
|
||||
check("b", "ok");
|
||||
check("c", "%2525 ? %2525 # %2525");
|
||||
t.done();
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that javascript: evaluation only performs a navigation to the
|
||||
result when the result is a string value.</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<iframe src="javascript:'1'"></iframe>
|
||||
<iframe src="javascript:1"></iframe>
|
||||
<iframe src="javascript:({ toString: function() { return '1'; } })"></iframe>
|
||||
<iframe src="javascript:undefined"></iframe>
|
||||
<iframe src="javascript:null"></iframe>
|
||||
<iframe src="javascript:true"></iframe>
|
||||
<iframe src="javascript:new String('1')"></iframe>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onload = t.step_func_done(function() {
|
||||
assert_equals(frames[0].document.documentElement.textContent,
|
||||
"1", "string return should cause navigation");
|
||||
// The rest of the test is disabled for now, until
|
||||
// https://github.com/whatwg/html/issues/1895 gets sorted out
|
||||
/*
|
||||
assert_equals(frames[1].document.documentElement.textContent,
|
||||
"", "number return should not cause navigation");
|
||||
assert_equals(frames[2].document.documentElement.textContent,
|
||||
"", "object return should not cause navigation");
|
||||
assert_equals(frames[3].document.documentElement.textContent,
|
||||
"", "undefined return should not cause navigation");
|
||||
assert_equals(frames[4].document.documentElement.textContent,
|
||||
"", "null return should not cause navigation");
|
||||
assert_equals(frames[5].document.documentElement.textContent,
|
||||
"", "null return should not cause navigation");
|
||||
assert_equals(frames[6].document.documentElement.textContent,
|
||||
"", "String object return should not cause navigation");
|
||||
*/
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
001-1
|
||||
<script>
|
||||
addEventListener("unload", function() {
|
||||
location = "data:text/html,unload<script>parent.postMessage('fail', '*');<\/script>";
|
||||
}, false);
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
001-1
|
||||
<script>
|
||||
addEventListener("unload", function() {
|
||||
location = location.href.replace(/[^\/\.]*\.html/, "001-3.html");
|
||||
}, false);
|
||||
</script>
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set location from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.contentWindow.location = "support/dummy.html"
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set src from a function called from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/set-parent-src.html"></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.contentWindow.go()
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set location from a function called from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/location-set.html"></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
var url = fr.contentDocument.URL
|
||||
fr.contentWindow.go()
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, url)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set the src attribute to about:blank and check referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.src = "about:blank"
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<p>Hello.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
function go() {
|
||||
location.href = "support/dummy.html"
|
||||
}
|
||||
</script>
|
||||
<p>Hello. Go.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
function go() {
|
||||
frameElement.src = "support/dummy.html"
|
||||
}
|
||||
</script>
|
||||
<p>Hello. Go.
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media documents: image</title>
|
||||
<link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
var t = async_test("The document for a standalone media file should have one child in the body.");
|
||||
|
||||
function frameLoaded() {
|
||||
var testframe = document.getElementById('testframe');
|
||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||
assert_equals(testframeChildren[0].nodeName, "IMG", "Only child of body must be an <img> element");
|
||||
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
|
||||
"Only child of body must be an HTML element");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oMFgQGMyFwHucAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media documents: video</title>
|
||||
<link rel="author" title="Michael Ventnor" href="mailto:mventnor@mozilla.com">
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-media">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
var t = async_test("The document for a standalone media file should have one child in the body.");
|
||||
|
||||
function frameLoaded() {
|
||||
var testframe = document.getElementById('testframe');
|
||||
var testframeChildren = testframe.contentDocument.body.childNodes;
|
||||
assert_equals(testframeChildren.length, 1, "Body of image document has 1 child");
|
||||
assert_equals(testframeChildren[0].nodeName, "VIDEO", "Only child of body must be an <video> element");
|
||||
assert_equals(testframeChildren[0].namespaceURI, "http://www.w3.org/1999/xhtml",
|
||||
"Only child of body must be an HTML element");
|
||||
t.done();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<iframe id="testframe" onload="t.step(frameLoaded)"
|
||||
src="data:video/webm,"></iframe>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Page load processing model for text files</title>
|
||||
<link rel="author" title="Ms2ger" href="ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#read-text">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var t = async_test("Checking document metadata for text file");
|
||||
var tD = async_test("Checking DOM for text file");
|
||||
var tC = async_test("Checking contents for text file");
|
||||
var iframe = document.body.appendChild(document.createElement("iframe"));
|
||||
iframe.onload = function(e) {
|
||||
var doc = iframe.contentDocument;
|
||||
t.step(function() {
|
||||
assert_equals(doc.compatMode, "BackCompat");
|
||||
assert_equals(doc.contentType, "text/plain");
|
||||
assert_equals(doc.doctype, null);
|
||||
t.done();
|
||||
})
|
||||
tD.step(function() {
|
||||
assert_equals(doc.childNodes.length, 1, "Document should have 1 child")
|
||||
assert_equals(doc.documentElement.tagName, "HTML");
|
||||
assert_equals(doc.documentElement.childNodes.length, 2,
|
||||
"Root element should have 2 children")
|
||||
assert_equals(doc.documentElement.firstChild.tagName, "HEAD");
|
||||
assert_equals(doc.documentElement.lastChild.tagName, "BODY");
|
||||
assert_equals(doc.documentElement.lastChild.childNodes.length, 1,
|
||||
"Body element should have 1 child")
|
||||
assert_equals(doc.documentElement.lastChild.firstChild.tagName, "PRE");
|
||||
tD.done();
|
||||
})
|
||||
tC.step(function() {
|
||||
assert_equals(doc.documentElement.lastChild.firstChild.firstChild.data,
|
||||
"This is a sample text/plain document.\n\nThis is not an HTML document.\n\n");
|
||||
tC.done();
|
||||
})
|
||||
};
|
||||
iframe.src = "../../../../common/text-plain.txt";
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue