From 456ca213b2104c5c2913320f2a666bbbf8681f0a Mon Sep 17 00:00:00 2001 From: Roy Hashimoto Date: Mon, 3 Jun 2024 10:53:09 -0700 Subject: [PATCH 1/2] Remove obsolete karma configuration file. --- karma.conf.cjs | 82 -------------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 karma.conf.cjs diff --git a/karma.conf.cjs b/karma.conf.cjs deleted file mode 100644 index ae6b95ac..00000000 --- a/karma.conf.cjs +++ /dev/null @@ -1,82 +0,0 @@ -// Karma configuration -// Generated on Tue Apr 20 2021 22:15:36 GMT-0700 (Pacific Daylight Time) - -process.env.CHROME_BIN = require('puppeteer').executablePath(); -module.exports = function(config) { - config.set({ - - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '', - - - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['jasmine'], - plugins: ['karma-jasmine', 'karma-chrome-launcher'], - client: { - jasmine: { - random: true, - timeoutInterval: 30_000 - } - }, - - // list of files / patterns to load in the browser - mime: { 'application/wasm': ['wasm'] }, - files: [ - { pattern: '.yarn/unplugged/**/*.js', type: 'module', included: false }, - { pattern: '{dist,debug}/*.mjs', type: 'module', included: false }, - { pattern: '{dist,debug}/*.wasm', type: 'wasm', included: false }, - { pattern: 'test/*.test.js', type: 'module' }, - { pattern: 'src/**/*.js', included: false }, - { pattern: 'test/*.js', included: false } - ], - - - // list of files / patterns to exclude - exclude: [ - ], - - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - }, - - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: [], - - - // web server port - port: 9876, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: [], - - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: true, - - // Concurrency level - // how many browser should be started simultaneous - concurrency: Infinity - }) -} From 304dba33596c752f6449d8f54ded9ddd869f2eb7 Mon Sep 17 00:00:00 2001 From: Roy Hashimoto Date: Sat, 8 Jun 2024 10:49:58 -0700 Subject: [PATCH 2/2] Fix WebLocksMixin.jCheckReservedLock bug. --- src/WebLocksMixin.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/WebLocksMixin.js b/src/WebLocksMixin.js index e997f27c..e23c8415 100644 --- a/src/WebLocksMixin.js +++ b/src/WebLocksMixin.js @@ -111,7 +111,7 @@ export const WebLocksMixin = superclass => class extends superclass { return this.#checkReservedExclusive(lockState, pResOut); case 'shared': case 'shared+hint': - return await this.#checkReservedShared(lockState, pResOut); + return await this.#checkReservedShared(lockState, pResOut); } } catch (e) { console.error('WebLocksMixin: check reserved lock error', e); @@ -151,7 +151,7 @@ export const WebLocksMixin = superclass => class extends superclass { if (!await this.#acquire(lockState, 'access')) { return VFS.SQLITE_BUSY; } - console.assert(lockState.access); + console.assert(!!lockState.access); } lockState.type = lockType; return VFS.SQLITE_OK; @@ -210,7 +210,7 @@ export const WebLocksMixin = superclass => class extends superclass { await this.#acquire(lockState, 'access', SHARED); lockState.gate(); console.assert(!lockState.gate); - console.assert(lockState.access); + console.assert(!!lockState.access); console.assert(!lockState.reserved); break; @@ -245,7 +245,7 @@ export const WebLocksMixin = superclass => class extends superclass { lockState.access(); console.assert(!lockState.gate); console.assert(!lockState.access); - console.assert(lockState.reserved); + console.assert(!!lockState.reserved); break; case VFS.SQLITE_LOCK_EXCLUSIVE: @@ -261,8 +261,8 @@ export const WebLocksMixin = superclass => class extends superclass { lockState.gate(); return VFS.SQLITE_BUSY; } - console.assert(lockState.gate); - console.assert(lockState.access); + console.assert(!!lockState.gate); + console.assert(!!lockState.access); console.assert(!lockState.reserved); break; @@ -285,9 +285,9 @@ export const WebLocksMixin = superclass => class extends superclass { lockState.gate(); return VFS.SQLITE_BUSY; } - console.assert(lockState.gate); - console.assert(lockState.access); - console.assert(lockState.reserved); + console.assert(!!lockState.gate); + console.assert(!!lockState.access); + console.assert(!!lockState.reserved); break; default: @@ -330,7 +330,7 @@ export const WebLocksMixin = superclass => class extends superclass { lockState.gate(); lockState.reserved?.(); lockState.hint?.(); - console.assert(lockState.access); + console.assert(!!lockState.access); console.assert(!lockState.gate); console.assert(!lockState.reserved); break; @@ -341,7 +341,7 @@ export const WebLocksMixin = superclass => class extends superclass { await this.#acquire(lockState, 'access', SHARED); lockState.reserved(); lockState.hint?.(); - console.assert(lockState.access); + console.assert(!!lockState.access); console.assert(!lockState.gate); console.assert(!lockState.reserved); break; @@ -358,10 +358,11 @@ export const WebLocksMixin = superclass => class extends superclass { */ async #checkReservedShared(lockState, pResOut) { if (await this.#acquire(lockState, 'reserved', POLL_SHARED)) { + // We were able to get the lock so it was not reserved. lockState.reserved(); - pResOut.setInt32(0, 1, true); - } else { pResOut.setInt32(0, 0, true); + } else { + pResOut.setInt32(0, 1, true); } return VFS.SQLITE_OK; }