mirror of https://github.com/lukechilds/node.git
Browse Source
This change picks up v8_inspector directly from the upstream chromium repository [1]; dropping the intermediate repository. The upstream code has been refactored substantially to make it easy to share code without adaptation with Node.js. The deps/v8_inspector directory is now simply a gathering of dependencies: * platform/v8_inspector: vendored from [2]. * platform/inspector_protocol: vendored from [3]. * deps/jinja2: vendored from [4]. * deps/markupsafe: vendored from [5]. [1]: https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform [2]: https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/v8_inspector [3]: https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/inspector_protocol [4]: https://github.com/mitsuhiko/jinja2 [5]: https://github.com/mitsuhiko/markupsafe PR-URL: https://github.com/nodejs/node/pull/7302 Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>v6.x
committed by
Jeremiah Senkpiel
94 changed files with 4713 additions and 11267 deletions
@ -1,2 +1,10 @@ |
|||
# v8_inspector |
|||
# v8_inspector |
|||
V8 Inspector support for Node.js |
|||
================================ |
|||
|
|||
This directory is a gathering of dependencies for Node.js support for the |
|||
[Chrome Debug Protocol][https://developer.chrome.com/devtools/docs/debugger-protocol]. |
|||
|
|||
* platform/v8_inspector: vendored from https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/v8_inspector |
|||
* platform/inspector_protocol: vendored from https://chromium.googlesource.com/chromium/src/third_party/WebKit/Source/platform/inspector_protocol |
|||
* deps/jinja2: vendored from https://github.com/mitsuhiko/jinja2 |
|||
* deps/markupsafe: vendored from https://github.com/mitsuhiko/markupsafe |
|||
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,66 +0,0 @@ |
|||
/*
|
|||
* Copyright (C) 2013 Google 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: |
|||
* |
|||
* * Redistributions of source code must retain the above copyright |
|||
* notice, this list of conditions and the following disclaimer. |
|||
* * 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. |
|||
* * Neither the name of Google Inc. nor the names of its |
|||
* contributors may be used to endorse or promote products derived from |
|||
* this software without specific prior written permission. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT |
|||
* OWNER OR 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. |
|||
*/ |
|||
|
|||
|
|||
#ifndef PlatformExport_h |
|||
#define PlatformExport_h |
|||
|
|||
#if !defined(BLINK_PLATFORM_IMPLEMENTATION) |
|||
#define BLINK_PLATFORM_IMPLEMENTATION 0 |
|||
#endif |
|||
|
|||
#if defined(COMPONENT_BUILD) |
|||
#if defined(WIN32) |
|||
#if BLINK_PLATFORM_IMPLEMENTATION |
|||
#define PLATFORM_EXPORT __declspec(dllexport) |
|||
#else |
|||
#define PLATFORM_EXPORT __declspec(dllimport) |
|||
#endif |
|||
#else // defined(WIN32)
|
|||
#define PLATFORM_EXPORT __attribute__((visibility("default"))) |
|||
#endif |
|||
#else // defined(COMPONENT_BUILD)
|
|||
#define PLATFORM_EXPORT |
|||
#endif |
|||
|
|||
#if defined(_MSC_VER) |
|||
// MSVC Compiler warning C4275:
|
|||
// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'.
|
|||
// Note that this is intended to be used only when no access to the base class'
|
|||
// static data is done through derived classes or inline methods. For more info,
|
|||
// see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx
|
|||
//
|
|||
// This pragma will allow exporting a class that inherits from a non-exported
|
|||
// base class, anywhere in the Blink platform component. This is only
|
|||
// a problem when using the MSVC compiler on Windows.
|
|||
#pragma warning(suppress:4275) |
|||
#endif |
|||
|
|||
#endif // PlatformExport_h
|
@ -0,0 +1,23 @@ |
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef BackendCallback_h |
|||
#define BackendCallback_h |
|||
|
|||
#include "platform/inspector_protocol/ErrorSupport.h" |
|||
#include "platform/inspector_protocol/Platform.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class PLATFORM_EXPORT BackendCallback { |
|||
public: |
|||
virtual ~BackendCallback() { } |
|||
virtual void sendFailure(const ErrorString&) = 0; |
|||
}; |
|||
|
|||
} // namespace platform
|
|||
} // namespace blink
|
|||
|
|||
#endif // !defined(BackendCallback_h)
|
@ -1,78 +0,0 @@ |
|||
// This file is generated |
|||
|
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|||
// Use of this source code is governed by a BSD-style license that can be |
|||
// found in the LICENSE file. |
|||
|
|||
#ifndef {{class_name}}_h |
|||
#define {{class_name}}_h |
|||
|
|||
#include "platform/inspector_protocol/TypeBuilder.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class FrontendChannel; |
|||
class BackendImplWeakPtr; |
|||
|
|||
class PLATFORM_EXPORT Backend { |
|||
public: |
|||
class PLATFORM_EXPORT CallbackBase { |
|||
public: |
|||
virtual ~CallbackBase() { } |
|||
virtual void sendFailure(const ErrorString&) = 0; |
|||
}; |
|||
{% for domain in api.domains %} |
|||
|
|||
class PLATFORM_EXPORT {{domain.domain}} { |
|||
public: |
|||
{% for command in domain.commands %} |
|||
{% if "redirect" in command %}{% continue %}{% endif %} |
|||
{% if ("handlers" in command) and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %} |
|||
{% if "async" in command %} |
|||
class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public CallbackBase { |
|||
public: |
|||
virtual void sendSuccess( |
|||
{%- for parameter in command.returns -%} |
|||
{%- if "optional" in parameter -%} |
|||
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}} |
|||
{%- else -%} |
|||
{{resolve_type(parameter).pass_type}} {{parameter.name}} |
|||
{%- endif -%} |
|||
{%- if not loop.last -%}, {% endif -%} |
|||
{%- endfor -%} |
|||
) = 0; |
|||
}; |
|||
{% endif %} |
|||
virtual void {{command.name}}(ErrorString* |
|||
{%- for parameter in command.parameters -%} |
|||
{%- if "optional" in parameter -%} |
|||
, const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name}} |
|||
{%- else -%} |
|||
, {{resolve_type(parameter).pass_type}} in_{{parameter.name}} |
|||
{%- endif -%} |
|||
{%- endfor -%} |
|||
{%- if "async" in command -%} |
|||
, std::unique_ptr<{{command.name | to_title_case}}Callback> callback |
|||
{%- else -%} |
|||
{%- for parameter in command.returns -%} |
|||
{%- if "optional" in parameter -%} |
|||
, Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}} |
|||
{%- else -%} |
|||
, {{resolve_type(parameter).type}}* out_{{parameter.name}} |
|||
{%- endif -%} |
|||
{%- endfor -%} |
|||
{%- endif -%} |
|||
) = 0; |
|||
{% endfor %} |
|||
|
|||
protected: |
|||
virtual ~{{domain.domain}}() { } |
|||
}; |
|||
{% endfor %} |
|||
}; |
|||
|
|||
} // namespace protocol |
|||
} // namespace blink |
|||
|
|||
#endif // !defined({{class_name}}_h) |
@ -0,0 +1,173 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#include "platform/inspector_protocol/DispatcherBase.h" |
|||
|
|||
#include "platform/inspector_protocol/FrontendChannel.h" |
|||
#include "platform/inspector_protocol/Parser.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
// static
|
|||
const char DispatcherBase::kInvalidRequest[] = "Invalid request"; |
|||
|
|||
DispatcherBase::WeakPtr::WeakPtr(DispatcherBase* dispatcher) : m_dispatcher(dispatcher) { } |
|||
|
|||
DispatcherBase::WeakPtr::~WeakPtr() |
|||
{ |
|||
if (m_dispatcher) |
|||
m_dispatcher->m_weakPtrs.remove(this); |
|||
} |
|||
|
|||
DispatcherBase::Callback::Callback(std::unique_ptr<DispatcherBase::WeakPtr> backendImpl, int callId) |
|||
: m_backendImpl(std::move(backendImpl)) |
|||
, m_callId(callId) { } |
|||
|
|||
DispatcherBase::Callback::~Callback() = default; |
|||
|
|||
void DispatcherBase::Callback::dispose() |
|||
{ |
|||
m_backendImpl = nullptr; |
|||
} |
|||
|
|||
void DispatcherBase::Callback::sendIfActive(std::unique_ptr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError) |
|||
{ |
|||
if (!m_backendImpl->get()) |
|||
return; |
|||
m_backendImpl->get()->sendResponse(m_callId, invocationError, nullptr, std::move(partialMessage)); |
|||
m_backendImpl = nullptr; |
|||
} |
|||
|
|||
DispatcherBase::DispatcherBase(FrontendChannel* frontendChannel) |
|||
: m_frontendChannel(frontendChannel) { } |
|||
|
|||
DispatcherBase::~DispatcherBase() |
|||
{ |
|||
clearFrontend(); |
|||
} |
|||
|
|||
// static
|
|||
bool DispatcherBase::getCommandName(const String16& message, String16* result) |
|||
{ |
|||
std::unique_ptr<protocol::Value> value = parseJSON(message); |
|||
if (!value) |
|||
return false; |
|||
|
|||
protocol::DictionaryValue* object = DictionaryValue::cast(value.get()); |
|||
if (!object) |
|||
return false; |
|||
|
|||
if (!object->getString("method", result)) |
|||
return false; |
|||
|
|||
return true; |
|||
} |
|||
|
|||
void DispatcherBase::sendResponse(int callId, const ErrorString& invocationError, ErrorSupport* errors, std::unique_ptr<protocol::DictionaryValue> result) |
|||
{ |
|||
if (invocationError.length() || (errors && errors->hasErrors())) { |
|||
reportProtocolError(callId, ServerError, invocationError, errors); |
|||
return; |
|||
} |
|||
|
|||
std::unique_ptr<protocol::DictionaryValue> responseMessage = DictionaryValue::create(); |
|||
responseMessage->setNumber("id", callId); |
|||
responseMessage->setObject("result", std::move(result)); |
|||
if (m_frontendChannel) |
|||
m_frontendChannel->sendProtocolResponse(callId, responseMessage->toJSONString()); |
|||
} |
|||
|
|||
void DispatcherBase::sendResponse(int callId, const ErrorString& invocationError, std::unique_ptr<protocol::DictionaryValue> result) |
|||
{ |
|||
sendResponse(callId, invocationError, nullptr, std::move(result)); |
|||
} |
|||
|
|||
void DispatcherBase::sendResponse(int callId, const ErrorString& invocationError) |
|||
{ |
|||
sendResponse(callId, invocationError, nullptr, DictionaryValue::create()); |
|||
} |
|||
|
|||
static void reportProtocolError(FrontendChannel* frontendChannel, int callId, DispatcherBase::CommonErrorCode code, const String16& errorMessage, ErrorSupport* errors) |
|||
{ |
|||
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create(); |
|||
error->setNumber("code", code); |
|||
error->setString("message", errorMessage); |
|||
DCHECK(error); |
|||
if (errors && errors->hasErrors()) |
|||
error->setString("data", errors->errors()); |
|||
std::unique_ptr<protocol::DictionaryValue> message = DictionaryValue::create(); |
|||
message->setObject("error", std::move(error)); |
|||
message->setNumber("id", callId); |
|||
frontendChannel->sendProtocolResponse(callId, message->toJSONString()); |
|||
} |
|||
|
|||
void DispatcherBase::reportProtocolError(int callId, CommonErrorCode code, const String16& errorMessage, ErrorSupport* errors) |
|||
{ |
|||
if (m_frontendChannel) |
|||
::blink::protocol::reportProtocolError(m_frontendChannel, callId, code, errorMessage, errors); |
|||
} |
|||
|
|||
void DispatcherBase::clearFrontend() |
|||
{ |
|||
m_frontendChannel = nullptr; |
|||
for (auto& weak : m_weakPtrs) |
|||
weak.first->dispose(); |
|||
m_weakPtrs.clear(); |
|||
} |
|||
|
|||
std::unique_ptr<DispatcherBase::WeakPtr> DispatcherBase::weakPtr() |
|||
{ |
|||
std::unique_ptr<DispatcherBase::WeakPtr> weak(new DispatcherBase::WeakPtr(this)); |
|||
m_weakPtrs.add(weak.get()); |
|||
return weak; |
|||
} |
|||
|
|||
UberDispatcher::UberDispatcher(FrontendChannel* frontendChannel) |
|||
: m_frontendChannel(frontendChannel) { } |
|||
|
|||
void UberDispatcher::registerBackend(const String16& name, std::unique_ptr<protocol::DispatcherBase> dispatcher) |
|||
{ |
|||
m_dispatchers.set(name, std::move(dispatcher)); |
|||
} |
|||
|
|||
void UberDispatcher::dispatch(const String16& message) |
|||
{ |
|||
std::unique_ptr<protocol::Value> parsedMessage = parseJSON(message); |
|||
if (!parsedMessage) |
|||
return; |
|||
std::unique_ptr<protocol::DictionaryValue> messageObject = DictionaryValue::cast(std::move(parsedMessage)); |
|||
if (!messageObject) |
|||
return; |
|||
|
|||
int callId = 0; |
|||
protocol::Value* callIdValue = messageObject->get("id"); |
|||
bool success = callIdValue->asNumber(&callId); |
|||
if (!success) |
|||
return; |
|||
|
|||
protocol::Value* methodValue = messageObject->get("method"); |
|||
String16 method; |
|||
success = methodValue && methodValue->asString(&method); |
|||
if (!success) |
|||
return; |
|||
|
|||
size_t dotIndex = method.find("."); |
|||
if (dotIndex == kNotFound) { |
|||
reportProtocolError(m_frontendChannel, callId, DispatcherBase::MethodNotFound, "'" + method + "' wasn't found", nullptr); |
|||
return; |
|||
} |
|||
String16 domain = method.substring(0, dotIndex); |
|||
auto it = m_dispatchers.find(domain); |
|||
if (it == m_dispatchers.end()) { |
|||
reportProtocolError(m_frontendChannel, callId, DispatcherBase::MethodNotFound, "'" + method + "' wasn't found", nullptr); |
|||
return; |
|||
} |
|||
it->second->dispatch(callId, method, std::move(messageObject)); |
|||
} |
|||
|
|||
UberDispatcher::~UberDispatcher() = default; |
|||
|
|||
} // namespace protocol
|
|||
} // namespace blink
|
@ -0,0 +1,97 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef DispatcherBase_h |
|||
#define DispatcherBase_h |
|||
|
|||
#include "platform/inspector_protocol/BackendCallback.h" |
|||
#include "platform/inspector_protocol/Collections.h" |
|||
#include "platform/inspector_protocol/ErrorSupport.h" |
|||
#include "platform/inspector_protocol/Platform.h" |
|||
#include "platform/inspector_protocol/String16.h" |
|||
#include "platform/inspector_protocol/Values.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class FrontendChannel; |
|||
class WeakPtr; |
|||
|
|||
class PLATFORM_EXPORT DispatcherBase { |
|||
PROTOCOL_DISALLOW_COPY(DispatcherBase); |
|||
public: |
|||
static const char kInvalidRequest[]; |
|||
class PLATFORM_EXPORT WeakPtr { |
|||
public: |
|||
explicit WeakPtr(DispatcherBase*); |
|||
~WeakPtr(); |
|||
DispatcherBase* get() { return m_dispatcher; } |
|||
void dispose() { m_dispatcher = nullptr; } |
|||
|
|||
private: |
|||
DispatcherBase* m_dispatcher; |
|||
}; |
|||
|
|||
class PLATFORM_EXPORT Callback : public protocol::BackendCallback { |
|||
public: |
|||
Callback(std::unique_ptr<WeakPtr> backendImpl, int callId); |
|||
virtual ~Callback(); |
|||
void dispose(); |
|||
|
|||
protected: |
|||
void sendIfActive(std::unique_ptr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError); |
|||
|
|||
private: |
|||
std::unique_ptr<WeakPtr> m_backendImpl; |
|||
int m_callId; |
|||
}; |
|||
|
|||
explicit DispatcherBase(FrontendChannel*); |
|||
virtual ~DispatcherBase(); |
|||
|
|||
enum CommonErrorCode { |
|||
ParseError = -32700, |
|||
InvalidRequest = -32600, |
|||
MethodNotFound = -32601, |
|||
InvalidParams = -32602, |
|||
InternalError = -32603, |
|||
ServerError = -32000, |
|||
}; |
|||
|
|||
static bool getCommandName(const String16& message, String16* result); |
|||
|
|||
virtual void dispatch(int callId, const String16& method, std::unique_ptr<protocol::DictionaryValue> messageObject) = 0; |
|||
|
|||
void sendResponse(int callId, const ErrorString&, ErrorSupport*, std::unique_ptr<protocol::DictionaryValue> result); |
|||
void sendResponse(int callId, const ErrorString&, std::unique_ptr<protocol::DictionaryValue> result); |
|||
void sendResponse(int callId, const ErrorString&); |
|||
|
|||
void reportProtocolError(int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport* errors); |
|||
void clearFrontend(); |
|||
|
|||
std::unique_ptr<WeakPtr> weakPtr(); |
|||
|
|||
private: |
|||
FrontendChannel* m_frontendChannel; |
|||
protocol::HashSet<WeakPtr*> m_weakPtrs; |
|||
}; |
|||
|
|||
class PLATFORM_EXPORT UberDispatcher { |
|||
PROTOCOL_DISALLOW_COPY(UberDispatcher); |
|||
public: |
|||
explicit UberDispatcher(FrontendChannel*); |
|||
void registerBackend(const String16& name, std::unique_ptr<protocol::DispatcherBase>); |
|||
void dispatch(const String16& message); |
|||
FrontendChannel* channel() { return m_frontendChannel; } |
|||
virtual ~UberDispatcher(); |
|||
|
|||
private: |
|||
FrontendChannel* m_frontendChannel; |
|||
protocol::HashMap<String16, std::unique_ptr<protocol::DispatcherBase>> m_dispatchers; |
|||
}; |
|||
|
|||
} // namespace platform
|
|||
} // namespace blink
|
|||
|
|||
#endif // !defined(DispatcherBase_h)
|
@ -1,365 +0,0 @@ |
|||
// This file is generated |
|||
|
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|||
// Use of this source code is governed by a BSD-style license that can be |
|||
// found in the LICENSE file. |
|||
|
|||
#include "platform/inspector_protocol/{{class_name}}.h" |
|||
|
|||
#include "platform/inspector_protocol/Collections.h" |
|||
#include "platform/inspector_protocol/FrontendChannel.h" |
|||
#include "platform/inspector_protocol/Parser.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
using protocol::Maybe; |
|||
|
|||
class DispatcherImpl; |
|||
|
|||
class DispatcherImplWeakPtr { |
|||
public: |
|||
DispatcherImplWeakPtr(DispatcherImpl* dispatcher) : m_dispatcher(dispatcher) { } |
|||
~DispatcherImplWeakPtr(); |
|||
DispatcherImpl* get() { return m_dispatcher; } |
|||
void dispose() { m_dispatcher = nullptr; } |
|||
private: |
|||
DispatcherImpl* m_dispatcher; |
|||
}; |
|||
|
|||
class DispatcherImpl : public Dispatcher { |
|||
public: |
|||
DispatcherImpl(FrontendChannel* frontendChannel) |
|||
: m_frontendChannel(frontendChannel) |
|||
{% for domain in api.domains %} |
|||
, m_{{domain.domain | lower}}Agent(0) |
|||
{% endfor %} |
|||
{ |
|||
{% for domain in api.domains %} |
|||
{% for command in domain.commands %} |
|||
{% if "redirect" in command %}{% continue %}{% endif %} |
|||
{% if "handlers" in command and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %} |
|||
m_dispatchMap.set("{{domain.domain}}.{{command.name}}", &DispatcherImpl::{{domain.domain}}_{{command.name}}); |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
// Initialize common errors. |
|||
m_commonErrors.resize(LastEntry); |
|||
m_commonErrors[ParseError] = -32700; |
|||
m_commonErrors[InvalidRequest] = -32600; |
|||
m_commonErrors[MethodNotFound] = -32601; |
|||
m_commonErrors[InvalidParams] = -32602; |
|||
m_commonErrors[InternalError] = -32603; |
|||
m_commonErrors[ServerError] = -32000; |
|||
} |
|||
|
|||
~DispatcherImpl() { clearFrontend(); } |
|||
|
|||
virtual void clearFrontend() |
|||
{ |
|||
m_frontendChannel = nullptr; |
|||
for (auto& weak : m_weakPtrs) |
|||
weak.first->dispose(); |
|||
m_weakPtrs.clear(); |
|||
} |
|||
|
|||
std::unique_ptr<DispatcherImplWeakPtr> weakPtr() |
|||
{ |
|||
std::unique_ptr<DispatcherImplWeakPtr> weak(new DispatcherImplWeakPtr(this)); |
|||
m_weakPtrs.add(weak.get()); |
|||
return weak; |
|||
} |
|||
|
|||
virtual void dispatch(int sessionId, const String16& message); |
|||
virtual void reportProtocolError(int sessionId, int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport* errors) const; |
|||
using Dispatcher::reportProtocolError; |
|||
|
|||
void sendResponse(int sessionId, int callId, const ErrorString& invocationError, ErrorSupport* errors, std::unique_ptr<protocol::DictionaryValue> result); |
|||
|
|||
{% for domain in api.domains %} |
|||
virtual void registerAgent(blink::protocol::Backend::{{domain.domain}}* agent) { DCHECK(!m_{{domain.domain | lower}}Agent); m_{{domain.domain | lower}}Agent = agent; } |
|||
{% endfor %} |
|||
|
|||
private: |
|||
friend class DispatcherCallbackBase; |
|||
friend class DispatcherImplWeakPtr; |
|||
using CallHandler = void (DispatcherImpl::*)(int sessionId, int callId, std::unique_ptr<DictionaryValue> messageObject, ErrorSupport* errors); |
|||
using DispatchMap = protocol::HashMap<String16, CallHandler>; |
|||
|
|||
{% for domain in api.domains %} |
|||
{% for command in domain.commands %} |
|||
{% if "redirect" in command %}{% continue %}{% endif %} |
|||
{% if "handlers" in command and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %} |
|||
void {{domain.domain}}_{{command.name}}(int sessionId, int callId, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*); |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
FrontendChannel* m_frontendChannel; |
|||
|
|||
{% for domain in api.domains %} |
|||
Backend::{{domain.domain}}* m_{{domain.domain | lower}}Agent; |
|||
{% endfor %} |
|||
|
|||
void sendResponse(int sessionId, int callId, ErrorString invocationError, std::unique_ptr<protocol::DictionaryValue> result) |
|||
{ |
|||
sendResponse(sessionId, callId, invocationError, nullptr, std::move(result)); |
|||
} |
|||
|
|||
void sendResponse(int sessionId, int callId, ErrorString invocationError) |
|||
{ |
|||
sendResponse(sessionId, callId, invocationError, nullptr, DictionaryValue::create()); |
|||
} |
|||
|
|||
static const char kInvalidRequest[]; |
|||
|
|||
DispatchMap m_dispatchMap; |
|||
protocol::Vector<int> m_commonErrors; |
|||
protocol::HashSet<DispatcherImplWeakPtr*> m_weakPtrs; |
|||
}; |
|||
|
|||
class PLATFORM_EXPORT DispatcherCallbackBase : public protocol::Backend::CallbackBase { |
|||
public: |
|||
DispatcherCallbackBase(std::unique_ptr<DispatcherImplWeakPtr> backendImpl, int sessionId, int id) |
|||
: m_backendImpl(std::move(backendImpl)), m_sessionId(sessionId), m_id(id) { } |
|||
virtual ~DispatcherCallbackBase() { } |
|||
void dispose() { m_backendImpl = nullptr; } |
|||
|
|||
protected: |
|||
void sendIfActive(std::unique_ptr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError) |
|||
{ |
|||
if (!m_backendImpl->get()) |
|||
return; |
|||
m_backendImpl->get()->sendResponse(m_sessionId, m_id, invocationError, nullptr, std::move(partialMessage)); |
|||
m_backendImpl = nullptr; |
|||
} |
|||
|
|||
private: |
|||
std::unique_ptr<DispatcherImplWeakPtr> m_backendImpl; |
|||
int m_sessionId; |
|||
int m_id; |
|||
}; |
|||
|
|||
DispatcherImplWeakPtr::~DispatcherImplWeakPtr() |
|||
{ |
|||
if (m_dispatcher) |
|||
m_dispatcher->m_weakPtrs.remove(this); |
|||
} |
|||
|
|||
const char DispatcherImpl::kInvalidRequest[] = "Invalid request"; |
|||
|
|||
{% for domain in api.domains %} |
|||
{% for command in domain.commands %} |
|||
{% if "redirect" in command %}{% continue %}{% endif %} |
|||
{% if "handlers" in command and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %} |
|||
|
|||
{% if "async" in command %} |
|||
|
|||
class PLATFORM_EXPORT {{domain.domain}}{{command.name | to_title_case}}Callback : public Backend::{{domain.domain}}::{{command.name | to_title_case}}Callback, public DispatcherCallbackBase { |
|||
public: |
|||
{{domain.domain}}{{command.name | to_title_case}}Callback(std::unique_ptr<DispatcherImplWeakPtr> backendImpl, int sessionId, int id) |
|||
: DispatcherCallbackBase(std::move(backendImpl), sessionId, id) { } |
|||
|
|||
void sendSuccess( |
|||
{%- for parameter in command.returns -%} |
|||
{%- if "optional" in parameter -%} |
|||
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}} |
|||
{%- else -%} |
|||
{{resolve_type(parameter).pass_type}} {{parameter.name}} |
|||
{%- endif -%} |
|||
{%- if not loop.last -%}, {% endif -%} |
|||
{%- endfor -%}) override |
|||
{ |
|||
std::unique_ptr<protocol::DictionaryValue> resultObject = DictionaryValue::create(); |
|||
{% for parameter in command.returns %} |
|||
{% if "optional" in parameter %} |
|||
if ({{parameter.name}}.isJust()) |
|||
resultObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.fromJust())); |
|||
{% else %} |
|||
resultObject->setValue("{{parameter.name}}", toValue({{resolve_type(parameter).to_raw_type % parameter.name}})); |
|||
{% endif %} |
|||
{% endfor %} |
|||
sendIfActive(std::move(resultObject), ErrorString()); |
|||
} |
|||
|
|||
void sendFailure(const ErrorString& error) override |
|||
{ |
|||
DCHECK(error.length()); |
|||
sendIfActive(nullptr, error); |
|||
} |
|||
}; |
|||
{% endif %} |
|||
|
|||
void DispatcherImpl::{{domain.domain}}_{{command.name}}(int sessionId, int callId, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors) |
|||
{ |
|||
if (!m_{{domain.domain | lower}}Agent) |
|||
errors->addError("{{domain.domain}} handler is not available."); |
|||
|
|||
if (errors->hasErrors()) { |
|||
reportProtocolError(sessionId, callId, InvalidParams, kInvalidRequest, errors); |
|||
return; |
|||
} |
|||
{% if "parameters" in command %} |
|||
|
|||
// Prepare input parameters. |
|||
protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params")); |
|||
errors->push(); |
|||
{% for property in command.parameters %} |
|||
protocol::Value* {{property.name}}Value = object ? object->get("{{property.name}}") : nullptr; |
|||
{% if property.optional %} |
|||
Maybe<{{resolve_type(property).raw_type}}> in_{{property.name}}; |
|||
if ({{property.name}}Value) { |
|||
errors->setName("{{property.name}}"); |
|||
in_{{property.name}} = FromValue<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors); |
|||
} |
|||
{% else %} |
|||
errors->setName("{{property.name}}"); |
|||
{{resolve_type(property).type}} in_{{property.name}} = FromValue<{{resolve_type(property).raw_type}}>::parse({{property.name}}Value, errors); |
|||
{% endif %} |
|||
{% endfor %} |
|||
errors->pop(); |
|||
if (errors->hasErrors()) { |
|||
reportProtocolError(sessionId, callId, InvalidParams, kInvalidRequest, errors); |
|||
return; |
|||
} |
|||
{% endif %} |
|||
|
|||
{% if "async" in command %} |
|||
std::unique_ptr<{{domain.domain}}{{command.name | to_title_case}}Callback> callback(new {{domain.domain}}{{command.name | to_title_case}}Callback(weakPtr(), sessionId, callId)); |
|||
{% elif "returns" in command %} |
|||
// Declare output parameters. |
|||
std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create(); |
|||
{% for property in command.returns %} |
|||
{% if "optional" in property %} |
|||
Maybe<{{resolve_type(property).raw_type}}> out_{{property.name}}; |
|||
{% else %} |
|||
{{resolve_type(property).type}} out_{{property.name}}; |
|||
{% endif %} |
|||
{% endfor %} |
|||
{% endif %} |
|||
|
|||
std::unique_ptr<DispatcherImplWeakPtr> weak = weakPtr(); |
|||
ErrorString error; |
|||
m_{{domain.domain | lower}}Agent->{{command.name}}(&error |
|||
{%- for property in command.parameters -%} |
|||
{%- if "optional" in property -%} |
|||
, in_{{property.name}} |
|||
{%- else -%} |
|||
, {{resolve_type(property).to_pass_type % ("in_" + property.name)}} |
|||
{%- endif -%} |
|||
{%- endfor %} |
|||
{%- if "async" in command -%} |
|||
, std::move(callback) |
|||
{%- elif "returns" in command %} |
|||
{%- for property in command.returns -%} |
|||
, &out_{{property.name}} |
|||
{%- endfor %} |
|||
{% endif %}); |
|||
{% if "returns" in command and not("async" in command) %} |
|||
if (!error.length()) { |
|||
{% for parameter in command.returns %} |
|||
{% if "optional" in parameter %} |
|||
if (out_{{parameter.name}}.isJust()) |
|||
result->setValue("{{parameter.name}}", toValue(out_{{parameter.name}}.fromJust())); |
|||
{% else %} |
|||
result->setValue("{{parameter.name}}", toValue({{resolve_type(parameter).to_raw_type % ("out_" + parameter.name)}})); |
|||
{% endif %} |
|||
{% endfor %} |
|||
} |
|||
if (weak->get()) |
|||
weak->get()->sendResponse(sessionId, callId, error, std::move(result)); |
|||
{% elif not("async" in command) %} |
|||
if (weak->get()) |
|||
weak->get()->sendResponse(sessionId, callId, error); |
|||
{% endif %} |
|||
} |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
std::unique_ptr<Dispatcher> Dispatcher::create(FrontendChannel* frontendChannel) |
|||
{ |
|||
return wrapUnique(new DispatcherImpl(frontendChannel)); |
|||
} |
|||
|
|||
void DispatcherImpl::dispatch(int sessionId, const String16& message) |
|||
{ |
|||
int callId = 0; |
|||
std::unique_ptr<protocol::Value> parsedMessage = parseJSON(message); |
|||
DCHECK(parsedMessage); |
|||
std::unique_ptr<protocol::DictionaryValue> messageObject = DictionaryValue::cast(std::move(parsedMessage)); |
|||
DCHECK(messageObject); |
|||
|
|||
protocol::Value* callIdValue = messageObject->get("id"); |
|||
bool success = callIdValue->asNumber(&callId); |
|||
DCHECK(success); |
|||
|
|||
protocol::Value* methodValue = messageObject->get("method"); |
|||
String16 method; |
|||
success = methodValue && methodValue->asString(&method); |
|||
DCHECK(success); |
|||
|
|||
protocol::HashMap<String16, CallHandler>::iterator it = m_dispatchMap.find(method); |
|||
if (it == m_dispatchMap.end()) { |
|||
reportProtocolError(sessionId, callId, MethodNotFound, "'" + method + "' wasn't found"); |
|||
return; |
|||
} |
|||
|
|||
protocol::ErrorSupport errors; |
|||
((*this).*(*it->second))(sessionId, callId, std::move(messageObject), &errors); |
|||
} |
|||
|
|||
void DispatcherImpl::sendResponse(int sessionId, int callId, const ErrorString& invocationError, ErrorSupport* errors, std::unique_ptr<protocol::DictionaryValue> result) |
|||
{ |
|||
if (invocationError.length() || (errors && errors->hasErrors())) { |
|||
reportProtocolError(sessionId, callId, ServerError, invocationError, errors); |
|||
return; |
|||
} |
|||
|
|||
std::unique_ptr<protocol::DictionaryValue> responseMessage = DictionaryValue::create(); |
|||
responseMessage->setNumber("id", callId); |
|||
responseMessage->setObject("result", std::move(result)); |
|||
if (m_frontendChannel) |
|||
m_frontendChannel->sendProtocolResponse(sessionId, callId, std::move(responseMessage)); |
|||
} |
|||
|
|||
void Dispatcher::reportProtocolError(int sessionId, int callId, CommonErrorCode code, const String16& errorMessage) const |
|||
{ |
|||
ErrorSupport errors; |
|||
reportProtocolError(sessionId, callId, code, errorMessage, &errors); |
|||
} |
|||
|
|||
void DispatcherImpl::reportProtocolError(int sessionId, int callId, CommonErrorCode code, const String16& errorMessage, ErrorSupport* errors) const |
|||
{ |
|||
DCHECK(code >=0); |
|||
DCHECK((unsigned)code < m_commonErrors.size()); |
|||
DCHECK(m_commonErrors[code]); |
|||
std::unique_ptr<protocol::DictionaryValue> error = DictionaryValue::create(); |
|||
error->setNumber("code", m_commonErrors[code]); |
|||
error->setString("message", errorMessage); |
|||
DCHECK(error); |
|||
if (errors && errors->hasErrors()) |
|||
error->setString("data", errors->errors()); |
|||
std::unique_ptr<protocol::DictionaryValue> message = DictionaryValue::create(); |
|||
message->setObject("error", std::move(error)); |
|||
message->setNumber("id", callId); |
|||
if (m_frontendChannel) |
|||
m_frontendChannel->sendProtocolResponse(sessionId, callId, std::move(message)); |
|||
} |
|||
|
|||
bool Dispatcher::getCommandName(const String16& message, String16* result) |
|||
{ |
|||
std::unique_ptr<protocol::Value> value = parseJSON(message); |
|||
if (!value) |
|||
return false; |
|||
|
|||
protocol::DictionaryValue* object = DictionaryValue::cast(value.get()); |
|||
if (!object) |
|||
return false; |
|||
|
|||
if (!object->getString("method", result)) |
|||
return false; |
|||
|
|||
return true; |
|||
} |
|||
|
|||
} // namespace protocol |
|||
} // namespace blink |
@ -1,65 +0,0 @@ |
|||
// This file is generated |
|||
|
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|||
// Use of this source code is governed by a BSD-style license that can be |
|||
// found in the LICENSE file. |
|||
|
|||
#ifndef {{class_name}}_h |
|||
#define {{class_name}}_h |
|||
|
|||
#include "platform/inspector_protocol/Backend.h" |
|||
#include "platform/inspector_protocol/TypeBuilder.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class FrontendChannel; |
|||
class DispatcherImplWeakPtr; |
|||
|
|||
class PLATFORM_EXPORT Dispatcher { |
|||
public: |
|||
static std::unique_ptr<Dispatcher> create(FrontendChannel* frontendChannel); |
|||
virtual ~Dispatcher() { } |
|||
|
|||
class PLATFORM_EXPORT CallbackBase { |
|||
public: |
|||
CallbackBase(std::unique_ptr<DispatcherImplWeakPtr> backendImpl, int sessionId, int id); |
|||
virtual ~CallbackBase(); |
|||
void sendFailure(const ErrorString&); |
|||
void dispose(); |
|||
|
|||
protected: |
|||
void sendIfActive(std::unique_ptr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError); |
|||
|
|||
private: |
|||
std::unique_ptr<DispatcherImplWeakPtr> m_backendImpl; |
|||
int m_sessionId; |
|||
int m_id; |
|||
}; |
|||
|
|||
{% for domain in api.domains %} |
|||
virtual void registerAgent(blink::protocol::Backend::{{domain.domain}}*) = 0; |
|||
{% endfor %} |
|||
|
|||
virtual void clearFrontend() = 0; |
|||
|
|||
enum CommonErrorCode { |
|||
ParseError = 0, |
|||
InvalidRequest, |
|||
MethodNotFound, |
|||
InvalidParams, |
|||
InternalError, |
|||
ServerError, |
|||
LastEntry, |
|||
}; |
|||
|
|||
void reportProtocolError(int sessionId, int callId, CommonErrorCode, const String16& errorMessage) const; |
|||
virtual void reportProtocolError(int sessionId, int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport*) const = 0; |
|||
virtual void dispatch(int sessionId, const String16& message) = 0; |
|||
static bool getCommandName(const String16& message, String16* result); |
|||
}; |
|||
|
|||
} // namespace protocol |
|||
} // namespace blink |
|||
|
|||
#endif // !defined({{class_name}}_h) |
@ -1,53 +0,0 @@ |
|||
// This file is generated |
|||
|
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|||
// Use of this source code is governed by a BSD-style license that can be |
|||
// found in the LICENSE file. |
|||
|
|||
#include "platform/inspector_protocol/{{class_name}}.h" |
|||
|
|||
#include "platform/inspector_protocol/String16.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
Frontend::Frontend(FrontendChannel* frontendChannel) |
|||
: m_frontendChannel(frontendChannel) |
|||
{% for domain in api.domains %} |
|||
, m_{{domain.domain | lower}}(frontendChannel) |
|||
{% endfor %} |
|||
{ |
|||
} |
|||
|
|||
{% for domain in api.domains %} |
|||
{% for event in domain.events %} |
|||
{% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% continue %}{% endif %} |
|||
void Frontend::{{domain.domain}}::{{event.name}}( |
|||
{%- for parameter in event.parameters %} |
|||
{% if "optional" in parameter -%} |
|||
const Maybe<{{resolve_type(parameter).raw_type}}>& |
|||
{%- else -%} |
|||
{{resolve_type(parameter).pass_type}} |
|||
{%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} |
|||
{% endfor -%}) |
|||
{ |
|||
std::unique_ptr<protocol::DictionaryValue> jsonMessage = DictionaryValue::create(); |
|||
jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); |
|||
std::unique_ptr<protocol::DictionaryValue> paramsObject = DictionaryValue::create(); |
|||
{% for parameter in event.parameters %} |
|||
{% if "optional" in parameter %} |
|||
if ({{parameter.name}}.isJust()) |
|||
paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.fromJust())); |
|||
{% else %} |
|||
paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(parameter).to_raw_type % parameter.name}})); |
|||
{% endif %} |
|||
{% endfor %} |
|||
jsonMessage->setObject("params", std::move(paramsObject)); |
|||
if (m_frontendChannel) |
|||
m_frontendChannel->sendProtocolNotification(std::move(jsonMessage)); |
|||
} |
|||
{% endfor %} |
|||
{% endfor %} |
|||
|
|||
} // namespace protocol |
|||
} // namespace blink |
@ -1,57 +0,0 @@ |
|||
// This file is generated |
|||
|
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|||
// Use of this source code is governed by a BSD-style license that can be |
|||
// found in the LICENSE file. |
|||
|
|||
#ifndef {{class_name}}_h |
|||
#define {{class_name}}_h |
|||
|
|||
|
|||
#include "platform/inspector_protocol/FrontendChannel.h" |
|||
#include "platform/inspector_protocol/TypeBuilder.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class PLATFORM_EXPORT Frontend { |
|||
public: |
|||
Frontend(FrontendChannel*); |
|||
FrontendChannel* channel() { return m_frontendChannel; } |
|||
|
|||
{% for domain in api.domains %} |
|||
|
|||
class PLATFORM_EXPORT {{domain.domain}} { |
|||
public: |
|||
static {{domain.domain}}* from(Frontend* frontend) { return &(frontend->m_{{domain.domain | lower}}) ;} |
|||
{{domain.domain}}(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } |
|||
{% for event in domain.events %} |
|||
{% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% continue %}{% endif %} |
|||
void {{event.name}}( |
|||
{%- for parameter in event.parameters -%} |
|||
{%- if "optional" in parameter -%} |
|||
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}} = Maybe<{{resolve_type(parameter).raw_type}}>() |
|||
{%- else -%} |
|||
{{resolve_type(parameter).pass_type}} {{parameter.name}} |
|||
{%- endif -%}{%- if not loop.last -%}, {% endif -%} |
|||
{%- endfor -%} |
|||
); |
|||
{% endfor %} |
|||
|
|||
void flush() { m_frontendChannel->flush(); } |
|||
private: |
|||
FrontendChannel* m_frontendChannel; |
|||
}; |
|||
{% endfor %} |
|||
|
|||
private: |
|||
FrontendChannel* m_frontendChannel; |
|||
{% for domain in api.domains %} |
|||
{{domain.domain}} m_{{domain.domain | lower}}; |
|||
{% endfor %} |
|||
}; |
|||
|
|||
} // namespace protocol |
|||
} // namespace blink |
|||
|
|||
#endif // !defined({{class_name}}_h) |
@ -0,0 +1,35 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#include "platform/inspector_protocol/Object.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* errors) |
|||
{ |
|||
protocol::DictionaryValue* object = DictionaryValue::cast(value); |
|||
if (!object) { |
|||
errors->addError("object expected"); |
|||
return nullptr; |
|||
} |
|||
return wrapUnique(new Object(wrapUnique(static_cast<DictionaryValue*>(object->clone().release())))); |
|||
} |
|||
|
|||
std::unique_ptr<protocol::DictionaryValue> Object::serialize() const |
|||
{ |
|||
return DictionaryValue::cast(m_object->clone()); |
|||
} |
|||
|
|||
std::unique_ptr<Object> Object::clone() const |
|||
{ |
|||
return wrapUnique(new Object(DictionaryValue::cast(m_object->clone()))); |
|||
} |
|||
|
|||
Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std::move(object)) { } |
|||
|
|||
Object::~Object() { } |
|||
|
|||
} // namespace protocol
|
|||
} // namespace blink
|
@ -0,0 +1,30 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef Object_h |
|||
#define Object_h |
|||
|
|||
#include "platform/inspector_protocol/ErrorSupport.h" |
|||
#include "platform/inspector_protocol/Platform.h" |
|||
#include "platform/inspector_protocol/Values.h" |
|||
|
|||
namespace blink { |
|||
namespace protocol { |
|||
|
|||
class PLATFORM_EXPORT Object { |
|||
public: |
|||
static std::unique_ptr<Object> parse(protocol::Value*, ErrorSupport*); |
|||
~Object(); |
|||
|
|||
std::unique_ptr<protocol::DictionaryValue> serialize() const; |
|||
std::unique_ptr<Object> clone() const; |
|||
private: |
|||
explicit Object(std::unique_ptr<protocol::DictionaryValue>); |
|||
std::unique_ptr<protocol::DictionaryValue> m_object; |
|||
}; |
|||
|
|||
} // namespace platform
|
|||
} // namespace blink
|
|||
|
|||
#endif // !defined(Object_h)
|
@ -0,0 +1,14 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef protocol_Platform_h |
|||
#define protocol_Platform_h |
|||
|
|||
#if V8_INSPECTOR_USE_STL |
|||
#include "platform/inspector_protocol/PlatformSTL.h" |
|||
#else |
|||
#include "platform/inspector_protocol/PlatformWTF.h" |
|||
#endif // V8_INSPECTOR_USE_STL
|
|||
|
|||
#endif // !defined(protocol_Platform_h)
|
@ -0,0 +1,281 @@ |
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef PlatformSTL_h |
|||
#define PlatformSTL_h |
|||
|
|||
#include <memory> |
|||
|
|||
#define PLATFORM_EXPORT |
|||
#ifndef CHECK |
|||
#define CHECK(condition) ((void) 0) |
|||
#endif |
|||
#define DCHECK(condition) ((void) 0) |
|||
#define NOTREACHED() |
|||
#define DCHECK_EQ(i, j) DCHECK(i == j) |
|||
#define DCHECK_GE(i, j) DCHECK(i >= j) |
|||
#define DCHECK_LT(i, j) DCHECK(i < j) |
|||
#define DCHECK_GT(i, j) DCHECK(i > j) |
|||
template <typename T> |
|||
inline void USE(T) { } |
|||
|
|||
#define DEFINE_STATIC_LOCAL(type, name, arguments) \ |
|||
static type name; |
|||
|
|||
#if defined(__APPLE__) && !defined(_LIBCPP_VERSION) |
|||
|
|||
namespace std { |
|||
|
|||
template <typename T1, typename T2> |
|||
struct is_convertible { |
|||
private: |
|||
struct True_ { |
|||
char x[2]; |
|||
}; |
|||
struct False_ { |
|||
}; |
|||
|
|||
static True_ helper(T2 const &); |
|||
static False_ helper(...); |
|||
|
|||
public: |
|||
static bool const value = ( |
|||
sizeof(True_) == sizeof(is_convertible::helper(T1())) |
|||
); |
|||
}; |
|||
|
|||
template <bool, class T = void> |
|||
struct enable_if { |
|||
}; |
|||
|
|||
template <class T> |
|||
struct enable_if<true, T> { |
|||
typedef T type; |
|||
}; |
|||
|
|||
template<class T> |
|||
struct remove_extent { |
|||
typedef T type; |
|||
}; |
|||
|
|||
template<class T> |
|||
struct remove_extent<T[]> { |
|||
typedef T type; |
|||
}; |
|||
|
|||
template<class T, std::size_t N> |
|||
struct remove_extent<T[N]> { |
|||
typedef T type; |
|||
}; |
|||
|
|||
typedef decltype(nullptr) nullptr_t; |
|||
|
|||
template<class T, T v> |
|||
struct integral_constant { |
|||
static constexpr T value = v; |
|||
typedef T value_type; |
|||
typedef integral_constant type; |
|||
constexpr operator value_type() const noexcept { return value; } |
|||
constexpr value_type operator()() const noexcept { return value; } |
|||
}; |
|||
|
|||
typedef integral_constant<bool, true> true_type; |
|||
typedef integral_constant<bool, false> false_type; |
|||
|
|||
template<class T> |
|||
struct is_array : false_type {}; |
|||
|
|||
template<class T> |
|||
struct is_array<T[]> : true_type {}; |
|||
|
|||
template<class T, std::size_t N> |
|||
struct is_array<T[N]> : true_type {}; |
|||
|
|||
template <typename T> |
|||
struct OwnedPtrDeleter { |
|||
static void deletePtr(T* ptr) |
|||
{ |
|||
static_assert(sizeof(T) > 0, "type must be complete"); |
|||
delete ptr; |
|||
} |
|||
}; |
|||
|
|||
template <typename T> |
|||
struct OwnedPtrDeleter<T[]> { |
|||
static void deletePtr(T* ptr) |
|||
{ |
|||
static_assert(sizeof(T) > 0, "type must be complete"); |
|||
delete[] ptr; |
|||
} |
|||
}; |
|||
|
|||
template <class T, int n> |
|||
struct OwnedPtrDeleter<T[n]> { |
|||
static_assert(sizeof(T) < 0, "do not use array with size as type"); |
|||
}; |
|||
|
|||
template <typename T> class unique_ptr { |
|||
public: |
|||
typedef typename remove_extent<T>::type ValueType; |
|||
typedef ValueType* PtrType; |
|||
|
|||
unique_ptr() : m_ptr(nullptr) {} |
|||
unique_ptr(std::nullptr_t) : m_ptr(nullptr) {} |
|||
unique_ptr(unique_ptr&&); |
|||
template <typename U, typename = typename enable_if<is_convertible<U*, T*>::value>::type> unique_ptr(unique_ptr<U>&&); |
|||
|
|||
~unique_ptr() |
|||
{ |
|||
OwnedPtrDeleter<T>::deletePtr(m_ptr); |
|||
m_ptr = nullptr; |
|||
} |
|||
|
|||
PtrType get() const { return m_ptr; } |
|||
|
|||
void reset(PtrType = nullptr); |
|||
PtrType release(); |
|||
|
|||
ValueType& operator*() const { DCHECK(m_ptr); return *m_ptr; } |
|||
PtrType operator->() const { DCHECK(m_ptr); return m_ptr; } |
|||
|
|||
ValueType& operator[](std::ptrdiff_t i) const; |
|||
|
|||
bool operator!() const { return !m_ptr; } |
|||
explicit operator bool() const { return m_ptr; } |
|||
|
|||
unique_ptr& operator=(std::nullptr_t) { reset(); return *this; } |
|||
|
|||
|
|||
unique_ptr& operator=(unique_ptr&&); |
|||
template <typename U> unique_ptr& operator=(unique_ptr<U>&&); |
|||
|
|||
void swap(unique_ptr& o) { std::swap(m_ptr, o.m_ptr); } |
|||
|
|||
static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
|||
|
|||
explicit unique_ptr(PtrType ptr) : m_ptr(ptr) {} |
|||
|
|||
private: |
|||
|
|||
// We should never have two unique_ptrs for the same underlying object
|
|||
// (otherwise we'll get double-destruction), so these equality operators
|
|||
// should never be needed.
|
|||
template <typename U> bool operator==(const unique_ptr<U>&) const |
|||
{ |
|||
static_assert(!sizeof(U*), "unique_ptrs should never be equal"); |
|||
return false; |
|||
} |
|||
template <typename U> bool operator!=(const unique_ptr<U>&) const |
|||
{ |
|||
static_assert(!sizeof(U*), "unique_ptrs should never be equal"); |
|||
return false; |
|||
} |
|||
|
|||
PtrType m_ptr; |
|||
}; |
|||
|
|||
|
|||
template <typename T> inline void unique_ptr<T>::reset(PtrType ptr) |
|||
{ |
|||
PtrType p = m_ptr; |
|||
m_ptr = ptr; |
|||
OwnedPtrDeleter<T>::deletePtr(p); |
|||
} |
|||
|
|||
template <typename T> inline typename unique_ptr<T>::PtrType unique_ptr<T>::release() |
|||
{ |
|||
PtrType ptr = m_ptr; |
|||
m_ptr = nullptr; |
|||
return ptr; |
|||
} |
|||
|
|||
template <typename T> inline typename unique_ptr<T>::ValueType& unique_ptr<T>::operator[](std::ptrdiff_t i) const |
|||
{ |
|||
static_assert(is_array<T>::value, "elements access is possible for arrays only"); |
|||
DCHECK(m_ptr); |
|||
DCHECK_GE(i, 0); |
|||
return m_ptr[i]; |
|||
} |
|||
|
|||
template <typename T> inline unique_ptr<T>::unique_ptr(unique_ptr<T>&& o) |
|||
: m_ptr(o.release()) |
|||
{ |
|||
} |
|||
|
|||
template <typename T> |
|||
template <typename U, typename> inline unique_ptr<T>::unique_ptr(unique_ptr<U>&& o) |
|||
: m_ptr(o.release()) |
|||
{ |
|||
static_assert(!is_array<T>::value, "pointers to array must never be converted"); |
|||
} |
|||
|
|||
template <typename T> inline unique_ptr<T>& unique_ptr<T>::operator=(unique_ptr<T>&& o) |
|||
{ |
|||
PtrType ptr = m_ptr; |
|||
m_ptr = o.release(); |
|||
DCHECK(!ptr || m_ptr != ptr); |
|||
OwnedPtrDeleter<T>::deletePtr(ptr); |
|||
|
|||
return *this; |
|||
} |
|||
|
|||
template <typename T> |
|||
template <typename U> inline unique_ptr<T>& unique_ptr<T>::operator=(unique_ptr<U>&& o) |
|||
{ |
|||
static_assert(!is_array<T>::value, "pointers to array must never be converted"); |
|||
PtrType ptr = m_ptr; |
|||
m_ptr = o.release(); |
|||
DCHECK(!ptr || m_ptr != ptr); |
|||
OwnedPtrDeleter<T>::deletePtr(ptr); |
|||
|
|||
return *this; |
|||
} |
|||
|
|||
template <typename T> inline void swap(unique_ptr<T>& a, unique_ptr<T>& b) |
|||
{ |
|||
a.swap(b); |
|||
} |
|||
|
|||
template <typename T, typename U> inline bool operator==(const unique_ptr<T>& a, U* b) |
|||
{ |
|||
return a.get() == b; |
|||
} |
|||
|
|||
template <typename T, typename U> inline bool operator==(T* a, const unique_ptr<U>& b) |
|||
{ |
|||
return a == b.get(); |
|||
} |
|||
|
|||
template <typename T, typename U> inline bool operator!=(const unique_ptr<T>& a, U* b) |
|||
{ |
|||
return a.get() != b; |
|||
} |
|||
|
|||
template <typename T, typename U> inline bool operator!=(T* a, const unique_ptr<U>& b) |
|||
{ |
|||
return a != b.get(); |
|||
} |
|||
|
|||
template <typename T> inline typename unique_ptr<T>::PtrType getPtr(const unique_ptr<T>& p) |
|||
{ |
|||
return p.get(); |
|||
} |
|||
|
|||
template <typename T> |
|||
unique_ptr<T> move(unique_ptr<T>& ptr) |
|||
{ |
|||
return unique_ptr<T>(ptr.release()); |
|||
} |
|||
|
|||
} |
|||
|
|||
#endif // defined(__APPLE__) && !defined(_LIBCPP_VERSION)
|
|||
|
|||
template <typename T> |
|||
std::unique_ptr<T> wrapUnique(T* ptr) |
|||
{ |
|||
return std::unique_ptr<T>(ptr); |
|||
} |
|||
|
|||
#endif // PlatformSTL_h
|
@ -0,0 +1,14 @@ |
|||
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef PlatformWTF_h |
|||
#define PlatformWTF_h |
|||
|
|||
#include "platform/PlatformExport.h" |
|||
#include "wtf/Assertions.h" |
|||
#include "wtf/PtrUtil.h" |
|||
|
|||
#include <memory> |
|||
|
|||
#endif // PlatformWTF_h
|
@ -1,89 +0,0 @@ |
|||
# Copyright 2014 The Chromium Authors. All rights reserved. |
|||
# Use of this source code is governed by a BSD-style license that can be |
|||
# found in the LICENSE file. |
|||
|
|||
{ |
|||
'variables': { |
|||
'blink_platform_output_dir': '<(SHARED_INTERMEDIATE_DIR)/blink/platform', |
|||
'jinja_module_files': [ |
|||
# jinja2/__init__.py contains version string, so sufficient for package |
|||
'../../deps/jinja2/jinja2/__init__.py', |
|||
'../../deps/markupsafe/markupsafe/__init__.py', # jinja2 dep |
|||
], |
|||
}, |
|||
|
|||
'targets': [ |
|||
{ |
|||
# GN version: //third_party/WebKit/Source/platform/inspector_protocol_sources |
|||
'target_name': 'protocol_sources', |
|||
'type': 'none', |
|||
'dependencies': [ |
|||
'protocol_version' |
|||
], |
|||
'actions': [ |
|||
{ |
|||
'action_name': 'generateInspectorProtocolBackendSources', |
|||
'inputs': [ |
|||
'<@(jinja_module_files)', |
|||
# The python script in action below. |
|||
'CodeGenerator.py', |
|||
# Input files for the script. |
|||
'../../devtools/protocol.json', |
|||
'Backend_h.template', |
|||
'Dispatcher_h.template', |
|||
'Dispatcher_cpp.template', |
|||
'Frontend_h.template', |
|||
'Frontend_cpp.template', |
|||
'TypeBuilder_h.template', |
|||
'TypeBuilder_cpp.template', |
|||
], |
|||
'outputs': [ |
|||
'<(blink_platform_output_dir)/inspector_protocol/Backend.h', |
|||
'<(blink_platform_output_dir)/inspector_protocol/Dispatcher.cpp', |
|||
'<(blink_platform_output_dir)/inspector_protocol/Dispatcher.h', |
|||
'<(blink_platform_output_dir)/inspector_protocol/Frontend.cpp', |
|||
'<(blink_platform_output_dir)/inspector_protocol/Frontend.h', |
|||
'<(blink_platform_output_dir)/inspector_protocol/TypeBuilder.cpp', |
|||
'<(blink_platform_output_dir)/inspector_protocol/TypeBuilder.h', |
|||
], |
|||
'action': [ |
|||
'python', |
|||
'CodeGenerator.py', |
|||
'../../devtools/protocol.json', |
|||
'--output_dir', '<(blink_platform_output_dir)/inspector_protocol', |
|||
], |
|||
'message': 'Generating Inspector protocol backend sources from protocol.json', |
|||
}, |
|||
] |
|||
}, |
|||
{ |
|||
# GN version: //third_party/WebKit/Source/platform/inspector_protocol_version |
|||
'target_name': 'protocol_version', |
|||
'type': 'none', |
|||
'actions': [ |
|||
{ |
|||
'action_name': 'generateInspectorProtocolVersion', |
|||
'inputs': [ |
|||
'generate-inspector-protocol-version', |
|||
'../../devtools/protocol.json', |
|||
], |
|||
'outputs': [ |
|||
'<(blink_platform_output_dir)/inspector_protocol/InspectorProtocolVersion.h', |
|||
], |
|||
'variables': { |
|||
'generator_include_dirs': [ |
|||
], |
|||
}, |
|||
'action': [ |
|||
'python', |
|||
'generate-inspector-protocol-version', |
|||
'-o', |
|||
'<@(_outputs)', |
|||
'<@(_inputs)' |
|||
], |
|||
'message': 'Validate inspector protocol for backwards compatibility and generate version file', |
|||
} |
|||
] |
|||
}, |
|||
], # targets |
|||
} |
@ -1,70 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#include "platform/v8_inspector/InspectorWrapper.h" |
|||
|
|||
#include "platform/v8_inspector/V8Compat.h" |
|||
#include "platform/v8_inspector/public/V8DebuggerClient.h" |
|||
#include "wtf/Assertions.h" |
|||
|
|||
#include <v8-debug.h> |
|||
|
|||
namespace blink { |
|||
|
|||
v8::Local<v8::FunctionTemplate> InspectorWrapperBase::createWrapperTemplate(v8::Isolate* isolate, const char* className, const protocol::Vector<V8MethodConfiguration>& methods, const protocol::Vector<V8AttributeConfiguration>& attributes) |
|||
{ |
|||
v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate); |
|||
|
|||
functionTemplate->SetClassName(v8::String::NewFromUtf8(isolate, className, v8::NewStringType::kInternalized).ToLocalChecked()); |
|||
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate(); |
|||
|
|||
for (auto& config : attributes) { |
|||
v8::Local<v8::Name> v8name = v8::String::NewFromUtf8(isolate, config.name, v8::NewStringType::kInternalized).ToLocalChecked(); |
|||
instanceTemplate->SetAccessor(v8name, config.callback); |
|||
} |
|||
|
|||
for (auto& config : methods) { |
|||
v8::Local<v8::Name> v8name = v8::String::NewFromUtf8(isolate, config.name, v8::NewStringType::kInternalized).ToLocalChecked(); |
|||
v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, config.callback); |
|||
functionTemplate->RemovePrototype(); |
|||
instanceTemplate->Set(v8name, functionTemplate, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum | v8::ReadOnly)); |
|||
} |
|||
|
|||
return functionTemplate; |
|||
} |
|||
|
|||
v8::Local<v8::Object> InspectorWrapperBase::createWrapper(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context) |
|||
{ |
|||
v8::MicrotasksScope microtasks(context->GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); |
|||
v8::Local<v8::Function> function; |
|||
if (!constructorTemplate->GetFunction(context).ToLocal(&function)) |
|||
return v8::Local<v8::Object>(); |
|||
|
|||
v8::Local<v8::Object> result; |
|||
if (!function->NewInstance(context).ToLocal(&result)) |
|||
return v8::Local<v8::Object>(); |
|||
return result; |
|||
} |
|||
|
|||
void* InspectorWrapperBase::unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object, const char* name) |
|||
{ |
|||
v8::Isolate* isolate = context->GetIsolate(); |
|||
DCHECK(context != v8::Debug::GetDebugContext(isolate)); |
|||
|
|||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked()); |
|||
|
|||
v8::Local<v8::Value> value; |
|||
if (!object->GetPrivate(context, privateKey).ToLocal(&value)) |
|||
return nullptr; |
|||
if (!value->IsExternal()) |
|||
return nullptr; |
|||
return value.As<v8::External>()->Value(); |
|||
} |
|||
|
|||
v8::Local<v8::String> InspectorWrapperBase::v8InternalizedString(v8::Isolate* isolate, const char* name) |
|||
{ |
|||
return v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kInternalized).ToLocalChecked(); |
|||
} |
|||
|
|||
} // namespace blink
|
@ -1,88 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef InspectorWrapper_h |
|||
#define InspectorWrapper_h |
|||
|
|||
#include "platform/inspector_protocol/Collections.h" |
|||
#include <v8.h> |
|||
|
|||
namespace blink { |
|||
|
|||
class InspectorWrapperBase { |
|||
public: |
|||
struct V8MethodConfiguration { |
|||
const char* name; |
|||
v8::FunctionCallback callback; |
|||
}; |
|||
|
|||
struct V8AttributeConfiguration { |
|||
const char* name; |
|||
v8::AccessorNameGetterCallback callback; |
|||
}; |
|||
|
|||
static v8::Local<v8::FunctionTemplate> createWrapperTemplate(v8::Isolate*, const char* className, const protocol::Vector<V8MethodConfiguration>& methods, const protocol::Vector<V8AttributeConfiguration>& attributes); |
|||
|
|||
protected: |
|||
static v8::Local<v8::Object> createWrapper(v8::Local<v8::FunctionTemplate>, v8::Local<v8::Context>); |
|||
static void* unwrap(v8::Local<v8::Context>, v8::Local<v8::Object>, const char* name); |
|||
|
|||
static v8::Local<v8::String> v8InternalizedString(v8::Isolate*, const char* name); |
|||
}; |
|||
|
|||
template<class T, char* const hiddenPropertyName, char* const className> |
|||
class InspectorWrapper final : public InspectorWrapperBase { |
|||
public: |
|||
class WeakCallbackData final { |
|||
public: |
|||
WeakCallbackData(v8::Isolate* isolate, T* impl, v8::Local<v8::Object> wrapper) |
|||
: m_impl(impl) |
|||
, m_persistent(isolate, wrapper) |
|||
{ |
|||
m_persistent.SetWeak(this, &WeakCallbackData::weakCallback, v8::WeakCallbackType::kParameter); |
|||
} |
|||
|
|||
T* m_impl; |
|||
std::unique_ptr<T> m_implOwn; |
|||
|
|||
private: |
|||
static void weakCallback(const v8::WeakCallbackInfo<WeakCallbackData>& info) |
|||
{ |
|||
delete info.GetParameter(); |
|||
} |
|||
|
|||
v8::Global<v8::Object> m_persistent; |
|||
}; |
|||
|
|||
static v8::Local<v8::FunctionTemplate> createWrapperTemplate(v8::Isolate* isolate, const protocol::Vector<V8MethodConfiguration>& methods, const protocol::Vector<V8AttributeConfiguration>& attributes) |
|||
{ |
|||
return InspectorWrapperBase::createWrapperTemplate(isolate, className, methods, attributes); |
|||
} |
|||
|
|||
static v8::Local<v8::Object> wrap(v8::Local<v8::FunctionTemplate> constructorTemplate, v8::Local<v8::Context> context, T* object) |
|||
{ |
|||
v8::Context::Scope contextScope(context); |
|||
v8::Local<v8::Object> result = InspectorWrapperBase::createWrapper(constructorTemplate, context); |
|||
if (result.IsEmpty()) |
|||
return v8::Local<v8::Object>(); |
|||
v8::Isolate* isolate = context->GetIsolate(); |
|||
v8::Local<v8::External> objectReference = v8::External::New(isolate, new WeakCallbackData(isolate, object, result)); |
|||
|
|||
v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String::NewFromUtf8(isolate, hiddenPropertyName, v8::NewStringType::kInternalized).ToLocalChecked()); |
|||
result->SetPrivate(context, privateKey, objectReference); |
|||
return result; |
|||
} |
|||
|
|||
static T* unwrap(v8::Local<v8::Context> context, v8::Local<v8::Object> object) |
|||
{ |
|||
void* data = InspectorWrapperBase::unwrap(context, object, hiddenPropertyName); |
|||
if (!data) |
|||
return nullptr; |
|||
return reinterpret_cast<WeakCallbackData*>(data)->m_impl; |
|||
} |
|||
}; |
|||
|
|||
} // namespace blink
|
|||
|
|||
#endif // InspectorWrapper_h
|
File diff suppressed because it is too large
@ -0,0 +1,976 @@ |
|||
{ |
|||
"version": { "major": "1", "minor": "1" }, |
|||
"domains": [{ |
|||
"domain": "Runtime", |
|||
"description": "Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.", |
|||
"types": [ |
|||
{ |
|||
"id": "ScriptId", |
|||
"type": "string", |
|||
"description": "Unique script identifier." |
|||
}, |
|||
{ |
|||
"id": "RemoteObjectId", |
|||
"type": "string", |
|||
"description": "Unique object identifier." |
|||
}, |
|||
{ |
|||
"id": "RemoteObject", |
|||
"type": "object", |
|||
"description": "Mirror object referencing original JavaScript object.", |
|||
"properties": [ |
|||
{ "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, |
|||
{ "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for <code>object</code> type values only." }, |
|||
{ "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." }, |
|||
{ "name": "value", "type": "any", "optional": true, "description": "Remote object value in case of primitive values or JSON values (if it was requested), or description string if the value can not be JSON-stringified (like NaN, Infinity, -Infinity, -0)." }, |
|||
{ "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, |
|||
{ "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Unique object identifier (for non-primitive values)." }, |
|||
{ "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for <code>object</code> type values only.", "hidden": true }, |
|||
{ "name": "customPreview", "$ref": "CustomPreview", "optional": true, "hidden": true} |
|||
] |
|||
}, |
|||
{ |
|||
"id": "CustomPreview", |
|||
"type": "object", |
|||
"hidden": true, |
|||
"properties": [ |
|||
{ "name": "header", "type": "string"}, |
|||
{ "name": "hasBody", "type": "boolean"}, |
|||
{ "name": "formatterObjectId", "$ref": "RemoteObjectId"}, |
|||
{ "name": "bindRemoteObjectFunctionId", "$ref": "RemoteObjectId" }, |
|||
{ "name": "configObjectId", "$ref": "RemoteObjectId", "optional": true } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "ObjectPreview", |
|||
"type": "object", |
|||
"hidden": true, |
|||
"description": "Object containing abbreviated remote object value.", |
|||
"properties": [ |
|||
{ "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." }, |
|||
{ "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for <code>object</code> type values only." }, |
|||
{ "name": "description", "type": "string", "optional": true, "description": "String representation of the object." }, |
|||
{ "name": "overflow", "type": "boolean", "description": "True iff some of the properties or entries of the original object did not fit." }, |
|||
{ "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "description": "List of the properties." }, |
|||
{ "name": "entries", "type": "array", "items": { "$ref": "EntryPreview" }, "optional": true, "description": "List of the entries. Specified for <code>map</code> and <code>set</code> subtype values only." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "PropertyPreview", |
|||
"type": "object", |
|||
"hidden": true, |
|||
"properties": [ |
|||
{ "name": "name", "type": "string", "description": "Property name." }, |
|||
{ "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type. Accessor means that the property itself is an accessor property." }, |
|||
{ "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." }, |
|||
{ "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." }, |
|||
{ "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "map", "set", "iterator", "generator", "error"], "description": "Object subtype hint. Specified for <code>object</code> type values only." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "EntryPreview", |
|||
"type": "object", |
|||
"hidden": true, |
|||
"properties": [ |
|||
{ "name": "key", "$ref": "ObjectPreview", "optional": true, "description": "Preview of the key. Specified for map-like collection entries." }, |
|||
{ "name": "value", "$ref": "ObjectPreview", "description": "Preview of the value." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "PropertyDescriptor", |
|||
"type": "object", |
|||
"description": "Object property descriptor.", |
|||
"properties": [ |
|||
{ "name": "name", "type": "string", "description": "Property name or symbol description." }, |
|||
{ "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." }, |
|||
{ "name": "writable", "type": "boolean", "optional": true, "description": "True if the value associated with the property may be changed (data descriptors only)." }, |
|||
{ "name": "get", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a getter for the property, or <code>undefined</code> if there is no getter (accessor descriptors only)." }, |
|||
{ "name": "set", "$ref": "RemoteObject", "optional": true, "description": "A function which serves as a setter for the property, or <code>undefined</code> if there is no setter (accessor descriptors only)." }, |
|||
{ "name": "configurable", "type": "boolean", "description": "True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." }, |
|||
{ "name": "enumerable", "type": "boolean", "description": "True if this property shows up during enumeration of the properties on the corresponding object." }, |
|||
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, |
|||
{ "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object.", "hidden": true }, |
|||
{ "name": "symbol", "$ref": "RemoteObject", "optional": true, "description": "Property symbol object, if the property is of the <code>symbol</code> type.", "hidden": true } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "InternalPropertyDescriptor", |
|||
"type": "object", |
|||
"description": "Object internal property descriptor. This property isn't normally visible in JavaScript code.", |
|||
"properties": [ |
|||
{ "name": "name", "type": "string", "description": "Conventional property name." }, |
|||
{ "name": "value", "$ref": "RemoteObject", "optional": true, "description": "The value associated with the property." } |
|||
], |
|||
"hidden": true |
|||
}, |
|||
{ |
|||
"id": "CallArgument", |
|||
"type": "object", |
|||
"description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.", |
|||
"properties": [ |
|||
{ "name": "value", "type": "any", "optional": true, "description": "Primitive value, or description string if the value can not be JSON-stringified (like NaN, Infinity, -Infinity, -0)." }, |
|||
{ "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." }, |
|||
{ "name": "type", "optional": true, "hidden": true, "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol"], "description": "Object type." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "ExecutionContextId", |
|||
"type": "integer", |
|||
"description": "Id of an execution context." |
|||
}, |
|||
{ |
|||
"id": "ExecutionContextDescription", |
|||
"type": "object", |
|||
"description": "Description of an isolated world.", |
|||
"properties": [ |
|||
{ "name": "id", "$ref": "ExecutionContextId", "description": "Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed." }, |
|||
{ "name": "isDefault", "type": "boolean", "description": "Whether context is the default page context (as opposite to e.g. context of content script).", "hidden": true }, |
|||
{ "name": "origin", "type": "string", "description": "Execution context origin.", "hidden": true}, |
|||
{ "name": "name", "type": "string", "description": "Human readable name describing given context.", "hidden": true}, |
|||
{ "name": "frameId", "type": "string", "description": "Id of the owning frame. May be an empty string if the context is not associated with a frame." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "ExceptionDetails", |
|||
"type": "object", |
|||
"description": "Detailed information on exception (or error) that was thrown during script compilation or execution.", |
|||
"properties": [ |
|||
{ "name": "text", "type": "string", "description": "Exception text." }, |
|||
{ "name": "url", "type": "string", "optional": true, "description": "URL of the message origin." }, |
|||
{ "name": "scriptId", "type": "string", "optional": true, "description": "Script ID of the message origin." }, |
|||
{ "name": "line", "type": "integer", "optional": true, "description": "Line number in the resource that generated this message." }, |
|||
{ "name": "column", "type": "integer", "optional": true, "description": "Column number in the resource that generated this message." }, |
|||
{ "name": "stack", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace for assertions and error messages." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "CallFrame", |
|||
"type": "object", |
|||
"description": "Stack entry for runtime errors and assertions.", |
|||
"properties": [ |
|||
{ "name": "functionName", "type": "string", "description": "JavaScript function name." }, |
|||
{ "name": "scriptId", "$ref": "ScriptId", "description": "JavaScript script id." }, |
|||
{ "name": "url", "type": "string", "description": "JavaScript script name or url." }, |
|||
{ "name": "lineNumber", "type": "integer", "description": "JavaScript script line number." }, |
|||
{ "name": "columnNumber", "type": "integer", "description": "JavaScript script column number." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "StackTrace", |
|||
"type": "object", |
|||
"description": "Call frames for assertions or error messages.", |
|||
"properties": [ |
|||
{ "name": "description", "type": "string", "optional": true, "description": "String label of this stack trace. For async traces this may be a name of the function that initiated the async call." }, |
|||
{ "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "JavaScript function name." }, |
|||
{ "name": "parent", "$ref": "StackTrace", "optional": true, "hidden": true, "hidden": true, "description": "Asynchronous JavaScript stack trace that preceded this stack, if available." } |
|||
] |
|||
} |
|||
], |
|||
"commands": [ |
|||
{ |
|||
"name": "evaluate", |
|||
"parameters": [ |
|||
{ "name": "expression", "type": "string", "description": "Expression to evaluate." }, |
|||
{ "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, |
|||
{ "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation.", "hidden": true }, |
|||
{ "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true }, |
|||
{ "name": "contextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page." }, |
|||
{ "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, |
|||
{ "name": "generatePreview", "type": "boolean", "optional": true, "hidden": true, "description": "Whether preview should be generated for the result." }, |
|||
{ "name": "userGesture", "type": "boolean", "optional": true, "hidden": true, "description": "Whether execution should be treated as initiated by user in the UI." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, |
|||
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, |
|||
{ "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "hidden": true, "description": "Exception details."} |
|||
], |
|||
"description": "Evaluates expression on global object." |
|||
}, |
|||
{ |
|||
"name": "callFunctionOn", |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to call function on." }, |
|||
{ "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." }, |
|||
{ "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same JavaScript world as the target object." }, |
|||
{ "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true }, |
|||
{ "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, |
|||
{ "name": "generatePreview", "type": "boolean", "optional": true, "hidden": true, "description": "Whether preview should be generated for the result." }, |
|||
{ "name": "userGesture", "type": "boolean", "optional": true, "hidden": true, "description": "Whether execution should be treated as initiated by user in the UI." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "$ref": "RemoteObject", "description": "Call result." }, |
|||
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." } |
|||
], |
|||
"description": "Calls function with given declaration on the given object. Object group of the result is inherited from the target object." |
|||
}, |
|||
{ |
|||
"name": "getProperties", |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." }, |
|||
{ "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }, |
|||
{ "name": "accessorPropertiesOnly", "optional": true, "type": "boolean", "description": "If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.", "hidden": true }, |
|||
{ "name": "generatePreview", "type": "boolean", "optional": true, "hidden": true, "description": "Whether preview should be generated for the results." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor" }, "description": "Object properties." }, |
|||
{ "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor" }, "description": "Internal object properties (only of the element itself).", "hidden": true }, |
|||
{ "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "hidden": true, "description": "Exception details."} |
|||
], |
|||
"description": "Returns properties of a given object. Object group of the result is inherited from the target object." |
|||
}, |
|||
{ |
|||
"name": "releaseObject", |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to release." } |
|||
], |
|||
"description": "Releases remote object with given id." |
|||
}, |
|||
{ |
|||
"name": "releaseObjectGroup", |
|||
"parameters": [ |
|||
{ "name": "objectGroup", "type": "string", "description": "Symbolic object group name." } |
|||
], |
|||
"description": "Releases all remote objects that belong to a given group." |
|||
}, |
|||
{ |
|||
"name": "run", |
|||
"hidden": true, |
|||
"description": "Tells inspected instance(worker or page) that it can run in case it was started paused." |
|||
}, |
|||
{ |
|||
"name": "enable", |
|||
"description": "Enables reporting of execution contexts creation by means of <code>executionContextCreated</code> event. When the reporting gets enabled the event will be sent immediately for each existing execution context." |
|||
}, |
|||
{ |
|||
"name": "disable", |
|||
"hidden": true, |
|||
"description": "Disables reporting of execution contexts creation." |
|||
}, |
|||
{ |
|||
"name": "setCustomObjectFormatterEnabled", |
|||
"parameters": [ |
|||
{ |
|||
"name": "enabled", |
|||
"type": "boolean" |
|||
} |
|||
], |
|||
"hidden": true |
|||
}, |
|||
{ |
|||
"name": "compileScript", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "expression", "type": "string", "description": "Expression to compile." }, |
|||
{ "name": "sourceURL", "type": "string", "description": "Source url to be set for the script." }, |
|||
{ "name": "persistScript", "type": "boolean", "description": "Specifies whether the compiled script should be persisted." }, |
|||
{ "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Specifies in which isolated context to perform script run. Each content script lives in an isolated context and this parameter is used to specify one of those contexts." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Id of the script." }, |
|||
{ "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} |
|||
], |
|||
"description": "Compiles expression." |
|||
}, |
|||
{ |
|||
"name": "runScript", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to run." }, |
|||
{ "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Specifies in which isolated context to perform script run. Each content script lives in an isolated context and this parameter is used to specify one of those contexts." }, |
|||
{ "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, |
|||
{ "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether script run should stop on exceptions and mute console. Overrides setPauseOnException state." }, |
|||
{ "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "$ref": "RemoteObject", "description": "Run result." }, |
|||
{ "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} |
|||
], |
|||
"description": "Runs script with given id in a given context." |
|||
} |
|||
], |
|||
"events": [ |
|||
{ |
|||
"name": "executionContextCreated", |
|||
"parameters": [ |
|||
{ "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created execution contex." } |
|||
], |
|||
"description": "Issued when new execution context is created." |
|||
}, |
|||
{ |
|||
"name": "executionContextDestroyed", |
|||
"parameters": [ |
|||
{ "name": "executionContextId", "$ref": "ExecutionContextId", "description": "Id of the destroyed context" } |
|||
], |
|||
"description": "Issued when execution context is destroyed." |
|||
}, |
|||
{ |
|||
"name": "executionContextsCleared", |
|||
"description": "Issued when all executionContexts were cleared in browser" |
|||
}, |
|||
{ |
|||
"name": "inspectRequested", |
|||
"parameters": [ |
|||
{ "name": "object", "$ref": "RemoteObject" }, |
|||
{ "name": "hints", "type": "object" } |
|||
], |
|||
"hidden": true |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"domain": "Debugger", |
|||
"description": "Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.", |
|||
"dependencies": ["Runtime"], |
|||
"types": [ |
|||
{ |
|||
"id": "BreakpointId", |
|||
"type": "string", |
|||
"description": "Breakpoint identifier." |
|||
}, |
|||
{ |
|||
"id": "CallFrameId", |
|||
"type": "string", |
|||
"description": "Call frame identifier." |
|||
}, |
|||
{ |
|||
"id": "Location", |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier as reported in the <code>Debugger.scriptParsed</code>." }, |
|||
{ "name": "lineNumber", "type": "integer", "description": "Line number in the script (0-based)." }, |
|||
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script (0-based)." } |
|||
], |
|||
"description": "Location in the source code." |
|||
}, |
|||
{ |
|||
"id": "ScriptPosition", |
|||
"hidden": true, |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "line", "type": "integer" }, |
|||
{ "name": "column", "type": "integer" } |
|||
], |
|||
"description": "Location in the source code." |
|||
}, |
|||
{ |
|||
"id": "FunctionDetails", |
|||
"hidden": true, |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "location", "$ref": "Location", "optional": true, "description": "Location of the function, none for native functions." }, |
|||
{ "name": "functionName", "type": "string", "description": "Name of the function." }, |
|||
{ "name": "isGenerator", "type": "boolean", "description": "Whether this is a generator function." }, |
|||
{ "name": "scopeChain", "type": "array", "optional": true, "items": { "$ref": "Scope" }, "description": "Scope chain for this closure." } |
|||
], |
|||
"description": "Information about the function." |
|||
}, |
|||
{ |
|||
"id": "GeneratorObjectDetails", |
|||
"hidden": true, |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "function", "$ref": "Runtime.RemoteObject", "description": "Generator function." }, |
|||
{ "name": "functionName", "type": "string", "description": "Name of the generator function." }, |
|||
{ "name": "status", "type": "string", "enum": ["running", "suspended", "closed"], "description": "Current generator object status." }, |
|||
{ "name": "location", "$ref": "Location", "optional": true, "description": "If suspended, location where generator function was suspended (e.g. location of the last 'yield'). Otherwise, location of the generator function." } |
|||
], |
|||
"description": "Information about the generator object." |
|||
}, |
|||
{ |
|||
"id": "CollectionEntry", |
|||
"hidden": true, |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "key", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Entry key of a map-like collection, otherwise not provided." }, |
|||
{ "name": "value", "$ref": "Runtime.RemoteObject", "description": "Entry value." } |
|||
], |
|||
"description": "Collection entry." |
|||
}, |
|||
{ |
|||
"id": "CallFrame", |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier. This identifier is only valid while the virtual machine is paused." }, |
|||
{ "name": "functionName", "type": "string", "description": "Name of the JavaScript function called on this call frame." }, |
|||
{ "name": "functionLocation", "$ref": "Location", "optional": true, "hidden": true, "description": "Location in the source code." }, |
|||
{ "name": "location", "$ref": "Location", "description": "Location in the source code." }, |
|||
{ "name": "scopeChain", "type": "array", "items": { "$ref": "Scope" }, "description": "Scope chain for this call frame." }, |
|||
{ "name": "this", "$ref": "Runtime.RemoteObject", "description": "<code>this</code> object for this call frame." }, |
|||
{ "name": "returnValue", "$ref": "Runtime.RemoteObject", "optional": true, "hidden": true, "description": "The value being returned, if the function is at return point." } |
|||
], |
|||
"description": "JavaScript call frame. Array of call frames form the call stack." |
|||
}, |
|||
{ |
|||
"id": "Scope", |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "block", "script"], "description": "Scope type." }, |
|||
{ "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }, |
|||
{ "name": "name", "type": "string", "optional": true, "hidden": true }, |
|||
{ "name": "startLocation", "$ref": "Location", "optional": true, "hidden": true, "description": "Location in the source code where scope starts" }, |
|||
{ "name": "endLocation", "$ref": "Location", "optional": true, "hidden": true, "description": "Location in the source code where scope ends" } |
|||
], |
|||
"description": "Scope description." |
|||
}, |
|||
{ |
|||
"id": "SetScriptSourceError", |
|||
"type": "object", |
|||
"properties": [ |
|||
{ "name": "message", "type": "string", "description": "Compiler error message" }, |
|||
{ "name": "lineNumber", "type": "integer", "description": "Compile error line number (1-based)" }, |
|||
{ "name": "columnNumber", "type": "integer", "description": "Compile error column number (1-based)" } |
|||
], |
|||
"description": "Error data for setScriptSource command. Contains uncompilable script source error.", |
|||
"hidden": true |
|||
}, |
|||
{ |
|||
"id": "SearchMatch", |
|||
"type": "object", |
|||
"description": "Search match for resource.", |
|||
"properties": [ |
|||
{ "name": "lineNumber", "type": "number", "description": "Line number in resource content." }, |
|||
{ "name": "lineContent", "type": "string", "description": "Line with match content." } |
|||
], |
|||
"hidden": true |
|||
} |
|||
], |
|||
"commands": [ |
|||
{ |
|||
"name": "enable", |
|||
"description": "Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received." |
|||
}, |
|||
{ |
|||
"name": "disable", |
|||
"description": "Disables debugger for given page." |
|||
}, |
|||
{ |
|||
"name": "setBreakpointsActive", |
|||
"parameters": [ |
|||
{ "name": "active", "type": "boolean", "description": "New value for breakpoints active state." } |
|||
], |
|||
"description": "Activates / deactivates all breakpoints on the page." |
|||
}, |
|||
{ |
|||
"name": "setSkipAllPauses", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "skipped", "type": "boolean", "description": "New value for skip pauses state." } |
|||
], |
|||
"description": "Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc)." |
|||
}, |
|||
{ |
|||
"name": "setBreakpointByUrl", |
|||
"parameters": [ |
|||
{ "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." }, |
|||
{ "name": "url", "type": "string", "optional": true, "description": "URL of the resources to set breakpoint on." }, |
|||
{ "name": "urlRegex", "type": "string", "optional": true, "description": "Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified." }, |
|||
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." }, |
|||
{ "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, |
|||
{ "name": "locations", "type": "array", "items": { "$ref": "Location" }, "description": "List of the locations this breakpoint resolved into upon addition." } |
|||
], |
|||
"description": "Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads." |
|||
}, |
|||
{ |
|||
"name": "setBreakpoint", |
|||
"parameters": [ |
|||
{ "name": "location", "$ref": "Location", "description": "Location to set breakpoint in." }, |
|||
{ "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, |
|||
{ "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." } |
|||
], |
|||
"description": "Sets JavaScript breakpoint at a given location." |
|||
}, |
|||
{ |
|||
"name": "removeBreakpoint", |
|||
"parameters": [ |
|||
{ "name": "breakpointId", "$ref": "BreakpointId" } |
|||
], |
|||
"description": "Removes JavaScript breakpoint." |
|||
}, |
|||
{ |
|||
"name": "continueToLocation", |
|||
"parameters": [ |
|||
{ "name": "location", "$ref": "Location", "description": "Location to continue to." }, |
|||
{ "name": "interstatementLocation", "type": "boolean", "optional": true, "hidden": true, "description": "Allows breakpoints at the intemediate positions inside statements." } |
|||
], |
|||
"description": "Continues execution until specific location is reached." |
|||
}, |
|||
{ |
|||
"name": "stepOver", |
|||
"description": "Steps over the statement." |
|||
}, |
|||
{ |
|||
"name": "stepInto", |
|||
"description": "Steps into the function call." |
|||
}, |
|||
{ |
|||
"name": "stepOut", |
|||
"description": "Steps out of the function call." |
|||
}, |
|||
{ |
|||
"name": "pause", |
|||
"description": "Stops on the next JavaScript statement." |
|||
}, |
|||
{ |
|||
"name": "resume", |
|||
"description": "Resumes JavaScript execution." |
|||
}, |
|||
{ |
|||
"name": "searchInContent", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to search in." }, |
|||
{ "name": "query", "type": "string", "description": "String to search for." }, |
|||
{ "name": "caseSensitive", "type": "boolean", "optional": true, "description": "If true, search is case sensitive." }, |
|||
{ "name": "isRegex", "type": "boolean", "optional": true, "description": "If true, treats string parameter as regex." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "type": "array", "items": { "$ref": "SearchMatch" }, "description": "List of search matches." } |
|||
], |
|||
"description": "Searches for given string in script content." |
|||
}, |
|||
{ |
|||
"name": "canSetScriptSource", |
|||
"returns": [ |
|||
{ "name": "result", "type": "boolean", "description": "True if <code>setScriptSource</code> is supported." } |
|||
], |
|||
"description": "Always returns true." |
|||
}, |
|||
{ |
|||
"name": "setScriptSource", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to edit." }, |
|||
{ "name": "scriptSource", "type": "string", "description": "New content of the script." }, |
|||
{ "name": "preview", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Preview mode may be used to get result description without actually modifying the code.", "hidden": true } |
|||
], |
|||
"returns": [ |
|||
{ "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame" }, "description": "New stack trace in case editing has happened while VM was stopped." }, |
|||
{ "name": "stackChanged", "type": "boolean", "optional": true, "description": "Whether current call stack was modified after applying the changes.", "hidden": true }, |
|||
{ "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any.", "hidden": true }, |
|||
{ "name": "compileError", "optional": true, "$ref": "SetScriptSourceError", "description": "Error data if any." } |
|||
], |
|||
"description": "Edits JavaScript source live." |
|||
}, |
|||
{ |
|||
"name": "restartFrame", |
|||
"parameters": [ |
|||
{ "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "New stack trace." }, |
|||
{ "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." } |
|||
], |
|||
"hidden": true, |
|||
"description": "Restarts particular call frame from the beginning." |
|||
}, |
|||
{ |
|||
"name": "getScriptSource", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to get source for." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "scriptSource", "type": "string", "description": "Script source." } |
|||
], |
|||
"description": "Returns source for the script with given id." |
|||
}, |
|||
{ |
|||
"name": "getFunctionDetails", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "functionId", "$ref": "Runtime.RemoteObjectId", "description": "Id of the function to get details for." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "details", "$ref": "FunctionDetails", "description": "Information about the function." } |
|||
], |
|||
"description": "Returns detailed information on given function." |
|||
}, |
|||
{ |
|||
"name": "getGeneratorObjectDetails", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Id of the generator object to get details for." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "details", "$ref": "GeneratorObjectDetails", "description": "Information about the generator object." } |
|||
], |
|||
"description": "Returns detailed information on given generator object." |
|||
}, |
|||
{ |
|||
"name": "getCollectionEntries", |
|||
"hidden": true, |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Id of the collection to get entries for." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "entries", "type": "array", "items": { "$ref": "CollectionEntry" }, "description": "Array of collection entries." } |
|||
], |
|||
"description": "Returns entries of given collection." |
|||
}, |
|||
{ |
|||
"name": "setPauseOnExceptions", |
|||
"parameters": [ |
|||
{ "name": "state", "type": "string", "enum": ["none", "uncaught", "all"], "description": "Pause on exceptions mode." } |
|||
], |
|||
"description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is <code>none</code>." |
|||
}, |
|||
{ |
|||
"name": "evaluateOnCallFrame", |
|||
"parameters": [ |
|||
{ "name": "callFrameId", "$ref": "CallFrameId", "description": "Call frame identifier to evaluate on." }, |
|||
{ "name": "expression", "type": "string", "description": "Expression to evaluate." }, |
|||
{ "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>)." }, |
|||
{ "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false.", "hidden": true }, |
|||
{ "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "hidden": true }, |
|||
{ "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, |
|||
{ "name": "generatePreview", "type": "boolean", "optional": true, "hidden": true, "description": "Whether preview should be generated for the result." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, |
|||
{ "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, |
|||
{ "name": "exceptionDetails", "$ref": "Runtime.ExceptionDetails", "optional": true, "hidden": true, "description": "Exception details."} |
|||
], |
|||
"description": "Evaluates expression on a given call frame." |
|||
}, |
|||
{ |
|||
"name": "setVariableValue", |
|||
"parameters": [ |
|||
{ "name": "scopeNumber", "type": "integer", "description": "0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually." }, |
|||
{ "name": "variableName", "type": "string", "description": "Variable name." }, |
|||
{ "name": "newValue", "$ref": "Runtime.CallArgument", "description": "New variable value." }, |
|||
{ "name": "callFrameId", "$ref": "CallFrameId", "description": "Id of callframe that holds variable." } |
|||
], |
|||
"hidden": true, |
|||
"description": "Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually." |
|||
}, |
|||
{ |
|||
"name": "getBacktrace", |
|||
"returns": [ |
|||
{ "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, |
|||
{ "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." } |
|||
], |
|||
"hidden": true, |
|||
"description": "Returns call stack including variables changed since VM was paused. VM must be paused." |
|||
}, |
|||
{ |
|||
"name": "setAsyncCallStackDepth", |
|||
"parameters": [ |
|||
{ "name": "maxDepth", "type": "integer", "description": "Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default)." } |
|||
], |
|||
"hidden": true, |
|||
"description": "Enables or disables async call stacks tracking." |
|||
}, |
|||
{ |
|||
"name": "setBlackboxPatterns", |
|||
"parameters": [ |
|||
{ "name": "patterns", "type": "array", "items": { "type": "string" }, "description": "Array of regexps that will be used to check script url for blackbox state." } |
|||
], |
|||
"hidden": true, |
|||
"description": "Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful." |
|||
}, |
|||
{ |
|||
"name": "setBlackboxedRanges", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script." }, |
|||
{ "name": "positions", "type": "array", "items": { "$ref": "ScriptPosition" } } |
|||
], |
|||
"hidden": true, |
|||
"description": "Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted." |
|||
} |
|||
], |
|||
"events": [ |
|||
{ |
|||
"name": "scriptParsed", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, |
|||
{ "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, |
|||
{ "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, |
|||
{ "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, |
|||
{ "name": "endLine", "type": "integer", "description": "Last line of the script." }, |
|||
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, |
|||
{ "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "hidden": true }, |
|||
{ "name": "hash", "type": "string", "hidden": true, "description": "Content hash of the script."}, |
|||
{ "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }, |
|||
{ "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "hidden": true }, |
|||
{ "name": "isLiveEdit", "type": "boolean", "optional": true, "description": "True, if this script is generated as a result of the live edit operation.", "hidden": true }, |
|||
{ "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, |
|||
{ "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "hidden": true }, |
|||
{ "name": "deprecatedCommentWasUsed", "type": "boolean", "optional": true, "hidden": true, "description": "True, if '//@ sourceURL' or '//@ sourceMappingURL' was used."} |
|||
], |
|||
"description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger." |
|||
}, |
|||
{ |
|||
"name": "scriptFailedToParse", |
|||
"parameters": [ |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Identifier of the script parsed." }, |
|||
{ "name": "url", "type": "string", "description": "URL or name of the script parsed (if any)." }, |
|||
{ "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource with given URL (for script tags)." }, |
|||
{ "name": "startColumn", "type": "integer", "description": "Column offset of the script within the resource with given URL." }, |
|||
{ "name": "endLine", "type": "integer", "description": "Last line of the script." }, |
|||
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." }, |
|||
{ "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "hidden": true }, |
|||
{ "name": "hash", "type": "string", "hidden": true, "description": "Content hash of the script."}, |
|||
{ "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }, |
|||
{ "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "hidden": true }, |
|||
{ "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, |
|||
{ "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "hidden": true }, |
|||
{ "name": "deprecatedCommentWasUsed", "type": "boolean", "optional": true, "hidden": true, "description": "True, if '//@ sourceURL' or '//@ sourceMappingURL' was used."} |
|||
], |
|||
"description": "Fired when virtual machine fails to parse the script." |
|||
}, |
|||
{ |
|||
"name": "breakpointResolved", |
|||
"parameters": [ |
|||
{ "name": "breakpointId", "$ref": "BreakpointId", "description": "Breakpoint unique identifier." }, |
|||
{ "name": "location", "$ref": "Location", "description": "Actual breakpoint location." } |
|||
], |
|||
"description": "Fired when breakpoint is resolved to an actual script and location." |
|||
}, |
|||
{ |
|||
"name": "paused", |
|||
"parameters": [ |
|||
{ "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, |
|||
{ "name": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "CSPViolation", "debugCommand", "promiseRejection", "other" ], "description": "Pause reason." }, |
|||
{ "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }, |
|||
{ "name": "hitBreakpoints", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Hit breakpoints IDs", "hidden": true }, |
|||
{ "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any.", "hidden": true } |
|||
], |
|||
"description": "Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria." |
|||
}, |
|||
{ |
|||
"name": "resumed", |
|||
"description": "Fired when the virtual machine resumed execution." |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"domain": "Profiler", |
|||
"dependencies": ["Runtime", "Debugger"], |
|||
"hidden": true, |
|||
"types": [ |
|||
{ |
|||
"id": "CPUProfileNode", |
|||
"type": "object", |
|||
"description": "CPU Profile node. Holds callsite information, execution statistics and child nodes.", |
|||
"properties": [ |
|||
{ "name": "functionName", "type": "string", "description": "Function name." }, |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier." }, |
|||
{ "name": "url", "type": "string", "description": "URL." }, |
|||
{ "name": "lineNumber", "type": "integer", "description": "1-based line number of the function start position." }, |
|||
{ "name": "columnNumber", "type": "integer", "description": "1-based column number of the function start position." }, |
|||
{ "name": "hitCount", "type": "integer", "description": "Number of samples where this node was on top of the call stack." }, |
|||
{ "name": "callUID", "type": "number", "description": "Call UID." }, |
|||
{ "name": "children", "type": "array", "items": { "$ref": "CPUProfileNode" }, "description": "Child nodes." }, |
|||
{ "name": "deoptReason", "type": "string", "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."}, |
|||
{ "name": "id", "type": "integer", "description": "Unique id of the node." }, |
|||
{ "name": "positionTicks", "type": "array", "items": { "$ref": "PositionTickInfo" }, "description": "An array of source position ticks." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "CPUProfile", |
|||
"type": "object", |
|||
"description": "Profile.", |
|||
"properties": [ |
|||
{ "name": "head", "$ref": "CPUProfileNode" }, |
|||
{ "name": "startTime", "type": "number", "description": "Profiling start time in seconds." }, |
|||
{ "name": "endTime", "type": "number", "description": "Profiling end time in seconds." }, |
|||
{ "name": "samples", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Ids of samples top nodes." }, |
|||
{ "name": "timestamps", "optional": true, "type": "array", "items": { "type": "number" }, "description": "Timestamps of the samples in microseconds." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "PositionTickInfo", |
|||
"type": "object", |
|||
"description": "Specifies a number of samples attributed to a certain source position.", |
|||
"properties": [ |
|||
{ "name": "line", "type": "integer", "description": "Source line number (1-based)." }, |
|||
{ "name": "ticks", "type": "integer", "description": "Number of samples attributed to the source line." } |
|||
] |
|||
} |
|||
], |
|||
"commands": [ |
|||
{ |
|||
"name": "enable" |
|||
}, |
|||
{ |
|||
"name": "disable" |
|||
}, |
|||
{ |
|||
"name": "setSamplingInterval", |
|||
"parameters": [ |
|||
{ "name": "interval", "type": "integer", "description": "New sampling interval in microseconds." } |
|||
], |
|||
"description": "Changes CPU profiler sampling interval. Must be called before CPU profiles recording started." |
|||
}, |
|||
{ |
|||
"name": "start" |
|||
}, |
|||
{ |
|||
"name": "stop", |
|||
"returns": [ |
|||
{ "name": "profile", "$ref": "CPUProfile", "description": "Recorded profile." } |
|||
] |
|||
} |
|||
], |
|||
"events": [ |
|||
{ |
|||
"name": "consoleProfileStarted", |
|||
"parameters": [ |
|||
{ "name": "id", "type": "string" }, |
|||
{ "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profile()." }, |
|||
{ "name": "title", "type": "string", "optional": true, "description": "Profile title passed as argument to console.profile()." } |
|||
|
|||
], |
|||
"description": "Sent when new profile recodring is started using console.profile() call." |
|||
}, |
|||
{ |
|||
"name": "consoleProfileFinished", |
|||
"parameters": [ |
|||
{ "name": "id", "type": "string" }, |
|||
{ "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profileEnd()." }, |
|||
{ "name": "profile", "$ref": "CPUProfile" }, |
|||
{ "name": "title", "type": "string", "optional": true, "description": "Profile title passed as argunet to console.profile()." } |
|||
] |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
"domain": "HeapProfiler", |
|||
"dependencies": ["Runtime"], |
|||
"hidden": true, |
|||
"types": [ |
|||
{ |
|||
"id": "HeapSnapshotObjectId", |
|||
"type": "string", |
|||
"description": "Heap snapshot object id." |
|||
}, |
|||
{ |
|||
"id": "SamplingHeapProfileNode", |
|||
"type": "object", |
|||
"description": "Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes.", |
|||
"properties": [ |
|||
{ "name": "functionName", "type": "string", "description": "Function name." }, |
|||
{ "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Script identifier." }, |
|||
{ "name": "url", "type": "string", "description": "URL." }, |
|||
{ "name": "lineNumber", "type": "integer", "description": "1-based line number of the function start position." }, |
|||
{ "name": "columnNumber", "type": "integer", "description": "1-based column number of the function start position." }, |
|||
{ "name": "selfSize", "type": "number", "description": "Allocations size in bytes for the node excluding children." }, |
|||
{ "name": "children", "type": "array", "items": { "$ref": "SamplingHeapProfileNode" }, "description": "Child nodes." } |
|||
] |
|||
}, |
|||
{ |
|||
"id": "SamplingHeapProfile", |
|||
"type": "object", |
|||
"description": "Profile.", |
|||
"properties": [ |
|||
{ "name": "head", "$ref": "SamplingHeapProfileNode" } |
|||
] |
|||
} |
|||
], |
|||
"commands": [ |
|||
{ |
|||
"name": "enable" |
|||
}, |
|||
{ |
|||
"name": "disable" |
|||
}, |
|||
{ |
|||
"name": "startTrackingHeapObjects", |
|||
"parameters": [ |
|||
{ "name": "trackAllocations", "type": "boolean", "optional": true } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "stopTrackingHeapObjects", |
|||
"parameters": [ |
|||
{ "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped." } |
|||
] |
|||
|
|||
}, |
|||
{ |
|||
"name": "takeHeapSnapshot", |
|||
"parameters": [ |
|||
{ "name": "reportProgress", "type": "boolean", "optional": true, "description": "If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken." } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "collectGarbage" |
|||
}, |
|||
{ |
|||
"name": "getObjectByHeapObjectId", |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "HeapSnapshotObjectId" }, |
|||
{ "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "addInspectedHeapObject", |
|||
"parameters": [ |
|||
{ "name": "heapObjectId", "$ref": "HeapSnapshotObjectId", "description": "Heap snapshot object id to be accessible by means of $x command line API." } |
|||
], |
|||
"description": "Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions)." |
|||
}, |
|||
{ |
|||
"name": "getHeapObjectId", |
|||
"parameters": [ |
|||
{ "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Identifier of the object to get heap object id for." } |
|||
], |
|||
"returns": [ |
|||
{ "name": "heapSnapshotObjectId", "$ref": "HeapSnapshotObjectId", "description": "Id of the heap snapshot object corresponding to the passed remote object id." } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "startSampling", |
|||
"parameters": [ |
|||
{ "name": "samplingInterval", "type": "number", "optional": true, "description": "Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes." } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "stopSampling", |
|||
"returns": [ |
|||
{ "name": "profile", "$ref": "SamplingHeapProfile", "description": "Recorded sampling heap profile." } |
|||
] |
|||
} |
|||
], |
|||
"events": [ |
|||
{ |
|||
"name": "addHeapSnapshotChunk", |
|||
"parameters": [ |
|||
{ "name": "chunk", "type": "string" } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "resetProfiles" |
|||
}, |
|||
{ |
|||
"name": "reportHeapSnapshotProgress", |
|||
"parameters": [ |
|||
{ "name": "done", "type": "integer" }, |
|||
{ "name": "total", "type": "integer" }, |
|||
{ "name": "finished", "type": "boolean", "optional": true } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "lastSeenObjectId", |
|||
"description": "If heap objects tracking has been started then backend regulary sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.", |
|||
"parameters": [ |
|||
{ "name": "lastSeenObjectId", "type": "integer" }, |
|||
{ "name": "timestamp", "type": "number" } |
|||
] |
|||
}, |
|||
{ |
|||
"name": "heapStatsUpdate", |
|||
"description": "If heap objects tracking has been started then backend may send update for one or more fragments", |
|||
"parameters": [ |
|||
{ "name": "statsUpdate", "type": "array", "items": { "type": "integer" }, "description": "An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment."} |
|||
] |
|||
} |
|||
] |
|||
}] |
|||
} |
@ -1,24 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef V8DebuggerAgent_h |
|||
#define V8DebuggerAgent_h |
|||
|
|||
#include "platform/PlatformExport.h" |
|||
#include "platform/inspector_protocol/Dispatcher.h" |
|||
#include "platform/v8_inspector/public/V8Debugger.h" |
|||
|
|||
namespace blink { |
|||
|
|||
class V8RuntimeAgent; |
|||
|
|||
class PLATFORM_EXPORT V8DebuggerAgent : public protocol::Backend::Debugger, public V8Debugger::Agent<protocol::Frontend::Debugger> { |
|||
public: |
|||
virtual ~V8DebuggerAgent() { } |
|||
}; |
|||
|
|||
} // namespace blink
|
|||
|
|||
|
|||
#endif // V8DebuggerAgent_h
|
@ -1,36 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef V8EventListenerInfo_h |
|||
#define V8EventListenerInfo_h |
|||
|
|||
#include "platform/inspector_protocol/Collections.h" |
|||
#include "platform/inspector_protocol/String16.h" |
|||
|
|||
#include <v8.h> |
|||
|
|||
namespace blink { |
|||
|
|||
class V8EventListenerInfo { |
|||
public: |
|||
V8EventListenerInfo(const String16& eventType, bool useCapture, bool passive, v8::Local<v8::Object> handler) |
|||
: eventType(eventType) |
|||
, useCapture(useCapture) |
|||
, passive(passive) |
|||
, handler(handler) |
|||
{ |
|||
} |
|||
|
|||
const String16 eventType; |
|||
bool useCapture; |
|||
bool passive; |
|||
v8::Local<v8::Object> handler; |
|||
|
|||
}; |
|||
|
|||
using V8EventListenerInfoList = protocol::Vector<V8EventListenerInfo>; |
|||
|
|||
} // namespace blink
|
|||
|
|||
#endif // V8EventListenerInfo_h
|
@ -1,23 +0,0 @@ |
|||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef V8HeapProfilerAgent_h |
|||
#define V8HeapProfilerAgent_h |
|||
|
|||
#include "platform/PlatformExport.h" |
|||
#include "platform/inspector_protocol/Dispatcher.h" |
|||
#include "platform/v8_inspector/public/V8Debugger.h" |
|||
|
|||
namespace blink { |
|||
|
|||
class V8RuntimeAgent; |
|||
|
|||
class PLATFORM_EXPORT V8HeapProfilerAgent : public protocol::Backend::HeapProfiler, public V8Debugger::Agent<protocol::Frontend::HeapProfiler> { |
|||
public: |
|||
virtual ~V8HeapProfilerAgent() { } |
|||
}; |
|||
|
|||
} // namespace blink
|
|||
|
|||
#endif // !defined(V8HeapProfilerAgent_h)
|
@ -1,22 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef V8ProfilerAgent_h |
|||
#define V8ProfilerAgent_h |
|||
|
|||
#include "platform/PlatformExport.h" |
|||
#include "platform/inspector_protocol/Dispatcher.h" |
|||
#include "platform/v8_inspector/public/V8Debugger.h" |
|||
|
|||
namespace blink { |
|||
|
|||
class PLATFORM_EXPORT V8ProfilerAgent : public protocol::Backend::Profiler, public V8Debugger::Agent<protocol::Frontend::Profiler> { |
|||
public: |
|||
virtual ~V8ProfilerAgent() { } |
|||
}; |
|||
|
|||
} // namespace blink
|
|||
|
|||
|
|||
#endif // !defined(V8ProfilerAgent_h)
|
@ -1,23 +0,0 @@ |
|||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
|||
// found in the LICENSE file.
|
|||
|
|||
#ifndef V8RuntimeAgent_h |
|||
#define V8RuntimeAgent_h |
|||
|
|||
#include "platform/PlatformExport.h" |
|||
#include "platform/inspector_protocol/Dispatcher.h" |
|||
#include "platform/v8_inspector/public/V8Debugger.h" |
|||
|
|||
namespace blink { |
|||
|
|||
class InjectedScriptManager; |
|||
|
|||
class PLATFORM_EXPORT V8RuntimeAgent : public protocol::Backend::Runtime, public V8Debugger::Agent<protocol::Frontend::Runtime> { |
|||
public: |
|||
virtual ~V8RuntimeAgent() { } |
|||
}; |
|||
|
|||
} // namespace blink
|
|||
|
|||
#endif // V8RuntimeAgent_h
|
@ -1,35 +0,0 @@ |
|||
# Copyright 2016 The Chromium Authors. All rights reserved. |
|||
# Use of this source code is governed by a BSD-style license that can be |
|||
# found in the LICENSE file. |
|||
|
|||
{ |
|||
'includes': [ |
|||
'v8_inspector.gypi', |
|||
], |
|||
|
|||
'targets': [ |
|||
{ |
|||
'target_name': 'v8_inspector', |
|||
'type': '<(component)', |
|||
|
|||
'dependencies': [ |
|||
'platform/inspector_protocol/protocol.gyp:protocol_sources', |
|||
'platform/v8_inspector/v8_inspector.gyp:inspector_injected_script', |
|||
'platform/v8_inspector/v8_inspector.gyp:inspector_debugger_script', |
|||
], |
|||
'defines': [ |
|||
'V8_INSPECTOR_USE_STL=1' |
|||
], |
|||
'include_dirs': [ |
|||
'.', |
|||
'deps/wtf', |
|||
'../v8/include', |
|||
'../v8', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink', |
|||
], |
|||
'sources': [ |
|||
'<@(v8_inspector_files)', |
|||
], |
|||
}, |
|||
] # end targets |
|||
} |
@ -1,94 +0,0 @@ |
|||
# Copyright 2016 The Chromium Authors. All rights reserved. |
|||
# Use of this source code is governed by a BSD-style license that can be |
|||
# found in the LICENSE file. |
|||
|
|||
{ |
|||
'variables': { |
|||
'v8_inspector_files': [ |
|||
|
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/Backend.h', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/Dispatcher.cpp', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/Dispatcher.h', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/Frontend.cpp', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/Frontend.h', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/TypeBuilder.cpp', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/inspector_protocol/TypeBuilder.h', |
|||
'platform/v8_inspector/public/V8Inspector.cpp', |
|||
'platform/v8_inspector/public/V8Inspector.h', |
|||
|
|||
'platform/inspector_protocol/Allocator.h', |
|||
'platform/inspector_protocol/Array.h', |
|||
'platform/inspector_protocol/Collections.h', |
|||
'platform/inspector_protocol/CollectionsSTL.h', |
|||
'platform/inspector_protocol/ErrorSupport.cpp', |
|||
'platform/inspector_protocol/ErrorSupport.h', |
|||
'platform/inspector_protocol/Maybe.h', |
|||
'platform/inspector_protocol/Parser.cpp', |
|||
'platform/inspector_protocol/Parser.h', |
|||
'platform/inspector_protocol/FrontendChannel.h', |
|||
'platform/inspector_protocol/String16.h', |
|||
'platform/inspector_protocol/String16STL.cpp', |
|||
'platform/inspector_protocol/String16STL.h', |
|||
'platform/inspector_protocol/Values.cpp', |
|||
'platform/inspector_protocol/Values.h', |
|||
'platform/inspector_protocol/ValueConversions.cpp', |
|||
'platform/inspector_protocol/ValueConversions.h', |
|||
'platform/v8_inspector/Atomics.h', |
|||
'platform/v8_inspector/InspectorWrapper.cpp', |
|||
'platform/v8_inspector/InspectorWrapper.h', |
|||
'platform/v8_inspector/IgnoreExceptionsScope.h', |
|||
'platform/v8_inspector/InjectedScript.cpp', |
|||
'platform/v8_inspector/InjectedScript.h', |
|||
'platform/v8_inspector/InjectedScriptNative.cpp', |
|||
'platform/v8_inspector/InjectedScriptNative.h', |
|||
'platform/v8_inspector/InspectedContext.cpp', |
|||
'platform/v8_inspector/InspectedContext.h', |
|||
'platform/v8_inspector/JavaScriptCallFrame.cpp', |
|||
'platform/v8_inspector/JavaScriptCallFrame.h', |
|||
'platform/v8_inspector/MuteConsoleScope.h', |
|||
'platform/v8_inspector/ScriptBreakpoint.h', |
|||
'platform/v8_inspector/RemoteObjectId.cpp', |
|||
'platform/v8_inspector/RemoteObjectId.h', |
|||
'platform/v8_inspector/V8Console.cpp', |
|||
'platform/v8_inspector/V8Console.h', |
|||
'platform/v8_inspector/V8DebuggerAgentImpl.cpp', |
|||
'platform/v8_inspector/V8DebuggerAgentImpl.h', |
|||
'platform/v8_inspector/V8DebuggerImpl.cpp', |
|||
'platform/v8_inspector/V8DebuggerImpl.h', |
|||
'platform/v8_inspector/V8DebuggerScript.cpp', |
|||
'platform/v8_inspector/V8DebuggerScript.h', |
|||
'platform/v8_inspector/V8FunctionCall.cpp', |
|||
'platform/v8_inspector/V8FunctionCall.h', |
|||
'platform/v8_inspector/V8HeapProfilerAgentImpl.cpp', |
|||
'platform/v8_inspector/V8HeapProfilerAgentImpl.h', |
|||
'platform/v8_inspector/V8InjectedScriptHost.cpp', |
|||
'platform/v8_inspector/V8InjectedScriptHost.h', |
|||
'platform/v8_inspector/V8InspectorSessionImpl.cpp', |
|||
'platform/v8_inspector/V8InspectorSessionImpl.h', |
|||
'platform/v8_inspector/V8ProfilerAgentImpl.cpp', |
|||
'platform/v8_inspector/V8ProfilerAgentImpl.h', |
|||
'platform/v8_inspector/V8Regex.cpp', |
|||
'platform/v8_inspector/V8Regex.h', |
|||
'platform/v8_inspector/V8RuntimeAgentImpl.cpp', |
|||
'platform/v8_inspector/V8RuntimeAgentImpl.h', |
|||
'platform/v8_inspector/V8StackTraceImpl.cpp', |
|||
'platform/v8_inspector/V8StackTraceImpl.h', |
|||
'platform/v8_inspector/V8StringUtil.cpp', |
|||
'platform/v8_inspector/V8StringUtil.h', |
|||
'platform/v8_inspector/public/V8EventListenerInfo.h', |
|||
'platform/v8_inspector/public/V8ContentSearchUtil.h', |
|||
'platform/v8_inspector/public/V8ContextInfo.h', |
|||
'platform/v8_inspector/public/V8Debugger.h', |
|||
'platform/v8_inspector/public/V8DebuggerAgent.h', |
|||
'platform/v8_inspector/public/V8DebuggerClient.h', |
|||
'platform/v8_inspector/public/V8HeapProfilerAgent.h', |
|||
'platform/v8_inspector/public/V8InspectorSession.h', |
|||
'platform/v8_inspector/public/V8ProfilerAgent.h', |
|||
'platform/v8_inspector/public/V8RuntimeAgent.h', |
|||
'platform/v8_inspector/public/V8StackTrace.h', |
|||
'platform/v8_inspector/public/V8ToProtocolValue.h', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/v8_inspector/DebuggerScript.h', |
|||
'<(SHARED_INTERMEDIATE_DIR)/blink/platform/v8_inspector/InjectedScriptSource.h', |
|||
], |
|||
} |
|||
} |
Loading…
Reference in new issue