From 49e8edaefb265f740eb8d58a8efaeffbfda558d7 Mon Sep 17 00:00:00 2001 From: ggetz Date: Mon, 23 Apr 2018 15:49:19 -0400 Subject: [PATCH] Cleanup taskProcessor spec --- Source/Core/TaskProcessor.js | 3 +-- Specs/Core/TaskProcessorSpec.js | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Core/TaskProcessor.js b/Source/Core/TaskProcessor.js index dbb301f5a337..3ba9bfa51e29 100644 --- a/Source/Core/TaskProcessor.js +++ b/Source/Core/TaskProcessor.js @@ -173,7 +173,7 @@ define([ }; // Web assembly not supported, use fallback js module if provided - if (!processor._supportsWasm) { + if (!FeatureDetection.supportsWebAssembly()) { if (!defined(wasmOptions.fallbackModulePath)) { throw new RuntimeError('This browser does not support Web Assembly, and no backup module was provided for ' + processor._workerName); } @@ -214,7 +214,6 @@ define([ this._activeTasks = 0; this._deferreds = {}; this._nextID = 0; - this._supportsWasm = FeatureDetection.supportsWebAssembly(); // exposed for testing purposes } var emptyTransferableObjectArray = []; diff --git a/Specs/Core/TaskProcessorSpec.js b/Specs/Core/TaskProcessorSpec.js index 6d020d40898f..dabf2a355d82 100644 --- a/Specs/Core/TaskProcessorSpec.js +++ b/Specs/Core/TaskProcessorSpec.js @@ -190,7 +190,8 @@ defineSuite([ it('uses a backup module if web assembly is not supported', function() { var binaryUrl = absolutize(require.toUrl('../TestWorkers/TestWasm/testWasm.wasm')); taskProcessor = new TaskProcessor('returnWasmConfig', 5); - taskProcessor._supportsWasm = false; + + spyOn(FeatureDetection, 'supportsWebAssembly').and.returnValue(false); var promise = taskProcessor.initWebAssemblyModule({ modulePath : 'TestWasm/testWasmWrapper', @@ -208,7 +209,8 @@ defineSuite([ it('throws runtime error if web assembly is not supported and no backup is provided', function() { var binaryUrl = absolutize(require.toUrl('../TestWorkers/TestWasm/testWasm.wasm')); taskProcessor = new TaskProcessor('returnWasmConfig', 5); - taskProcessor._supportsWasm = false; + + spyOn(FeatureDetection, 'supportsWebAssembly').and.returnValue(false); expect(function () { taskProcessor.initWebAssemblyModule({