| <!DOCTYPE html> |
| <title> WorkerNavigator.userAgentData </title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script> |
| |
| promise_test(async () => { |
| const e = await new Promise((resolve, reject) => { |
| const worker = new Worker("./support/WorkerNavigator.js"); |
| worker.onmessage = resolve; |
| }); |
| |
| assert_equals(e.data.brands.length, navigator.userAgentData.brands.length); |
| for (let i = 0; i < e.data.brands.length; ++i) { |
| const workerUA = e.data.brands[i]; |
| const windowUA = navigator.userAgentData.brands[i]; |
| assert_equals(workerUA.brand, windowUA.brand); |
| assert_equals(workerUA.version, windowUA.version); |
| } |
| assert_equals(e.data.mobile, navigator.userAgentData.mobile); |
| const highEntropyValues = await navigator.userAgentData.getHighEntropyValues(["platform", "platformVersion", "architecture", "model", "uaFullVersion"]); |
| assert_equals(e.data.model, highEntropyValues.model); |
| assert_equals(e.data.platform, highEntropyValues.platform); |
| assert_equals(e.data.platformVersion, highEntropyValues.platformVersion); |
| assert_equals(e.data.architecture, highEntropyValues.architecture); |
| assert_equals(e.data.uaFullVersion, highEntropyValues.uaFullVersion); |
| assert_equals(e.data.NavigatorUADataExposed, true); |
| }, "Test that userAgentData is available in workers in secure contexts"); |
| </script> |