haikuwebkit/LayoutTests/inspector/dom/dom-search-with-context.html

130 lines
3.6 KiB
HTML
Raw Permalink Normal View History

Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script src="../../http/tests/inspector/dom/resources/InspectorDOMListener.js"></script>
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
<script>
function test()
{
// Create a DOM listener to convert nodeIds to tag names.
var dom = createDOMListener();
// Caching the output to avoid searching through the log.
var output = [];
var documentId;
var domSearchQueries = [
{
query: "p",
nodes: []
},
{
query: "p",
nodes: [".base1"]
},
{
query: "p",
nodes: [".base2"]
},
{
query: "p",
nodes: [".base1", ".base2"]
},
{
query: "p",
nodes: ["iframe"]
},
// XPath should return just the children of the selected nodes.
{
query: "//p",
nodes: [".base1"]
},
{
query: "//div",
nodes: [".base1"]
}
];
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
InspectorProtocol.sendCommand("DOM.getDocument", {}, onGotDocument);
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
function onGotDocument(message) {
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
InspectorProtocol.checkForError(message);
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
dom.collectNode(message.result.root);
documentId = message.result.root.nodeId;
performSearches(domSearchQueries, testFinished);
}
function performSearches(list, callback)
{
function next() {
if (list.length)
search(list.shift(), next);
else
callback();
}
next();
}
function search(queryData, callback)
{
resolveSelectors(queryData.nodes, function(nodeIds) {
output.push("=== Query: " + JSON.stringify(queryData.query) + " in [" + queryData.nodes.join(", ") + "] ===");
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
InspectorProtocol.sendCommand("DOM.performSearch", {query: queryData.query, nodeIds: nodeIds}, function(message) {
InspectorProtocol.checkForError(message);
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
printSearchResults(message.result, callback);
});
});
}
function resolveSelectors(nodes, callback)
{
var results = new Array(nodes.length);
var remaining = nodes.length;
if (!remaining)
return callback(results);
nodes.forEach(function(selector, index) {
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
InspectorProtocol.sendCommand("DOM.querySelector", {nodeId: documentId, selector: selector}, function(message) {
InspectorProtocol.checkForError(message);
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
results[index] = message.result.nodeId;
if (--remaining <= 0)
callback(results);
});
});
}
function printSearchResults(results, callback)
{
output.push("Count: " + results.resultCount);
if (!results.resultCount)
return callback();
var options = {"searchId": results.searchId, "fromIndex": 0, "toIndex": results.resultCount};
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
InspectorProtocol.sendCommand("DOM.getSearchResults", options, function(message) {
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
for (var nodeId of message.result.nodeIds)
output.push(dom.getNodeIdentifier(nodeId));
callback();
});
}
function testFinished()
{
Web Inspector: use different namespaces in test fixtures for protocol tests and frontend tests https://bugs.webkit.org/show_bug.cgi?id=147787 Patch by Brian Burg <bburg@apple.com> on 2015-08-11 Reviewed by Timothy Hatcher. Refactor test methods to use three distinct namespaces to reflect their implementation: - InspectorProtocol contains commands that are only used from within protocol tests. This includes sending and receiving protocol messages and checking message errors. - InspectorTest contains test methods for full inspector frontend tests. - ProtocolTest contains test methods for protocol tests. In a subsequent patch, most methods in InspectorTest and ProtocolTest namespaces will be unified so that implementations of log, assert, etc. are no longer duplicated. For now, at least make it obvious at each callsite what code is being invoked. * http/tests/inspector/console/access-inspected-object.html: * http/tests/inspector/dom/resources/InspectorDOMListener.js: * http/tests/inspector/page/loading-iframe-document-node.html: * http/tests/inspector/resources/ProtocolTestStub.js: * http/tests/inspector/resources/console-test.js: * http/tests/inspector/resources/probe-test.js: * inspector/console/console-message.html: * inspector/console/css-source-locations.html: * inspector/console/js-source-locations.html: * inspector/console/x-frame-options-message.html: * inspector/css/getSupportedCSSProperties.html: * inspector/debugger/breakpoint-action-detach.html: * inspector/debugger/breakpoint-action-with-exception.html: * inspector/debugger/breakpoint-condition-detach.html: * inspector/debugger/breakpoint-condition-with-bad-script.html: * inspector/debugger/breakpoint-condition-with-exception.html: * inspector/debugger/breakpoint-eval-with-exception.html: * inspector/debugger/breakpoint-inside-conditons-and-actions.html: * inspector/debugger/call-frame-function-name.html: * inspector/debugger/call-frame-this-host.html: * inspector/debugger/call-frame-this-nonstrict.html: * inspector/debugger/call-frame-this-strict.html: * inspector/debugger/debugger-statement.html: * inspector/debugger/didSampleProbe-multiple-probes.html: * inspector/debugger/hit-breakpoint-from-console.html: * inspector/debugger/nested-inspectors.html: * inspector/debugger/pause-dedicated-worker.html: * inspector/debugger/pause-on-assert.html: * inspector/debugger/regress-133182.html: * inspector/debugger/removeBreakpoint.html: * inspector/debugger/searchInContent-linebreaks.html: * inspector/debugger/setBreakpoint-actions.html: * inspector/debugger/setBreakpoint-autoContinue.html: * inspector/debugger/setBreakpoint-column.html: * inspector/debugger/setBreakpoint-condition.html: * inspector/debugger/setBreakpoint-dfg-and-modify-local.html: * inspector/debugger/setBreakpoint-dfg-callee-and-examine-dfg-local.html: * inspector/debugger/setBreakpoint-dfg.html: * inspector/debugger/setBreakpoint-options-exception.html: * inspector/debugger/setBreakpoint.html: * inspector/debugger/setBreakpointByUrl-sourceURL.html: * inspector/debugger/setPauseOnExceptions-all.html: * inspector/debugger/setPauseOnExceptions-none.html: * inspector/debugger/setPauseOnExceptions-uncaught.html: * inspector/debugger/setVariableValue.html: * inspector/debugger/terminate-dedicated-worker-while-paused.html: * inspector/dom-debugger/node-removed.html: * inspector/dom/dom-remove-events.html: * inspector/dom/dom-search-crash.html: * inspector/dom/dom-search-with-context.html: * inspector/dom/dom-search.html: * inspector/dom/focus.html: * inspector/dom/getAccessibilityPropertiesForNode.html: * inspector/dom/getAccessibilityPropertiesForNode_liveRegion.html: * inspector/dom/getAccessibilityPropertiesForNode_mouseEventNodeId.html: * inspector/dom/highlight-flow-with-no-region.html: * inspector/dom/remove-multiple-nodes.html: * inspector/dom/request-child-nodes-depth.html: * inspector/layers/layers-anonymous.html: * inspector/layers/layers-blending-compositing-reasons.html: * inspector/layers/layers-compositing-reasons.html: * inspector/layers/layers-for-node.html: * inspector/layers/layers-generated-content.html: * inspector/layers/layers-reflected-content.html: * inspector/page/archive.html: * inspector/page/frameScheduledNavigation.html: * inspector/page/frameStartedLoading.html: * inspector/page/javascriptDialogEvents.html: * inspector/page/setEmulatedMedia.html: * inspector/runtime/getProperties.html: * inspector/unit-tests/async-test-suite.html: * inspector/unit-tests/sync-test-suite.html: Canonical link: https://commits.webkit.org/165990@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-11 18:28:31 +00:00
ProtocolTest.log(output.join("\n"));
ProtocolTest.completeTest();
Web Inspector: DOM.performSearch should accept a list of context nodes https://bugs.webkit.org/show_bug.cgi?id=124390 Reviewed by Timothy Hatcher. Source/WebCore: Extracted the code in InspectorDOMAgent::performSearch into its own helper class called InspectorNodeFinder. Also added a new array parameter called "nodeIds" that can be used to limit the search results to just partial subtrees. Tests: inspector-protocol/dom/dom-search-crash.html inspector-protocol/dom/dom-search-with-context.html inspector-protocol/dom/dom-search.html * CMakeLists.txt: * GNUmakefile.list.am: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * inspector/protocol/DOM.json: * inspector/InspectorAllInOne.cpp: * inspector/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::performSearch): * inspector/InspectorDOMAgent.h: * inspector/InspectorNodeFinder.cpp: Added. (WebCore::stripCharacters): (WebCore::InspectorNodeFinder::InspectorNodeFinder): (WebCore::InspectorNodeFinder::performSearch): (WebCore::InspectorNodeFinder::searchUsingDOMTreeTraversal): (WebCore::InspectorNodeFinder::matchesAttribute): (WebCore::InspectorNodeFinder::matchesElement): (WebCore::InspectorNodeFinder::searchUsingXPath): (WebCore::InspectorNodeFinder::searchUsingCSSSelectors): * inspector/InspectorNodeFinder.h: Added. (WebCore::InspectorNodeFinder::results): LayoutTests: Added new inspector-protocol tests to check for the DOM.performSearch implementation. Also, ported an existing test from the old "inspector" format. * http/tests/inspector-protocol/resources/InspectorDOMListener.js: Added boilerplate code that can be used to track node ids and class names. (createDOMListener.createNodeAttributesMap): (createDOMListener.collectNode): (createDOMListener.onSetChildNodes): (createDOMListener.onChildNodeRemoved): (createDOMListener.onChildNodeInserted): (createDOMListener.return.getNodeById): (createDOMListener.return.getNodeIdentifier): * http/tests/inspector-protocol/resources/InspectorTest.js: (InspectorFrontendAPI.dispatchMessageAsync): Added a way to catch all the messages received in the inspector. It is useful for debugging the test file. (InspectorTest.addEventListener): Helper method to register multiple handlers for the same event. * inspector-protocol/dom/dom-search-crash-expected.txt: Added. * inspector-protocol/dom/dom-search-crash.html: Added. * inspector-protocol/dom/dom-search-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context-expected.txt: Added. * inspector-protocol/dom/dom-search-with-context.html: Added. * inspector-protocol/dom/dom-search.html: Added. * inspector-protocol/dom/resources/dom-search-crash-iframe.html: Cloned from inspector/dom/resources/dom-search-crash-iframe.html * inspector-protocol/dom/resources/dom-search-iframe.html: Added. * inspector-protocol/dom/resources/dom-search-queries.js: Added. Canonical link: https://commits.webkit.org/142624@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-15 22:08:13 +00:00
}
}
</script>
</head>
<body onload="runTest()" class="main-frame">
<p>Testing DOM.performSearch with parent node ids.</p>
<div class="base1">
<p class="base1 main-frame"></p>
</div>
<div class="base2">
<p class="base2 main-frame"></p>
</div>
<iframe src="resources/dom-search-iframe.html"></iframe>
</body>
</html>