зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1399589 - Move domnodelist, disconnectedNode and disconnectedNodeArray to node spec and front. r=jdescottes
MozReview-Commit-ID: B5l1X4pc2Kf --HG-- extra : rebase_source : a45e07106582c999768065cddb93c38b692adfee
This commit is contained in:
Родитель
b5eb40769a
Коммит
37bd611e02
|
@ -59,8 +59,8 @@ const defer = require("devtools/shared/defer");
|
|||
const {Task} = require("devtools/shared/task");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
const {nodeListSpec, walkerSpec, inspectorSpec} = require("devtools/shared/specs/inspector");
|
||||
const {nodeSpec} = require("devtools/shared/specs/node");
|
||||
const {walkerSpec, inspectorSpec} = require("devtools/shared/specs/inspector");
|
||||
const {nodeSpec, nodeListSpec} = require("devtools/shared/specs/node");
|
||||
|
||||
loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
|
||||
loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
|
||||
|
|
|
@ -12,10 +12,8 @@ const {
|
|||
} = require("devtools/shared/protocol.js");
|
||||
const {
|
||||
inspectorSpec,
|
||||
nodeListSpec,
|
||||
walkerSpec
|
||||
} = require("devtools/shared/specs/inspector");
|
||||
const promise = require("promise");
|
||||
const defer = require("devtools/shared/defer");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
loader.lazyRequireGetter(this, "nodeConstants",
|
||||
|
@ -23,46 +21,6 @@ loader.lazyRequireGetter(this, "nodeConstants",
|
|||
loader.lazyRequireGetter(this, "CommandUtils",
|
||||
"devtools/client/shared/developer-toolbar", true);
|
||||
|
||||
/**
|
||||
* Client side of a node list as returned by querySelectorAll()
|
||||
*/
|
||||
const NodeListFront = FrontClassWithSpec(nodeListSpec, {
|
||||
initialize: function (client, form) {
|
||||
Front.prototype.initialize.call(this, client, form);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
Front.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
marshallPool: function () {
|
||||
return this.parent();
|
||||
},
|
||||
|
||||
// Update the object given a form representation off the wire.
|
||||
form: function (json) {
|
||||
this.length = json.length;
|
||||
},
|
||||
|
||||
item: custom(function (index) {
|
||||
return this._item(index).then(response => {
|
||||
return response.node;
|
||||
});
|
||||
}, {
|
||||
impl: "_item"
|
||||
}),
|
||||
|
||||
items: custom(function (start, end) {
|
||||
return this._items(start, end).then(response => {
|
||||
return response.nodes;
|
||||
});
|
||||
}, {
|
||||
impl: "_items"
|
||||
})
|
||||
});
|
||||
|
||||
exports.NodeListFront = NodeListFront;
|
||||
|
||||
/**
|
||||
* Client side of the DOM walker.
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@ const {
|
|||
|
||||
const {
|
||||
nodeSpec,
|
||||
nodeListSpec,
|
||||
} = require("devtools/shared/specs/node");
|
||||
|
||||
const promise = require("promise");
|
||||
|
@ -22,6 +23,46 @@ loader.lazyRequireGetter(this, "nodeConstants",
|
|||
|
||||
const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__";
|
||||
|
||||
/**
|
||||
* Client side of a node list as returned by querySelectorAll()
|
||||
*/
|
||||
const NodeListFront = FrontClassWithSpec(nodeListSpec, {
|
||||
initialize: function (client, form) {
|
||||
Front.prototype.initialize.call(this, client, form);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
Front.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
marshallPool: function () {
|
||||
return this.parent();
|
||||
},
|
||||
|
||||
// Update the object given a form representation off the wire.
|
||||
form: function (json) {
|
||||
this.length = json.length;
|
||||
},
|
||||
|
||||
item: custom(function (index) {
|
||||
return this._item(index).then(response => {
|
||||
return response.node;
|
||||
});
|
||||
}, {
|
||||
impl: "_item"
|
||||
}),
|
||||
|
||||
items: custom(function (start, end) {
|
||||
return this._items(start, end).then(response => {
|
||||
return response.nodes;
|
||||
});
|
||||
}, {
|
||||
impl: "_items"
|
||||
})
|
||||
});
|
||||
|
||||
exports.NodeListFront = NodeListFront;
|
||||
|
||||
/**
|
||||
* Convenience API for building a list of attribute modifications
|
||||
* for the `modifyAttributes` request.
|
||||
|
|
|
@ -123,12 +123,12 @@ const Types = exports.__TypesForTests = [
|
|||
},
|
||||
/* imageData isn't an actor but just a DictType */
|
||||
{
|
||||
types: ["imageData"],
|
||||
types: ["imageData", "disconnectedNode", "disconnectedNodeArray"],
|
||||
spec: "devtools/shared/specs/node",
|
||||
front: null,
|
||||
},
|
||||
{
|
||||
types: ["domnode"],
|
||||
types: ["domnode", "domnodelist"],
|
||||
spec: "devtools/shared/specs/node",
|
||||
front: "devtools/shared/fronts/node",
|
||||
},
|
||||
|
|
|
@ -11,27 +11,6 @@ const {
|
|||
types
|
||||
} = require("devtools/shared/protocol");
|
||||
|
||||
/**
|
||||
* Returned from any call that might return a node that isn't connected to root
|
||||
* by nodes the child has seen, such as querySelector.
|
||||
*/
|
||||
types.addDictType("disconnectedNode", {
|
||||
// The actual node to return
|
||||
node: "domnode",
|
||||
|
||||
// Nodes that are needed to connect the node to a node the client has already
|
||||
// seen
|
||||
newParents: "array:domnode"
|
||||
});
|
||||
|
||||
types.addDictType("disconnectedNodeArray", {
|
||||
// The actual node list to return
|
||||
nodes: "array:domnode",
|
||||
|
||||
// Nodes that are needed to connect those nodes to the root.
|
||||
newParents: "array:domnode"
|
||||
});
|
||||
|
||||
types.addDictType("dommutation", {});
|
||||
|
||||
types.addDictType("searchresult", {
|
||||
|
@ -41,29 +20,6 @@ types.addDictType("searchresult", {
|
|||
metadata: "array:json"
|
||||
});
|
||||
|
||||
const nodeListSpec = generateActorSpec({
|
||||
typeName: "domnodelist",
|
||||
|
||||
methods: {
|
||||
item: {
|
||||
request: { item: Arg(0) },
|
||||
response: RetVal("disconnectedNode")
|
||||
},
|
||||
items: {
|
||||
request: {
|
||||
start: Arg(0, "nullable:number"),
|
||||
end: Arg(1, "nullable:number")
|
||||
},
|
||||
response: RetVal("disconnectedNodeArray")
|
||||
},
|
||||
release: {
|
||||
release: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.nodeListSpec = nodeListSpec;
|
||||
|
||||
// Some common request/response templates for the dom walker
|
||||
|
||||
var nodeArrayMethod = {
|
||||
|
|
|
@ -17,6 +17,50 @@ types.addDictType("imageData", {
|
|||
size: "json"
|
||||
});
|
||||
|
||||
/**
|
||||
* Returned from any call that might return a node that isn't connected to root
|
||||
* by nodes the child has seen, such as querySelector.
|
||||
*/
|
||||
types.addDictType("disconnectedNode", {
|
||||
// The actual node to return
|
||||
node: "domnode",
|
||||
|
||||
// Nodes that are needed to connect the node to a node the client has already
|
||||
// seen
|
||||
newParents: "array:domnode"
|
||||
});
|
||||
|
||||
types.addDictType("disconnectedNodeArray", {
|
||||
// The actual node list to return
|
||||
nodes: "array:domnode",
|
||||
|
||||
// Nodes that are needed to connect those nodes to the root.
|
||||
newParents: "array:domnode"
|
||||
});
|
||||
|
||||
const nodeListSpec = generateActorSpec({
|
||||
typeName: "domnodelist",
|
||||
|
||||
methods: {
|
||||
item: {
|
||||
request: { item: Arg(0) },
|
||||
response: RetVal("disconnectedNode")
|
||||
},
|
||||
items: {
|
||||
request: {
|
||||
start: Arg(0, "nullable:number"),
|
||||
end: Arg(1, "nullable:number")
|
||||
},
|
||||
response: RetVal("disconnectedNodeArray")
|
||||
},
|
||||
release: {
|
||||
release: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.nodeListSpec = nodeListSpec;
|
||||
|
||||
const nodeSpec = generateActorSpec({
|
||||
typeName: "domnode",
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче