Skip to content

Commit

Permalink
apparently, firefox doesn't like it when WebAssembly.Module isn't pre…
Browse files Browse the repository at this point in the history
…fixed with 'new'.
  • Loading branch information
btzy committed Apr 2, 2017
1 parent 13d7930 commit 7478b2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions jelly-bf-sync.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var JellyBFSync={
compile:function(str,options){
return WebAssembly.Module(JellyBFCompiler.compile(str,options));
return new WebAssembly.Module(JellyBFCompiler.compile(str,options));
},
execute:function(module,inputuint8array,options){
options.eof_value=options.eof_value||0;
Expand All @@ -17,7 +17,7 @@ var JellyBFSync={
var put_output=function(byte){
outputdata.push(byte);
};
var instance=WebAssembly.Instance(module,{
var instance=new WebAssembly.Instance(module,{
interaction:{
input:get_input,
output:put_output
Expand Down Expand Up @@ -70,7 +70,7 @@ var JellyBFSync={
Atomics.store(outputwaitint32array,WaitArrayId.TERMINATED_FLAG,1);
Atomics.store(outputwaitint32array,WaitArrayId.WRITE_HEAD,output_write_head+1);
};
var instance=WebAssembly.Instance(module,{
var instance=new WebAssembly.Instance(module,{
interaction:{
input:get_input,
output:put_output
Expand Down
6 changes: 3 additions & 3 deletions jelly-bf-worker.max.js
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ var JellyBF_CloseAndAttemptUnrollLoop = function(codeChunks, options) {

var JellyBFSync = {
compile: function(str, options) {
return WebAssembly.Module(JellyBFCompiler.compile(str, options));
return new WebAssembly.Module(JellyBFCompiler.compile(str, options));
},
execute: function(module, inputuint8array, options) {
options.eof_value = options.eof_value || 0;
Expand All @@ -1558,7 +1558,7 @@ var JellyBFSync = {
var put_output = function(byte) {
outputdata.push(byte);
};
var instance = WebAssembly.Instance(module, {
var instance = new WebAssembly.Instance(module, {
interaction: {
input: get_input,
output: put_output
Expand Down Expand Up @@ -1609,7 +1609,7 @@ var JellyBFSync = {
Atomics.store(outputwaitint32array, WaitArrayId.TERMINATED_FLAG, 1);
Atomics.store(outputwaitint32array, WaitArrayId.WRITE_HEAD, output_write_head + 1);
};
var instance = WebAssembly.Instance(module, {
var instance = new WebAssembly.Instance(module, {
interaction: {
input: get_input,
output: put_output
Expand Down
3 changes: 1 addition & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ window.addEventListener("load",function(){
};

var compile=function(worker,sourcecode,options,callback){
var module=new Uint8Array(100);
worker.postMessage({type:"compile",sourcecode:sourcecode,options:options,module:module},[module.buffer]);
worker.postMessage({type:"compile",sourcecode:sourcecode,options:options});
wait_for_message(worker,"compiled",function(message){
callback();
});
Expand Down

0 comments on commit 7478b2c

Please sign in to comment.