Make the multi-global tests more robust.

This commit is contained in:
Ms2ger 2016-12-19 19:12:38 +01:00
parent d918c14247
commit 26cf0a7a8c
6 changed files with 5 additions and 17 deletions

View file

@ -1,5 +0,0 @@
[url-parsing.html]
type: testharness
[should parse the URL relative to the current settings object]
expected: FAIL

View file

@ -1,5 +0,0 @@
[url-parsing.html]
type: testharness
[should parse the redirect Location URL relative to the current settings object]
expected: FAIL

View file

@ -6,9 +6,8 @@
<script>
'use strict';
const current = document.querySelector('#c').contentWindow;
window.createRequest = (...args) => {
const current = document.querySelector('#c').contentWindow;
return new current.Request(...args);
};

View file

@ -18,7 +18,7 @@ const loadPromise = new Promise(resolve => {
promise_test(() => {
return loadPromise.then(() => {
const req = frames[0].createRequest("url");
const req = document.querySelector('iframe').contentWindow.createRequest("url");
assert_equals(req.url, new URL("current/url", location.href).href);
});

View file

@ -7,10 +7,9 @@
<script>
'use strict';
const current = document.querySelector('#c').contentWindow;
const relevant = document.querySelector('#r').contentWindow;
window.createRedirectResponse = (...args) => {
const current = document.querySelector('#c').contentWindow;
const relevant = document.querySelector('#r').contentWindow;
return current.Response.redirect.call(relevant.Response, ...args);
};

View file

@ -18,7 +18,7 @@ const loadPromise = new Promise(resolve => {
promise_test(() => {
return loadPromise.then(() => {
const res = frames[0].createRedirectResponse("url");
const res = document.querySelector('iframe').contentWindow.createRedirectResponse("url");
assert_equals(res.headers.get("Location"), new URL("current/url", location.href).href);
});