Backed out changeset 63fabd70675c (bug 1539764) for causing failures in browser_ext_addon_debugging_netmonitor.js CLOSED TREE

This commit is contained in:
Noemi Erli 2019-07-26 01:29:13 +03:00
Родитель 8f73896852
Коммит 1e52c22f88
4 изменённых файлов: 6 добавлений и 46 удалений

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

@ -3,8 +3,8 @@
add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
const tab = await addTab("about:blank");
const target = await TargetFactory.forTab(tab);
await target.attach();
@ -12,14 +12,6 @@ add_task(async function() {
const target2 = await TargetFactory.forTab(tab2);
await target2.attach();
info("Test the targetFront attribute for the root");
const { client } = target;
is(
client.mainRoot.targetFront,
null,
"got null from the targetFront attribute for the root"
);
info("Test getting a front twice");
const getAccessibilityFront = await target.getFront("accessibility");
const getAccessibilityFront2 = await target.getFront("accessibility");
@ -28,16 +20,6 @@ add_task(async function() {
getAccessibilityFront2,
"got the same front when calling getFront twice"
);
is(
getAccessibilityFront.targetFront,
target,
"got the correct targetFront attribute from the front"
);
is(
getAccessibilityFront2.targetFront,
target,
"got the correct targetFront attribute from the front"
);
info("Test getting a front on different targets");
const target1Front = await target.getFront("accessibility");
@ -47,16 +29,6 @@ add_task(async function() {
true,
"got different fronts when calling getFront on different targets"
);
is(
target1Front.targetFront !== target2Front.targetFront,
true,
"got different targetFront from different fronts from different targets"
);
is(
target2Front.targetFront,
target2,
"got the correct targetFront attribute from the front"
);
info("Test async front retrieval");
// use two fronts that are initialized one after the other.

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

@ -202,8 +202,7 @@ function TargetMixin(parentClass) {
this._inspector = await getFront(
this.client,
"inspector",
this.targetForm,
this
this.targetForm
);
this.emit("inspector", this._inspector);
return this._inspector;
@ -230,7 +229,7 @@ function TargetMixin(parentClass) {
) {
return front;
}
front = getFront(this.client, typeName, this.targetForm, this);
front = getFront(this.client, typeName, this.targetForm);
this.fronts.set(typeName, front);
// replace the placeholder with the instance of the front once it has loaded
front = await front;

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

@ -40,9 +40,6 @@ class Front extends Pool {
constructor(conn = null) {
super(conn);
this.actorID = null;
// The targetFront attribute represents the debuggable context. Only target-scoped
// fronts and their children fronts will have the targetFront attribute set.
this.targetFront = null;
this._requests = [];
// Front listener functions registered via `onFront` get notified

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

@ -317,6 +317,7 @@ types.addActorType = function(name) {
let front = ctx.conn.getActor(actorID);
if (!front) {
// If front isn't instantiated yet, create one.
// Try lazy loading front if not already loaded.
// The front module will synchronously call `FrontClassWithSpec` and
// augment `type` with the `frontClass` attribute.
@ -329,11 +330,7 @@ types.addActorType = function(name) {
const Class = type.frontClass;
front = new Class(ctx.conn);
front.actorID = actorID;
const parentFront = ctx.marshallPool();
// If this is a child of a target-scoped front, propagate the target front to the
// child front that it manages.
front.targetFront = parentFront.targetFront;
parentFront.manage(front);
ctx.marshallPool().manage(front);
}
// When the type `${name}#actorid` is used, `v` is a string refering to the
@ -493,11 +490,8 @@ exports.registerFront = function(cls) {
* @param json form
* If we want to instantiate a global actor's front, this is the root front's form,
* otherwise we are instantiating a target-scoped front from the target front's form.
* @param [Target|null] target
* If we are instantiating a target-scoped front, this is a reference to the front's
* Target instance, otherwise this is null.
*/
function getFront(client, typeName, form, target = null) {
function getFront(client, typeName, form) {
const type = types.getType(typeName);
if (!type) {
throw new Error(`No spec for front type '${typeName}'.`);
@ -509,8 +503,6 @@ function getFront(client, typeName, form, target = null) {
// a capital letter for all constructors.
const Class = type.frontClass;
const instance = new Class(client);
// Set the targetFront for target-scoped fronts.
instance.targetFront = target;
const { formAttributeName } = instance;
if (!formAttributeName) {
throw new Error(`Can't find the form attribute name for ${typeName}`);