|
1 | 1 | /* globals commonTests,THIRD_PARTY_ORIGIN,THIRD_PARTY_TRACKER_ORIGIN,THIRD_PARTY_AD_ORIGIN,cookieStore */ |
2 | 2 |
|
| 3 | +const { searchParams } = new URL(window.location); |
| 4 | +const iframeLoadTimeoutMs = parseInt(searchParams.get('timeout'), 10) || 1000; |
| 5 | + |
3 | 6 | const storeButton = document.querySelector('#store'); |
4 | 7 | const retriveButton = document.querySelector('#retrive'); |
5 | 8 | const downloadButton = document.querySelector('#download'); |
@@ -40,7 +43,7 @@ function create3pIframeTest (name, origin) { |
40 | 43 |
|
41 | 44 | window.addEventListener('message', cleanUp); |
42 | 45 | iframe.addEventListener('load', () => { |
43 | | - failTimeout = setTimeout(() => rej('timeout'), 1000); |
| 46 | + failTimeout = setTimeout(() => rej('timeout'), iframeLoadTimeoutMs); |
44 | 47 | }); |
45 | 48 |
|
46 | 49 | document.body.appendChild(iframe); |
@@ -69,7 +72,7 @@ function create3pIframeTest (name, origin) { |
69 | 72 |
|
70 | 73 | window.addEventListener('message', cleanUp); |
71 | 74 | iframe.addEventListener('load', () => { |
72 | | - failTimeout = setTimeout(() => rej('timeout'), 1000); |
| 75 | + failTimeout = setTimeout(() => rej('timeout'), iframeLoadTimeoutMs); |
73 | 76 | }); |
74 | 77 |
|
75 | 78 | document.body.appendChild(iframe); |
@@ -332,11 +335,11 @@ downloadButton.addEventListener('click', () => downloadTheResults()); |
332 | 335 | storeButton.addEventListener('click', () => storeData()); |
333 | 336 | retriveButton.addEventListener('click', () => retrieveData()); |
334 | 337 |
|
335 | | -// if url query is '?store' store the data immadiatelly |
336 | | -if (document.location.search === '?store') { |
| 338 | +// If URL contains 'store' parameter, store the data immediately. |
| 339 | +if (searchParams.has('store')) { |
337 | 340 | storeData(); |
338 | 341 | } |
339 | | -// if url query is '?retrive' retrieve the data immadiatelly |
340 | | -if (document.location.search === '?retrive') { |
| 342 | +// If URL contains 'retrive' parameter, retrieve the data immediately. |
| 343 | +if (searchParams.has('retrive')) { |
341 | 344 | retrieveData(); |
342 | 345 | } |
0 commit comments