diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/browsers/history/the-location-interface | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/browsers/history/the-location-interface')
59 files changed, 1120 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep b/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html new file mode 100644 index 000000000..f72ed1eaf --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html @@ -0,0 +1,197 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + + <title>Location objects' custom [[GetPrototypeOf]] trap permit [[Prototype]] chain cycles to be created through them</title> + + <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" /> + <link rel="help" href="https://tc39.github.io/ecma262/#sec-ordinarysetprototypeof" /> + <link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#location-getprototypeof" /> + + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> + +<hr /> + +<iframe id="same-origin-different-window"></iframe> +<iframe id="cross-origin-joined-via-document-domain"></iframe> + +<script> +"use strict"; + +// Handle same-origin, same-window testing first, before any async-requiring +// testing. +test(function() { + var LocationPrototype = Location.prototype; + var ObjectPrototype = Object.prototype; + + var loc = window.location; + + var locProto = Object.getPrototypeOf(loc); + assert_equals(locProto, LocationPrototype, + "loc's initial [[Prototype]]"); + + var originalLocProtoProto = Object.getPrototypeOf(locProto); + assert_equals(originalLocProtoProto, ObjectPrototype, + "Location.prototype's initial [[Prototype]]"); + + Object.setPrototypeOf(locProto, loc); + + assert_equals(Object.getPrototypeOf(locProto), loc, + "LocationPrototype's new [[Prototype]]"); + assert_equals(Object.getPrototypeOf(loc), locProto, + "loc's new [[Prototype]]"); + + // Reset so as not to muck with testharness.js expectations. + Object.setPrototypeOf(locProto, originalLocProtoProto); +}, "same-origin, same-window location cycle"); + +var pathdir = + location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1); + +var triggerCrossOriginTest = (function() { + var crossOrigin = + document.getElementById("cross-origin-joined-via-document-domain"); + + var t = async_test("cross-origin location has null prototype"); + + return new Promise(function(resolve, reject) { + crossOrigin.onload = t.step_func_done(function(e) { + try { + var win = crossOrigin.contentWindow; + + var loc = win.location; + + // Between un-opted-in windows, location objects appear to have null + // [[Prototype]]. + assert_equals(Object.getPrototypeOf(loc), null, + "cross-origin unjoined location's [[Prototype]"); + + resolve(); + } catch (e) { + reject(e); + throw e; + } + }); + + crossOrigin.src = + "//{{domains[www]}}:" + location.port + pathdir + "cross_origin_joined_frame.sub.html"; + }) + .catch(t.unreached_func("crossOrigin onload/src setting")); +})(); + +var triggerSameOriginTest = (function() { + var sameOriginDifferentWindow = + document.getElementById("same-origin-different-window"); + + var t = async_test("same-origin, different-window location cycle"); + + return new Promise(function(resolve, reject) { + sameOriginDifferentWindow.onload = t.step_func_done(function() { + try { + var win = sameOriginDifferentWindow.contentWindow; + + var loc = win.location; + var LocationPrototype = win.Location.prototype; + var ObjectPrototype = win.Object.prototype; + + var locProto = Object.getPrototypeOf(loc); + assert_equals(locProto, LocationPrototype, + "loc's initial [[Prototype]]"); + + var originalLocProtoProto = Object.getPrototypeOf(locProto); + assert_equals(originalLocProtoProto, ObjectPrototype, + "Location.prototype's initial [[Prototype]]"); + + Object.setPrototypeOf(locProto, loc); + + assert_equals(Object.getPrototypeOf(locProto), loc, + "LocationPrototype's new [[Prototype]]"); + assert_equals(Object.getPrototypeOf(loc), locProto, + "loc's new [[Prototype]]"); + + // Reset so as not to muck with testharness.js expectations. + Object.setPrototypeOf(locProto, originalLocProtoProto); + + resolve(); + } catch (e) { + reject(e); + throw e; + } + }); + + sameOriginDifferentWindow.src = "same_origin_frame.html"; + }) + .catch(t.unreached_func("sameOriginDifferentWindow onload/src setting")); +})(); + +function crossOriginJoinTest() { + var win = + document.getElementById("cross-origin-joined-via-document-domain") + .contentWindow; + + assert_equals(document.domain, "{{host}}"); + + var loc = win.location; + + var threw = false; + try { + // Still cross-origin until the document.domain set below. + win.Location; + } catch (e) { + threw = true; + } + + assert_equals(threw, true, + "accessing win.Location before joining win's origin"); + + // Join with other frames that have set |document.domain| to this same + // value -- namely, this cross-origin frame. Now access between the two + // windows should be permitted. + assert_equals(document.domain, "{{host}}", + "initial document.domain sanity check"); + document.domain = "{{host}}"; + + var LocationPrototype = win.Location.prototype; + var ObjectPrototype = win.Object.prototype; + + var locProto = Object.getPrototypeOf(loc); + assert_equals(locProto, LocationPrototype, + "loc's initial [[Prototype]]"); + + var originalLocProtoProto = Object.getPrototypeOf(locProto); + assert_equals(originalLocProtoProto, ObjectPrototype, + "Location.prototype's initial [[Prototype]]"); + + Object.setPrototypeOf(locProto, loc); + + assert_equals(Object.getPrototypeOf(locProto), loc, + "LocationPrototype's new [[Prototype]]"); + assert_equals(Object.getPrototypeOf(loc), locProto, + "loc's new [[Prototype]]"); + + // Reset so as not to muck with testharness.js expectations. + Object.setPrototypeOf(locProto, originalLocProtoProto); +} + +function run() { + var t = + async_test("cross-origin, but joined via document.domain, location cycle"); + + // The cross-origin/joined case must be tested after both unjoined same-origin + // and unjoined cross-origin tests: by mucking with document.domain, the + // cross-origin/joined case makes it impossible to perform those tests. + t.step(function() { + Promise.all([triggerCrossOriginTest, triggerSameOriginTest]) + .then(t.step_func_done(crossOriginJoinTest), + t.unreached_func("cross-origin joined error case")); + }); +} +run(); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html new file mode 100644 index 000000000..3d2b89722 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-1.html @@ -0,0 +1,9 @@ +<!doctype html> +1 +<script> +onload = parent.t.step_func(function() { + setTimeout(function() { + location = location.toString().replace("assign_after_load-1.html", "assign_after_load-2.html"); + }, 100); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html new file mode 100644 index 000000000..94679571b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +2 +<script> +onload = parent.t.step_func(function() { + setTimeout(function() {parent.do_test()}, 100); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html new file mode 100644 index 000000000..00dc931d4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_after_load.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>Assignment to location after document is completely loaded</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe></iframe> +<script> +var t = async_test(); +var history_length; + +onload = t.step_func(function() { + setTimeout(function() { + history_length = history.length; + document.getElementsByTagName("iframe")[0].src = "assign_after_load-1.html"; + }, 100); +}); + +do_test = t.step_func(function() { + assert_equals(history.length, history_length + 2); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html new file mode 100644 index 000000000..2549867c8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-1.html @@ -0,0 +1,7 @@ +<!doctype html> +1 +<script> +onload = parent.t.step_func(function() { + location = location.toString().replace("assign_before_load-1.html", "assign_before_load-2.html"); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html new file mode 100644 index 000000000..94679571b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +2 +<script> +onload = parent.t.step_func(function() { + setTimeout(function() {parent.do_test()}, 100); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html new file mode 100644 index 000000000..62a2aa7c6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/assign_before_load.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>Assignment to location before document is completely loaded</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe></iframe> +<script> +var t = async_test(); +var history_length; + +onload = t.step_func(function() { + setTimeout(function() { + history_length = history.length; + document.getElementsByTagName("iframe")[0].src = "assign_before_load-1.html"; + }, 100); +}); + +do_test = t.step_func(function() { + assert_equals(history.length, history_length + 1); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json b/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json new file mode 100644 index 000000000..d311dbb31 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/contains.json @@ -0,0 +1,6 @@ +[ + { + "id": "security-location", + "original_id": "security-location" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html new file mode 100644 index 000000000..a3ffdd005 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/cross_origin_joined_frame.sub.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>Cross-origin subframe for Location cyclic [[Prototype]] test</title> + <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" /> +</head> +<body> +<script> +document.domain = "{{host}}"; +</script> +<!-- this should be accessible to the parent once it sets document.domain --> +<p>Cross-origin iframe with joined <code>document.domain</code></p> +</body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html new file mode 100644 index 000000000..5ccc9c76b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/document_location.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>document.location</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + var doc = document.implementation.createHTMLDocument(""); + assert_equals(doc.location, null); +}, "document not in a browsing context"); + +test(function() { + assert_equals(document.location, location); +}, "document.location equals window.location"); + +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html new file mode 100644 index 000000000..726aaea23 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-prototype-setting.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset=utf-8> +<title>[[SetPrototypeOf]] on a location object should return false</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script> + test(function() { + var origProto = Object.getPrototypeOf(location); + assert_throws(new TypeError, function() { + Object.setPrototypeOf(location, {}); + }); + assert_throws(new TypeError, function() { + location.__proto__ = {}; + }); + assert_false(Reflect.setPrototypeOf(location, {})); + assert_equals(Object.getPrototypeOf(location), origProto); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html new file mode 100644 index 000000000..d23323b37 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location-stringifier.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<title>Location stringifier</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://heycam.github.io/webidl/#es-stringifier"> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=/common/stringifiers.js></script> +<div id=log></div> +<script> +test_stringifier_attribute(location, "href", true); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html new file mode 100644 index 000000000..7e18804c2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign.html @@ -0,0 +1,26 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_assign</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var href = location.href; + location.assign('#x'); + + assert_equals((href + "#x"), location.href, "location href"); + + }, "location assign"); + + test(function () { + var href = location.href; + assert_throws('SYNTAX_ERR', function() { location.assign("http://:"); }); + assert_equals(location.href, href); + }, "URL that fails to parse"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html new file mode 100644 index 000000000..b43598f2c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank-1.html @@ -0,0 +1,2 @@ +<!doctype html> +Filler text diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html new file mode 100644 index 000000000..f3f7cf26b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_assign_about_blank.html @@ -0,0 +1,24 @@ +<!doctype html> +<title>location.assign with initial about:blank browsing context</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe></iframe> +<script> +var t = async_test(); +var history_length; +onload = t.step_func(function() { + setTimeout(t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.onload = t.step_func(function() { + setTimeout(t.step_func(function() { + assert_equals(history.length, history_length); + t.done(); + }), 100); + }); + history_length = history.length; + iframe.src = "location_assign_about_blank-1.html" + }), 100); +}); +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html new file mode 100644 index 000000000..74d2d0154 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hash.html @@ -0,0 +1,33 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_hash</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <iframe id="srcdoc-iframe" + srcdoc="<div style='height: 200vh'></div><div id='test'></div>"></iframe> + <script> + test(function () { + window.history.pushState(1, document.title, '#x=1'); + var hash = location.hash; + + assert_equals(hash, "#x=1", "hash"); + + }, "location hash"); + + var t = async_test("Setting location.hash on srcdoc iframe"); + addEventListener("load", t.step_func_done(function() { + var frameWin = document.getElementById("srcdoc-iframe").contentWindow; + assert_equals(frameWin.location.href, "about:srcdoc"); + assert_equals(frameWin.scrollY, 0, "Should not have scrolled yet"); + frameWin.location.hash = "test"; + assert_equals(frameWin.location.href, "about:srcdoc#test"); + assert_true(frameWin.scrollY > frameWin.innerHeight, + "Should have scrolled by more than one viewport height"); + })); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html new file mode 100644 index 000000000..d93bf47e5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_host.html @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_host</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var host = location.host; + var url = location.href; + + var pos = url.indexOf("//"); + if (pos != -1) { + url = url.substr(pos+2, url.length-pos-2); + pos = url.indexOf("/"); + if (pos != -1) + url = url.substr(0, pos); + } + + assert_equals(host, url, "host"); + + }, "location host"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html new file mode 100644 index 000000000..2ffa0e5fc --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_hostname.html @@ -0,0 +1,33 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_hostname</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var hostname = location.hostname; + var url = location.href; + + var pos = url.indexOf("//"); + if (pos != -1) { + url = url.substr(pos+2, url.length-pos-2); + pos = url.indexOf(":"); + if (pos != -1) { + url = url.substr(0, pos); + } else { + pos = url.indexOf("/"); + if (pos != -1) + url = url.substr(0, pos); + } + } + + assert_equals(hostname, url, "hostname"); + + }, "location hostname"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html new file mode 100644 index 000000000..1aa85dcdc --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_href.html @@ -0,0 +1,19 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_href</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var href = location.href; + + assert_equals(href, document.URL, "href"); + + }, "location href"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html new file mode 100644 index 000000000..2325f4018 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_origin.html @@ -0,0 +1,14 @@ +<!doctype html> +<meta charset="utf-8"> +<title></title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + test(function () { + assert_equals( + location.origin, + location.protocol + '//' + location.host, + "origin" + ); + }, "location origin"); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html new file mode 100644 index 000000000..dea05d2f3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_pathname.html @@ -0,0 +1,22 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_pathname</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var pathname = location.pathname; + var url = location.href + + url = url.replace(location.protocol + "//" + location.host, ""); + + assert_equals(pathname, url, "pathname"); + + }, "location pathname"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html new file mode 100644 index 000000000..fa1308ca5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_port.html @@ -0,0 +1,31 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_port</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var port = location.port; + var url = location.href; + + var pos = url.indexOf("//"); + if (pos != -1) { + url = url.substr(pos+2, url.length-pos-2); + pos = url.indexOf("/"); + if (pos != -1) + url = url.substr(0, pos); + pos = url.indexOf(":"); + if (pos != -1) + url = url.substr(pos+1, url.length-pos-1); + } + + assert_equals(port, url, "port"); + + }, "location port"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html new file mode 100644 index 000000000..d28bd5639 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_protocol.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_protocol</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var protocol = location.protocol; + var url = location.href; + + var pos = url.indexOf("//"); + if (pos != -1) { + url = url.substr(0, pos); + } + + assert_equals(protocol, url, "protocol"); + + }, "location protocol"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html new file mode 100644 index 000000000..95b63d9f5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload-iframe.html @@ -0,0 +1,4 @@ +<script> + parent._ping(window.location.href) + location.reload(); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html new file mode 100644 index 000000000..78b3cc35e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_reload</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + + <iframe></iframe> + + <script> + var history_length; + async_test(function(t) { + + var url = new URL("./location_reload-iframe.html", window.location).href; + var pingCount = 0; + + window._ping = t.step_func(function(innerURL) { + // Some browsers keep 'about:blank' in the session history + if (pingCount == 0) { + history_length = history.length; + } + assert_equals(url, innerURL, "iframe url (" + pingCount + ")"); + assert_equals(history_length, history.length, "history length (" + pingCount + ")"); + pingCount++; + if (pingCount == 5) { + iframe.src = 'about:blank'; + t.done(); + } + }); + + var iframe = document.querySelector("iframe"); + iframe.src = url; + history_length = history.length; + }); + </script> + + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html new file mode 100644 index 000000000..2f2d57308 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_replace.html @@ -0,0 +1,20 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_replace</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + var href = location.href; + location.replace('#x'); + + assert_equals((href + "#x"), location.href, "location href"); + + }, "location replace"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html new file mode 100644 index 000000000..f9db75784 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/location_search.html @@ -0,0 +1,20 @@ +<!DOCTYPE HTML> +<html> + <head> + <title>location_search</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + test(function () { + window.history.pushState(1, document.title, '?x=1'); + var search = location.search; + + assert_equals(search, "?x=1", "search"); + + }, "location search"); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html new file mode 100644 index 000000000..c762ece3b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-1.html @@ -0,0 +1,7 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<a onclick="location = 'manual_click_assign_during_load-2.html'; return false;" href>Click Here</a> +<p>Filler image to keep the page loading:</p> +<img src="/images/smiley.png?pipe=trickle(20:d1:r2)"> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html new file mode 100644 index 000000000..4f2555c5e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_assign_during_load-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Assignment to location with click during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("manual_click_assign_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length + 1); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html new file mode 100644 index 000000000..e9d03e936 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-1.html @@ -0,0 +1,10 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<a onclick="location.replace('manual_click_location_replace_during_load-2.html'); return false;" href>Click Here</a> +<p>Filler image to keep the page loading:</p> +<img> +<script> +document.images[0].src = "/images/smiley.png?pipe=trickle(20:d1:r2)&random=" + Math.random(); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html new file mode 100644 index 000000000..43af1b1d3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_location_replace_during_load-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>location.replace with click during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("manual_click_location_replace_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html new file mode 100644 index 000000000..3507222ca --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_click_replace_during_load-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Assignment to location with click during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("manual_click_replace_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html new file mode 100644 index 000000000..08f7e2dd6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-1.html @@ -0,0 +1,9 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<form onsubmit="location = 'manual_form_submit_assign_during_load-2.html'; return false;"> +<input type=submit value="Click Me"> +</form> +<p>Filler image to keep the page loading:</p> +<img src="/images/smiley.png?pipe=trickle(20:d1:r2)"> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html new file mode 100644 index 000000000..df6487407 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/manual_form_submit_assign_during_load-manual.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Assignment to location with form submit during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("manual_form_submit_assign_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length + 1); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html new file mode 100644 index 000000000..05b44f4c4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-1.html @@ -0,0 +1,15 @@ +<!doctype html> +<p>Resize this window. FAIL if the window doesn't close shortly afterwards.</p> +<script> +onload = opener.t.step_func(function() { + opener.load_count++; + if (opener.load_count > 1) { + opener.do_test(); + } +}) + +onresize = opener.t.step_func(function() { + opener.flag_resized(); + location.reload(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html new file mode 100644 index 000000000..1991cee8a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/non-automated/reload_in_resize-manual.html @@ -0,0 +1,26 @@ +<!doctype html> +<title>Reload called from resize event</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>Resize the popup window. That window should then close and the result be presented here. If that window doesn't close after resize that's a FAIL.</p> +<div id="log"></div> +<script> +setup({timeout:3600000}) +var t = async_test(undefined, {timeout:3600000}); +var load_count = 0; +var resized = false; +var win = window.open("reload_in_resize-1.html") + +flag_resized = t.step_func(function() { + resized = true; + setTimeout(do_test, 1000); +}); + +do_test = t.step_func(function() { + win.close(); + assert_true(resized, "Resize event happened"); + assert_equals(load_count, 1, "Number of load events"); + t.done(); +}); +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html new file mode 100644 index 000000000..1c5a1db8f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write-1.html @@ -0,0 +1,14 @@ +<!doctype html> +1 +<script> +function f() { + opener.postMessage("original", "*"); + setTimeout(function () { + document.open(); + document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>"); + document.close(); + }), 100; +} + +window.onload = f +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html new file mode 100644 index 000000000..0fc2a2c3d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_open_write.html @@ -0,0 +1,26 @@ +<!doctype html> +<title>Reload document with document.open and document.written content</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var win = window.open("reload_document_open_write-1.html"); +var t = async_test(); + +var data = []; + +window.onmessage = t.step_func(function(e) { + data.push(e.data); + if (data.length < 3) { + win.location.reload(); + } else { + setTimeout(t.step_func(function() { + assert_array_equals(data, ["original", "written", "written"]); + t.done(); + }), 500); + } +}); + +add_completion_callback(function() {win.close()}); +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html new file mode 100644 index 000000000..9a0843392 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write-1.html @@ -0,0 +1,4 @@ +<script> +document.write(Math.random()); +opener.postMessage(document.body.innerHTML, "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html new file mode 100644 index 000000000..dfbd436a4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>Reload document with document.written content</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var win = window.open("reload_document_write-1.html"); +var t = async_test(); + +window.onmessage = t.step_func(function(e) { + var initial_value = e.data; + win.location.reload(); + window.onmessage = t.step_func(function(e) { + assert_true(e.data !== initial_value); + t.done(); + }); +}); + +add_completion_callback(function() {win.close()}); +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html new file mode 100644 index 000000000..36445af3c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload-1.html @@ -0,0 +1,9 @@ +<script> +function f() { + opener.postMessage("original", "*"); + document.write("<!doctype html>2<script>opener.postMessage('written', '*');<\/script>"); + document.close(); +} + +window.onload = f +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html new file mode 100644 index 000000000..b2cf31147 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_document_write_onload.html @@ -0,0 +1,26 @@ +<!doctype html> +<title>Reload document with document.written content written in load event</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var win = window.open("reload_document_write_onload-1.html"); +var t = async_test(); + +var data = []; + +window.onmessage = t.step_func(function(e) { + data.push(e.data); + if (data.length < 3) { + win.location.reload(); + } else { + setTimeout(t.step_func(function() { + assert_array_equals(data, ["original", "written", "written"]); + t.done(); + }), 500); + } +}); + +add_completion_callback(function() {win.close()}); +</script> + diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html new file mode 100644 index 000000000..69e48f77c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1-1.html @@ -0,0 +1,10 @@ +<script> +onload = function() {opener.next()} +document.write(Math.random()); +</script> + +<form method="POST" action=""> +<input type=hidden name=test value=test> +<input type=submit> +</form> +<button onclick="location.reload()">Reload</button> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html new file mode 100644 index 000000000..080545e23 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/reload_post_1.html @@ -0,0 +1,27 @@ +<!doctype html> +<title>Reload document with POST</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var win = window.open("reload_post_1-1.html"); +var t = async_test(); +var posted = false; +var reloaded = false; + +next = t.step_func(function() { + +if (posted && !reloaded) { + reloaded = true; + win.location.reload(); +} else if (posted && reloaded) { + t.done(); +} else { + posted = true; + win.document.forms[0].submit(); +} + +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html new file mode 100644 index 000000000..953e696b2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/same_origin_frame.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <title>Same-origin subframe for Location cyclic [[Prototype]] test</title> + <link rel="author" title="Jeff Walden" href="http://whereswalden.com/" /> +</head> +<body> +<!-- nothing to do, this window should be accessible to the parent frame --> +<p>Same-origin iframe</p> +</body> +</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html new file mode 100644 index 000000000..9561cabdd --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-1.html @@ -0,0 +1,10 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<a onclick="location = 'scripted_click_assign_during_load-2.html'; return false;" href>Click Here</a> +<script> +document.links[0].click() +</script> +<p>Filler image to keep the page loading:</p> +<img src="/images/smiley.png?pipe=trickle(20:d1:r2)"> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html new file mode 100644 index 000000000..4d7352f4c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_assign_during_load.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Assignment to location with click during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("scripted_click_assign_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html new file mode 100644 index 000000000..05bb42f96 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-1.html @@ -0,0 +1,13 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<a onclick="location.assign('scripted_click_location_assign_during_load-2.html'); return false;" href>Click Here</a> +<script> +document.links[0].click() +</script> +<p>Filler image to keep the page loading:</p> +<img> +<script> +document.images[0].src = "/images/smiley.png?pipe=trickle(20:d1:r2)&random=" + Math.random() +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html new file mode 100644 index 000000000..64f3ff942 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_click_location_assign_during_load.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>location.assign with click during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +var t = async_test(); +var win = window.open("scripted_click_location_assign_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length + 1); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html new file mode 100644 index 000000000..ae07ac5cf --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-1.html @@ -0,0 +1,12 @@ +<!doctype html> +<script> +opener.history_length = history.length; +</script> +<form onsubmit="location = 'scripted_form_submit_assign_during_load-2.html'; return false;"> +<input type=submit value="Click Me"> +</form> +<script> +document.forms[0].elements[0].click() +</script> +<p>Filler image to keep the page loading:</p> +<img src="/images/smiley.png?pipe=trickle(20:d1:r2)"> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html new file mode 100644 index 000000000..1bf7f41e0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load-2.html @@ -0,0 +1,7 @@ +<!doctype html> +<p>This window should close itself and the test result appear in the original window +<script> +onload = function() { + setTimeout(function() {opener.do_test(history.length); window.close();}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html new file mode 100644 index 000000000..981b9c9a3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/scripted_form_submit_assign_during_load.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Assignment to location with form submit during load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<p>The popup blocker must be disabled for this test</p> +<div id="log"></div> +<script> +setup({timeout:3600000}); +var t = async_test(undefined, {timeout:3600000}); +var win = window.open("scripted_form_submit_assign_during_load-1.html"); + +var history_length; +do_test = t.step_func(function(new_length) { + assert_equals(new_length, history_length); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm b/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm new file mode 100644 index 000000000..f509c23b1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-location-interface/security_location_0.sub.htm @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <title>Location interface Security</title> + <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> + <link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location" /> + <meta name="assert" content="access location object from different origins doesn't raise SECURITY_ERR exception" /> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <p>Access location object from different origins doesn't raise SECURITY_ERR exception</p> + <div id=log></div> + <script src="/common/get-host-info.sub.js"></script> + <script> + var runTest = async_test("Accessing location object from different origins doesn't raise SECURITY_ERR exception").step_func_done(function() { + var frame = document.getElementById('testframe'); + frame.setAttribute('onload', ''); + frame.contentWindow.location = get_host_info().HTTP_REMOTE_ORIGIN + "/"; + }); + </script> + <iframe id='testframe' onload="runTest()">Test Frame</iframe> + <script> + document.getElementById('testframe').setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + '/'); + </script> + </body> +</html> |