summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/history/the-history-interface/history.js')
-rw-r--r--testing/web-platform/tests/html/browsers/history/the-history-interface/history.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js b/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js
new file mode 100644
index 0000000000..bb5ee6dde0
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/history.js
@@ -0,0 +1,35 @@
+function parse_query() {
+ var query = location.search.slice(1);
+ var vars = query.split("&");
+ var fields = {};
+ vars.forEach(
+ function (x) {
+ var split = x.split("=");
+ return fields[split[0]] = split.slice(1).join("=");
+ });
+ return fields;
+}
+
+var query_parts = parse_query();
+var id = "id" in query_parts ? parseInt(query_parts.id) : 1;
+var urls_to_load = query_parts.urls.split(",");
+
+document.write(id);
+
+onunload = function() {};
+
+function queue_next() {
+ t = opener.t;
+ setTimeout(t.step_func(
+ function() {
+// opener.assert_equals(history.length, id);
+ if (urls_to_load[0]) {
+ var next_page = urls_to_load[0];
+ (next_page.indexOf("?") > -1) ? (next_page += "&") : (next_page += "?");
+ next_page += "urls=" + urls_to_load.slice(1).join(",");
+ next_page += "&id=" + ++id;
+ location = next_page;
+ }
+ }
+ ), 100);
+}