Debian Codegraph @

js/src/jit-test/tests/basic/script-filename-validation-2.js

raw
1 load(libdir + "asserts.js");
2 load(libdir + 'bytecode-cache.js');
3
4 // Install the callback after evaluating the script and saving the bytecode
5 // (generation 0). XDR decoding after this should throw.
6
7 var g = newGlobal({cloneSingletons: true});
8 test = `
9 assertEq(generation, 0);
10 `;
11 assertThrowsInstanceOf(() => {
12 evalWithCache(test, {
13 global: g,
14 checkAfter: function (ctx) {
15 assertEq(g.generation, 0);
16 setTestFilenameValidationCallback();
17 }
18 });
19 }, g.InternalError);
20
21 // Generation should be 1 (XDR decoding threw an exception).
22 assertEq(g.generation, 1);