Replace 'self' with 'globalThis' in some JS test code.

FossilOrigin-Name: 53eeffc9b1ea8c3ee7d7cdcc220997ed893403e45b35d8ea10805ea3b0435587
This commit is contained in:
stephan 2023-07-13 03:46:43 +00:00
parent 5da49ff562
commit 81602595a0
3 changed files with 16 additions and 16 deletions

View File

@ -45,7 +45,7 @@
*/
//#if target=es6-module
import {default as sqlite3InitModule} from './jswasm/sqlite3.mjs';
self.sqlite3InitModule = sqlite3InitModule;
globalThis.sqlite3InitModule = sqlite3InitModule;
//#else
'use strict';
//#endif
@ -57,7 +57,7 @@ self.sqlite3InitModule = sqlite3InitModule;
*/
let logClass;
/* Predicate for tests/groups. */
const isUIThread = ()=>(self.window===self && self.document);
const isUIThread = ()=>(globalThis.window===self && globalThis.document);
/* Predicate for tests/groups. */
const isWorker = ()=>!isUIThread();
/* Predicate for tests/groups. */
@ -3050,14 +3050,14 @@ self.sqlite3InitModule = sqlite3InitModule;
////////////////////////////////////////////////////////////////////////
log("Loading and initializing sqlite3 WASM module...");
if(0){
self.sqlite3ApiConfig = {
globalThis.sqlite3ApiConfig = {
debug: ()=>{},
log: ()=>{},
warn: ()=>{},
error: ()=>{}
}
}
if(!self.sqlite3InitModule && !isUIThread()){
if(!globalThis.sqlite3InitModule && !isUIThread()){
/* Vanilla worker, as opposed to an ES6 module worker */
/*
If sqlite3.js is in a directory other than this script, in order
@ -3070,27 +3070,27 @@ self.sqlite3InitModule = sqlite3InitModule;
that's not needed.
URL arguments passed as part of the filename via importScripts()
are simply lost, and such scripts see the self.location of
are simply lost, and such scripts see the globalThis.location of
_this_ script.
*/
let sqlite3Js = 'sqlite3.js';
const urlParams = new URL(self.location.href).searchParams;
const urlParams = new URL(globalThis.location.href).searchParams;
if(urlParams.has('sqlite3.dir')){
sqlite3Js = urlParams.get('sqlite3.dir') + '/' + sqlite3Js;
}
importScripts(sqlite3Js);
}
self.sqlite3InitModule.__isUnderTest =
globalThis.sqlite3InitModule.__isUnderTest =
true /* disables certain API-internal cleanup so that we can
test internal APIs from here */;
self.sqlite3InitModule({
globalThis.sqlite3InitModule({
print: log,
printErr: error
}).then(function(sqlite3){
//console.log('sqlite3 =',sqlite3);
log("Done initializing WASM/JS bits. Running tests...");
sqlite3.config.warn("Installing sqlite3 bits as global S for local dev/test purposes.");
self.S = sqlite3;
globalThis.S = sqlite3;
capi = sqlite3.capi;
wasm = sqlite3.wasm;
log("sqlite3 version:",capi.sqlite3_libversion(),

View File

@ -1,5 +1,5 @@
C JS:\schange\sthe\sdefault\sOPFS\sVFS\sjournal\smode\sfrom\sPERSIST\sto\sDELETE,\sas\sDELETE\sis\sfaster\sin\scurrent\sbrowsers.
D 2023-07-13T01:51:16.511
C Replace\s'self'\swith\s'globalThis'\sin\ssome\sJS\stest\scode.
D 2023-07-13T03:46:43.944
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -547,7 +547,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
F ext/wasm/test-opfs-vfs.js f09266873e1a34d9bdb6d3981ec8c9e382f31f215c9fd2f9016d2394b8ae9b7b
F ext/wasm/tester1-worker.html ebc4b820a128963afce328ecf63ab200bd923309eb939f4110510ab449e9814c
F ext/wasm/tester1.c-pp.html 1c1bc78b858af2019e663b1a31e76657b73dc24bede28ca92fbe917c3a972af2
F ext/wasm/tester1.c-pp.js 1a05497ae2b2fcca008d43b37072f9b841e1c970c06c01eb0faf675db567bfc8
F ext/wasm/tester1.c-pp.js 439a1264bc3224b90bc722833568cc36fc77ed0ba6d2e4379b40ea7c417c97ab
F ext/wasm/tests/opfs/concurrency/index.html 0802373d57034d51835ff6041cda438c7a982deea6079efd98098d3e42fbcbc1
F ext/wasm/tests/opfs/concurrency/test.js a98016113eaf71e81ddbf71655aa29b0fed9a8b79a3cdd3620d1658eb1cc9a5d
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@ -2042,8 +2042,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f661a6e0c1ac081ee402e64590eabd427440db1b717be9166bdfc025d0b0d899
R 68f402355eff532485c97ad92873be22
P a061a43e36b8f3cb7c465fd2e54cfcd9dceb07e232ee78602bbdd1818acd05ea
R e5f9c2b543ee2e3a15f3537a9d58e252
U stephan
Z e4c28ef3556be6a3a591892b05be6957
Z c5917bb24dee9d73dec2b26ad6758a4f
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
a061a43e36b8f3cb7c465fd2e54cfcd9dceb07e232ee78602bbdd1818acd05ea
53eeffc9b1ea8c3ee7d7cdcc220997ed893403e45b35d8ea10805ea3b0435587