Bug 1897920 - Follow mozilla-central and adjust wrong specification of scripting.registerScripts(). r=mkmelin
The MDN documentation was indeed wrong. See Bug 1896870. Adjusting our own methods to comply with the specification. Differential Revision: https://phabricator.services.mozilla.com/D211004 --HG-- extra : amend_source : b31738ad7bfc79a1bce22699f2133b344c1855aa
This commit is contained in:
Родитель
d5bf2c3f40
Коммит
56eeb97887
|
@ -255,7 +255,6 @@ this.scripting_tb = class extends ExtensionAPI {
|
|||
extensionScriptsMap().set(scriptId, extensionScript);
|
||||
newScripts.push(extensionScript.convert());
|
||||
}
|
||||
return newScripts;
|
||||
},
|
||||
async unregisterScripts(filter) {
|
||||
const ids = filter?.ids ?? null;
|
||||
|
|
|
@ -102,14 +102,8 @@
|
|||
{
|
||||
"name": "callback",
|
||||
"type": "function",
|
||||
"description": "The resulting array contains the registered compose scripts.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "scripts",
|
||||
"type": "array",
|
||||
"items": { "$ref": "ComposeScriptDetails" }
|
||||
}
|
||||
]
|
||||
"description": "Invoked upon completion of the registration.",
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -221,14 +215,8 @@
|
|||
{
|
||||
"name": "callback",
|
||||
"type": "function",
|
||||
"description": "The resulting array contains the registered message display scripts.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "scripts",
|
||||
"type": "array",
|
||||
"items": { "$ref": "MessageDisplayScriptDetails" }
|
||||
}
|
||||
]
|
||||
"description": "Invoked upon completion of the registration.",
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -331,21 +331,13 @@ add_task(async function testRegisterBeforeCompose() {
|
|||
// Register the compose script only during install, and not when the
|
||||
// background script wakes up again.
|
||||
browser.runtime.onInstalled.addListener(async () => {
|
||||
const scriptDetails = await browser.scripting.compose.registerScripts(
|
||||
[
|
||||
{
|
||||
id: "test-1",
|
||||
css: ["test.css"],
|
||||
js: ["test.js"],
|
||||
},
|
||||
]
|
||||
);
|
||||
window.assertDeepEqual(
|
||||
EXPECTED_DETAILS,
|
||||
scriptDetails,
|
||||
`Details of registered script should be correct`,
|
||||
{ strict: true }
|
||||
);
|
||||
await browser.scripting.compose.registerScripts([
|
||||
{
|
||||
id: "test-1",
|
||||
css: ["test.css"],
|
||||
js: ["test.js"],
|
||||
},
|
||||
]);
|
||||
|
||||
// Test getRegisteredScripts(filter).
|
||||
const testsForGetRegisteredScripts = [
|
||||
|
|
|
@ -386,20 +386,13 @@ add_task(async function testRegister() {
|
|||
// Register the message display script only during install, and not when
|
||||
// the background script wakes up again.
|
||||
browser.runtime.onInstalled.addListener(async () => {
|
||||
const scriptDetails =
|
||||
await browser.scripting.messageDisplay.registerScripts([
|
||||
{
|
||||
id: "test-1",
|
||||
css: ["test.css"],
|
||||
js: ["test.js"],
|
||||
},
|
||||
]);
|
||||
window.assertDeepEqual(
|
||||
EXPECTED_DETAILS,
|
||||
scriptDetails,
|
||||
`Details of registered script should be correct`,
|
||||
{ strict: true }
|
||||
);
|
||||
await browser.scripting.messageDisplay.registerScripts([
|
||||
{
|
||||
id: "test-1",
|
||||
css: ["test.css"],
|
||||
js: ["test.js"],
|
||||
},
|
||||
]);
|
||||
|
||||
// Test getRegisteredScripts(filter).
|
||||
const testsForGetRegisteredScripts = [
|
||||
|
|
Загрузка…
Ссылка в новой задаче