navigator-globalPrivacyControl.html (1311B)
1 <!DOCTYPE html> 2 <html> 3 <title>navigator.globalPrivacyControl Window</title> 4 <head> 5 <script src="/resources/testharness.js"></script> 6 </head> 7 <body> 8 <div id="log"></div> 9 <script> 10 setup({explicit_done: true}); 11 const queryString = window.location.search; 12 const urlParams = new URLSearchParams(queryString); 13 const expectedValue = urlParams.has("gpc", "true"); 14 test(function(t) { 15 assert_equals(navigator.globalPrivacyControl, expectedValue, "Expected navigator.globalPrivacyControl value is read from the window"); 16 }, `Expected navigator.globalPrivacyControl value (${expectedValue}) is read from the window`); 17 18 async function run() { 19 await Promise.all([ 20 fetch_tests_from_worker(new Worker(`navigator-globalPrivacyControl.js?gpc=${expectedValue}&workerType=dedicated`)), 21 fetch_tests_from_worker(new SharedWorker(`navigator-globalPrivacyControl.js?gpc=${expectedValue}&workerType=shared`)), 22 ]); 23 24 let r = await navigator.serviceWorker.register( 25 `navigator-globalPrivacyControl.js?gpc=${expectedValue}&workerType=service`, 26 {scope: `blank.html`}); 27 let sw = r.active || r.installing || r.waiting; 28 await fetch_tests_from_worker(sw), 29 await r.unregister(); 30 done(); 31 } 32 run(); 33 </script> 34 </body> 35 </html>