mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1644193: Make walker.getStyleSheetOwnerNode() to reflect resource watcher. r=ochameau
Depends on D89282 Differential Revision: https://phabricator.services.mozilla.com/D89283
This commit is contained in:
parent
581ea9af20
commit
aa9f77e93e
@ -658,9 +658,7 @@ StyleSheetEditor.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
const node = await this.walker.getStyleSheetOwnerNode(
|
||||
this.styleSheet.actorID
|
||||
);
|
||||
const node = await this.walker.getStyleSheetOwnerNode(this.resourceId);
|
||||
await this.highlighter.show(node, {
|
||||
selector: info.selector,
|
||||
hideInfoBar: true,
|
||||
|
@ -14,6 +14,10 @@ const InspectorUtils = require("InspectorUtils");
|
||||
const {
|
||||
EXCLUDED_LISTENER,
|
||||
} = require("devtools/server/actors/inspector/constants");
|
||||
const {
|
||||
TYPES,
|
||||
getResourceWatcher,
|
||||
} = require("devtools/server/actors/resources/index");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
@ -2708,8 +2712,18 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
||||
* NodeActor.
|
||||
* Note that getNodeFromActor was added later and can now be used instead.
|
||||
*/
|
||||
getStyleSheetOwnerNode: function(styleSheetActorID) {
|
||||
return this.getNodeFromActor(styleSheetActorID, ["ownerNode"]);
|
||||
getStyleSheetOwnerNode: function(resourceId) {
|
||||
const watcher = getResourceWatcher(this.targetActor, TYPES.STYLESHEET);
|
||||
if (watcher) {
|
||||
const ownerNode = watcher.getOwnerNode(resourceId);
|
||||
return this.attachElement(ownerNode);
|
||||
}
|
||||
|
||||
// Following code can be removed once we enable STYLESHEET resource on the watcher/server
|
||||
// side by default. For now it is being preffed off and we have to support the two
|
||||
// codepaths. Once enabled we will only support the stylesheet watcher codepath.
|
||||
const actorBasedNode = this.getNodeFromActor(resourceId, ["ownerNode"]);
|
||||
return actorBasedNode;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -136,6 +136,14 @@ class StyleSheetWatcher {
|
||||
this._stylesheetCreationData.set(style.sheet, { fileName });
|
||||
}
|
||||
|
||||
/**
|
||||
* Return owner node of the style sheet of the given resource id.
|
||||
*/
|
||||
getOwnerNode(resourceId) {
|
||||
const { styleSheet } = this._styleSheetMap.get(resourceId);
|
||||
return styleSheet.ownerNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protocol method to get the text of stylesheet of resourceId.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user