OLD | NEW |
1 if (window.testRunner) { | 1 if (window.testRunner) { |
2 // In Chromium we need to change the setting to disallow displaying | 2 // In Chromium we need to change the setting to disallow displaying |
3 // insecure contents. | 3 // insecure contents. |
4 | 4 |
5 // By default, LayoutTest content_shell returns allowed for | 5 // By default, LayoutTest content_shell returns allowed for |
6 // "Should fetching request be blocked as mixed content?" at Step 5: | 6 // "Should fetching request be blocked as mixed content?" at Step 5: |
7 // https://w3c.github.io/webappsec/specs/mixedcontent/#should-block-fetch | 7 // https://w3c.github.io/webappsec/specs/mixedcontent/#should-block-fetch |
8 // > If the user agent has been instructed to allow mixed content | 8 // > If the user agent has been instructed to allow mixed content |
9 // Turning the switch below to false makes this condition above false, and | 9 // Turning the switch below to false makes this condition above false, and |
10 // make content_shell to run into Step 7 to test mixed content blocking. | 10 // make content_shell to run into Step 7 to test mixed content blocking. |
11 testRunner.overridePreference('WebKitAllowRunningInsecureContent', false); | 11 testRunner.overridePreference('WebKitAllowRunningInsecureContent', false); |
12 //FIXME: to be removed. | 12 //FIXME: to be removed. |
13 //testRunner.overridePreference('WebKitAllowDisplayingInsecureContent', true); | 13 //testRunner.overridePreference('WebKitAllowDisplayingInsecureContent', true); |
14 | 14 |
15 // Accept all cookies. | 15 // Accept all cookies. |
16 testRunner.setAlwaysAcceptCookies(true); | 16 testRunner.setAlwaysAcceptCookies(true); |
17 } | 17 } |
18 | 18 |
19 // How tests starts: | 19 // How tests starts: |
20 // 1. http://127.0.0.1:8000/.../X.html is loaded. | 20 // 1. http://127.0.0.1:8000/.../X.html is loaded. |
21 // 2. init(): Do initialization. | 21 // 2. init(): Do initialization. |
22 // In fetch-access-control* tests | 22 // In thorough/* tests |
23 // (see init() in fetch-access-control-util.js): | 23 // (see init() in thorough-util.js): |
24 // - Login to HTTP pages. | 24 // - Login to HTTP pages. |
25 // This is done first from HTTP origin to avoid mixed content blocking. | 25 // This is done first from HTTP origin to avoid mixed content blocking. |
26 // - Login to HTTPS pages. | 26 // - Login to HTTPS pages. |
27 // If the test is not base-https: | 27 // If the test is not base-https: |
28 // 3a. start(): Start tests. | 28 // 3a. start(): Start tests. |
29 // Otherwise: | 29 // Otherwise: |
30 // 3b. Redirect to https://127.0.0.1:8443/.../X.html. | 30 // 3b. Redirect to https://127.0.0.1:8443/.../X.html. |
31 // 4b. start(): Start tests. | 31 // 4b. start(): Start tests. |
32 | 32 |
33 var t = async_test('Startup'); | 33 var t = async_test('Startup'); |
34 if (location.protocol != 'https:') { | 34 if (location.protocol != 'https:') { |
35 init(t) | 35 init(t) |
36 .then(function() { | 36 .then(function() { |
37 // Initialization done. In fetch-access-control* tests, login done. | 37 // Initialization done. In thorough/* tests, login done. |
38 if (location.pathname.indexOf('base-https') >= 0) { | 38 if (location.pathname.indexOf('base-https') >= 0) { |
39 // Step 3b. For base-https tests, redirect to HTTPS page here. | 39 // Step 3b. For base-https tests, redirect to HTTPS page here. |
40 location = 'https://127.0.0.1:8443' + location.pathname; | 40 location = 'https://127.0.0.1:8443' + location.pathname; |
41 } else { | 41 } else { |
42 // Step 3a. For non-base-https tests, start tests here. | 42 // Step 3a. For non-base-https tests, start tests here. |
43 start(t); | 43 start(t); |
44 } | 44 } |
45 }); | 45 }); |
46 } else { | 46 } else { |
47 // Step 4b. Already redirected to the HTTPS page. | 47 // Step 4b. Already redirected to the HTTPS page. |
48 // Start tests for base-https tests here. | 48 // Start tests for base-https tests here. |
49 start(t); | 49 start(t); |
50 } | 50 } |
OLD | NEW |