Bug 113398

Summary: Web Inspector: add event for node inspection request while in inspection mode
Product: WebKit Reporter: Dmitry Gozman <dgozman>
Component: Web Inspector (Deprecated)Assignee: Dmitry Gozman <dgozman>
Status: RESOLVED WONTFIX    
Severity: Normal CC: apavlov, graouts, joepeck, keishi, loislo, pfeldman, pmuellr, timothy, vsevik, web-inspector-bugs, webkit.review.bot, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Dmitry Gozman
Reported 2013-03-27 05:48:58 PDT
Web Inspector: dispatch inspectNode to frontend without injected script. This will allow to inspect nodes while debugging.
Attachments
Patch (9.64 KB, patch)
2013-03-27 05:59 PDT, Dmitry Gozman
no flags
Patch (4.71 KB, patch)
2013-04-01 07:58 PDT, Dmitry Gozman
no flags
Patch (5.33 KB, patch)
2013-04-02 02:52 PDT, Dmitry Gozman
no flags
Patch (9.12 KB, patch)
2013-04-02 08:19 PDT, Dmitry Gozman
no flags
Patch (9.24 KB, patch)
2013-04-03 04:21 PDT, Dmitry Gozman
no flags
Dmitry Gozman
Comment 1 2013-03-27 05:59:46 PDT
Pavel Feldman
Comment 2 2013-03-27 06:57:59 PDT
Comment on attachment 195293 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=195293&action=review > Source/WebCore/inspector/Inspector.json:1992 > + "name": "shouldInspectNode", You don't want them on DOM domain, you also want them to be hidden. > Source/WebCore/inspector/InspectorDOMAgent.cpp:1031 > + int nodeId = pushNodePathToFrontend(m_nodeToFocus.get()); It might be too early to push the node - document might not be requested yet.
Timothy Hatcher
Comment 3 2013-03-27 07:02:49 PDT
This seems overly complex — 2 methods and 1 event. What problem does this solve? Why is this needed? "Why" should always be answered in the bug and/or change log.
Dmitry Gozman
Comment 4 2013-03-27 07:14:46 PDT
(In reply to comment #3) > This seems overly complex — 2 methods and 1 event. > > What problem does this solve? Why is this needed? "Why" should always be answered in the bug and/or change log. As written in the bug description, this will allow to inspect nodes while debugging. Otherwise, security checks disallow to evaluate anything in injected script, if debugger stopped in another context (i.e. in iframe). As for 2 additional methods, ChangeLog contains the explanation.
Dmitry Gozman
Comment 5 2013-03-27 07:15:20 PDT
Comment on attachment 195293 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=195293&action=review >> Source/WebCore/inspector/Inspector.json:1992 >> + "name": "shouldInspectNode", > > You don't want them on DOM domain, you also want them to be hidden. Which domain then? Inspector? Is it OK to use them from InspectorDOMAgent class then (I mean, it will introduce dependence InspectorDOMAgent <-- InspectorFrontend::Inspector) ? >> Source/WebCore/inspector/InspectorDOMAgent.cpp:1031 >> + int nodeId = pushNodePathToFrontend(m_nodeToFocus.get()); > > It might be too early to push the node - document might not be requested yet. If so, this method will not do anything, and frontend will request nodeToFocus via getInspectedNode instead (which will happen after pushing document). See explanation in ChangeLog.
Timothy Hatcher
Comment 6 2013-03-27 07:24:28 PDT
Sorry I missed the bug description. Reading through it all again it makes sense, though still more complex than I would like.
Dmitry Gozman
Comment 7 2013-04-01 07:58:43 PDT
Dmitry Gozman
Comment 8 2013-04-02 02:52:28 PDT
Dmitry Gozman
Comment 9 2013-04-02 02:55:14 PDT
Separate event in DOM domain is the right thing here. This also solves the problem with inspecting in debug mode, since we don't go into injected script.
Pavel Feldman
Comment 10 2013-04-02 07:06:46 PDT
Comment on attachment 196109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=196109&action=review > Source/WebCore/inspector/Inspector.json:2074 > + "name": "nodeShouldBeInspected", inspectNodeRequested > Source/WebCore/inspector/InspectorDOMAgent.cpp:1033 > + if (m_searchingForNode) { Lets remove this "focusNode" method - it is misleading. > Source/WebCore/inspector/front-end/DOMAgent.js:1050 > + WebInspector.updateFocusedNode(nodeId); DOMAgent is SDK, WebInspector is UI, no dependency is allowed.
Dmitry Gozman
Comment 11 2013-04-02 08:19:52 PDT
Dmitry Gozman
Comment 12 2013-04-02 08:20:31 PDT
Comment on attachment 196109 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=196109&action=review >> Source/WebCore/inspector/Inspector.json:2074 >> + "name": "nodeShouldBeInspected", > > inspectNodeRequested Done. >> Source/WebCore/inspector/InspectorDOMAgent.cpp:1033 >> + if (m_searchingForNode) { > > Lets remove this "focusNode" method - it is misleading. Done. Code separated between InspectorController::inspect and InspectorDOMAgent::inspect. >> Source/WebCore/inspector/front-end/DOMAgent.js:1050 >> + WebInspector.updateFocusedNode(nodeId); > > DOMAgent is SDK, WebInspector is UI, no dependency is allowed. Fixed.
Pavel Feldman
Comment 13 2013-04-02 11:10:51 PDT
Comment on attachment 196145 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=196145&action=review > Source/WebCore/inspector/InspectorController.cpp:346 > + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(mainWorldScriptState(frame)); if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE) is now missing here.
Dmitry Gozman
Comment 14 2013-04-03 04:19:15 PDT
Comment on attachment 196145 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=196145&action=review >> Source/WebCore/inspector/InspectorController.cpp:346 >> + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(mainWorldScriptState(frame)); > > if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE) is now missing here. Nice catch! Thanks. Fixed.
Dmitry Gozman
Comment 15 2013-04-03 04:21:25 PDT
Note You need to log in before you can comment on or make changes to this bug.