sab-errMsg.js (811B)
1 // |jit-test| skip-if: !sharedMemoryEnabled() 2 3 // Check the error mssage when the prefs for COOP/COEP are both enable or not. 4 var g = newGlobal(); 5 var ex; 6 const sab = new SharedArrayBuffer(); 7 try { 8 g.serialize(sab); 9 } catch (e) { 10 ex = e; 11 } 12 assertEq(ex.toString(), 13 `TypeError: The SharedArrayBuffer object cannot be serialized. The ` + 14 `Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP ` + 15 `headers will enable this in the future.`); 16 17 var h = newGlobal({enableCoopAndCoep: true}); 18 try { 19 h.serialize(sab); 20 } catch (e) { 21 ex = e; 22 } 23 assertEq(ex.toString(), 24 `TypeError: The SharedArrayBuffer object cannot be serialized. The ` + 25 `Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP ` + 26 `headers can be used to enable this.`);