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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* import-globals-from helper-addons.js */
Services.scriptloader.loadSubScript(CHROME_URL_ROOT + "helper-addons.js", this);
// Test that the reload button updates the addon list with the correct metadata.
add_task(async function () {
const { document, tab, window } = await openAboutDebugging();
await selectThisFirefoxPage(document, window.AboutDebugging.store);
const EXTENSION_ID = "test-devtools@mozilla.org";
const EXTENSION_NAME = "Temporary web extension";
let { xpiFile: addonFile } = await installTemporaryExtensionFromXPI(
{
id: EXTENSION_ID,
name: EXTENSION_NAME,
},
document
);
const target = findDebugTargetByText(EXTENSION_NAME, document);
ok(!!target, "The temporary extension is installed with the expected name");
info("Update the name of the temporary extension in the manifest");
addonFile = updateTemporaryXPI({ id: EXTENSION_ID }, addonFile);
info("Click on the reload button for the invalid temporary extension");
const waitForError = waitForDispatch(
window.AboutDebugging.store,
"TEMPORARY_EXTENSION_RELOAD_FAILURE"
);
const reloadButton = target.querySelector(
".qa-temporary-extension-reload-button"
);
reloadButton.click();
await waitForError;
ok(
target.querySelector(".qa-temporary-extension-reload-error"),
"The error message of reloading appears"
);
info("Click on the reload button for the valid temporary extension");
const waitForSuccess = waitForDispatch(
window.AboutDebugging.store,
"TEMPORARY_EXTENSION_RELOAD_SUCCESS"
);
updateTemporaryXPI({ id: EXTENSION_ID, name: EXTENSION_NAME }, addonFile);
reloadButton.click();
await waitForSuccess;
ok(
!target.querySelector(".qa-temporary-extension-reload-error"),
"The error message of reloading disappears"
);
info("Click on the remove button for the temporary extension");
const removeButton = target.querySelector(
".qa-temporary-extension-remove-button"
);
removeButton.click();
info("Wait until the debug target with the extension disappears");
await waitUntil(() => !findDebugTargetByText(EXTENSION_NAME, document));
await removeTab(tab);
});
|