| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 function TestInstantiateInWorker() { | 5 function TestInstantiateInWorker() { |
| 6 return createWasmModule() | 6 return createWasmModule() |
| 7 .then((mod) => { | 7 .then((mod) => { |
| 8 var worker = new Worker("wasm_serialization_worker.js"); | 8 var worker = new Worker("wasm_serialization_worker.js"); |
| 9 return new Promise((resolve, reject) => { | 9 return new Promise((resolve, reject) => { |
| 10 worker.postMessage(mod); | 10 worker.postMessage(mod); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 for (var i = byteView.length - 1; i >= startOfWasmHeader + 3; --i) { | 50 for (var i = byteView.length - 1; i >= startOfWasmHeader + 3; --i) { |
| 51 if (byteView[i] != 0) { | 51 if (byteView[i] != 0) { |
| 52 byteView[i] = 0; | 52 byteView[i] = 0; |
| 53 invalidated = true; | 53 invalidated = true; |
| 54 break; | 54 break; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 assert_true(invalidated, | 57 assert_true(invalidated, |
| 58 "the serialized blob should contain some non-null bytes."); | 58 "the serialized blob should contain some non-null bytes."); |
| 59 | 59 |
| 60 var deserialized = undefined; | 60 var deserialized = window.internals.deserializeBuffer(byteView.buffer); |
| 61 try { | 61 assert_equals(deserialized, null); |
| 62 deserialized = window.internals.deserializeBuffer(byteView.buffer); | |
| 63 assert_unreached(); | |
| 64 } catch (e) { | |
| 65 assert_equals(deserialized, undefined); | |
| 66 } | |
| 67 }); | 62 }); |
| 68 } | 63 } |
| OLD | NEW |