From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- toolkit/modules/Sqlite.sys.mjs | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'toolkit/modules/Sqlite.sys.mjs') diff --git a/toolkit/modules/Sqlite.sys.mjs b/toolkit/modules/Sqlite.sys.mjs index b1f48c28be..ca58904d6b 100644 --- a/toolkit/modules/Sqlite.sys.mjs +++ b/toolkit/modules/Sqlite.sys.mjs @@ -1184,9 +1184,15 @@ ConnectionData.prototype = Object.freeze({ * @param {string} destFilePath * The path on the local filesystem to write the database copy. Any existing * file at this path will be overwritten. + * @param {number} [pagesPerStep=0] + * The number of pages to copy per step. If not supplied or is 0, falls back + * to the platform default which is currently 5. + * @param {number} [stepDelayMs=0] + * The number of milliseconds to wait between copying step. If not supplied + * or is 0, falls back to the platform default which is currently 250. * @return Promise */ - async backupToFile(destFilePath) { + async backupToFile(destFilePath, pagesPerStep = 0, stepDelayMs = 0) { if (!this._dbConn) { return Promise.reject( new Error("No opened database connection to create a backup from.") @@ -1194,13 +1200,18 @@ ConnectionData.prototype = Object.freeze({ } let destFile = await IOUtils.getFile(destFilePath); return new Promise((resolve, reject) => { - this._dbConn.backupToFileAsync(destFile, result => { - if (Components.isSuccessCode(result)) { - resolve(); - } else { - reject(result); - } - }); + this._dbConn.backupToFileAsync( + destFile, + result => { + if (Components.isSuccessCode(result)) { + resolve(); + } else { + reject(result); + } + }, + pagesPerStep, + stepDelayMs + ); }); }, }); @@ -2002,10 +2013,20 @@ OpenedConnection.prototype = Object.freeze({ * @param {string} destFilePath * The path on the local filesystem to write the database copy. Any existing * file at this path will be overwritten. + * @param {number} [pagesPerStep=0] + * The number of pages to copy per step. If not supplied or is 0, falls back + * to the platform default which is currently 5. + * @param {number} [stepDelayMs=0] + * The number of milliseconds to wait between copying step. If not supplied + * or is 0, falls back to the platform default which is currently 250. * @return Promise */ - backup(destFilePath) { - return this._connectionData.backupToFile(destFilePath); + backup(destFilePath, pagesPerStep = 0, stepDelayMs = 0) { + return this._connectionData.backupToFile( + destFilePath, + pagesPerStep, + stepDelayMs + ); }, }); -- cgit v1.2.3