blob: abd81a7ce3a022f55cefa4402dac94bca10b638a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const { ExtensionTestCommon } = ChromeUtils.importESModule(
"resource://testing-common/ExtensionTestCommon.sys.mjs"
);
add_task(async function extension_startup_early_error() {
const EXTENSION_ID = "@extension-with-package-error";
let extension = ExtensionTestCommon.generate({
manifest: {
browser_specific_settings: { gecko: { id: EXTENSION_ID } },
},
});
extension.initLocale = async function () {
// Simulate error that happens during startup.
extension.packagingError("dummy error");
};
let startupPromise = extension.startup();
let policy = WebExtensionPolicy.getByID(EXTENSION_ID);
ok(policy, "WebExtensionPolicy instantiated at startup");
let readyPromise = policy.readyPromise;
ok(readyPromise, "WebExtensionPolicy.readyPromise is set");
await Assert.rejects(
startupPromise,
/dummy error/,
"Extension with packaging error should fail to load"
);
Assert.equal(
WebExtensionPolicy.getByID(EXTENSION_ID),
null,
"WebExtensionPolicy should be unregistered"
);
Assert.equal(
await readyPromise,
null,
"policy.readyPromise should be resolved with null"
);
});
|