Bug 914077 - Use rawNde() only if connection is not remote. r=bgrins

This commit is contained in:
Paul Rouget 2013-11-06 09:02:09 -05:00
parent 48d97e5389
commit 84998d53dd
4 changed files with 33 additions and 7 deletions

View File

@ -104,7 +104,12 @@ Selection.prototype = {
this.emit("pseudoclass");
}
if (detached) {
this.emit("detached", parentNode ? parentNode.rawNode() : null);
let rawNode = null;
if (parentNode && parentNode.isLocal_toBeDeprecated()) {
rawNode = parentNode.rawNode();
}
this.emit("detached", rawNode, null);
this.emit("detached-front", parentNode);
}
},
@ -156,7 +161,10 @@ Selection.prototype = {
setNodeFront: function(value, reason="unknown") {
this.reason = reason;
if (value !== this._nodeFront) {
let rawValue = value ? value.rawNode() : value;
let rawValue = null;
if (value && value.isLocal_toBeDeprecated()) {
rawValue = value.rawNode();
}
this.emit("before-new-node", rawValue, reason);
this.emit("before-new-node-front", value, reason);
let previousNode = this._node;
@ -208,7 +216,10 @@ Selection.prototype = {
// As long as there are still tools going around
// accessing node.rawNode, this needs to stay.
let rawNode = node.rawNode();
let rawNode = null;
if (node.isLocal_toBeDeprecated()) {
rawNode = node.rawNode();
}
if (rawNode) {
try {
let doc = this.document;

View File

@ -1570,7 +1570,9 @@ function ElementEditor(aContainer, aNode) {
// Create the main editor
this.template("element", this);
this.rawNode = aNode.rawNode();
if (aNode.isLocal_toBeDeprecated()) {
this.rawNode = aNode.rawNode();
}
// Make the tag name editable (unless this is a remote node or
// a document element)

View File

@ -1217,9 +1217,11 @@ SelectorView.prototype = {
}
let contentDoc = null;
let rawNode = this.tree.viewedElement.rawNode();
if (rawNode) {
contentDoc = rawNode.ownerDocument;
if (this.tree.viewedElement.isLocal_toBeDeprecated()) {
let rawNode = this.tree.viewedElement.rawNode();
if (rawNode) {
contentDoc = rawNode.ownerDocument;
}
}
let viewSourceUtils = inspector.viewSourceUtils;

View File

@ -583,6 +583,17 @@ let NodeFront = protocol.FrontClass(NodeActor, {
return ret;
},
/**
* Do we use a local target?
* Useful to know if a rawNode is available or not.
*
* This will, one day, be removed. External code should
* not need to know if the target is remote or not.
*/
isLocal_toBeDeprecated: function() {
return !!this.conn._transport._serverConnection;
},
/**
* Get an nsIDOMNode for the given node front. This only works locally,
* and is only intended as a stopgap during the transition to the remote