summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/inspector
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-05-30 12:48:17 +0200
commit881da28418d380042aa95a97f0cbd42560a64f7c (patch)
treea794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/inspector
parent7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff)
parent0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff)
downloadqtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/inspector')
-rw-r--r--Source/JavaScriptCore/inspector/ConsoleMessage.cpp285
-rw-r--r--Source/JavaScriptCore/inspector/ConsoleMessage.h97
-rw-r--r--Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp202
-rw-r--r--Source/JavaScriptCore/inspector/ContentSearchUtilities.h57
-rw-r--r--Source/JavaScriptCore/inspector/EventLoop.cpp71
-rw-r--r--Source/JavaScriptCore/inspector/EventLoop.h58
-rw-r--r--Source/JavaScriptCore/inspector/IdentifiersFactory.cpp62
-rw-r--r--Source/JavaScriptCore/inspector/IdentifiersFactory.h47
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScript.cpp316
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScript.h83
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptBase.cpp151
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptBase.h78
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptHost.cpp59
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptHost.h53
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptManager.cpp198
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptManager.h86
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptModule.cpp83
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptModule.h64
-rw-r--r--Source/JavaScriptCore/inspector/InjectedScriptSource.js1419
-rw-r--r--Source/JavaScriptCore/inspector/InspectorAgentBase.h87
-rw-r--r--Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp73
-rw-r--r--Source/JavaScriptCore/inspector/InspectorAgentRegistry.h70
-rw-r--r--Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp339
-rw-r--r--Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h122
-rw-r--r--Source/JavaScriptCore/inspector/InspectorEnvironment.h62
-rw-r--r--Source/JavaScriptCore/inspector/InspectorFrontendChannel.h51
-rw-r--r--Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp101
-rw-r--r--Source/JavaScriptCore/inspector/InspectorFrontendRouter.h59
-rw-r--r--Source/JavaScriptCore/inspector/InspectorProtocolTypes.h183
-rw-r--r--Source/JavaScriptCore/inspector/InspectorValues.cpp888
-rw-r--r--Source/JavaScriptCore/inspector/InspectorValues.h411
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp109
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h62
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp312
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h135
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp66
-rw-r--r--Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h60
-rw-r--r--Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp476
-rw-r--r--Source/JavaScriptCore/inspector/JSInjectedScriptHost.h85
-rw-r--r--Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp202
-rw-r--r--Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h62
-rw-r--r--Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp209
-rw-r--r--Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h97
-rw-r--r--Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp194
-rw-r--r--Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h62
-rw-r--r--Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp52
-rw-r--r--Source/JavaScriptCore/inspector/JavaScriptCallFrame.h69
-rw-r--r--Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.cpp52
-rw-r--r--Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.h48
-rw-r--r--Source/JavaScriptCore/inspector/ScriptArguments.cpp105
-rw-r--r--Source/JavaScriptCore/inspector/ScriptArguments.h74
-rw-r--r--Source/JavaScriptCore/inspector/ScriptBreakpoint.h94
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallFrame.cpp69
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallFrame.h64
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallStack.cpp117
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallStack.h72
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp179
-rw-r--r--Source/JavaScriptCore/inspector/ScriptCallStackFactory.h56
-rw-r--r--Source/JavaScriptCore/inspector/ScriptDebugListener.h72
-rw-r--r--Source/JavaScriptCore/inspector/ScriptDebugServer.cpp371
-rw-r--r--Source/JavaScriptCore/inspector/ScriptDebugServer.h115
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp145
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorAgent.h84
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp215
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h93
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp835
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h175
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp139
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h68
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp360
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h100
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp222
-rw-r--r--Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h83
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp46
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h48
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp63
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h58
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp61
-rw-r--r--Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h58
-rw-r--r--Source/JavaScriptCore/inspector/augmentable/AlternateDispatchableAgent.h73
-rw-r--r--Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h57
-rw-r--r--Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorControllerClient.h44
-rw-r--r--Source/JavaScriptCore/inspector/protocol/ApplicationCache.json87
-rw-r--r--Source/JavaScriptCore/inspector/protocol/CSS.json457
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Console.json89
-rw-r--r--Source/JavaScriptCore/inspector/protocol/DOM.json556
-rw-r--r--Source/JavaScriptCore/inspector/protocol/DOMDebugger.json73
-rw-r--r--Source/JavaScriptCore/inspector/protocol/DOMStorage.json88
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Database.json71
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Debugger.json337
-rw-r--r--Source/JavaScriptCore/inspector/protocol/GenericTypes.json15
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Heap.json39
-rw-r--r--Source/JavaScriptCore/inspector/protocol/IndexedDB.json145
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Inspector.json51
-rw-r--r--Source/JavaScriptCore/inspector/protocol/LayerTree.json114
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Memory.json54
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Network.json314
-rw-r--r--Source/JavaScriptCore/inspector/protocol/OverlayTypes.json129
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Page.json357
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Replay.json264
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Runtime.json353
-rw-r--r--Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json92
-rw-r--r--Source/JavaScriptCore/inspector/protocol/Timeline.json115
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp47
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h59
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h98
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp52
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h72
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp72
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h78
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteInspector.h157
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h105
-rw-r--r--Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h80
-rw-r--r--Source/JavaScriptCore/inspector/scripts/codegen/__init__.py24
-rw-r--r--Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py314
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py265
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py93
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py208
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py314
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py116
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py124
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py352
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py183
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py137
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py106
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py194
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py87
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py150
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py155
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py154
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py229
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py75
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py160
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/generator.py241
-rw-r--r--Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py61
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/models.py591
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/objc_generator.py523
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py156
-rwxr-xr-xSource/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py211
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json109
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json85
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json54
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/enum-values.json35
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json59
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result1634
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result1489
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result1356
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result1177
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result1104
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-availability.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error1
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result1164
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result841
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result984
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result826
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result893
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result925
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result1736
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result1372
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-availability.json9
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json16
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json16
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json12
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json15
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json15
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json10
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json18
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-type-member.json16
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json18
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json16
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json13
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json10
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json12
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json15
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json36
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json22
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json31
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json10
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json50
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json15
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json83
-rw-r--r--Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json51
195 files changed, 38892 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp
new file mode 100644
index 000000000..133893fb0
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2007, 2008, 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2009, 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ConsoleMessage.h"
+
+#include "IdentifiersFactory.h"
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InspectorValues.h"
+#include "ScriptArguments.h"
+#include "ScriptCallFrame.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+#include "ScriptValue.h"
+
+namespace Inspector {
+
+ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned long requestIdentifier)
+ : m_source(source)
+ , m_type(type)
+ , m_level(level)
+ , m_message(message)
+ , m_url()
+ , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
+{
+}
+
+ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, const String& url, unsigned line, unsigned column, JSC::ExecState* state, unsigned long requestIdentifier)
+ : m_source(source)
+ , m_type(type)
+ , m_level(level)
+ , m_message(message)
+ , m_url(url)
+ , m_line(line)
+ , m_column(column)
+ , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
+{
+ autogenerateMetadata(state);
+}
+
+ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptCallStack> callStack, unsigned long requestIdentifier)
+ : m_source(source)
+ , m_type(type)
+ , m_level(level)
+ , m_message(message)
+ , m_url()
+ , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
+{
+ m_callStack = callStack;
+
+ const ScriptCallFrame* frame = m_callStack ? m_callStack->firstNonNativeCallFrame() : nullptr;
+ if (frame) {
+ m_url = frame->sourceURL();
+ m_line = frame->lineNumber();
+ m_column = frame->columnNumber();
+ }
+}
+
+ConsoleMessage::ConsoleMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, PassRefPtr<ScriptArguments> arguments, JSC::ExecState* state, unsigned long requestIdentifier)
+ : m_source(source)
+ , m_type(type)
+ , m_level(level)
+ , m_message(message)
+ , m_arguments(arguments)
+ , m_url()
+ , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
+{
+ autogenerateMetadata(state);
+}
+
+ConsoleMessage::~ConsoleMessage()
+{
+}
+
+void ConsoleMessage::autogenerateMetadata(JSC::ExecState* state)
+{
+ if (!state)
+ return;
+
+ if (m_type == MessageType::EndGroup)
+ return;
+
+ // FIXME: Should this really be using "for console" in the generic ConsoleMessage autogeneration? This can skip the first frame.
+ m_callStack = createScriptCallStackForConsole(state, ScriptCallStack::maxCallStackSizeToCapture);
+
+ if (const ScriptCallFrame* frame = m_callStack->firstNonNativeCallFrame()) {
+ m_url = frame->sourceURL();
+ m_line = frame->lineNumber();
+ m_column = frame->columnNumber();
+ return;
+ }
+}
+
+static Inspector::Protocol::Console::ConsoleMessage::Source messageSourceValue(MessageSource source)
+{
+ switch (source) {
+ case MessageSource::XML: return Inspector::Protocol::Console::ConsoleMessage::Source::XML;
+ case MessageSource::JS: return Inspector::Protocol::Console::ConsoleMessage::Source::Javascript;
+ case MessageSource::Network: return Inspector::Protocol::Console::ConsoleMessage::Source::Network;
+ case MessageSource::ConsoleAPI: return Inspector::Protocol::Console::ConsoleMessage::Source::ConsoleAPI;
+ case MessageSource::Storage: return Inspector::Protocol::Console::ConsoleMessage::Source::Storage;
+ case MessageSource::AppCache: return Inspector::Protocol::Console::ConsoleMessage::Source::Appcache;
+ case MessageSource::Rendering: return Inspector::Protocol::Console::ConsoleMessage::Source::Rendering;
+ case MessageSource::CSS: return Inspector::Protocol::Console::ConsoleMessage::Source::CSS;
+ case MessageSource::Security: return Inspector::Protocol::Console::ConsoleMessage::Source::Security;
+ case MessageSource::ContentBlocker: return Inspector::Protocol::Console::ConsoleMessage::Source::ContentBlocker;
+ case MessageSource::Other: return Inspector::Protocol::Console::ConsoleMessage::Source::Other;
+ }
+ return Inspector::Protocol::Console::ConsoleMessage::Source::Other;
+}
+
+static Inspector::Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)
+{
+ switch (type) {
+ case MessageType::Log: return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
+ case MessageType::Clear: return Inspector::Protocol::Console::ConsoleMessage::Type::Clear;
+ case MessageType::Dir: return Inspector::Protocol::Console::ConsoleMessage::Type::Dir;
+ case MessageType::DirXML: return Inspector::Protocol::Console::ConsoleMessage::Type::DirXML;
+ case MessageType::Table: return Inspector::Protocol::Console::ConsoleMessage::Type::Table;
+ case MessageType::Trace: return Inspector::Protocol::Console::ConsoleMessage::Type::Trace;
+ case MessageType::StartGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroup;
+ case MessageType::StartGroupCollapsed: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;
+ case MessageType::EndGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::EndGroup;
+ case MessageType::Assert: return Inspector::Protocol::Console::ConsoleMessage::Type::Assert;
+ case MessageType::Timing: return Inspector::Protocol::Console::ConsoleMessage::Type::Timing;
+ case MessageType::Profile: return Inspector::Protocol::Console::ConsoleMessage::Type::Profile;
+ case MessageType::ProfileEnd: return Inspector::Protocol::Console::ConsoleMessage::Type::ProfileEnd;
+ }
+ return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
+}
+
+static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)
+{
+ switch (level) {
+ case MessageLevel::Log: return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
+ case MessageLevel::Info: return Inspector::Protocol::Console::ConsoleMessage::Level::Info;
+ case MessageLevel::Warning: return Inspector::Protocol::Console::ConsoleMessage::Level::Warning;
+ case MessageLevel::Error: return Inspector::Protocol::Console::ConsoleMessage::Level::Error;
+ case MessageLevel::Debug: return Inspector::Protocol::Console::ConsoleMessage::Level::Debug;
+ }
+ return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
+}
+
+void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDispatcher, InjectedScriptManager& injectedScriptManager, bool generatePreview)
+{
+ Ref<Inspector::Protocol::Console::ConsoleMessage> jsonObj = Inspector::Protocol::Console::ConsoleMessage::create()
+ .setSource(messageSourceValue(m_source))
+ .setLevel(messageLevelValue(m_level))
+ .setText(m_message)
+ .release();
+
+ // FIXME: only send out type for ConsoleAPI source messages.
+ jsonObj->setType(messageTypeValue(m_type));
+ jsonObj->setLine(static_cast<int>(m_line));
+ jsonObj->setColumn(static_cast<int>(m_column));
+ jsonObj->setUrl(m_url);
+ jsonObj->setRepeatCount(static_cast<int>(m_repeatCount));
+
+ if (m_source == MessageSource::Network && !m_requestId.isEmpty())
+ jsonObj->setNetworkRequestId(m_requestId);
+
+ if (m_arguments && m_arguments->argumentCount()) {
+ InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(m_arguments->globalState());
+ if (!injectedScript.hasNoValue()) {
+ Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>> jsonArgs = Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>::create();
+ if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
+ Deprecated::ScriptValue table = m_arguments->argumentAt(0);
+ Deprecated::ScriptValue columns = m_arguments->argumentCount() > 1 ? m_arguments->argumentAt(1) : Deprecated::ScriptValue();
+ RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapTable(table, columns);
+ if (!inspectorValue) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ jsonArgs->addItem(inspectorValue.copyRef());
+ if (m_arguments->argumentCount() > 1)
+ jsonArgs->addItem(injectedScript.wrapObject(columns, ASCIILiteral("console"), true));
+ } else {
+ for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
+ RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), ASCIILiteral("console"), generatePreview);
+ if (!inspectorValue) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ jsonArgs->addItem(inspectorValue.copyRef());
+ }
+ }
+ jsonObj->setParameters(WTFMove(jsonArgs));
+ }
+ }
+
+ if (m_callStack)
+ jsonObj->setStackTrace(m_callStack->buildInspectorArray());
+
+ consoleFrontendDispatcher.messageAdded(WTFMove(jsonObj));
+}
+
+void ConsoleMessage::updateRepeatCountInConsole(ConsoleFrontendDispatcher& consoleFrontendDispatcher)
+{
+ consoleFrontendDispatcher.messageRepeatCountUpdated(m_repeatCount);
+}
+
+bool ConsoleMessage::isEqual(ConsoleMessage* msg) const
+{
+ if (m_arguments) {
+ if (!m_arguments->isEqual(msg->m_arguments.get()))
+ return false;
+
+ // Never treat objects as equal - their properties might change over time.
+ for (size_t i = 0; i < m_arguments->argumentCount(); ++i) {
+ if (m_arguments->argumentAt(i).isObject())
+ return false;
+ }
+ } else if (msg->m_arguments)
+ return false;
+
+ if (m_callStack) {
+ if (!m_callStack->isEqual(msg->m_callStack.get()))
+ return false;
+ } else if (msg->m_callStack)
+ return false;
+
+ return msg->m_source == m_source
+ && msg->m_type == m_type
+ && msg->m_level == m_level
+ && msg->m_message == m_message
+ && msg->m_line == m_line
+ && msg->m_column == m_column
+ && msg->m_url == m_url
+ && msg->m_requestId == m_requestId;
+}
+
+void ConsoleMessage::clear()
+{
+ if (!m_message)
+ m_message = ASCIILiteral("<message collected>");
+
+ if (m_arguments)
+ m_arguments = nullptr;
+}
+
+JSC::ExecState* ConsoleMessage::scriptState() const
+{
+ if (m_arguments)
+ return m_arguments->globalState();
+
+ return nullptr;
+}
+
+unsigned ConsoleMessage::argumentCount() const
+{
+ if (m_arguments)
+ return m_arguments->argumentCount();
+
+ return 0;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.h b/Source/JavaScriptCore/inspector/ConsoleMessage.h
new file mode 100644
index 000000000..50abe7724
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ConsoleMessage.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2007, 2008, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2009, 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ConsoleMessage_h
+#define ConsoleMessage_h
+
+#include "ConsoleTypes.h"
+#include "InspectorFrontendDispatchers.h"
+#include <wtf/Forward.h>
+
+namespace JSC {
+class ExecState;
+}
+
+namespace Inspector {
+
+class InjectedScriptManager;
+class ScriptArguments;
+class ScriptCallStack;
+
+class JS_EXPORT_PRIVATE ConsoleMessage {
+ WTF_MAKE_NONCOPYABLE(ConsoleMessage);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned long requestIdentifier = 0);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, const String& url, unsigned line, unsigned column, JSC::ExecState* = nullptr, unsigned long requestIdentifier = 0);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptCallStack>, unsigned long requestIdentifier = 0);
+ ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& message, PassRefPtr<ScriptArguments>, JSC::ExecState*, unsigned long requestIdentifier = 0);
+ ~ConsoleMessage();
+
+ void addToFrontend(ConsoleFrontendDispatcher&, InjectedScriptManager&, bool generatePreview);
+ void updateRepeatCountInConsole(ConsoleFrontendDispatcher&);
+
+ MessageSource source() const { return m_source; }
+ MessageType type() const { return m_type; }
+ MessageLevel level() const { return m_level; }
+ const String& message() const { return m_message; }
+ const String& url() const { return m_url; }
+ unsigned line() const { return m_line; }
+ unsigned column() const { return m_column; }
+
+ JSC::ExecState* scriptState() const;
+
+ void incrementCount() { ++m_repeatCount; }
+
+ unsigned argumentCount() const;
+
+ bool isEqual(ConsoleMessage* msg) const;
+
+ void clear();
+
+private:
+ void autogenerateMetadata(JSC::ExecState* = nullptr);
+
+ MessageSource m_source;
+ MessageType m_type;
+ MessageLevel m_level;
+ String m_message;
+ RefPtr<ScriptArguments> m_arguments;
+ RefPtr<ScriptCallStack> m_callStack;
+ String m_url;
+ unsigned m_line { 0 };
+ unsigned m_column { 0 };
+ unsigned m_repeatCount { 1 };
+ String m_requestId;
+};
+
+} // namespace Inspector
+
+#endif // ConsoleMessage_h
diff --git a/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp b/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
new file mode 100644
index 000000000..f3515f4e7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ContentSearchUtilities.h"
+
+#include "InspectorValues.h"
+#include "RegularExpression.h"
+#include "Yarr.h"
+#include <wtf/BumpPointerAllocator.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringBuilder.h>
+
+using namespace JSC::Yarr;
+
+namespace Inspector {
+namespace ContentSearchUtilities {
+
+static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|";
+
+static String createSearchRegexSource(const String& text)
+{
+ StringBuilder result;
+
+ for (unsigned i = 0; i < text.length(); i++) {
+ UChar character = text[i];
+ if (isASCII(character) && strchr(regexSpecialCharacters, character))
+ result.append('\\');
+ result.append(character);
+ }
+
+ return result.toString();
+}
+
+static inline size_t sizetExtractor(const size_t* value)
+{
+ return *value;
+}
+
+TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings)
+{
+ const size_t* foundNextStart = approximateBinarySearch<size_t, size_t>(lineEndings, lineEndings.size(), offset, sizetExtractor);
+ size_t lineIndex = foundNextStart - &lineEndings.at(0);
+ if (offset >= *foundNextStart)
+ ++lineIndex;
+ size_t lineStartOffset = lineIndex > 0 ? lineEndings.at(lineIndex - 1) : 0;
+ size_t column = offset - lineStartOffset;
+ return TextPosition(OrdinalNumber::fromZeroBasedInt(lineIndex), OrdinalNumber::fromZeroBasedInt(column));
+}
+
+static Vector<std::pair<size_t, String>> getRegularExpressionMatchesByLines(const JSC::Yarr::RegularExpression& regex, const String& text)
+{
+ Vector<std::pair<size_t, String>> result;
+ if (text.isEmpty())
+ return result;
+
+ std::unique_ptr<Vector<size_t>> endings(lineEndings(text));
+ size_t size = endings->size();
+ size_t start = 0;
+
+ for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) {
+ size_t nextStart = endings->at(lineNumber);
+ String line = text.substring(start, nextStart - start);
+
+ int matchLength;
+ if (regex.match(line, 0, &matchLength) != -1)
+ result.append(std::pair<size_t, String>(lineNumber, line));
+
+ start = nextStart;
+ }
+
+ return result;
+}
+
+std::unique_ptr<Vector<size_t>> lineEndings(const String& text)
+{
+ auto result = std::make_unique<Vector<size_t>>();
+
+ size_t start = 0;
+ while (start < text.length()) {
+ size_t nextStart = text.findNextLineStart(start);
+ if (nextStart == notFound) {
+ result->append(text.length());
+ break;
+ }
+
+ result->append(nextStart);
+ start = nextStart;
+ }
+
+ result->append(text.length());
+
+ return result;
+}
+
+static Ref<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
+{
+ return Inspector::Protocol::GenericTypes::SearchMatch::create()
+ .setLineNumber(lineNumber)
+ .setLineContent(lineContent)
+ .release();
+}
+
+JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex)
+{
+ String regexSource = isRegex ? query : createSearchRegexSource(query);
+ return JSC::Yarr::RegularExpression(regexSource, caseSensitive ? TextCaseSensitive : TextCaseInsensitive);
+}
+
+int countRegularExpressionMatches(const JSC::Yarr::RegularExpression& regex, const String& content)
+{
+ if (content.isEmpty())
+ return 0;
+
+ int result = 0;
+ int position;
+ unsigned start = 0;
+ int matchLength;
+ while ((position = regex.match(content, start, &matchLength)) != -1) {
+ if (start >= content.length())
+ break;
+ if (matchLength > 0)
+ ++result;
+ start = position + 1;
+ }
+ return result;
+}
+
+Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
+{
+ Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> result = Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>::create();
+
+ JSC::Yarr::RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
+ Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text);
+
+ for (const auto& match : matches) {
+ Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second);
+ result->addItem(WTFMove(matchObject));
+ }
+
+ return result;
+}
+
+static String stylesheetCommentPattern(const String& name)
+{
+ // "/*# <name>=<value> */" and deprecated "/*@"
+ return "/\\*[#@][\040\t]" + name + "=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/";
+}
+
+static String findMagicComment(const String& content, const String& patternString)
+{
+ ASSERT(!content.isNull());
+ const char* error = nullptr;
+ JSC::Yarr::YarrPattern pattern(patternString, false, true, &error);
+ ASSERT(!error);
+ BumpPointerAllocator regexAllocator;
+ auto bytecodePattern = JSC::Yarr::byteCompile(pattern, &regexAllocator);
+ ASSERT(bytecodePattern);
+
+ ASSERT(pattern.m_numSubpatterns == 1);
+ Vector<int, 4> matches;
+ matches.resize(4);
+ unsigned result = JSC::Yarr::interpret(bytecodePattern.get(), content, 0, reinterpret_cast<unsigned*>(matches.data()));
+ if (result == JSC::Yarr::offsetNoMatch)
+ return String();
+
+ ASSERT(matches[2] > 0 && matches[3] > 0);
+ return content.substring(matches[2], matches[3] - matches[2]);
+}
+
+String findStylesheetSourceMapURL(const String& content)
+{
+ return findMagicComment(content, stylesheetCommentPattern(ASCIILiteral("sourceMappingURL")));
+}
+
+} // namespace ContentSearchUtilities
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ContentSearchUtilities.h b/Source/JavaScriptCore/inspector/ContentSearchUtilities.h
new file mode 100644
index 000000000..0a5683304
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ContentSearchUtilities.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ContentSearchUtilities_h
+#define ContentSearchUtilities_h
+
+#include "InspectorProtocolObjects.h"
+#include <wtf/Vector.h>
+#include <wtf/text/TextPosition.h>
+#include <wtf/text/WTFString.h>
+
+namespace JSC { namespace Yarr {
+class RegularExpression;
+} }
+
+namespace Inspector {
+
+namespace ContentSearchUtilities {
+
+JS_EXPORT_PRIVATE JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex);
+JS_EXPORT_PRIVATE int countRegularExpressionMatches(const JSC::Yarr::RegularExpression&, const String&);
+JS_EXPORT_PRIVATE Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
+JS_EXPORT_PRIVATE TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings);
+JS_EXPORT_PRIVATE std::unique_ptr<Vector<size_t>> lineEndings(const String&);
+
+JS_EXPORT_PRIVATE String findStylesheetSourceMapURL(const String& content);
+
+} // namespace ContentSearchUtilities
+
+} // namespace Inspector
+
+#endif // !defined(ContentSearchUtilities_h)
diff --git a/Source/JavaScriptCore/inspector/EventLoop.cpp b/Source/JavaScriptCore/inspector/EventLoop.cpp
new file mode 100644
index 000000000..495e3f094
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/EventLoop.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "EventLoop.h"
+
+#if OS(WINDOWS)
+#include <windows.h>
+#elif PLATFORM(EFL)
+#include <Ecore.h>
+#elif PLATFORM(GTK)
+#include <glib.h>
+#endif
+
+namespace Inspector {
+
+#if USE(CF) && !OS(WINDOWS)
+CFStringRef EventLoop::remoteInspectorRunLoopMode()
+{
+ return CFSTR("com.apple.JavaScriptCore.remote-inspector-runloop-mode");
+}
+#endif
+
+void EventLoop::cycle()
+{
+#if OS(WINDOWS)
+ MSG msg;
+ if (!GetMessage(&msg, 0, 0, 0)) {
+ m_ended = true;
+ return;
+ }
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+#elif USE(CF)
+ // Run the RunLoop in a custom run loop mode to prevent default observers
+ // to run and potentially evaluate JavaScript in this context while we are
+ // nested. Only the debugger should control things until we continue.
+ // FIXME: This is not a perfect solution, as background threads are not
+ // paused and can still access and evalute script in the JSContext.
+ CFTimeInterval timeInterval = 0.05;
+ CFRunLoopRunInMode(remoteInspectorRunLoopMode(), timeInterval, true);
+#elif PLATFORM(EFL)
+ ecore_main_loop_iterate();
+#elif PLATFORM(GTK)
+ g_main_context_iteration(NULL, FALSE);
+#endif
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/EventLoop.h b/Source/JavaScriptCore/inspector/EventLoop.h
new file mode 100644
index 000000000..c06e72b26
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/EventLoop.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 EventLoop_h
+#define EventLoop_h
+
+#include <wtf/Noncopyable.h>
+
+#if USE(CF) && !OS(WINDOWS)
+#include <CoreFoundation/CFRunLoop.h>
+#endif
+
+namespace Inspector {
+
+class EventLoop {
+ WTF_MAKE_NONCOPYABLE(EventLoop);
+public:
+ EventLoop()
+ : m_ended(false)
+ {
+ }
+
+ void cycle();
+ bool ended() const { return m_ended; }
+
+#if USE(CF) && !OS(WINDOWS)
+ static CFStringRef remoteInspectorRunLoopMode();
+#endif
+
+private:
+ bool m_ended;
+};
+
+} // namespace Inspector
+
+#endif // EventLoop_h
diff --git a/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp b/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp
new file mode 100644
index 000000000..7e145be3e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IdentifiersFactory.h"
+
+#include <wtf/text/StringBuilder.h>
+
+namespace Inspector {
+
+namespace {
+static long s_lastUsedIdentifier = 0;
+}
+
+long IdentifiersFactory::s_processId = 0;
+
+String IdentifiersFactory::createIdentifier()
+{
+ return addProcessIdPrefixTo(String::number(++s_lastUsedIdentifier));
+}
+
+String IdentifiersFactory::requestId(unsigned long identifier)
+{
+ if (identifier)
+ return addProcessIdPrefixTo(String::number(identifier));
+ return String();
+}
+
+String IdentifiersFactory::addProcessIdPrefixTo(const String& id)
+{
+ StringBuilder builder;
+ builder.appendNumber(s_processId);
+ builder.append('.');
+ builder.append(id);
+ return builder.toString();
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/IdentifiersFactory.h b/Source/JavaScriptCore/inspector/IdentifiersFactory.h
new file mode 100644
index 000000000..d81c79a4a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/IdentifiersFactory.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 IdentifiersFactory_h
+#define IdentifiersFactory_h
+
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE IdentifiersFactory {
+public:
+ static void setProcessId(long processId) { s_processId = processId; }
+ static String createIdentifier();
+ static String requestId(unsigned long identifier);
+
+private:
+ static String addProcessIdPrefixTo(const String& id);
+
+ static long s_processId;
+};
+
+} // namespace Inspector
+
+#endif // !defined(IdentifiersFactory_h)
diff --git a/Source/JavaScriptCore/inspector/InjectedScript.cpp b/Source/JavaScriptCore/inspector/InjectedScript.cpp
new file mode 100644
index 000000000..1e1bc8ba3
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScript.cpp
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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.
+ */
+
+#include "config.h"
+#include "InjectedScript.h"
+
+#include "InspectorValues.h"
+#include "JSCInlines.h"
+#include "ScriptFunctionCall.h"
+#include "ScriptObject.h"
+#include <wtf/text/WTFString.h>
+
+using Inspector::Protocol::Array;
+
+namespace Inspector {
+
+InjectedScript::InjectedScript()
+ : InjectedScriptBase(ASCIILiteral("InjectedScript"))
+{
+}
+
+InjectedScript::InjectedScript(Deprecated::ScriptObject injectedScriptObject, InspectorEnvironment* environment)
+ : InjectedScriptBase(ASCIILiteral("InjectedScript"), injectedScriptObject, environment)
+{
+}
+
+InjectedScript::~InjectedScript()
+{
+}
+
+void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>* result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluate"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(expression);
+ function.appendArgument(objectGroup);
+ function.appendArgument(includeCommandLineAPI);
+ function.appendArgument(returnByValue);
+ function.appendArgument(generatePreview);
+ function.appendArgument(saveResult);
+ makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
+}
+
+void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>* result, Inspector::Protocol::OptOutput<bool>* wasThrown)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("callFunctionOn"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ function.appendArgument(expression);
+ function.appendArgument(arguments);
+ function.appendArgument(returnByValue);
+ function.appendArgument(generatePreview);
+ makeEvalCall(errorString, function, result, wasThrown);
+}
+
+void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>* result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluateOnCallFrame"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(callFrames);
+ function.appendArgument(callFrameId);
+ function.appendArgument(expression);
+ function.appendArgument(objectGroup);
+ function.appendArgument(includeCommandLineAPI);
+ function.appendArgument(returnByValue);
+ function.appendArgument(generatePreview);
+ function.appendArgument(saveResult);
+ makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
+}
+
+void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>* result)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getFunctionDetails"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(functionId);
+
+ RefPtr<InspectorValue> resultValue;
+ makeCall(function, &resultValue);
+ if (!resultValue || resultValue->type() != InspectorValue::Type::Object) {
+ if (!resultValue->asString(errorString))
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
+}
+
+void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ function.appendArgument(ownProperties);
+ function.appendArgument(generatePreview);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::Type::Array) {
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
+}
+
+void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getDisplayableProperties"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ function.appendArgument(generatePreview);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::Type::Array) {
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
+}
+
+void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ function.appendArgument(generatePreview);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::Type::Array) {
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ auto array = BindingTraits<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));
+ *properties = array->length() > 0 ? array : nullptr;
+}
+
+void InjectedScript::getCollectionEntries(ErrorString& errorString, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<Protocol::Array<Protocol::Runtime::CollectionEntry>>* entries)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getCollectionEntries"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ function.appendArgument(objectGroup);
+ function.appendArgument(startIndex);
+ function.appendArgument(numberToFetch);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::Type::Array) {
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ *entries = BindingTraits<Array<Protocol::Runtime::CollectionEntry>>::runtimeCast(WTFMove(result));
+}
+
+void InjectedScript::saveResult(ErrorString& errorString, const String& callArgumentJSON, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("saveResult"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(callArgumentJSON);
+
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result || result->type() != InspectorValue::Type::Integer) {
+ errorString = ASCIILiteral("Internal error");
+ return;
+ }
+
+ int savedResultIndexInt = 0;
+ if (result->asInteger(savedResultIndexInt) && savedResultIndexInt > 0)
+ *savedResultIndex = savedResultIndexInt;
+}
+
+Ref<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames) const
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("wrapCallFrames"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(callFrames);
+
+ bool hadException = false;
+ Deprecated::ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException);
+ ASSERT(!hadException);
+ RefPtr<InspectorValue> result = callFramesValue.toInspectorValue(scriptState());
+ if (result->type() == InspectorValue::Type::Array)
+ return BindingTraits<Array<Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();
+
+ return Array<Inspector::Protocol::Debugger::CallFrame>::create();
+}
+
+RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapObject"), inspectorEnvironment()->functionCallHandler());
+ wrapFunction.appendArgument(value);
+ wrapFunction.appendArgument(groupName);
+ wrapFunction.appendArgument(hasAccessToInspectedScriptState());
+ wrapFunction.appendArgument(generatePreview);
+
+ bool hadException = false;
+ Deprecated::ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException);
+ if (hadException)
+ return nullptr;
+
+ RefPtr<InspectorObject> resultObject;
+ bool castSucceeded = r.toInspectorValue(scriptState())->asObject(resultObject);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+}
+
+RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapTable"), inspectorEnvironment()->functionCallHandler());
+ wrapFunction.appendArgument(hasAccessToInspectedScriptState());
+ wrapFunction.appendArgument(table);
+ if (columns.hasNoValue())
+ wrapFunction.appendArgument(false);
+ else
+ wrapFunction.appendArgument(columns);
+
+ bool hadException = false;
+ Deprecated::ScriptValue r = callFunctionWithEvalEnabled(wrapFunction, hadException);
+ if (hadException)
+ return nullptr;
+
+ RefPtr<InspectorObject> resultObject;
+ bool castSucceeded = r.toInspectorValue(scriptState())->asObject(resultObject);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+}
+
+void InjectedScript::setExceptionValue(const Deprecated::ScriptValue& value)
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("setExceptionValue"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(value);
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+}
+
+void InjectedScript::clearExceptionValue()
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("clearExceptionValue"), inspectorEnvironment()->functionCallHandler());
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+}
+
+Deprecated::ScriptValue InjectedScript::findObjectById(const String& objectId) const
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("findObjectById"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+
+ bool hadException = false;
+ Deprecated::ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
+ ASSERT(!hadException);
+
+ return resultValue;
+}
+
+void InjectedScript::inspectObject(Deprecated::ScriptValue value)
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("inspectObject"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(value);
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+}
+
+void InjectedScript::releaseObject(const String& objectId)
+{
+ Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("releaseObject"), inspectorEnvironment()->functionCallHandler());
+ function.appendArgument(objectId);
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+}
+
+void InjectedScript::releaseObjectGroup(const String& objectGroup)
+{
+ ASSERT(!hasNoValue());
+ Deprecated::ScriptFunctionCall releaseFunction(injectedScriptObject(), ASCIILiteral("releaseObjectGroup"), inspectorEnvironment()->functionCallHandler());
+ releaseFunction.appendArgument(objectGroup);
+
+ bool hadException = false;
+ callFunctionWithEvalEnabled(releaseFunction, hadException);
+ ASSERT(!hadException);
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/InjectedScript.h b/Source/JavaScriptCore/inspector/InjectedScript.h
new file mode 100644
index 000000000..509cd58d4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScript.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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 InjectedScript_h
+#define InjectedScript_h
+
+#include "InjectedScriptBase.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+
+namespace Deprecated {
+class ScriptObject;
+}
+
+namespace Inspector {
+
+class InjectedScriptModule;
+class InspectorEnvironment;
+
+class JS_EXPORT_PRIVATE InjectedScript : public InjectedScriptBase {
+public:
+ InjectedScript();
+ InjectedScript(Deprecated::ScriptObject, InspectorEnvironment*);
+ virtual ~InjectedScript();
+
+ void evaluate(ErrorString&, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex);
+ void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
+ void evaluateOnCallFrame(ErrorString&, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex);
+ void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>* result);
+ void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
+ void getDisplayableProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
+ void getInternalProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
+ void getCollectionEntries(ErrorString&, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<Protocol::Array<Protocol::Runtime::CollectionEntry>>* entries);
+ void saveResult(ErrorString&, const String& callArgumentJSON, Inspector::Protocol::OptOutput<int>* savedResultIndex);
+
+ Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&) const;
+ RefPtr<Protocol::Runtime::RemoteObject> wrapObject(const Deprecated::ScriptValue&, const String& groupName, bool generatePreview = false) const;
+ RefPtr<Protocol::Runtime::RemoteObject> wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const;
+
+ void setExceptionValue(const Deprecated::ScriptValue&);
+ void clearExceptionValue();
+
+ Deprecated::ScriptValue findObjectById(const String& objectId) const;
+ void inspectObject(Deprecated::ScriptValue);
+ void releaseObject(const String& objectId);
+ void releaseObjectGroup(const String& objectGroup);
+
+private:
+ friend class InjectedScriptModule;
+};
+
+} // namespace Inspector
+
+#endif // InjectedScript_h
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp
new file mode 100644
index 000000000..27ec8a165
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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.
+ */
+
+#include "config.h"
+#include "InjectedScriptBase.h"
+
+#include "DebuggerEvalEnabler.h"
+#include "InspectorValues.h"
+#include "JSCInlines.h"
+#include "JSGlobalObject.h"
+#include "LegacyProfiler.h"
+#include "ScriptFunctionCall.h"
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+InjectedScriptBase::InjectedScriptBase(const String& name)
+ : m_name(name)
+ , m_environment(nullptr)
+{
+}
+
+InjectedScriptBase::InjectedScriptBase(const String& name, Deprecated::ScriptObject injectedScriptObject, InspectorEnvironment* environment)
+ : m_name(name)
+ , m_injectedScriptObject(injectedScriptObject)
+ , m_environment(environment)
+{
+}
+
+InjectedScriptBase::~InjectedScriptBase()
+{
+}
+
+bool InjectedScriptBase::hasAccessToInspectedScriptState() const
+{
+ return m_environment && m_environment->canAccessInspectedScriptState(m_injectedScriptObject.scriptState());
+}
+
+const Deprecated::ScriptObject& InjectedScriptBase::injectedScriptObject() const
+{
+ return m_injectedScriptObject;
+}
+
+Deprecated::ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(Deprecated::ScriptFunctionCall& function, bool& hadException) const
+{
+ JSC::ExecState* scriptState = m_injectedScriptObject.scriptState();
+ JSC::LegacyProfiler::profiler()->suspendProfiling(scriptState);
+
+ Deprecated::ScriptValue resultValue;
+ {
+ JSC::DebuggerEvalEnabler evalEnabler(scriptState);
+ resultValue = function.call(hadException);
+ }
+
+ JSC::LegacyProfiler::profiler()->unsuspendProfiling(scriptState);
+
+ return resultValue;
+}
+
+void InjectedScriptBase::makeCall(Deprecated::ScriptFunctionCall& function, RefPtr<InspectorValue>* result)
+{
+ if (hasNoValue() || !hasAccessToInspectedScriptState()) {
+ *result = InspectorValue::null();
+ return;
+ }
+
+ bool hadException = false;
+ Deprecated::ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
+
+ ASSERT(!hadException);
+ if (!hadException) {
+ *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState());
+ if (!*result)
+ *result = InspectorString::create(String::format("Object has too long reference chain (must not be longer than %d)", InspectorValue::maxDepth));
+ } else
+ *result = InspectorString::create("Exception while making a call.");
+}
+
+void InjectedScriptBase::makeEvalCall(ErrorString& errorString, Deprecated::ScriptFunctionCall& function, RefPtr<Protocol::Runtime::RemoteObject>* objectResult, Protocol::OptOutput<bool>* wasThrown, Protocol::OptOutput<int>* savedResultIndex)
+{
+ RefPtr<InspectorValue> result;
+ makeCall(function, &result);
+ if (!result) {
+ errorString = ASCIILiteral("Internal error: result value is empty");
+ return;
+ }
+
+ if (result->type() == InspectorValue::Type::String) {
+ result->asString(errorString);
+ ASSERT(errorString.length());
+ return;
+ }
+
+ RefPtr<InspectorObject> resultTuple;
+ if (!result->asObject(resultTuple)) {
+ errorString = ASCIILiteral("Internal error: result is not an Object");
+ return;
+ }
+
+ RefPtr<InspectorObject> resultObject;
+ if (!resultTuple->getObject(ASCIILiteral("result"), resultObject)) {
+ errorString = ASCIILiteral("Internal error: result is not a pair of value and wasThrown flag");
+ return;
+ }
+
+ bool wasThrownValue = false;
+ if (!resultTuple->getBoolean(ASCIILiteral("wasThrown"), wasThrownValue)) {
+ errorString = ASCIILiteral("Internal error: result is not a pair of value and wasThrown flag");
+ return;
+ }
+
+ *objectResult = BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+ *wasThrown = wasThrownValue;
+
+ if (savedResultIndex) {
+ int savedIndex = 0;
+ if (resultTuple->getInteger(ASCIILiteral("savedResultIndex"), savedIndex))
+ *savedResultIndex = savedIndex;
+ }
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.h b/Source/JavaScriptCore/inspector/InjectedScriptBase.h
new file mode 100644
index 000000000..fd01fabd7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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 InjectedScriptBase_h
+#define InjectedScriptBase_h
+
+#include "InspectorEnvironment.h"
+#include "InspectorProtocolObjects.h"
+#include "bindings/ScriptObject.h"
+#include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
+
+namespace Deprecated {
+class ScriptFunctionCall;
+}
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InjectedScriptBase {
+public:
+ virtual ~InjectedScriptBase();
+
+ const String& name() const { return m_name; }
+ bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); }
+ JSC::ExecState* scriptState() const { return m_injectedScriptObject.scriptState(); }
+
+protected:
+ InjectedScriptBase(const String& name);
+ InjectedScriptBase(const String& name, Deprecated::ScriptObject, InspectorEnvironment*);
+
+ InspectorEnvironment* inspectorEnvironment() const { return m_environment; }
+
+ bool hasAccessToInspectedScriptState() const;
+
+ const Deprecated::ScriptObject& injectedScriptObject() const;
+ Deprecated::ScriptValue callFunctionWithEvalEnabled(Deprecated::ScriptFunctionCall&, bool& hadException) const;
+ void makeCall(Deprecated::ScriptFunctionCall&, RefPtr<InspectorValue>* result);
+ void makeEvalCall(ErrorString&, Deprecated::ScriptFunctionCall&, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown, Protocol::OptOutput<int>* savedResult = nullptr);
+
+private:
+ String m_name;
+ Deprecated::ScriptObject m_injectedScriptObject;
+ InspectorEnvironment* m_environment;
+};
+
+} // namespace Inspector
+
+#endif // InjectedScriptBase_h
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp b/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp
new file mode 100644
index 000000000..657ba19cd
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedScriptHost.h"
+
+#include "JSCInlines.h"
+#include "JSInjectedScriptHost.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+InjectedScriptHost::~InjectedScriptHost()
+{
+}
+
+JSValue InjectedScriptHost::wrapper(ExecState* exec, JSGlobalObject* globalObject)
+{
+ JSValue value = m_wrappers.getWrapper(globalObject);
+ if (value)
+ return value;
+
+ JSObject* prototype = JSInjectedScriptHost::createPrototype(exec->vm(), globalObject);
+ Structure* structure = JSInjectedScriptHost::createStructure(exec->vm(), globalObject, prototype);
+ JSInjectedScriptHost* injectedScriptHost = JSInjectedScriptHost::create(exec->vm(), structure, Ref<InjectedScriptHost>(*this));
+ m_wrappers.addWrapper(globalObject, injectedScriptHost);
+
+ return injectedScriptHost;
+}
+
+void InjectedScriptHost::clearAllWrappers()
+{
+ m_wrappers.clearAllWrappers();
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptHost.h b/Source/JavaScriptCore/inspector/InjectedScriptHost.h
new file mode 100644
index 000000000..27de1425a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptHost.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InjectedScriptHost_h
+#define InjectedScriptHost_h
+
+#include "JSCJSValueInlines.h"
+#include "inspector/PerGlobalObjectWrapperWorld.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE InjectedScriptHost : public RefCounted<InjectedScriptHost> {
+public:
+ static Ref<InjectedScriptHost> create() { return adoptRef(*new InjectedScriptHost); }
+ virtual ~InjectedScriptHost();
+
+ virtual JSC::JSValue subtype(JSC::ExecState*, JSC::JSValue) { return JSC::jsUndefined(); }
+ virtual bool isHTMLAllCollection(JSC::JSValue) { return false; }
+
+ JSC::JSValue wrapper(JSC::ExecState*, JSC::JSGlobalObject*);
+ void clearAllWrappers();
+
+private:
+ PerGlobalObjectWrapperWorld m_wrappers;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InjectedScriptHost_h)
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp b/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
new file mode 100644
index 000000000..812ad3d75
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2012 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InjectedScriptManager.h"
+
+#include "Completion.h"
+#include "InjectedScriptHost.h"
+#include "InjectedScriptSource.h"
+#include "InspectorValues.h"
+#include "JSInjectedScriptHost.h"
+#include "JSLock.h"
+#include "ScriptObject.h"
+#include "SourceCode.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+InjectedScriptManager::InjectedScriptManager(InspectorEnvironment& environment, PassRefPtr<InjectedScriptHost> injectedScriptHost)
+ : m_environment(environment)
+ , m_injectedScriptHost(injectedScriptHost)
+ , m_nextInjectedScriptId(1)
+{
+}
+
+InjectedScriptManager::~InjectedScriptManager()
+{
+}
+
+void InjectedScriptManager::disconnect()
+{
+ discardInjectedScripts();
+}
+
+void InjectedScriptManager::discardInjectedScripts()
+{
+ m_injectedScriptHost->clearAllWrappers();
+ m_idToInjectedScript.clear();
+ m_scriptStateToId.clear();
+}
+
+InjectedScriptHost* InjectedScriptManager::injectedScriptHost()
+{
+ return m_injectedScriptHost.get();
+}
+
+InjectedScript InjectedScriptManager::injectedScriptForId(int id)
+{
+ auto it = m_idToInjectedScript.find(id);
+ if (it != m_idToInjectedScript.end())
+ return it->value;
+
+ for (auto it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) {
+ if (it->value == id)
+ return injectedScriptFor(it->key);
+ }
+
+ return InjectedScript();
+}
+
+int InjectedScriptManager::injectedScriptIdFor(ExecState* scriptState)
+{
+ auto it = m_scriptStateToId.find(scriptState);
+ if (it != m_scriptStateToId.end())
+ return it->value;
+
+ int id = m_nextInjectedScriptId++;
+ m_scriptStateToId.set(scriptState, id);
+ return id;
+}
+
+InjectedScript InjectedScriptManager::injectedScriptForObjectId(const String& objectId)
+{
+ RefPtr<InspectorValue> parsedObjectId;
+ if (!InspectorValue::parseJSON(objectId, parsedObjectId))
+ return InjectedScript();
+
+ RefPtr<InspectorObject> resultObject;
+ if (!parsedObjectId->asObject(resultObject))
+ return InjectedScript();
+
+ long injectedScriptId = 0;
+ if (!resultObject->getInteger(ASCIILiteral("injectedScriptId"), injectedScriptId))
+ return InjectedScript();
+
+ return m_idToInjectedScript.get(injectedScriptId);
+}
+
+void InjectedScriptManager::releaseObjectGroup(const String& objectGroup)
+{
+ for (auto& injectedScript : m_idToInjectedScript.values())
+ injectedScript.releaseObjectGroup(objectGroup);
+}
+
+void InjectedScriptManager::clearExceptionValue()
+{
+ for (auto& injectedScript : m_idToInjectedScript.values())
+ injectedScript.clearExceptionValue();
+}
+
+String InjectedScriptManager::injectedScriptSource()
+{
+ return StringImpl::createWithoutCopying(InjectedScriptSource_js, sizeof(InjectedScriptSource_js));
+}
+
+Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id)
+{
+ JSLockHolder lock(scriptState);
+
+ SourceCode sourceCode = makeSource(source);
+ JSGlobalObject* globalObject = scriptState->lexicalGlobalObject();
+ JSValue globalThisValue = scriptState->globalThisValue();
+
+ NakedPtr<Exception> evaluationException;
+ InspectorEvaluateHandler evaluateHandler = m_environment.evaluateHandler();
+ JSValue functionValue = evaluateHandler(scriptState, sourceCode, globalThisValue, evaluationException);
+ if (evaluationException)
+ return Deprecated::ScriptObject();
+
+ CallData callData;
+ CallType callType = getCallData(functionValue, callData);
+ if (callType == CallTypeNone)
+ return Deprecated::ScriptObject();
+
+ MarkedArgumentBuffer args;
+ args.append(m_injectedScriptHost->wrapper(scriptState, globalObject));
+ args.append(globalThisValue);
+ args.append(jsNumber(id));
+
+ JSValue result = JSC::call(scriptState, functionValue, callType, callData, globalThisValue, args);
+ scriptState->clearException();
+ if (result.isObject())
+ return Deprecated::ScriptObject(scriptState, result.getObject());
+
+ return Deprecated::ScriptObject();
+}
+
+InjectedScript InjectedScriptManager::injectedScriptFor(ExecState* inspectedExecState)
+{
+ auto it = m_scriptStateToId.find(inspectedExecState);
+ if (it != m_scriptStateToId.end()) {
+ auto it1 = m_idToInjectedScript.find(it->value);
+ if (it1 != m_idToInjectedScript.end())
+ return it1->value;
+ }
+
+ if (!m_environment.canAccessInspectedScriptState(inspectedExecState))
+ return InjectedScript();
+
+ int id = injectedScriptIdFor(inspectedExecState);
+ Deprecated::ScriptObject injectedScriptObject = createInjectedScript(injectedScriptSource(), inspectedExecState, id);
+ if (injectedScriptObject.scriptState() != inspectedExecState) {
+ WTFLogAlways("Failed to parse/execute InjectedScriptSource.js!");
+ WTFLogAlways("%s\n", injectedScriptSource().ascii().data());
+ RELEASE_ASSERT_NOT_REACHED();
+ }
+
+ InjectedScript result(injectedScriptObject, &m_environment);
+ m_idToInjectedScript.set(id, result);
+ didCreateInjectedScript(result);
+ return result;
+}
+
+void InjectedScriptManager::didCreateInjectedScript(const InjectedScript&)
+{
+ // Intentionally empty. This allows for subclasses to inject additional scripts.
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptManager.h b/Source/JavaScriptCore/inspector/InjectedScriptManager.h
new file mode 100644
index 000000000..e18d7cd46
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptManager.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2007, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InjectedScriptManager_h
+#define InjectedScriptManager_h
+
+#include "InjectedScript.h"
+#include "InjectedScriptHost.h"
+#include "InspectorEnvironment.h"
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/text/WTFString.h>
+
+namespace Deprecated {
+class ScriptObject;
+}
+
+namespace JSC {
+class ExecState;
+}
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE InjectedScriptManager {
+ WTF_MAKE_NONCOPYABLE(InjectedScriptManager); WTF_MAKE_FAST_ALLOCATED;
+public:
+ InjectedScriptManager(InspectorEnvironment&, PassRefPtr<InjectedScriptHost>);
+ virtual ~InjectedScriptManager();
+
+ virtual void disconnect();
+ virtual void discardInjectedScripts();
+
+ InjectedScriptHost* injectedScriptHost();
+ InspectorEnvironment& inspectorEnvironment() const { return m_environment; }
+
+ InjectedScript injectedScriptFor(JSC::ExecState*);
+ InjectedScript injectedScriptForId(int);
+ int injectedScriptIdFor(JSC::ExecState*);
+ InjectedScript injectedScriptForObjectId(const String& objectId);
+ void releaseObjectGroup(const String& objectGroup);
+ void clearExceptionValue();
+
+protected:
+ virtual void didCreateInjectedScript(const InjectedScript&);
+
+ HashMap<int, InjectedScript> m_idToInjectedScript;
+ HashMap<JSC::ExecState*, int> m_scriptStateToId;
+
+private:
+ String injectedScriptSource();
+ Deprecated::ScriptObject createInjectedScript(const String& source, JSC::ExecState*, int id);
+
+ InspectorEnvironment& m_environment;
+ RefPtr<InjectedScriptHost> m_injectedScriptHost;
+ int m_nextInjectedScriptId;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InjectedScriptManager_h)
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp b/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp
new file mode 100644
index 000000000..52bdb46b9
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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.
+ */
+
+#include "config.h"
+#include "InjectedScriptModule.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "ScriptFunctionCall.h"
+#include "ScriptObject.h"
+
+namespace Inspector {
+
+InjectedScriptModule::InjectedScriptModule(const String& name)
+ : InjectedScriptBase(name)
+{
+}
+
+InjectedScriptModule::~InjectedScriptModule()
+{
+}
+
+void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, JSC::ExecState* scriptState)
+{
+ InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState);
+ ensureInjected(injectedScriptManager, injectedScript);
+}
+
+void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, const InjectedScript& injectedScript)
+{
+ ASSERT(!injectedScript.hasNoValue());
+ if (injectedScript.hasNoValue())
+ return;
+
+ // FIXME: Make the InjectedScript a module itself.
+ JSC::JSLockHolder locker(injectedScript.scriptState());
+ Deprecated::ScriptFunctionCall function(injectedScript.injectedScriptObject(), ASCIILiteral("module"), injectedScriptManager->inspectorEnvironment().functionCallHandler());
+ function.appendArgument(name());
+ bool hadException = false;
+ Deprecated::ScriptValue resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException);
+ ASSERT(!hadException);
+ if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
+ Deprecated::ScriptFunctionCall function(injectedScript.injectedScriptObject(), ASCIILiteral("injectModule"), injectedScriptManager->inspectorEnvironment().functionCallHandler());
+ function.appendArgument(name());
+ function.appendArgument(source());
+ function.appendArgument(host(injectedScriptManager, injectedScript.scriptState()));
+ resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException);
+ if (hadException) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ }
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptModule.h b/Source/JavaScriptCore/inspector/InjectedScriptModule.h
new file mode 100644
index 000000000..a96e618b2
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptModule.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 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 InjectedScriptModule_h
+#define InjectedScriptModule_h
+
+#include "InjectedScriptBase.h"
+#include <wtf/text/WTFString.h>
+
+namespace JSC {
+class JSValue;
+}
+
+namespace Inspector {
+
+class InjectedScript;
+class InjectedScriptManager;
+
+class JS_EXPORT_PRIVATE InjectedScriptModule : public InjectedScriptBase {
+public:
+ virtual ~InjectedScriptModule();
+ virtual String source() const = 0;
+ virtual JSC::JSValue host(InjectedScriptManager*, JSC::ExecState*) const = 0;
+
+protected:
+ // Do not expose constructor in the child classes as well. Instead provide
+ // a static factory method that would create a new instance of the class
+ // and call its ensureInjected() method immediately.
+ explicit InjectedScriptModule(const String& name);
+ void ensureInjected(InjectedScriptManager*, JSC::ExecState*);
+ void ensureInjected(InjectedScriptManager*, const InjectedScript&);
+};
+
+} // namespace Inspector
+
+#endif // InjectedScriptModule_h
diff --git a/Source/JavaScriptCore/inspector/InjectedScriptSource.js b/Source/JavaScriptCore/inspector/InjectedScriptSource.js
new file mode 100644
index 000000000..bb2b1dad5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InjectedScriptSource.js
@@ -0,0 +1,1419 @@
+/*
+ * Copyright (C) 2007, 2014-2015 Apple Inc. All rights reserved.
+ * 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+//# sourceURL=__WebInspectorInjectedScript__
+
+(function (InjectedScriptHost, inspectedGlobalObject, injectedScriptId) {
+
+// Protect against Object overwritten by the user code.
+var Object = {}.constructor;
+
+function toString(obj)
+{
+ return String(obj);
+}
+
+function toStringDescription(obj)
+{
+ if (obj === 0 && 1 / obj < 0)
+ return "-0";
+
+ return toString(obj);
+}
+
+function isUInt32(obj)
+{
+ if (typeof obj === "number")
+ return obj >>> 0 === obj && (obj > 0 || 1 / obj > 0);
+ return "" + (obj >>> 0) === obj;
+}
+
+function endsWith(str, suffix)
+{
+ var position = str.length - suffix.length;
+ if (position < 0)
+ return false;
+ return str.indexOf(suffix, position) === position;
+}
+
+function isSymbol(obj)
+{
+ return typeof obj === "symbol";
+}
+
+var InjectedScript = function()
+{
+ this._lastBoundObjectId = 1;
+ this._idToWrappedObject = {};
+ this._idToObjectGroupName = {};
+ this._objectGroups = {};
+ this._modules = {};
+ this._nextSavedResultIndex = 1;
+ this._savedResults = [];
+}
+
+InjectedScript.primitiveTypes = {
+ undefined: true,
+ boolean: true,
+ number: true,
+ string: true,
+}
+
+InjectedScript.CollectionMode = {
+ OwnProperties: 1 << 0, // own properties.
+ NativeGetterProperties: 1 << 1, // native getter properties in the prototype chain.
+ AllProperties: 1 << 2, // all properties in the prototype chain.
+}
+
+InjectedScript.prototype = {
+ isPrimitiveValue: function(object)
+ {
+ // FIXME(33716): typeof document.all is always 'undefined'.
+ return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllCollection(object);
+ },
+
+ wrapObject: function(object, groupName, canAccessInspectedGlobalObject, generatePreview)
+ {
+ if (canAccessInspectedGlobalObject)
+ return this._wrapObject(object, groupName, false, generatePreview);
+ return this._fallbackWrapper(object);
+ },
+
+ setExceptionValue: function(value)
+ {
+ this._exceptionValue = value;
+ },
+
+ clearExceptionValue: function()
+ {
+ delete this._exceptionValue;
+ },
+
+ _fallbackWrapper: function(object)
+ {
+ var result = {};
+ result.type = typeof object;
+ if (this.isPrimitiveValue(object))
+ result.value = object;
+ else
+ result.description = toString(object);
+ return result;
+ },
+
+ wrapTable: function(canAccessInspectedGlobalObject, table, columns)
+ {
+ if (!canAccessInspectedGlobalObject)
+ return this._fallbackWrapper(table);
+
+ // FIXME: Currently columns are ignored. Instead, the frontend filters all
+ // properties based on the provided column names and in the provided order.
+ // Should we filter here too?
+
+ var columnNames = null;
+ if (typeof columns === "string")
+ columns = [columns];
+
+ if (InjectedScriptHost.subtype(columns) === "array") {
+ columnNames = [];
+ for (var i = 0; i < columns.length; ++i)
+ columnNames.push(toString(columns[i]));
+ }
+
+ return this._wrapObject(table, "console", false, true, columnNames);
+ },
+
+ inspectObject: function(object)
+ {
+ if (this._commandLineAPIImpl)
+ this._commandLineAPIImpl.inspect(object);
+ },
+
+ _wrapObject: function(object, objectGroupName, forceValueType, generatePreview, columnNames)
+ {
+ try {
+ return new InjectedScript.RemoteObject(object, objectGroupName, forceValueType, generatePreview, columnNames);
+ } catch (e) {
+ try {
+ var description = injectedScript._describe(e);
+ } catch (ex) {
+ var description = "<failed to convert exception to string>";
+ }
+ return new InjectedScript.RemoteObject(description);
+ }
+ },
+
+ _bind: function(object, objectGroupName)
+ {
+ var id = this._lastBoundObjectId++;
+ this._idToWrappedObject[id] = object;
+ var objectId = "{\"injectedScriptId\":" + injectedScriptId + ",\"id\":" + id + "}";
+ if (objectGroupName) {
+ var group = this._objectGroups[objectGroupName];
+ if (!group) {
+ group = [];
+ this._objectGroups[objectGroupName] = group;
+ }
+ group.push(id);
+ this._idToObjectGroupName[id] = objectGroupName;
+ }
+ return objectId;
+ },
+
+ _parseObjectId: function(objectId)
+ {
+ return InjectedScriptHost.evaluate("(" + objectId + ")");
+ },
+
+ releaseObjectGroup: function(objectGroupName)
+ {
+ if (objectGroupName === "console") {
+ delete this._lastResult;
+ this._nextSavedResultIndex = 1;
+ this._savedResults = [];
+ }
+
+ var group = this._objectGroups[objectGroupName];
+ if (!group)
+ return;
+
+ for (var i = 0; i < group.length; i++)
+ this._releaseObject(group[i]);
+
+ delete this._objectGroups[objectGroupName];
+ },
+
+ dispatch: function(methodName, args)
+ {
+ var argsArray = InjectedScriptHost.evaluate("(" + args + ")");
+ var result = this[methodName].apply(this, argsArray);
+ if (typeof result === "undefined") {
+ if (inspectedGlobalObject.console)
+ inspectedGlobalObject.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
+ result = null;
+ }
+ return result;
+ },
+
+ _getProperties: function(objectId, collectionMode, generatePreview)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ var objectGroupName = this._idToObjectGroupName[parsedObjectId.id];
+
+ if (!this._isDefined(object))
+ return false;
+
+ if (isSymbol(object))
+ return false;
+
+ var descriptors = this._propertyDescriptors(object, collectionMode);
+
+ // Go over properties, wrap object values.
+ for (var i = 0; i < descriptors.length; ++i) {
+ var descriptor = descriptors[i];
+ if ("get" in descriptor)
+ descriptor.get = this._wrapObject(descriptor.get, objectGroupName);
+ if ("set" in descriptor)
+ descriptor.set = this._wrapObject(descriptor.set, objectGroupName);
+ if ("value" in descriptor)
+ descriptor.value = this._wrapObject(descriptor.value, objectGroupName, false, generatePreview);
+ if (!("configurable" in descriptor))
+ descriptor.configurable = false;
+ if (!("enumerable" in descriptor))
+ descriptor.enumerable = false;
+ if ("symbol" in descriptor)
+ descriptor.symbol = this._wrapObject(descriptor.symbol, objectGroupName);
+ }
+
+ return descriptors;
+ },
+
+ getProperties: function(objectId, ownProperties, generatePreview)
+ {
+ var collectionMode = ownProperties ? InjectedScript.CollectionMode.OwnProperties : InjectedScript.CollectionMode.AllProperties;
+ return this._getProperties(objectId, collectionMode, generatePreview);
+ },
+
+ getDisplayableProperties: function(objectId, generatePreview)
+ {
+ var collectionMode = InjectedScript.CollectionMode.OwnProperties | InjectedScript.CollectionMode.NativeGetterProperties;
+ return this._getProperties(objectId, collectionMode, generatePreview);
+ },
+
+ getInternalProperties: function(objectId, generatePreview)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ var objectGroupName = this._idToObjectGroupName[parsedObjectId.id];
+
+ if (!this._isDefined(object))
+ return false;
+
+ if (isSymbol(object))
+ return false;
+
+ var descriptors = this._internalPropertyDescriptors(object);
+ if (!descriptors)
+ return [];
+
+ // Go over properties, wrap object values.
+ for (var i = 0; i < descriptors.length; ++i) {
+ var descriptor = descriptors[i];
+ if ("value" in descriptor)
+ descriptor.value = this._wrapObject(descriptor.value, objectGroupName, false, generatePreview);
+ }
+
+ return descriptors;
+ },
+
+ getCollectionEntries: function(objectId, objectGroupName, startIndex, numberToFetch)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ var objectGroupName = objectGroupName || this._idToObjectGroupName[parsedObjectId.id];
+
+ if (!this._isDefined(object))
+ return;
+
+ if (typeof object !== "object")
+ return;
+
+ var entries = this._entries(object, InjectedScriptHost.subtype(object), startIndex, numberToFetch);
+ return entries.map(function(entry) {
+ entry.value = injectedScript._wrapObject(entry.value, objectGroupName, false, true);
+ if ("key" in entry)
+ entry.key = injectedScript._wrapObject(entry.key, objectGroupName, false, true);
+ return entry;
+ });
+ },
+
+ saveResult: function(callArgumentJSON)
+ {
+ this._savedResultIndex = 0;
+
+ try {
+ var callArgument = InjectedScriptHost.evaluate("(" + callArgumentJSON + ")");
+ var value = this._resolveCallArgument(callArgument);
+ this._saveResult(value);
+ } catch (e) {}
+
+ return this._savedResultIndex;
+ },
+
+ getFunctionDetails: function(functionId)
+ {
+ var parsedFunctionId = this._parseObjectId(functionId);
+ var func = this._objectForId(parsedFunctionId);
+ if (typeof func !== "function")
+ return "Cannot resolve function by id.";
+ var details = InjectedScriptHost.functionDetails(func);
+ if (!details)
+ return "Cannot resolve function details.";
+ if ("rawScopes" in details) {
+ var objectGroupName = this._idToObjectGroupName[parsedFunctionId.id];
+ var rawScopes = details.rawScopes;
+ var scopes = [];
+ delete details.rawScopes;
+ for (var i = 0; i < rawScopes.length; i++)
+ scopes.push(InjectedScript.CallFrameProxy._createScopeJson(rawScopes[i].type, rawScopes[i].object, objectGroupName));
+ details.scopeChain = scopes;
+ }
+ return details;
+ },
+
+ releaseObject: function(objectId)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ this._releaseObject(parsedObjectId.id);
+ },
+
+ _releaseObject: function(id)
+ {
+ delete this._idToWrappedObject[id];
+ delete this._idToObjectGroupName[id];
+ },
+
+ evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+ {
+ return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
+ },
+
+ callFunctionOn: function(objectId, expression, args, returnByValue, generatePreview)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ var object = this._objectForId(parsedObjectId);
+ if (!this._isDefined(object))
+ return "Could not find object with given id";
+
+ if (args) {
+ var resolvedArgs = [];
+ var callArgs = InjectedScriptHost.evaluate(args);
+ for (var i = 0; i < callArgs.length; ++i) {
+ try {
+ resolvedArgs[i] = this._resolveCallArgument(callArgs[i]);
+ } catch (e) {
+ return String(e);
+ }
+ }
+ }
+
+ try {
+ var objectGroup = this._idToObjectGroupName[parsedObjectId.id];
+ var func = InjectedScriptHost.evaluate("(" + expression + ")");
+ if (typeof func !== "function")
+ return "Given expression does not evaluate to a function";
+
+ return {
+ wasThrown: false,
+ result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue, generatePreview)
+ };
+ } catch (e) {
+ return this._createThrownValue(e, objectGroup);
+ }
+ },
+
+ _resolveCallArgument: function(callArgumentJSON)
+ {
+ if ("value" in callArgumentJSON)
+ return callArgumentJSON.value;
+
+ var objectId = callArgumentJSON.objectId;
+ if (objectId) {
+ var parsedArgId = this._parseObjectId(objectId);
+ if (!parsedArgId || parsedArgId["injectedScriptId"] !== injectedScriptId)
+ throw "Arguments should belong to the same JavaScript world as the target object.";
+
+ var resolvedArg = this._objectForId(parsedArgId);
+ if (!this._isDefined(resolvedArg))
+ throw "Could not find object with given id";
+
+ return resolvedArg;
+ }
+
+ return undefined;
+ },
+
+ _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+ {
+ try {
+ this._savedResultIndex = 0;
+
+ var returnObject = {
+ wasThrown: false,
+ result: this._wrapObject(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult), objectGroup, returnByValue, generatePreview)
+ };
+
+ if (saveResult && this._savedResultIndex)
+ returnObject.savedResultIndex = this._savedResultIndex;
+
+ return returnObject;
+ } catch (e) {
+ return this._createThrownValue(e, objectGroup);
+ }
+ },
+
+ _createThrownValue: function(value, objectGroup)
+ {
+ var remoteObject = this._wrapObject(value, objectGroup);
+ try {
+ remoteObject.description = toStringDescription(value);
+ } catch (e) {}
+ return {
+ wasThrown: true,
+ result: remoteObject
+ };
+ },
+
+ _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult)
+ {
+ var commandLineAPI = null;
+ if (injectCommandLineAPI) {
+ if (this.CommandLineAPI)
+ commandLineAPI = new this.CommandLineAPI(this._commandLineAPIImpl, isEvalOnCallFrame ? object : null);
+ else
+ commandLineAPI = new BasicCommandLineAPI;
+ }
+
+ if (isEvalOnCallFrame) {
+ // We can only use this approach if the evaluate function is the true 'eval'. That allows us to use it with
+ // the 'eval' identifier when calling it. Using 'eval' grants access to the local scope of the closure we
+ // create that provides the command line APIs.
+
+ var parameters = [InjectedScriptHost.evaluate, expression];
+ var expressionFunctionBody = "" +
+ "var global = Function('return this')() || (1, eval)('this');" +
+ "var __originalEval = global.eval; global.eval = __eval;" +
+ "try { return eval(__currentExpression); }" +
+ "finally { global.eval = __originalEval; }";
+
+ if (commandLineAPI) {
+ // To avoid using a 'with' statement (which fails in strict mode and requires injecting the API object)
+ // we instead create a closure where we evaluate the expression. The command line APIs are passed as
+ // parameters to the closure so they are in scope but not injected. This allows the code evaluated in
+ // the console to stay in strict mode (if is was already set), or to get strict mode by prefixing
+ // expressions with 'use strict';.
+
+ var parameterNames = Object.getOwnPropertyNames(commandLineAPI);
+ for (var i = 0; i < parameterNames.length; ++i)
+ parameters.push(commandLineAPI[parameterNames[i]]);
+
+ var expressionFunctionString = "(function(__eval, __currentExpression, " + parameterNames.join(", ") + ") { " + expressionFunctionBody + " })";
+ } else {
+ // Use a closure in this case too to keep the same behavior of 'var' being captured by the closure instead
+ // of leaking out into the calling scope.
+ var expressionFunctionString = "(function(__eval, __currentExpression) { " + expressionFunctionBody + " })";
+ }
+
+ // Bind 'this' to the function expression using another closure instead of Function.prototype.bind. This ensures things will work if the page replaces bind.
+ var boundExpressionFunctionString = "(function(__function, __thisObject) { return function() { return __function.apply(__thisObject, arguments) }; })(" + expressionFunctionString + ", this)";
+ var expressionFunction = evalFunction.call(object, boundExpressionFunctionString);
+ var result = expressionFunction.apply(null, parameters);
+
+ if (saveResult)
+ this._saveResult(result);
+
+ return result;
+ }
+
+ // When not evaluating on a call frame we use a 'with' statement to allow var and function statements to leak
+ // into the global scope. This allow them to stick around between evaluations.
+
+ try {
+ if (commandLineAPI) {
+ if (inspectedGlobalObject.console)
+ inspectedGlobalObject.console.__commandLineAPI = commandLineAPI;
+ else
+ inspectedGlobalObject.__commandLineAPI = commandLineAPI;
+ expression = "with ((this && (this.console ? this.console.__commandLineAPI : this.__commandLineAPI)) || {}) { " + expression + "\n}";
+ }
+
+ var result = evalFunction.call(inspectedGlobalObject, expression);
+
+ if (saveResult)
+ this._saveResult(result);
+
+ return result;
+ } finally {
+ if (commandLineAPI) {
+ if (inspectedGlobalObject.console)
+ delete inspectedGlobalObject.console.__commandLineAPI;
+ else
+ delete inspectedGlobalObject.__commandLineAPI;
+ }
+ }
+ },
+
+ wrapCallFrames: function(callFrame)
+ {
+ if (!callFrame)
+ return false;
+
+ var result = [];
+ var depth = 0;
+ do {
+ result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
+ callFrame = callFrame.caller;
+ } while (callFrame);
+ return result;
+ },
+
+ evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult)
+ {
+ var callFrame = this._callFrameForId(topCallFrame, callFrameId);
+ if (!callFrame)
+ return "Could not find call frame with given id";
+ return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview, saveResult);
+ },
+
+ _callFrameForId: function(topCallFrame, callFrameId)
+ {
+ var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")");
+ var ordinal = parsedCallFrameId["ordinal"];
+ var callFrame = topCallFrame;
+ while (--ordinal >= 0 && callFrame)
+ callFrame = callFrame.caller;
+ return callFrame;
+ },
+
+ _objectForId: function(objectId)
+ {
+ return this._idToWrappedObject[objectId.id];
+ },
+
+ findObjectById: function(objectId)
+ {
+ var parsedObjectId = this._parseObjectId(objectId);
+ return this._objectForId(parsedObjectId);
+ },
+
+ module: function(name)
+ {
+ return this._modules[name];
+ },
+
+ injectModule: function(name, source, host)
+ {
+ delete this._modules[name];
+
+ var moduleFunction = InjectedScriptHost.evaluate("(" + source + ")");
+ if (typeof moduleFunction !== "function") {
+ if (inspectedGlobalObject.console)
+ inspectedGlobalObject.console.error("Web Inspector error: A function was expected for module %s evaluation", name);
+ return null;
+ }
+
+ var module = moduleFunction.call(inspectedGlobalObject, InjectedScriptHost, inspectedGlobalObject, injectedScriptId, this, host);
+ this._modules[name] = module;
+ return module;
+ },
+
+ _internalPropertyDescriptors: function(object, completeDescriptor)
+ {
+ var internalProperties = InjectedScriptHost.getInternalProperties(object);
+ if (!internalProperties)
+ return null;
+
+ var descriptors = [];
+ for (var i = 0; i < internalProperties.length; i++) {
+ var property = internalProperties[i];
+ var descriptor = {name: property.name, value: property.value};
+ if (completeDescriptor) {
+ descriptor.writable = false;
+ descriptor.configurable = false;
+ descriptor.enumerable = false;
+ descriptor.isOwn = true;
+ }
+ descriptors.push(descriptor);
+ }
+ return descriptors;
+ },
+
+ _propertyDescriptors: function(object, collectionMode)
+ {
+ var descriptors = [];
+ var nameProcessed = new Set;
+
+ function createFakeValueDescriptor(name, symbol, descriptor, isOwnProperty, possibleNativeBindingGetter)
+ {
+ try {
+ var descriptor = {name, value: object[name], writable: descriptor.writable || false, configurable: descriptor.configurable || false, enumerable: descriptor.enumerable || false};
+ if (possibleNativeBindingGetter)
+ descriptor.nativeGetter = true;
+ if (isOwnProperty)
+ descriptor.isOwn = true;
+ if (symbol)
+ descriptor.symbol = symbol;
+ return descriptor;
+ } catch (e) {
+ var errorDescriptor = {name, value: e, wasThrown: true};
+ if (isOwnProperty)
+ errorDescriptor.isOwn = true;
+ if (symbol)
+ errorDescriptor.symbol = symbol;
+ return errorDescriptor;
+ }
+ }
+
+ function processDescriptor(descriptor, isOwnProperty, possibleNativeBindingGetter)
+ {
+ // All properties.
+ if (collectionMode & InjectedScript.CollectionMode.AllProperties) {
+ descriptors.push(descriptor);
+ return;
+ }
+
+ // Own properties.
+ if (collectionMode & InjectedScript.CollectionMode.OwnProperties && isOwnProperty) {
+ descriptors.push(descriptor);
+ return;
+ }
+
+ // Native Getter properties.
+ if (collectionMode & InjectedScript.CollectionMode.NativeGetterProperties) {
+ // FIXME: <https://webkit.org/b/140575> Web Inspector: Native Bindings Descriptors are Incomplete
+ // if (descriptor.hasOwnProperty("get") && descriptor.get && isNativeFunction(descriptor.get)) { ... }
+
+ if (possibleNativeBindingGetter) {
+ // Possible getter property in the prototype chain.
+ descriptors.push(descriptor);
+ return;
+ }
+ }
+ }
+
+ function processProperties(o, properties, isOwnProperty)
+ {
+ for (var i = 0; i < properties.length; ++i) {
+ var property = properties[i];
+ if (nameProcessed.has(property) || property === "__proto__")
+ continue;
+
+ nameProcessed.add(property);
+
+ var name = toString(property);
+ var symbol = isSymbol(property) ? property : null;
+
+ var descriptor = Object.getOwnPropertyDescriptor(o, property);
+ if (!descriptor) {
+ // FIXME: Bad descriptor. Can we get here?
+ // Fall back to very restrictive settings.
+ var fakeDescriptor = createFakeValueDescriptor(name, symbol, {writable: false, configurable: false, enumerable: false}, isOwnProperty);
+ processDescriptor(fakeDescriptor, isOwnProperty);
+ continue;
+ }
+
+ if (endsWith(String(descriptor.get), "[native code]\n}") ||
+ (!descriptor.get && descriptor.hasOwnProperty("get") && !descriptor.set && descriptor.hasOwnProperty("set"))) {
+ // FIXME: Some Native Bindings Descriptors are Incomplete
+ // <https://webkit.org/b/141585> Some IDL attributes appear on the instances instead of on prototypes
+ // Developers may create such a descriptors, so we should be resilient:
+ // var x = {}; Object.defineProperty(x, "p", {get:undefined}); Object.getOwnPropertyDescriptor(x, "p")
+ var fakeDescriptor = createFakeValueDescriptor(name, symbol, descriptor, isOwnProperty, true);
+ processDescriptor(fakeDescriptor, isOwnProperty, true);
+ continue;
+ }
+
+ descriptor.name = name;
+ if (isOwnProperty)
+ descriptor.isOwn = true;
+ if (symbol)
+ descriptor.symbol = symbol;
+ processDescriptor(descriptor, isOwnProperty);
+ }
+ }
+
+ function arrayIndexPropertyNames(o, length)
+ {
+ var array = new Array(length);
+ for (var i = 0; i < length; ++i) {
+ if (i in o)
+ array.push("" + i);
+ }
+ return array;
+ }
+
+ // FIXME: <https://webkit.org/b/143589> Web Inspector: Better handling for large collections in Object Trees
+ // For array types with a large length we attempt to skip getOwnPropertyNames and instead just sublist of indexes.
+ var isArrayTypeWithLargeLength = false;
+ try {
+ isArrayTypeWithLargeLength = injectedScript._subtype(object) === "array" && isFinite(object.length) && object.length > 100;
+ } catch(e) {}
+
+ for (var o = object; this._isDefined(o); o = o.__proto__) {
+ var isOwnProperty = o === object;
+
+ if (isArrayTypeWithLargeLength && isOwnProperty)
+ processProperties(o, arrayIndexPropertyNames(o, 100), isOwnProperty);
+ else {
+ processProperties(o, Object.getOwnPropertyNames(o), isOwnProperty);
+ if (Object.getOwnPropertySymbols)
+ processProperties(o, Object.getOwnPropertySymbols(o), isOwnProperty);
+ }
+
+ if (collectionMode === InjectedScript.CollectionMode.OwnProperties)
+ break;
+ }
+
+ // Always include __proto__ at the end.
+ try {
+ if (object.__proto__)
+ descriptors.push({name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false, isOwn: true});
+ } catch (e) {}
+
+ return descriptors;
+ },
+
+ _isDefined: function(object)
+ {
+ return !!object || this._isHTMLAllCollection(object);
+ },
+
+ _isHTMLAllCollection: function(object)
+ {
+ // document.all is reported as undefined, but we still want to process it.
+ return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object);
+ },
+
+ _subtype: function(obj)
+ {
+ if (obj === null)
+ return "null";
+
+ if (this.isPrimitiveValue(obj) || isSymbol(obj))
+ return null;
+
+ if (this._isHTMLAllCollection(obj))
+ return "array";
+
+ var preciseType = InjectedScriptHost.subtype(obj);
+ if (preciseType)
+ return preciseType;
+
+ // FireBug's array detection.
+ try {
+ if (typeof obj.splice === "function" && isFinite(obj.length))
+ return "array";
+ } catch (e) {
+ }
+
+ return null;
+ },
+
+ _nodeDescription: function(node)
+ {
+ var isXMLDocument = node.ownerDocument && !!node.ownerDocument.xmlVersion;
+ var description = isXMLDocument ? node.nodeName : node.nodeName.toLowerCase();
+
+ switch (node.nodeType) {
+ case 1: // Node.ELEMENT_NODE
+ if (node.id)
+ description += "#" + node.id;
+ if (node.hasAttribute("class")) {
+ // Using .getAttribute() is a workaround for SVG*Element.className returning SVGAnimatedString,
+ // which doesn't have any useful String methods. See <https://webkit.org/b/145363/>.
+ description += "." + node.getAttribute("class").trim().replace(/\s+/g, ".");
+ }
+ return description;
+
+ default:
+ return description;
+ }
+ },
+
+ _classPreview: function(classConstructorValue)
+ {
+ return "class " + classConstructorValue.name;
+ },
+
+ _nodePreview: function(node)
+ {
+ var isXMLDocument = node.ownerDocument && !!node.ownerDocument.xmlVersion;
+ var nodeName = isXMLDocument ? node.nodeName : node.nodeName.toLowerCase();
+
+ switch (node.nodeType) {
+ case 1: // Node.ELEMENT_NODE
+ if (node.id)
+ return "<" + nodeName + " id=\"" + node.id + "\">";
+ if (node.classList.length)
+ return "<" + nodeName + " class=\"" + node.classList.toString().replace(/\s+/, " ") + "\">";
+ if (nodeName === "input" && node.type)
+ return "<" + nodeName + " type=\"" + node.type + "\">";
+ return "<" + nodeName + ">";
+
+ case 3: // Node.TEXT_NODE
+ return nodeName + " \"" + node.nodeValue + "\"";
+
+ case 8: // Node.COMMENT_NODE
+ return "<!--" + node.nodeValue + "-->";
+
+ case 10: // Node.DOCUMENT_TYPE_NODE
+ return "<!DOCTYPE " + nodeName + ">";
+
+ default:
+ return nodeName;
+ }
+ },
+
+ _describe: function(obj)
+ {
+ if (this.isPrimitiveValue(obj))
+ return null;
+
+ if (isSymbol(obj))
+ return toString(obj);
+
+ var subtype = this._subtype(obj);
+
+ if (subtype === "regexp")
+ return toString(obj);
+
+ if (subtype === "date")
+ return toString(obj);
+
+ if (subtype === "error")
+ return toString(obj);
+
+ if (subtype === "node")
+ return this._nodeDescription(obj);
+
+ var className = InjectedScriptHost.internalConstructorName(obj);
+ if (subtype === "array")
+ return className;
+
+ // NodeList in JSC is a function, check for array prior to this.
+ if (typeof obj === "function")
+ return toString(obj);
+
+ // If Object, try for a better name from the constructor.
+ if (className === "Object") {
+ var constructorName = obj.constructor && obj.constructor.name;
+ if (constructorName)
+ return constructorName;
+ }
+
+ return className;
+ },
+
+ _getSetEntries: function(object, skip, numberToFetch)
+ {
+ var entries = [];
+
+ for (var value of object) {
+ if (skip > 0) {
+ skip--;
+ continue;
+ }
+
+ entries.push({value});
+
+ if (numberToFetch && entries.length === numberToFetch)
+ break;
+ }
+
+ return entries;
+ },
+
+ _getMapEntries: function(object, skip, numberToFetch)
+ {
+ var entries = [];
+
+ for (var [key, value] of object) {
+ if (skip > 0) {
+ skip--;
+ continue;
+ }
+
+ entries.push({key, value});
+
+ if (numberToFetch && entries.length === numberToFetch)
+ break;
+ }
+
+ return entries;
+ },
+
+ _getWeakMapEntries: function(object, numberToFetch)
+ {
+ return InjectedScriptHost.weakMapEntries(object, numberToFetch);
+ },
+
+ _getWeakSetEntries: function(object, numberToFetch)
+ {
+ return InjectedScriptHost.weakSetEntries(object, numberToFetch);
+ },
+
+ _getIteratorEntries: function(object, numberToFetch)
+ {
+ return InjectedScriptHost.iteratorEntries(object, numberToFetch);
+ },
+
+ _entries: function(object, subtype, startIndex, numberToFetch)
+ {
+ if (subtype === "set")
+ return this._getSetEntries(object, startIndex, numberToFetch);
+ if (subtype === "map")
+ return this._getMapEntries(object, startIndex, numberToFetch);
+ if (subtype === "weakmap")
+ return this._getWeakMapEntries(object, numberToFetch);
+ if (subtype === "weakset")
+ return this._getWeakSetEntries(object, numberToFetch);
+ if (subtype === "iterator")
+ return this._getIteratorEntries(object, numberToFetch);
+
+ throw "unexpected type";
+ },
+
+ _saveResult: function(result)
+ {
+ this._lastResult = result;
+
+ if (result === undefined || result === null)
+ return;
+
+ var existingIndex = this._savedResults.indexOf(result);
+ if (existingIndex !== -1) {
+ this._savedResultIndex = existingIndex;
+ return;
+ }
+
+ this._savedResultIndex = this._nextSavedResultIndex;
+ this._savedResults[this._nextSavedResultIndex++] = result;
+
+ // $n is limited from $1-$99. $0 is special.
+ if (this._nextSavedResultIndex >= 100)
+ this._nextSavedResultIndex = 1;
+ },
+
+ _savedResult: function(index)
+ {
+ return this._savedResults[index];
+ }
+}
+
+var injectedScript = new InjectedScript;
+
+
+InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType, generatePreview, columnNames)
+{
+ this.type = typeof object;
+
+ if (this.type === "undefined" && injectedScript._isHTMLAllCollection(object))
+ this.type = "object";
+
+ if (injectedScript.isPrimitiveValue(object) || object === null || forceValueType) {
+ // We don't send undefined values over JSON.
+ if (this.type !== "undefined")
+ this.value = object;
+
+ // Null object is object with 'null' subtype.
+ if (object === null)
+ this.subtype = "null";
+
+ // Provide user-friendly number values.
+ if (this.type === "number")
+ this.description = toStringDescription(object);
+ return;
+ }
+
+ this.objectId = injectedScript._bind(object, objectGroupName);
+
+ var subtype = injectedScript._subtype(object);
+ if (subtype)
+ this.subtype = subtype;
+
+ this.className = InjectedScriptHost.internalConstructorName(object);
+ this.description = injectedScript._describe(object);
+
+ if (subtype === "array")
+ this.size = typeof object.length === "number" ? object.length : 0;
+ else if (subtype === "set" || subtype === "map")
+ this.size = object.size;
+ else if (subtype === "weakmap")
+ this.size = InjectedScriptHost.weakMapSize(object);
+ else if (subtype === "weakset")
+ this.size = InjectedScriptHost.weakSetSize(object);
+ else if (subtype === "class") {
+ this.classPrototype = injectedScript._wrapObject(object.prototype, objectGroupName);
+ this.className = object.name;
+ }
+
+ if (generatePreview && this.type === "object")
+ this.preview = this._generatePreview(object, undefined, columnNames);
+}
+
+InjectedScript.RemoteObject.prototype = {
+ _initialPreview: function()
+ {
+ var preview = {
+ type: this.type,
+ description: this.description || toString(this.value),
+ lossless: true,
+ };
+
+ if (this.subtype) {
+ preview.subtype = this.subtype;
+ if (this.subtype !== "null") {
+ preview.overflow = false;
+ preview.properties = [];
+ }
+ }
+
+ if ("size" in this)
+ preview.size = this.size;
+
+ return preview;
+ },
+
+ _emptyPreview: function()
+ {
+ var preview = this._initialPreview();
+
+ if (this.subtype === "map" || this.subtype === "set" || this.subtype === "weakmap" || this.subtype === "weakset" || this.subtype === "iterator") {
+ if (this.size) {
+ preview.entries = [];
+ preview.lossless = false;
+ preview.overflow = true;
+ }
+ }
+
+ return preview;
+ },
+
+ _createObjectPreviewForValue: function(value, generatePreview)
+ {
+ var remoteObject = new InjectedScript.RemoteObject(value, undefined, false, generatePreview, undefined);
+ if (remoteObject.objectId)
+ injectedScript.releaseObject(remoteObject.objectId);
+ if (remoteObject.classPrototype && remoteObject.classPrototype.objectId)
+ injectedScript.releaseObject(remoteObject.classPrototype.objectId);
+
+ return remoteObject.preview || remoteObject._emptyPreview();
+ },
+
+ _generatePreview: function(object, firstLevelKeys, secondLevelKeys)
+ {
+ var preview = this._initialPreview();
+ var isTableRowsRequest = secondLevelKeys === null || secondLevelKeys;
+ var firstLevelKeysCount = firstLevelKeys ? firstLevelKeys.length : 0;
+
+ var propertiesThreshold = {
+ properties: isTableRowsRequest ? 1000 : Math.max(5, firstLevelKeysCount),
+ indexes: isTableRowsRequest ? 1000 : Math.max(10, firstLevelKeysCount)
+ };
+
+ try {
+ // Maps, Sets, and Iterators have entries.
+ if (this.subtype === "map" || this.subtype === "set" || this.subtype === "weakmap" || this.subtype === "weakset" || this.subtype === "iterator")
+ this._appendEntryPreviews(object, preview);
+
+ preview.properties = [];
+
+ // Internal Properties.
+ var internalPropertyDescriptors = injectedScript._internalPropertyDescriptors(object, true);
+ if (internalPropertyDescriptors) {
+ this._appendPropertyPreviews(object, preview, internalPropertyDescriptors, true, propertiesThreshold, firstLevelKeys, secondLevelKeys);
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
+ return preview;
+ }
+
+ if (preview.entries)
+ return preview;
+
+ // Properties.
+ var descriptors = injectedScript._propertyDescriptors(object, InjectedScript.CollectionMode.AllProperties);
+ this._appendPropertyPreviews(object, preview, descriptors, false, propertiesThreshold, firstLevelKeys, secondLevelKeys);
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
+ return preview;
+ } catch (e) {
+ preview.lossless = false;
+ }
+
+ return preview;
+ },
+
+ _appendPropertyPreviews: function(object, preview, descriptors, internal, propertiesThreshold, firstLevelKeys, secondLevelKeys)
+ {
+ for (var descriptor of descriptors) {
+ // Seen enough.
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
+ break;
+
+ // Error in descriptor.
+ if (descriptor.wasThrown) {
+ preview.lossless = false;
+ continue;
+ }
+
+ // Do not show "__proto__" in preview.
+ var name = descriptor.name;
+ if (name === "__proto__")
+ continue;
+
+ // For arrays, only allow indexes.
+ if (this.subtype === "array" && !isUInt32(name))
+ continue;
+
+ // Do not show non-enumerable non-own properties. Special case to allow array indexes that may be on the prototype.
+ if (!descriptor.enumerable && !descriptor.isOwn && this.subtype !== "array")
+ continue;
+
+ // If we have a filter, only show properties in the filter.
+ // FIXME: Currently these filters do nothing on the backend.
+ if (firstLevelKeys && !firstLevelKeys.includes(name))
+ continue;
+
+ // Getter/setter.
+ if (!("value" in descriptor)) {
+ preview.lossless = false;
+ this._appendPropertyPreview(preview, internal, {name, type: "accessor"}, propertiesThreshold);
+ continue;
+ }
+
+ // Null value.
+ var value = descriptor.value;
+ if (value === null) {
+ this._appendPropertyPreview(preview, internal, {name, type: "object", subtype: "null", value: "null"}, propertiesThreshold);
+ continue;
+ }
+
+ // Ignore non-enumerable functions.
+ var type = typeof value;
+ if (!descriptor.enumerable && type === "function")
+ continue;
+
+ // Fix type of document.all.
+ if (type === "undefined" && injectedScript._isHTMLAllCollection(value))
+ type = "object";
+
+ // Primitive.
+ const maxLength = 100;
+ if (InjectedScript.primitiveTypes[type]) {
+ if (type === "string" && value.length > maxLength) {
+ value = this._abbreviateString(value, maxLength, true);
+ preview.lossless = false;
+ }
+ this._appendPropertyPreview(preview, internal, {name, type, value: toStringDescription(value)}, propertiesThreshold);
+ continue;
+ }
+
+ // Symbol.
+ if (isSymbol(value)) {
+ var symbolString = toString(value);
+ if (symbolString.length > maxLength) {
+ symbolString = this._abbreviateString(symbolString, maxLength, true);
+ preview.lossless = false;
+ }
+ this._appendPropertyPreview(preview, internal, {name, type, value: symbolString}, propertiesThreshold);
+ continue;
+ }
+
+ // Object.
+ var property = {name, type};
+ var subtype = injectedScript._subtype(value);
+ if (subtype)
+ property.subtype = subtype;
+
+ // Second level.
+ if ((secondLevelKeys === null || secondLevelKeys) || this._isPreviewableObject(value, object)) {
+ // FIXME: If we want secondLevelKeys filter to continue we would need some refactoring.
+ var subPreview = this._createObjectPreviewForValue(value, value !== object);
+ property.valuePreview = subPreview;
+ if (!subPreview.lossless)
+ preview.lossless = false;
+ if (subPreview.overflow)
+ preview.overflow = true;
+ } else {
+ var description = "";
+ if (type !== "function" || subtype === "class") {
+ var fullDescription;
+ if (subtype === "class")
+ fullDescription = "class " + value.name;
+ else if (subtype === "node")
+ fullDescription = injectedScript._nodePreview(value);
+ else
+ fullDescription = injectedScript._describe(value);
+ description = this._abbreviateString(fullDescription, maxLength, subtype === "regexp");
+ }
+ property.value = description;
+ preview.lossless = false;
+ }
+
+ this._appendPropertyPreview(preview, internal, property, propertiesThreshold);
+ }
+ },
+
+ _appendPropertyPreview: function(preview, internal, property, propertiesThreshold)
+ {
+ if (toString(property.name >>> 0) === property.name)
+ propertiesThreshold.indexes--;
+ else
+ propertiesThreshold.properties--;
+
+ if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) {
+ preview.overflow = true;
+ preview.lossless = false;
+ return;
+ }
+
+ if (internal)
+ property.internal = true;
+
+ preview.properties.push(property);
+ },
+
+ _appendEntryPreviews: function(object, preview)
+ {
+ // Fetch 6, but only return 5, so we can tell if we overflowed.
+ var entries = injectedScript._entries(object, this.subtype, 0, 6);
+ if (!entries)
+ return;
+
+ if (entries.length > 5) {
+ entries.pop();
+ preview.overflow = true;
+ preview.lossless = false;
+ }
+
+ function updateMainPreview(subPreview) {
+ if (!subPreview.lossless)
+ preview.lossless = false;
+ }
+
+ preview.entries = entries.map(function(entry) {
+ entry.value = this._createObjectPreviewForValue(entry.value, entry.value !== object);
+ updateMainPreview(entry.value);
+ if ("key" in entry) {
+ entry.key = this._createObjectPreviewForValue(entry.key, entry.key !== object);
+ updateMainPreview(entry.key);
+ }
+ return entry;
+ }, this);
+ },
+
+ _isPreviewableObject: function(value, object)
+ {
+ return this._isPreviewableObjectInternal(value, new Set([object]), 1);
+ },
+
+ _isPreviewableObjectInternal: function(object, knownObjects, depth)
+ {
+ // Deep object.
+ if (depth > 3)
+ return false;
+
+ // Primitive.
+ if (injectedScript.isPrimitiveValue(object) || isSymbol(object))
+ return true;
+
+ // Null.
+ if (object === null)
+ return true;
+
+ // Cyclic objects.
+ if (knownObjects.has(object))
+ return false;
+
+ ++depth;
+ knownObjects.add(object);
+
+ // Arrays are simple if they have 5 or less simple objects.
+ var subtype = injectedScript._subtype(object);
+ if (subtype === "array") {
+ var length = object.length;
+ if (length > 5)
+ return false;
+ for (var i = 0; i < length; ++i) {
+ if (!this._isPreviewableObjectInternal(object[i], knownObjects, depth))
+ return false;
+ }
+ return true;
+ }
+
+ // Not a basic object.
+ if (object.__proto__ && object.__proto__.__proto__)
+ return false;
+
+ // Objects are simple if they have 3 or less simple properties.
+ var ownPropertyNames = Object.getOwnPropertyNames(object);
+ if (ownPropertyNames.length > 3)
+ return false;
+ for (var propertyName of ownPropertyNames) {
+ if (!this._isPreviewableObjectInternal(object[propertyName], knownObjects, depth))
+ return false;
+ }
+
+ return true;
+ },
+
+ _abbreviateString: function(string, maxLength, middle)
+ {
+ if (string.length <= maxLength)
+ return string;
+
+ if (middle) {
+ var leftHalf = maxLength >> 1;
+ var rightHalf = maxLength - leftHalf - 1;
+ return string.substr(0, leftHalf) + "\u2026" + string.substr(string.length - rightHalf, rightHalf);
+ }
+
+ return string.substr(0, maxLength) + "\u2026";
+ }
+}
+
+InjectedScript.CallFrameProxy = function(ordinal, callFrame)
+{
+ this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
+ this.functionName = callFrame.functionName;
+ this.location = {scriptId: String(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column};
+ this.scopeChain = this._wrapScopeChain(callFrame);
+ this.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace");
+}
+
+InjectedScript.CallFrameProxy.prototype = {
+ _wrapScopeChain: function(callFrame)
+ {
+ var scopeChain = callFrame.scopeChain;
+ var scopeChainProxy = [];
+ for (var i = 0; i < scopeChain.length; i++)
+ scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace");
+ return scopeChainProxy;
+ }
+}
+
+InjectedScript.CallFrameProxy._scopeTypeNames = {
+ 0: "global", // GLOBAL_SCOPE
+ 1: "with", // WITH_SCOPE
+ 2: "closure", // CLOSURE_SCOPE
+ 3: "catch", // CATCH_SCOPE
+ 4: "functionName", // FUNCTION_NAME_SCOPE
+ 5: "globalLexicalEnvironment", // GLOBAL_LEXICAL_ENVIRONMENT_SCOPE
+ 6: "nestedLexical", // NESTED_LEXICAL_SCOPE
+}
+
+InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId)
+{
+ return {
+ object: injectedScript._wrapObject(scopeObject, groupId),
+ type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode]
+ };
+}
+
+
+function slice(array, index)
+{
+ var result = [];
+ for (var i = index || 0; i < array.length; ++i)
+ result.push(array[i]);
+ return result;
+}
+
+function bind(func, thisObject, var_args)
+{
+ var args = slice(arguments, 2);
+ return function(var_args) {
+ return func.apply(thisObject, args.concat(slice(arguments)));
+ }
+}
+
+function BasicCommandLineAPI()
+{
+ this.$_ = injectedScript._lastResult;
+ this.$exception = injectedScript._exceptionValue;
+
+ // $1-$99
+ for (var i = 1; i <= injectedScript._savedResults.length; ++i) {
+ var member = "$" + i;
+ if (member in inspectedGlobalObject)
+ continue;
+ this.__defineGetter__("$" + i, bind(injectedScript._savedResult, injectedScript, i));
+ }
+}
+
+return injectedScript;
+})
diff --git a/Source/JavaScriptCore/inspector/InspectorAgentBase.h b/Source/JavaScriptCore/inspector/InspectorAgentBase.h
new file mode 100644
index 000000000..d013bacb6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorAgentBase.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorAgentBase_h
+#define InspectorAgentBase_h
+
+#include <wtf/text/WTFString.h>
+
+namespace JSC {
+class JSGlobalObject;
+}
+
+namespace Inspector {
+
+class BackendDispatcher;
+class FrontendRouter;
+class InjectedScriptManager;
+class InspectorEnvironment;
+
+struct AgentContext {
+ InspectorEnvironment& environment;
+ InjectedScriptManager& injectedScriptManager;
+ FrontendRouter& frontendRouter;
+ BackendDispatcher& backendDispatcher;
+};
+
+struct JSAgentContext : public AgentContext {
+ JSAgentContext(AgentContext& context, JSC::JSGlobalObject& globalObject)
+ : AgentContext(context)
+ , inspectedGlobalObject(globalObject)
+ {
+ }
+
+ JSC::JSGlobalObject& inspectedGlobalObject;
+};
+
+enum class DisconnectReason {
+ InspectedTargetDestroyed,
+ InspectorDestroyed
+};
+
+class InspectorAgentBase {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ virtual ~InspectorAgentBase() { }
+
+ String domainName() const { return m_name; }
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) = 0;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) = 0;
+ virtual void discardAgent() { }
+
+protected:
+ InspectorAgentBase(const String& name)
+ : m_name(name)
+ {
+ }
+
+ String m_name;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorAgentBase_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
new file mode 100644
index 000000000..35ba34516
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorAgentRegistry.h"
+
+#include "InspectorAgentBase.h"
+
+namespace Inspector {
+
+AgentRegistry::AgentRegistry()
+{
+}
+
+AgentRegistry::~AgentRegistry()
+{
+ // Allow agents to remove cross-references to other agents that would otherwise
+ // make it difficult to establish a correct destruction order for all agents.
+ for (auto& agent : m_agents)
+ agent->discardAgent();
+}
+
+void AgentRegistry::append(std::unique_ptr<InspectorAgentBase> agent)
+{
+ m_agents.append(WTFMove(agent));
+}
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void AgentRegistry::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent)
+{
+ m_extraDomains.append(agent->domainName());
+
+ append(WTFMove(agent));
+}
+#endif
+
+void AgentRegistry::didCreateFrontendAndBackend(FrontendRouter* frontendRouter, BackendDispatcher* backendDispatcher)
+{
+ for (auto& agent : m_agents)
+ agent->didCreateFrontendAndBackend(frontendRouter, backendDispatcher);
+}
+
+void AgentRegistry::willDestroyFrontendAndBackend(DisconnectReason reason)
+{
+ for (auto& agent : m_agents)
+ agent->willDestroyFrontendAndBackend(reason);
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h
new file mode 100644
index 000000000..61ae9a0ca
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorAgentRegistry_h
+#define InspectorAgentRegistry_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class BackendDispatcher;
+class FrontendRouter;
+class InspectorAgentBase;
+
+enum class DisconnectReason;
+
+class JS_EXPORT_PRIVATE AgentRegistry {
+public:
+ AgentRegistry();
+ ~AgentRegistry();
+
+ void append(std::unique_ptr<InspectorAgentBase>);
+
+ void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*);
+ void willDestroyFrontendAndBackend(DisconnectReason);
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ void appendExtraAgent(std::unique_ptr<InspectorAgentBase>);
+ Vector<String> extraDomains() const { return m_extraDomains; }
+#endif
+
+private:
+ // These are declared here to avoid MSVC from trying to create default iplementations which would
+ // involve generating a copy constructor and copy assignment operator for the Vector of std::unique_ptrs.
+ AgentRegistry(const AgentRegistry&) = delete;
+ AgentRegistry& operator=(const AgentRegistry&) = delete;
+
+ Vector<std::unique_ptr<InspectorAgentBase>> m_agents;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ Vector<String> m_extraDomains;
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorAgentRegistry_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
new file mode 100644
index 000000000..06c3c1638
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
@@ -0,0 +1,339 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorBackendDispatcher.h"
+
+#include "InspectorFrontendRouter.h"
+#include "InspectorValues.h"
+#include <wtf/TemporaryChange.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+SupplementalBackendDispatcher::SupplementalBackendDispatcher(BackendDispatcher& backendDispatcher)
+ : m_backendDispatcher(backendDispatcher)
+{
+}
+
+SupplementalBackendDispatcher::~SupplementalBackendDispatcher()
+{
+}
+
+BackendDispatcher::CallbackBase::CallbackBase(Ref<BackendDispatcher>&& backendDispatcher, long requestId)
+ : m_backendDispatcher(WTFMove(backendDispatcher))
+ , m_requestId(requestId)
+{
+}
+
+bool BackendDispatcher::CallbackBase::isActive() const
+{
+ return !m_alreadySent && m_backendDispatcher->isActive();
+}
+
+void BackendDispatcher::CallbackBase::sendFailure(const ErrorString& error)
+{
+ ASSERT(error.length());
+
+ if (m_alreadySent)
+ return;
+
+ m_alreadySent = true;
+
+ // Immediately send an error message since this is an async response with a single error.
+ m_backendDispatcher->reportProtocolError(m_requestId, ServerError, error);
+ m_backendDispatcher->sendPendingErrors();
+}
+
+void BackendDispatcher::CallbackBase::sendSuccess(RefPtr<InspectorObject>&& partialMessage)
+{
+ if (m_alreadySent)
+ return;
+
+ m_alreadySent = true;
+ m_backendDispatcher->sendResponse(m_requestId, WTFMove(partialMessage));
+}
+
+BackendDispatcher::BackendDispatcher(Ref<FrontendRouter>&& router)
+ : m_frontendRouter(WTFMove(router))
+{
+}
+
+Ref<BackendDispatcher> BackendDispatcher::create(Ref<FrontendRouter>&& router)
+{
+ return adoptRef(*new BackendDispatcher(WTFMove(router)));
+}
+
+bool BackendDispatcher::isActive() const
+{
+ return m_frontendRouter->hasFrontends();
+}
+
+void BackendDispatcher::registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher* dispatcher)
+{
+ ASSERT_ARG(dispatcher, dispatcher);
+
+ // FIXME: <https://webkit.org/b/148492> Agents should only register with the backend once,
+ // and we should re-add the assertion that only one dispatcher is registered per domain.
+ m_dispatchers.set(domain, dispatcher);
+}
+
+void BackendDispatcher::dispatch(const String& message)
+{
+ Ref<BackendDispatcher> protect(*this);
+
+ ASSERT(!m_protocolErrors.size());
+
+ long requestId = 0;
+ RefPtr<InspectorObject> messageObject;
+
+ {
+ // In case this is a re-entrant call from a nested run loop, we don't want to lose
+ // the outer request's id just because the inner request is bogus.
+ TemporaryChange<Optional<long>> scopedRequestId(m_currentRequestId, Nullopt);
+
+ RefPtr<InspectorValue> parsedMessage;
+ if (!InspectorValue::parseJSON(message, parsedMessage)) {
+ reportProtocolError(ParseError, ASCIILiteral("Message must be in JSON format"));
+ sendPendingErrors();
+ return;
+ }
+
+ if (!parsedMessage->asObject(messageObject)) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("Message must be a JSONified object"));
+ sendPendingErrors();
+ return;
+ }
+
+ RefPtr<InspectorValue> requestIdValue;
+ if (!messageObject->getValue(ASCIILiteral("id"), requestIdValue)) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("'id' property was not found"));
+ sendPendingErrors();
+ return;
+ }
+
+ if (!requestIdValue->asInteger(requestId)) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("The type of 'id' property must be integer"));
+ sendPendingErrors();
+ return;
+ }
+ }
+
+ {
+ // We could be called re-entrantly from a nested run loop, so restore the previous id.
+ TemporaryChange<Optional<long>> scopedRequestId(m_currentRequestId, requestId);
+
+ RefPtr<InspectorValue> methodValue;
+ if (!messageObject->getValue(ASCIILiteral("method"), methodValue)) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("'method' property wasn't found"));
+ sendPendingErrors();
+ return;
+ }
+
+ String methodString;
+ if (!methodValue->asString(methodString)) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("The type of 'method' property must be string"));
+ sendPendingErrors();
+ return;
+ }
+
+ Vector<String> domainAndMethod;
+ methodString.split('.', true, domainAndMethod);
+ if (domainAndMethod.size() != 2 || !domainAndMethod[0].length() || !domainAndMethod[1].length()) {
+ reportProtocolError(InvalidRequest, ASCIILiteral("The 'method' property was formatted incorrectly. It should be 'Domain.method'"));
+ sendPendingErrors();
+ return;
+ }
+
+ String domain = domainAndMethod[0];
+ SupplementalBackendDispatcher* domainDispatcher = m_dispatchers.get(domain);
+ if (!domainDispatcher) {
+ reportProtocolError(MethodNotFound, "'" + domain + "' domain was not found");
+ sendPendingErrors();
+ return;
+ }
+
+ String method = domainAndMethod[1];
+ domainDispatcher->dispatch(requestId, method, messageObject.releaseNonNull());
+
+ if (m_protocolErrors.size())
+ sendPendingErrors();
+ }
+}
+
+void BackendDispatcher::sendResponse(long requestId, RefPtr<InspectorObject>&& result)
+{
+ ASSERT(!m_protocolErrors.size());
+
+ // The JSON-RPC 2.0 specification requires that the "error" member have the value 'null'
+ // if no error occurred during an invocation, but we do not include it at all.
+ Ref<InspectorObject> responseMessage = InspectorObject::create();
+ responseMessage->setObject(ASCIILiteral("result"), result);
+ responseMessage->setInteger(ASCIILiteral("id"), requestId);
+ m_frontendRouter->sendResponse(responseMessage->toJSONString());
+}
+
+void BackendDispatcher::sendPendingErrors()
+{
+ // These error codes are specified in JSON-RPC 2.0, Section 5.1.
+ static const int errorCodes[] = {
+ -32700, // ParseError
+ -32600, // InvalidRequest
+ -32601, // MethodNotFound
+ -32602, // InvalidParams
+ -32603, // InternalError
+ -32000, // ServerError
+ };
+
+ // To construct the error object, only use the last error's code and message.
+ // Per JSON-RPC 2.0, Section 5.1, the 'data' member may contain nested errors,
+ // but only one top-level Error object should be sent per request.
+ CommonErrorCode errorCode;
+ String errorMessage;
+ Ref<InspectorArray> payload = InspectorArray::create();
+
+ for (auto& data : m_protocolErrors) {
+ errorCode = std::get<0>(data);
+ errorMessage = std::get<1>(data);
+
+ ASSERT_ARG(errorCode, (unsigned)errorCode < WTF_ARRAY_LENGTH(errorCodes));
+ ASSERT_ARG(errorCode, errorCodes[errorCode]);
+
+ Ref<InspectorObject> error = InspectorObject::create();
+ error->setInteger(ASCIILiteral("code"), errorCodes[errorCode]);
+ error->setString(ASCIILiteral("message"), errorMessage);
+ payload->pushObject(WTFMove(error));
+ }
+
+ Ref<InspectorObject> topLevelError = InspectorObject::create();
+ topLevelError->setInteger(ASCIILiteral("code"), errorCodes[errorCode]);
+ topLevelError->setString(ASCIILiteral("message"), errorMessage);
+ topLevelError->setArray(ASCIILiteral("data"), WTFMove(payload));
+
+ Ref<InspectorObject> message = InspectorObject::create();
+ message->setObject(ASCIILiteral("error"), WTFMove(topLevelError));
+ if (m_currentRequestId)
+ message->setInteger(ASCIILiteral("id"), m_currentRequestId.value());
+ else {
+ // The 'null' value for an unknown id is specified in JSON-RPC 2.0, Section 5.
+ message->setValue(ASCIILiteral("id"), InspectorValue::null());
+ }
+
+ m_frontendRouter->sendResponse(message->toJSONString());
+
+ m_protocolErrors.clear();
+ m_currentRequestId = Nullopt;
+}
+
+void BackendDispatcher::reportProtocolError(CommonErrorCode errorCode, const String& errorMessage)
+{
+ reportProtocolError(m_currentRequestId, errorCode, errorMessage);
+}
+
+void BackendDispatcher::reportProtocolError(Optional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage)
+{
+ ASSERT_ARG(errorCode, errorCode >= 0);
+
+ // If the error was reported from an async callback, then no request id will be registered yet.
+ if (!m_currentRequestId)
+ m_currentRequestId = relatedRequestId;
+
+ m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage));
+}
+
+template<typename T>
+T BackendDispatcher::getPropertyValue(InspectorObject* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(InspectorValue&, T&)> asMethod, const char* typeName)
+{
+ T result(defaultValue);
+ // out_optionalValueFound signals to the caller whether an optional property was found.
+ // if out_optionalValueFound == nullptr, then this is a required property.
+ if (out_optionalValueFound)
+ *out_optionalValueFound = false;
+
+ if (!object) {
+ if (!out_optionalValueFound)
+ reportProtocolError(BackendDispatcher::InvalidParams, String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName));
+ return result;
+ }
+
+ auto findResult = object->find(name);
+ if (findResult == object->end()) {
+ if (!out_optionalValueFound)
+ reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName));
+ return result;
+ }
+
+ if (!asMethod(*findResult->value, result)) {
+ reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName));
+ return result;
+ }
+
+ if (out_optionalValueFound)
+ *out_optionalValueFound = true;
+
+ return result;
+}
+
+static bool castToInteger(InspectorValue& value, int& result) { return value.asInteger(result); }
+static bool castToNumber(InspectorValue& value, double& result) { return value.asDouble(result); }
+
+int BackendDispatcher::getInteger(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<int>(object, name, valueFound, 0, &castToInteger, "Integer");
+}
+
+double BackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<double>(object, name, valueFound, 0, &castToNumber, "Number");
+}
+
+String BackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<String>(object, name, valueFound, "", &InspectorValue::asString, "String");
+}
+
+bool BackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<bool>(object, name, valueFound, false, &InspectorValue::asBoolean, "Boolean");
+}
+
+RefPtr<InspectorObject> BackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<RefPtr<InspectorObject>>(object, name, valueFound, nullptr, &InspectorValue::asObject, "Object");
+}
+
+RefPtr<InspectorArray> BackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<RefPtr<InspectorArray>>(object, name, valueFound, nullptr, &InspectorValue::asArray, "Array");
+}
+
+RefPtr<InspectorValue> BackendDispatcher::getValue(InspectorObject* object, const String& name, bool* valueFound)
+{
+ return getPropertyValue<RefPtr<InspectorValue>>(object, name, valueFound, nullptr, &InspectorValue::asValue, "Value");
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
new file mode 100644
index 000000000..d86ad3eea
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorBackendDispatcher_h
+#define InspectorBackendDispatcher_h
+
+#include "InspectorFrontendRouter.h"
+#include "InspectorProtocolTypes.h"
+#include <wtf/Optional.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class BackendDispatcher;
+
+typedef String ErrorString;
+
+class SupplementalBackendDispatcher : public RefCounted<SupplementalBackendDispatcher> {
+public:
+ SupplementalBackendDispatcher(BackendDispatcher&);
+ virtual ~SupplementalBackendDispatcher();
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) = 0;
+protected:
+ Ref<BackendDispatcher> m_backendDispatcher;
+};
+
+class BackendDispatcher : public RefCounted<BackendDispatcher> {
+public:
+ JS_EXPORT_PRIVATE static Ref<BackendDispatcher> create(Ref<FrontendRouter>&&);
+
+ class JS_EXPORT_PRIVATE CallbackBase : public RefCounted<CallbackBase> {
+ public:
+ CallbackBase(Ref<BackendDispatcher>&&, long requestId);
+
+ bool isActive() const;
+ void disable() { m_alreadySent = true; }
+
+ void sendSuccess(RefPtr<InspectorObject>&&);
+ void sendFailure(const ErrorString&);
+
+ private:
+ Ref<BackendDispatcher> m_backendDispatcher;
+ long m_requestId;
+ bool m_alreadySent { false };
+ };
+
+ bool isActive() const;
+
+ bool hasProtocolErrors() const { return m_protocolErrors.size() > 0; }
+
+ enum CommonErrorCode {
+ ParseError = 0,
+ InvalidRequest,
+ MethodNotFound,
+ InvalidParams,
+ InternalError,
+ ServerError
+ };
+
+ void registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher*);
+ JS_EXPORT_PRIVATE void dispatch(const String& message);
+
+ JS_EXPORT_PRIVATE void sendResponse(long requestId, RefPtr<InspectorObject>&& result);
+ JS_EXPORT_PRIVATE void sendPendingErrors();
+
+ void reportProtocolError(CommonErrorCode, const String& errorMessage);
+ JS_EXPORT_PRIVATE void reportProtocolError(Optional<long> relatedRequestId, CommonErrorCode, const String& errorMessage);
+
+ template<typename T>
+ T getPropertyValue(InspectorObject*, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(InspectorValue&, T&)>, const char* typeName);
+
+ int getInteger(InspectorObject*, const String& name, bool* valueFound);
+ double getDouble(InspectorObject*, const String& name, bool* valueFound);
+ String getString(InspectorObject*, const String& name, bool* valueFound);
+ bool getBoolean(InspectorObject*, const String& name, bool* valueFound);
+ RefPtr<InspectorValue> getValue(InspectorObject*, const String& name, bool* valueFound);
+ RefPtr<InspectorObject> getObject(InspectorObject*, const String& name, bool* valueFound);
+ RefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound);
+
+private:
+ BackendDispatcher(Ref<FrontendRouter>&&);
+
+ Ref<FrontendRouter> m_frontendRouter;
+ HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
+
+ // Protocol errors reported for the top-level request being processed.
+ // If processing a request triggers async responses, then any related errors will
+ // be attributed to the top-level request, but generate separate error messages.
+ Vector<std::tuple<CommonErrorCode, String>> m_protocolErrors;
+
+ // For synchronously handled requests, avoid plumbing requestId through every
+ // call that could potentially fail with a protocol error.
+ Optional<long> m_currentRequestId { Nullopt };
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatcher_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorEnvironment.h b/Source/JavaScriptCore/inspector/InspectorEnvironment.h
new file mode 100644
index 000000000..6fd470a0a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorEnvironment.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorEnvironment_h
+#define InspectorEnvironment_h
+
+#include "CallData.h"
+
+namespace WTF {
+class Stopwatch;
+}
+
+namespace JSC {
+class Exception;
+class SourceCode;
+class VM;
+}
+
+namespace Inspector {
+
+class ScriptDebugServer;
+typedef JSC::JSValue (*InspectorFunctionCallHandler)(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>& returnedException);
+typedef JSC::JSValue (*InspectorEvaluateHandler)(JSC::ExecState*, const JSC::SourceCode&, JSC::JSValue thisValue, NakedPtr<JSC::Exception>& returnedException);
+
+class InspectorEnvironment {
+public:
+ virtual ~InspectorEnvironment() { }
+ virtual bool developerExtrasEnabled() const = 0;
+ virtual bool canAccessInspectedScriptState(JSC::ExecState*) const = 0;
+ virtual InspectorFunctionCallHandler functionCallHandler() const = 0;
+ virtual InspectorEvaluateHandler evaluateHandler() const = 0;
+ virtual void frontendInitialized() = 0;
+ virtual Ref<WTF::Stopwatch> executionStopwatch() = 0;
+ virtual ScriptDebugServer& scriptDebugServer() = 0;
+ virtual JSC::VM& vm() = 0;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorEnvironment_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h b/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h
new file mode 100644
index 000000000..3ddad22cc
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorFrontendChannel_h
+#define InspectorFrontendChannel_h
+
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+// Represents a one-way connection from an Inspection or Automation target to
+// a local or remote controller (such as a debugger or UI automation script).
+
+class FrontendChannel {
+public:
+
+ enum class ConnectionType {
+ Remote,
+ Local
+ };
+
+ virtual ~FrontendChannel() { }
+ virtual ConnectionType connectionType() const = 0;
+ virtual bool sendMessageToFrontend(const String& message) = 0;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendChannel_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
new file mode 100644
index 000000000..65f8525a2
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorFrontendRouter.h"
+
+#include "InspectorFrontendChannel.h"
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+Ref<FrontendRouter> FrontendRouter::create()
+{
+ return adoptRef(*new FrontendRouter);
+}
+
+void FrontendRouter::connectFrontend(FrontendChannel* connection)
+{
+ ASSERT_ARG(connection, connection);
+
+ if (m_connections.contains(connection)) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ m_connections.append(connection);
+}
+
+void FrontendRouter::disconnectFrontend(FrontendChannel* connection)
+{
+ ASSERT_ARG(connection, connection);
+
+ if (!m_connections.contains(connection)) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ m_connections.removeFirst(connection);
+}
+
+void FrontendRouter::disconnectAllFrontends()
+{
+ m_connections.clear();
+}
+
+bool FrontendRouter::hasLocalFrontend() const
+{
+ for (auto* connection : m_connections) {
+ if (connection->connectionType() == FrontendChannel::ConnectionType::Local)
+ return true;
+ }
+
+ return false;
+}
+
+bool FrontendRouter::hasRemoteFrontend() const
+{
+ for (auto* connection : m_connections) {
+ if (connection->connectionType() == FrontendChannel::ConnectionType::Remote)
+ return true;
+ }
+
+ return false;
+}
+
+void FrontendRouter::sendEvent(const String& message) const
+{
+ for (auto* connection : m_connections)
+ connection->sendMessageToFrontend(message);
+}
+
+void FrontendRouter::sendResponse(const String& message) const
+{
+ // FIXME: send responses to the appropriate frontend.
+ for (auto* connection : m_connections)
+ connection->sendMessageToFrontend(message);
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendRouter.h b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.h
new file mode 100644
index 000000000..9b2433041
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorFrontendRouter_h
+#define InspectorFrontendRouter_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE FrontendRouter : public RefCounted<FrontendRouter> {
+public:
+ static Ref<FrontendRouter> create();
+
+ bool hasFrontends() const { return !m_connections.isEmpty(); }
+ bool hasLocalFrontend() const;
+ bool hasRemoteFrontend() const;
+
+ unsigned frontendCount() const { return m_connections.size(); }
+
+ void connectFrontend(FrontendChannel*);
+ void disconnectFrontend(FrontendChannel*);
+ void disconnectAllFrontends();
+
+ void sendEvent(const String& message) const;
+ void sendResponse(const String& message) const;
+
+private:
+ Vector<FrontendChannel*, 2> m_connections;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendRouter_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h b/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
new file mode 100644
index 000000000..6e2f010a1
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 The Chromium Authors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorProtocolTypes_h
+#define InspectorProtocolTypes_h
+
+#include "InspectorValues.h"
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+template<typename T> struct BindingTraits;
+
+template<typename T>
+class OptOutput {
+public:
+ OptOutput() : m_assigned(false) { }
+
+ void operator=(T value)
+ {
+ m_value = value;
+ m_assigned = true;
+ }
+
+ bool isAssigned() const { return m_assigned; }
+
+ T getValue()
+ {
+ ASSERT(isAssigned());
+ return m_value;
+ }
+
+private:
+ T m_value;
+ bool m_assigned;
+
+ WTF_MAKE_NONCOPYABLE(OptOutput);
+};
+
+template<typename T>
+class Array : public InspectorArrayBase {
+private:
+ Array() { }
+
+ InspectorArray& openAccessors()
+ {
+ COMPILE_ASSERT(sizeof(InspectorArray) == sizeof(Array<T>), cannot_cast);
+ return *static_cast<InspectorArray*>(static_cast<InspectorArrayBase*>(this));
+ }
+
+public:
+ void addItem(Ref<T>&& value)
+ {
+ openAccessors().pushValue(&value.get());
+ }
+
+ void addItem(RefPtr<T>&& value)
+ {
+ openAccessors().pushValue(WTFMove(value));
+ }
+
+ void addItem(const String& value)
+ {
+ openAccessors().pushString(value);
+ }
+
+ void addItem(int value)
+ {
+ openAccessors().pushInteger(value);
+ }
+
+ void addItem(double value)
+ {
+ openAccessors().pushDouble(value);
+ }
+
+ static Ref<Array<T>> create()
+ {
+ return adoptRef(*new Array<T>());
+ }
+};
+
+// Helper methods for Protocol and other Inspector types are provided by
+// specializations of BindingTraits<T>. Some are generated for protocol types.
+
+template<typename T>
+struct BindingTraits {
+ typedef T BindingType;
+
+ static void push(InspectorArray&, BindingType&);
+ static InspectorValue::Type typeTag();
+ static RefPtr<T> runtimeCast(RefPtr<InspectorObject>&&);
+#if !ASSERT_DISABLED
+ static void assertValueHasExpectedType(InspectorValue*);
+#endif // !ASSERT_DISABLED
+};
+
+template<InspectorValue::Type TYPE>
+struct PrimitiveBindingTraits {
+#if !ASSERT_DISABLED
+ static void assertValueHasExpectedType(InspectorValue* value)
+ {
+ ASSERT_ARG(value, value && value->type() == TYPE);
+ }
+#endif // !ASSERT_DISABLED
+};
+
+template<typename T>
+struct BindingTraits<Protocol::Array<T>> {
+ static RefPtr<Array<T>> runtimeCast(RefPtr<InspectorValue>&& value)
+ {
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorArray> array;
+ bool castSucceeded = value->asArray(array);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+#if !ASSERT_DISABLED
+ assertValueHasExpectedType(array.get());
+#endif // !ASSERT_DISABLED
+ COMPILE_ASSERT(sizeof(Array<T>) == sizeof(InspectorArray), type_cast_problem);
+ return static_cast<Array<T>*>(static_cast<InspectorArrayBase*>(array.get()));
+ }
+
+#if !ASSERT_DISABLED
+ static void assertValueHasExpectedType(InspectorValue* value)
+ {
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorArray> array;
+ bool castSucceeded = value->asArray(array);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+ for (unsigned i = 0; i < array->length(); i++)
+ BindingTraits<T>::assertValueHasExpectedType(array->get(i).get());
+ }
+#endif // !ASSERT_DISABLED
+};
+
+template<>
+struct BindingTraits<InspectorValue> {
+#if !ASSERT_DISABLED
+ static void assertValueHasExpectedType(InspectorValue*)
+ {
+ }
+#endif // !ASSERT_DISABLED
+};
+
+template<> struct BindingTraits<InspectorArray> : public PrimitiveBindingTraits<InspectorValue::Type::Array> { };
+template<> struct BindingTraits<InspectorObject> : public PrimitiveBindingTraits<InspectorValue::Type::Object> { };
+template<> struct BindingTraits<String> : public PrimitiveBindingTraits<InspectorValue::Type::String> { };
+template<> struct BindingTraits<bool> : public PrimitiveBindingTraits<InspectorValue::Type::Boolean> { };
+template<> struct BindingTraits<double> : public PrimitiveBindingTraits<InspectorValue::Type::Double> { };
+template<> struct BindingTraits<int> : public PrimitiveBindingTraits<InspectorValue::Type::Integer> { };
+
+} // namespace Protocol
+
+using Protocol::BindingTraits;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolTypes_h)
diff --git a/Source/JavaScriptCore/inspector/InspectorValues.cpp b/Source/JavaScriptCore/inspector/InspectorValues.cpp
new file mode 100644
index 000000000..547b18133
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorValues.cpp
@@ -0,0 +1,888 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. 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.
+ */
+
+#include "config.h"
+#include "InspectorValues.h"
+
+#include <wtf/DecimalNumber.h>
+#include <wtf/dtoa.h>
+#include <wtf/text/StringBuilder.h>
+
+namespace Inspector {
+
+namespace {
+
+static const int stackLimit = 1000;
+
+enum Token {
+ OBJECT_BEGIN,
+ OBJECT_END,
+ ARRAY_BEGIN,
+ ARRAY_END,
+ STRING,
+ NUMBER,
+ BOOL_TRUE,
+ BOOL_FALSE,
+ NULL_TOKEN,
+ LIST_SEPARATOR,
+ OBJECT_PAIR_SEPARATOR,
+ INVALID_TOKEN,
+};
+
+const char* const nullString = "null";
+const char* const trueString = "true";
+const char* const falseString = "false";
+
+bool parseConstToken(const UChar* start, const UChar* end, const UChar** tokenEnd, const char* token)
+{
+ while (start < end && *token != '\0' && *start++ == *token++) { }
+
+ if (*token != '\0')
+ return false;
+
+ *tokenEnd = start;
+ return true;
+}
+
+bool readInt(const UChar* start, const UChar* end, const UChar** tokenEnd, bool canHaveLeadingZeros)
+{
+ if (start == end)
+ return false;
+
+ bool haveLeadingZero = '0' == *start;
+ int length = 0;
+ while (start < end && '0' <= *start && *start <= '9') {
+ ++start;
+ ++length;
+ }
+
+ if (!length)
+ return false;
+
+ if (!canHaveLeadingZeros && length > 1 && haveLeadingZero)
+ return false;
+
+ *tokenEnd = start;
+ return true;
+}
+
+bool parseNumberToken(const UChar* start, const UChar* end, const UChar** tokenEnd)
+{
+ // We just grab the number here. We validate the size in DecodeNumber.
+ // According to RFC4627, a valid number is: [minus] int [frac] [exp]
+ if (start == end)
+ return false;
+
+ UChar c = *start;
+ if ('-' == c)
+ ++start;
+
+ if (!readInt(start, end, &start, false))
+ return false;
+
+ if (start == end) {
+ *tokenEnd = start;
+ return true;
+ }
+
+ // Optional fraction part
+ c = *start;
+ if ('.' == c) {
+ ++start;
+ if (!readInt(start, end, &start, true))
+ return false;
+ if (start == end) {
+ *tokenEnd = start;
+ return true;
+ }
+ c = *start;
+ }
+
+ // Optional exponent part
+ if ('e' == c || 'E' == c) {
+ ++start;
+ if (start == end)
+ return false;
+ c = *start;
+ if ('-' == c || '+' == c) {
+ ++start;
+ if (start == end)
+ return false;
+ }
+ if (!readInt(start, end, &start, true))
+ return false;
+ }
+
+ *tokenEnd = start;
+ return true;
+}
+
+bool readHexDigits(const UChar* start, const UChar* end, const UChar** tokenEnd, int digits)
+{
+ if (end - start < digits)
+ return false;
+
+ for (int i = 0; i < digits; ++i) {
+ UChar c = *start++;
+ if (!(('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')))
+ return false;
+ }
+
+ *tokenEnd = start;
+ return true;
+}
+
+bool parseStringToken(const UChar* start, const UChar* end, const UChar** tokenEnd)
+{
+ while (start < end) {
+ UChar c = *start++;
+ if ('\\' == c) {
+ c = *start++;
+ // Make sure the escaped char is valid.
+ switch (c) {
+ case 'x':
+ if (!readHexDigits(start, end, &start, 2))
+ return false;
+ break;
+ case 'u':
+ if (!readHexDigits(start, end, &start, 4))
+ return false;
+ break;
+ case '\\':
+ case '/':
+ case 'b':
+ case 'f':
+ case 'n':
+ case 'r':
+ case 't':
+ case 'v':
+ case '"':
+ break;
+ default:
+ return false;
+ }
+ } else if ('"' == c) {
+ *tokenEnd = start;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+Token parseToken(const UChar* start, const UChar* end, const UChar** tokenStart, const UChar** tokenEnd)
+{
+ while (start < end && isSpaceOrNewline(*start))
+ ++start;
+
+ if (start == end)
+ return INVALID_TOKEN;
+
+ *tokenStart = start;
+
+ switch (*start) {
+ case 'n':
+ if (parseConstToken(start, end, tokenEnd, nullString))
+ return NULL_TOKEN;
+ break;
+ case 't':
+ if (parseConstToken(start, end, tokenEnd, trueString))
+ return BOOL_TRUE;
+ break;
+ case 'f':
+ if (parseConstToken(start, end, tokenEnd, falseString))
+ return BOOL_FALSE;
+ break;
+ case '[':
+ *tokenEnd = start + 1;
+ return ARRAY_BEGIN;
+ case ']':
+ *tokenEnd = start + 1;
+ return ARRAY_END;
+ case ',':
+ *tokenEnd = start + 1;
+ return LIST_SEPARATOR;
+ case '{':
+ *tokenEnd = start + 1;
+ return OBJECT_BEGIN;
+ case '}':
+ *tokenEnd = start + 1;
+ return OBJECT_END;
+ case ':':
+ *tokenEnd = start + 1;
+ return OBJECT_PAIR_SEPARATOR;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ case '-':
+ if (parseNumberToken(start, end, tokenEnd))
+ return NUMBER;
+ break;
+ case '"':
+ if (parseStringToken(start + 1, end, tokenEnd))
+ return STRING;
+ break;
+ }
+
+ return INVALID_TOKEN;
+}
+
+inline int hexToInt(UChar c)
+{
+ if ('0' <= c && c <= '9')
+ return c - '0';
+ if ('A' <= c && c <= 'F')
+ return c - 'A' + 10;
+ if ('a' <= c && c <= 'f')
+ return c - 'a' + 10;
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool decodeString(const UChar* start, const UChar* end, StringBuilder& output)
+{
+ while (start < end) {
+ UChar c = *start++;
+ if ('\\' != c) {
+ output.append(c);
+ continue;
+ }
+ c = *start++;
+ switch (c) {
+ case '"':
+ case '/':
+ case '\\':
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'x':
+ c = (hexToInt(*start) << 4) +
+ hexToInt(*(start + 1));
+ start += 2;
+ break;
+ case 'u':
+ c = (hexToInt(*start) << 12) +
+ (hexToInt(*(start + 1)) << 8) +
+ (hexToInt(*(start + 2)) << 4) +
+ hexToInt(*(start + 3));
+ start += 4;
+ break;
+ default:
+ return false;
+ }
+ output.append(c);
+ }
+
+ return true;
+}
+
+bool decodeString(const UChar* start, const UChar* end, String& output)
+{
+ if (start == end) {
+ output = emptyString();
+ return true;
+ }
+
+ if (start > end)
+ return false;
+
+ StringBuilder buffer;
+ buffer.reserveCapacity(end - start);
+ if (!decodeString(start, end, buffer))
+ return false;
+
+ output = buffer.toString();
+ return true;
+}
+
+RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth)
+{
+ if (depth > stackLimit)
+ return nullptr;
+
+ RefPtr<InspectorValue> result;
+ const UChar* tokenStart;
+ const UChar* tokenEnd;
+ Token token = parseToken(start, end, &tokenStart, &tokenEnd);
+ switch (token) {
+ case INVALID_TOKEN:
+ return nullptr;
+ case NULL_TOKEN:
+ result = InspectorValue::null();
+ break;
+ case BOOL_TRUE:
+ result = InspectorBasicValue::create(true);
+ break;
+ case BOOL_FALSE:
+ result = InspectorBasicValue::create(false);
+ break;
+ case NUMBER: {
+ bool ok;
+ double value = charactersToDouble(tokenStart, tokenEnd - tokenStart, &ok);
+ if (!ok)
+ return nullptr;
+ result = InspectorBasicValue::create(value);
+ break;
+ }
+ case STRING: {
+ String value;
+ bool ok = decodeString(tokenStart + 1, tokenEnd - 1, value);
+ if (!ok)
+ return nullptr;
+ result = InspectorString::create(value);
+ break;
+ }
+ case ARRAY_BEGIN: {
+ Ref<InspectorArray> array = InspectorArray::create();
+ start = tokenEnd;
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ while (token != ARRAY_END) {
+ RefPtr<InspectorValue> arrayNode = buildValue(start, end, &tokenEnd, depth + 1);
+ if (!arrayNode)
+ return nullptr;
+ array->pushValue(WTFMove(arrayNode));
+
+ // After a list value, we expect a comma or the end of the list.
+ start = tokenEnd;
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ if (token == LIST_SEPARATOR) {
+ start = tokenEnd;
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ if (token == ARRAY_END)
+ return nullptr;
+ } else if (token != ARRAY_END) {
+ // Unexpected value after list value. Bail out.
+ return nullptr;
+ }
+ }
+ if (token != ARRAY_END)
+ return nullptr;
+ result = WTFMove(array);
+ break;
+ }
+ case OBJECT_BEGIN: {
+ Ref<InspectorObject> object = InspectorObject::create();
+ start = tokenEnd;
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ while (token != OBJECT_END) {
+ if (token != STRING)
+ return nullptr;
+ String key;
+ if (!decodeString(tokenStart + 1, tokenEnd - 1, key))
+ return nullptr;
+ start = tokenEnd;
+
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ if (token != OBJECT_PAIR_SEPARATOR)
+ return nullptr;
+ start = tokenEnd;
+
+ RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, depth + 1);
+ if (!value)
+ return nullptr;
+ object->setValue(key, WTFMove(value));
+ start = tokenEnd;
+
+ // After a key/value pair, we expect a comma or the end of the
+ // object.
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ if (token == LIST_SEPARATOR) {
+ start = tokenEnd;
+ token = parseToken(start, end, &tokenStart, &tokenEnd);
+ if (token == OBJECT_END)
+ return nullptr;
+ } else if (token != OBJECT_END) {
+ // Unexpected value after last object value. Bail out.
+ return nullptr;
+ }
+ }
+ if (token != OBJECT_END)
+ return nullptr;
+ result = WTFMove(object);
+ break;
+ }
+
+ default:
+ // We got a token that's not a value.
+ return nullptr;
+ }
+ *valueTokenEnd = tokenEnd;
+ return result.release();
+}
+
+inline bool escapeChar(UChar c, StringBuilder& dst)
+{
+ switch (c) {
+ case '\b': dst.appendLiteral("\\b"); break;
+ case '\f': dst.appendLiteral("\\f"); break;
+ case '\n': dst.appendLiteral("\\n"); break;
+ case '\r': dst.appendLiteral("\\r"); break;
+ case '\t': dst.appendLiteral("\\t"); break;
+ case '\\': dst.appendLiteral("\\\\"); break;
+ case '"': dst.appendLiteral("\\\""); break;
+ default:
+ return false;
+ }
+ return true;
+}
+
+inline void doubleQuoteString(const String& str, StringBuilder& dst)
+{
+ dst.append('"');
+ for (unsigned i = 0; i < str.length(); ++i) {
+ UChar c = str[i];
+ if (!escapeChar(c, dst)) {
+ if (c < 32 || c > 126 || c == '<' || c == '>') {
+ // 1. Escaping <, > to prevent script execution.
+ // 2. Technically, we could also pass through c > 126 as UTF8, but this
+ // is also optional. It would also be a pain to implement here.
+ dst.append(String::format("\\u%04X", c));
+ } else
+ dst.append(c);
+ }
+ }
+ dst.append('"');
+}
+
+} // anonymous namespace
+
+bool InspectorValue::asBoolean(bool&) const
+{
+ return false;
+}
+
+bool InspectorValue::asDouble(double&) const
+{
+ return false;
+}
+
+bool InspectorValue::asDouble(float&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(int&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(unsigned&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(long&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(long long&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(unsigned long&) const
+{
+ return false;
+}
+
+bool InspectorValue::asInteger(unsigned long long&) const
+{
+ return false;
+}
+
+bool InspectorValue::asString(String&) const
+{
+ return false;
+}
+
+bool InspectorValue::asValue(RefPtr<InspectorValue>& output)
+{
+ output = this;
+ return true;
+}
+
+bool InspectorValue::asObject(RefPtr<InspectorObject>&)
+{
+ return false;
+}
+
+bool InspectorValue::asArray(RefPtr<InspectorArray>&)
+{
+ return false;
+}
+
+bool InspectorValue::parseJSON(const String& jsonInput, RefPtr<InspectorValue>& output)
+{
+ // FIXME: This whole file should just use StringView instead of UChar/length and avoid upconverting.
+ auto characters = StringView(jsonInput).upconvertedCharacters();
+ const UChar* start = characters;
+ const UChar* end = start + jsonInput.length();
+ const UChar* tokenEnd;
+ RefPtr<InspectorValue> result = buildValue(start, end, &tokenEnd, 0);
+ if (!result || tokenEnd != end)
+ return false;
+
+ output = result.release();
+ return true;
+}
+
+String InspectorValue::toJSONString() const
+{
+ StringBuilder result;
+ result.reserveCapacity(512);
+ writeJSON(result);
+ return result.toString();
+}
+
+void InspectorValue::writeJSON(StringBuilder& output) const
+{
+ ASSERT(m_type == Type::Null);
+
+ output.appendLiteral("null");
+}
+
+bool InspectorBasicValue::asBoolean(bool& output) const
+{
+ if (type() != Type::Boolean)
+ return false;
+
+ output = m_booleanValue;
+ return true;
+}
+
+bool InspectorBasicValue::asDouble(double& output) const
+{
+ if (type() != Type::Double)
+ return false;
+
+ output = m_doubleValue;
+ return true;
+}
+
+bool InspectorBasicValue::asDouble(float& output) const
+{
+ if (type() != Type::Double)
+ return false;
+
+ output = static_cast<float>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(int& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<int>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(unsigned& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<unsigned>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(long& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<long>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(long long& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<long long>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(unsigned long& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<unsigned long>(m_doubleValue);
+ return true;
+}
+
+bool InspectorBasicValue::asInteger(unsigned long long& output) const
+{
+ if (type() != Type::Integer && type() != Type::Double)
+ return false;
+
+ output = static_cast<unsigned long long>(m_doubleValue);
+ return true;
+}
+
+void InspectorBasicValue::writeJSON(StringBuilder& output) const
+{
+ ASSERT(type() == Type::Boolean || type() == Type::Double || type() == Type::Integer);
+
+ if (type() == Type::Boolean) {
+ if (m_booleanValue)
+ output.appendLiteral("true");
+ else
+ output.appendLiteral("false");
+ } else if (type() == Type::Double || type() == Type::Integer) {
+ NumberToLStringBuffer buffer;
+ if (!std::isfinite(m_doubleValue)) {
+ output.appendLiteral("null");
+ return;
+ }
+ DecimalNumber decimal = m_doubleValue;
+ unsigned length = 0;
+ if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLength) {
+ // Not enough room for decimal. Use exponential format.
+ if (decimal.bufferLengthForStringExponential() > WTF::NumberToStringBufferLength) {
+ // Fallback for an abnormal case if it's too little even for exponential.
+ output.appendLiteral("NaN");
+ return;
+ }
+ length = decimal.toStringExponential(buffer, WTF::NumberToStringBufferLength);
+ } else
+ length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
+ output.append(buffer, length);
+ }
+}
+
+bool InspectorString::asString(String& output) const
+{
+ output = m_stringValue;
+ return true;
+}
+
+void InspectorString::writeJSON(StringBuilder& output) const
+{
+ ASSERT(type() == Type::String);
+ doubleQuoteString(m_stringValue, output);
+}
+
+InspectorObjectBase::~InspectorObjectBase()
+{
+}
+
+bool InspectorObjectBase::asObject(RefPtr<InspectorObject>& output)
+{
+ COMPILE_ASSERT(sizeof(InspectorObject) == sizeof(InspectorObjectBase), cannot_cast);
+
+ output = static_cast<InspectorObject*>(this);
+ return true;
+}
+
+InspectorObject* InspectorObjectBase::openAccessors()
+{
+ COMPILE_ASSERT(sizeof(InspectorObject) == sizeof(InspectorObjectBase), cannot_cast);
+
+ return static_cast<InspectorObject*>(this);
+}
+
+bool InspectorObjectBase::getBoolean(const String& name, bool& output) const
+{
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asBoolean(output);
+}
+
+bool InspectorObjectBase::getString(const String& name, String& output) const
+{
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asString(output);
+}
+
+bool InspectorObjectBase::getObject(const String& name, RefPtr<InspectorObject>& output) const
+{
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asObject(output);
+}
+
+bool InspectorObjectBase::getArray(const String& name, RefPtr<InspectorArray>& output) const
+{
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asArray(output);
+}
+
+bool InspectorObjectBase::getValue(const String& name, RefPtr<InspectorValue>& output) const
+{
+ Dictionary::const_iterator findResult = m_data.find(name);
+ if (findResult == m_data.end())
+ return false;
+
+ output = findResult->value;
+ return true;
+}
+
+void InspectorObjectBase::remove(const String& name)
+{
+ m_data.remove(name);
+ m_order.removeFirst(name);
+}
+
+void InspectorObjectBase::writeJSON(StringBuilder& output) const
+{
+ output.append('{');
+ for (size_t i = 0; i < m_order.size(); ++i) {
+ auto findResult = m_data.find(m_order[i]);
+ ASSERT(findResult != m_data.end());
+ if (i)
+ output.append(',');
+ doubleQuoteString(findResult->key, output);
+ output.append(':');
+ findResult->value->writeJSON(output);
+ }
+ output.append('}');
+}
+
+InspectorObjectBase::InspectorObjectBase()
+ : InspectorValue(Type::Object)
+ , m_data()
+ , m_order()
+{
+}
+
+InspectorArrayBase::~InspectorArrayBase()
+{
+}
+
+bool InspectorArrayBase::asArray(RefPtr<InspectorArray>& output)
+{
+ COMPILE_ASSERT(sizeof(InspectorArrayBase) == sizeof(InspectorArray), cannot_cast);
+ output = static_cast<InspectorArray*>(this);
+ return true;
+}
+
+void InspectorArrayBase::writeJSON(StringBuilder& output) const
+{
+ output.append('[');
+ for (Vector<RefPtr<InspectorValue>>::const_iterator it = m_data.begin(); it != m_data.end(); ++it) {
+ if (it != m_data.begin())
+ output.append(',');
+ (*it)->writeJSON(output);
+ }
+ output.append(']');
+}
+
+InspectorArrayBase::InspectorArrayBase()
+ : InspectorValue(Type::Array)
+ , m_data()
+{
+}
+
+RefPtr<InspectorValue> InspectorArrayBase::get(size_t index) const
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size());
+ return m_data[index];
+}
+
+Ref<InspectorObject> InspectorObject::create()
+{
+ return adoptRef(*new InspectorObject);
+}
+
+Ref<InspectorArray> InspectorArray::create()
+{
+ return adoptRef(*new InspectorArray);
+}
+
+Ref<InspectorValue> InspectorValue::null()
+{
+ return adoptRef(*new InspectorValue);
+}
+
+Ref<InspectorString> InspectorString::create(const String& value)
+{
+ return adoptRef(*new InspectorString(value));
+}
+
+Ref<InspectorString> InspectorString::create(const char* value)
+{
+ return adoptRef(*new InspectorString(value));
+}
+
+Ref<InspectorBasicValue> InspectorBasicValue::create(bool value)
+{
+ return adoptRef(*new InspectorBasicValue(value));
+}
+
+Ref<InspectorBasicValue> InspectorBasicValue::create(int value)
+{
+ return adoptRef(*new InspectorBasicValue(value));
+}
+
+Ref<InspectorBasicValue> InspectorBasicValue::create(double value)
+{
+ return adoptRef(*new InspectorBasicValue(value));
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InspectorValues.h b/Source/JavaScriptCore/inspector/InspectorValues.h
new file mode 100644
index 000000000..81b870332
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/InspectorValues.h
@@ -0,0 +1,411 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. 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 InspectorValues_h
+#define InspectorValues_h
+
+#include "JSExportMacros.h"
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class InspectorArray;
+class InspectorArrayBase;
+class InspectorObject;
+class InspectorObjectBase;
+
+class JS_EXPORT_PRIVATE InspectorValue : public RefCounted<InspectorValue> {
+public:
+ static const int maxDepth = 1000;
+
+ InspectorValue()
+ : m_type(Type::Null) { }
+ virtual ~InspectorValue() { }
+
+ static Ref<InspectorValue> null();
+
+ enum class Type {
+ Null = 0,
+ Boolean,
+ Double,
+ Integer,
+ String,
+ Object,
+ Array
+ };
+
+ Type type() const { return m_type; }
+
+ bool isNull() const { return m_type == Type::Null; }
+
+ virtual bool asBoolean(bool&) const;
+ virtual bool asInteger(int&) const;
+ virtual bool asInteger(unsigned&) const;
+ virtual bool asInteger(long&) const;
+ virtual bool asInteger(long long&) const;
+ virtual bool asInteger(unsigned long&) const;
+ virtual bool asInteger(unsigned long long&) const;
+ virtual bool asDouble(double&) const;
+ virtual bool asDouble(float&) const;
+ virtual bool asString(String&) const;
+ virtual bool asValue(RefPtr<InspectorValue>&);
+ virtual bool asObject(RefPtr<InspectorObject>&);
+ virtual bool asArray(RefPtr<InspectorArray>&);
+
+ static bool parseJSON(const String& jsonInput, RefPtr<InspectorValue>& output);
+
+ String toJSONString() const;
+ virtual void writeJSON(StringBuilder& output) const;
+
+protected:
+ explicit InspectorValue(Type type) : m_type(type) { }
+
+private:
+ Type m_type;
+};
+
+class JS_EXPORT_PRIVATE InspectorBasicValue : public InspectorValue {
+public:
+
+ static Ref<InspectorBasicValue> create(bool);
+ static Ref<InspectorBasicValue> create(int);
+ static Ref<InspectorBasicValue> create(double);
+
+ virtual bool asBoolean(bool&) const override;
+ // Numbers from the frontend are always parsed as doubles, so we allow
+ // clients to convert to integral values with this function.
+ virtual bool asInteger(int&) const override;
+ virtual bool asInteger(unsigned&) const override;
+ virtual bool asInteger(long&) const override;
+ virtual bool asInteger(long long&) const override;
+ virtual bool asInteger(unsigned long&) const override;
+ virtual bool asInteger(unsigned long long&) const override;
+ virtual bool asDouble(double&) const override;
+ virtual bool asDouble(float&) const override;
+
+ virtual void writeJSON(StringBuilder& output) const override;
+
+private:
+ explicit InspectorBasicValue(bool value)
+ : InspectorValue(Type::Boolean)
+ , m_booleanValue(value) { }
+
+ explicit InspectorBasicValue(int value)
+ : InspectorValue(Type::Integer)
+ , m_doubleValue(static_cast<double>(value)) { }
+
+ explicit InspectorBasicValue(double value)
+ : InspectorValue(Type::Double)
+ , m_doubleValue(value) { }
+
+ union {
+ bool m_booleanValue;
+ double m_doubleValue;
+ };
+};
+
+class JS_EXPORT_PRIVATE InspectorString : public InspectorValue {
+public:
+ static Ref<InspectorString> create(const String&);
+ static Ref<InspectorString> create(const char*);
+
+ virtual bool asString(String& output) const override;
+
+ virtual void writeJSON(StringBuilder& output) const override;
+
+private:
+ explicit InspectorString(const String& value)
+ : InspectorValue(Type::String)
+ , m_stringValue(value) { }
+
+ explicit InspectorString(const char* value)
+ : InspectorValue(Type::String)
+ , m_stringValue(value) { }
+
+ String m_stringValue;
+};
+
+class JS_EXPORT_PRIVATE InspectorObjectBase : public InspectorValue {
+private:
+ typedef HashMap<String, RefPtr<InspectorValue>> Dictionary;
+
+public:
+ typedef Dictionary::iterator iterator;
+ typedef Dictionary::const_iterator const_iterator;
+
+ InspectorObject* openAccessors();
+
+protected:
+ virtual ~InspectorObjectBase();
+
+ virtual bool asObject(RefPtr<InspectorObject>& output) override;
+
+ // FIXME: use templates to reduce the amount of duplicated set*() methods.
+ void setBoolean(const String& name, bool);
+ void setInteger(const String& name, int);
+ void setDouble(const String& name, double);
+ void setString(const String& name, const String&);
+ void setValue(const String& name, RefPtr<InspectorValue>&&);
+ void setObject(const String& name, RefPtr<InspectorObjectBase>&&);
+ void setArray(const String& name, RefPtr<InspectorArrayBase>&&);
+
+ iterator find(const String& name);
+ const_iterator find(const String& name) const;
+
+ // FIXME: use templates to reduce the amount of duplicated get*() methods.
+ bool getBoolean(const String& name, bool& output) const;
+ template<class T> bool getDouble(const String& name, T& output) const
+ {
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asDouble(output);
+ }
+ template<class T> bool getInteger(const String& name, T& output) const
+ {
+ RefPtr<InspectorValue> value;
+ if (!getValue(name, value))
+ return false;
+
+ return value->asInteger(output);
+ }
+
+ bool getString(const String& name, String& output) const;
+ bool getObject(const String& name, RefPtr<InspectorObject>&) const;
+ bool getArray(const String& name, RefPtr<InspectorArray>&) const;
+ bool getValue(const String& name, RefPtr<InspectorValue>&) const;
+
+ void remove(const String& name);
+
+ virtual void writeJSON(StringBuilder& output) const override;
+
+ iterator begin() { return m_data.begin(); }
+ iterator end() { return m_data.end(); }
+ const_iterator begin() const { return m_data.begin(); }
+ const_iterator end() const { return m_data.end(); }
+
+ int size() const { return m_data.size(); }
+
+protected:
+ InspectorObjectBase();
+
+private:
+ Dictionary m_data;
+ Vector<String> m_order;
+};
+
+class InspectorObject : public InspectorObjectBase {
+public:
+ static JS_EXPORT_PRIVATE Ref<InspectorObject> create();
+
+ using InspectorObjectBase::asObject;
+
+ using InspectorObjectBase::setBoolean;
+ using InspectorObjectBase::setInteger;
+ using InspectorObjectBase::setDouble;
+ using InspectorObjectBase::setString;
+ using InspectorObjectBase::setValue;
+ using InspectorObjectBase::setObject;
+ using InspectorObjectBase::setArray;
+
+ using InspectorObjectBase::find;
+ using InspectorObjectBase::getBoolean;
+ using InspectorObjectBase::getInteger;
+ using InspectorObjectBase::getDouble;
+ using InspectorObjectBase::getString;
+ using InspectorObjectBase::getObject;
+ using InspectorObjectBase::getArray;
+ using InspectorObjectBase::getValue;
+
+ using InspectorObjectBase::remove;
+
+ using InspectorObjectBase::begin;
+ using InspectorObjectBase::end;
+
+ using InspectorObjectBase::size;
+};
+
+
+class JS_EXPORT_PRIVATE InspectorArrayBase : public InspectorValue {
+public:
+ typedef Vector<RefPtr<InspectorValue>>::iterator iterator;
+ typedef Vector<RefPtr<InspectorValue>>::const_iterator const_iterator;
+
+ unsigned length() const { return static_cast<unsigned>(m_data.size()); }
+
+protected:
+ virtual ~InspectorArrayBase();
+
+ virtual bool asArray(RefPtr<InspectorArray>&) override;
+
+ void pushBoolean(bool);
+ void pushInteger(int);
+ void pushDouble(double);
+ void pushString(const String&);
+ void pushValue(RefPtr<InspectorValue>&&);
+ void pushObject(RefPtr<InspectorObjectBase>&&);
+ void pushArray(RefPtr<InspectorArrayBase>&&);
+
+ RefPtr<InspectorValue> get(size_t index) const;
+
+ virtual void writeJSON(StringBuilder& output) const override;
+
+ iterator begin() { return m_data.begin(); }
+ iterator end() { return m_data.end(); }
+ const_iterator begin() const { return m_data.begin(); }
+ const_iterator end() const { return m_data.end(); }
+
+protected:
+ InspectorArrayBase();
+
+private:
+ Vector<RefPtr<InspectorValue>> m_data;
+};
+
+class InspectorArray : public InspectorArrayBase {
+public:
+ static JS_EXPORT_PRIVATE Ref<InspectorArray> create();
+
+ using InspectorArrayBase::asArray;
+
+ using InspectorArrayBase::pushBoolean;
+ using InspectorArrayBase::pushInteger;
+ using InspectorArrayBase::pushDouble;
+ using InspectorArrayBase::pushString;
+ using InspectorArrayBase::pushValue;
+ using InspectorArrayBase::pushObject;
+ using InspectorArrayBase::pushArray;
+
+ using InspectorArrayBase::get;
+
+ using InspectorArrayBase::begin;
+ using InspectorArrayBase::end;
+};
+
+
+inline InspectorObjectBase::iterator InspectorObjectBase::find(const String& name)
+{
+ return m_data.find(name);
+}
+
+inline InspectorObjectBase::const_iterator InspectorObjectBase::find(const String& name) const
+{
+ return m_data.find(name);
+}
+
+inline void InspectorObjectBase::setBoolean(const String& name, bool value)
+{
+ setValue(name, InspectorBasicValue::create(value));
+}
+
+inline void InspectorObjectBase::setInteger(const String& name, int value)
+{
+ setValue(name, InspectorBasicValue::create(value));
+}
+
+inline void InspectorObjectBase::setDouble(const String& name, double value)
+{
+ setValue(name, InspectorBasicValue::create(value));
+}
+
+inline void InspectorObjectBase::setString(const String& name, const String& value)
+{
+ setValue(name, InspectorString::create(value));
+}
+
+inline void InspectorObjectBase::setValue(const String& name, RefPtr<InspectorValue>&& value)
+{
+ ASSERT(value);
+ if (m_data.set(name, WTFMove(value)).isNewEntry)
+ m_order.append(name);
+}
+
+inline void InspectorObjectBase::setObject(const String& name, RefPtr<InspectorObjectBase>&& value)
+{
+ ASSERT(value);
+ if (m_data.set(name, WTFMove(value)).isNewEntry)
+ m_order.append(name);
+}
+
+inline void InspectorObjectBase::setArray(const String& name, RefPtr<InspectorArrayBase>&& value)
+{
+ ASSERT(value);
+ if (m_data.set(name, WTFMove(value)).isNewEntry)
+ m_order.append(name);
+}
+
+inline void InspectorArrayBase::pushBoolean(bool value)
+{
+ m_data.append(InspectorBasicValue::create(value));
+}
+
+inline void InspectorArrayBase::pushInteger(int value)
+{
+ m_data.append(InspectorBasicValue::create(value));
+}
+
+inline void InspectorArrayBase::pushDouble(double value)
+{
+ m_data.append(InspectorBasicValue::create(value));
+}
+
+inline void InspectorArrayBase::pushString(const String& value)
+{
+ m_data.append(InspectorString::create(value));
+}
+
+inline void InspectorArrayBase::pushValue(RefPtr<InspectorValue>&& value)
+{
+ ASSERT(value);
+ m_data.append(WTFMove(value));
+}
+
+inline void InspectorArrayBase::pushObject(RefPtr<InspectorObjectBase>&& value)
+{
+ ASSERT(value);
+ m_data.append(WTFMove(value));
+}
+
+inline void InspectorArrayBase::pushArray(RefPtr<InspectorArrayBase>&& value)
+{
+ ASSERT(value);
+ m_data.append(WTFMove(value));
+}
+
+} // namespace Inspector
+
+#endif // !defined(InspectorValues_h)
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
new file mode 100644
index 000000000..f4a155df1
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectConsoleClient.h"
+
+#include "ConsoleMessage.h"
+#include "InspectorConsoleAgent.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+#if !LOG_DISABLED
+static bool sLogToSystemConsole = true;
+#else
+static bool sLogToSystemConsole = false;
+#endif
+
+bool JSGlobalObjectConsoleClient::logToSystemConsole()
+{
+ return sLogToSystemConsole;
+}
+
+void JSGlobalObjectConsoleClient::setLogToSystemConsole(bool shouldLog)
+{
+ sLogToSystemConsole = shouldLog;
+}
+
+JSGlobalObjectConsoleClient::JSGlobalObjectConsoleClient(InspectorConsoleAgent* consoleAgent)
+ : ConsoleClient()
+ , m_consoleAgent(consoleAgent)
+{
+}
+
+void JSGlobalObjectConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<ScriptArguments>&& arguments)
+{
+ if (JSGlobalObjectConsoleClient::logToSystemConsole())
+ ConsoleClient::printConsoleMessageWithArguments(MessageSource::ConsoleAPI, type, level, exec, arguments.copyRef());
+
+ String message;
+ arguments->getFirstArgumentAsString(message);
+ m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, type, level, message, WTFMove(arguments), exec));
+}
+
+void JSGlobalObjectConsoleClient::count(ExecState* exec, RefPtr<ScriptArguments>&& arguments)
+{
+ m_consoleAgent->count(exec, arguments);
+}
+
+void JSGlobalObjectConsoleClient::profile(JSC::ExecState*, const String&)
+{
+ // FIXME: support |console.profile| for JSContexts. <https://webkit.org/b/136466>
+}
+
+void JSGlobalObjectConsoleClient::profileEnd(JSC::ExecState*, const String&)
+{
+ // FIXME: support |console.profile| for JSContexts. <https://webkit.org/b/136466>
+}
+
+void JSGlobalObjectConsoleClient::time(ExecState*, const String& title)
+{
+ m_consoleAgent->startTiming(title);
+}
+
+void JSGlobalObjectConsoleClient::timeEnd(ExecState* exec, const String& title)
+{
+ RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
+ m_consoleAgent->stopTiming(title, WTFMove(callStack));
+}
+
+void JSGlobalObjectConsoleClient::timeStamp(ExecState*, RefPtr<ScriptArguments>&&)
+{
+ // FIXME: JSContext inspection needs a timeline.
+ warnUnimplemented(ASCIILiteral("console.timeStamp"));
+}
+
+void JSGlobalObjectConsoleClient::warnUnimplemented(const String& method)
+{
+ String message = method + " is currently ignored in JavaScript context inspection.";
+ m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Warning, message, nullptr, nullptr));
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
new file mode 100644
index 000000000..12e1e4144
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectConsoleClient_h
+#define JSGlobalObjectConsoleClient_h
+
+#include "ConsoleClient.h"
+
+namespace Inspector {
+
+class InspectorConsoleAgent;
+
+class JSGlobalObjectConsoleClient final : public JSC::ConsoleClient {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ explicit JSGlobalObjectConsoleClient(InspectorConsoleAgent*);
+ virtual ~JSGlobalObjectConsoleClient() { }
+
+ static bool logToSystemConsole();
+ static void setLogToSystemConsole(bool);
+
+protected:
+ virtual void messageWithTypeAndLevel(MessageType, MessageLevel, JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
+ virtual void count(JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
+ virtual void profile(JSC::ExecState*, const String& title) override;
+ virtual void profileEnd(JSC::ExecState*, const String& title) override;
+ virtual void time(JSC::ExecState*, const String& title) override;
+ virtual void timeEnd(JSC::ExecState*, const String& title) override;
+ virtual void timeStamp(JSC::ExecState*, RefPtr<ScriptArguments>&&) override;
+
+private:
+ void warnUnimplemented(const String& method);
+ void internalAddMessage(MessageType, MessageLevel, JSC::ExecState*, RefPtr<ScriptArguments>&&);
+
+ InspectorConsoleAgent* m_consoleAgent;
+};
+
+}
+
+#endif // !defined(JSGlobalObjectConsoleClient_h)
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
new file mode 100644
index 000000000..fd7f869d4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectInspectorController.h"
+
+#include "Completion.h"
+#include "ConsoleMessage.h"
+#include "ErrorHandlingScope.h"
+#include "Exception.h"
+#include "InjectedScriptHost.h"
+#include "InjectedScriptManager.h"
+#include "InspectorAgent.h"
+#include "InspectorBackendDispatcher.h"
+#include "InspectorFrontendChannel.h"
+#include "InspectorFrontendRouter.h"
+#include "InspectorHeapAgent.h"
+#include "InspectorScriptProfilerAgent.h"
+#include "JSGlobalObject.h"
+#include "JSGlobalObjectConsoleAgent.h"
+#include "JSGlobalObjectConsoleClient.h"
+#include "JSGlobalObjectDebuggerAgent.h"
+#include "JSGlobalObjectRuntimeAgent.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+#include <wtf/Stopwatch.h>
+
+#include <cxxabi.h>
+#if OS(DARWIN) || (OS(LINUX) && !PLATFORM(GTK))
+#include <dlfcn.h>
+#include <execinfo.h>
+#endif
+
+#if ENABLE(REMOTE_INSPECTOR)
+#include "JSGlobalObjectDebuggable.h"
+#include "RemoteInspector.h"
+#endif
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObject& globalObject)
+ : m_globalObject(globalObject)
+ , m_injectedScriptManager(std::make_unique<InjectedScriptManager>(*this, InjectedScriptHost::create()))
+ , m_executionStopwatch(Stopwatch::create())
+ , m_scriptDebugServer(globalObject)
+ , m_frontendRouter(FrontendRouter::create())
+ , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
+{
+ AgentContext baseContext = {
+ *this,
+ *m_injectedScriptManager,
+ m_frontendRouter.get(),
+ m_backendDispatcher.get()
+ };
+
+ JSAgentContext context = {
+ baseContext,
+ globalObject
+ };
+
+ auto inspectorAgent = std::make_unique<InspectorAgent>(context);
+ auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
+ auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(context);
+ auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
+
+ m_inspectorAgent = inspectorAgent.get();
+ m_debuggerAgent = debuggerAgent.get();
+ m_consoleAgent = consoleAgent.get();
+ m_consoleClient = std::make_unique<JSGlobalObjectConsoleClient>(m_consoleAgent);
+
+ m_agents.append(WTFMove(inspectorAgent));
+ m_agents.append(WTFMove(runtimeAgent));
+ m_agents.append(WTFMove(consoleAgent));
+ m_agents.append(WTFMove(debuggerAgent));
+ m_agents.append(std::make_unique<InspectorHeapAgent>(context));
+ m_agents.append(std::make_unique<InspectorScriptProfilerAgent>(context));
+
+ m_executionStopwatch->start();
+}
+
+JSGlobalObjectInspectorController::~JSGlobalObjectInspectorController()
+{
+}
+
+void JSGlobalObjectInspectorController::globalObjectDestroyed()
+{
+ disconnectAllFrontends();
+
+ m_injectedScriptManager->disconnect();
+}
+
+void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* frontendChannel, bool isAutomaticInspection)
+{
+ ASSERT_ARG(frontendChannel, frontendChannel);
+
+ m_isAutomaticInspection = isAutomaticInspection;
+
+ bool connectedFirstFrontend = !m_frontendRouter->hasFrontends();
+ m_frontendRouter->connectFrontend(frontendChannel);
+
+ if (!connectedFirstFrontend)
+ return;
+
+ // FIXME: change this to notify agents which frontend has connected (by id).
+ m_agents.didCreateFrontendAndBackend(nullptr, nullptr);
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ m_inspectorAgent->activateExtraDomains(m_agents.extraDomains());
+
+ if (m_augmentingClient)
+ m_augmentingClient->inspectorConnected();
+#endif
+}
+
+void JSGlobalObjectInspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+{
+ ASSERT_ARG(frontendChannel, frontendChannel);
+
+ // FIXME: change this to notify agents which frontend has disconnected (by id).
+ m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
+
+ m_frontendRouter->disconnectFrontend(frontendChannel);
+
+ m_isAutomaticInspection = false;
+
+ bool disconnectedLastFrontend = !m_frontendRouter->hasFrontends();
+ if (!disconnectedLastFrontend)
+ return;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_augmentingClient)
+ m_augmentingClient->inspectorDisconnected();
+#endif
+}
+
+void JSGlobalObjectInspectorController::disconnectAllFrontends()
+{
+ // FIXME: change this to notify agents which frontend has disconnected (by id).
+ m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectedTargetDestroyed);
+
+ m_frontendRouter->disconnectAllFrontends();
+
+ m_isAutomaticInspection = false;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_augmentingClient)
+ m_augmentingClient->inspectorDisconnected();
+#endif
+}
+
+void JSGlobalObjectInspectorController::dispatchMessageFromFrontend(const String& message)
+{
+ m_backendDispatcher->dispatch(message);
+}
+
+void JSGlobalObjectInspectorController::pause()
+{
+ ErrorString dummyError;
+ m_debuggerAgent->enable(dummyError);
+ m_debuggerAgent->pause(dummyError);
+}
+
+void JSGlobalObjectInspectorController::appendAPIBacktrace(ScriptCallStack* callStack)
+{
+#if OS(DARWIN) || (OS(LINUX) && !PLATFORM(GTK))
+ static const int framesToShow = 31;
+ static const int framesToSkip = 3; // WTFGetBacktrace, appendAPIBacktrace, reportAPIException.
+
+ void* samples[framesToShow + framesToSkip];
+ int frames = framesToShow + framesToSkip;
+ WTFGetBacktrace(samples, &frames);
+
+ void** stack = samples + framesToSkip;
+ int size = frames - framesToSkip;
+ for (int i = 0; i < size; ++i) {
+ const char* mangledName = nullptr;
+ char* cxaDemangled = nullptr;
+ Dl_info info;
+ if (dladdr(stack[i], &info) && info.dli_sname)
+ mangledName = info.dli_sname;
+ if (mangledName)
+ cxaDemangled = abi::__cxa_demangle(mangledName, nullptr, nullptr, nullptr);
+ if (mangledName || cxaDemangled)
+ callStack->append(ScriptCallFrame(cxaDemangled ? cxaDemangled : mangledName, ASCIILiteral("[native code]"), 0, 0));
+ else
+ callStack->append(ScriptCallFrame(ASCIILiteral("?"), ASCIILiteral("[native code]"), 0, 0));
+ free(cxaDemangled);
+ }
+#else
+ UNUSED_PARAM(callStack);
+#endif
+}
+
+void JSGlobalObjectInspectorController::reportAPIException(ExecState* exec, Exception* exception)
+{
+ if (isTerminatedExecutionException(exception))
+ return;
+
+ ErrorHandlingScope errorScope(exec->vm());
+
+ RefPtr<ScriptCallStack> callStack = createScriptCallStackFromException(exec, exception, ScriptCallStack::maxCallStackSizeToCapture);
+ if (includesNativeCallStackWhenReportingExceptions())
+ appendAPIBacktrace(callStack.get());
+
+ // FIXME: <http://webkit.org/b/115087> Web Inspector: Should not evaluate JavaScript handling exceptions
+ // If this is a custom exception object, call toString on it to try and get a nice string representation for the exception.
+ String errorMessage = exception->value().toString(exec)->value(exec);
+ exec->clearException();
+
+ if (JSGlobalObjectConsoleClient::logToSystemConsole()) {
+ if (callStack->size()) {
+ const ScriptCallFrame& callFrame = callStack->at(0);
+ ConsoleClient::printConsoleMessage(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage, callFrame.sourceURL(), callFrame.lineNumber(), callFrame.columnNumber());
+ } else
+ ConsoleClient::printConsoleMessage(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage, String(), 0, 0);
+ }
+
+ m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Error, errorMessage, callStack));
+}
+
+ConsoleClient* JSGlobalObjectInspectorController::consoleClient() const
+{
+ return m_consoleClient.get();
+}
+
+bool JSGlobalObjectInspectorController::developerExtrasEnabled() const
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ if (!RemoteInspector::singleton().enabled())
+ return false;
+
+ if (!m_globalObject.inspectorDebuggable().remoteDebuggingAllowed())
+ return false;
+#endif
+
+ return true;
+}
+
+InspectorFunctionCallHandler JSGlobalObjectInspectorController::functionCallHandler() const
+{
+ return JSC::call;
+}
+
+InspectorEvaluateHandler JSGlobalObjectInspectorController::evaluateHandler() const
+{
+ return JSC::evaluate;
+}
+
+void JSGlobalObjectInspectorController::frontendInitialized()
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ if (m_isAutomaticInspection)
+ m_globalObject.inspectorDebuggable().unpauseForInitializedInspector();
+#endif
+}
+
+Ref<Stopwatch> JSGlobalObjectInspectorController::executionStopwatch()
+{
+ return m_executionStopwatch.copyRef();
+}
+
+JSGlobalObjectScriptDebugServer& JSGlobalObjectInspectorController::scriptDebugServer()
+{
+ return m_scriptDebugServer;
+}
+
+VM& JSGlobalObjectInspectorController::vm()
+{
+ return m_globalObject.vm();
+}
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void JSGlobalObjectInspectorController::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent)
+{
+ String domainName = agent->domainName();
+
+ // FIXME: change this to notify agents which frontend has connected (by id).
+ agent->didCreateFrontendAndBackend(nullptr, nullptr);
+
+ m_agents.appendExtraAgent(WTFMove(agent));
+
+ m_inspectorAgent->activateExtraDomain(domainName);
+}
+#endif
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h b/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
new file mode 100644
index 000000000..7ee90c134
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectInspectorController_h
+#define JSGlobalObjectInspectorController_h
+
+#include "InspectorAgentRegistry.h"
+#include "InspectorEnvironment.h"
+#include "InspectorFrontendRouter.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/text/WTFString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "AugmentableInspectorController.h"
+#endif
+
+namespace JSC {
+class ConsoleClient;
+class Exception;
+class ExecState;
+class JSGlobalObject;
+class JSValue;
+}
+
+namespace Inspector {
+
+class BackendDispatcher;
+class FrontendChannel;
+class InjectedScriptManager;
+class InspectorAgent;
+class InspectorConsoleAgent;
+class InspectorDebuggerAgent;
+class InspectorHeapAgent;
+class InspectorScriptProfilerAgent;
+class JSGlobalObjectConsoleClient;
+class ScriptCallStack;
+
+class JSGlobalObjectInspectorController final
+ : public InspectorEnvironment
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , public AugmentableInspectorController
+#endif
+{
+ WTF_MAKE_NONCOPYABLE(JSGlobalObjectInspectorController);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ JSGlobalObjectInspectorController(JSC::JSGlobalObject&);
+ ~JSGlobalObjectInspectorController();
+
+ void connectFrontend(FrontendChannel*, bool isAutomaticInspection);
+ void disconnectFrontend(FrontendChannel*);
+ void disconnectAllFrontends();
+
+ void dispatchMessageFromFrontend(const String&);
+
+ void globalObjectDestroyed();
+
+ bool includesNativeCallStackWhenReportingExceptions() const { return m_includeNativeCallStackWithExceptions; }
+ void setIncludesNativeCallStackWhenReportingExceptions(bool includesNativeCallStack) { m_includeNativeCallStackWithExceptions = includesNativeCallStack; }
+
+ void pause();
+ void reportAPIException(JSC::ExecState*, JSC::Exception*);
+
+ JSC::ConsoleClient* consoleClient() const;
+
+ virtual bool developerExtrasEnabled() const override;
+ virtual bool canAccessInspectedScriptState(JSC::ExecState*) const override { return true; }
+ virtual InspectorFunctionCallHandler functionCallHandler() const override;
+ virtual InspectorEvaluateHandler evaluateHandler() const override;
+ virtual void frontendInitialized() override;
+ virtual Ref<WTF::Stopwatch> executionStopwatch() override;
+ virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override;
+ virtual JSC::VM& vm() override;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const override { return m_augmentingClient; }
+ virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient* client) override { m_augmentingClient = client; }
+
+ virtual const FrontendRouter& frontendRouter() const override { return m_frontendRouter.get(); }
+ virtual BackendDispatcher& backendDispatcher() override { return m_backendDispatcher.get(); }
+ virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) override;
+#endif
+
+private:
+ void appendAPIBacktrace(ScriptCallStack* callStack);
+
+ JSC::JSGlobalObject& m_globalObject;
+ std::unique_ptr<InjectedScriptManager> m_injectedScriptManager;
+ std::unique_ptr<JSGlobalObjectConsoleClient> m_consoleClient;
+ Ref<WTF::Stopwatch> m_executionStopwatch;
+ JSGlobalObjectScriptDebugServer m_scriptDebugServer;
+
+ AgentRegistry m_agents;
+ InspectorAgent* m_inspectorAgent { nullptr };
+ InspectorConsoleAgent* m_consoleAgent { nullptr };
+ InspectorDebuggerAgent* m_debuggerAgent { nullptr };
+
+ Ref<FrontendRouter> m_frontendRouter;
+ Ref<BackendDispatcher> m_backendDispatcher;
+
+ bool m_includeNativeCallStackWithExceptions { true };
+ bool m_isAutomaticInspection { false };
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ AugmentableInspectorControllerClient* m_augmentingClient { nullptr };
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSGlobalObjectInspectorController_h)
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp
new file mode 100644
index 000000000..e9a28c1f9
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+
+#include "EventLoop.h"
+#include "JSCInlines.h"
+#include "JSLock.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer(JSGlobalObject& globalObject)
+ : ScriptDebugServer(globalObject.vm())
+ , m_globalObject(globalObject)
+{
+}
+
+void JSGlobalObjectScriptDebugServer::attachDebugger()
+{
+ attach(&m_globalObject);
+ recompileAllJSFunctions();
+}
+
+void JSGlobalObjectScriptDebugServer::detachDebugger(bool isBeingDestroyed)
+{
+ detach(&m_globalObject, isBeingDestroyed ? Debugger::GlobalObjectIsDestructing : Debugger::TerminatingDebuggingSession);
+ if (!isBeingDestroyed)
+ recompileAllJSFunctions();
+}
+
+void JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused()
+{
+ // Drop all locks so another thread can work in the VM while we are nested.
+ JSC::JSLock::DropAllLocks dropAllLocks(&m_globalObject.vm());
+
+ EventLoop loop;
+ while (!m_doneProcessingDebuggerEvents && !loop.ended())
+ loop.cycle();
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h
new file mode 100644
index 000000000..d808aa5cc
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectScriptDebugServer_h
+#define JSGlobalObjectScriptDebugServer_h
+
+#include "ScriptDebugServer.h"
+
+namespace Inspector {
+
+class JSGlobalObjectScriptDebugServer final : public ScriptDebugServer {
+ WTF_MAKE_NONCOPYABLE(JSGlobalObjectScriptDebugServer);
+public:
+ JSGlobalObjectScriptDebugServer(JSC::JSGlobalObject&);
+ virtual ~JSGlobalObjectScriptDebugServer() { }
+
+ JSC::JSGlobalObject& globalObject() const { return m_globalObject; }
+
+private:
+ virtual void attachDebugger() override;
+ virtual void detachDebugger(bool isBeingDestroyed) override;
+
+ virtual void didPause(JSC::JSGlobalObject*) override { }
+ virtual void didContinue(JSC::JSGlobalObject*) override { }
+ virtual void runEventLoopWhilePaused() override;
+ virtual bool isContentScript(JSC::ExecState*) const override { return false; }
+
+ // NOTE: Currently all exceptions are reported at the API boundary through reportAPIException.
+ // Until a time comes where an exception can be caused outside of the API (e.g. setTimeout
+ // or some other async operation in a pure JSContext) we can ignore exceptions reported here.
+ virtual void reportException(JSC::ExecState*, JSC::Exception*) const override { }
+
+ JSC::JSGlobalObject& m_globalObject;
+};
+
+} // namespace Inspector
+
+#endif // JSGlobalObjectScriptDebugServer_h
diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
new file mode 100644
index 000000000..3ad8bfa73
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSInjectedScriptHost.h"
+
+#include "DateInstance.h"
+#include "DirectArguments.h"
+#include "Error.h"
+#include "InjectedScriptHost.h"
+#include "IteratorOperations.h"
+#include "JSArray.h"
+#include "JSArrayIterator.h"
+#include "JSBoundFunction.h"
+#include "JSCInlines.h"
+#include "JSFunction.h"
+#include "JSInjectedScriptHostPrototype.h"
+#include "JSMap.h"
+#include "JSMapIterator.h"
+#include "JSPromise.h"
+#include "JSPropertyNameIterator.h"
+#include "JSSet.h"
+#include "JSSetIterator.h"
+#include "JSStringIterator.h"
+#include "JSTypedArrays.h"
+#include "JSWeakMap.h"
+#include "JSWeakSet.h"
+#include "ObjectConstructor.h"
+#include "RegExpObject.h"
+#include "ScopedArguments.h"
+#include "SourceCode.h"
+#include "TypedArrayInlines.h"
+#include "WeakMapData.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+const ClassInfo JSInjectedScriptHost::s_info = { "InjectedScriptHost", &Base::s_info, 0, CREATE_METHOD_TABLE(JSInjectedScriptHost) };
+
+JSInjectedScriptHost::JSInjectedScriptHost(VM& vm, Structure* structure, Ref<InjectedScriptHost>&& impl)
+ : JSDestructibleObject(vm, structure)
+ , m_wrapped(WTFMove(impl))
+{
+}
+
+void JSInjectedScriptHost::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+}
+
+JSObject* JSInjectedScriptHost::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return JSInjectedScriptHostPrototype::create(vm, globalObject, JSInjectedScriptHostPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+void JSInjectedScriptHost::destroy(JSC::JSCell* cell)
+{
+ JSInjectedScriptHost* thisObject = static_cast<JSInjectedScriptHost*>(cell);
+ thisObject->JSInjectedScriptHost::~JSInjectedScriptHost();
+}
+
+JSValue JSInjectedScriptHost::evaluate(ExecState* exec) const
+{
+ JSGlobalObject* globalObject = exec->lexicalGlobalObject();
+ return globalObject->evalFunction();
+}
+
+JSValue JSInjectedScriptHost::internalConstructorName(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSObject* object = jsCast<JSObject*>(exec->uncheckedArgument(0).toThis(exec, NotStrictMode));
+ return jsString(exec, JSObject::calculatedClassName(object));
+}
+
+JSValue JSInjectedScriptHost::isHTMLAllCollection(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ return jsBoolean(impl().isHTMLAllCollection(value));
+}
+
+JSValue JSInjectedScriptHost::subtype(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ if (value.isString())
+ return exec->vm().smallStrings.stringString();
+ if (value.isBoolean())
+ return exec->vm().smallStrings.booleanString();
+ if (value.isNumber())
+ return exec->vm().smallStrings.numberString();
+ if (value.isSymbol())
+ return exec->vm().smallStrings.symbolString();
+
+ JSObject* object = asObject(value);
+ if (object) {
+ if (object->isErrorInstance())
+ return jsNontrivialString(exec, ASCIILiteral("error"));
+
+ // Consider class constructor functions class objects.
+ JSFunction* function = jsDynamicCast<JSFunction*>(value);
+ if (function && function->isClassConstructorFunction())
+ return jsNontrivialString(exec, ASCIILiteral("class"));
+ }
+
+ if (value.inherits(JSArray::info()))
+ return jsNontrivialString(exec, ASCIILiteral("array"));
+ if (value.inherits(DirectArguments::info()) || value.inherits(ScopedArguments::info()))
+ return jsNontrivialString(exec, ASCIILiteral("array"));
+
+ if (value.inherits(DateInstance::info()))
+ return jsNontrivialString(exec, ASCIILiteral("date"));
+ if (value.inherits(RegExpObject::info()))
+ return jsNontrivialString(exec, ASCIILiteral("regexp"));
+
+ if (value.inherits(JSMap::info()))
+ return jsNontrivialString(exec, ASCIILiteral("map"));
+ if (value.inherits(JSSet::info()))
+ return jsNontrivialString(exec, ASCIILiteral("set"));
+ if (value.inherits(JSWeakMap::info()))
+ return jsNontrivialString(exec, ASCIILiteral("weakmap"));
+ if (value.inherits(JSWeakSet::info()))
+ return jsNontrivialString(exec, ASCIILiteral("weakset"));
+
+ if (value.inherits(JSArrayIterator::info())
+ || value.inherits(JSMapIterator::info())
+ || value.inherits(JSSetIterator::info())
+ || value.inherits(JSStringIterator::info())
+ || value.inherits(JSPropertyNameIterator::info()))
+ return jsNontrivialString(exec, ASCIILiteral("iterator"));
+
+ if (value.inherits(JSInt8Array::info()) || value.inherits(JSInt16Array::info()) || value.inherits(JSInt32Array::info()))
+ return jsNontrivialString(exec, ASCIILiteral("array"));
+ if (value.inherits(JSUint8Array::info()) || value.inherits(JSUint16Array::info()) || value.inherits(JSUint32Array::info()))
+ return jsNontrivialString(exec, ASCIILiteral("array"));
+ if (value.inherits(JSFloat32Array::info()) || value.inherits(JSFloat64Array::info()))
+ return jsNontrivialString(exec, ASCIILiteral("array"));
+
+ return impl().subtype(exec, value);
+}
+
+JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ if (!value.asCell()->inherits(JSFunction::info()))
+ return jsUndefined();
+
+ // FIXME: This should provide better details for JSBoundFunctions.
+
+ JSFunction* function = jsCast<JSFunction*>(value);
+ const SourceCode* sourceCode = function->sourceCode();
+ if (!sourceCode)
+ return jsUndefined();
+
+ // In the inspector protocol all positions are 0-based while in SourceCode they are 1-based
+ int lineNumber = sourceCode->firstLine();
+ if (lineNumber)
+ lineNumber -= 1;
+ int columnNumber = sourceCode->startColumn();
+ if (columnNumber)
+ columnNumber -= 1;
+
+ String scriptID = String::number(sourceCode->provider()->asID());
+ JSObject* location = constructEmptyObject(exec);
+ location->putDirect(exec->vm(), Identifier::fromString(exec, "scriptId"), jsString(exec, scriptID));
+ location->putDirect(exec->vm(), Identifier::fromString(exec, "lineNumber"), jsNumber(lineNumber));
+ location->putDirect(exec->vm(), Identifier::fromString(exec, "columnNumber"), jsNumber(columnNumber));
+
+ JSObject* result = constructEmptyObject(exec);
+ result->putDirect(exec->vm(), Identifier::fromString(exec, "location"), location);
+
+ String name = function->name(exec);
+ if (!name.isEmpty())
+ result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));
+
+ String displayName = function->displayName(exec);
+ if (!displayName.isEmpty())
+ result->putDirect(exec->vm(), Identifier::fromString(exec, "displayName"), jsString(exec, displayName));
+
+ // FIXME: provide function scope data in "scopesRaw" property when JSC supports it.
+ // <https://webkit.org/b/87192> [JSC] expose function (closure) inner context to debugger
+
+ return result;
+}
+
+static JSObject* constructInternalProperty(ExecState* exec, const String& name, JSValue value)
+{
+ JSObject* result = constructEmptyObject(exec);
+ result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));
+ result->putDirect(exec->vm(), Identifier::fromString(exec, "value"), value);
+ return result;
+}
+
+JSValue JSInjectedScriptHost::getInternalProperties(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+
+ if (JSPromise* promise = jsDynamicCast<JSPromise*>(value)) {
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr);
+ switch (promise->status(exec->vm())) {
+ case JSPromise::Status::Pending:
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("pending"))));
+ break;
+ case JSPromise::Status::Fulfilled:
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("resolved"))));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
+ break;
+ case JSPromise::Status::Rejected:
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("status"), jsNontrivialString(exec, ASCIILiteral("rejected"))));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, ASCIILiteral("result"), promise->result(exec->vm())));
+ break;
+ }
+ // FIXME: <https://webkit.org/b/141664> Web Inspector: ES6: Improved Support for Promises - Promise Reactions
+ return array;
+ }
+
+ if (JSBoundFunction* boundFunction = jsDynamicCast<JSBoundFunction*>(value)) {
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 3);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "targetFunction", boundFunction->targetFunction()));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundThis", boundFunction->boundThis()));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "boundArgs", boundFunction->boundArgs()));
+ return array;
+ }
+
+ if (JSArrayIterator* arrayIterator = jsDynamicCast<JSArrayIterator*>(value)) {
+ String kind;
+ switch (arrayIterator->kind(exec)) {
+ case ArrayIterateKey:
+ kind = ASCIILiteral("key");
+ break;
+ case ArrayIterateValue:
+ kind = ASCIILiteral("value");
+ break;
+ case ArrayIterateKeyValue:
+ kind = ASCIILiteral("key+value");
+ break;
+ }
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 2);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "array", arrayIterator->iteratedValue(exec)));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
+ return array;
+ }
+
+ if (JSMapIterator* mapIterator = jsDynamicCast<JSMapIterator*>(value)) {
+ String kind;
+ switch (mapIterator->kind()) {
+ case MapIterateKey:
+ kind = ASCIILiteral("key");
+ break;
+ case MapIterateValue:
+ kind = ASCIILiteral("value");
+ break;
+ case MapIterateKeyValue:
+ kind = ASCIILiteral("key+value");
+ break;
+ }
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 2);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "map", mapIterator->iteratedValue()));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
+ return array;
+ }
+
+ if (JSSetIterator* setIterator = jsDynamicCast<JSSetIterator*>(value)) {
+ String kind;
+ switch (setIterator->kind()) {
+ case SetIterateKey:
+ kind = ASCIILiteral("key");
+ break;
+ case SetIterateValue:
+ kind = ASCIILiteral("value");
+ break;
+ case SetIterateKeyValue:
+ kind = ASCIILiteral("key+value");
+ break;
+ }
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 2);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "set", setIterator->iteratedValue()));
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "kind", jsNontrivialString(exec, kind)));
+ return array;
+ }
+
+ if (JSStringIterator* stringIterator = jsDynamicCast<JSStringIterator*>(value)) {
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 1);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "string", stringIterator->iteratedValue(exec)));
+ return array;
+ }
+
+ if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value)) {
+ unsigned index = 0;
+ JSArray* array = constructEmptyArray(exec, nullptr, 1);
+ array->putDirectIndex(exec, index++, constructInternalProperty(exec, "object", propertyNameIterator->iteratedValue()));
+ return array;
+ }
+
+ return jsUndefined();
+}
+
+JSValue JSInjectedScriptHost::weakMapSize(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value);
+ if (!weakMap)
+ return jsUndefined();
+
+ return jsNumber(weakMap->weakMapData()->size());
+}
+
+JSValue JSInjectedScriptHost::weakMapEntries(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ JSWeakMap* weakMap = jsDynamicCast<JSWeakMap*>(value);
+ if (!weakMap)
+ return jsUndefined();
+
+ unsigned fetched = 0;
+ unsigned numberToFetch = 100;
+
+ JSValue numberToFetchArg = exec->argument(1);
+ double fetchDouble = numberToFetchArg.toInteger(exec);
+ if (fetchDouble >= 0)
+ numberToFetch = static_cast<unsigned>(fetchDouble);
+
+ JSArray* array = constructEmptyArray(exec, nullptr);
+ for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) {
+ JSObject* entry = constructEmptyObject(exec);
+ entry->putDirect(exec->vm(), Identifier::fromString(exec, "key"), it->key);
+ entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->value.get());
+ array->putDirectIndex(exec, fetched++, entry);
+ if (numberToFetch && fetched >= numberToFetch)
+ break;
+ }
+
+ return array;
+}
+
+JSValue JSInjectedScriptHost::weakSetSize(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ JSWeakSet* weakSet = jsDynamicCast<JSWeakSet*>(value);
+ if (!weakSet)
+ return jsUndefined();
+
+ return jsNumber(weakSet->weakMapData()->size());
+}
+
+JSValue JSInjectedScriptHost::weakSetEntries(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue value = exec->uncheckedArgument(0);
+ JSWeakSet* weakSet = jsDynamicCast<JSWeakSet*>(value);
+ if (!weakSet)
+ return jsUndefined();
+
+ unsigned fetched = 0;
+ unsigned numberToFetch = 100;
+
+ JSValue numberToFetchArg = exec->argument(1);
+ double fetchDouble = numberToFetchArg.toInteger(exec);
+ if (fetchDouble >= 0)
+ numberToFetch = static_cast<unsigned>(fetchDouble);
+
+ JSArray* array = constructEmptyArray(exec, nullptr);
+ for (auto it = weakSet->weakMapData()->begin(); it != weakSet->weakMapData()->end(); ++it) {
+ JSObject* entry = constructEmptyObject(exec);
+ entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->key);
+ array->putDirectIndex(exec, fetched++, entry);
+ if (numberToFetch && fetched >= numberToFetch)
+ break;
+ }
+
+ return array;
+}
+
+JSValue JSInjectedScriptHost::iteratorEntries(ExecState* exec)
+{
+ if (exec->argumentCount() < 1)
+ return jsUndefined();
+
+ JSValue iterator;
+ JSValue value = exec->uncheckedArgument(0);
+ if (JSArrayIterator* arrayIterator = jsDynamicCast<JSArrayIterator*>(value))
+ iterator = arrayIterator->clone(exec);
+ else if (JSMapIterator* mapIterator = jsDynamicCast<JSMapIterator*>(value))
+ iterator = mapIterator->clone(exec);
+ else if (JSSetIterator* setIterator = jsDynamicCast<JSSetIterator*>(value))
+ iterator = setIterator->clone(exec);
+ else if (JSStringIterator* stringIterator = jsDynamicCast<JSStringIterator*>(value))
+ iterator = stringIterator->clone(exec);
+ else if (JSPropertyNameIterator* propertyNameIterator = jsDynamicCast<JSPropertyNameIterator*>(value))
+ iterator = propertyNameIterator->clone(exec);
+ else
+ return jsUndefined();
+
+ unsigned numberToFetch = 5;
+ JSValue numberToFetchArg = exec->argument(1);
+ double fetchDouble = numberToFetchArg.toInteger(exec);
+ if (fetchDouble >= 0)
+ numberToFetch = static_cast<unsigned>(fetchDouble);
+
+ JSArray* array = constructEmptyArray(exec, nullptr);
+
+ for (unsigned i = 0; i < numberToFetch; ++i) {
+ JSValue next = iteratorStep(exec, iterator);
+ if (exec->hadException())
+ break;
+ if (next.isFalse())
+ break;
+
+ JSValue nextValue = iteratorValue(exec, next);
+ if (exec->hadException())
+ break;
+
+ JSObject* entry = constructEmptyObject(exec);
+ entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), nextValue);
+ array->putDirectIndex(exec, i, entry);
+ }
+
+ iteratorClose(exec, iterator);
+
+ return array;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h
new file mode 100644
index 000000000..2ff5fac39
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSInjectedScriptHost_h
+#define JSInjectedScriptHost_h
+
+#include "JSDestructibleObject.h"
+
+namespace Inspector {
+
+class InjectedScriptHost;
+
+class JSInjectedScriptHost : public JSC::JSDestructibleObject {
+public:
+ typedef JSC::JSDestructibleObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags;
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSInjectedScriptHost* create(JSC::VM& vm, JSC::Structure* structure, Ref<InjectedScriptHost>&& impl)
+ {
+ JSInjectedScriptHost* instance = new (NotNull, JSC::allocateCell<JSInjectedScriptHost>(vm.heap)) JSInjectedScriptHost(vm, structure, WTFMove(impl));
+ instance->finishCreation(vm);
+ return instance;
+ }
+
+ static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+ static void destroy(JSC::JSCell*);
+
+ InjectedScriptHost& impl() const { return const_cast<InjectedScriptHost&>(m_wrapped.get()); }
+
+ // Attributes.
+ JSC::JSValue evaluate(JSC::ExecState*) const;
+
+ // Functions.
+ JSC::JSValue internalConstructorName(JSC::ExecState*);
+ JSC::JSValue isHTMLAllCollection(JSC::ExecState*);
+ JSC::JSValue subtype(JSC::ExecState*);
+ JSC::JSValue functionDetails(JSC::ExecState*);
+ JSC::JSValue getInternalProperties(JSC::ExecState*);
+ JSC::JSValue weakMapSize(JSC::ExecState*);
+ JSC::JSValue weakMapEntries(JSC::ExecState*);
+ JSC::JSValue weakSetSize(JSC::ExecState*);
+ JSC::JSValue weakSetEntries(JSC::ExecState*);
+ JSC::JSValue iteratorEntries(JSC::ExecState*);
+
+protected:
+ void finishCreation(JSC::VM&);
+
+private:
+ JSInjectedScriptHost(JSC::VM&, JSC::Structure*, Ref<InjectedScriptHost>&&);
+
+ Ref<InjectedScriptHost> m_wrapped;
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSInjectedScriptHost_h)
diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp
new file mode 100644
index 000000000..6d4807a6c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSInjectedScriptHostPrototype.h"
+
+#include "Error.h"
+#include "GetterSetter.h"
+#include "Identifier.h"
+#include "InjectedScriptHost.h"
+#include "JSCInlines.h"
+#include "JSFunction.h"
+#include "JSInjectedScriptHost.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionSubtype(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionFunctionDetails(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionGetInternalProperties(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapEntries(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakSetSize(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakSetEntries(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIteratorEntries(ExecState*);
+
+static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState*);
+
+const ClassInfo JSInjectedScriptHostPrototype::s_info = { "InjectedScriptHost", &Base::s_info, 0, CREATE_METHOD_TABLE(JSInjectedScriptHostPrototype) };
+
+void JSInjectedScriptHostPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ vm.prototypeMap.addPrototype(this);
+
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("subtype", jsInjectedScriptHostPrototypeFunctionSubtype, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("functionDetails", jsInjectedScriptHostPrototypeFunctionFunctionDetails, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("getInternalProperties", jsInjectedScriptHostPrototypeFunctionGetInternalProperties, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("internalConstructorName", jsInjectedScriptHostPrototypeFunctionInternalConstructorName, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("isHTMLAllCollection", jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("weakMapSize", jsInjectedScriptHostPrototypeFunctionWeakMapSize, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("weakMapEntries", jsInjectedScriptHostPrototypeFunctionWeakMapEntries, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("weakSetSize", jsInjectedScriptHostPrototypeFunctionWeakSetSize, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("weakSetEntries", jsInjectedScriptHostPrototypeFunctionWeakSetEntries, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("iteratorEntries", jsInjectedScriptHostPrototypeFunctionIteratorEntries, DontEnum, 1);
+
+ Identifier evaluateIdentifier = Identifier::fromString(&vm, "evaluate");
+ GetterSetter* accessor = GetterSetter::create(vm, globalObject);
+ JSFunction* function = JSFunction::create(vm, globalObject, 0, evaluateIdentifier.string(), jsInjectedScriptHostPrototypeAttributeEvaluate);
+ accessor->setGetter(vm, globalObject, function);
+ putDirectNonIndexAccessor(vm, evaluateIdentifier, accessor, DontEnum | Accessor);
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->evaluate(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->internalConstructorName(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->isHTMLAllCollection(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapSize(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->weakMapSize(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakMapEntries(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->weakMapEntries(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakSetSize(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->weakSetSize(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionWeakSetEntries(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->weakSetEntries(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIteratorEntries(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->iteratorEntries(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionSubtype(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->subtype(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionFunctionDetails(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->functionDetails(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionGetInternalProperties(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info());
+ return JSValue::encode(castedThis->getInternalProperties(exec));
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h
new file mode 100644
index 000000000..aa4963ed5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSInjectedScriptHostPrototype_h
+#define JSInjectedScriptHostPrototype_h
+
+#include "JSObject.h"
+
+namespace Inspector {
+
+class JSInjectedScriptHostPrototype : public JSC::JSNonFinalObject {
+public:
+ typedef JSC::JSNonFinalObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags | JSC::OverridesGetOwnPropertySlot;
+
+ DECLARE_INFO;
+
+ static JSInjectedScriptHostPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSInjectedScriptHostPrototype* ptr = new (NotNull, JSC::allocateCell<JSInjectedScriptHostPrototype>(vm.heap)) JSInjectedScriptHostPrototype(vm, globalObject, structure);
+ ptr->finishCreation(vm, globalObject);
+ return ptr;
+ }
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+private:
+ JSInjectedScriptHostPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+ : JSC::JSNonFinalObject(vm, structure)
+ {
+ }
+ void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSInjectedScriptHostPrototype_h)
diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp
new file mode 100644
index 000000000..0b0fc42e9
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSJavaScriptCallFrame.h"
+
+#include "DebuggerScope.h"
+#include "Error.h"
+#include "JSCJSValue.h"
+#include "JSCellInlines.h"
+#include "JSJavaScriptCallFramePrototype.h"
+#include "StructureInlines.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFrame) };
+
+JSJavaScriptCallFrame::JSJavaScriptCallFrame(VM& vm, Structure* structure, PassRefPtr<JavaScriptCallFrame> impl)
+ : JSDestructibleObject(vm, structure)
+ , m_impl(impl.leakRef())
+{
+}
+
+void JSJavaScriptCallFrame::finishCreation(VM& vm)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+}
+
+JSObject* JSJavaScriptCallFrame::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+ return JSJavaScriptCallFramePrototype::create(vm, globalObject, JSJavaScriptCallFramePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+void JSJavaScriptCallFrame::destroy(JSC::JSCell* cell)
+{
+ JSJavaScriptCallFrame* thisObject = static_cast<JSJavaScriptCallFrame*>(cell);
+ thisObject->JSJavaScriptCallFrame::~JSJavaScriptCallFrame();
+}
+
+void JSJavaScriptCallFrame::releaseImpl()
+{
+ if (auto impl = std::exchange(m_impl, nullptr))
+ impl->deref();
+}
+
+JSJavaScriptCallFrame::~JSJavaScriptCallFrame()
+{
+ releaseImpl();
+}
+
+JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec)
+{
+ NakedPtr<Exception> exception;
+ JSValue result = impl().evaluate(exec->argument(0).toString(exec)->value(exec), exception);
+ if (exception)
+ exec->vm().throwException(exec, exception);
+
+ return result;
+}
+
+JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec)
+{
+ if (!impl().scopeChain())
+ return jsUndefined();
+
+ if (!exec->argument(0).isInt32())
+ return jsUndefined();
+ int index = exec->argument(0).asInt32();
+
+ DebuggerScope* scopeChain = impl().scopeChain();
+ DebuggerScope::iterator end = scopeChain->end();
+
+ for (DebuggerScope::iterator iter = scopeChain->begin(); iter != end; ++iter) {
+ DebuggerScope* scope = iter.get();
+
+ if (!index) {
+ if (scope->isCatchScope())
+ return jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE);
+ if (scope->isFunctionNameScope())
+ return jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE);
+ if (scope->isWithScope())
+ return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE);
+ if (scope->isNestedLexicalScope())
+ return jsNumber(JSJavaScriptCallFrame::NESTED_LEXICAL_SCOPE);
+ if (scope->isGlobalLexicalEnvironment())
+ return jsNumber(JSJavaScriptCallFrame::GLOBAL_LEXICAL_ENVIRONMENT_SCOPE);
+ if (scope->isGlobalScope()) {
+ ASSERT(++iter == end);
+ return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE);
+ }
+ ASSERT(scope->isClosureScope());
+ return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE);
+ }
+
+ --index;
+ }
+
+ ASSERT_NOT_REACHED();
+ return jsUndefined();
+}
+
+JSValue JSJavaScriptCallFrame::caller(ExecState* exec) const
+{
+ return toJS(exec, globalObject(), impl().caller());
+}
+
+JSValue JSJavaScriptCallFrame::sourceID(ExecState*) const
+{
+ return jsNumber(impl().sourceID());
+}
+
+JSValue JSJavaScriptCallFrame::line(ExecState*) const
+{
+ return jsNumber(impl().line());
+}
+
+JSValue JSJavaScriptCallFrame::column(ExecState*) const
+{
+ return jsNumber(impl().column());
+}
+
+JSValue JSJavaScriptCallFrame::functionName(ExecState* exec) const
+{
+ return jsString(exec, impl().functionName());
+}
+
+JSValue JSJavaScriptCallFrame::scopeChain(ExecState* exec) const
+{
+ if (!impl().scopeChain())
+ return jsNull();
+
+ DebuggerScope* scopeChain = impl().scopeChain();
+ DebuggerScope::iterator iter = scopeChain->begin();
+ DebuggerScope::iterator end = scopeChain->end();
+
+ // We must always have something in the scope chain.
+ ASSERT(iter != end);
+
+ MarkedArgumentBuffer list;
+ do {
+ list.append(iter.get());
+ ++iter;
+ } while (iter != end);
+
+ return constructArray(exec, nullptr, globalObject(), list);
+}
+
+JSValue JSJavaScriptCallFrame::thisObject(ExecState*) const
+{
+ return impl().thisValue();
+}
+
+JSValue JSJavaScriptCallFrame::type(ExecState* exec) const
+{
+ switch (impl().type()) {
+ case DebuggerCallFrame::FunctionType:
+ return jsNontrivialString(exec, ASCIILiteral("function"));
+ case DebuggerCallFrame::ProgramType:
+ return jsNontrivialString(exec, ASCIILiteral("program"));
+ }
+
+ ASSERT_NOT_REACHED();
+ return jsNull();
+}
+
+JSValue toJS(ExecState* exec, JSGlobalObject* globalObject, JavaScriptCallFrame* impl)
+{
+ if (!impl)
+ return jsNull();
+
+ JSObject* prototype = JSJavaScriptCallFrame::createPrototype(exec->vm(), globalObject);
+ Structure* structure = JSJavaScriptCallFrame::createStructure(exec->vm(), globalObject, prototype);
+ JSJavaScriptCallFrame* javaScriptCallFrame = JSJavaScriptCallFrame::create(exec->vm(), structure, impl);
+
+ return javaScriptCallFrame;
+}
+
+JSJavaScriptCallFrame* toJSJavaScriptCallFrame(JSValue value)
+{
+ return value.inherits(JSJavaScriptCallFrame::info()) ? jsCast<JSJavaScriptCallFrame*>(value) : nullptr;
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h
new file mode 100644
index 000000000..324627f6c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSJavaScriptCallFrame_h
+#define JSJavaScriptCallFrame_h
+
+#include "JSDestructibleObject.h"
+#include "JavaScriptCallFrame.h"
+
+namespace Inspector {
+
+class JSJavaScriptCallFrame : public JSC::JSDestructibleObject {
+public:
+ typedef JSC::JSDestructibleObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags;
+
+ DECLARE_INFO;
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+ static JSJavaScriptCallFrame* create(JSC::VM& vm, JSC::Structure* structure, PassRefPtr<JavaScriptCallFrame> impl)
+ {
+ JSJavaScriptCallFrame* instance = new (NotNull, JSC::allocateCell<JSJavaScriptCallFrame>(vm.heap)) JSJavaScriptCallFrame(vm, structure, impl);
+ instance->finishCreation(vm);
+ return instance;
+ }
+
+ static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+ static void destroy(JSC::JSCell*);
+
+ JavaScriptCallFrame& impl() const { return *m_impl; }
+ void releaseImpl();
+
+ // Functions.
+ JSC::JSValue evaluate(JSC::ExecState*);
+ JSC::JSValue scopeType(JSC::ExecState*);
+
+ // Attributes.
+ JSC::JSValue caller(JSC::ExecState*) const;
+ JSC::JSValue sourceID(JSC::ExecState*) const;
+ JSC::JSValue line(JSC::ExecState*) const;
+ JSC::JSValue column(JSC::ExecState*) const;
+ JSC::JSValue functionName(JSC::ExecState*) const;
+ JSC::JSValue scopeChain(JSC::ExecState*) const;
+ JSC::JSValue thisObject(JSC::ExecState*) const;
+ JSC::JSValue type(JSC::ExecState*) const;
+
+ // Constants.
+ static const unsigned short GLOBAL_SCOPE = 0;
+ static const unsigned short WITH_SCOPE = 1;
+ static const unsigned short CLOSURE_SCOPE = 2;
+ static const unsigned short CATCH_SCOPE = 3;
+ static const unsigned short FUNCTION_NAME_SCOPE = 4;
+ static const unsigned short GLOBAL_LEXICAL_ENVIRONMENT_SCOPE = 5;
+ static const unsigned short NESTED_LEXICAL_SCOPE = 6;
+
+protected:
+ void finishCreation(JSC::VM&);
+
+private:
+ JSJavaScriptCallFrame(JSC::VM&, JSC::Structure*, PassRefPtr<JavaScriptCallFrame>);
+ ~JSJavaScriptCallFrame();
+
+ JavaScriptCallFrame* m_impl;
+};
+
+JSC::JSValue toJS(JSC::ExecState*, JSC::JSGlobalObject*, JavaScriptCallFrame*);
+JSJavaScriptCallFrame* toJSJavaScriptCallFrame(JSC::JSValue);
+
+} // namespace Inspector
+
+#endif // !defined(JSJavaScriptCallFrame_h)
diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp
new file mode 100644
index 000000000..bb08eac88
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSJavaScriptCallFramePrototype.h"
+
+#include "Error.h"
+#include "GetterSetter.h"
+#include "Identifier.h"
+#include "JSCInlines.h"
+#include "JSFunction.h"
+#include "JSJavaScriptCallFrame.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+// Functions.
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionScopeType(ExecState*);
+
+// Attributes.
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeCaller(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeSourceID(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeLine(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeColumn(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeFunctionName(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeScopeChain(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeThisObject(ExecState*);
+static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeType(ExecState*);
+
+const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFramePrototype) };
+
+#define JSC_NATIVE_NON_INDEX_ACCESSOR(jsName, cppName, attributes) \
+ { \
+ Identifier identifier = Identifier::fromString(&vm, jsName); \
+ GetterSetter* accessor = GetterSetter::create(vm, globalObject); \
+ JSFunction* function = JSFunction::create(vm, globalObject, 0, identifier.string(), cppName); \
+ accessor->setGetter(vm, globalObject, function); \
+ putDirectNonIndexAccessor(vm, identifier, accessor, (attributes)); \
+ }
+
+void JSJavaScriptCallFramePrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
+{
+ Base::finishCreation(vm);
+ ASSERT(inherits(info()));
+ vm.prototypeMap.addPrototype(this);
+
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("evaluate", jsJavaScriptCallFramePrototypeFunctionEvaluate, DontEnum, 1);
+ JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("scopeType", jsJavaScriptCallFramePrototypeFunctionScopeType, DontEnum, 1);
+
+ JSC_NATIVE_NON_INDEX_ACCESSOR("caller", jsJavaScriptCallFrameAttributeCaller, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("sourceID", jsJavaScriptCallFrameAttributeSourceID, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("line", jsJavaScriptCallFrameAttributeLine, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("column", jsJavaScriptCallFrameAttributeColumn, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("functionName", jsJavaScriptCallFrameAttributeFunctionName, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("scopeChain", jsJavaScriptCallFrameAttributeScopeChain, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("thisObject", jsJavaScriptCallFrameAttributeThisObject, DontEnum | Accessor);
+ JSC_NATIVE_NON_INDEX_ACCESSOR("type", jsJavaScriptCallFrameAttributeType, DontEnum | Accessor);
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->evaluate(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionScopeType(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->scopeType(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeCaller(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->caller(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeSourceID(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->sourceID(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeLine(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->line(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeColumn(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->column(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeFunctionName(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->functionName(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeScopeChain(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->scopeChain(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeThisObject(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->thisObject(exec));
+}
+
+EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeType(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue);
+ if (!castedThis)
+ return throwVMTypeError(exec);
+
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSJavaScriptCallFrame::info());
+ return JSValue::encode(castedThis->type(exec));
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h
new file mode 100644
index 000000000..0811c2462
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSJavaScriptCallFramePrototype_h
+#define JSJavaScriptCallFramePrototype_h
+
+#include "JSObject.h"
+
+namespace Inspector {
+
+class JSJavaScriptCallFramePrototype : public JSC::JSNonFinalObject {
+public:
+ typedef JSC::JSNonFinalObject Base;
+ static const unsigned StructureFlags = Base::StructureFlags | JSC::OverridesGetOwnPropertySlot;
+
+ DECLARE_INFO;
+
+ static JSJavaScriptCallFramePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+ {
+ JSJavaScriptCallFramePrototype* ptr = new (NotNull, JSC::allocateCell<JSJavaScriptCallFramePrototype>(vm.heap)) JSJavaScriptCallFramePrototype(vm, globalObject, structure);
+ ptr->finishCreation(vm, globalObject);
+ return ptr;
+ }
+
+ static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+ {
+ return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+ }
+
+private:
+ JSJavaScriptCallFramePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+ : JSC::JSNonFinalObject(vm, structure)
+ {
+ }
+ void finishCreation(JSC::VM&, JSC::JSGlobalObject*);
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSJavaScriptCallFramePrototype_h)
diff --git a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp
new file mode 100644
index 000000000..d5f73d540
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JavaScriptCallFrame.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JavaScriptCallFrame::JavaScriptCallFrame(PassRefPtr<DebuggerCallFrame> debuggerCallFrame)
+ : m_debuggerCallFrame(debuggerCallFrame)
+{
+}
+
+JavaScriptCallFrame* JavaScriptCallFrame::caller()
+{
+ if (m_caller)
+ return m_caller.get();
+
+ RefPtr<DebuggerCallFrame> debuggerCallerFrame = m_debuggerCallFrame->callerFrame();
+ if (!debuggerCallerFrame)
+ return nullptr;
+
+ m_caller = create(debuggerCallerFrame);
+ return m_caller.get();
+}
+
+} // namespace Inspector
+
diff --git a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h
new file mode 100644
index 000000000..c7d037b18
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2008, 2013-2014 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JavaScriptCallFrame_h
+#define JavaScriptCallFrame_h
+
+#include "JSCJSValueInlines.h"
+#include "debugger/DebuggerCallFrame.h"
+#include "interpreter/CallFrame.h"
+#include <wtf/Forward.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/TextPosition.h>
+
+namespace Inspector {
+
+class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> {
+public:
+ static Ref<JavaScriptCallFrame> create(PassRefPtr<JSC::DebuggerCallFrame> debuggerCallFrame)
+ {
+ return adoptRef(*new JavaScriptCallFrame(debuggerCallFrame));
+ }
+
+ JavaScriptCallFrame* caller();
+ intptr_t sourceID() const { return m_debuggerCallFrame->sourceID(); }
+ const TextPosition position() const { return m_debuggerCallFrame->position(); }
+ int line() const { return m_debuggerCallFrame->line(); }
+ int column() const { return m_debuggerCallFrame->column(); }
+
+ String functionName() const { return m_debuggerCallFrame->functionName(); }
+ JSC::DebuggerCallFrame::Type type() const { return m_debuggerCallFrame->type(); }
+ JSC::DebuggerScope* scopeChain() const { return m_debuggerCallFrame->scope(); }
+ JSC::JSGlobalObject* vmEntryGlobalObject() const { return m_debuggerCallFrame->vmEntryGlobalObject(); }
+
+ JSC::JSValue thisValue() const { return m_debuggerCallFrame->thisValue(); }
+ JSC::JSValue evaluate(const String& script, NakedPtr<JSC::Exception>& exception) const { return m_debuggerCallFrame->evaluate(script, exception); }
+
+private:
+ JavaScriptCallFrame(PassRefPtr<JSC::DebuggerCallFrame>);
+
+ RefPtr<JSC::DebuggerCallFrame> m_debuggerCallFrame;
+ RefPtr<JavaScriptCallFrame> m_caller;
+};
+
+} // namespace Inspector
+
+#endif // JavaScriptCallFrame_h
diff --git a/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.cpp b/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.cpp
new file mode 100644
index 000000000..c9b7abd8f
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PerGlobalObjectWrapperWorld.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSValue PerGlobalObjectWrapperWorld::getWrapper(JSGlobalObject* globalObject)
+{
+ auto it = m_wrappers.find(globalObject);
+ if (it != m_wrappers.end())
+ return it->value.get();
+ return JSValue();
+}
+
+void PerGlobalObjectWrapperWorld::addWrapper(JSGlobalObject* globalObject, JSObject* object)
+{
+ Strong<JSObject> wrapper(globalObject->vm(), object);
+ m_wrappers.add(globalObject, wrapper);
+}
+
+void PerGlobalObjectWrapperWorld::clearAllWrappers()
+{
+ m_wrappers.clear();
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.h b/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.h
new file mode 100644
index 000000000..bdd7db0aa
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/PerGlobalObjectWrapperWorld.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 PerGlobalObjectWrapperWorld_h
+#define PerGlobalObjectWrapperWorld_h
+
+#include "JSCJSValueInlines.h"
+#include "Strong.h"
+#include "StrongInlines.h"
+#include <wtf/HashMap.h>
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE PerGlobalObjectWrapperWorld {
+public:
+ JSC::JSValue getWrapper(JSC::JSGlobalObject*);
+ void addWrapper(JSC::JSGlobalObject*, JSC::JSObject*);
+ void clearAllWrappers();
+
+private:
+ HashMap<JSC::JSGlobalObject*, JSC::Strong<JSC::JSObject>> m_wrappers;
+};
+
+} // namespace Inspector
+
+#endif // !defined(PerGlobalObjectWrapperWorld_h)
diff --git a/Source/JavaScriptCore/inspector/ScriptArguments.cpp b/Source/JavaScriptCore/inspector/ScriptArguments.cpp
new file mode 100644
index 000000000..51d1fe658
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptArguments.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 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.
+ */
+
+#include "config.h"
+#include "ScriptArguments.h"
+
+#include "JSCInlines.h"
+#include "ScriptValue.h"
+
+namespace Inspector {
+
+Ref<ScriptArguments> ScriptArguments::create(JSC::ExecState* scriptState, Vector<Deprecated::ScriptValue>& arguments)
+{
+ return adoptRef(*new ScriptArguments(scriptState, arguments));
+}
+
+ScriptArguments::ScriptArguments(JSC::ExecState* execState, Vector<Deprecated::ScriptValue>& arguments)
+ : m_globalObject(execState->vm(), execState->lexicalGlobalObject())
+{
+ m_arguments.swap(arguments);
+}
+
+ScriptArguments::~ScriptArguments()
+{
+}
+
+const Deprecated::ScriptValue &ScriptArguments::argumentAt(size_t index) const
+{
+ ASSERT(m_arguments.size() > index);
+ return m_arguments[index];
+}
+
+JSC::ExecState* ScriptArguments::globalState() const
+{
+ if (m_globalObject)
+ return const_cast<JSC::JSGlobalObject*>(m_globalObject.get())->globalExec();
+
+ return nullptr;
+}
+
+bool ScriptArguments::getFirstArgumentAsString(String& result, bool checkForNullOrUndefined)
+{
+ if (!argumentCount())
+ return false;
+
+ const Deprecated::ScriptValue& value = argumentAt(0);
+ if (checkForNullOrUndefined && (value.isNull() || value.isUndefined()))
+ return false;
+
+ if (!globalState()) {
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+
+ result = value.toString(globalState());
+ return true;
+}
+
+bool ScriptArguments::isEqual(ScriptArguments* other) const
+{
+ if (!other)
+ return false;
+
+ if (m_arguments.size() != other->m_arguments.size())
+ return false;
+ if (!globalState() && m_arguments.size())
+ return false;
+
+ for (size_t i = 0; i < m_arguments.size(); ++i) {
+ if (!m_arguments[i].isEqual(other->globalState(), other->m_arguments[i]))
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ScriptArguments.h b/Source/JavaScriptCore/inspector/ScriptArguments.h
new file mode 100644
index 000000000..7200ab48a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptArguments.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 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 ScriptArguments_h
+#define ScriptArguments_h
+
+#include <heap/Strong.h>
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace Deprecated {
+class ScriptValue;
+}
+
+namespace JSC {
+class ExecState;
+class JSGlobalObject;
+}
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE ScriptArguments : public RefCounted<ScriptArguments> {
+public:
+ static Ref<ScriptArguments> create(JSC::ExecState*, Vector<Deprecated::ScriptValue>& arguments);
+ ~ScriptArguments();
+
+ const Deprecated::ScriptValue& argumentAt(size_t) const;
+ size_t argumentCount() const { return m_arguments.size(); }
+
+ JSC::ExecState* globalState() const;
+
+ bool getFirstArgumentAsString(String& result, bool checkForNullOrUndefined = false);
+ bool isEqual(ScriptArguments*) const;
+
+private:
+ ScriptArguments(JSC::ExecState*, Vector<Deprecated::ScriptValue>& arguments);
+
+ JSC::Strong<JSC::JSGlobalObject> m_globalObject;
+ Vector<Deprecated::ScriptValue> m_arguments;
+};
+
+} // namespace Inspector
+
+#endif // ScriptArguments_h
diff --git a/Source/JavaScriptCore/inspector/ScriptBreakpoint.h b/Source/JavaScriptCore/inspector/ScriptBreakpoint.h
new file mode 100644
index 000000000..88a0380ef
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptBreakpoint.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptBreakpoint_h
+#define ScriptBreakpoint_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef enum {
+ ScriptBreakpointActionTypeLog,
+ ScriptBreakpointActionTypeEvaluate,
+ ScriptBreakpointActionTypeSound,
+ ScriptBreakpointActionTypeProbe
+} ScriptBreakpointActionType;
+
+struct ScriptBreakpointAction {
+ ScriptBreakpointAction(ScriptBreakpointActionType type, int identifier, const String& data)
+ : type(type)
+ , identifier(identifier)
+ , data(data)
+ {
+ }
+
+ ScriptBreakpointActionType type;
+ int identifier;
+ String data;
+};
+
+typedef Vector<ScriptBreakpointAction> BreakpointActions;
+
+struct ScriptBreakpoint {
+ ScriptBreakpoint()
+ {
+ }
+
+ ScriptBreakpoint(int lineNumber, int columnNumber, const String& condition, bool autoContinue, unsigned ignoreCount)
+ : lineNumber(lineNumber)
+ , columnNumber(columnNumber)
+ , condition(condition)
+ , autoContinue(autoContinue)
+ , ignoreCount(ignoreCount)
+ {
+ }
+
+ ScriptBreakpoint(int lineNumber, int columnNumber, const String& condition, BreakpointActions& actions, bool autoContinue, unsigned ignoreCount)
+ : lineNumber(lineNumber)
+ , columnNumber(columnNumber)
+ , condition(condition)
+ , actions(actions)
+ , autoContinue(autoContinue)
+ , ignoreCount(ignoreCount)
+ {
+ }
+
+ int lineNumber { 0 };
+ int columnNumber { 0 };
+ String condition;
+ BreakpointActions actions;
+ bool autoContinue { false };
+ unsigned ignoreCount { 0 };
+};
+
+} // namespace Inspector
+
+#endif // !defined(ScriptBreakpoint_h)
diff --git a/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp
new file mode 100644
index 000000000..96a06ff62
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 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.
+ */
+
+#include "config.h"
+#include "ScriptCallFrame.h"
+
+#include "InspectorValues.h"
+
+namespace Inspector {
+
+ScriptCallFrame::ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column)
+ : m_functionName(functionName)
+ , m_scriptName(scriptName)
+ , m_lineNumber(lineNumber)
+ , m_column(column)
+{
+}
+
+ScriptCallFrame::~ScriptCallFrame()
+{
+}
+
+bool ScriptCallFrame::isEqual(const ScriptCallFrame& o) const
+{
+ return m_functionName == o.m_functionName
+ && m_scriptName == o.m_scriptName
+ && m_lineNumber == o.m_lineNumber
+ && m_column == o.m_column;
+}
+
+Ref<Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
+{
+ return Inspector::Protocol::Console::CallFrame::create()
+ .setFunctionName(m_functionName)
+ .setUrl(m_scriptName)
+ .setLineNumber(m_lineNumber)
+ .setColumnNumber(m_column)
+ .release();
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ScriptCallFrame.h b/Source/JavaScriptCore/inspector/ScriptCallFrame.h
new file mode 100644
index 000000000..99ac489a7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallFrame.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 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 ScriptCallFrame_h
+#define ScriptCallFrame_h
+
+#include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
+#include "InspectorProtocolObjects.h"
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE ScriptCallFrame {
+public:
+ ScriptCallFrame(const String& functionName, const String& scriptName, unsigned lineNumber, unsigned column);
+ ~ScriptCallFrame();
+
+ const String& functionName() const { return m_functionName; }
+ const String& sourceURL() const { return m_scriptName; }
+ unsigned lineNumber() const { return m_lineNumber; }
+ unsigned columnNumber() const { return m_column; }
+
+ bool isEqual(const ScriptCallFrame&) const;
+
+ Ref<Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;
+
+private:
+ String m_functionName;
+ String m_scriptName;
+ unsigned m_lineNumber;
+ unsigned m_column;
+};
+
+} // namespace Inspector
+
+#endif // ScriptCallFrame_h
diff --git a/Source/JavaScriptCore/inspector/ScriptCallStack.cpp b/Source/JavaScriptCore/inspector/ScriptCallStack.cpp
new file mode 100644
index 000000000..65ec9de25
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallStack.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2008, 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.
+ */
+
+#include "config.h"
+#include "ScriptCallStack.h"
+
+#include "InspectorValues.h"
+
+namespace Inspector {
+
+Ref<ScriptCallStack> ScriptCallStack::create()
+{
+ return adoptRef(*new ScriptCallStack);
+}
+
+Ref<ScriptCallStack> ScriptCallStack::create(Vector<ScriptCallFrame>& frames)
+{
+ return adoptRef(*new ScriptCallStack(frames));
+}
+
+ScriptCallStack::ScriptCallStack()
+{
+}
+
+ScriptCallStack::ScriptCallStack(Vector<ScriptCallFrame>& frames)
+{
+ m_frames.swap(frames);
+}
+
+ScriptCallStack::~ScriptCallStack()
+{
+}
+
+const ScriptCallFrame& ScriptCallStack::at(size_t index) const
+{
+ ASSERT(m_frames.size() > index);
+ return m_frames[index];
+}
+
+size_t ScriptCallStack::size() const
+{
+ return m_frames.size();
+}
+
+const ScriptCallFrame* ScriptCallStack::firstNonNativeCallFrame() const
+{
+ if (!m_frames.size())
+ return nullptr;
+
+ for (size_t i = 0; i < m_frames.size(); ++i) {
+ const ScriptCallFrame& frame = m_frames[i];
+ if (frame.sourceURL() != "[native code]")
+ return &frame;
+ }
+
+ return nullptr;
+}
+
+void ScriptCallStack::append(const ScriptCallFrame& frame)
+{
+ m_frames.append(frame);
+}
+
+bool ScriptCallStack::isEqual(ScriptCallStack* o) const
+{
+ if (!o)
+ return false;
+
+ size_t frameCount = o->m_frames.size();
+ if (frameCount != m_frames.size())
+ return false;
+
+ for (size_t i = 0; i < frameCount; ++i) {
+ if (!m_frames[i].isEqual(o->m_frames[i]))
+ return false;
+ }
+
+ return true;
+}
+
+Ref<Inspector::Protocol::Console::StackTrace> ScriptCallStack::buildInspectorArray() const
+{
+ auto frames = Inspector::Protocol::Console::StackTrace::create();
+ for (size_t i = 0; i < m_frames.size(); i++)
+ frames->addItem(m_frames.at(i).buildInspectorObject());
+ return frames;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ScriptCallStack.h b/Source/JavaScriptCore/inspector/ScriptCallStack.h
new file mode 100644
index 000000000..d2cbb6596
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallStack.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2008, 2010 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 ScriptCallStack_h
+#define ScriptCallStack_h
+
+#include "InspectorProtocolObjects.h"
+#include "ScriptCallFrame.h"
+#include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE ScriptCallStack : public RefCounted<ScriptCallStack> {
+public:
+ static const size_t maxCallStackSizeToCapture = 200;
+
+ static Ref<ScriptCallStack> create();
+ static Ref<ScriptCallStack> create(Vector<ScriptCallFrame>&);
+
+ ~ScriptCallStack();
+
+ const ScriptCallFrame& at(size_t) const;
+ size_t size() const;
+
+ const ScriptCallFrame* firstNonNativeCallFrame() const;
+
+ void append(const ScriptCallFrame&);
+
+ bool isEqual(ScriptCallStack*) const;
+
+ Ref<Inspector::Protocol::Console::StackTrace> buildInspectorArray() const;
+
+private:
+ ScriptCallStack();
+ ScriptCallStack(Vector<ScriptCallFrame>&);
+
+ Vector<ScriptCallFrame> m_frames;
+};
+
+} // namespace Inspector
+
+#endif // ScriptCallStack_h
diff --git a/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp b/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
new file mode 100644
index 000000000..362509c85
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Research In Motion Limited. 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.
+ */
+
+#include "config.h"
+#include "ScriptCallStackFactory.h"
+
+#include "CallFrame.h"
+#include "CodeBlock.h"
+#include "Exception.h"
+#include "JSCJSValue.h"
+#include "JSCInlines.h"
+#include "ScriptArguments.h"
+#include "ScriptCallFrame.h"
+#include "ScriptCallStack.h"
+#include "ScriptValue.h"
+#include "StackVisitor.h"
+#include <wtf/RefCountedArray.h>
+#include <wtf/text/WTFString.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+class CreateScriptCallStackFunctor {
+public:
+ CreateScriptCallStackFunctor(bool needToSkipAFrame, Vector<ScriptCallFrame>& frames, size_t remainingCapacity)
+ : m_needToSkipAFrame(needToSkipAFrame)
+ , m_frames(frames)
+ , m_remainingCapacityForFrameCapture(remainingCapacity)
+ {
+ }
+
+ StackVisitor::Status operator()(StackVisitor& visitor)
+ {
+ if (m_needToSkipAFrame) {
+ m_needToSkipAFrame = false;
+ return StackVisitor::Continue;
+ }
+
+ if (m_remainingCapacityForFrameCapture) {
+#if ENABLE(WEBASSEMBLY)
+ if (visitor->codeBlock()->ownerExecutable()->isWebAssemblyExecutable())
+ return StackVisitor::Continue;
+#endif
+ unsigned line;
+ unsigned column;
+ visitor->computeLineAndColumn(line, column);
+ m_frames.append(ScriptCallFrame(visitor->functionName(), visitor->sourceURL(), line, column));
+
+ m_remainingCapacityForFrameCapture--;
+ return StackVisitor::Continue;
+ }
+
+ return StackVisitor::Done;
+ }
+
+private:
+ bool m_needToSkipAFrame;
+ Vector<ScriptCallFrame>& m_frames;
+ size_t m_remainingCapacityForFrameCapture;
+};
+
+Ref<ScriptCallStack> createScriptCallStack(JSC::ExecState* exec, size_t maxStackSize)
+{
+ if (!exec)
+ return ScriptCallStack::create();
+
+ Vector<ScriptCallFrame> frames;
+
+ CallFrame* frame = exec->vm().topCallFrame;
+ CreateScriptCallStackFunctor functor(false, frames, maxStackSize);
+ frame->iterate(functor);
+
+ return ScriptCallStack::create(frames);
+}
+
+Ref<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState* exec, size_t maxStackSize)
+{
+ if (!exec)
+ return ScriptCallStack::create();
+
+ Vector<ScriptCallFrame> frames;
+
+ CallFrame* frame = exec->vm().topCallFrame;
+ CreateScriptCallStackFunctor functor(true, frames, maxStackSize);
+ frame->iterate(functor);
+
+ if (frames.isEmpty()) {
+ CreateScriptCallStackFunctor functor(false, frames, maxStackSize);
+ frame->iterate(functor);
+ }
+
+ return ScriptCallStack::create(frames);
+}
+
+static void extractSourceInformationFromException(JSC::ExecState* exec, JSObject* exceptionObject, int* lineNumber, int* columnNumber, String* sourceURL)
+{
+ // FIXME: <http://webkit.org/b/115087> Web Inspector: Should not need to evaluate JavaScript handling exceptions
+ JSValue lineValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "line"));
+ *lineNumber = lineValue && lineValue.isNumber() ? int(lineValue.toNumber(exec)) : 0;
+ JSValue columnValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "column"));
+ *columnNumber = columnValue && columnValue.isNumber() ? int(columnValue.toNumber(exec)) : 0;
+ JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "sourceURL"));
+ *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : ASCIILiteral("undefined");
+ exec->clearException();
+}
+
+Ref<ScriptCallStack> createScriptCallStackFromException(JSC::ExecState* exec, JSC::Exception* exception, size_t maxStackSize)
+{
+ Vector<ScriptCallFrame> frames;
+ RefCountedArray<StackFrame> stackTrace = exception->stack();
+ for (size_t i = 0; i < stackTrace.size() && i < maxStackSize; i++) {
+ unsigned line;
+ unsigned column;
+ stackTrace[i].computeLineAndColumn(line, column);
+ String functionName = stackTrace[i].friendlyFunctionName(exec);
+ frames.append(ScriptCallFrame(functionName, stackTrace[i].friendlySourceURL(), line, column));
+ }
+
+ // Fallback to getting at least the line and sourceURL from the exception object if it has values and the exceptionStack doesn't.
+ if (exception->value().isObject()) {
+ JSObject* exceptionObject = exception->value().toObject(exec);
+ int lineNumber;
+ int columnNumber;
+ String exceptionSourceURL;
+ if (!frames.size()) {
+ extractSourceInformationFromException(exec, exceptionObject, &lineNumber, &columnNumber, &exceptionSourceURL);
+ frames.append(ScriptCallFrame(String(), exceptionSourceURL, lineNumber, columnNumber));
+ } else {
+ if (stackTrace[0].sourceURL.isEmpty()) {
+ const ScriptCallFrame& firstCallFrame = frames.first();
+ extractSourceInformationFromException(exec, exceptionObject, &lineNumber, &columnNumber, &exceptionSourceURL);
+ frames[0] = ScriptCallFrame(firstCallFrame.functionName(), exceptionSourceURL, lineNumber, columnNumber);
+ }
+ }
+ }
+
+ return ScriptCallStack::create(frames);
+}
+
+Ref<ScriptArguments> createScriptArguments(JSC::ExecState* exec, unsigned skipArgumentCount)
+{
+ Vector<Deprecated::ScriptValue> arguments;
+ size_t argumentCount = exec->argumentCount();
+ for (size_t i = skipArgumentCount; i < argumentCount; ++i)
+ arguments.append(Deprecated::ScriptValue(exec->vm(), exec->uncheckedArgument(i)));
+ return ScriptArguments::create(exec, arguments);
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ScriptCallStackFactory.h b/Source/JavaScriptCore/inspector/ScriptCallStackFactory.h
new file mode 100644
index 000000000..b0c0dc01b
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptCallStackFactory.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2010 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 ScriptCallStackFactory_h
+#define ScriptCallStackFactory_h
+
+#include <wtf/Forward.h>
+
+namespace JSC {
+class Exception;
+class ExecState;
+class JSValue;
+}
+
+namespace Inspector {
+
+class ScriptArguments;
+class ScriptCallStack;
+
+// FIXME: The subtle differences between these should be eliminated.
+JS_EXPORT_PRIVATE Ref<ScriptCallStack> createScriptCallStack(JSC::ExecState*, size_t maxStackSize);
+JS_EXPORT_PRIVATE Ref<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState*, size_t maxStackSize);
+JS_EXPORT_PRIVATE Ref<ScriptCallStack> createScriptCallStackFromException(JSC::ExecState*, JSC::Exception*, size_t maxStackSize);
+JS_EXPORT_PRIVATE Ref<ScriptArguments> createScriptArguments(JSC::ExecState*, unsigned skipArgumentCount);
+
+} // namespace Inspector
+
+#endif // ScriptCallStackFactory_h
diff --git a/Source/JavaScriptCore/inspector/ScriptDebugListener.h b/Source/JavaScriptCore/inspector/ScriptDebugListener.h
new file mode 100644
index 000000000..43ff237cc
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptDebugListener.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptDebugListener_h
+#define ScriptDebugListener_h
+
+#include "debugger/Debugger.h"
+#include <wtf/text/WTFString.h>
+
+namespace Deprecated {
+class ScriptValue;
+}
+
+namespace Inspector {
+
+struct ScriptBreakpointAction;
+
+class ScriptDebugListener {
+public:
+ struct Script {
+ String url;
+ String source;
+ String sourceURL;
+ String sourceMappingURL;
+ int startLine {0};
+ int startColumn {0};
+ int endLine {0};
+ int endColumn {0};
+ bool isContentScript {false};
+ };
+
+ virtual ~ScriptDebugListener() { }
+
+ virtual void didParseSource(JSC::SourceID, const Script&) = 0;
+ virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
+ virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) = 0;
+ virtual void didContinue() = 0;
+
+ virtual void breakpointActionLog(JSC::ExecState*, const String&) = 0;
+ virtual void breakpointActionSound(int breakpointActionIdentifier) = 0;
+ virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue& result) = 0;
+};
+
+} // namespace Inspector
+
+#endif // ScriptDebugListener_h
diff --git a/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp b/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
new file mode 100644
index 000000000..98c65de0b
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
@@ -0,0 +1,371 @@
+/*
+ * Copyright (C) 2008, 2009, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2011 Google Inc. All rights reserved.
+ * Copyright (C) 2013 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScriptDebugServer.h"
+
+#include "DebuggerCallFrame.h"
+#include "DebuggerScope.h"
+#include "Exception.h"
+#include "JSJavaScriptCallFrame.h"
+#include "JSLock.h"
+#include "JavaScriptCallFrame.h"
+#include "ScriptValue.h"
+#include "SourceProvider.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/TemporaryChange.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+ScriptDebugServer::ScriptDebugServer(VM& vm)
+ : Debugger(vm)
+{
+}
+
+ScriptDebugServer::~ScriptDebugServer()
+{
+}
+
+JSC::BreakpointID ScriptDebugServer::setBreakpoint(JSC::SourceID sourceID, const ScriptBreakpoint& scriptBreakpoint, unsigned* actualLineNumber, unsigned* actualColumnNumber)
+{
+ if (!sourceID)
+ return JSC::noBreakpointID;
+
+ JSC::Breakpoint breakpoint(sourceID, scriptBreakpoint.lineNumber, scriptBreakpoint.columnNumber, scriptBreakpoint.condition, scriptBreakpoint.autoContinue, scriptBreakpoint.ignoreCount);
+ JSC::BreakpointID id = Debugger::setBreakpoint(breakpoint, *actualLineNumber, *actualColumnNumber);
+ if (id != JSC::noBreakpointID && !scriptBreakpoint.actions.isEmpty()) {
+#ifndef NDEBUG
+ BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(id);
+ ASSERT(it == m_breakpointIDToActions.end());
+#endif
+ const BreakpointActions& actions = scriptBreakpoint.actions;
+ m_breakpointIDToActions.set(id, actions);
+ }
+ return id;
+}
+
+void ScriptDebugServer::removeBreakpoint(JSC::BreakpointID id)
+{
+ ASSERT(id != JSC::noBreakpointID);
+ BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(id);
+ if (it != m_breakpointIDToActions.end())
+ m_breakpointIDToActions.remove(it);
+
+ Debugger::removeBreakpoint(id);
+}
+
+bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& breakpointAction)
+{
+ DebuggerCallFrame* debuggerCallFrame = currentDebuggerCallFrame();
+
+ switch (breakpointAction.type) {
+ case ScriptBreakpointActionTypeLog: {
+ dispatchBreakpointActionLog(debuggerCallFrame->exec(), breakpointAction.data);
+ break;
+ }
+ case ScriptBreakpointActionTypeEvaluate: {
+ NakedPtr<Exception> exception;
+ debuggerCallFrame->evaluate(breakpointAction.data, exception);
+ if (exception)
+ reportException(debuggerCallFrame->exec(), exception);
+ break;
+ }
+ case ScriptBreakpointActionTypeSound:
+ dispatchBreakpointActionSound(debuggerCallFrame->exec(), breakpointAction.identifier);
+ break;
+ case ScriptBreakpointActionTypeProbe: {
+ NakedPtr<Exception> exception;
+ JSValue result = debuggerCallFrame->evaluate(breakpointAction.data, exception);
+ if (exception)
+ reportException(debuggerCallFrame->exec(), exception);
+
+ JSC::ExecState* state = debuggerCallFrame->scope()->globalObject()->globalExec();
+ Deprecated::ScriptValue wrappedResult = Deprecated::ScriptValue(state->vm(), exception ? exception->value() : result);
+ dispatchBreakpointActionProbe(state, breakpointAction, wrappedResult);
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ return true;
+}
+
+void ScriptDebugServer::clearBreakpoints()
+{
+ Debugger::clearBreakpoints();
+ m_breakpointIDToActions.clear();
+}
+
+void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener)
+{
+ ASSERT(isPaused());
+ DebuggerCallFrame* debuggerCallFrame = currentDebuggerCallFrame();
+ JSGlobalObject* globalObject = debuggerCallFrame->scope()->globalObject();
+ JSC::ExecState* state = globalObject->globalExec();
+ RefPtr<JavaScriptCallFrame> javaScriptCallFrame = JavaScriptCallFrame::create(debuggerCallFrame);
+ JSValue jsCallFrame = toJS(state, globalObject, javaScriptCallFrame.get());
+
+ listener->didPause(state, Deprecated::ScriptValue(state->vm(), jsCallFrame), exceptionOrCaughtValue(state));
+}
+
+void ScriptDebugServer::dispatchBreakpointActionLog(ExecState* exec, const String& message)
+{
+ if (m_callingListeners)
+ return;
+
+ if (m_listeners.isEmpty())
+ return;
+
+ TemporaryChange<bool> change(m_callingListeners, true);
+
+ Vector<ScriptDebugListener*> listenersCopy;
+ copyToVector(m_listeners, listenersCopy);
+ for (auto* listener : listenersCopy)
+ listener->breakpointActionLog(exec, message);
+}
+
+void ScriptDebugServer::dispatchBreakpointActionSound(ExecState*, int breakpointActionIdentifier)
+{
+ if (m_callingListeners)
+ return;
+
+ if (m_listeners.isEmpty())
+ return;
+
+ TemporaryChange<bool> change(m_callingListeners, true);
+
+ Vector<ScriptDebugListener*> listenersCopy;
+ copyToVector(m_listeners, listenersCopy);
+ for (auto* listener : listenersCopy)
+ listener->breakpointActionSound(breakpointActionIdentifier);
+}
+
+void ScriptDebugServer::dispatchBreakpointActionProbe(ExecState* exec, const ScriptBreakpointAction& action, const Deprecated::ScriptValue& sampleValue)
+{
+ if (m_callingListeners)
+ return;
+
+ if (m_listeners.isEmpty())
+ return;
+
+ TemporaryChange<bool> change(m_callingListeners, true);
+
+ unsigned sampleId = m_nextProbeSampleId++;
+
+ Vector<ScriptDebugListener*> listenersCopy;
+ copyToVector(m_listeners, listenersCopy);
+ for (auto* listener : listenersCopy)
+ listener->breakpointActionProbe(exec, action, m_currentProbeBatchId, sampleId, sampleValue);
+}
+
+void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener)
+{
+ listener->didContinue();
+}
+
+void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, bool isContentScript)
+{
+ JSC::SourceID sourceID = sourceProvider->asID();
+
+ ScriptDebugListener::Script script;
+ script.url = sourceProvider->url();
+ script.source = sourceProvider->source().toString();
+ script.startLine = sourceProvider->startPosition().m_line.zeroBasedInt();
+ script.startColumn = sourceProvider->startPosition().m_column.zeroBasedInt();
+ script.isContentScript = isContentScript;
+ script.sourceURL = sourceProvider->sourceURL();
+ script.sourceMappingURL = sourceProvider->sourceMappingURL();
+
+ int sourceLength = script.source.length();
+ int lineCount = 1;
+ int lastLineStart = 0;
+ for (int i = 0; i < sourceLength; ++i) {
+ if (script.source[i] == '\n') {
+ lineCount += 1;
+ lastLineStart = i + 1;
+ }
+ }
+
+ script.endLine = script.startLine + lineCount - 1;
+ if (lineCount == 1)
+ script.endColumn = script.startColumn + sourceLength;
+ else
+ script.endColumn = sourceLength - lastLineStart;
+
+ Vector<ScriptDebugListener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ copy[i]->didParseSource(sourceID, script);
+}
+
+void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
+{
+ String url = sourceProvider->url();
+ String data = sourceProvider->source().toString();
+ int firstLine = sourceProvider->startPosition().m_line.oneBasedInt();
+
+ Vector<ScriptDebugListener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ copy[i]->failedToParseSource(url, data, firstLine, errorLine, errorMessage);
+}
+
+void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const String& errorMessage)
+{
+ if (m_callingListeners)
+ return;
+
+ if (m_listeners.isEmpty())
+ return;
+
+ TemporaryChange<bool> change(m_callingListeners, true);
+
+ bool isError = errorLine != -1;
+ if (isError)
+ dispatchFailedToParseSource(m_listeners, sourceProvider, errorLine, errorMessage);
+ else
+ dispatchDidParseSource(m_listeners, sourceProvider, isContentScript(exec));
+}
+
+void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback)
+{
+ if (m_callingListeners)
+ return;
+
+ if (m_listeners.isEmpty())
+ return;
+
+ TemporaryChange<bool> change(m_callingListeners, true);
+
+ dispatchFunctionToListeners(m_listeners, callback);
+}
+
+void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback)
+{
+ Vector<ScriptDebugListener*> copy;
+ copyToVector(listeners, copy);
+ for (size_t i = 0; i < copy.size(); ++i)
+ (this->*callback)(copy[i]);
+}
+
+void ScriptDebugServer::notifyDoneProcessingDebuggerEvents()
+{
+ m_doneProcessingDebuggerEvents = true;
+}
+
+void ScriptDebugServer::handleBreakpointHit(JSC::JSGlobalObject* globalObject, const JSC::Breakpoint& breakpoint)
+{
+ ASSERT(isAttached(globalObject));
+
+ m_currentProbeBatchId++;
+
+ BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(breakpoint.id);
+ if (it != m_breakpointIDToActions.end()) {
+ BreakpointActions actions = it->value;
+ for (size_t i = 0; i < actions.size(); ++i) {
+ if (!evaluateBreakpointAction(actions[i]))
+ return;
+ if (!isAttached(globalObject))
+ return;
+ }
+ }
+}
+
+void ScriptDebugServer::handleExceptionInBreakpointCondition(JSC::ExecState* exec, JSC::Exception* exception) const
+{
+ reportException(exec, exception);
+}
+
+void ScriptDebugServer::handlePause(JSGlobalObject* vmEntryGlobalObject, Debugger::ReasonForPause)
+{
+ dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause);
+ didPause(vmEntryGlobalObject);
+
+ m_doneProcessingDebuggerEvents = false;
+ runEventLoopWhilePaused();
+
+ didContinue(vmEntryGlobalObject);
+ dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue);
+}
+
+const BreakpointActions& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID)
+{
+ ASSERT(breakpointID != JSC::noBreakpointID);
+
+ if (m_breakpointIDToActions.contains(breakpointID))
+ return m_breakpointIDToActions.find(breakpointID)->value;
+
+ static NeverDestroyed<BreakpointActions> emptyActionVector = BreakpointActions();
+ return emptyActionVector;
+}
+
+void ScriptDebugServer::addListener(ScriptDebugListener* listener)
+{
+ ASSERT(listener);
+
+ bool wasEmpty = m_listeners.isEmpty();
+ m_listeners.add(listener);
+
+ // First listener. Attach the debugger.
+ if (wasEmpty)
+ attachDebugger();
+}
+
+void ScriptDebugServer::removeListener(ScriptDebugListener* listener, bool isBeingDestroyed)
+{
+ ASSERT(listener);
+
+ m_listeners.remove(listener);
+
+ // Last listener. Detach the debugger.
+ if (m_listeners.isEmpty())
+ detachDebugger(isBeingDestroyed);
+}
+
+Deprecated::ScriptValue ScriptDebugServer::exceptionOrCaughtValue(JSC::ExecState* state)
+{
+ if (reasonForPause() == PausedForException)
+ return Deprecated::ScriptValue(state->vm(), currentException());
+
+ RefPtr<DebuggerCallFrame> debuggerCallFrame = currentDebuggerCallFrame();
+ while (debuggerCallFrame) {
+ DebuggerScope* scope = debuggerCallFrame->scope();
+ if (scope->isCatchScope())
+ return Deprecated::ScriptValue(state->vm(), scope->caughtValue(state));
+ debuggerCallFrame = debuggerCallFrame->callerFrame();
+ }
+
+ return Deprecated::ScriptValue();
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/ScriptDebugServer.h b/Source/JavaScriptCore/inspector/ScriptDebugServer.h
new file mode 100644
index 000000000..ea210d3d2
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/ScriptDebugServer.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2008, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScriptDebugServer_h
+#define ScriptDebugServer_h
+
+#include "ScriptBreakpoint.h"
+#include "ScriptDebugListener.h"
+#include "bindings/ScriptObject.h"
+#include "debugger/Debugger.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/WTFString.h>
+
+namespace JSC {
+class ExecState;
+class JSGlobalObject;
+class VM;
+}
+
+namespace Inspector {
+
+class JS_EXPORT_PRIVATE ScriptDebugServer : public JSC::Debugger {
+ WTF_MAKE_NONCOPYABLE(ScriptDebugServer);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ JSC::BreakpointID setBreakpoint(JSC::SourceID, const ScriptBreakpoint&, unsigned* actualLineNumber, unsigned* actualColumnNumber);
+ void removeBreakpoint(JSC::BreakpointID);
+ void clearBreakpoints();
+
+ const BreakpointActions& getActionsForBreakpoint(JSC::BreakpointID);
+
+ void addListener(ScriptDebugListener*);
+ void removeListener(ScriptDebugListener*, bool isBeingDestroyed);
+
+protected:
+ typedef HashSet<ScriptDebugListener*> ListenerSet;
+ typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*);
+
+ ScriptDebugServer(JSC::VM&);
+ ~ScriptDebugServer();
+
+ virtual void attachDebugger() = 0;
+ virtual void detachDebugger(bool isBeingDestroyed) = 0;
+
+ virtual void didPause(JSC::JSGlobalObject*) = 0;
+ virtual void didContinue(JSC::JSGlobalObject*) = 0;
+ virtual void runEventLoopWhilePaused() = 0;
+ virtual bool isContentScript(JSC::ExecState*) const = 0;
+ virtual void reportException(JSC::ExecState*, JSC::Exception*) const = 0;
+
+ bool evaluateBreakpointAction(const ScriptBreakpointAction&);
+
+ void dispatchFunctionToListeners(JavaScriptExecutionCallback);
+ void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback);
+ void dispatchDidPause(ScriptDebugListener*);
+ void dispatchDidContinue(ScriptDebugListener*);
+ void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, bool isContentScript);
+ void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage);
+ void dispatchBreakpointActionLog(JSC::ExecState*, const String&);
+ void dispatchBreakpointActionSound(JSC::ExecState*, int breakpointActionIdentifier);
+ void dispatchBreakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&, const Deprecated::ScriptValue& sample);
+
+ bool m_doneProcessingDebuggerEvents {true};
+
+private:
+ typedef HashMap<JSC::BreakpointID, BreakpointActions> BreakpointIDToActionsMap;
+
+ virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg) override final;
+ virtual bool needPauseHandling(JSC::JSGlobalObject*) override final { return true; }
+ virtual void handleBreakpointHit(JSC::JSGlobalObject*, const JSC::Breakpoint&) override final;
+ virtual void handleExceptionInBreakpointCondition(JSC::ExecState*, JSC::Exception*) const override final;
+ virtual void handlePause(JSC::JSGlobalObject*, JSC::Debugger::ReasonForPause) override final;
+ virtual void notifyDoneProcessingDebuggerEvents() override final;
+
+ Deprecated::ScriptValue exceptionOrCaughtValue(JSC::ExecState*);
+
+ BreakpointIDToActionsMap m_breakpointIDToActions;
+
+ ListenerSet m_listeners;
+ bool m_callingListeners {false};
+
+ unsigned m_nextProbeSampleId {1};
+ unsigned m_currentProbeBatchId {0};
+};
+
+} // namespace Inspector
+
+#endif // ScriptDebugServer_h
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp
new file mode 100644
index 000000000..312e5d9b4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2007-2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorAgent.h"
+
+#include "InspectorEnvironment.h"
+#include "InspectorFrontendRouter.h"
+#include "InspectorValues.h"
+#include "ScriptValue.h"
+
+namespace Inspector {
+
+InspectorAgent::InspectorAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("Inspector"))
+ , m_environment(context.environment)
+ , m_frontendDispatcher(std::make_unique<InspectorFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(InspectorBackendDispatcher::create(context.backendDispatcher, this))
+{
+}
+
+InspectorAgent::~InspectorAgent()
+{
+}
+
+void InspectorAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+ m_pendingEvaluateTestCommands.clear();
+
+ ErrorString unused;
+ disable(unused);
+}
+
+void InspectorAgent::enable(ErrorString&)
+{
+ m_enabled = true;
+
+ if (m_pendingInspectData.first)
+ inspect(m_pendingInspectData.first.copyRef(), m_pendingInspectData.second.copyRef());
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_pendingExtraDomainsData)
+ m_frontendDispatcher->activateExtraDomains(m_pendingExtraDomainsData);
+#endif
+
+ for (auto& testCommand : m_pendingEvaluateTestCommands)
+ m_frontendDispatcher->evaluateForTestInFrontend(testCommand);
+
+ m_pendingEvaluateTestCommands.clear();
+}
+
+void InspectorAgent::disable(ErrorString&)
+{
+ m_enabled = false;
+}
+
+void InspectorAgent::initialized(ErrorString&)
+{
+ m_environment.frontendInitialized();
+}
+
+void InspectorAgent::inspect(RefPtr<Protocol::Runtime::RemoteObject>&& objectToInspect, RefPtr<InspectorObject>&& hints)
+{
+ if (m_enabled) {
+ m_frontendDispatcher->inspect(objectToInspect, hints);
+ m_pendingInspectData.first = nullptr;
+ m_pendingInspectData.second = nullptr;
+ return;
+ }
+
+ m_pendingInspectData.first = objectToInspect;
+ m_pendingInspectData.second = hints;
+}
+
+void InspectorAgent::evaluateForTestInFrontend(const String& script)
+{
+ if (m_enabled)
+ m_frontendDispatcher->evaluateForTestInFrontend(script);
+ else
+ m_pendingEvaluateTestCommands.append(script);
+}
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void InspectorAgent::activateExtraDomain(const String& domainName)
+{
+ if (!m_enabled) {
+ if (!m_pendingExtraDomainsData)
+ m_pendingExtraDomainsData = Inspector::Protocol::Array<String>::create();
+ m_pendingExtraDomainsData->addItem(domainName);
+ return;
+ }
+
+ Ref<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
+ domainNames->addItem(domainName);
+ m_frontendDispatcher->activateExtraDomains(WTFMove(domainNames));
+}
+
+void InspectorAgent::activateExtraDomains(const Vector<String>& extraDomains)
+{
+ if (extraDomains.isEmpty())
+ return;
+
+ RefPtr<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
+ for (auto domainName : extraDomains)
+ domainNames->addItem(domainName);
+
+ if (!m_enabled)
+ m_pendingExtraDomainsData = domainNames.release();
+ else
+ m_frontendDispatcher->activateExtraDomains(domainNames.release());
+}
+#endif
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorAgent.h
new file mode 100644
index 000000000..eda744901
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorAgent.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2007-2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorAgent_h
+#define InspectorAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "inspector/InspectorAgentBase.h"
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
+
+namespace Inspector {
+
+class BackendDispatcher;
+class InspectorEnvironment;
+class InspectorObject;
+
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorAgent final : public InspectorAgentBase, public InspectorBackendDispatcherHandler {
+ WTF_MAKE_NONCOPYABLE(InspectorAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ InspectorAgent(AgentContext&);
+ virtual ~InspectorAgent();
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ virtual void enable(ErrorString&) override;
+ virtual void disable(ErrorString&) override;
+ virtual void initialized(ErrorString&) override;
+
+ void inspect(RefPtr<Protocol::Runtime::RemoteObject>&& objectToInspect, RefPtr<InspectorObject>&& hints);
+ void evaluateForTestInFrontend(const String& script);
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ void activateExtraDomain(const String&);
+ void activateExtraDomains(const Vector<String>&);
+#endif
+
+private:
+ InspectorEnvironment& m_environment;
+ std::unique_ptr<InspectorFrontendDispatcher> m_frontendDispatcher;
+ Ref<InspectorBackendDispatcher> m_backendDispatcher;
+
+ Vector<String> m_pendingEvaluateTestCommands;
+ std::pair<RefPtr<Protocol::Runtime::RemoteObject>, RefPtr<InspectorObject>> m_pendingInspectData;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ RefPtr<Inspector::Protocol::Array<String>> m_pendingExtraDomainsData;
+#endif
+ bool m_enabled { false };
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
new file mode 100644
index 000000000..e518f7f55
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorConsoleAgent.h"
+
+#include "ConsoleMessage.h"
+#include "InjectedScriptManager.h"
+#include "InspectorFrontendRouter.h"
+#include "ScriptArguments.h"
+#include "ScriptCallFrame.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+#include "ScriptObject.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+static const unsigned maximumConsoleMessages = 100;
+static const int expireConsoleMessagesStep = 10;
+
+InspectorConsoleAgent::InspectorConsoleAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("Console"))
+ , m_injectedScriptManager(context.injectedScriptManager)
+ , m_frontendDispatcher(std::make_unique<ConsoleFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this))
+{
+}
+
+InspectorConsoleAgent::~InspectorConsoleAgent()
+{
+}
+
+void InspectorConsoleAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorConsoleAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+ String errorString;
+ disable(errorString);
+}
+
+void InspectorConsoleAgent::enable(ErrorString&)
+{
+ if (m_enabled)
+ return;
+
+ m_enabled = true;
+
+ if (m_expiredConsoleMessageCount) {
+ ConsoleMessage expiredMessage(MessageSource::Other, MessageType::Log, MessageLevel::Warning, String::format("%d console messages are not shown.", m_expiredConsoleMessageCount));
+ expiredMessage.addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, false);
+ }
+
+ size_t messageCount = m_consoleMessages.size();
+ for (size_t i = 0; i < messageCount; ++i)
+ m_consoleMessages[i]->addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, false);
+}
+
+void InspectorConsoleAgent::disable(ErrorString&)
+{
+ if (!m_enabled)
+ return;
+
+ m_enabled = false;
+}
+
+void InspectorConsoleAgent::clearMessages(ErrorString&)
+{
+ m_consoleMessages.clear();
+ m_expiredConsoleMessageCount = 0;
+ m_previousMessage = nullptr;
+
+ m_injectedScriptManager.releaseObjectGroup(ASCIILiteral("console"));
+
+ if (m_enabled)
+ m_frontendDispatcher->messagesCleared();
+}
+
+void InspectorConsoleAgent::reset()
+{
+ ErrorString unused;
+ clearMessages(unused);
+
+ m_times.clear();
+ m_counts.clear();
+}
+
+void InspectorConsoleAgent::addMessageToConsole(std::unique_ptr<ConsoleMessage> message)
+{
+ if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
+ return;
+
+ if (message->type() == MessageType::Clear) {
+ ErrorString unused;
+ clearMessages(unused);
+ }
+
+ addConsoleMessage(WTFMove(message));
+}
+
+void InspectorConsoleAgent::startTiming(const String& title)
+{
+ // Follow Firebug's behavior of requiring a title that is not null or
+ // undefined for timing functions
+ if (title.isNull())
+ return;
+
+ m_times.add(title, monotonicallyIncreasingTime());
+}
+
+void InspectorConsoleAgent::stopTiming(const String& title, PassRefPtr<ScriptCallStack> callStack)
+{
+ // Follow Firebug's behavior of requiring a title that is not null or
+ // undefined for timing functions
+ if (title.isNull())
+ return;
+
+ HashMap<String, double>::iterator it = m_times.find(title);
+ if (it == m_times.end())
+ return;
+
+ double startTime = it->value;
+ m_times.remove(it);
+
+ double elapsed = monotonicallyIncreasingTime() - startTime;
+ String message = title + String::format(": %.3fms", elapsed * 1000);
+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, callStack));
+}
+
+void InspectorConsoleAgent::count(JSC::ExecState* state, PassRefPtr<ScriptArguments> arguments)
+{
+ RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state, ScriptCallStack::maxCallStackSizeToCapture));
+ const ScriptCallFrame& lastCaller = callStack->at(0);
+ // Follow Firebug's behavior of counting with null and undefined title in
+ // the same bucket as no argument
+ String title;
+ arguments->getFirstArgumentAsString(title);
+ String identifier = title + '@' + lastCaller.sourceURL() + ':' + String::number(lastCaller.lineNumber());
+
+ HashMap<String, unsigned>::iterator it = m_counts.find(identifier);
+ int count;
+ if (it == m_counts.end())
+ count = 1;
+ else {
+ count = it->value + 1;
+ m_counts.remove(it);
+ }
+
+ m_counts.add(identifier, count);
+
+ String message;
+ if (title.isEmpty())
+ message = "<no label>: " + String::number(count);
+ else
+ message = title + ": " + String::number(count);
+
+ addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::ConsoleAPI, MessageType::Log, MessageLevel::Debug, message, callStack));
+}
+
+static bool isGroupMessage(MessageType type)
+{
+ return type == MessageType::StartGroup
+ || type == MessageType::StartGroupCollapsed
+ || type == MessageType::EndGroup;
+}
+
+void InspectorConsoleAgent::addConsoleMessage(std::unique_ptr<ConsoleMessage> consoleMessage)
+{
+ ASSERT(m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled());
+ ASSERT_ARG(consoleMessage, consoleMessage);
+
+ if (m_previousMessage && !isGroupMessage(m_previousMessage->type()) && m_previousMessage->isEqual(consoleMessage.get())) {
+ m_previousMessage->incrementCount();
+ if (m_enabled)
+ m_previousMessage->updateRepeatCountInConsole(*m_frontendDispatcher);
+ } else {
+ m_previousMessage = consoleMessage.get();
+ m_consoleMessages.append(WTFMove(consoleMessage));
+ if (m_enabled)
+ m_previousMessage->addToFrontend(*m_frontendDispatcher, m_injectedScriptManager, true);
+ }
+
+ if (m_consoleMessages.size() >= maximumConsoleMessages) {
+ m_expiredConsoleMessageCount += expireConsoleMessagesStep;
+ m_consoleMessages.remove(0, expireConsoleMessagesStep);
+ }
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
new file mode 100644
index 000000000..0e228d934
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
@@ -0,0 +1,93 @@
+/*
+* Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+* Copyright (C) 2011 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:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef InspectorConsoleAgent_h
+#define InspectorConsoleAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "inspector/InspectorAgentBase.h"
+#include "runtime/ConsoleTypes.h"
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+
+namespace JSC {
+class ExecState;
+}
+
+namespace Inspector {
+
+class ConsoleMessage;
+class InjectedScriptManager;
+class ScriptArguments;
+class ScriptCallStack;
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorConsoleAgent : public InspectorAgentBase, public ConsoleBackendDispatcherHandler {
+ WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ InspectorConsoleAgent(AgentContext&);
+ virtual ~InspectorConsoleAgent();
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ virtual void enable(ErrorString&) override;
+ virtual void disable(ErrorString&) override;
+ virtual void clearMessages(ErrorString&) override;
+ virtual void setMonitoringXHREnabled(ErrorString&, bool enabled) override = 0;
+ virtual void addInspectedNode(ErrorString&, int nodeId) override = 0;
+
+ bool enabled() const { return m_enabled; }
+ void reset();
+
+ void addMessageToConsole(std::unique_ptr<ConsoleMessage>);
+
+ void startTiming(const String& title);
+ void stopTiming(const String& title, PassRefPtr<ScriptCallStack>);
+ void count(JSC::ExecState*, PassRefPtr<ScriptArguments>);
+
+protected:
+ void addConsoleMessage(std::unique_ptr<ConsoleMessage>);
+
+ InjectedScriptManager& m_injectedScriptManager;
+ std::unique_ptr<ConsoleFrontendDispatcher> m_frontendDispatcher;
+ RefPtr<ConsoleBackendDispatcher> m_backendDispatcher;
+
+ ConsoleMessage* m_previousMessage { nullptr };
+ Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages;
+ int m_expiredConsoleMessageCount { 0 };
+ HashMap<String, unsigned> m_counts;
+ HashMap<String, double> m_times;
+ bool m_enabled { false };
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorConsoleAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
new file mode 100644
index 000000000..83d7f3b7e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
@@ -0,0 +1,835 @@
+/*
+ * Copyright (C) 2010, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorDebuggerAgent.h"
+
+#include "ContentSearchUtilities.h"
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InspectorFrontendRouter.h"
+#include "InspectorValues.h"
+#include "RegularExpression.h"
+#include "ScriptDebugServer.h"
+#include "ScriptObject.h"
+#include "ScriptValue.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Stopwatch.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace";
+
+// Objects created and retained by evaluating breakpoint actions are put into object groups
+// according to the breakpoint action identifier assigned by the frontend. A breakpoint may
+// have several object groups, and objects from several backend breakpoint action instances may
+// create objects in the same group.
+static String objectGroupForBreakpointAction(const ScriptBreakpointAction& action)
+{
+ static NeverDestroyed<String> objectGroup(ASCIILiteral("breakpoint-action-"));
+ return makeString(objectGroup.get(), String::number(action.identifier));
+}
+
+InspectorDebuggerAgent::InspectorDebuggerAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("Debugger"))
+ , m_injectedScriptManager(context.injectedScriptManager)
+ , m_frontendDispatcher(std::make_unique<DebuggerFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(DebuggerBackendDispatcher::create(context.backendDispatcher, this))
+ , m_scriptDebugServer(context.environment.scriptDebugServer())
+ , m_continueToLocationBreakpointID(JSC::noBreakpointID)
+{
+ // FIXME: make breakReason optional so that there was no need to init it with "other".
+ clearBreakDetails();
+}
+
+InspectorDebuggerAgent::~InspectorDebuggerAgent()
+{
+}
+
+void InspectorDebuggerAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorDebuggerAgent::willDestroyFrontendAndBackend(DisconnectReason reason)
+{
+ bool skipRecompile = reason == DisconnectReason::InspectedTargetDestroyed;
+ disable(skipRecompile);
+}
+
+void InspectorDebuggerAgent::enable()
+{
+ if (m_enabled)
+ return;
+
+ m_scriptDebugServer.setBreakpointsActivated(true);
+ m_scriptDebugServer.addListener(this);
+
+ if (m_listener)
+ m_listener->debuggerWasEnabled();
+
+ m_enabled = true;
+}
+
+void InspectorDebuggerAgent::disable(bool isBeingDestroyed)
+{
+ if (!m_enabled)
+ return;
+
+ m_scriptDebugServer.removeListener(this, isBeingDestroyed);
+ clearInspectorBreakpointState();
+
+ ASSERT(m_javaScriptBreakpoints.isEmpty());
+
+ if (m_listener)
+ m_listener->debuggerWasDisabled();
+
+ m_enabled = false;
+}
+
+void InspectorDebuggerAgent::enable(ErrorString&)
+{
+ enable();
+}
+
+void InspectorDebuggerAgent::disable(ErrorString&)
+{
+ disable(false);
+}
+
+void InspectorDebuggerAgent::setBreakpointsActive(ErrorString&, bool active)
+{
+ if (active)
+ m_scriptDebugServer.activateBreakpoints();
+ else
+ m_scriptDebugServer.deactivateBreakpoints();
+}
+
+bool InspectorDebuggerAgent::isPaused()
+{
+ return m_scriptDebugServer.isPaused();
+}
+
+void InspectorDebuggerAgent::setSuppressAllPauses(bool suppress)
+{
+ m_scriptDebugServer.setSuppressAllPauses(suppress);
+}
+
+static RefPtr<InspectorObject> buildAssertPauseReason(const String& message)
+{
+ auto reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release();
+ if (!message.isNull())
+ reason->setMessage(message);
+ return reason->openAccessors();
+}
+
+static RefPtr<InspectorObject> buildCSPViolationPauseReason(const String& directiveText)
+{
+ auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create()
+ .setDirective(directiveText)
+ .release();
+ return reason->openAccessors();
+}
+
+RefPtr<InspectorObject> InspectorDebuggerAgent::buildBreakpointPauseReason(JSC::BreakpointID debuggerBreakpointIdentifier)
+{
+ ASSERT(debuggerBreakpointIdentifier != JSC::noBreakpointID);
+ auto it = m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.find(debuggerBreakpointIdentifier);
+ if (it == m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.end())
+ return nullptr;
+
+ auto reason = Inspector::Protocol::Debugger::BreakpointPauseReason::create()
+ .setBreakpointId(it->value)
+ .release();
+ return reason->openAccessors();
+}
+
+RefPtr<InspectorObject> InspectorDebuggerAgent::buildExceptionPauseReason(const Deprecated::ScriptValue& exception, const InjectedScript& injectedScript)
+{
+ ASSERT(!exception.hasNoValue());
+ if (exception.hasNoValue())
+ return nullptr;
+
+ ASSERT(!injectedScript.hasNoValue());
+ if (injectedScript.hasNoValue())
+ return nullptr;
+
+ return injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors();
+}
+
+void InspectorDebuggerAgent::handleConsoleAssert(const String& message)
+{
+ if (m_scriptDebugServer.pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
+ breakProgram(DebuggerFrontendDispatcher::Reason::Assert, buildAssertPauseReason(message));
+}
+
+static Ref<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue, unsigned ignoreCount)
+{
+ Ref<InspectorObject> breakpointObject = InspectorObject::create();
+ breakpointObject->setString(ASCIILiteral("url"), url);
+ breakpointObject->setInteger(ASCIILiteral("lineNumber"), lineNumber);
+ breakpointObject->setInteger(ASCIILiteral("columnNumber"), columnNumber);
+ breakpointObject->setString(ASCIILiteral("condition"), condition);
+ breakpointObject->setBoolean(ASCIILiteral("isRegex"), isRegex);
+ breakpointObject->setBoolean(ASCIILiteral("autoContinue"), autoContinue);
+ breakpointObject->setInteger(ASCIILiteral("ignoreCount"), ignoreCount);
+
+ if (actions)
+ breakpointObject->setArray(ASCIILiteral("actions"), actions);
+
+ return breakpointObject;
+}
+
+static bool matches(const String& url, const String& pattern, bool isRegex)
+{
+ if (isRegex) {
+ JSC::Yarr::RegularExpression regex(pattern, TextCaseSensitive);
+ return regex.match(url) != -1;
+ }
+ return url == pattern;
+}
+
+static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output)
+{
+ if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
+ *output = ScriptBreakpointActionTypeLog;
+ return true;
+ }
+ if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
+ *output = ScriptBreakpointActionTypeEvaluate;
+ return true;
+ }
+ if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
+ *output = ScriptBreakpointActionTypeSound;
+ return true;
+ }
+ if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
+ *output = ScriptBreakpointActionTypeProbe;
+ return true;
+ }
+
+ return false;
+}
+
+bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString& errorString, RefPtr<InspectorArray>& actions, BreakpointActions* result)
+{
+ if (!actions)
+ return true;
+
+ unsigned actionsLength = actions->length();
+ if (!actionsLength)
+ return true;
+
+ result->reserveCapacity(actionsLength);
+ for (unsigned i = 0; i < actionsLength; ++i) {
+ RefPtr<InspectorValue> value = actions->get(i);
+ RefPtr<InspectorObject> object;
+ if (!value->asObject(object)) {
+ errorString = ASCIILiteral("BreakpointAction of incorrect type, expected object");
+ return false;
+ }
+
+ String typeString;
+ if (!object->getString(ASCIILiteral("type"), typeString)) {
+ errorString = ASCIILiteral("BreakpointAction had type missing");
+ return false;
+ }
+
+ ScriptBreakpointActionType type;
+ if (!breakpointActionTypeForString(typeString, &type)) {
+ errorString = ASCIILiteral("BreakpointAction had unknown type");
+ return false;
+ }
+
+ // Specifying an identifier is optional. They are used to correlate probe samples
+ // in the frontend across multiple backend probe actions and segregate object groups.
+ int identifier = 0;
+ object->getInteger(ASCIILiteral("id"), identifier);
+
+ String data;
+ object->getString(ASCIILiteral("data"), data);
+
+ result->append(ScriptBreakpointAction(type, identifier, data));
+ }
+
+ return true;
+}
+
+void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations)
+{
+ locations = Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>::create();
+ if (!optionalURL == !optionalURLRegex) {
+ errorString = ASCIILiteral("Either url or urlRegex must be specified.");
+ return;
+ }
+
+ String url = optionalURL ? *optionalURL : *optionalURLRegex;
+ int columnNumber = optionalColumnNumber ? *optionalColumnNumber : 0;
+ bool isRegex = optionalURLRegex;
+
+ String breakpointIdentifier = (isRegex ? "/" + url + "/" : url) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber);
+ if (m_javaScriptBreakpoints.contains(breakpointIdentifier)) {
+ errorString = ASCIILiteral("Breakpoint at specified location already exists.");
+ return;
+ }
+
+ String condition = emptyString();
+ bool autoContinue = false;
+ unsigned ignoreCount = 0;
+ RefPtr<InspectorArray> actions;
+ if (options) {
+ options->getString(ASCIILiteral("condition"), condition);
+ options->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
+ options->getArray(ASCIILiteral("actions"), actions);
+ options->getInteger(ASCIILiteral("ignoreCount"), ignoreCount);
+ }
+
+ BreakpointActions breakpointActions;
+ if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions))
+ return;
+
+ m_javaScriptBreakpoints.set(breakpointIdentifier, buildObjectForBreakpointCookie(url, lineNumber, columnNumber, condition, actions, isRegex, autoContinue, ignoreCount));
+
+ ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue, ignoreCount);
+ for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
+ String scriptURL = !it->value.sourceURL.isEmpty() ? it->value.sourceURL : it->value.url;
+ if (!matches(scriptURL, url, isRegex))
+ continue;
+
+ RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(breakpointIdentifier, it->key, breakpoint);
+ if (location)
+ locations->addItem(WTFMove(location));
+ }
+ *outBreakpointIdentifier = breakpointIdentifier;
+}
+
+static bool parseLocation(ErrorString& errorString, const InspectorObject& location, JSC::SourceID& sourceID, unsigned& lineNumber, unsigned& columnNumber)
+{
+ String scriptIDStr;
+ if (!location.getString(ASCIILiteral("scriptId"), scriptIDStr) || !location.getInteger(ASCIILiteral("lineNumber"), lineNumber)) {
+ sourceID = JSC::noSourceID;
+ errorString = ASCIILiteral("scriptId and lineNumber are required.");
+ return false;
+ }
+
+ sourceID = scriptIDStr.toIntPtr();
+ columnNumber = 0;
+ location.getInteger(ASCIILiteral("columnNumber"), columnNumber);
+ return true;
+}
+
+void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const InspectorObject& location, const InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)
+{
+ JSC::SourceID sourceID;
+ unsigned lineNumber;
+ unsigned columnNumber;
+ if (!parseLocation(errorString, location, sourceID, lineNumber, columnNumber))
+ return;
+
+ String condition = emptyString();
+ bool autoContinue = false;
+ unsigned ignoreCount = 0;
+ RefPtr<InspectorArray> actions;
+ if (options) {
+ options->getString(ASCIILiteral("condition"), condition);
+ options->getBoolean(ASCIILiteral("autoContinue"), autoContinue);
+ options->getArray(ASCIILiteral("actions"), actions);
+ options->getInteger(ASCIILiteral("ignoreCount"), ignoreCount);
+ }
+
+ BreakpointActions breakpointActions;
+ if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions))
+ return;
+
+ String breakpointIdentifier = String::number(sourceID) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber);
+ if (m_breakpointIdentifierToDebugServerBreakpointIDs.find(breakpointIdentifier) != m_breakpointIdentifierToDebugServerBreakpointIDs.end()) {
+ errorString = ASCIILiteral("Breakpoint at specified location already exists.");
+ return;
+ }
+
+ ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue, ignoreCount);
+ actualLocation = resolveBreakpoint(breakpointIdentifier, sourceID, breakpoint);
+ if (!actualLocation) {
+ errorString = ASCIILiteral("Could not resolve breakpoint");
+ return;
+ }
+
+ *outBreakpointIdentifier = breakpointIdentifier;
+}
+
+void InspectorDebuggerAgent::removeBreakpoint(ErrorString&, const String& breakpointIdentifier)
+{
+ m_javaScriptBreakpoints.remove(breakpointIdentifier);
+
+ for (JSC::BreakpointID breakpointID : m_breakpointIdentifierToDebugServerBreakpointIDs.take(breakpointIdentifier)) {
+ m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.remove(breakpointID);
+
+ const BreakpointActions& breakpointActions = m_scriptDebugServer.getActionsForBreakpoint(breakpointID);
+ for (auto& action : breakpointActions)
+ m_injectedScriptManager.releaseObjectGroup(objectGroupForBreakpointAction(action));
+
+ m_scriptDebugServer.removeBreakpoint(breakpointID);
+ }
+}
+
+void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const InspectorObject& location)
+{
+ if (m_continueToLocationBreakpointID != JSC::noBreakpointID) {
+ m_scriptDebugServer.removeBreakpoint(m_continueToLocationBreakpointID);
+ m_continueToLocationBreakpointID = JSC::noBreakpointID;
+ }
+
+ JSC::SourceID sourceID;
+ unsigned lineNumber;
+ unsigned columnNumber;
+ if (!parseLocation(errorString, location, sourceID, lineNumber, columnNumber))
+ return;
+
+ ScriptBreakpoint breakpoint(lineNumber, columnNumber, "", false, 0);
+ m_continueToLocationBreakpointID = m_scriptDebugServer.setBreakpoint(sourceID, breakpoint, &lineNumber, &columnNumber);
+ resume(errorString);
+}
+
+RefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID sourceID, const ScriptBreakpoint& breakpoint)
+{
+ ScriptsMap::iterator scriptIterator = m_scripts.find(sourceID);
+ if (scriptIterator == m_scripts.end())
+ return nullptr;
+ Script& script = scriptIterator->value;
+ if (breakpoint.lineNumber < script.startLine || script.endLine < breakpoint.lineNumber)
+ return nullptr;
+
+ unsigned actualLineNumber;
+ unsigned actualColumnNumber;
+ JSC::BreakpointID debugServerBreakpointID = m_scriptDebugServer.setBreakpoint(sourceID, breakpoint, &actualLineNumber, &actualColumnNumber);
+ if (debugServerBreakpointID == JSC::noBreakpointID)
+ return nullptr;
+
+ BreakpointIdentifierToDebugServerBreakpointIDsMap::iterator debugServerBreakpointIDsIterator = m_breakpointIdentifierToDebugServerBreakpointIDs.find(breakpointIdentifier);
+ if (debugServerBreakpointIDsIterator == m_breakpointIdentifierToDebugServerBreakpointIDs.end())
+ debugServerBreakpointIDsIterator = m_breakpointIdentifierToDebugServerBreakpointIDs.set(breakpointIdentifier, Vector<JSC::BreakpointID>()).iterator;
+ debugServerBreakpointIDsIterator->value.append(debugServerBreakpointID);
+
+ m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.set(debugServerBreakpointID, breakpointIdentifier);
+
+ auto location = Inspector::Protocol::Debugger::Location::create()
+ .setScriptId(String::number(sourceID))
+ .setLineNumber(actualLineNumber)
+ .release();
+ location->setColumnNumber(actualColumnNumber);
+ return WTFMove(location);
+}
+
+void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
+{
+ JSC::SourceID sourceID = scriptIDStr.toIntPtr();
+ auto it = m_scripts.find(sourceID);
+ if (it == m_scripts.end()) {
+ error = ASCIILiteral("No script for id: ") + scriptIDStr;
+ return;
+ }
+
+ bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
+ bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
+ results = ContentSearchUtilities::searchInTextByLines(it->value.source, query, caseSensitive, isRegex);
+}
+
+void InspectorDebuggerAgent::getScriptSource(ErrorString& error, const String& scriptIDStr, String* scriptSource)
+{
+ JSC::SourceID sourceID = scriptIDStr.toIntPtr();
+ ScriptsMap::iterator it = m_scripts.find(sourceID);
+ if (it != m_scripts.end())
+ *scriptSource = it->value.source;
+ else
+ error = ASCIILiteral("No script for id: ") + scriptIDStr;
+}
+
+void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(functionId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Function object id is obsolete");
+ return;
+ }
+
+ injectedScript.getFunctionDetails(errorString, functionId, &details);
+}
+
+void InspectorDebuggerAgent::schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data)
+{
+ if (m_javaScriptPauseScheduled)
+ return;
+
+ m_breakReason = breakReason;
+ m_breakAuxData = WTFMove(data);
+ m_scriptDebugServer.setPauseOnNextStatement(true);
+}
+
+void InspectorDebuggerAgent::cancelPauseOnNextStatement()
+{
+ if (m_javaScriptPauseScheduled)
+ return;
+
+ clearBreakDetails();
+ m_scriptDebugServer.setPauseOnNextStatement(false);
+}
+
+void InspectorDebuggerAgent::pause(ErrorString&)
+{
+ schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason::PauseOnNextStatement, nullptr);
+
+ m_javaScriptPauseScheduled = true;
+}
+
+void InspectorDebuggerAgent::resume(ErrorString& errorString)
+{
+ if (!assertPaused(errorString))
+ return;
+
+ m_scriptDebugServer.continueProgram();
+}
+
+void InspectorDebuggerAgent::stepOver(ErrorString& errorString)
+{
+ if (!assertPaused(errorString))
+ return;
+
+ m_scriptDebugServer.stepOverStatement();
+}
+
+void InspectorDebuggerAgent::stepInto(ErrorString& errorString)
+{
+ if (!assertPaused(errorString))
+ return;
+
+ m_scriptDebugServer.stepIntoStatement();
+
+ if (m_listener)
+ m_listener->stepInto();
+}
+
+void InspectorDebuggerAgent::stepOut(ErrorString& errorString)
+{
+ if (!assertPaused(errorString))
+ return;
+
+ m_scriptDebugServer.stepOutOfFunction();
+}
+
+void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString& errorString, const String& stringPauseState)
+{
+ JSC::Debugger::PauseOnExceptionsState pauseState;
+ if (stringPauseState == "none")
+ pauseState = JSC::Debugger::DontPauseOnExceptions;
+ else if (stringPauseState == "all")
+ pauseState = JSC::Debugger::PauseOnAllExceptions;
+ else if (stringPauseState == "uncaught")
+ pauseState = JSC::Debugger::PauseOnUncaughtExceptions;
+ else {
+ errorString = ASCIILiteral("Unknown pause on exceptions mode: ") + stringPauseState;
+ return;
+ }
+
+ m_scriptDebugServer.setPauseOnExceptionsState(static_cast<JSC::Debugger::PauseOnExceptionsState>(pauseState));
+ if (m_scriptDebugServer.pauseOnExceptionsState() != pauseState)
+ errorString = ASCIILiteral("Internal error. Could not change pause on exceptions state");
+}
+
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(callFrameId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+
+ JSC::Debugger::PauseOnExceptionsState previousPauseOnExceptionsState = m_scriptDebugServer.pauseOnExceptionsState();
+ if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
+ if (previousPauseOnExceptionsState != JSC::Debugger::DontPauseOnExceptions)
+ m_scriptDebugServer.setPauseOnExceptionsState(JSC::Debugger::DontPauseOnExceptions);
+ muteConsole();
+ }
+
+ injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, saveResult ? *saveResult : false, &result, wasThrown, savedResultIndex);
+
+ if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
+ unmuteConsole();
+ if (m_scriptDebugServer.pauseOnExceptionsState() != previousPauseOnExceptionsState)
+ m_scriptDebugServer.setPauseOnExceptionsState(previousPauseOnExceptionsState);
+ }
+}
+
+void InspectorDebuggerAgent::setOverlayMessage(ErrorString&, const String*)
+{
+}
+
+void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText)
+{
+ if (m_scriptDebugServer.pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
+ breakProgram(DebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText));
+}
+
+Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
+{
+ ASSERT(!injectedScript.hasNoValue());
+ if (injectedScript.hasNoValue())
+ return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create();
+
+ return injectedScript.wrapCallFrames(m_currentCallStack);
+}
+
+String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script)
+{
+ return script.sourceMappingURL;
+}
+
+void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script& script)
+{
+ bool hasSourceURL = !script.sourceURL.isEmpty();
+ String scriptURL = hasSourceURL ? script.sourceURL : script.url;
+ bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr;
+ String sourceMappingURL = sourceMapURLForScript(script);
+ String* sourceMapURLParam = sourceMappingURL.isNull() ? nullptr : &sourceMappingURL;
+ const bool* isContentScript = script.isContentScript ? &script.isContentScript : nullptr;
+ String scriptIDStr = String::number(sourceID);
+ m_frontendDispatcher->scriptParsed(scriptIDStr, scriptURL, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceMapURLParam, hasSourceURLParam);
+
+ m_scripts.set(sourceID, script);
+
+ if (scriptURL.isEmpty())
+ return;
+
+ for (auto it = m_javaScriptBreakpoints.begin(), end = m_javaScriptBreakpoints.end(); it != end; ++it) {
+ RefPtr<InspectorObject> breakpointObject;
+ if (!it->value->asObject(breakpointObject))
+ return;
+
+ bool isRegex;
+ breakpointObject->getBoolean(ASCIILiteral("isRegex"), isRegex);
+ String url;
+ breakpointObject->getString(ASCIILiteral("url"), url);
+ if (!matches(scriptURL, url, isRegex))
+ continue;
+
+ ScriptBreakpoint breakpoint;
+ breakpointObject->getInteger(ASCIILiteral("lineNumber"), breakpoint.lineNumber);
+ breakpointObject->getInteger(ASCIILiteral("columnNumber"), breakpoint.columnNumber);
+ breakpointObject->getString(ASCIILiteral("condition"), breakpoint.condition);
+ breakpointObject->getBoolean(ASCIILiteral("autoContinue"), breakpoint.autoContinue);
+ breakpointObject->getInteger(ASCIILiteral("ignoreCount"), breakpoint.ignoreCount);
+ ErrorString errorString;
+ RefPtr<InspectorArray> actions;
+ breakpointObject->getArray(ASCIILiteral("actions"), actions);
+ if (!breakpointActionsFromProtocol(errorString, actions, &breakpoint.actions)) {
+ ASSERT_NOT_REACHED();
+ continue;
+ }
+
+ RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(it->key, sourceID, breakpoint);
+ if (location)
+ m_frontendDispatcher->breakpointResolved(it->key, location);
+ }
+}
+
+void InspectorDebuggerAgent::failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage)
+{
+ m_frontendDispatcher->scriptFailedToParse(url, data, firstLine, errorLine, errorMessage);
+}
+
+void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue)
+{
+ ASSERT(scriptState && !m_pausedScriptState);
+ m_pausedScriptState = scriptState;
+ m_currentCallStack = callFrames;
+
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
+
+ // If a high level pause pause reason is not already set, try to infer a reason from the debugger.
+ if (m_breakReason == DebuggerFrontendDispatcher::Reason::Other) {
+ switch (m_scriptDebugServer.reasonForPause()) {
+ case JSC::Debugger::PausedForBreakpoint: {
+ JSC::BreakpointID debuggerBreakpointId = m_scriptDebugServer.pausingBreakpointID();
+ if (debuggerBreakpointId != m_continueToLocationBreakpointID) {
+ m_breakReason = DebuggerFrontendDispatcher::Reason::Breakpoint;
+ m_breakAuxData = buildBreakpointPauseReason(debuggerBreakpointId);
+ }
+ break;
+ }
+ case JSC::Debugger::PausedForDebuggerStatement:
+ m_breakReason = DebuggerFrontendDispatcher::Reason::DebuggerStatement;
+ m_breakAuxData = nullptr;
+ break;
+ case JSC::Debugger::PausedForException:
+ m_breakReason = DebuggerFrontendDispatcher::Reason::Exception;
+ m_breakAuxData = buildExceptionPauseReason(exceptionOrCaughtValue, injectedScript);
+ break;
+ case JSC::Debugger::PausedAtStatement:
+ case JSC::Debugger::PausedAfterCall:
+ case JSC::Debugger::PausedBeforeReturn:
+ case JSC::Debugger::PausedAtStartOfProgram:
+ case JSC::Debugger::PausedAtEndOfProgram:
+ // Pause was just stepping. Nothing to report.
+ break;
+ case JSC::Debugger::NotPaused:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
+
+ // Set $exception to the exception or caught value.
+ if (!exceptionOrCaughtValue.hasNoValue() && !injectedScript.hasNoValue()) {
+ injectedScript.setExceptionValue(exceptionOrCaughtValue);
+ m_hasExceptionValue = true;
+ }
+
+ m_frontendDispatcher->paused(currentCallFrames(injectedScript), m_breakReason, m_breakAuxData);
+ m_javaScriptPauseScheduled = false;
+
+ if (m_continueToLocationBreakpointID != JSC::noBreakpointID) {
+ m_scriptDebugServer.removeBreakpoint(m_continueToLocationBreakpointID);
+ m_continueToLocationBreakpointID = JSC::noBreakpointID;
+ }
+
+ if (m_listener)
+ m_listener->didPause();
+
+ RefPtr<Stopwatch> stopwatch = m_injectedScriptManager.inspectorEnvironment().executionStopwatch();
+ if (stopwatch && stopwatch->isActive()) {
+ stopwatch->stop();
+ m_didPauseStopwatch = true;
+ }
+}
+
+void InspectorDebuggerAgent::breakpointActionSound(int breakpointActionIdentifier)
+{
+ m_frontendDispatcher->playBreakpointActionSound(breakpointActionIdentifier);
+}
+
+void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState* scriptState, const ScriptBreakpointAction& action, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue& sample)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(scriptState);
+ RefPtr<Protocol::Runtime::RemoteObject> payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(action), true);
+ auto result = Protocol::Debugger::ProbeSample::create()
+ .setProbeId(action.identifier)
+ .setBatchId(batchId)
+ .setSampleId(sampleId)
+ .setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->elapsedTime())
+ .setPayload(payload.release())
+ .release();
+
+ m_frontendDispatcher->didSampleProbe(WTFMove(result));
+}
+
+void InspectorDebuggerAgent::didContinue()
+{
+ if (m_didPauseStopwatch) {
+ m_didPauseStopwatch = false;
+ m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->start();
+ }
+
+ m_pausedScriptState = nullptr;
+ m_currentCallStack = Deprecated::ScriptValue();
+ m_injectedScriptManager.releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup);
+ clearBreakDetails();
+ clearExceptionValue();
+
+ m_frontendDispatcher->resumed();
+}
+
+void InspectorDebuggerAgent::breakProgram(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data)
+{
+ m_breakReason = breakReason;
+ m_breakAuxData = WTFMove(data);
+ m_scriptDebugServer.breakProgram();
+}
+
+void InspectorDebuggerAgent::clearInspectorBreakpointState()
+{
+ ErrorString dummyError;
+ Vector<String> breakpointIdentifiers;
+ copyKeysToVector(m_breakpointIdentifierToDebugServerBreakpointIDs, breakpointIdentifiers);
+ for (const String& identifier : breakpointIdentifiers)
+ removeBreakpoint(dummyError, identifier);
+
+ m_javaScriptBreakpoints.clear();
+
+ clearDebuggerBreakpointState();
+}
+
+void InspectorDebuggerAgent::clearDebuggerBreakpointState()
+{
+ m_scriptDebugServer.clearBreakpoints();
+
+ m_pausedScriptState = nullptr;
+ m_currentCallStack = Deprecated::ScriptValue();
+ m_scripts.clear();
+ m_breakpointIdentifierToDebugServerBreakpointIDs.clear();
+ m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.clear();
+ m_continueToLocationBreakpointID = JSC::noBreakpointID;
+ clearBreakDetails();
+ m_javaScriptPauseScheduled = false;
+ m_hasExceptionValue = false;
+
+ m_scriptDebugServer.continueProgram();
+}
+
+void InspectorDebuggerAgent::didClearGlobalObject()
+{
+ // Clear breakpoints from the debugger, but keep the inspector's model of which
+ // pages have what breakpoints, as the mapping is only sent to DebuggerAgent once.
+ clearDebuggerBreakpointState();
+
+ m_frontendDispatcher->globalObjectCleared();
+}
+
+bool InspectorDebuggerAgent::assertPaused(ErrorString& errorString)
+{
+ if (!m_pausedScriptState) {
+ errorString = ASCIILiteral("Can only perform operation while paused.");
+ return false;
+ }
+
+ return true;
+}
+
+void InspectorDebuggerAgent::clearBreakDetails()
+{
+ m_breakReason = DebuggerFrontendDispatcher::Reason::Other;
+ m_breakAuxData = nullptr;
+}
+
+void InspectorDebuggerAgent::clearExceptionValue()
+{
+ if (m_hasExceptionValue) {
+ m_injectedScriptManager.clearExceptionValue();
+ m_hasExceptionValue = false;
+ }
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
new file mode 100644
index 000000000..c09332cf0
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2010, 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorDebuggerAgent_h
+#define InspectorDebuggerAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "bindings/ScriptValue.h"
+#include "debugger/Debugger.h"
+#include "inspector/InspectorAgentBase.h"
+#include "inspector/ScriptBreakpoint.h"
+#include "inspector/ScriptDebugListener.h"
+#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
+
+namespace Inspector {
+
+class InjectedScript;
+class InjectedScriptManager;
+class InspectorArray;
+class InspectorObject;
+class InspectorValue;
+class ScriptDebugServer;
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorDebuggerAgent : public InspectorAgentBase, public ScriptDebugListener, public DebuggerBackendDispatcherHandler {
+ WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static const char* backtraceObjectGroup;
+
+ virtual ~InspectorDebuggerAgent();
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ virtual void enable(ErrorString&) override;
+ virtual void disable(ErrorString&) override;
+ virtual void setBreakpointsActive(ErrorString&, bool active) override;
+ virtual void setBreakpointByUrl(ErrorString&, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const Inspector::InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>>& locations) override;
+ virtual void setBreakpoint(ErrorString&, const Inspector::InspectorObject& location, const Inspector::InspectorObject* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) override;
+ virtual void removeBreakpoint(ErrorString&, const String& breakpointIdentifier) override;
+ virtual void continueToLocation(ErrorString&, const InspectorObject& location) override;
+ virtual void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;
+ virtual void getScriptSource(ErrorString&, const String& scriptID, String* scriptSource) override;
+ virtual void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>&) override;
+ virtual void pause(ErrorString&) override;
+ virtual void resume(ErrorString&) override;
+ virtual void stepOver(ErrorString&) override;
+ virtual void stepInto(ErrorString&) override;
+ virtual void stepOut(ErrorString&) override;
+ virtual void setPauseOnExceptions(ErrorString&, const String& pauseState) override;
+ virtual void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex) override;
+ virtual void setOverlayMessage(ErrorString&, const String*) override;
+
+ bool isPaused();
+
+ void setSuppressAllPauses(bool);
+
+ void handleConsoleAssert(const String& message);
+
+ void schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data);
+ void cancelPauseOnNextStatement();
+ void breakProgram(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data);
+ void scriptExecutionBlockedByCSP(const String& directiveText);
+
+ class Listener {
+ public:
+ virtual ~Listener() { }
+ virtual void debuggerWasEnabled() = 0;
+ virtual void debuggerWasDisabled() = 0;
+ virtual void stepInto() = 0;
+ virtual void didPause() = 0;
+ };
+ void setListener(Listener* listener) { m_listener = listener; }
+
+protected:
+ InspectorDebuggerAgent(AgentContext&);
+
+ InjectedScriptManager& injectedScriptManager() const { return m_injectedScriptManager; }
+ virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
+
+ ScriptDebugServer& scriptDebugServer() { return m_scriptDebugServer; }
+
+ virtual void muteConsole() = 0;
+ virtual void unmuteConsole() = 0;
+
+ virtual void enable();
+ virtual void disable(bool skipRecompile);
+ virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) override;
+ virtual void didContinue() override;
+
+ virtual String sourceMapURLForScript(const Script&);
+
+ void didClearGlobalObject();
+
+private:
+ Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
+
+ virtual void didParseSource(JSC::SourceID, const Script&) override final;
+ virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) override final;
+
+ virtual void breakpointActionSound(int breakpointActionIdentifier) override;
+ virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue& sample) override final;
+
+ RefPtr<Inspector::Protocol::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&);
+ bool assertPaused(ErrorString&);
+ void clearDebuggerBreakpointState();
+ void clearInspectorBreakpointState();
+ void clearBreakDetails();
+ void clearExceptionValue();
+
+ RefPtr<InspectorObject> buildBreakpointPauseReason(JSC::BreakpointID);
+ RefPtr<InspectorObject> buildExceptionPauseReason(const Deprecated::ScriptValue& exception, const InjectedScript&);
+
+ bool breakpointActionsFromProtocol(ErrorString&, RefPtr<InspectorArray>& actions, BreakpointActions* result);
+
+ typedef HashMap<JSC::SourceID, Script> ScriptsMap;
+ typedef HashMap<String, Vector<JSC::BreakpointID>> BreakpointIdentifierToDebugServerBreakpointIDsMap;
+ typedef HashMap<String, RefPtr<InspectorObject>> BreakpointIdentifierToBreakpointMap;
+ typedef HashMap<JSC::BreakpointID, String> DebugServerBreakpointIDToBreakpointIdentifier;
+
+ InjectedScriptManager& m_injectedScriptManager;
+ std::unique_ptr<DebuggerFrontendDispatcher> m_frontendDispatcher;
+ RefPtr<DebuggerBackendDispatcher> m_backendDispatcher;
+ ScriptDebugServer& m_scriptDebugServer;
+ Listener* m_listener { nullptr };
+ JSC::ExecState* m_pausedScriptState { nullptr };
+ Deprecated::ScriptValue m_currentCallStack;
+ ScriptsMap m_scripts;
+ BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs;
+ BreakpointIdentifierToBreakpointMap m_javaScriptBreakpoints;
+ DebugServerBreakpointIDToBreakpointIdentifier m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier;
+ JSC::BreakpointID m_continueToLocationBreakpointID;
+ DebuggerFrontendDispatcher::Reason m_breakReason;
+ RefPtr<InspectorObject> m_breakAuxData;
+ bool m_enabled { false };
+ bool m_javaScriptPauseScheduled { false };
+ bool m_hasExceptionValue { false };
+ bool m_didPauseStopwatch { false };
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorDebuggerAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
new file mode 100644
index 000000000..2cbc3f304
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorHeapAgent.h"
+
+#include "InspectorEnvironment.h"
+#include "VM.h"
+#include <wtf/RunLoop.h>
+#include <wtf/Stopwatch.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+InspectorHeapAgent::InspectorHeapAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("Heap"))
+ , m_frontendDispatcher(std::make_unique<HeapFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(HeapBackendDispatcher::create(context.backendDispatcher, this))
+ , m_environment(context.environment)
+{
+}
+
+InspectorHeapAgent::~InspectorHeapAgent()
+{
+}
+
+void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorHeapAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+ ErrorString ignored;
+ disable(ignored);
+}
+
+void InspectorHeapAgent::enable(ErrorString&)
+{
+ if (m_enabled)
+ return;
+
+ m_enabled = true;
+
+ m_environment.vm().heap.addObserver(this);
+}
+
+void InspectorHeapAgent::disable(ErrorString&)
+{
+ if (!m_enabled)
+ return;
+
+ m_enabled = false;
+
+ m_environment.vm().heap.removeObserver(this);
+}
+
+void InspectorHeapAgent::gc(ErrorString&)
+{
+ VM& vm = m_environment.vm();
+ JSLockHolder lock(vm);
+ sanitizeStackForVM(&vm);
+ vm.heap.collectAllGarbage();
+}
+
+static Inspector::Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(HeapOperation operation)
+{
+ switch (operation) {
+ case FullCollection:
+ return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
+ case EdenCollection:
+ return Inspector::Protocol::Heap::GarbageCollection::Type::Partial;
+ default:
+ ASSERT_NOT_REACHED();
+ return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
+ }
+}
+
+void InspectorHeapAgent::willGarbageCollect()
+{
+ ASSERT(m_enabled);
+ ASSERT(std::isnan(m_gcStartTime));
+
+ m_gcStartTime = m_environment.executionStopwatch()->elapsedTime();
+}
+
+void InspectorHeapAgent::didGarbageCollect(HeapOperation operation)
+{
+ ASSERT(m_enabled);
+ ASSERT(!std::isnan(m_gcStartTime));
+
+ // FIXME: Include number of bytes freed by collection.
+
+ double startTime = m_gcStartTime;
+ double endTime = m_environment.executionStopwatch()->elapsedTime();
+
+ // Dispatch the event asynchronously because this method may be
+ // called between collection and sweeping and we don't want to
+ // create unexpected JavaScript allocations that the Sweeper does
+ // not expect to encounter. JavaScript allocations could happen
+ // with WebKitLegacy's in process inspector which shares the same
+ // VM as the inspected page.
+
+ RunLoop::current().dispatch([this, startTime, endTime, operation]() {
+ auto collection = Inspector::Protocol::Heap::GarbageCollection::create()
+ .setType(protocolTypeForHeapOperation(operation))
+ .setStartTime(startTime)
+ .setEndTime(endTime)
+ .release();
+
+ m_frontendDispatcher->garbageCollected(WTFMove(collection));
+ });
+
+ m_gcStartTime = NAN;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
new file mode 100644
index 000000000..18e48df73
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 InspectorHeapAgent_h
+#define InspectorHeapAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "heap/HeapObserver.h"
+#include "inspector/InspectorAgentBase.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorHeapAgent final : public InspectorAgentBase, public HeapBackendDispatcherHandler, public JSC::HeapObserver {
+ WTF_MAKE_NONCOPYABLE(InspectorHeapAgent);
+public:
+ InspectorHeapAgent(AgentContext&);
+ virtual ~InspectorHeapAgent();
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ // HeapBackendDispatcherHandler
+ virtual void enable(ErrorString&) override;
+ virtual void disable(ErrorString&) override;
+ virtual void gc(ErrorString&) override;
+
+ // HeapObserver
+ virtual void willGarbageCollect() override;
+ virtual void didGarbageCollect(JSC::HeapOperation) override;
+
+private:
+ std::unique_ptr<HeapFrontendDispatcher> m_frontendDispatcher;
+ RefPtr<HeapBackendDispatcher> m_backendDispatcher;
+ InspectorEnvironment& m_environment;
+ bool m_enabled { false };
+ double m_gcStartTime { NAN };
+};
+
+} // namespace Inspector
+
+#endif // InspectorHeapAgent_h
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
new file mode 100644
index 000000000..81d03bdb2
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
@@ -0,0 +1,360 @@
+/*
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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.
+ */
+
+#include "config.h"
+#include "InspectorRuntimeAgent.h"
+
+#include "Completion.h"
+#include "DFGWorklist.h"
+#include "HeapIterationScope.h"
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "InspectorFrontendRouter.h"
+#include "InspectorValues.h"
+#include "JSLock.h"
+#include "ParserError.h"
+#include "ScriptDebugServer.h"
+#include "SourceCode.h"
+#include "TypeProfiler.h"
+#include "TypeProfilerLog.h"
+#include "VMEntryScope.h"
+#include <wtf/CurrentTime.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+static bool asBool(const bool* const b)
+{
+ return b ? *b : false;
+}
+
+InspectorRuntimeAgent::InspectorRuntimeAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("Runtime"))
+ , m_injectedScriptManager(context.injectedScriptManager)
+ , m_scriptDebugServer(context.environment.scriptDebugServer())
+ , m_vm(context.environment.vm())
+{
+}
+
+InspectorRuntimeAgent::~InspectorRuntimeAgent()
+{
+}
+
+static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer& scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
+{
+ ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer.pauseOnExceptionsState();
+ if (presentState != newState)
+ scriptDebugServer.setPauseOnExceptionsState(newState);
+ return presentState;
+}
+
+static Ref<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
+{
+ return Inspector::Protocol::Runtime::ErrorRange::create()
+ .setStartOffset(tokenLocation.startOffset)
+ .setEndOffset(tokenLocation.endOffset)
+ .release();
+}
+
+void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)
+{
+ JSLockHolder lock(m_vm);
+
+ ParserError error;
+ checkSyntax(m_vm, JSC::makeSource(expression), error);
+
+ switch (error.syntaxErrorType()) {
+ case ParserError::SyntaxErrorNone:
+ *result = Inspector::Protocol::Runtime::SyntaxErrorType::None;
+ break;
+ case ParserError::SyntaxErrorIrrecoverable:
+ *result = Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable;
+ break;
+ case ParserError::SyntaxErrorUnterminatedLiteral:
+ *result = Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;
+ break;
+ case ParserError::SyntaxErrorRecoverable:
+ *result = Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable;
+ break;
+ }
+
+ if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) {
+ *message = error.message();
+ range = buildErrorRangeObject(error.token().m_location);
+ }
+}
+
+void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
+ if (injectedScript.hasNoValue())
+ return;
+
+ ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions;
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+ previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+ muteConsole();
+
+ injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), &result, wasThrown, savedResultIndex);
+
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+ unmuteConsole();
+ setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+ }
+}
+
+void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const InspectorArray* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+
+ String arguments;
+ if (optionalArguments)
+ arguments = optionalArguments->toJSONString();
+
+ ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions;
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+ previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole))
+ muteConsole();
+
+ injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), &result, wasThrown);
+
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
+ unmuteConsole();
+ setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+ }
+}
+
+void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+
+ ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+ muteConsole();
+
+ injectedScript.getProperties(errorString, objectId, asBool(ownProperties), asBool(generatePreview), &result);
+ injectedScript.getInternalProperties(errorString, objectId, asBool(generatePreview), &internalProperties);
+
+ unmuteConsole();
+ setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+}
+
+void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+
+ ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+ muteConsole();
+
+ injectedScript.getDisplayableProperties(errorString, objectId, asBool(generatePreview), &result);
+ injectedScript.getInternalProperties(errorString, objectId, asBool(generatePreview), &internalProperties);
+
+ unmuteConsole();
+ setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+}
+
+void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+
+ int start = startIndex && *startIndex >= 0 ? *startIndex : 0;
+ int fetch = numberToFetch && *numberToFetch >= 0 ? *numberToFetch : 0;
+
+ injectedScript.getCollectionEntries(errorString, objectId, objectGroup ? *objectGroup : String(), start, fetch, &entries);
+}
+
+void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const Inspector::InspectorObject& callArgument, const int* executionContextId, Inspector::Protocol::OptOutput<int>* savedResultIndex)
+{
+ InjectedScript injectedScript;
+
+ String objectId;
+ if (callArgument.getString(ASCIILiteral("objectId"), objectId)) {
+ injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (injectedScript.hasNoValue()) {
+ errorString = ASCIILiteral("Inspected frame has gone");
+ return;
+ }
+ } else {
+ injectedScript = injectedScriptForEval(errorString, executionContextId);
+ if (injectedScript.hasNoValue())
+ return;
+ }
+
+ injectedScript.saveResult(errorString, callArgument.toJSONString(), savedResultIndex);
+}
+
+void InspectorRuntimeAgent::releaseObject(ErrorString&, const String& objectId)
+{
+ InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
+ if (!injectedScript.hasNoValue())
+ injectedScript.releaseObject(objectId);
+}
+
+void InspectorRuntimeAgent::releaseObjectGroup(ErrorString&, const String& objectGroup)
+{
+ m_injectedScriptManager.releaseObjectGroup(objectGroup);
+}
+
+void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const Inspector::InspectorArray& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
+{
+ static const bool verbose = false;
+
+ typeDescriptions = Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>::create();
+ if (!m_vm.typeProfiler()) {
+ errorString = ASCIILiteral("The VM does not currently have Type Information.");
+ return;
+ }
+
+ double start = currentTimeMS();
+ m_vm.typeProfilerLog()->processLogEntries(ASCIILiteral("User Query"));
+
+ for (size_t i = 0; i < locations.length(); i++) {
+ RefPtr<Inspector::InspectorValue> value = locations.get(i);
+ RefPtr<InspectorObject> location;
+ if (!value->asObject(location)) {
+ errorString = ASCIILiteral("Array of TypeLocation objects has an object that does not have type of TypeLocation.");
+ return;
+ }
+
+ int descriptor;
+ String sourceIDAsString;
+ int divot;
+ location->getInteger(ASCIILiteral("typeInformationDescriptor"), descriptor);
+ location->getString(ASCIILiteral("sourceID"), sourceIDAsString);
+ location->getInteger(ASCIILiteral("divot"), divot);
+
+ bool okay;
+ TypeLocation* typeLocation = m_vm.typeProfiler()->findLocation(divot, sourceIDAsString.toIntPtrStrict(&okay), static_cast<TypeProfilerSearchDescriptor>(descriptor), m_vm);
+ ASSERT(okay);
+
+ RefPtr<TypeSet> typeSet;
+ if (typeLocation) {
+ if (typeLocation->m_globalTypeSet && typeLocation->m_globalVariableID != TypeProfilerNoGlobalIDExists)
+ typeSet = typeLocation->m_globalTypeSet;
+ else
+ typeSet = typeLocation->m_instructionTypeSet;
+ }
+
+ bool isValid = typeLocation && typeSet && !typeSet->isEmpty();
+ auto description = Inspector::Protocol::Runtime::TypeDescription::create()
+ .setIsValid(isValid)
+ .release();
+
+ if (isValid) {
+ description->setLeastCommonAncestor(typeSet->leastCommonAncestor());
+ description->setStructures(typeSet->allStructureRepresentations());
+ description->setTypeSet(typeSet->inspectorTypeSet());
+ description->setIsTruncated(typeSet->isOverflown());
+ }
+
+ typeDescriptions->addItem(WTFMove(description));
+ }
+
+ double end = currentTimeMS();
+ if (verbose)
+ dataLogF("Inspector::getRuntimeTypesForVariablesAtOffsets took %lfms\n", end - start);
+}
+
+void InspectorRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason)
+{
+ if (reason != DisconnectReason::InspectedTargetDestroyed && m_isTypeProfilingEnabled)
+ setTypeProfilerEnabledState(false);
+}
+
+void InspectorRuntimeAgent::enableTypeProfiler(ErrorString&)
+{
+ setTypeProfilerEnabledState(true);
+}
+
+void InspectorRuntimeAgent::disableTypeProfiler(ErrorString&)
+{
+ setTypeProfilerEnabledState(false);
+}
+
+void InspectorRuntimeAgent::setTypeProfilerEnabledState(bool isTypeProfilingEnabled)
+{
+ if (m_isTypeProfilingEnabled == isTypeProfilingEnabled)
+ return;
+ m_isTypeProfilingEnabled = isTypeProfilingEnabled;
+
+ VM& vm = m_vm;
+ vm.whenIdle([&vm, isTypeProfilingEnabled] () {
+ bool shouldRecompileFromTypeProfiler = (isTypeProfilingEnabled ? vm.enableTypeProfiler() : vm.disableTypeProfiler());
+ bool shouldRecompileFromControlFlowProfiler = (isTypeProfilingEnabled ? vm.enableControlFlowProfiler() : vm.disableControlFlowProfiler());
+ bool needsToRecompile = shouldRecompileFromTypeProfiler || shouldRecompileFromControlFlowProfiler;
+
+ if (needsToRecompile)
+ vm.deleteAllCode();
+ });
+}
+
+void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)
+{
+ if (!m_vm.controlFlowProfiler()) {
+ errorString = ASCIILiteral("The VM does not currently have a Control Flow Profiler.");
+ return;
+ }
+
+ bool okay;
+ intptr_t sourceID = sourceIDAsString.toIntPtrStrict(&okay);
+ ASSERT(okay);
+ const Vector<BasicBlockRange>& basicBlockRanges = m_vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, m_vm);
+ basicBlocks = Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>::create();
+ for (const BasicBlockRange& block : basicBlockRanges) {
+ Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
+ .setStartOffset(block.m_startOffset)
+ .setEndOffset(block.m_endOffset)
+ .setHasExecuted(block.m_hasExecuted)
+ .setExecutionCount(block.m_executionCount)
+ .release();
+ basicBlocks->addItem(WTFMove(location));
+ }
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
new file mode 100644
index 000000000..e3385b9ba
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 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 InspectorRuntimeAgent_h
+#define InspectorRuntimeAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "inspector/InspectorAgentBase.h"
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+class VM;
+}
+
+namespace Inspector {
+
+class InjectedScript;
+class InjectedScriptManager;
+class InspectorArray;
+class ScriptDebugServer;
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorRuntimeAgent : public InspectorAgentBase, public RuntimeBackendDispatcherHandler {
+ WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent);
+public:
+ virtual ~InspectorRuntimeAgent();
+
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ virtual void enable(ErrorString&) override { m_enabled = true; }
+ virtual void disable(ErrorString&) override { m_enabled = false; }
+ virtual void parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>&) override final;
+ virtual void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex) override final;
+ virtual void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const Inspector::InspectorArray* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
+ virtual void releaseObject(ErrorString&, const ErrorString& objectId) override final;
+ virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
+ virtual void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
+ virtual void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries) override final;
+ virtual void saveResult(ErrorString&, const Inspector::InspectorObject& callArgument, const int* executionContextId, Inspector::Protocol::OptOutput<int>* savedResultIndex) override final;
+ virtual void releaseObjectGroup(ErrorString&, const String& objectGroup) override final;
+ virtual void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const Inspector::InspectorArray& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>&) override;
+ virtual void enableTypeProfiler(ErrorString&) override;
+ virtual void disableTypeProfiler(ErrorString&) override;
+ virtual void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
+
+ bool enabled() const { return m_enabled; }
+
+protected:
+ InspectorRuntimeAgent(AgentContext&);
+
+ InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
+
+ virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
+
+ virtual void muteConsole() = 0;
+ virtual void unmuteConsole() = 0;
+
+private:
+ void setTypeProfilerEnabledState(bool);
+
+ InjectedScriptManager& m_injectedScriptManager;
+ ScriptDebugServer& m_scriptDebugServer;
+ JSC::VM& m_vm;
+ bool m_enabled {false};
+ bool m_isTypeProfilingEnabled {false};
+};
+
+} // namespace Inspector
+
+#endif // InspectorRuntimeAgent_h
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp
new file mode 100644
index 000000000..8c4fd121c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InspectorScriptProfilerAgent.h"
+
+#include "InspectorEnvironment.h"
+#include "SamplingProfiler.h"
+#include <wtf/RunLoop.h>
+#include <wtf/Stopwatch.h>
+
+using namespace JSC;
+
+namespace Inspector {
+
+InspectorScriptProfilerAgent::InspectorScriptProfilerAgent(AgentContext& context)
+ : InspectorAgentBase(ASCIILiteral("ScriptProfiler"))
+ , m_frontendDispatcher(std::make_unique<ScriptProfilerFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(ScriptProfilerBackendDispatcher::create(context.backendDispatcher, this))
+ , m_environment(context.environment)
+{
+}
+
+InspectorScriptProfilerAgent::~InspectorScriptProfilerAgent()
+{
+}
+
+void InspectorScriptProfilerAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+void InspectorScriptProfilerAgent::willDestroyFrontendAndBackend(DisconnectReason)
+{
+ ErrorString ignored;
+ stopTracking(ignored);
+}
+
+void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* includeSamples)
+{
+ if (m_tracking)
+ return;
+
+ m_tracking = true;
+
+#if ENABLE(SAMPLING_PROFILER)
+ if (includeSamples && *includeSamples) {
+ VM& vm = m_environment.scriptDebugServer().vm();
+ vm.ensureSamplingProfiler(m_environment.executionStopwatch());
+
+ SamplingProfiler& samplingProfiler = *vm.samplingProfiler();
+ LockHolder locker(samplingProfiler.getLock());
+
+ samplingProfiler.setStopWatch(locker, m_environment.executionStopwatch());
+ samplingProfiler.noticeCurrentThreadAsJSCExecutionThread(locker);
+ samplingProfiler.start(locker);
+ m_enabledSamplingProfiler = true;
+ }
+#else
+ UNUSED_PARAM(includeSamples);
+#endif // ENABLE(SAMPLING_PROFILER)
+
+ m_environment.scriptDebugServer().setProfilingClient(this);
+
+ m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime());
+}
+
+void InspectorScriptProfilerAgent::stopTracking(ErrorString&)
+{
+ if (!m_tracking)
+ return;
+
+ m_tracking = false;
+ m_activeEvaluateScript = false;
+
+ m_environment.scriptDebugServer().setProfilingClient(nullptr);
+
+ trackingComplete();
+}
+
+bool InspectorScriptProfilerAgent::isAlreadyProfiling() const
+{
+ return m_activeEvaluateScript;
+}
+
+double InspectorScriptProfilerAgent::willEvaluateScript()
+{
+ m_activeEvaluateScript = true;
+
+#if ENABLE(SAMPLING_PROFILER)
+ if (m_enabledSamplingProfiler) {
+ SamplingProfiler* samplingProfiler = m_environment.scriptDebugServer().vm().samplingProfiler();
+ RELEASE_ASSERT(samplingProfiler);
+ samplingProfiler->noticeCurrentThreadAsJSCExecutionThread();
+ }
+#endif
+
+ return m_environment.executionStopwatch()->elapsedTime();
+}
+
+void InspectorScriptProfilerAgent::didEvaluateScript(double startTime, ProfilingReason reason)
+{
+ m_activeEvaluateScript = false;
+
+ double endTime = m_environment.executionStopwatch()->elapsedTime();
+
+ addEvent(startTime, endTime, reason);
+}
+
+static Inspector::Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
+{
+ switch (reason) {
+ case ProfilingReason::API:
+ return Inspector::Protocol::ScriptProfiler::EventType::API;
+ case ProfilingReason::Microtask:
+ return Inspector::Protocol::ScriptProfiler::EventType::Microtask;
+ case ProfilingReason::Other:
+ return Inspector::Protocol::ScriptProfiler::EventType::Other;
+ }
+
+ ASSERT_NOT_REACHED();
+ return Inspector::Protocol::ScriptProfiler::EventType::Other;
+}
+
+void InspectorScriptProfilerAgent::addEvent(double startTime, double endTime, ProfilingReason reason)
+{
+ ASSERT(endTime >= startTime);
+
+ auto event = Inspector::Protocol::ScriptProfiler::Event::create()
+ .setStartTime(startTime)
+ .setEndTime(endTime)
+ .setType(toProtocol(reason))
+ .release();
+
+ m_frontendDispatcher->trackingUpdate(WTFMove(event));
+}
+
+#if ENABLE(SAMPLING_PROFILER)
+static Ref<Protocol::ScriptProfiler::Samples> buildSamples(VM& vm, Vector<SamplingProfiler::StackTrace>&& samplingProfilerStackTraces, double totalTime)
+{
+ Ref<Protocol::Array<Protocol::ScriptProfiler::StackTrace>> stackTraces = Protocol::Array<Protocol::ScriptProfiler::StackTrace>::create();
+ for (SamplingProfiler::StackTrace& stackTrace : samplingProfilerStackTraces) {
+ Ref<Protocol::Array<Protocol::ScriptProfiler::StackFrame>> frames = Protocol::Array<Protocol::ScriptProfiler::StackFrame>::create();
+ for (SamplingProfiler::StackFrame& stackFrame : stackTrace.frames) {
+ Ref<Protocol::ScriptProfiler::StackFrame> frame = Protocol::ScriptProfiler::StackFrame::create()
+ .setSourceID(String::number(stackFrame.sourceID()))
+ .setName(stackFrame.displayName(vm))
+ .setLine(stackFrame.functionStartLine())
+ .setColumn(stackFrame.functionStartColumn())
+ .setUrl(stackFrame.url())
+ .release();
+
+ if (stackFrame.hasExpressionInfo()) {
+ Ref<Protocol::ScriptProfiler::ExpressionLocation> expressionLocation = Protocol::ScriptProfiler::ExpressionLocation::create()
+ .setLine(stackFrame.lineNumber)
+ .setColumn(stackFrame.columnNumber)
+ .release();
+ frame->setExpressionLocation(WTFMove(expressionLocation));
+ }
+
+ frames->addItem(WTFMove(frame));
+ }
+ Ref<Protocol::ScriptProfiler::StackTrace> inspectorStackTrace = Protocol::ScriptProfiler::StackTrace::create()
+ .setTimestamp(stackTrace.timestamp)
+ .setStackFrames(WTFMove(frames))
+ .release();
+ stackTraces->addItem(WTFMove(inspectorStackTrace));
+ }
+
+ return Protocol::ScriptProfiler::Samples::create()
+ .setStackTraces(WTFMove(stackTraces))
+ .setTotalTime(totalTime)
+ .release();
+}
+#endif // ENABLE(SAMPLING_PROFILER)
+
+void InspectorScriptProfilerAgent::trackingComplete()
+{
+#if ENABLE(SAMPLING_PROFILER)
+ if (m_enabledSamplingProfiler) {
+ JSLockHolder lock(m_environment.scriptDebugServer().vm());
+ SamplingProfiler* samplingProfiler = m_environment.scriptDebugServer().vm().samplingProfiler();
+ RELEASE_ASSERT(samplingProfiler);
+ LockHolder locker(samplingProfiler->getLock());
+ samplingProfiler->stop(locker);
+ Vector<SamplingProfiler::StackTrace> stackTraces = samplingProfiler->releaseStackTraces(locker);
+ Ref<Protocol::ScriptProfiler::Samples> samples = buildSamples(m_environment.scriptDebugServer().vm(), WTFMove(stackTraces), samplingProfiler->totalTime(locker));
+
+ locker.unlockEarly();
+
+ m_enabledSamplingProfiler = false;
+
+ m_frontendDispatcher->trackingComplete(WTFMove(samples));
+ } else
+ m_frontendDispatcher->trackingComplete(nullptr);
+#else
+ m_frontendDispatcher->trackingComplete(nullptr);
+#endif // ENABLE(SAMPLING_PROFILER)
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h
new file mode 100644
index 000000000..f62e008a6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef InspectorScriptProfilerAgent_h
+#define InspectorScriptProfilerAgent_h
+
+#include "InspectorBackendDispatchers.h"
+#include "InspectorFrontendDispatchers.h"
+#include "inspector/InspectorAgentBase.h"
+#include "inspector/ScriptDebugServer.h"
+#include <wtf/Noncopyable.h>
+
+namespace JSC {
+class Profile;
+}
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+class JS_EXPORT_PRIVATE InspectorScriptProfilerAgent final : public InspectorAgentBase, public ScriptProfilerBackendDispatcherHandler, public JSC::Debugger::ProfilingClient {
+ WTF_MAKE_NONCOPYABLE(InspectorScriptProfilerAgent);
+public:
+ InspectorScriptProfilerAgent(AgentContext&);
+ virtual ~InspectorScriptProfilerAgent();
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override;
+
+ // ScriptProfilerBackendDispatcherHandler
+ virtual void startTracking(ErrorString&, const bool* includeSamples) override;
+ virtual void stopTracking(ErrorString&) override;
+
+ // Debugger::ProfilingClient
+ virtual bool isAlreadyProfiling() const override;
+ virtual double willEvaluateScript() override;
+ virtual void didEvaluateScript(double, JSC::ProfilingReason) override;
+
+private:
+ struct Event {
+ Event(double start, double end) : startTime(start), endTime(end) { }
+ double startTime { 0 };
+ double endTime { 0 };
+ };
+
+ void addEvent(double startTime, double endTime, JSC::ProfilingReason);
+ void trackingComplete();
+
+ std::unique_ptr<ScriptProfilerFrontendDispatcher> m_frontendDispatcher;
+ RefPtr<ScriptProfilerBackendDispatcher> m_backendDispatcher;
+ InspectorEnvironment& m_environment;
+ bool m_tracking { false };
+#if ENABLE(SAMPLING_PROFILER)
+ bool m_enabledSamplingProfiler { false };
+#endif
+ bool m_activeEvaluateScript { false };
+};
+
+} // namespace Inspector
+
+#endif // InspectorScriptProfilerAgent_h
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp
new file mode 100644
index 000000000..0217dc6dc
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectConsoleAgent.h"
+
+namespace Inspector {
+
+JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(AgentContext& context)
+ : InspectorConsoleAgent(context)
+{
+}
+
+void JSGlobalObjectConsoleAgent::setMonitoringXHREnabled(ErrorString& errorString, bool)
+{
+ errorString = ASCIILiteral("Not supported for JavaScript context");
+}
+
+void JSGlobalObjectConsoleAgent::addInspectedNode(ErrorString& errorString, int)
+{
+ errorString = ASCIILiteral("Not supported for JavaScript context");
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h
new file mode 100644
index 000000000..f966e92fd
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectConsoleAgent_h
+#define JSGlobalObjectConsoleAgent_h
+
+#include "InspectorConsoleAgent.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+
+namespace Inspector {
+
+class JSGlobalObjectConsoleAgent final : public InspectorConsoleAgent {
+ WTF_MAKE_NONCOPYABLE(JSGlobalObjectConsoleAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ JSGlobalObjectConsoleAgent(AgentContext&);
+ virtual ~JSGlobalObjectConsoleAgent() { }
+
+ // FIXME: XHRs and Nodes only makes sense debugging a Web context. Can this be moved to a different agent?
+ virtual void setMonitoringXHREnabled(ErrorString&, bool enabled) override;
+ virtual void addInspectedNode(ErrorString&, int nodeId) override;
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSGlobalObjectConsoleAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
new file mode 100644
index 000000000..e508b877d
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectDebuggerAgent.h"
+
+#include "ConsoleMessage.h"
+#include "InjectedScriptManager.h"
+#include "InspectorConsoleAgent.h"
+#include "JSGlobalObject.h"
+#include "ScriptArguments.h"
+#include "ScriptCallStack.h"
+#include "ScriptCallStackFactory.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(JSAgentContext& context, InspectorConsoleAgent* consoleAgent)
+ : InspectorDebuggerAgent(context)
+ , m_consoleAgent(consoleAgent)
+{
+}
+
+InjectedScript JSGlobalObjectDebuggerAgent::injectedScriptForEval(ErrorString& error, const int* executionContextId)
+{
+ if (executionContextId) {
+ error = ASCIILiteral("Execution context id is not supported for JSContext inspection as there is only one execution context.");
+ return InjectedScript();
+ }
+
+ ExecState* exec = static_cast<JSGlobalObjectScriptDebugServer&>(scriptDebugServer()).globalObject().globalExec();
+ return injectedScriptManager().injectedScriptFor(exec);
+}
+
+void JSGlobalObjectDebuggerAgent::breakpointActionLog(JSC::ExecState* exec, const String& message)
+{
+ m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Log, message, createScriptCallStack(exec, ScriptCallStack::maxCallStackSizeToCapture), 0));
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
new file mode 100644
index 000000000..450ecf205
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectDebuggerAgent_h
+#define JSGlobalObjectDebuggerAgent_h
+
+#include "InspectorDebuggerAgent.h"
+#include "JSGlobalObjectScriptDebugServer.h"
+
+namespace Inspector {
+
+class InspectorConsoleAgent;
+
+class JSGlobalObjectDebuggerAgent final : public InspectorDebuggerAgent {
+ WTF_MAKE_NONCOPYABLE(JSGlobalObjectDebuggerAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ JSGlobalObjectDebuggerAgent(JSAgentContext&, InspectorConsoleAgent*);
+ virtual ~JSGlobalObjectDebuggerAgent() { }
+
+ virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
+
+ virtual void breakpointActionLog(JSC::ExecState*, const String&) override;
+
+ // NOTE: JavaScript inspector does not yet need to mute a console because no messages
+ // are sent to the console outside of the API boundary or console object.
+ virtual void muteConsole() override { }
+ virtual void unmuteConsole() override { }
+
+private:
+ InspectorConsoleAgent* m_consoleAgent { nullptr };
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSGlobalObjectDebuggerAgent_h)
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp
new file mode 100644
index 000000000..b748eeb0a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSGlobalObjectRuntimeAgent.h"
+
+#include "InjectedScript.h"
+#include "InjectedScriptManager.h"
+#include "JSGlobalObject.h"
+
+using namespace JSC;
+
+namespace Inspector {
+
+JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent(JSAgentContext& context)
+ : InspectorRuntimeAgent(context)
+ , m_frontendDispatcher(std::make_unique<RuntimeFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(RuntimeBackendDispatcher::create(context.backendDispatcher, this))
+ , m_globalObject(context.inspectedGlobalObject)
+{
+}
+
+void JSGlobalObjectRuntimeAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
+{
+}
+
+InjectedScript JSGlobalObjectRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
+{
+ ASSERT_UNUSED(executionContextId, !executionContextId);
+
+ JSC::ExecState* scriptState = m_globalObject.globalExec();
+ InjectedScript injectedScript = injectedScriptManager().injectedScriptFor(scriptState);
+ if (injectedScript.hasNoValue())
+ errorString = ASCIILiteral("Internal error: main world execution context not found.");
+
+ return injectedScript;
+}
+
+} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h
new file mode 100644
index 000000000..dfa5ab18e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 JSGlobalObjectRuntimeAgent_h
+#define JSGlobalObjectRuntimeAgent_h
+
+#include "InspectorRuntimeAgent.h"
+
+namespace JSC {
+class JSGlobalObject;
+}
+
+namespace Inspector {
+
+class JSGlobalObjectRuntimeAgent final : public InspectorRuntimeAgent {
+public:
+ JSGlobalObjectRuntimeAgent(JSAgentContext&);
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
+
+ virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
+
+ // NOTE: JavaScript inspector does not yet need to mute a console because no messages
+ // are sent to the console outside of the API boundary or console object.
+ virtual void muteConsole() override { }
+ virtual void unmuteConsole() override { }
+
+private:
+ std::unique_ptr<RuntimeFrontendDispatcher> m_frontendDispatcher;
+ RefPtr<RuntimeBackendDispatcher> m_backendDispatcher;
+ JSC::JSGlobalObject& m_globalObject;
+};
+
+} // namespace Inspector
+
+#endif // !defined(JSGlobalObjectRuntimeAgent_h)
diff --git a/Source/JavaScriptCore/inspector/augmentable/AlternateDispatchableAgent.h b/Source/JavaScriptCore/inspector/augmentable/AlternateDispatchableAgent.h
new file mode 100644
index 000000000..ed332ab20
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/augmentable/AlternateDispatchableAgent.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 AlternateDispatchableAgent_h
+#define AlternateDispatchableAgent_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorAlternateBackendDispatchers.h"
+#include "InspectorBackendDispatchers.h"
+#include <JavaScriptCore/InspectorAgentBase.h>
+#include <wtf/Forward.h>
+
+namespace Inspector {
+
+template<typename TBackendDispatcher, typename TAlternateDispatcher>
+class AlternateDispatchableAgent final : public InspectorAgentBase {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ AlternateDispatchableAgent(const String& domainName, AugmentableInspectorController& controller, std::unique_ptr<TAlternateDispatcher> alternateDispatcher)
+ : InspectorAgentBase(domainName)
+ , m_alternateDispatcher(WTFMove(alternateDispatcher))
+ , m_backendDispatcher(TBackendDispatcher::create(controller.backendDispatcher(), nullptr))
+ {
+ m_backendDispatcher->setAlternateDispatcher(m_alternateDispatcher.get());
+ m_alternateDispatcher->setBackendDispatcher(&controller.backendDispatcher());
+ }
+
+ virtual ~AlternateDispatchableAgent()
+ {
+ m_alternateDispatcher->setBackendDispatcher(nullptr);
+ }
+
+ virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override
+ {
+ }
+
+ virtual void willDestroyFrontendAndBackend(DisconnectReason) override
+ {
+ }
+
+private:
+ std::unique_ptr<TAlternateDispatcher> m_alternateDispatcher;
+ RefPtr<TBackendDispatcher> m_backendDispatcher;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // AlternateDispatchableAgent_h
diff --git a/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h b/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h
new file mode 100644
index 000000000..348c7545c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 AugmentableInspectorController_h
+#define AugmentableInspectorController_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include <JavaScriptCore/AugmentableInspectorControllerClient.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+#include <JavaScriptCore/InspectorFrontendRouter.h>
+
+namespace Inspector {
+
+class InspectorAgentBase;
+
+class AugmentableInspectorController {
+public:
+ virtual ~AugmentableInspectorController() { }
+
+ virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const = 0;
+ virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient*) = 0;
+
+ virtual const FrontendRouter& frontendRouter() const = 0;
+ virtual BackendDispatcher& backendDispatcher() = 0;
+ virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) = 0;
+
+ bool connected() const { return frontendRouter().hasFrontends(); }
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(AugmentableInspectorController_h)
diff --git a/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorControllerClient.h b/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorControllerClient.h
new file mode 100644
index 000000000..fef1cf9b5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorControllerClient.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 AugmentableInspectorControllerClient_h
+#define AugmentableInspectorControllerClient_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+namespace Inspector {
+
+class AugmentableInspectorControllerClient {
+public:
+ virtual ~AugmentableInspectorControllerClient() { }
+ virtual void inspectorConnected() = 0;
+ virtual void inspectorDisconnected() = 0;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(AugmentableInspectorControllerClient_h)
diff --git a/Source/JavaScriptCore/inspector/protocol/ApplicationCache.json b/Source/JavaScriptCore/inspector/protocol/ApplicationCache.json
new file mode 100644
index 000000000..86a984a12
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/ApplicationCache.json
@@ -0,0 +1,87 @@
+{
+ "domain": "ApplicationCache",
+ "availability": "web",
+ "types": [
+ {
+ "id": "ApplicationCacheResource",
+ "type": "object",
+ "description": "Detailed application cache resource information.",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Resource url." },
+ { "name": "size", "type": "integer", "description": "Resource size." },
+ { "name": "type", "type": "string", "description": "Resource type." }
+ ]
+ },
+ {
+ "id": "ApplicationCache",
+ "type": "object",
+ "description": "Detailed application cache information.",
+ "properties": [
+ { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
+ { "name": "size", "type": "number", "description": "Application cache size." },
+ { "name": "creationTime", "type": "number", "description": "Application cache creation time." },
+ { "name": "updateTime", "type": "number", "description": "Application cache update time." },
+ { "name": "resources", "type": "array", "items": { "$ref": "ApplicationCacheResource" }, "description": "Application cache resources." }
+ ]
+ },
+ {
+ "id": "FrameWithManifest",
+ "type": "object",
+ "description": "Frame identifier - manifest URL pair.",
+ "properties": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Frame identifier." },
+ { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
+ { "name": "status", "type": "integer", "description": "Application cache status." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "getFramesWithManifests",
+ "returns": [
+ { "name": "frameIds", "type": "array", "items": { "$ref": "FrameWithManifest" }, "description": "Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache." }
+ ],
+ "description": "Returns array of frame identifiers with manifest urls for each frame containing a document associated with some application cache."
+ },
+ {
+ "name": "enable",
+ "description": "Enables application cache domain notifications."
+ },
+ {
+ "name": "getManifestForFrame",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Identifier of the frame containing document whose manifest is retrieved." }
+ ],
+ "returns": [
+ { "name": "manifestURL", "type": "string", "description": "Manifest URL for document in the given frame." }
+ ],
+ "description": "Returns manifest URL for document in the given frame."
+ },
+ {
+ "name": "getApplicationCacheForFrame",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Identifier of the frame containing document whose application cache is retrieved." }
+ ],
+ "returns": [
+ { "name": "applicationCache", "$ref": "ApplicationCache", "description": "Relevant application cache data for the document in given frame." }
+ ],
+ "description": "Returns relevant application cache data for the document in given frame."
+ }
+ ],
+ "events": [
+ {
+ "name": "applicationCacheStatusUpdated",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Identifier of the frame containing document whose application cache updated status." },
+ { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
+ { "name": "status", "type": "integer", "description": "Updated application cache status." }
+ ]
+ },
+ {
+ "name": "networkStateUpdated",
+ "parameters": [
+ { "name": "isNowOnline", "type": "boolean" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/CSS.json b/Source/JavaScriptCore/inspector/protocol/CSS.json
new file mode 100644
index 000000000..7abbe227f
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/CSS.json
@@ -0,0 +1,457 @@
+{
+ "domain": "CSS",
+ "description": "This domain exposes CSS read/write operations. All CSS objects, like stylesheets, rules, and styles, have an associated <code>id</code> used in subsequent operations on the related object. Each object type has a specific <code>id</code> structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the <code>get*ForNode()</code> calls (which accept a DOM node id). Alternatively, a client can discover all the existing stylesheets with the <code>getAllStyleSheets()</code> method and subsequently load the required stylesheet contents using the <code>getStyleSheet[Text]()</code> methods.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "StyleSheetId",
+ "type": "string"
+ },
+ {
+ "id": "CSSStyleId",
+ "type": "object",
+ "properties": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "Enclosing stylesheet identifier." },
+ { "name": "ordinal", "type": "integer", "description": "The style ordinal within the stylesheet." }
+ ],
+ "description": "This object identifies a CSS style in a unique way."
+ },
+ {
+ "id": "StyleSheetOrigin",
+ "type": "string",
+ "enum": ["user", "user-agent", "inspector", "regular"],
+ "description": "Stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding the \"via inspector\" rules), \"regular\" for regular stylesheets."
+ },
+ {
+ "id": "CSSRuleId",
+ "type": "object",
+ "properties": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "Enclosing stylesheet identifier." },
+ { "name": "ordinal", "type": "integer", "description": "The rule ordinal within the stylesheet." }
+ ],
+ "description": "This object identifies a CSS rule in a unique way."
+ },
+ {
+ "id": "PseudoIdMatches",
+ "type": "object",
+ "properties": [
+ { "name": "pseudoId", "type": "integer", "description": "Pseudo style identifier (see <code>enum PseudoId</code> in <code>RenderStyleConstants.h</code>)."},
+ { "name": "matches", "type": "array", "items": { "$ref": "RuleMatch" }, "description": "Matches of CSS rules applicable to the pseudo style."}
+ ],
+ "description": "CSS rule collection for a single pseudo style."
+ },
+ {
+ "id": "InheritedStyleEntry",
+ "type": "object",
+ "properties": [
+ { "name": "inlineStyle", "$ref": "CSSStyle", "optional": true, "description": "The ancestor node's inline style, if any, in the style inheritance chain." },
+ { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "RuleMatch" }, "description": "Matches of CSS rules matching the ancestor node in the style inheritance chain." }
+ ],
+ "description": "CSS rule collection for a single pseudo style."
+ },
+ {
+ "id": "RuleMatch",
+ "type": "object",
+ "properties": [
+ { "name": "rule", "$ref": "CSSRule", "description": "CSS rule in the match." },
+ { "name": "matchingSelectors", "type": "array", "items": { "type": "integer" }, "description": "Matching selector indices in the rule's selectorList selectors (0-based)." }
+ ],
+ "description": "Match data for a CSS rule."
+ },
+ {
+ "id": "CSSSelector",
+ "type": "object",
+ "properties": [
+ { "name": "text", "type": "string", "description": "Canonicalized selector text." },
+ { "name": "specificity", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Specificity (a, b, c) tuple. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element." },
+ { "name": "dynamic", "optional": true, "type": "boolean", "description": "Whether or not the specificity can be dynamic. Included if the selector is sent in response to CSS.getMatchedStylesForNode which provides a context element." }
+ ],
+ "description": "CSS selector."
+ },
+ {
+ "id": "SelectorList",
+ "type": "object",
+ "properties": [
+ { "name": "selectors", "type": "array", "items": { "$ref": "CSSSelector" }, "description": "Selectors in the list." },
+ { "name": "text", "type": "string", "description": "Rule selector text." },
+ { "name": "range", "$ref": "SourceRange", "optional": true, "description": "Rule selector range in the underlying resource (if available)." }
+ ],
+ "description": "Selector list data."
+ },
+ {
+ "id": "CSSStyleAttribute",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "DOM attribute name (e.g. \"width\")."},
+ { "name": "style", "$ref": "CSSStyle", "description": "CSS style generated by the respective DOM attribute."}
+ ],
+ "description": "CSS style information for a DOM style attribute."
+ },
+ {
+ "id": "CSSStyleSheetHeader",
+ "type": "object",
+ "properties": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "The stylesheet identifier."},
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Owner frame identifier."},
+ { "name": "sourceURL", "type": "string", "description": "Stylesheet resource URL."},
+ { "name": "origin", "$ref": "StyleSheetOrigin", "description": "Stylesheet origin."},
+ { "name": "title", "type": "string", "description": "Stylesheet title."},
+ { "name": "disabled", "type": "boolean", "description": "Denotes whether the stylesheet is disabled."},
+ { "name": "isInline", "type": "boolean", "description": "Whether this stylesheet is a <style> tag created by the parser. This is not set for document.written <style> tags." },
+ { "name": "startLine", "type": "number", "description": "Line offset of the stylesheet within the resource (zero based)." },
+ { "name": "startColumn", "type": "number", "description": "Column offset of the stylesheet within the resource (zero based)." }
+ ],
+ "description": "CSS stylesheet metainformation."
+ },
+ {
+ "id": "CSSStyleSheetBody",
+ "type": "object",
+ "properties": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "The stylesheet identifier."},
+ { "name": "rules", "type": "array", "items": { "$ref": "CSSRule" }, "description": "Stylesheet resource URL."},
+ { "name": "text", "type": "string", "optional": true, "description": "Stylesheet resource contents (if available)."}
+ ],
+ "description": "CSS stylesheet contents."
+ },
+ {
+ "id": "CSSRule",
+ "type": "object",
+ "properties": [
+ { "name": "ruleId", "$ref": "CSSRuleId", "optional": true, "description": "The CSS rule identifier (absent for user agent stylesheet and user-specified stylesheet rules)."},
+ { "name": "selectorList", "$ref": "SelectorList", "description": "Rule selector data." },
+ { "name": "sourceURL", "type": "string", "optional": true, "description": "Parent stylesheet resource URL (for regular rules)."},
+ { "name": "sourceLine", "type": "integer", "description": "Line ordinal of the rule selector start character in the resource."},
+ { "name": "origin", "$ref": "StyleSheetOrigin", "description": "Parent stylesheet's origin."},
+ { "name": "style", "$ref": "CSSStyle", "description": "Associated style declaration." },
+ { "name": "media", "type": "array", "items": { "$ref": "CSSMedia" }, "optional": true, "description": "Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards." }
+ ],
+ "description": "CSS rule representation."
+ },
+ {
+ "id": "SourceRange",
+ "type": "object",
+ "properties": [
+ { "name": "startLine", "type": "integer", "description": "Start line of range." },
+ { "name": "startColumn", "type": "integer", "description": "Start column of range (inclusive)." },
+ { "name": "endLine", "type": "integer", "description": "End line of range" },
+ { "name": "endColumn", "type": "integer", "description": "End column of range (exclusive)." }
+ ],
+ "description": "Text range within a resource."
+ },
+ {
+ "id": "ShorthandEntry",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Shorthand name." },
+ { "name": "value", "type": "string", "description": "Shorthand value." }
+ ]
+ },
+ {
+ "id": "CSSPropertyInfo",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Property name." },
+ { "name": "longhands", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Longhand property names." },
+ { "name": "values", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Supported values for this property." }
+ ]
+ },
+ {
+ "id": "CSSComputedStyleProperty",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Computed style property name." },
+ { "name": "value", "type": "string", "description": "Computed style property value." }
+ ]
+ },
+ {
+ "id": "CSSStyle",
+ "type": "object",
+ "properties": [
+ { "name": "styleId", "$ref": "CSSStyleId", "optional": true, "description": "The CSS style identifier (absent for attribute styles)." },
+ { "name": "cssProperties", "type": "array", "items": { "$ref": "CSSProperty" }, "description": "CSS properties in the style." },
+ { "name": "shorthandEntries", "type": "array", "items": { "$ref": "ShorthandEntry" }, "description": "Computed values for all shorthands found in the style." },
+ { "name": "cssText", "type": "string", "optional": true, "description": "Style declaration text (if available)." },
+ { "name": "range", "$ref": "SourceRange", "optional": true, "description": "Style declaration range in the enclosing stylesheet (if available)." },
+ { "name": "width", "type": "string", "optional": true, "description": "The effective \"width\" property value from this style." },
+ { "name": "height", "type": "string", "optional": true, "description": "The effective \"height\" property value from this style." }
+ ],
+ "description": "CSS style representation."
+ },
+ {
+ "id": "CSSPropertyStatus",
+ "type": "string",
+ "enum": ["active", "inactive", "disabled", "style"],
+ "description": "The property status: \"active\" if the property is effective in the style, \"inactive\" if the property is overridden by a same-named property in this style later on, \"disabled\" if the property is disabled by the user, \"style\" (implied if absent) if the property is reported by the browser rather than by the CSS source parser."
+ },
+ {
+ "id": "CSSProperty",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "The property name." },
+ { "name": "value", "type": "string", "description": "The property value." },
+ { "name": "priority", "type": "string", "optional": true, "description": "The property priority (implies \"\" if absent)." },
+ { "name": "implicit", "type": "boolean", "optional": true, "description": "Whether the property is implicit (implies <code>false</code> if absent)." },
+ { "name": "text", "type": "string", "optional": true, "description": "The full property text as specified in the style." },
+ { "name": "parsedOk", "type": "boolean", "optional": true, "description": "Whether the property is understood by the browser (implies <code>true</code> if absent)." },
+ { "name": "status", "$ref": "CSSPropertyStatus", "optional": true, "description": "Whether the property is active or disabled." },
+ { "name": "range", "$ref": "SourceRange", "optional": true, "description": "The entire property range in the enclosing style declaration (if available)." }
+ ],
+ "description": "CSS style effective visual dimensions and source offsets."
+ },
+ {
+ "id": "CSSMedia",
+ "type": "object",
+ "properties": [
+ { "name": "text", "type": "string", "description": "Media query text." },
+ { "name": "source", "type": "string", "enum": ["mediaRule", "importRule", "linkedSheet", "inlineSheet"], "description": "Source of the media query: \"mediaRule\" if specified by a @media rule, \"importRule\" if specified by an @import rule, \"linkedSheet\" if specified by a \"media\" attribute in a linked stylesheet's LINK tag, \"inlineSheet\" if specified by a \"media\" attribute in an inline stylesheet's STYLE tag." },
+ { "name": "sourceURL", "type": "string", "optional": true, "description": "URL of the document containing the media query description." },
+ { "name": "sourceLine", "type": "integer", "optional": true, "description": "Line in the document containing the media query (not defined for the \"stylesheet\" source)." }
+ ],
+ "description": "CSS media query descriptor."
+ },
+ {
+ "id": "Region",
+ "type": "object",
+ "properties": [
+ { "name": "regionOverset", "type": "string", "enum": ["overset", "fit", "empty"], "description": "The \"overset\" attribute of a Named Flow." },
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The corresponding DOM node id." }
+ ],
+ "description": "This object represents a region that flows from a Named Flow."
+ },
+ {
+ "id": "NamedFlow",
+ "type": "object",
+ "properties": [
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+ { "name": "name", "type": "string", "description": "Named Flow identifier." },
+ { "name": "overset", "type": "boolean", "description": "The \"overset\" attribute of a Named Flow." },
+ { "name": "content", "type": "array", "items": { "$ref": "DOM.NodeId" }, "description": "An array of nodes that flow into the Named Flow." },
+ { "name": "regions", "type": "array", "items": { "$ref": "Region" }, "description": "An array of regions associated with the Named Flow." }
+ ],
+ "description": "This object represents a Named Flow."
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received."
+ },
+ {
+ "name": "disable",
+ "description": "Disables the CSS agent for the given page."
+ },
+ {
+ "name": "getMatchedStylesForNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId" },
+ { "name": "includePseudo", "type": "boolean", "optional": true, "description": "Whether to include pseudo styles (default: true)." },
+ { "name": "includeInherited", "type": "boolean", "optional": true, "description": "Whether to include inherited styles (default: true)." }
+ ],
+ "returns": [
+ { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "RuleMatch" }, "optional": true, "description": "CSS rules matching this node, from all applicable stylesheets." },
+ { "name": "pseudoElements", "type": "array", "items": { "$ref": "PseudoIdMatches" }, "optional": true, "description": "Pseudo style matches for this node." },
+ { "name": "inherited", "type": "array", "items": { "$ref": "InheritedStyleEntry" }, "optional": true, "description": "A chain of inherited styles (from the immediate node parent up to the DOM tree root)." }
+ ],
+ "description": "Returns requested styles for a DOM node identified by <code>nodeId</code>."
+ },
+ {
+ "name": "getInlineStylesForNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId" }
+ ],
+ "returns": [
+ { "name": "inlineStyle", "$ref": "CSSStyle", "optional": true, "description": "Inline style for the specified DOM node." },
+ { "name": "attributesStyle", "$ref": "CSSStyle", "optional": true, "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\")."}
+ ],
+ "description": "Returns the styles defined inline (explicitly in the \"style\" attribute and implicitly, using DOM attributes) for a DOM node identified by <code>nodeId</code>."
+ },
+ {
+ "name": "getComputedStyleForNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId" }
+ ],
+ "returns": [
+ { "name": "computedStyle", "type": "array", "items": { "$ref": "CSSComputedStyleProperty" }, "description": "Computed style for the specified DOM node." }
+ ],
+ "description": "Returns the computed style for a DOM node identified by <code>nodeId</code>."
+ },
+ {
+ "name": "getAllStyleSheets",
+ "returns": [
+ { "name": "headers", "type": "array", "items": { "$ref": "CSSStyleSheetHeader" }, "description": "Descriptor entries for all available stylesheets." }
+ ],
+ "description": "Returns metainfo entries for all known stylesheets."
+ },
+ {
+ "name": "getStyleSheet",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId" }
+ ],
+ "returns": [
+ { "name": "styleSheet", "$ref": "CSSStyleSheetBody", "description": "Stylesheet contents for the specified <code>styleSheetId</code>." }
+ ],
+ "description": "Returns stylesheet data for the specified <code>styleSheetId</code>."
+ },
+ {
+ "name": "getStyleSheetText",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId" }
+ ],
+ "returns": [
+ { "name": "text", "type": "string", "description": "The stylesheet text." }
+ ],
+ "description": "Returns the current textual content and the URL for a stylesheet."
+ },
+ {
+ "name": "setStyleSheetText",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId" },
+ { "name": "text", "type": "string" }
+ ],
+ "description": "Sets the new stylesheet text, thereby invalidating all existing <code>CSSStyleId</code>'s and <code>CSSRuleId</code>'s contained by this stylesheet."
+ },
+ {
+ "name": "setStyleText",
+ "parameters": [
+ { "name": "styleId", "$ref": "CSSStyleId" },
+ { "name": "text", "type": "string" }
+ ],
+ "returns": [
+ { "name": "style", "$ref": "CSSStyle", "description": "The resulting style after the text modification." }
+ ],
+ "description": "Sets the new <code>text</code> for the respective style."
+ },
+ {
+ "name": "setRuleSelector",
+ "parameters": [
+ { "name": "ruleId", "$ref": "CSSRuleId" },
+ { "name": "selector", "type": "string" }
+ ],
+ "returns": [
+ { "name": "rule", "$ref": "CSSRule", "description": "The resulting rule after the selector modification." }
+ ],
+ "description": "Modifies the rule selector."
+ },
+ {
+ "name": "createStyleSheet",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Identifier of the frame where the new \"inspector\" stylesheet should be created." }
+ ],
+ "returns": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "Identifier of the created \"inspector\" stylesheet." }
+ ],
+ "description": "Creates a new special \"inspector\" stylesheet in the frame with given <code>frameId</code>."
+ },
+ {
+ "name": "addRule",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId" },
+ { "name": "selector", "type": "string" }
+ ],
+ "returns": [
+ { "name": "rule", "$ref": "CSSRule", "description": "The newly created rule." }
+ ],
+ "description": "Creates a new empty rule with the given <code>selector</code> in a stylesheet with given <code>styleSheetId</code>."
+ },
+ {
+ "name": "getSupportedCSSProperties",
+ "returns": [
+ { "name": "cssProperties", "type": "array", "items": { "$ref": "CSSPropertyInfo" }, "description": "Supported property metainfo." }
+ ],
+ "description": "Returns all supported CSS property names."
+ },
+ {
+ "name": "getSupportedSystemFontFamilyNames",
+ "returns": [
+ { "name": "fontFamilyNames", "type": "array", "items": { "type": "string" }, "description": "Supported system font families." }
+ ],
+ "description": "Returns all supported system font family names."
+ },
+ {
+ "name": "forcePseudoState",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The element id for which to force the pseudo state." },
+ { "name": "forcedPseudoClasses", "type": "array", "items": { "type": "string", "enum": ["active", "focus", "hover", "visited"] }, "description": "Element pseudo classes to force when computing the element's style." }
+ ],
+ "description": "Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser."
+ },
+ {
+ "name": "getNamedFlowCollection",
+ "parameters": [
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id for which to get the Named Flow Collection." }
+ ],
+ "returns": [
+ { "name": "namedFlows", "type": "array", "items": { "$ref": "NamedFlow" }, "description": "An array containing the Named Flows in the document." }
+ ],
+ "description": "Returns the Named Flows from the document."
+ }
+ ],
+ "events": [
+ {
+ "name": "mediaQueryResultChanged",
+ "description": "Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features."
+ },
+ {
+ "name": "styleSheetChanged",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId" }
+ ],
+ "description": "Fired whenever a stylesheet is changed as a result of the client operation."
+ },
+ {
+ "name": "styleSheetAdded",
+ "parameters": [
+ { "name": "header", "$ref": "CSSStyleSheetHeader", "description": "Added stylesheet metainfo." }
+ ],
+ "description": "Fired whenever an active document stylesheet is added."
+ },
+ {
+ "name": "styleSheetRemoved",
+ "parameters": [
+ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "Identifier of the removed stylesheet." }
+ ],
+ "description": "Fired whenever an active document stylesheet is removed."
+ },
+ {
+ "name": "namedFlowCreated",
+ "parameters": [
+ { "name": "namedFlow", "$ref": "NamedFlow", "description": "The new Named Flow." }
+ ],
+ "description": "Fires when a Named Flow is created."
+ },
+ {
+ "name": "namedFlowRemoved",
+ "parameters": [
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+ { "name": "flowName", "type": "string", "description": "Identifier of the removed Named Flow." }
+ ],
+ "description": "Fires when a Named Flow is removed: has no associated content nodes and regions."
+ },
+ {
+ "name": "regionOversetChanged",
+ "parameters": [
+ { "name": "namedFlow", "$ref": "NamedFlow", "description": "The Named Flow containing the regions whose regionOverset values changed." }
+ ],
+ "description": "Fires if any of the regionOverset values changed in a Named Flow's region chain."
+ },
+ {
+ "name": "registeredNamedFlowContentElement",
+ "parameters": [
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+ { "name": "flowName", "type": "string", "description": "Named Flow identifier for which the new content element was registered." },
+ { "name": "contentNodeId", "$ref": "DOM.NodeId", "description": "The node id of the registered content node." },
+ { "name": "nextContentNodeId", "$ref": "DOM.NodeId", "description": "The node id of the element following the registered content node." }
+ ],
+ "description": "Fires when a Named Flow's has been registered with a new content node."
+ },
+ {
+ "name": "unregisteredNamedFlowContentElement",
+ "parameters": [
+ { "name": "documentNodeId", "$ref": "DOM.NodeId", "description": "The document node id." },
+ { "name": "flowName", "type": "string", "description": "Named Flow identifier for which the new content element was unregistered." },
+ { "name": "contentNodeId", "$ref": "DOM.NodeId", "description": "The node id of the unregistered content node." }
+ ],
+ "description": "Fires when a Named Flow's has been registered with a new content node."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Console.json b/Source/JavaScriptCore/inspector/protocol/Console.json
new file mode 100644
index 000000000..a25536232
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Console.json
@@ -0,0 +1,89 @@
+{
+ "domain": "Console",
+ "description": "Console domain defines methods and events for interaction with the JavaScript console. Console collects messages created by means of the <a href='http://getfirebug.com/wiki/index.php/Console_API'>JavaScript Console API</a>. One needs to enable this domain using <code>enable</code> command in order to start receiving the console messages. Browser collects messages issued while console domain is not enabled as well and reports them using <code>messageAdded</code> notification upon enabling.",
+ "types": [
+ {
+ "id": "ConsoleMessage",
+ "type": "object",
+ "description": "Console message.",
+ "properties": [
+ { "name": "source", "type": "string", "enum": ["xml", "javascript", "network", "console-api", "storage", "appcache", "rendering", "css", "security", "content-blocker", "other"], "description": "Message source." },
+ { "name": "level", "type": "string", "enum": ["log", "info", "warning", "error", "debug"], "description": "Message severity." },
+ { "name": "text", "type": "string", "description": "Message text." },
+ { "name": "type", "type": "string", "optional": true, "enum": ["log", "dir", "dirxml", "table", "trace", "clear", "startGroup", "startGroupCollapsed", "endGroup", "assert", "timing", "profile", "profileEnd"], "description": "Console message type." },
+ { "name": "url", "type": "string", "optional": true, "description": "URL 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 on the line in the resource that generated this message." },
+ { "name": "repeatCount", "type": "integer", "optional": true, "description": "Repeat count for repeated messages." },
+ { "name": "parameters", "type": "array", "items": { "$ref": "Runtime.RemoteObject" }, "optional": true, "description": "Message parameters in case of the formatted message." },
+ { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace for assertions and error messages." },
+ { "name": "networkRequestId", "$ref": "Network.RequestId", "optional": true, "description": "Identifier of the network request associated with this message." }
+ ]
+ },
+ {
+ "id": "CallFrame",
+ "type": "object",
+ "description": "Stack entry for console errors and assertions.",
+ "properties": [
+ { "name": "functionName", "type": "string", "description": "JavaScript function name." },
+ { "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": "array",
+ "items": { "$ref": "CallFrame" },
+ "description": "Call frames for assertions or error messages."
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables console domain, sends the messages collected so far to the client by means of the <code>messageAdded</code> notification."
+ },
+ {
+ "name": "disable",
+ "description": "Disables console domain, prevents further console messages from being reported to the client."
+ },
+ {
+ "name": "clearMessages",
+ "description": "Clears console messages collected in the browser."
+ },
+ {
+ "name": "setMonitoringXHREnabled",
+ "parameters": [
+ { "name": "enabled", "type": "boolean", "description": "Monitoring enabled state." }
+ ],
+ "description": "Toggles monitoring of XMLHttpRequest. If <code>true</code>, console will receive messages upon each XHR issued."
+ },
+ {
+ "name": "addInspectedNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "DOM node id to be accessible by means of $0 command line API." }
+ ],
+ "description": "Enables console to refer to the node with given id via $0 (see Command Line API for more details)."
+ }
+ ],
+ "events": [
+ {
+ "name": "messageAdded",
+ "parameters": [
+ { "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." }
+ ],
+ "description": "Issued when new console message is added."
+ },
+ {
+ "name": "messageRepeatCountUpdated",
+ "parameters": [
+ { "name": "count", "type": "integer", "description": "New repeat count value." }
+ ],
+ "description": "Issued when subsequent message(s) are equal to the previous one(s)."
+ },
+ {
+ "name": "messagesCleared",
+ "description": "Issued when console is cleared. This happens either upon <code>clearMessages</code> command or after page navigation."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/DOM.json b/Source/JavaScriptCore/inspector/protocol/DOM.json
new file mode 100644
index 000000000..f1880db81
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/DOM.json
@@ -0,0 +1,556 @@
+{
+ "domain": "DOM",
+ "description": "This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an <code>id</code>. This <code>id</code> can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.<p>Note that <code>iframe</code> owner elements will return corresponding document elements as their child nodes.</p>",
+ "availability": "web",
+ "types": [
+ {
+ "id": "NodeId",
+ "type": "integer",
+ "description": "Unique DOM node identifier."
+ },
+ {
+ "id": "BackendNodeId",
+ "type": "integer",
+ "description": "Unique DOM node identifier used to reference a node that may not have been pushed to the front-end."
+ },
+ {
+ "id": "PseudoType",
+ "type": "string",
+ "enum": ["before", "after"],
+ "description": "Pseudo element type."
+ },
+ {
+ "id": "LiveRegionRelevant",
+ "type": "string",
+ "enum": ["additions", "removals", "text"],
+ "description": "Token values of @aria-relevant attribute."
+ },
+ {
+ "id": "Node",
+ "type": "object",
+ "properties": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Node identifier that is passed into the rest of the DOM messages as the <code>nodeId</code>. Backend will only push node with given <code>id</code> once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client." },
+ { "name": "nodeType", "type": "integer", "description": "<code>Node</code>'s nodeType." },
+ { "name": "nodeName", "type": "string", "description": "<code>Node</code>'s nodeName." },
+ { "name": "localName", "type": "string", "description": "<code>Node</code>'s localName." },
+ { "name": "nodeValue", "type": "string", "description": "<code>Node</code>'s nodeValue." },
+ { "name": "childNodeCount", "type": "integer", "optional": true, "description": "Child count for <code>Container</code> nodes." },
+ { "name": "children", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Child nodes of this node when requested with children." },
+ { "name": "attributes", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]</code>." },
+ { "name": "documentURL", "type": "string", "optional": true, "description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to." },
+ { "name": "baseURL", "type": "string", "optional": true, "description": "Base URL that <code>Document</code> or <code>FrameOwner</code> node uses for URL completion." },
+ { "name": "publicId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId." },
+ { "name": "systemId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId." },
+ { "name": "internalSubset", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset." },
+ { "name": "xmlVersion", "type": "string", "optional": true, "description": "<code>Document</code>'s XML version in case of XML documents." },
+ { "name": "name", "type": "string", "optional": true, "description": "<code>Attr</code>'s name." },
+ { "name": "value", "type": "string", "optional": true, "description": "<code>Attr</code>'s value." },
+ { "name": "pseudoType", "$ref": "PseudoType", "optional": true, "description": "Pseudo element type for this node." },
+ { "name": "frameId", "$ref": "Network.FrameId", "optional": true, "description": "Frame ID for frame owner elements." },
+ { "name": "contentDocument", "$ref": "Node", "optional": true, "description": "Content document for frame owner elements." },
+ { "name": "shadowRoots", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Shadow root list for given element host." },
+ { "name": "templateContent", "$ref": "Node", "optional": true, "description": "Content document fragment for template elements" },
+ { "name": "pseudoElements", "type": "array", "items": { "$ref": "Node" }, "optional": true, "description": "Pseudo elements associated with this node." },
+ { "name": "role", "type": "string", "optional": true, "description": "Computed value for first recognized role token, default role per element, or overridden role." }
+ ],
+ "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type."
+ },
+ {
+ "id": "EventListener",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "description": "<code>EventListener</code>'s type." },
+ { "name": "useCapture", "type": "boolean", "description": "<code>EventListener</code>'s useCapture." },
+ { "name": "isAttribute", "type": "boolean", "description": "<code>EventListener</code>'s isAttribute." },
+ { "name": "nodeId", "$ref": "NodeId", "description": "Target <code>DOMNode</code> id." },
+ { "name": "handlerBody", "type": "string", "description": "Event handler function body." },
+ { "name": "location", "$ref": "Debugger.Location", "optional": true, "description": "Handler code location." },
+ { "name": "sourceName", "type": "string", "optional": true, "description": "Source script URL." },
+ { "name": "handler", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event handler function value." }
+ ],
+ "description": "A structure holding event listener properties."
+ },
+ {
+ "id": "AccessibilityProperties",
+ "description": "A structure holding accessibility properties.",
+ "type": "object",
+ "properties": [
+ { "name": "activeDescendantNodeId", "$ref": "NodeId", "optional": true, "description": "<code>DOMNode</code> id of the accessibility object referenced by aria-activedescendant." },
+ { "name": "busy", "type": "boolean", "optional": true, "description": "Value of @aria-busy on current or ancestor node." },
+ { "name": "checked", "type": "string", "optional": true, "enum": ["true", "false", "mixed"], "description": "Checked state of certain form controls." },
+ { "name": "childNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of the accessibility tree children if available." },
+ { "name": "controlledNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any nodes referenced via @aria-controls." },
+ { "name": "current", "type": "string", "optional": true, "enum": ["true", "false", "page", "step", "location", "date", "time"], "description": "Current item within a container or set of related elements." },
+ { "name": "disabled", "type": "boolean", "optional": true, "description": "Disabled state of form controls." },
+ { "name": "exists", "type": "boolean", "description": "Indicates whether there is an existing AX object for the DOM node. If this is false, all the other properties will be default values." },
+ { "name": "expanded", "type": "boolean", "optional": true, "description": "Expanded state." },
+ { "name": "flowedNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any nodes referenced via @aria-flowto." },
+ { "name": "focused", "type": "boolean", "optional": true, "description": "Focused state. Only defined on focusable elements." },
+ { "name": "ignored", "type": "boolean", "optional": true, "description": "Indicates whether the accessibility of the associated AX object node is ignored, whether heuristically or explicitly." },
+ { "name": "ignoredByDefault", "type": "boolean", "optional": true, "description": "State indicating whether the accessibility of the associated AX object node is ignored by default for node type." },
+ { "name": "invalid", "type": "string", "optional": true, "enum": ["true", "false", "grammar", "spelling"], "description": "Invalid status of form controls." },
+ { "name": "hidden", "type": "boolean", "optional": true, "description": "Hidden state. True if node or an ancestor is hidden via CSS or explicit @aria-hidden, to clarify why the element is ignored." },
+ { "name": "label", "type": "string", "description": "Computed label value for the node, sometimes calculated by referencing other nodes." },
+ { "name": "liveRegionAtomic", "type": "boolean", "optional": true, "description": "Value of @aria-atomic." },
+ { "name": "liveRegionRelevant", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Token value(s) of element's @aria-relevant attribute. Array of string values matching $ref LiveRegionRelevant. FIXME: Enum values blocked by http://webkit.org/b/133711" },
+ { "name": "liveRegionStatus", "type": "string", "optional": true, "enum": ["assertive", "polite", "off"], "description": "Value of element's @aria-live attribute." },
+ { "name": "mouseEventNodeId", "$ref": "NodeId", "optional": true, "description": "<code>DOMNode</code> id of node or closest ancestor node that has a mousedown, mouseup, or click event handler." },
+ { "name": "nodeId", "$ref": "NodeId", "description": "Target <code>DOMNode</code> id." },
+ { "name": "ownedNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any nodes referenced via @aria-owns." },
+ { "name": "parentNodeId", "$ref": "NodeId", "optional": true, "description": "<code>DOMNode</code> id of the accessibility tree parent object if available." },
+ { "name": "pressed", "type": "boolean", "optional": true, "description": "Pressed state for toggle buttons." },
+ { "name": "readonly", "type": "boolean", "optional": true, "description": "Readonly state of text controls." },
+ { "name": "required", "type": "boolean", "optional": true, "description": "Required state of form controls." },
+ { "name": "role", "type": "string", "description": "Computed value for first recognized role token, default role per element, or overridden role." },
+ { "name": "selected", "type": "boolean", "optional": true, "description": "Selected state of certain form controls." },
+ { "name": "selectedChildNodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Array of <code>DOMNode</code> ids of any children marked as selected." }
+ ]
+ },
+ {
+ "id": "RGBAColor",
+ "type": "object",
+ "properties": [
+ { "name": "r", "type": "integer", "description": "The red component, in the [0-255] range." },
+ { "name": "g", "type": "integer", "description": "The green component, in the [0-255] range." },
+ { "name": "b", "type": "integer", "description": "The blue component, in the [0-255] range." },
+ { "name": "a", "type": "number", "optional": true, "description": "The alpha component, in the [0-1] range (default: 1)." }
+ ],
+ "description": "A structure holding an RGBA color."
+ },
+ {
+ "id": "Quad",
+ "type": "array",
+ "items": { "type": "number" },
+ "minItems": 8,
+ "maxItems": 8,
+ "description": "An array of quad vertices, x immediately followed by y for each point, points clock-wise."
+ },
+ {
+ "id": "HighlightConfig",
+ "type": "object",
+ "properties": [
+ { "name": "showInfo", "type": "boolean", "optional": true, "description": "Whether the node info tooltip should be shown (default: false)." },
+ { "name": "contentColor", "$ref": "RGBAColor", "optional": true, "description": "The content box highlight fill color (default: transparent)." },
+ { "name": "paddingColor", "$ref": "RGBAColor", "optional": true, "description": "The padding highlight fill color (default: transparent)." },
+ { "name": "borderColor", "$ref": "RGBAColor", "optional": true, "description": "The border highlight fill color (default: transparent)." },
+ { "name": "marginColor", "$ref": "RGBAColor", "optional": true, "description": "The margin highlight fill color (default: transparent)." }
+ ],
+ "description": "Configuration data for the highlighting of page elements."
+ }
+ ],
+ "commands": [
+ {
+ "name": "getDocument",
+ "returns": [
+ { "name": "root", "$ref": "Node", "description": "Resulting node." }
+ ],
+ "description": "Returns the root DOM node to the caller."
+ },
+ {
+ "name": "requestChildNodes",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get children for." },
+ { "name": "depth", "type": "integer", "optional": true, "description": "The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0." }
+ ],
+ "description": "Requests that children of the node with given id are returned to the caller in form of <code>setChildNodes</code> events where not only immediate children are retrieved, but all children down to the specified depth."
+ },
+ {
+ "name": "querySelector",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to query upon." },
+ { "name": "selector", "type": "string", "description": "Selector string." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Query selector result." }
+ ],
+ "description": "Executes <code>querySelector</code> on a given node."
+ },
+ {
+ "name": "querySelectorAll",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to query upon." },
+ { "name": "selector", "type": "string", "description": "Selector string." }
+ ],
+ "returns": [
+ { "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "description": "Query selector result." }
+ ],
+ "description": "Executes <code>querySelectorAll</code> on a given node."
+ },
+ {
+ "name": "setNodeName",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to set name for." },
+ { "name": "name", "type": "string", "description": "New node's name." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "New node's id." }
+ ],
+ "description": "Sets node name for a node with given id."
+ },
+ {
+ "name": "setNodeValue",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to set value for." },
+ { "name": "value", "type": "string", "description": "New node's value." }
+ ],
+ "description": "Sets node value for a node with given id."
+ },
+ {
+ "name": "removeNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to remove." }
+ ],
+ "description": "Removes node with given id."
+ },
+ {
+ "name": "setAttributeValue",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the element to set attribute for." },
+ { "name": "name", "type": "string", "description": "Attribute name." },
+ { "name": "value", "type": "string", "description": "Attribute value." }
+ ],
+ "description": "Sets attribute for an element with given id."
+ },
+ {
+ "name": "setAttributesAsText",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the element to set attributes for." },
+ { "name": "text", "type": "string", "description": "Text with a number of attributes. Will parse this text using HTML parser." },
+ { "name": "name", "type": "string", "optional": true, "description": "Attribute name to replace with new attributes derived from text in case text parsed successfully." }
+ ],
+ "description": "Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs."
+ },
+ {
+ "name": "removeAttribute",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the element to remove attribute from." },
+ { "name": "name", "type": "string", "description": "Name of the attribute to remove." }
+ ],
+ "description": "Removes attribute with given name from an element with given id."
+ },
+ {
+ "name": "getEventListenersForNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get listeners for." },
+ { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name for handler value. Handler value is not returned without this parameter specified." }
+ ],
+ "returns": [
+ { "name": "listeners", "type": "array", "items": { "$ref": "EventListener"}, "description": "Array of relevant listeners." }
+ ],
+ "description": "Returns event listeners relevant to the node."
+ },
+ {
+ "name": "getAccessibilityPropertiesForNode",
+ "description": "Returns a dictionary of accessibility properties for the node.",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node for which to get accessibility properties." }
+ ],
+ "returns": [
+ { "name": "properties", "$ref": "AccessibilityProperties", "description": "Dictionary of relevant accessibility properties." }
+ ]
+ },
+ {
+ "name": "getOuterHTML",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get markup for." }
+ ],
+ "returns": [
+ { "name": "outerHTML", "type": "string", "description": "Outer HTML markup." }
+ ],
+ "description": "Returns node's HTML markup."
+ },
+ {
+ "name": "setOuterHTML",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to set markup for." },
+ { "name": "outerHTML", "type": "string", "description": "Outer HTML markup to set." }
+ ],
+ "description": "Sets node HTML markup, returns new node id."
+ },
+ {
+ "name": "performSearch",
+ "parameters": [
+ { "name": "query", "type": "string", "description": "Plain text or query selector or XPath search query." },
+ { "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "optional": true, "description": "Ids of nodes to use as starting points for the search." }
+ ],
+ "returns": [
+ { "name": "searchId", "type": "string", "description": "Unique search session identifier." },
+ { "name": "resultCount", "type": "integer", "description": "Number of search results." }
+ ],
+ "description": "Searches for a given string in the DOM tree. Use <code>getSearchResults</code> to access search results or <code>cancelSearch</code> to end this search session."
+ },
+ {
+ "name": "getSearchResults",
+ "parameters": [
+ { "name": "searchId", "type": "string", "description": "Unique search session identifier." },
+ { "name": "fromIndex", "type": "integer", "description": "Start index of the search result to be returned." },
+ { "name": "toIndex", "type": "integer", "description": "End index of the search result to be returned." }
+ ],
+ "returns": [
+ { "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "description": "Ids of the search result nodes." }
+ ],
+ "description": "Returns search results from given <code>fromIndex</code> to given <code>toIndex</code> from the sarch with the given identifier."
+ },
+ {
+ "name": "discardSearchResults",
+ "parameters": [
+ { "name": "searchId", "type": "string", "description": "Unique search session identifier." }
+ ],
+ "description": "Discards search results from the session with the given id. <code>getSearchResults</code> should no longer be called for that search."
+ },
+ {
+ "name": "requestNode",
+ "parameters": [
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "JavaScript object id to convert into node." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Node id for given object." }
+ ],
+ "description": "Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of <code>setChildNodes</code> notifications."
+ },
+ {
+ "name": "setInspectModeEnabled",
+ "parameters": [
+ { "name": "enabled", "type": "boolean", "description": "True to enable inspection mode, false to disable it." },
+ { "name": "highlightConfig", "$ref": "HighlightConfig", "optional": true, "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>." }
+ ],
+ "description": "Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspect' command upon element selection."
+ },
+ {
+ "name": "highlightRect",
+ "parameters": [
+ { "name": "x", "type": "integer", "description": "X coordinate" },
+ { "name": "y", "type": "integer", "description": "Y coordinate" },
+ { "name": "width", "type": "integer", "description": "Rectangle width" },
+ { "name": "height", "type": "integer", "description": "Rectangle height" },
+ { "name": "color", "$ref": "RGBAColor", "optional": true, "description": "The highlight fill color (default: transparent)." },
+ { "name": "outlineColor", "$ref": "RGBAColor", "optional": true, "description": "The highlight outline color (default: transparent)." },
+ { "name": "usePageCoordinates", "type": "boolean", "optional": true, "description": "Indicates whether the provided parameters are in page coordinates or in viewport coordinates (the default)." }
+ ],
+ "description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport."
+ },
+ {
+ "name": "highlightQuad",
+ "parameters": [
+ { "name": "quad", "$ref": "Quad", "description": "Quad to highlight" },
+ { "name": "color", "$ref": "RGBAColor", "optional": true, "description": "The highlight fill color (default: transparent)." },
+ { "name": "outlineColor", "$ref": "RGBAColor", "optional": true, "description": "The highlight outline color (default: transparent)." },
+ { "name": "usePageCoordinates", "type": "boolean", "optional": true, "description": "Indicates whether the provided parameters are in page coordinates or in viewport coordinates (the default)." }
+ ],
+ "description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport."
+ },
+ {
+ "name": "highlightSelector",
+ "parameters": [
+ { "name": "highlightConfig", "$ref": "HighlightConfig", "description": "A descriptor for the highlight appearance." },
+ { "name": "selectorString", "type": "string", "description": "A CSS selector for finding matching nodes to highlight." },
+ { "name": "frameId", "type": "string", "optional": true, "description": "Identifier of the frame which will be searched using the selector. If not provided, the main frame will be used." }
+ ],
+ "description": "Highlights all DOM nodes that match a given selector. A string containing a CSS selector must be specified."
+ },
+ {
+ "name": "highlightNode",
+ "parameters": [
+ { "name": "highlightConfig", "$ref": "HighlightConfig", "description": "A descriptor for the highlight appearance." },
+ { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "Identifier of the node to highlight." },
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "optional": true, "description": "JavaScript object id of the node to be highlighted." }
+ ],
+ "description": "Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified."
+ },
+ {
+ "name": "hideHighlight",
+ "description": "Hides DOM node highlight."
+ },
+ {
+ "name": "highlightFrame",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Identifier of the frame to highlight." },
+ { "name": "contentColor", "$ref": "RGBAColor", "optional": true, "description": "The content box highlight fill color (default: transparent)." },
+ { "name": "contentOutlineColor", "$ref": "RGBAColor", "optional": true, "description": "The content box highlight outline color (default: transparent)." }
+ ],
+ "description": "Highlights owner element of the frame with given id."
+ },
+ {
+ "name": "pushNodeByPathToFrontend",
+ "parameters": [
+ { "name": "path", "type": "string", "description": "Path to node in the proprietary format." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node for given path." }
+ ],
+ "description": "Requests that the node is sent to the caller given its path. // FIXME, use XPath"
+ },
+ {
+ "name": "pushNodeByBackendIdToFrontend",
+ "parameters": [
+ { "name": "backendNodeId", "$ref": "BackendNodeId", "description": "The backend node id of the node." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "The pushed node's id." }
+ ],
+ "description": "Requests that the node is sent to the caller given its backend node id."
+ },
+ {
+ "name": "releaseBackendNodeIds",
+ "parameters": [
+ { "name": "nodeGroup", "type": "string", "description": "The backend node ids group name." }
+ ],
+ "description": "Requests that group of <code>BackendNodeIds</code> is released."
+ },
+ {
+ "name": "resolveNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to resolve." },
+ { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }
+ ],
+ "returns": [
+ { "name": "object", "$ref": "Runtime.RemoteObject", "description": "JavaScript object wrapper for given node." }
+ ],
+ "description": "Resolves JavaScript node object for given node id."
+ },
+ {
+ "name": "getAttributes",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to retrieve attibutes for." }
+ ],
+ "returns": [
+ { "name": "attributes", "type": "array", "items": { "type": "string" }, "description": "An interleaved array of node attribute names and values." }
+ ],
+ "description": "Returns attributes for the specified node."
+ },
+ {
+ "name": "moveTo",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to drop." },
+ { "name": "targetNodeId", "$ref": "NodeId", "description": "Id of the element to drop into." },
+ { "name": "insertBeforeNodeId", "$ref": "NodeId", "optional": true, "description": "Drop node before given one." }
+ ],
+ "returns": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "New id of the moved node." }
+ ],
+ "description": "Moves node into the new container, places it before the given anchor."
+ },
+ {
+ "name": "undo",
+ "description": "Undoes the last performed action."
+ },
+ {
+ "name": "redo",
+ "description": "Re-does the last undone action."
+ },
+ {
+ "name": "markUndoableState",
+ "description": "Marks last undoable state."
+ },
+ {
+ "name": "focus",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to focus." }
+ ],
+ "description": "Focuses the given element."
+ }
+ ],
+ "events": [
+ {
+ "name": "documentUpdated",
+ "description": "Fired when <code>Document</code> has been totally updated. Node ids are no longer valid."
+ },
+ {
+ "name": "setChildNodes",
+ "parameters": [
+ { "name": "parentId", "$ref": "NodeId", "description": "Parent node id to populate with children." },
+ { "name": "nodes", "type": "array", "items": { "$ref": "Node"}, "description": "Child nodes array." }
+ ],
+ "description": "Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids."
+ },
+ {
+ "name": "attributeModified",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "Attribute name." },
+ { "name": "value", "type": "string", "description": "Attribute value." }
+ ],
+ "description": "Fired when <code>Element</code>'s attribute is modified."
+ },
+ {
+ "name": "attributeRemoved",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "name", "type": "string", "description": "A ttribute name." }
+ ],
+ "description": "Fired when <code>Element</code>'s attribute is removed."
+ },
+ {
+ "name": "inlineStyleInvalidated",
+ "parameters": [
+ { "name": "nodeIds", "type": "array", "items": { "$ref": "NodeId" }, "description": "Ids of the nodes for which the inline styles have been invalidated." }
+ ],
+ "description": "Fired when <code>Element</code>'s inline style is modified via a CSS property modification."
+ },
+ {
+ "name": "characterDataModified",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "characterData", "type": "string", "description": "New text value." }
+ ],
+ "description": "Mirrors <code>DOMCharacterDataModified</code> event."
+ },
+ {
+ "name": "childNodeCountUpdated",
+ "parameters": [
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "childNodeCount", "type": "integer", "description": "New node count." }
+ ],
+ "description": "Fired when <code>Container</code>'s child node count has changed."
+ },
+ {
+ "name": "childNodeInserted",
+ "parameters": [
+ { "name": "parentNodeId", "$ref": "NodeId", "description": "Id of the node that has changed." },
+ { "name": "previousNodeId", "$ref": "NodeId", "description": "If of the previous siblint." },
+ { "name": "node", "$ref": "Node", "description": "Inserted node data." }
+ ],
+ "description": "Mirrors <code>DOMNodeInserted</code> event."
+ },
+ {
+ "name": "childNodeRemoved",
+ "parameters": [
+ { "name": "parentNodeId", "$ref": "NodeId", "description": "Parent id." },
+ { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node that has been removed." }
+ ],
+ "description": "Mirrors <code>DOMNodeRemoved</code> event."
+ },
+ {
+ "name": "shadowRootPushed",
+ "parameters": [
+ { "name": "hostId", "$ref": "NodeId", "description": "Host element id." },
+ { "name": "root", "$ref": "Node", "description": "Shadow root." }
+ ],
+ "description": "Called when shadow root is pushed into the element."
+ },
+ {
+ "name": "shadowRootPopped",
+ "parameters": [
+ { "name": "hostId", "$ref": "NodeId", "description": "Host element id." },
+ { "name": "rootId", "$ref": "NodeId", "description": "Shadow root id." }
+ ],
+ "description": "Called when shadow root is popped from the element."
+ },
+ {
+ "name": "pseudoElementAdded",
+ "parameters": [
+ { "name": "parentId", "$ref": "NodeId", "description": "Pseudo element's parent element id." },
+ { "name": "pseudoElement", "$ref": "Node", "description": "The added pseudo element." }
+ ],
+ "description": "Called when a pseudo element is added to an element."
+ },
+ {
+ "name": "pseudoElementRemoved",
+ "parameters": [
+ { "name": "parentId", "$ref": "NodeId", "description": "Pseudo element's parent element id." },
+ { "name": "pseudoElementId", "$ref": "NodeId", "description": "The removed pseudo element id." }
+ ],
+ "description": "Called when a pseudo element is removed from an element."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json b/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json
new file mode 100644
index 000000000..bfab308b0
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json
@@ -0,0 +1,73 @@
+{
+ "domain": "DOMDebugger",
+ "description": "DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "DOMBreakpointType",
+ "type": "string",
+ "enum": ["subtree-modified", "attribute-modified", "node-removed"],
+ "description": "DOM breakpoint type."
+ }
+ ],
+ "commands": [
+ {
+ "name": "setDOMBreakpoint",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Identifier of the node to set breakpoint on." },
+ { "name": "type", "$ref": "DOMBreakpointType", "description": "Type of the operation to stop upon." }
+ ],
+ "description": "Sets breakpoint on particular operation with DOM."
+ },
+ {
+ "name": "removeDOMBreakpoint",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Identifier of the node to remove breakpoint from." },
+ { "name": "type", "$ref": "DOMBreakpointType", "description": "Type of the breakpoint to remove." }
+ ],
+ "description": "Removes DOM breakpoint that was set using <code>setDOMBreakpoint</code>."
+ },
+ {
+ "name": "setEventListenerBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "DOM Event name to stop on (any DOM event will do)." }
+ ],
+ "description": "Sets breakpoint on particular DOM event."
+ },
+ {
+ "name": "removeEventListenerBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Event name." }
+ ],
+ "description": "Removes breakpoint on particular DOM event."
+ },
+ {
+ "name": "setInstrumentationBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
+ ],
+ "description": "Sets breakpoint on particular native event."
+ },
+ {
+ "name": "removeInstrumentationBreakpoint",
+ "parameters": [
+ { "name": "eventName", "type": "string", "description": "Instrumentation name to stop on." }
+ ],
+ "description": "Sets breakpoint on particular native event."
+ },
+ {
+ "name": "setXHRBreakpoint",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "Resource URL substring. All XHRs having this substring in the URL will get stopped upon." }
+ ],
+ "description": "Sets breakpoint on XMLHttpRequest."
+ },
+ {
+ "name": "removeXHRBreakpoint",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "Resource URL substring." }
+ ],
+ "description": "Removes breakpoint from XMLHttpRequest."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/DOMStorage.json b/Source/JavaScriptCore/inspector/protocol/DOMStorage.json
new file mode 100644
index 000000000..812e70d3f
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/DOMStorage.json
@@ -0,0 +1,88 @@
+{
+ "domain": "DOMStorage",
+ "description": "Query and modify DOM storage.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "StorageId",
+ "type": "object",
+ "description": "DOM Storage identifier.",
+ "properties": [
+ { "name": "securityOrigin", "type": "string", "description": "Security origin for the storage." },
+ { "name": "isLocalStorage", "type": "boolean", "description": "Whether the storage is local storage (not session storage)." }
+ ]
+ },
+ {
+ "id": "Item",
+ "type": "array",
+ "description": "DOM Storage item.",
+ "items": { "type": "string" }
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables storage tracking, storage events will now be delivered to the client."
+ },
+ {
+ "name": "disable",
+ "description": "Disables storage tracking, prevents storage events from being sent to the client."
+ },
+ {
+ "name": "getDOMStorageItems",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" }
+ ],
+ "returns": [
+ { "name": "entries", "type": "array", "items": { "$ref": "Item" } }
+ ]
+ },
+ {
+ "name": "setDOMStorageItem",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" },
+ { "name": "key", "type": "string" },
+ { "name": "value", "type": "string" }
+ ]
+ },
+ {
+ "name": "removeDOMStorageItem",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" },
+ { "name": "key", "type": "string" }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "domStorageItemsCleared",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" }
+ ]
+ },
+ {
+ "name": "domStorageItemRemoved",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" },
+ { "name": "key", "type": "string" }
+ ]
+ },
+ {
+ "name": "domStorageItemAdded",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" },
+ { "name": "key", "type": "string" },
+ { "name": "newValue", "type": "string" }
+ ]
+ },
+ {
+ "name": "domStorageItemUpdated",
+ "parameters": [
+ { "name": "storageId", "$ref": "StorageId" },
+ { "name": "key", "type": "string" },
+ { "name": "oldValue", "type": "string" },
+ { "name": "newValue", "type": "string" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Database.json b/Source/JavaScriptCore/inspector/protocol/Database.json
new file mode 100644
index 000000000..b959e0f2d
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Database.json
@@ -0,0 +1,71 @@
+{
+ "domain": "Database",
+ "availability": "web",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "string",
+ "description": "Unique identifier of Database object."
+ },
+ {
+ "id": "Database",
+ "type": "object",
+ "description": "Database object.",
+ "properties": [
+ { "name": "id", "$ref": "DatabaseId", "description": "Database ID." },
+ { "name": "domain", "type": "string", "description": "Database domain." },
+ { "name": "name", "type": "string", "description": "Database name." },
+ { "name": "version", "type": "string", "description": "Database version." }
+ ]
+ },
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables database tracking, database events will now be delivered to the client."
+ },
+ {
+ "name": "disable",
+ "description": "Disables database tracking, prevents database events from being sent to the client."
+ },
+ {
+ "name": "getDatabaseTableNames",
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" }
+ ],
+ "returns": [
+ { "name": "tableNames", "type": "array", "items": { "type": "string" } }
+ ]
+ },
+ {
+ "name": "executeSQL",
+ "async": true,
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "values", "type": "array", "optional": true, "items": { "type": "any" }},
+ { "name": "sqlError", "$ref": "Error", "optional": true }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "addDatabase",
+ "parameters": [
+ { "name": "database", "$ref": "Database" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Debugger.json b/Source/JavaScriptCore/inspector/protocol/Debugger.json
new file mode 100644
index 000000000..d0f9dc026
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Debugger.json
@@ -0,0 +1,337 @@
+{
+ "domain": "Debugger",
+ "description": "Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.",
+ "types": [
+ {
+ "id": "BreakpointId",
+ "type": "string",
+ "description": "Breakpoint identifier."
+ },
+ {
+ "id": "BreakpointActionIdentifier",
+ "type": "integer",
+ "description": "Breakpoint action identifier."
+ },
+ {
+ "id": "ScriptId",
+ "type": "string",
+ "description": "Unique script identifier."
+ },
+ {
+ "id": "CallFrameId",
+ "type": "string",
+ "description": "Call frame identifier."
+ },
+ {
+ "id": "Location",
+ "type": "object",
+ "properties": [
+ { "name": "scriptId", "$ref": "ScriptId", "description": "Script identifier as reported in the <code>Debugger.scriptParsed</code>." },
+ { "name": "lineNumber", "type": "integer", "description": "Line number in the script." },
+ { "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number in the script." }
+ ],
+ "description": "Location in the source code."
+ },
+ {
+ "id": "BreakpointAction",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["log", "evaluate", "sound", "probe"], "description": "Different kinds of breakpoint actions." },
+ { "name": "data", "type": "string", "optional": true, "description": "Data associated with this breakpoint type (e.g. for type \"eval\" this is the JavaScript string to evalulate)." },
+ { "name": "id", "$ref": "BreakpointActionIdentifier", "optional": true, "description": "A frontend-assigned identifier for this breakpoint action." }
+ ],
+ "description": "Action to perform when a breakpoint is triggered."
+ },
+ {
+ "id": "BreakpointOptions",
+ "type": "object",
+ "properties": [
+ { "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." },
+ { "name": "actions", "type": "array", "optional": true, "items": { "$ref": "BreakpointAction" }, "description": "Actions to perform automatically when the breakpoint is triggered." },
+ { "name": "autoContinue", "type": "boolean", "optional": true, "description": "Automatically continue after hitting this breakpoint and running actions." },
+ { "name": "ignoreCount", "type": "integer", "optional": true, "description": "Number of times to ignore this breakpoint, before stopping on the breakpoint and running actions." }
+ ],
+ "description": "Extra options that modify breakpoint behavior."
+ },
+ {
+ "id": "FunctionDetails",
+ "type": "object",
+ "properties": [
+ { "name": "location", "$ref": "Location", "description": "Location of the function." },
+ { "name": "name", "type": "string", "optional": true, "description": "Name of the function. Not present for anonymous functions." },
+ { "name": "displayName", "type": "string", "optional": true, "description": "Display name of the function(specified in 'displayName' property on the function object)." },
+ { "name": "inferredName", "type": "string", "optional": true, "description": "Name of the function inferred from its initial assignment." },
+ { "name": "scopeChain", "type": "array", "optional": true, "items": { "$ref": "Scope" }, "description": "Scope chain for this closure." }
+ ],
+ "description": "Information about the function."
+ },
+ {
+ "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": "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." }
+ ],
+ "description": "JavaScript call frame. Array of call frames form the call stack."
+ },
+ {
+ "id": "Scope",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["global", "with", "closure", "catch", "functionName", "globalLexicalEnvironment", "nestedLexical"], "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." }
+ ],
+ "description": "Scope description."
+ },
+ {
+ "id": "ProbeSample",
+ "description": "A sample collected by evaluating a probe breakpoint action.",
+ "type": "object",
+ "properties": [
+ { "name": "probeId", "$ref": "BreakpointActionIdentifier", "description": "Identifier of the probe breakpoint action that created the sample." },
+ { "name": "sampleId", "type": "integer", "description": "Unique identifier for this sample." },
+ { "name": "batchId", "type": "integer", "description": "A batch identifier which is the same for all samples taken at the same breakpoint hit." },
+ { "name": "timestamp", "type": "number", "description": "Timestamp of when the sample was taken." },
+ { "name": "payload", "$ref": "Runtime.RemoteObject", "description": "Contents of the sample." }
+ ]
+ },
+ {
+ "id": "AssertPauseReason",
+ "description": "The pause reason auxiliary data when paused because of an assertion.",
+ "type": "object",
+ "properties": [
+ { "name": "message", "type": "string", "optional": true, "description": "The console.assert message string if provided." }
+ ]
+ },
+ {
+ "id": "BreakpointPauseReason",
+ "description": "The pause reason auxiliary data when paused because of hitting a breakpoint.",
+ "type": "object",
+ "properties": [
+ { "name": "breakpointId", "type": "string", "description": "The identifier of the breakpoint causing the pause." }
+ ]
+ },
+ {
+ "id": "CSPViolationPauseReason",
+ "description": "The pause reason auxiliary data when paused because of a Content Security Policy directive.",
+ "type": "object",
+ "properties": [
+ { "name": "directive", "type": "string", "description": "The CSP directive that blocked script execution." }
+ ]
+ }
+ ],
+ "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": "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": "options", "$ref": "BreakpointOptions", "optional": true, "description": "Options to apply to this breakpoint to modify its behavior." }
+ ],
+ "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": "options", "$ref": "BreakpointOptions", "optional": true, "description": "Options to apply to this breakpoint to modify its behavior." }
+ ],
+ "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." }
+ ],
+ "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",
+ "description": "Searches for given string in script content.",
+ "parameters": [
+ { "name": "scriptId", "$ref": "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": "GenericTypes.SearchMatch" }, "description": "List of search matches." }
+ ]
+ },
+ {
+ "name": "getScriptSource",
+ "parameters": [
+ { "name": "scriptId", "$ref": "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",
+ "parameters": [
+ { "name": "functionId", "$ref": "Runtime.RemoteObjectId", "description": "Id of the function to get location for." }
+ ],
+ "returns": [
+ { "name": "details", "$ref": "FunctionDetails", "description": "Information about the function." }
+ ],
+ "description": "Returns detailed information on given function."
+ },
+ {
+ "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." },
+ { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state." },
+ { "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, "description": "Whether preview should be generated for the result." },
+ { "name": "saveResult", "type": "boolean", "optional": true, "description": "Whether the resulting value should be considered for saving in the $n history." }
+ ],
+ "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": "savedResultIndex", "type": "integer", "optional": true, "description": "If the result was saved, this is the $n index that can be used to access the value." }
+ ],
+ "description": "Evaluates expression on a given call frame."
+ },
+ {
+ "name": "setOverlayMessage",
+ "parameters": [
+ { "name": "message", "type": "string", "optional": true, "description": "Overlay message to display when paused in debugger." }
+ ],
+ "description": "Sets overlay message."
+ }
+ ],
+ "events": [
+ {
+ "name": "globalObjectCleared",
+ "description": "Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload."
+ },
+ {
+ "name": "scriptParsed",
+ "parameters": [
+ { "name": "scriptId", "$ref": "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": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
+ { "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." }
+ ],
+ "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": "url", "type": "string", "description": "URL of the script that failed to parse." },
+ { "name": "scriptSource", "type": "string", "description": "Source text of the script that failed to parse." },
+ { "name": "startLine", "type": "integer", "description": "Line offset of the script within the resource." },
+ { "name": "errorLine", "type": "integer", "description": "Line with error." },
+ { "name": "errorMessage", "type": "string", "description": "Parse error message." }
+ ],
+ "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", "DebuggerStatement", "Breakpoint", "PauseOnNextStatement", "other"], "description": "Pause reason." },
+ { "name": "data", "type": "object", "optional": true, "description": "Object containing break-specific auxiliary properties." }
+ ],
+ "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."
+ },
+ {
+ "name": "didSampleProbe",
+ "description": "Fires when a new probe sample is collected.",
+ "parameters": [
+ { "name": "sample", "$ref": "ProbeSample", "description": "A collected probe sample." }
+ ]
+ },
+ {
+ "name": "playBreakpointActionSound",
+ "description": "Fired when a \"sound\" breakpoint action is triggered on a breakpoint.",
+ "parameters": [
+ { "name": "breakpointActionId", "$ref": "BreakpointActionIdentifier", "description": "Breakpoint action identifier." }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/GenericTypes.json b/Source/JavaScriptCore/inspector/protocol/GenericTypes.json
new file mode 100644
index 000000000..1a61257b6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/GenericTypes.json
@@ -0,0 +1,15 @@
+{
+ "domain": "GenericTypes",
+ "description": "Exposes generic types to be used by any domain.",
+ "types": [
+ {
+ "id": "SearchMatch",
+ "type": "object",
+ "description": "Search match in a resource.",
+ "properties": [
+ { "name": "lineNumber", "type": "number", "description": "Line number in resource content." },
+ { "name": "lineContent", "type": "string", "description": "Line with match content." }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Heap.json b/Source/JavaScriptCore/inspector/protocol/Heap.json
new file mode 100644
index 000000000..eac33464e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Heap.json
@@ -0,0 +1,39 @@
+{
+ "domain": "Heap",
+ "description": "Heap domain exposes JavaScript heap attributes and capabilities.",
+ "types": [
+ {
+ "id": "GarbageCollection",
+ "description": "Information about a garbage collection.",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["full", "partial"], "description": "The type of garbage collection." },
+ { "name": "startTime", "type": "number" },
+ { "name": "endTime", "type": "number" }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables Heap domain events."
+ },
+ {
+ "name": "disable",
+ "description": "Disables Heap domain events."
+ },
+ {
+ "name": "gc",
+ "description": "Trigger a full garbage collection."
+ }
+ ],
+ "events": [
+ {
+ "name": "garbageCollected",
+ "description": "Information about the garbage collection.",
+ "parameters": [
+ { "name": "collection", "type": "GarbageCollection" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/IndexedDB.json b/Source/JavaScriptCore/inspector/protocol/IndexedDB.json
new file mode 100644
index 000000000..0e984e4e8
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/IndexedDB.json
@@ -0,0 +1,145 @@
+{
+ "domain": "IndexedDB",
+ "featureGuard": "ENABLE(INDEXED_DATABASE)",
+ "availability": "web",
+ "types": [
+ {
+ "id": "DatabaseWithObjectStores",
+ "type": "object",
+ "description": "Database with an array of object stores.",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Database name." },
+ { "name": "version", "type": "number", "description": "Database version." },
+ { "name": "objectStores", "type": "array", "items": { "$ref": "ObjectStore" }, "description": "Object stores in this database." }
+ ]
+ },
+ {
+ "id": "ObjectStore",
+ "type": "object",
+ "description": "Object store.",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Object store name." },
+ { "name": "keyPath", "$ref": "KeyPath", "description": "Object store key path." },
+ { "name": "autoIncrement", "type": "boolean", "description": "If true, object store has auto increment flag set." },
+ { "name": "indexes", "type": "array", "items": { "$ref": "ObjectStoreIndex" }, "description": "Indexes in this object store." }
+ ]
+ },
+ {
+ "id": "ObjectStoreIndex",
+ "type": "object",
+ "description": "Object store index.",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Index name." },
+ { "name": "keyPath", "$ref": "KeyPath", "description": "Index key path." },
+ { "name": "unique", "type": "boolean", "description": "If true, index is unique." },
+ { "name": "multiEntry", "type": "boolean", "description": "If true, index allows multiple entries for a key." }
+ ]
+ },
+ {
+ "id": "Key",
+ "type": "object",
+ "description": "Key.",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["number", "string", "date", "array"], "description": "Key type." },
+ { "name": "number", "type": "number", "optional": true, "description": "Number value." },
+ { "name": "string", "type": "string", "optional": true, "description": "String value." },
+ { "name": "date", "type": "number", "optional": true, "description": "Date value." },
+ { "name": "array", "type": "array", "optional": true, "items": { "$ref": "Key" }, "description": "Array value." }
+ ]
+ },
+ {
+ "id": "KeyRange",
+ "type": "object",
+ "description": "Key range.",
+ "properties": [
+ { "name": "lower", "$ref": "Key", "optional": true, "description": "Lower bound." },
+ { "name": "upper", "$ref": "Key", "optional": true, "description": "Upper bound." },
+ { "name": "lowerOpen", "type": "boolean", "description": "If true lower bound is open." },
+ { "name": "upperOpen", "type": "boolean", "description": "If true upper bound is open." }
+ ]
+ },
+ {
+ "id": "DataEntry",
+ "type": "object",
+ "description": "Data entry.",
+ "properties": [
+ { "name": "key", "$ref": "Runtime.RemoteObject", "description": "Key." },
+ { "name": "primaryKey", "$ref": "Runtime.RemoteObject", "description": "Primary key." },
+ { "name": "value", "$ref": "Runtime.RemoteObject", "description": "Value." }
+ ]
+ },
+ {
+ "id": "KeyPath",
+ "type": "object",
+ "description": "Key path.",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["null", "string", "array"], "description": "Key path type." },
+ { "name": "string", "type": "string", "optional": true, "description": "String value." },
+ { "name": "array", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Array value." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables events from backend."
+ },
+ {
+ "name": "disable",
+ "description": "Disables events from backend."
+ },
+ {
+ "name": "requestDatabaseNames",
+ "async": true,
+ "parameters": [
+ { "name": "securityOrigin", "type": "string", "description": "Security origin." }
+ ],
+ "returns": [
+ { "name": "databaseNames", "type": "array", "items": { "type": "string" }, "description": "Database names for origin." }
+ ],
+ "description": "Requests database names for given security origin."
+ },
+ {
+ "name": "requestDatabase",
+ "async": true,
+ "parameters": [
+ { "name": "securityOrigin", "type": "string", "description": "Security origin." },
+ { "name": "databaseName", "type": "string", "description": "Database name." }
+ ],
+ "returns": [
+ { "name": "databaseWithObjectStores", "$ref": "DatabaseWithObjectStores", "description": "Database with an array of object stores." }
+ ],
+ "description": "Requests database with given name in given frame."
+ },
+ {
+ "name": "requestData",
+ "async": true,
+ "parameters": [
+ { "name": "securityOrigin", "type": "string", "description": "Security origin." },
+ { "name": "databaseName", "type": "string", "description": "Database name." },
+ { "name": "objectStoreName", "type": "string", "description": "Object store name." },
+ { "name": "indexName", "type": "string", "description": "Index name, empty string for object store data requests." },
+ { "name": "skipCount", "type": "integer", "description": "Number of records to skip." },
+ { "name": "pageSize", "type": "integer", "description": "Number of records to fetch." },
+ { "name": "keyRange", "$ref": "KeyRange", "optional": true, "description": "Key range." }
+ ],
+ "returns": [
+ { "name": "objectStoreDataEntries", "type": "array", "items": { "$ref": "DataEntry" }, "description": "Array of object store data entries." },
+ { "name": "hasMore", "type": "boolean", "description": "If true, there are more entries to fetch in the given range." }
+ ],
+ "description": "Requests data from object store or index."
+ },
+ {
+ "name": "clearObjectStore",
+ "async": true,
+ "parameters": [
+ { "name": "securityOrigin", "type": "string", "description": "Security origin." },
+ { "name": "databaseName", "type": "string", "description": "Database name." },
+ { "name": "objectStoreName", "type": "string", "description": "Object store name." }
+ ],
+ "returns": [
+ ],
+ "description": "Clears all entries from an object store."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Inspector.json b/Source/JavaScriptCore/inspector/protocol/Inspector.json
new file mode 100644
index 000000000..0420ebda0
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Inspector.json
@@ -0,0 +1,51 @@
+{
+ "domain": "Inspector",
+ "types": [],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables inspector domain notifications."
+ },
+ {
+ "name": "disable",
+ "description": "Disables inspector domain notifications."
+ },
+ {
+ "name": "initialized",
+ "description": "Sent by the frontend after all initialization messages have been sent."
+ }
+ ],
+ "events": [
+ {
+ "name": "evaluateForTestInFrontend",
+ "parameters": [
+ { "name": "script", "type": "string" }
+ ]
+ },
+ {
+ "name": "inspect",
+ "parameters": [
+ { "name": "object", "$ref": "Runtime.RemoteObject" },
+ { "name": "hints", "type": "object" }
+ ]
+ },
+ {
+ "name": "detached",
+ "description": "Fired when remote debugging connection is about to be terminated. Contains detach reason.",
+ "parameters": [
+ { "name": "reason", "type": "string", "description": "The reason why connection has been terminated." }
+ ]
+ },
+ {
+ "name": "activateExtraDomains",
+ "description": "Fired when the backend has alternate domains that need to be activated.",
+ "parameters": [
+ { "name": "domains", "type": "array", "items": { "type": "string" }, "description": "Domain names that need activation" }
+ ]
+ },
+ {
+ "name": "targetCrashed",
+ "description": "Fired when debugging target has crashed"
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/LayerTree.json b/Source/JavaScriptCore/inspector/protocol/LayerTree.json
new file mode 100644
index 000000000..4115cd4ab
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/LayerTree.json
@@ -0,0 +1,114 @@
+{
+ "domain": "LayerTree",
+ "availability": "web",
+ "types": [
+ {
+ "id": "LayerId",
+ "type": "string",
+ "description": "Unique RenderLayer identifier."
+ },
+ {
+ "id": "PseudoElementId",
+ "type": "string",
+ "description": "Unique PseudoElement identifier."
+ },
+ {
+ "id": "IntRect",
+ "type": "object",
+ "description": "A rectangle.",
+ "properties": [
+ { "name": "x", "type": "integer", "description": "The x position." },
+ { "name": "y", "type": "integer", "description": "The y position." },
+ { "name": "width", "type": "integer", "description": "The width metric." },
+ { "name": "height", "type": "integer", "description": "The height metric." }
+ ]
+ },
+ {
+ "id": "Layer",
+ "type": "object",
+ "description": "Information about a compositing layer.",
+ "properties": [
+ { "name": "layerId", "$ref": "LayerId", "description": "The unique id for this layer." },
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The id for the node associated with this layer." },
+ { "name": "bounds", "$ref": "IntRect", "description": "Bounds of the layer in absolute page coordinates." },
+ { "name": "paintCount", "type": "integer", "description": "Indicates how many time this layer has painted." },
+ { "name": "memory", "type": "integer", "description": "Estimated memory used by this layer." },
+ { "name": "compositedBounds", "$ref": "IntRect", "description": "The bounds of the composited layer." },
+ { "name": "isInShadowTree", "type": "boolean", "optional": true, "description": "Indicates whether this layer is associated with an element hosted in a shadow tree." },
+ { "name": "isReflection", "type": "boolean", "optional": true, "description": "Indicates whether this layer was used to provide a reflection for the element." },
+ { "name": "isGeneratedContent", "type": "boolean", "optional": true, "description": "Indicates whether the layer is attached to a pseudo element that is CSS generated content." },
+ { "name": "isAnonymous", "type": "boolean", "optional": true, "description": "Indicates whether the layer was created for a CSS anonymous block or box." },
+ { "name": "pseudoElementId", "$ref": "PseudoElementId", "optional": true, "description": "The id for the pseudo element associated with this layer." },
+ { "name": "pseudoElement", "type": "string", "optional": true, "description": "The name of the CSS pseudo-element that prompted the layer to be generated." }
+ ]
+ },
+ {
+ "id": "CompositingReasons",
+ "type": "object",
+ "description": "An object containing the reasons why the layer was composited as properties.",
+ "properties": [
+ { "name": "transform3D", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a CSS 3D transform." },
+ { "name": "video", "type": "boolean", "optional": true, "description": "Composition due to association with a <video> element." },
+ { "name": "canvas", "type": "boolean", "optional": true, "description": "Composition due to the element being a <canvas> element." },
+ { "name": "plugin", "type": "boolean", "optional": true, "description": "Composition due to association with a plugin." },
+ { "name": "iFrame", "type": "boolean", "optional": true, "description": "Composition due to association with an <iframe> element." },
+ { "name": "backfaceVisibilityHidden", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"backface-visibility: hidden\" style." },
+ { "name": "clipsCompositingDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element clipping compositing descendants." },
+ { "name": "animation", "type": "boolean", "optional": true, "description": "Composition due to association with an animated element." },
+ { "name": "filters", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS filters applied." },
+ { "name": "positionFixed", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"position: fixed\" style." },
+ { "name": "positionSticky", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"position: sticky\" style." },
+ { "name": "overflowScrollingTouch", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"overflow-scrolling: touch\" style." },
+ { "name": "stacking", "type": "boolean", "optional": true, "description": "Composition due to association with an element establishing a stacking context." },
+ { "name": "overlap", "type": "boolean", "optional": true, "description": "Composition due to association with an element overlapping other composited elements." },
+ { "name": "negativeZIndexChildren", "type": "boolean", "optional": true, "description": "Composition due to association with an element with descendants that have a negative z-index." },
+ { "name": "transformWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with composited descendants." },
+ { "name": "opacityWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with opacity applied and composited descendants." },
+ { "name": "maskWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with a masked element and composited descendants." },
+ { "name": "reflectionWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a reflection and composited descendants." },
+ { "name": "filterWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS filters applied and composited descendants." },
+ { "name": "blendingWithCompositedDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element with CSS blending applied and composited descendants." },
+ { "name": "isolatesCompositedBlendingDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element isolating compositing descendants having CSS blending applied." },
+ { "name": "perspective", "type": "boolean", "optional": true, "description": "Composition due to association with an element with perspective applied." },
+ { "name": "preserve3D", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"transform-style: preserve-3d\" style." },
+ { "name": "willChange", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"will-change\" style." },
+ { "name": "root", "type": "boolean", "optional": true, "description": "Composition due to association with the root element." },
+ { "name": "blending", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"blend-mode\" style." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables compositing tree inspection."
+ },
+ {
+ "name": "disable",
+ "description": "Disables compositing tree inspection."
+ },
+ {
+ "name": "layersForNode",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Root of the subtree for which we want to gather layers." } ],
+ "description": "Returns the layer tree structure of the current page.",
+ "returns": [
+ { "name": "layers", "type": "array", "items": { "$ref": "Layer" }, "description": "Child layers." }
+ ]
+ },
+ {
+ "name": "reasonsForCompositingLayer",
+ "parameters": [
+ { "name": "layerId", "$ref": "LayerId", "description": "The id of the layer for which we want to get the reasons it was composited." }
+ ],
+ "description": "Provides the reasons why the given layer was composited.",
+ "returns": [
+ { "name": "compositingReasons", "$ref": "CompositingReasons", "description": "An object containing the reasons why the layer was composited as properties." }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "layerTreeDidChange"
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Memory.json b/Source/JavaScriptCore/inspector/protocol/Memory.json
new file mode 100644
index 000000000..0ee20d23a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Memory.json
@@ -0,0 +1,54 @@
+{
+ "domain": "Memory",
+ "description": "Memory domain exposes page memory tracking.",
+ "featureGuard": "ENABLE(RESOURCE_USAGE)",
+ "availability": "web",
+ "types": [
+ {
+ "id": "Event",
+ "type": "object",
+ "properties": [
+ { "name": "timestamp", "type": "number" },
+ { "name": "categories", "type": "array", "items": { "$ref": "CategoryData" }, "description": "Breakdown of memory in categories." }
+ ]
+ },
+ {
+ "id": "CategoryData",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["javascript", "jit", "images", "layers", "page", "other"], "description": "Category type." },
+ { "name": "size", "type": "number", "description": "Category size in bytes." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "startTracking",
+ "description": "Start tracking memory. This will produce a `trackingStart` event."
+ },
+ {
+ "name": "stopTracking",
+ "description": "Stop tracking memory. This will produce a `trackingComplete` event."
+ }
+ ],
+ "events": [
+ {
+ "name": "trackingStart",
+ "description": "Tracking started.",
+ "parameters": [
+ { "name": "timestamp", "type": "number" }
+ ]
+ },
+ {
+ "name": "trackingUpdate",
+ "description": "Periodic tracking updates with event data.",
+ "parameters": [
+ { "name": "event", "$ref": "Event" }
+ ]
+ },
+ {
+ "name": "trackingComplete",
+ "description": "Tracking stopped."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Network.json b/Source/JavaScriptCore/inspector/protocol/Network.json
new file mode 100644
index 000000000..e317f80e7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Network.json
@@ -0,0 +1,314 @@
+{
+ "domain": "Network",
+ "description": "Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "LoaderId",
+ "type": "string",
+ "description": "Unique loader identifier."
+ },
+ {
+ "id": "FrameId",
+ "type": "string",
+ "description": "Unique frame identifier."
+ },
+ {
+ "id": "RequestId",
+ "type": "string",
+ "description": "Unique request identifier."
+ },
+ {
+ "id": "Timestamp",
+ "type": "number",
+ "description": "Number of seconds since epoch."
+ },
+ {
+ "id": "Headers",
+ "type": "object",
+ "description": "Request / response headers as keys / values of JSON object."
+ },
+ {
+ "id": "ResourceTiming",
+ "type": "object",
+ "description": "Timing information for the request.",
+ "properties": [
+ { "name": "navigationStart", "type": "number", "description": "Timing's navigationStart is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this navigationStart." },
+ { "name": "domainLookupStart", "type": "number", "description": "Started DNS address resolve." },
+ { "name": "domainLookupEnd", "type": "number", "description": "Finished DNS address resolve." },
+ { "name": "connectStart", "type": "number", "description": "Started connecting to the remote host." },
+ { "name": "connectEnd", "type": "number", "description": "Connected to the remote host." },
+ { "name": "secureConnectionStart", "type": "number", "description": "Started SSL handshake." },
+ { "name": "requestStart", "type": "number", "description": "Started sending request." },
+ { "name": "responseStart", "type": "number", "description": "Started receiving response headers." }
+ ]
+ },
+ {
+ "id": "Request",
+ "type": "object",
+ "description": "HTTP request data.",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Request URL." },
+ { "name": "method", "type": "string", "description": "HTTP request method." },
+ { "name": "headers", "$ref": "Headers", "description": "HTTP request headers." },
+ { "name": "postData", "type": "string", "optional": true, "description": "HTTP POST request data." }
+ ]
+ },
+ {
+ "id": "Response",
+ "type": "object",
+ "description": "HTTP response data.",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Response URL. This URL can be different from CachedResource.url in case of redirect." },
+ { "name": "status", "type": "number", "description": "HTTP response status code." },
+ { "name": "statusText", "type": "string", "description": "HTTP response status text." },
+ { "name": "headers", "$ref": "Headers", "description": "HTTP response headers." },
+ { "name": "headersText", "type": "string", "optional": true, "description": "HTTP response headers text." },
+ { "name": "mimeType", "type": "string", "description": "Resource mimeType as determined by the browser." },
+ { "name": "requestHeaders", "$ref": "Headers", "optional": true, "description": "Refined HTTP request headers that were actually transmitted over the network." },
+ { "name": "requestHeadersText", "type": "string", "optional": true, "description": "HTTP request headers text." },
+ { "name": "fromDiskCache", "type": "boolean", "optional": true, "description": "Specifies that the request was served from the disk cache." },
+ { "name": "timing", "$ref": "ResourceTiming", "optional": true, "description": "Timing information for the given request." }
+ ]
+ },
+ {
+ "id": "WebSocketRequest",
+ "type": "object",
+ "description": "WebSocket request data.",
+ "properties": [
+ { "name": "headers", "$ref": "Headers", "description": "HTTP response headers." }
+ ]
+ },
+ {
+ "id": "WebSocketResponse",
+ "type": "object",
+ "description": "WebSocket response data.",
+ "properties": [
+ { "name": "status", "type": "number", "description": "HTTP response status code." },
+ { "name": "statusText", "type": "string", "description": "HTTP response status text." },
+ { "name": "headers", "$ref": "Headers", "description": "HTTP response headers." }
+ ]
+ },
+ {
+ "id": "WebSocketFrame",
+ "type": "object",
+ "description": "WebSocket frame data.",
+ "properties": [
+ { "name": "opcode", "type": "number", "description": "WebSocket frame opcode." },
+ { "name": "mask", "type": "boolean", "description": "WebSocket frame mask." },
+ { "name": "payloadData", "type": "string", "description": "WebSocket frame payload data." }
+ ]
+ },
+ {
+ "id": "CachedResource",
+ "type": "object",
+ "description": "Information about the cached resource.",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Resource URL. This is the url of the original network request." },
+ { "name": "type", "$ref": "Page.ResourceType", "description": "Type of this resource." },
+ { "name": "response", "$ref": "Response", "optional": true, "description": "Cached response data." },
+ { "name": "bodySize", "type": "number", "description": "Cached response body size." },
+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with this resource (if any)." }
+ ]
+ },
+ {
+ "id": "Initiator",
+ "type": "object",
+ "description": "Information about the request initiator.",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["parser", "script", "other"], "description": "Type of this initiator." },
+ { "name": "stackTrace", "$ref": "Console.StackTrace", "optional": true, "description": "Initiator JavaScript stack trace, set for Script only." },
+ { "name": "url", "type": "string", "optional": true, "description": "Initiator URL, set for Parser type only." },
+ { "name": "lineNumber", "type": "number", "optional": true, "description": "Initiator line number, set for Parser type only." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables network tracking, network events will now be delivered to the client."
+ },
+ {
+ "name": "disable",
+ "description": "Disables network tracking, prevents network events from being sent to the client."
+ },
+ {
+ "name": "setExtraHTTPHeaders",
+ "description": "Specifies whether to always send extra HTTP headers with the requests from this page.",
+ "parameters": [
+ { "name": "headers", "$ref": "Headers", "description": "Map with extra HTTP headers." }
+ ]
+ },
+ {
+ "name": "getResponseBody",
+ "description": "Returns content served for the given request.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Identifier of the network request to get content for." }
+ ],
+ "returns": [
+ { "name": "body", "type": "string", "description": "Response body." },
+ { "name": "base64Encoded", "type": "boolean", "description": "True, if content was sent as base64." }
+ ]
+ },
+ {
+ "name": "setCacheDisabled",
+ "parameters": [
+ { "name": "cacheDisabled", "type": "boolean", "description": "Cache disabled state." }
+ ],
+ "description": "Toggles ignoring cache for each request. If <code>true</code>, cache will not be used."
+ },
+ {
+ "name": "loadResource",
+ "async": true,
+ "parameters": [
+ { "name": "frameId", "$ref": "FrameId", "description": "Frame to load the resource from." },
+ { "name": "url", "type": "string", "description": "URL of the resource to load." }
+ ],
+ "returns": [
+ { "name": "content", "type": "string", "description": "Resource content." },
+ { "name": "mimeType", "type": "string", "description": "Resource mimeType." },
+ { "name": "status", "type": "number", "description": "HTTP response status code." }
+ ],
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ }
+ ],
+ "events": [
+ {
+ "name": "requestWillBeSent",
+ "description": "Fired when page is about to send HTTP request.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "frameId", "$ref": "FrameId", "description": "Frame identifier." },
+ { "name": "loaderId", "$ref": "LoaderId", "description": "Loader identifier." },
+ { "name": "documentURL", "type": "string", "description": "URL of the document this request is loaded for." },
+ { "name": "request", "$ref": "Request", "description": "Request data." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." },
+ { "name": "redirectResponse", "optional": true, "$ref": "Response", "description": "Redirect response data." },
+ { "name": "type", "$ref": "Page.ResourceType", "optional": true, "description": "Resource type." }
+ ]
+ },
+ {
+ "name": "requestServedFromCache",
+ "description": "Fired if request ended up loading from cache.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." }
+ ]
+ },
+ {
+ "name": "responseReceived",
+ "description": "Fired when HTTP response is available.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "frameId", "$ref": "FrameId", "description": "Frame identifier." },
+ { "name": "loaderId", "$ref": "LoaderId", "description": "Loader identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "type", "$ref": "Page.ResourceType", "description": "Resource type." },
+ { "name": "response", "$ref": "Response", "description": "Response data." }
+ ]
+ },
+ {
+ "name": "dataReceived",
+ "description": "Fired when data chunk was received over the network.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "dataLength", "type": "integer", "description": "Data chunk length." },
+ { "name": "encodedDataLength", "type": "integer", "description": "Actual bytes received (might be less than dataLength for compressed encodings)." }
+ ]
+ },
+ {
+ "name": "loadingFinished",
+ "description": "Fired when HTTP request has finished loading.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with this resource (if any)." }
+ ]
+ },
+ {
+ "name": "loadingFailed",
+ "description": "Fired when HTTP request has failed to load.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "errorText", "type": "string", "description": "User friendly error message." },
+ { "name": "canceled", "type": "boolean", "optional": true, "description": "True if loading was canceled." }
+ ]
+ },
+ {
+ "name": "requestServedFromMemoryCache",
+ "description": "Fired when HTTP request has been served from memory cache.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "frameId", "$ref": "FrameId", "description": "Frame identifier." },
+ { "name": "loaderId", "$ref": "LoaderId", "description": "Loader identifier." },
+ { "name": "documentURL", "type": "string", "description": "URL of the document this request is loaded for." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." },
+ { "name": "resource", "$ref": "CachedResource", "description": "Cached resource data." }
+ ]
+ },
+ {
+ "name": "webSocketWillSendHandshakeRequest",
+ "description": "Fired when WebSocket is about to initiate handshake.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "request", "$ref": "WebSocketRequest", "description": "WebSocket request data." }
+ ]
+ },
+ {
+ "name": "webSocketHandshakeResponseReceived",
+ "description": "Fired when WebSocket handshake response becomes available.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "response", "$ref": "WebSocketResponse", "description": "WebSocket response data." }
+ ]
+ },
+ {
+ "name": "webSocketCreated",
+ "description": "Fired upon WebSocket creation.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "url", "type": "string", "description": "WebSocket request URL." }
+ ]
+ },
+ {
+ "name": "webSocketClosed",
+ "description": "Fired when WebSocket is closed.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." }
+ ]
+ },
+ {
+ "name": "webSocketFrameReceived",
+ "description": "Fired when WebSocket frame is received.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "response", "$ref": "WebSocketFrame", "description": "WebSocket response data." }
+ ]
+ },
+ {
+ "name": "webSocketFrameError",
+ "description": "Fired when WebSocket frame error occurs.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "errorMessage", "type": "string", "description": "WebSocket frame error message." }
+ ]
+ },
+ {
+ "name": "webSocketFrameSent",
+ "description": "Fired when WebSocket frame is sent.",
+ "parameters": [
+ { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
+ { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
+ { "name": "response", "$ref": "WebSocketFrame", "description": "WebSocket response data." }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/OverlayTypes.json b/Source/JavaScriptCore/inspector/protocol/OverlayTypes.json
new file mode 100644
index 000000000..47efa75ef
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/OverlayTypes.json
@@ -0,0 +1,129 @@
+{
+ "domain": "OverlayTypes",
+ "description": "Exposes types to be used by the inspector overlay.",
+ "types": [
+ {
+ "id": "Point",
+ "type": "object",
+ "properties": [
+ { "name": "x", "type": "number" },
+ { "name": "y", "type": "number" }
+ ]
+ },
+ {
+ "id": "Size",
+ "type": "object",
+ "properties": [
+ { "name": "width", "type": "integer" },
+ { "name": "height", "type": "integer" }
+ ]
+ },
+ {
+ "id": "Quad",
+ "description": "A quad is a collection of 4 points. When initialized from a rect, the points are in clockwise order from top left.",
+ "type": "array",
+ "items": { "$ref": "Point" }
+ },
+ {
+ "id": "Rect",
+ "description": "A rectangle specified by a reference coordinate and width/height offsets.",
+ "type": "object",
+ "properties": [
+ { "name": "x", "type": "number" },
+ { "name": "y", "type": "number" },
+ { "name": "width", "type": "number" },
+ { "name": "height", "type": "number" }
+ ]
+ },
+ {
+ "id": "Region",
+ "description": "A single region in a flow thread.",
+ "type": "object",
+ "properties": [
+ { "name": "borderQuad", "$ref": "Quad" },
+ { "name": "incomingQuad", "$ref": "Quad" },
+ { "name": "outgoingQuad", "$ref": "Quad" },
+ { "name": "isHighlighted", "type": "boolean", "optional": true }
+ ]
+ },
+ {
+ "id": "DisplayPath",
+ "description": "A vector path described using SVG path syntax.",
+ "type": "array",
+ "items": { "type": "any" }
+ },
+ {
+ "id": "RegionFlowData",
+ "type": "object",
+ "properties": [
+ { "name": "regions", "type": "array", "items": { "$ref": "Region"} },
+ { "name": "name", "type": "string" }
+ ]
+ },
+ {
+ "id": "ContentFlowData",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string" }
+ ]
+ },
+ {
+ "id": "ShapeOutsideData",
+ "type": "object",
+ "properties": [
+ { "name": "bounds", "$ref": "Quad", "description": "Bounds for the shape-outside paths." },
+ { "name": "shape", "$ref": "DisplayPath", "description": "Path for the element's shape.", "optional": true },
+ { "name": "marginShape", "$ref": "DisplayPath", "description": "Path for the element's margin shape.", "optional": true }
+ ]
+ },
+ {
+ "id": "ElementData",
+ "description": "Data that describes an element to be highlighted.",
+ "type": "object",
+ "properties": [
+ { "name": "tagName", "type": "string" },
+ { "name": "idValue", "type": "string", "description": "The value of the element's 'id' attribute." },
+ { "name": "className", "type": "string", "optional": true },
+ { "name": "size", "$ref": "Size", "optional": true },
+ { "name": "role", "type": "string", "description": "Computed accessibility role for the element.", "optional": true },
+ { "name": "regionFlowData", "$ref": "RegionFlowData", "optional": true },
+ { "name": "contentFlowData", "$ref": "ContentFlowData", "optional": true },
+ { "name": "shapeOutsideData", "$ref": "ShapeOutsideData", "optional": true }
+ ]
+ },
+ {
+ "id": "FragmentHighlightData",
+ "description": "Data required to highlight multiple quads.",
+ "type": "object",
+ "properties": [
+ { "name": "quads", "type": "array", "items": { "$ref": "Quad" }, "description": "Quads for which the highlight should be applied."},
+ { "name": "contentColor", "type": "string" },
+ { "name": "contentOutlineColor", "type": "string" },
+ { "name": "paddingColor", "type": "string" },
+ { "name": "borderColor", "type": "string" },
+ { "name": "marginColor", "type": "string" },
+ { "name": "regionClippingArea", "$ref": "Quad", "optional": true }
+ ]
+ },
+ {
+ "id": "NodeHighlightData",
+ "description": "Data required to highlight a DOM node.",
+ "type": "object",
+ "properties": [
+ { "name": "scrollOffset", "$ref": "Point", "description": "Scroll offset for the MainFrame's FrameView that is shared across all quads." },
+ { "name": "fragments", "type": "array", "items": { "$ref": "FragmentHighlightData" } },
+ { "name": "elementData", "$ref": "ElementData", "optional": true }
+ ]
+ },
+ {
+ "id": "OverlayConfiguration",
+ "description": "Data required to configure the overlay's size and scaling behavior.",
+ "type": "object",
+ "properties": [
+ { "name": "deviceScaleFactor", "type": "number" },
+ { "name": "viewportSize", "$ref": "Size" },
+ { "name": "frameViewFullSize", "$ref": "Size" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Page.json b/Source/JavaScriptCore/inspector/protocol/Page.json
new file mode 100644
index 000000000..c210a8975
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Page.json
@@ -0,0 +1,357 @@
+{
+ "domain": "Page",
+ "description": "Actions and events related to the inspected page belong to the page domain.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "ResourceType",
+ "type": "string",
+ "enum": ["Document", "Stylesheet", "Image", "Font", "Script", "XHR", "WebSocket", "Other"],
+ "description": "Resource type as it was perceived by the rendering engine."
+ },
+ {
+ "id": "CoordinateSystem",
+ "type": "string",
+ "enum": ["Viewport", "Page"],
+ "description": "Coordinate system used by supplied coordinates."
+ },
+ {
+ "id": "Frame",
+ "type": "object",
+ "description": "Information about the Frame on the page.",
+ "properties": [
+ { "name": "id", "type": "string", "description": "Frame unique identifier." },
+ { "name": "parentId", "type": "string", "optional": true, "description": "Parent frame identifier." },
+ { "name": "loaderId", "$ref": "Network.LoaderId", "description": "Identifier of the loader associated with this frame." },
+ { "name": "name", "type": "string", "optional": true, "description": "Frame's name as specified in the tag." },
+ { "name": "url", "type": "string", "description": "Frame document's URL." },
+ { "name": "securityOrigin", "type": "string", "description": "Frame document's security origin." },
+ { "name": "mimeType", "type": "string", "description": "Frame document's mimeType as determined by the browser." }
+ ]
+ },
+ {
+ "id": "FrameResource",
+ "type": "object",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Resource URL." },
+ { "name": "type", "$ref": "ResourceType", "description": "Type of this resource." },
+ { "name": "mimeType", "type": "string", "description": "Resource mimeType as determined by the browser." },
+ { "name": "failed", "type": "boolean", "optional": true, "description": "True if the resource failed to load." },
+ { "name": "canceled", "type": "boolean", "optional": true, "description": "True if the resource was canceled during loading." },
+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with this resource (if any)." }
+ ]
+ },
+ {
+ "id": "FrameResourceTree",
+ "type": "object",
+ "description": "Information about the Frame hierarchy along with their cached resources.",
+ "properties": [
+ { "name": "frame", "$ref": "Frame", "description": "Frame information for this tree item." },
+ { "name": "childFrames", "type": "array", "optional": true, "items": { "$ref": "FrameResourceTree" }, "description": "Child frames." },
+ { "name": "resources", "type": "array", "items": { "$ref": "FrameResource" }, "description": "Information about frame resources." }
+ ]
+ },
+ {
+ "id": "SearchResult",
+ "type": "object",
+ "description": "Search result for resource.",
+ "properties": [
+ { "name": "url", "type": "string", "description": "Resource URL." },
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Resource frame id." },
+ { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." }
+ ]
+ },
+ {
+ "id": "Cookie",
+ "type": "object",
+ "description": "Cookie object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Cookie name." },
+ { "name": "value", "type": "string", "description": "Cookie value." },
+ { "name": "domain", "type": "string", "description": "Cookie domain." },
+ { "name": "path", "type": "string", "description": "Cookie path." },
+ { "name": "expires", "type": "number", "description": "Cookie expires." },
+ { "name": "size", "type": "integer", "description": "Cookie size." },
+ { "name": "httpOnly", "type": "boolean", "description": "True if cookie is http-only." },
+ { "name": "secure", "type": "boolean", "description": "True if cookie is secure." },
+ { "name": "session", "type": "boolean", "description": "True in case of session cookie." }
+ ]
+ },
+ {
+ "id": "ScriptIdentifier",
+ "type": "string",
+ "description": "Unique script identifier."
+ }
+ ],
+ "commands": [
+ {
+ "name": "enable",
+ "description": "Enables page domain notifications."
+ },
+ {
+ "name": "disable",
+ "description": "Disables page domain notifications."
+ },
+ {
+ "name": "addScriptToEvaluateOnLoad",
+ "parameters": [
+ { "name": "scriptSource", "type": "string" }
+ ],
+ "returns": [
+ { "name": "identifier", "$ref": "ScriptIdentifier", "description": "Identifier of the added script." }
+ ]
+ },
+ {
+ "name": "removeScriptToEvaluateOnLoad",
+ "parameters": [
+ { "name": "identifier", "$ref": "ScriptIdentifier" }
+ ]
+ },
+ {
+ "name": "reload",
+ "parameters": [
+ { "name": "ignoreCache", "type": "boolean", "optional": true, "description": "If true, browser cache is ignored (as if the user pressed Shift+refresh)." },
+ { "name": "scriptToEvaluateOnLoad", "type": "string", "optional": true, "description": "If set, the script will be injected into all frames of the inspected page after reload." }
+ ],
+ "description": "Reloads given page optionally ignoring the cache."
+ },
+ {
+ "name": "navigate",
+ "parameters": [
+ { "name": "url", "type": "string", "description": "URL to navigate the page to." }
+ ],
+ "description": "Navigates current page to the given URL."
+ },
+ {
+ "name": "getCookies",
+ "returns": [
+ { "name": "cookies", "type": "array", "items": { "$ref": "Cookie"}, "description": "Array of cookie objects." }
+ ],
+ "description": "Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the <code>cookies</code> field."
+ },
+ {
+ "name": "deleteCookie",
+ "parameters": [
+ { "name": "cookieName", "type": "string", "description": "Name of the cookie to remove." },
+ { "name": "url", "type": "string", "description": "URL to match cooke domain and path." }
+ ],
+ "description": "Deletes browser cookie with given name, domain and path."
+ },
+ {
+ "name": "getResourceTree",
+ "description": "Returns present frame / resource tree structure.",
+ "returns": [
+ { "name": "frameTree", "$ref": "FrameResourceTree", "description": "Present frame / resource tree structure." }
+ ]
+ },
+ {
+ "name": "getResourceContent",
+ "description": "Returns content of the given resource.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Frame id to get resource for." },
+ { "name": "url", "type": "string", "description": "URL of the resource to get content for." }
+ ],
+ "returns": [
+ { "name": "content", "type": "string", "description": "Resource content." },
+ { "name": "base64Encoded", "type": "boolean", "description": "True, if content was served as base64." }
+ ]
+ },
+ {
+ "name": "searchInResource",
+ "description": "Searches for given string in resource content.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Frame id for resource to search in." },
+ { "name": "url", "type": "string", "description": "URL of the resource 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": "GenericTypes.SearchMatch" }, "description": "List of search matches." }
+ ]
+ },
+ {
+ "name": "searchInResources",
+ "description": "Searches for given string in frame / resource tree structure.",
+ "parameters": [
+ { "name": "text", "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": "SearchResult" }, "description": "List of search results." }
+ ]
+ },
+ {
+ "name": "setDocumentContent",
+ "description": "Sets given markup as the document's HTML.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Frame id to set HTML for." },
+ { "name": "html", "type": "string", "description": "HTML content to set." }
+ ]
+ },
+ {
+ "name": "setShowPaintRects",
+ "description": "Requests that backend shows paint rectangles",
+ "parameters": [
+ { "name": "result", "type": "boolean", "description": "True for showing paint rectangles" }
+ ]
+ },
+ {
+ "name": "getScriptExecutionStatus",
+ "description": "Determines if scripts can be executed in the page.",
+ "returns": [
+ { "name": "result", "type": "string", "enum": ["allowed", "disabled", "forbidden"], "description": "Script execution status: \"allowed\" if scripts can be executed, \"disabled\" if script execution has been disabled through page settings, \"forbidden\" if script execution for the given page is not possible for other reasons." }
+ ]
+ },
+ {
+ "name": "setScriptExecutionDisabled",
+ "description": "Switches script execution in the page.",
+ "parameters": [
+ { "name": "value", "type": "boolean", "description": "Whether script execution should be disabled in the page." }
+ ]
+ },
+ {
+ "name": "setTouchEmulationEnabled",
+ "parameters": [
+ { "name": "enabled", "type": "boolean", "description": "Whether the touch event emulation should be enabled." }
+ ],
+ "description": "Toggles mouse event-based touch event emulation."
+ },
+ {
+ "name": "setEmulatedMedia",
+ "parameters": [
+ { "name": "media", "type": "string", "description": "Media type to emulate. Empty string disables the override." }
+ ],
+ "description": "Emulates the given media for CSS media queries."
+ },
+ {
+ "name": "getCompositingBordersVisible",
+ "description": "Indicates the visibility of compositing borders.",
+ "returns": [
+ { "name": "result", "type": "boolean", "description": "If true, compositing borders are visible." }
+ ]
+ },
+ {
+ "name": "setCompositingBordersVisible",
+ "description": "Controls the visibility of compositing borders.",
+ "parameters": [
+ { "name": "visible", "type": "boolean", "description": "True for showing compositing borders." }
+ ]
+ },
+ {
+ "name": "snapshotNode",
+ "description": "Capture a snapshot of the specified node that does not include unrelated layers.",
+ "parameters": [
+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Id of the node to snapshot." }
+ ],
+ "returns": [
+ { "name": "dataURL", "type": "string", "description": "Base64-encoded image data (PNG)." }
+ ]
+ },
+ {
+ "name": "snapshotRect",
+ "description": "Capture a snapshot of the page within the specified rectangle and coordinate system.",
+ "parameters": [
+ { "name": "x", "type": "integer", "description": "X coordinate" },
+ { "name": "y", "type": "integer", "description": "Y coordinate" },
+ { "name": "width", "type": "integer", "description": "Rectangle width" },
+ { "name": "height", "type": "integer", "description": "Rectangle height" },
+ { "name": "coordinateSystem", "$ref": "CoordinateSystem", "description": "Indicates the coordinate system of the supplied rectangle." }
+ ],
+ "returns": [
+ { "name": "dataURL", "type": "string", "description": "Base64-encoded image data (PNG)." }
+ ]
+ },
+ {
+ "name": "handleJavaScriptDialog",
+ "description": "Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).",
+ "parameters": [
+ { "name": "accept", "type": "boolean", "description": "Whether to accept or dismiss the dialog." },
+ { "name": "promptText", "type": "string", "optional": true, "description": "The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog." }
+ ]
+ },
+ {
+ "name": "archive",
+ "description": "Grab an archive of the page.",
+ "returns": [
+ { "name": "data", "type": "string", "description": "Base64-encoded web archive." }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "domContentEventFired",
+ "parameters": [
+ { "name": "timestamp", "type": "number" }
+ ]
+ },
+ {
+ "name": "loadEventFired",
+ "parameters": [
+ { "name": "timestamp", "type": "number" }
+ ]
+ },
+ {
+ "name": "frameNavigated",
+ "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.",
+ "parameters": [
+ { "name": "frame", "$ref": "Frame", "description": "Frame object." }
+ ]
+ },
+ {
+ "name": "frameDetached",
+ "description": "Fired when frame has been detached from its parent.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has been detached." }
+ ]
+ },
+ {
+ "name": "frameStartedLoading",
+ "description": "Fired when frame has started loading.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has started loading." }
+ ]
+ },
+ {
+ "name": "frameStoppedLoading",
+ "description": "Fired when frame has stopped loading.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has stopped loading." }
+ ]
+ },
+ {
+ "name": "frameScheduledNavigation",
+ "description": "Fired when frame schedules a potential navigation.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has scheduled a navigation." },
+ { "name": "delay", "type": "number", "description": "Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start." }
+ ]
+ },
+ {
+ "name": "frameClearedScheduledNavigation",
+ "description": "Fired when frame no longer has a scheduled navigation.",
+ "parameters": [
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the frame that has cleared its scheduled navigation." }
+ ]
+ },
+ {
+ "name": "javascriptDialogOpening",
+ "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.",
+ "parameters": [
+ { "name": "message", "type": "string", "description": "Message that will be displayed by the dialog." }
+ ]
+ },
+ {
+ "name": "javascriptDialogClosed",
+ "description": "Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed."
+ },
+ {
+ "name": "scriptsEnabled",
+ "description": "Fired when the JavaScript is enabled/disabled on the page",
+ "parameters": [
+ { "name": "isEnabled", "type": "boolean", "description": "Whether script execution is enabled or disabled on the page." }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Replay.json b/Source/JavaScriptCore/inspector/protocol/Replay.json
new file mode 100644
index 000000000..7bc26bda7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Replay.json
@@ -0,0 +1,264 @@
+{
+ "domain": "Replay",
+ "description": "Controls web replay, and manages recording sessions and segments.",
+ "featureGuard": "ENABLE(WEB_REPLAY)",
+ "availability": "web",
+ "types": [
+ {
+ "id": "SessionIdentifier", "description": "Unique replay session identifier.",
+ "type": "integer"
+ },
+ {
+ "id": "SegmentIdentifier", "description": "Unique session segment identifier.",
+ "type": "integer"
+ },
+ {
+ "id": "SessionState", "description": "State machine's state for the session.",
+ "type": "string",
+ "enum": ["Capturing", "Inactive", "Replaying"]
+ },
+ {
+ "id": "SegmentState", "description": "State machine's state for the session segment.",
+ "type": "string",
+ "enum": ["Appending", "Unloaded", "Loaded", "Dispatching"]
+ },
+ {
+ "id": "ReplayPosition",
+ "type": "object",
+ "properties": [
+ { "name": "segmentOffset", "type": "integer", "description": "Offset for a segment within the currently-loaded replay session." },
+ { "name": "inputOffset", "type": "integer", "description": "Offset for an event loop input within the specified session segment." }
+ ]
+ },
+ {
+ "id": "ReplayInput",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "description": "Input type." },
+ { "name": "offset", "type": "integer", "description": "Offset of this input in its respective queue."},
+ { "name": "data", "type": "object", "description": "Per-input payload." }
+ ]
+ },
+ {
+ "id": "ReplayInputQueue",
+ "type": "object",
+ "properties": [
+ { "name": "type", "type": "string", "description": "Queue type" },
+ { "name": "inputs", "type": "array", "items": { "$ref": "ReplayInput"}, "description": "Inputs belonging to this queue." }
+ ]
+ },
+ {
+ "id": "SessionSegment", "description": "A standalone segment of a replay session that corresponds to a single main frame navigation and execution.",
+ "type": "object",
+ "properties": [
+ { "name": "id", "$ref": "SegmentIdentifier", "description": "Unique session segment identifier." },
+ { "name": "timestamp", "type": "number", "description": "Start time of the segment, in milliseconds since the epoch." },
+ { "name": "queues", "type": "array", "items": { "$ref": "ReplayInputQueue"} }
+ ]
+ },
+ {
+ "id": "ReplaySession", "description": "An ordered collection of replay session segments.",
+ "type": "object",
+ "properties": [
+ { "name": "id", "$ref": "SessionIdentifier", "description": "Unique replay session identifier." },
+ { "name": "timestamp", "type": "number", "description": "Creation time of session, in milliseconds since the epoch." },
+ { "name": "segments", "type": "array", "items": { "$ref": "SegmentIdentifier" }, "description": "An ordered list identifiers for the segments that comprise this replay session." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "startCapturing",
+ "description": "Starts capture of a new replay session."
+ },
+ {
+ "name": "stopCapturing",
+ "description": "Stops capture of the currently recording replay session."
+ },
+ {
+ "name": "replayToPosition",
+ "description": "Seek execution to a specific position within the replay session.",
+ "parameters": [
+ { "name": "position", "$ref": "ReplayPosition" },
+ { "name": "shouldFastForward", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "replayToCompletion",
+ "description": "Replay all session segments completely.",
+ "parameters": [
+ { "name": "shouldFastForward", "type": "boolean" }
+ ]
+ },
+ {
+ "name": "pausePlayback",
+ "description": "Pauses playback in the current segment. Can be resumed by using a replay command."
+ },
+ {
+ "name": "cancelPlayback",
+ "description": "Cancels playback of the current segment. Further replaying will start from the beginning of the current segment."
+ },
+ {
+ "name": "switchSession",
+ "description": "Unloads the current replay session and loads the specified session",
+ "parameters": [
+ { "name": "sessionIdentifier", "$ref": "SessionIdentifier" }
+ ]
+ },
+ {
+ "name": "insertSessionSegment",
+ "description": "Splices the specified session segment into the session at the specified index.",
+ "parameters": [
+ { "name": "sessionIdentifier", "$ref": "SessionIdentifier" },
+ { "name": "segmentIdentifier", "$ref": "SegmentIdentifier" },
+ { "name": "segmentIndex", "type": "integer" }
+ ]
+ },
+ {
+ "name": "removeSessionSegment",
+ "description": "Removes the session segment at the specified position from the session.",
+ "parameters": [
+ { "name": "sessionIdentifier", "$ref": "SessionIdentifier" },
+ { "name": "segmentIndex", "type": "integer" }
+ ]
+ },
+ {
+ "name": "currentReplayState",
+ "description": "Returns the identifier, position, session state and segment state of the currently loaded session. This is necessary because the inspector may be closed and reopened in the middle of replay.",
+ "returns": [
+ { "name": "sessionIdentifier", "$ref": "SessionIdentifier" },
+ { "name": "segmentIdentifier", "$ref": "SegmentIdentifier", "optional": true, "description": "If no segment is currently loaded, then there is no valid segment identifier." },
+ { "name": "sessionState", "$ref": "SessionState" },
+ { "name": "segmentState", "$ref": "SegmentState" },
+ { "name": "replayPosition", "$ref": "ReplayPosition" }
+ ]
+ },
+ {
+ "name": "getAvailableSessions",
+ "description": "Returns identifiers of all available sessions.",
+ "returns": [
+ { "name": "ids", "type": "array", "items": { "$ref": "SessionIdentifier" } }
+ ]
+ },
+ {
+ "name": "getSessionData",
+ "description": "Returns an object for the specified session.",
+ "parameters": [
+ { "name": "sessionIdentifier", "$ref": "SessionIdentifier" }
+ ],
+ "returns": [
+ { "name": "session", "$ref": "ReplaySession", "optional": true, "description": "The requested serialized replay session." }
+ ]
+ },
+ {
+ "name": "getSegmentData",
+ "description": "Returns an object for the specified session segment.",
+ "parameters": [
+ { "name": "id", "$ref": "SegmentIdentifier" }
+ ],
+ "returns": [
+ { "name": "segment", "$ref": "SessionSegment", "optional": true, "description": "The requested serialized session segment." }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "captureStarted",
+ "description": "Fired when capture has started."
+ },
+ {
+ "name": "captureStopped",
+ "description": "Fired when capture has stopped."
+ },
+ {
+ "name": "playbackHitPosition",
+ "description": "Playback within the session has progressed up to this position, and is about to replay the input at the specified offset.",
+ "parameters": [
+ { "name": "position", "$ref": "ReplayPosition", "description": "The playback position that was hit." },
+ { "name": "timestamp", "type": "number", "description": "A timestamp for the event." }
+ ]
+ },
+ {
+ "name": "playbackStarted",
+ "description": "Fired when session playback has started."
+ },
+ {
+ "name": "playbackPaused",
+ "description": "Fired when session playback has paused, but not finished.",
+ "parameters": [
+ { "name": "position", "$ref": "ReplayPosition", "description": "The playback position immediately prior to where playback is paused." }
+ ]
+ },
+ {
+ "name": "playbackFinished",
+ "description": "Fired when session playback has stopped."
+ },
+ {
+ "name": "inputSuppressionChanged",
+ "description": "Fired when the replay controller starts or stops suppressing user inputs.",
+ "parameters": [
+ { "name": "willSuppress", "type": "boolean", "description": "Whether user inputs will be suppressed during playback." }
+ ]
+ },
+ {
+ "name": "sessionCreated",
+ "description": "Fired when a new replay session is created",
+ "parameters": [
+ { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the created session." }
+ ]
+ },
+ {
+ "name": "sessionModified",
+ "description": "Fired when a session's segments have changed.",
+ "parameters": [
+ { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the session the segment was added to." }
+ ]
+ },
+ {
+ "name": "sessionRemoved",
+ "description": "Fired when a replay session is removed and can no longer be loaded.",
+ "parameters": [
+ { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the removed session." }
+ ]
+ },
+ {
+ "name": "sessionLoaded",
+ "description": "Fired when a replay session is loaded.",
+ "parameters": [
+ { "name": "id", "$ref": "SessionIdentifier", "description": "Identifier for the loaded session." }
+ ]
+ },
+ {
+ "name": "segmentCreated",
+ "description": "Fired when a new session segment is created.",
+ "parameters": [
+ { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the created session segment." }
+ ]
+ },
+ {
+ "name": "segmentRemoved",
+ "description": "Fired when a session segment is removed and can no longer be replayed as part of a session.",
+ "parameters": [
+ { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the removed session segment." }
+ ]
+ },
+ {
+ "name": "segmentCompleted",
+ "description": "Fired when a session segment is completed and can no longer have inputs added to it.",
+ "parameters": [
+ { "name": "id", "$ref": "SegmentIdentifier", "description": "Identifier for the completed session segment." }
+ ]
+ },
+ {
+ "name": "segmentLoaded",
+ "description": "Fired when a segment is loaded.",
+ "parameters": [
+ { "name": "segmentIdentifier", "$ref": "SegmentIdentifier", "description": "Id for the loaded segment." }
+ ]
+ },
+ {
+ "name": "segmentUnloaded",
+ "description": "Fired when a segment is unloaded."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Runtime.json b/Source/JavaScriptCore/inspector/protocol/Runtime.json
new file mode 100644
index 000000000..af874d68d
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Runtime.json
@@ -0,0 +1,353 @@
+{
+ "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": "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", "error", "map", "set", "weakmap", "weakset", "iterator", "class"], "description": "Object subtype hint. Specified for <code>object</code> <code>function</code> (for class) 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)." },
+ { "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": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap/weakset object type values only." },
+ { "name": "classPrototype", "$ref": "RemoteObject", "optional": true, "description": "Remote object for the class prototype. Specified for class object type values only." },
+ { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containing abbreviated property values. Specified for <code>object</code> type values only." }
+ ]
+ },
+ {
+ "id": "ObjectPreview",
+ "type": "object",
+ "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", "error", "map", "set", "weakmap", "weakset", "iterator", "class"], "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": "lossless", "type": "boolean", "description": "Determines whether preview is lossless (contains all information of the original object)." },
+ { "name": "overflow", "type": "boolean", "optional": true, "description": "True iff some of the properties of the original did not fit." },
+ { "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "optional": true, "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." },
+ { "name": "size", "type": "integer", "optional": true, "description": "Size of the array/collection. Specified for array/map/set/weakmap/weakset object type values only." }
+ ]
+ },
+ {
+ "id": "PropertyPreview",
+ "type": "object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Property name." },
+ { "name": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean", "symbol", "accessor"], "description": "Object type." },
+ { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date", "error", "map", "set", "weakmap", "weakset", "iterator", "class"], "description": "Object subtype hint. Specified for <code>object</code> type values only." },
+ { "name": "value", "type": "string", "optional": true, "description": "User-friendly property value string." },
+ { "name": "valuePreview", "$ref": "ObjectPreview", "optional": true, "description": "Nested value preview." },
+ { "name": "internal", "type": "boolean", "optional": true, "description": "True if this is an internal property." }
+ ]
+ },
+ {
+ "id": "EntryPreview",
+ "type": "object",
+ "properties": [
+ { "name": "key", "$ref": "ObjectPreview", "optional": true, "description": "Entry key. Specified for map-like collection entries." },
+ { "name": "value", "$ref": "ObjectPreview", "description": "Entry value." }
+ ]
+ },
+ {
+ "id": "CollectionEntry",
+ "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." }
+ ]
+ },
+ {
+ "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." },
+ { "name": "symbol", "optional": true, "$ref": "Runtime.RemoteObject", "description": "Property symbol object, if the property is a symbol." },
+ { "name": "nativeGetter", "optional": true, "type": "boolean", "description": "True if the property value came from a native getter." }
+ ]
+ },
+ {
+ "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." }
+ ]
+ },
+ {
+ "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." },
+ { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." }
+ ]
+ },
+ {
+ "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": "isPageContext", "type": "boolean", "description": "True if this is a context where inpspected web page scripts run. False if it is a content script isolated context." },
+ { "name": "name", "type": "string", "description": "Human readable name describing given context."},
+ { "name": "frameId", "$ref": "Network.FrameId", "description": "Id of the owning frame." }
+ ]
+ },
+ {
+ "id": "SyntaxErrorType",
+ "type": "string",
+ "enum": ["none", "irrecoverable", "unterminated-literal", "recoverable"],
+ "description": "Syntax error type: \"none\" for no error, \"irrecoverable\" for unrecoverable errors, \"unterminated-literal\" for when there is an unterminated literal, \"recoverable\" for when the expression is unfinished but valid so far."
+ },
+ {
+ "id": "ErrorRange",
+ "type": "object",
+ "description": "Range of an error in source code.",
+ "properties": [
+ { "name": "startOffset", "type": "integer", "description": "Start offset of range (inclusive)." },
+ { "name": "endOffset", "type": "integer", "description": "End offset of range (exclusive)." }
+ ]
+ },
+ {
+ "id": "StructureDescription",
+ "type": "object",
+ "properties": [
+ { "name": "fields", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Array of strings, where the strings represent object properties." },
+ { "name": "optionalFields", "type": "array", "items": { "type": "string" }, "optional": true, "description": "Array of strings, where the strings represent optional object properties." },
+ { "name": "constructorName", "type": "string", "optional": true, "description": "Name of the constructor." },
+ { "name": "prototypeStructure", "$ref": "StructureDescription", "optional": true, "description": "Pointer to the StructureRepresentation of the protoype if one exists." },
+ { "name": "isImprecise", "type": "boolean", "optional": true, "description": "If true, it indicates that the fields in this StructureDescription may be inaccurate. I.e, there might have been fields that have been deleted before it was profiled or it has fields we haven't profiled." }
+ ]
+ },
+ {
+ "id": "TypeSet",
+ "type": "object",
+ "properties": [
+ { "name": "isFunction", "type": "boolean", "description": "Indicates if this type description has been type Function." },
+ { "name": "isUndefined", "type": "boolean", "description": "Indicates if this type description has been type Undefined." },
+ { "name": "isNull", "type": "boolean", "description": "Indicates if this type description has been type Null." },
+ { "name": "isBoolean", "type": "boolean", "description": "Indicates if this type description has been type Boolean." },
+ { "name": "isInteger", "type": "boolean", "description": "Indicates if this type description has been type Integer." },
+ { "name": "isNumber", "type": "boolean", "description": "Indicates if this type description has been type Number." },
+ { "name": "isString", "type": "boolean", "description": "Indicates if this type description has been type String." },
+ { "name": "isObject", "type": "boolean", "description": "Indicates if this type description has been type Object." },
+ { "name": "isSymbol", "type": "boolean", "description": "Indicates if this type description has been type Symbol." }
+ ]
+ },
+ {
+ "id": "TypeDescription",
+ "type": "object",
+ "description": "Container for type information that has been gathered.",
+ "properties": [
+ { "name": "isValid", "type": "boolean", "description": "If true, we were able to correlate the offset successfuly with a program location. If false, the offset may be bogus or the offset may be from a CodeBlock that hasn't executed." },
+ { "name": "leastCommonAncestor", "type": "string", "optional": true, "description": "Least common ancestor of all Constructors if the TypeDescription has seen any structures. This string is the display name of the shared constructor function." },
+ { "name": "typeSet", "$ref": "TypeSet", "optional": true, "description": "Set of booleans for determining the aggregate type of this type description." },
+ { "name": "structures", "type": "array", "items": { "$ref": "StructureDescription" }, "optional": true, "description": "Array of descriptions for all structures seen for this variable." },
+ { "name": "isTruncated", "type": "boolean", "optional": true, "description": "If true, this indicates that no more structures are being profiled because some maximum threshold has been reached and profiling has stopped because of memory pressure." }
+ ]
+ },
+ {
+ "id": "TypeLocation",
+ "type": "object",
+ "description": "Describes the location of an expression we want type information for.",
+ "properties": [
+ { "name": "typeInformationDescriptor", "type": "integer", "description": "What kind of type information do we want (normal, function return values, 'this' statement)." },
+ { "name": "sourceID", "type": "string", "description": "sourceID uniquely identifying a script" },
+ { "name": "divot", "type": "integer", "description": "character offset for assignment range" }
+ ]
+ },
+ {
+ "id": "BasicBlock",
+ "type": "object",
+ "description": "From Wikipedia: a basic block is a portion of the code within a program with only one entry point and only one exit point. This type gives the location of a basic block and if that basic block has executed.",
+ "properties": [
+ { "name": "startOffset", "type": "integer", "description": "Start offset of the basic block." },
+ { "name": "endOffset", "type": "integer", "description": "End offset of the basic block." },
+ { "name": "hasExecuted", "type": "boolean", "description": "Indicates if the basic block has executed before." },
+ { "name": "executionCount", "type": "integer", "description": "Indicates how many times the basic block has executed." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "parse",
+ "parameters": [
+ { "name": "source", "type": "string", "description": "Source code to parse." }
+ ],
+ "returns": [
+ { "name": "result", "$ref": "SyntaxErrorType", "description": "Parse result." },
+ { "name": "message", "type": "string", "optional": true, "description": "Parse error message." },
+ { "name": "range", "$ref": "ErrorRange", "optional": true, "description": "Range in the source where the error occurred." }
+ ],
+ "description": "Parses JavaScript source code for errors."
+ },
+ {
+ "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." },
+ { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state." },
+ { "name": "contextId", "$ref": "Runtime.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, "description": "Whether preview should be generated for the result." },
+ { "name": "saveResult", "type": "boolean", "optional": true, "description": "Whether the resulting value should be considered for saving in the $n history." }
+ ],
+ "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": "savedResultIndex", "type": "integer", "optional": true, "description": "If the result was saved, this is the $n index that can be used to access the value." }
+ ],
+ "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." },
+ { "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, "description": "Whether preview should be generated for the result." }
+ ],
+ "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 object itself, not to its prototype chain." },
+ { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for property values." }
+ ],
+ "returns": [
+ { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." },
+ { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor"}, "description": "Internal object properties." }
+ ],
+ "description": "Returns properties of a given object. Object group of the result is inherited from the target object."
+ },
+ {
+ "name": "getDisplayableProperties",
+ "parameters": [
+ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
+ { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for property values." }
+ ],
+ "returns": [
+ { "name": "properties", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." },
+ { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor"}, "description": "Internal object properties." }
+ ],
+ "description": "Returns displayable properties of a given object. Object group of the result is inherited from the target object. Displayable properties are own properties, internal properties, and native getters in the prototype chain (assumed to be bindings and treated like own properties for the frontend)."
+ },
+ {
+ "name": "getCollectionEntries",
+ "description": "Returns entries of given Map / Set collection.",
+ "parameters": [
+ { "name": "objectId", "$ref": "Runtime.RemoteObjectId", "description": "Id of the collection to get entries for." },
+ { "name": "objectGroup", "optional": true, "type": "string", "description": "Symbolic group name that can be used to release multiple. If not provided, it will be the same objectGroup as the RemoteObject determined from <code>objectId</code>. This is useful for WeakMap to release the collection entries." },
+ { "name": "startIndex", "optional": true, "type": "integer", "description": "If provided skip to this index before collecting values. Otherwise, 0." },
+ { "name": "numberToFetch", "optional": true, "type": "integer", "description": "If provided only return <code>numberToFetch</code> values. Otherwise, return values all the way to the end." }
+ ],
+ "returns": [
+ { "name": "entries", "type": "array", "items": { "$ref": "CollectionEntry" }, "description": "Array of collection entries." }
+ ]
+ },
+ {
+ "name": "saveResult",
+ "parameters": [
+ { "name": "value", "$ref": "CallArgument", "description": "Id or value of the object to save." },
+ { "name": "contextId", "optional": true, "$ref": "ExecutionContextId", "description": "Unique id of the execution context. To specify in which execution context script evaluation should be performed. If not provided, determine from the CallArgument's objectId." }
+ ],
+ "returns": [
+ { "name": "savedResultIndex", "type": "integer", "optional": true, "description": "If the value was saved, this is the $n index that can be used to access the value." }
+ ],
+ "description": "Assign a saved result index to this value."
+ },
+ {
+ "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": "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",
+ "description": "Disables reporting of execution contexts creation."
+ },
+ {
+ "name": "getRuntimeTypesForVariablesAtOffsets",
+ "parameters": [
+ { "name": "locations", "type": "array", "items": { "$ref": "TypeLocation" }, "description": "An array of type locations we're requesting information for. Results are expected in the same order they're sent in."}
+ ],
+ "returns": [
+ { "name": "types", "type": "array", "items": { "$ref": "TypeDescription", "description": "Types for requested variable." } }
+ ],
+ "description": "Returns detailed informtation on given function."
+ },
+ {
+ "name": "enableTypeProfiler",
+ "description": "Enables type profiling on the VM."
+ },
+ {
+ "name": "disableTypeProfiler",
+ "description": "Disables type profiling on the VM."
+ },
+ {
+ "name": "getBasicBlocks",
+ "parameters": [
+ { "name": "sourceID", "type": "string", "description": "Indicates which sourceID information is requested for." }
+ ],
+ "returns": [
+ { "name": "basicBlocks", "type": "array", "items": { "$ref": "BasicBlock", "description": "Array of basic blocks." } }
+ ],
+ "description": "Returns a list of basic blocks for the given sourceID with information about their text ranges and whether or not they have executed."
+ }
+ ],
+ "events": [
+ {
+ "name": "executionContextCreated",
+ "parameters": [
+ { "name": "context", "$ref": "ExecutionContextDescription", "description": "A newly created execution contex." }
+ ],
+ "description": "Issued when new execution context is created."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json b/Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json
new file mode 100644
index 000000000..c56da70e7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json
@@ -0,0 +1,92 @@
+{
+ "domain": "ScriptProfiler",
+ "description": "Profiler domain exposes JavaScript evaluation timing and profiling.",
+ "types": [
+ {
+ "id": "EventType",
+ "type": "string",
+ "enum": ["API", "Microtask", "Other"]
+ },
+ {
+ "id": "Event",
+ "type": "object",
+ "properties": [
+ { "name": "startTime", "type": "number" },
+ { "name": "endTime", "type": "number" },
+ { "name": "type", "$ref": "EventType" }
+ ]
+ },
+ {
+ "id": "ExpressionLocation",
+ "type": "object",
+ "properties": [
+ { "name": "line", "type": "integer" },
+ { "name": "column", "type": "integer" }
+ ]
+ },
+ {
+ "id": "StackFrame",
+ "type": "object",
+ "properties": [
+ { "name": "sourceID", "$ref": "Debugger.ScriptId", "description": "Unique script identifier." },
+ { "name": "name", "type": "string", "description": "A displayable name for the stack frame. i.e function name, (program), etc." },
+ { "name": "line", "type": "integer" },
+ { "name": "column", "type": "integer" },
+ { "name": "url", "type": "string" },
+ { "name": "expressionLocation", "$ref": "ExpressionLocation", "optional": true }
+ ]
+ },
+ {
+ "id": "StackTrace",
+ "type": "object",
+ "properties": [
+ { "name": "timestamp", "type": "number" },
+ { "name": "stackFrames", "type": "array", "items": { "$ref": "StackFrame" }, "description": "First array item is the bottom of the call stack and last array item is the top of the call stack." }
+ ]
+ },
+ {
+ "id": "Samples",
+ "type": "object",
+ "properties": [
+ { "name": "totalTime", "type": "number", "description": "Total execution time of the profiler's data. (Note: not total elapsed time.)" },
+ { "name": "stackTraces", "type": "array", "items": { "$ref": "StackTrace" } }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "startTracking",
+ "description": "Start tracking script evaluations.",
+ "parameters": [
+ { "name": "includeSamples", "type": "boolean", "optional": true, "description": "Start the sampling profiler, defaults to false." }
+ ]
+ },
+ {
+ "name": "stopTracking",
+ "description": "Stop tracking script evaluations. This will produce a `trackingComplete` event."
+ }
+ ],
+ "events": [
+ {
+ "name": "trackingStart",
+ "description": "Tracking started.",
+ "parameters": [
+ { "name": "timestamp", "type": "number" }
+ ]
+ },
+ {
+ "name": "trackingUpdate",
+ "description": "Periodic tracking updates with event data.",
+ "parameters": [
+ { "name": "event", "$ref": "Event" }
+ ]
+ },
+ {
+ "name": "trackingComplete",
+ "description": "Tracking stopped. Includes any buffered data during tracking, such as profiling information.",
+ "parameters": [
+ { "name": "samples", "$ref": "Samples", "optional": true, "description": "Stack traces." }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/protocol/Timeline.json b/Source/JavaScriptCore/inspector/protocol/Timeline.json
new file mode 100644
index 000000000..3a550cb78
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/protocol/Timeline.json
@@ -0,0 +1,115 @@
+{
+ "domain": "Timeline",
+ "description": "Timeline provides its clients with instrumentation records that are generated during the page runtime. Timeline instrumentation can be started and stopped using corresponding commands. While timeline is started, it is generating timeline event records.",
+ "availability": "web",
+ "types": [
+ {
+ "id": "EventType",
+ "type": "string",
+ "enum": [
+ "EventDispatch",
+ "ScheduleStyleRecalculation",
+ "RecalculateStyles",
+ "InvalidateLayout",
+ "Layout",
+ "Paint",
+ "Composite",
+ "RenderingFrame",
+ "TimerInstall",
+ "TimerRemove",
+ "TimerFire",
+ "EvaluateScript",
+ "TimeStamp",
+ "Time",
+ "TimeEnd",
+ "FunctionCall",
+ "ProbeSample",
+ "ConsoleProfile",
+ "RequestAnimationFrame",
+ "CancelAnimationFrame",
+ "FireAnimationFrame"
+ ],
+ "description": "Timeline record type."
+ },
+ {
+ "id": "TimelineEvent",
+ "type": "object",
+ "properties": [
+ { "name": "type", "$ref": "EventType", "description": "Event type." },
+ { "name": "data", "type": "object", "description": "Event data." },
+ { "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." }
+ ],
+ "description": "Timeline record contains information about the recorded activity."
+ },
+ {
+ "id": "CPUProfileNodeAggregateCallInfo",
+ "type": "object",
+ "description": "Aggregate CPU Profile call info. Holds time information for all the calls that happened on a node.",
+ "properties": [
+ { "name": "callCount", "type": "number", "description": "Total number of calls." },
+ { "name": "startTime", "type": "number", "description": "Start time for the first call." },
+ { "name": "endTime", "type": "number", "description": "End time for the last call." },
+ { "name": "totalTime", "type": "number", "description": "Total execution time for all calls combined." }
+ ]
+ },
+ {
+ "id": "CPUProfileNode",
+ "type": "object",
+ "description": "CPU Profile node. Holds callsite information, execution statistics and child nodes.",
+ "properties": [
+ { "name": "id", "type": "integer", "description": "Unique identifier for this call site." },
+ { "name": "callInfo", "$ref": "CPUProfileNodeAggregateCallInfo", "description": "Aggregate info about all the calls that making up this node." },
+ { "name": "functionName", "type": "string", "optional": true, "description": "Function name." },
+ { "name": "url", "type": "string", "optional": true, "description": "URL." },
+ { "name": "lineNumber", "type": "integer", "optional": true, "description": "Line number." },
+ { "name": "columnNumber", "type": "integer", "optional": true, "description": "Column number." },
+ { "name": "children", "type": "array", "items": { "$ref": "CPUProfileNode" }, "optional": true, "description": "Child nodes." }
+ ]
+ },
+ {
+ "id": "CPUProfile",
+ "type": "object",
+ "description": "Profile.",
+ "properties": [
+ { "name": "rootNodes", "type": "array", "items": { "$ref": "CPUProfileNode" }, "description": "Top level nodes in the stack." },
+ { "name": "idleTime", "type": "number", "optional": true }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "start",
+ "parameters": [
+ { "name": "maxCallStackDepth", "optional": true, "type": "integer", "description": "Samples JavaScript stack traces up to <code>maxCallStackDepth</code>, defaults to 5." }
+ ],
+ "description": "Starts capturing instrumentation events."
+ },
+ {
+ "name": "stop",
+ "description": "Stops capturing instrumentation events."
+ }
+ ],
+ "events": [
+ {
+ "name": "eventRecorded",
+ "parameters": [
+ { "name": "record", "$ref": "TimelineEvent", "description": "Timeline event record data." }
+ ],
+ "description": "Fired for every instrumentation event while timeline is started."
+ },
+ {
+ "name": "recordingStarted",
+ "parameters": [
+ { "name": "startTime", "type": "number", "description": "Start time of this new recording." }
+ ],
+ "description": "Fired when recording has started."
+ },
+ {
+ "name": "recordingStopped",
+ "parameters": [
+ { "name": "endTime", "type": "number", "description": "End time of this recording." }
+ ],
+ "description": "Fired when recording has stopped."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp b/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp
new file mode 100644
index 000000000..565218c69
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteAutomationTarget.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include "RemoteInspector.h"
+
+namespace Inspector {
+
+void RemoteAutomationTarget::setIsPaired(bool paired)
+{
+ if (m_paired == paired)
+ return;
+
+ m_paired = paired;
+
+ update();
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h
new file mode 100644
index 000000000..0b289db3a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteAutomationTarget.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteAutomationTarget_h
+#define RemoteAutomationTarget_h
+
+#include "RemoteControllableTarget.h"
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteAutomationTarget : public RemoteControllableTarget {
+public:
+ virtual ~RemoteAutomationTarget() { }
+
+ bool isPaired() const { return m_paired; }
+ void setIsPaired(bool);
+
+ virtual String name() const = 0;
+ virtual RemoteControllableTarget::Type type() const override { return RemoteControllableTarget::Type::Automation; }
+ virtual bool remoteControlAllowed() const override { return !m_paired; };
+
+private:
+ bool m_paired { false };
+};
+
+} // namespace Inspector
+
+SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(Inspector::RemoteAutomationTarget, Automation)
+
+#endif // RemoteAutomationTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h
new file mode 100644
index 000000000..d3e8d319b
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteConnectionToTarget.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteConnectionToTarget_h
+#define RemoteConnectionToTarget_h
+
+#import "InspectorFrontendChannel.h"
+#import "RemoteConnectionToTarget.h"
+#import "RemoteInspector.h"
+#import <mutex>
+#import <wtf/BlockPtr.h>
+#import <wtf/Lock.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/ThreadSafeRefCounted.h>
+
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+typedef Vector<BlockPtr<void ()>> RemoteTargetQueue;
+
+class RemoteConnectionToTarget final : public ThreadSafeRefCounted<RemoteConnectionToTarget>, public FrontendChannel {
+public:
+ RemoteConnectionToTarget(RemoteControllableTarget*, NSString *connectionIdentifier, NSString *destination);
+ virtual ~RemoteConnectionToTarget();
+
+ // Main API.
+ bool setup(bool isAutomaticInspection = false, bool automaticallyPause = false);
+ virtual void sendMessageToTarget(NSString *);
+ virtual void close();
+ virtual void targetClosed();
+
+ Optional<unsigned> targetIdentifier() const;
+ NSString *connectionIdentifier() const;
+ NSString *destination() const;
+
+ Lock& queueMutex() { return m_queueMutex; }
+ const RemoteTargetQueue& queue() const { return m_queue; }
+ void clearQueue() { m_queue.clear(); }
+
+ // FrontendChannel overrides.
+ virtual ConnectionType connectionType() const override { return ConnectionType::Remote; }
+ virtual bool sendMessageToFrontend(const String&) override;
+
+private:
+ void dispatchAsyncOnTarget(void (^block)());
+
+ void setupRunLoop();
+ void teardownRunLoop();
+ void queueTaskOnPrivateRunLoop(void (^block)());
+
+ // This connection from the RemoteInspector singleton to the InspectionTarget
+ // can be used on multiple threads. So any access to the target
+ // itself must take this mutex to ensure m_target is valid.
+ Lock m_targetMutex;
+
+ // If a target has a specific run loop it wants to evaluate on
+ // we setup our run loop sources on that specific run loop.
+ RetainPtr<CFRunLoopRef> m_runLoop;
+ RetainPtr<CFRunLoopSourceRef> m_runLoopSource;
+ RemoteTargetQueue m_queue;
+ Lock m_queueMutex;
+
+ RemoteControllableTarget* m_target { nullptr };
+ RetainPtr<NSString> m_connectionIdentifier;
+ RetainPtr<NSString> m_destination;
+ bool m_connected { false };
+};
+
+} // namespace Inspector
+
+#endif // RemoteConnectionToTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp
new file mode 100644
index 000000000..f52852b15
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteControllableTarget.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include "RemoteInspector.h"
+
+namespace Inspector {
+
+RemoteControllableTarget::~RemoteControllableTarget()
+{
+ RemoteInspector::singleton().unregisterTarget(this);
+}
+
+void RemoteControllableTarget::init()
+{
+ RemoteInspector::singleton().registerTarget(this);
+}
+
+void RemoteControllableTarget::update()
+{
+ RemoteInspector::singleton().updateTarget(this);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
new file mode 100644
index 000000000..349ad9ece
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteControllableTarget_h
+#define RemoteControllableTarget_h
+
+#include <CoreFoundation/CFRunLoop.h>
+#include <wtf/TypeCasts.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteControllableTarget {
+public:
+ virtual ~RemoteControllableTarget();
+
+ void init();
+ void update();
+
+ virtual void connect(FrontendChannel*, bool isAutomaticConnection = false) = 0;
+ virtual void disconnect(FrontendChannel*) = 0;
+
+ unsigned targetIdentifier() const { return m_identifier; }
+ void setTargetIdentifier(unsigned identifier) { m_identifier = identifier; }
+
+ enum class Type { JavaScript, Web, Automation };
+ virtual Type type() const = 0;
+ virtual bool remoteControlAllowed() const = 0;
+ virtual void dispatchMessageFromRemote(const String& message) = 0;
+
+ // The dispatch block will be scheduled on a global run loop if null is returned.
+ virtual CFRunLoopRef targetRunLoop() { return nullptr; }
+private:
+ unsigned m_identifier {0};
+};
+
+} // namespace Inspector
+
+#define SPECIALIZE_TYPE_TRAITS_CONTROLLABLE_TARGET(ToClassName, ToClassType) \
+SPECIALIZE_TYPE_TRAITS_BEGIN(ToClassName) \
+ static bool isType(const Inspector::RemoteControllableTarget& target) { return target.type() == Inspector::RemoteControllableTarget::Type::ToClassType; } \
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // RemoteControllableTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp
new file mode 100644
index 000000000..5d5f3ebc7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteInspectionTarget.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include "EventLoop.h"
+#include "RemoteInspector.h"
+
+namespace Inspector {
+
+bool RemoteInspectionTarget::remoteControlAllowed() const
+{
+ return remoteDebuggingAllowed() || hasLocalDebugger();
+}
+
+void RemoteInspectionTarget::setRemoteDebuggingAllowed(bool allowed)
+{
+ if (m_allowed == allowed)
+ return;
+
+ m_allowed = allowed;
+
+ if (m_allowed && automaticInspectionAllowed())
+ RemoteInspector::singleton().updateAutomaticInspectionCandidate(this);
+ else
+ RemoteInspector::singleton().updateTarget(this);
+}
+
+void RemoteInspectionTarget::pauseWaitingForAutomaticInspection()
+{
+ ASSERT(targetIdentifier());
+ ASSERT(m_allowed);
+ ASSERT(automaticInspectionAllowed());
+
+ EventLoop loop;
+ while (RemoteInspector::singleton().waitingForAutomaticInspection(targetIdentifier()) && !loop.ended())
+ loop.cycle();
+}
+
+void RemoteInspectionTarget::unpauseForInitializedInspector()
+{
+ RemoteInspector::singleton().setupCompleted(targetIdentifier());
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h
new file mode 100644
index 000000000..f595ddffd
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2013, 2015 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectionTarget_h
+#define RemoteInspectionTarget_h
+
+#include "RemoteControllableTarget.h"
+#include <wtf/RetainPtr.h>
+#include <wtf/TypeCasts.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendChannel;
+
+class JS_EXPORT_PRIVATE RemoteInspectionTarget : public RemoteControllableTarget {
+public:
+ bool remoteDebuggingAllowed() const { return m_allowed; }
+ void setRemoteDebuggingAllowed(bool);
+
+ CFRunLoopRef targetRunLoop() override { return m_runLoop.get(); }
+ void setTargetRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; }
+
+ virtual String name() const { return String(); } // JavaScript and Web
+ virtual String url() const { return String(); } // Web
+ virtual bool hasLocalDebugger() const = 0;
+
+ virtual void setIndicating(bool) { } // Default is to do nothing.
+ virtual void pause() { };
+
+ virtual bool automaticInspectionAllowed() const { return false; }
+ virtual void pauseWaitingForAutomaticInspection();
+ virtual void unpauseForInitializedInspector();
+
+ // RemoteControllableTarget overrides.
+ virtual bool remoteControlAllowed() const override;
+private:
+ bool m_allowed {false};
+ RetainPtr<CFRunLoopRef> m_runLoop;
+};
+
+} // namespace Inspector
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(Inspector::RemoteInspectionTarget) \
+ static bool isType(const Inspector::RemoteControllableTarget& target) \
+ { \
+ return target.type() == Inspector::RemoteControllableTarget::Type::JavaScript \
+ || target.type() == Inspector::RemoteControllableTarget::Type::Web; \
+ }
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // RemoteInspectionTarget_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h
new file mode 100644
index 000000000..3f2c50f88
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2013, 2015, 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspector_h
+#define RemoteInspector_h
+
+#import "RemoteInspectorXPCConnection.h"
+#import <wtf/Forward.h>
+#import <wtf/HashMap.h>
+#import <wtf/Lock.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Vector.h>
+
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+class RemoteAutomationTarget;
+class RemoteConnectionToTarget;
+class RemoteControllableTarget;
+class RemoteInspectionTarget;
+class RemoteInspectorClient;
+
+class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client {
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual bool remoteAutomationAllowed() const = 0;
+ virtual void requestAutomationSession(const String& sessionIdentifier) = 0;
+ };
+
+ static void startDisabled();
+ static RemoteInspector& singleton();
+ friend class NeverDestroyed<RemoteInspector>;
+
+ void registerTarget(RemoteControllableTarget*);
+ void unregisterTarget(RemoteControllableTarget*);
+ void updateTarget(RemoteControllableTarget*);
+ void sendMessageToRemote(unsigned targetIdentifier, const String& message);
+
+ void updateAutomaticInspectionCandidate(RemoteInspectionTarget*);
+ void setRemoteInspectorClient(RemoteInspector::Client*);
+
+ void setupFailed(unsigned targetIdentifier);
+ void setupCompleted(unsigned targetIdentifier);
+ bool waitingForAutomaticInspection(unsigned targetIdentifier);
+ void clientCapabilitiesDidChange() { pushListingsSoon(); }
+
+ bool enabled() const { return m_enabled; }
+ bool hasActiveDebugSession() const { return m_hasActiveDebugSession; }
+
+ void start();
+ void stop();
+
+ bool hasParentProcessInformation() const { return m_parentProcessIdentifier != 0; }
+ pid_t parentProcessIdentifier() const { return m_parentProcessIdentifier; }
+ RetainPtr<CFDataRef> parentProcessAuditData() const { return m_parentProcessAuditData; }
+ void setParentProcessInformation(pid_t, RetainPtr<CFDataRef> auditData);
+ void setParentProcessInfomationIsDelayed();
+
+private:
+ RemoteInspector();
+
+ unsigned nextAvailableTargetIdentifier();
+
+ enum class StopSource { API, XPCMessage };
+ void stopInternal(StopSource);
+
+ void setupXPCConnectionIfNeeded();
+
+ RetainPtr<NSDictionary> listingForTarget(const RemoteControllableTarget&) const;
+ RetainPtr<NSDictionary> listingForInspectionTarget(const RemoteInspectionTarget&) const;
+ RetainPtr<NSDictionary> listingForAutomationTarget(const RemoteAutomationTarget&) const;
+ void pushListingsNow();
+ void pushListingsSoon();
+
+ void updateHasActiveDebugSession();
+
+ void sendAutomaticInspectionCandidateMessage();
+
+ virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) override;
+ virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) override;
+ virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) override;
+
+ void receivedSetupMessage(NSDictionary *userInfo);
+ void receivedDataMessage(NSDictionary *userInfo);
+ void receivedDidCloseMessage(NSDictionary *userInfo);
+ void receivedGetListingMessage(NSDictionary *userInfo);
+ void receivedIndicateMessage(NSDictionary *userInfo);
+ void receivedProxyApplicationSetupMessage(NSDictionary *userInfo);
+ void receivedConnectionDiedMessage(NSDictionary *userInfo);
+ void receivedAutomaticInspectionConfigurationMessage(NSDictionary *userInfo);
+ void receivedAutomaticInspectionRejectMessage(NSDictionary *userInfo);
+ void receivedAutomationSessionRequestMessage(NSDictionary *userInfo);
+
+ static bool startEnabled;
+
+ // Targets can be registered from any thread at any time.
+ // Any target can send messages over the XPC connection.
+ // So lock access to all maps and state as they can change
+ // from any thread.
+ Lock m_mutex;
+
+ HashMap<unsigned, RemoteControllableTarget*> m_targetMap;
+ HashMap<unsigned, RetainPtr<NSDictionary>> m_targetListingMap;
+ HashMap<unsigned, RefPtr<RemoteConnectionToTarget>> m_targetConnectionMap;
+
+ RefPtr<RemoteInspectorXPCConnection> m_relayConnection;
+
+ RemoteInspector::Client* m_client { nullptr };
+
+ dispatch_queue_t m_xpcQueue;
+ unsigned m_nextAvailableTargetIdentifier { 1 };
+ int m_notifyToken { 0 };
+ bool m_enabled { false };
+ bool m_hasActiveDebugSession { false };
+ bool m_pushScheduled { false };
+
+ pid_t m_parentProcessIdentifier { 0 };
+ RetainPtr<CFDataRef> m_parentProcessAuditData;
+ bool m_shouldSendParentProcessInformation { false };
+ bool m_automaticInspectionEnabled { false };
+ bool m_automaticInspectionPaused { false };
+ unsigned m_automaticInspectionCandidateTargetIdentifier { 0 };
+};
+
+} // namespace Inspector
+
+#endif // RemoteInspector_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h
new file mode 100644
index 000000000..db1806c59
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011, 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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 RemoteInspectorConstants_h
+#define RemoteInspectorConstants_h
+
+// WIRConstants are "Web Inspector Relay" constants shared between
+// the WebInspector framework on the OS X side, webinspectord, and
+// iOS WebKit on the device side.
+
+#define WIRSimulatorTCPPortNumber 27753
+#define WIRXPCMachPortName "com.apple.webinspector"
+#define WIRXPCDebuggerServiceName "com.apple.webinspector.debugger"
+#define WIRServiceAvailableNotification "com.apple.webinspectord.available"
+#define WIRServiceAvailabilityCheckNotification "com.apple.webinspectord.availability_check"
+#define WIRServiceEnabledNotification "com.apple.webinspectord.enabled"
+#define WIRServiceDisabledNotification "com.apple.webinspectord.disabled"
+#define WIRAutomaticInspectionEnabledState "com.apple.webinspectord.automatic_inspection_enabled"
+
+
+#define WIRApplicationIdentifierKey @"WIRApplicationIdentifierKey"
+#define WIRApplicationBundleIdentifierKey @"WIRApplicationBundleIdentifierKey"
+#define WIRApplicationNameKey @"WIRApplicationNameKey"
+#define WIRIsApplicationProxyKey @"WIRIsApplicationProxyKey"
+#define WIRIsApplicationActiveKey @"WIRIsApplicationActiveKey"
+#define WIRHostApplicationIdentifierKey @"WIRHostApplicationIdentifierKey"
+#define WIRHostApplicationNameKey @"WIRHostApplicationNameKey"
+#define WIRConnectionIdentifierKey @"WIRConnectionIdentifierKey"
+// COMPATABILITY(iOS 9): The key string is intentionally mismatched to support old relays.
+#define WIRTargetIdentifierKey @"WIRPageIdentifierKey"
+#define WIRHasLocalDebuggerKey @"WIRHasLocalDebuggerKey"
+#define WIRTitleKey @"WIRTitleKey"
+#define WIRURLKey @"WIRURLKey"
+#define WIRUserInfoKey @"WIRUserInfoKey"
+#define WIRApplicationDictionaryKey @"WIRApplicationDictionaryKey"
+#define WIRMessageDataKey @"WIRMessageDataKey"
+#define WIRApplicationGetListingMessage @"WIRApplicationGetListingMessage"
+#define WIRIndicateMessage @"WIRIndicateMessage"
+#define WIRIndicateEnabledKey @"WIRIndicateEnabledKey"
+#define WIRSenderKey @"WIRSenderKey"
+#define WIRSocketDataKey @"WIRSocketDataKey"
+#define WIRSocketDataMessage @"WIRSocketDataMessage"
+#define WIRSocketSetupMessage @"WIRSocketSetupMessage"
+#define WIRWebPageCloseMessage @"WIRWebPageCloseMessage"
+#define WIRRawDataMessage @"WIRRawDataMessage"
+#define WIRRawDataKey @"WIRRawDataKey"
+#define WIRListingMessage @"WIRListingMessage"
+#define WIRListingKey @"WIRListingKey"
+#define WIRRemoteAutomationEnabledKey @"WIRRemoteAutomationEnabledKey"
+#define WIRDestinationKey @"WIRDestinationKey"
+#define WIRConnectionDiedMessage @"WIRConnectionDiedMessage"
+#define WIRTypeKey @"WIRTypeKey"
+#define WIRTypeJavaScript @"WIRTypeJavaScript"
+#define WIRTypeWeb @"WIRTypeWeb"
+#define WIRTypeAutomation @"WIRTypeAutomation"
+#define WIRAutomaticallyPause @"WIRAutomaticallyPause"
+
+#define WIRAutomaticInspectionEnabledKey @"WIRAutomaticInspectionEnabledKey"
+#define WIRAutomaticInspectionSessionIdentifierKey @"WIRAutomaticInspectionSessionIdentifierKey"
+#define WIRAutomaticInspectionConfigurationMessage @"WIRAutomaticInspectionConfigurationMessage"
+#define WIRAutomaticInspectionRejectMessage @"WIRAutomaticInspectionRejectMessage"
+#define WIRAutomaticInspectionCandidateMessage @"WIRAutomaticInspectionCandidateMessage"
+
+#define WIRAutomationTargetIsPairedKey @"WIRAutomationTargetIsPairedKey"
+#define WIRSessionIdentifierKey @"WIRSessionIdentifierKey"
+#define WIRAutomationSessionRequestMessage @"WIRAutomationSessionRequestMessage"
+
+// These definitions are shared with a Simulator webinspectord and
+// OS X process communicating with it.
+
+#define WIRSimulatorBuildKey @"WIRSimulatorBuildKey"
+#define WIRSimulatorProductVersionKey @"WIRSimulatorProductVersionKey"
+#define WIRSimulatorNameKey @"WIRSimulatorNameKey"
+
+// These definitions are shared between webinspectord and WebKit.
+
+#define WIRPermissionDenied @"WIRPermissionDenied"
+#define WIRProxyApplicationParentPIDKey @"WIRProxyApplicationParentPID"
+#define WIRProxyApplicationParentAuditDataKey @"WIRProxyApplicationParentAuditData"
+#define WIRProxyApplicationSetupMessage @"WIRProxyApplicationSetupMessage"
+#define WIRProxyApplicationSetupResponseMessage @"WIRProxyApplicationSetupResponseMessage"
+
+#endif
diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h
new file mode 100644
index 000000000..ef04c2341
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * 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.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectorXPCConnection_h
+#define RemoteInspectorXPCConnection_h
+
+#import <dispatch/dispatch.h>
+#import <wtf/Lock.h>
+#import <wtf/ThreadSafeRefCounted.h>
+#import <wtf/spi/darwin/XPCSPI.h>
+
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+class RemoteInspectorXPCConnection : public ThreadSafeRefCounted<RemoteInspectorXPCConnection> {
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) = 0;
+ virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) = 0;
+ virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) = 0;
+ };
+
+ RemoteInspectorXPCConnection(xpc_connection_t, dispatch_queue_t, Client*);
+ virtual ~RemoteInspectorXPCConnection();
+
+ void close();
+ void closeFromMessage();
+ void sendMessage(NSString *messageName, NSDictionary *userInfo);
+
+private:
+ NSDictionary *deserializeMessage(xpc_object_t);
+ void handleEvent(xpc_object_t);
+ void closeOnQueue();
+
+ // We handle XPC events on the queue, but a client may call close() on any queue.
+ // We make sure that m_client is thread safe and immediately cleared in close().
+ Lock m_mutex;
+
+ xpc_connection_t m_connection;
+ dispatch_queue_t m_queue;
+ Client* m_client;
+ bool m_closed { false };
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000)
+ bool m_validated { false };
+#endif
+};
+
+} // namespace Inspector
+
+#endif // RemoteInspectorXPCConnection_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py b/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py
new file mode 100644
index 000000000..6077fa97a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py
@@ -0,0 +1,24 @@
+# Required for Python to search this directory for module files
+
+from models import *
+from generator import *
+from cpp_generator import *
+from objc_generator import *
+
+from generate_cpp_alternate_backend_dispatcher_header import *
+from generate_cpp_backend_dispatcher_header import *
+from generate_cpp_backend_dispatcher_implementation import *
+from generate_cpp_frontend_dispatcher_header import *
+from generate_cpp_frontend_dispatcher_implementation import *
+from generate_cpp_protocol_types_header import *
+from generate_cpp_protocol_types_implementation import *
+from generate_js_backend_commands import *
+from generate_objc_backend_dispatcher_header import *
+from generate_objc_backend_dispatcher_implementation import *
+from generate_objc_configuration_header import *
+from generate_objc_configuration_implementation import *
+from generate_objc_conversion_helpers import *
+from generate_objc_frontend_dispatcher_implementation import *
+from generate_objc_header import *
+from generate_objc_internal_header import *
+from generate_objc_protocol_types_implementation import *
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
new file mode 100644
index 000000000..edd330da4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
@@ -0,0 +1,314 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import os.path
+import re
+
+from generator import ucfirst
+from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
+
+log = logging.getLogger('global')
+
+_PRIMITIVE_TO_CPP_NAME_MAP = {
+ 'boolean': 'bool',
+ 'integer': 'int',
+ 'number': 'double',
+ 'string': 'String',
+ 'object': 'Inspector::InspectorObject',
+ 'array': 'Inspector::InspectorArray',
+ 'any': 'Inspector::InspectorValue'
+}
+
+# This class contains extra static methods used for generation, but does
+# not participate in any inheritance hierarchy. File generators should
+# extend the generic "Generator" class instead.
+class CppGenerator:
+
+ # Miscellaneous text manipulation routines.
+ @staticmethod
+ def cpp_getter_method_for_type(_type):
+ if isinstance(_type, ObjectType):
+ return 'getObject'
+ if isinstance(_type, ArrayType):
+ return 'getArray'
+ if isinstance(_type, PrimitiveType):
+ if _type.raw_name() is 'integer':
+ return 'getInteger'
+ elif _type.raw_name() is 'number':
+ return 'getDouble'
+ elif _type.raw_name() is 'any':
+ return 'getValue'
+ else:
+ return 'get' + ucfirst(_type.raw_name())
+ if isinstance(_type, AliasedType):
+ return CppGenerator.cpp_getter_method_for_type(_type.aliased_type)
+ if isinstance(_type, EnumType):
+ return CppGenerator.cpp_getter_method_for_type(_type.primitive_type)
+
+ @staticmethod
+ def cpp_setter_method_for_type(_type):
+ if isinstance(_type, ObjectType):
+ return 'setObject'
+ if isinstance(_type, ArrayType):
+ return 'setArray'
+ if isinstance(_type, PrimitiveType):
+ if _type.raw_name() is 'integer':
+ return 'setInteger'
+ elif _type.raw_name() is 'number':
+ return 'setDouble'
+ elif _type.raw_name() is 'any':
+ return 'setValue'
+ else:
+ return 'set' + ucfirst(_type.raw_name())
+ if isinstance(_type, AliasedType):
+ return CppGenerator.cpp_setter_method_for_type(_type.aliased_type)
+ if isinstance(_type, EnumType):
+ return CppGenerator.cpp_setter_method_for_type(_type.primitive_type)
+
+ # Generate type representations for various situations.
+ @staticmethod
+ def cpp_protocol_type_for_type(_type):
+ if isinstance(_type, ObjectType) and len(_type.members) == 0:
+ return 'Inspector::InspectorObject'
+ if isinstance(_type, ArrayType):
+ if _type.raw_name() is None: # Otherwise, fall through and use typedef'd name.
+ return 'Inspector::Protocol::Array<%s>' % CppGenerator.cpp_protocol_type_for_type(_type.element_type)
+ if isinstance(_type, (ObjectType, AliasedType, EnumType, ArrayType)):
+ return 'Inspector::Protocol::%s::%s' % (_type.type_domain().domain_name, _type.raw_name())
+ if isinstance(_type, PrimitiveType):
+ return CppGenerator.cpp_name_for_primitive_type(_type)
+
+ @staticmethod
+ def cpp_protocol_type_for_type_member(type_member, object_declaration):
+ if isinstance(type_member.type, EnumType) and type_member.type.is_anonymous:
+ return '::'.join([CppGenerator.cpp_protocol_type_for_type(object_declaration.type), ucfirst(type_member.member_name)])
+ else:
+ return CppGenerator.cpp_protocol_type_for_type(type_member.type)
+
+ @staticmethod
+ def cpp_type_for_unchecked_formal_in_parameter(parameter):
+ _type = parameter.type
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through to enum or primitive.
+
+ if isinstance(_type, EnumType):
+ _type = _type.primitive_type # Fall through to primitive.
+
+ # This handles the 'any' type and objects with defined properties.
+ if isinstance(_type, ObjectType) or _type.qualified_name() is 'object':
+ cpp_name = 'Inspector::InspectorObject'
+ if parameter.is_optional:
+ return 'const %s*' % cpp_name
+ else:
+ return 'const %s&' % cpp_name
+ if isinstance(_type, ArrayType):
+ cpp_name = 'Inspector::InspectorArray'
+ if parameter.is_optional:
+ return 'const %s*' % cpp_name
+ else:
+ return 'const %s&' % cpp_name
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if parameter.is_optional:
+ return 'const %s*' % cpp_name
+ elif _type.raw_name() in ['string']:
+ return 'const %s&' % cpp_name
+ else:
+ return cpp_name
+
+ return "unknown_unchecked_formal_in_parameter_type"
+
+ @staticmethod
+ def cpp_type_for_checked_formal_event_parameter(parameter):
+ return CppGenerator.cpp_type_for_type_with_name(parameter.type, parameter.parameter_name, parameter.is_optional)
+
+ @staticmethod
+ def cpp_type_for_type_member(member):
+ return CppGenerator.cpp_type_for_type_with_name(member.type, member.member_name, False)
+
+ @staticmethod
+ def cpp_type_for_type_with_name(_type, type_name, is_optional):
+ if isinstance(_type, (ArrayType, ObjectType)):
+ return 'RefPtr<%s>' % CppGenerator.cpp_protocol_type_for_type(_type)
+ if isinstance(_type, AliasedType):
+ builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
+ if is_optional:
+ return 'const %s* const' % builder_type
+ elif _type.aliased_type.qualified_name() in ['integer', 'number']:
+ return CppGenerator.cpp_name_for_primitive_type(_type.aliased_type)
+ elif _type.aliased_type.qualified_name() in ['string']:
+ return 'const %s&' % builder_type
+ else:
+ return builder_type
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if _type.qualified_name() in ['object']:
+ return 'RefPtr<Inspector::InspectorObject>'
+ elif _type.qualified_name() in ['any']:
+ return 'RefPtr<Inspector::InspectorValue>'
+ elif is_optional:
+ return 'const %s* const' % cpp_name
+ elif _type.qualified_name() in ['string']:
+ return 'const %s&' % cpp_name
+ else:
+ return cpp_name
+ if isinstance(_type, EnumType):
+ if _type.is_anonymous:
+ enum_type_name = ucfirst(type_name)
+ else:
+ enum_type_name = 'Inspector::Protocol::%s::%s' % (_type.type_domain().domain_name, _type.raw_name())
+
+ if is_optional:
+ return '%s*' % enum_type_name
+ else:
+ return '%s' % enum_type_name
+
+ @staticmethod
+ def cpp_type_for_formal_out_parameter(parameter):
+ _type = parameter.type
+
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through.
+
+ if isinstance(_type, (ObjectType, ArrayType)):
+ return 'RefPtr<%s>&' % CppGenerator.cpp_protocol_type_for_type(_type)
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if parameter.is_optional:
+ return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
+ else:
+ return '%s*' % cpp_name
+ if isinstance(_type, EnumType):
+ if _type.is_anonymous:
+ return '%sBackendDispatcherHandler::%s*' % (_type.type_domain().domain_name, ucfirst(parameter.parameter_name))
+ else:
+ return 'Inspector::Protocol::%s::%s*' % (_type.type_domain().domain_name, _type.raw_name())
+
+ raise ValueError("unknown formal out parameter type.")
+
+ # FIXME: this is only slightly different from out parameters; they could be unified.
+ @staticmethod
+ def cpp_type_for_formal_async_parameter(parameter):
+ _type = parameter.type
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through.
+
+ if isinstance(_type, EnumType):
+ _type = _type.primitive_type # Fall through.
+
+ if isinstance(_type, (ObjectType, ArrayType)):
+ return 'RefPtr<%s>&&' % CppGenerator.cpp_protocol_type_for_type(_type)
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if parameter.is_optional:
+ return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
+ elif _type.qualified_name() in ['integer', 'number']:
+ return CppGenerator.cpp_name_for_primitive_type(_type)
+ elif _type.qualified_name() in ['string']:
+ return 'const %s&' % cpp_name
+ else:
+ return cpp_name
+
+ raise ValueError("Unknown formal async parameter type.")
+
+ # In-parameters don't use builder types, because they could be passed
+ # "open types" that are manually constructed out of InspectorObjects.
+
+ # FIXME: Only parameters that are actually open types should need non-builder parameter types.
+ @staticmethod
+ def cpp_type_for_stack_in_parameter(parameter):
+ _type = parameter.type
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through.
+
+ if isinstance(_type, EnumType):
+ _type = _type.primitive_type # Fall through.
+
+ if isinstance(_type, ObjectType):
+ return "RefPtr<Inspector::InspectorObject>"
+ if isinstance(_type, ArrayType):
+ return "RefPtr<Inspector::InspectorArray>"
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if _type.qualified_name() in ['any', 'object']:
+ return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type)
+ elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']:
+ return "Inspector::Protocol::OptOutput<%s>" % cpp_name
+ else:
+ return cpp_name
+
+ @staticmethod
+ def cpp_type_for_stack_out_parameter(parameter):
+ _type = parameter.type
+ if isinstance(_type, (ArrayType, ObjectType)):
+ return 'RefPtr<%s>' % CppGenerator.cpp_protocol_type_for_type(_type)
+ if isinstance(_type, AliasedType):
+ builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
+ if parameter.is_optional:
+ return "Inspector::Protocol::OptOutput<%s>" % builder_type
+ return '%s' % builder_type
+ if isinstance(_type, PrimitiveType):
+ cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
+ if parameter.is_optional:
+ return "Inspector::Protocol::OptOutput<%s>" % cpp_name
+ else:
+ return cpp_name
+ if isinstance(_type, EnumType):
+ if _type.is_anonymous:
+ return '%sBackendDispatcherHandler::%s' % (_type.type_domain().domain_name, ucfirst(parameter.parameter_name))
+ else:
+ return 'Inspector::Protocol::%s::%s' % (_type.type_domain().domain_name, _type.raw_name())
+
+ @staticmethod
+ def cpp_assertion_method_for_type_member(type_member, object_declaration):
+
+ def assertion_method_for_type(_type):
+ return 'BindingTraits<%s>::assertValueHasExpectedType' % CppGenerator.cpp_protocol_type_for_type(_type)
+
+ if isinstance(type_member.type, AliasedType):
+ return assertion_method_for_type(type_member.type.aliased_type)
+ if isinstance(type_member.type, EnumType) and type_member.type.is_anonymous:
+ return 'BindingTraits<%s>::assertValueHasExpectedType' % CppGenerator.cpp_protocol_type_for_type_member(type_member, object_declaration)
+
+ return assertion_method_for_type(type_member.type)
+
+ @staticmethod
+ def cpp_name_for_primitive_type(_type):
+ return _PRIMITIVE_TO_CPP_NAME_MAP.get(_type.raw_name())
+
+ # Decide whether certain helpers are necessary in a situation.
+ @staticmethod
+ def should_use_wrapper_for_return_type(_type):
+ return not isinstance(_type, (ArrayType, ObjectType))
+
+ @staticmethod
+ def should_use_references_for_type(_type):
+ return isinstance(_type, (ArrayType, ObjectType)) or (isinstance(_type, (PrimitiveType)) and _type.qualified_name() in ["any", "object"])
+
+ @staticmethod
+ def should_pass_by_copy_for_return_type(_type):
+ return isinstance(_type, (ArrayType, ObjectType)) or (isinstance(_type, (PrimitiveType)) and _type.qualified_name() == "object")
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
new file mode 100755
index 000000000..c856feb42
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
@@ -0,0 +1,265 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# Generator templates, which can be filled with string.Template.
+# Following are classes that fill the templates from the typechecked model.
+
+class CppGeneratorTemplates:
+
+ HeaderPrelude = (
+ """#ifndef ${headerGuardString}
+#define ${headerGuardString}
+
+${includes}
+
+namespace Inspector {
+
+${typedefs}""")
+
+ HeaderPostlude = (
+ """} // namespace Inspector
+
+#endif // !defined(${headerGuardString})""")
+
+ ImplementationPrelude = (
+ """#include "config.h"
+#include ${primaryInclude}
+
+${secondaryIncludes}
+
+namespace Inspector {""")
+
+ ImplementationPostlude = (
+ """} // namespace Inspector
+""")
+
+ AlternateDispatchersHeaderPrelude = (
+ """#ifndef ${headerGuardString}
+#define ${headerGuardString}
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+${includes}
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+""")
+
+ AlternateDispatchersHeaderPostlude = (
+ """} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(${headerGuardString})""")
+
+ AlternateBackendDispatcherHeaderDomainHandlerInterfaceDeclaration = (
+ """class Alternate${domainName}BackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~Alternate${domainName}BackendDispatcher() { }
+${commandDeclarations}
+};""")
+
+ BackendDispatcherHeaderDomainHandlerDeclaration = (
+ """${classAndExportMacro} ${domainName}BackendDispatcherHandler {
+public:
+${commandDeclarations}
+protected:
+ virtual ~${domainName}BackendDispatcherHandler();
+};""")
+
+ BackendDispatcherHeaderDomainDispatcherDeclaration = (
+ """${classAndExportMacro} ${domainName}BackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<${domainName}BackendDispatcher> create(BackendDispatcher&, ${domainName}BackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+${commandDeclarations}
+private:
+ ${domainName}BackendDispatcher(BackendDispatcher&, ${domainName}BackendDispatcherHandler*);
+ ${domainName}BackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(Alternate${domainName}BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ Alternate${domainName}BackendDispatcher* m_alternateDispatcher;
+#endif
+};""")
+
+ BackendDispatcherHeaderAsyncCommandDeclaration = (
+ """ ${classAndExportMacro} ${callbackName} : public BackendDispatcher::CallbackBase {
+ public:
+ ${callbackName}(Ref<BackendDispatcher>&&, int id);
+ void sendSuccess(${outParameters});
+ };
+ virtual void ${commandName}(${inParameters}) = 0;""")
+
+ BackendDispatcherImplementationSmallSwitch = (
+ """void ${domainName}BackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<${domainName}BackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+${dispatchCases}
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
+}""")
+
+ BackendDispatcherImplementationLargeSwitch = (
+"""void ${domainName}BackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<${domainName}BackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ typedef void (${domainName}BackendDispatcher::*CallHandler)(long requestId, RefPtr<InspectorObject>&& message);
+ typedef HashMap<String, CallHandler> DispatchMap;
+ static NeverDestroyed<DispatchMap> dispatchMap;
+ if (dispatchMap.get().isEmpty()) {
+ static const struct MethodTable {
+ const char* name;
+ CallHandler handler;
+ } commands[] = {
+${dispatchCases}
+ };
+ size_t length = WTF_ARRAY_LENGTH(commands);
+ for (size_t i = 0; i < length; ++i)
+ dispatchMap.get().add(commands[i].name, commands[i].handler);
+ }
+
+ auto findResult = dispatchMap.get().find(method);
+ if (findResult == dispatchMap.get().end()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
+ return;
+ }
+
+ ((*this).*findResult->value)(requestId, WTFMove(parameters));
+}""")
+
+ BackendDispatcherImplementationDomainConstructor = (
+ """Ref<${domainName}BackendDispatcher> ${domainName}BackendDispatcher::create(BackendDispatcher& backendDispatcher, ${domainName}BackendDispatcherHandler* agent)
+{
+ return adoptRef(*new ${domainName}BackendDispatcher(backendDispatcher, agent));
+}
+
+${domainName}BackendDispatcher::${domainName}BackendDispatcher(BackendDispatcher& backendDispatcher, ${domainName}BackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("${domainName}"), this);
+}""")
+
+ BackendDispatcherImplementationPrepareCommandArguments = (
+"""${inParameterDeclarations}
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}"));
+ return;
+ }
+""")
+
+ BackendDispatcherImplementationAsyncCommand = (
+"""${domainName}BackendDispatcherHandler::${callbackName}::${callbackName}(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { }
+
+void ${domainName}BackendDispatcherHandler::${callbackName}::sendSuccess(${formalParameters})
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+${outParameterAssignments}
+ CallbackBase::sendSuccess(WTFMove(jsonMessage));
+}""")
+
+ FrontendDispatcherDomainDispatcherDeclaration = (
+"""${classAndExportMacro} ${domainName}FrontendDispatcher {
+public:
+ ${domainName}FrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
+${eventDeclarations}
+private:
+ FrontendRouter& m_frontendRouter;
+};""")
+
+ ProtocolObjectBuilderDeclarationPrelude = (
+""" template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*${objectType}*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class ${objectType};
+ public:""")
+
+ ProtocolObjectBuilderDeclarationPostlude = (
+"""
+ Ref<${objectType}> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(${objectType}) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<${objectType}>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+${constructorExample}
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }""")
+
+ ProtocolObjectRuntimeCast = (
+"""RefPtr<${objectType}> BindingTraits<${objectType}>::runtimeCast(RefPtr<InspectorValue>&& value)
+{
+ RefPtr<InspectorObject> result;
+ bool castSucceeded = value->asObject(result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+#if !ASSERT_DISABLED
+ BindingTraits<${objectType}>::assertValueHasExpectedType(result.get());
+#endif // !ASSERT_DISABLED
+ COMPILE_ASSERT(sizeof(${objectType}) == sizeof(InspectorObjectBase), type_cast_problem);
+ return static_cast<${objectType}*>(static_cast<InspectorObjectBase*>(result.get()));
+}
+""")
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py
new file mode 100755
index 000000000..375ce05ca
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+import re
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator
+
+log = logging.getLogger('global')
+
+
+class CppAlternateBackendDispatcherHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return 'InspectorAlternateBackendDispatchers.h'
+
+ def generate_output(self):
+ headers = [
+ '"InspectorProtocolTypes.h"',
+ '<inspector/InspectorFrontendRouter.h>',
+ '<JavaScriptCore/InspectorBackendDispatcher.h>',
+ ]
+
+ header_args = {
+ 'headerGuardString': re.sub('\W+', '_', self.output_filename()),
+ 'includes': '\n'.join(['#include ' + header for header in headers]),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.AlternateDispatchersHeaderPrelude).substitute(None, **header_args))
+ sections.append('\n'.join(filter(None, map(self._generate_handler_declarations_for_domain, domains))))
+ sections.append(Template(CppTemplates.AlternateDispatchersHeaderPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_handler_declarations_for_domain(self, domain):
+ if not domain.commands:
+ return ''
+
+ command_declarations = []
+ for command in domain.commands:
+ command_declarations.append(self._generate_handler_declaration_for_command(command))
+
+ handler_args = {
+ 'domainName': domain.domain_name,
+ 'commandDeclarations': '\n'.join(command_declarations),
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.AlternateBackendDispatcherHeaderDomainHandlerInterfaceDeclaration).substitute(None, **handler_args))
+
+ def _generate_handler_declaration_for_command(self, command):
+ lines = []
+ parameters = ['long callId']
+ for _parameter in command.call_parameters:
+ parameters.append('%s in_%s' % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(_parameter), _parameter.parameter_name))
+
+ command_args = {
+ 'commandName': command.command_name,
+ 'parameters': ', '.join(parameters),
+ }
+ lines.append(' virtual void %(commandName)s(%(parameters)s) = 0;' % command_args)
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
new file mode 100755
index 000000000..2e5ff7a6a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py
@@ -0,0 +1,208 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import EnumType
+
+log = logging.getLogger('global')
+
+
+class CppBackendDispatcherHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorBackendDispatchers.h"
+
+ def domains_to_generate(self):
+ return filter(lambda domain: len(domain.commands) > 0, Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ headers = [
+ '"InspectorProtocolObjects.h"',
+ '<inspector/InspectorBackendDispatcher.h>',
+ '<wtf/text/WTFString.h>']
+
+ typedefs = [('String', 'ErrorString')]
+
+ header_args = {
+ 'headerGuardString': re.sub('\W+', '_', self.output_filename()),
+ 'includes': '\n'.join(['#include ' + header for header in headers]),
+ 'typedefs': '\n'.join(['typedef %s %s;' % typedef for typedef in typedefs]),
+ }
+
+ domains = self.domains_to_generate()
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
+ sections.append(self._generate_alternate_handler_forward_declarations_for_domains(domains))
+ sections.extend(map(self._generate_handler_declarations_for_domain, domains))
+ sections.extend(map(self._generate_dispatcher_declarations_for_domain, domains))
+ sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ def _generate_alternate_handler_forward_declarations_for_domains(self, domains):
+ if not domains:
+ return ''
+
+ lines = []
+ lines.append('#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
+ for domain in domains:
+ lines.append(self.wrap_with_guard_for_domain(domain, 'class Alternate%sBackendDispatcher;' % domain.domain_name))
+ lines.append('#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
+ return '\n'.join(lines)
+
+ def _generate_handler_declarations_for_domain(self, domain):
+ classComponents = ['class']
+ exportMacro = self.model().framework.setting('export_macro', None)
+ if exportMacro is not None:
+ classComponents.append(exportMacro)
+
+ used_enum_names = set()
+
+ command_declarations = []
+ for command in domain.commands:
+ command_declarations.append(self._generate_handler_declaration_for_command(command, used_enum_names))
+
+ handler_args = {
+ 'classAndExportMacro': " ".join(classComponents),
+ 'domainName': domain.domain_name,
+ 'commandDeclarations': "\n".join(command_declarations)
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.BackendDispatcherHeaderDomainHandlerDeclaration).substitute(None, **handler_args))
+
+ def _generate_anonymous_enum_for_parameter(self, parameter, command):
+ enum_args = {
+ 'parameterName': parameter.parameter_name,
+ 'commandName': command.command_name
+ }
+
+ lines = []
+ lines.append(' // Named after parameter \'%(parameterName)s\' while generating command/event %(commandName)s.' % enum_args)
+ lines.append(' enum class %s {' % ucfirst(parameter.parameter_name))
+ for enum_value in parameter.type.enum_values():
+ lines.append(' %s = %d,' % (Generator.stylized_name_for_enum_value(enum_value), self.encoding_for_enum_value(enum_value)))
+ lines.append(' }; // enum class %s' % ucfirst(parameter.parameter_name))
+ return '\n'.join(lines)
+
+ def _generate_handler_declaration_for_command(self, command, used_enum_names):
+ if command.is_async:
+ return self._generate_async_handler_declaration_for_command(command)
+
+ lines = []
+ parameters = ['ErrorString&']
+ for _parameter in command.call_parameters:
+ parameter_name = 'in_' + _parameter.parameter_name
+ if _parameter.is_optional:
+ parameter_name = 'opt_' + parameter_name
+
+ parameters.append("%s %s" % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(_parameter), parameter_name))
+
+ if isinstance(_parameter.type, EnumType) and _parameter.parameter_name not in used_enum_names:
+ lines.append(self._generate_anonymous_enum_for_parameter(_parameter, command))
+ used_enum_names.add(_parameter.parameter_name)
+
+ for _parameter in command.return_parameters:
+ parameter_name = 'out_' + _parameter.parameter_name
+ if _parameter.is_optional:
+ parameter_name = 'opt_' + parameter_name
+ parameters.append("%s %s" % (CppGenerator.cpp_type_for_formal_out_parameter(_parameter), parameter_name))
+
+ if isinstance(_parameter.type, EnumType) and _parameter.parameter_name not in used_enum_names:
+ lines.append(self._generate_anonymous_enum_for_parameter(_parameter, command))
+ used_enum_names.add(_parameter.parameter_name)
+
+ command_args = {
+ 'commandName': command.command_name,
+ 'parameters': ", ".join(parameters)
+ }
+ lines.append(' virtual void %(commandName)s(%(parameters)s) = 0;' % command_args)
+ return '\n'.join(lines)
+
+ def _generate_async_handler_declaration_for_command(self, command):
+ callbackName = "%sCallback" % ucfirst(command.command_name)
+
+ in_parameters = ['ErrorString&']
+ for _parameter in command.call_parameters:
+ parameter_name = 'in_' + _parameter.parameter_name
+ if _parameter.is_optional:
+ parameter_name = 'opt_' + parameter_name
+
+ in_parameters.append("%s %s" % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(_parameter), parameter_name))
+ in_parameters.append("Ref<%s>&& callback" % callbackName)
+
+ out_parameters = []
+ for _parameter in command.return_parameters:
+ out_parameters.append("%s %s" % (CppGenerator.cpp_type_for_formal_async_parameter(_parameter), _parameter.parameter_name))
+
+ class_components = ['class']
+ export_macro = self.model().framework.setting('export_macro', None)
+ if export_macro:
+ class_components.append(export_macro)
+
+ command_args = {
+ 'classAndExportMacro': ' '.join(class_components),
+ 'callbackName': callbackName,
+ 'commandName': command.command_name,
+ 'inParameters': ", ".join(in_parameters),
+ 'outParameters': ", ".join(out_parameters),
+ }
+
+ return Template(CppTemplates.BackendDispatcherHeaderAsyncCommandDeclaration).substitute(None, **command_args)
+
+ def _generate_dispatcher_declarations_for_domain(self, domain):
+ classComponents = ['class']
+ exportMacro = self.model().framework.setting('export_macro', None)
+ if exportMacro is not None:
+ classComponents.append(exportMacro)
+
+ declarations = []
+ if len(domain.commands) > 0:
+ declarations.append('private:')
+ declarations.extend(map(self._generate_dispatcher_declaration_for_command, domain.commands))
+
+ handler_args = {
+ 'classAndExportMacro': " ".join(classComponents),
+ 'domainName': domain.domain_name,
+ 'commandDeclarations': "\n".join(declarations)
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.BackendDispatcherHeaderDomainDispatcherDeclaration).substitute(None, **handler_args))
+
+ def _generate_dispatcher_declaration_for_command(self, command):
+ return " void %s(long requestId, RefPtr<InspectorObject>&& parameters);" % command.command_name
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
new file mode 100755
index 000000000..8f3df80ee
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
@@ -0,0 +1,314 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import ObjectType, ArrayType
+
+log = logging.getLogger('global')
+
+
+class CppBackendDispatcherImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorBackendDispatchers.cpp"
+
+ def domains_to_generate(self):
+ return filter(lambda domain: len(domain.commands) > 0, Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ secondary_headers = [
+ '<inspector/InspectorFrontendRouter.h>',
+ '<inspector/InspectorValues.h>',
+ '<wtf/NeverDestroyed.h>',
+ '<wtf/text/CString.h>']
+
+ secondary_includes = ['#include %s' % header for header in secondary_headers]
+ secondary_includes.append('')
+ secondary_includes.append('#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
+ secondary_includes.append('#include "InspectorAlternateBackendDispatchers.h"')
+ secondary_includes.append('#endif')
+
+ header_args = {
+ 'primaryInclude': '"InspectorBackendDispatchers.h"',
+ 'secondaryIncludes': '\n'.join(secondary_includes),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.append("\n".join(map(self._generate_handler_class_destructor_for_domain, self.domains_to_generate())))
+ sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))
+ sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ def _generate_handler_class_destructor_for_domain(self, domain):
+ destructor_args = {
+ 'domainName': domain.domain_name
+ }
+ destructor = '%(domainName)sBackendDispatcherHandler::~%(domainName)sBackendDispatcherHandler() { }' % destructor_args
+ return self.wrap_with_guard_for_domain(domain, destructor)
+
+ def _generate_dispatcher_implementations_for_domain(self, domain):
+ implementations = []
+
+ constructor_args = {
+ 'domainName': domain.domain_name,
+ }
+ implementations.append(Template(CppTemplates.BackendDispatcherImplementationDomainConstructor).substitute(None, **constructor_args))
+
+ if len(domain.commands) <= 5:
+ implementations.append(self._generate_small_dispatcher_switch_implementation_for_domain(domain))
+ else:
+ implementations.append(self._generate_large_dispatcher_switch_implementation_for_domain(domain))
+
+ for command in domain.commands:
+ if command.is_async:
+ implementations.append(self._generate_async_dispatcher_class_for_domain(command, domain))
+ implementations.append(self._generate_dispatcher_implementation_for_command(command, domain))
+
+ return self.wrap_with_guard_for_domain(domain, '\n\n'.join(implementations))
+
+ def _generate_small_dispatcher_switch_implementation_for_domain(self, domain):
+ cases = []
+ cases.append(' if (method == "%s")' % domain.commands[0].command_name)
+ cases.append(' %s(requestId, WTFMove(parameters));' % domain.commands[0].command_name)
+ for command in domain.commands[1:]:
+ cases.append(' else if (method == "%s")' % command.command_name)
+ cases.append(' %s(requestId, WTFMove(parameters));' % command.command_name)
+
+ switch_args = {
+ 'domainName': domain.domain_name,
+ 'dispatchCases': "\n".join(cases)
+ }
+
+ return Template(CppTemplates.BackendDispatcherImplementationSmallSwitch).substitute(None, **switch_args)
+
+ def _generate_large_dispatcher_switch_implementation_for_domain(self, domain):
+ cases = []
+ for command in domain.commands:
+ args = {
+ 'domainName': domain.domain_name,
+ 'commandName': command.command_name
+ }
+ cases.append(' { "%(commandName)s", &%(domainName)sBackendDispatcher::%(commandName)s },' % args)
+
+ switch_args = {
+ 'domainName': domain.domain_name,
+ 'dispatchCases': "\n".join(cases)
+ }
+
+ return Template(CppTemplates.BackendDispatcherImplementationLargeSwitch).substitute(None, **switch_args)
+
+ def _generate_async_dispatcher_class_for_domain(self, command, domain):
+ out_parameter_assignments = []
+ formal_parameters = []
+
+ for parameter in command.return_parameters:
+ param_args = {
+ 'keyedSetMethod': CppGenerator.cpp_setter_method_for_type(parameter.type),
+ 'parameterKey': parameter.parameter_name,
+ 'parameterName': parameter.parameter_name,
+ 'parameterType': CppGenerator.cpp_type_for_stack_in_parameter(parameter),
+ }
+
+ formal_parameters.append('%s %s' % (CppGenerator.cpp_type_for_formal_async_parameter(parameter), parameter.parameter_name))
+
+ if parameter.is_optional:
+ if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
+ out_parameter_assignments.append(' if (%(parameterName)s.isAssigned())' % param_args)
+ out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s.getValue());' % param_args)
+ else:
+ out_parameter_assignments.append(' if (%(parameterName)s)' % param_args)
+ out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
+ elif parameter.type.is_enum():
+ out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(%(parameterName)s));' % param_args)
+ else:
+ out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
+
+ async_args = {
+ 'domainName': domain.domain_name,
+ 'callbackName': ucfirst(command.command_name) + 'Callback',
+ 'formalParameters': ", ".join(formal_parameters),
+ 'outParameterAssignments': "\n".join(out_parameter_assignments)
+ }
+ return Template(CppTemplates.BackendDispatcherImplementationAsyncCommand).substitute(None, **async_args)
+
+ def _generate_dispatcher_implementation_for_command(self, command, domain):
+ in_parameter_declarations = []
+ out_parameter_declarations = []
+ out_parameter_assignments = []
+ alternate_dispatcher_method_parameters = ['requestId']
+ method_parameters = ['error']
+
+ for parameter in command.call_parameters:
+ parameter_name = 'in_' + parameter.parameter_name
+ if parameter.is_optional:
+ parameter_name = 'opt_' + parameter_name
+
+ out_success_argument = 'nullptr'
+ if parameter.is_optional:
+ out_success_argument = '&%s_valueFound' % parameter_name
+ in_parameter_declarations.append(' bool %s_valueFound = false;' % parameter_name)
+
+ # Now add appropriate operators.
+ parameter_expression = parameter_name
+
+ if CppGenerator.should_use_references_for_type(parameter.type):
+ if parameter.is_optional:
+ parameter_expression = '%s.get()' % parameter_expression
+ else:
+ # This assumes that we have already proved the object is non-null.
+ # If a required property is missing, InspectorBackend::getObject will
+ # append a protocol error, and the method dispatcher will return without
+ # invoking the backend method (and dereferencing the object).
+ parameter_expression = '*%s' % parameter_expression
+ elif parameter.is_optional:
+ parameter_expression = '&%s' % parameter_expression
+
+ param_args = {
+ 'parameterType': CppGenerator.cpp_type_for_stack_in_parameter(parameter),
+ 'parameterKey': parameter.parameter_name,
+ 'parameterName': parameter_name,
+ 'parameterExpression': parameter_expression,
+ 'keyedGetMethod': CppGenerator.cpp_getter_method_for_type(parameter.type),
+ 'successOutParam': out_success_argument
+ }
+
+ in_parameter_declarations.append(' %(parameterType)s %(parameterName)s = m_backendDispatcher->%(keyedGetMethod)s(parameters.get(), ASCIILiteral("%(parameterKey)s"), %(successOutParam)s);' % param_args)
+
+ if parameter.is_optional:
+ optional_in_parameter_string = '%(parameterName)s_valueFound ? %(parameterExpression)s : nullptr' % param_args
+ alternate_dispatcher_method_parameters.append(optional_in_parameter_string)
+ method_parameters.append(optional_in_parameter_string)
+ else:
+ alternate_dispatcher_method_parameters.append(parameter_expression)
+ method_parameters.append(parameter_expression)
+
+ if command.is_async:
+ async_args = {
+ 'domainName': domain.domain_name,
+ 'callbackName': ucfirst(command.command_name) + 'Callback'
+ }
+
+ out_parameter_assignments.append(' callback->disable();')
+ out_parameter_assignments.append(' m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, error);')
+ out_parameter_assignments.append(' return;')
+ method_parameters.append('callback.copyRef()')
+
+ else:
+ for parameter in command.return_parameters:
+ param_args = {
+ 'parameterType': CppGenerator.cpp_type_for_stack_out_parameter(parameter),
+ 'parameterKey': parameter.parameter_name,
+ 'parameterName': parameter.parameter_name,
+ 'keyedSetMethod': CppGenerator.cpp_setter_method_for_type(parameter.type),
+
+ }
+
+ out_parameter_declarations.append(' %(parameterType)s out_%(parameterName)s;' % param_args)
+ if parameter.is_optional:
+ if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
+ out_parameter_assignments.append(' if (out_%(parameterName)s.isAssigned())' % param_args)
+ out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s.getValue());' % param_args)
+ else:
+ out_parameter_assignments.append(' if (out_%(parameterName)s)' % param_args)
+ out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
+ elif parameter.type.is_enum():
+ out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(out_%(parameterName)s));' % param_args)
+ else:
+ out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
+
+ if CppGenerator.should_pass_by_copy_for_return_type(parameter.type):
+ method_parameters.append('out_' + parameter.parameter_name)
+ else:
+ method_parameters.append('&out_' + parameter.parameter_name)
+
+ command_args = {
+ 'domainName': domain.domain_name,
+ 'callbackName': '%sCallback' % ucfirst(command.command_name),
+ 'commandName': command.command_name,
+ 'inParameterDeclarations': '\n'.join(in_parameter_declarations),
+ 'invocationParameters': ', '.join(method_parameters),
+ 'alternateInvocationParameters': ', '.join(alternate_dispatcher_method_parameters),
+ }
+
+ lines = []
+ if len(command.call_parameters) == 0:
+ lines.append('void %(domainName)sBackendDispatcher::%(commandName)s(long requestId, RefPtr<InspectorObject>&&)' % command_args)
+ else:
+ lines.append('void %(domainName)sBackendDispatcher::%(commandName)s(long requestId, RefPtr<InspectorObject>&& parameters)' % command_args)
+ lines.append('{')
+
+ if len(command.call_parameters) > 0:
+ lines.append(Template(CppTemplates.BackendDispatcherImplementationPrepareCommandArguments).substitute(None, **command_args))
+
+ lines.append('#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)')
+ lines.append(' if (m_alternateDispatcher) {')
+ lines.append(' m_alternateDispatcher->%(commandName)s(%(alternateInvocationParameters)s);' % command_args)
+ lines.append(' return;')
+ lines.append(' }')
+ lines.append('#endif')
+ lines.append('')
+
+ lines.append(' ErrorString error;')
+ lines.append(' Ref<InspectorObject> result = InspectorObject::create();')
+ if command.is_async:
+ lines.append(' Ref<%(domainName)sBackendDispatcherHandler::%(callbackName)s> callback = adoptRef(*new %(domainName)sBackendDispatcherHandler::%(callbackName)s(m_backendDispatcher.copyRef(), requestId));' % command_args)
+ if len(command.return_parameters) > 0:
+ lines.extend(out_parameter_declarations)
+ lines.append(' m_agent->%(commandName)s(%(invocationParameters)s);' % command_args)
+ lines.append('')
+ if command.is_async:
+ lines.append(' if (error.length()) {')
+ lines.extend(out_parameter_assignments)
+ lines.append(' }')
+ elif len(command.return_parameters) > 1:
+ lines.append(' if (!error.length()) {')
+ lines.extend(out_parameter_assignments)
+ lines.append(' }')
+ elif len(command.return_parameters) == 1:
+ lines.append(' if (!error.length())')
+ lines.extend(out_parameter_assignments)
+ lines.append('')
+
+ if not command.is_async:
+ lines.append(' if (!error.length())')
+ lines.append(' m_backendDispatcher->sendResponse(requestId, WTFMove(result));')
+ lines.append(' else')
+ lines.append(' m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));')
+ lines.append('}')
+ return "\n".join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
new file mode 100755
index 000000000..58a3cb925
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py
@@ -0,0 +1,116 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import EnumType
+
+log = logging.getLogger('global')
+
+
+class CppFrontendDispatcherHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorFrontendDispatchers.h"
+
+ def domains_to_generate(self):
+ return filter(lambda domain: len(domain.events) > 0, Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ headers = [
+ '"InspectorProtocolObjects.h"',
+ '<inspector/InspectorValues.h>',
+ '<wtf/text/WTFString.h>']
+
+ header_args = {
+ 'headerGuardString': re.sub('\W+', '_', self.output_filename()),
+ 'includes': '\n'.join(['#include ' + header for header in headers]),
+ 'typedefs': 'class FrontendRouter;',
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
+ sections.extend(map(self._generate_dispatcher_declarations_for_domain, self.domains_to_generate()))
+ sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ def _generate_anonymous_enum_for_parameter(self, parameter, event):
+ enum_args = {
+ 'parameterName': parameter.parameter_name,
+ 'eventName': event.event_name
+ }
+
+ lines = []
+ lines.append(' // Named after parameter \'%(parameterName)s\' while generating command/event %(eventName)s.' % enum_args)
+ lines.append(' enum class %s {' % ucfirst(parameter.parameter_name))
+ for enum_value in parameter.type.enum_values():
+ lines.append(' %s = %d,' % (Generator.stylized_name_for_enum_value(enum_value), self.encoding_for_enum_value(enum_value)))
+ lines.append(' }; // enum class %s' % ucfirst(parameter.parameter_name))
+ return "\n".join(lines)
+
+ def _generate_dispatcher_declarations_for_domain(self, domain):
+ classComponents = ['class']
+ exportMacro = self.model().framework.setting('export_macro', None)
+ if exportMacro is not None:
+ classComponents.append(exportMacro)
+
+ used_enum_names = set([])
+
+ event_declarations = []
+ for event in domain.events:
+ event_declarations.append(self._generate_dispatcher_declaration_for_event(event, domain, used_enum_names))
+
+ handler_args = {
+ 'classAndExportMacro': " ".join(classComponents),
+ 'domainName': domain.domain_name,
+ 'eventDeclarations': "\n".join(event_declarations)
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(CppTemplates.FrontendDispatcherDomainDispatcherDeclaration).substitute(None, **handler_args))
+
+ def _generate_dispatcher_declaration_for_event(self, event, domain, used_enum_names):
+ formal_parameters = []
+ lines = []
+ for parameter in event.event_parameters:
+ formal_parameters.append('%s %s' % (CppGenerator.cpp_type_for_checked_formal_event_parameter(parameter), parameter.parameter_name))
+ if isinstance(parameter.type, EnumType) and parameter.parameter_name not in used_enum_names:
+ lines.append(self._generate_anonymous_enum_for_parameter(parameter, event))
+ used_enum_names.add(parameter.parameter_name)
+
+ lines.append(" void %s(%s);" % (event.event_name, ", ".join(formal_parameters)))
+ return "\n".join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
new file mode 100755
index 000000000..ea46aaf26
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import ObjectType, ArrayType
+
+log = logging.getLogger('global')
+
+
+class CppFrontendDispatcherImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorFrontendDispatchers.cpp"
+
+ def domains_to_generate(self):
+ return filter(lambda domain: len(domain.events) > 0, Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ secondary_headers = [
+ '"InspectorFrontendRouter.h"',
+ '<wtf/text/CString.h>',
+ ]
+
+ header_args = {
+ 'primaryInclude': '"InspectorFrontendDispatchers.h"',
+ 'secondaryIncludes': "\n".join(['#include %s' % header for header in secondary_headers]),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.extend(map(self._generate_dispatcher_implementations_for_domain, self.domains_to_generate()))
+ sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ def _generate_dispatcher_implementations_for_domain(self, domain):
+ implementations = []
+ for event in domain.events:
+ implementations.append(self._generate_dispatcher_implementation_for_event(event, domain))
+
+ return self.wrap_with_guard_for_domain(domain, '\n\n'.join(implementations))
+
+ def _generate_dispatcher_implementation_for_event(self, event, domain):
+ lines = []
+ parameter_assignments = []
+ formal_parameters = []
+
+ for parameter in event.event_parameters:
+
+ parameter_value = parameter.parameter_name
+ if parameter.is_optional and not CppGenerator.should_pass_by_copy_for_return_type(parameter.type):
+ parameter_value = '*' + parameter_value
+ if parameter.type.is_enum():
+ parameter_value = 'Inspector::Protocol::getEnumConstantValue(%s)' % parameter_value
+
+ parameter_args = {
+ 'parameterType': CppGenerator.cpp_type_for_stack_out_parameter(parameter),
+ 'parameterName': parameter.parameter_name,
+ 'parameterValue': parameter_value,
+ 'keyedSetMethod': CppGenerator.cpp_setter_method_for_type(parameter.type),
+ }
+
+ if parameter.is_optional:
+ parameter_assignments.append(' if (%(parameterName)s)' % parameter_args)
+ parameter_assignments.append(' paramsObject->%(keyedSetMethod)s(ASCIILiteral("%(parameterName)s"), %(parameterValue)s);' % parameter_args)
+ else:
+ parameter_assignments.append(' paramsObject->%(keyedSetMethod)s(ASCIILiteral("%(parameterName)s"), %(parameterValue)s);' % parameter_args)
+
+ formal_parameters.append('%s %s' % (CppGenerator.cpp_type_for_checked_formal_event_parameter(parameter), parameter.parameter_name))
+
+ event_args = {
+ 'domainName': domain.domain_name,
+ 'eventName': event.event_name,
+ 'formalParameters': ", ".join(formal_parameters)
+ }
+
+ lines.append('void %(domainName)sFrontendDispatcher::%(eventName)s(%(formalParameters)s)' % event_args)
+ lines.append('{')
+ lines.append(' Ref<InspectorObject> jsonMessage = InspectorObject::create();')
+ lines.append(' jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("%(domainName)s.%(eventName)s"));' % event_args)
+
+ if len(parameter_assignments) > 0:
+ lines.append(' Ref<InspectorObject> paramsObject = InspectorObject::create();')
+ lines.extend(parameter_assignments)
+ lines.append(' jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));')
+
+ lines.append('')
+ lines.append(' m_frontendRouter.sendEvent(jsonMessage->toJSONString());')
+ lines.append('}')
+ return "\n".join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
new file mode 100755
index 000000000..6753e2dcf
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
@@ -0,0 +1,352 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import re
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import EnumType, ObjectType, PrimitiveType, AliasedType, ArrayType, Frameworks
+
+log = logging.getLogger('global')
+
+
+class CppProtocolTypesHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorProtocolObjects.h"
+
+ def generate_output(self):
+ domains = self.domains_to_generate()
+ self.calculate_types_requiring_shape_assertions(domains)
+
+ headers = set([
+ '<inspector/InspectorProtocolTypes.h>',
+ '<wtf/Assertions.h>',
+ ])
+
+ export_macro = self.model().framework.setting('export_macro', None)
+
+ header_args = {
+ 'headerGuardString': re.sub('\W+', '_', self.output_filename()),
+ 'includes': '\n'.join(['#include ' + header for header in sorted(headers)]),
+ 'typedefs': '',
+ }
+
+ return_type = 'String'
+ return_type_with_export_macro = [return_type]
+ if export_macro is not None:
+ return_type_with_export_macro[:0] = [export_macro]
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
+ sections.append('namespace Protocol {')
+ sections.append(self._generate_forward_declarations(domains))
+ sections.append(self._generate_typedefs(domains))
+ sections.append('%s getEnumConstantValue(int code);' % ' '.join(return_type_with_export_macro))
+ sections.append('\n'.join([
+ 'template<typename T> %s getEnumConstantValue(T enumValue)' % return_type,
+ '{',
+ ' return getEnumConstantValue(static_cast<int>(enumValue));',
+ '}']))
+
+ builder_sections = map(self._generate_builders_for_domain, domains)
+ sections.extend(filter(lambda section: len(section) > 0, builder_sections))
+ sections.append(self._generate_forward_declarations_for_binding_traits())
+ sections.append('} // namespace Protocol')
+ sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ # FIXME: move builders out of classes, uncomment forward declaration
+
+ def _generate_forward_declarations(self, domains):
+ sections = []
+
+ for domain in domains:
+ declaration_types = [decl.type for decl in domain.type_declarations]
+ object_types = filter(lambda _type: isinstance(_type, ObjectType), declaration_types)
+ enum_types = filter(lambda _type: isinstance(_type, EnumType), declaration_types)
+ if len(object_types) + len(enum_types) == 0:
+ continue
+
+ domain_lines = []
+ domain_lines.append('namespace %s {' % domain.domain_name)
+
+ object_type_names = [_type.raw_name() for _type in object_types]
+ enum_type_names = [_type.raw_name() for _type in enum_types]
+
+ # Forward-declare all classes so the type builders won't break if rearranged.
+ domain_lines.extend('class %s;' % name for name in sorted(object_type_names))
+ domain_lines.extend('enum class %s;' % name for name in sorted(enum_type_names))
+ domain_lines.append('} // %s' % domain.domain_name)
+ sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
+
+ if len(sections) == 0:
+ return ''
+ else:
+ return """// Forward declarations.
+%s
+// End of forward declarations.
+""" % '\n\n'.join(sections)
+
+ def _generate_typedefs(self, domains):
+ sections = map(self._generate_typedefs_for_domain, domains)
+ sections = filter(lambda text: len(text) > 0, sections)
+
+ if len(sections) == 0:
+ return ''
+ else:
+ return """// Typedefs.
+%s
+// End of typedefs.""" % '\n\n'.join(sections)
+
+ def _generate_typedefs_for_domain(self, domain):
+ primitive_declarations = filter(lambda decl: isinstance(decl.type, AliasedType), domain.type_declarations)
+ array_declarations = filter(lambda decl: isinstance(decl.type, ArrayType), domain.type_declarations)
+ if len(primitive_declarations) == 0 and len(array_declarations) == 0:
+ return ''
+
+ sections = []
+ for declaration in primitive_declarations:
+ primitive_name = CppGenerator.cpp_name_for_primitive_type(declaration.type.aliased_type)
+ typedef_lines = []
+ if len(declaration.description) > 0:
+ typedef_lines.append('/* %s */' % declaration.description)
+ typedef_lines.append('typedef %s %s;' % (primitive_name, declaration.type_name))
+ sections.append('\n'.join(typedef_lines))
+
+ for declaration in array_declarations:
+ element_type = CppGenerator.cpp_protocol_type_for_type(declaration.type.element_type)
+ typedef_lines = []
+ if len(declaration.description) > 0:
+ typedef_lines.append('/* %s */' % declaration.description)
+ typedef_lines.append('typedef Inspector::Protocol::Array<%s> %s;' % (element_type, declaration.type_name))
+ sections.append('\n'.join(typedef_lines))
+
+ lines = []
+ lines.append('namespace %s {' % domain.domain_name)
+ lines.append('\n'.join(sections))
+ lines.append('} // %s' % domain.domain_name)
+ return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+
+ def _generate_builders_for_domain(self, domain):
+ sections = []
+
+ for type_declaration in domain.type_declarations:
+ if isinstance(type_declaration.type, EnumType):
+ sections.append(self._generate_struct_for_enum_declaration(type_declaration))
+ elif isinstance(type_declaration.type, ObjectType):
+ sections.append(self._generate_class_for_object_declaration(type_declaration, domain))
+
+ sections = filter(lambda section: len(section) > 0, sections)
+ if len(sections) == 0:
+ return ''
+
+ lines = []
+ lines.append('namespace %s {' % domain.domain_name)
+ lines.append('\n'.join(sections))
+ lines.append('} // %s' % domain.domain_name)
+ return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+
+ def _generate_class_for_object_declaration(self, type_declaration, domain):
+ if len(type_declaration.type_members) == 0:
+ return ''
+
+ enum_members = filter(lambda member: isinstance(member.type, EnumType) and member.type.is_anonymous, type_declaration.type_members)
+ required_members = filter(lambda member: not member.is_optional, type_declaration.type_members)
+ optional_members = filter(lambda member: member.is_optional, type_declaration.type_members)
+ object_name = type_declaration.type_name
+
+ lines = []
+ if len(type_declaration.description) > 0:
+ lines.append('/* %s */' % type_declaration.description)
+ base_class = 'Inspector::InspectorObject'
+ if not Generator.type_has_open_fields(type_declaration.type):
+ base_class = base_class + 'Base'
+ lines.append('class %s : public %s {' % (object_name, base_class))
+ lines.append('public:')
+ for enum_member in enum_members:
+ lines.append(' // Named after property name \'%s\' while generating %s.' % (enum_member.member_name, object_name))
+ lines.append(self._generate_struct_for_anonymous_enum_member(enum_member))
+ lines.append(self._generate_builder_state_enum(type_declaration))
+
+ constructor_example = []
+ constructor_example.append(' * Ref<%s> result = %s::create()' % (object_name, object_name))
+ for member in required_members:
+ constructor_example.append(' * .set%s(...)' % ucfirst(member.member_name))
+ constructor_example.append(' * .release()')
+
+ builder_args = {
+ 'objectType': object_name,
+ 'constructorExample': '\n'.join(constructor_example) + ';',
+ }
+
+ lines.append(Template(CppTemplates.ProtocolObjectBuilderDeclarationPrelude).substitute(None, **builder_args))
+ for type_member in required_members:
+ lines.append(self._generate_builder_setter_for_member(type_member, domain))
+ lines.append(Template(CppTemplates.ProtocolObjectBuilderDeclarationPostlude).substitute(None, **builder_args))
+ for member in optional_members:
+ lines.append(self._generate_unchecked_setter_for_member(member, domain))
+
+ if Generator.type_has_open_fields(type_declaration.type):
+ lines.append('')
+ lines.append(' // Property names for type generated as open.')
+ for type_member in type_declaration.type_members:
+ export_macro = self.model().framework.setting('export_macro', None)
+ lines.append(' %s static const char* %s;' % (export_macro, ucfirst(type_member.member_name)))
+
+ lines.append('};')
+ lines.append('')
+ return '\n'.join(lines)
+
+ def _generate_struct_for_enum_declaration(self, enum_declaration):
+ lines = []
+ lines.append('/* %s */' % enum_declaration.description)
+ lines.extend(self._generate_struct_for_enum_type(enum_declaration.type_name, enum_declaration.type))
+ return '\n'.join(lines)
+
+ def _generate_struct_for_anonymous_enum_member(self, enum_member):
+ def apply_indentation(line):
+ if line.startswith(('#', '/*', '*/', '//')) or len(line) is 0:
+ return line
+ else:
+ return ' ' + line
+
+ indented_lines = map(apply_indentation, self._generate_struct_for_enum_type(enum_member.member_name, enum_member.type))
+ return '\n'.join(indented_lines)
+
+ def _generate_struct_for_enum_type(self, enum_name, enum_type):
+ lines = []
+ enum_name = ucfirst(enum_name)
+ lines.append('enum class %s {' % enum_name)
+ for enum_value in enum_type.enum_values():
+ lines.append(' %s = %s,' % (Generator.stylized_name_for_enum_value(enum_value), self.encoding_for_enum_value(enum_value)))
+ lines.append('}; // enum class %s' % enum_name)
+ return lines # The caller may want to adjust indentation, so don't join these lines.
+
+ def _generate_builder_state_enum(self, type_declaration):
+ lines = []
+ required_members = filter(lambda member: not member.is_optional, type_declaration.type_members)
+ enum_values = []
+
+ lines.append(' enum {')
+ lines.append(' NoFieldsSet = 0,')
+ for i in range(len(required_members)):
+ enum_value = "%sSet" % ucfirst(required_members[i].member_name)
+ enum_values.append(enum_value)
+ lines.append(' %s = 1 << %d,' % (enum_value, i))
+ if len(enum_values) > 0:
+ lines.append(' AllFieldsSet = (%s)' % ' | '.join(enum_values))
+ else:
+ lines.append(' AllFieldsSet = 0')
+ lines.append(' };')
+ lines.append('')
+ return '\n'.join(lines)
+
+ def _generate_builder_setter_for_member(self, type_member, domain):
+ setter_args = {
+ 'camelName': ucfirst(type_member.member_name),
+ 'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
+ 'name': type_member.member_name,
+ 'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
+ }
+
+ lines = []
+ lines.append('')
+ lines.append(' Builder<STATE | %(camelName)sSet>& set%(camelName)s(%(parameterType)s value)' % setter_args)
+ lines.append(' {')
+ lines.append(' COMPILE_ASSERT(!(STATE & %(camelName)sSet), property_%(name)s_already_set);' % setter_args)
+
+ if isinstance(type_member.type, EnumType):
+ lines.append(' m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
+ else:
+ lines.append(' m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), value);' % setter_args)
+ lines.append(' return castState<%(camelName)sSet>();' % setter_args)
+ lines.append(' }')
+ return '\n'.join(lines)
+
+ def _generate_unchecked_setter_for_member(self, type_member, domain):
+ setter_args = {
+ 'camelName': ucfirst(type_member.member_name),
+ 'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
+ 'name': type_member.member_name,
+ 'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
+ }
+
+ lines = []
+ lines.append('')
+ lines.append(' void set%(camelName)s(%(parameterType)s value)' % setter_args)
+ lines.append(' {')
+ if isinstance(type_member.type, EnumType):
+ lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
+ elif CppGenerator.should_use_references_for_type(type_member.type):
+ lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), WTFMove(value));' % setter_args)
+ else:
+ lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), value);' % setter_args)
+ lines.append(' }')
+ return '\n'.join(lines)
+
+ def _generate_forward_declarations_for_binding_traits(self):
+ # A list of (builder_type, needs_runtime_cast)
+ type_arguments = []
+
+ for domain in self.domains_to_generate():
+ declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), domain.type_declarations)
+
+ for type_declaration in declarations_to_generate:
+ for type_member in type_declaration.type_members:
+ if isinstance(type_member.type, EnumType):
+ type_arguments.append((CppGenerator.cpp_protocol_type_for_type_member(type_member, type_declaration), False))
+
+ if isinstance(type_declaration.type, ObjectType):
+ type_arguments.append((CppGenerator.cpp_protocol_type_for_type(type_declaration.type), Generator.type_needs_runtime_casts(type_declaration.type)))
+
+ struct_keywords = ['struct']
+ function_keywords = ['static void']
+ export_macro = self.model().framework.setting('export_macro', None)
+ if export_macro is not None:
+ struct_keywords.append(export_macro)
+ #function_keywords[1:1] = [export_macro]
+
+ lines = []
+ for argument in type_arguments:
+ lines.append('template<> %s BindingTraits<%s> {' % (' '.join(struct_keywords), argument[0]))
+ if argument[1]:
+ lines.append('static RefPtr<%s> runtimeCast(RefPtr<Inspector::InspectorValue>&& value);' % argument[0])
+ lines.append('#if !ASSERT_DISABLED')
+ lines.append('%s assertValueHasExpectedType(Inspector::InspectorValue*);' % ' '.join(function_keywords))
+ lines.append('#endif // !ASSERT_DISABLED')
+ lines.append('};')
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
new file mode 100755
index 000000000..2c263b504
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
@@ -0,0 +1,183 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from cpp_generator_templates import CppGeneratorTemplates as CppTemplates
+from generator import Generator, ucfirst
+from models import AliasedType, ArrayType, EnumType, ObjectType
+
+log = logging.getLogger('global')
+
+
+class CppProtocolTypesImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorProtocolObjects.cpp"
+
+ def generate_output(self):
+ domains = self.domains_to_generate()
+ self.calculate_types_requiring_shape_assertions(domains)
+
+ secondary_headers = ['<wtf/text/CString.h>']
+
+ header_args = {
+ 'primaryInclude': '"InspectorProtocolObjects.h"',
+ 'secondaryIncludes': "\n".join(['#include %s' % header for header in secondary_headers]),
+ }
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.append('namespace Protocol {')
+ sections.append(self._generate_enum_mapping())
+ sections.append(self._generate_open_field_names())
+ builder_sections = map(self._generate_builders_for_domain, domains)
+ sections.extend(filter(lambda section: len(section) > 0, builder_sections))
+ sections.append('} // namespace Protocol')
+ sections.append(Template(CppTemplates.ImplementationPostlude).substitute(None, **header_args))
+
+ return "\n\n".join(sections)
+
+ # Private methods.
+
+ def _generate_enum_mapping(self):
+ lines = []
+ lines.append('static const char* const enum_constant_values[] = {')
+ lines.extend([' "%s",' % enum_value for enum_value in self.assigned_enum_values()])
+ lines.append('};')
+ lines.append('')
+ lines.append('String getEnumConstantValue(int code) {')
+ lines.append(' return enum_constant_values[code];')
+ lines.append('}')
+ return '\n'.join(lines)
+
+ def _generate_open_field_names(self):
+ lines = []
+ for domain in self.domains_to_generate():
+ for type_declaration in filter(lambda decl: Generator.type_has_open_fields(decl.type), domain.type_declarations):
+ for type_member in sorted(type_declaration.type_members, key=lambda member: member.member_name):
+ field_name = '::'.join(['Inspector', 'Protocol', domain.domain_name, ucfirst(type_declaration.type_name), ucfirst(type_member.member_name)])
+ lines.append('const char* %s = "%s";' % (field_name, type_member.member_name))
+
+ return '\n'.join(lines)
+
+ def _generate_builders_for_domain(self, domain):
+ sections = []
+ declarations_to_generate = filter(lambda decl: self.type_needs_shape_assertions(decl.type), domain.type_declarations)
+
+ for type_declaration in declarations_to_generate:
+ for type_member in type_declaration.type_members:
+ if isinstance(type_member.type, EnumType):
+ sections.append(self._generate_assertion_for_enum(type_member, type_declaration))
+
+ if isinstance(type_declaration.type, ObjectType):
+ sections.append(self._generate_assertion_for_object_declaration(type_declaration))
+ if Generator.type_needs_runtime_casts(type_declaration.type):
+ sections.append(self._generate_runtime_cast_for_object_declaration(type_declaration))
+
+ return '\n\n'.join(sections)
+
+ def _generate_runtime_cast_for_object_declaration(self, object_declaration):
+ args = {
+ 'objectType': CppGenerator.cpp_protocol_type_for_type(object_declaration.type)
+ }
+ return Template(CppTemplates.ProtocolObjectRuntimeCast).substitute(None, **args)
+
+ def _generate_assertion_for_object_declaration(self, object_declaration):
+ required_members = filter(lambda member: not member.is_optional, object_declaration.type_members)
+ optional_members = filter(lambda member: member.is_optional, object_declaration.type_members)
+ should_count_properties = not Generator.type_has_open_fields(object_declaration.type)
+ lines = []
+
+ lines.append('#if !ASSERT_DISABLED')
+ lines.append('void BindingTraits<%s>::assertValueHasExpectedType(Inspector::InspectorValue* value)' % (CppGenerator.cpp_protocol_type_for_type(object_declaration.type)))
+ lines.append("""{
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorObject> object;
+ bool castSucceeded = value->asObject(object);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);""")
+ for type_member in required_members:
+ args = {
+ 'memberName': type_member.member_name,
+ 'assertMethod': CppGenerator.cpp_assertion_method_for_type_member(type_member, object_declaration)
+ }
+
+ lines.append(""" {
+ InspectorObject::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
+ ASSERT(%(memberName)sPos != object->end());
+ %(assertMethod)s(%(memberName)sPos->value.get());
+ }""" % args)
+
+ if should_count_properties:
+ lines.append('')
+ lines.append(' int foundPropertiesCount = %s;' % len(required_members))
+
+ for type_member in optional_members:
+ args = {
+ 'memberName': type_member.member_name,
+ 'assertMethod': CppGenerator.cpp_assertion_method_for_type_member(type_member, object_declaration)
+ }
+
+ lines.append(""" {
+ InspectorObject::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
+ if (%(memberName)sPos != object->end()) {
+ %(assertMethod)s(%(memberName)sPos->value.get());""" % args)
+
+ if should_count_properties:
+ lines.append(' ++foundPropertiesCount;')
+ lines.append(' }')
+ lines.append(' }')
+
+ if should_count_properties:
+ lines.append(' if (foundPropertiesCount != object->size())')
+ lines.append(' FATAL("Unexpected properties in object: %s\\n", object->toJSONString().ascii().data());')
+ lines.append('}')
+ lines.append('#endif // !ASSERT_DISABLED')
+ return '\n'.join(lines)
+
+ def _generate_assertion_for_enum(self, enum_member, object_declaration):
+ lines = []
+ lines.append('#if !ASSERT_DISABLED')
+ lines.append('void %s(Inspector::InspectorValue* value)' % CppGenerator.cpp_assertion_method_for_type_member(enum_member, object_declaration))
+ lines.append('{')
+ lines.append(' ASSERT_ARG(value, value);')
+ lines.append(' String result;')
+ lines.append(' bool castSucceeded = value->asString(result);')
+ lines.append(' ASSERT(castSucceeded);')
+
+ assert_condition = ' || '.join(['result == "%s"' % enum_value for enum_value in enum_member.type.enum_values()])
+ lines.append(' ASSERT(%s);' % assert_condition)
+ lines.append('}')
+ lines.append('#endif // !ASSERT_DISABLED')
+
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py
new file mode 100755
index 000000000..3392c7845
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py
@@ -0,0 +1,137 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator, ucfirst
+from generator_templates import GeneratorTemplates as Templates
+from models import EnumType
+
+log = logging.getLogger('global')
+
+
+class JSBackendCommandsGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return "InspectorBackendCommands.js"
+
+ def domains_to_generate(self):
+ def should_generate_domain(domain):
+ domain_enum_types = filter(lambda declaration: isinstance(declaration.type, EnumType), domain.type_declarations)
+ return len(domain.commands) > 0 or len(domain.events) > 0 or len(domain_enum_types) > 0
+
+ return filter(should_generate_domain, Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ sections = []
+ sections.append(self.generate_license())
+ sections.extend(map(self.generate_domain, self.domains_to_generate()))
+ return "\n\n".join(sections)
+
+ def generate_domain(self, domain):
+ lines = []
+ args = {
+ 'domain': domain.domain_name
+ }
+
+ lines.append('// %(domain)s.' % args)
+
+ has_async_commands = any(map(lambda command: command.is_async, domain.commands))
+ if len(domain.events) > 0 or has_async_commands:
+ lines.append('InspectorBackend.register%(domain)sDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "%(domain)s");' % args)
+
+ for declaration in domain.type_declarations:
+ if declaration.type.is_enum():
+ enum_args = {
+ 'domain': domain.domain_name,
+ 'enumName': declaration.type_name,
+ 'enumMap': ", ".join(['%s: "%s"' % (Generator.stylized_name_for_enum_value(enum_value), enum_value) for enum_value in declaration.type.enum_values()])
+ }
+ lines.append('InspectorBackend.registerEnum("%(domain)s.%(enumName)s", {%(enumMap)s});' % enum_args)
+
+ def is_anonymous_enum_member(type_member):
+ return isinstance(type_member.type, EnumType) and type_member.type.is_anonymous
+
+ for _member in filter(is_anonymous_enum_member, declaration.type_members):
+ enum_args = {
+ 'domain': domain.domain_name,
+ 'enumName': '%s%s' % (declaration.type_name, ucfirst(_member.member_name)),
+ 'enumMap': ", ".join(['%s: "%s"' % (Generator.stylized_name_for_enum_value(enum_value), enum_value) for enum_value in _member.type.enum_values()])
+ }
+ lines.append('InspectorBackend.registerEnum("%(domain)s.%(enumName)s", {%(enumMap)s});' % enum_args)
+
+ def is_anonymous_enum_param(param):
+ return isinstance(param.type, EnumType) and param.type.is_anonymous
+
+ for event in domain.events:
+ for param in filter(is_anonymous_enum_param, event.event_parameters):
+ enum_args = {
+ 'domain': domain.domain_name,
+ 'enumName': '%s%s' % (ucfirst(event.event_name), ucfirst(param.parameter_name)),
+ 'enumMap': ", ".join(['%s: "%s"' % (Generator.stylized_name_for_enum_value(enum_value), enum_value) for enum_value in param.type.enum_values()])
+ }
+ lines.append('InspectorBackend.registerEnum("%(domain)s.%(enumName)s", {%(enumMap)s});' % enum_args)
+
+ event_args = {
+ 'domain': domain.domain_name,
+ 'eventName': event.event_name,
+ 'params': ", ".join(['"%s"' % parameter.parameter_name for parameter in event.event_parameters])
+ }
+ lines.append('InspectorBackend.registerEvent("%(domain)s.%(eventName)s", [%(params)s]);' % event_args)
+
+ for command in domain.commands:
+ def generate_parameter_object(parameter):
+ optional_string = "true" if parameter.is_optional else "false"
+ pairs = []
+ pairs.append('"name": "%s"' % parameter.parameter_name)
+ pairs.append('"type": "%s"' % Generator.js_name_for_parameter_type(parameter.type))
+ pairs.append('"optional": %s' % optional_string)
+ return "{%s}" % ", ".join(pairs)
+
+ command_args = {
+ 'domain': domain.domain_name,
+ 'commandName': command.command_name,
+ 'callParams': ", ".join([generate_parameter_object(parameter) for parameter in command.call_parameters]),
+ 'returnParams': ", ".join(['"%s"' % parameter.parameter_name for parameter in command.return_parameters]),
+ }
+ lines.append('InspectorBackend.registerCommand("%(domain)s.%(commandName)s", [%(callParams)s], [%(returnParams)s]);' % command_args)
+
+ if domain.commands or domain.events:
+ activate_args = {
+ 'domain': domain.domain_name,
+ 'availability': domain.availability,
+ }
+ if domain.availability:
+ lines.append('InspectorBackend.activateDomain("%(domain)s", "%(availability)s");' % activate_args)
+ else:
+ lines.append('InspectorBackend.activateDomain("%(domain)s");' % activate_args)
+
+ return "\n".join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py
new file mode 100755
index 000000000..d56a0b178
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+import re
+from string import Template
+
+from cpp_generator import CppGenerator
+from generator import Generator
+from models import Frameworks
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCBackendDispatcherHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sBackendDispatchers.h' % ObjCGenerator.OBJC_PREFIX
+
+ def domains_to_generate(self):
+ return filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ headers = [
+ '<JavaScriptCore/InspectorAlternateBackendDispatchers.h>',
+ '<wtf/RetainPtr.h>',
+ ]
+
+ header_args = {
+ 'headerGuardString': re.sub('\W+', '_', self.output_filename()),
+ 'includes': '\n'.join(['#include ' + header for header in headers]),
+ 'forwardDeclarations': self._generate_objc_forward_declarations(),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPrelude).substitute(None, **header_args))
+ sections.extend(map(self._generate_objc_handler_declarations_for_domain, domains))
+ sections.append(Template(ObjCTemplates.BackendDispatcherHeaderPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_objc_forward_declarations(self):
+ lines = []
+ for domain in self.domains_to_generate():
+ if domain.commands:
+ lines.append('@protocol %s%sDomainHandler;' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name))
+ return '\n'.join(lines)
+
+ def _generate_objc_handler_declarations_for_domain(self, domain):
+ if not domain.commands:
+ return ''
+
+ command_declarations = []
+ for command in domain.commands:
+ command_declarations.append(self._generate_objc_handler_declaration_for_command(command))
+
+ handler_args = {
+ 'domainName': domain.domain_name,
+ 'commandDeclarations': '\n'.join(command_declarations),
+ 'objcPrefix': ObjCGenerator.OBJC_PREFIX,
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerObjCDeclaration).substitute(None, **handler_args))
+
+ def _generate_objc_handler_declaration_for_command(self, command):
+ lines = []
+ parameters = ['long requestId']
+ for _parameter in command.call_parameters:
+ parameters.append('%s in_%s' % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(_parameter), _parameter.parameter_name))
+
+ command_args = {
+ 'commandName': command.command_name,
+ 'parameters': ', '.join(parameters),
+ }
+ lines.append(' virtual void %(commandName)s(%(parameters)s) override;' % command_args)
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
new file mode 100755
index 000000000..42afd99cf
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
@@ -0,0 +1,194 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+import re
+from string import Template
+
+from cpp_generator import CppGenerator
+from generator import Generator
+from models import PrimitiveType, EnumType, AliasedType, Frameworks
+from objc_generator import ObjCTypeCategory, ObjCGenerator, join_type_and_name
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCConfigurationImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sBackendDispatchers.mm' % ObjCGenerator.OBJC_PREFIX
+
+ def domains_to_generate(self):
+ return filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ secondary_headers = [
+ '"%sInternal.h"' % ObjCGenerator.OBJC_PREFIX,
+ '"%sEnumConversionHelpers.h"' % ObjCGenerator.OBJC_PREFIX,
+ '<JavaScriptCore/InspectorValues.h>',
+ ]
+
+ header_args = {
+ 'primaryInclude': '"%sBackendDispatchers.h"' % ObjCGenerator.OBJC_PREFIX,
+ 'secondaryIncludes': '\n'.join(['#include %s' % header for header in secondary_headers]),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPrelude).substitute(None, **header_args))
+ sections.extend(map(self._generate_handler_implementation_for_domain, domains))
+ sections.append(Template(ObjCTemplates.BackendDispatcherImplementationPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_handler_implementation_for_domain(self, domain):
+ if not domain.commands:
+ return ''
+
+ command_declarations = []
+ for command in domain.commands:
+ command_declarations.append(self._generate_handler_implementation_for_command(domain, command))
+
+ return '\n'.join(command_declarations)
+
+ def _generate_handler_implementation_for_command(self, domain, command):
+ lines = []
+ parameters = ['long requestId']
+ for parameter in command.call_parameters:
+ parameters.append('%s in_%s' % (CppGenerator.cpp_type_for_unchecked_formal_in_parameter(parameter), parameter.parameter_name))
+
+ command_args = {
+ 'domainName': domain.domain_name,
+ 'commandName': command.command_name,
+ 'parameters': ', '.join(parameters),
+ 'successCallback': self._generate_success_block_for_command(domain, command),
+ 'conversions': self._generate_conversions_for_command(domain, command),
+ 'invocation': self._generate_invocation_for_command(domain, command),
+ }
+
+ return self.wrap_with_guard_for_domain(domain, Template(ObjCTemplates.BackendDispatcherHeaderDomainHandlerImplementation).substitute(None, **command_args))
+
+ def _generate_success_block_for_command(self, domain, command):
+ lines = []
+
+ if command.return_parameters:
+ success_block_parameters = []
+ for parameter in command.return_parameters:
+ objc_type = ObjCGenerator.objc_type_for_param(domain, command.command_name, parameter)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ success_block_parameters.append(join_type_and_name(objc_type, var_name))
+ lines.append(' id successCallback = ^(%s) {' % ', '.join(success_block_parameters))
+ else:
+ lines.append(' id successCallback = ^{')
+
+ if command.return_parameters:
+ lines.append(' Ref<InspectorObject> resultObject = InspectorObject::create();')
+
+ required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters)
+ for parameter in required_pointer_parameters:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name))
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(parameter.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+
+ optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), command.return_parameters)
+ for parameter in optional_pointer_parameters:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name))
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(parameter.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_OPTIONAL_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+
+ for parameter in command.return_parameters:
+ keyed_set_method = CppGenerator.cpp_setter_method_for_type(parameter.type)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ var_expression = '*%s' % var_name if parameter.is_optional else var_name
+ export_expression = ObjCGenerator.objc_protocol_export_expression_for_variable(parameter.type, var_expression)
+ if not parameter.is_optional:
+ lines.append(' resultObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
+ else:
+ lines.append(' if (%s)' % var_name)
+ lines.append(' resultObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
+ lines.append(' backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));')
+ else:
+ lines.append(' backendDispatcher()->sendResponse(requestId, InspectorObject::create());')
+
+ lines.append(' };')
+ return '\n'.join(lines)
+
+ def _generate_conversions_for_command(self, domain, command):
+ lines = []
+ if command.call_parameters:
+ lines.append('')
+
+ def in_param_expression(param_name, parameter):
+ _type = parameter.type
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through to enum or primitive.
+ if isinstance(_type, EnumType):
+ _type = _type.primitive_type # Fall through to primitive.
+ if isinstance(_type, PrimitiveType):
+ if _type.raw_name() in ['array', 'any', 'object']:
+ return '&%s' % param_name if not parameter.is_optional else param_name
+ return '*%s' % param_name if parameter.is_optional else param_name
+ return '&%s' % param_name if not parameter.is_optional else param_name
+
+ for parameter in command.call_parameters:
+ in_param_name = 'in_%s' % parameter.parameter_name
+ objc_in_param_name = 'o_%s' % in_param_name
+ objc_type = ObjCGenerator.objc_type_for_param(domain, command.command_name, parameter, False)
+ param_expression = in_param_expression(in_param_name, parameter)
+ import_expression = ObjCGenerator.objc_protocol_import_expression_for_parameter(param_expression, domain, command.command_name, parameter)
+ if not parameter.is_optional:
+ lines.append(' %s = %s;' % (join_type_and_name(objc_type, objc_in_param_name), import_expression))
+ else:
+ lines.append(' %s;' % join_type_and_name(objc_type, objc_in_param_name))
+ lines.append(' if (%s)' % in_param_name)
+ lines.append(' %s = %s;' % (objc_in_param_name, import_expression))
+
+ if lines:
+ lines.append('')
+ return '\n'.join(lines)
+
+ def _generate_invocation_for_command(self, domain, command):
+ pairs = []
+ pairs.append('WithErrorCallback:errorCallback')
+ pairs.append('successCallback:successCallback')
+ for parameter in command.call_parameters:
+ in_param_name = 'in_%s' % parameter.parameter_name
+ objc_in_param_name = 'o_%s' % in_param_name
+ if not parameter.is_optional:
+ pairs.append('%s:%s' % (parameter.parameter_name, objc_in_param_name))
+ else:
+ optional_expression = '(%s ? &%s : nil)' % (in_param_name, objc_in_param_name)
+ pairs.append('%s:%s' % (parameter.parameter_name, optional_expression))
+ return ' [m_delegate %s%s];' % (command.command_name, ' '.join(pairs))
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py
new file mode 100755
index 000000000..9b93f37f6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCConfigurationHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sConfiguration.h' % ObjCGenerator.OBJC_PREFIX
+
+ def generate_output(self):
+ headers = [
+ '<WebInspector/%s.h>' % ObjCGenerator.OBJC_PREFIX,
+ ]
+
+ header_args = {
+ 'includes': '\n'.join(['#import ' + header for header in headers]),
+ }
+
+ self._command_filter = ObjCGenerator.should_generate_domain_command_handler_filter(self.model())
+ self._event_filter = ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model())
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.GenericHeaderPrelude).substitute(None, **header_args))
+ sections.append(self._generate_configuration_interface_for_domains(domains))
+ sections.append(Template(ObjCTemplates.GenericHeaderPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_configuration_interface_for_domains(self, domains):
+ lines = []
+ lines.append('__attribute__((visibility ("default")))')
+ lines.append('@interface %sConfiguration : NSObject' % ObjCGenerator.OBJC_PREFIX)
+ for domain in domains:
+ lines.extend(self._generate_properties_for_domain(domain))
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_properties_for_domain(self, domain):
+ property_args = {
+ 'objcPrefix': ObjCGenerator.OBJC_PREFIX,
+ 'domainName': domain.domain_name,
+ 'variableNamePrefix': ObjCGenerator.variable_name_prefix_for_domain(domain),
+ }
+
+ lines = []
+ if domain.commands and self._command_filter(domain):
+ lines.append(Template(ObjCTemplates.ConfigurationCommandProperty).substitute(None, **property_args))
+ if domain.events and self._event_filter(domain):
+ lines.append(Template(ObjCTemplates.ConfigurationEventProperty).substitute(None, **property_args))
+ return lines
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py
new file mode 100755
index 000000000..735abbca3
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCBackendDispatcherImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sConfiguration.mm' % ObjCGenerator.OBJC_PREFIX
+
+ def generate_output(self):
+ secondary_headers = [
+ '"%sInternal.h"' % ObjCGenerator.OBJC_PREFIX,
+ '"%sBackendDispatchers.h"' % ObjCGenerator.OBJC_PREFIX,
+ '<JavaScriptCore/AlternateDispatchableAgent.h>',
+ '<JavaScriptCore/AugmentableInspectorController.h>',
+ '<JavaScriptCore/InspectorAlternateBackendDispatchers.h>',
+ '<JavaScriptCore/InspectorBackendDispatchers.h>',
+ ]
+
+ header_args = {
+ 'primaryInclude': '"%sConfiguration.h"' % ObjCGenerator.OBJC_PREFIX,
+ 'secondaryIncludes': '\n'.join(['#import %s' % header for header in secondary_headers]),
+ }
+
+ self._command_filter = ObjCGenerator.should_generate_domain_command_handler_filter(self.model())
+ self._event_filter = ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model())
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.append(self._generate_configuration_implementation_for_domains(domains))
+ sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_configuration_implementation_for_domains(self, domains):
+ lines = []
+ lines.append('@implementation %sConfiguration' % ObjCGenerator.OBJC_PREFIX)
+ lines.append('{')
+ lines.append(' AugmentableInspectorController* _controller;')
+ lines.extend(self._generate_ivars(domains))
+ lines.append('}')
+ lines.append('')
+ lines.append('- (instancetype)initWithController:(AugmentableInspectorController*)controller')
+ lines.append('{')
+ lines.append(' self = [super init];')
+ lines.append(' if (!self)')
+ lines.append(' return nil;')
+ lines.append(' ASSERT(controller);')
+ lines.append(' _controller = controller;')
+ lines.append(' return self;')
+ lines.append('}')
+ lines.append('')
+ lines.extend(self._generate_dealloc(domains))
+ lines.append('')
+ for domain in domains:
+ if domain.commands and self._command_filter(domain):
+ lines.append(self._generate_handler_setter_for_domain(domain))
+ lines.append('')
+ if domain.events and self._event_filter(domain):
+ lines.append(self._generate_event_dispatcher_getter_for_domain(domain))
+ lines.append('')
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_ivars(self, domains):
+ lines = []
+ for domain in domains:
+ if domain.commands and self._command_filter(domain):
+ objc_class_name = '%s%sDomainHandler' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ ivar_name = '_%sHandler' % ObjCGenerator.variable_name_prefix_for_domain(domain)
+ lines.append(' id<%s> %s;' % (objc_class_name, ivar_name))
+ if domain.events and self._event_filter(domain):
+ objc_class_name = '%s%sDomainEventDispatcher' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ ivar_name = '_%sEventDispatcher' % ObjCGenerator.variable_name_prefix_for_domain(domain)
+ lines.append(' %s *%s;' % (objc_class_name, ivar_name))
+ return lines
+
+ def _generate_dealloc(self, domains):
+ lines = []
+ lines.append('- (void)dealloc')
+ lines.append('{')
+ for domain in domains:
+ if domain.commands and self._command_filter(domain):
+ lines.append(' [_%sHandler release];' % ObjCGenerator.variable_name_prefix_for_domain(domain))
+ if domain.events and self._event_filter(domain):
+ lines.append(' [_%sEventDispatcher release];' % ObjCGenerator.variable_name_prefix_for_domain(domain))
+ lines.append(' [super dealloc];')
+ lines.append('}')
+ return lines
+
+ def _generate_handler_setter_for_domain(self, domain):
+ setter_args = {
+ 'objcPrefix': ObjCGenerator.OBJC_PREFIX,
+ 'domainName': domain.domain_name,
+ 'variableNamePrefix': ObjCGenerator.variable_name_prefix_for_domain(domain),
+ }
+ return Template(ObjCTemplates.ConfigurationCommandPropertyImplementation).substitute(None, **setter_args)
+
+ def _generate_event_dispatcher_getter_for_domain(self, domain):
+ getter_args = {
+ 'objcPrefix': ObjCGenerator.OBJC_PREFIX,
+ 'domainName': domain.domain_name,
+ 'variableNamePrefix': ObjCGenerator.variable_name_prefix_for_domain(domain),
+ }
+ return Template(ObjCTemplates.ConfigurationGetterImplementation).substitute(None, **getter_args)
+
+ def _variable_name_prefix_for_domain(self, domain):
+ domain_name = domain.domain_name
+ if domain_name.startswith('DOM'):
+ return 'dom' + domain_name[3:]
+ if domain_name.startswith('CSS'):
+ return 'css' + domain_name[3:]
+ return domain_name[:1].lower() + domain_name[1:]
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py
new file mode 100755
index 000000000..c31e991e3
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator
+from models import EnumType
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+def add_newline(lines):
+ if lines and lines[-1] == '':
+ return
+ lines.append('')
+
+
+class ObjCConversionHelpersGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sEnumConversionHelpers.h' % ObjCGenerator.OBJC_PREFIX
+
+ def domains_to_generate(self):
+ return filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ headers = [
+ '"%sArrayConversionHelpers.h"' % ObjCGenerator.OBJC_PREFIX,
+ ]
+
+ header_args = {
+ 'includes': '\n'.join(['#import ' + header for header in headers]),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.ConversionHelpersPrelude).substitute(None, **header_args))
+ sections.append(Template(ObjCTemplates.ConversionHelpersStandard).substitute(None))
+ sections.extend(map(self._generate_enum_conversion_functions, domains))
+ sections.append(Template(ObjCTemplates.ConversionHelpersPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_enum_conversion_functions(self, domain):
+ lines = []
+
+ # Type enums and member enums.
+ for declaration in domain.type_declarations:
+ if isinstance(declaration.type, EnumType):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_conversion_for_declaration(domain, declaration))
+ else:
+ for member in declaration.type_members:
+ if (isinstance(member.type, EnumType) and member.type.is_anonymous):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_conversion_for_member(domain, declaration, member))
+
+ # Anonymous command enums.
+ for command in domain.commands:
+ for parameter in command.call_parameters:
+ if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
+ for parameter in command.return_parameters:
+ if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, command.command_name, parameter))
+
+ # Anonymous event enums.
+ for event in domain.events:
+ for parameter in event.event_parameters:
+ if (isinstance(parameter.type, EnumType) and parameter.type.is_anonymous):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_conversion_for_parameter(domain, event.event_name, parameter))
+
+ return '\n'.join(lines)
+
+ def _generate_anonymous_enum_conversion_for_declaration(self, domain, declaration):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_declaration(declaration)
+ enum_values = declaration.type.enum_values()
+ lines = []
+ lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values))
+ lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values))
+ return '\n\n'.join(lines)
+
+ def _generate_anonymous_enum_conversion_for_member(self, domain, declaration, member):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_member(declaration, member)
+ enum_values = member.type.enum_values()
+ lines = []
+ lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values))
+ lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values))
+ return '\n\n'.join(lines)
+
+ def _generate_anonymous_enum_conversion_for_parameter(self, domain, event_or_command_name, parameter):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_parameter(domain, event_or_command_name, parameter)
+ enum_values = parameter.type.enum_values()
+ lines = []
+ lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values))
+ lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values))
+ return '\n\n'.join(lines)
+
+ def _generate_enum_objc_to_protocol_string(self, objc_enum_name, enum_values):
+ lines = []
+ lines.append('inline String toProtocolString(%s value)' % objc_enum_name)
+ lines.append('{')
+ lines.append(' switch(value) {')
+ for enum_value in enum_values:
+ lines.append(' case %s%s:' % (objc_enum_name, Generator.stylized_name_for_enum_value(enum_value)))
+ lines.append(' return ASCIILiteral("%s");' % enum_value)
+ lines.append(' }')
+ lines.append('}')
+ return '\n'.join(lines)
+
+ def _generate_enum_from_protocol_string(self, objc_enum_name, enum_values):
+ lines = []
+ lines.append('template<>')
+ lines.append('inline %s fromProtocolString(const String& value)' % objc_enum_name)
+ lines.append('{')
+ for enum_value in enum_values:
+ lines.append(' if (value == "%s")' % enum_value)
+ lines.append(' return %s%s;' % (objc_enum_name, Generator.stylized_name_for_enum_value(enum_value)))
+ lines.append(' ASSERT_NOT_REACHED();')
+ lines.append(' return %s%s;' % (objc_enum_name, Generator.stylized_name_for_enum_value(enum_values[0])))
+ lines.append('}')
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py
new file mode 100755
index 000000000..0030ed5ee
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py
@@ -0,0 +1,154 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from cpp_generator import CppGenerator
+from generator import Generator, ucfirst
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCFrontendDispatcherImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sEventDispatchers.mm' % ObjCGenerator.OBJC_PREFIX
+
+ def domains_to_generate(self):
+ return filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ secondary_headers = [
+ '"%sEnumConversionHelpers.h"' % ObjCGenerator.OBJC_PREFIX,
+ '<JavaScriptCore/InspectorValues.h>',
+ ]
+
+ header_args = {
+ 'primaryInclude': '"%sInternal.h"' % ObjCGenerator.OBJC_PREFIX,
+ 'secondaryIncludes': '\n'.join(['#import %s' % header for header in secondary_headers]),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.extend(map(self._generate_event_dispatcher_implementations, domains))
+ sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_event_dispatcher_implementations(self, domain):
+ if not domain.events:
+ return ''
+
+ lines = []
+ objc_name = '%s%sDomainEventDispatcher' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ lines.append('@implementation %s' % objc_name)
+ lines.append('{')
+ lines.append(' AugmentableInspectorController* _controller;')
+ lines.append('}')
+ lines.append('')
+ lines.append('- (instancetype)initWithController:(AugmentableInspectorController*)controller;')
+ lines.append('{')
+ lines.append(' self = [super init];')
+ lines.append(' if (!self)')
+ lines.append(' return nil;')
+ lines.append(' ASSERT(controller);')
+ lines.append(' _controller = controller;')
+ lines.append(' return self;')
+ lines.append('}')
+ lines.append('')
+ for event in domain.events:
+ lines.append(self._generate_event(domain, event))
+ lines.append('')
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_event(self, domain, event):
+ lines = []
+ lines.append(self._generate_event_signature(domain, event))
+ lines.append('{')
+ lines.append(' const FrontendRouter& router = _controller->frontendRouter();')
+ lines.append('')
+
+ required_pointer_parameters = filter(lambda parameter: not parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters)
+ for parameter in required_pointer_parameters:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(%s, @"%s");' % (var_name, var_name))
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(parameter.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+
+ optional_pointer_parameters = filter(lambda parameter: parameter.is_optional and ObjCGenerator.is_type_objc_pointer_type(parameter.type), event.event_parameters)
+ for parameter in optional_pointer_parameters:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(parameter.parameter_name)
+ lines.append(' THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(%s, @"%s");' % (var_name, var_name))
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(parameter.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_OPTIONAL_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+
+ if required_pointer_parameters or optional_pointer_parameters:
+ lines.append('')
+
+ lines.append(' Ref<InspectorObject> jsonMessage = InspectorObject::create();')
+ lines.append(' jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("%s.%s"));' % (domain.domain_name, event.event_name))
+ if event.event_parameters:
+ lines.extend(self._generate_event_out_parameters(domain, event))
+ lines.append(' router.sendEvent(jsonMessage->toJSONString());')
+ lines.append('}')
+ return '\n'.join(lines)
+
+ def _generate_event_signature(self, domain, event):
+ if not event.event_parameters:
+ return '- (void)%s' % event.event_name
+ pairs = []
+ for parameter in event.event_parameters:
+ param_name = parameter.parameter_name
+ pairs.append('%s:(%s)%s' % (param_name, ObjCGenerator.objc_type_for_param(domain, event.event_name, parameter), param_name))
+ pairs[0] = ucfirst(pairs[0])
+ return '- (void)%sWith%s' % (event.event_name, ' '.join(pairs))
+
+ def _generate_event_out_parameters(self, domain, event):
+ lines = []
+ lines.append(' Ref<InspectorObject> paramsObject = InspectorObject::create();')
+ for parameter in event.event_parameters:
+ keyed_set_method = CppGenerator.cpp_setter_method_for_type(parameter.type)
+ var_name = parameter.parameter_name
+ safe_var_name = '(*%s)' % var_name if parameter.is_optional else var_name
+ export_expression = ObjCGenerator.objc_protocol_export_expression_for_variable(parameter.type, safe_var_name)
+ if not parameter.is_optional:
+ lines.append(' paramsObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
+ else:
+ lines.append(' if (%s)' % (parameter.parameter_name))
+ lines.append(' paramsObject->%s(ASCIILiteral("%s"), %s);' % (keyed_set_method, parameter.parameter_name, export_expression))
+ lines.append(' jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));')
+ return lines
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py
new file mode 100755
index 000000000..7e8e61030
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py
@@ -0,0 +1,229 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator, ucfirst
+from models import ObjectType, EnumType
+from objc_generator import ObjCGenerator, join_type_and_name
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+def add_newline(lines):
+ if lines and lines[-1] == '':
+ return
+ lines.append('')
+
+
+class ObjCHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%s.h' % ObjCGenerator.OBJC_PREFIX
+
+ def generate_output(self):
+ headers = set([
+ '<WebInspector/%sJSONObject.h>' % ObjCGenerator.OBJC_PREFIX,
+ ])
+
+ header_args = {
+ 'includes': '\n'.join(['#import ' + header for header in sorted(headers)]),
+ }
+
+ domains = self.domains_to_generate()
+ type_domains = filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), domains)
+ command_domains = filter(ObjCGenerator.should_generate_domain_command_handler_filter(self.model()), domains)
+ event_domains = filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains)
+
+ # FIXME: <https://webkit.org/b/138222> Web Inspector: Reduce unnecessary enums/types generated in ObjC Protocol Interfaces
+ # Currently we generate enums/types for all types in the type_domains. For the built-in
+ # JSC domains (Debugger, Runtime) this produces extra unused types. We only need to
+ # generate these types if they are referenced by the command_domains or event_domains.
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args))
+ sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains))))
+ sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains))))
+ sections.append('\n'.join(filter(None, map(self._generate_types, type_domains))))
+ sections.append('\n\n'.join(filter(None, map(self._generate_command_protocols, command_domains))))
+ sections.append('\n\n'.join(filter(None, map(self._generate_event_interfaces, event_domains))))
+ sections.append(Template(ObjCTemplates.HeaderPostlude).substitute(None))
+ return '\n\n'.join(sections)
+
+ def _generate_forward_declarations(self, domain):
+ lines = []
+ for declaration in domain.type_declarations:
+ if (isinstance(declaration.type, ObjectType)):
+ objc_name = ObjCGenerator.objc_name_for_type(declaration.type)
+ lines.append('@class %s;' % objc_name)
+ return '\n'.join(lines)
+
+ def _generate_enums(self, domain):
+ lines = []
+
+ # Type enums and member enums.
+ for declaration in domain.type_declarations:
+ if isinstance(declaration.type, EnumType):
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_for_declaration(domain, declaration))
+ else:
+ for member in declaration.type_members:
+ if isinstance(member.type, EnumType) and member.type.is_anonymous:
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_for_member(domain, declaration, member))
+
+ # Anonymous command enums.
+ for command in domain.commands:
+ for parameter in command.call_parameters:
+ if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
+ for parameter in command.return_parameters:
+ if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_for_parameter(domain, command.command_name, parameter))
+
+ # Anonymous event enums.
+ for event in domain.events:
+ for parameter in event.event_parameters:
+ if isinstance(parameter.type, EnumType) and parameter.type.is_anonymous:
+ add_newline(lines)
+ lines.append(self._generate_anonymous_enum_for_parameter(domain, event.event_name, parameter))
+
+ return '\n'.join(lines)
+
+ def _generate_types(self, domain):
+ lines = []
+ # Type interfaces.
+ for declaration in domain.type_declarations:
+ if isinstance(declaration.type, ObjectType):
+ add_newline(lines)
+ lines.append(self._generate_type_interface(domain, declaration))
+ return '\n'.join(lines)
+
+ def _generate_anonymous_enum_for_declaration(self, domain, declaration):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_declaration(declaration)
+ return self._generate_enum(objc_enum_name, declaration.type.enum_values())
+
+ def _generate_anonymous_enum_for_member(self, domain, declaration, member):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_member(declaration, member)
+ return self._generate_enum(objc_enum_name, member.type.enum_values())
+
+ def _generate_anonymous_enum_for_parameter(self, domain, event_or_command_name, parameter):
+ objc_enum_name = ObjCGenerator.objc_enum_name_for_anonymous_enum_parameter(domain, event_or_command_name, parameter)
+ return self._generate_enum(objc_enum_name, parameter.type.enum_values())
+
+ def _generate_enum(self, enum_name, enum_values):
+ lines = []
+ lines.append('typedef NS_ENUM(NSInteger, %s) {' % enum_name)
+ for enum_value in enum_values:
+ lines.append(' %s%s,' % (enum_name, Generator.stylized_name_for_enum_value(enum_value)))
+ lines.append('};')
+ return '\n'.join(lines)
+
+ def _generate_type_interface(self, domain, declaration):
+ lines = []
+ objc_name = ObjCGenerator.objc_name_for_type(declaration.type)
+ lines.append('__attribute__((visibility ("default")))')
+ lines.append('@interface %s : %s' % (objc_name, ObjCGenerator.OBJC_JSON_OBJECT_BASE))
+ required_members = filter(lambda member: not member.is_optional, declaration.type_members)
+ optional_members = filter(lambda member: member.is_optional, declaration.type_members)
+ if required_members:
+ lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members))
+ for member in required_members:
+ lines.append('/* required */ ' + self._generate_member_property(declaration, member))
+ for member in optional_members:
+ lines.append('/* optional */ ' + self._generate_member_property(declaration, member))
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_init_method_for_required_members(self, domain, declaration, required_members):
+ pairs = []
+ for member in required_members:
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ pairs.append('%s:(%s)%s' % (var_name, objc_type, var_name))
+ pairs[0] = ucfirst(pairs[0])
+ return '- (instancetype)initWith%s;' % ' '.join(pairs)
+
+ def _generate_member_property(self, declaration, member):
+ accessor_type = ObjCGenerator.objc_accessor_type_for_member(member)
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ return '@property (nonatomic, %s) %s;' % (accessor_type, join_type_and_name(objc_type, ObjCGenerator.identifier_to_objc_identifier(member.member_name)))
+
+ def _generate_command_protocols(self, domain):
+ lines = []
+ if domain.commands:
+ objc_name = '%s%sDomainHandler' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ lines.append('@protocol %s <NSObject>' % objc_name)
+ lines.append('@required')
+ for command in domain.commands:
+ lines.append(self._generate_single_command_protocol(domain, command))
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_single_command_protocol(self, domain, command):
+ pairs = []
+ pairs.append('ErrorCallback:(void(^)(NSString *error))errorCallback')
+ pairs.append('successCallback:(%s)successCallback' % self._callback_block_for_command(domain, command))
+ for parameter in command.call_parameters:
+ param_name = parameter.parameter_name
+ pairs.append('%s:(%s)%s' % (param_name, ObjCGenerator.objc_type_for_param(domain, command.command_name, parameter), param_name))
+ return '- (void)%sWith%s;' % (command.command_name, ' '.join(pairs))
+
+ def _callback_block_for_command(self, domain, command):
+ pairs = []
+ for parameter in command.return_parameters:
+ pairs.append(join_type_and_name(ObjCGenerator.objc_type_for_param(domain, command.command_name, parameter), parameter.parameter_name))
+ return 'void(^)(%s)' % ', '.join(pairs)
+
+ def _generate_event_interfaces(self, domain):
+ lines = []
+ if domain.events:
+ objc_name = '%s%sDomainEventDispatcher' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ lines.append('__attribute__((visibility ("default")))')
+ lines.append('@interface %s : NSObject' % objc_name)
+ for event in domain.events:
+ lines.append(self._generate_single_event_interface(domain, event))
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_single_event_interface(self, domain, event):
+ if not event.event_parameters:
+ return '- (void)%s;' % event.event_name
+ pairs = []
+ for parameter in event.event_parameters:
+ param_name = parameter.parameter_name
+ pairs.append('%s:(%s)%s' % (param_name, ObjCGenerator.objc_type_for_param(domain, event.event_name, parameter), param_name))
+ pairs[0] = ucfirst(pairs[0])
+ return '- (void)%sWith%s;' % (event.event_name, ' '.join(pairs))
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py
new file mode 100755
index 000000000..40802ff17
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator, ucfirst
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+class ObjCInternalHeaderGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sInternal.h' % ObjCGenerator.OBJC_PREFIX
+
+ def generate_output(self):
+ headers = set([
+ '"%s.h"' % ObjCGenerator.OBJC_PREFIX,
+ '"%sJSONObjectInternal.h"' % ObjCGenerator.OBJC_PREFIX,
+ '<JavaScriptCore/InspectorValues.h>',
+ '<JavaScriptCore/AugmentableInspectorController.h>',
+ ])
+
+ header_args = {
+ 'includes': '\n'.join(['#import ' + header for header in sorted(headers)]),
+ }
+
+ domains = self.domains_to_generate()
+ event_domains = filter(ObjCGenerator.should_generate_domain_event_dispatcher_filter(self.model()), domains)
+
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.GenericHeaderPrelude).substitute(None, **header_args))
+ sections.append('\n\n'.join(filter(None, map(self._generate_event_dispatcher_private_interfaces, event_domains))))
+ sections.append(Template(ObjCTemplates.GenericHeaderPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def _generate_event_dispatcher_private_interfaces(self, domain):
+ lines = []
+ if domain.events:
+ objc_name = '%s%sDomainEventDispatcher' % (ObjCGenerator.OBJC_PREFIX, domain.domain_name)
+ lines.append('@interface %s (Private)' % objc_name)
+ lines.append('- (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller;')
+ lines.append('@end')
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py
new file mode 100755
index 000000000..95b57f671
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+
+import logging
+import string
+from string import Template
+
+from generator import Generator, ucfirst
+from models import ObjectType
+from objc_generator import ObjCGenerator
+from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
+
+log = logging.getLogger('global')
+
+
+def add_newline(lines):
+ if lines and lines[-1] == '':
+ return
+ lines.append('')
+
+
+class ObjCProtocolTypesImplementationGenerator(Generator):
+ def __init__(self, model, input_filepath):
+ Generator.__init__(self, model, input_filepath)
+
+ def output_filename(self):
+ return '%sTypes.mm' % ObjCGenerator.OBJC_PREFIX
+
+ def domains_to_generate(self):
+ return filter(ObjCGenerator.should_generate_domain_types_filter(self.model()), Generator.domains_to_generate(self))
+
+ def generate_output(self):
+ secondary_headers = [
+ '"%sEnumConversionHelpers.h"' % ObjCGenerator.OBJC_PREFIX,
+ '<JavaScriptCore/InspectorValues.h>',
+ '<wtf/Assertions.h>',
+ ]
+
+ header_args = {
+ 'primaryInclude': '"%sInternal.h"' % ObjCGenerator.OBJC_PREFIX,
+ 'secondaryIncludes': '\n'.join(['#import %s' % header for header in secondary_headers]),
+ }
+
+ domains = self.domains_to_generate()
+ sections = []
+ sections.append(self.generate_license())
+ sections.append(Template(ObjCTemplates.ImplementationPrelude).substitute(None, **header_args))
+ sections.extend(map(self.generate_type_implementations, domains))
+ sections.append(Template(ObjCTemplates.ImplementationPostlude).substitute(None, **header_args))
+ return '\n\n'.join(sections)
+
+ def generate_type_implementations(self, domain):
+ lines = []
+ for declaration in domain.type_declarations:
+ if (isinstance(declaration.type, ObjectType)):
+ add_newline(lines)
+ lines.append(self.generate_type_implementation(domain, declaration))
+ return '\n'.join(lines)
+
+ def generate_type_implementation(self, domain, declaration):
+ lines = []
+ lines.append('@implementation %s' % ObjCGenerator.objc_name_for_type(declaration.type))
+ required_members = filter(lambda member: not member.is_optional, declaration.type_members)
+ if required_members:
+ lines.append('')
+ lines.append(self._generate_init_method_for_required_members(domain, declaration, required_members))
+ for member in declaration.type_members:
+ lines.append('')
+ lines.append(self._generate_setter_for_member(domain, declaration, member))
+ lines.append('')
+ lines.append(self._generate_getter_for_member(domain, declaration, member))
+ lines.append('')
+ lines.append('@end')
+ return '\n'.join(lines)
+
+ def _generate_init_method_for_required_members(self, domain, declaration, required_members):
+ pairs = []
+ for member in required_members:
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ pairs.append('%s:(%s)%s' % (var_name, objc_type, var_name))
+ pairs[0] = ucfirst(pairs[0])
+ lines = []
+ lines.append('- (instancetype)initWith%s;' % ' '.join(pairs))
+ lines.append('{')
+ lines.append(' self = [super init];')
+ lines.append(' if (!self)')
+ lines.append(' return nil;')
+ lines.append('')
+
+ required_pointer_members = filter(lambda member: ObjCGenerator.is_type_objc_pointer_type(member.type), required_members)
+ if required_pointer_members:
+ for member in required_pointer_members:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ lines.append(' THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(%s, @"%s");' % (var_name, var_name))
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(member.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+ lines.append('')
+
+ for member in required_members:
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ lines.append(' self.%s = %s;' % (var_name, var_name))
+
+ lines.append('')
+ lines.append(' return self;')
+ lines.append('}')
+ return '\n'.join(lines)
+
+ def _generate_setter_for_member(self, domain, declaration, member):
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ setter_method = ObjCGenerator.objc_setter_method_for_member(declaration, member)
+ conversion_expression = ObjCGenerator.objc_to_protocol_expression_for_member(declaration, member, var_name)
+ lines = []
+ lines.append('- (void)set%s:(%s)%s' % (ucfirst(var_name), objc_type, var_name))
+ lines.append('{')
+ objc_array_class = ObjCGenerator.objc_class_for_array_type(member.type)
+ if objc_array_class and objc_array_class.startswith(ObjCGenerator.OBJC_PREFIX):
+ lines.append(' THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(%s, [%s class]);' % (var_name, objc_array_class))
+ lines.append(' [super %s:%s forKey:@"%s"];' % (setter_method, conversion_expression, member.member_name))
+ lines.append('}')
+ return '\n'.join(lines)
+
+ def _generate_getter_for_member(self, domain, declaration, member):
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ var_name = ObjCGenerator.identifier_to_objc_identifier(member.member_name)
+ getter_method = ObjCGenerator.objc_getter_method_for_member(declaration, member)
+ basic_expression = '[super %s:@"%s"]' % (getter_method, member.member_name)
+ conversion_expression = ObjCGenerator.protocol_to_objc_expression_for_member(declaration, member, basic_expression)
+ lines = []
+ lines.append('- (%s)%s' % (objc_type, var_name))
+ lines.append('{')
+ lines.append(' return %s;' % conversion_expression)
+ lines.append('}')
+ return '\n'.join(lines)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/generator.py
new file mode 100755
index 000000000..4c8f1998e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generator.py
@@ -0,0 +1,241 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import os.path
+import re
+from string import Template
+
+from generator_templates import GeneratorTemplates as Templates
+from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
+
+log = logging.getLogger('global')
+
+
+def ucfirst(str):
+ return str[:1].upper() + str[1:]
+
+_ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML'])
+
+# These objects are built manually by creating and setting InspectorValues.
+# Before sending these over the protocol, their shapes are checked against the specification.
+# So, any types referenced by these types require debug-only assertions that check values.
+# Calculating necessary assertions is annoying, and adds a lot of complexity to the generator.
+
+# FIXME: This should be converted into a property in JSON.
+_TYPES_NEEDING_RUNTIME_CASTS = set([
+ "Runtime.RemoteObject",
+ "Runtime.PropertyDescriptor",
+ "Runtime.InternalPropertyDescriptor",
+ "Runtime.CollectionEntry",
+ "Debugger.FunctionDetails",
+ "Debugger.CallFrame",
+ "Canvas.TraceLog",
+ "Canvas.ResourceInfo",
+ "Canvas.ResourceState",
+ # This should be a temporary hack. TimelineEvent should be created via generated C++ API.
+ "Timeline.TimelineEvent",
+ # For testing purposes only.
+ "Test.TypeNeedingCast"
+])
+
+# FIXME: This should be converted into a property in JSON.
+_TYPES_WITH_OPEN_FIELDS = set([
+ "Timeline.TimelineEvent",
+ # InspectorStyleSheet not only creates this property but wants to read it and modify it.
+ "CSS.CSSProperty",
+ # InspectorNetworkAgent needs to update mime-type.
+ "Network.Response",
+ # For testing purposes only.
+ "Test.OpenParameterBundle"
+])
+
+
+class Generator:
+ def __init__(self, model, input_filepath):
+ self._model = model
+ self._input_filepath = input_filepath
+
+ def model(self):
+ return self._model
+
+ def generate_license(self):
+ return Template(Templates.CopyrightBlock).substitute(None, inputFilename=os.path.basename(self._input_filepath))
+
+ # These methods are overridden by subclasses.
+ def non_supplemental_domains(self):
+ return filter(lambda domain: not domain.is_supplemental, self.model().domains)
+
+ def domains_to_generate(self):
+ return self.non_supplemental_domains()
+
+ def generate_output(self):
+ pass
+
+ def output_filename(self):
+ pass
+
+ def encoding_for_enum_value(self, enum_value):
+ if not hasattr(self, "_assigned_enum_values"):
+ self._traverse_and_assign_enum_values()
+
+ return self._enum_value_encodings[enum_value]
+
+ def assigned_enum_values(self):
+ if not hasattr(self, "_assigned_enum_values"):
+ self._traverse_and_assign_enum_values()
+
+ return self._assigned_enum_values[:] # Slice.
+
+ @staticmethod
+ def type_needs_runtime_casts(_type):
+ return _type.qualified_name() in _TYPES_NEEDING_RUNTIME_CASTS
+
+ @staticmethod
+ def type_has_open_fields(_type):
+ return _type.qualified_name() in _TYPES_WITH_OPEN_FIELDS
+
+ def type_needs_shape_assertions(self, _type):
+ if not hasattr(self, "_types_needing_shape_assertions"):
+ self.calculate_types_requiring_shape_assertions(self.model().domains)
+
+ return _type in self._types_needing_shape_assertions
+
+ # To restrict the domains over which we compute types needing assertions, call this method
+ # before generating any output with the desired domains parameter. The computed
+ # set of types will not be automatically regenerated on subsequent calls to
+ # Generator.types_needing_shape_assertions().
+ def calculate_types_requiring_shape_assertions(self, domains):
+ domain_names = map(lambda domain: domain.domain_name, domains)
+ log.debug("> Calculating types that need shape assertions (eligible domains: %s)" % ", ".join(domain_names))
+
+ # Mutates the passed-in set; this simplifies checks to prevent infinite recursion.
+ def gather_transitively_referenced_types(_type, gathered_types):
+ if _type in gathered_types:
+ return
+
+ if isinstance(_type, ObjectType):
+ log.debug("> Adding type %s to list of types needing shape assertions." % _type.qualified_name())
+ gathered_types.add(_type)
+ for type_member in _type.members:
+ gather_transitively_referenced_types(type_member.type, gathered_types)
+ elif isinstance(_type, EnumType):
+ log.debug("> Adding type %s to list of types needing shape assertions." % _type.qualified_name())
+ gathered_types.add(_type)
+ elif isinstance(_type, AliasedType):
+ gather_transitively_referenced_types(_type.aliased_type, gathered_types)
+ elif isinstance(_type, ArrayType):
+ gather_transitively_referenced_types(_type.element_type, gathered_types)
+
+ found_types = set()
+ for domain in domains:
+ for declaration in domain.type_declarations:
+ if declaration.type.qualified_name() in _TYPES_NEEDING_RUNTIME_CASTS:
+ log.debug("> Gathering types referenced by %s to generate shape assertions." % declaration.type.qualified_name())
+ gather_transitively_referenced_types(declaration.type, found_types)
+
+ self._types_needing_shape_assertions = found_types
+
+ # Private helper instance methods.
+ def _traverse_and_assign_enum_values(self):
+ self._enum_value_encodings = {}
+ self._assigned_enum_values = []
+ all_types = []
+
+ domains = self.non_supplemental_domains()
+
+ for domain in domains:
+ for type_declaration in domain.type_declarations:
+ all_types.append(type_declaration.type)
+ for type_member in type_declaration.type_members:
+ all_types.append(type_member.type)
+
+ for domain in domains:
+ for event in domain.events:
+ all_types.extend([parameter.type for parameter in event.event_parameters])
+
+ for domain in domains:
+ for command in domain.commands:
+ all_types.extend([parameter.type for parameter in command.call_parameters])
+ all_types.extend([parameter.type for parameter in command.return_parameters])
+
+ for _type in all_types:
+ if not isinstance(_type, EnumType):
+ continue
+ map(self._assign_encoding_for_enum_value, _type.enum_values())
+
+ def _assign_encoding_for_enum_value(self, enum_value):
+ if enum_value in self._enum_value_encodings:
+ return
+
+ self._enum_value_encodings[enum_value] = len(self._assigned_enum_values)
+ self._assigned_enum_values.append(enum_value)
+
+ # Miscellaneous text manipulation routines.
+ def wrap_with_guard_for_domain(self, domain, text):
+ if self.model().framework is Frameworks.WebInspector:
+ return text
+ guard = domain.feature_guard
+ if guard:
+ return Generator.wrap_with_guard(guard, text)
+ return text
+
+ @staticmethod
+ def wrap_with_guard(guard, text):
+ return '\n'.join([
+ '#if %s' % guard,
+ text,
+ '#endif // %s' % guard,
+ ])
+
+ @staticmethod
+ def stylized_name_for_enum_value(enum_value):
+ regex = '(%s)' % "|".join(_ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS)
+
+ def replaceCallback(match):
+ return match.group(1).upper()
+
+ # Split on hyphen, introduce camelcase, and force uppercasing of acronyms.
+ subwords = map(ucfirst, enum_value.split('-'))
+ return re.sub(re.compile(regex, re.IGNORECASE), replaceCallback, "".join(subwords))
+
+ @staticmethod
+ def js_name_for_parameter_type(_type):
+ _type = _type
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type # Fall through.
+ if isinstance(_type, EnumType):
+ _type = _type.primitive_type # Fall through.
+
+ if isinstance(_type, (ArrayType, ObjectType)):
+ return 'object'
+ if isinstance(_type, PrimitiveType):
+ if _type.qualified_name() in ['object', 'any']:
+ return 'object'
+ elif _type.qualified_name() in ['integer', 'number']:
+ return 'number'
+ else:
+ return _type.qualified_name()
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py b/Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py
new file mode 100644
index 000000000..f2e330a72
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# Generator templates, which can be filled with string.Template.
+# Following are classes that fill the templates from the typechecked model.
+
+
+class GeneratorTemplates:
+ CopyrightBlock = (
+ """/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from ${inputFilename}
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py""")
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/models.py b/Source/JavaScriptCore/inspector/scripts/codegen/models.py
new file mode 100755
index 000000000..ec16a1291
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/models.py
@@ -0,0 +1,591 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import collections
+
+log = logging.getLogger('global')
+
+
+def ucfirst(str):
+ return str[:1].upper() + str[1:]
+
+
+def find_duplicates(l):
+ return [key for key, count in collections.Counter(l).items() if count > 1]
+
+
+_FRAMEWORK_CONFIG_MAP = {
+ "Global": {
+ },
+ "JavaScriptCore": {
+ "export_macro": "JS_EXPORT_PRIVATE"
+ },
+ "WebInspector": {
+ },
+ # Used for code generator tests.
+ "Test": {
+ }
+}
+
+
+class ParseException(Exception):
+ pass
+
+
+class TypecheckException(Exception):
+ pass
+
+
+class Framework:
+ def __init__(self, name):
+ self._settings = _FRAMEWORK_CONFIG_MAP[name]
+ self.name = name
+
+ def setting(self, key, default=''):
+ return self._settings.get(key, default)
+
+ @staticmethod
+ def fromString(frameworkString):
+ if frameworkString == "Global":
+ return Frameworks.Global
+
+ if frameworkString == "JavaScriptCore":
+ return Frameworks.JavaScriptCore
+
+ if frameworkString == "WebInspector":
+ return Frameworks.WebInspector
+
+ if frameworkString == "Test":
+ return Frameworks.Test
+
+ raise ParseException("Unknown framework: %s" % frameworkString)
+
+
+class Frameworks:
+ Global = Framework("Global")
+ JavaScriptCore = Framework("JavaScriptCore")
+ WebInspector = Framework("WebInspector")
+ Test = Framework("Test")
+
+
+class TypeReference:
+ def __init__(self, type_kind, referenced_type_name, enum_values, array_items):
+ self.type_kind = type_kind
+ self.referenced_type_name = referenced_type_name
+ self.enum_values = enum_values
+ if array_items is None:
+ self.array_type_ref = None
+ else:
+ self.array_type_ref = TypeReference(array_items.get('type'), array_items.get('$ref'), array_items.get('enum'), array_items.get('items'))
+
+ if type_kind is not None and referenced_type_name is not None:
+ raise ParseException("Type reference cannot have both 'type' and '$ref' keys.")
+
+ if type_kind == "array" and array_items is None:
+ raise ParseException("Type reference with type 'array' must have key 'items' to define array element type.")
+
+ if enum_values is not None and len(enum_values) == 0:
+ raise ParseException("Type reference with enum values must have at least one enum value.")
+
+ def referenced_name(self):
+ if self.referenced_type_name is not None:
+ return self.referenced_type_name
+ else:
+ return self.type_kind # integer, string, number, boolean, enum, object, array
+
+
+class Type:
+ def __init__(self):
+ pass
+
+ def __eq__(self, other):
+ return self.qualified_name() == other.qualified_name()
+
+ def __hash__(self):
+ return self.qualified_name().__hash__()
+
+ def raw_name(self):
+ return self._name
+
+ # These methods should be overridden by subclasses.
+ def is_enum(self):
+ return False
+
+ def type_domain(self):
+ pass
+
+ def qualified_name(self):
+ pass
+
+ # This is used to resolve nested types after instances are created.
+ def resolve_type_references(self, protocol):
+ pass
+
+
+class PrimitiveType(Type):
+ def __init__(self, name):
+ self._name = name
+
+ def __repr__(self):
+ return 'PrimitiveType[%s]' % self.qualified_name()
+
+ def type_domain(self):
+ return None
+
+ def qualified_name(self):
+ return self.raw_name()
+
+
+class AliasedType(Type):
+ def __init__(self, name, domain, aliased_type_ref):
+ self._name = name
+ self._domain = domain
+ self._aliased_type_ref = aliased_type_ref
+ self.aliased_type = None
+
+ def __repr__(self):
+ if self.aliased_type is not None:
+ return 'AliasedType[%s -> %r]' % (self.qualified_name(), self.aliased_type)
+ else:
+ return 'AliasedType[%s -> (unresolved)]' % self.qualified_name()
+
+ def is_enum(self):
+ return self.aliased_type.is_enum()
+
+ def type_domain(self):
+ return self._domain
+
+ def qualified_name(self):
+ return ".".join([self.type_domain().domain_name, self.raw_name()])
+
+ def resolve_type_references(self, protocol):
+ if self.aliased_type is not None:
+ return
+
+ self.aliased_type = protocol.lookup_type_reference(self._aliased_type_ref, self.type_domain())
+ log.debug("< Resolved type reference for aliased type in %s: %s" % (self.qualified_name(), self.aliased_type.qualified_name()))
+
+
+class EnumType(Type):
+ def __init__(self, name, domain, values, primitive_type_ref, is_anonymous=False):
+ self._name = name
+ self._domain = domain
+ self._values = values
+ self._primitive_type_ref = primitive_type_ref
+ self.primitive_type = None
+ self.is_anonymous = is_anonymous
+
+ def __repr__(self):
+ return 'EnumType[value_type=%s; values=%s]' % (self.qualified_name(), ', '.join(map(str, self.enum_values())))
+
+ def is_enum(self):
+ return True
+
+ def type_domain(self):
+ return self._domain
+
+ def enum_values(self):
+ return self._values
+
+ def qualified_name(self):
+ return ".".join([self.type_domain().domain_name, self.raw_name()])
+
+ def resolve_type_references(self, protocol):
+ if self.primitive_type is not None:
+ return
+
+ self.primitive_type = protocol.lookup_type_reference(self._primitive_type_ref, Domains.GLOBAL)
+ log.debug("< Resolved type reference for enum type in %s: %s" % (self.qualified_name(), self.primitive_type.qualified_name()))
+ log.debug("<< enum values: %s" % self.enum_values())
+
+
+class ArrayType(Type):
+ def __init__(self, name, element_type_ref, domain):
+ self._name = name
+ self._domain = domain
+ self._element_type_ref = element_type_ref
+ self.element_type = None
+
+ def __repr__(self):
+ if self.element_type is not None:
+ return 'ArrayType[element_type=%r]' % self.element_type
+ else:
+ return 'ArrayType[element_type=(unresolved)]'
+
+ def type_domain(self):
+ return self._domain
+
+ def qualified_name(self):
+ return ".".join(["array", self.element_type.qualified_name()])
+
+ def resolve_type_references(self, protocol):
+ if self.element_type is not None:
+ return
+
+ self.element_type = protocol.lookup_type_reference(self._element_type_ref, self.type_domain())
+ log.debug("< Resolved type reference for element type in %s: %s" % (self.qualified_name(), self.element_type.qualified_name()))
+
+
+class ObjectType(Type):
+ def __init__(self, name, domain, members):
+ self._name = name
+ self._domain = domain
+ self.members = members
+
+ def __repr__(self):
+ return 'ObjectType[%s]' % self.qualified_name()
+
+ def type_domain(self):
+ return self._domain
+
+ def qualified_name(self):
+ return ".".join([self.type_domain().domain_name, self.raw_name()])
+
+
+def check_for_required_properties(props, obj, what):
+ for prop in props:
+ if prop not in obj:
+ raise ParseException("When parsing %s, required property missing: %s" % (what, prop))
+
+
+class Protocol:
+ def __init__(self, framework_name):
+ self.domains = []
+ self.types_by_name = {}
+ self.framework = Framework.fromString(framework_name)
+
+ def parse_specification(self, json, isSupplemental):
+ log.debug("parse toplevel")
+
+ if isinstance(json, dict) and 'domains' in json:
+ json = json['domains']
+ if not isinstance(json, list):
+ json = [json]
+
+ for domain in json:
+ self.parse_domain(domain, isSupplemental)
+
+ def parse_domain(self, json, isSupplemental):
+ check_for_required_properties(['domain'], json, "domain")
+ log.debug("parse domain " + json['domain'])
+
+ types = []
+ commands = []
+ events = []
+
+ if 'types' in json:
+ if not isinstance(json['types'], list):
+ raise ParseException("Malformed domain specification: types is not an array")
+ types.extend([self.parse_type_declaration(declaration) for declaration in json['types']])
+
+ if 'commands' in json:
+ if not isinstance(json['commands'], list):
+ raise ParseException("Malformed domain specification: commands is not an array")
+ commands.extend([self.parse_command(command) for command in json['commands']])
+
+ if 'events' in json:
+ if not isinstance(json['events'], list):
+ raise ParseException("Malformed domain specification: events is not an array")
+ events.extend([self.parse_event(event) for event in json['events']])
+
+ if 'availability' in json:
+ if not commands and not events:
+ raise ParseException("Malformed domain specification: availability should only be included if there are commands or events.")
+ allowed_activation_strings = set(['web'])
+ if json['availability'] not in allowed_activation_strings:
+ raise ParseException('Malformed domain specification: availability is an unsupported string. Was: "%s", Allowed values: %s' % (json['availability'], ', '.join(allowed_activation_strings)))
+
+ self.domains.append(Domain(json['domain'], json.get('description', ''), json.get('featureGuard'), json.get('availability'), isSupplemental, types, commands, events))
+
+ def parse_type_declaration(self, json):
+ check_for_required_properties(['id', 'type'], json, "type")
+ log.debug("parse type %s" % json['id'])
+
+ type_members = []
+
+ if 'properties' in json:
+ if not isinstance(json['properties'], list):
+ raise ParseException("Malformed type specification: properties is not an array")
+ type_members.extend([self.parse_type_member(member) for member in json['properties']])
+
+ duplicate_names = find_duplicates([member.member_name for member in type_members])
+ if len(duplicate_names) > 0:
+ raise ParseException("Malformed domain specification: type declaration for %s has duplicate member names" % json['id'])
+
+ type_ref = TypeReference(json['type'], json.get('$ref'), json.get('enum'), json.get('items'))
+ return TypeDeclaration(json['id'], type_ref, json.get("description", ""), type_members)
+
+ def parse_type_member(self, json):
+ check_for_required_properties(['name'], json, "type member")
+ log.debug("parse type member %s" % json['name'])
+
+ type_ref = TypeReference(json.get('type'), json.get('$ref'), json.get('enum'), json.get('items'))
+ return TypeMember(json['name'], type_ref, json.get('optional', False), json.get('description', ""))
+
+ def parse_command(self, json):
+ check_for_required_properties(['name'], json, "command")
+ log.debug("parse command %s" % json['name'])
+
+ call_parameters = []
+ return_parameters = []
+
+ if 'parameters' in json:
+ if not isinstance(json['parameters'], list):
+ raise ParseException("Malformed command specification: parameters is not an array")
+ call_parameters.extend([self.parse_call_or_return_parameter(parameter) for parameter in json['parameters']])
+
+ duplicate_names = find_duplicates([param.parameter_name for param in call_parameters])
+ if len(duplicate_names) > 0:
+ raise ParseException("Malformed domain specification: call parameter list for command %s has duplicate parameter names" % json['name'])
+
+ if 'returns' in json:
+ if not isinstance(json['returns'], list):
+ raise ParseException("Malformed command specification: returns is not an array")
+ return_parameters.extend([self.parse_call_or_return_parameter(parameter) for parameter in json['returns']])
+
+ duplicate_names = find_duplicates([param.parameter_name for param in return_parameters])
+ if len(duplicate_names) > 0:
+ raise ParseException("Malformed domain specification: return parameter list for command %s has duplicate parameter names" % json['name'])
+
+ return Command(json['name'], call_parameters, return_parameters, json.get('description', ""), json.get('async', False))
+
+ def parse_event(self, json):
+ check_for_required_properties(['name'], json, "event")
+ log.debug("parse event %s" % json['name'])
+
+ event_parameters = []
+
+ if 'parameters' in json:
+ if not isinstance(json['parameters'], list):
+ raise ParseException("Malformed event specification: parameters is not an array")
+ event_parameters.extend([self.parse_call_or_return_parameter(parameter) for parameter in json['parameters']])
+
+ duplicate_names = find_duplicates([param.parameter_name for param in event_parameters])
+ if len(duplicate_names) > 0:
+ raise ParseException("Malformed domain specification: parameter list for event %s has duplicate parameter names" % json['name'])
+
+ return Event(json['name'], event_parameters, json.get('description', ""))
+
+ def parse_call_or_return_parameter(self, json):
+ check_for_required_properties(['name'], json, "parameter")
+ log.debug("parse parameter %s" % json['name'])
+
+ type_ref = TypeReference(json.get('type'), json.get('$ref'), json.get('enum'), json.get('items'))
+ return Parameter(json['name'], type_ref, json.get('optional', False), json.get('description', ""))
+
+ def resolve_types(self):
+ qualified_declared_type_names = set(['boolean', 'string', 'integer', 'number', 'enum', 'array', 'object', 'any'])
+
+ self.types_by_name['string'] = PrimitiveType('string')
+ for _primitive_type in ['boolean', 'integer', 'number']:
+ self.types_by_name[_primitive_type] = PrimitiveType(_primitive_type)
+ for _object_type in ['any', 'object']:
+ self.types_by_name[_object_type] = PrimitiveType(_object_type)
+
+ # Gather qualified type names from type declarations in each domain.
+ for domain in self.domains:
+ for declaration in domain.type_declarations:
+ # Basic sanity checking.
+ if declaration.type_ref.referenced_type_name is not None:
+ raise TypecheckException("Type declarations must name a base type, not a type reference.")
+
+ # Find duplicate qualified type names.
+ qualified_type_name = ".".join([domain.domain_name, declaration.type_name])
+ if qualified_type_name in qualified_declared_type_names:
+ raise TypecheckException("Duplicate type declaration: %s" % qualified_type_name)
+
+ qualified_declared_type_names.add(qualified_type_name)
+
+ type_instance = None
+
+ kind = declaration.type_ref.type_kind
+ if declaration.type_ref.enum_values is not None:
+ primitive_type_ref = TypeReference(declaration.type_ref.type_kind, None, None, None)
+ type_instance = EnumType(declaration.type_name, domain, declaration.type_ref.enum_values, primitive_type_ref)
+ elif kind == "array":
+ type_instance = ArrayType(declaration.type_name, declaration.type_ref.array_type_ref, domain)
+ elif kind == "object":
+ type_instance = ObjectType(declaration.type_name, domain, declaration.type_members)
+ else:
+ type_instance = AliasedType(declaration.type_name, domain, declaration.type_ref)
+
+ log.debug("< Created fresh type %r for declaration %s" % (type_instance, qualified_type_name))
+ self.types_by_name[qualified_type_name] = type_instance
+
+ # Resolve all type references recursively.
+ for domain in self.domains:
+ domain.resolve_type_references(self)
+
+ def lookup_type_for_declaration(self, declaration, domain):
+ # This will only match a type defined in the same domain, where prefixes aren't required.
+ qualified_name = ".".join([domain.domain_name, declaration.type_name])
+ if qualified_name in self.types_by_name:
+ found_type = self.types_by_name[qualified_name]
+ found_type.resolve_type_references(self)
+ return found_type
+
+ raise TypecheckException("Lookup failed for type declaration: %s (referenced from domain: %s)" % (declaration.type_name, domain.domain_name))
+
+ def lookup_type_reference(self, type_ref, domain):
+ # If reference is to an anonymous array type, create a fresh instance.
+ if type_ref.type_kind == "array":
+ type_instance = ArrayType(None, type_ref.array_type_ref, domain)
+ type_instance.resolve_type_references(self)
+ log.debug("< Created fresh type instance for anonymous array type: %s" % type_instance.qualified_name())
+ return type_instance
+
+ # If reference is to an anonymous enum type, create a fresh instance.
+ if type_ref.enum_values is not None:
+ # We need to create a type reference without enum values as the enum's nested type.
+ primitive_type_ref = TypeReference(type_ref.type_kind, None, None, None)
+ type_instance = EnumType("(anonymous)", domain, type_ref.enum_values, primitive_type_ref, True)
+ type_instance.resolve_type_references(self)
+ log.debug("< Created fresh type instance for anonymous enum type: %s" % type_instance.qualified_name())
+ return type_instance
+
+ # This will match when referencing a type defined in the same domain, where prefixes aren't required.
+ qualified_name = ".".join([domain.domain_name, type_ref.referenced_name()])
+ if qualified_name in self.types_by_name:
+ found_type = self.types_by_name[qualified_name]
+ found_type.resolve_type_references(self)
+ log.debug("< Lookup succeeded for unqualified type: %s" % found_type.qualified_name())
+ return found_type
+
+ # This will match primitive types and fully-qualified types from a different domain.
+ if type_ref.referenced_name() in self.types_by_name:
+ found_type = self.types_by_name[type_ref.referenced_name()]
+ found_type.resolve_type_references(self)
+ log.debug("< Lookup succeeded for primitive or qualified type: %s" % found_type.qualified_name())
+ return found_type
+
+ raise TypecheckException("Lookup failed for type reference: %s (referenced from domain: %s)" % (type_ref.referenced_name(), domain.domain_name))
+
+
+class Domain:
+ def __init__(self, domain_name, description, feature_guard, availability, isSupplemental, type_declarations, commands, events):
+ self.domain_name = domain_name
+ self.description = description
+ self.feature_guard = feature_guard
+ self.availability = availability
+ self.is_supplemental = isSupplemental
+ self.type_declarations = type_declarations
+ self.commands = commands
+ self.events = events
+
+ def resolve_type_references(self, protocol):
+ log.debug("> Resolving type declarations for domain: %s" % self.domain_name)
+ for declaration in self.type_declarations:
+ declaration.resolve_type_references(protocol, self)
+
+ log.debug("> Resolving types in commands for domain: %s" % self.domain_name)
+ for command in self.commands:
+ command.resolve_type_references(protocol, self)
+
+ log.debug("> Resolving types in events for domain: %s" % self.domain_name)
+ for event in self.events:
+ event.resolve_type_references(protocol, self)
+
+
+class Domains:
+ GLOBAL = Domain("", "The global domain, in which primitive types are implicitly declared.", None, None, True, [], [], [])
+
+
+class TypeDeclaration:
+ def __init__(self, type_name, type_ref, description, type_members):
+ self.type_name = type_name
+ self.type_ref = type_ref
+ self.description = description
+ self.type_members = type_members
+
+ if self.type_name != ucfirst(self.type_name):
+ raise ParseException("Types must begin with an uppercase character.")
+
+ def resolve_type_references(self, protocol, domain):
+ log.debug(">> Resolving type references for type declaration: %s" % self.type_name)
+ self.type = protocol.lookup_type_for_declaration(self, domain)
+ for member in self.type_members:
+ member.resolve_type_references(protocol, domain)
+
+
+class TypeMember:
+ def __init__(self, member_name, type_ref, is_optional, description):
+ self.member_name = member_name
+ self.type_ref = type_ref
+ self.is_optional = is_optional
+ self.description = description
+
+ if not isinstance(self.is_optional, bool):
+ raise ParseException("The 'optional' flag for a type member must be a boolean literal.")
+
+ def resolve_type_references(self, protocol, domain):
+ log.debug(">>> Resolving type references for type member: %s" % self.member_name)
+ self.type = protocol.lookup_type_reference(self.type_ref, domain)
+
+
+class Parameter:
+ def __init__(self, parameter_name, type_ref, is_optional, description):
+ self.parameter_name = parameter_name
+ self.type_ref = type_ref
+ self.is_optional = is_optional
+ self.description = description
+
+ if not isinstance(self.is_optional, bool):
+ raise ParseException("The 'optional' flag for a parameter must be a boolean literal.")
+
+ def resolve_type_references(self, protocol, domain):
+ log.debug(">>> Resolving type references for parameter: %s" % self.parameter_name)
+ self.type = protocol.lookup_type_reference(self.type_ref, domain)
+
+
+class Command:
+ def __init__(self, command_name, call_parameters, return_parameters, description, is_async):
+ self.command_name = command_name
+ self.call_parameters = call_parameters
+ self.return_parameters = return_parameters
+ self.description = description
+ self.is_async = is_async
+
+ def resolve_type_references(self, protocol, domain):
+ log.debug(">> Resolving type references for call parameters in command: %s" % self.command_name)
+ for parameter in self.call_parameters:
+ parameter.resolve_type_references(protocol, domain)
+
+ log.debug(">> Resolving type references for return parameters in command: %s" % self.command_name)
+ for parameter in self.return_parameters:
+ parameter.resolve_type_references(protocol, domain)
+
+
+class Event:
+ def __init__(self, event_name, event_parameters, description):
+ self.event_name = event_name
+ self.event_parameters = event_parameters
+ self.description = description
+
+ def resolve_type_references(self, protocol, domain):
+ log.debug(">> Resolving type references for parameters in event: %s" % self.event_name)
+ for parameter in self.event_parameters:
+ parameter.resolve_type_references(protocol, domain)
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py
new file mode 100755
index 000000000..f6dd03cb5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+from generator import Generator, ucfirst
+from models import PrimitiveType, ObjectType, ArrayType, EnumType, AliasedType, Frameworks
+
+log = logging.getLogger('global')
+
+
+def join_type_and_name(type_str, name_str):
+ if type_str.endswith('*'):
+ return type_str + name_str
+ return type_str + ' ' + name_str
+
+
+def strip_block_comment_markers(str):
+ return str.replace('/*', '').replace('*/', '')
+
+
+def remove_duplicate_from_str(str, possible_duplicate):
+ return str.replace(possible_duplicate + possible_duplicate, possible_duplicate)
+
+
+_OBJC_IDENTIFIER_RENAME_MAP = {
+ 'this': 'thisObject', # Debugger.CallFrame.this
+ 'description': 'stringRepresentation', # Runtime.RemoteObject.description
+ 'id': 'identifier', # Page.Frame.id, Runtime.ExecutionContextDescription.id, Debugger.BreakpointAction.id
+}
+
+_OBJC_IDENTIFIER_REVERSE_RENAME_MAP = dict((v, k) for k, v in _OBJC_IDENTIFIER_RENAME_MAP.iteritems())
+
+
+class ObjCTypeCategory:
+ Simple = 0
+ String = 1
+ Object = 2
+ Array = 3
+
+ @staticmethod
+ def category_for_type(_type):
+ if (isinstance(_type, PrimitiveType)):
+ if _type.raw_name() is 'string':
+ return ObjCTypeCategory.String
+ if _type.raw_name() in ['object', 'any']:
+ return ObjCTypeCategory.Object
+ if _type.raw_name() is 'array':
+ return ObjCTypeCategory.Array
+ return ObjCTypeCategory.Simple
+ if (isinstance(_type, ObjectType)):
+ return ObjCTypeCategory.Object
+ if (isinstance(_type, ArrayType)):
+ return ObjCTypeCategory.Array
+ if (isinstance(_type, AliasedType)):
+ return ObjCTypeCategory.category_for_type(_type.aliased_type)
+ if (isinstance(_type, EnumType)):
+ return ObjCTypeCategory.category_for_type(_type.primitive_type)
+ return None
+
+
+
+# This class contains extra static methods used for generation, but does
+# not participate in any inheritance hierarchy. File generators should
+# extend the generic "Generator" class instead.
+class ObjCGenerator:
+ OBJC_PREFIX = 'RWIProtocol'
+ OBJC_JSON_OBJECT_BASE = '%sJSONObject' % OBJC_PREFIX
+
+ # Adjust identifier names that collide with ObjC keywords.
+
+ @staticmethod
+ def identifier_to_objc_identifier(name):
+ return _OBJC_IDENTIFIER_RENAME_MAP.get(name, name)
+
+ @staticmethod
+ def objc_identifier_to_identifier(name):
+ return _OBJC_IDENTIFIER_REVERSE_RENAME_MAP.get(name, name)
+
+ # Generate ObjC types, command handlers, and event dispatchers for a subset of domains.
+
+ DOMAINS_TO_GENERATE = ['CSS', 'DOM', 'DOMStorage', 'Network', 'Page', 'GenericTypes']
+
+ @staticmethod
+ def should_generate_domain_types_filter(model):
+ def should_generate_domain_types(domain):
+ if model.framework is Frameworks.Test:
+ return True
+ whitelist = set(ObjCGenerator.DOMAINS_TO_GENERATE)
+ whitelist.update(set(['Console', 'Debugger', 'Runtime']))
+ return domain.domain_name in whitelist
+ return should_generate_domain_types
+
+ @staticmethod
+ def should_generate_domain_command_handler_filter(model):
+ def should_generate_domain_command_handler(domain):
+ if model.framework is Frameworks.Test:
+ return True
+ whitelist = set(ObjCGenerator.DOMAINS_TO_GENERATE)
+ return domain.domain_name in whitelist
+ return should_generate_domain_command_handler
+
+ @staticmethod
+ def should_generate_domain_event_dispatcher_filter(model):
+ def should_generate_domain_event_dispatcher(domain):
+ if model.framework is Frameworks.Test:
+ return True
+ whitelist = set(ObjCGenerator.DOMAINS_TO_GENERATE)
+ whitelist.add('Console')
+ return domain.domain_name in whitelist
+ return should_generate_domain_event_dispatcher
+
+ # ObjC enum and type names.
+
+ @staticmethod
+ def objc_name_for_type(type):
+ name = type.qualified_name().replace('.', '')
+ name = remove_duplicate_from_str(name, type.type_domain().domain_name)
+ return '%s%s' % (ObjCGenerator.OBJC_PREFIX, name)
+
+ @staticmethod
+ def objc_enum_name_for_anonymous_enum_declaration(declaration):
+ domain_name = declaration.type.type_domain().domain_name
+ name = '%s%s' % (domain_name, declaration.type.raw_name())
+ name = remove_duplicate_from_str(name, domain_name)
+ return '%s%s' % (ObjCGenerator.OBJC_PREFIX, name)
+
+ @staticmethod
+ def objc_enum_name_for_anonymous_enum_member(declaration, member):
+ domain_name = member.type.type_domain().domain_name
+ name = '%s%s%s' % (domain_name, declaration.type.raw_name(), ucfirst(member.member_name))
+ name = remove_duplicate_from_str(name, domain_name)
+ return '%s%s' % (ObjCGenerator.OBJC_PREFIX, name)
+
+ @staticmethod
+ def objc_enum_name_for_anonymous_enum_parameter(domain, event_or_command_name, parameter):
+ domain_name = domain.domain_name
+ name = '%s%s%s' % (domain_name, ucfirst(event_or_command_name), ucfirst(parameter.parameter_name))
+ name = remove_duplicate_from_str(name, domain_name)
+ return '%s%s' % (ObjCGenerator.OBJC_PREFIX, name)
+
+ @staticmethod
+ def objc_enum_name_for_non_anonymous_enum(_type):
+ domain_name = _type.type_domain().domain_name
+ name = _type.qualified_name().replace('.', '')
+ name = remove_duplicate_from_str(name, domain_name)
+ return '%s%s' % (ObjCGenerator.OBJC_PREFIX, name)
+
+ # Miscellaneous name handling.
+
+ @staticmethod
+ def variable_name_prefix_for_domain(domain):
+ domain_name = domain.domain_name
+ if domain_name.startswith('DOM'):
+ return 'dom' + domain_name[3:]
+ if domain_name.startswith('CSS'):
+ return 'css' + domain_name[3:]
+ return domain_name[:1].lower() + domain_name[1:]
+
+ # Type basics.
+
+ @staticmethod
+ def objc_accessor_type_for_raw_name(raw_name):
+ if raw_name in ['string', 'array']:
+ return 'copy'
+ if raw_name in ['integer', 'number', 'boolean']:
+ return 'assign'
+ if raw_name in ['any', 'object']:
+ return 'retain'
+ return None
+
+ @staticmethod
+ def objc_type_for_raw_name(raw_name):
+ if raw_name is 'string':
+ return 'NSString *'
+ if raw_name is 'array':
+ return 'NSArray *'
+ if raw_name is 'integer':
+ return 'int'
+ if raw_name is 'number':
+ return 'double'
+ if raw_name is 'boolean':
+ return 'BOOL'
+ if raw_name in ['any', 'object']:
+ return '%s *' % ObjCGenerator.OBJC_JSON_OBJECT_BASE
+ return None
+
+ @staticmethod
+ def objc_class_for_raw_name(raw_name):
+ if raw_name is 'string':
+ return 'NSString'
+ if raw_name is 'array':
+ return 'NSArray'
+ if raw_name in ['integer', 'number', 'boolean']:
+ return 'NSNumber'
+ if raw_name in ['any', 'object']:
+ return ObjCGenerator.OBJC_JSON_OBJECT_BASE
+ return None
+
+ # FIXME: Can these protocol_type functions be removed in favor of C++ generators functions?
+
+ @staticmethod
+ def protocol_type_for_raw_name(raw_name):
+ if raw_name is 'string':
+ return 'String'
+ if raw_name is 'integer':
+ return 'int'
+ if raw_name is 'number':
+ return 'double'
+ if raw_name is 'boolean':
+ return 'bool'
+ if raw_name in ['any', 'object']:
+ return 'InspectorObject'
+ return None
+
+ @staticmethod
+ def protocol_type_for_type(_type):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return ObjCGenerator.protocol_type_for_raw_name(_type.raw_name())
+ if (isinstance(_type, EnumType)):
+ return ObjCGenerator.protocol_type_for_type(_type.primitive_type)
+ if (isinstance(_type, ObjectType)):
+ return 'Inspector::Protocol::%s::%s' % (_type.type_domain().domain_name, _type.raw_name())
+ if (isinstance(_type, ArrayType)):
+ sub_type = ObjCGenerator.protocol_type_for_type(_type.element_type)
+ return 'Inspector::Protocol::Array<%s>' % sub_type
+ return None
+
+ @staticmethod
+ def is_type_objc_pointer_type(_type):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return _type.raw_name() in ['string', 'array', 'any', 'object']
+ if (isinstance(_type, EnumType)):
+ return False
+ if (isinstance(_type, ObjectType)):
+ return True
+ if (isinstance(_type, ArrayType)):
+ return True
+ return None
+
+ @staticmethod
+ def objc_class_for_type(_type):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return ObjCGenerator.objc_class_for_raw_name(_type.raw_name())
+ if (isinstance(_type, EnumType)):
+ return ObjCGenerator.objc_class_for_raw_name(_type.primitive_type.raw_name())
+ if (isinstance(_type, ObjectType)):
+ return ObjCGenerator.objc_name_for_type(_type)
+ if (isinstance(_type, ArrayType)):
+ sub_type = strip_block_comment_markers(ObjCGenerator.objc_class_for_type(_type.element_type))
+ return 'NSArray/*<%s>*/' % sub_type
+ return None
+
+ @staticmethod
+ def objc_class_for_array_type(_type):
+ if isinstance(_type, AliasedType):
+ _type = _type.aliased_type
+ if isinstance(_type, ArrayType):
+ return ObjCGenerator.objc_class_for_type(_type.element_type)
+ return None
+
+ @staticmethod
+ def objc_accessor_type_for_member(member):
+ return ObjCGenerator.objc_accessor_type_for_member_internal(member.type)
+
+ @staticmethod
+ def objc_accessor_type_for_member_internal(_type):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return ObjCGenerator.objc_accessor_type_for_raw_name(_type.raw_name())
+ if (isinstance(_type, EnumType)):
+ return 'assign'
+ if (isinstance(_type, ObjectType)):
+ return 'retain'
+ if (isinstance(_type, ArrayType)):
+ return 'copy'
+ return None
+
+ @staticmethod
+ def objc_type_for_member(declaration, member):
+ return ObjCGenerator.objc_type_for_member_internal(member.type, declaration, member)
+
+ @staticmethod
+ def objc_type_for_member_internal(_type, declaration, member):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return ObjCGenerator.objc_type_for_raw_name(_type.raw_name())
+ if (isinstance(_type, EnumType)):
+ if (_type.is_anonymous):
+ return ObjCGenerator.objc_enum_name_for_anonymous_enum_member(declaration, member)
+ return ObjCGenerator.objc_enum_name_for_non_anonymous_enum(_type)
+ if (isinstance(_type, ObjectType)):
+ return ObjCGenerator.objc_name_for_type(_type) + ' *'
+ if (isinstance(_type, ArrayType)):
+ sub_type = strip_block_comment_markers(ObjCGenerator.objc_class_for_type(_type.element_type))
+ return 'NSArray/*<%s>*/ *' % sub_type
+ return None
+
+ @staticmethod
+ def objc_type_for_param(domain, event_or_command_name, parameter, respect_optional=True):
+ objc_type = ObjCGenerator.objc_type_for_param_internal(parameter.type, domain, event_or_command_name, parameter)
+ if respect_optional and parameter.is_optional:
+ if objc_type.endswith('*'):
+ return objc_type + '*'
+ return objc_type + ' *'
+ return objc_type
+
+ @staticmethod
+ def objc_type_for_param_internal(_type, domain, event_or_command_name, parameter):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ return ObjCGenerator.objc_type_for_raw_name(_type.raw_name())
+ if (isinstance(_type, EnumType)):
+ if _type.is_anonymous:
+ return ObjCGenerator.objc_enum_name_for_anonymous_enum_parameter(domain, event_or_command_name, parameter)
+ return ObjCGenerator.objc_enum_name_for_non_anonymous_enum(_type)
+ if (isinstance(_type, ObjectType)):
+ return ObjCGenerator.objc_name_for_type(_type) + ' *'
+ if (isinstance(_type, ArrayType)):
+ sub_type = strip_block_comment_markers(ObjCGenerator.objc_class_for_type(_type.element_type))
+ return 'NSArray/*<%s>*/ *' % sub_type
+ return None
+
+ # ObjC <-> Protocol conversion for commands and events.
+ # - convert a command call parameter received from Protocol to ObjC for handler
+ # - convert a command return parameter in callback block from ObjC to Protocol to send
+ # - convert an event parameter from ObjC API to Protocol to send
+
+ @staticmethod
+ def objc_protocol_export_expression_for_variable(var_type, var_name):
+ category = ObjCTypeCategory.category_for_type(var_type)
+ if category in [ObjCTypeCategory.Simple, ObjCTypeCategory.String]:
+ if isinstance(var_type, EnumType):
+ return 'toProtocolString(%s)' % var_name
+ return var_name
+ if category is ObjCTypeCategory.Object:
+ return '[%s toInspectorObject]' % var_name
+ if category is ObjCTypeCategory.Array:
+ protocol_type = ObjCGenerator.protocol_type_for_type(var_type.element_type)
+ objc_class = ObjCGenerator.objc_class_for_type(var_type.element_type)
+ if protocol_type == 'Inspector::Protocol::Array<String>':
+ return 'inspectorStringArrayArray(%s)' % var_name
+ if protocol_type is 'String' and objc_class is 'NSString':
+ return 'inspectorStringArray(%s)' % var_name
+ if protocol_type is 'int' and objc_class is 'NSNumber':
+ return 'inspectorIntegerArray(%s)' % var_name
+ if protocol_type is 'double' and objc_class is 'NSNumber':
+ return 'inspectorDoubleArray(%s)' % var_name
+ return 'inspectorObjectArray(%s)' % var_name
+
+ @staticmethod
+ def objc_protocol_import_expression_for_member(name, declaration, member):
+ if isinstance(member.type, EnumType):
+ if member.type.is_anonymous:
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_anonymous_enum_member(declaration, member), name)
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_non_anonymous_enum(member.type), name)
+ return ObjCGenerator.objc_protocol_import_expression_for_variable(member.type, name)
+
+ @staticmethod
+ def objc_protocol_import_expression_for_parameter(name, domain, event_or_command_name, parameter):
+ if isinstance(parameter.type, EnumType):
+ if parameter.type.is_anonymous:
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_anonymous_enum_parameter(domain, event_or_command_name, parameter), name)
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_non_anonymous_enum(parameter.type), name)
+ return ObjCGenerator.objc_protocol_import_expression_for_variable(parameter.type, name)
+
+ @staticmethod
+ def objc_protocol_import_expression_for_variable(var_type, var_name):
+ category = ObjCTypeCategory.category_for_type(var_type)
+ if category in [ObjCTypeCategory.Simple, ObjCTypeCategory.String]:
+ return var_name
+ if category is ObjCTypeCategory.Object:
+ objc_class = ObjCGenerator.objc_class_for_type(var_type)
+ return '[[[%s alloc] initWithInspectorObject:%s] autorelease]' % (objc_class, var_name)
+ if category is ObjCTypeCategory.Array:
+ objc_class = ObjCGenerator.objc_class_for_type(var_type.element_type)
+ if objc_class is 'NSString':
+ return 'objcStringArray(%s)' % var_name
+ if objc_class is 'NSNumber': # FIXME: Integer or Double?
+ return 'objcIntegerArray(%s)' % var_name
+ return 'objcArray<%s>(%s)' % (objc_class, var_name)
+
+ # ObjC <-> JSON object conversion for types getters/setters.
+ # - convert a member setter from ObjC API to JSON object setter
+ # - convert a member getter from JSON object to ObjC API
+
+ @staticmethod
+ def objc_to_protocol_expression_for_member(declaration, member, sub_expression):
+ category = ObjCTypeCategory.category_for_type(member.type)
+ if category in [ObjCTypeCategory.Simple, ObjCTypeCategory.String]:
+ if isinstance(member.type, EnumType):
+ return 'toProtocolString(%s)' % sub_expression
+ return sub_expression
+ if category is ObjCTypeCategory.Object:
+ return sub_expression
+ if category is ObjCTypeCategory.Array:
+ objc_class = ObjCGenerator.objc_class_for_type(member.type.element_type)
+ if objc_class is 'NSString':
+ return 'inspectorStringArray(%s)' % sub_expression
+ if objc_class is 'NSNumber':
+ protocol_type = ObjCGenerator.protocol_type_for_type(member.type.element_type)
+ if protocol_type is 'double':
+ return 'inspectorDoubleArray(%s)' % sub_expression
+ return 'inspectorIntegerArray(%s)' % sub_expression
+ return 'inspectorObjectArray(%s)' % sub_expression
+
+ @staticmethod
+ def protocol_to_objc_expression_for_member(declaration, member, sub_expression):
+ category = ObjCTypeCategory.category_for_type(member.type)
+ if category in [ObjCTypeCategory.Simple, ObjCTypeCategory.String]:
+ if isinstance(member.type, EnumType):
+ if member.type.is_anonymous:
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_anonymous_enum_member(declaration, member), sub_expression)
+ return 'fromProtocolString<%s>(%s)' % (ObjCGenerator.objc_enum_name_for_non_anonymous_enum(member.type), sub_expression)
+ return sub_expression
+ if category is ObjCTypeCategory.Object:
+ objc_type = ObjCGenerator.objc_type_for_member(declaration, member)
+ return '(%s)%s' % (objc_type, sub_expression)
+ if category is ObjCTypeCategory.Array:
+ protocol_type = ObjCGenerator.protocol_type_for_type(member.type.element_type)
+ objc_class = ObjCGenerator.objc_class_for_type(member.type.element_type)
+ if objc_class is 'NSString':
+ return 'objcStringArray(%s)' % sub_expression
+ if objc_class is 'NSNumber':
+ protocol_type = ObjCGenerator.protocol_type_for_type(member.type.element_type)
+ if protocol_type is 'double':
+ return 'objcDoubleArray(%s)' % sub_expression
+ return 'objcIntegerArray(%s)' % sub_expression
+ return 'objcArray<%s>(%s)' % (objc_class, sub_expression)
+
+ # JSON object setter/getter selectors for types.
+
+ @staticmethod
+ def objc_setter_method_for_member(declaration, member):
+ return ObjCGenerator.objc_setter_method_for_member_internal(member.type, declaration, member)
+
+ @staticmethod
+ def objc_setter_method_for_member_internal(_type, declaration, member):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ raw_name = _type.raw_name()
+ if raw_name is 'boolean':
+ return 'setBool'
+ if raw_name is 'integer':
+ return 'setInteger'
+ if raw_name is 'number':
+ return 'setDouble'
+ if raw_name is 'string':
+ return 'setString'
+ if raw_name in ['any', 'object']:
+ return 'setObject'
+ if raw_name is 'array':
+ return 'setInspectorArray'
+ return None
+ if (isinstance(_type, EnumType)):
+ return 'setString'
+ if (isinstance(_type, ObjectType)):
+ return 'setObject'
+ if (isinstance(_type, ArrayType)):
+ return 'setInspectorArray'
+ return None
+
+ @staticmethod
+ def objc_getter_method_for_member(declaration, member):
+ return ObjCGenerator.objc_getter_method_for_member_internal(member.type, declaration, member)
+
+ @staticmethod
+ def objc_getter_method_for_member_internal(_type, declaration, member):
+ if (isinstance(_type, AliasedType)):
+ _type = _type.aliased_type
+ if (isinstance(_type, PrimitiveType)):
+ raw_name = _type.raw_name()
+ if raw_name is 'boolean':
+ return 'boolForKey'
+ if raw_name is 'integer':
+ return 'integerForKey'
+ if raw_name is 'number':
+ return 'doubleForKey'
+ if raw_name is 'string':
+ return 'stringForKey'
+ if raw_name in ['any', 'object']:
+ return 'objectForKey'
+ if raw_name is 'array':
+ return 'inspectorArrayForKey'
+ return None
+ if (isinstance(_type, EnumType)):
+ return 'stringForKey'
+ if (isinstance(_type, ObjectType)):
+ return 'objectForKey'
+ if (isinstance(_type, ArrayType)):
+ return 'inspectorArrayForKey'
+ return None
diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py
new file mode 100755
index 000000000..f8d21c060
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# Generator templates, which can be filled with string.Template.
+# Following are classes that fill the templates from the typechecked model.
+
+class ObjCGeneratorTemplates:
+
+ HeaderPrelude = (
+ """#import <Foundation/Foundation.h>
+
+${includes}
+""")
+
+ HeaderPostlude = (
+ """""")
+
+ ConversionHelpersPrelude = (
+ """${includes}
+
+namespace Inspector {""")
+
+ ConversionHelpersPostlude = (
+ """} // namespace Inspector
+""")
+
+ GenericHeaderPrelude = (
+ """${includes}""")
+
+ GenericHeaderPostlude = (
+ """""")
+
+ ConversionHelpersStandard = (
+ """template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);""")
+
+ BackendDispatcherHeaderPrelude = (
+ """${includes}
+
+${forwardDeclarations}
+
+namespace Inspector {
+""")
+
+ BackendDispatcherHeaderPostlude = (
+ """} // namespace Inspector
+""")
+
+ BackendDispatcherImplementationPrelude = (
+ """#import "config.h"
+#import ${primaryInclude}
+
+${secondaryIncludes}
+
+namespace Inspector {""")
+
+ BackendDispatcherImplementationPostlude = (
+ """} // namespace Inspector
+""")
+
+ ImplementationPrelude = (
+ """#import "config.h"
+#import ${primaryInclude}
+
+${secondaryIncludes}
+
+using namespace Inspector;""")
+
+ ImplementationPostlude = (
+ """""")
+
+ BackendDispatcherHeaderDomainHandlerInterfaceDeclaration = (
+ """class Alternate${domainName}BackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~Alternate${domainName}BackendDispatcher() { }
+${commandDeclarations}
+};""")
+
+ BackendDispatcherHeaderDomainHandlerObjCDeclaration = (
+ """class ObjCInspector${domainName}BackendDispatcher final : public Alternate${domainName}BackendDispatcher {
+public:
+ ObjCInspector${domainName}BackendDispatcher(id<${objcPrefix}${domainName}DomainHandler> handler) { m_delegate = handler; }
+${commandDeclarations}
+private:
+ RetainPtr<id<${objcPrefix}${domainName}DomainHandler>> m_delegate;
+};""")
+
+ BackendDispatcherHeaderDomainHandlerImplementation = (
+ """void ObjCInspector${domainName}BackendDispatcher::${commandName}(${parameters})
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+${successCallback}
+${conversions}
+${invocation}
+}
+""")
+
+ ConfigurationCommandProperty = (
+ """@property (nonatomic, retain, setter=set${domainName}Handler:) id<${objcPrefix}${domainName}DomainHandler> ${variableNamePrefix}Handler;""")
+
+ ConfigurationEventProperty = (
+ """@property (nonatomic, readonly) ${objcPrefix}${domainName}DomainEventDispatcher *${variableNamePrefix}EventDispatcher;""")
+
+ ConfigurationCommandPropertyImplementation = (
+ """- (void)set${domainName}Handler:(id<${objcPrefix}${domainName}DomainHandler>)handler
+{
+ if (handler == _${variableNamePrefix}Handler)
+ return;
+
+ [_${variableNamePrefix}Handler release];
+ _${variableNamePrefix}Handler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspector${domainName}BackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<${domainName}BackendDispatcher, Alternate${domainName}BackendDispatcher>>(ASCIILiteral("${domainName}"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<${objcPrefix}${domainName}DomainHandler>)${variableNamePrefix}Handler
+{
+ return _${variableNamePrefix}Handler;
+}""")
+
+ ConfigurationGetterImplementation = (
+ """- (${objcPrefix}${domainName}DomainEventDispatcher *)${variableNamePrefix}EventDispatcher
+{
+ if (!_${variableNamePrefix}EventDispatcher)
+ _${variableNamePrefix}EventDispatcher = [[${objcPrefix}${domainName}DomainEventDispatcher alloc] initWithController:_controller];
+ return _${variableNamePrefix}EventDispatcher;
+}""")
diff --git a/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py b/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
new file mode 100755
index 000000000..a1987aa90
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
@@ -0,0 +1,211 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 University of Washington. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# This script generates JS, Objective C, and C++ bindings for the inspector protocol.
+# Generators for individual files are located in the codegen/ directory.
+
+import os.path
+import re
+import sys
+import string
+from string import Template
+import optparse
+import logging
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.ERROR)
+log = logging.getLogger('global')
+
+try:
+ from codegen import *
+
+# When copying generator files to JavaScriptCore's private headers on Mac,
+# the codegen/ module directory is flattened. So, import directly.
+except ImportError, e:
+ # log.error(e) # Uncomment this to debug early import errors.
+ import models
+ from models import *
+ from generator import *
+ from cpp_generator import *
+ from objc_generator import *
+
+ from generate_cpp_alternate_backend_dispatcher_header import *
+ from generate_cpp_backend_dispatcher_header import *
+ from generate_cpp_backend_dispatcher_implementation import *
+ from generate_cpp_frontend_dispatcher_header import *
+ from generate_cpp_frontend_dispatcher_implementation import *
+ from generate_cpp_protocol_types_header import *
+ from generate_cpp_protocol_types_implementation import *
+ from generate_js_backend_commands import *
+ from generate_objc_backend_dispatcher_header import *
+ from generate_objc_backend_dispatcher_implementation import *
+ from generate_objc_configuration_header import *
+ from generate_objc_configuration_implementation import *
+ from generate_objc_conversion_helpers import *
+ from generate_objc_frontend_dispatcher_implementation import *
+ from generate_objc_header import *
+ from generate_objc_internal_header import *
+ from generate_objc_protocol_types_implementation import *
+
+
+# A writer that only updates file if it actually changed.
+class IncrementalFileWriter:
+ def __init__(self, filepath, force_output):
+ self._filepath = filepath
+ self._output = ""
+ self.force_output = force_output
+
+ def write(self, text):
+ self._output += text
+
+ def close(self):
+ text_changed = True
+ self._output = self._output.rstrip() + "\n"
+
+ try:
+ if self.force_output:
+ raise
+
+ read_file = open(self._filepath, "r")
+ old_text = read_file.read()
+ read_file.close()
+ text_changed = old_text != self._output
+ except:
+ # Ignore, just overwrite by default
+ pass
+
+ if text_changed or self.force_output:
+ out_file = open(self._filepath, "w")
+ out_file.write(self._output)
+ out_file.close()
+
+
+def generate_from_specification(primary_specification_filepath=None,
+ supplemental_specification_filepaths=[],
+ concatenate_output=False,
+ output_dirpath=None,
+ force_output=False,
+ framework_name=""):
+
+ def load_specification(protocol, filepath, isSupplemental=False):
+ try:
+ with open(filepath, "r") as input_file:
+ parsed_json = json.load(input_file)
+ protocol.parse_specification(parsed_json, isSupplemental)
+ except ValueError as e:
+ raise Exception("Error parsing valid JSON in file: " + filepath)
+
+ protocol = models.Protocol(framework_name)
+ for specification in supplemental_specification_filepaths:
+ load_specification(protocol, specification, isSupplemental=True)
+ load_specification(protocol, primary_specification_filepath, isSupplemental=False)
+
+ protocol.resolve_types()
+
+ generators = []
+ is_test = protocol.framework is Frameworks.Test
+ if is_test or protocol.framework is not Frameworks.WebInspector:
+ generators.append(CppAlternateBackendDispatcherHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(JSBackendCommandsGenerator(protocol, primary_specification_filepath))
+ generators.append(CppBackendDispatcherHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(CppBackendDispatcherImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(CppFrontendDispatcherHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(CppFrontendDispatcherImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(CppProtocolTypesHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(CppProtocolTypesImplementationGenerator(protocol, primary_specification_filepath))
+ if is_test or protocol.framework is Frameworks.WebInspector:
+ generators.append(ObjCBackendDispatcherHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCBackendDispatcherImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCConfigurationHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCConfigurationImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCConversionHelpersGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCFrontendDispatcherImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCHeaderGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCProtocolTypesImplementationGenerator(protocol, primary_specification_filepath))
+ generators.append(ObjCInternalHeaderGenerator(protocol, primary_specification_filepath))
+
+ single_output_file_contents = []
+
+ for generator in generators:
+ output = generator.generate_output()
+ if concatenate_output:
+ single_output_file_contents.append('### Begin File: %s' % generator.output_filename())
+ single_output_file_contents.append(output)
+ single_output_file_contents.append('### End File: %s' % generator.output_filename())
+ single_output_file_contents.append('')
+ else:
+ output_file = IncrementalFileWriter(os.path.join(output_dirpath, generator.output_filename()), force_output)
+ output_file.write(output)
+ output_file.close()
+
+ if concatenate_output:
+ filename = os.path.join(os.path.basename(primary_specification_filepath) + '-result')
+ output_file = IncrementalFileWriter(os.path.join(output_dirpath, filename), force_output)
+ output_file.write('\n'.join(single_output_file_contents))
+ output_file.close()
+
+
+if __name__ == '__main__':
+ allowed_framework_names = ['JavaScriptCore', 'WebInspector', 'Test']
+ cli_parser = optparse.OptionParser(usage="usage: %prog [options] PrimaryProtocol.json [SupplementalProtocol.json ...]")
+ cli_parser.add_option("-o", "--outputDir", help="Directory where generated files should be written.")
+ cli_parser.add_option("--framework", type="choice", choices=allowed_framework_names, help="The framework that the primary specification belongs to.")
+ cli_parser.add_option("--force", action="store_true", help="Force output of generated scripts, even if nothing changed.")
+ cli_parser.add_option("-v", "--debug", action="store_true", help="Log extra output for debugging the generator itself.")
+ cli_parser.add_option("-t", "--test", action="store_true", help="Enable test mode. Use unique output filenames created by prepending the input filename.")
+
+ options = None
+
+ arg_options, arg_values = cli_parser.parse_args()
+ if (len(arg_values) < 1):
+ raise ParseException("At least one plain argument expected")
+
+ if not arg_options.outputDir:
+ raise ParseException("Missing output directory")
+
+ if arg_options.debug:
+ log.setLevel(logging.DEBUG)
+
+ options = {
+ 'primary_specification_filepath': arg_values[0],
+ 'supplemental_specification_filepaths': arg_values[1:],
+ 'output_dirpath': arg_options.outputDir,
+ 'concatenate_output': arg_options.test,
+ 'framework_name': arg_options.framework,
+ 'force_output': arg_options.force
+ }
+
+ try:
+ generate_from_specification(**options)
+ except (ParseException, TypecheckException) as e:
+ if arg_options.test:
+ log.error(e.message)
+ else:
+ raise # Force the build to fail.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json b/Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json
new file mode 100644
index 000000000..11262e889
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json
@@ -0,0 +1,109 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "integer",
+ "description": "Unique identifier of Database object."
+ },
+ {
+ "id": "PrimaryColors",
+ "type": "string",
+ "enum": ["red", "green", "blue"]
+ },
+ {
+ "id": "ColorList",
+ "type": "array",
+ "items": { "$ref": "PrimaryColors" }
+ },
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "executeSQLSyncOptionalReturnValues",
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "databaseId", "$ref": "DatabaseId", "optional": true },
+ { "name": "sqlError", "$ref": "Error", "optional": true },
+ { "name": "screenColor", "$ref": "PrimaryColors", "optional": true },
+ { "name": "alternateColors", "$ref": "ColorList", "optional": true },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"], "optional": true }
+ ]
+ },
+ {
+ "name": "executeSQLAsyncOptionalReturnValues",
+ "async": true,
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "databaseId", "$ref": "DatabaseId", "optional": true },
+ { "name": "sqlError", "$ref": "Error", "optional": true },
+ { "name": "screenColor", "$ref": "PrimaryColors", "optional": true },
+ { "name": "alternateColors", "$ref": "ColorList", "optional": true },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"], "optional": true }
+ ]
+ },
+ {
+ "name": "executeSQLSync",
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "sqlError", "$ref": "Error" },
+ { "name": "alternateColors", "$ref": "ColorList" },
+ { "name": "screenColor", "$ref": "PrimaryColors" },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"] }
+ ]
+ },
+ {
+ "name": "executeSQLAsync",
+ "async": true,
+ "parameters": [
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "query", "type": "string" }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "sqlError", "$ref": "Error" },
+ { "name": "screenColor", "$ref": "PrimaryColors" },
+ { "name": "alternateColors", "$ref": "ColorList" },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"] }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json b/Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json
new file mode 100644
index 000000000..361d57d82
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json
@@ -0,0 +1,85 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "integer",
+ "description": "Unique identifier of Database object."
+ },
+ {
+ "id": "PrimaryColors",
+ "type": "string",
+ "enum": ["red", "green", "blue"]
+ },
+ {
+ "id": "ColorList",
+ "type": "array",
+ "items": { "$ref": "PrimaryColors" }
+ },
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ }
+ ],
+ "commands": [
+ {
+ "name": "executeAllOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "databaseId", "$ref": "DatabaseId", "optional": true },
+ { "name": "sqlError", "$ref": "Error", "optional": true },
+ { "name": "screenColor", "$ref": "PrimaryColors", "optional": true },
+ { "name": "alternateColors", "$ref": "ColorList", "optional": true },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"], "optional": true }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "databaseId", "$ref": "DatabaseId", "optional": true },
+ { "name": "sqlError", "$ref": "Error", "optional": true },
+ { "name": "screenColor", "$ref": "PrimaryColors", "optional": true },
+ { "name": "alternateColors", "$ref": "ColorList", "optional": true },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"], "optional": true }
+ ]
+ },
+ {
+ "name": "executeNoOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "sqlError", "$ref": "Error" },
+ { "name": "screenColor", "$ref": "PrimaryColors" },
+ { "name": "alternateColors", "$ref": "ColorList" },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"] }
+ ],
+ "returns": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "databaseId", "$ref": "DatabaseId" },
+ { "name": "sqlError", "$ref": "Error" },
+ { "name": "screenColor", "$ref": "PrimaryColors" },
+ { "name": "alternateColors", "$ref": "ColorList" },
+ { "name": "printColor", "type": "string", "enum": ["cyan", "magenta", "yellow", "black"] }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json b/Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json
new file mode 100644
index 000000000..94a8ecb17
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json
@@ -0,0 +1,54 @@
+[
+{
+ "domain": "Network1",
+ "commands": [
+ {
+ "name": "loadResource1",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ }
+ ]
+},
+{
+ "domain": "Network2",
+ "types": [
+ {
+ "id": "LoaderId",
+ "type": "string",
+ "description": "Unique loader identifier."
+ }
+ ]
+},
+{
+ "domain": "Network3",
+ "commands": [
+ {
+ "name": "loadResource1",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource2",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource3",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource4",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource5",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource6",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ },
+ {
+ "name": "loadResource7",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/enum-values.json b/Source/JavaScriptCore/inspector/scripts/tests/enum-values.json
new file mode 100644
index 000000000..cdad61df7
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/enum-values.json
@@ -0,0 +1,35 @@
+{"domains":[
+{
+ "domain": "TypeDomain",
+ "types": [
+ {
+ "id": "TypeDomainEnum",
+ "type": "string",
+ "enum": ["shared", "red", "green", "blue"]
+ }
+ ]
+},
+{
+ "domain": "CommandDomain",
+ "commands": [
+ {
+ "name": "commandWithEnumReturnValue",
+ "parameters": [],
+ "returns": [
+ { "name": "returnValue", "type": "string", "enum": ["shared", "cyan", "magenta", "yellow"] }
+ ]
+ }
+ ]
+},
+{
+ "domain": "EventDomain",
+ "events": [
+ {
+ "name": "eventWithEnumParameter",
+ "parameters": [
+ { "name": "parameter", "type": "string", "enum": ["shared", "black", "white"] }
+ ]
+ }
+ ]
+}
+]}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json b/Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json
new file mode 100644
index 000000000..cabbf10b8
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json
@@ -0,0 +1,59 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "string",
+ "description": "Unique identifier of Database object."
+ },
+ {
+ "id": "PrimaryColors",
+ "type": "string",
+ "values": ["red", "green", "blue"]
+ },
+ {
+ "id": "ColorList",
+ "type": "array",
+ "items": { "$ref": "PrimaryColors" }
+ },
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ }
+ ],
+ "events": [
+ {
+ "name": "didExecuteOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "sqlError", "$ref": "Error", "optional": true },
+ { "name": "screenColor", "$ref": "PrimaryColors", "optional": true },
+ { "name": "alternateColors", "$ref": "ColorList", "optional": true },
+ { "name": "printColor", "type": "string", "values": ["cyan", "magenta", "yellow", "black"], "optional": true }
+ ]
+ },
+ {
+ "name": "didExecuteNoOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "sqlError", "$ref": "Error" },
+ { "name": "screenColor", "$ref": "PrimaryColors" },
+ { "name": "alternateColors", "$ref": "ColorList" },
+ { "name": "printColor", "type": "string", "values": ["cyan", "magenta", "yellow", "black"] }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
new file mode 100644
index 000000000..66d0b08f5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result
@@ -0,0 +1,1634 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+class AlternateDatabaseBackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateDatabaseBackendDispatcher() { }
+ virtual void executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0;
+ virtual void executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) = 0;
+ virtual void executeSQLSync(long callId, int in_databaseId, const String& in_query) = 0;
+ virtual void executeSQLAsync(long callId, int in_databaseId, const String& in_query) = 0;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Database.
+InspectorBackend.registerDatabaseDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Database");
+InspectorBackend.registerEnum("Database.PrimaryColors", {Red: "red", Green: "green", Blue: "blue"});
+InspectorBackend.registerCommand("Database.executeSQLSyncOptionalReturnValues", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.registerCommand("Database.executeSQLAsyncOptionalReturnValues", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.registerCommand("Database.executeSQLSync", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "alternateColors", "screenColor", "printColor"]);
+InspectorBackend.registerCommand("Database.executeSQLAsync", [{"name": "databaseId", "type": "number", "optional": false}, {"name": "query", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.activateDomain("Database");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+class AlternateDatabaseBackendDispatcher;
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+class DatabaseBackendDispatcherHandler {
+public:
+ // Named after parameter 'screenColor' while generating command/event executeSQLSyncOptionalReturnValues.
+ enum class ScreenColor {
+ Red = 0,
+ Green = 1,
+ Blue = 2,
+ }; // enum class ScreenColor
+ // Named after parameter 'printColor' while generating command/event executeSQLSyncOptionalReturnValues.
+ enum class PrintColor {
+ Cyan = 3,
+ Magenta = 4,
+ Yellow = 5,
+ Black = 6,
+ }; // enum class PrintColor
+ virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
+ class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase {
+ public:
+ ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id);
+ void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor);
+ };
+ virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0;
+ virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, Inspector::Protocol::Database::PrimaryColors* out_screenColor, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
+ class ExecuteSQLAsyncCallback : public BackendDispatcher::CallbackBase {
+ public:
+ ExecuteSQLAsyncCallback(Ref<BackendDispatcher>&&, int id);
+ void sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, const String& printColor);
+ };
+ virtual void executeSQLAsync(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncCallback>&& callback) = 0;
+protected:
+ virtual ~DatabaseBackendDispatcherHandler();
+};
+
+class DatabaseBackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<DatabaseBackendDispatcher> create(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void executeSQLSyncOptionalReturnValues(long requestId, RefPtr<InspectorObject>&& parameters);
+ void executeSQLAsyncOptionalReturnValues(long requestId, RefPtr<InspectorObject>&& parameters);
+ void executeSQLSync(long requestId, RefPtr<InspectorObject>&& parameters);
+ void executeSQLAsync(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
+ DatabaseBackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateDatabaseBackendDispatcher* m_alternateDispatcher;
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+DatabaseBackendDispatcherHandler::~DatabaseBackendDispatcherHandler() { }
+
+Ref<DatabaseBackendDispatcher> DatabaseBackendDispatcher::create(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent)
+{
+ return adoptRef(*new DatabaseBackendDispatcher(backendDispatcher, agent));
+}
+
+DatabaseBackendDispatcher::DatabaseBackendDispatcher(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this);
+}
+
+void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<DatabaseBackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ if (method == "executeSQLSyncOptionalReturnValues")
+ executeSQLSyncOptionalReturnValues(requestId, WTFMove(parameters));
+ else if (method == "executeSQLAsyncOptionalReturnValues")
+ executeSQLAsyncOptionalReturnValues(requestId, WTFMove(parameters));
+ else if (method == "executeSQLSync")
+ executeSQLSync(requestId, WTFMove(parameters));
+ else if (method == "executeSQLAsync")
+ executeSQLAsync(requestId, WTFMove(parameters));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
+}
+
+void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
+ String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeSQLSyncOptionalReturnValues(requestId, in_databaseId, in_query);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
+ Inspector::Protocol::OptOutput<String> out_notes;
+ Inspector::Protocol::OptOutput<double> out_timestamp;
+ Inspector::Protocol::OptOutput<Inspector::InspectorObject> out_values;
+ Inspector::Protocol::OptOutput<Inspector::InspectorValue> out_payload;
+ Inspector::Protocol::OptOutput<Inspector::Protocol::Database::DatabaseId> out_databaseId;
+ RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
+ Inspector::Protocol::Database::PrimaryColors out_screenColor;
+ RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
+ DatabaseBackendDispatcherHandler::PrintColor out_printColor;
+ m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);
+
+ if (!error.length()) {
+ if (out_columnNames)
+ result->setArray(ASCIILiteral("columnNames"), out_columnNames);
+ if (out_notes.isAssigned())
+ result->setString(ASCIILiteral("notes"), out_notes.getValue());
+ if (out_timestamp.isAssigned())
+ result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
+ if (out_values.isAssigned())
+ result->setObject(ASCIILiteral("values"), out_values.getValue());
+ if (out_payload.isAssigned())
+ result->setValue(ASCIILiteral("payload"), out_payload.getValue());
+ if (out_databaseId.isAssigned())
+ result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
+ if (out_sqlError)
+ result->setObject(ASCIILiteral("sqlError"), out_sqlError);
+ if (out_screenColor.isAssigned())
+ result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
+ if (out_alternateColors)
+ result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
+ if (out_printColor.isAssigned())
+ result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
+ }
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { }
+
+void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor)
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ if (columnNames)
+ jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
+ if (notes.isAssigned())
+ jsonMessage->setString(ASCIILiteral("notes"), notes.getValue());
+ if (timestamp.isAssigned())
+ jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue());
+ if (values.isAssigned())
+ jsonMessage->setObject(ASCIILiteral("values"), values.getValue());
+ if (payload.isAssigned())
+ jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue());
+ if (databaseId.isAssigned())
+ jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue());
+ if (sqlError)
+ jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
+ if (screenColor.isAssigned())
+ jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue());
+ if (alternateColors)
+ jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
+ if (printColor.isAssigned())
+ jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue());
+ CallbackBase::sendSuccess(WTFMove(jsonMessage));
+}
+
+void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
+ String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeSQLAsyncOptionalReturnValues(requestId, in_databaseId, in_query);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), requestId));
+ m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback.copyRef());
+
+ if (error.length()) {
+ callback->disable();
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, error);
+ return;
+ }
+}
+
+void DatabaseBackendDispatcher::executeSQLSync(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
+ String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeSQLSync(requestId, in_databaseId, in_query);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
+ String out_notes;
+ double out_timestamp;
+ Inspector::InspectorObject out_values;
+ Inspector::InspectorValue out_payload;
+ Inspector::Protocol::Database::DatabaseId out_databaseId;
+ RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
+ RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
+ Inspector::Protocol::Database::PrimaryColors out_screenColor;
+ DatabaseBackendDispatcherHandler::PrintColor out_printColor;
+ m_agent->executeSQLSync(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, out_alternateColors, &out_screenColor, &out_printColor);
+
+ if (!error.length()) {
+ result->setArray(ASCIILiteral("columnNames"), out_columnNames);
+ result->setString(ASCIILiteral("notes"), out_notes);
+ result->setDouble(ASCIILiteral("timestamp"), out_timestamp);
+ result->setObject(ASCIILiteral("values"), out_values);
+ result->setValue(ASCIILiteral("payload"), out_payload);
+ result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
+ result->setObject(ASCIILiteral("sqlError"), out_sqlError);
+ result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
+ result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
+ result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
+ }
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { }
+
+void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::sendSuccess(RefPtr<Inspector::Protocol::Array<String>>&& columnNames, const String& notes, double timestamp, Inspector::InspectorObject values, Inspector::InspectorValue payload, int databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, const String& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, const String& printColor)
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
+ jsonMessage->setString(ASCIILiteral("notes"), notes);
+ jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp);
+ jsonMessage->setObject(ASCIILiteral("values"), values);
+ jsonMessage->setValue(ASCIILiteral("payload"), payload);
+ jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId);
+ jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
+ jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(screenColor));
+ jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
+ jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(printColor));
+ CallbackBase::sendSuccess(WTFMove(jsonMessage));
+}
+
+void DatabaseBackendDispatcher::executeSQLAsync(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
+ String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeSQLAsync(requestId, in_databaseId, in_query);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), requestId));
+ m_agent->executeSQLAsync(error, in_databaseId, in_query, callback.copyRef());
+
+ if (error.length()) {
+ callback->disable();
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, error);
+ return;
+ }
+}
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Database {
+class Error;
+enum class PrimaryColors;
+} // Database
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Database {
+/* Unique identifier of Database object. */
+typedef int DatabaseId;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Database::PrimaryColors> ColorList;
+} // Database
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Database {
+/* */
+enum class PrimaryColors {
+ Red = 0,
+ Green = 1,
+ Blue = 2,
+}; // enum class PrimaryColors
+/* Database error. */
+class Error : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ MessageSet = 1 << 0,
+ CodeSet = 1 << 1,
+ AllFieldsSet = (MessageSet | CodeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*Error*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class Error;
+ public:
+
+ Builder<STATE | MessageSet>& setMessage(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
+ m_result->setString(ASCIILiteral("message"), value);
+ return castState<MessageSet>();
+ }
+
+ Builder<STATE | CodeSet>& setCode(int value)
+ {
+ COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
+ m_result->setInteger(ASCIILiteral("code"), value);
+ return castState<CodeSet>();
+ }
+
+ Ref<Error> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<Error>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<Error> result = Error::create()
+ * .setMessage(...)
+ * .setCode(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Database
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "red",
+ "green",
+ "blue",
+ "cyan",
+ "magenta",
+ "yellow",
+ "black",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+@protocol RWIProtocolDatabaseDomainHandler;
+
+namespace Inspector {
+
+
+class ObjCInspectorDatabaseBackendDispatcher final : public AlternateDatabaseBackendDispatcher {
+public:
+ ObjCInspectorDatabaseBackendDispatcher(id<RWIProtocolDatabaseDomainHandler> handler) { m_delegate = handler; }
+ virtual void executeSQLSyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) override;
+ virtual void executeSQLAsyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query) override;
+ virtual void executeSQLSync(long requestId, int in_databaseId, const String& in_query) override;
+ virtual void executeSQLAsync(long requestId, int in_databaseId, const String& in_query) override;
+private:
+ RetainPtr<id<RWIProtocolDatabaseDomainHandler>> m_delegate;
+};
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ id<RWIProtocolDatabaseDomainHandler> _databaseHandler;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_databaseHandler release];
+ [super dealloc];
+}
+
+- (void)setDatabaseHandler:(id<RWIProtocolDatabaseDomainHandler>)handler
+{
+ if (handler == _databaseHandler)
+ return;
+
+ [_databaseHandler release];
+ _databaseHandler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<DatabaseBackendDispatcher, AlternateDatabaseBackendDispatcher>>(ASCIILiteral("Database"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolDatabaseDomainHandler>)databaseHandler
+{
+ return _databaseHandler;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, retain, setter=setDatabaseHandler:) id<RWIProtocolDatabaseDomainHandler> databaseHandler;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors");
+ if (columnNames)
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames));
+ if (notes)
+ resultObject->setString(ASCIILiteral("notes"), *notes);
+ if (timestamp)
+ resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp);
+ if (values)
+ resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]);
+ if (payload)
+ resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]);
+ if (databaseId)
+ resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId);
+ if (sqlError)
+ resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]);
+ if (screenColor)
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
+ if (alternateColors)
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors));
+ if (printColor)
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ int o_in_databaseId = in_databaseId;
+ NSString *o_in_query = in_query;
+
+ [m_delegate executeSQLSyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query];
+}
+
+void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long requestId, int in_databaseId, const String& in_query)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors");
+ if (columnNames)
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames));
+ if (notes)
+ resultObject->setString(ASCIILiteral("notes"), *notes);
+ if (timestamp)
+ resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp);
+ if (values)
+ resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]);
+ if (payload)
+ resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]);
+ if (databaseId)
+ resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId);
+ if (sqlError)
+ resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]);
+ if (screenColor)
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
+ if (alternateColors)
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors));
+ if (printColor)
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ int o_in_databaseId = in_databaseId;
+ NSString *o_in_query = in_query;
+
+ [m_delegate executeSQLAsyncOptionalReturnValuesWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query];
+}
+
+void ObjCInspectorDatabaseBackendDispatcher::executeSQLSync(long requestId, int in_databaseId, const String& in_query)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLSyncPrintColor printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors");
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames));
+ resultObject->setString(ASCIILiteral("notes"), notes);
+ resultObject->setDouble(ASCIILiteral("timestamp"), timestamp);
+ resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]);
+ resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]);
+ resultObject->setInteger(ASCIILiteral("databaseId"), databaseId);
+ resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors));
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ int o_in_databaseId = in_databaseId;
+ NSString *o_in_query = in_query;
+
+ [m_delegate executeSQLSyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query];
+}
+
+void ObjCInspectorDatabaseBackendDispatcher::executeSQLAsync(long requestId, int in_databaseId, const String& in_query)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteSQLAsyncPrintColor printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors");
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames));
+ resultObject->setString(ASCIILiteral("notes"), notes);
+ resultObject->setDouble(ASCIILiteral("timestamp"), timestamp);
+ resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]);
+ resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]);
+ resultObject->setInteger(ASCIILiteral("databaseId"), databaseId);
+ resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors));
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ int o_in_databaseId = in_databaseId;
+ NSString *o_in_query = in_query;
+
+ [m_delegate executeSQLAsyncWithErrorCallback:errorCallback successCallback:successCallback databaseId:o_in_databaseId query:o_in_query];
+}
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolDatabasePrimaryColors value)
+{
+ switch(value) {
+ case RWIProtocolDatabasePrimaryColorsRed:
+ return ASCIILiteral("red");
+ case RWIProtocolDatabasePrimaryColorsGreen:
+ return ASCIILiteral("green");
+ case RWIProtocolDatabasePrimaryColorsBlue:
+ return ASCIILiteral("blue");
+ }
+}
+
+template<>
+inline RWIProtocolDatabasePrimaryColors fromProtocolString(const String& value)
+{
+ if (value == "red")
+ return RWIProtocolDatabasePrimaryColorsRed;
+ if (value == "green")
+ return RWIProtocolDatabasePrimaryColorsGreen;
+ if (value == "blue")
+ return RWIProtocolDatabasePrimaryColorsBlue;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabasePrimaryColorsRed;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteSQLSyncPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteSQLSyncPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteSQLAsyncPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteSQLAsyncPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolDatabaseError;
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabasePrimaryColors) {
+ RWIProtocolDatabasePrimaryColorsRed,
+ RWIProtocolDatabasePrimaryColorsGreen,
+ RWIProtocolDatabasePrimaryColorsBlue,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor) {
+ RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorCyan,
+ RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorMagenta,
+ RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorYellow,
+ RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor) {
+ RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorCyan,
+ RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorMagenta,
+ RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorYellow,
+ RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLSyncPrintColor) {
+ RWIProtocolDatabaseExecuteSQLSyncPrintColorCyan,
+ RWIProtocolDatabaseExecuteSQLSyncPrintColorMagenta,
+ RWIProtocolDatabaseExecuteSQLSyncPrintColorYellow,
+ RWIProtocolDatabaseExecuteSQLSyncPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteSQLAsyncPrintColor) {
+ RWIProtocolDatabaseExecuteSQLAsyncPrintColorCyan,
+ RWIProtocolDatabaseExecuteSQLAsyncPrintColorMagenta,
+ RWIProtocolDatabaseExecuteSQLAsyncPrintColorYellow,
+ RWIProtocolDatabaseExecuteSQLAsyncPrintColorBlack,
+};
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseError : RWIProtocolJSONObject
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+/* required */ @property (nonatomic, copy) NSString *message;
+/* required */ @property (nonatomic, assign) int code;
+@end
+
+@protocol RWIProtocolDatabaseDomainHandler <NSObject>
+@required
+- (void)executeSQLSyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLSyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query;
+- (void)executeSQLAsyncOptionalReturnValuesWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteSQLAsyncOptionalReturnValuesPrintColor *printColor))successCallback databaseId:(int)databaseId query:(NSString *)query;
+- (void)executeSQLSyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabasePrimaryColors screenColor, RWIProtocolDatabaseExecuteSQLSyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query;
+- (void)executeSQLAsyncWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteSQLAsyncPrintColor printColor))successCallback databaseId:(int)databaseId query:(NSString *)query;
+@end
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolDatabaseError
+
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message");
+
+ self.message = message;
+ self.code = code;
+
+ return self;
+}
+
+- (void)setMessage:(NSString *)message
+{
+ [super setString:message forKey:@"message"];
+}
+
+- (NSString *)message
+{
+ return [super stringForKey:@"message"];
+}
+
+- (void)setCode:(int)code
+{
+ [super setInteger:code forKey:@"code"];
+}
+
+- (int)code
+{
+ return [super integerForKey:@"code"];
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-async-attribute.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
new file mode 100644
index 000000000..e7d63706f
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result
@@ -0,0 +1,1489 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+class AlternateDatabaseBackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateDatabaseBackendDispatcher() { }
+ virtual void executeAllOptionalParameters(long callId, const Inspector::InspectorArray* in_columnNames, const String* in_notes, const double* in_timestamp, const Inspector::InspectorObject* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const Inspector::InspectorObject* in_sqlError, const String* in_screenColor, const Inspector::InspectorArray* in_alternateColors, const String* in_printColor) = 0;
+ virtual void executeNoOptionalParameters(long callId, const Inspector::InspectorArray& in_columnNames, const String& in_notes, double in_timestamp, const Inspector::InspectorObject& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const Inspector::InspectorObject& in_sqlError, const String& in_screenColor, const Inspector::InspectorArray& in_alternateColors, const String& in_printColor) = 0;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Database.
+InspectorBackend.registerEnum("Database.PrimaryColors", {Red: "red", Green: "green", Blue: "blue"});
+InspectorBackend.registerCommand("Database.executeAllOptionalParameters", [{"name": "columnNames", "type": "object", "optional": true}, {"name": "notes", "type": "string", "optional": true}, {"name": "timestamp", "type": "number", "optional": true}, {"name": "values", "type": "object", "optional": true}, {"name": "payload", "type": "object", "optional": true}, {"name": "databaseId", "type": "number", "optional": true}, {"name": "sqlError", "type": "object", "optional": true}, {"name": "screenColor", "type": "string", "optional": true}, {"name": "alternateColors", "type": "object", "optional": true}, {"name": "printColor", "type": "string", "optional": true}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.registerCommand("Database.executeNoOptionalParameters", [{"name": "columnNames", "type": "object", "optional": false}, {"name": "notes", "type": "string", "optional": false}, {"name": "timestamp", "type": "number", "optional": false}, {"name": "values", "type": "object", "optional": false}, {"name": "payload", "type": "object", "optional": false}, {"name": "databaseId", "type": "number", "optional": false}, {"name": "sqlError", "type": "object", "optional": false}, {"name": "screenColor", "type": "string", "optional": false}, {"name": "alternateColors", "type": "object", "optional": false}, {"name": "printColor", "type": "string", "optional": false}], ["columnNames", "notes", "timestamp", "values", "payload", "databaseId", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.activateDomain("Database");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+class AlternateDatabaseBackendDispatcher;
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+class DatabaseBackendDispatcherHandler {
+public:
+ // Named after parameter 'screenColor' while generating command/event executeAllOptionalParameters.
+ enum class ScreenColor {
+ Red = 0,
+ Green = 1,
+ Blue = 2,
+ }; // enum class ScreenColor
+ // Named after parameter 'printColor' while generating command/event executeAllOptionalParameters.
+ enum class PrintColor {
+ Cyan = 3,
+ Magenta = 4,
+ Yellow = 5,
+ Black = 6,
+ }; // enum class PrintColor
+ virtual void executeAllOptionalParameters(ErrorString&, const Inspector::InspectorArray* opt_in_columnNames, const String* opt_in_notes, const double* opt_in_timestamp, const Inspector::InspectorObject* opt_in_values, const Inspector::InspectorValue* opt_in_payload, const int* opt_in_databaseId, const Inspector::InspectorObject* opt_in_sqlError, const String* opt_in_screenColor, const Inspector::InspectorArray* opt_in_alternateColors, const String* opt_in_printColor, RefPtr<Inspector::Protocol::Array<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<Inspector::InspectorObject>* opt_out_values, Inspector::Protocol::OptOutput<Inspector::InspectorValue>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
+ virtual void executeNoOptionalParameters(ErrorString&, const Inspector::InspectorArray& in_columnNames, const String& in_notes, double in_timestamp, const Inspector::InspectorObject& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const Inspector::InspectorObject& in_sqlError, const String& in_screenColor, const Inspector::InspectorArray& in_alternateColors, const String& in_printColor, RefPtr<Inspector::Protocol::Array<String>>& out_columnNames, String* out_notes, double* out_timestamp, Inspector::InspectorObject* out_values, Inspector::InspectorValue* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
+protected:
+ virtual ~DatabaseBackendDispatcherHandler();
+};
+
+class DatabaseBackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<DatabaseBackendDispatcher> create(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void executeAllOptionalParameters(long requestId, RefPtr<InspectorObject>&& parameters);
+ void executeNoOptionalParameters(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ DatabaseBackendDispatcher(BackendDispatcher&, DatabaseBackendDispatcherHandler*);
+ DatabaseBackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateDatabaseBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateDatabaseBackendDispatcher* m_alternateDispatcher;
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+DatabaseBackendDispatcherHandler::~DatabaseBackendDispatcherHandler() { }
+
+Ref<DatabaseBackendDispatcher> DatabaseBackendDispatcher::create(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent)
+{
+ return adoptRef(*new DatabaseBackendDispatcher(backendDispatcher, agent));
+}
+
+DatabaseBackendDispatcher::DatabaseBackendDispatcher(BackendDispatcher& backendDispatcher, DatabaseBackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Database"), this);
+}
+
+void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<DatabaseBackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ if (method == "executeAllOptionalParameters")
+ executeAllOptionalParameters(requestId, WTFMove(parameters));
+ else if (method == "executeNoOptionalParameters")
+ executeNoOptionalParameters(requestId, WTFMove(parameters));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
+}
+
+void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ bool opt_in_columnNames_valueFound = false;
+ RefPtr<Inspector::InspectorArray> opt_in_columnNames = m_backendDispatcher->getArray(parameters.get(), ASCIILiteral("columnNames"), &opt_in_columnNames_valueFound);
+ bool opt_in_notes_valueFound = false;
+ String opt_in_notes = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("notes"), &opt_in_notes_valueFound);
+ bool opt_in_timestamp_valueFound = false;
+ Inspector::Protocol::OptOutput<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);
+ bool opt_in_values_valueFound = false;
+ RefPtr<Inspector::InspectorObject> opt_in_values = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("values"), &opt_in_values_valueFound);
+ bool opt_in_payload_valueFound = false;
+ RefPtr<Inspector::InspectorValue> opt_in_payload = m_backendDispatcher->getValue(parameters.get(), ASCIILiteral("payload"), &opt_in_payload_valueFound);
+ bool opt_in_databaseId_valueFound = false;
+ int opt_in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), &opt_in_databaseId_valueFound);
+ bool opt_in_sqlError_valueFound = false;
+ RefPtr<Inspector::InspectorObject> opt_in_sqlError = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("sqlError"), &opt_in_sqlError_valueFound);
+ bool opt_in_screenColor_valueFound = false;
+ String opt_in_screenColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("screenColor"), &opt_in_screenColor_valueFound);
+ bool opt_in_alternateColors_valueFound = false;
+ RefPtr<Inspector::InspectorArray> opt_in_alternateColors = m_backendDispatcher->getArray(parameters.get(), ASCIILiteral("alternateColors"), &opt_in_alternateColors_valueFound);
+ bool opt_in_printColor_valueFound = false;
+ String opt_in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), &opt_in_printColor_valueFound);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeAllOptionalParameters(requestId, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
+ Inspector::Protocol::OptOutput<String> out_notes;
+ Inspector::Protocol::OptOutput<double> out_timestamp;
+ Inspector::Protocol::OptOutput<Inspector::InspectorObject> out_values;
+ Inspector::Protocol::OptOutput<Inspector::InspectorValue> out_payload;
+ Inspector::Protocol::OptOutput<Inspector::Protocol::Database::DatabaseId> out_databaseId;
+ RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
+ Inspector::Protocol::Database::PrimaryColors out_screenColor;
+ RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
+ DatabaseBackendDispatcherHandler::PrintColor out_printColor;
+ m_agent->executeAllOptionalParameters(error, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);
+
+ if (!error.length()) {
+ if (out_columnNames)
+ result->setArray(ASCIILiteral("columnNames"), out_columnNames);
+ if (out_notes.isAssigned())
+ result->setString(ASCIILiteral("notes"), out_notes.getValue());
+ if (out_timestamp.isAssigned())
+ result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
+ if (out_values.isAssigned())
+ result->setObject(ASCIILiteral("values"), out_values.getValue());
+ if (out_payload.isAssigned())
+ result->setValue(ASCIILiteral("payload"), out_payload.getValue());
+ if (out_databaseId.isAssigned())
+ result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
+ if (out_sqlError)
+ result->setObject(ASCIILiteral("sqlError"), out_sqlError);
+ if (out_screenColor.isAssigned())
+ result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
+ if (out_alternateColors)
+ result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
+ if (out_printColor.isAssigned())
+ result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
+ }
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void DatabaseBackendDispatcher::executeNoOptionalParameters(long requestId, RefPtr<InspectorObject>&& parameters)
+{
+ RefPtr<Inspector::InspectorArray> in_columnNames = m_backendDispatcher->getArray(parameters.get(), ASCIILiteral("columnNames"), nullptr);
+ String in_notes = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("notes"), nullptr);
+ double in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), nullptr);
+ RefPtr<Inspector::InspectorObject> in_values = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("values"), nullptr);
+ RefPtr<Inspector::InspectorValue> in_payload = m_backendDispatcher->getValue(parameters.get(), ASCIILiteral("payload"), nullptr);
+ int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
+ RefPtr<Inspector::InspectorObject> in_sqlError = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("sqlError"), nullptr);
+ String in_screenColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("screenColor"), nullptr);
+ RefPtr<Inspector::InspectorArray> in_alternateColors = m_backendDispatcher->getArray(parameters.get(), ASCIILiteral("alternateColors"), nullptr);
+ String in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), nullptr);
+ if (m_backendDispatcher->hasProtocolErrors()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters"));
+ return;
+ }
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->executeNoOptionalParameters(requestId, *in_columnNames, in_notes, in_timestamp, *in_values, *in_payload, in_databaseId, *in_sqlError, in_screenColor, *in_alternateColors, in_printColor);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ RefPtr<Inspector::Protocol::Array<String>> out_columnNames;
+ String out_notes;
+ double out_timestamp;
+ Inspector::InspectorObject out_values;
+ Inspector::InspectorValue out_payload;
+ Inspector::Protocol::Database::DatabaseId out_databaseId;
+ RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
+ Inspector::Protocol::Database::PrimaryColors out_screenColor;
+ RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
+ DatabaseBackendDispatcherHandler::PrintColor out_printColor;
+ m_agent->executeNoOptionalParameters(error, *in_columnNames, in_notes, in_timestamp, *in_values, *in_payload, in_databaseId, *in_sqlError, in_screenColor, *in_alternateColors, in_printColor, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);
+
+ if (!error.length()) {
+ result->setArray(ASCIILiteral("columnNames"), out_columnNames);
+ result->setString(ASCIILiteral("notes"), out_notes);
+ result->setDouble(ASCIILiteral("timestamp"), out_timestamp);
+ result->setObject(ASCIILiteral("values"), out_values);
+ result->setValue(ASCIILiteral("payload"), out_payload);
+ result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
+ result->setObject(ASCIILiteral("sqlError"), out_sqlError);
+ result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
+ result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
+ result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
+ }
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Database {
+class Error;
+enum class PrimaryColors;
+} // Database
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Database {
+/* Unique identifier of Database object. */
+typedef int DatabaseId;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Database::PrimaryColors> ColorList;
+} // Database
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Database {
+/* */
+enum class PrimaryColors {
+ Red = 0,
+ Green = 1,
+ Blue = 2,
+}; // enum class PrimaryColors
+/* Database error. */
+class Error : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ MessageSet = 1 << 0,
+ CodeSet = 1 << 1,
+ AllFieldsSet = (MessageSet | CodeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*Error*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class Error;
+ public:
+
+ Builder<STATE | MessageSet>& setMessage(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
+ m_result->setString(ASCIILiteral("message"), value);
+ return castState<MessageSet>();
+ }
+
+ Builder<STATE | CodeSet>& setCode(int value)
+ {
+ COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
+ m_result->setInteger(ASCIILiteral("code"), value);
+ return castState<CodeSet>();
+ }
+
+ Ref<Error> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<Error>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<Error> result = Error::create()
+ * .setMessage(...)
+ * .setCode(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Database
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "red",
+ "green",
+ "blue",
+ "cyan",
+ "magenta",
+ "yellow",
+ "black",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+@protocol RWIProtocolDatabaseDomainHandler;
+
+namespace Inspector {
+
+
+class ObjCInspectorDatabaseBackendDispatcher final : public AlternateDatabaseBackendDispatcher {
+public:
+ ObjCInspectorDatabaseBackendDispatcher(id<RWIProtocolDatabaseDomainHandler> handler) { m_delegate = handler; }
+ virtual void executeAllOptionalParameters(long requestId, const Inspector::InspectorArray* in_columnNames, const String* in_notes, const double* in_timestamp, const Inspector::InspectorObject* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const Inspector::InspectorObject* in_sqlError, const String* in_screenColor, const Inspector::InspectorArray* in_alternateColors, const String* in_printColor) override;
+ virtual void executeNoOptionalParameters(long requestId, const Inspector::InspectorArray& in_columnNames, const String& in_notes, double in_timestamp, const Inspector::InspectorObject& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const Inspector::InspectorObject& in_sqlError, const String& in_screenColor, const Inspector::InspectorArray& in_alternateColors, const String& in_printColor) override;
+private:
+ RetainPtr<id<RWIProtocolDatabaseDomainHandler>> m_delegate;
+};
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ id<RWIProtocolDatabaseDomainHandler> _databaseHandler;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_databaseHandler release];
+ [super dealloc];
+}
+
+- (void)setDatabaseHandler:(id<RWIProtocolDatabaseDomainHandler>)handler
+{
+ if (handler == _databaseHandler)
+ return;
+
+ [_databaseHandler release];
+ _databaseHandler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<DatabaseBackendDispatcher, AlternateDatabaseBackendDispatcher>>(ASCIILiteral("Database"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolDatabaseDomainHandler>)databaseHandler
+{
+ return _databaseHandler;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, retain, setter=setDatabaseHandler:) id<RWIProtocolDatabaseDomainHandler> databaseHandler;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, const Inspector::InspectorArray* in_columnNames, const String* in_notes, const double* in_timestamp, const Inspector::InspectorObject* in_values, const Inspector::InspectorValue* in_payload, const int* in_databaseId, const Inspector::InspectorObject* in_sqlError, const String* in_screenColor, const Inspector::InspectorArray* in_alternateColors, const String* in_printColor)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor *printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors");
+ if (columnNames)
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(*columnNames));
+ if (notes)
+ resultObject->setString(ASCIILiteral("notes"), *notes);
+ if (timestamp)
+ resultObject->setDouble(ASCIILiteral("timestamp"), *timestamp);
+ if (values)
+ resultObject->setObject(ASCIILiteral("values"), [*values toInspectorObject]);
+ if (payload)
+ resultObject->setValue(ASCIILiteral("payload"), [*payload toInspectorObject]);
+ if (databaseId)
+ resultObject->setInteger(ASCIILiteral("databaseId"), *databaseId);
+ if (sqlError)
+ resultObject->setObject(ASCIILiteral("sqlError"), [*sqlError toInspectorObject]);
+ if (screenColor)
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(*screenColor));
+ if (alternateColors)
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(*alternateColors));
+ if (printColor)
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(*printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ NSArray/*<NSString>*/ *o_in_columnNames;
+ if (in_columnNames)
+ o_in_columnNames = objcStringArray(in_columnNames);
+ NSString *o_in_notes;
+ if (in_notes)
+ o_in_notes = *in_notes;
+ double o_in_timestamp;
+ if (in_timestamp)
+ o_in_timestamp = *in_timestamp;
+ RWIProtocolJSONObject *o_in_values;
+ if (in_values)
+ o_in_values = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:in_values] autorelease];
+ RWIProtocolJSONObject *o_in_payload;
+ if (in_payload)
+ o_in_payload = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:in_payload] autorelease];
+ int o_in_databaseId;
+ if (in_databaseId)
+ o_in_databaseId = *in_databaseId;
+ RWIProtocolDatabaseError *o_in_sqlError;
+ if (in_sqlError)
+ o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:in_sqlError] autorelease];
+ RWIProtocolDatabasePrimaryColors o_in_screenColor;
+ if (in_screenColor)
+ o_in_screenColor = fromProtocolString<RWIProtocolDatabasePrimaryColors>(*in_screenColor);
+ NSArray/*<NSString>*/ *o_in_alternateColors;
+ if (in_alternateColors)
+ o_in_alternateColors = objcStringArray(in_alternateColors);
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor o_in_printColor;
+ if (in_printColor)
+ o_in_printColor = fromProtocolString<RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor>(*in_printColor);
+
+ [m_delegate executeAllOptionalParametersWithErrorCallback:errorCallback successCallback:successCallback columnNames:(in_columnNames ? &o_in_columnNames : nil) notes:(in_notes ? &o_in_notes : nil) timestamp:(in_timestamp ? &o_in_timestamp : nil) values:(in_values ? &o_in_values : nil) payload:(in_payload ? &o_in_payload : nil) databaseId:(in_databaseId ? &o_in_databaseId : nil) sqlError:(in_sqlError ? &o_in_sqlError : nil) screenColor:(in_screenColor ? &o_in_screenColor : nil) alternateColors:(in_alternateColors ? &o_in_alternateColors : nil) printColor:(in_printColor ? &o_in_printColor : nil)];
+}
+
+void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long requestId, const Inspector::InspectorArray& in_columnNames, const String& in_notes, double in_timestamp, const Inspector::InspectorObject& in_values, Inspector::InspectorValue in_payload, int in_databaseId, const Inspector::InspectorObject& in_sqlError, const String& in_screenColor, const Inspector::InspectorArray& in_alternateColors, const String& in_printColor)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor printColor) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors");
+ resultObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames));
+ resultObject->setString(ASCIILiteral("notes"), notes);
+ resultObject->setDouble(ASCIILiteral("timestamp"), timestamp);
+ resultObject->setObject(ASCIILiteral("values"), [values toInspectorObject]);
+ resultObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]);
+ resultObject->setInteger(ASCIILiteral("databaseId"), databaseId);
+ resultObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
+ resultObject->setString(ASCIILiteral("screenColor"), toProtocolString(screenColor));
+ resultObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors));
+ resultObject->setString(ASCIILiteral("printColor"), toProtocolString(printColor));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ NSArray/*<NSString>*/ *o_in_columnNames = objcStringArray(&in_columnNames);
+ NSString *o_in_notes = in_notes;
+ double o_in_timestamp = in_timestamp;
+ RWIProtocolJSONObject *o_in_values = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:&in_values] autorelease];
+ RWIProtocolJSONObject *o_in_payload = [[[RWIProtocolJSONObject alloc] initWithInspectorObject:&in_payload] autorelease];
+ int o_in_databaseId = in_databaseId;
+ RWIProtocolDatabaseError *o_in_sqlError = [[[RWIProtocolDatabaseError alloc] initWithInspectorObject:&in_sqlError] autorelease];
+ RWIProtocolDatabasePrimaryColors o_in_screenColor = fromProtocolString<RWIProtocolDatabasePrimaryColors>(in_screenColor);
+ NSArray/*<NSString>*/ *o_in_alternateColors = objcStringArray(&in_alternateColors);
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor o_in_printColor = fromProtocolString<RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor);
+
+ [m_delegate executeNoOptionalParametersWithErrorCallback:errorCallback successCallback:successCallback columnNames:o_in_columnNames notes:o_in_notes timestamp:o_in_timestamp values:o_in_values payload:o_in_payload databaseId:o_in_databaseId sqlError:o_in_sqlError screenColor:o_in_screenColor alternateColors:o_in_alternateColors printColor:o_in_printColor];
+}
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolDatabasePrimaryColors value)
+{
+ switch(value) {
+ case RWIProtocolDatabasePrimaryColorsRed:
+ return ASCIILiteral("red");
+ case RWIProtocolDatabasePrimaryColorsGreen:
+ return ASCIILiteral("green");
+ case RWIProtocolDatabasePrimaryColorsBlue:
+ return ASCIILiteral("blue");
+ }
+}
+
+template<>
+inline RWIProtocolDatabasePrimaryColors fromProtocolString(const String& value)
+{
+ if (value == "red")
+ return RWIProtocolDatabasePrimaryColorsRed;
+ if (value == "green")
+ return RWIProtocolDatabasePrimaryColorsGreen;
+ if (value == "blue")
+ return RWIProtocolDatabasePrimaryColorsBlue;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabasePrimaryColorsRed;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan;
+}
+
+inline String toProtocolString(RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor value)
+{
+ switch(value) {
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow:
+ return ASCIILiteral("yellow");
+ case RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack:
+ return ASCIILiteral("black");
+ }
+}
+
+template<>
+inline RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor fromProtocolString(const String& value)
+{
+ if (value == "cyan")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan;
+ if (value == "magenta")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta;
+ if (value == "yellow")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow;
+ if (value == "black")
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolDatabaseError;
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabasePrimaryColors) {
+ RWIProtocolDatabasePrimaryColorsRed,
+ RWIProtocolDatabasePrimaryColorsGreen,
+ RWIProtocolDatabasePrimaryColorsBlue,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor) {
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor) {
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorCyan,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorMagenta,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorYellow,
+ RWIProtocolDatabaseExecuteAllOptionalParametersPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor) {
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor) {
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorCyan,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorMagenta,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorYellow,
+ RWIProtocolDatabaseExecuteNoOptionalParametersPrintColorBlack,
+};
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseError : RWIProtocolJSONObject
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+/* required */ @property (nonatomic, copy) NSString *message;
+/* required */ @property (nonatomic, assign) int code;
+@end
+
+@protocol RWIProtocolDatabaseDomainHandler <NSObject>
+@required
+- (void)executeAllOptionalParametersWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ **columnNames, NSString **notes, double *timestamp, RWIProtocolJSONObject **values, RWIProtocolJSONObject **payload, int *databaseId, RWIProtocolDatabaseError **sqlError, RWIProtocolDatabasePrimaryColors *screenColor, NSArray/*<NSString>*/ **alternateColors, RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor *printColor))successCallback columnNames:(NSArray/*<NSString>*/ **)columnNames notes:(NSString **)notes timestamp:(double *)timestamp values:(RWIProtocolJSONObject **)values payload:(RWIProtocolJSONObject **)payload databaseId:(int *)databaseId sqlError:(RWIProtocolDatabaseError **)sqlError screenColor:(RWIProtocolDatabasePrimaryColors *)screenColor alternateColors:(NSArray/*<NSString>*/ **)alternateColors printColor:(RWIProtocolDatabaseExecuteAllOptionalParametersPrintColor *)printColor;
+- (void)executeNoOptionalParametersWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(NSArray/*<NSString>*/ *columnNames, NSString *notes, double timestamp, RWIProtocolJSONObject *values, RWIProtocolJSONObject *payload, int databaseId, RWIProtocolDatabaseError *sqlError, RWIProtocolDatabasePrimaryColors screenColor, NSArray/*<NSString>*/ *alternateColors, RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor printColor))successCallback columnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload databaseId:(int)databaseId sqlError:(RWIProtocolDatabaseError *)sqlError screenColor:(RWIProtocolDatabasePrimaryColors)screenColor alternateColors:(NSArray/*<NSString>*/ *)alternateColors printColor:(RWIProtocolDatabaseExecuteNoOptionalParametersPrintColor)printColor;
+@end
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolDatabaseError
+
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message");
+
+ self.message = message;
+ self.code = code;
+
+ return self;
+}
+
+- (void)setMessage:(NSString *)message
+{
+ [super setString:message forKey:@"message"];
+}
+
+- (NSString *)message
+{
+ return [super stringForKey:@"message"];
+}
+
+- (void)setCode:(int)code
+{
+ [super setInteger:code forKey:@"code"];
+}
+
+- (int)code
+{
+ return [super integerForKey:@"code"];
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from commands-with-optional-call-return-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result
new file mode 100644
index 000000000..540e1528d
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result
@@ -0,0 +1,1356 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+class AlternateNetwork1BackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateNetwork1BackendDispatcher() { }
+ virtual void loadResource1(long callId) = 0;
+};
+class AlternateNetwork3BackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateNetwork3BackendDispatcher() { }
+ virtual void loadResource1(long callId) = 0;
+ virtual void loadResource2(long callId) = 0;
+ virtual void loadResource3(long callId) = 0;
+ virtual void loadResource4(long callId) = 0;
+ virtual void loadResource5(long callId) = 0;
+ virtual void loadResource6(long callId) = 0;
+ virtual void loadResource7(long callId) = 0;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Network1.
+InspectorBackend.registerCommand("Network1.loadResource1", [], []);
+InspectorBackend.activateDomain("Network1");
+
+// Network3.
+InspectorBackend.registerCommand("Network3.loadResource1", [], []);
+InspectorBackend.registerCommand("Network3.loadResource2", [], []);
+InspectorBackend.registerCommand("Network3.loadResource3", [], []);
+InspectorBackend.registerCommand("Network3.loadResource4", [], []);
+InspectorBackend.registerCommand("Network3.loadResource5", [], []);
+InspectorBackend.registerCommand("Network3.loadResource6", [], []);
+InspectorBackend.registerCommand("Network3.loadResource7", [], []);
+InspectorBackend.activateDomain("Network3");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+class AlternateNetwork1BackendDispatcher;
+class AlternateNetwork3BackendDispatcher;
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+class Network1BackendDispatcherHandler {
+public:
+ virtual void loadResource1(ErrorString&) = 0;
+protected:
+ virtual ~Network1BackendDispatcherHandler();
+};
+
+class Network3BackendDispatcherHandler {
+public:
+ virtual void loadResource1(ErrorString&) = 0;
+ virtual void loadResource2(ErrorString&) = 0;
+ virtual void loadResource3(ErrorString&) = 0;
+ virtual void loadResource4(ErrorString&) = 0;
+ virtual void loadResource5(ErrorString&) = 0;
+ virtual void loadResource6(ErrorString&) = 0;
+ virtual void loadResource7(ErrorString&) = 0;
+protected:
+ virtual ~Network3BackendDispatcherHandler();
+};
+
+class Network1BackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<Network1BackendDispatcher> create(BackendDispatcher&, Network1BackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void loadResource1(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ Network1BackendDispatcher(BackendDispatcher&, Network1BackendDispatcherHandler*);
+ Network1BackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateNetwork1BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateNetwork1BackendDispatcher* m_alternateDispatcher;
+#endif
+};
+
+class Network3BackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<Network3BackendDispatcher> create(BackendDispatcher&, Network3BackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void loadResource1(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource2(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource3(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource4(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource5(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource6(long requestId, RefPtr<InspectorObject>&& parameters);
+ void loadResource7(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ Network3BackendDispatcher(BackendDispatcher&, Network3BackendDispatcherHandler*);
+ Network3BackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateNetwork3BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateNetwork3BackendDispatcher* m_alternateDispatcher;
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+Network1BackendDispatcherHandler::~Network1BackendDispatcherHandler() { }
+Network3BackendDispatcherHandler::~Network3BackendDispatcherHandler() { }
+
+Ref<Network1BackendDispatcher> Network1BackendDispatcher::create(BackendDispatcher& backendDispatcher, Network1BackendDispatcherHandler* agent)
+{
+ return adoptRef(*new Network1BackendDispatcher(backendDispatcher, agent));
+}
+
+Network1BackendDispatcher::Network1BackendDispatcher(BackendDispatcher& backendDispatcher, Network1BackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network1"), this);
+}
+
+void Network1BackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<Network1BackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ if (method == "loadResource1")
+ loadResource1(requestId, WTFMove(parameters));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
+}
+
+void Network1BackendDispatcher::loadResource1(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource1(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource1(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+Ref<Network3BackendDispatcher> Network3BackendDispatcher::create(BackendDispatcher& backendDispatcher, Network3BackendDispatcherHandler* agent)
+{
+ return adoptRef(*new Network3BackendDispatcher(backendDispatcher, agent));
+}
+
+Network3BackendDispatcher::Network3BackendDispatcher(BackendDispatcher& backendDispatcher, Network3BackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network3"), this);
+}
+
+void Network3BackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<Network3BackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ typedef void (Network3BackendDispatcher::*CallHandler)(long requestId, RefPtr<InspectorObject>&& message);
+ typedef HashMap<String, CallHandler> DispatchMap;
+ static NeverDestroyed<DispatchMap> dispatchMap;
+ if (dispatchMap.get().isEmpty()) {
+ static const struct MethodTable {
+ const char* name;
+ CallHandler handler;
+ } commands[] = {
+ { "loadResource1", &Network3BackendDispatcher::loadResource1 },
+ { "loadResource2", &Network3BackendDispatcher::loadResource2 },
+ { "loadResource3", &Network3BackendDispatcher::loadResource3 },
+ { "loadResource4", &Network3BackendDispatcher::loadResource4 },
+ { "loadResource5", &Network3BackendDispatcher::loadResource5 },
+ { "loadResource6", &Network3BackendDispatcher::loadResource6 },
+ { "loadResource7", &Network3BackendDispatcher::loadResource7 },
+ };
+ size_t length = WTF_ARRAY_LENGTH(commands);
+ for (size_t i = 0; i < length; ++i)
+ dispatchMap.get().add(commands[i].name, commands[i].handler);
+ }
+
+ auto findResult = dispatchMap.get().find(method);
+ if (findResult == dispatchMap.get().end()) {
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network3", '.', method, "' was not found"));
+ return;
+ }
+
+ ((*this).*findResult->value)(requestId, WTFMove(parameters));
+}
+
+void Network3BackendDispatcher::loadResource1(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource1(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource1(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource2(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource2(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource2(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource3(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource3(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource3(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource4(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource4(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource4(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource5(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource5(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource5(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource6(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource6(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource6(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+void Network3BackendDispatcher::loadResource7(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource7(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource7(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+
+
+// Typedefs.
+namespace Network2 {
+/* Unique loader identifier. */
+typedef String LoaderId;
+} // Network2
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+@protocol RWIProtocolNetwork1DomainHandler;
+@protocol RWIProtocolNetwork3DomainHandler;
+
+namespace Inspector {
+
+
+class ObjCInspectorNetwork1BackendDispatcher final : public AlternateNetwork1BackendDispatcher {
+public:
+ ObjCInspectorNetwork1BackendDispatcher(id<RWIProtocolNetwork1DomainHandler> handler) { m_delegate = handler; }
+ virtual void loadResource1(long requestId) override;
+private:
+ RetainPtr<id<RWIProtocolNetwork1DomainHandler>> m_delegate;
+};
+
+
+
+class ObjCInspectorNetwork3BackendDispatcher final : public AlternateNetwork3BackendDispatcher {
+public:
+ ObjCInspectorNetwork3BackendDispatcher(id<RWIProtocolNetwork3DomainHandler> handler) { m_delegate = handler; }
+ virtual void loadResource1(long requestId) override;
+ virtual void loadResource2(long requestId) override;
+ virtual void loadResource3(long requestId) override;
+ virtual void loadResource4(long requestId) override;
+ virtual void loadResource5(long requestId) override;
+ virtual void loadResource6(long requestId) override;
+ virtual void loadResource7(long requestId) override;
+private:
+ RetainPtr<id<RWIProtocolNetwork3DomainHandler>> m_delegate;
+};
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ id<RWIProtocolNetwork1DomainHandler> _network1Handler;
+ id<RWIProtocolNetwork3DomainHandler> _network3Handler;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_network1Handler release];
+ [_network3Handler release];
+ [super dealloc];
+}
+
+- (void)setNetwork1Handler:(id<RWIProtocolNetwork1DomainHandler>)handler
+{
+ if (handler == _network1Handler)
+ return;
+
+ [_network1Handler release];
+ _network1Handler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<Network1BackendDispatcher, AlternateNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolNetwork1DomainHandler>)network1Handler
+{
+ return _network1Handler;
+}
+
+- (void)setNetwork3Handler:(id<RWIProtocolNetwork3DomainHandler>)handler
+{
+ if (handler == _network3Handler)
+ return;
+
+ [_network3Handler release];
+ _network3Handler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork3BackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<Network3BackendDispatcher, AlternateNetwork3BackendDispatcher>>(ASCIILiteral("Network3"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolNetwork3DomainHandler>)network3Handler
+{
+ return _network3Handler;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, retain, setter=setNetwork1Handler:) id<RWIProtocolNetwork1DomainHandler> network1Handler;
+@property (nonatomic, retain, setter=setNetwork3Handler:) id<RWIProtocolNetwork3DomainHandler> network3Handler;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+void ObjCInspectorNetwork1BackendDispatcher::loadResource1(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource1WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+
+
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource1(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource1WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource2(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource2WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource3(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource3WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource4(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource4WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource5(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource5WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource6(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource6WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+void ObjCInspectorNetwork3BackendDispatcher::loadResource7(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResource7WithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+
+
+
+@protocol RWIProtocolNetwork1DomainHandler <NSObject>
+@required
+- (void)loadResource1WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+@end
+
+@protocol RWIProtocolNetwork3DomainHandler <NSObject>
+@required
+- (void)loadResource1WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource2WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource3WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource4WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource5WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource6WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+- (void)loadResource7WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+@end
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from domains-with-varying-command-sizes.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
new file mode 100644
index 000000000..d9730fc7c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result
@@ -0,0 +1,1177 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+class AlternateCommandDomainBackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateCommandDomainBackendDispatcher() { }
+ virtual void commandWithEnumReturnValue(long callId) = 0;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// TypeDomain.
+InspectorBackend.registerEnum("TypeDomain.TypeDomainEnum", {Shared: "shared", Red: "red", Green: "green", Blue: "blue"});
+
+// CommandDomain.
+InspectorBackend.registerCommand("CommandDomain.commandWithEnumReturnValue", [], ["returnValue"]);
+InspectorBackend.activateDomain("CommandDomain");
+
+// EventDomain.
+InspectorBackend.registerEventDomainDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "EventDomain");
+InspectorBackend.registerEnum("EventDomain.EventWithEnumParameterParameter", {Shared: "shared", Black: "black", White: "white"});
+InspectorBackend.registerEvent("EventDomain.eventWithEnumParameter", ["parameter"]);
+InspectorBackend.activateDomain("EventDomain");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+class AlternateCommandDomainBackendDispatcher;
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+class CommandDomainBackendDispatcherHandler {
+public:
+ // Named after parameter 'returnValue' while generating command/event commandWithEnumReturnValue.
+ enum class ReturnValue {
+ Shared = 0,
+ Cyan = 6,
+ Magenta = 7,
+ Yellow = 8,
+ }; // enum class ReturnValue
+ virtual void commandWithEnumReturnValue(ErrorString&, CommandDomainBackendDispatcherHandler::ReturnValue* out_returnValue) = 0;
+protected:
+ virtual ~CommandDomainBackendDispatcherHandler();
+};
+
+class CommandDomainBackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<CommandDomainBackendDispatcher> create(BackendDispatcher&, CommandDomainBackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void commandWithEnumReturnValue(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ CommandDomainBackendDispatcher(BackendDispatcher&, CommandDomainBackendDispatcherHandler*);
+ CommandDomainBackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateCommandDomainBackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateCommandDomainBackendDispatcher* m_alternateDispatcher;
+#endif
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+CommandDomainBackendDispatcherHandler::~CommandDomainBackendDispatcherHandler() { }
+
+Ref<CommandDomainBackendDispatcher> CommandDomainBackendDispatcher::create(BackendDispatcher& backendDispatcher, CommandDomainBackendDispatcherHandler* agent)
+{
+ return adoptRef(*new CommandDomainBackendDispatcher(backendDispatcher, agent));
+}
+
+CommandDomainBackendDispatcher::CommandDomainBackendDispatcher(BackendDispatcher& backendDispatcher, CommandDomainBackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("CommandDomain"), this);
+}
+
+void CommandDomainBackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<CommandDomainBackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ if (method == "commandWithEnumReturnValue")
+ commandWithEnumReturnValue(requestId, WTFMove(parameters));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found"));
+}
+
+void CommandDomainBackendDispatcher::commandWithEnumReturnValue(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->commandWithEnumReturnValue(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ CommandDomainBackendDispatcherHandler::ReturnValue out_returnValue;
+ m_agent->commandWithEnumReturnValue(error, &out_returnValue);
+
+ if (!error.length())
+ result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::getEnumConstantValue(out_returnValue));
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+class EventDomainFrontendDispatcher {
+public:
+ EventDomainFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
+ // Named after parameter 'parameter' while generating command/event eventWithEnumParameter.
+ enum class Parameter {
+ Shared = 0,
+ Black = 4,
+ White = 5,
+ }; // enum class Parameter
+ void eventWithEnumParameter(Parameter parameter);
+private:
+ FrontendRouter& m_frontendRouter;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+void EventDomainFrontendDispatcher::eventWithEnumParameter(Parameter parameter)
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::getEnumConstantValue(parameter));
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+
+ m_frontendRouter.sendEvent(jsonMessage->toJSONString());
+}
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace TypeDomain {
+enum class TypeDomainEnum;
+} // TypeDomain
+// End of forward declarations.
+
+
+
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace TypeDomain {
+/* */
+enum class TypeDomainEnum {
+ Shared = 0,
+ Red = 1,
+ Green = 2,
+ Blue = 3,
+}; // enum class TypeDomainEnum
+} // TypeDomain
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "shared",
+ "red",
+ "green",
+ "blue",
+ "black",
+ "white",
+ "cyan",
+ "magenta",
+ "yellow",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+@protocol RWIProtocolCommandDomainDomainHandler;
+
+namespace Inspector {
+
+
+
+
+class ObjCInspectorCommandDomainBackendDispatcher final : public AlternateCommandDomainBackendDispatcher {
+public:
+ ObjCInspectorCommandDomainBackendDispatcher(id<RWIProtocolCommandDomainDomainHandler> handler) { m_delegate = handler; }
+ virtual void commandWithEnumReturnValue(long requestId) override;
+private:
+ RetainPtr<id<RWIProtocolCommandDomainDomainHandler>> m_delegate;
+};
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ id<RWIProtocolCommandDomainDomainHandler> _commandDomainHandler;
+ RWIProtocolEventDomainDomainEventDispatcher *_eventDomainEventDispatcher;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_commandDomainHandler release];
+ [_eventDomainEventDispatcher release];
+ [super dealloc];
+}
+
+- (void)setCommandDomainHandler:(id<RWIProtocolCommandDomainDomainHandler>)handler
+{
+ if (handler == _commandDomainHandler)
+ return;
+
+ [_commandDomainHandler release];
+ _commandDomainHandler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorCommandDomainBackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<CommandDomainBackendDispatcher, AlternateCommandDomainBackendDispatcher>>(ASCIILiteral("CommandDomain"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolCommandDomainDomainHandler>)commandDomainHandler
+{
+ return _commandDomainHandler;
+}
+
+- (RWIProtocolEventDomainDomainEventDispatcher *)eventDomainEventDispatcher
+{
+ if (!_eventDomainEventDispatcher)
+ _eventDomainEventDispatcher = [[RWIProtocolEventDomainDomainEventDispatcher alloc] initWithController:_controller];
+ return _eventDomainEventDispatcher;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, retain, setter=setCommandDomainHandler:) id<RWIProtocolCommandDomainDomainHandler> commandDomainHandler;
+@property (nonatomic, readonly) RWIProtocolEventDomainDomainEventDispatcher *eventDomainEventDispatcher;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+void ObjCInspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue) {
+ Ref<InspectorObject> resultObject = InspectorObject::create();
+ resultObject->setString(ASCIILiteral("returnValue"), toProtocolString(returnValue));
+ backendDispatcher()->sendResponse(requestId, WTFMove(resultObject));
+ };
+
+ [m_delegate commandWithEnumReturnValueWithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolTypeDomainEnum value)
+{
+ switch(value) {
+ case RWIProtocolTypeDomainEnumShared:
+ return ASCIILiteral("shared");
+ case RWIProtocolTypeDomainEnumRed:
+ return ASCIILiteral("red");
+ case RWIProtocolTypeDomainEnumGreen:
+ return ASCIILiteral("green");
+ case RWIProtocolTypeDomainEnumBlue:
+ return ASCIILiteral("blue");
+ }
+}
+
+template<>
+inline RWIProtocolTypeDomainEnum fromProtocolString(const String& value)
+{
+ if (value == "shared")
+ return RWIProtocolTypeDomainEnumShared;
+ if (value == "red")
+ return RWIProtocolTypeDomainEnumRed;
+ if (value == "green")
+ return RWIProtocolTypeDomainEnumGreen;
+ if (value == "blue")
+ return RWIProtocolTypeDomainEnumBlue;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolTypeDomainEnumShared;
+}
+
+
+inline String toProtocolString(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue value)
+{
+ switch(value) {
+ case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared:
+ return ASCIILiteral("shared");
+ case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan:
+ return ASCIILiteral("cyan");
+ case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta:
+ return ASCIILiteral("magenta");
+ case RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow:
+ return ASCIILiteral("yellow");
+ }
+}
+
+template<>
+inline RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue fromProtocolString(const String& value)
+{
+ if (value == "shared")
+ return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared;
+ if (value == "cyan")
+ return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan;
+ if (value == "magenta")
+ return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta;
+ if (value == "yellow")
+ return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared;
+}
+
+
+inline String toProtocolString(RWIProtocolEventDomainEventWithEnumParameterParameter value)
+{
+ switch(value) {
+ case RWIProtocolEventDomainEventWithEnumParameterParameterShared:
+ return ASCIILiteral("shared");
+ case RWIProtocolEventDomainEventWithEnumParameterParameterBlack:
+ return ASCIILiteral("black");
+ case RWIProtocolEventDomainEventWithEnumParameterParameterWhite:
+ return ASCIILiteral("white");
+ }
+}
+
+template<>
+inline RWIProtocolEventDomainEventWithEnumParameterParameter fromProtocolString(const String& value)
+{
+ if (value == "shared")
+ return RWIProtocolEventDomainEventWithEnumParameterParameterShared;
+ if (value == "black")
+ return RWIProtocolEventDomainEventWithEnumParameterParameterBlack;
+ if (value == "white")
+ return RWIProtocolEventDomainEventWithEnumParameterParameterWhite;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolEventDomainEventWithEnumParameterParameterShared;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+@implementation RWIProtocolEventDomainDomainEventDispatcher
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)eventWithEnumParameterWithParameter:(RWIProtocolEventDomainEventWithEnumParameterParameter)parameter
+{
+ const FrontendRouter& router = _controller->frontendRouter();
+
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ paramsObject->setString(ASCIILiteral("parameter"), toProtocolString(parameter));
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+ router.sendEvent(jsonMessage->toJSONString());
+}
+
+@end
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolTypeDomainEnum) {
+ RWIProtocolTypeDomainEnumShared,
+ RWIProtocolTypeDomainEnumRed,
+ RWIProtocolTypeDomainEnumGreen,
+ RWIProtocolTypeDomainEnumBlue,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue) {
+ RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueShared,
+ RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueCyan,
+ RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueMagenta,
+ RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValueYellow,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolEventDomainEventWithEnumParameterParameter) {
+ RWIProtocolEventDomainEventWithEnumParameterParameterShared,
+ RWIProtocolEventDomainEventWithEnumParameterParameterBlack,
+ RWIProtocolEventDomainEventWithEnumParameterParameterWhite,
+};
+
+
+
+@protocol RWIProtocolCommandDomainDomainHandler <NSObject>
+@required
+- (void)commandWithEnumReturnValueWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue))successCallback;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolEventDomainDomainEventDispatcher : NSObject
+- (void)eventWithEnumParameterWithParameter:(RWIProtocolEventDomainEventWithEnumParameterParameter)parameter;
+@end
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from enum-values.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+@interface RWIProtocolEventDomainDomainEventDispatcher (Private)
+- (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller;
+@end
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result
new file mode 100644
index 000000000..c1788787a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result
@@ -0,0 +1,1104 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Database.
+InspectorBackend.registerDatabaseDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Database");
+InspectorBackend.registerEvent("Database.didExecuteOptionalParameters", ["columnNames", "notes", "timestamp", "values", "payload", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.registerEvent("Database.didExecuteNoOptionalParameters", ["columnNames", "notes", "timestamp", "values", "payload", "sqlError", "screenColor", "alternateColors", "printColor"]);
+InspectorBackend.activateDomain("Database");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+class DatabaseFrontendDispatcher {
+public:
+ DatabaseFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
+ void didExecuteOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* const printColor);
+ void didExecuteNoOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String& printColor);
+private:
+ FrontendRouter& m_frontendRouter;
+};
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+void DatabaseFrontendDispatcher::didExecuteOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* const printColor)
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteOptionalParameters"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ if (columnNames)
+ paramsObject->setArray(ASCIILiteral("columnNames"), columnNames);
+ if (notes)
+ paramsObject->setString(ASCIILiteral("notes"), *notes);
+ if (timestamp)
+ paramsObject->setDouble(ASCIILiteral("timestamp"), *timestamp);
+ if (values)
+ paramsObject->setObject(ASCIILiteral("values"), values);
+ if (payload)
+ paramsObject->setValue(ASCIILiteral("payload"), *payload);
+ if (sqlError)
+ paramsObject->setObject(ASCIILiteral("sqlError"), sqlError);
+ if (screenColor)
+ paramsObject->setString(ASCIILiteral("screenColor"), *screenColor);
+ if (alternateColors)
+ paramsObject->setArray(ASCIILiteral("alternateColors"), alternateColors);
+ if (printColor)
+ paramsObject->setString(ASCIILiteral("printColor"), *printColor);
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+
+ m_frontendRouter.sendEvent(jsonMessage->toJSONString());
+}
+
+void DatabaseFrontendDispatcher::didExecuteNoOptionalParameters(RefPtr<Inspector::Protocol::Array<String>> columnNames, const String& notes, double timestamp, RefPtr<Inspector::InspectorObject> values, RefPtr<Inspector::InspectorValue> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors& screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String& printColor)
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteNoOptionalParameters"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ paramsObject->setArray(ASCIILiteral("columnNames"), columnNames);
+ paramsObject->setString(ASCIILiteral("notes"), notes);
+ paramsObject->setDouble(ASCIILiteral("timestamp"), timestamp);
+ paramsObject->setObject(ASCIILiteral("values"), values);
+ paramsObject->setValue(ASCIILiteral("payload"), payload);
+ paramsObject->setObject(ASCIILiteral("sqlError"), sqlError);
+ paramsObject->setString(ASCIILiteral("screenColor"), screenColor);
+ paramsObject->setArray(ASCIILiteral("alternateColors"), alternateColors);
+ paramsObject->setString(ASCIILiteral("printColor"), printColor);
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+
+ m_frontendRouter.sendEvent(jsonMessage->toJSONString());
+}
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Database {
+class Error;
+} // Database
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Database {
+/* Unique identifier of Database object. */
+typedef String DatabaseId;
+typedef String PrimaryColors;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Database::PrimaryColors> ColorList;
+} // Database
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Database {
+/* Database error. */
+class Error : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ MessageSet = 1 << 0,
+ CodeSet = 1 << 1,
+ AllFieldsSet = (MessageSet | CodeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*Error*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class Error;
+ public:
+
+ Builder<STATE | MessageSet>& setMessage(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
+ m_result->setString(ASCIILiteral("message"), value);
+ return castState<MessageSet>();
+ }
+
+ Builder<STATE | CodeSet>& setCode(int value)
+ {
+ COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
+ m_result->setInteger(ASCIILiteral("code"), value);
+ return castState<CodeSet>();
+ }
+
+ Ref<Error> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<Error>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<Error> result = Error::create()
+ * .setMessage(...)
+ * .setCode(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Database
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ RWIProtocolDatabaseDomainEventDispatcher *_databaseEventDispatcher;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_databaseEventDispatcher release];
+ [super dealloc];
+}
+
+- (RWIProtocolDatabaseDomainEventDispatcher *)databaseEventDispatcher
+{
+ if (!_databaseEventDispatcher)
+ _databaseEventDispatcher = [[RWIProtocolDatabaseDomainEventDispatcher alloc] initWithController:_controller];
+ return _databaseEventDispatcher;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, readonly) RWIProtocolDatabaseDomainEventDispatcher *databaseEventDispatcher;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolDatabaseDomainEventDispatcher
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)didExecuteOptionalParametersWithColumnNames:(NSArray/*<NSString>*/ **)columnNames notes:(NSString **)notes timestamp:(double *)timestamp values:(RWIProtocolJSONObject **)values payload:(RWIProtocolJSONObject **)payload sqlError:(RWIProtocolDatabaseError **)sqlError screenColor:(NSString **)screenColor alternateColors:(NSArray/*<NSString>*/ **)alternateColors printColor:(NSString **)printColor
+{
+ const FrontendRouter& router = _controller->frontendRouter();
+
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(screenColor, @"screenColor");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(alternateColors, @"alternateColors");
+ THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(printColor, @"printColor");
+
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteOptionalParameters"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ if (columnNames)
+ paramsObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray((*columnNames)));
+ if (notes)
+ paramsObject->setString(ASCIILiteral("notes"), (*notes));
+ if (timestamp)
+ paramsObject->setDouble(ASCIILiteral("timestamp"), (*timestamp));
+ if (values)
+ paramsObject->setObject(ASCIILiteral("values"), [(*values) toInspectorObject]);
+ if (payload)
+ paramsObject->setValue(ASCIILiteral("payload"), [(*payload) toInspectorObject]);
+ if (sqlError)
+ paramsObject->setObject(ASCIILiteral("sqlError"), [(*sqlError) toInspectorObject]);
+ if (screenColor)
+ paramsObject->setString(ASCIILiteral("screenColor"), (*screenColor));
+ if (alternateColors)
+ paramsObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray((*alternateColors)));
+ if (printColor)
+ paramsObject->setString(ASCIILiteral("printColor"), (*printColor));
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+ router.sendEvent(jsonMessage->toJSONString());
+}
+
+- (void)didExecuteNoOptionalParametersWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload sqlError:(RWIProtocolDatabaseError *)sqlError screenColor:(NSString *)screenColor alternateColors:(NSArray/*<NSString>*/ *)alternateColors printColor:(NSString *)printColor
+{
+ const FrontendRouter& router = _controller->frontendRouter();
+
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(sqlError, @"sqlError");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(screenColor, @"screenColor");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(alternateColors, @"alternateColors");
+ THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(printColor, @"printColor");
+
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteNoOptionalParameters"));
+ Ref<InspectorObject> paramsObject = InspectorObject::create();
+ paramsObject->setArray(ASCIILiteral("columnNames"), inspectorStringArray(columnNames));
+ paramsObject->setString(ASCIILiteral("notes"), notes);
+ paramsObject->setDouble(ASCIILiteral("timestamp"), timestamp);
+ paramsObject->setObject(ASCIILiteral("values"), [values toInspectorObject]);
+ paramsObject->setValue(ASCIILiteral("payload"), [payload toInspectorObject]);
+ paramsObject->setObject(ASCIILiteral("sqlError"), [sqlError toInspectorObject]);
+ paramsObject->setString(ASCIILiteral("screenColor"), screenColor);
+ paramsObject->setArray(ASCIILiteral("alternateColors"), inspectorStringArray(alternateColors));
+ paramsObject->setString(ASCIILiteral("printColor"), printColor);
+ jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
+ router.sendEvent(jsonMessage->toJSONString());
+}
+
+@end
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolDatabaseError;
+
+
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseError : RWIProtocolJSONObject
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+/* required */ @property (nonatomic, copy) NSString *message;
+/* required */ @property (nonatomic, assign) int code;
+@end
+
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseDomainEventDispatcher : NSObject
+- (void)didExecuteOptionalParametersWithColumnNames:(NSArray/*<NSString>*/ **)columnNames notes:(NSString **)notes timestamp:(double *)timestamp values:(RWIProtocolJSONObject **)values payload:(RWIProtocolJSONObject **)payload sqlError:(RWIProtocolDatabaseError **)sqlError screenColor:(NSString **)screenColor alternateColors:(NSArray/*<NSString>*/ **)alternateColors printColor:(NSString **)printColor;
+- (void)didExecuteNoOptionalParametersWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload sqlError:(RWIProtocolDatabaseError *)sqlError screenColor:(NSString *)screenColor alternateColors:(NSArray/*<NSString>*/ *)alternateColors printColor:(NSString *)printColor;
+@end
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolDatabaseError
+
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message");
+
+ self.message = message;
+ self.code = code;
+
+ return self;
+}
+
+- (void)setMessage:(NSString *)message
+{
+ [super setString:message forKey:@"message"];
+}
+
+- (NSString *)message
+{
+ return [super stringForKey:@"message"];
+}
+
+- (void)setCode:(int)code
+{
+ [super setInteger:code forKey:@"code"];
+}
+
+- (int)code
+{
+ return [super integerForKey:@"code"];
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from events-with-optional-parameters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+@interface RWIProtocolDatabaseDomainEventDispatcher (Private)
+- (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller;
+@end
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-availability.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-availability.json-error
new file mode 100644
index 000000000..90d7195d6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-availability.json-error
@@ -0,0 +1 @@
+ERROR: Malformed domain specification: availability is an unsupported string. Was: "webb", Allowed values: web
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error
new file mode 100644
index 000000000..3f756de32
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error
@@ -0,0 +1 @@
+ERROR: Malformed domain specification: call parameter list for command processPoints has duplicate parameter names
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error
new file mode 100644
index 000000000..ea148ff67
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error
@@ -0,0 +1 @@
+ERROR: Malformed domain specification: return parameter list for command processPoints has duplicate parameter names
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error
new file mode 100644
index 000000000..c71bbd21c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error
@@ -0,0 +1 @@
+ERROR: Malformed domain specification: parameter list for event processedPoints has duplicate parameter names
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error
new file mode 100644
index 000000000..447cdf8e2
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error
@@ -0,0 +1 @@
+ERROR: Duplicate type declaration: Runtime.RemoteObjectId
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error
new file mode 100644
index 000000000..d5376a77a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error
@@ -0,0 +1 @@
+ERROR: Malformed domain specification: type declaration for Point has duplicate member names
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error
new file mode 100644
index 000000000..2655c2b90
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error
@@ -0,0 +1 @@
+ERROR: Type reference with enum values must have at least one enum value.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error
new file mode 100644
index 000000000..97b2af0e4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-parameter-flag.json-error
@@ -0,0 +1 @@
+ERROR: The 'optional' flag for a parameter must be a boolean literal.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error
new file mode 100644
index 000000000..86df3750c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-number-typed-optional-type-member.json-error
@@ -0,0 +1 @@
+ERROR: The 'optional' flag for a type member must be a boolean literal.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error
new file mode 100644
index 000000000..97b2af0e4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error
@@ -0,0 +1 @@
+ERROR: The 'optional' flag for a parameter must be a boolean literal.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error
new file mode 100644
index 000000000..86df3750c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error
@@ -0,0 +1 @@
+ERROR: The 'optional' flag for a type member must be a boolean literal.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error
new file mode 100644
index 000000000..42f5753a4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error
@@ -0,0 +1 @@
+ERROR: Type reference cannot have both 'type' and '$ref' keys.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error
new file mode 100644
index 000000000..4e462250c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error
@@ -0,0 +1 @@
+ERROR: Types must begin with an uppercase character.
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error
new file mode 100644
index 000000000..d3c782d89
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error
@@ -0,0 +1 @@
+ERROR: Lookup failed for type reference: dragon (referenced from domain: Runtime)
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error
new file mode 100644
index 000000000..faf6672cb
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error
@@ -0,0 +1 @@
+ERROR: Lookup failed for type reference: Color (referenced from domain: Fantasy)
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result
new file mode 100644
index 000000000..89e3224a5
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result
@@ -0,0 +1,1164 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+#if PLATFORM(WEB_COMMANDS)
+class AlternateNetwork1BackendDispatcher : public AlternateBackendDispatcher {
+public:
+ virtual ~AlternateNetwork1BackendDispatcher() { }
+ virtual void loadResource(long callId) = 0;
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Network1.
+InspectorBackend.registerCommand("Network1.loadResource", [], []);
+InspectorBackend.activateDomain("Network1");
+
+// Network3.
+InspectorBackend.registerNetwork3Dispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Network3");
+InspectorBackend.registerEvent("Network3.resourceLoaded", []);
+InspectorBackend.activateDomain("Network3");
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#if PLATFORM(WEB_COMMANDS)
+class AlternateNetwork1BackendDispatcher;
+#endif // PLATFORM(WEB_COMMANDS)
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#if PLATFORM(WEB_COMMANDS)
+class Network1BackendDispatcherHandler {
+public:
+ virtual void loadResource(ErrorString&) = 0;
+protected:
+ virtual ~Network1BackendDispatcherHandler();
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+#if PLATFORM(WEB_COMMANDS)
+class Network1BackendDispatcher final : public SupplementalBackendDispatcher {
+public:
+ static Ref<Network1BackendDispatcher> create(BackendDispatcher&, Network1BackendDispatcherHandler*);
+ virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) override;
+private:
+ void loadResource(long requestId, RefPtr<InspectorObject>&& parameters);
+private:
+ Network1BackendDispatcher(BackendDispatcher&, Network1BackendDispatcherHandler*);
+ Network1BackendDispatcherHandler* m_agent;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+public:
+ void setAlternateDispatcher(AlternateNetwork1BackendDispatcher* alternateDispatcher) { m_alternateDispatcher = alternateDispatcher; }
+private:
+ AlternateNetwork1BackendDispatcher* m_alternateDispatcher;
+#endif
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+#if PLATFORM(WEB_COMMANDS)
+Network1BackendDispatcherHandler::~Network1BackendDispatcherHandler() { }
+#endif // PLATFORM(WEB_COMMANDS)
+
+#if PLATFORM(WEB_COMMANDS)
+Ref<Network1BackendDispatcher> Network1BackendDispatcher::create(BackendDispatcher& backendDispatcher, Network1BackendDispatcherHandler* agent)
+{
+ return adoptRef(*new Network1BackendDispatcher(backendDispatcher, agent));
+}
+
+Network1BackendDispatcher::Network1BackendDispatcher(BackendDispatcher& backendDispatcher, Network1BackendDispatcherHandler* agent)
+ : SupplementalBackendDispatcher(backendDispatcher)
+ , m_agent(agent)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ , m_alternateDispatcher(nullptr)
+#endif
+{
+ m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network1"), this);
+}
+
+void Network1BackendDispatcher::dispatch(long requestId, const String& method, Ref<InspectorObject>&& message)
+{
+ Ref<Network1BackendDispatcher> protect(*this);
+
+ RefPtr<InspectorObject> parameters;
+ message->getObject(ASCIILiteral("params"), parameters);
+
+ if (method == "loadResource")
+ loadResource(requestId, WTFMove(parameters));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
+}
+
+void Network1BackendDispatcher::loadResource(long requestId, RefPtr<InspectorObject>&&)
+{
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+ if (m_alternateDispatcher) {
+ m_alternateDispatcher->loadResource(requestId);
+ return;
+ }
+#endif
+
+ ErrorString error;
+ Ref<InspectorObject> result = InspectorObject::create();
+ m_agent->loadResource(error);
+
+ if (!error.length())
+ m_backendDispatcher->sendResponse(requestId, WTFMove(result));
+ else
+ m_backendDispatcher->reportProtocolError(BackendDispatcher::ServerError, WTFMove(error));
+}
+#endif // PLATFORM(WEB_COMMANDS)
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+#if PLATFORM(WEB_EVENTS)
+class Network3FrontendDispatcher {
+public:
+ Network3FrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
+ void resourceLoaded();
+private:
+ FrontendRouter& m_frontendRouter;
+};
+#endif // PLATFORM(WEB_EVENTS)
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+#if PLATFORM(WEB_EVENTS)
+void Network3FrontendDispatcher::resourceLoaded()
+{
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded"));
+
+ m_frontendRouter.sendEvent(jsonMessage->toJSONString());
+}
+#endif // PLATFORM(WEB_EVENTS)
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+#if PLATFORM(WEB_TYPES)
+namespace Network2 {
+class NetworkError;
+} // Network2
+#endif // PLATFORM(WEB_TYPES)
+// End of forward declarations.
+
+
+
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+#if PLATFORM(WEB_TYPES)
+namespace Network2 {
+class NetworkError : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ MessageSet = 1 << 0,
+ CodeSet = 1 << 1,
+ AllFieldsSet = (MessageSet | CodeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*NetworkError*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class NetworkError;
+ public:
+
+ Builder<STATE | MessageSet>& setMessage(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
+ m_result->setString(ASCIILiteral("message"), value);
+ return castState<MessageSet>();
+ }
+
+ Builder<STATE | CodeSet>& setCode(int value)
+ {
+ COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
+ m_result->setInteger(ASCIILiteral("code"), value);
+ return castState<CodeSet>();
+ }
+
+ Ref<NetworkError> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(NetworkError) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<NetworkError>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<NetworkError> result = NetworkError::create()
+ * .setMessage(...)
+ * .setCode(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Network2
+#endif // PLATFORM(WEB_TYPES)
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+@protocol RWIProtocolNetwork1DomainHandler;
+
+namespace Inspector {
+
+
+#if PLATFORM(WEB_COMMANDS)
+class ObjCInspectorNetwork1BackendDispatcher final : public AlternateNetwork1BackendDispatcher {
+public:
+ ObjCInspectorNetwork1BackendDispatcher(id<RWIProtocolNetwork1DomainHandler> handler) { m_delegate = handler; }
+ virtual void loadResource(long requestId) override;
+private:
+ RetainPtr<id<RWIProtocolNetwork1DomainHandler>> m_delegate;
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+ id<RWIProtocolNetwork1DomainHandler> _network1Handler;
+ RWIProtocolNetwork3DomainEventDispatcher *_network3EventDispatcher;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [_network1Handler release];
+ [_network3EventDispatcher release];
+ [super dealloc];
+}
+
+- (void)setNetwork1Handler:(id<RWIProtocolNetwork1DomainHandler>)handler
+{
+ if (handler == _network1Handler)
+ return;
+
+ [_network1Handler release];
+ _network1Handler = [handler retain];
+
+ auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
+ auto alternateAgent = std::make_unique<AlternateDispatchableAgent<Network1BackendDispatcher, AlternateNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), *_controller, WTFMove(alternateDispatcher));
+ _controller->appendExtraAgent(WTFMove(alternateAgent));
+}
+
+- (id<RWIProtocolNetwork1DomainHandler>)network1Handler
+{
+ return _network1Handler;
+}
+
+- (RWIProtocolNetwork3DomainEventDispatcher *)network3EventDispatcher
+{
+ if (!_network3EventDispatcher)
+ _network3EventDispatcher = [[RWIProtocolNetwork3DomainEventDispatcher alloc] initWithController:_controller];
+ return _network3EventDispatcher;
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@property (nonatomic, retain, setter=setNetwork1Handler:) id<RWIProtocolNetwork1DomainHandler> network1Handler;
+@property (nonatomic, readonly) RWIProtocolNetwork3DomainEventDispatcher *network3EventDispatcher;
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+#if PLATFORM(WEB_COMMANDS)
+void ObjCInspectorNetwork1BackendDispatcher::loadResource(long requestId)
+{
+ id errorCallback = ^(NSString *error) {
+ backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
+ backendDispatcher()->sendPendingErrors();
+ };
+
+ id successCallback = ^{
+ backendDispatcher()->sendResponse(requestId, InspectorObject::create());
+ };
+
+ [m_delegate loadResourceWithErrorCallback:errorCallback successCallback:successCallback];
+}
+
+#endif // PLATFORM(WEB_COMMANDS)
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+@implementation RWIProtocolNetwork3DomainEventDispatcher
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)resourceLoaded
+{
+ const FrontendRouter& router = _controller->frontendRouter();
+
+ Ref<InspectorObject> jsonMessage = InspectorObject::create();
+ jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded"));
+ router.sendEvent(jsonMessage->toJSONString());
+}
+
+@end
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolNetwork2NetworkError;
+
+
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolNetwork2NetworkError : RWIProtocolJSONObject
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+/* required */ @property (nonatomic, copy) NSString *message;
+/* required */ @property (nonatomic, assign) int code;
+@end
+
+@protocol RWIProtocolNetwork1DomainHandler <NSObject>
+@required
+- (void)loadResourceWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolNetwork3DomainEventDispatcher : NSObject
+- (void)resourceLoaded;
+@end
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+@implementation RWIProtocolNetwork2NetworkError
+
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message");
+
+ self.message = message;
+ self.code = code;
+
+ return self;
+}
+
+- (void)setMessage:(NSString *)message
+{
+ [super setString:message forKey:@"message"];
+}
+
+- (NSString *)message
+{
+ return [super stringForKey:@"message"];
+}
+
+- (void)setCode:(int)code
+{
+ [super setInteger:code forKey:@"code"];
+}
+
+- (int)code
+{
+ return [super integerForKey:@"code"];
+}
+
+@end
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from generate-domains-with-feature-guards.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+@interface RWIProtocolNetwork3DomainEventDispatcher (Private)
+- (instancetype)initWithController:(Inspector::AugmentableInspectorController*)controller;
+@end
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result
new file mode 100644
index 000000000..5bcffac7d
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result
@@ -0,0 +1,841 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+
+
+// Typedefs.
+namespace Runtime {
+/* Unique object identifier. */
+typedef String RemoteObjectId;
+} // Runtime
+
+namespace Runtime2 {
+/* Unique object identifier. */
+typedef String RemoteObjectId;
+} // Runtime2
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+
+
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from same-type-id-different-domain.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result
new file mode 100644
index 000000000..e76189100
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result
@@ -0,0 +1,984 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Runtime {
+class KeyPath;
+} // Runtime
+// End of forward declarations.
+
+
+
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Runtime {
+/* Key path. */
+class KeyPath : public Inspector::InspectorObjectBase {
+public:
+ // Named after property name 'type' while generating KeyPath.
+ enum class Type {
+ Null = 0,
+ String = 1,
+ Array = 2,
+ }; // enum class Type
+ enum {
+ NoFieldsSet = 0,
+ TypeSet = 1 << 0,
+ AllFieldsSet = (TypeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*KeyPath*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class KeyPath;
+ public:
+
+ Builder<STATE | TypeSet>& setType(Type value)
+ {
+ COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
+ m_result->setString(ASCIILiteral("type"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
+ return castState<TypeSet>();
+ }
+
+ Ref<KeyPath> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(KeyPath) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<KeyPath>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<KeyPath> result = KeyPath::create()
+ * .setType(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+
+ void setString(const String& value)
+ {
+ InspectorObjectBase::setString(ASCIILiteral("string"), value);
+ }
+
+ void setArray(RefPtr<Inspector::Protocol::Array<String>> value)
+ {
+ InspectorObjectBase::setArray(ASCIILiteral("array"), WTFMove(value));
+ }
+};
+
+} // Runtime
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "null",
+ "string",
+ "array",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolRuntimeKeyPathType value)
+{
+ switch(value) {
+ case RWIProtocolRuntimeKeyPathTypeNull:
+ return ASCIILiteral("null");
+ case RWIProtocolRuntimeKeyPathTypeString:
+ return ASCIILiteral("string");
+ case RWIProtocolRuntimeKeyPathTypeArray:
+ return ASCIILiteral("array");
+ }
+}
+
+template<>
+inline RWIProtocolRuntimeKeyPathType fromProtocolString(const String& value)
+{
+ if (value == "null")
+ return RWIProtocolRuntimeKeyPathTypeNull;
+ if (value == "string")
+ return RWIProtocolRuntimeKeyPathTypeString;
+ if (value == "array")
+ return RWIProtocolRuntimeKeyPathTypeArray;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolRuntimeKeyPathTypeNull;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolRuntimeKeyPath;
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolRuntimeKeyPathType) {
+ RWIProtocolRuntimeKeyPathTypeNull,
+ RWIProtocolRuntimeKeyPathTypeString,
+ RWIProtocolRuntimeKeyPathTypeArray,
+};
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolRuntimeKeyPath : RWIProtocolJSONObject
+- (instancetype)initWithType:(RWIProtocolRuntimeKeyPathType)type;
+/* required */ @property (nonatomic, assign) RWIProtocolRuntimeKeyPathType type;
+/* optional */ @property (nonatomic, copy) NSString *string;
+/* optional */ @property (nonatomic, copy) NSArray/*<NSString>*/ *array;
+@end
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolRuntimeKeyPath
+
+- (instancetype)initWithType:(RWIProtocolRuntimeKeyPathType)type;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ self.type = type;
+
+ return self;
+}
+
+- (void)setType:(RWIProtocolRuntimeKeyPathType)type
+{
+ [super setString:toProtocolString(type) forKey:@"type"];
+}
+
+- (RWIProtocolRuntimeKeyPathType)type
+{
+ return fromProtocolString<RWIProtocolRuntimeKeyPathType>([super stringForKey:@"type"]);
+}
+
+- (void)setString:(NSString *)string
+{
+ [super setString:string forKey:@"string"];
+}
+
+- (NSString *)string
+{
+ return [super stringForKey:@"string"];
+}
+
+- (void)setArray:(NSArray/*<NSString>*/ *)array
+{
+ [super setInspectorArray:inspectorStringArray(array) forKey:@"array"];
+}
+
+- (NSArray/*<NSString>*/ *)array
+{
+ return objcStringArray([super inspectorArrayForKey:@"array"]);
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from shadowed-optional-type-setters.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result
new file mode 100644
index 000000000..a97d8219e
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result
@@ -0,0 +1,826 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+
+
+// Typedefs.
+namespace Runtime {
+/* Unique object identifier. */
+typedef int RemoteObjectId;
+} // Runtime
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+
+
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-aliased-primitive-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result
new file mode 100644
index 000000000..c23bb5bf6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result
@@ -0,0 +1,893 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Debugger.
+InspectorBackend.registerEnum("Debugger.Reason", {Died: "Died", Fainted: "Fainted", Hungry: "Hungry"});
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Debugger {
+enum class Reason;
+} // Debugger
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Debugger {
+typedef int BreakpointId;
+} // Debugger
+
+namespace Runtime {
+typedef int ObjectId;
+typedef Inspector::Protocol::Array<int> LuckyNumbers;
+typedef Inspector::Protocol::Array<String> BabyNames;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Runtime::ObjectId> NewObjects;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Debugger::BreakpointId> OldObjects;
+typedef Inspector::Protocol::Array<Inspector::Protocol::Debugger::Reason> StopReasons;
+} // Runtime
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Debugger {
+/* */
+enum class Reason {
+ Died = 0,
+ Fainted = 1,
+ Hungry = 2,
+}; // enum class Reason
+} // Debugger
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "Died",
+ "Fainted",
+ "Hungry",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolDebuggerReason value)
+{
+ switch(value) {
+ case RWIProtocolDebuggerReasonDied:
+ return ASCIILiteral("Died");
+ case RWIProtocolDebuggerReasonFainted:
+ return ASCIILiteral("Fainted");
+ case RWIProtocolDebuggerReasonHungry:
+ return ASCIILiteral("Hungry");
+ }
+}
+
+template<>
+inline RWIProtocolDebuggerReason fromProtocolString(const String& value)
+{
+ if (value == "Died")
+ return RWIProtocolDebuggerReasonDied;
+ if (value == "Fainted")
+ return RWIProtocolDebuggerReasonFainted;
+ if (value == "Hungry")
+ return RWIProtocolDebuggerReasonHungry;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolDebuggerReasonDied;
+}
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolDebuggerReason) {
+ RWIProtocolDebuggerReasonDied,
+ RWIProtocolDebuggerReasonFainted,
+ RWIProtocolDebuggerReasonHungry,
+};
+
+
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-array-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result
new file mode 100644
index 000000000..3d828d8d6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result
@@ -0,0 +1,925 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Runtime.
+InspectorBackend.registerEnum("Runtime.FarmAnimals", {Pigs: "Pigs", Cows: "Cows", Cats: "Cats", Hens: "Hens"});
+InspectorBackend.registerEnum("Runtime.TwoLeggedAnimals", {Ducks: "Ducks", Hens: "Hens", Crows: "Crows", Flamingos: "Flamingos"});
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Runtime {
+enum class FarmAnimals;
+enum class TwoLeggedAnimals;
+} // Runtime
+// End of forward declarations.
+
+
+
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Runtime {
+/* */
+enum class FarmAnimals {
+ Pigs = 0,
+ Cows = 1,
+ Cats = 2,
+ Hens = 3,
+}; // enum class FarmAnimals
+/* */
+enum class TwoLeggedAnimals {
+ Ducks = 4,
+ Hens = 3,
+ Crows = 5,
+ Flamingos = 6,
+}; // enum class TwoLeggedAnimals
+} // Runtime
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "Pigs",
+ "Cows",
+ "Cats",
+ "Hens",
+ "Ducks",
+ "Crows",
+ "Flamingos",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolRuntimeFarmAnimals value)
+{
+ switch(value) {
+ case RWIProtocolRuntimeFarmAnimalsPigs:
+ return ASCIILiteral("Pigs");
+ case RWIProtocolRuntimeFarmAnimalsCows:
+ return ASCIILiteral("Cows");
+ case RWIProtocolRuntimeFarmAnimalsCats:
+ return ASCIILiteral("Cats");
+ case RWIProtocolRuntimeFarmAnimalsHens:
+ return ASCIILiteral("Hens");
+ }
+}
+
+template<>
+inline RWIProtocolRuntimeFarmAnimals fromProtocolString(const String& value)
+{
+ if (value == "Pigs")
+ return RWIProtocolRuntimeFarmAnimalsPigs;
+ if (value == "Cows")
+ return RWIProtocolRuntimeFarmAnimalsCows;
+ if (value == "Cats")
+ return RWIProtocolRuntimeFarmAnimalsCats;
+ if (value == "Hens")
+ return RWIProtocolRuntimeFarmAnimalsHens;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolRuntimeFarmAnimalsPigs;
+}
+
+inline String toProtocolString(RWIProtocolRuntimeTwoLeggedAnimals value)
+{
+ switch(value) {
+ case RWIProtocolRuntimeTwoLeggedAnimalsDucks:
+ return ASCIILiteral("Ducks");
+ case RWIProtocolRuntimeTwoLeggedAnimalsHens:
+ return ASCIILiteral("Hens");
+ case RWIProtocolRuntimeTwoLeggedAnimalsCrows:
+ return ASCIILiteral("Crows");
+ case RWIProtocolRuntimeTwoLeggedAnimalsFlamingos:
+ return ASCIILiteral("Flamingos");
+ }
+}
+
+template<>
+inline RWIProtocolRuntimeTwoLeggedAnimals fromProtocolString(const String& value)
+{
+ if (value == "Ducks")
+ return RWIProtocolRuntimeTwoLeggedAnimalsDucks;
+ if (value == "Hens")
+ return RWIProtocolRuntimeTwoLeggedAnimalsHens;
+ if (value == "Crows")
+ return RWIProtocolRuntimeTwoLeggedAnimalsCrows;
+ if (value == "Flamingos")
+ return RWIProtocolRuntimeTwoLeggedAnimalsFlamingos;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolRuntimeTwoLeggedAnimalsDucks;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolRuntimeFarmAnimals) {
+ RWIProtocolRuntimeFarmAnimalsPigs,
+ RWIProtocolRuntimeFarmAnimalsCows,
+ RWIProtocolRuntimeFarmAnimalsCats,
+ RWIProtocolRuntimeFarmAnimalsHens,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolRuntimeTwoLeggedAnimals) {
+ RWIProtocolRuntimeTwoLeggedAnimalsDucks,
+ RWIProtocolRuntimeTwoLeggedAnimalsHens,
+ RWIProtocolRuntimeTwoLeggedAnimalsCrows,
+ RWIProtocolRuntimeTwoLeggedAnimalsFlamingos,
+};
+
+
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-enum-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result
new file mode 100644
index 000000000..86051c6b4
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result
@@ -0,0 +1,1736 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Database {
+class DummyObject;
+class Error;
+class ObjectWithPropertyNameConflicts;
+class OptionalParameterBundle;
+class ParameterBundle;
+} // Database
+
+namespace Test {
+class ParameterBundle;
+} // Test
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Database {
+typedef Inspector::Protocol::Array<Inspector::Protocol::Database::Error> ErrorList;
+} // Database
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Database {
+/* Database error. */
+class Error : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ MessageSet = 1 << 0,
+ CodeSet = 1 << 1,
+ AllFieldsSet = (MessageSet | CodeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*Error*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class Error;
+ public:
+
+ Builder<STATE | MessageSet>& setMessage(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & MessageSet), property_message_already_set);
+ m_result->setString(ASCIILiteral("message"), value);
+ return castState<MessageSet>();
+ }
+
+ Builder<STATE | CodeSet>& setCode(int value)
+ {
+ COMPILE_ASSERT(!(STATE & CodeSet), property_code_already_set);
+ m_result->setInteger(ASCIILiteral("code"), value);
+ return castState<CodeSet>();
+ }
+
+ Ref<Error> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(Error) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<Error>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<Error> result = Error::create()
+ * .setMessage(...)
+ * .setCode(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+class OptionalParameterBundle : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ AllFieldsSet = 0
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*OptionalParameterBundle*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class OptionalParameterBundle;
+ public:
+
+ Ref<OptionalParameterBundle> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(OptionalParameterBundle) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<OptionalParameterBundle>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<OptionalParameterBundle> result = OptionalParameterBundle::create()
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+
+ void setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
+ {
+ InspectorObjectBase::setArray(ASCIILiteral("columnNames"), WTFMove(value));
+ }
+
+ void setNotes(const String& value)
+ {
+ InspectorObjectBase::setString(ASCIILiteral("notes"), value);
+ }
+
+ void setTimestamp(double value)
+ {
+ InspectorObjectBase::setDouble(ASCIILiteral("timestamp"), value);
+ }
+
+ void setValues(RefPtr<Inspector::InspectorObject> value)
+ {
+ InspectorObjectBase::setObject(ASCIILiteral("values"), WTFMove(value));
+ }
+
+ void setPayload(RefPtr<Inspector::InspectorValue> value)
+ {
+ InspectorObjectBase::setValue(ASCIILiteral("payload"), WTFMove(value));
+ }
+
+ void setError(RefPtr<Inspector::Protocol::Database::Error> value)
+ {
+ InspectorObjectBase::setObject(ASCIILiteral("error"), WTFMove(value));
+ }
+
+ void setErrorList(RefPtr<Inspector::Protocol::Database::ErrorList> value)
+ {
+ InspectorObjectBase::setArray(ASCIILiteral("errorList"), WTFMove(value));
+ }
+};
+
+class ParameterBundle : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ ColumnNamesSet = 1 << 0,
+ NotesSet = 1 << 1,
+ TimestampSet = 1 << 2,
+ ValuesSet = 1 << 3,
+ PayloadSet = 1 << 4,
+ ErrorSet = 1 << 5,
+ ErrorListSet = 1 << 6,
+ AllFieldsSet = (ColumnNamesSet | NotesSet | TimestampSet | ValuesSet | PayloadSet | ErrorSet | ErrorListSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*ParameterBundle*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class ParameterBundle;
+ public:
+
+ Builder<STATE | ColumnNamesSet>& setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
+ {
+ COMPILE_ASSERT(!(STATE & ColumnNamesSet), property_columnNames_already_set);
+ m_result->setArray(ASCIILiteral("columnNames"), value);
+ return castState<ColumnNamesSet>();
+ }
+
+ Builder<STATE | NotesSet>& setNotes(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & NotesSet), property_notes_already_set);
+ m_result->setString(ASCIILiteral("notes"), value);
+ return castState<NotesSet>();
+ }
+
+ Builder<STATE | TimestampSet>& setTimestamp(double value)
+ {
+ COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
+ m_result->setDouble(ASCIILiteral("timestamp"), value);
+ return castState<TimestampSet>();
+ }
+
+ Builder<STATE | ValuesSet>& setValues(RefPtr<Inspector::InspectorObject> value)
+ {
+ COMPILE_ASSERT(!(STATE & ValuesSet), property_values_already_set);
+ m_result->setObject(ASCIILiteral("values"), value);
+ return castState<ValuesSet>();
+ }
+
+ Builder<STATE | PayloadSet>& setPayload(RefPtr<Inspector::InspectorValue> value)
+ {
+ COMPILE_ASSERT(!(STATE & PayloadSet), property_payload_already_set);
+ m_result->setValue(ASCIILiteral("payload"), value);
+ return castState<PayloadSet>();
+ }
+
+ Builder<STATE | ErrorSet>& setError(RefPtr<Inspector::Protocol::Database::Error> value)
+ {
+ COMPILE_ASSERT(!(STATE & ErrorSet), property_error_already_set);
+ m_result->setObject(ASCIILiteral("error"), value);
+ return castState<ErrorSet>();
+ }
+
+ Builder<STATE | ErrorListSet>& setErrorList(RefPtr<Inspector::Protocol::Database::ErrorList> value)
+ {
+ COMPILE_ASSERT(!(STATE & ErrorListSet), property_errorList_already_set);
+ m_result->setArray(ASCIILiteral("errorList"), value);
+ return castState<ErrorListSet>();
+ }
+
+ Ref<ParameterBundle> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(ParameterBundle) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<ParameterBundle>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<ParameterBundle> result = ParameterBundle::create()
+ * .setColumnNames(...)
+ * .setNotes(...)
+ * .setTimestamp(...)
+ * .setValues(...)
+ * .setPayload(...)
+ * .setError(...)
+ * .setErrorList(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+/* Conflicted names may cause generated getters/setters to clash with built-in InspectorObject methods. */
+class ObjectWithPropertyNameConflicts : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ IntegerSet = 1 << 0,
+ ArraySet = 1 << 1,
+ StringSet = 1 << 2,
+ ValueSet = 1 << 3,
+ ObjectSet = 1 << 4,
+ AllFieldsSet = (IntegerSet | ArraySet | StringSet | ValueSet | ObjectSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*ObjectWithPropertyNameConflicts*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class ObjectWithPropertyNameConflicts;
+ public:
+
+ Builder<STATE | IntegerSet>& setInteger(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & IntegerSet), property_integer_already_set);
+ m_result->setString(ASCIILiteral("integer"), value);
+ return castState<IntegerSet>();
+ }
+
+ Builder<STATE | ArraySet>& setArray(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & ArraySet), property_array_already_set);
+ m_result->setString(ASCIILiteral("array"), value);
+ return castState<ArraySet>();
+ }
+
+ Builder<STATE | StringSet>& setString(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & StringSet), property_string_already_set);
+ m_result->setString(ASCIILiteral("string"), value);
+ return castState<StringSet>();
+ }
+
+ Builder<STATE | ValueSet>& setValue(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & ValueSet), property_value_already_set);
+ m_result->setString(ASCIILiteral("value"), value);
+ return castState<ValueSet>();
+ }
+
+ Builder<STATE | ObjectSet>& setObject(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & ObjectSet), property_object_already_set);
+ m_result->setString(ASCIILiteral("object"), value);
+ return castState<ObjectSet>();
+ }
+
+ Ref<ObjectWithPropertyNameConflicts> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(ObjectWithPropertyNameConflicts) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<ObjectWithPropertyNameConflicts>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<ObjectWithPropertyNameConflicts> result = ObjectWithPropertyNameConflicts::create()
+ * .setInteger(...)
+ * .setArray(...)
+ * .setString(...)
+ * .setValue(...)
+ * .setObject(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Database
+
+namespace Test {
+class ParameterBundle : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ ColumnNamesSet = 1 << 0,
+ NotesSet = 1 << 1,
+ TimestampSet = 1 << 2,
+ ValuesSet = 1 << 3,
+ PayloadSet = 1 << 4,
+ ErrorSet = 1 << 5,
+ AllFieldsSet = (ColumnNamesSet | NotesSet | TimestampSet | ValuesSet | PayloadSet | ErrorSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*ParameterBundle*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class ParameterBundle;
+ public:
+
+ Builder<STATE | ColumnNamesSet>& setColumnNames(RefPtr<Inspector::Protocol::Array<String>> value)
+ {
+ COMPILE_ASSERT(!(STATE & ColumnNamesSet), property_columnNames_already_set);
+ m_result->setArray(ASCIILiteral("columnNames"), value);
+ return castState<ColumnNamesSet>();
+ }
+
+ Builder<STATE | NotesSet>& setNotes(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & NotesSet), property_notes_already_set);
+ m_result->setString(ASCIILiteral("notes"), value);
+ return castState<NotesSet>();
+ }
+
+ Builder<STATE | TimestampSet>& setTimestamp(double value)
+ {
+ COMPILE_ASSERT(!(STATE & TimestampSet), property_timestamp_already_set);
+ m_result->setDouble(ASCIILiteral("timestamp"), value);
+ return castState<TimestampSet>();
+ }
+
+ Builder<STATE | ValuesSet>& setValues(RefPtr<Inspector::InspectorObject> value)
+ {
+ COMPILE_ASSERT(!(STATE & ValuesSet), property_values_already_set);
+ m_result->setObject(ASCIILiteral("values"), value);
+ return castState<ValuesSet>();
+ }
+
+ Builder<STATE | PayloadSet>& setPayload(RefPtr<Inspector::InspectorValue> value)
+ {
+ COMPILE_ASSERT(!(STATE & PayloadSet), property_payload_already_set);
+ m_result->setValue(ASCIILiteral("payload"), value);
+ return castState<PayloadSet>();
+ }
+
+ Builder<STATE | ErrorSet>& setError(RefPtr<Inspector::Protocol::Database::Error> value)
+ {
+ COMPILE_ASSERT(!(STATE & ErrorSet), property_error_already_set);
+ m_result->setObject(ASCIILiteral("error"), value);
+ return castState<ErrorSet>();
+ }
+
+ Ref<ParameterBundle> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(ParameterBundle) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<ParameterBundle>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<ParameterBundle> result = ParameterBundle::create()
+ * .setColumnNames(...)
+ * .setNotes(...)
+ * .setTimestamp(...)
+ * .setValues(...)
+ * .setPayload(...)
+ * .setError(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+} // Test
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolDatabaseError;
+@class RWIProtocolDatabaseOptionalParameterBundle;
+@class RWIProtocolDatabaseParameterBundle;
+@class RWIProtocolDatabaseObjectWithPropertyNameConflicts;
+@class RWIProtocolDatabaseDummyObject;
+@class RWIProtocolTestParameterBundle;
+
+
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseError : RWIProtocolJSONObject
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+/* required */ @property (nonatomic, copy) NSString *message;
+/* required */ @property (nonatomic, assign) int code;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseOptionalParameterBundle : RWIProtocolJSONObject
+/* optional */ @property (nonatomic, copy) NSArray/*<NSString>*/ *columnNames;
+/* optional */ @property (nonatomic, copy) NSString *notes;
+/* optional */ @property (nonatomic, assign) double timestamp;
+/* optional */ @property (nonatomic, retain) RWIProtocolJSONObject *values;
+/* optional */ @property (nonatomic, retain) RWIProtocolJSONObject *payload;
+/* optional */ @property (nonatomic, retain) RWIProtocolDatabaseError *error;
+/* optional */ @property (nonatomic, copy) NSArray/*<RWIProtocolDatabaseError>*/ *errorList;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseParameterBundle : RWIProtocolJSONObject
+- (instancetype)initWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload error:(RWIProtocolDatabaseError *)error errorList:(NSArray/*<RWIProtocolDatabaseError>*/ *)errorList;
+/* required */ @property (nonatomic, copy) NSArray/*<NSString>*/ *columnNames;
+/* required */ @property (nonatomic, copy) NSString *notes;
+/* required */ @property (nonatomic, assign) double timestamp;
+/* required */ @property (nonatomic, retain) RWIProtocolJSONObject *values;
+/* required */ @property (nonatomic, retain) RWIProtocolJSONObject *payload;
+/* required */ @property (nonatomic, retain) RWIProtocolDatabaseError *error;
+/* required */ @property (nonatomic, copy) NSArray/*<RWIProtocolDatabaseError>*/ *errorList;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseObjectWithPropertyNameConflicts : RWIProtocolJSONObject
+- (instancetype)initWithInteger:(NSString *)integer array:(NSString *)array string:(NSString *)string value:(NSString *)value object:(NSString *)object;
+/* required */ @property (nonatomic, copy) NSString *integer;
+/* required */ @property (nonatomic, copy) NSString *array;
+/* required */ @property (nonatomic, copy) NSString *string;
+/* required */ @property (nonatomic, copy) NSString *value;
+/* required */ @property (nonatomic, copy) NSString *object;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolDatabaseDummyObject : RWIProtocolJSONObject
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolTestParameterBundle : RWIProtocolJSONObject
+- (instancetype)initWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload error:(RWIProtocolDatabaseError *)error;
+/* required */ @property (nonatomic, copy) NSArray/*<NSString>*/ *columnNames;
+/* required */ @property (nonatomic, copy) NSString *notes;
+/* required */ @property (nonatomic, assign) double timestamp;
+/* required */ @property (nonatomic, retain) RWIProtocolJSONObject *values;
+/* required */ @property (nonatomic, retain) RWIProtocolJSONObject *payload;
+/* required */ @property (nonatomic, retain) RWIProtocolDatabaseError *error;
+@end
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolDatabaseError
+
+- (instancetype)initWithMessage:(NSString *)message code:(int)code;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(message, @"message");
+
+ self.message = message;
+ self.code = code;
+
+ return self;
+}
+
+- (void)setMessage:(NSString *)message
+{
+ [super setString:message forKey:@"message"];
+}
+
+- (NSString *)message
+{
+ return [super stringForKey:@"message"];
+}
+
+- (void)setCode:(int)code
+{
+ [super setInteger:code forKey:@"code"];
+}
+
+- (int)code
+{
+ return [super integerForKey:@"code"];
+}
+
+@end
+
+@implementation RWIProtocolDatabaseOptionalParameterBundle
+
+- (void)setColumnNames:(NSArray/*<NSString>*/ *)columnNames
+{
+ [super setInspectorArray:inspectorStringArray(columnNames) forKey:@"columnNames"];
+}
+
+- (NSArray/*<NSString>*/ *)columnNames
+{
+ return objcStringArray([super inspectorArrayForKey:@"columnNames"]);
+}
+
+- (void)setNotes:(NSString *)notes
+{
+ [super setString:notes forKey:@"notes"];
+}
+
+- (NSString *)notes
+{
+ return [super stringForKey:@"notes"];
+}
+
+- (void)setTimestamp:(double)timestamp
+{
+ [super setDouble:timestamp forKey:@"timestamp"];
+}
+
+- (double)timestamp
+{
+ return [super doubleForKey:@"timestamp"];
+}
+
+- (void)setValues:(RWIProtocolJSONObject *)values
+{
+ [super setObject:values forKey:@"values"];
+}
+
+- (RWIProtocolJSONObject *)values
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"values"];
+}
+
+- (void)setPayload:(RWIProtocolJSONObject *)payload
+{
+ [super setObject:payload forKey:@"payload"];
+}
+
+- (RWIProtocolJSONObject *)payload
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"payload"];
+}
+
+- (void)setError:(RWIProtocolDatabaseError *)error
+{
+ [super setObject:error forKey:@"error"];
+}
+
+- (RWIProtocolDatabaseError *)error
+{
+ return (RWIProtocolDatabaseError *)[super objectForKey:@"error"];
+}
+
+- (void)setErrorList:(NSArray/*<RWIProtocolDatabaseError>*/ *)errorList
+{
+ THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(errorList, [RWIProtocolDatabaseError class]);
+ [super setInspectorArray:inspectorObjectArray(errorList) forKey:@"errorList"];
+}
+
+- (NSArray/*<RWIProtocolDatabaseError>*/ *)errorList
+{
+ return objcArray<RWIProtocolDatabaseError>([super inspectorArrayForKey:@"errorList"]);
+}
+
+@end
+
+@implementation RWIProtocolDatabaseParameterBundle
+
+- (instancetype)initWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload error:(RWIProtocolDatabaseError *)error errorList:(NSArray/*<RWIProtocolDatabaseError>*/ *)errorList;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(error, @"error");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(errorList, @"errorList");
+ THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(errorList, [RWIProtocolDatabaseError class]);
+
+ self.columnNames = columnNames;
+ self.notes = notes;
+ self.timestamp = timestamp;
+ self.values = values;
+ self.payload = payload;
+ self.error = error;
+ self.errorList = errorList;
+
+ return self;
+}
+
+- (void)setColumnNames:(NSArray/*<NSString>*/ *)columnNames
+{
+ [super setInspectorArray:inspectorStringArray(columnNames) forKey:@"columnNames"];
+}
+
+- (NSArray/*<NSString>*/ *)columnNames
+{
+ return objcStringArray([super inspectorArrayForKey:@"columnNames"]);
+}
+
+- (void)setNotes:(NSString *)notes
+{
+ [super setString:notes forKey:@"notes"];
+}
+
+- (NSString *)notes
+{
+ return [super stringForKey:@"notes"];
+}
+
+- (void)setTimestamp:(double)timestamp
+{
+ [super setDouble:timestamp forKey:@"timestamp"];
+}
+
+- (double)timestamp
+{
+ return [super doubleForKey:@"timestamp"];
+}
+
+- (void)setValues:(RWIProtocolJSONObject *)values
+{
+ [super setObject:values forKey:@"values"];
+}
+
+- (RWIProtocolJSONObject *)values
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"values"];
+}
+
+- (void)setPayload:(RWIProtocolJSONObject *)payload
+{
+ [super setObject:payload forKey:@"payload"];
+}
+
+- (RWIProtocolJSONObject *)payload
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"payload"];
+}
+
+- (void)setError:(RWIProtocolDatabaseError *)error
+{
+ [super setObject:error forKey:@"error"];
+}
+
+- (RWIProtocolDatabaseError *)error
+{
+ return (RWIProtocolDatabaseError *)[super objectForKey:@"error"];
+}
+
+- (void)setErrorList:(NSArray/*<RWIProtocolDatabaseError>*/ *)errorList
+{
+ THROW_EXCEPTION_FOR_BAD_TYPE_IN_ARRAY(errorList, [RWIProtocolDatabaseError class]);
+ [super setInspectorArray:inspectorObjectArray(errorList) forKey:@"errorList"];
+}
+
+- (NSArray/*<RWIProtocolDatabaseError>*/ *)errorList
+{
+ return objcArray<RWIProtocolDatabaseError>([super inspectorArrayForKey:@"errorList"]);
+}
+
+@end
+
+@implementation RWIProtocolDatabaseObjectWithPropertyNameConflicts
+
+- (instancetype)initWithInteger:(NSString *)integer array:(NSString *)array string:(NSString *)string value:(NSString *)value object:(NSString *)object;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(integer, @"integer");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(array, @"array");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(string, @"string");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(value, @"value");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(object, @"object");
+
+ self.integer = integer;
+ self.array = array;
+ self.string = string;
+ self.value = value;
+ self.object = object;
+
+ return self;
+}
+
+- (void)setInteger:(NSString *)integer
+{
+ [super setString:integer forKey:@"integer"];
+}
+
+- (NSString *)integer
+{
+ return [super stringForKey:@"integer"];
+}
+
+- (void)setArray:(NSString *)array
+{
+ [super setString:array forKey:@"array"];
+}
+
+- (NSString *)array
+{
+ return [super stringForKey:@"array"];
+}
+
+- (void)setString:(NSString *)string
+{
+ [super setString:string forKey:@"string"];
+}
+
+- (NSString *)string
+{
+ return [super stringForKey:@"string"];
+}
+
+- (void)setValue:(NSString *)value
+{
+ [super setString:value forKey:@"value"];
+}
+
+- (NSString *)value
+{
+ return [super stringForKey:@"value"];
+}
+
+- (void)setObject:(NSString *)object
+{
+ [super setString:object forKey:@"object"];
+}
+
+- (NSString *)object
+{
+ return [super stringForKey:@"object"];
+}
+
+@end
+
+@implementation RWIProtocolDatabaseDummyObject
+
+@end
+
+
+@implementation RWIProtocolTestParameterBundle
+
+- (instancetype)initWithColumnNames:(NSArray/*<NSString>*/ *)columnNames notes:(NSString *)notes timestamp:(double)timestamp values:(RWIProtocolJSONObject *)values payload:(RWIProtocolJSONObject *)payload error:(RWIProtocolDatabaseError *)error;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(columnNames, @"columnNames");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(notes, @"notes");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(values, @"values");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(payload, @"payload");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(error, @"error");
+
+ self.columnNames = columnNames;
+ self.notes = notes;
+ self.timestamp = timestamp;
+ self.values = values;
+ self.payload = payload;
+ self.error = error;
+
+ return self;
+}
+
+- (void)setColumnNames:(NSArray/*<NSString>*/ *)columnNames
+{
+ [super setInspectorArray:inspectorStringArray(columnNames) forKey:@"columnNames"];
+}
+
+- (NSArray/*<NSString>*/ *)columnNames
+{
+ return objcStringArray([super inspectorArrayForKey:@"columnNames"]);
+}
+
+- (void)setNotes:(NSString *)notes
+{
+ [super setString:notes forKey:@"notes"];
+}
+
+- (NSString *)notes
+{
+ return [super stringForKey:@"notes"];
+}
+
+- (void)setTimestamp:(double)timestamp
+{
+ [super setDouble:timestamp forKey:@"timestamp"];
+}
+
+- (double)timestamp
+{
+ return [super doubleForKey:@"timestamp"];
+}
+
+- (void)setValues:(RWIProtocolJSONObject *)values
+{
+ [super setObject:values forKey:@"values"];
+}
+
+- (RWIProtocolJSONObject *)values
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"values"];
+}
+
+- (void)setPayload:(RWIProtocolJSONObject *)payload
+{
+ [super setObject:payload forKey:@"payload"];
+}
+
+- (RWIProtocolJSONObject *)payload
+{
+ return (RWIProtocolJSONObject *)[super objectForKey:@"payload"];
+}
+
+- (void)setError:(RWIProtocolDatabaseError *)error
+{
+ [super setObject:error forKey:@"error"];
+}
+
+- (RWIProtocolDatabaseError *)error
+{
+ return (RWIProtocolDatabaseError *)[super objectForKey:@"error"];
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-declaration-object-type.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result
new file mode 100644
index 000000000..9be587393
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result
@@ -0,0 +1,1372 @@
+### Begin File: InspectorAlternateBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorAlternateBackendDispatchers_h
+#define InspectorAlternateBackendDispatchers_h
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#include "InspectorProtocolTypes.h"
+#include <inspector/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorBackendDispatcher.h>
+
+namespace Inspector {
+
+class AlternateBackendDispatcher {
+public:
+ void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTFMove(dispatcher); }
+ BackendDispatcher* backendDispatcher() const { return m_backendDispatcher.get(); }
+private:
+ RefPtr<BackendDispatcher> m_backendDispatcher;
+};
+
+
+
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+
+#endif // !defined(InspectorAlternateBackendDispatchers_h)
+### End File: InspectorAlternateBackendDispatchers.h
+
+### Begin File: InspectorBackendCommands.js
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Test.
+InspectorBackend.registerEnum("Test.UncastedAnimals", {Pigs: "Pigs", Cows: "Cows", Cats: "Cats", Hens: "Hens"});
+InspectorBackend.registerEnum("Test.CastedAnimals", {Ducks: "Ducks", Hens: "Hens", Crows: "Crows", Flamingos: "Flamingos"});
+### End File: InspectorBackendCommands.js
+
+### Begin File: InspectorBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorBackendDispatchers_h
+#define InspectorBackendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+
+
+} // namespace Inspector
+
+#endif // !defined(InspectorBackendDispatchers_h)
+### End File: InspectorBackendDispatchers.h
+
+### Begin File: InspectorBackendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorBackendDispatchers.h"
+
+#include <inspector/InspectorFrontendRouter.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/CString.h>
+
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+#include "InspectorAlternateBackendDispatchers.h"
+#endif
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: InspectorBackendDispatchers.cpp
+
+### Begin File: InspectorFrontendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorFrontendDispatchers_h
+#define InspectorFrontendDispatchers_h
+
+#include "InspectorProtocolObjects.h"
+#include <inspector/InspectorValues.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class FrontendRouter;
+
+} // namespace Inspector
+
+#endif // !defined(InspectorFrontendDispatchers_h)
+### End File: InspectorFrontendDispatchers.h
+
+### Begin File: InspectorFrontendDispatchers.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorFrontendDispatchers.h"
+
+#include "InspectorFrontendRouter.h"
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+} // namespace Inspector
+
+### End File: InspectorFrontendDispatchers.cpp
+
+### Begin File: InspectorProtocolObjects.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorProtocolObjects_h
+#define InspectorProtocolObjects_h
+
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+
+namespace Inspector {
+
+
+
+namespace Protocol {
+
+// Forward declarations.
+namespace Test {
+class RecursiveObject1;
+class RecursiveObject2;
+class TypeNeedingCast;
+enum class CastedAnimals;
+enum class UncastedAnimals;
+} // Test
+// End of forward declarations.
+
+
+// Typedefs.
+namespace Test {
+typedef int CastedObjectId;
+typedef int UncastedObjectId;
+} // Test
+// End of typedefs.
+
+String getEnumConstantValue(int code);
+
+template<typename T> String getEnumConstantValue(T enumValue)
+{
+ return getEnumConstantValue(static_cast<int>(enumValue));
+}
+
+namespace Test {
+/* A dummy type that requires runtime casts, and forces non-primitive referenced types to also emit runtime cast helpers. */
+class TypeNeedingCast : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ StringSet = 1 << 0,
+ NumberSet = 1 << 1,
+ AnimalsSet = 1 << 2,
+ IdSet = 1 << 3,
+ TreeSet = 1 << 4,
+ AllFieldsSet = (StringSet | NumberSet | AnimalsSet | IdSet | TreeSet)
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*TypeNeedingCast*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class TypeNeedingCast;
+ public:
+
+ Builder<STATE | StringSet>& setString(const String& value)
+ {
+ COMPILE_ASSERT(!(STATE & StringSet), property_string_already_set);
+ m_result->setString(ASCIILiteral("string"), value);
+ return castState<StringSet>();
+ }
+
+ Builder<STATE | NumberSet>& setNumber(int value)
+ {
+ COMPILE_ASSERT(!(STATE & NumberSet), property_number_already_set);
+ m_result->setInteger(ASCIILiteral("number"), value);
+ return castState<NumberSet>();
+ }
+
+ Builder<STATE | AnimalsSet>& setAnimals(Inspector::Protocol::Test::CastedAnimals value)
+ {
+ COMPILE_ASSERT(!(STATE & AnimalsSet), property_animals_already_set);
+ m_result->setString(ASCIILiteral("animals"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
+ return castState<AnimalsSet>();
+ }
+
+ Builder<STATE | IdSet>& setId(int value)
+ {
+ COMPILE_ASSERT(!(STATE & IdSet), property_id_already_set);
+ m_result->setInteger(ASCIILiteral("id"), value);
+ return castState<IdSet>();
+ }
+
+ Builder<STATE | TreeSet>& setTree(RefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
+ {
+ COMPILE_ASSERT(!(STATE & TreeSet), property_tree_already_set);
+ m_result->setObject(ASCIILiteral("tree"), value);
+ return castState<TreeSet>();
+ }
+
+ Ref<TypeNeedingCast> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(TypeNeedingCast) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<TypeNeedingCast>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<TypeNeedingCast> result = TypeNeedingCast::create()
+ * .setString(...)
+ * .setNumber(...)
+ * .setAnimals(...)
+ * .setId(...)
+ * .setTree(...)
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+};
+
+/* */
+enum class UncastedAnimals {
+ Pigs = 4,
+ Cows = 5,
+ Cats = 6,
+ Hens = 1,
+}; // enum class UncastedAnimals
+/* */
+enum class CastedAnimals {
+ Ducks = 0,
+ Hens = 1,
+ Crows = 2,
+ Flamingos = 3,
+}; // enum class CastedAnimals
+class RecursiveObject1 : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ AllFieldsSet = 0
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*RecursiveObject1*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class RecursiveObject1;
+ public:
+
+ Ref<RecursiveObject1> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(RecursiveObject1) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<RecursiveObject1>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<RecursiveObject1> result = RecursiveObject1::create()
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+
+ void setObj(RefPtr<Inspector::Protocol::Test::RecursiveObject2> value)
+ {
+ InspectorObjectBase::setObject(ASCIILiteral("obj"), WTFMove(value));
+ }
+};
+
+class RecursiveObject2 : public Inspector::InspectorObjectBase {
+public:
+ enum {
+ NoFieldsSet = 0,
+ AllFieldsSet = 0
+ };
+
+ template<int STATE>
+ class Builder {
+ private:
+ RefPtr<InspectorObject> m_result;
+
+ template<int STEP> Builder<STATE | STEP>& castState()
+ {
+ return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+ }
+
+ Builder(Ref</*RecursiveObject2*/InspectorObject>&& object)
+ : m_result(WTFMove(object))
+ {
+ COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+ }
+ friend class RecursiveObject2;
+ public:
+
+ Ref<RecursiveObject2> release()
+ {
+ COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+ COMPILE_ASSERT(sizeof(RecursiveObject2) == sizeof(InspectorObject), cannot_cast);
+
+ Ref<InspectorObject> result = m_result.releaseNonNull();
+ return WTFMove(*reinterpret_cast<Ref<RecursiveObject2>*>(&result));
+ }
+ };
+
+ /*
+ * Synthetic constructor:
+ * Ref<RecursiveObject2> result = RecursiveObject2::create()
+ * .release();
+ */
+ static Builder<NoFieldsSet> create()
+ {
+ return Builder<NoFieldsSet>(InspectorObject::create());
+ }
+
+ void setObj(RefPtr<Inspector::Protocol::Test::RecursiveObject1> value)
+ {
+ InspectorObjectBase::setObject(ASCIILiteral("obj"), WTFMove(value));
+ }
+};
+
+} // Test
+
+template<> struct BindingTraits<Inspector::Protocol::Test::CastedAnimals> {
+#if !ASSERT_DISABLED
+static void assertValueHasExpectedType(Inspector::InspectorValue*);
+#endif // !ASSERT_DISABLED
+};
+template<> struct BindingTraits<Inspector::Protocol::Test::TypeNeedingCast> {
+static RefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(RefPtr<Inspector::InspectorValue>&& value);
+#if !ASSERT_DISABLED
+static void assertValueHasExpectedType(Inspector::InspectorValue*);
+#endif // !ASSERT_DISABLED
+};
+template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject1> {
+#if !ASSERT_DISABLED
+static void assertValueHasExpectedType(Inspector::InspectorValue*);
+#endif // !ASSERT_DISABLED
+};
+template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject2> {
+#if !ASSERT_DISABLED
+static void assertValueHasExpectedType(Inspector::InspectorValue*);
+#endif // !ASSERT_DISABLED
+};
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // !defined(InspectorProtocolObjects_h)
+### End File: InspectorProtocolObjects.h
+
+### Begin File: InspectorProtocolObjects.cpp
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorProtocolObjects.h"
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+ "Ducks",
+ "Hens",
+ "Crows",
+ "Flamingos",
+ "Pigs",
+ "Cows",
+ "Cats",
+};
+
+String getEnumConstantValue(int code) {
+ return enum_constant_values[code];
+}
+
+
+
+#if !ASSERT_DISABLED
+void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(Inspector::InspectorValue* value)
+{
+ ASSERT_ARG(value, value);
+ String result;
+ bool castSucceeded = value->asString(result);
+ ASSERT(castSucceeded);
+ ASSERT(result == "Ducks" || result == "Hens" || result == "Crows" || result == "Flamingos");
+}
+#endif // !ASSERT_DISABLED
+
+#if !ASSERT_DISABLED
+void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(Inspector::InspectorValue* value)
+{
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorObject> object;
+ bool castSucceeded = value->asObject(object);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+ {
+ InspectorObject::iterator stringPos = object->find(ASCIILiteral("string"));
+ ASSERT(stringPos != object->end());
+ BindingTraits<String>::assertValueHasExpectedType(stringPos->value.get());
+ }
+ {
+ InspectorObject::iterator numberPos = object->find(ASCIILiteral("number"));
+ ASSERT(numberPos != object->end());
+ BindingTraits<int>::assertValueHasExpectedType(numberPos->value.get());
+ }
+ {
+ InspectorObject::iterator animalsPos = object->find(ASCIILiteral("animals"));
+ ASSERT(animalsPos != object->end());
+ BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(animalsPos->value.get());
+ }
+ {
+ InspectorObject::iterator idPos = object->find(ASCIILiteral("id"));
+ ASSERT(idPos != object->end());
+ BindingTraits<int>::assertValueHasExpectedType(idPos->value.get());
+ }
+ {
+ InspectorObject::iterator treePos = object->find(ASCIILiteral("tree"));
+ ASSERT(treePos != object->end());
+ BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(treePos->value.get());
+ }
+
+ int foundPropertiesCount = 5;
+ if (foundPropertiesCount != object->size())
+ FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
+}
+#endif // !ASSERT_DISABLED
+
+RefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(RefPtr<InspectorValue>&& value)
+{
+ RefPtr<InspectorObject> result;
+ bool castSucceeded = value->asObject(result);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+#if !ASSERT_DISABLED
+ BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(result.get());
+#endif // !ASSERT_DISABLED
+ COMPILE_ASSERT(sizeof(Inspector::Protocol::Test::TypeNeedingCast) == sizeof(InspectorObjectBase), type_cast_problem);
+ return static_cast<Inspector::Protocol::Test::TypeNeedingCast*>(static_cast<InspectorObjectBase*>(result.get()));
+}
+
+
+#if !ASSERT_DISABLED
+void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(Inspector::InspectorValue* value)
+{
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorObject> object;
+ bool castSucceeded = value->asObject(object);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ int foundPropertiesCount = 0;
+ {
+ InspectorObject::iterator objPos = object->find(ASCIILiteral("obj"));
+ if (objPos != object->end()) {
+ BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(objPos->value.get());
+ ++foundPropertiesCount;
+ }
+ }
+ if (foundPropertiesCount != object->size())
+ FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
+}
+#endif // !ASSERT_DISABLED
+
+#if !ASSERT_DISABLED
+void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(Inspector::InspectorValue* value)
+{
+ ASSERT_ARG(value, value);
+ RefPtr<InspectorObject> object;
+ bool castSucceeded = value->asObject(object);
+ ASSERT_UNUSED(castSucceeded, castSucceeded);
+
+ int foundPropertiesCount = 0;
+ {
+ InspectorObject::iterator objPos = object->find(ASCIILiteral("obj"));
+ if (objPos != object->end()) {
+ BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(objPos->value.get());
+ ++foundPropertiesCount;
+ }
+ }
+ if (foundPropertiesCount != object->size())
+ FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
+}
+#endif // !ASSERT_DISABLED
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+### End File: InspectorProtocolObjects.cpp
+
+### Begin File: RWIProtocolBackendDispatchers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#include <wtf/RetainPtr.h>
+
+
+
+namespace Inspector {
+
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.h
+
+### Begin File: RWIProtocolConfiguration.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolConfiguration.h"
+
+#import "RWIProtocolInternal.h"
+#import "RWIProtocolBackendDispatchers.h"
+#import <JavaScriptCore/AlternateDispatchableAgent.h>
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorAlternateBackendDispatchers.h>
+#import <JavaScriptCore/InspectorBackendDispatchers.h>
+
+using namespace Inspector;
+
+@implementation RWIProtocolConfiguration
+{
+ AugmentableInspectorController* _controller;
+}
+
+- (instancetype)initWithController:(AugmentableInspectorController*)controller
+{
+ self = [super init];
+ if (!self)
+ return nil;
+ ASSERT(controller);
+ _controller = controller;
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+@end
+
+
+### End File: RWIProtocolConfiguration.mm
+
+### Begin File: RWIProtocolConfiguration.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <WebInspector/RWIProtocol.h>
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolConfiguration : NSObject
+@end
+
+
+### End File: RWIProtocolConfiguration.h
+
+### Begin File: RWIProtocolBackendDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolBackendDispatchers.h"
+
+#include "RWIProtocolInternal.h"
+#include "RWIProtocolEnumConversionHelpers.h"
+#include <JavaScriptCore/InspectorValues.h>
+
+namespace Inspector {
+
+
+
+} // namespace Inspector
+
+### End File: RWIProtocolBackendDispatchers.mm
+
+### Begin File: RWIProtocolEnumConversionHelpers.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocolArrayConversionHelpers.h"
+
+namespace Inspector {
+
+template<typename ObjCEnumType>
+ObjCEnumType fromProtocolString(const String& value);
+
+
+inline String toProtocolString(RWIProtocolTestUncastedAnimals value)
+{
+ switch(value) {
+ case RWIProtocolTestUncastedAnimalsPigs:
+ return ASCIILiteral("Pigs");
+ case RWIProtocolTestUncastedAnimalsCows:
+ return ASCIILiteral("Cows");
+ case RWIProtocolTestUncastedAnimalsCats:
+ return ASCIILiteral("Cats");
+ case RWIProtocolTestUncastedAnimalsHens:
+ return ASCIILiteral("Hens");
+ }
+}
+
+template<>
+inline RWIProtocolTestUncastedAnimals fromProtocolString(const String& value)
+{
+ if (value == "Pigs")
+ return RWIProtocolTestUncastedAnimalsPigs;
+ if (value == "Cows")
+ return RWIProtocolTestUncastedAnimalsCows;
+ if (value == "Cats")
+ return RWIProtocolTestUncastedAnimalsCats;
+ if (value == "Hens")
+ return RWIProtocolTestUncastedAnimalsHens;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolTestUncastedAnimalsPigs;
+}
+
+inline String toProtocolString(RWIProtocolTestCastedAnimals value)
+{
+ switch(value) {
+ case RWIProtocolTestCastedAnimalsDucks:
+ return ASCIILiteral("Ducks");
+ case RWIProtocolTestCastedAnimalsHens:
+ return ASCIILiteral("Hens");
+ case RWIProtocolTestCastedAnimalsCrows:
+ return ASCIILiteral("Crows");
+ case RWIProtocolTestCastedAnimalsFlamingos:
+ return ASCIILiteral("Flamingos");
+ }
+}
+
+template<>
+inline RWIProtocolTestCastedAnimals fromProtocolString(const String& value)
+{
+ if (value == "Ducks")
+ return RWIProtocolTestCastedAnimalsDucks;
+ if (value == "Hens")
+ return RWIProtocolTestCastedAnimalsHens;
+ if (value == "Crows")
+ return RWIProtocolTestCastedAnimalsCrows;
+ if (value == "Flamingos")
+ return RWIProtocolTestCastedAnimalsFlamingos;
+ ASSERT_NOT_REACHED();
+ return RWIProtocolTestCastedAnimalsDucks;
+}
+
+} // namespace Inspector
+
+### End File: RWIProtocolEnumConversionHelpers.h
+
+### Begin File: RWIProtocolEventDispatchers.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+
+using namespace Inspector;
+
+
+
+
+### End File: RWIProtocolEventDispatchers.mm
+
+### Begin File: RWIProtocol.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import <Foundation/Foundation.h>
+
+#import <WebInspector/RWIProtocolJSONObject.h>
+
+
+@class RWIProtocolTestTypeNeedingCast;
+@class RWIProtocolTestRecursiveObject1;
+@class RWIProtocolTestRecursiveObject2;
+
+
+typedef NS_ENUM(NSInteger, RWIProtocolTestUncastedAnimals) {
+ RWIProtocolTestUncastedAnimalsPigs,
+ RWIProtocolTestUncastedAnimalsCows,
+ RWIProtocolTestUncastedAnimalsCats,
+ RWIProtocolTestUncastedAnimalsHens,
+};
+
+typedef NS_ENUM(NSInteger, RWIProtocolTestCastedAnimals) {
+ RWIProtocolTestCastedAnimalsDucks,
+ RWIProtocolTestCastedAnimalsHens,
+ RWIProtocolTestCastedAnimalsCrows,
+ RWIProtocolTestCastedAnimalsFlamingos,
+};
+
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolTestTypeNeedingCast : RWIProtocolJSONObject
+- (instancetype)initWithString:(NSString *)string number:(int)number animals:(RWIProtocolTestCastedAnimals)animals identifier:(int)identifier tree:(RWIProtocolTestRecursiveObject1 *)tree;
+/* required */ @property (nonatomic, copy) NSString *string;
+/* required */ @property (nonatomic, assign) int number;
+/* required */ @property (nonatomic, assign) RWIProtocolTestCastedAnimals animals;
+/* required */ @property (nonatomic, assign) int identifier;
+/* required */ @property (nonatomic, retain) RWIProtocolTestRecursiveObject1 *tree;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolTestRecursiveObject1 : RWIProtocolJSONObject
+/* optional */ @property (nonatomic, retain) RWIProtocolTestRecursiveObject2 *obj;
+@end
+
+__attribute__((visibility ("default")))
+@interface RWIProtocolTestRecursiveObject2 : RWIProtocolJSONObject
+/* optional */ @property (nonatomic, retain) RWIProtocolTestRecursiveObject1 *obj;
+@end
+
+
+
+
+
+
+### End File: RWIProtocol.h
+
+### Begin File: RWIProtocolTypes.mm
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "config.h"
+#import "RWIProtocolInternal.h"
+
+#import "RWIProtocolEnumConversionHelpers.h"
+#import <JavaScriptCore/InspectorValues.h>
+#import <wtf/Assertions.h>
+
+using namespace Inspector;
+
+
+@implementation RWIProtocolTestTypeNeedingCast
+
+- (instancetype)initWithString:(NSString *)string number:(int)number animals:(RWIProtocolTestCastedAnimals)animals identifier:(int)identifier tree:(RWIProtocolTestRecursiveObject1 *)tree;
+{
+ self = [super init];
+ if (!self)
+ return nil;
+
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(string, @"string");
+ THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(tree, @"tree");
+
+ self.string = string;
+ self.number = number;
+ self.animals = animals;
+ self.identifier = identifier;
+ self.tree = tree;
+
+ return self;
+}
+
+- (void)setString:(NSString *)string
+{
+ [super setString:string forKey:@"string"];
+}
+
+- (NSString *)string
+{
+ return [super stringForKey:@"string"];
+}
+
+- (void)setNumber:(int)number
+{
+ [super setInteger:number forKey:@"number"];
+}
+
+- (int)number
+{
+ return [super integerForKey:@"number"];
+}
+
+- (void)setAnimals:(RWIProtocolTestCastedAnimals)animals
+{
+ [super setString:toProtocolString(animals) forKey:@"animals"];
+}
+
+- (RWIProtocolTestCastedAnimals)animals
+{
+ return fromProtocolString<RWIProtocolTestCastedAnimals>([super stringForKey:@"animals"]);
+}
+
+- (void)setIdentifier:(int)identifier
+{
+ [super setInteger:identifier forKey:@"id"];
+}
+
+- (int)identifier
+{
+ return [super integerForKey:@"id"];
+}
+
+- (void)setTree:(RWIProtocolTestRecursiveObject1 *)tree
+{
+ [super setObject:tree forKey:@"tree"];
+}
+
+- (RWIProtocolTestRecursiveObject1 *)tree
+{
+ return (RWIProtocolTestRecursiveObject1 *)[super objectForKey:@"tree"];
+}
+
+@end
+
+@implementation RWIProtocolTestRecursiveObject1
+
+- (void)setObj:(RWIProtocolTestRecursiveObject2 *)obj
+{
+ [super setObject:obj forKey:@"obj"];
+}
+
+- (RWIProtocolTestRecursiveObject2 *)obj
+{
+ return (RWIProtocolTestRecursiveObject2 *)[super objectForKey:@"obj"];
+}
+
+@end
+
+@implementation RWIProtocolTestRecursiveObject2
+
+- (void)setObj:(RWIProtocolTestRecursiveObject1 *)obj
+{
+ [super setObject:obj forKey:@"obj"];
+}
+
+- (RWIProtocolTestRecursiveObject1 *)obj
+{
+ return (RWIProtocolTestRecursiveObject1 *)[super objectForKey:@"obj"];
+}
+
+@end
+
+
+### End File: RWIProtocolTypes.mm
+
+### Begin File: RWIProtocolInternal.h
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 University of Washington. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// DO NOT EDIT THIS FILE. It is automatically generated from type-requiring-runtime-casts.json
+// by the script: Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#import "RWIProtocol.h"
+#import "RWIProtocolJSONObjectInternal.h"
+#import <JavaScriptCore/AugmentableInspectorController.h>
+#import <JavaScriptCore/InspectorValues.h>
+
+
+
+
+### End File: RWIProtocolInternal.h
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-availability.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-availability.json
new file mode 100644
index 000000000..36ee2c600
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-availability.json
@@ -0,0 +1,9 @@
+{
+ "domain": "WebOnly",
+ "availability": "webb",
+ "commands": [
+ {
+ "name": "enable"
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json
new file mode 100644
index 000000000..bab76ca62
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json
@@ -0,0 +1,16 @@
+{
+ "domain": "Overlay",
+ "commands": [
+ {
+ "name": "processPoints",
+ "parameters": [
+ { "name": "point", "type": "number" },
+ { "name": "point", "type": "number" }
+ ],
+ "returns": [
+ { "name": "result1", "type": "string" },
+ { "name": "result2", "type": "string" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json
new file mode 100644
index 000000000..c8bb15c04
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json
@@ -0,0 +1,16 @@
+{
+ "domain": "Overlay",
+ "commands": [
+ {
+ "name": "processPoints",
+ "parameters": [
+ { "name": "point1", "type": "number" },
+ { "name": "point2", "type": "number" }
+ ],
+ "returns": [
+ { "name": "result", "type": "string" },
+ { "name": "result", "type": "string" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json
new file mode 100644
index 000000000..d3d3b3cc6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json
@@ -0,0 +1,12 @@
+{
+ "domain": "Overlay",
+ "events": [
+ {
+ "name": "processedPoints",
+ "parameters": [
+ { "name": "point", "type": "number" },
+ { "name": "point", "type": "number" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json
new file mode 100644
index 000000000..702fc6a32
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json
@@ -0,0 +1,15 @@
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "string",
+ "description": "Unique object identifier."
+ },
+ {
+ "id": "RemoteObjectId",
+ "type": "string",
+ "description": "Unique object identifier."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json
new file mode 100644
index 000000000..aebacee8b
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json
@@ -0,0 +1,15 @@
+[
+{
+ "domain": "OverlayTypes",
+ "types": [
+ {
+ "id": "Point",
+ "type": "object",
+ "properties": [
+ { "name": "x", "type": "integer" },
+ { "name": "x", "type": "integer" }
+ ]
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json
new file mode 100644
index 000000000..232a7c324
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json
@@ -0,0 +1,10 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "PrimaryColors",
+ "type": "string",
+ "enum": []
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json
new file mode 100644
index 000000000..7308db992
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-parameter-flag.json
@@ -0,0 +1,18 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "string",
+ "description": "Unique identifier of Database object."
+ }
+ ],
+ "events": [
+ {
+ "name": "didExecuteOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "string", "optional": 0 }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-type-member.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-type-member.json
new file mode 100644
index 000000000..afea555ec
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-number-typed-optional-type-member.json
@@ -0,0 +1,16 @@
+[
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code.", "optional": 0 }
+ ]
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json
new file mode 100644
index 000000000..4012c79b6
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json
@@ -0,0 +1,18 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "DatabaseId",
+ "type": "string",
+ "description": "Unique identifier of Database object."
+ }
+ ],
+ "events": [
+ {
+ "name": "didExecuteOptionalParameters",
+ "parameters": [
+ { "name": "columnNames", "type": "string", "optional": "true" }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json
new file mode 100644
index 000000000..ca3ef28a8
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json
@@ -0,0 +1,16 @@
+[
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code.", "optional": "false" }
+ ]
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json
new file mode 100644
index 000000000..19b7590cc
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json
@@ -0,0 +1,13 @@
+[
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "object",
+ "$ref": "SomeType",
+ "description": "Unique object identifier."
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json
new file mode 100644
index 000000000..531901e4a
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json
@@ -0,0 +1,10 @@
+{
+ "domain": "Database",
+ "types": [
+ {
+ "id": "databaseId",
+ "type": "integer",
+ "description": "Unique identifier of Database object."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json
new file mode 100644
index 000000000..d6887a274
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json
@@ -0,0 +1,12 @@
+[
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "dragon",
+ "description": "Unique object identifier."
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json
new file mode 100644
index 000000000..b817db504
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json
@@ -0,0 +1,15 @@
+[
+{
+ "domain": "Fantasy",
+ "types": [
+ {
+ "id": "DragonEgg",
+ "type": "object",
+ "description": "A dragon egg.",
+ "properties": [
+ { "name": "color", "$ref": "Color" }
+ ]
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json b/Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json
new file mode 100644
index 000000000..67cf8e582
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json
@@ -0,0 +1,36 @@
+[
+{
+ "domain": "Network1",
+ "featureGuard": "PLATFORM(WEB_COMMANDS)",
+ "commands": [
+ {
+ "name": "loadResource",
+ "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+ }
+ ]
+},
+{
+ "domain": "Network2",
+ "featureGuard": "PLATFORM(WEB_TYPES)",
+ "types": [
+ {
+ "id": "NetworkError",
+ "type": "object",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ }
+ ]
+},
+{
+ "domain": "Network3",
+ "featureGuard": "PLATFORM(WEB_EVENTS)",
+ "events": [
+ {
+ "name": "resourceLoaded",
+ "description": "A resource was loaded."
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json b/Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json
new file mode 100644
index 000000000..3bf4dff5c
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json
@@ -0,0 +1,22 @@
+[
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "string",
+ "description": "Unique object identifier."
+ }
+ ]
+},
+{
+ "domain": "Runtime2",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "string",
+ "description": "Unique object identifier."
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json b/Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json
new file mode 100644
index 000000000..20a0c1552
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json
@@ -0,0 +1,31 @@
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "KeyPath",
+ "type": "object",
+ "description": "Key path.",
+ "properties": [
+ {
+ "name": "type",
+ "type": "string",
+ "enum": ["null", "string", "array"],
+ "description": "Key path type."
+ },
+ {
+ "name": "string",
+ "type": "string",
+ "optional": true,
+ "description": "String value."
+ },
+ {
+ "name": "array",
+ "type": "array",
+ "optional": true,
+ "items": { "type": "string" },
+ "description": "Array value."
+ }
+ ]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json
new file mode 100644
index 000000000..cbc9d5394
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json
@@ -0,0 +1,10 @@
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "RemoteObjectId",
+ "type": "integer",
+ "description": "Unique object identifier."
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json
new file mode 100644
index 000000000..cfb08bd94
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json
@@ -0,0 +1,50 @@
+[
+{
+ "domain": "Debugger",
+ "types": [
+ {
+ "id": "BreakpointId",
+ "type": "integer"
+ },
+ {
+ "id": "Reason",
+ "type": "string",
+ "enum": ["Died", "Fainted", "Hungry"]
+ }
+ ]
+},
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "ObjectId",
+ "type": "integer"
+ },
+ {
+ "id": "LuckyNumbers",
+ "type": "array",
+ "items": { "type": "integer" }
+ },
+ {
+ "id": "BabyNames",
+ "type": "array",
+ "items": { "type": "string" }
+ },
+ {
+ "id": "NewObjects",
+ "type": "array",
+ "items": { "$ref": "ObjectId" }
+ },
+ {
+ "id": "OldObjects",
+ "type": "array",
+ "items": { "$ref": "Debugger.BreakpointId" }
+ },
+ {
+ "id": "StopReasons",
+ "type": "array",
+ "items": { "$ref": "Debugger.Reason" }
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json
new file mode 100644
index 000000000..9f0aee9c9
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json
@@ -0,0 +1,15 @@
+{
+ "domain": "Runtime",
+ "types": [
+ {
+ "id": "FarmAnimals",
+ "type": "string",
+ "enum": ["Pigs", "Cows", "Cats", "Hens"]
+ },
+ {
+ "id": "TwoLeggedAnimals",
+ "type": "string",
+ "enum": ["Ducks", "Hens", "Crows", "Flamingos"]
+ }
+ ]
+}
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json
new file mode 100644
index 000000000..178309197
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json
@@ -0,0 +1,83 @@
+[
+{
+ "domain": "Database",
+ "description": "Test type builder generation of various object types.",
+ "types": [
+ {
+ "id": "Error",
+ "type": "object",
+ "description": "Database error.",
+ "properties": [
+ { "name": "message", "type": "string", "description": "Error message." },
+ { "name": "code", "type": "integer", "description": "Error code." }
+ ]
+ },
+ {
+ "id": "ErrorList",
+ "type": "array",
+ "items": { "$ref": "Error" }
+ },
+ {
+ "id": "OptionalParameterBundle",
+ "type": "object",
+ "properties": [
+ { "name": "columnNames", "type": "array", "optional": true, "items": { "type": "string" } },
+ { "name": "notes", "type": "string", "optional": true },
+ { "name": "timestamp", "type": "number", "optional": true },
+ { "name": "values", "type": "object", "optional": true },
+ { "name": "payload", "type": "any", "optional": true },
+ { "name": "error", "$ref": "Error", "optional": true },
+ { "name": "errorList", "$ref": "ErrorList", "optional": true }
+ ]
+ },
+ {
+ "id": "ParameterBundle",
+ "type": "object",
+ "properties": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "error", "$ref": "Error" },
+ { "name": "errorList", "$ref": "ErrorList" }
+ ]
+ },
+ {
+ "id": "ObjectWithPropertyNameConflicts",
+ "description": "Conflicted names may cause generated getters/setters to clash with built-in InspectorObject methods.",
+ "type": "object",
+ "properties": [
+ { "name": "integer", "type": "string" },
+ { "name": "array", "type": "string" },
+ { "name": "string", "type": "string" },
+ { "name": "value", "type": "string" },
+ { "name": "object", "type": "string" }
+ ]
+ },
+ {
+ "id": "DummyObject",
+ "description": "An open object that doesn't have any predefined fields.",
+ "type": "object"
+ }
+ ]
+},
+{
+ "domain": "Test",
+ "description": "Test the generation of special behaviors that only apply to specific classes.",
+ "types": [
+ {
+ "id": "ParameterBundle",
+ "type": "object",
+ "properties": [
+ { "name": "columnNames", "type": "array", "items": { "type": "string" } },
+ { "name": "notes", "type": "string" },
+ { "name": "timestamp", "type": "number" },
+ { "name": "values", "type": "object" },
+ { "name": "payload", "type": "any" },
+ { "name": "error", "$ref": "Database.Error" }
+ ]
+ }
+ ]
+}
+]
diff --git a/Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json b/Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json
new file mode 100644
index 000000000..83d94be89
--- /dev/null
+++ b/Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json
@@ -0,0 +1,51 @@
+[
+{
+ "domain": "Test",
+ "types": [
+ {
+ "id": "TypeNeedingCast",
+ "type": "object",
+ "description": "A dummy type that requires runtime casts, and forces non-primitive referenced types to also emit runtime cast helpers.",
+ "properties": [
+ { "name": "string", "type": "string", "description": "String member." },
+ { "name": "number", "type": "integer", "description": "Number member." },
+ { "name": "animals", "$ref": "CastedAnimals", "description": "Enum member." },
+ { "name": "id", "$ref": "CastedObjectId", "description": "Aliased member." },
+ { "name": "tree", "$ref": "RecursiveObject1", "description": "Recursive object member." }
+ ]
+ },
+ {
+ "id": "CastedObjectId",
+ "type": "integer"
+ },
+ {
+ "id": "UncastedObjectId",
+ "type": "integer"
+ },
+ {
+ "id": "UncastedAnimals",
+ "type": "string",
+ "enum": ["Pigs", "Cows", "Cats", "Hens"]
+ },
+ {
+ "id": "CastedAnimals",
+ "type": "string",
+ "enum": ["Ducks", "Hens", "Crows", "Flamingos"]
+ },
+ {
+ "id": "RecursiveObject1",
+ "type": "object",
+ "properties": [
+ { "name": "obj", "$ref": "RecursiveObject2", "optional": true }
+ ]
+ },
+ {
+ "id": "RecursiveObject2",
+ "type": "object",
+ "properties": [
+ { "name": "obj", "$ref": "RecursiveObject1", "optional": true }
+ ]
+ }
+ ]
+}
+]