| <!DOCTYPE html> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="timeout" content="long"/> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/common/get-host-info.sub.js"></script> |
| <script src="/common/utils.js"></script> |
| <script src="./resources/compression-dictionary-util.sub.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| function getHeadersCrossorigin() { |
| function headersCallback(r) { |
| return (x) => { |
| r(x); |
| } |
| } |
| let script = document.createElement("script"); |
| return new Promise((resolve, reject) => { |
| getHeadersCrossorigin['callback'] = headersCallback(resolve); |
| script.src = |
| `${CROSS_ORIGIN_RESOURCES_URL}/echo-headers.py?callback=getHeadersCrossorigin.callback`; |
| document.head.appendChild(script); |
| }); |
| } |
| |
| compression_dictionary_promise_test(async (t) => { |
| // Register the dictionary |
| const dict = await (await fetch(kRegisterDictionaryPath)).text(); |
| assert_equals(dict, kDefaultDictionaryContent); |
| assert_equals( |
| await waitUntilAvailableDictionaryHeader(t, {}), |
| kDefaultDictionaryHashBase64); |
| // Test a no-cors crossorigin fetch |
| const headers = await getHeadersCrossorigin(); |
| assert_false("available-dictionary" in headers); |
| }, 'Fetch cross-origin no-cors request does not include Available-Dictionary header'); |
| |
| </script> |
| </body> |