test_wasm_get_values.js (1627B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 /* exported testGenerator */ 7 var testGenerator = testSteps(); 8 9 function* testSteps() { 10 const name = "test_wasm_recompile.js"; 11 12 const objectStoreName = "Wasm"; 13 14 const wasmData = { key: 1 }; 15 16 // The goal of this test is to prove that stored wasm is never deserialized. 17 18 info("Installing profile"); 19 20 clearAllDatabases(continueToNextStepSync); 21 yield undefined; 22 23 // The profile was created with a mythical build (buildId: 20180309213541, 24 // cpuId: X64=0x2). It contains one stored wasm module (file id 1 - bytecode 25 // and file id 2 - compiled/machine code). The file create_db.js in the 26 // package was run locally (specifically it was temporarily added to 27 // xpcshell-parent-process.ini and then executed: 28 // mach xpcshell-test dom/indexedDB/test/unit/create_db.js 29 installPackagedProfile("wasm_get_values_profile"); 30 31 info("Opening database"); 32 33 let request = indexedDB.open(name); 34 request.onerror = errorHandler; 35 request.onupgradeneeded = unexpectedSuccessHandler; 36 request.onsuccess = continueToNextStepSync; 37 yield undefined; 38 39 // success 40 let db = request.result; 41 db.onerror = errorHandler; 42 43 info("Getting wasm"); 44 45 request = db 46 .transaction([objectStoreName]) 47 .objectStore(objectStoreName) 48 .get(wasmData.key); 49 request.onsuccess = continueToNextStepSync; 50 yield undefined; 51 52 info("Verifying wasm"); 53 54 let isWasmModule = request.result instanceof WebAssembly.Module; 55 ok(!isWasmModule, "Object is not wasm module"); 56 57 finishTest(); 58 yield undefined; 59 }