OLD | NEW |
| (Empty) |
1 // OPTIONS: ,-base-https-other-https | |
2 if (self.importScripts) { | |
3 importScripts('../resources/fetch-test-helpers.js'); | |
4 importScripts('../resources/fetch-access-control-util.js'); | |
5 } | |
6 | |
7 var referer; | |
8 | |
9 if (self.importScripts) { | |
10 // fetch/workers or fetch/serviceworker | |
11 referer = BASE_ORIGIN + | |
12 '/fetch/script-tests/fetch-access-control.js?' + TEST_OPTIONS; | |
13 } else if(location.pathname.startsWith( | |
14 '/fetch/serviceworker-proxied/fetch-access-control')) { | |
15 // fetch/serviceworker-proxied | |
16 referer = WORKER_URL; | |
17 } else { | |
18 // fetch/window | |
19 referer = BASE_ORIGIN + | |
20 '/fetch/window/fetch-access-control' + TEST_OPTIONS + '.html'; | |
21 } | |
22 | |
23 var TEST_TARGETS = [ | |
24 // Test mode=same-origin. | |
25 [BASE_URL + 'mode=same-origin&method=GET', | |
26 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
27 [methodIsGET, authCheck1]], | |
28 [BASE_URL + 'mode=same-origin&method=GET&headers={}', | |
29 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
30 [methodIsGET]], | |
31 [BASE_URL + 'mode=same-origin&method=GET&headers=CUSTOM', | |
32 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
33 [methodIsGET, hasCustomHeader]], | |
34 [BASE_URL + 'mode=same-origin&method=POST&headers=CUSTOM', | |
35 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
36 [methodIsPOST, hasCustomHeader]], | |
37 [BASE_URL + 'mode=same-origin&method=PUT&headers=CUSTOM', | |
38 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
39 [methodIsPUT, hasCustomHeader]], | |
40 [BASE_URL + 'mode=same-origin&method=XXX&headers=CUSTOM', | |
41 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
42 [methodIsXXX, hasCustomHeader]], | |
43 | |
44 // Test mode=cors. | |
45 [BASE_URL + 'mode=cors&method=GET', | |
46 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
47 [methodIsGET, authCheck1]], | |
48 [BASE_URL + 'mode=cors&method=GET&headers={}', | |
49 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
50 [methodIsGET]], | |
51 [BASE_URL + 'mode=cors&method=GET&headers=CUSTOM', | |
52 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
53 [methodIsGET, hasCustomHeader]], | |
54 [BASE_URL + 'mode=cors&method=POST&headers=CUSTOM', | |
55 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
56 [methodIsPOST, hasCustomHeader]], | |
57 [BASE_URL + 'mode=cors&method=PUT&headers=CUSTOM', | |
58 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
59 [methodIsPUT, hasCustomHeader]], | |
60 [BASE_URL + 'mode=cors&method=XXX&headers=CUSTOM', | |
61 [fetchResolved, hasContentLength, hasServerHeader, hasBody, typeBasic], | |
62 [methodIsXXX, hasCustomHeader]], | |
63 | |
64 // Referer check | |
65 [BASE_URL + 'mode=same-origin', | |
66 [fetchResolved], | |
67 [checkJsonpHeader.bind(this, 'Referer', referer)]], | |
68 ]; | |
69 | |
70 if (self.importScripts) { | |
71 executeTests(TEST_TARGETS); | |
72 done(); | |
73 } | |
OLD | NEW |