haikuwebkit/Source/WebCore/inspector/InspectorAuditDOMObject.cpp

70 lines
2.5 KiB
C++
Raw Permalink Normal View History

Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
/*
* Copyright (C) 2019 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "InspectorAuditDOMObject.h"
#include "Node.h"
#include <wtf/text/AtomString.h>
#include <wtf/text/WTFString.h>
Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
namespace WebCore {
using namespace Inspector;
#define ERROR_IF_NO_ACTIVE_AUDIT() \
if (!m_auditAgent.hasActiveAudit()) \
return Exception { NotAllowedError, "Cannot be called outside of a Web Inspector Audit"_s };
InspectorAuditDOMObject::InspectorAuditDOMObject(InspectorAuditAgent& auditAgent)
: m_auditAgent(auditAgent)
{
}
ExceptionOr<bool> InspectorAuditDOMObject::hasEventListeners(Node& node, const String& type)
Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
{
ERROR_IF_NO_ACTIVE_AUDIT();
if (EventTargetData* eventTargetData = node.eventTargetData()) {
Vector<AtomString> eventTypes;
if (type.isNull())
eventTypes = eventTargetData->eventListenerMap.eventTypes();
else
eventTypes.append(type);
for (AtomString& type : eventTypes) {
for (const RefPtr<RegisteredEventListener>& listener : node.eventListeners(type)) {
if (listener->callback().type() == EventListener::JSEventListenerType)
return true;
}
}
}
return false;
Web Inspector: Audit: create new IDL type for exposing special functionality in test context https://bugs.webkit.org/show_bug.cgi?id=193149 <rdar://problem/46801218> Reviewed by Joseph Pecoraro. Source/JavaScriptCore: Create a new `AuditAgent` (and various subclasses for different inspection targets) * inspector/protocol/Audit.json: Added. Add a `run` command that is a simpler version of `Runtime.evaluate`, except that it expects a function string instead of an arbitrary JavaScript expression. Add `setup` and `teardown` commands that create a JavaScript object that will be passed in to the test as an argument. Keep this object alive so that tests can add to the object and have later tests use what was added. * inspector/agents/InspectorAuditAgent.h: Added. * inspector/agents/InspectorAuditAgent.cpp: Added. (Inspector::InspectorAuditAgent::InspectorAuditAgent): (Inspector::InspectorAuditAgent::didCreateFrontendAndBackend): (Inspector::InspectorAuditAgent::willDestroyFrontendAndBackend): (Inspector::InspectorAuditAgent::setup): (Inspector::InspectorAuditAgent::run): (Inspector::InspectorAuditAgent::teardown): (Inspector::InspectorAuditAgent::hasActiveAudit): (Inspector::InspectorAuditAgent::populateAuditObject): * inspector/agents/JSGlobalObjectAuditAgent.h: Added. * inspector/agents/JSGlobalObjectAuditAgent.cpp: Added. (Inspector::JSGlobalObjectAuditAgent::JSGlobalObjectAuditAgent): (Inspector::JSGlobalObjectAuditAgent::injectedScriptForEval): * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::jsAgentContext): Added. (Inspector::JSGlobalObjectInspectorController::createLazyAgents): Added. * inspector/InjectedScript.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::execute): Added. (Inspector::InjectedScript::arrayFromVector): Added. Create a version of `evaluate` that accepts a list of values to be passed in as arguments to the function that was created by the `eval` of the given `functionString`. * inspector/InjectedScriptSource.js: (InjectedScript.prototype.execute): Added. (InjectedScript.prototype.evaluate): (InjectedScript.prototype.evaluateOnCallFrame): (InjectedScript.prototype._evaluateAndWrap): (InjectedScript.prototype._wrapAndSaveCall): Added. (InjectedScript.prototype._wrapCall): Added. (InjectedScript.prototype._evaluateOn): Refactor the `eval` and `saveResult` logic to allow for more flexibility for other callers. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources.make: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * UnifiedSources-input.xcfilelist: Source/WebCore: Tests: inspector/audit/run.html inspector/audit/setup.html inspector/audit/teardown.html Create a new `AuditAgent` (and various subclasses for different inspection targets), as well as `InspectorAuditAccessibilityObject` and `InspectorAuditDOMObject` objects that will be injected into the test function to allow for more advanced testing. * inspector/InspectorAuditAccessibilityObject.idl: Added. * inspector/InspectorAuditAccessibilityObject.h: Added. (WebCore::InspectorAuditAccessibilityObject::create): * inspector/InspectorAuditAccessibilityObject.cpp: Added. (WebCore::InspectorAuditAccessibilityObject::InspectorAuditAccessibilityObject): * inspector/InspectorAuditDOMObject.idl: Added. * inspector/InspectorAuditDOMObject.h: Added. (WebCore::InspectorAuditDOMObject::create): * inspector/InspectorAuditDOMObject.cpp: Added. (WebCore::InspectorAuditDOMObject::InspectorAuditDOMObject): * inspector/agents/page/PageAuditAgent.h: Added. * inspector/agents/page/PageAuditAgent.cpp: Added. (WebCore::PageAuditAgent::PageAuditAgent): (WebCore::PageAuditAgent::injectedScriptForEval): (WebCore::PageAuditAgent::populateAuditObject): (WebCore::PageAuditAgent::muteConsole): (WebCore::PageAuditAgent::unmuteConsole): * inspector/agents/worker/WorkerAuditAgent.h: Added. * inspector/agents/worker/WorkerAuditAgent.cpp: Added. (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/InspectorController.cpp: (WebCore::InspectorController::createLazyAgents): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::createLazyAgents): * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * UnifiedSources-input.xcfilelist: * WebCore.xcodeproj/project.pbxproj: Source/WebInspectorUI: Add `AuditAgent` getters and plumbing. * UserInterface/Protocol/Target.js: (WI.Target.prototype.get AuditAgent): Added. * UserInterface/Models/AuditTestCase.js: (WI.AuditTestCase.prototype.async run): * UserInterface/Controllers/AuditManager.js: (WI.AuditManager.prototype.async start): * .eslintrc: LayoutTests: * inspector/audit/resources/audit-utilities.js: (TestPage.registerInitializer.InspectorTest.Audit.setupAudit): Added. (TestPage.registerInitializer.InspectorTest.Audit.teardownAudit): Added. * inspector/audit/run.html: Added. * inspector/audit/run-expected.txt: Added. * inspector/audit/setup.html: Added. * inspector/audit/setup-expected.txt: Added. * inspector/audit/teardown.html: Added. * inspector/audit/teardown-expected.txt: Added. * inspector/canvas/create-context-2d-expected.txt: * inspector/canvas/create-context-bitmaprenderer-expected.txt: * inspector/canvas/create-context-webgl-expected.txt: * inspector/canvas/create-context-webgl2-expected.txt: * inspector/canvas/create-context-webmetal-expected.txt: * inspector/canvas/recording-2d-expected.txt: * inspector/canvas/recording-webgl-expected.txt: * inspector/canvas/recording-webgl-snapshots-expected.txt: * inspector/model/remote-object-expected.txt: * inspector/model/stack-trace-expected.txt: Canonical link: https://commits.webkit.org/207945@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239976 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-15 08:25:33 +00:00
}
} // namespace WebCore