summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/xpcshell/head.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/extensions/test/xpcshell/head.js
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/test/xpcshell/head.js')
-rw-r--r--toolkit/components/extensions/test/xpcshell/head.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/toolkit/components/extensions/test/xpcshell/head.js b/toolkit/components/extensions/test/xpcshell/head.js
index 6935e3f0da..ff58d36f7d 100644
--- a/toolkit/components/extensions/test/xpcshell/head.js
+++ b/toolkit/components/extensions/test/xpcshell/head.js
@@ -3,8 +3,9 @@
promiseQuotaManagerServiceReset, promiseQuotaManagerServiceClear,
runWithPrefs, testEnv, withHandlingUserInput, resetHandlingUserInput,
assertPersistentListeners, promiseExtensionEvent, assertHasPersistedScriptsCachedFlag,
- assertIsPersistedScriptsCachedFlag
- setup_crash_reporter_override_and_cleaner crashFrame crashExtensionBackground
+ assertIsPersistedScriptsCachedFlag,
+ setup_crash_reporter_override_and_cleaner, crashFrame, crashExtensionBackground,
+ makeRkvDatabaseDir
*/
var { AppConstants } = ChromeUtils.importESModule(
@@ -81,6 +82,19 @@ var createHttpServer = (...args) => {
return AddonTestUtils.createHttpServer(...args);
};
+async function makeRkvDatabaseDir(name, { mockCorrupted = false } = {}) {
+ const databaseDir = PathUtils.join(PathUtils.profileDir, name);
+ await IOUtils.makeDirectory(databaseDir);
+ if (mockCorrupted) {
+ // Mock a corrupted db.
+ await IOUtils.write(
+ PathUtils.join(databaseDir, "data.safe.bin"),
+ new Uint8Array([0x00, 0x00, 0x00, 0x00])
+ );
+ }
+ return databaseDir;
+}
+
// Some tests load non-moz-extension:-URLs in their extension document. When
// extensions run in-process (extensions.webextensions.remote set to false),
// that fails.
@@ -285,7 +299,7 @@ function handlingUserInputFrameScript() {
let handle;
MessageChannel.addListener(this, "ExtensionTest:HandleUserInput", {
- receiveMessage({ name, data }) {
+ receiveMessage({ data }) {
if (data) {
handle = content.windowUtils.setHandlingUserInput(true);
} else if (handle) {
@@ -367,7 +381,7 @@ const optionalPermissionsPromptHandler = {
});
},
- observe(subject, topic, data) {
+ observe(subject, topic) {
if (topic == "webextension-optional-permission-prompt") {
this.sawPrompt = true;
let { resolve } = subject.wrappedJSObject;