aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/fiddle/fiddle.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-09-24 11:32:00 +0000
committerstephan <stephan@noemail.net>2022-09-24 11:32:00 +0000
commit395012e58e97554665b39d748f8ecd179f09dab8 (patch)
treeb81e13b933d7d43105778913305491e1633eb5ea /ext/wasm/fiddle/fiddle.js
parentef11fb915d9574dff1187ae80a7189168b14a309 (diff)
downloadsqlite-395012e58e97554665b39d748f8ecd179f09dab8.tar.gz
sqlite-395012e58e97554665b39d748f8ecd179f09dab8.zip
Fiddle: move, rather than copy, data buffers between the threads. Fix the case of an uploaded db failing to install because its filename is the same as the opened db.
FossilOrigin-Name: bcec4f964a7b02f59be05286ff715bac654a32b19f05a743e402f4cdb207cab8
Diffstat (limited to 'ext/wasm/fiddle/fiddle.js')
-rw-r--r--ext/wasm/fiddle/fiddle.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/wasm/fiddle/fiddle.js b/ext/wasm/fiddle/fiddle.js
index 0d8792d55..4a0bc3911 100644
--- a/ext/wasm/fiddle/fiddle.js
+++ b/ext/wasm/fiddle/fiddle.js
@@ -290,8 +290,8 @@
return this;
},
/* Posts a message in the form {type, data} to the db worker. Returns this. */
- wMsg: function(type,data){
- this.worker.postMessage({type, data});
+ wMsg: function(type,data,transferables){
+ this.worker.postMessage({type, data}, transferables || []);
return this;
},
/**
@@ -558,7 +558,8 @@
SF.echo("Export failed:",ev.error);
return;
}
- const blob = new Blob([ev.buffer], {type:"application/x-sqlite3"});
+ const blob = new Blob([ev.buffer],
+ {type:"application/x-sqlite3"});
const a = document.createElement('a');
document.body.appendChild(a);
a.href = window.URL.createObjectURL(blob);
@@ -593,7 +594,7 @@
SF.wMsg('open',{
filename: f.name,
buffer: this.result
- });
+ }, [this.result]);
});
r.addEventListener('error',function(){
enableMutatingElements(true);
@@ -800,7 +801,8 @@ SELECT group_concat(rtrim(t),x'0a') as Mandelbrot FROM a;`}
'may prove interesting or useful but is not an officially',
'supported deliverable of the sqlite project. It is subject to',
'any number of changes or outright removal at any time.\n');
- SF.dbExec(null);
+ const urlParams = new URL(self.location.href).searchParams;
+ SF.dbExec(urlParams.get('sql') || null);
delete ForceResizeKludge.$disabled;
ForceResizeKludge();
}/*onSFLoaded()*/;