Skip to content

Commit

Permalink
Cleanup taskProcessor spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Apr 23, 2018
1 parent bb60b41 commit 49e8eda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Source/Core/TaskProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -214,7 +214,6 @@ define([
this._activeTasks = 0;
this._deferreds = {};
this._nextID = 0;
this._supportsWasm = FeatureDetection.supportsWebAssembly(); // exposed for testing purposes
}

var emptyTransferableObjectArray = [];
Expand Down
6 changes: 4 additions & 2 deletions Specs/Core/TaskProcessorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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({
Expand Down

0 comments on commit 49e8eda

Please sign in to comment.