Backed out changeset 40cdffbbff0e (bug 1593186) for browser_getActor.js and browser_sendQuery.js failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2020-05-12 01:13:20 +03:00
Родитель 34c6fd1e8c
Коммит ee479fe473
10 изменённых файлов: 30 добавлений и 154 удалений

Просмотреть файл

@ -29,6 +29,7 @@ class TranslationStub extends TranslationParent {
constructor(browser) {
super();
this._browser = browser;
this.actorCreated();
}
get browser() {

Просмотреть файл

@ -31,8 +31,6 @@ void JSProcessActorParent::Init(const nsACString& aName,
MOZ_ASSERT(!mManager, "Cannot Init() a JSProcessActorParent twice!");
SetName(aName);
mManager = aManager;
InvokeCallback(CallbackFunction::ActorCreated);
}
JSProcessActorParent::~JSProcessActorParent() { MOZ_ASSERT(!mManager); }

Просмотреть файл

@ -31,8 +31,6 @@ void JSWindowActorParent::Init(const nsACString& aName,
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");
SetName(aName);
mManager = aManager;
InvokeCallback(CallbackFunction::ActorCreated);
}
namespace {

Просмотреть файл

@ -2,35 +2,15 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const ACTOR_PARENT_CREATED_NOTIFICATION = "test-process-actor-parent-created";
function promiseNotification(aNotification) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let notificationResolve;
let notificationObserver = function observer() {
notificationResolve();
Services.obs.removeObserver(notificationObserver, aNotification);
};
return new Promise(resolve => {
notificationResolve = resolve;
Services.obs.addObserver(notificationObserver, aNotification);
});
}
declTest("getActor on both sides", {
async test(browser) {
let parentCreationObserved = promiseNotification(
ACTOR_PARENT_CREATED_NOTIFICATION
);
let parent = browser.browsingContext.currentWindowGlobal.contentParent;
ok(parent, "WindowGlobalParent should have value.");
let actorParent = parent.getActor("TestProcessActor");
is(
actorParent.show(),
"TestProcessActorParent",
"actor show should have value."
"actor show should have vaule."
);
is(
actorParent.manager,
@ -38,34 +18,20 @@ declTest("getActor on both sides", {
"manager should match WindowGlobalParent.contentParent"
);
await parentCreationObserved;
ok(true, "Parent creation was observed");
await SpecialPowers.spawn(
browser,
[promiseNotification.toString()],
async function(promiseNotificationSource) {
const ACTOR_CHILD_CREATED_NOTIFICATION =
"test-process-actor-child-created";
let childCreationObserved = new Function(promiseNotificationSource)(
ACTOR_CHILD_CREATED_NOTIFICATION
);
let child = ChromeUtils.contentChild;
ok(child, "WindowGlobalChild should have value.");
let actorChild = child.getActor("TestProcessActor");
is(
actorChild.show(),
"TestProcessActorChild",
"actor show should have vaule."
);
is(
actorChild.manager,
child,
"manager should match ChromeUtils.contentChild."
);
await childCreationObserved;
ok(true, "Child creation was observed");
}
);
await SpecialPowers.spawn(browser, [], async function() {
let child = ChromeUtils.contentChild;
ok(child, "WindowGlobalChild should have value.");
let actorChild = child.getActor("TestProcessActor");
is(
actorChild.show(),
"TestProcessActorChild",
"actor show should have vaule."
);
is(
actorChild.manager,
child,
"manager should match ChromeUtils.contentChild."
);
});
},
});

Просмотреть файл

@ -17,21 +17,6 @@ let processActorOptions = {
},
};
function promiseNotification(aNotification) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let notificationResolve;
let notificationObserver = function observer() {
notificationResolve();
Services.obs.removeObserver(notificationObserver, aNotification);
};
return new Promise(resolve => {
notificationResolve = resolve;
Services.obs.addObserver(notificationObserver, aNotification);
});
}
function declTest(name, cfg) {
let { url = "about:blank", remoteTypes, fission, test } = cfg;

Просмотреть файл

@ -2,71 +2,25 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const ACTOR_PARENT_CREATED_NOTIFICATION = "test-window-actor-parent-created";
function promiseNotification(aNotification) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
let notificationResolve;
let notificationObserver = function observer() {
notificationResolve();
Services.obs.removeObserver(notificationObserver, aNotification);
};
return new Promise(resolve => {
notificationResolve = resolve;
Services.obs.addObserver(notificationObserver, aNotification);
});
}
declTest("getActor on both sides", {
async test(browser) {
let parentCreationObserved = promiseNotification(
ACTOR_PARENT_CREATED_NOTIFICATION
);
let parent = browser.browsingContext.currentWindowGlobal;
ok(parent, "WindowGlobalParent should have value.");
let actorParent = parent.getActor("TestWindow");
is(actorParent.show(), "TestWindowParent", "actor show should have vaule.");
is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
ok(true, "Checking that we can observe parent creation");
await parentCreationObserved;
ok(true, "Parent creation was observed");
await SpecialPowers.spawn(
browser,
[promiseNotification.toString()],
async function(promiseNotificationSource) {
const ACTOR_CHILD_CREATED_NOTIFICATION =
"test-window-actor-child-created";
let childCreationObserved = new Function(promiseNotificationSource)(
ACTOR_CHILD_CREATED_NOTIFICATION
);
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
is(
child.isInProcess,
false,
"Actor should be loaded in the content process."
);
let actorChild = child.getActor("TestWindow");
is(
actorChild.show(),
"TestWindowChild",
"actor show should have vaule."
);
is(
actorChild.manager,
child,
"manager should match WindowGlobalChild."
);
ok(true, "Checking that we can observe child creation");
await childCreationObserved;
ok(true, "Child creation was observed");
}
);
await SpecialPowers.spawn(browser, [], async function() {
let child = content.windowGlobalChild;
ok(child, "WindowGlobalChild should have value.");
is(
child.isInProcess,
false,
"Actor should be loaded in the content process."
);
let actorChild = child.getActor("TestWindow");
is(actorChild.show(), "TestWindowChild", "actor show should have vaule.");
is(actorChild.manager, child, "manager should match WindowGlobalChild.");
});
},
});

Просмотреть файл

@ -13,13 +13,6 @@ class TestProcessActorChild extends JSProcessActorChild {
super();
}
actorCreated() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.obs.notifyObservers(null, "test-process-actor-child-created");
}
receiveMessage(aMessage) {
switch (aMessage.name) {
case "toChild":

Просмотреть файл

@ -11,12 +11,7 @@ class TestProcessActorParent extends JSProcessActorParent {
super();
this.wrappedJSObject = this;
}
actorCreated() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.obs.notifyObservers(null, "test-process-actor-parent-created");
}
receiveMessage(aMessage) {
switch (aMessage.name) {
case "init":

Просмотреть файл

@ -13,13 +13,6 @@ class TestWindowChild extends JSWindowActorChild {
super();
}
actorCreated() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.obs.notifyObservers(null, "test-window-actor-child-created");
}
receiveMessage(aMessage) {
switch (aMessage.name) {
case "toChild":

Просмотреть файл

@ -14,13 +14,6 @@ class TestWindowParent extends JSWindowActorParent {
this.wrappedJSObject = this;
}
actorCreated() {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
Services.obs.notifyObservers(null, "test-window-actor-parent-created");
}
receiveMessage(aMessage) {
switch (aMessage.name) {
case "init":