mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
Update web-platform-tests to revision ad99a9e949c6006cc0f609501de77a0edb1e593a
This commit is contained in:
parent
6e28d7b3ec
commit
f1ca6b4be4
89 changed files with 2406 additions and 267 deletions
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Base URLs used in resolving specifiers in dynamic imports from importScripts()</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker("./worker-importScripts.sub.js"));
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Base URLs used in resolving specifiers in dynamic imports from workers</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker(
|
||||
"../beta/redirect.py?location=http://{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js"));
|
||||
</script>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Base URLs used in resolving specifiers in dynamic imports</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
self.testName = "same origin classic <script>";
|
||||
self.baseUrlSanitized = false;
|
||||
</script>
|
||||
<script src="../beta/redirect.py?location=http://{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js"></script>
|
||||
|
||||
<script>
|
||||
self.testName = "cross origin classic <script> without crossorigin attribute";
|
||||
self.baseUrlSanitized = true;
|
||||
</script>
|
||||
<script src="../beta/redirect.py?location=http://{{hosts[alt][]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js"></script>
|
||||
|
||||
<script>
|
||||
self.testName = "cross origin classic <script> with crossorigin attribute";
|
||||
self.baseUrlSanitized = false;
|
||||
</script>
|
||||
<script src="../beta/redirect.py?location=http://{{hosts[alt][]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js%3Fpipe=header(Access-Control-Allow-Origin,*)" crossorigin></script>
|
||||
|
||||
<script>
|
||||
self.testName = "cross origin module <script>";
|
||||
self.baseUrlSanitized = false;
|
||||
</script>
|
||||
<script src="../beta/redirect.py?location=http://{{hosts[alt][]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js%3Fpipe=header(Access-Control-Allow-Origin,*)" type="module"></script>
|
|
@ -0,0 +1 @@
|
|||
export const A = { "from": "alpha/import.js" };
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
|
||||
// CORS-same-origin
|
||||
self.testName = "same-origin importScripts()";
|
||||
self.baseUrlSanitized = false;
|
||||
importScripts("../beta/redirect.py?location=http://{{host}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js");
|
||||
|
||||
// CORS-cross-origin
|
||||
self.testName = "cross-origin importScripts()";
|
||||
self.baseUrlSanitized = true;
|
||||
importScripts("../beta/redirect.py?location=http://{{hosts[alt][]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/base-url.sub.js");
|
||||
|
||||
done();
|
|
@ -0,0 +1 @@
|
|||
export const A = { "from": "beta/import.js" };
|
|
@ -0,0 +1,19 @@
|
|||
def main(request, response):
|
||||
"""Simple handler that causes redirection.
|
||||
|
||||
The request should typically have two query parameters:
|
||||
status - The status to use for the redirection. Defaults to 302.
|
||||
location - The resource to redirect to.
|
||||
"""
|
||||
status = 302
|
||||
if b"status" in request.GET:
|
||||
try:
|
||||
status = int(request.GET.first(b"status"))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
response.status = status
|
||||
|
||||
location = request.GET.first(b"location")
|
||||
|
||||
response.headers.set(b"Location", location)
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
// This script triggers import(), and thus the base URL of this script
|
||||
// (either loaded by `<script>` or `importScripts()`) is used as the base URL
|
||||
// of resolving relative URL-like specifiers in `import()`.
|
||||
|
||||
// The following fields should be set by the callers of this script
|
||||
// (unless loaded as the worker top-level script):
|
||||
// - self.testName (string)
|
||||
// - self.baseUrlSanitized (boolean)
|
||||
|
||||
// When this script is loaded as the worker top-level script:
|
||||
if ('DedicatedWorkerGlobalScope' in self &&
|
||||
self instanceof DedicatedWorkerGlobalScope &&
|
||||
!self.testName) {
|
||||
importScripts("/resources/testharness.js");
|
||||
self.testName = 'worker top-level script';
|
||||
// Worker top-level scripts are always same-origin.
|
||||
self.baseUrlSanitized = false;
|
||||
}
|
||||
|
||||
{
|
||||
// This could change by the time the test is executed, so we save it now.
|
||||
// As this script is loaded multiple times, savedBaseUrlSanitized is scoped.
|
||||
const savedBaseUrlSanitized = self.baseUrlSanitized;
|
||||
|
||||
promise_test(() => {
|
||||
const promise = import("./import.js?pipe=header(Access-Control-Allow-Origin,*)&label=relative-" + self.testName);
|
||||
if (savedBaseUrlSanitized) {
|
||||
// The base URL is "about:blank" and thus import() here should fail.
|
||||
return promise.then(module => {
|
||||
// This code should be unreached, but assert_equals() is used here
|
||||
// to log `module.A["from"]` in case of unexpected resolution.
|
||||
assert_equals(module.A["from"], "(unreached)",
|
||||
"Relative URL-like specifier resolution should fail");
|
||||
assert_unreached();
|
||||
},
|
||||
() => {});
|
||||
} else {
|
||||
// The base URL is the response URL of this script, i.e.
|
||||
// `.../gamma/base-url.sub.js`.
|
||||
return promise.then(module => {
|
||||
assert_equals(module.A["from"], "gamma/import.js");
|
||||
});
|
||||
}
|
||||
},
|
||||
"Relative URL-like from " + self.testName);
|
||||
}
|
||||
|
||||
promise_test(() => {
|
||||
return import("http://{{hosts[alt][]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/dynamic-import/gamma/import.js?pipe=header(Access-Control-Allow-Origin,*)&label=absolute-" + self.testName)
|
||||
.then(module => {
|
||||
assert_equals(module.A["from"], "gamma/import.js");
|
||||
})
|
||||
},
|
||||
"Absolute URL-like from " + self.testName);
|
||||
|
||||
done();
|
|
@ -0,0 +1 @@
|
|||
export const A = { "from": "gamma/import.js" };
|
Loading…
Add table
Add a link
Reference in a new issue