mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 21:00:42 +02:00
Backed out changeset 3f222a72eb1c (bug 1593186) for browser_getActor.js failures CLOSED TREE
This commit is contained in:
parent
e3806f335f
commit
2cb15e959f
10 changed files with 30 additions and 152 deletions
|
|
@ -29,6 +29,7 @@ class TranslationStub extends TranslationParent {
|
||||||
constructor(browser) {
|
constructor(browser) {
|
||||||
super();
|
super();
|
||||||
this._browser = browser;
|
this._browser = browser;
|
||||||
|
this.actorCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
get browser() {
|
get browser() {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ void JSProcessActorParent::Init(const nsACString& aName,
|
||||||
MOZ_ASSERT(!mManager, "Cannot Init() a JSProcessActorParent twice!");
|
MOZ_ASSERT(!mManager, "Cannot Init() a JSProcessActorParent twice!");
|
||||||
SetName(aName);
|
SetName(aName);
|
||||||
mManager = aManager;
|
mManager = aManager;
|
||||||
|
|
||||||
InvokeCallback(CallbackFunction::ActorCreated);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSProcessActorParent::~JSProcessActorParent() { MOZ_ASSERT(!mManager); }
|
JSProcessActorParent::~JSProcessActorParent() { MOZ_ASSERT(!mManager); }
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,6 @@ void JSWindowActorParent::Init(const nsACString& aName,
|
||||||
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");
|
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");
|
||||||
SetName(aName);
|
SetName(aName);
|
||||||
mManager = aManager;
|
mManager = aManager;
|
||||||
|
|
||||||
InvokeCallback(CallbackFunction::ActorCreated);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,15 @@
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
"use strict";
|
"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", {
|
declTest("getActor on both sides", {
|
||||||
async test(browser) {
|
async test(browser) {
|
||||||
let parentCreationObserved = promiseNotification(
|
|
||||||
ACTOR_PARENT_CREATED_NOTIFICATION
|
|
||||||
);
|
|
||||||
let parent = browser.browsingContext.currentWindowGlobal.contentParent;
|
let parent = browser.browsingContext.currentWindowGlobal.contentParent;
|
||||||
ok(parent, "WindowGlobalParent should have value.");
|
ok(parent, "WindowGlobalParent should have value.");
|
||||||
let actorParent = parent.getActor("TestProcessActor");
|
let actorParent = parent.getActor("TestProcessActor");
|
||||||
is(
|
is(
|
||||||
actorParent.show(),
|
actorParent.show(),
|
||||||
"TestProcessActorParent",
|
"TestProcessActorParent",
|
||||||
"actor show should have value."
|
"actor show should have vaule."
|
||||||
);
|
);
|
||||||
is(
|
is(
|
||||||
actorParent.manager,
|
actorParent.manager,
|
||||||
|
|
@ -38,18 +18,7 @@ declTest("getActor on both sides", {
|
||||||
"manager should match WindowGlobalParent.contentParent"
|
"manager should match WindowGlobalParent.contentParent"
|
||||||
);
|
);
|
||||||
|
|
||||||
await parentCreationObserved;
|
await SpecialPowers.spawn(browser, [], async function() {
|
||||||
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;
|
let child = ChromeUtils.contentChild;
|
||||||
ok(child, "WindowGlobalChild should have value.");
|
ok(child, "WindowGlobalChild should have value.");
|
||||||
let actorChild = child.getActor("TestProcessActor");
|
let actorChild = child.getActor("TestProcessActor");
|
||||||
|
|
@ -63,9 +32,6 @@ declTest("getActor on both sides", {
|
||||||
child,
|
child,
|
||||||
"manager should match ChromeUtils.contentChild."
|
"manager should match ChromeUtils.contentChild."
|
||||||
);
|
);
|
||||||
await childCreationObserved;
|
});
|
||||||
ok(true, "Child creation was observed");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
function declTest(name, cfg) {
|
||||||
let { url = "about:blank", remoteTypes, fission, test } = cfg;
|
let { url = "about:blank", remoteTypes, fission, test } = cfg;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,47 +2,15 @@
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
"use strict";
|
"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", {
|
declTest("getActor on both sides", {
|
||||||
async test(browser) {
|
async test(browser) {
|
||||||
let parentCreationObserved = promiseNotification(
|
|
||||||
ACTOR_PARENT_CREATED_NOTIFICATION
|
|
||||||
);
|
|
||||||
let parent = browser.browsingContext.currentWindowGlobal;
|
let parent = browser.browsingContext.currentWindowGlobal;
|
||||||
ok(parent, "WindowGlobalParent should have value.");
|
ok(parent, "WindowGlobalParent should have value.");
|
||||||
let actorParent = parent.getActor("TestWindow");
|
let actorParent = parent.getActor("TestWindow");
|
||||||
is(actorParent.show(), "TestWindowParent", "actor show should have vaule.");
|
is(actorParent.show(), "TestWindowParent", "actor show should have vaule.");
|
||||||
is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
|
is(actorParent.manager, parent, "manager should match WindowGlobalParent.");
|
||||||
|
|
||||||
await parentCreationObserved;
|
await SpecialPowers.spawn(browser, [], async function() {
|
||||||
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;
|
let child = content.windowGlobalChild;
|
||||||
ok(child, "WindowGlobalChild should have value.");
|
ok(child, "WindowGlobalChild should have value.");
|
||||||
is(
|
is(
|
||||||
|
|
@ -51,20 +19,8 @@ declTest("getActor on both sides", {
|
||||||
"Actor should be loaded in the content process."
|
"Actor should be loaded in the content process."
|
||||||
);
|
);
|
||||||
let actorChild = child.getActor("TestWindow");
|
let actorChild = child.getActor("TestWindow");
|
||||||
is(
|
is(actorChild.show(), "TestWindowChild", "actor show should have vaule.");
|
||||||
actorChild.show(),
|
is(actorChild.manager, child, "manager should match WindowGlobalChild.");
|
||||||
"TestWindowChild",
|
});
|
||||||
"actor show should have vaule."
|
|
||||||
);
|
|
||||||
is(
|
|
||||||
actorChild.manager,
|
|
||||||
child,
|
|
||||||
"manager should match WindowGlobalChild."
|
|
||||||
);
|
|
||||||
|
|
||||||
await childCreationObserved;
|
|
||||||
ok(true, "Child creation was observed");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,6 @@ class TestProcessActorChild extends JSProcessActorChild {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
const { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
Services.obs.notifyObservers(null, "test-process-actor-child-created");
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
receiveMessage(aMessage) {
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "toChild":
|
case "toChild":
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,7 @@ class TestProcessActorParent extends JSProcessActorParent {
|
||||||
super();
|
super();
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
}
|
}
|
||||||
actorCreated() {
|
|
||||||
const { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
Services.obs.notifyObservers(null, "test-process-actor-parent-created");
|
|
||||||
}
|
|
||||||
receiveMessage(aMessage) {
|
receiveMessage(aMessage) {
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "init":
|
case "init":
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,6 @@ class TestWindowChild extends JSWindowActorChild {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
const { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
Services.obs.notifyObservers(null, "test-window-actor-child-created");
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
receiveMessage(aMessage) {
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "toChild":
|
case "toChild":
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,6 @@ class TestWindowParent extends JSWindowActorParent {
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCreated() {
|
|
||||||
const { Services } = ChromeUtils.import(
|
|
||||||
"resource://gre/modules/Services.jsm"
|
|
||||||
);
|
|
||||||
Services.obs.notifyObservers(null, "test-window-actor-child-created");
|
|
||||||
}
|
|
||||||
|
|
||||||
receiveMessage(aMessage) {
|
receiveMessage(aMessage) {
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "init":
|
case "init":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue