1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

js: resolve the mysterious "extra" unhandled exception notification, caused by inadvertently forking one promise into two separate ones (failing to properly reassign a then() result). Fix a typo in new Worker 1 code which caused the DB(filename) name to be incorrect.

FossilOrigin-Name: 7467ac88801224089b51c6ba7924f93283dd87beca602a186c83632df26cfc85
This commit is contained in:
stephan
2022-08-24 14:50:10 +00:00
parent 9a34509a06
commit 9c765e7945
7 changed files with 37 additions and 41 deletions

View File

@ -29,16 +29,6 @@
};
let startTime;
const logEventResult = async function(evd){
logHtml(evd.errorClass ? 'error' : '',
"response to",evd.messageId,"Worker time =",
(evd.workerRespondTime - evd.workerReceivedTime),"ms.",
"Round-trip event time =",
(performance.now() - evd.departureTime),"ms.",
(evd.errorClass ? evd.message : "")
);
};
const testCount = async ()=>{
logHtml("","Total test count:",T.counter+". Total time =",(performance.now() - startTime),"ms");
};
@ -70,26 +60,28 @@
delete self.sqlite3Worker1Promiser;
const wtest = async function(msgType, msgArgs, callback){
let p = workerPromise({type: msgType, args:msgArgs});
if(callback) p.then(callback).finally(testCount);
return p;
const p = workerPromise({type: msgType, args:msgArgs});
return callback ? p.then(callback).finally(testCount) : p;
};
const runTests = async function(){
const dbFilename = '/testing2.sqlite3';
logHtml('',
"Sending 'open' message and waiting for its response before continuing.");
startTime = performance.now();
wtest('open', {
filename:'testing2.sqlite3',
simulateError: 0 /* if true, fail the 'open' */
await wtest('open', {
filename: dbFilename,
persistent: true,
simulateError: 0 /* if true, fail the 'open' */,
}, function(ev){
log("then open result",ev);
T.assert('testing2.sqlite3'===ev.result.filename)
T.assert(1 && (dbFilename===ev.result.filename
|| (sqlite3TestModule.sqlite3ApiConfig.persistentDirName
+ dbFilename)==ev.result.filename))
.assert(ev.dbId)
.assert(ev.messageId)
.assert(promiserConfig.dbId === ev.dbId);
}).then(runTests2)
.catch((err)=>error("error response:",err));
}).then(runTests2);
};
const runTests2 = async function(){