run-url-selection-operation-limit-multiple-sites.tentative.https.sub.html (2286B)
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="/common/get-host-info.sub.js"></script> 6 <script src="/shared-storage-selecturl-limit/resources/utils.js"></script> 7 <script src="/shared-storage/resources/util.js"></script> 8 <script src="/fenced-frame/resources/utils.js"></script> 9 10 <body> 11 <script> 12 'use strict'; 13 14 promise_test(async () => { 15 const ancestorKey = token(); 16 const perOriginBitLimit = 3; 17 const bitsKey = "bits"; 18 19 let url0 = generateURL( 20 "/shared-storage-selecturl-limit/" + 21 "resources/run-url-selection-operation-limit-inner.https.html", 22 [ancestorKey]); 23 24 // We have set the per site per pageload limit to 3 bits. 25 url0.searchParams.append(bitsKey, perOriginBitLimit.toString()); 26 attachIFrame(url0); 27 const result0 = await nextValueFromServer(ancestorKey); 28 assert_equals(result0, "run_url_selection_limit_inner_succeeded"); 29 30 let url1 = generateURL( 31 "/shared-storage-selecturl-limit/" + 32 "resources/run-url-selection-operation-limit-inner.https.html", 33 [ancestorKey]); 34 35 // The overall pageload budget should have 3 bits remaining, as we have set 36 // it to start at 6. 37 url1.searchParams.append(bitsKey, "3"); 38 const crossOrigin1 = get_host_info().HTTPS_NOTSAMESITE_ORIGIN; 39 url1 = updateUrlToUseNewOrigin(url1, crossOrigin1); 40 attachIFrame(url1); 41 const result1 = await nextValueFromServer(ancestorKey); 42 assert_equals(result1, "run_url_selection_limit_inner_succeeded"); 43 44 let url2 = generateURL( 45 "/shared-storage-selecturl-limit/" + 46 "resources/run-url-selection-operation-limit-inner.https.html", 47 [ancestorKey]); 48 49 // Since the overall per pageload limit is 6 bits here, it should have 50 // already been reached, even though `url2`'s site should have 3 bits 51 // remaining in the per-site budget. 52 url2.searchParams.append(bitsKey, "0"); 53 const crossOrigin2 = get_host_info().OTHER_ORIGIN; 54 url2 = updateUrlToUseNewOrigin(url2, crossOrigin2); 55 attachIFrame(url2); 56 const result2 = await nextValueFromServer(ancestorKey); 57 assert_equals(result2, "run_url_selection_limit_inner_succeeded"); 58 }, 'selectURL() with overall per-pageload limit'); 59 </script> 60 </body>