More updates
authorDave Camp <dcamp@mozilla.com>
Sat, 15 Jun 2013 21:43:29 -0700
changeset 9 5903dbb0a8f623cedd92fc3ccfbf99592d44f0c5
parent 8 35e660233e731e8037f6d5e2e3ffb222b319dde6
child 10 3141e7194a9a7b38bf6e9980ed3198bf965e510f
push id10
push userdcamp@campd.org
push dateSun, 16 Jun 2013 04:43:33 +0000
More updates
actor-markup-fixes.diff
console-padend.diff
inspector-actor-docelement.diff
inspector-actor-forgiving-rawnode.diff
inspector-actor-innerhtml.diff
inspector-actor-markup-fixes.diff
inspector-actor-modify-attributes.diff
inspector-actor-modify-nodevalue.diff
inspector-actor-queue-mutations.diff
inspector-actor-readystate.diff
inspector-actor-retain.diff
inspector-actor-sibling-traversal.diff
inspector-front-import-rawnode-parents.diff
inspector-front-islocal.diff
inspector-innerhtml.diff
inspector-queue-mutations.diff
inspector-retain.diff
inspector-set-attributes.diff
inspector-set-nodevalue.diff
inspector-sibling-traversal.diff
series
target-inspector-changes.diff
--- a/console-padend.diff
+++ b/console-padend.diff
@@ -1,24 +1,83 @@
 # HG changeset patch
-# Parent f838ce3415e147cd2787f14fd75cd48caf95a838
+# Parent 7da5909bde65e50ac90509a0e7b1752a3b25148f
+
 diff --git a/toolkit/devtools/Console.jsm b/toolkit/devtools/Console.jsm
 --- a/toolkit/devtools/Console.jsm
 +++ b/toolkit/devtools/Console.jsm
-@@ -69,17 +69,17 @@ function fmt(aStr, aMaxLen, aMinLen, aOp
+@@ -30,30 +30,32 @@ Cu.import("resource://gre/modules/Consol
+ XPCOMUtils.defineLazyModuleGetter(this, "Services",
+                                   "resource://gre/modules/Services.jsm");
+ 
+ let gTimerRegistry = new Map();
+ 
+ /**
+  * String utility to ensure that strings are a specified length. Strings
+  * that are too long are truncated to the max length and the last char is
+- * set to "_". Strings that are too short are left padded with spaces.
++ * set to "_". Strings that are too short are padded with spaces.
+  *
+  * @param {string} aStr
+  *        The string to format to the correct length
+  * @param {number} aMaxLen
+  *        The maximum allowed length of the returned string
+  * @param {number} aMinLen (optional)
+  *        The minimum allowed length of the returned string. If undefined,
+  *        then aMaxLen will be used
+  * @param {object} aOptions (optional)
+- *        An object allowing format customization. The only customization
+- *        allowed currently is 'truncate' which can take the value "start" to
+- *        truncate strings from the start as opposed to the end or "center" to
+- *        truncate strings in the center
++ *        An object allowing format customization. Allowed customizations:
++ *          'truncate' - can take the value "start" to truncate strings from
++ *             the start as opposed to the end or "center" to truncate
++ *             strings in the center.
++ *          'align' - takes an alignment when padding is needed for MinLen,
++ *             either "start" or "end".  Defaults to "start".
+  * @return {string}
+  *        The original string formatted to fit the specified lengths
+  */
+ function fmt(aStr, aMaxLen, aMinLen, aOptions) {
+   if (aMinLen == null) {
+     aMinLen = aMaxLen;
+   }
+   if (aStr == null) {
+@@ -69,17 +71,18 @@ function fmt(aStr, aMaxLen, aMinLen, aOp
        let end = aStr.substring((aStr.length - (aMaxLen / 2)) + 1);
        return start + "_" + end;
      }
      else {
        return aStr.substring(0, aMaxLen - 1) + "_";
      }
    }
    if (aStr.length < aMinLen) {
 -    return Array(aMinLen - aStr.length + 1).join(" ") + aStr;
-+    return aStr + Array(aMinLen - aStr.length + 1).join(" ");
++    let padding = Array(aMinLen - aStr.length + 1).join(" ");
++    aStr = (aOptions.align === "end") ? padding + aStr : aStr + padding;
    }
    return aStr;
  }
  
  /**
   * Utility to extract the constructor name of an object.
   * Object.toString gives: "[object ?????]"; we want the "?????".
   *
+@@ -339,17 +342,17 @@ function getStack(aFrame, aMaxDepth = 0)
+  *        Array of trace objects as created by parseStack()
+  * @return {string} Multi line report of the stack trace
+  */
+ function formatTrace(aTrace) {
+   let reply = "";
+   aTrace.forEach(function(frame) {
+     reply += fmt(frame.filename, 20, 20, { truncate: "start" }) + " " +
+              fmt(frame.lineNumber, 5, 5) + " " +
+-             fmt(frame.functionName, 75, 75, { truncate: "center" }) + "\n";
++             fmt(frame.functionName, 0, 75, { truncate: "center" }) + "\n";
+   });
+   return reply;
+ }
+ 
+ /**
+  * Create a new timer by recording the current time under the specified name.
+  *
+  * @param {string} aName
new file mode 100644
--- /dev/null
+++ b/inspector-actor-docelement.diff
@@ -0,0 +1,46 @@
+# HG changeset patch
+# Parent 8a31e6ec65839e0e78e22f3e1d28ca9b373ffbe1
+diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
+--- a/toolkit/devtools/server/actors/inspector.js
++++ b/toolkit/devtools/server/actors/inspector.js
+@@ -140,16 +140,21 @@ var NodeActor = protocol.ActorClass({
+       publicId: this.rawNode.publicId,
+       systemId: this.rawNode.systemId,
+ 
+       attrs: this.writeAttrs(),
+ 
+       pseudoClassLocks: this.writePseudoClassLocks(),
+     };
+ 
++    if (this.rawNode.ownerDocument &&
++        this.rawNode.ownerDocument.documentElement === this.rawNode) {
++      form.isDocumentElement = true;
++    }
++
+     if (this.rawNode.nodeValue) {
+       // We only include a short version of the value if it's longer than
+       // gValueSummaryLength
+       if (this.rawNode.nodeValue.length > gValueSummaryLength) {
+         form.shortValue = this.rawNode.nodeValue.substring(0, gValueSummaryLength);
+         form.incompleteValue = true;
+       } else {
+         form.shortValue = this.rawNode.nodeValue;
+@@ -321,16 +326,18 @@ let NodeFront = protocol.FrontClass(Node
+ 
+   get hasChildren() this._form.numChildren > 0,
+   get numChildren() this._form.numChildren,
+ 
+   get tagName() this.nodeType === Ci.nsIDOMNode.ELEMENT_NODE ? this.nodeName : null,
+   get shortValue() this._form.shortValue,
+   get incompleteValue() !!this._form.incompleteValue,
+ 
++  get isDocumentElement() !!this._form.isDocumentElement,
++
+   // doctype properties
+   get name() this._form.name,
+   get publicId() this._form.publicId,
+   get systemId() this._form.systemId,
+ 
+   getAttribute: function(name) {
+     let attr = this._getAttribute(name);
+     return attr ? attr.value : null;
new file mode 100644
--- /dev/null
+++ b/inspector-actor-forgiving-rawnode.diff
@@ -0,0 +1,58 @@
+# HG changeset patch
+# User Dave Camp <dcamp@mozilla.com>
+# Date 1370924323 25200
+#      Mon Jun 10 21:18:43 2013 -0700
+# Node ID ecbacfcceb02c1377980df824ff47b7eca7f1063
+# Parent b9e8d9e36ad51f754fc6da74f619df6cddabd5a9
+imported patch target-inspector-changes.diff
+
+diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
+--- a/toolkit/devtools/server/actors/inspector.js
++++ b/toolkit/devtools/server/actors/inspector.js
+@@ -418,21 +418,24 @@ let NodeFront = protocol.FrontClass(Node
+ 
+   /**
+    * 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
+    * protocol.  If you depend on this you're likely to break soon.
+    */
+   rawNode: function(rawNode) {
+     if (!this.conn._transport._serverConnection) {
+-      throw new Error("Tried to use rawNode on a remote connection.");
++      console.warn("Tried to use rawNode on a remote connection.");
++      return null;
+     }
+     let actor = this.conn._transport._serverConnection.getActor(this.actorID);
+     if (!actor) {
+-      throw new Error("Could not find client side for actor " + this.actorID);
++      // Can happen if we try to get the raw node for an already-expired
++      // actor.
++      return null;
+     }
+     return actor.rawNode;
+   }
+ });
+ 
+ /**
+  * Returned from any call that might return a node that isn't connected to root by
+  * nodes the child has seen, such as querySelector.
+@@ -1736,17 +1739,18 @@ var WalkerFront = exports.WalkerFront = 
+   isLocal: function() {
+     return !!this.conn._transport._serverConnection;
+   },
+ 
+   // XXX hack during transition to remote inspector: get a proper NodeFront
+   // for a given local node.  Only works locally.
+   frontForRawNode: function(rawNode){
+     if (!this.isLocal()) {
+-      throw Error("Tried to use frontForRawNode on a remote connection.");
++      console.warn("Tried to use frontForRawNode on a remote connection.");
++      return null;
+     }
+     let actor = this.conn._transport._serverConnection.getActor(this.actorID);
+     if (!actor) {
+       throw Error("Could not find client side for actor " + this.actorID);
+     }
+     let nodeActor = actor._ref(rawNode);
+ 
+     // Pass the node through a read/write pair to create the client side actor.
rename from inspector-innerhtml.diff
rename to inspector-actor-innerhtml.diff
rename from actor-markup-fixes.diff
rename to inspector-actor-markup-fixes.diff
rename from inspector-set-attributes.diff
rename to inspector-actor-modify-attributes.diff
rename from inspector-set-nodevalue.diff
rename to inspector-actor-modify-nodevalue.diff
rename from inspector-queue-mutations.diff
rename to inspector-actor-queue-mutations.diff
new file mode 100644
--- /dev/null
+++ b/inspector-actor-readystate.diff
@@ -0,0 +1,56 @@
+# HG changeset patch
+# Parent 6e21fc2a61a895fcfc1b5a7fc08e6ccccf61b3c2
+diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
+--- a/toolkit/devtools/server/actors/inspector.js
++++ b/toolkit/devtools/server/actors/inspector.js
+@@ -1775,26 +1775,46 @@ var WalkerFront = exports.WalkerFront = 
+  * Server side of the inspector actor, which is used to create
+  * inspector-related actors, including the walker.
+  */
+ var InspectorActor = protocol.ActorClass({
+   typeName: "inspector",
+   initialize: function(conn, tabActor) {
+     protocol.Actor.prototype.initialize.call(this, conn);
+     this.tabActor = tabActor;
++  },
++
++  get window() {
++    let tabActor = this.tabActor;
+     if (tabActor.browser instanceof Ci.nsIDOMWindow) {
+-      this.window = tabActor.browser;
++      return tabActor.browser;
+     } else if (tabActor.browser instanceof Ci.nsIDOMElement) {
+-      this.window = tabActor.browser.contentWindow;
++      return tabActor.browser.contentWindow;
+     }
+-    this.webProgress = tabActor._tabbrowser;
++    return null;
+   },
+ 
+   getWalker: method(function(options={}) {
+-    return WalkerActor(this.conn, this.window.document, this.webProgress, options);
++    let deferred = promise.defer();
++
++    let window = this.window;
++
++    var domReady = () => {
++      let tabActor = this.tabActor;
++      window.removeEventListener("DOMContentLoaded", domReady, true);
++      deferred.resolve(WalkerActor(this.conn, window.document, tabActor._tabbrowser, options));
++    };
++
++    if (window.document.readyState === "loading") {
++      window.addEventListener("DOMContentLoaded", domReady, true);
++    } else {
++      domReady();
++    }
++
++    return deferred.promise;
+   }, {
+     request: {},
+     response: {
+       walker: RetVal("domwalker")
+     }
+   })
+ });
+ 
rename from inspector-retain.diff
rename to inspector-actor-retain.diff
rename from inspector-sibling-traversal.diff
rename to inspector-actor-sibling-traversal.diff
--- a/inspector-sibling-traversal.diff
+++ b/inspector-actor-sibling-traversal.diff
@@ -59,8 +59,55 @@ diff --git a/toolkit/devtools/server/act
    }, traversalMethod),
  
    /**
     * Helper function for the `children` method: Read forward in the sibling
     * list into an array with `count` items, including the current node.
     */
    _readForward: function(walker, count)
    {
+diff --git a/toolkit/devtools/server/tests/mochitest/test_inspector-traversal.html b/toolkit/devtools/server/tests/mochitest/test_inspector-traversal.html
+--- a/toolkit/devtools/server/tests/mochitest/test_inspector-traversal.html
++++ b/toolkit/devtools/server/tests/mochitest/test_inspector-traversal.html
+@@ -180,17 +180,42 @@ addTest(function testSiblings() {
+     return gWalker.siblings(a, { maxNodes: 5, center: a }).then(nodeArrayChecker(true, false, "abcde"));
+   }).then(() => {
+     return gWalker.siblings(gWalker.rootNode).then(response => {
+       ok(response.hasFirst && response.hasLast, "Has first and last.");
+       is(response.nodes.length, 1, "Has only the document element.");
+       ok(response.nodes[0] === gWalker.rootNode, "Document element is its own sibling.");
+     });
+   }).then(runNextTest));
+-})
++});
++
++addTest(function testNextSibling() {
++  promiseDone(gWalker.querySelector(gWalker.rootNode, "#y").then(y => {
++    is(y.id, "y", "Got the right node.");
++    return gWalker.nextSibling(y);
++  }).then(z => {
++    is(z.id, "z", "nextSibling got the next node.");
++    return gWalker.nextSibling(z);
++  }).then(nothing => {
++    is(nothing, null, "nextSibling on the last node returned null.");
++  }).then(runNextTest));
++});
++
++addTest(function testPreviousSibling() {
++  promiseDone(gWalker.querySelector(gWalker.rootNode, "#b").then(b => {
++    is(b.id, "b", "Got the right node.");
++    return gWalker.previousSibling(b);
++  }).then(a => {
++    is(a.id, "a", "nextSibling got the next node.");
++    return gWalker.previousSibling(a);
++  }).then(nothing => {
++    is(nothing, null, "previousSibling on the first node returned null.");
++  }).then(runNextTest));
++});
++
+ 
+ addTest(function testFrameTraversal() {
+   promiseDone(gWalker.querySelector(gWalker.rootNode, "#childFrame").then(childFrame => {
+     return gWalker.children(childFrame);
+   }).then(children => {
+     let nodes = children.nodes;
+     ok(nodes.length, 1, "There should be only one child of the iframe");
+     is(nodes[0].nodeType, Node.DOCUMENT_NODE, "iframe child should be a document node");
new file mode 100644
--- /dev/null
+++ b/inspector-front-import-rawnode-parents.diff
@@ -0,0 +1,47 @@
+# HG changeset patch
+# Parent 7654bacc8ceb2ef47c8a466a501ec887ca56c85e
+diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
+--- a/toolkit/devtools/server/actors/inspector.js
++++ b/toolkit/devtools/server/actors/inspector.js
+@@ -1742,25 +1742,37 @@ var WalkerFront = exports.WalkerFront = 
+ 
+   // XXX hack during transition to remote inspector: get a proper NodeFront
+   // for a given local node.  Only works locally.
+   frontForRawNode: function(rawNode){
+     if (!this.isLocal()) {
+       console.warn("Tried to use frontForRawNode on a remote connection.");
+       return null;
+     }
+-    let actor = this.conn._transport._serverConnection.getActor(this.actorID);
+-    if (!actor) {
++    let walkerActor = this.conn._transport._serverConnection.getActor(this.actorID);
++    if (!walkerActor) {
+       throw Error("Could not find client side for actor " + this.actorID);
+     }
+-    let nodeActor = actor._ref(rawNode);
++    let nodeActor = walkerActor._ref(rawNode);
+ 
+     // Pass the node through a read/write pair to create the client side actor.
+     let nodeType = types.getType("domnode");
+-    return nodeType.read(nodeType.write(nodeActor, actor), this);
++    let returnNode = nodeType.read(nodeType.write(nodeActor, walkerActor), this);
++    let top = returnNode;
++    let extras = walkerActor.parents(nodeActor);
++    for (let extraActor of extras) {
++      top = nodeType.read(nodeType.write(extraActor, walkerActor), this);
++    }
++
++    if (top !== this.rootNode) {
++      // Imported an already-orphaned node.
++      this._orphaned.add(top);
++      walkerActor._orphaned.add(this.conn._transport._serverConnection.getActor(top.actorID));
++    }
++    return returnNode;
+   }
+ });
+ 
+ /**
+  * Server side of the inspector actor, which is used to create
+  * inspector-related actors, including the walker.
+  */
+ var InspectorActor = protocol.ActorClass({
--- a/inspector-front-islocal.diff
+++ b/inspector-front-islocal.diff
@@ -1,20 +1,20 @@
 # HG changeset patch
 # User Dave Camp <dcamp@mozilla.com>
 # Date 1370924323 25200
 #      Mon Jun 10 21:18:43 2013 -0700
 # Node ID 4520f54fb87f1f2f350a73011973680fa8c102ef
-# Parent  ecbacfcceb02c1377980df824ff47b7eca7f1063
+# Parent 56096f636c37feda0eb4b4e97ca9b53a1bf9c5d9
 imported patch inspector-front-islocal.diff
 
 diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
 --- a/toolkit/devtools/server/actors/inspector.js
 +++ b/toolkit/devtools/server/actors/inspector.js
-@@ -1739,20 +1739,24 @@ var WalkerFront = exports.WalkerFront = 
+@@ -1728,20 +1728,24 @@ var WalkerFront = exports.WalkerFront = 
     * Handle the `new-mutations` notification by fetching the
     * available mutation records.
     */
    onMutations: protocol.preEvent("new-mutations", function() {
      // Fetch and process the mutations.
      this.getMutations({cleanup: this.autoCleanup}).then(null, console.error);
    }),
  
@@ -22,16 +22,16 @@ diff --git a/toolkit/devtools/server/act
 +    return !!this.conn._transport._serverConnection;
 +  },
 +
    // XXX hack during transition to remote inspector: get a proper NodeFront
    // for a given local node.  Only works locally.
    frontForRawNode: function(rawNode){
 -    if (!this.conn._transport._serverConnection) {
 +    if (!this.isLocal()) {
-       console.warn("Tried to use frontForRawNode on a remote connection.");
-       return null;
+       throw Error("Tried to use frontForRawNode on a remote connection.");
      }
-     let walkerActor = this.conn._transport._serverConnection.getActor(this.actorID);
-     if (!walkerActor) {
+     let actor = this.conn._transport._serverConnection.getActor(this.actorID);
+     if (!actor) {
        throw Error("Could not find client side for actor " + this.actorID);
      }
-     let nodeActor = walkerActor._ref(rawNode);
+     let nodeActor = actor._ref(rawNode);
+ 
--- a/series
+++ b/series
@@ -1,18 +1,21 @@
-inspector-queue-mutations.diff
-inspector-retain.diff
+inspector-actor-queue-mutations.diff
+inspector-actor-retain.diff
 inspector-actor-pseudoclass.diff
-inspector-sibling-traversal.diff
-target-inspector-changes.diff
+inspector-actor-sibling-traversal.diff
 inspector-front-islocal.diff
-inspector-innerhtml.diff
-inspector-set-attributes.diff
-inspector-set-nodevalue.diff
-actor-markup-fixes.diff
+inspector-actor-forgiving-rawnode.diff
+inspector-front-import-rawnode-parents.diff
+inspector-actor-readystate.diff
+inspector-actor-docelement.diff
+inspector-actor-innerhtml.diff
+inspector-actor-modify-attributes.diff
+inspector-actor-modify-nodevalue.diff
+inspector-actor-markup-fixes.diff
 inspector-remote-target.diff
 inspector-remote-breadcrumbs.diff
 inspector-remote-pseudoclass.diff
 inspector-delete-node.diff
 search-box-remote.diff
 remote-markup.diff
 warning-fixes.diff
 inspector-panel-default-node.diff
deleted file mode 100644
--- a/target-inspector-changes.diff
+++ /dev/null
@@ -1,171 +0,0 @@
-# HG changeset patch
-# User Dave Camp <dcamp@mozilla.com>
-# Date 1370924323 25200
-#      Mon Jun 10 21:18:43 2013 -0700
-# Node ID ecbacfcceb02c1377980df824ff47b7eca7f1063
-# Parent 83e6a2e2b84eb1823e213f29abcf31bb7205188f
-imported patch target-inspector-changes.diff
-
-diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js
---- a/toolkit/devtools/server/actors/inspector.js
-+++ b/toolkit/devtools/server/actors/inspector.js
-@@ -140,16 +140,21 @@ var NodeActor = protocol.ActorClass({
-       publicId: this.rawNode.publicId,
-       systemId: this.rawNode.systemId,
- 
-       attrs: this.writeAttrs(),
- 
-       pseudoClassLocks: this.writePseudoClassLocks(),
-     };
- 
-+    if (this.rawNode.ownerDocument &&
-+        this.rawNode.ownerDocument.documentElement === this.rawNode) {
-+      form.isDocumentElement = true;
-+    }
-+
-     if (this.rawNode.nodeValue) {
-       // We only include a short version of the value if it's longer than
-       // gValueSummaryLength
-       if (this.rawNode.nodeValue.length > gValueSummaryLength) {
-         form.shortValue = this.rawNode.nodeValue.substring(0, gValueSummaryLength);
-         form.incompleteValue = true;
-       } else {
-         form.shortValue = this.rawNode.nodeValue;
-@@ -321,16 +326,18 @@ let NodeFront = protocol.FrontClass(Node
- 
-   get hasChildren() this._form.numChildren > 0,
-   get numChildren() this._form.numChildren,
- 
-   get tagName() this.nodeType === Ci.nsIDOMNode.ELEMENT_NODE ? this.nodeName : null,
-   get shortValue() this._form.shortValue,
-   get incompleteValue() !!this._form.incompleteValue,
- 
-+  get isDocumentElement() !!this._form.isDocumentElement,
-+
-   // doctype properties
-   get name() this._form.name,
-   get publicId() this._form.publicId,
-   get systemId() this._form.systemId,
- 
-   getAttribute: function(name) {
-     let attr = this._getAttribute(name);
-     return attr ? attr.value : null;
-@@ -418,21 +425,24 @@ let NodeFront = protocol.FrontClass(Node
- 
-   /**
-    * 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
-    * protocol.  If you depend on this you're likely to break soon.
-    */
-   rawNode: function(rawNode) {
-     if (!this.conn._transport._serverConnection) {
--      throw new Error("Tried to use rawNode on a remote connection.");
-+      console.warn("Tried to use rawNode on a remote connection.");
-+      return null;
-     }
-     let actor = this.conn._transport._serverConnection.getActor(this.actorID);
-     if (!actor) {
--      throw new Error("Could not find client side for actor " + this.actorID);
-+      // Can happen if we try to get the raw node for an already-expired
-+      // actor.
-+      return null;
-     }
-     return actor.rawNode;
-   }
- });
- 
- /**
-  * Returned from any call that might return a node that isn't connected to root by
-  * nodes the child has seen, such as querySelector.
-@@ -1732,49 +1742,82 @@ var WalkerFront = exports.WalkerFront = 
-     // Fetch and process the mutations.
-     this.getMutations({cleanup: this.autoCleanup}).then(null, console.error);
-   }),
- 
-   // XXX hack during transition to remote inspector: get a proper NodeFront
-   // for a given local node.  Only works locally.
-   frontForRawNode: function(rawNode){
-     if (!this.conn._transport._serverConnection) {
--      throw Error("Tried to use frontForRawNode on a remote connection.");
-+      console.warn("Tried to use frontForRawNode on a remote connection.");
-+      return null;
-     }
--    let actor = this.conn._transport._serverConnection.getActor(this.actorID);
--    if (!actor) {
-+    let walkerActor = this.conn._transport._serverConnection.getActor(this.actorID);
-+    if (!walkerActor) {
-       throw Error("Could not find client side for actor " + this.actorID);
-     }
--    let nodeActor = actor._ref(rawNode);
-+    let nodeActor = walkerActor._ref(rawNode);
- 
-     // Pass the node through a read/write pair to create the client side actor.
-     let nodeType = types.getType("domnode");
--    return nodeType.read(nodeType.write(nodeActor, actor), this);
-+    let returnNode = nodeType.read(nodeType.write(nodeActor, walkerActor), this);
-+    let top = returnNode;
-+    let extras = walkerActor.parents(nodeActor);
-+    for (let extraActor of extras) {
-+      top = nodeType.read(nodeType.write(extraActor, walkerActor), this);
-+    }
-+
-+    if (top !== this.rootNode) {
-+      // Imported an already-orphaned node.
-+      this._orphaned.add(top);
-+      walkerActor._orphaned.add(this.conn._transport._serverConnection.getActor(top.actorID));
-+    }
-+    return returnNode;
-   }
- });
- 
- /**
-  * Server side of the inspector actor, which is used to create
-  * inspector-related actors, including the walker.
-  */
- var InspectorActor = protocol.ActorClass({
-   typeName: "inspector",
-   initialize: function(conn, tabActor) {
-     protocol.Actor.prototype.initialize.call(this, conn);
-     this.tabActor = tabActor;
-+  },
-+
-+  get window() {
-+    let tabActor = this.tabActor;
-     if (tabActor.browser instanceof Ci.nsIDOMWindow) {
--      this.window = tabActor.browser;
-+      return tabActor.browser;
-     } else if (tabActor.browser instanceof Ci.nsIDOMElement) {
--      this.window = tabActor.browser.contentWindow;
-+      return tabActor.browser.contentWindow;
-     }
--    this.webProgress = tabActor._tabbrowser;
-+    return null;
-   },
- 
-   getWalker: method(function(options={}) {
--    return WalkerActor(this.conn, this.window.document, this.webProgress, options);
-+    let deferred = promise.defer();
-+
-+    let window = this.window;
-+
-+    var domReady = () => {
-+      let tabActor = this.tabActor;
-+      window.removeEventListener("DOMContentLoaded", domReady, true);
-+      deferred.resolve(WalkerActor(this.conn, window.document, tabActor._tabbrowser, options));
-+    };
-+
-+    if (window.document.readyState === "loading") {
-+      window.addEventListener("DOMContentLoaded", domReady, true);
-+    } else {
-+      domReady();
-+    }
-+
-+    return deferred.promise;
-   }, {
-     request: {},
-     response: {
-       walker: RetVal("domwalker")
-     }
-   })
- });
-