Bug 1878281 - Stub out NEWTAB_MESSAGE_REQUEST handling for legacy privileged addons. r=mkaply,omc-reviewers,pdahiya
Differential Revision: https://phabricator.services.mozilla.com/D201094
This commit is contained in:
@@ -91,6 +91,13 @@ export class ASRouterChild extends JSWindowActorChild {
|
||||
}
|
||||
|
||||
asRouterMessage({ type, data }) {
|
||||
// Some legacy privileged addons send this message, but it got removed from
|
||||
// VALID_TYPES in bug 1715158. Thankfully, these addons don't appear to
|
||||
// require any actions from this message - just a Promise that resolves.
|
||||
if (type === "NEWTAB_MESSAGE_REQUEST") {
|
||||
return this.wrapPromise(Promise.resolve());
|
||||
}
|
||||
|
||||
if (VALID_TYPES.has(type)) {
|
||||
switch (type) {
|
||||
case msg.DISABLE_PROVIDER:
|
||||
|
||||
@@ -55,5 +55,17 @@ describe("ASRouterChild", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
// Some legacy privileged extensions still send this legacy NEWTAB_MESSAGE_REQUEST
|
||||
// action type. We simply
|
||||
it("can accept the legacy NEWTAB_MESSAGE_REQUEST message without throwing", async () => {
|
||||
assert.doesNotThrow(async () => {
|
||||
let result = await asRouterChild.asRouterMessage({
|
||||
type: "NEWTAB_MESSAGE_REQUEST",
|
||||
data: {},
|
||||
});
|
||||
sandbox.assert.deepEqual(result, {});
|
||||
sandbox.assert.notCalled(asRouterChild.sendAsyncMessage);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,6 +27,15 @@ describe("ASRouterUtils", () => {
|
||||
overrider.set("ASRouterMessage", undefined);
|
||||
assert.throws(() => ASRouterUtils.sendMessage({ foo: "bar" }));
|
||||
});
|
||||
it("can accept the legacy NEWTAB_MESSAGE_REQUEST message without throwing", async () => {
|
||||
assert.doesNotThrow(async () => {
|
||||
let result = await ASRouterUtils.sendMessage({
|
||||
type: "NEWTAB_MESSAGE_REQUEST",
|
||||
data: {},
|
||||
});
|
||||
sandbox.assert.deepEqual(result, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("blockById", () => {
|
||||
it("default", () => {
|
||||
|
||||
Reference in New Issue
Block a user