mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Replace use of 'self' in JS code with 'globalThis', as that works in browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks.
FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
This commit is contained in:
@ -437,7 +437,7 @@ emcc.jsflags += -sSTRICT_JS=0
|
|||||||
# STRICT_JS disabled due to:
|
# STRICT_JS disabled due to:
|
||||||
# https://github.com/emscripten-core/emscripten/issues/18610
|
# https://github.com/emscripten-core/emscripten/issues/18610
|
||||||
# TL;DR: does not work with MODULARIZE or EXPORT_ES6 as of version 3.1.31.
|
# TL;DR: does not work with MODULARIZE or EXPORT_ES6 as of version 3.1.31.
|
||||||
emcc.environment := -sENVIRONMENT=web,worker
|
emcc.environment := -sENVIRONMENT=web,worker,node
|
||||||
########################################################################
|
########################################################################
|
||||||
# -sINITIAL_MEMORY: How much memory we need to start with is governed
|
# -sINITIAL_MEMORY: How much memory we need to start with is governed
|
||||||
# at least in part by whether -sALLOW_MEMORY_GROWTH is enabled. If so,
|
# at least in part by whether -sALLOW_MEMORY_GROWTH is enabled. If so,
|
||||||
@ -450,9 +450,9 @@ emcc.environment := -sENVIRONMENT=web,worker
|
|||||||
# such test results are inconsistent due to browser internals which
|
# such test results are inconsistent due to browser internals which
|
||||||
# are opaque to us.
|
# are opaque to us.
|
||||||
emcc.jsflags += -sALLOW_MEMORY_GROWTH
|
emcc.jsflags += -sALLOW_MEMORY_GROWTH
|
||||||
emcc.INITIAL_MEMORY.128 := 13107200
|
emcc.INITIAL_MEMORY.128 := 134217728
|
||||||
emcc.INITIAL_MEMORY.96 := 100663296
|
emcc.INITIAL_MEMORY.96 := 100663296
|
||||||
emcc.INITIAL_MEMORY.64 := 64225280
|
emcc.INITIAL_MEMORY.64 := 67108864
|
||||||
emcc.INITIAL_MEMORY.32 := 33554432
|
emcc.INITIAL_MEMORY.32 := 33554432
|
||||||
emcc.INITIAL_MEMORY.16 := 16777216
|
emcc.INITIAL_MEMORY.16 := 16777216
|
||||||
emcc.INITIAL_MEMORY.8 := 8388608
|
emcc.INITIAL_MEMORY.8 := 8388608
|
||||||
@ -469,6 +469,8 @@ emcc.jsflags += -sSTACK_SIZE=512KB
|
|||||||
# ^^^ ACHTUNG: emsdk 3.1.27 reduced the default stack size from 5MB to
|
# ^^^ ACHTUNG: emsdk 3.1.27 reduced the default stack size from 5MB to
|
||||||
# a mere 64KB, which leads to silent memory corruption via the kvvfs
|
# a mere 64KB, which leads to silent memory corruption via the kvvfs
|
||||||
# VFS, which requires twice that for its xRead() and xWrite() methods.
|
# VFS, which requires twice that for its xRead() and xWrite() methods.
|
||||||
|
# 2023-03: those methods have since been adapted to use a malloc()'d
|
||||||
|
# buffer.
|
||||||
########################################################################
|
########################################################################
|
||||||
# $(sqlite3.js.init-func) is the name Emscripten assigns our exported
|
# $(sqlite3.js.init-func) is the name Emscripten assigns our exported
|
||||||
# module init/load function. This symbol name is hard-coded in
|
# module init/load function. This symbol name is hard-coded in
|
||||||
@ -537,7 +539,7 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
|
|||||||
$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
|
$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
|
||||||
@echo "Making $@..."
|
@echo "Making $@..."
|
||||||
@{ \
|
@{ \
|
||||||
echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
|
echo 'globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
|
||||||
echo -n ' sqlite3.version = '; \
|
echo -n ' sqlite3.version = '; \
|
||||||
$(bin.version-info) --json; \
|
$(bin.version-info) --json; \
|
||||||
echo ';'; \
|
echo ';'; \
|
||||||
@ -666,7 +668,7 @@ pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js)
|
|||||||
define SETUP_LIB_BUILD_MODE
|
define SETUP_LIB_BUILD_MODE
|
||||||
$(info Setting up build [$(1)]: $(4))
|
$(info Setting up build [$(1)]: $(4))
|
||||||
c-pp.D.$(1) := $(5)
|
c-pp.D.$(1) := $(5)
|
||||||
pre-js.js.$(1) := $$(dir.api)/pre-js.$(1).js
|
pre-js.js.$(1) := $$(dir.tmp)/pre-js.$(1).js
|
||||||
$$(eval $$(call C-PP.FILTER,$$(pre-js.js.in),$$(pre-js.js.$(1)),$$(c-pp.D.$(1))))
|
$$(eval $$(call C-PP.FILTER,$$(pre-js.js.in),$$(pre-js.js.$(1)),$$(c-pp.D.$(1))))
|
||||||
post-js.js.$(1) := $$(dir.tmp)/post-js.$(1).js
|
post-js.js.$(1) := $$(dir.tmp)/post-js.$(1).js
|
||||||
$$(eval $$(call C-PP.FILTER,$$(post-js.js.in),$$(post-js.js.$(1)),$$(c-pp.D.$(1))))
|
$$(eval $$(call C-PP.FILTER,$$(post-js.js.in),$$(post-js.js.$(1)),$$(c-pp.D.$(1))))
|
||||||
|
@ -28,7 +28,7 @@ const toExportForESM =
|
|||||||
for non-ES6 Module cases but wrong for ES6 modules because those
|
for non-ES6 Module cases but wrong for ES6 modules because those
|
||||||
resolve this symbol differently. */ sqlite3InitModule;
|
resolve this symbol differently. */ sqlite3InitModule;
|
||||||
if(!originalInit){
|
if(!originalInit){
|
||||||
throw new Error("Expecting self.sqlite3InitModule to be defined by the Emscripten build.");
|
throw new Error("Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
We need to add some state which our custom Module.locateFile()
|
We need to add some state which our custom Module.locateFile()
|
||||||
@ -41,11 +41,13 @@ const toExportForESM =
|
|||||||
into the global scope and delete it when sqlite3InitModule()
|
into the global scope and delete it when sqlite3InitModule()
|
||||||
is called.
|
is called.
|
||||||
*/
|
*/
|
||||||
const initModuleState = self.sqlite3InitModuleState = Object.assign(Object.create(null),{
|
const initModuleState = globalThis.sqlite3InitModuleState = Object.assign(Object.create(null),{
|
||||||
moduleScript: self?.document?.currentScript,
|
moduleScript: self?.document?.currentScript,
|
||||||
isWorker: ('undefined' !== typeof WorkerGlobalScope),
|
isWorker: ('undefined' !== typeof WorkerGlobalScope),
|
||||||
location: self.location,
|
location: globalThis.location,
|
||||||
urlParams: new URL(self.location.href).searchParams
|
urlParams: globalThis?.location?.href
|
||||||
|
? new URL(globalThis.location.href).searchParams
|
||||||
|
: new URLSearchParams()
|
||||||
});
|
});
|
||||||
initModuleState.debugModule =
|
initModuleState.debugModule =
|
||||||
initModuleState.urlParams.has('sqlite3.debugModule')
|
initModuleState.urlParams.has('sqlite3.debugModule')
|
||||||
@ -60,14 +62,14 @@ const toExportForESM =
|
|||||||
initModuleState.sqlite3Dir = li.join('/') + '/';
|
initModuleState.sqlite3Dir = li.join('/') + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sqlite3InitModule = function ff(...args){
|
globalThis.sqlite3InitModule = function ff(...args){
|
||||||
//console.warn("Using replaced sqlite3InitModule()",self.location);
|
//console.warn("Using replaced sqlite3InitModule()",self.location);
|
||||||
return originalInit(...args).then((EmscriptenModule)=>{
|
return originalInit(...args).then((EmscriptenModule)=>{
|
||||||
if(self.window!==self &&
|
if('undefined'!==typeof WorkerGlobalScope &&
|
||||||
(EmscriptenModule['ENVIRONMENT_IS_PTHREAD']
|
(EmscriptenModule['ENVIRONMENT_IS_PTHREAD']
|
||||||
|| EmscriptenModule['_pthread_self']
|
|| EmscriptenModule['_pthread_self']
|
||||||
|| 'function'===typeof threadAlert
|
|| 'function'===typeof threadAlert
|
||||||
|| self.location.pathname.endsWith('.worker.js')
|
|| globalThis?.location?.pathname?.endsWith?.('.worker.js')
|
||||||
)){
|
)){
|
||||||
/** Workaround for wasmfs-generated worker, which calls this
|
/** Workaround for wasmfs-generated worker, which calls this
|
||||||
routine from each individual thread and requires that its
|
routine from each individual thread and requires that its
|
||||||
@ -88,10 +90,10 @@ const toExportForESM =
|
|||||||
throw e;
|
throw e;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
self.sqlite3InitModule.ready = originalInit.ready;
|
globalThis.sqlite3InitModule.ready = originalInit.ready;
|
||||||
|
|
||||||
if(self.sqlite3InitModuleState.moduleScript){
|
if(globalThis.sqlite3InitModuleState.moduleScript){
|
||||||
const sim = self.sqlite3InitModuleState;
|
const sim = globalThis.sqlite3InitModuleState;
|
||||||
let src = sim.moduleScript.src.split('/');
|
let src = sim.moduleScript.src.split('/');
|
||||||
src.pop();
|
src.pop();
|
||||||
sim.scriptDir = src.join('/') + '/';
|
sim.scriptDir = src.join('/') + '/';
|
||||||
@ -99,7 +101,7 @@ const toExportForESM =
|
|||||||
initModuleState.debugModule('sqlite3InitModuleState =',initModuleState);
|
initModuleState.debugModule('sqlite3InitModuleState =',initModuleState);
|
||||||
if(0){
|
if(0){
|
||||||
console.warn("Replaced sqlite3InitModule()");
|
console.warn("Replaced sqlite3InitModule()");
|
||||||
console.warn("self.location.href =",self.location.href);
|
console.warn("globalThis.location.href =",globalThis.location.href);
|
||||||
if('undefined' !== typeof document){
|
if('undefined' !== typeof document){
|
||||||
console.warn("document.currentScript.src =",
|
console.warn("document.currentScript.src =",
|
||||||
document?.currentScript?.src);
|
document?.currentScript?.src);
|
||||||
@ -119,7 +121,7 @@ const toExportForESM =
|
|||||||
/* AMD modules get injected in a way we cannot override,
|
/* AMD modules get injected in a way we cannot override,
|
||||||
so we can't handle those here. */
|
so we can't handle those here. */
|
||||||
//#endif // !target=es6-module
|
//#endif // !target=es6-module
|
||||||
return self.sqlite3InitModule /* required for ESM */;
|
return globalThis.sqlite3InitModule /* required for ESM */;
|
||||||
})();
|
})();
|
||||||
//#if target=es6-module
|
//#if target=es6-module
|
||||||
export default toExportForESM;
|
export default toExportForESM;
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// See notes in extern-post-js.js
|
// See notes in extern-post-js.js
|
||||||
const sqlite3InitModuleState = self.sqlite3InitModuleState
|
const sqlite3InitModuleState = globalThis.sqlite3InitModuleState
|
||||||
|| Object.assign(Object.create(null),{
|
|| Object.assign(Object.create(null),{
|
||||||
debugModule: ()=>{}
|
debugModule: ()=>{}
|
||||||
});
|
});
|
||||||
delete self.sqlite3InitModuleState;
|
delete globalThis.sqlite3InitModuleState;
|
||||||
sqlite3InitModuleState.debugModule('self.location =',self.location);
|
sqlite3InitModuleState.debugModule('globalThis.location =',globalThis.location);
|
||||||
|
|
||||||
//#ifnot target=es6-bundler-friendly
|
//#ifnot target=es6-bundler-friendly
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
|
|||||||
exports: Module['asm'],
|
exports: Module['asm'],
|
||||||
memory: Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */
|
memory: Module.wasmMemory /* gets set if built with -sIMPORT_MEMORY */
|
||||||
},
|
},
|
||||||
self.sqlite3ApiConfig || {}
|
globalThis.sqlite3ApiConfig || {}
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,29 +33,29 @@ if('undefined' !== typeof Module){ // presumably an Emscripten build
|
|||||||
sqlite3ApiBootstrap(). That decision will be revisited at some
|
sqlite3ApiBootstrap(). That decision will be revisited at some
|
||||||
point, as we really want client code to be able to call this to
|
point, as we really want client code to be able to call this to
|
||||||
configure certain parts. Clients may modify
|
configure certain parts. Clients may modify
|
||||||
self.sqlite3ApiBootstrap.defaultConfig to tweak the default
|
globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default
|
||||||
configuration used by a no-args call to sqlite3ApiBootstrap(),
|
configuration used by a no-args call to sqlite3ApiBootstrap(),
|
||||||
but must have first loaded their WASM module in order to be
|
but must have first loaded their WASM module in order to be
|
||||||
able to provide the necessary configuration state.
|
able to provide the necessary configuration state.
|
||||||
*/
|
*/
|
||||||
//console.warn("self.sqlite3ApiConfig = ",self.sqlite3ApiConfig);
|
//console.warn("globalThis.sqlite3ApiConfig = ",globalThis.sqlite3ApiConfig);
|
||||||
self.sqlite3ApiConfig = SABC;
|
globalThis.sqlite3ApiConfig = SABC;
|
||||||
let sqlite3;
|
let sqlite3;
|
||||||
try{
|
try{
|
||||||
sqlite3 = self.sqlite3ApiBootstrap();
|
sqlite3 = globalThis.sqlite3ApiBootstrap();
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.error("sqlite3ApiBootstrap() error:",e);
|
console.error("sqlite3ApiBootstrap() error:",e);
|
||||||
throw e;
|
throw e;
|
||||||
}finally{
|
}finally{
|
||||||
delete self.sqlite3ApiBootstrap;
|
delete globalThis.sqlite3ApiBootstrap;
|
||||||
delete self.sqlite3ApiConfig;
|
delete globalThis.sqlite3ApiConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
|
Module.sqlite3 = sqlite3 /* Needed for customized sqlite3InitModule() to be able to
|
||||||
pass the sqlite3 object off to the client. */;
|
pass the sqlite3 object off to the client. */;
|
||||||
}else{
|
}else{
|
||||||
console.warn("This is not running in an Emscripten module context, so",
|
console.warn("This is not running in an Emscripten module context, so",
|
||||||
"self.sqlite3ApiBootstrap() is _not_ being called due to lack",
|
"globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack",
|
||||||
"of config info for the WASM environment.",
|
"of config info for the WASM environment.",
|
||||||
"It must be called manually.");
|
"It must be called manually.");
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,13 @@
|
|||||||
initializes the main API pieces so that the downstream components
|
initializes the main API pieces so that the downstream components
|
||||||
(e.g. sqlite3-api-oo1.js) have all that they need.
|
(e.g. sqlite3-api-oo1.js) have all that they need.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||||
'use strict';
|
'use strict';
|
||||||
const toss = (...args)=>{throw new Error(args.join(' '))};
|
const toss = (...args)=>{throw new Error(args.join(' '))};
|
||||||
const toss3 = sqlite3.SQLite3Error.toss;
|
const toss3 = sqlite3.SQLite3Error.toss;
|
||||||
const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
|
const capi = sqlite3.capi, wasm = sqlite3.wasm, util = sqlite3.util;
|
||||||
self.WhWasmUtilInstaller(wasm);
|
globalThis.WhWasmUtilInstaller(wasm);
|
||||||
delete self.WhWasmUtilInstaller;
|
delete globalThis.WhWasmUtilInstaller;
|
||||||
|
|
||||||
if(0){
|
if(0){
|
||||||
/**
|
/**
|
||||||
@ -605,7 +605,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
/**
|
/**
|
||||||
Install JS<->C struct bindings for the non-opaque struct types we
|
Install JS<->C struct bindings for the non-opaque struct types we
|
||||||
need... */
|
need... */
|
||||||
sqlite3.StructBinder = self.Jaccwabyt({
|
sqlite3.StructBinder = globalThis.Jaccwabyt({
|
||||||
heap: 0 ? wasm.memory : wasm.heap8u,
|
heap: 0 ? wasm.memory : wasm.heap8u,
|
||||||
alloc: wasm.alloc,
|
alloc: wasm.alloc,
|
||||||
dealloc: wasm.dealloc,
|
dealloc: wasm.dealloc,
|
||||||
@ -613,7 +613,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
memberPrefix: /* Never change this: this prefix is baked into any
|
memberPrefix: /* Never change this: this prefix is baked into any
|
||||||
amount of code and client-facing docs. */ '$'
|
amount of code and client-facing docs. */ '$'
|
||||||
});
|
});
|
||||||
delete self.Jaccwabyt;
|
delete globalThis.Jaccwabyt;
|
||||||
|
|
||||||
{// wasm.xWrap() bindings...
|
{// wasm.xWrap() bindings...
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
This file contains the so-called OO #1 API wrapper for the sqlite3
|
This file contains the so-called OO #1 API wrapper for the sqlite3
|
||||||
WASM build. It requires that sqlite3-api-glue.js has already run
|
WASM build. It requires that sqlite3-api-glue.js has already run
|
||||||
and it installs its deliverable as self.sqlite3.oo1.
|
and it installs its deliverable as globalThis.sqlite3.oo1.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||||
const toss = (...args)=>{throw new Error(args.join(' '))};
|
const toss = (...args)=>{throw new Error(args.join(' '))};
|
||||||
const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)};
|
const toss3 = (...args)=>{throw new sqlite3.SQLite3Error(...args)};
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
exposed by this API. It is intended to be called one time at the
|
exposed by this API. It is intended to be called one time at the
|
||||||
end of the API amalgamation process, passed configuration details
|
end of the API amalgamation process, passed configuration details
|
||||||
for the current environment, and then optionally be removed from
|
for the current environment, and then optionally be removed from
|
||||||
the global object using `delete self.sqlite3ApiBootstrap`.
|
the global object using `delete globalThis.sqlite3ApiBootstrap`.
|
||||||
|
|
||||||
This function is not intended for client-level use. It is intended
|
This function is not intended for client-level use. It is intended
|
||||||
for use in creating bundles configured for specific WASM
|
for use in creating bundles configured for specific WASM
|
||||||
@ -58,7 +58,7 @@
|
|||||||
WASM-exported memory.
|
WASM-exported memory.
|
||||||
|
|
||||||
- `bigIntEnabled`: true if BigInt support is enabled. Defaults to
|
- `bigIntEnabled`: true if BigInt support is enabled. Defaults to
|
||||||
true if `self.BigInt64Array` is available, else false. Some APIs
|
true if `globalThis.BigInt64Array` is available, else false. Some APIs
|
||||||
will throw exceptions if called without BigInt support, as BigInt
|
will throw exceptions if called without BigInt support, as BigInt
|
||||||
is required for marshalling C-side int64 into and out of JS.
|
is required for marshalling C-side int64 into and out of JS.
|
||||||
(Sidebar: it is technically possible to add int64 support via
|
(Sidebar: it is technically possible to add int64 support via
|
||||||
@ -100,8 +100,8 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
||||||
apiConfig = (self.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
|
apiConfig = (globalThis.sqlite3ApiConfig || sqlite3ApiBootstrap.defaultConfig)
|
||||||
){
|
){
|
||||||
if(sqlite3ApiBootstrap.sqlite3){ /* already initalized */
|
if(sqlite3ApiBootstrap.sqlite3){ /* already initalized */
|
||||||
console.warn("sqlite3ApiBootstrap() called multiple times.",
|
console.warn("sqlite3ApiBootstrap() called multiple times.",
|
||||||
@ -117,7 +117,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
-sWASM_BIGINT=1, else it will not. */
|
-sWASM_BIGINT=1, else it will not. */
|
||||||
return !!Module.HEAPU64;
|
return !!Module.HEAPU64;
|
||||||
}
|
}
|
||||||
return !!self.BigInt64Array;
|
return !!globalThis.BigInt64Array;
|
||||||
})(),
|
})(),
|
||||||
debug: console.debug.bind(console),
|
debug: console.debug.bind(console),
|
||||||
warn: console.warn.bind(console),
|
warn: console.warn.bind(console),
|
||||||
@ -772,7 +772,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
isBindableTypedArray,
|
isBindableTypedArray,
|
||||||
isInt32, isSQLableTypedArray, isTypedArray,
|
isInt32, isSQLableTypedArray, isTypedArray,
|
||||||
typedArrayToString,
|
typedArrayToString,
|
||||||
isUIThread: ()=>(self.window===self && !!self.document),
|
isUIThread: ()=>(globalThis.window===globalThis && !!globalThis.document),
|
||||||
// is this true for ESM?: 'undefined'===typeof WorkerGlobalScope
|
// is this true for ESM?: 'undefined'===typeof WorkerGlobalScope
|
||||||
isSharedTypedArray,
|
isSharedTypedArray,
|
||||||
toss: function(...args){throw new Error(args.join(' '))},
|
toss: function(...args){throw new Error(args.join(' '))},
|
||||||
@ -1203,9 +1203,9 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
console.error("sqlite3_wasmfs_opfs_dir() can no longer work due "+
|
console.error("sqlite3_wasmfs_opfs_dir() can no longer work due "+
|
||||||
"to incompatible WASMFS changes. It will be removed.");
|
"to incompatible WASMFS changes. It will be removed.");
|
||||||
if(!pdir
|
if(!pdir
|
||||||
|| !self.FileSystemHandle
|
|| !globalThis.FileSystemHandle
|
||||||
|| !self.FileSystemDirectoryHandle
|
|| !globalThis.FileSystemDirectoryHandle
|
||||||
|| !self.FileSystemFileHandle){
|
|| !globalThis.FileSystemFileHandle){
|
||||||
return __wasmfsOpfsDir = "";
|
return __wasmfsOpfsDir = "";
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
@ -1461,8 +1461,8 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
const rc = Object.create(null);
|
const rc = Object.create(null);
|
||||||
rc.prefix = 'kvvfs-'+which;
|
rc.prefix = 'kvvfs-'+which;
|
||||||
rc.stores = [];
|
rc.stores = [];
|
||||||
if('session'===which || ""===which) rc.stores.push(self.sessionStorage);
|
if('session'===which || ""===which) rc.stores.push(globalThis.sessionStorage);
|
||||||
if('local'===which || ""===which) rc.stores.push(self.localStorage);
|
if('local'===which || ""===which) rc.stores.push(globalThis.localStorage);
|
||||||
return rc;
|
return rc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1962,7 +1962,7 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
return sqlite3;
|
return sqlite3;
|
||||||
}/*sqlite3ApiBootstrap()*/;
|
}/*sqlite3ApiBootstrap()*/;
|
||||||
/**
|
/**
|
||||||
self.sqlite3ApiBootstrap.initializers is an internal detail used by
|
globalThis.sqlite3ApiBootstrap.initializers is an internal detail used by
|
||||||
the various pieces of the sqlite3 API's amalgamation process. It
|
the various pieces of the sqlite3 API's amalgamation process. It
|
||||||
must not be modified by client code except when plugging such code
|
must not be modified by client code except when plugging such code
|
||||||
into the amalgamation process.
|
into the amalgamation process.
|
||||||
@ -1980,14 +1980,14 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
|
|||||||
utilized until the whwasmutil.js part is plugged in via
|
utilized until the whwasmutil.js part is plugged in via
|
||||||
sqlite3-api-glue.js.
|
sqlite3-api-glue.js.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.initializers = [];
|
globalThis.sqlite3ApiBootstrap.initializers = [];
|
||||||
/**
|
/**
|
||||||
self.sqlite3ApiBootstrap.initializersAsync is an internal detail
|
globalThis.sqlite3ApiBootstrap.initializersAsync is an internal detail
|
||||||
used by the sqlite3 API's amalgamation process. It must not be
|
used by the sqlite3 API's amalgamation process. It must not be
|
||||||
modified by client code except when plugging such code into the
|
modified by client code except when plugging such code into the
|
||||||
amalgamation process.
|
amalgamation process.
|
||||||
|
|
||||||
The counterpart of self.sqlite3ApiBootstrap.initializers,
|
The counterpart of globalThis.sqlite3ApiBootstrap.initializers,
|
||||||
specifically for initializers which are asynchronous. All entries in
|
specifically for initializers which are asynchronous. All entries in
|
||||||
this list must be either async functions, non-async functions which
|
this list must be either async functions, non-async functions which
|
||||||
return a Promise, or a Promise. Each function in the list is called
|
return a Promise, or a Promise. Each function in the list is called
|
||||||
@ -1999,10 +1999,10 @@ self.sqlite3ApiBootstrap.initializers = [];
|
|||||||
|
|
||||||
This list is not processed until the client calls
|
This list is not processed until the client calls
|
||||||
sqlite3.asyncPostInit(). This means, for example, that intializers
|
sqlite3.asyncPostInit(). This means, for example, that intializers
|
||||||
added to self.sqlite3ApiBootstrap.initializers may push entries to
|
added to globalThis.sqlite3ApiBootstrap.initializers may push entries to
|
||||||
this list.
|
this list.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.initializersAsync = [];
|
globalThis.sqlite3ApiBootstrap.initializersAsync = [];
|
||||||
/**
|
/**
|
||||||
Client code may assign sqlite3ApiBootstrap.defaultConfig an
|
Client code may assign sqlite3ApiBootstrap.defaultConfig an
|
||||||
object-type value before calling sqlite3ApiBootstrap() (without
|
object-type value before calling sqlite3ApiBootstrap() (without
|
||||||
@ -2012,13 +2012,12 @@ self.sqlite3ApiBootstrap.initializersAsync = [];
|
|||||||
an environment-suitable configuration without having to define a new
|
an environment-suitable configuration without having to define a new
|
||||||
global-scope symbol.
|
global-scope symbol.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.defaultConfig = Object.create(null);
|
globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null);
|
||||||
/**
|
/**
|
||||||
Placeholder: gets installed by the first call to
|
Placeholder: gets installed by the first call to
|
||||||
self.sqlite3ApiBootstrap(). However, it is recommended that the
|
globalThis.sqlite3ApiBootstrap(). However, it is recommended that the
|
||||||
caller of sqlite3ApiBootstrap() capture its return value and delete
|
caller of sqlite3ApiBootstrap() capture its return value and delete
|
||||||
self.sqlite3ApiBootstrap after calling it. It returns the same
|
globalThis.sqlite3ApiBootstrap after calling it. It returns the same
|
||||||
value which will be stored here.
|
value which will be stored here.
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.sqlite3 = undefined;
|
globalThis.sqlite3ApiBootstrap.sqlite3 = undefined;
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@
|
|||||||
options.columnNames may be populated by the call to db.exec().
|
options.columnNames may be populated by the call to db.exec().
|
||||||
|
|
||||||
*/
|
*/
|
||||||
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||||
sqlite3.initWorker1API = function(){
|
sqlite3.initWorker1API = function(){
|
||||||
'use strict';
|
'use strict';
|
||||||
const toss = (...args)=>{throw new Error(args.join(' '))};
|
const toss = (...args)=>{throw new Error(args.join(' '))};
|
||||||
@ -382,10 +382,10 @@ sqlite3.initWorker1API = function(){
|
|||||||
*/
|
*/
|
||||||
post: function(msg,xferList){
|
post: function(msg,xferList){
|
||||||
if(xferList && xferList.length){
|
if(xferList && xferList.length){
|
||||||
self.postMessage( msg, Array.from(xferList) );
|
globalThis.postMessage( msg, Array.from(xferList) );
|
||||||
xferList.length = 0;
|
xferList.length = 0;
|
||||||
}else{
|
}else{
|
||||||
self.postMessage(msg);
|
globalThis.postMessage(msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** Map of DB IDs to DBs. */
|
/** Map of DB IDs to DBs. */
|
||||||
@ -589,7 +589,7 @@ sqlite3.initWorker1API = function(){
|
|||||||
}
|
}
|
||||||
}/*wMsgHandler*/;
|
}/*wMsgHandler*/;
|
||||||
|
|
||||||
self.onmessage = async function(ev){
|
globalThis.onmessage = async function(ev){
|
||||||
ev = ev.data;
|
ev = ev.data;
|
||||||
let result, dbId = ev.dbId, evType = ev.type;
|
let result, dbId = ev.dbId, evType = ev.type;
|
||||||
const arrivalTime = performance.now();
|
const arrivalTime = performance.now();
|
||||||
@ -637,6 +637,6 @@ sqlite3.initWorker1API = function(){
|
|||||||
result: result
|
result: result
|
||||||
}, wState.xfer);
|
}, wState.xfer);
|
||||||
};
|
};
|
||||||
self.postMessage({type:'sqlite3-api',result:'worker1-ready'});
|
globalThis.postMessage({type:'sqlite3-api',result:'worker1-ready'});
|
||||||
}.bind({self, sqlite3});
|
}.bind({self, sqlite3});
|
||||||
});
|
});
|
||||||
|
@ -50,10 +50,10 @@
|
|||||||
const wPost = (type,...args)=>postMessage({type, payload:args});
|
const wPost = (type,...args)=>postMessage({type, payload:args});
|
||||||
const installAsyncProxy = function(self){
|
const installAsyncProxy = function(self){
|
||||||
const toss = function(...args){throw new Error(args.join(' '))};
|
const toss = function(...args){throw new Error(args.join(' '))};
|
||||||
if(self.window === self){
|
if(globalThis.window === globalThis){
|
||||||
toss("This code cannot run from the main thread.",
|
toss("This code cannot run from the main thread.",
|
||||||
"Load it as a Worker from a separate Worker.");
|
"Load it as a Worker from a separate Worker.");
|
||||||
}else if(!navigator.storage.getDirectory){
|
}else if(!navigator?.storage?.getDirectory){
|
||||||
toss("This API requires navigator.storage.getDirectory.");
|
toss("This API requires navigator.storage.getDirectory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ const installAsyncProxy = function(self){
|
|||||||
w += m.wait;
|
w += m.wait;
|
||||||
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
|
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
|
||||||
}
|
}
|
||||||
console.log(self.location.href,
|
console.log(globalThis?.location?.href,
|
||||||
"metrics for",self.location.href,":\n",
|
"metrics for",globalThis?.location?.href,":\n",
|
||||||
metrics,
|
metrics,
|
||||||
"\nTotal of",n,"op(s) for",t,"ms",
|
"\nTotal of",n,"op(s) for",t,"ms",
|
||||||
"approx",w,"ms spent waiting on OPFS APIs.");
|
"approx",w,"ms spent waiting on OPFS APIs.");
|
||||||
@ -843,7 +843,7 @@ const installAsyncProxy = function(self){
|
|||||||
|
|
||||||
navigator.storage.getDirectory().then(function(d){
|
navigator.storage.getDirectory().then(function(d){
|
||||||
state.rootDir = d;
|
state.rootDir = d;
|
||||||
self.onmessage = function({data}){
|
globalThis.onmessage = function({data}){
|
||||||
switch(data.type){
|
switch(data.type){
|
||||||
case 'opfs-async-init':{
|
case 'opfs-async-init':{
|
||||||
/* Receive shared state from synchronous partner */
|
/* Receive shared state from synchronous partner */
|
||||||
@ -880,17 +880,17 @@ const installAsyncProxy = function(self){
|
|||||||
wPost('opfs-async-loaded');
|
wPost('opfs-async-loaded');
|
||||||
}).catch((e)=>error("error initializing OPFS asyncer:",e));
|
}).catch((e)=>error("error initializing OPFS asyncer:",e));
|
||||||
}/*installAsyncProxy()*/;
|
}/*installAsyncProxy()*/;
|
||||||
if(!self.SharedArrayBuffer){
|
if(!globalThis.SharedArrayBuffer){
|
||||||
wPost('opfs-unavailable', "Missing SharedArrayBuffer API.",
|
wPost('opfs-unavailable', "Missing SharedArrayBuffer API.",
|
||||||
"The server must emit the COOP/COEP response headers to enable that.");
|
"The server must emit the COOP/COEP response headers to enable that.");
|
||||||
}else if(!self.Atomics){
|
}else if(!globalThis.Atomics){
|
||||||
wPost('opfs-unavailable', "Missing Atomics API.",
|
wPost('opfs-unavailable', "Missing Atomics API.",
|
||||||
"The server must emit the COOP/COEP response headers to enable that.");
|
"The server must emit the COOP/COEP response headers to enable that.");
|
||||||
}else if(!self.FileSystemHandle ||
|
}else if(!globalThis.FileSystemHandle ||
|
||||||
!self.FileSystemDirectoryHandle ||
|
!globalThis.FileSystemDirectoryHandle ||
|
||||||
!self.FileSystemFileHandle ||
|
!globalThis.FileSystemFileHandle ||
|
||||||
!self.FileSystemFileHandle.prototype.createSyncAccessHandle ||
|
!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle ||
|
||||||
!navigator.storage.getDirectory){
|
!navigator?.storage?.getDirectory){
|
||||||
wPost('opfs-unavailable',"Missing required OPFS APIs.");
|
wPost('opfs-unavailable',"Missing required OPFS APIs.");
|
||||||
}else{
|
}else{
|
||||||
installAsyncProxy(self);
|
installAsyncProxy(self);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
with its virtual table counterpart, sqlite3.vtab.
|
with its virtual table counterpart, sqlite3.vtab.
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||||
const wasm = sqlite3.wasm, capi = sqlite3.capi, toss = sqlite3.util.toss3;
|
const wasm = sqlite3.wasm, capi = sqlite3.capi, toss = sqlite3.util.toss3;
|
||||||
const vfs = Object.create(null), vtab = Object.create(null);
|
const vfs = Object.create(null), vtab = Object.create(null);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
after sqlite3-api-oo1.js and before sqlite3-api-cleanup.js.
|
after sqlite3-api-oo1.js and before sqlite3-api-cleanup.js.
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||||
/**
|
/**
|
||||||
installOpfsVfs() returns a Promise which, on success, installs an
|
installOpfsVfs() returns a Promise which, on success, installs an
|
||||||
sqlite3_vfs named "opfs", suitable for use with all sqlite3 APIs
|
sqlite3_vfs named "opfs", suitable for use with all sqlite3 APIs
|
||||||
@ -76,23 +76,23 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
`opfs` property, containing several OPFS-specific utilities.
|
`opfs` property, containing several OPFS-specific utilities.
|
||||||
*/
|
*/
|
||||||
const installOpfsVfs = function callee(options){
|
const installOpfsVfs = function callee(options){
|
||||||
if(!self.SharedArrayBuffer
|
if(!globalThis.SharedArrayBuffer
|
||||||
|| !self.Atomics){
|
|| !globalThis.Atomics){
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. "+
|
new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. "+
|
||||||
"The server must emit the COOP/COEP response headers to enable those. "+
|
"The server must emit the COOP/COEP response headers to enable those. "+
|
||||||
"See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep")
|
"See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep")
|
||||||
);
|
);
|
||||||
}else if(self.window===self && self.document){
|
}else if('undefined'===typeof WorkerGlobalScope){
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error("The OPFS sqlite3_vfs cannot run in the main thread "+
|
new Error("The OPFS sqlite3_vfs cannot run in the main thread "+
|
||||||
"because it requires Atomics.wait().")
|
"because it requires Atomics.wait().")
|
||||||
);
|
);
|
||||||
}else if(!self.FileSystemHandle ||
|
}else if(!globalThis.FileSystemHandle ||
|
||||||
!self.FileSystemDirectoryHandle ||
|
!globalThis.FileSystemDirectoryHandle ||
|
||||||
!self.FileSystemFileHandle ||
|
!globalThis.FileSystemFileHandle ||
|
||||||
!self.FileSystemFileHandle.prototype.createSyncAccessHandle ||
|
!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle ||
|
||||||
!navigator.storage.getDirectory){
|
!navigator?.storage?.getDirectory){
|
||||||
return Promise.reject(
|
return Promise.reject(
|
||||||
new Error("Missing required OPFS APIs.")
|
new Error("Missing required OPFS APIs.")
|
||||||
);
|
);
|
||||||
@ -100,7 +100,7 @@ const installOpfsVfs = function callee(options){
|
|||||||
if(!options || 'object'!==typeof options){
|
if(!options || 'object'!==typeof options){
|
||||||
options = Object.create(null);
|
options = Object.create(null);
|
||||||
}
|
}
|
||||||
const urlParams = new URL(self.location.href).searchParams;
|
const urlParams = new URL(globalThis.location.href).searchParams;
|
||||||
if(undefined===options.verbose){
|
if(undefined===options.verbose){
|
||||||
options.verbose = urlParams.has('opfs-verbose')
|
options.verbose = urlParams.has('opfs-verbose')
|
||||||
? (+urlParams.get('opfs-verbose') || 2) : 1;
|
? (+urlParams.get('opfs-verbose') || 2) : 1;
|
||||||
@ -112,7 +112,7 @@ const installOpfsVfs = function callee(options){
|
|||||||
options.proxyUri = callee.defaultProxyUri;
|
options.proxyUri = callee.defaultProxyUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sqlite3.config.warn("OPFS options =",options,self.location);
|
//sqlite3.config.warn("OPFS options =",options,globalThis.location);
|
||||||
|
|
||||||
if('function' === typeof options.proxyUri){
|
if('function' === typeof options.proxyUri){
|
||||||
options.proxyUri = options.proxyUri();
|
options.proxyUri = options.proxyUri();
|
||||||
@ -149,11 +149,11 @@ const installOpfsVfs = function callee(options){
|
|||||||
Returns true if _this_ thread has access to the OPFS APIs.
|
Returns true if _this_ thread has access to the OPFS APIs.
|
||||||
*/
|
*/
|
||||||
const thisThreadHasOPFS = ()=>{
|
const thisThreadHasOPFS = ()=>{
|
||||||
return self.FileSystemHandle &&
|
return globalThis.FileSystemHandle &&
|
||||||
self.FileSystemDirectoryHandle &&
|
globalThis.FileSystemDirectoryHandle &&
|
||||||
self.FileSystemFileHandle &&
|
globalThis.FileSystemFileHandle &&
|
||||||
self.FileSystemFileHandle.prototype.createSyncAccessHandle &&
|
globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle &&
|
||||||
navigator.storage.getDirectory;
|
navigator?.storage?.getDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,8 +171,8 @@ const installOpfsVfs = function callee(options){
|
|||||||
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
|
m.avgTime = (m.count && m.time) ? (m.time / m.count) : 0;
|
||||||
m.avgWait = (m.count && m.wait) ? (m.wait / m.count) : 0;
|
m.avgWait = (m.count && m.wait) ? (m.wait / m.count) : 0;
|
||||||
}
|
}
|
||||||
sqlite3.config.log(self.location.href,
|
sqlite3.config.log(globalThis.location.href,
|
||||||
"metrics for",self.location.href,":",metrics,
|
"metrics for",globalThis.location.href,":",metrics,
|
||||||
"\nTotal of",n,"op(s) for",t,
|
"\nTotal of",n,"op(s) for",t,
|
||||||
"ms (incl. "+w+" ms of waiting on the async side)");
|
"ms (incl. "+w+" ms of waiting on the async side)");
|
||||||
sqlite3.config.log("Serialization metrics:",metrics.s11n);
|
sqlite3.config.log("Serialization metrics:",metrics.s11n);
|
||||||
@ -1311,7 +1311,7 @@ const installOpfsVfs = function callee(options){
|
|||||||
}/*installOpfsVfs()*/;
|
}/*installOpfsVfs()*/;
|
||||||
installOpfsVfs.defaultProxyUri =
|
installOpfsVfs.defaultProxyUri =
|
||||||
"sqlite3-opfs-async-proxy.js";
|
"sqlite3-opfs-async-proxy.js";
|
||||||
self.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
|
globalThis.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
|
||||||
try{
|
try{
|
||||||
let proxyJs = installOpfsVfs.defaultProxyUri;
|
let proxyJs = installOpfsVfs.defaultProxyUri;
|
||||||
if(sqlite3.scriptInfo.sqlite3Dir){
|
if(sqlite3.scriptInfo.sqlite3Dir){
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
|
|
||||||
https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
|
https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
|
||||||
*/
|
*/
|
||||||
self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
|
globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
|
||||||
// Inspired by: https://stackoverflow.com/a/52439530
|
// Inspired by: https://stackoverflow.com/a/52439530
|
||||||
if(1===arguments.length && 'function'===typeof arguments[0]){
|
if(1===arguments.length && 'function'===typeof arguments[0]){
|
||||||
const f = config;
|
const f = config;
|
||||||
@ -245,7 +245,7 @@ self.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig){
|
|||||||
return p;
|
return p;
|
||||||
};
|
};
|
||||||
}/*sqlite3Worker1Promiser()*/;
|
}/*sqlite3Worker1Promiser()*/;
|
||||||
self.sqlite3Worker1Promiser.defaultConfig = {
|
globalThis.sqlite3Worker1Promiser.defaultConfig = {
|
||||||
worker: function(){
|
worker: function(){
|
||||||
//#if target=es6-bundler-friendly
|
//#if target=es6-bundler-friendly
|
||||||
return new Worker("sqlite3-worker1-bundler-friendly.mjs",{
|
return new Worker("sqlite3-worker1-bundler-friendly.mjs",{
|
||||||
@ -259,17 +259,17 @@ self.sqlite3Worker1Promiser.defaultConfig = {
|
|||||||
src.pop();
|
src.pop();
|
||||||
theJs = src.join('/')+'/' + theJs;
|
theJs = src.join('/')+'/' + theJs;
|
||||||
//sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs);
|
//sqlite3.config.warn("promiser currentScript, theJs =",this.currentScript,theJs);
|
||||||
}else{
|
}else if(globalThis.location){
|
||||||
//sqlite3.config.warn("promiser self.location =",self.location);
|
//sqlite3.config.warn("promiser globalThis.location =",globalThis.location);
|
||||||
const urlParams = new URL(self.location.href).searchParams;
|
const urlParams = new URL(globalThis.location.href).searchParams;
|
||||||
if(urlParams.has('sqlite3.dir')){
|
if(urlParams.has('sqlite3.dir')){
|
||||||
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
|
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Worker(theJs + self.location.search);
|
return new Worker(theJs + globalThis.location.search);
|
||||||
//#endif
|
//#endif
|
||||||
}.bind({
|
}.bind({
|
||||||
currentScript: self?.document?.currentScript
|
currentScript: globalThis?.document?.currentScript
|
||||||
}),
|
}),
|
||||||
onerror: (...args)=>console.error('worker1 promiser error',...args)
|
onerror: (...args)=>console.error('worker1 promiser error',...args)
|
||||||
};
|
};
|
||||||
|
@ -36,7 +36,9 @@ import {default as sqlite3InitModule} from './sqlite3-bundler-friendly.mjs';
|
|||||||
//#else
|
//#else
|
||||||
"use strict";
|
"use strict";
|
||||||
{
|
{
|
||||||
const urlParams = new URL(self.location.href).searchParams;
|
const urlParams = globalThis.location
|
||||||
|
? new URL(self.location.href).searchParams
|
||||||
|
: new URLSearchParams();
|
||||||
let theJs = 'sqlite3.js';
|
let theJs = 'sqlite3.js';
|
||||||
if(urlParams.has('sqlite3.dir')){
|
if(urlParams.has('sqlite3.dir')){
|
||||||
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
|
theJs = urlParams.get('sqlite3.dir') + '/' + theJs;
|
||||||
|
@ -45,8 +45,8 @@
|
|||||||
Intended usage:
|
Intended usage:
|
||||||
|
|
||||||
```
|
```
|
||||||
self.WhWasmUtilInstaller(appObject);
|
globalThis.WhWasmUtilInstaller(appObject);
|
||||||
delete self.WhWasmUtilInstaller;
|
delete globalThis.WhWasmUtilInstaller;
|
||||||
```
|
```
|
||||||
|
|
||||||
Its global-scope symbol is intended only to provide an easy way to
|
Its global-scope symbol is intended only to provide an easy way to
|
||||||
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
https://fossil.wanderinghorse.net/r/jaccwabbyt/file/common/whwasmutil.js
|
https://fossil.wanderinghorse.net/r/jaccwabbyt/file/common/whwasmutil.js
|
||||||
*/
|
*/
|
||||||
self.WhWasmUtilInstaller = function(target){
|
globalThis.WhWasmUtilInstaller = function(target){
|
||||||
'use strict';
|
'use strict';
|
||||||
if(undefined===target.bigIntEnabled){
|
if(undefined===target.bigIntEnabled){
|
||||||
target.bigIntEnabled = !!self['BigInt64Array'];
|
target.bigIntEnabled = !!self['BigInt64Array'];
|
||||||
@ -2194,7 +2194,7 @@ self.WhWasmUtilInstaller = function(target){
|
|||||||
Error handling is up to the caller, who may attach a `catch()` call
|
Error handling is up to the caller, who may attach a `catch()` call
|
||||||
to the promise.
|
to the promise.
|
||||||
*/
|
*/
|
||||||
self.WhWasmUtilInstaller.yawl = function(config){
|
globalThis.WhWasmUtilInstaller.yawl = function(config){
|
||||||
const wfetch = ()=>fetch(config.uri, {credentials: 'same-origin'});
|
const wfetch = ()=>fetch(config.uri, {credentials: 'same-origin'});
|
||||||
const wui = this;
|
const wui = this;
|
||||||
const finalThen = function(arg){
|
const finalThen = function(arg){
|
||||||
@ -2240,4 +2240,4 @@ self.WhWasmUtilInstaller.yawl = function(config){
|
|||||||
.then(finalThen);
|
.then(finalThen);
|
||||||
};
|
};
|
||||||
return loadWasm;
|
return loadWasm;
|
||||||
}.bind(self.WhWasmUtilInstaller)/*yawl()*/;
|
}.bind(globalThis.WhWasmUtilInstaller)/*yawl()*/;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
self.Jaccwabyt = function StructBinderFactory(config){
|
globalThis.Jaccwabyt = function StructBinderFactory(config){
|
||||||
/* ^^^^ it is recommended that clients move that object into wherever
|
/* ^^^^ it is recommended that clients move that object into wherever
|
||||||
they'd like to have it and delete the self-held copy ("self" being
|
they'd like to have it and delete the self-held copy ("self" being
|
||||||
the global window or worker object). This API does not require the
|
the global window or worker object). This API does not require the
|
||||||
|
40
manifest
40
manifest
@ -1,5 +1,5 @@
|
|||||||
C In\sthe\sJS\ssqlite3.vfs/vtab\sutility\sAPIs,\suse\sa\slocal\sreference\sto\sStructBinder\sinstead\sof\ssqlite3.StructBinder,\sas\sthat\sobject\sis\sremoved\sfrom\sthe\ssqlite3\snamespace\sduring\sthe\sfinal\ssteps\sof\sAPI\sinitialization.\sBased\son\sfeedback\sfrom\s[forum:d19d96183badca70|forum\spost\sd19d96183badca70].
|
C Replace\suse\sof\s'self'\sin\sJS\scode\swith\s'globalThis',\sas\sthat\sworks\sin\sbrowsers\sand\snode\senvironments.\sAvoid\susing\sglobalThis.location\sif\sit's\snot\sset\s(e.g.\sin\snode).\sBased\son\sfeedback\sin\s[forum:ac7a94d4f77db235|forum\spost\sac7a94d4f77db235].\sMinor\sJS\sbuild\stweaks.
|
||||||
D 2023-03-07T12:59:20.234
|
D 2023-03-07T19:12:06.088
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@ -468,37 +468,37 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
|
|||||||
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
|
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
|
||||||
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
|
||||||
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
|
||||||
F ext/wasm/GNUmakefile 7bc0f80ccc1e82ef2c2dd597ac98e8c5a2d3094ee06dc4b05d5bbe82fed03143
|
F ext/wasm/GNUmakefile 6c0c0e9d3b6ef2090f230bc47f8da5d9614fbdefacb72e8bafcc9a41d035605b
|
||||||
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
|
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
|
||||||
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
|
F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9
|
||||||
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
|
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab
|
||||||
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
|
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
|
||||||
F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54
|
F ext/wasm/api/README.md 77a2f1f2fc60a35def7455dffc8d3f2c56385d6ac5c6cecc60fa938252ea2c54
|
||||||
F ext/wasm/api/extern-post-js.c-pp.js 44a3a169f55a8dba42cf688954b2625b9b9e6174f2ff02d4918a2ca8c3beab7f
|
F ext/wasm/api/extern-post-js.c-pp.js 5c4997d3442756e4e4819303fa4a7045de4a2a7b79c3ad6c26cdcf1d9141fac6
|
||||||
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
|
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
|
||||||
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
|
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
|
||||||
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
|
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
|
||||||
F ext/wasm/api/pre-js.c-pp.js 9ece5de1bb0509f0a8a360712fcc9c1291b9516c0be5bd66acedd6edbcec37a1
|
F ext/wasm/api/pre-js.c-pp.js ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057afb08161d7511219
|
||||||
F ext/wasm/api/sqlite3-api-cleanup.js 2d63eb84267a1d15ce002e083d6396a521471da8af3afa76846d50f39a54d65e
|
F ext/wasm/api/sqlite3-api-cleanup.js cc21e3486da748463e02bbe51e2464c6ac136587cdfd5aa00cd0b5385f6ca808
|
||||||
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
|
F ext/wasm/api/sqlite3-api-glue.js 32091c2730ecef8f5795c3527d3db6b7bbf054d12e27311ce2da59db559b2e0e
|
||||||
F ext/wasm/api/sqlite3-api-oo1.js 9b50c188513c70438a497914089cfeac79b6ac2d73501775538f9e467325ea15
|
F ext/wasm/api/sqlite3-api-oo1.js 2691a34a741015127b210954a1b9586764d3ff0c8a20f00fd15c00f339ecc79f
|
||||||
F ext/wasm/api/sqlite3-api-prologue.js 5cc817b67a774bfa3c47d4c2fa484b10b24b5529a66094b35546f3ebba1ef646
|
F ext/wasm/api/sqlite3-api-prologue.js df8646e4f92b8b09cef255da3530e11dc264a2e8d53b0e78daa2ee04f99c584d
|
||||||
F ext/wasm/api/sqlite3-api-worker1.js 9551f04cdfcde354e5a6ccb48951e007d618abb4e95758297b7fd44ccffdf89f
|
F ext/wasm/api/sqlite3-api-worker1.js 838d756ef059c1f9cfd96f5c3fd3579f1c9be1216efbd1c0a8c086264f96d307
|
||||||
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
|
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
|
||||||
F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c3c72a80bef364fa2a58e2ddae3f
|
F ext/wasm/api/sqlite3-opfs-async-proxy.js 70914ae97784d3028150bbf252e07a423056c42cc345903c81b5fae661ce512f
|
||||||
F ext/wasm/api/sqlite3-v-helper.js 2b7c8b26293127a69138d7474521ee3ae6f1e714dfebe6cfb4632e25b448e86d
|
F ext/wasm/api/sqlite3-v-helper.js e5c202a9ecde9ef818536d3f5faf26c03a1a9f5192b1ddea8bdabf30d75ef487
|
||||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 0dfddd0fcd354817c3d5887decebb8a293cbb926c2639ba09b995a524f1085fb
|
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 26f6240170d415726d9cfe2fa7a0163e153775e1a74fa91c9ba5446502c71097
|
||||||
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
|
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
|
||||||
F ext/wasm/api/sqlite3-wasm.c 223d30c41d811cae8b9f1175fa68f2f1fb3cc056d16ad0def3b0ea5c65757a6c
|
F ext/wasm/api/sqlite3-wasm.c 223d30c41d811cae8b9f1175fa68f2f1fb3cc056d16ad0def3b0ea5c65757a6c
|
||||||
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js f17d5a51dbf804c37999c9814dd068017e5336e09a04012e50d9486fb895c2e4
|
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js 2710a06a59620c6bf7ce298ab1fb6c9ce825b9f9379728b74c486db6613beecc
|
||||||
F ext/wasm/api/sqlite3-worker1.c-pp.js 51f32a719880c9c5142f11a6cdf232f30dcc4387e361eeb5855fcf7caaa8c318
|
F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75
|
||||||
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
|
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
|
||||||
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
|
F ext/wasm/batch-runner.js 0dad6a02ad796f1003d3b7048947d275c4d6277f63767b8e685c27df8fdac93e
|
||||||
F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4
|
F ext/wasm/c-pp.c 6d80d8569d85713effe8b0818a3cf51dc779e3f0bf8dc88771b8998552ee25b4
|
||||||
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
|
F ext/wasm/common/SqliteTestUtil.js d8bf97ecb0705a2299765c8fc9e11b1a5ac7f10988bbf375a6558b7ca287067b
|
||||||
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
|
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
|
||||||
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
|
F ext/wasm/common/testing.css 0ff15602a3ab2bad8aef2c3bd120c7ee3fd1c2054ad2ace7e214187ae68d926f
|
||||||
F ext/wasm/common/whwasmutil.js cad510071533dbe47787bce53f2e0dcab5b05d2dde1dbe477d8fb04e00d4e8c4
|
F ext/wasm/common/whwasmutil.js 749a1f81f85835e9a384e9706f2a955a7158f2b8cc9da33f41105cac7775a305
|
||||||
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
||||||
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
||||||
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
|
F ext/wasm/demo-123.js ebae30756585bca655b4ab2553ec9236a87c23ad24fc8652115dcedb06d28df6
|
||||||
@ -517,7 +517,7 @@ F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5
|
|||||||
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
|
F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2
|
||||||
F ext/wasm/index-dist.html 22379774f0ad4edcaaa8cf9c674c82e794cc557719a8addabed74eb8069d412e
|
F ext/wasm/index-dist.html 22379774f0ad4edcaaa8cf9c674c82e794cc557719a8addabed74eb8069d412e
|
||||||
F ext/wasm/index.html dd900891844caebd9cadbddd704f66bd841d7c12fd69ce5af490e2c10fb49f45
|
F ext/wasm/index.html dd900891844caebd9cadbddd704f66bd841d7c12fd69ce5af490e2c10fb49f45
|
||||||
F ext/wasm/jaccwabyt/jaccwabyt.js 06f2ef1ad640c26c593def3d960336e9bb789819b920516480895c38ed5f58fa
|
F ext/wasm/jaccwabyt/jaccwabyt.js 8287c0537fa0750414edbe75ce64668a81c8716df5ec4c3e6bb4f11bd1c36031
|
||||||
F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb
|
F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb
|
||||||
F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10
|
F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10
|
||||||
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
|
F ext/wasm/scratchpad-wasmfs-main.html 20cf6f1a8f368e70d01e8c17200e3eaa90f1c8e1029186d836d14b83845fbe06
|
||||||
@ -2048,8 +2048,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 46b3ac6d1fdd9207cdc511d445bb4c33d11102d6e4eb43f119293d62bb7008ff
|
P 0d89885d28b44b1858117a72a180841f4f5f44bcc574fc59a116ca3526325932
|
||||||
R 4a31f99bfa30395371cae1302bc1f756
|
R 422bfcde04e8717cdbd839c41655b87a
|
||||||
U stephan
|
U stephan
|
||||||
Z 0f22e03fc38467c39e3c17df73bf7790
|
Z b769421e5ef0157ab70f4e43f4db6aad
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@ -1 +1 @@
|
|||||||
0d89885d28b44b1858117a72a180841f4f5f44bcc574fc59a116ca3526325932
|
dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
|
Reference in New Issue
Block a user