зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1569023 - Expose a helper on protocol's Front class to help retrieve the parent front. r=ochameau,yulia
Differential Revision: https://phabricator.services.mozilla.com/D39610 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6e2191877a
Коммит
daff679f83
|
@ -63,6 +63,7 @@ skip-if = os == 'win' || debug # Bug 1282269, 1448084
|
|||
[browser_devtools_api.js]
|
||||
[browser_devtools_api_destroy.js]
|
||||
[browser_dynamic_tool_enabling.js]
|
||||
[browser_front_parentFront.js]
|
||||
[browser_ignore_toolbox_network_requests.js]
|
||||
[browser_keybindings_01.js]
|
||||
[browser_keybindings_02.js]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test the Front's parentFront attribute returns the correct parent front.
|
||||
|
||||
const TEST_URL = `data:text/html;charset=utf-8,<div id="test"></div>`;
|
||||
|
||||
add_task(async function() {
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
|
||||
const tab = await addTab(TEST_URL);
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
|
||||
const inspectorFront = await target.getFront("inspector");
|
||||
const walker = inspectorFront.walker;
|
||||
const pageStyleFront = await inspectorFront.getPageStyle();
|
||||
const nodeFront = await walker.querySelector(walker.rootNode, "#test");
|
||||
|
||||
is(
|
||||
inspectorFront.parentFront,
|
||||
target,
|
||||
"Got the correct parentFront from the InspectorFront."
|
||||
);
|
||||
is(
|
||||
walker.parentFront,
|
||||
inspectorFront,
|
||||
"Got the correct parentFront from the WalkerFront."
|
||||
);
|
||||
is(
|
||||
pageStyleFront.parentFront,
|
||||
inspectorFront,
|
||||
"Got the correct parentFront from the PageStyleFront."
|
||||
);
|
||||
is(
|
||||
nodeFront.parentFront,
|
||||
walker,
|
||||
"Got the correct parentFront from the NodeFront."
|
||||
);
|
||||
});
|
|
@ -19,6 +19,11 @@ add_task(async function() {
|
|||
null,
|
||||
"got null from the targetFront attribute for the root"
|
||||
);
|
||||
is(
|
||||
client.mainRoot.parentFront,
|
||||
null,
|
||||
"got null from the parentFront attribute for the root"
|
||||
);
|
||||
|
||||
info("Test getting a front twice");
|
||||
const getAccessibilityFront = await target.getFront("accessibility");
|
||||
|
@ -38,6 +43,16 @@ add_task(async function() {
|
|||
target,
|
||||
"got the correct targetFront attribute from the front"
|
||||
);
|
||||
is(
|
||||
getAccessibilityFront.parentFront,
|
||||
target,
|
||||
"got the correct parentFront attribute from the front"
|
||||
);
|
||||
is(
|
||||
getAccessibilityFront2.parentFront,
|
||||
target,
|
||||
"got the correct parentFront attribute from the front"
|
||||
);
|
||||
|
||||
info("Test getting a front on different targets");
|
||||
const target1Front = await target.getFront("accessibility");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -15,8 +16,8 @@ const {
|
|||
const events = require("devtools/shared/event-emitter");
|
||||
|
||||
class AccessibleFront extends FrontClassWithSpec(accessibleSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this.before("audited", this.audited.bind(this));
|
||||
this.before("name-change", this.nameChange.bind(this));
|
||||
|
@ -156,8 +157,8 @@ class AccessibleFront extends FrontClassWithSpec(accessibleSpec) {
|
|||
}
|
||||
|
||||
class AccessibleWalkerFront extends FrontClassWithSpec(accessibleWalkerSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this.before("accessible-destroy", this.accessibleDestroy.bind(this));
|
||||
}
|
||||
|
||||
|
@ -179,8 +180,8 @@ class AccessibleWalkerFront extends FrontClassWithSpec(accessibleWalkerSpec) {
|
|||
}
|
||||
|
||||
class AccessibilityFront extends FrontClassWithSpec(accessibilitySpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this.before("init", this.init.bind(this));
|
||||
this.before("shutdown", this.shutdown.bind(this));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { addonsSpec } = require("devtools/shared/specs/addon/addons");
|
||||
|
@ -10,8 +11,8 @@ const {
|
|||
} = require("devtools/shared/protocol");
|
||||
|
||||
class AddonsFront extends FrontClassWithSpec(addonsSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "addonsActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -18,8 +19,8 @@ const {
|
|||
class WebExtensionInspectedWindowFront extends FrontClassWithSpec(
|
||||
webExtensionInspectedWindowSpec
|
||||
) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "webExtensionInspectedWindowActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -13,8 +14,8 @@ const {
|
|||
} = require("devtools/shared/specs/animation");
|
||||
|
||||
class AnimationPlayerFront extends FrontClassWithSpec(animationPlayerSpec) {
|
||||
constructor(conn, form) {
|
||||
super(conn, form);
|
||||
constructor(conn, targetFront, parentFront) {
|
||||
super(conn, targetFront, parentFront);
|
||||
|
||||
this.state = {};
|
||||
this.before("changed", this.onChanged.bind(this));
|
||||
|
@ -200,8 +201,8 @@ exports.AnimationPlayerFront = AnimationPlayerFront;
|
|||
registerFront(AnimationPlayerFront);
|
||||
|
||||
class AnimationsFront extends FrontClassWithSpec(animationsSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "animationsActor";
|
||||
|
|
|
@ -14,8 +14,8 @@ const { changesSpec } = require("devtools/shared/specs/changes");
|
|||
* ChangesFront, the front object for the ChangesActor
|
||||
*/
|
||||
class ChangesFront extends FrontClassWithSpec(changesSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "changesActor";
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"CSS_PROPERTIES_DB",
|
||||
"devtools/shared/css/properties-db",
|
||||
true
|
||||
);
|
||||
const {
|
||||
FrontClassWithSpec,
|
||||
registerFront,
|
||||
} = require("devtools/shared/protocol");
|
||||
const { cssPropertiesSpec } = require("devtools/shared/specs/css-properties");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -16,12 +16,18 @@ loader.lazyRequireGetter(
|
|||
"devtools/shared/css/color-db",
|
||||
true
|
||||
);
|
||||
|
||||
const {
|
||||
FrontClassWithSpec,
|
||||
registerFront,
|
||||
} = require("devtools/shared/protocol");
|
||||
const { cssPropertiesSpec } = require("devtools/shared/specs/css-properties");
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"CSS_PROPERTIES_DB",
|
||||
"devtools/shared/css/properties-db",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"CSS_TYPES",
|
||||
"devtools/shared/css/constants",
|
||||
true
|
||||
);
|
||||
|
||||
/**
|
||||
* Build up a regular expression that matches a CSS variable token. This is an
|
||||
|
@ -38,23 +44,6 @@ var IS_VARIABLE_TOKEN = new RegExp(
|
|||
"i"
|
||||
);
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"CSS_TYPES",
|
||||
"devtools/shared/css/constants",
|
||||
true
|
||||
);
|
||||
|
||||
/**
|
||||
* Check that this is a CSS variable.
|
||||
*
|
||||
* @param {String} input
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isCssVariable(input) {
|
||||
return !!input.match(IS_VARIABLE_TOKEN);
|
||||
}
|
||||
|
||||
var cachedCssProperties = new WeakMap();
|
||||
|
||||
/**
|
||||
|
@ -64,28 +53,14 @@ var cachedCssProperties = new WeakMap();
|
|||
* properties the current server supports.
|
||||
*/
|
||||
class CssPropertiesFront extends FrontClassWithSpec(cssPropertiesSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront) {
|
||||
super(client, targetFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "cssPropertiesActor";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the feature supporting status in the featureSet.
|
||||
*
|
||||
* @param {Hashmap} featureSet the feature set hashmap
|
||||
* @param {String} feature the feature name string
|
||||
* @return {Boolean} has the feature or not
|
||||
*/
|
||||
function hasFeature(featureSet, feature) {
|
||||
if (feature in featureSet) {
|
||||
return featureSet[feature];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask questions to a CSS database. This class does not care how the database
|
||||
* gets loaded in, only the questions that you can ask to it.
|
||||
|
@ -209,6 +184,30 @@ CssProperties.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Check that this is a CSS variable.
|
||||
*
|
||||
* @param {String} input
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function isCssVariable(input) {
|
||||
return !!input.match(IS_VARIABLE_TOKEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the feature supporting status in the featureSet.
|
||||
*
|
||||
* @param {Hashmap} featureSet the feature set hashmap
|
||||
* @param {String} feature the feature name string
|
||||
* @return {Boolean} has the feature or not
|
||||
*/
|
||||
function hasFeature(featureSet, feature) {
|
||||
if (feature in featureSet) {
|
||||
return featureSet[feature];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CssProperties object with a fully loaded CSS database. The
|
||||
* CssProperties interface can be queried synchronously, but the initialization
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
|
@ -12,8 +13,8 @@ const {
|
|||
const defer = require("devtools/shared/defer");
|
||||
|
||||
class DeviceFront extends FrontClassWithSpec(deviceSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "deviceActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -13,8 +14,8 @@ const { emulationSpec } = require("devtools/shared/specs/emulation");
|
|||
* The corresponding Front object for the EmulationActor.
|
||||
*/
|
||||
class EmulationFront extends FrontClassWithSpec(emulationSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "emulationActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -13,8 +14,8 @@ const { framerateSpec } = require("devtools/shared/specs/framerate");
|
|||
* The corresponding Front object for the FramerateActor.
|
||||
*/
|
||||
class FramerateFront extends FrontClassWithSpec(framerateSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "framerateActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -14,8 +15,8 @@ const {
|
|||
} = require("devtools/shared/specs/highlighters");
|
||||
|
||||
class HighlighterFront extends FrontClassWithSpec(highlighterSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this.isNodeFrontHighlighted = false;
|
||||
this.isPicking = false;
|
||||
|
@ -102,8 +103,8 @@ exports.HighlighterFront = HighlighterFront;
|
|||
registerFront(HighlighterFront);
|
||||
|
||||
class CustomHighlighterFront extends FrontClassWithSpec(customHighlighterSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this._isShown = false;
|
||||
}
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
const defer = require("devtools/shared/defer");
|
||||
const Telemetry = require("devtools/client/shared/telemetry");
|
||||
const telemetry = new Telemetry();
|
||||
const { NodePicker } = require("devtools/shared/fronts/inspector/node-picker");
|
||||
const TELEMETRY_EYEDROPPER_OPENED = "DEVTOOLS_EYEDROPPER_OPENED_COUNT";
|
||||
const TELEMETRY_EYEDROPPER_OPENED_MENU =
|
||||
"DEVTOOLS_MENU_EYEDROPPER_OPENED_COUNT";
|
||||
const SHOW_ALL_ANONYMOUS_CONTENT_PREF =
|
||||
"devtools.inspector.showAllAnonymousContent";
|
||||
const SHOW_UA_SHADOW_ROOTS_PREF = "devtools.inspector.showUserAgentShadowRoots";
|
||||
|
||||
const {
|
||||
FrontClassWithSpec,
|
||||
types,
|
||||
|
@ -23,8 +18,6 @@ const {
|
|||
walkerSpec,
|
||||
} = require("devtools/shared/specs/inspector");
|
||||
|
||||
const Services = require("Services");
|
||||
const defer = require("devtools/shared/defer");
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"nodeConstants",
|
||||
|
@ -38,6 +31,15 @@ loader.lazyRequireGetter(
|
|||
);
|
||||
loader.lazyRequireGetter(this, "flags", "devtools/shared/flags");
|
||||
|
||||
const TELEMETRY_EYEDROPPER_OPENED = "DEVTOOLS_EYEDROPPER_OPENED_COUNT";
|
||||
const TELEMETRY_EYEDROPPER_OPENED_MENU =
|
||||
"DEVTOOLS_MENU_EYEDROPPER_OPENED_COUNT";
|
||||
const SHOW_ALL_ANONYMOUS_CONTENT_PREF =
|
||||
"devtools.inspector.showAllAnonymousContent";
|
||||
const SHOW_UA_SHADOW_ROOTS_PREF = "devtools.inspector.showUserAgentShadowRoots";
|
||||
|
||||
const telemetry = new Telemetry();
|
||||
|
||||
/**
|
||||
* Client side of the DOM walker.
|
||||
*/
|
||||
|
@ -52,8 +54,8 @@ class WalkerFront extends FrontClassWithSpec(walkerSpec) {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this._createRootNodePromise();
|
||||
this._orphaned = new Set();
|
||||
this._retainedOrphans = new Set();
|
||||
|
@ -481,8 +483,8 @@ registerFront(WalkerFront);
|
|||
* inspector-related actors, including the walker.
|
||||
*/
|
||||
class InspectorFront extends FrontClassWithSpec(inspectorSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this._client = client;
|
||||
this._highlighters = new Map();
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { memorySpec } = require("devtools/shared/specs/memory");
|
||||
|
@ -22,8 +23,8 @@ loader.lazyRequireGetter(
|
|||
);
|
||||
|
||||
class MemoryFront extends FrontClassWithSpec(memorySpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this._client = client;
|
||||
this.heapSnapshotFileActorID = null;
|
||||
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const promise = require("promise");
|
||||
const {
|
||||
FrontClassWithSpec,
|
||||
types,
|
||||
registerFront,
|
||||
} = require("devtools/shared/protocol.js");
|
||||
|
||||
const { nodeSpec, nodeListSpec } = require("devtools/shared/specs/node");
|
||||
|
||||
const promise = require("promise");
|
||||
const { SimpleStringFront } = require("devtools/shared/fronts/string");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
|
@ -114,8 +113,8 @@ class AttributeModificationList {
|
|||
* to traverse children.
|
||||
*/
|
||||
class NodeFront extends FrontClassWithSpec(nodeSpec) {
|
||||
constructor(conn, form) {
|
||||
super(conn, form);
|
||||
constructor(conn, targetFront, parentFront) {
|
||||
super(conn, targetFront, parentFront);
|
||||
// The parent node
|
||||
this._parent = null;
|
||||
// The first child of this node.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -10,8 +11,8 @@ const {
|
|||
const { perfSpec } = require("devtools/shared/specs/perf");
|
||||
|
||||
class PerfFront extends FrontClassWithSpec(perfSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "perfActor";
|
||||
|
|
|
@ -63,8 +63,8 @@ class PerformanceRecordingFront extends FrontClassWithSpec(
|
|||
}
|
||||
}
|
||||
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this._markers = [];
|
||||
this._frames = [];
|
||||
this._memory = [];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
|
@ -21,8 +22,8 @@ loader.lazyRequireGetter(
|
|||
loader.lazyRequireGetter(this, "getSystemInfo", "devtools/shared/system", true);
|
||||
|
||||
class PerformanceFront extends FrontClassWithSpec(performanceSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this._queuedRecordings = [];
|
||||
this._onRecordingStartedEvent = this._onRecordingStartedEvent.bind(this);
|
||||
this.flushQueuedRecordings = this.flushQueuedRecordings.bind(this);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { preferenceSpec } = require("devtools/shared/specs/preference");
|
||||
|
@ -10,8 +11,8 @@ const {
|
|||
} = require("devtools/shared/protocol");
|
||||
|
||||
class PreferenceFront extends FrontClassWithSpec(preferenceSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "preferenceActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -13,8 +14,8 @@ const { promisesSpec } = require("devtools/shared/specs/promises");
|
|||
* PromisesFront, the front for the PromisesActor.
|
||||
*/
|
||||
class PromisesFront extends FrontClassWithSpec(promisesSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "promisesActor";
|
||||
|
|
|
@ -19,8 +19,8 @@ const {
|
|||
* // now wait for events to come
|
||||
*/
|
||||
class ReflowFront extends FrontClassWithSpec(reflowSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "reflowActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { screenshotSpec } = require("devtools/shared/specs/screenshot");
|
||||
|
@ -11,8 +12,8 @@ const {
|
|||
} = require("devtools/shared/protocol");
|
||||
|
||||
class ScreenshotFront extends FrontClassWithSpec(screenshotSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "screenshotActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -21,8 +22,8 @@ for (const childSpec of Object.values(childSpecs)) {
|
|||
}
|
||||
|
||||
class StorageFront extends FrontClassWithSpec(storageSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "storageActor";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -23,8 +24,8 @@ loader.lazyRequireGetter(
|
|||
* PageStyleFront, the front object for the PageStyleActor
|
||||
*/
|
||||
class PageStyleFront extends FrontClassWithSpec(pageStyleSpec) {
|
||||
constructor(conn) {
|
||||
super(conn);
|
||||
constructor(conn, targetFront, parentFront) {
|
||||
super(conn, targetFront, parentFront);
|
||||
this.inspector = this.parent();
|
||||
}
|
||||
|
||||
|
@ -84,8 +85,8 @@ registerFront(PageStyleFront);
|
|||
* StyleRuleFront, the front for the StyleRule actor.
|
||||
*/
|
||||
class StyleRuleFront extends FrontClassWithSpec(styleRuleSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this.before("location-changed", this._locationChangedPre.bind(this));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -31,8 +32,8 @@ loader.lazyRequireGetter(
|
|||
* Corresponding client-side front for a MediaRuleActor.
|
||||
*/
|
||||
class MediaRuleFront extends FrontClassWithSpec(mediaRuleSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this._onMatchesChange = this._onMatchesChange.bind(this);
|
||||
this.on("matches-change", this._onMatchesChange);
|
||||
|
@ -74,8 +75,8 @@ registerFront(MediaRuleFront);
|
|||
* StyleSheetFront is the client-side counterpart to a StyleSheetActor.
|
||||
*/
|
||||
class StyleSheetFront extends FrontClassWithSpec(styleSheetSpec) {
|
||||
constructor(conn, form) {
|
||||
super(conn, form);
|
||||
constructor(conn, targetFront, parentFront) {
|
||||
super(conn, targetFront, parentFront);
|
||||
|
||||
this._onPropertyChange = this._onPropertyChange.bind(this);
|
||||
this.on("property-change", this._onPropertyChange);
|
||||
|
@ -151,8 +152,8 @@ registerFront(StyleSheetFront);
|
|||
* The corresponding Front object for the StyleSheetsActor.
|
||||
*/
|
||||
class StyleSheetsFront extends FrontClassWithSpec(styleSheetsSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
// Attribute name from which to retrieve the actorID out of the target actor's form
|
||||
this.formAttributeName = "styleSheetsActor";
|
||||
|
|
|
@ -16,8 +16,8 @@ loader.lazyRequireGetter(
|
|||
);
|
||||
|
||||
class AddonTargetFront extends FrontClassWithSpec(addonTargetSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this.client = client;
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ loader.lazyRequireGetter(
|
|||
* The actor ID for this thread.
|
||||
*/
|
||||
class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this.client = client;
|
||||
this._pauseGrips = {};
|
||||
this._threadGrips = {};
|
||||
|
|
|
@ -18,15 +18,12 @@ const { webconsoleSpec } = require("devtools/shared/specs/webconsole");
|
|||
* A WebConsoleClient is used as a front end for the WebConsoleActor that is
|
||||
* created on the server, hiding implementation details.
|
||||
*
|
||||
* @param object debuggerClient
|
||||
* @param object client
|
||||
* The DebuggerClient instance we live for.
|
||||
* @param object response
|
||||
* The response packet received from the "startListeners" request sent to
|
||||
* the WebConsoleActor.
|
||||
*/
|
||||
class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
this._client = client;
|
||||
this.traits = {};
|
||||
this._longStrings = {};
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
|
@ -14,8 +15,8 @@ const { webSocketSpec } = require("devtools/shared/specs/websocket");
|
|||
* created on the server, hiding implementation details.
|
||||
*/
|
||||
class WebSocketFront extends FrontClassWithSpec(webSocketSpec) {
|
||||
constructor(client) {
|
||||
super(client);
|
||||
constructor(client, targetFront, parentFront) {
|
||||
super(client, targetFront, parentFront);
|
||||
|
||||
this._onWebSocketOpened = this._onWebSocketOpened.bind(this);
|
||||
this._onWebSocketClosed = this._onWebSocketClosed.bind(this);
|
||||
|
|
|
@ -30,19 +30,28 @@ function defer() {
|
|||
/**
|
||||
* Base class for client-side actor fronts.
|
||||
*
|
||||
* @param optional conn
|
||||
* Either a DebuggerServerConnection or a DebuggerClient. Must have
|
||||
* @param [DebuggerClient|null] conn
|
||||
* The conn must either be DebuggerClient or null. Must have
|
||||
* addActorPool, removeActorPool, and poolFor.
|
||||
* conn can be null if the subclass provides a conn property.
|
||||
* @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.
|
||||
* @param [Front|null] parentFront
|
||||
* The parent front. This is only available if the Front being initialized is a child
|
||||
* of a parent front.
|
||||
* @constructor
|
||||
*/
|
||||
class Front extends Pool {
|
||||
constructor(conn = null) {
|
||||
constructor(conn = null, targetFront = null, parentFront = 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.targetFront = targetFront;
|
||||
// The parentFront attribute points to its parent front. Only children of
|
||||
// target-scoped fronts will have the parentFront attribute set.
|
||||
this.parentFront = parentFront;
|
||||
this._requests = [];
|
||||
|
||||
// Front listener functions registered via `onFront` get notified
|
||||
|
@ -75,6 +84,7 @@ class Front extends Pool {
|
|||
this.clearEvents();
|
||||
this.actorID = null;
|
||||
this.targetFront = null;
|
||||
this.parentFront = null;
|
||||
this._frontListeners = null;
|
||||
this._beforeListeners = null;
|
||||
}
|
||||
|
|
|
@ -325,15 +325,14 @@ types.addActorType = function(name) {
|
|||
lazyLoadFront(name);
|
||||
}
|
||||
|
||||
const parentFront = ctx.marshallPool();
|
||||
const targetFront = parentFront.targetFront;
|
||||
|
||||
// Use intermediate Class variable to please eslint requiring
|
||||
// a capital letter for all constructors.
|
||||
const Class = type.frontClass;
|
||||
front = new Class(ctx.conn);
|
||||
front = new Class(ctx.conn, targetFront, parentFront);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -502,16 +501,14 @@ function getFront(client, typeName, form, target = null) {
|
|||
const type = types.getType(typeName);
|
||||
if (!type) {
|
||||
throw new Error(`No spec for front type '${typeName}'.`);
|
||||
}
|
||||
if (!type.frontClass) {
|
||||
} else if (!type.frontClass) {
|
||||
lazyLoadFront(typeName);
|
||||
}
|
||||
|
||||
// Use intermediate Class variable to please eslint requiring
|
||||
// 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 instance = new Class(client, target, target);
|
||||
const { formAttributeName } = instance;
|
||||
if (!formAttributeName) {
|
||||
throw new Error(`Can't find the form attribute name for ${typeName}`);
|
||||
|
|
Загрузка…
Ссылка в новой задаче