Remote Debugging - Can't Expand DOM after calling Page.navigate

212 views
Skip to first unread message

t...@yieldmetrics.com

unread,
Oct 4, 2012, 12:34:13 AM10/4/12
to google-chrome-...@googlegroups.com
I'm seeing the following behavior and I'm not sure if this is by design or not.

  1. Connect to an open tab via the remote debugging web socket
  2. Expand the DOM by calling DOM.getDocument and then a series of calls to DOM.requestChildNodes.  This triggers a bunch of DOM.setChildNodes events.
  3. Call Page.navigate to navigate the tab to a new page
  4. Receive a DOM.documentUpdated event as expected.
  5. Call DOM.getDocument - this works and gives me a valid response.  However, at this point calls to DOM.requestChildNodes doesn't trigger DOM.setChildNodes events as it did above.

Is this a supported scenario?  If I disconnect my websocket and then reconnect to the same tab I can then again expand the DOM.  Surely I don't need to disconnect and then reconnect to expand the DOM after a DOM.documentUpdated event.

Anyone have any experience doing this?

Thanks,

Tom

Pavel Feldman

unread,
Oct 4, 2012, 12:50:06 AM10/4/12
to t...@yieldmetrics.com, google-chrome-...@googlegroups.com

No reconnect should be necessary. devtools itself is using the same protocol (and even same ws connection in the remote debugging mode) with no reconnect upon navigation.

You could run chrome with --remote-debugging-port=9222 , start remote debugging and sniff for the traffic going on.

Or you could open devtools on devtools and make it log all protocol messages going on (see the name of the flag you need to flip in InspectorBackend.js in WebKit repo, dumpProtocolMessages or something .

Note that for faster prototyping you could use chrome.debugger extension api as well. When you encounter a problem there it is really easy to share a test case.

Regards
Pavel

t...@yieldmetrics.com

unread,
Oct 5, 2012, 7:49:28 PM10/5/12
to google-chrome-...@googlegroups.com, t...@yieldmetrics.com
I'm not sure what I'm doing wrong but even after dumping all websocket traffic I can't for the life of me get these DOM domain calls work right.  So I've moved this particular functionality of my app into an extension as you suggest and have things working.

Thanks for the pointers and quick response.
Reply all
Reply to author
Forward
0 new messages