Commit 6e1a1cdb authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Worklet: Specify "Allow-Access-Control-Origin" header by *.js.headers files in WPT

This is a clean-up CL. This specifies "Allow-Access-Control-Origin" header by
*.js.headers files instead of "pipe=header()" query parameters for
simplification.

Bug: n/a
Change-Id: Ia18ea8a1e00ea6854f69771d911bf3e4d88379d2
Reviewed-on: https://chromium-review.googlesource.com/804921Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521284}
parent 66b4dc80
......@@ -30,8 +30,7 @@ function runContentSecurityPolicyTests(workletType) {
'Content-Security-Policy, script-src \'self\' \'unsafe-inline\')';
const kScriptURL =
get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/import-empty-worklet-script.js' +
'?pipe=header(Access-Control-Allow-Origin, *)';
'/worklets/resources/import-empty-worklet-script-with-cors-header.js';
return openWindowAndExpectResult(
kWindowURL, kScriptURL, workletType, 'REJECTED');
}, 'Importing a remote-origin worklet script should be blocked by the ' +
......@@ -51,9 +50,9 @@ function runContentSecurityPolicyTests(workletType) {
const kWindowURL =
'resources/addmodule-window.html?pipe=header(' +
'Content-Security-Policy, script-src * \'unsafe-inline\')';
const kScriptURL = get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/empty-worklet-script.js' +
'?pipe=header(Access-Control-Allow-Origin, *)';
const kScriptURL =
get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/empty-worklet-script-with-cors-header.js';
return openWindowAndExpectResult(
kWindowURL, kScriptURL, workletType, 'RESOLVED');
}, 'Importing a remote-origin worklet script should not be blocked ' +
......@@ -65,9 +64,9 @@ function runContentSecurityPolicyTests(workletType) {
'Content-Security-Policy, script-src * \'unsafe-inline\')';
// A worklet on HTTPS_REMOTE_ORIGIN will import a child script on
// HTTPS_REMOTE_ORIGIN.
const kScriptURL = get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/import-empty-worklet-script.js' +
'?pipe=header(Access-Control-Allow-Origin, *)';
const kScriptURL =
get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/import-empty-worklet-script-with-cors-header.js';
return openWindowAndExpectResult(
kWindowURL, kScriptURL, workletType, 'RESOLVED');
}, 'Importing a remote-origin script from a remote-origin worklet script '+
......@@ -77,9 +76,9 @@ function runContentSecurityPolicyTests(workletType) {
const kWindowURL =
'resources/addmodule-window.html?pipe=header(' +
'Content-Security-Policy, worker-src \'self\' \'unsafe-inline\')';
const kScriptURL = get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/empty-worklet-script.js' +
'?pipe=header(Access-Control-Allow-Origin, *)';
const kScriptURL =
get_host_info().HTTPS_REMOTE_ORIGIN +
'/worklets/resources/empty-worklet-script-with-cors-header.js';
return openWindowAndExpectResult(
kWindowURL, kScriptURL, workletType, 'RESOLVED');
}, 'Importing a remote-origin worklet script should not be blocked by ' +
......
// This file and descendant files are served with "Access-Control-Allow-Origin"
// header.
import './empty-worklet-script-with-cors-header.js';
// This script can be imported as a remote-origin script, so the
// Access-Control-Allow-Origin is specified here.
import './empty-worklet-script.js?pipe=header(Access-Control-Allow-Origin, *)';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment