add-module-cross-origin-script.tentative.https.sub.html (1446B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/common/utils.js"></script> 5 <script src="/shared-storage/resources/util.js"></script> 6 <script src="/fenced-frame/resources/utils.js"></script> 7 8 <body> 9 <script> 10 'use strict'; 11 12 promise_test(async t => { 13 const sameOrigin = location.origin; 14 const crossOrigin = 'https://{{domains[www]}}:{{ports[https][0]}}'; 15 const crossOriginScript = crossOrigin 16 + "/shared-storage/resources/simple-module2.js"; 17 await sharedStorage.worklet.addModule(crossOriginScript); 18 19 const ancestor_key = token(); 20 let url0 = generateURL("/shared-storage/resources/frame0.html", 21 [ancestor_key]); 22 let select_url_result = await sharedStorage.selectURL( 23 "test-url-selection-operation", [{url: url0}], 24 {data: {'mockResult': 0, 'setKey': 'a', 'setValue': 'b'}, 25 resolveToConfig: true}); 26 assert_true(validateSelectURLResult(select_url_result, true)); 27 attachFencedFrame(select_url_result, 'opaque-ads'); 28 const result = await nextValueFromServer(ancestor_key); 29 assert_equals(result, "frame0_loaded"); 30 31 // The invoking context's origin is used as the data origin. 32 await verifyKeyValueForOrigin('a', 'b', sameOrigin); 33 await verifyKeyNotFoundForOrigin('a', crossOrigin); 34 35 // Clean up. 36 return sharedStorage.delete('a'); 37 }, 'addModule with cross-origin url'); 38 39 </script> 40 </body>