diff options
Diffstat (limited to 'Source/WebCore/inspector/PageConsoleAgent.cpp')
-rw-r--r-- | Source/WebCore/inspector/PageConsoleAgent.cpp | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/Source/WebCore/inspector/PageConsoleAgent.cpp b/Source/WebCore/inspector/PageConsoleAgent.cpp index 1adb449d2..cb15c88b9 100644 --- a/Source/WebCore/inspector/PageConsoleAgent.cpp +++ b/Source/WebCore/inspector/PageConsoleAgent.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2015 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 @@ -31,58 +32,49 @@ #include "config.h" #include "PageConsoleAgent.h" -#if ENABLE(INSPECTOR) - #include "CommandLineAPIHost.h" -#include "DOMWindow.h" #include "InspectorDOMAgent.h" #include "Node.h" -#include "PageInjectedScriptManager.h" +#include "WebInjectedScriptManager.h" using namespace Inspector; namespace WebCore { -PageConsoleAgent::PageConsoleAgent(InstrumentingAgents* instrumentingAgents, PageInjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent) - : InspectorConsoleAgent(instrumentingAgents, injectedScriptManager) +PageConsoleAgent::PageConsoleAgent(WebAgentContext& context, InspectorHeapAgent* heapAgent, InspectorDOMAgent* domAgent) + : WebConsoleAgent(context, heapAgent) , m_inspectorDOMAgent(domAgent) { } -PageConsoleAgent::~PageConsoleAgent() -{ - m_inspectorDOMAgent = nullptr; -} - -void PageConsoleAgent::clearMessages(ErrorString* errorString) +void PageConsoleAgent::clearMessages(ErrorString& errorString) { m_inspectorDOMAgent->releaseDanglingNodes(); - InspectorConsoleAgent::clearMessages(errorString); + + WebConsoleAgent::clearMessages(errorString); } class InspectableNode final : public CommandLineAPIHost::InspectableObject { public: explicit InspectableNode(Node* node) : m_node(node) { } - virtual Deprecated::ScriptValue get(JSC::ExecState* state) override + JSC::JSValue get(JSC::ExecState& state) final { - return InspectorDOMAgent::nodeAsScriptValue(state, m_node); + return InspectorDOMAgent::nodeAsScriptValue(state, m_node.get()); } private: - Node* m_node; + RefPtr<Node> m_node; }; -void PageConsoleAgent::addInspectedNode(ErrorString* errorString, int nodeId) +void PageConsoleAgent::addInspectedNode(ErrorString& errorString, int nodeId) { Node* node = m_inspectorDOMAgent->nodeForId(nodeId); - if (!node || node->isInShadowTree()) { - *errorString = ASCIILiteral("nodeId is not valid"); + if (!node || node->isInUserAgentShadowTree()) { + errorString = ASCIILiteral("nodeId is not valid"); return; } - if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost()) - commandLineAPIHost->addInspectedObject(adoptPtr(new InspectableNode(node))); + if (CommandLineAPIHost* commandLineAPIHost = static_cast<WebInjectedScriptManager&>(m_injectedScriptManager).commandLineAPIHost()) + commandLineAPIHost->addInspectedObject(std::make_unique<InspectableNode>(node)); } } // namespace WebCore - -#endif // ENABLE(INSPECTOR) |