verify-shared-storage.https.html (869B)
1 <!DOCTYPE html> 2 <html> 3 <body> 4 <script> 5 async function test() { 6 let params = new URL(document.location.toString()).searchParams; 7 let method = params.get("method"); 8 9 try { 10 if (method == 'set') { 11 await sharedStorage.set('key0', 'key1'); 12 } else if (method == 'createWorklet') { 13 await sharedStorage.createWorklet('simple-module.js') 14 } else if (method == 'createWorkletScriptOrigin') { 15 await sharedStorage.createWorklet('simple-module.js', 16 { dataOrigin: 'script-origin' }) 17 } else if (method == 'addModule') { 18 await sharedStorage.worklet.addModule('simple-module.js') 19 } 20 window.parent.postMessage({ accessSharedStorageResult: 'success'}, "*"); 21 } catch (error) { 22 window.parent.postMessage({ accessSharedStorageResult: 'failure'}, "*"); 23 } 24 } 25 26 test(); 27 28 </script> 29 </body> 30 </html>