| Index: LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php
|
| diff --git a/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php b/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php
|
| index 4f590b349a03b104e81d2b51b9a3e67cd0ab7f3e..89cd382b4aec9b61f4d38bcb6dfc1628810b698c 100644
|
| --- a/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php
|
| +++ b/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php
|
| @@ -8,11 +8,15 @@ if ($directive == 'default') {
|
| ?>
|
| importScripts('worker-testharness.js');
|
| importScripts('test-helpers.js');
|
| +importScripts('../../resources/get-host-info.js');
|
| +
|
| +var host_info = get_host_info();
|
|
|
| test(function() {
|
| var import_script_failed = false;
|
| try {
|
| - importScripts('http://localhost:8000/serviceworker/resources/empty.js');
|
| + importScripts(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/empty.js');
|
| } catch(e) {
|
| import_script_failed = true;
|
| }
|
| @@ -21,7 +25,8 @@ test(function() {
|
| }, 'importScripts test for default-src');
|
|
|
| async_test(function(t) {
|
| - fetch('http://localhost:8000/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| + fetch(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| {mode: 'cors'})
|
| .then(function(response){
|
| assert_unreached('fetch should fail.');
|
| @@ -32,8 +37,10 @@ async_test(function(t) {
|
| }, 'Fetch test for default-src');
|
|
|
| async_test(function(t) {
|
| - var REDIRECT_URL = 'http://127.0.0.1:8000/serviceworker/resources/redirect.php?Redirect=';
|
| - var OTHER_BASE_URL = 'http://localhost:8000/serviceworker/resources/fetch-access-control.php?'
|
| + var REDIRECT_URL = host_info.HTTP_ORIGIN +
|
| + '/serviceworker/resources/redirect.php?Redirect=';
|
| + var OTHER_BASE_URL = host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?'
|
| fetch(REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*'),
|
| {mode: 'cors'})
|
| .then(function(response){
|
| @@ -52,11 +59,15 @@ async_test(function(t) {
|
| ?>
|
| importScripts('worker-testharness.js');
|
| importScripts('test-helpers.js');
|
| +importScripts('../../resources/get-host-info.js');
|
| +
|
| +var host_info = get_host_info();
|
|
|
| test(function() {
|
| var import_script_failed = false;
|
| try {
|
| - importScripts('http://localhost:8000/serviceworker/resources/empty.js');
|
| + importScripts(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/empty.js');
|
| } catch(e) {
|
| import_script_failed = true;
|
| }
|
| @@ -65,7 +76,8 @@ test(function() {
|
| }, 'importScripts test for script-src');
|
|
|
| async_test(function(t) {
|
| - fetch('http://localhost:8000/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| + fetch(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| {mode: 'cors'})
|
| .then(function(response){
|
| t.done();
|
| @@ -76,8 +88,10 @@ async_test(function(t) {
|
| }, 'Fetch test for script-src');
|
|
|
| async_test(function(t) {
|
| - var REDIRECT_URL = 'http://127.0.0.1:8000/serviceworker/resources/redirect.php?Redirect=';
|
| - var OTHER_BASE_URL = 'http://localhost:8000/serviceworker/resources/fetch-access-control.php?'
|
| + var REDIRECT_URL = host_info.HTTP_ORIGIN +
|
| + '/serviceworker/resources/redirect.php?Redirect=';
|
| + var OTHER_BASE_URL = host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?'
|
| fetch(REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*'),
|
| {mode: 'cors'})
|
| .then(function(response){
|
| @@ -96,11 +110,15 @@ async_test(function(t) {
|
| ?>
|
| importScripts('worker-testharness.js');
|
| importScripts('test-helpers.js');
|
| +importScripts('../../resources/get-host-info.js');
|
| +
|
| +var host_info = get_host_info();
|
|
|
| test(function() {
|
| var import_script_failed = false;
|
| try {
|
| - importScripts('http://localhost:8000/serviceworker/resources/empty.js');
|
| + importScripts(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/empty.js');
|
| } catch(e) {
|
| import_script_failed = true;
|
| }
|
| @@ -109,7 +127,8 @@ test(function() {
|
| }, 'importScripts test for connect-src');
|
|
|
| async_test(function(t) {
|
| - fetch('http://localhost:8000/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| + fetch(host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?ACAOrigin=*',
|
| {mode: 'cors'})
|
| .then(function(response){
|
| assert_unreached('fetch should fail.');
|
| @@ -120,8 +139,10 @@ async_test(function(t) {
|
| }, 'Fetch test for connect-src');
|
|
|
| async_test(function(t) {
|
| - var REDIRECT_URL = 'http://127.0.0.1:8000/serviceworker/resources/redirect.php?Redirect=';
|
| - var OTHER_BASE_URL = 'http://localhost:8000/serviceworker/resources/fetch-access-control.php?'
|
| + var REDIRECT_URL = host_info.HTTP_ORIGIN +
|
| + '/serviceworker/resources/redirect.php?Redirect=';
|
| + var OTHER_BASE_URL = host_info.HTTP_REMOTE_ORIGIN +
|
| + '/serviceworker/resources/fetch-access-control.php?'
|
| fetch(REDIRECT_URL + encodeURIComponent(OTHER_BASE_URL + 'ACAOrigin=*'),
|
| {mode: 'cors'})
|
| .then(function(response){
|
| @@ -134,4 +155,4 @@ async_test(function(t) {
|
|
|
| <?php
|
| }
|
| -?>
|
| +?>
|
|
|