Skip to content

Commit 4d2c551

Browse files
committed
Cleanup specs
1 parent bb60b41 commit 4d2c551

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Source/Core/TaskProcessor.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ define([
173173
};
174174

175175
// Web assembly not supported, use fallback js module if provided
176-
if (!processor._supportsWasm) {
176+
if (!FeatureDetection.supportsWebAssembly()) {
177177
if (!defined(wasmOptions.fallbackModulePath)) {
178178
throw new RuntimeError('This browser does not support Web Assembly, and no backup module was provided for ' + processor._workerName);
179179
}
@@ -214,7 +214,6 @@ define([
214214
this._activeTasks = 0;
215215
this._deferreds = {};
216216
this._nextID = 0;
217-
this._supportsWasm = FeatureDetection.supportsWebAssembly(); // exposed for testing purposes
218217
}
219218

220219
var emptyTransferableObjectArray = [];

Source/Workers/decodeDraco.js

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ define([
225225
// Require and compile WebAssembly module, or use fallback if not supported
226226
return require([wasmConfig.modulePath], function(dracoModule) {
227227
if (defined(wasmConfig.wasmBinaryFile)) {
228+
if (!defined(dracoModule)) {
229+
dracoModule = self.DracoDecoderModule;
230+
}
231+
228232
dracoModule(wasmConfig).then(function (compiledModule) {
229233
initWorker(compiledModule);
230234
});

Specs/Core/TaskProcessorSpec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ defineSuite([
190190
it('uses a backup module if web assembly is not supported', function() {
191191
var binaryUrl = absolutize(require.toUrl('../TestWorkers/TestWasm/testWasm.wasm'));
192192
taskProcessor = new TaskProcessor('returnWasmConfig', 5);
193-
taskProcessor._supportsWasm = false;
193+
194+
spyOn(FeatureDetection, 'supportsWebAssembly').and.returnValue(false);
194195

195196
var promise = taskProcessor.initWebAssemblyModule({
196197
modulePath : 'TestWasm/testWasmWrapper',
@@ -208,7 +209,8 @@ defineSuite([
208209
it('throws runtime error if web assembly is not supported and no backup is provided', function() {
209210
var binaryUrl = absolutize(require.toUrl('../TestWorkers/TestWasm/testWasm.wasm'));
210211
taskProcessor = new TaskProcessor('returnWasmConfig', 5);
211-
taskProcessor._supportsWasm = false;
212+
213+
spyOn(FeatureDetection, 'supportsWebAssembly').and.returnValue(false);
212214

213215
expect(function () {
214216
taskProcessor.initWebAssemblyModule({

0 commit comments

Comments
 (0)