diff options
| author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
|---|---|---|
| committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-05-20 09:56:07 +0000 |
| commit | 41386e9cb918eed93b3f13648cbef387e371e451 (patch) | |
| tree | a97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/inspector | |
| parent | e15dd966d523731101f70ccf768bba12435a0208 (diff) | |
| download | WebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz | |
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/inspector')
180 files changed, 4917 insertions, 31321 deletions
diff --git a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp b/Source/JavaScriptCore/inspector/ConsoleMessage.cpp deleted file mode 100644 index 9ac0ddee2..000000000 --- a/Source/JavaScriptCore/inspector/ConsoleMessage.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2007, 2008, 2014 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_line(0) - , m_column(0) - , m_repeatCount(1) - , 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_repeatCount(1) - , 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_line(0) - , m_column(0) - , m_repeatCount(1) - , 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_line(0) - , m_column(0) - , m_repeatCount(1) - , 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(WTF::move(jsonArgs)); - } - } - - if (m_callStack) - jsonObj->setStackTrace(m_callStack->buildInspectorArray()); - - consoleFrontendDispatcher->messageAdded(WTF::move(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 deleted file mode 100644 index a73e28630..000000000 --- a/Source/JavaScriptCore/inspector/ConsoleMessage.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2007, 2008 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; } - const String& message() const { return m_message; } - MessageType type() const { return m_type; } - JSC::ExecState* scriptState() const; - const String& url() const { return m_url; } - unsigned line() const { return m_line; } - unsigned column() const { return m_column; } - - 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; - unsigned m_column; - unsigned m_repeatCount; - String m_requestId; -}; - -} // namespace Inspector - -#endif // ConsoleMessage_h diff --git a/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp b/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp index ed32a1598..8f1f91cf1 100644 --- a/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp +++ b/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp @@ -29,12 +29,14 @@ #include "config.h" #include "ContentSearchUtilities.h" +#if ENABLE(INSPECTOR) + +#include "InspectorJSTypeBuilders.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; @@ -45,16 +47,17 @@ static const char regexSpecialCharacters[] = "[](){}+-*.,?\\^$|"; static String createSearchRegexSource(const String& text) { - StringBuilder result; + String result; + const UChar* characters = text.deprecatedCharacters(); + String specials(regexSpecialCharacters); for (unsigned i = 0; i < text.length(); i++) { - UChar character = text[i]; - if (isASCII(character) && strchr(regexSpecialCharacters, character)) - result.append('\\'); - result.append(character); + if (specials.find(characters[i]) != notFound) + result.append("\\"); + result.append(characters[i]); } - return result.toString(); + return result; } static inline size_t sizetExtractor(const size_t* value) @@ -64,63 +67,60 @@ static inline size_t sizetExtractor(const size_t* 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) + const size_t* foundLineEnding = approximateBinarySearch<size_t, size_t>(lineEndings, lineEndings.size(), offset, sizetExtractor); + size_t lineIndex = foundLineEnding - &lineEndings.at(0); + if (offset > *foundLineEnding) ++lineIndex; - size_t lineStartOffset = lineIndex > 0 ? lineEndings.at(lineIndex - 1) : 0; + size_t lineStartOffset = lineIndex > 0 ? lineEndings.at(lineIndex - 1) + 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) +static Vector<std::pair<int, String>> getRegularExpressionMatchesByLines(const JSC::Yarr::RegularExpression& regex, const String& text) { - Vector<std::pair<size_t, String>> result; + Vector<std::pair<int, String>> result; if (text.isEmpty()) return result; - std::unique_ptr<Vector<size_t>> endings(lineEndings(text)); + OwnPtr<Vector<size_t>> endings(lineEndings(text)); size_t size = endings->size(); - size_t start = 0; - + unsigned start = 0; for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) { - size_t nextStart = endings->at(lineNumber); - String line = text.substring(start, nextStart - start); + size_t lineEnd = endings->at(lineNumber); + String line = text.substring(start, lineEnd - start); + if (line.endsWith('\r')) + line = line.left(line.length() - 1); int matchLength; if (regex.match(line, 0, &matchLength) != -1) - result.append(std::pair<size_t, String>(lineNumber, line)); + result.append(std::pair<int, String>(lineNumber, line)); - start = nextStart; + start = lineEnd + 1; } - return result; } -std::unique_ptr<Vector<size_t>> lineEndings(const String& text) +PassOwnPtr<Vector<size_t>> lineEndings(const String& text) { - auto result = std::make_unique<Vector<size_t>>(); + OwnPtr<Vector<size_t>> result(adoptPtr(new Vector<size_t>())); - size_t start = 0; + unsigned start = 0; while (start < text.length()) { - size_t nextStart = text.findNextLineStart(start); - if (nextStart == notFound) { - result->append(text.length()); + size_t lineEnd = text.find('\n', start); + if (lineEnd == notFound) break; - } - result->append(nextStart); - start = nextStart; + result->append(lineEnd); + start = lineEnd + 1; } - result->append(text.length()); - return result; + return result.release(); } -static Ref<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent) +static PassRefPtr<Inspector::TypeBuilder::GenericTypes::SearchMatch> buildObjectForSearchMatch(int lineNumber, const String& lineContent) { - return Inspector::Protocol::GenericTypes::SearchMatch::create() + return Inspector::TypeBuilder::GenericTypes::SearchMatch::create() .setLineNumber(lineNumber) .setLineContent(lineContent) .release(); @@ -151,17 +151,15 @@ int countRegularExpressionMatches(const JSC::Yarr::RegularExpression& regex, con return result; } -Ref<Inspector::Protocol::Array<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex) +PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::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(); + RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>> result = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>::create(); JSC::Yarr::RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex); - Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text); + Vector<std::pair<int, String>> matches = getRegularExpressionMatchesByLines(regex, text); - for (const auto& match : matches) { - Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second); - result->addItem(WTF::move(matchObject)); - } + for (Vector<std::pair<int, String>>::const_iterator it = matches.begin(); it != matches.end(); ++it) + result->addItem(buildObjectForSearchMatch(it->first, it->second)); return result; } @@ -180,12 +178,11 @@ static String stylesheetCommentPattern(const String& name) 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, ®exAllocator); + OwnPtr<JSC::Yarr::BytecodePattern> bytecodePattern = JSC::Yarr::byteCompile(pattern, ®exAllocator); ASSERT(bytecodePattern); ASSERT(pattern.m_numSubpatterns == 1); @@ -215,4 +212,6 @@ String findStylesheetSourceMapURL(const String& content) } } // namespace ContentSearchUtilities -} // namespace Inspector +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/ContentSearchUtilities.h b/Source/JavaScriptCore/inspector/ContentSearchUtilities.h index 542065fda..3eaa06641 100644 --- a/Source/JavaScriptCore/inspector/ContentSearchUtilities.h +++ b/Source/JavaScriptCore/inspector/ContentSearchUtilities.h @@ -29,7 +29,9 @@ #ifndef ContentSearchUtilities_h #define ContentSearchUtilities_h -#include "InspectorProtocolObjects.h" +#if ENABLE(INSPECTOR) + +#include "InspectorJSTypeBuilders.h" #include <wtf/Vector.h> #include <wtf/text/TextPosition.h> #include <wtf/text/WTFString.h> @@ -44,9 +46,9 @@ 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 PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::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 PassOwnPtr<Vector<size_t>> lineEndings(const String&); JS_EXPORT_PRIVATE String findScriptSourceURL(const String& content); JS_EXPORT_PRIVATE String findScriptSourceMapURL(const String& content); @@ -56,4 +58,6 @@ JS_EXPORT_PRIVATE String findStylesheetSourceMapURL(const String& content); } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(ContentSearchUtilities_h) diff --git a/Source/JavaScriptCore/inspector/EventLoop.cpp b/Source/JavaScriptCore/inspector/EventLoop.cpp deleted file mode 100644 index 495e3f094..000000000 --- a/Source/JavaScriptCore/inspector/EventLoop.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 deleted file mode 100644 index c06e72b26..000000000 --- a/Source/JavaScriptCore/inspector/EventLoop.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7e145be3e..000000000 --- a/Source/JavaScriptCore/inspector/IdentifiersFactory.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index d81c79a4a..000000000 --- a/Source/JavaScriptCore/inspector/IdentifiersFactory.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 index 492060e68..a02f85fb4 100644 --- a/Source/JavaScriptCore/inspector/InjectedScript.cpp +++ b/Source/JavaScriptCore/inspector/InjectedScript.cpp @@ -32,13 +32,14 @@ #include "config.h" #include "InjectedScript.h" +#if ENABLE(INSPECTOR) + #include "InspectorValues.h" -#include "JSCInlines.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" #include <wtf/text/WTFString.h> -using Inspector::Protocol::Array; +using Inspector::TypeBuilder::Array; namespace Inspector { @@ -56,7 +57,7 @@ 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) +void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>* result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluate"), inspectorEnvironment()->functionCallHandler()); function.appendArgument(expression); @@ -64,11 +65,10 @@ void InjectedScript::evaluate(ErrorString& errorString, const String& expression function.appendArgument(includeCommandLineAPI); function.appendArgument(returnByValue); function.appendArgument(generatePreview); - function.appendArgument(saveResult); - makeEvalCall(errorString, function, result, wasThrown, savedResultIndex); + makeEvalCall(errorString, function, result, wasThrown); } -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) +void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>* result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("callFunctionOn"), inspectorEnvironment()->functionCallHandler()); function.appendArgument(objectId); @@ -79,7 +79,7 @@ void InjectedScript::callFunctionOn(ErrorString& errorString, const String& obje 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) +void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>* result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluateOnCallFrame"), inspectorEnvironment()->functionCallHandler()); function.appendArgument(callFrames); @@ -89,112 +89,59 @@ void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, const Depreca function.appendArgument(includeCommandLineAPI); function.appendArgument(returnByValue); function.appendArgument(generatePreview); - function.appendArgument(saveResult); - makeEvalCall(errorString, function, result, wasThrown, savedResultIndex); + makeEvalCall(errorString, function, result, wasThrown); } -void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>* result) +void InjectedScript::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<Inspector::TypeBuilder::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 || resultValue->type() != InspectorValue::TypeObject) { if (!resultValue->asString(errorString)) - errorString = ASCIILiteral("Internal error"); + *errorString = ASCIILiteral("Internal error"); return; } - *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTF::move(resultValue)); + *result = Inspector::TypeBuilder::Debugger::FunctionDetails::runtimeCast(resultValue); } -void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties) +void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<Array<Inspector::TypeBuilder::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(WTF::move(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"); + if (!result || result->type() != InspectorValue::TypeArray) { + *errorString = ASCIILiteral("Internal error"); return; } - *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTF::move(result)); + *properties = Array<Inspector::TypeBuilder::Runtime::PropertyDescriptor>::runtimeCast(result); } -void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties) +void InjectedScript::getInternalProperties(ErrorString* errorString, const String& objectId, RefPtr<Array<Inspector::TypeBuilder::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"); + if (!result || result->type() != InspectorValue::TypeArray) { + *errorString = ASCIILiteral("Internal error"); return; } - auto array = BindingTraits<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTF::move(result)); - *properties = array->length() > 0 ? array : nullptr; + RefPtr<Array<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor>> array = Array<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor>::runtimeCast(result); + if (array->length() > 0) + *properties = array; } -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(WTF::move(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) +PassRefPtr<Array<Inspector::TypeBuilder::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames) { ASSERT(!hasNoValue()); Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("wrapCallFrames"), inspectorEnvironment()->functionCallHandler()); @@ -204,13 +151,13 @@ Ref<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFra 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(WTF::move(result)).releaseNonNull(); + if (result->type() == InspectorValue::TypeArray) + return Array<Inspector::TypeBuilder::Debugger::CallFrame>::runtimeCast(result); - return Array<Inspector::Protocol::Debugger::CallFrame>::create(); + return Array<Inspector::TypeBuilder::Debugger::CallFrame>::create(); } -RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const +PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const Deprecated::ScriptValue& value, const String& groupName, bool generatePreview) const { ASSERT(!hasNoValue()); Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapObject"), inspectorEnvironment()->functionCallHandler()); @@ -224,14 +171,11 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(co 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<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject(); + return Inspector::TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); } -RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const +PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const { ASSERT(!hasNoValue()); Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapTable"), inspectorEnvironment()->functionCallHandler()); @@ -247,28 +191,8 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(con 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); + RefPtr<InspectorObject> rawResult = r.toInspectorValue(scriptState())->asObject(); + return Inspector::TypeBuilder::Runtime::RemoteObject::runtimeCast(rawResult); } Deprecated::ScriptValue InjectedScript::findObjectById(const String& objectId) const @@ -314,3 +238,4 @@ void InjectedScript::releaseObjectGroup(const String& objectGroup) } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InjectedScript.h b/Source/JavaScriptCore/inspector/InjectedScript.h index bd43f720c..4c58b19e5 100644 --- a/Source/JavaScriptCore/inspector/InjectedScript.h +++ b/Source/JavaScriptCore/inspector/InjectedScript.h @@ -32,9 +32,13 @@ #ifndef InjectedScript_h #define InjectedScript_h +#if ENABLE(INSPECTOR) + #include "InjectedScriptBase.h" +#include "InspectorJSTypeBuilders.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace Deprecated { @@ -52,22 +56,16 @@ public: 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&); - 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 evaluate(ErrorString*, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); + void callFunctionOn(ErrorString*, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::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, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); + void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result); + void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::PropertyDescriptor>>* result); + void getInternalProperties(ErrorString*, const String& objectId, RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::InternalPropertyDescriptor>>* result); - void setExceptionValue(const Deprecated::ScriptValue&); - void clearExceptionValue(); + PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&); + PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapObject(const Deprecated::ScriptValue&, const String& groupName, bool generatePreview = false) const; + PassRefPtr<TypeBuilder::Runtime::RemoteObject> wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const; Deprecated::ScriptValue findObjectById(const String& objectId) const; void inspectObject(Deprecated::ScriptValue); @@ -80,4 +78,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // InjectedScript_h diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp index 2dd5643de..c2a494728 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp +++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.cpp @@ -32,9 +32,9 @@ #include "config.h" #include "InjectedScriptBase.h" -#include "DebuggerEvalEnabler.h" +#if ENABLE(INSPECTOR) + #include "InspectorValues.h" -#include "JSCInlines.h" #include "JSGlobalObject.h" #include "ScriptFunctionCall.h" #include <wtf/text/WTFString.h> @@ -80,15 +80,21 @@ Deprecated::ScriptValue InjectedScriptBase::callFunctionWithEvalEnabled(Deprecat m_environment->willCallInjectedScriptFunction(m_injectedScriptObject.scriptState(), name(), 1); JSC::ExecState* scriptState = m_injectedScriptObject.scriptState(); - Deprecated::ScriptValue resultValue; - - { - JSC::DebuggerEvalEnabler evalEnabler(scriptState); - resultValue = function.call(hadException); + bool evalIsDisabled = false; + if (scriptState) { + evalIsDisabled = !scriptState->lexicalGlobalObject()->evalEnabled(); + // Temporarily enable allow evals for inspector. + if (evalIsDisabled) + scriptState->lexicalGlobalObject()->setEvalEnabled(true); } + Deprecated::ScriptValue resultValue = function.call(hadException); + + if (evalIsDisabled) + scriptState->lexicalGlobalObject()->setEvalEnabled(false); + if (m_environment) - m_environment->didCallInjectedScriptFunction(m_injectedScriptObject.scriptState()); + m_environment->didCallInjectedScriptFunction(); return resultValue; } @@ -112,48 +118,38 @@ void InjectedScriptBase::makeCall(Deprecated::ScriptFunctionCall& function, RefP *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) +void InjectedScriptBase::makeEvalCall(ErrorString* errorString, Deprecated::ScriptFunctionCall& function, RefPtr<TypeBuilder::Runtime::RemoteObject>* objectResult, TypeBuilder::OptOutput<bool>* wasThrown) { RefPtr<InspectorValue> result; makeCall(function, &result); if (!result) { - errorString = ASCIILiteral("Internal error: result value is empty"); + *errorString = ASCIILiteral("Internal error: result value is empty"); return; } - if (result->type() == InspectorValue::Type::String) { + if (result->type() == InspectorValue::TypeString) { result->asString(errorString); - ASSERT(errorString.length()); + ASSERT(errorString->length()); return; } - RefPtr<InspectorObject> resultTuple; - if (!result->asObject(resultTuple)) { - errorString = ASCIILiteral("Internal error: result is not an Object"); + RefPtr<InspectorObject> resultPair = result->asObject(); + if (!resultPair) { + *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"); + RefPtr<InspectorObject> resultObj = resultPair->getObject(ASCIILiteral("result")); + bool wasThrownVal = false; + if (!resultObj || !resultPair->getBoolean(ASCIILiteral("wasThrown"), &wasThrownVal)) { + *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; - } + *objectResult = TypeBuilder::Runtime::RemoteObject::runtimeCast(resultObj); + *wasThrown = wasThrownVal; } } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InjectedScriptBase.h b/Source/JavaScriptCore/inspector/InjectedScriptBase.h index 06c3f5664..034e0c20a 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptBase.h +++ b/Source/JavaScriptCore/inspector/InjectedScriptBase.h @@ -32,8 +32,10 @@ #ifndef InjectedScriptBase_h #define InjectedScriptBase_h +#if ENABLE(INSPECTOR) + #include "InspectorEnvironment.h" -#include "InspectorProtocolObjects.h" +#include "InspectorJSTypeBuilders.h" #include "bindings/ScriptObject.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -66,7 +68,7 @@ protected: 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); + void makeEvalCall(ErrorString*, Deprecated::ScriptFunctionCall&, RefPtr<TypeBuilder::Runtime::RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); private: String m_name; @@ -76,4 +78,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // InjectedScriptBase_h diff --git a/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp b/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp index 6351472e0..46b3c4e37 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp +++ b/Source/JavaScriptCore/inspector/InjectedScriptHost.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "InjectedScriptHost.h" +#if ENABLE(INSPECTOR) + #include "JSInjectedScriptHost.h" using namespace JSC; @@ -70,10 +72,12 @@ void InjectedScriptHost::clearWrapper(ExecState* exec, JSGlobalObject* globalObj void InjectedScriptHost::clearAllWrappers() { - for (auto& wrapper : m_wrappers) + for (auto wrapper : m_wrappers) clearWrapperFromValue(wrapper.value.get()); m_wrappers.clear(); } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InjectedScriptHost.h b/Source/JavaScriptCore/inspector/InjectedScriptHost.h index ae530a202..db93f8631 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptHost.h +++ b/Source/JavaScriptCore/inspector/InjectedScriptHost.h @@ -26,6 +26,8 @@ #ifndef InjectedScriptHost_h #define InjectedScriptHost_h +#if ENABLE(INSPECTOR) + #include "JSCJSValueInlines.h" #include "Strong.h" #include "StrongInlines.h" @@ -36,10 +38,10 @@ namespace Inspector { class JS_EXPORT_PRIVATE InjectedScriptHost : public RefCounted<InjectedScriptHost> { public: - static Ref<InjectedScriptHost> create() { return adoptRef(*new InjectedScriptHost); } + static PassRefPtr<InjectedScriptHost> create() { return adoptRef(new InjectedScriptHost); } virtual ~InjectedScriptHost(); - virtual JSC::JSValue subtype(JSC::ExecState*, JSC::JSValue) { return JSC::jsUndefined(); } + virtual JSC::JSValue type(JSC::ExecState*, JSC::JSValue) { return JSC::jsUndefined(); } virtual bool isHTMLAllCollection(JSC::JSValue) { return false; } JSC::JSValue jsWrapper(JSC::ExecState*, JSC::JSGlobalObject*); @@ -52,4 +54,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(InjectedScriptHost_h) diff --git a/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp b/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp index 1bac2ecbd..72d20df3e 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp +++ b/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -31,6 +31,8 @@ #include "config.h" #include "InjectedScriptManager.h" +#if ENABLE(INSPECTOR) + #include "Completion.h" #include "InjectedScriptHost.h" #include "InjectedScriptSource.h" @@ -58,6 +60,7 @@ InjectedScriptManager::~InjectedScriptManager() void InjectedScriptManager::disconnect() { discardInjectedScripts(); + m_injectedScriptHost = nullptr; } InjectedScriptHost* InjectedScriptManager::injectedScriptHost() @@ -92,19 +95,15 @@ int InjectedScriptManager::injectedScriptIdFor(ExecState* scriptState) 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(); + RefPtr<InspectorValue> parsedObjectId = InspectorValue::parseJSON(objectId); + if (parsedObjectId && parsedObjectId->type() == InspectorValue::TypeObject) { + long injectedScriptId = 0; + bool success = parsedObjectId->asObject()->getNumber(ASCIILiteral("injectedScriptId"), &injectedScriptId); + if (success) + return m_idToInjectedScript.get(injectedScriptId); + } - return m_idToInjectedScript.get(injectedScriptId); + return InjectedScript(); } void InjectedScriptManager::discardInjectedScripts() @@ -116,19 +115,13 @@ void InjectedScriptManager::discardInjectedScripts() 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(); + for (auto it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it) + it->value.releaseObjectGroup(objectGroup); } String InjectedScriptManager::injectedScriptSource() { - return StringImpl::createWithoutCopying(InjectedScriptSource_js, sizeof(InjectedScriptSource_js)); + return String(reinterpret_cast<const char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js)); } Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const String& source, ExecState* scriptState, int id) @@ -139,9 +132,9 @@ Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const Strin JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); JSValue globalThisValue = scriptState->globalThisValue(); - NakedPtr<Exception> evaluationException; + JSValue evaluationException; InspectorEvaluateHandler evaluateHandler = m_environment.evaluateHandler(); - JSValue functionValue = evaluateHandler(scriptState, sourceCode, globalThisValue, evaluationException); + JSValue functionValue = evaluateHandler(scriptState, sourceCode, globalThisValue, &evaluationException); if (evaluationException) return Deprecated::ScriptObject(); @@ -156,7 +149,6 @@ Deprecated::ScriptObject InjectedScriptManager::createInjectedScript(const Strin 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()); @@ -190,3 +182,4 @@ void InjectedScriptManager::didCreateInjectedScript(InjectedScript) } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InjectedScriptManager.h b/Source/JavaScriptCore/inspector/InjectedScriptManager.h index cb6c9b3b9..bcc64e2a4 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptManager.h +++ b/Source/JavaScriptCore/inspector/InjectedScriptManager.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -64,7 +64,6 @@ public: InjectedScript injectedScriptForObjectId(const String& objectId); void discardInjectedScripts(); void releaseObjectGroup(const String& objectGroup); - void clearExceptionValue(); protected: virtual void didCreateInjectedScript(InjectedScript); diff --git a/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp b/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp index 5ba27e080..f2b29d255 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp +++ b/Source/JavaScriptCore/inspector/InjectedScriptModule.cpp @@ -32,6 +32,8 @@ #include "config.h" #include "InjectedScriptModule.h" +#if ENABLE(INSPECTOR) + #include "InjectedScript.h" #include "InjectedScriptManager.h" #include "ScriptFunctionCall.h" @@ -61,7 +63,6 @@ void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptM 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; @@ -86,3 +87,5 @@ void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptM } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InjectedScriptModule.h b/Source/JavaScriptCore/inspector/InjectedScriptModule.h index e8881b9ec..a170e798d 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptModule.h +++ b/Source/JavaScriptCore/inspector/InjectedScriptModule.h @@ -35,6 +35,8 @@ #include "InjectedScriptBase.h" #include <wtf/text/WTFString.h> +#if ENABLE(INSPECTOR) + namespace JSC { class JSValue; } @@ -62,4 +64,6 @@ protected: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // InjectedScriptModule_h diff --git a/Source/JavaScriptCore/inspector/InjectedScriptSource.js b/Source/JavaScriptCore/inspector/InjectedScriptSource.js index 55874a633..7bff7f6d4 100644 --- a/Source/JavaScriptCore/inspector/InjectedScriptSource.js +++ b/Source/JavaScriptCore/inspector/InjectedScriptSource.js @@ -1,6 +1,5 @@ /* - * Copyright (C) 2007, 2014-2015 Apple Inc. All rights reserved. - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -11,7 +10,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -29,36 +28,19 @@ //# sourceURL=__WebInspectorInjectedScript__ +/** + * @param {InjectedScriptHost} InjectedScriptHost + * @param {GlobalObject} inspectedGlobalObject + * @param {number} injectedScriptId + */ (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 isSymbol(obj) -{ - return typeof obj === "symbol"; -} - +/** + * @constructor + */ var InjectedScript = function() { this._lastBoundObjectId = 1; @@ -66,30 +48,37 @@ var InjectedScript = function() this._idToObjectGroupName = {}; this._objectGroups = {}; this._modules = {}; - this._nextSavedResultIndex = 1; - this._savedResults = []; } +/** + * @type {Object.<string, boolean>} + * @const + */ 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. + string: true } InjectedScript.prototype = { + /** + * @param {*} object + * @return {boolean} + */ isPrimitiveValue: function(object) { // FIXME(33716): typeof document.all is always 'undefined'. return InjectedScript.primitiveTypes[typeof object] && !this._isHTMLAllCollection(object); }, + /** + * @param {*} object + * @param {string} groupName + * @param {boolean} canAccessInspectedGlobalObject + * @param {boolean} generatePreview + * @return {!RuntimeAgent.RemoteObject} + */ wrapObject: function(object, groupName, canAccessInspectedGlobalObject, generatePreview) { if (canAccessInspectedGlobalObject) @@ -97,16 +86,10 @@ InjectedScript.prototype = { return this._fallbackWrapper(object); }, - setExceptionValue: function(value) - { - this._exceptionValue = value; - }, - - clearExceptionValue: function() - { - delete this._exceptionValue; - }, - + /** + * @param {*} object + * @return {!RuntimeAgent.RemoteObject} + */ _fallbackWrapper: function(object) { var result = {}; @@ -114,38 +97,50 @@ InjectedScript.prototype = { if (this.isPrimitiveValue(object)) result.value = object; else - result.description = toString(object); - return result; + result.description = this._toString(object); + return /** @type {!RuntimeAgent.RemoteObject} */ (result); }, + /** + * @param {boolean} canAccessInspectedGlobalObject + * @param {Object} table + * @param {Array.<string>|string|boolean} columns + * @return {!RuntimeAgent.RemoteObject} + */ 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") { + if (InjectedScriptHost.type(columns) == "array") { columnNames = []; for (var i = 0; i < columns.length; ++i) - columnNames.push(toString(columns[i])); + columnNames.push(String(columns[i])); } - return this._wrapObject(table, "console", false, true, columnNames); }, + /** + * @param {*} object + */ inspectObject: function(object) { if (this._commandLineAPIImpl) this._commandLineAPIImpl.inspect(object); }, + /** + * This method cannot throw. + * @param {*} object + * @param {string=} objectGroupName + * @param {boolean=} forceValueType + * @param {boolean=} generatePreview + * @param {?Array.<string>=} columnNames + * @return {!RuntimeAgent.RemoteObject} + * @suppress {checkTypes} + */ _wrapObject: function(object, objectGroupName, forceValueType, generatePreview, columnNames) { try { @@ -160,6 +155,11 @@ InjectedScript.prototype = { } }, + /** + * @param {*} object + * @param {string=} objectGroupName + * @return {string} + */ _bind: function(object, objectGroupName) { var id = this._lastBoundObjectId++; @@ -177,34 +177,39 @@ InjectedScript.prototype = { return objectId; }, + /** + * @param {string} objectId + * @return {Object} + */ _parseObjectId: function(objectId) { return InjectedScriptHost.evaluate("(" + objectId + ")"); }, + /** + * @param {string} objectGroupName + */ 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]; }, + /** + * @param {string} methodName + * @param {string} args + * @return {*} + */ dispatch: function(methodName, args) { var argsArray = InjectedScriptHost.evaluate("(" + args + ")"); var result = this[methodName].apply(this, argsArray); if (typeof result === "undefined") { + // FIXME: JS Context inspection currently does not have a global.console object. if (inspectedGlobalObject.console) inspectedGlobalObject.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName); result = null; @@ -212,7 +217,12 @@ InjectedScript.prototype = { return result; }, - _getProperties: function(objectId, collectionMode, generatePreview) + /** + * @param {string} objectId + * @param {boolean} ownProperties + * @return {Array.<RuntimeAgent.PropertyDescriptor>|boolean} + */ + getProperties: function(objectId, ownProperties) { var parsedObjectId = this._parseObjectId(objectId); var object = this._objectForId(parsedObjectId); @@ -220,11 +230,7 @@ InjectedScript.prototype = { if (!this._isDefined(object)) return false; - - if (isSymbol(object)) - return false; - - var descriptors = this._propertyDescriptors(object, collectionMode); + var descriptors = this._propertyDescriptors(object, ownProperties); // Go over properties, wrap object values. for (var i = 0; i < descriptors.length; ++i) { @@ -234,90 +240,45 @@ InjectedScript.prototype = { if ("set" in descriptor) descriptor.set = this._wrapObject(descriptor.set, objectGroupName); if ("value" in descriptor) - descriptor.value = this._wrapObject(descriptor.value, objectGroupName, false, generatePreview); + descriptor.value = this._wrapObject(descriptor.value, objectGroupName); 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) + /** + * @param {string} objectId + * @return {Array.<Object>|boolean} + */ + getInternalProperties: function(objectId, ownProperties) { 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); + var descriptors = []; + var internalProperties = InjectedScriptHost.getInternalProperties(object); + if (internalProperties) { + for (var i = 0; i < internalProperties.length; i++) { + var property = internalProperties[i]; + var descriptor = { + name: property.name, + value: this._wrapObject(property.value, objectGroupName) + }; + descriptors.push(descriptor); + } } - 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; - }, - + /** + * @param {string} functionId + * @return {!DebuggerAgent.FunctionDetails|string} + */ getFunctionDetails: function(functionId) { var parsedFunctionId = this._parseObjectId(functionId); @@ -339,24 +300,96 @@ InjectedScript.prototype = { return details; }, + /** + * @param {string} objectId + */ releaseObject: function(objectId) { var parsedObjectId = this._parseObjectId(objectId); this._releaseObject(parsedObjectId.id); }, + /** + * @param {string} id + */ _releaseObject: function(id) { delete this._idToWrappedObject[id]; delete this._idToObjectGroupName[id]; }, - evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult) + /** + * @param {Object} object + * @param {boolean} ownProperties + * @return {Array.<Object>} + */ + _propertyDescriptors: function(object, ownProperties) { - return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview, saveResult); + var descriptors = []; + var nameProcessed = {}; + nameProcessed["__proto__"] = null; + for (var o = object; this._isDefined(o); o = o.__proto__) { + var names = Object.getOwnPropertyNames(/** @type {!Object} */ (o)); + for (var i = 0; i < names.length; ++i) { + var name = names[i]; + if (nameProcessed[name]) + continue; + + try { + nameProcessed[name] = true; + var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */ (object), name); + if (!descriptor) { + // Not all bindings provide proper descriptors. Fall back to the writable, configurable property. + try { + descriptor = { name: name, value: object[name], writable: false, configurable: false, enumerable: false}; + if (o === object) + descriptor.isOwn = true; + descriptors.push(descriptor); + } catch (e) { + // Silent catch. + } + continue; + } + } catch (e) { + var descriptor = {}; + descriptor.value = e; + descriptor.wasThrown = true; + } + + descriptor.name = name; + if (o === object) + descriptor.isOwn = true; + descriptors.push(descriptor); + } + if (ownProperties) { + if (object.__proto__) + descriptors.push({ name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false, isOwn: true}); + break; + } + } + return descriptors; }, - callFunctionOn: function(objectId, expression, args, returnByValue, generatePreview) + /** + * @param {string} expression + * @param {string} objectGroup + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @param {boolean} generatePreview + * @return {*} + */ + evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview) + { + return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview); + }, + + /** + * @param {string} objectId + * @param {string} expression + * @param {boolean} returnByValue + * @return {Object|string} + */ + callFunctionOn: function(objectId, expression, args, returnByValue) { var parsedObjectId = this._parseObjectId(objectId); var object = this._objectForId(parsedObjectId); @@ -365,13 +398,15 @@ InjectedScript.prototype = { if (args) { var resolvedArgs = []; - var callArgs = InjectedScriptHost.evaluate(args); - for (var i = 0; i < callArgs.length; ++i) { + args = InjectedScriptHost.evaluate(args); + for (var i = 0; i < args.length; ++i) { + var resolvedCallArgument; try { - resolvedArgs[i] = this._resolveCallArgument(callArgs[i]); + resolvedCallArgument = this._resolveCallArgument(args[i]); } catch (e) { return String(e); } + resolvedArgs.push(resolvedCallArgument) } } @@ -381,21 +416,21 @@ InjectedScript.prototype = { 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) - }; + return { wasThrown: false, + result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue) }; } catch (e) { return this._createThrownValue(e, objectGroup); } }, - _resolveCallArgument: function(callArgumentJSON) - { - if ("value" in callArgumentJSON) - return callArgumentJSON.value; - - var objectId = callArgumentJSON.objectId; + /** + * Resolves a value from CallArgument description. + * @param {RuntimeAgent.CallArgument} callArgumentJson + * @return {*} resolved value + * @throws {string} error message + */ + _resolveCallArgument: function(callArgumentJson) { + var objectId = callArgumentJson.objectId; if (objectId) { var parsedArgId = this._parseObjectId(objectId); if (!parsedArgId || parsedArgId["injectedScriptId"] !== injectedScriptId) @@ -406,43 +441,57 @@ InjectedScript.prototype = { throw "Could not find object with given id"; return resolvedArg; - } - - return undefined; + } else if ("value" in callArgumentJson) + return callArgumentJson.value; + else + return undefined; }, - _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, saveResult) + /** + * @param {Function} evalFunction + * @param {Object} object + * @param {string} objectGroup + * @param {boolean} isEvalOnCallFrame + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @param {boolean} generatePreview + * @return {*} + */ + _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview) { 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; + return { wasThrown: false, + result: this._wrapObject(this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGroup, returnByValue, generatePreview) }; } catch (e) { return this._createThrownValue(e, objectGroup); } }, + /** + * @param {*} value + * @param {string} objectGroup + * @return {Object} + */ _createThrownValue: function(value, objectGroup) { var remoteObject = this._wrapObject(value, objectGroup); try { - remoteObject.description = toStringDescription(value); + remoteObject.description = this._toString(value); } catch (e) {} - return { - wasThrown: true, - result: remoteObject - }; + return { wasThrown: true, + result: remoteObject }; }, - _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, saveResult) + /** + * @param {Function} evalFunction + * @param {Object} object + * @param {string} objectGroup + * @param {string} expression + * @param {boolean} isEvalOnCallFrame + * @param {boolean} injectCommandLineAPI + * @return {*} + */ + _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI) { var commandLineAPI = null; if (injectCommandLineAPI) { @@ -487,8 +536,8 @@ InjectedScript.prototype = { var expressionFunction = evalFunction.call(object, boundExpressionFunctionString); var result = expressionFunction.apply(null, parameters); - if (objectGroup === "console" && saveResult) - this._saveResult(result); + if (objectGroup === "console") + this._lastResult = result; return result; } @@ -496,6 +545,7 @@ InjectedScript.prototype = { // 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. + // FIXME: JS Context inspection currently does not have a global.console object. try { if (commandLineAPI) { if (inspectedGlobalObject.console) @@ -507,8 +557,8 @@ InjectedScript.prototype = { var result = evalFunction.call(inspectedGlobalObject, expression); - if (objectGroup === "console" && saveResult) - this._saveResult(result); + if (objectGroup === "console") + this._lastResult = result; return result; } finally { @@ -521,6 +571,10 @@ InjectedScript.prototype = { } }, + /** + * @param {Object} callFrame + * @return {Array.<InjectedScript.CallFrameProxy>|boolean} + */ wrapCallFrames: function(callFrame) { if (!callFrame) @@ -535,14 +589,29 @@ InjectedScript.prototype = { return result; }, - evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview, saveResult) + /** + * @param {Object} topCallFrame + * @param {string} callFrameId + * @param {string} expression + * @param {string} objectGroup + * @param {boolean} injectCommandLineAPI + * @param {boolean} returnByValue + * @param {boolean} generatePreview + * @return {*} + */ + evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview) { 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); + return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview); }, + /** + * @param {Object} topCallFrame + * @param {string} callFrameId + * @return {Object} + */ _callFrameForId: function(topCallFrame, callFrameId) { var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")"); @@ -553,215 +622,89 @@ InjectedScript.prototype = { return callFrame; }, + /** + * @param {Object} objectId + * @return {Object} + */ _objectForId: function(objectId) { return this._idToWrappedObject[objectId.id]; }, + /** + * @param {string} objectId + * @return {Object} + */ findObjectById: function(objectId) { var parsedObjectId = this._parseObjectId(objectId); return this._objectForId(parsedObjectId); }, + /** + * @param {string} name + * @return {Object} + */ module: function(name) { return this._modules[name]; }, + /** + * @param {string} name + * @param {string} source + * @return {Object} + */ injectModule: function(name, source, host) { delete this._modules[name]; - var moduleFunction = InjectedScriptHost.evaluate("(" + source + ")"); if (typeof moduleFunction !== "function") { + // FIXME: JS Context inspection currently does not have a global.console object. 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 (descriptor.hasOwnProperty("get") && descriptor.hasOwnProperty("set") && !descriptor.get && !descriptor.set) { - // FIXME: <https://webkit.org/b/140575> Web Inspector: Native Bindings Descriptors are Incomplete - // 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; - }, - + /** + * @param {*} object + * @return {boolean} + */ _isDefined: function(object) { return !!object || this._isHTMLAllCollection(object); }, + /** + * @param {*} object + * @return {boolean} + */ _isHTMLAllCollection: function(object) { // document.all is reported as undefined, but we still want to process it. return (typeof object === "undefined") && InjectedScriptHost.isHTMLAllCollection(object); }, + /** + * @param {Object=} obj + * @return {string?} + */ _subtype: function(obj) { if (obj === null) return "null"; - if (this.isPrimitiveValue(obj) || isSymbol(obj)) + if (this.isPrimitiveValue(obj)) return null; if (this._isHTMLAllCollection(obj)) return "array"; - var preciseType = InjectedScriptHost.subtype(obj); + var preciseType = InjectedScriptHost.type(obj); if (preciseType) return preciseType; @@ -769,644 +712,321 @@ InjectedScript.prototype = { try { if (typeof obj.splice === "function" && isFinite(obj.length)) return "array"; + if (Object.prototype.toString.call(obj) === "[object Arguments]" && isFinite(obj.length)) // arguments. + return "array"; } catch (e) { } + // If owning frame has navigated to somewhere else window properties will be undefined. 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() + "\">"; - 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; - } - }, - + /** + * @param {*} obj + * @return {string?} + */ _describe: function(obj) { if (this.isPrimitiveValue(obj)) return null; - if (isSymbol(obj)) - return toString(obj); + obj = /** @type {Object} */ (obj); + // Type is object, get subtype. var subtype = this._subtype(obj); if (subtype === "regexp") - return toString(obj); + return this._toString(obj); if (subtype === "date") - return toString(obj); - - if (subtype === "error") - return toString(obj); - - if (subtype === "node") - return this._nodeDescription(obj); + return this._toString(obj); + + if (subtype === "node") { + var description = obj.nodeName.toLowerCase(); + switch (obj.nodeType) { + case 1 /* Node.ELEMENT_NODE */: + description += obj.id ? "#" + obj.id : ""; + var className = obj.className; + description += className ? "." + className : ""; + break; + case 10 /*Node.DOCUMENT_TYPE_NODE */: + description = "<!DOCTYPE " + description + ">"; + break; + } + return description; + } var className = InjectedScriptHost.internalConstructorName(obj); - if (subtype === "array") + if (subtype === "array") { + if (typeof obj.length === "number") + className += "[" + obj.length + "]"; return className; + } // NodeList in JSC is a function, check for array prior to this. if (typeof obj === "function") - return toString(obj); + return this._toString(obj); - // If Object, try for a better name from the constructor. if (className === "Object") { + // In Chromium DOM wrapper prototypes will have Object as their constructor name, + // get the real DOM wrapper name from the constructor property. 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) + /** + * @param {*} obj + * @return {string} + */ + _toString: function(obj) { - return this._savedResults[index]; + // We don't use String(obj) because inspectedGlobalObject.String is undefined if owning frame navigated to another page. + return "" + obj; } } -var injectedScript = new InjectedScript; - - +/** + * @type {InjectedScript} + * @const + */ +var injectedScript = new InjectedScript(); + +/** + * @constructor + * @param {*} object + * @param {string=} objectGroupName + * @param {boolean=} forceValueType + * @param {boolean=} generatePreview + * @param {?Array.<string>=} columnNames + */ 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") + if (typeof object !== "undefined") this.value = object; - // Null object is object with 'null' subtype. + // 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); + if (typeof object === "number") + this.description = object + ""; return; } - this.objectId = injectedScript._bind(object, objectGroupName); + object = /** @type {Object} */ (object); + 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") + if (generatePreview && (this.type === "object" || injectedScript._isHTMLAllCollection(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(); - }, - + /** + * @param {Object} object + * @param {Array.<string>=} firstLevelKeys + * @param {?Array.<string>=} secondLevelKeys + * @return {Object} preview + */ _generatePreview: function(object, firstLevelKeys, secondLevelKeys) { - var preview = this._initialPreview(); - - // Primitives just have a value. - if (this.type !== "object") - return; + var preview = {}; + preview.lossless = true; + preview.overflow = false; + preview.properties = []; 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) + indexes: isTableRowsRequest ? 1000 : Math.max(100, 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; - } - + for (var o = object; injectedScript._isDefined(o); o = o.__proto__) + this._generateProtoPreview(o, preview, propertiesThreshold, firstLevelKeys, secondLevelKeys); return preview; }, - _appendPropertyPreviews: function(object, preview, descriptors, internal, propertiesThreshold, firstLevelKeys, secondLevelKeys) + /** + * @param {Object} object + * @param {Object} preview + * @param {Object} propertiesThreshold + * @param {Array.<string>=} firstLevelKeys + * @param {Array.<string>=} secondLevelKeys + */ + _generateProtoPreview: function(object, preview, 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); + var propertyNames = firstLevelKeys ? firstLevelKeys : Object.keys(/** @type {!Object} */(object)); + try { + for (var i = 0; i < propertyNames.length; ++i) { + if (!propertiesThreshold.properties || !propertiesThreshold.indexes) { + preview.overflow = true; preview.lossless = false; + break; } - this._appendPropertyPreview(preview, internal, {name, type, value: toStringDescription(value)}, propertiesThreshold); - continue; - } + var name = propertyNames[i]; + if (this.subtype === "array" && name === "length") + continue; - // Symbol. - if (isSymbol(value)) { - var symbolString = toString(value); - if (symbolString.length > maxLength) { - symbolString = this._abbreviateString(symbolString, maxLength, true); + var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */(object), name); + if (!("value" in descriptor) || !descriptor.enumerable) { preview.lossless = false; + continue; } - this._appendPropertyPreview(preview, internal, {name, type, value: symbolString}, propertiesThreshold); - return; - } - // 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"); + var value = descriptor.value; + if (value === null) { + this._appendPropertyPreview(preview, { name: name, type: "object", value: "null" }, propertiesThreshold); + continue; } - 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; + const maxLength = 100; + var type = typeof value; + + if (InjectedScript.primitiveTypes[type]) { + if (type === "string") { + if (value.length > maxLength) { + value = this._abbreviateString(value, maxLength, true); + preview.lossless = false; + } + value = value.replace(/\n/g, "\u21B5"); + } + this._appendPropertyPreview(preview, { name: name, type: type, value: value + "" }, propertiesThreshold); + continue; + } - if (entries.length > 5) { - entries.pop(); - preview.overflow = true; - preview.lossless = false; - } + if (secondLevelKeys === null || secondLevelKeys) { + var subPreview = this._generatePreview(value, secondLevelKeys || undefined); + var property = { name: name, type: type, valuePreview: subPreview }; + this._appendPropertyPreview(preview, property, propertiesThreshold); + if (!subPreview.lossless) + preview.lossless = false; + if (subPreview.overflow) + preview.overflow = true; + continue; + } - 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); + var subtype = injectedScript._subtype(value); + var description = ""; + if (type !== "function") + description = this._abbreviateString(/** @type {string} */ (injectedScript._describe(value)), maxLength, subtype === "regexp"); - // 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; + var property = { name: name, type: type, value: description }; + if (subtype) + property.subtype = subtype; + this._appendPropertyPreview(preview, property, propertiesThreshold); } - 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; + } catch (e) { } + }, - return true; + /** + * @param {Object} preview + * @param {Object} property + * @param {Object} propertiesThreshold + */ + _appendPropertyPreview: function(preview, property, propertiesThreshold) + { + if (isNaN(property.name)) + propertiesThreshold.properties--; + else + propertiesThreshold.indexes--; + preview.properties.push(property); }, + /** + * @param {string} string + * @param {number} maxLength + * @param {boolean=} middle + * @returns + */ _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"; } } - +/** + * @constructor + * @param {number} ordinal + * @param {Object} callFrame + */ InjectedScript.CallFrameProxy = function(ordinal, callFrame) { this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}"; this.functionName = (callFrame.type === "function" ? callFrame.functionName : ""); - this.location = {scriptId: String(callFrame.sourceID), lineNumber: callFrame.line, columnNumber: callFrame.column}; + 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 = { + /** + * @param {Object} callFrame + * @return {!Array.<DebuggerAgent.Scope>} + */ _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"); + for (var i = 0; i < scopeChain.length; i++) { + var scope = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace"); + scopeChainProxy.push(scope); + } return scopeChainProxy; } } -InjectedScript.CallFrameProxy._scopeTypeNames = { - 0: "global", // GLOBAL_SCOPE - 1: "local", // LOCAL_SCOPE - 2: "with", // WITH_SCOPE - 3: "closure", // CLOSURE_SCOPE - 4: "catch", // CATCH_SCOPE - 5: "functionName", // FUNCTION_NAME_SCOPE -} +/** + * @param {number} scopeTypeCode + * @param {*} scopeObject + * @param {string} groupId + * @return {!DebuggerAgent.Scope} + */ +InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) { + const GLOBAL_SCOPE = 0; + const LOCAL_SCOPE = 1; + const WITH_SCOPE = 2; + const CLOSURE_SCOPE = 3; + const CATCH_SCOPE = 4; + + /** @type {!Object.<number, string>} */ + var scopeTypeNames = {}; + scopeTypeNames[GLOBAL_SCOPE] = "global"; + scopeTypeNames[LOCAL_SCOPE] = "local"; + scopeTypeNames[WITH_SCOPE] = "with"; + scopeTypeNames[CLOSURE_SCOPE] = "closure"; + scopeTypeNames[CATCH_SCOPE] = "catch"; -InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) -{ return { object: injectedScript._wrapObject(scopeObject, groupId), - type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode] + type: /** @type {DebuggerAgent.ScopeType} */ (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 index 63404cf54..f6b6c55cb 100644 --- a/Source/JavaScriptCore/inspector/InspectorAgentBase.h +++ b/Source/JavaScriptCore/inspector/InspectorAgentBase.h @@ -31,10 +31,10 @@ namespace Inspector { -class BackendDispatcher; -class FrontendChannel; +class InspectorBackendDispatcher; +class InspectorFrontendChannel; -enum class DisconnectReason { +enum class InspectorDisconnectReason { InspectedTargetDestroyed, InspectorDestroyed }; @@ -43,10 +43,8 @@ class InspectorAgentBase { public: virtual ~InspectorAgentBase() { } - String domainName() const { return m_name; } - - virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*) = 0; - virtual void willDestroyFrontendAndBackend(DisconnectReason) = 0; + virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) = 0; + virtual void willDestroyFrontendAndBackend(InspectorDisconnectReason reason) = 0; virtual void discardAgent() { } protected: @@ -57,7 +55,7 @@ protected: String m_name; }; - + } // namespace Inspector #endif // !defined(InspectorAgentBase_h) diff --git a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp index bcc098821..e0d9ede15 100644 --- a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp +++ b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp @@ -27,41 +27,34 @@ #include "config.h" #include "InspectorAgentRegistry.h" +#if ENABLE(INSPECTOR) + #include "InspectorAgentBase.h" namespace Inspector { -AgentRegistry::AgentRegistry() +InspectorAgentRegistry::InspectorAgentRegistry() { } -void AgentRegistry::append(std::unique_ptr<InspectorAgentBase> agent) +void InspectorAgentRegistry::append(std::unique_ptr<InspectorAgentBase> agent) { - m_agents.append(WTF::move(agent)); -} - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) -void AgentRegistry::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent) -{ - m_extraDomains.append(agent->domainName()); - - append(WTF::move(agent)); + m_agents.append(std::move(agent)); } -#endif -void AgentRegistry::didCreateFrontendAndBackend(FrontendChannel* frontendChannel, BackendDispatcher* backendDispatcher) +void InspectorAgentRegistry::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher) { for (size_t i = 0; i < m_agents.size(); i++) m_agents[i]->didCreateFrontendAndBackend(frontendChannel, backendDispatcher); } -void AgentRegistry::willDestroyFrontendAndBackend(DisconnectReason reason) +void InspectorAgentRegistry::willDestroyFrontendAndBackend(InspectorDisconnectReason reason) { for (size_t i = 0; i < m_agents.size(); i++) m_agents[i]->willDestroyFrontendAndBackend(reason); } -void AgentRegistry::discardAgents() +void InspectorAgentRegistry::discardAgents() { for (size_t i = 0; i < m_agents.size(); i++) m_agents[i]->discardAgent(); @@ -69,3 +62,4 @@ void AgentRegistry::discardAgents() } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h index 962f006df..17d65e71a 100644 --- a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h +++ b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.h @@ -28,41 +28,31 @@ #define InspectorAgentRegistry_h #include <wtf/Vector.h> -#include <wtf/text/WTFString.h> namespace Inspector { -class BackendDispatcher; -class FrontendChannel; class InspectorAgentBase; +class InspectorBackendDispatcher; +class InspectorFrontendChannel; +enum class InspectorDisconnectReason; -enum class DisconnectReason; - -class JS_EXPORT_PRIVATE AgentRegistry { +class JS_EXPORT_PRIVATE InspectorAgentRegistry { public: - AgentRegistry(); + InspectorAgentRegistry(); void append(std::unique_ptr<InspectorAgentBase>); - void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*); - void willDestroyFrontendAndBackend(DisconnectReason); + void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*); + void willDestroyFrontendAndBackend(InspectorDisconnectReason reason); void discardAgents(); -#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; + InspectorAgentRegistry(const InspectorAgentRegistry&) = delete; + InspectorAgentRegistry& operator=(const InspectorAgentRegistry&) = delete; Vector<std::unique_ptr<InspectorAgentBase>> m_agents; -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - Vector<String> m_extraDomains; -#endif }; } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp index f88cfbdab..30a66f7b3 100644 --- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp +++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp @@ -27,6 +27,8 @@ #include "config.h" #include "InspectorBackendDispatcher.h" +#if ENABLE(INSPECTOR) + #include "InspectorFrontendChannel.h" #include "InspectorValues.h" #include <wtf/text/CString.h> @@ -34,80 +36,80 @@ namespace Inspector { -BackendDispatcher::CallbackBase::CallbackBase(Ref<BackendDispatcher>&& backendDispatcher, int id) - : m_backendDispatcher(WTF::move(backendDispatcher)) +InspectorBackendDispatcher::CallbackBase::CallbackBase(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id) + : m_backendDispatcher(backendDispatcher) , m_id(id) , m_alreadySent(false) { } -bool BackendDispatcher::CallbackBase::isActive() const +bool InspectorBackendDispatcher::CallbackBase::isActive() const { return !m_alreadySent && m_backendDispatcher->isActive(); } -void BackendDispatcher::CallbackBase::sendFailure(const ErrorString& error) +void InspectorBackendDispatcher::CallbackBase::sendFailure(const ErrorString& error) { ASSERT(error.length()); sendIfActive(nullptr, error); } -void BackendDispatcher::CallbackBase::sendIfActive(RefPtr<InspectorObject>&& partialMessage, const ErrorString& invocationError) +void InspectorBackendDispatcher::CallbackBase::sendIfActive(PassRefPtr<InspectorObject> partialMessage, const ErrorString& invocationError) { if (m_alreadySent) return; - m_backendDispatcher->sendResponse(m_id, WTF::move(partialMessage), invocationError); + m_backendDispatcher->sendResponse(m_id, partialMessage, invocationError); m_alreadySent = true; } -Ref<BackendDispatcher> BackendDispatcher::create(FrontendChannel* frontendChannel) +PassRefPtr<InspectorBackendDispatcher> InspectorBackendDispatcher::create(InspectorFrontendChannel* inspectorFrontendChannel) { - return adoptRef(*new BackendDispatcher(frontendChannel)); + return adoptRef(new InspectorBackendDispatcher(inspectorFrontendChannel)); } -void BackendDispatcher::registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher* dispatcher) +void InspectorBackendDispatcher::registerDispatcherForDomain(const String& domain, InspectorSupplementalBackendDispatcher* dispatcher) { auto result = m_dispatchers.add(domain, dispatcher); ASSERT_UNUSED(result, result.isNewEntry); } -void BackendDispatcher::dispatch(const String& message) +void InspectorBackendDispatcher::dispatch(const String& message) { - Ref<BackendDispatcher> protect(*this); + Ref<InspectorBackendDispatcher> protect(*this); - RefPtr<InspectorValue> parsedMessage; - if (!InspectorValue::parseJSON(message, parsedMessage)) { + RefPtr<InspectorValue> parsedMessage = InspectorValue::parseJSON(message); + if (!parsedMessage) { reportProtocolError(nullptr, ParseError, ASCIILiteral("Message must be in JSON format")); return; } - RefPtr<InspectorObject> messageObject; - if (!parsedMessage->asObject(messageObject)) { + RefPtr<InspectorObject> messageObject = parsedMessage->asObject(); + if (!messageObject) { reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("Message must be a JSONified object")); return; } - RefPtr<InspectorValue> callIdValue; - if (!messageObject->getValue(ASCIILiteral("id"), callIdValue)) { + RefPtr<InspectorValue> callIdValue = messageObject->get("id"); + if (!callIdValue) { reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("'id' property was not found")); return; } long callId = 0; - if (!callIdValue->asInteger(callId)) { - reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("The type of 'id' property must be integer")); + if (!callIdValue->asNumber(&callId)) { + reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("The type of 'id' property must be number")); return; } - RefPtr<InspectorValue> methodValue; - if (!messageObject->getValue(ASCIILiteral("method"), methodValue)) { + RefPtr<InspectorValue> methodValue = messageObject->get("method"); + if (!methodValue) { reportProtocolError(&callId, InvalidRequest, ASCIILiteral("'method' property wasn't found")); return; } String method; - if (!methodValue->asString(method)) { + if (!methodValue->asString(&method)) { reportProtocolError(&callId, InvalidRequest, ASCIILiteral("The type of 'method' property must be string")); return; } @@ -119,19 +121,19 @@ void BackendDispatcher::dispatch(const String& message) } String domain = method.substring(0, position); - SupplementalBackendDispatcher* domainDispatcher = m_dispatchers.get(domain); + InspectorSupplementalBackendDispatcher* domainDispatcher = m_dispatchers.get(domain); if (!domainDispatcher) { reportProtocolError(&callId, MethodNotFound, "'" + domain + "' domain was not found"); return; } String domainMethod = method.substring(position + 1); - domainDispatcher->dispatch(callId, domainMethod, messageObject.releaseNonNull()); + domainDispatcher->dispatch(callId, domainMethod, messageObject.release()); } -void BackendDispatcher::sendResponse(long callId, RefPtr<InspectorObject>&& result, const ErrorString& invocationError) +void InspectorBackendDispatcher::sendResponse(long callId, PassRefPtr<InspectorObject> result, const ErrorString& invocationError) { - if (!m_frontendChannel) + if (!m_inspectorFrontendChannel) return; if (invocationError.length()) { @@ -139,18 +141,18 @@ void BackendDispatcher::sendResponse(long callId, RefPtr<InspectorObject>&& resu return; } - Ref<InspectorObject> responseMessage = InspectorObject::create(); + RefPtr<InspectorObject> responseMessage = InspectorObject::create(); responseMessage->setObject(ASCIILiteral("result"), result); - responseMessage->setInteger(ASCIILiteral("id"), callId); - m_frontendChannel->sendMessageToFrontend(responseMessage->toJSONString()); + responseMessage->setNumber(ASCIILiteral("id"), callId); + m_inspectorFrontendChannel->sendMessageToFrontend(responseMessage->toJSONString()); } -void BackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage) const +void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage) const { reportProtocolError(callId, errorCode, errorMessage, nullptr); } -void BackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage, RefPtr<Inspector::Protocol::Array<String>>&& data) const +void InspectorBackendDispatcher::reportProtocolError(const long* const callId, CommonErrorCode errorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const { static const int errorCodes[] = { -32700, // ParseError @@ -161,105 +163,102 @@ void BackendDispatcher::reportProtocolError(const long* const callId, CommonErro -32000, // ServerError }; - ASSERT_ARG(errorCode, errorCode >= 0); - ASSERT_ARG(errorCode, (unsigned)errorCode < WTF_ARRAY_LENGTH(errorCodes)); - ASSERT_ARG(errorCode, errorCodes[errorCode]); + ASSERT(errorCode >= 0); + ASSERT((unsigned)errorCode < WTF_ARRAY_LENGTH(errorCodes)); + ASSERT(errorCodes[errorCode]); - if (!m_frontendChannel) + if (!m_inspectorFrontendChannel) return; - Ref<InspectorObject> error = InspectorObject::create(); - error->setInteger(ASCIILiteral("code"), errorCodes[errorCode]); + RefPtr<InspectorObject> error = InspectorObject::create(); + error->setNumber(ASCIILiteral("code"), errorCodes[errorCode]); error->setString(ASCIILiteral("message"), errorMessage); if (data) - error->setArray(ASCIILiteral("data"), WTF::move(data)); + error->setArray(ASCIILiteral("data"), data); - Ref<InspectorObject> message = InspectorObject::create(); - message->setObject(ASCIILiteral("error"), WTF::move(error)); + RefPtr<InspectorObject> message = InspectorObject::create(); + message->setObject(ASCIILiteral("error"), error.release()); if (callId) - message->setInteger(ASCIILiteral("id"), *callId); + message->setNumber(ASCIILiteral("id"), *callId); else message->setValue(ASCIILiteral("id"), InspectorValue::null()); - m_frontendChannel->sendMessageToFrontend(message->toJSONString()); + m_inspectorFrontendChannel->sendMessageToFrontend(message->toJSONString()); } template<typename ReturnValueType, typename ValueType, typename DefaultValueType> -static ReturnValueType getPropertyValue(InspectorObject* object, const String& name, bool* out_optionalValueFound, Inspector::Protocol::Array<String>& protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue&, ValueType&), const char* typeName) +static ReturnValueType getPropertyValue(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors, DefaultValueType defaultValue, bool (*asMethod)(InspectorValue*, ValueType*), const char* typeName) { - ValueType 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; + ASSERT(protocolErrors); + + ValueType value = defaultValue; + if (valueFound) + *valueFound = false; if (!object) { - if (!out_optionalValueFound) - protocolErrors.addItem(String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName)); - return result; + if (!valueFound) + protocolErrors->pushString(String::format("'params' object must contain required parameter '%s' with type '%s'.", name.utf8().data(), typeName)); + return value; } - auto findResult = object->find(name); - if (findResult == object->end()) { - if (!out_optionalValueFound) - protocolErrors.addItem(String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName)); - return result; + InspectorObject::const_iterator end = object->end(); + InspectorObject::const_iterator valueIterator = object->find(name); + if (valueIterator == end) { + if (!valueFound) + protocolErrors->pushString(String::format("Parameter '%s' with type '%s' was not found.", name.utf8().data(), typeName)); + return value; } - if (!asMethod(*findResult->value, result)) { - protocolErrors.addItem(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName)); - return result; + if (!asMethod(valueIterator->value.get(), &value)) { + protocolErrors->pushString(String::format("Parameter '%s' has wrong type. It must be '%s'.", name.utf8().data(), typeName)); + return value; } - if (out_optionalValueFound) - *out_optionalValueFound = true; + if (valueFound) + *valueFound = true; - return result; + return value; } struct AsMethodBridges { - static bool asInteger(InspectorValue& value, int& output) { return value.asInteger(output); } - static bool asDouble(InspectorValue& value, double& output) { return value.asDouble(output); } - static bool asString(InspectorValue& value, String& output) { return value.asString(output); } - static bool asBoolean(InspectorValue& value, bool& output) { return value.asBoolean(output); } - static bool asObject(InspectorValue& value, RefPtr<InspectorObject>& output) { return value.asObject(output); } - static bool asArray(InspectorValue& value, RefPtr<InspectorArray>& output) { return value.asArray(output); } - static bool asValue(InspectorValue& value, RefPtr<InspectorValue>& output) { return value.asValue(output); } + static bool asInt(InspectorValue* value, int* output) { return value->asNumber(output); } + static bool asDouble(InspectorValue* value, double* output) { return value->asNumber(output); } + static bool asString(InspectorValue* value, String* output) { return value->asString(output); } + static bool asBoolean(InspectorValue* value, bool* output) { return value->asBoolean(output); } + static bool asObject(InspectorValue* value, RefPtr<InspectorObject>* output) { return value->asObject(output); } + static bool asArray(InspectorValue* value, RefPtr<InspectorArray>* output) { return value->asArray(output); } }; -int BackendDispatcher::getInteger(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +int InspectorBackendDispatcher::getInt(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { - return getPropertyValue<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInteger, "Integer"); + return getPropertyValue<int, int, int>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asInt, "Number"); } -double BackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +double InspectorBackendDispatcher::getDouble(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { return getPropertyValue<double, double, double>(object, name, valueFound, protocolErrors, 0, AsMethodBridges::asDouble, "Number"); } -String BackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +String InspectorBackendDispatcher::getString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { return getPropertyValue<String, String, String>(object, name, valueFound, protocolErrors, "", AsMethodBridges::asString, "String"); } -bool BackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +bool InspectorBackendDispatcher::getBoolean(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { return getPropertyValue<bool, bool, bool>(object, name, valueFound, protocolErrors, false, AsMethodBridges::asBoolean, "Boolean"); } -RefPtr<InspectorObject> BackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) -{ - return getPropertyValue<RefPtr<InspectorObject>, RefPtr<InspectorObject>, InspectorObject*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asObject, "Object"); -} - -RefPtr<InspectorArray> BackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +PassRefPtr<InspectorObject> InspectorBackendDispatcher::getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { - return getPropertyValue<RefPtr<InspectorArray>, RefPtr<InspectorArray>, InspectorArray*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asArray, "Array"); + return getPropertyValue<PassRefPtr<InspectorObject>, RefPtr<InspectorObject>, InspectorObject*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asObject, "Object"); } -RefPtr<InspectorValue> BackendDispatcher::getValue(InspectorObject* object, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors) +PassRefPtr<InspectorArray> InspectorBackendDispatcher::getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) { - return getPropertyValue<RefPtr<InspectorValue>, RefPtr<InspectorValue>, InspectorValue*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asValue, "Value"); + return getPropertyValue<PassRefPtr<InspectorArray>, RefPtr<InspectorArray>, InspectorArray*>(object, name, valueFound, protocolErrors, nullptr, AsMethodBridges::asArray, "Array"); } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h index b303700a2..0a55a1c96 100644 --- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h +++ b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h @@ -27,50 +27,49 @@ #ifndef InspectorBackendDispatcher_h #define InspectorBackendDispatcher_h -#include "InspectorProtocolTypes.h" +#include "InspectorValues.h" +#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> namespace Inspector { -class BackendDispatcher; -class FrontendChannel; - +class InspectorBackendDispatcher; +class InspectorFrontendChannel; typedef String ErrorString; -class SupplementalBackendDispatcher : public RefCounted<SupplementalBackendDispatcher> { +class InspectorSupplementalBackendDispatcher : public RefCounted<InspectorSupplementalBackendDispatcher> { public: - SupplementalBackendDispatcher(BackendDispatcher& backendDispatcher) - : m_backendDispatcher(backendDispatcher) { } - virtual ~SupplementalBackendDispatcher() { } - virtual void dispatch(long callId, const String& method, Ref<InspectorObject>&& message) = 0; + InspectorSupplementalBackendDispatcher(InspectorBackendDispatcher* backendDispatcher) : m_backendDispatcher(backendDispatcher) { } + virtual ~InspectorSupplementalBackendDispatcher() { } + virtual void dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) = 0; protected: - Ref<BackendDispatcher> m_backendDispatcher; + RefPtr<InspectorBackendDispatcher> m_backendDispatcher; }; -class JS_EXPORT_PRIVATE BackendDispatcher : public RefCounted<BackendDispatcher> { +class JS_EXPORT_PRIVATE InspectorBackendDispatcher : public RefCounted<InspectorBackendDispatcher> { public: - static Ref<BackendDispatcher> create(FrontendChannel*); + static PassRefPtr<InspectorBackendDispatcher> create(InspectorFrontendChannel*); class JS_EXPORT_PRIVATE CallbackBase : public RefCounted<CallbackBase> { public: - CallbackBase(Ref<BackendDispatcher>&&, int id); + CallbackBase(PassRefPtr<InspectorBackendDispatcher>, int id); bool isActive() const; void sendFailure(const ErrorString&); void disable() { m_alreadySent = true; } protected: - void sendIfActive(RefPtr<InspectorObject>&& partialMessage, const ErrorString& invocationError); + void sendIfActive(PassRefPtr<InspectorObject> partialMessage, const ErrorString& invocationError); private: - Ref<BackendDispatcher> m_backendDispatcher; + RefPtr<InspectorBackendDispatcher> m_backendDispatcher; int m_id; bool m_alreadySent; }; - void clearFrontend() { m_frontendChannel = nullptr; } - bool isActive() const { return !!m_frontendChannel; } + void clearFrontend() { m_inspectorFrontendChannel = nullptr; } + bool isActive() const { return !!m_inspectorFrontendChannel; } enum CommonErrorCode { ParseError = 0, @@ -81,26 +80,24 @@ public: ServerError }; - void registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher*); + void registerDispatcherForDomain(const String& domain, InspectorSupplementalBackendDispatcher*); void dispatch(const String& message); - void sendResponse(long callId, RefPtr<InspectorObject>&& result, const ErrorString& invocationError); + void sendResponse(long callId, PassRefPtr<InspectorObject> result, const ErrorString& invocationError); void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage) const; - void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, RefPtr<Inspector::Protocol::Array<String>>&& data) const; + void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const; - static int getInteger(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static double getDouble(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static String getString(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static bool getBoolean(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static RefPtr<InspectorValue> getValue(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static RefPtr<InspectorObject> getObject(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); - static RefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound, Inspector::Protocol::Array<String>& protocolErrors); + static int getInt(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); + static double getDouble(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); + static String getString(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); + static bool getBoolean(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); + static PassRefPtr<InspectorObject> getObject(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); + static PassRefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound, InspectorArray* protocolErrors); private: - BackendDispatcher(FrontendChannel* FrontendChannel) - : m_frontendChannel(FrontendChannel) { } + InspectorBackendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { } - FrontendChannel* m_frontendChannel; - HashMap<String, SupplementalBackendDispatcher*> m_dispatchers; + InspectorFrontendChannel* m_inspectorFrontendChannel; + HashMap<String, InspectorSupplementalBackendDispatcher*> m_dispatchers; }; } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/InspectorEnvironment.h b/Source/JavaScriptCore/inspector/InspectorEnvironment.h index cb48771bf..327a9f89a 100644 --- a/Source/JavaScriptCore/inspector/InspectorEnvironment.h +++ b/Source/JavaScriptCore/inspector/InspectorEnvironment.h @@ -28,19 +28,14 @@ #include "CallData.h" -namespace WTF { -class Stopwatch; -} - namespace JSC { -class Exception; class SourceCode; } namespace Inspector { -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); +typedef JSC::JSValue (*InspectorFunctionCallHandler)(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args); +typedef JSC::JSValue (*InspectorEvaluateHandler)(JSC::ExecState*, const JSC::SourceCode&, JSC::JSValue thisValue, JSC::JSValue* exception); class InspectorEnvironment { public: @@ -50,9 +45,7 @@ public: virtual InspectorFunctionCallHandler functionCallHandler() const = 0; virtual InspectorEvaluateHandler evaluateHandler() const = 0; virtual void willCallInjectedScriptFunction(JSC::ExecState*, const String& scriptName, int scriptLine) = 0; - virtual void didCallInjectedScriptFunction(JSC::ExecState*) = 0; - virtual void frontendInitialized() = 0; - virtual Ref<WTF::Stopwatch> executionStopwatch() = 0; + virtual void didCallInjectedScriptFunction() = 0; }; } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h b/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h index a2bf6f3c2..fa0a8eae8 100644 --- a/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h +++ b/Source/JavaScriptCore/inspector/InspectorFrontendChannel.h @@ -30,9 +30,9 @@ namespace Inspector { -class FrontendChannel { +class InspectorFrontendChannel { public: - virtual ~FrontendChannel() { } + virtual ~InspectorFrontendChannel() { } virtual bool sendMessageToFrontend(const String& message) = 0; }; diff --git a/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h b/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h deleted file mode 100644 index 6f062966a..000000000 --- a/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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(WTF::move(value)); - } - - void addItem(const String& value) - { - openAccessors().pushString(value); - } - - void addItem(int value) - { - openAccessors().pushInteger(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/InspectorTypeBuilder.h b/Source/JavaScriptCore/inspector/InspectorTypeBuilder.h new file mode 100644 index 000000000..8ea76ec90 --- /dev/null +++ b/Source/JavaScriptCore/inspector/InspectorTypeBuilder.h @@ -0,0 +1,337 @@ +/* + * 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 InspectorTypeBuilder_h +#define InspectorTypeBuilder_h + +#if ENABLE(INSPECTOR) + +#include "InspectorValues.h" +#include <wtf/Assertions.h> +#include <wtf/PassRefPtr.h> + +namespace Inspector { + +namespace TypeBuilder { + +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); +}; + + +// A small transient wrapper around int type, that can be used as a funciton parameter type +// cleverly disallowing C++ implicit casts from float or double. +class ExactlyInt { +public: + template<typename T> + ExactlyInt(T t) : m_value(cast_to_int<T>(t)) { } + ExactlyInt() { } + + operator int() { return m_value; } + +private: + int m_value; + + template<typename T> + static int cast_to_int(T) { return T::default_case_cast_is_not_supported(); } +}; + +template<> +inline int ExactlyInt::cast_to_int<int>(int i) { return i; } + +template<> +inline int ExactlyInt::cast_to_int<unsigned int>(unsigned int i) { return i; } + +#if !ASSERT_DISABLED +class RuntimeCastHelper { +public: + template<InspectorValue::Type TYPE> + static void assertType(InspectorValue* value) + { + ASSERT(value->type() == TYPE); + } + + static void assertAny(InspectorValue*) + { + } + + static void assertInt(InspectorValue* value) + { + double v; + bool castRes = value->asNumber(&v); + ASSERT_UNUSED(castRes, castRes); + ASSERT(static_cast<double>(static_cast<int>(v)) == v); + } +}; +#endif + + +// This class provides "Traits" type for the input type T. It is programmed using C++ template specialization +// technique. By default it simply takes "ItemTraits" type from T, but it doesn't work with the base types. +template<typename T> +struct ArrayItemHelper { + typedef typename T::ItemTraits Traits; +}; + +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(PassRefPtr<T> value) + { + ArrayItemHelper<T>::Traits::pushRefPtr(this->openAccessors(), value); + } + + void addItem(T value) + { + ArrayItemHelper<T>::Traits::pushRaw(this->openAccessors(), value); + } + + static PassRefPtr<Array<T>> create() + { + return adoptRef(new Array<T>()); + } + + static PassRefPtr<Array<T>> runtimeCast(PassRefPtr<InspectorValue> value) + { + RefPtr<InspectorArray> array; + bool castRes = value->asArray(&array); + ASSERT_UNUSED(castRes, castRes); +#if !ASSERT_DISABLED + assertCorrectValue(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 assertCorrectValue(InspectorValue* value) + { + RefPtr<InspectorArray> array; + bool castRes = value->asArray(&array); + ASSERT_UNUSED(castRes, castRes); + for (unsigned i = 0; i < array->length(); i++) + ArrayItemHelper<T>::Traits::template assertCorrectValue<T>(array->get(i).get()); + } +#endif // !ASSERT_DISABLED +}; + +struct StructItemTraits { + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value) + { + array->pushValue(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + T::assertCorrectValue(value); + } +#endif // !ASSERT_DISABLED +}; + +template<> +struct ArrayItemHelper<String> { + struct Traits { + static void pushRaw(InspectorArray* array, const String& value) + { + array->pushString(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertType<InspectorValue::TypeString>(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<int> { + struct Traits { + static void pushRaw(InspectorArray* array, int value) + { + array->pushInt(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertInt(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<double> { + struct Traits { + static void pushRaw(InspectorArray* array, double value) + { + array->pushNumber(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertType<InspectorValue::TypeNumber>(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<bool> { + struct Traits { + static void pushRaw(InspectorArray* array, bool value) + { + array->pushBoolean(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertType<InspectorValue::TypeBoolean>(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<InspectorValue> { + struct Traits { + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value) + { + array->pushValue(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertAny(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<InspectorObject> { + struct Traits { + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorValue> value) + { + array->pushValue(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertType<InspectorValue::TypeObject>(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<> +struct ArrayItemHelper<InspectorArray> { + struct Traits { + static void pushRefPtr(InspectorArray* array, PassRefPtr<InspectorArray> value) + { + array->pushArray(value); + } + +#if !ASSERT_DISABLED + template<typename T> + static void assertCorrectValue(InspectorValue* value) + { + RuntimeCastHelper::assertType<InspectorValue::TypeArray>(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +template<typename T> +struct ArrayItemHelper<TypeBuilder::Array<T>> { + struct Traits { + static void pushRefPtr(InspectorArray* array, PassRefPtr<TypeBuilder::Array<T>> value) + { + array->pushValue(value); + } + +#if !ASSERT_DISABLED + template<typename S> + static void assertCorrectValue(InspectorValue* value) + { + S::assertCorrectValue(value); + } +#endif // !ASSERT_DISABLED + }; +}; + +} // namespace TypeBuilder + +} // namespace Inspector + +#endif // ENABLE(INSPECTOR) + +#endif // !defined(InspectorTypeBuilder_h) diff --git a/Source/JavaScriptCore/inspector/InspectorValues.cpp b/Source/JavaScriptCore/inspector/InspectorValues.cpp index 5896ad6e6..4cdf71e92 100644 --- a/Source/JavaScriptCore/inspector/InspectorValues.cpp +++ b/Source/JavaScriptCore/inspector/InspectorValues.cpp @@ -1,6 +1,5 @@ /* * 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 @@ -64,10 +63,8 @@ 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; } @@ -76,20 +73,16 @@ bool readInt(const UChar* start, const UChar* end, const UChar** tokenEnd, bool { 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; } @@ -100,14 +93,12 @@ bool parseNumberToken(const UChar* start, const UChar* end, const UChar** tokenE // 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; @@ -149,13 +140,11 @@ bool readHexDigits(const UChar* start, const UChar* end, const UChar** tokenEnd, { 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; } @@ -194,7 +183,6 @@ bool parseStringToken(const UChar* start, const UChar* end, const UChar** tokenE return true; } } - return false; } @@ -258,7 +246,6 @@ Token parseToken(const UChar* start, const UChar* end, const UChar** tokenStart, return STRING; break; } - return INVALID_TOKEN; } @@ -270,17 +257,16 @@ inline int hexToInt(UChar c) 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) +bool decodeString(const UChar* start, const UChar* end, StringBuilder* output) { while (start < end) { UChar c = *start++; if ('\\' != c) { - output.append(c); + output->append(c); continue; } c = *start++; @@ -322,35 +308,31 @@ bool decodeString(const UChar* start, const UChar* end, StringBuilder& output) default: return false; } - output.append(c); + output->append(c); } - return true; } -bool decodeString(const UChar* start, const UChar* end, String& output) +bool decodeString(const UChar* start, const UChar* end, String* output) { if (start == end) { - output = emptyString(); + *output = ""; return true; } - if (start > end) return false; - StringBuilder buffer; buffer.reserveCapacity(end - start); - if (!decodeString(start, end, buffer)) + if (!decodeString(start, end, &buffer)) return false; - - output = buffer.toString(); + *output = buffer.toString(); return true; } -RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth) +PassRefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UChar** valueTokenEnd, int depth) { if (depth > stackLimit) - return nullptr; + return 0; RefPtr<InspectorValue> result; const UChar* tokenStart; @@ -358,7 +340,7 @@ RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UC Token token = parseToken(start, end, &tokenStart, &tokenEnd); switch (token) { case INVALID_TOKEN: - return nullptr; + return 0; case NULL_TOKEN: result = InspectorValue::null(); break; @@ -372,27 +354,27 @@ RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UC bool ok; double value = charactersToDouble(tokenStart, tokenEnd - tokenStart, &ok); if (!ok) - return nullptr; + return 0; result = InspectorBasicValue::create(value); break; } case STRING: { String value; - bool ok = decodeString(tokenStart + 1, tokenEnd - 1, value); + bool ok = decodeString(tokenStart + 1, tokenEnd - 1, &value); if (!ok) - return nullptr; + return 0; result = InspectorString::create(value); break; } case ARRAY_BEGIN: { - Ref<InspectorArray> array = InspectorArray::create(); + RefPtr<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(WTF::move(arrayNode)); + return 0; + array->pushValue(arrayNode); // After a list value, we expect a comma or the end of the list. start = tokenEnd; @@ -401,38 +383,38 @@ RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UC start = tokenEnd; token = parseToken(start, end, &tokenStart, &tokenEnd); if (token == ARRAY_END) - return nullptr; + return 0; } else if (token != ARRAY_END) { // Unexpected value after list value. Bail out. - return nullptr; + return 0; } } if (token != ARRAY_END) - return nullptr; - result = WTF::move(array); + return 0; + result = array.release(); break; } case OBJECT_BEGIN: { - Ref<InspectorObject> object = InspectorObject::create(); + RefPtr<InspectorObject> object = InspectorObject::create(); start = tokenEnd; token = parseToken(start, end, &tokenStart, &tokenEnd); while (token != OBJECT_END) { if (token != STRING) - return nullptr; + return 0; String key; - if (!decodeString(tokenStart + 1, tokenEnd - 1, key)) - return nullptr; + if (!decodeString(tokenStart + 1, tokenEnd - 1, &key)) + return 0; start = tokenEnd; token = parseToken(start, end, &tokenStart, &tokenEnd); if (token != OBJECT_PAIR_SEPARATOR) - return nullptr; + return 0; start = tokenEnd; RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, depth + 1); if (!value) - return nullptr; - object->setValue(key, WTF::move(value)); + return 0; + object->setValue(key, value); start = tokenEnd; // After a key/value pair, we expect a comma or the end of the @@ -442,45 +424,45 @@ RefPtr<InspectorValue> buildValue(const UChar* start, const UChar* end, const UC start = tokenEnd; token = parseToken(start, end, &tokenStart, &tokenEnd); if (token == OBJECT_END) - return nullptr; + return 0; } else if (token != OBJECT_END) { // Unexpected value after last object value. Bail out. - return nullptr; + return 0; } } if (token != OBJECT_END) - return nullptr; - result = WTF::move(object); + return 0; + result = object.release(); break; } default: // We got a token that's not a value. - return nullptr; + return 0; } *valueTokenEnd = tokenEnd; return result.release(); } -inline bool escapeChar(UChar c, StringBuilder& dst) +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; + case '\b': dst->append("\\b", 2); break; + case '\f': dst->append("\\f", 2); break; + case '\n': dst->append("\\n", 2); break; + case '\r': dst->append("\\r", 2); break; + case '\t': dst->append("\\t", 2); break; + case '\\': dst->append("\\\\", 2); break; + case '"': dst->append("\\\"", 2); break; default: return false; } return true; } -inline void doubleQuoteString(const String& str, StringBuilder& dst) +inline void doubleQuoteString(const String& str, StringBuilder* dst) { - dst.append('"'); + dst->append('"'); for (unsigned i = 0; i < str.length(); ++i) { UChar c = str[i]; if (!escapeChar(c, dst)) { @@ -488,206 +470,164 @@ inline void doubleQuoteString(const String& str, StringBuilder& dst) // 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)); + unsigned int symbol = static_cast<unsigned int>(c); + String symbolCode = String::format("\\u%04X", symbol); + dst->append(symbolCode.deprecatedCharacters(), symbolCode.length()); } else - dst.append(c); + dst->append(c); } } - dst.append('"'); + dst->append('"'); } } // anonymous namespace -bool InspectorValue::asBoolean(bool&) const +bool InspectorValue::asBoolean(bool*) const { return false; } -bool InspectorValue::asDouble(double&) const +bool InspectorValue::asNumber(double*) const { return false; } -bool InspectorValue::asDouble(float&) const +bool InspectorValue::asNumber(long*) const { return false; } -bool InspectorValue::asInteger(int&) const +bool InspectorValue::asNumber(int*) const { return false; } -bool InspectorValue::asInteger(unsigned&) const +bool InspectorValue::asNumber(unsigned long*) const { return false; } -bool InspectorValue::asInteger(long&) const +bool InspectorValue::asNumber(unsigned int*) const { return false; } -bool InspectorValue::asInteger(long long&) const +bool InspectorValue::asString(String*) const { return false; } -bool InspectorValue::asInteger(unsigned long&) const +bool InspectorValue::asValue(RefPtr<InspectorValue>* output) { - return false; + *output = this; + return true; } -bool InspectorValue::asInteger(unsigned long long&) const +bool InspectorValue::asObject(RefPtr<InspectorObject>*) { return false; } -bool InspectorValue::asString(String&) const +bool InspectorValue::asArray(RefPtr<InspectorArray>*) { return false; } -bool InspectorValue::asValue(RefPtr<InspectorValue>& output) -{ - output = this; - return true; -} - -bool InspectorValue::asObject(RefPtr<InspectorObject>&) +PassRefPtr<InspectorObject> InspectorValue::asObject() { - return false; + return 0; } -bool InspectorValue::asArray(RefPtr<InspectorArray>&) +PassRefPtr<InspectorArray> InspectorValue::asArray() { - return false; + return 0; } -bool InspectorValue::parseJSON(const String& jsonInput, RefPtr<InspectorValue>& output) +PassRefPtr<InspectorValue> InspectorValue::parseJSON(const String& json) { - // 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; + const UChar* start = json.deprecatedCharacters(); + const UChar* end = json.deprecatedCharacters() + json.length(); + const UChar *tokenEnd; + RefPtr<InspectorValue> value = buildValue(start, end, &tokenEnd, 0); + if (!value || tokenEnd != end) + return 0; + return value.release(); } String InspectorValue::toJSONString() const { StringBuilder result; result.reserveCapacity(512); - writeJSON(result); + writeJSON(&result); return result.toString(); } -void InspectorValue::writeJSON(StringBuilder& output) const +void InspectorValue::writeJSON(StringBuilder* output) const { - ASSERT(m_type == Type::Null); - - output.appendLiteral("null"); + ASSERT(m_type == TypeNull); + output->append(nullString, 4); } -bool InspectorBasicValue::asBoolean(bool& output) const +bool InspectorBasicValue::asBoolean(bool* output) const { - if (type() != Type::Boolean) + if (type() != TypeBoolean) return false; - - output = m_booleanValue; + *output = m_boolValue; return true; } -bool InspectorBasicValue::asDouble(double& output) const +bool InspectorBasicValue::asNumber(double* output) const { - if (type() != Type::Double) + if (type() != TypeNumber) return false; - - output = m_doubleValue; + *output = m_doubleValue; return true; } -bool InspectorBasicValue::asDouble(float& output) const +bool InspectorBasicValue::asNumber(long* output) const { - if (type() != Type::Double) + if (type() != TypeNumber) return false; - - output = static_cast<float>(m_doubleValue); + *output = static_cast<long>(m_doubleValue); return true; } -bool InspectorBasicValue::asInteger(int& output) const +bool InspectorBasicValue::asNumber(int* output) const { - if (type() != Type::Integer && type() != Type::Double) + if (type() != TypeNumber) return false; - - output = static_cast<int>(m_doubleValue); + *output = static_cast<int>(m_doubleValue); return true; } -bool InspectorBasicValue::asInteger(unsigned& output) const +bool InspectorBasicValue::asNumber(unsigned long* output) const { - if (type() != Type::Integer && type() != Type::Double) + if (type() != TypeNumber) return false; - - output = static_cast<unsigned>(m_doubleValue); + *output = static_cast<unsigned long>(m_doubleValue); return true; } -bool InspectorBasicValue::asInteger(long& output) const +bool InspectorBasicValue::asNumber(unsigned int* output) const { - if (type() != Type::Integer && type() != Type::Double) + if (type() != TypeNumber) return false; - - output = static_cast<long>(m_doubleValue); + *output = static_cast<unsigned int>(m_doubleValue); return true; } -bool InspectorBasicValue::asInteger(long long& output) const +void InspectorBasicValue::writeJSON(StringBuilder* 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"); + ASSERT(type() == TypeBoolean || type() == TypeNumber); + if (type() == TypeBoolean) { + if (m_boolValue) + output->append(trueString, 4); else - output.appendLiteral("false"); - } else if (type() == Type::Double || type() == Type::Integer) { + output->append(falseString, 5); + } else if (type() == TypeNumber) { NumberToLStringBuffer buffer; if (!std::isfinite(m_doubleValue)) { - output.appendLiteral("null"); + output->append(nullString, 4); return; } DecimalNumber decimal = m_doubleValue; @@ -696,25 +636,25 @@ void InspectorBasicValue::writeJSON(StringBuilder& output) const // 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"); + output->append("NaN", 3); return; } length = decimal.toStringExponential(buffer, WTF::NumberToStringBufferLength); } else length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength); - output.append(buffer, length); + output->append(buffer, length); } } -bool InspectorString::asString(String& output) const +bool InspectorString::asString(String* output) const { - output = m_stringValue; + *output = m_stringValue; return true; } -void InspectorString::writeJSON(StringBuilder& output) const +void InspectorString::writeJSON(StringBuilder* output) const { - ASSERT(type() == Type::String); + ASSERT(type() == TypeString); doubleQuoteString(m_stringValue, output); } @@ -722,90 +662,92 @@ InspectorObjectBase::~InspectorObjectBase() { } -bool InspectorObjectBase::asObject(RefPtr<InspectorObject>& output) +bool InspectorObjectBase::asObject(RefPtr<InspectorObject>* output) { COMPILE_ASSERT(sizeof(InspectorObject) == sizeof(InspectorObjectBase), cannot_cast); - - output = static_cast<InspectorObject*>(this); + *output = static_cast<InspectorObject*>(this); return true; } +PassRefPtr<InspectorObject> InspectorObjectBase::asObject() +{ + return openAccessors(); +} + 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 +bool InspectorObjectBase::getBoolean(const String& name, bool* output) const { - RefPtr<InspectorValue> value; - if (!getValue(name, value)) + RefPtr<InspectorValue> value = get(name); + if (!value) return false; - return value->asBoolean(output); } -bool InspectorObjectBase::getString(const String& name, String& output) const +bool InspectorObjectBase::getString(const String& name, String* output) const { - RefPtr<InspectorValue> value; - if (!getValue(name, value)) + RefPtr<InspectorValue> value = get(name); + if (!value) return false; - return value->asString(output); } -bool InspectorObjectBase::getObject(const String& name, RefPtr<InspectorObject>& output) const +PassRefPtr<InspectorObject> InspectorObjectBase::getObject(const String& name) const { - RefPtr<InspectorValue> value; - if (!getValue(name, value)) - return false; - - return value->asObject(output); + PassRefPtr<InspectorValue> value = get(name); + if (!value) + return 0; + return value->asObject(); } -bool InspectorObjectBase::getArray(const String& name, RefPtr<InspectorArray>& output) const +PassRefPtr<InspectorArray> InspectorObjectBase::getArray(const String& name) const { - RefPtr<InspectorValue> value; - if (!getValue(name, value)) - return false; - - return value->asArray(output); + PassRefPtr<InspectorValue> value = get(name); + if (!value) + return 0; + return value->asArray(); } -bool InspectorObjectBase::getValue(const String& name, RefPtr<InspectorValue>& output) const +PassRefPtr<InspectorValue> InspectorObjectBase::get(const String& name) const { - Dictionary::const_iterator findResult = m_data.find(name); - if (findResult == m_data.end()) - return false; - - output = findResult->value; - return true; + Dictionary::const_iterator it = m_data.find(name); + if (it == m_data.end()) + return 0; + return it->value; } void InspectorObjectBase::remove(const String& name) { m_data.remove(name); - m_order.removeFirst(name); + for (size_t i = 0; i < m_order.size(); ++i) { + if (m_order[i] == name) { + m_order.remove(i); + break; + } + } } -void InspectorObjectBase::writeJSON(StringBuilder& output) const +void InspectorObjectBase::writeJSON(StringBuilder* output) const { - output.append('{'); + 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()); + Dictionary::const_iterator it = m_data.find(m_order[i]); + ASSERT(it != m_data.end()); if (i) - output.append(','); - doubleQuoteString(findResult->key, output); - output.append(':'); - findResult->value->writeJSON(output); + output->append(','); + doubleQuoteString(it->key, output); + output->append(':'); + it->value->writeJSON(output); } - output.append('}'); + output->append('}'); } InspectorObjectBase::InspectorObjectBase() - : InspectorValue(Type::Object) + : InspectorValue(TypeObject) , m_data() , m_order() { @@ -815,74 +757,80 @@ InspectorArrayBase::~InspectorArrayBase() { } -bool InspectorArrayBase::asArray(RefPtr<InspectorArray>& output) +bool InspectorArrayBase::asArray(RefPtr<InspectorArray>* output) { COMPILE_ASSERT(sizeof(InspectorArrayBase) == sizeof(InspectorArray), cannot_cast); - output = static_cast<InspectorArray*>(this); + *output = static_cast<InspectorArray*>(this); return true; } -void InspectorArrayBase::writeJSON(StringBuilder& output) const +PassRefPtr<InspectorArray> InspectorArrayBase::asArray() +{ + COMPILE_ASSERT(sizeof(InspectorArrayBase) == sizeof(InspectorArray), cannot_cast); + return static_cast<InspectorArray*>(this); +} + +void InspectorArrayBase::writeJSON(StringBuilder* output) const { - output.append('['); + output->append('['); for (Vector<RefPtr<InspectorValue>>::const_iterator it = m_data.begin(); it != m_data.end(); ++it) { if (it != m_data.begin()) - output.append(','); + output->append(','); (*it)->writeJSON(output); } - output.append(']'); + output->append(']'); } InspectorArrayBase::InspectorArrayBase() - : InspectorValue(Type::Array) + : InspectorValue(TypeArray) , m_data() { } -RefPtr<InspectorValue> InspectorArrayBase::get(size_t index) const +PassRefPtr<InspectorValue> InspectorArrayBase::get(size_t index) { ASSERT_WITH_SECURITY_IMPLICATION(index < m_data.size()); return m_data[index]; } -Ref<InspectorObject> InspectorObject::create() +PassRefPtr<InspectorObject> InspectorObject::create() { - return adoptRef(*new InspectorObject); + return adoptRef(new InspectorObject); } -Ref<InspectorArray> InspectorArray::create() +PassRefPtr<InspectorArray> InspectorArray::create() { - return adoptRef(*new InspectorArray); + return adoptRef(new InspectorArray); } -Ref<InspectorValue> InspectorValue::null() +PassRefPtr<InspectorValue> InspectorValue::null() { - return adoptRef(*new InspectorValue); + return adoptRef(new InspectorValue); } -Ref<InspectorString> InspectorString::create(const String& value) +PassRefPtr<InspectorString> InspectorString::create(const String& value) { - return adoptRef(*new InspectorString(value)); + return adoptRef(new InspectorString(value)); } -Ref<InspectorString> InspectorString::create(const char* value) +PassRefPtr<InspectorString> InspectorString::create(const char* value) { - return adoptRef(*new InspectorString(value)); + return adoptRef(new InspectorString(value)); } -Ref<InspectorBasicValue> InspectorBasicValue::create(bool value) +PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(bool value) { - return adoptRef(*new InspectorBasicValue(value)); + return adoptRef(new InspectorBasicValue(value)); } -Ref<InspectorBasicValue> InspectorBasicValue::create(int value) +PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(int value) { - return adoptRef(*new InspectorBasicValue(value)); + return adoptRef(new InspectorBasicValue(value)); } -Ref<InspectorBasicValue> InspectorBasicValue::create(double value) +PassRefPtr<InspectorBasicValue> InspectorBasicValue::create(double value) { - return adoptRef(*new InspectorBasicValue(value)); + return adoptRef(new InspectorBasicValue(value)); } } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/InspectorValues.h b/Source/JavaScriptCore/inspector/InspectorValues.h index 7110eb7c7..06c5dfe97 100644 --- a/Source/JavaScriptCore/inspector/InspectorValues.h +++ b/Source/JavaScriptCore/inspector/InspectorValues.h @@ -1,6 +1,5 @@ /* * 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 @@ -32,8 +31,7 @@ #ifndef InspectorValues_h #define InspectorValues_h -#include "JSExportMacros.h" -#include <wtf/Assertions.h> +#include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -43,52 +41,47 @@ 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) { } + InspectorValue() : m_type(TypeNull) { } virtual ~InspectorValue() { } - static Ref<InspectorValue> null(); + static PassRefPtr<InspectorValue> null(); - enum class Type { - Null = 0, - Boolean, - Double, - Integer, - String, - Object, - Array - }; + typedef enum { + TypeNull = 0, + TypeBoolean, + TypeNumber, + TypeString, + TypeObject, + TypeArray + } Type; Type type() const { return m_type; } - bool isNull() const { return m_type == Type::Null; } + bool isNull() const { return m_type == TypeNull; } - 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>&); + virtual bool asBoolean(bool* output) const; + virtual bool asNumber(double* output) const; + virtual bool asNumber(long* output) const; + virtual bool asNumber(int* output) const; + virtual bool asNumber(unsigned long* output) const; + virtual bool asNumber(unsigned int* output) const; + virtual bool asString(String* output) const; + virtual bool asValue(RefPtr<InspectorValue>* output); + virtual bool asObject(RefPtr<InspectorObject>* output); + virtual bool asArray(RefPtr<InspectorArray>* output); + virtual PassRefPtr<InspectorObject> asObject(); + virtual PassRefPtr<InspectorArray> asArray(); - static bool parseJSON(const String& jsonInput, RefPtr<InspectorValue>& output); + static PassRefPtr<InspectorValue> parseJSON(const String& json); String toJSONString() const; - virtual void writeJSON(StringBuilder& output) const; + virtual void writeJSON(StringBuilder* output) const; protected: explicit InspectorValue(Type type) : m_type(type) { } @@ -100,60 +93,42 @@ private: class JS_EXPORT_PRIVATE InspectorBasicValue : public InspectorValue { public: - static Ref<InspectorBasicValue> create(bool); - static Ref<InspectorBasicValue> create(int); - static Ref<InspectorBasicValue> create(double); + static PassRefPtr<InspectorBasicValue> create(bool); + static PassRefPtr<InspectorBasicValue> create(int); + static PassRefPtr<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 bool asBoolean(bool* output) const override; + virtual bool asNumber(double* output) const override; + virtual bool asNumber(long* output) const override; + virtual bool asNumber(int* output) const override; + virtual bool asNumber(unsigned long* output) const override; + virtual bool asNumber(unsigned* output) const override; - virtual void writeJSON(StringBuilder& output) 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) { } + explicit InspectorBasicValue(bool value) : InspectorValue(TypeBoolean), m_boolValue(value) { } + explicit InspectorBasicValue(int value) : InspectorValue(TypeNumber), m_doubleValue((double)value) { } + explicit InspectorBasicValue(double value) : InspectorValue(TypeNumber), m_doubleValue(value) { } union { - bool m_booleanValue; + bool m_boolValue; double m_doubleValue; }; }; class JS_EXPORT_PRIVATE InspectorString : public InspectorValue { public: - static Ref<InspectorString> create(const String&); - static Ref<InspectorString> create(const char*); + static PassRefPtr<InspectorString> create(const String&); + static PassRefPtr<InspectorString> create(const char*); - virtual bool asString(String& output) const override; + virtual bool asString(String* output) const override; - virtual void writeJSON(StringBuilder& 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) { } + explicit InspectorString(const String& value) : InspectorValue(TypeString), m_stringValue(value) { } + explicit InspectorString(const char* value) : InspectorValue(TypeString), m_stringValue(value) { } String m_stringValue; }; @@ -166,52 +141,39 @@ public: typedef Dictionary::iterator iterator; typedef Dictionary::const_iterator const_iterator; + virtual PassRefPtr<InspectorObject> asObject() override; InspectorObject* openAccessors(); protected: virtual ~InspectorObjectBase(); - virtual bool asObject(RefPtr<InspectorObject>& output) override; + 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 setNumber(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>&&); + void setValue(const String& name, PassRefPtr<InspectorValue>); + void setObject(const String& name, PassRefPtr<InspectorObject>); + void setArray(const String& name, PassRefPtr<InspectorArray>); 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 + bool getBoolean(const String& name, bool* output) const; + template<class T> bool getNumber(const String& name, T* output) const { - RefPtr<InspectorValue> value; - if (!getValue(name, value)) + RefPtr<InspectorValue> value = get(name); + if (!value) return false; - - return value->asInteger(output); + return value->asNumber(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; + bool getString(const String& name, String* output) const; + PassRefPtr<InspectorObject> getObject(const String& name) const; + PassRefPtr<InspectorArray> getArray(const String& name) const; + PassRefPtr<InspectorValue> get(const String& name) const; void remove(const String& name); - virtual void writeJSON(StringBuilder& output) const override; + virtual void writeJSON(StringBuilder* output) const override; iterator begin() { return m_data.begin(); } iterator end() { return m_data.end(); } @@ -230,13 +192,12 @@ private: class InspectorObject : public InspectorObjectBase { public: - static JS_EXPORT_PRIVATE Ref<InspectorObject> create(); + static JS_EXPORT_PRIVATE PassRefPtr<InspectorObject> create(); using InspectorObjectBase::asObject; using InspectorObjectBase::setBoolean; - using InspectorObjectBase::setInteger; - using InspectorObjectBase::setDouble; + using InspectorObjectBase::setNumber; using InspectorObjectBase::setString; using InspectorObjectBase::setValue; using InspectorObjectBase::setObject; @@ -244,12 +205,11 @@ public: using InspectorObjectBase::find; using InspectorObjectBase::getBoolean; - using InspectorObjectBase::getInteger; - using InspectorObjectBase::getDouble; + using InspectorObjectBase::getNumber; using InspectorObjectBase::getString; using InspectorObjectBase::getObject; using InspectorObjectBase::getArray; - using InspectorObjectBase::getValue; + using InspectorObjectBase::get; using InspectorObjectBase::remove; @@ -265,24 +225,26 @@ 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()); } + virtual PassRefPtr<InspectorArray> asArray() override; + + unsigned length() const { return m_data.size(); } protected: virtual ~InspectorArrayBase(); - virtual bool asArray(RefPtr<InspectorArray>&) override; + virtual bool asArray(RefPtr<InspectorArray>* output) override; void pushBoolean(bool); - void pushInteger(int); - void pushDouble(double); + void pushInt(int); + void pushNumber(double); void pushString(const String&); - void pushValue(RefPtr<InspectorValue>&&); - void pushObject(RefPtr<InspectorObjectBase>&&); - void pushArray(RefPtr<InspectorArrayBase>&&); + void pushValue(PassRefPtr<InspectorValue>); + void pushObject(PassRefPtr<InspectorObject>); + void pushArray(PassRefPtr<InspectorArray>); - RefPtr<InspectorValue> get(size_t index) const; + PassRefPtr<InspectorValue> get(size_t index); - virtual void writeJSON(StringBuilder& output) const override; + virtual void writeJSON(StringBuilder* output) const override; iterator begin() { return m_data.begin(); } iterator end() { return m_data.end(); } @@ -298,13 +260,13 @@ private: class InspectorArray : public InspectorArrayBase { public: - static JS_EXPORT_PRIVATE Ref<InspectorArray> create(); + static JS_EXPORT_PRIVATE PassRefPtr<InspectorArray> create(); using InspectorArrayBase::asArray; using InspectorArrayBase::pushBoolean; - using InspectorArrayBase::pushInteger; - using InspectorArrayBase::pushDouble; + using InspectorArrayBase::pushInt; + using InspectorArrayBase::pushNumber; using InspectorArrayBase::pushString; using InspectorArrayBase::pushValue; using InspectorArrayBase::pushObject; @@ -332,12 +294,7 @@ 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) +inline void InspectorObjectBase::setNumber(const String& name, double value) { setValue(name, InspectorBasicValue::create(value)); } @@ -347,24 +304,24 @@ inline void InspectorObjectBase::setString(const String& name, const String& val setValue(name, InspectorString::create(value)); } -inline void InspectorObjectBase::setValue(const String& name, RefPtr<InspectorValue>&& value) +inline void InspectorObjectBase::setValue(const String& name, PassRefPtr<InspectorValue> value) { ASSERT(value); - if (m_data.set(name, WTF::move(value)).isNewEntry) + if (m_data.set(name, value).isNewEntry) m_order.append(name); } -inline void InspectorObjectBase::setObject(const String& name, RefPtr<InspectorObjectBase>&& value) +inline void InspectorObjectBase::setObject(const String& name, PassRefPtr<InspectorObject> value) { ASSERT(value); - if (m_data.set(name, WTF::move(value)).isNewEntry) + if (m_data.set(name, value).isNewEntry) m_order.append(name); } -inline void InspectorObjectBase::setArray(const String& name, RefPtr<InspectorArrayBase>&& value) +inline void InspectorObjectBase::setArray(const String& name, PassRefPtr<InspectorArray> value) { ASSERT(value); - if (m_data.set(name, WTF::move(value)).isNewEntry) + if (m_data.set(name, value).isNewEntry) m_order.append(name); } @@ -373,12 +330,12 @@ inline void InspectorArrayBase::pushBoolean(bool value) m_data.append(InspectorBasicValue::create(value)); } -inline void InspectorArrayBase::pushInteger(int value) +inline void InspectorArrayBase::pushInt(int value) { m_data.append(InspectorBasicValue::create(value)); } -inline void InspectorArrayBase::pushDouble(double value) +inline void InspectorArrayBase::pushNumber(double value) { m_data.append(InspectorBasicValue::create(value)); } @@ -388,22 +345,22 @@ inline void InspectorArrayBase::pushString(const String& value) m_data.append(InspectorString::create(value)); } -inline void InspectorArrayBase::pushValue(RefPtr<InspectorValue>&& value) +inline void InspectorArrayBase::pushValue(PassRefPtr<InspectorValue> value) { ASSERT(value); - m_data.append(WTF::move(value)); + m_data.append(value); } -inline void InspectorArrayBase::pushObject(RefPtr<InspectorObjectBase>&& value) +inline void InspectorArrayBase::pushObject(PassRefPtr<InspectorObject> value) { ASSERT(value); - m_data.append(WTF::move(value)); + m_data.append(value); } -inline void InspectorArrayBase::pushArray(RefPtr<InspectorArrayBase>&& value) +inline void InspectorArrayBase::pushArray(PassRefPtr<InspectorArray> value) { ASSERT(value); - m_data.append(WTF::move(value)); + m_data.append(value); } } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp deleted file mode 100644 index 75b805fa0..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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, WTF::move(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, WTF::move(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 deleted file mode 100644 index 12e1e4144..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index 11d86ed32..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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 "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 "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_frontendChannel(nullptr) - , m_executionStopwatch(Stopwatch::create()) - , m_includeNativeCallStackWithExceptions(true) - , m_isAutomaticInspection(false) -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - , m_augmentingClient(nullptr) -#endif -{ - auto inspectorAgent = std::make_unique<InspectorAgent>(*this); - auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(m_injectedScriptManager.get(), m_globalObject); - auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(m_injectedScriptManager.get()); - auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(m_injectedScriptManager.get(), m_globalObject, consoleAgent.get()); - - m_inspectorAgent = inspectorAgent.get(); - m_debuggerAgent = debuggerAgent.get(); - m_consoleAgent = consoleAgent.get(); - m_consoleClient = std::make_unique<JSGlobalObjectConsoleClient>(m_consoleAgent); - - runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer()); - - m_agents.append(WTF::move(inspectorAgent)); - m_agents.append(WTF::move(runtimeAgent)); - m_agents.append(WTF::move(consoleAgent)); - m_agents.append(WTF::move(debuggerAgent)); - - m_executionStopwatch->start(); -} - -JSGlobalObjectInspectorController::~JSGlobalObjectInspectorController() -{ - m_agents.discardAgents(); -} - -void JSGlobalObjectInspectorController::globalObjectDestroyed() -{ - disconnectFrontend(DisconnectReason::InspectedTargetDestroyed); - - m_injectedScriptManager->disconnect(); -} - -void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* frontendChannel, bool isAutomaticInspection) -{ - ASSERT(!m_frontendChannel); - ASSERT(!m_backendDispatcher); - - m_isAutomaticInspection = isAutomaticInspection; - - m_frontendChannel = frontendChannel; - m_backendDispatcher = BackendDispatcher::create(frontendChannel); - - m_agents.didCreateFrontendAndBackend(frontendChannel, m_backendDispatcher.get()); - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - m_inspectorAgent->activateExtraDomains(m_agents.extraDomains()); - - if (m_augmentingClient) - m_augmentingClient->inspectorConnected(); -#endif -} - -void JSGlobalObjectInspectorController::disconnectFrontend(DisconnectReason reason) -{ - if (!m_frontendChannel) - return; - - m_agents.willDestroyFrontendAndBackend(reason); - - m_backendDispatcher->clearFrontend(); - m_backendDispatcher = nullptr; - m_frontendChannel = nullptr; - - m_isAutomaticInspection = false; - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_augmentingClient) - m_augmentingClient->inspectorDisconnected(); -#endif -} - -void JSGlobalObjectInspectorController::dispatchMessageFromFrontend(const String& message) -{ - if (m_backendDispatcher) - m_backendDispatcher->dispatch(message); -} - -void JSGlobalObjectInspectorController::pause() -{ - if (!m_frontendChannel) - return; - - 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(); -} - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) -void JSGlobalObjectInspectorController::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent) -{ - String domainName = agent->domainName(); - - if (m_frontendChannel) - agent->didCreateFrontendAndBackend(m_frontendChannel, m_backendDispatcher.get()); - - m_agents.appendExtraAgent(WTF::move(agent)); - - if (m_frontendChannel) - m_inspectorAgent->activateExtraDomain(domainName); -} -#endif - -} // namespace Inspector - diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h b/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h deleted file mode 100644 index 6e3f94eac..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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 JSGlobalObjectInspectorController_h -#define JSGlobalObjectInspectorController_h - -#include "InspectorAgentRegistry.h" -#include "InspectorEnvironment.h" -#include <wtf/Forward.h> -#include <wtf/Noncopyable.h> -#include <wtf/text/WTFString.h> - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) -#include "AugmentableInspectorController.h" -#endif - -namespace WTF { -class Stopwatch; -} - - -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 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(DisconnectReason); - 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 willCallInjectedScriptFunction(JSC::ExecState*, const String&, int) override { } - virtual void didCallInjectedScriptFunction(JSC::ExecState*) override { } - virtual void frontendInitialized() override; - virtual Ref<WTF::Stopwatch> executionStopwatch() override; - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const override { return m_augmentingClient; } - virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient* client) override { m_augmentingClient = client; } - - virtual FrontendChannel* frontendChannel() const override { return m_frontendChannel; } - 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; - InspectorAgent* m_inspectorAgent; - InspectorConsoleAgent* m_consoleAgent; - InspectorDebuggerAgent* m_debuggerAgent; - AgentRegistry m_agents; - FrontendChannel* m_frontendChannel; - RefPtr<BackendDispatcher> m_backendDispatcher; - Ref<WTF::Stopwatch> m_executionStopwatch; - bool m_includeNativeCallStackWithExceptions; - bool m_isAutomaticInspection; - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - AugmentableInspectorControllerClient* m_augmentingClient; -#endif -}; - -} // namespace Inspector - -#endif // !defined(JSGlobalObjectInspectorController_h) diff --git a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp b/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp deleted file mode 100644 index 0e968f730..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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(false) - , m_globalObject(globalObject) -{ -} - -void JSGlobalObjectScriptDebugServer::addListener(ScriptDebugListener* listener) -{ - if (!listener) - return; - - bool wasEmpty = m_listeners.isEmpty(); - m_listeners.add(listener); - - // First listener. Attach the debugger to the JSGlobalObject. - if (wasEmpty) { - attach(&m_globalObject); - recompileAllJSFunctions(); - } -} - -void JSGlobalObjectScriptDebugServer::removeListener(ScriptDebugListener* listener, bool isBeingDestroyed) -{ - if (!listener) - return; - - m_listeners.remove(listener); - - // Last listener. Detach the debugger from the JSGlobalObject. - if (m_listeners.isEmpty()) { - detach(&m_globalObject, isBeingDestroyed ? Debugger::GlobalObjectIsDestructing : Debugger::TerminatingDebuggingSession); - if (!isBeingDestroyed) - recompileAllJSFunctions(); - } -} - -void JSGlobalObjectScriptDebugServer::recompileAllJSFunctions() -{ - JSC::Debugger::recompileAllJSFunctions(&m_globalObject.vm()); -} - -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 deleted file mode 100644 index 901b67397..000000000 --- a/Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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" -#include <wtf/Forward.h> - -namespace Inspector { - -class JSGlobalObjectScriptDebugServer final : public ScriptDebugServer { - WTF_MAKE_NONCOPYABLE(JSGlobalObjectScriptDebugServer); -public: - JSGlobalObjectScriptDebugServer(JSC::JSGlobalObject&); - virtual ~JSGlobalObjectScriptDebugServer() { } - - void addListener(ScriptDebugListener*); - void removeListener(ScriptDebugListener*, bool isBeingDestroyed); - - JSC::JSGlobalObject& globalObject() const { return m_globalObject; } - - virtual void recompileAllJSFunctions() override; - -private: - virtual ListenerSet& getListeners() override { return m_listeners; } - 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 { } - - ListenerSet m_listeners; - JSC::JSGlobalObject& m_globalObject; -}; - -} // namespace Inspector - -#endif // JSGlobalObjectScriptDebugServer_h diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp index 420df7e68..3f2f1ed4a 100644 --- a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp +++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. + * 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 @@ -26,39 +26,26 @@ #include "config.h" #include "JSInjectedScriptHost.h" +#if ENABLE(INSPECTOR) + #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 "Operations.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) }; +const ClassInfo JSInjectedScriptHost::s_info = { "InjectedScriptHost", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSInjectedScriptHost) }; JSInjectedScriptHost::JSInjectedScriptHost(VM& vm, Structure* structure, PassRefPtr<InjectedScriptHost> impl) : JSDestructibleObject(vm, structure) @@ -85,8 +72,10 @@ void JSInjectedScriptHost::destroy(JSC::JSCell* cell) void JSInjectedScriptHost::releaseImpl() { - if (auto impl = std::exchange(m_impl, nullptr)) - impl->deref(); + if (m_impl) { + m_impl->deref(); + m_impl = nullptr; + } } JSInjectedScriptHost::~JSInjectedScriptHost() @@ -105,8 +94,9 @@ 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)); + JSObject* thisObject = jsCast<JSObject*>(exec->uncheckedArgument(0).toThis(exec, NotStrictMode)); + String result = thisObject->methodTable()->className(thisObject); + return jsString(exec, result); } JSValue JSInjectedScriptHost::isHTMLAllCollection(ExecState* exec) @@ -118,7 +108,7 @@ JSValue JSInjectedScriptHost::isHTMLAllCollection(ExecState* exec) return jsBoolean(impl().isHTMLAllCollection(value)); } -JSValue JSInjectedScriptHost::subtype(ExecState* exec) +JSValue JSInjectedScriptHost::type(ExecState* exec) { if (exec->argumentCount() < 1) return jsUndefined(); @@ -130,46 +120,13 @@ JSValue JSInjectedScriptHost::subtype(ExecState* exec) 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())) @@ -177,7 +134,7 @@ JSValue JSInjectedScriptHost::subtype(ExecState* exec) if (value.inherits(JSFloat32Array::info()) || value.inherits(JSFloat64Array::info())) return jsNontrivialString(exec, ASCIILiteral("array")); - return impl().subtype(exec, value); + return impl().type(exec, value); } JSValue JSInjectedScriptHost::functionDetails(ExecState* exec) @@ -189,37 +146,30 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec) 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; + lineNumber -= 1; // In the inspector protocol all positions are 0-based while in SourceCode they are 1-based 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)); + location->putDirect(exec->vm(), Identifier(exec, "lineNumber"), jsNumber(lineNumber)); + location->putDirect(exec->vm(), Identifier(exec, "scriptId"), jsString(exec, scriptID)); JSObject* result = constructEmptyObject(exec); - result->putDirect(exec->vm(), Identifier::fromString(exec, "location"), location); + result->putDirect(exec->vm(), Identifier(exec, "location"), location); String name = function->name(exec); if (!name.isEmpty()) - result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name)); + result->putDirect(exec->vm(), Identifier(exec, "name"), jsString(exec, name)); String displayName = function->displayName(exec); if (!displayName.isEmpty()) - result->putDirect(exec->vm(), Identifier::fromString(exec, "displayName"), jsString(exec, displayName)); + result->putDirect(exec->vm(), Identifier(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 @@ -227,263 +177,12 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec) 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) +JSValue JSInjectedScriptHost::getInternalProperties(ExecState*) { - 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; - } - + // FIXME: <https://webkit.org/b/94533> [JSC] expose object inner properties to debugger 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; -} - JSValue toJS(ExecState* exec, JSGlobalObject* globalObject, InjectedScriptHost* impl) { if (!impl) @@ -502,3 +201,5 @@ JSInjectedScriptHost* toJSInjectedScriptHost(JSValue value) } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h index 86891516f..dc2356802 100644 --- a/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h +++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHost.h @@ -26,11 +26,9 @@ #ifndef JSInjectedScriptHost_h #define JSInjectedScriptHost_h -#include "JSDestructibleObject.h" +#if ENABLE(INSPECTOR) -namespace JSC { -class WeakMapData; -} +#include "JSDestructibleObject.h" namespace Inspector { @@ -39,7 +37,6 @@ class InjectedScriptHost; class JSInjectedScriptHost : public JSC::JSDestructibleObject { public: typedef JSC::JSDestructibleObject Base; - static const unsigned StructureFlags = Base::StructureFlags; DECLARE_INFO; @@ -67,16 +64,13 @@ public: // Functions. JSC::JSValue internalConstructorName(JSC::ExecState*); JSC::JSValue isHTMLAllCollection(JSC::ExecState*); - JSC::JSValue subtype(JSC::ExecState*); + JSC::JSValue type(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: + static const unsigned StructureFlags = Base::StructureFlags; + void finishCreation(JSC::VM&); private: @@ -91,4 +85,6 @@ JSInjectedScriptHost* toJSInjectedScriptHost(JSC::JSValue); } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(JSInjectedScriptHost_h) diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp index b86a2e011..12c7a5021 100644 --- a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp +++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2015 Apple Inc. All rights reserved. + * 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 @@ -26,11 +26,13 @@ #include "config.h" #include "JSInjectedScriptHostPrototype.h" +#if ENABLE(INSPECTOR) + #include "Error.h" #include "GetterSetter.h" #include "Identifier.h" #include "InjectedScriptHost.h" -#include "JSCInlines.h" +#include "JSCJSValueInlines.h" #include "JSFunction.h" #include "JSInjectedScriptHost.h" @@ -38,20 +40,15 @@ using namespace JSC; namespace Inspector { -static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionSubtype(ExecState*); +static EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionType(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) }; +const ClassInfo JSInjectedScriptHostPrototype::s_info = { "InjectedScriptHost", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSInjectedScriptHostPrototype) }; void JSInjectedScriptHostPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) { @@ -59,27 +56,22 @@ void JSInjectedScriptHostPrototype::finishCreation(VM& vm, JSGlobalObject* globa ASSERT(inherits(info())); vm.prototypeMap.addPrototype(this); - JSC_NATIVE_FUNCTION("subtype", jsInjectedScriptHostPrototypeFunctionSubtype, DontEnum, 1); + JSC_NATIVE_FUNCTION("type", jsInjectedScriptHostPrototypeFunctionType, DontEnum, 1); JSC_NATIVE_FUNCTION("functionDetails", jsInjectedScriptHostPrototypeFunctionFunctionDetails, DontEnum, 1); JSC_NATIVE_FUNCTION("getInternalProperties", jsInjectedScriptHostPrototypeFunctionGetInternalProperties, DontEnum, 1); JSC_NATIVE_FUNCTION("internalConstructorName", jsInjectedScriptHostPrototypeFunctionInternalConstructorName, DontEnum, 1); JSC_NATIVE_FUNCTION("isHTMLAllCollection", jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection, DontEnum, 1); - JSC_NATIVE_FUNCTION("weakMapSize", jsInjectedScriptHostPrototypeFunctionWeakMapSize, DontEnum, 1); - JSC_NATIVE_FUNCTION("weakMapEntries", jsInjectedScriptHostPrototypeFunctionWeakMapEntries, DontEnum, 1); - JSC_NATIVE_FUNCTION("weakSetSize", jsInjectedScriptHostPrototypeFunctionWeakSetSize, DontEnum, 1); - JSC_NATIVE_FUNCTION("weakSetEntries", jsInjectedScriptHostPrototypeFunctionWeakSetEntries, DontEnum, 1); - JSC_NATIVE_FUNCTION("iteratorEntries", jsInjectedScriptHostPrototypeFunctionIteratorEntries, DontEnum, 1); - - Identifier evaluateIdentifier = Identifier::fromString(&vm, "evaluate"); - GetterSetter* accessor = GetterSetter::create(vm, globalObject); + + Identifier evaluateIdentifier(&vm, "evaluate"); + GetterSetter* accessor = GetterSetter::create(vm); JSFunction* function = JSFunction::create(vm, globalObject, 0, evaluateIdentifier.string(), jsInjectedScriptHostPrototypeAttributeEvaluate); - accessor->setGetter(vm, globalObject, function); + accessor->setGetter(vm, function); putDirectNonIndexAccessor(vm, evaluateIdentifier, accessor, DontEnum | Accessor); } EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -90,7 +82,7 @@ EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeAttributeEvaluate(Exec EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstructorName(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -101,7 +93,7 @@ EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionInternalConstr EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllCollection(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -110,75 +102,20 @@ EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionIsHTMLAllColle 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) +EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionType(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSInjectedScriptHost::info()); - return JSValue::encode(castedThis->subtype(exec)); + return JSValue::encode(castedThis->type(exec)); } EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionFunctionDetails(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -189,7 +126,7 @@ EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionFunctionDetail EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionGetInternalProperties(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSInjectedScriptHost* castedThis = jsDynamicCast<JSInjectedScriptHost*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -200,3 +137,4 @@ EncodedJSValue JSC_HOST_CALL jsInjectedScriptHostPrototypeFunctionGetInternalPro } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h index aa4963ed5..9d0b7b666 100644 --- a/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h +++ b/Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.h @@ -26,6 +26,8 @@ #ifndef JSInjectedScriptHostPrototype_h #define JSInjectedScriptHostPrototype_h +#if ENABLE(INSPECTOR) + #include "JSObject.h" namespace Inspector { @@ -33,7 +35,6 @@ namespace Inspector { class JSInjectedScriptHostPrototype : public JSC::JSNonFinalObject { public: typedef JSC::JSNonFinalObject Base; - static const unsigned StructureFlags = Base::StructureFlags | JSC::OverridesGetOwnPropertySlot; DECLARE_INFO; @@ -49,6 +50,9 @@ public: return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; + private: JSInjectedScriptHostPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(vm, structure) @@ -59,4 +63,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(JSInjectedScriptHostPrototype_h) diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp index cb1f9d1c1..08fd618a8 100644 --- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp +++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp @@ -26,7 +26,8 @@ #include "config.h" #include "JSJavaScriptCallFrame.h" -#include "DebuggerScope.h" +#if ENABLE(INSPECTOR) + #include "Error.h" #include "JSCJSValue.h" #include "JSCellInlines.h" @@ -37,7 +38,7 @@ using namespace JSC; namespace Inspector { -const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFrame) }; +const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFrame) }; JSJavaScriptCallFrame::JSJavaScriptCallFrame(VM& vm, Structure* structure, PassRefPtr<JavaScriptCallFrame> impl) : JSDestructibleObject(vm, structure) @@ -64,8 +65,10 @@ void JSJavaScriptCallFrame::destroy(JSC::JSCell* cell) void JSJavaScriptCallFrame::releaseImpl() { - if (auto impl = std::exchange(m_impl, nullptr)) - impl->deref(); + if (m_impl) { + m_impl->deref(); + m_impl = nullptr; + } } JSJavaScriptCallFrame::~JSJavaScriptCallFrame() @@ -75,7 +78,7 @@ JSJavaScriptCallFrame::~JSJavaScriptCallFrame() JSValue JSJavaScriptCallFrame::evaluate(ExecState* exec) { - NakedPtr<Exception> exception; + JSValue exception; JSValue result = impl().evaluate(exec->argument(0).toString(exec)->value(exec), exception); if (exception) exec->vm().throwException(exec, exception); @@ -92,33 +95,29 @@ JSValue JSJavaScriptCallFrame::scopeType(ExecState* exec) return jsUndefined(); int index = exec->argument(0).asInt32(); - DebuggerScope* scopeChain = impl().scopeChain(); - DebuggerScope::iterator end = scopeChain->end(); + JSScope* scopeChain = impl().scopeChain(); + ScopeChainIterator end = scopeChain->end(); + + // FIXME: We should be identifying and returning CATCH_SCOPE appropriately. bool foundLocalScope = false; - for (DebuggerScope::iterator iter = scopeChain->begin(); iter != end; ++iter) { - DebuggerScope* scope = iter.get(); - - if (!foundLocalScope && scope->isFunctionOrEvalScope()) { - // First function scope is the local scope, each successive one is a closure. - if (!index) - return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); - foundLocalScope = true; + for (ScopeChainIterator iter = scopeChain->begin(); iter != end; ++iter) { + JSObject* scope = iter.get(); + if (scope->isActivationObject()) { + if (!foundLocalScope) { + // First activation object is local scope, each successive activation object is closure. + if (!index) + return jsNumber(JSJavaScriptCallFrame::LOCAL_SCOPE); + foundLocalScope = true; + } else if (!index) + return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); } 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->isGlobalScope()) { - ASSERT(++iter == end); + // Last in the chain is global scope. + if (++iter == end) return jsNumber(JSJavaScriptCallFrame::GLOBAL_SCOPE); - } - ASSERT(scope->isFunctionOrEvalScope()); - return jsNumber(JSJavaScriptCallFrame::CLOSURE_SCOPE); + return jsNumber(JSJavaScriptCallFrame::WITH_SCOPE); } --index; @@ -158,9 +157,9 @@ 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(); + JSScope* scopeChain = impl().scopeChain(); + ScopeChainIterator iter = scopeChain->begin(); + ScopeChainIterator end = scopeChain->end(); // We must always have something in the scope chain. ASSERT(iter != end); @@ -211,3 +210,4 @@ JSJavaScriptCallFrame* toJSJavaScriptCallFrame(JSValue value) } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h index b77c06ebf..dbbb93fa2 100644 --- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h +++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.h @@ -26,6 +26,8 @@ #ifndef JSJavaScriptCallFrame_h #define JSJavaScriptCallFrame_h +#if ENABLE(INSPECTOR) + #include "JSDestructibleObject.h" #include "JavaScriptCallFrame.h" @@ -34,7 +36,6 @@ namespace Inspector { class JSJavaScriptCallFrame : public JSC::JSDestructibleObject { public: typedef JSC::JSDestructibleObject Base; - static const unsigned StructureFlags = Base::StructureFlags; DECLARE_INFO; @@ -76,9 +77,10 @@ public: static const unsigned short WITH_SCOPE = 2; static const unsigned short CLOSURE_SCOPE = 3; static const unsigned short CATCH_SCOPE = 4; - static const unsigned short FUNCTION_NAME_SCOPE = 5; protected: + static const unsigned StructureFlags = Base::StructureFlags; + void finishCreation(JSC::VM&); private: @@ -93,4 +95,6 @@ JSJavaScriptCallFrame* toJSJavaScriptCallFrame(JSC::JSValue); } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(JSJavaScriptCallFrame_h) diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp index 482838652..d74126cb2 100644 --- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp +++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp @@ -26,10 +26,12 @@ #include "config.h" #include "JSJavaScriptCallFramePrototype.h" +#if ENABLE(INSPECTOR) + #include "Error.h" #include "GetterSetter.h" #include "Identifier.h" -#include "JSCInlines.h" +#include "JSCJSValueInlines.h" #include "JSFunction.h" #include "JSJavaScriptCallFrame.h" @@ -57,16 +59,15 @@ static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantLOCAL_SCOPE(Exe static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantWITH_SCOPE(ExecState*); static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCLOSURE_SCOPE(ExecState*); static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCATCH_SCOPE(ExecState*); -static EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*); -const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFramePrototype) }; +const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFrame", &Base::s_info, 0, 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); \ + Identifier identifier(&vm, jsName); \ + GetterSetter* accessor = GetterSetter::create(vm); \ JSFunction* function = JSFunction::create(vm, globalObject, 0, identifier.string(), cppName); \ - accessor->setGetter(vm, globalObject, function); \ + accessor->setGetter(vm, function); \ putDirectNonIndexAccessor(vm, identifier, accessor, (attributes)); \ } @@ -93,12 +94,11 @@ void JSJavaScriptCallFramePrototype::finishCreation(VM& vm, JSGlobalObject* glob JSC_NATIVE_NON_INDEX_ACCESSOR("WITH_SCOPE", jsJavaScriptCallFrameConstantWITH_SCOPE, DontEnum | Accessor); JSC_NATIVE_NON_INDEX_ACCESSOR("CLOSURE_SCOPE", jsJavaScriptCallFrameConstantCLOSURE_SCOPE, DontEnum | Accessor); JSC_NATIVE_NON_INDEX_ACCESSOR("CATCH_SCOPE", jsJavaScriptCallFrameConstantCATCH_SCOPE, DontEnum | Accessor); - JSC_NATIVE_NON_INDEX_ACCESSOR("FUNCTION_NAME_SCOPE", jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE, DontEnum | Accessor); } EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -109,7 +109,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(Exec EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionScopeType(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -120,7 +120,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionScopeType(Exe EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeCaller(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -131,7 +131,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeCaller(ExecState* exe EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeSourceID(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -142,7 +142,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeSourceID(ExecState* e EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeLine(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -153,7 +153,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeLine(ExecState* exec) EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeColumn(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -164,7 +164,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeColumn(ExecState* exe EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeFunctionName(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -175,7 +175,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeFunctionName(ExecStat EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeScopeChain(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -186,7 +186,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeScopeChain(ExecState* EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeThisObject(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -197,7 +197,7 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeThisObject(ExecState* EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameAttributeType(ExecState* exec) { - JSValue thisValue = exec->thisValue(); + JSValue thisValue = exec->hostThisValue(); JSJavaScriptCallFrame* castedThis = jsDynamicCast<JSJavaScriptCallFrame*>(thisValue); if (!castedThis) return throwVMTypeError(exec); @@ -231,9 +231,6 @@ EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantCATCH_SCOPE(ExecState* return JSValue::encode(jsNumber(JSJavaScriptCallFrame::CATCH_SCOPE)); } -EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFrameConstantFUNCTION_NAME_SCOPE(ExecState*) -{ - return JSValue::encode(jsNumber(JSJavaScriptCallFrame::FUNCTION_NAME_SCOPE)); -} - } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h index 0811c2462..b868c53e2 100644 --- a/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h +++ b/Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.h @@ -26,6 +26,8 @@ #ifndef JSJavaScriptCallFramePrototype_h #define JSJavaScriptCallFramePrototype_h +#if ENABLE(INSPECTOR) + #include "JSObject.h" namespace Inspector { @@ -33,7 +35,6 @@ namespace Inspector { class JSJavaScriptCallFramePrototype : public JSC::JSNonFinalObject { public: typedef JSC::JSNonFinalObject Base; - static const unsigned StructureFlags = Base::StructureFlags | JSC::OverridesGetOwnPropertySlot; DECLARE_INFO; @@ -49,6 +50,9 @@ public: return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); } +protected: + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; + private: JSJavaScriptCallFramePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(vm, structure) @@ -59,4 +63,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(JSJavaScriptCallFramePrototype_h) diff --git a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp index d5f73d540..f735a8aa6 100644 --- a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp +++ b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "JavaScriptCallFrame.h" +#if ENABLE(INSPECTOR) + using namespace JSC; namespace Inspector { @@ -50,3 +52,4 @@ JavaScriptCallFrame* JavaScriptCallFrame::caller() } // namespace Inspector +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h index c7d037b18..b584067a2 100644 --- a/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h +++ b/Source/JavaScriptCore/inspector/JavaScriptCallFrame.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2013-2014 Apple Inc. All Rights Reserved. + * 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 @@ -26,6 +26,8 @@ #ifndef JavaScriptCallFrame_h #define JavaScriptCallFrame_h +#if ENABLE(INSPECTOR) + #include "JSCJSValueInlines.h" #include "debugger/DebuggerCallFrame.h" #include "interpreter/CallFrame.h" @@ -38,9 +40,9 @@ namespace Inspector { class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> { public: - static Ref<JavaScriptCallFrame> create(PassRefPtr<JSC::DebuggerCallFrame> debuggerCallFrame) + static PassRefPtr<JavaScriptCallFrame> create(PassRefPtr<JSC::DebuggerCallFrame> debuggerCallFrame) { - return adoptRef(*new JavaScriptCallFrame(debuggerCallFrame)); + return adoptRef(new JavaScriptCallFrame(debuggerCallFrame)); } JavaScriptCallFrame* caller(); @@ -51,11 +53,11 @@ public: 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::JSScope* 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); } + JSC::JSValue evaluate(const String& script, JSC::JSValue& exception) const { return m_debuggerCallFrame->evaluate(script, exception); } private: JavaScriptCallFrame(PassRefPtr<JSC::DebuggerCallFrame>); @@ -66,4 +68,6 @@ private: } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // JavaScriptCallFrame_h diff --git a/Source/JavaScriptCore/inspector/ScriptArguments.cpp b/Source/JavaScriptCore/inspector/ScriptArguments.cpp deleted file mode 100644 index 51d1fe658..000000000 --- a/Source/JavaScriptCore/inspector/ScriptArguments.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7200ab48a..000000000 --- a/Source/JavaScriptCore/inspector/ScriptArguments.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 index fdabc6cc7..e3d52424d 100644 --- a/Source/JavaScriptCore/inspector/ScriptBreakpoint.h +++ b/Source/JavaScriptCore/inspector/ScriptBreakpoint.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -55,8 +55,6 @@ struct ScriptBreakpointAction { String data; }; -typedef Vector<ScriptBreakpointAction> BreakpointActions; - struct ScriptBreakpoint { ScriptBreakpoint() { @@ -70,7 +68,7 @@ struct ScriptBreakpoint { { } - ScriptBreakpoint(int lineNumber, int columnNumber, const String& condition, BreakpointActions& actions, bool autoContinue) + ScriptBreakpoint(int lineNumber, int columnNumber, const String& condition, Vector<ScriptBreakpointAction>& actions, bool autoContinue) : lineNumber(lineNumber) , columnNumber(columnNumber) , condition(condition) @@ -82,7 +80,7 @@ struct ScriptBreakpoint { int lineNumber; int columnNumber; String condition; - BreakpointActions actions; + Vector<ScriptBreakpointAction> actions; bool autoContinue; }; diff --git a/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp b/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp deleted file mode 100644 index 96a06ff62..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 deleted file mode 100644 index 99ac489a7..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallFrame.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 deleted file mode 100644 index 49b0719f5..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallStack.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 WTF::move(frames); -} - -} // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/ScriptCallStack.h b/Source/JavaScriptCore/inspector/ScriptCallStack.h deleted file mode 100644 index d2cbb6596..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallStack.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 deleted file mode 100644 index f33d405cb..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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 "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) { - 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 deleted file mode 100644 index b0c0dc01b..000000000 --- a/Source/JavaScriptCore/inspector/ScriptCallStackFactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 index dfd9e0ab4..bee3bc047 100644 --- a/Source/JavaScriptCore/inspector/ScriptDebugListener.h +++ b/Source/JavaScriptCore/inspector/ScriptDebugListener.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -40,8 +40,6 @@ class ScriptValue; namespace Inspector { -struct ScriptBreakpointAction; - class ScriptDebugListener { public: class Script { @@ -71,11 +69,11 @@ public: 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 didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& result) = 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; + virtual void breakpointActionSound() = 0; }; } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp b/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp index 356de1cbc..b1151cf7f 100644 --- a/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp +++ b/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -32,23 +32,25 @@ #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/MainThread.h> #include <wtf/NeverDestroyed.h> #include <wtf/TemporaryChange.h> #include <wtf/text/WTFString.h> using namespace JSC; +using namespace Inspector; namespace Inspector { ScriptDebugServer::ScriptDebugServer(bool isInWorkerThread) : Debugger(isInWorkerThread) + , m_doneProcessingDebuggerEvents(true) + , m_callingListeners(false) { } @@ -68,7 +70,7 @@ JSC::BreakpointID ScriptDebugServer::setBreakpoint(JSC::SourceID sourceID, const BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(id); ASSERT(it == m_breakpointIDToActions.end()); #endif - const BreakpointActions& actions = scriptBreakpoint.actions; + const Vector<ScriptBreakpointAction> &actions = scriptBreakpoint.actions; m_breakpointIDToActions.set(id, actions); } return id; @@ -94,24 +96,24 @@ bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& b break; } case ScriptBreakpointActionTypeEvaluate: { - NakedPtr<Exception> exception; + JSValue exception; debuggerCallFrame->evaluate(breakpointAction.data, exception); if (exception) reportException(debuggerCallFrame->exec(), exception); break; } case ScriptBreakpointActionTypeSound: - dispatchBreakpointActionSound(debuggerCallFrame->exec(), breakpointAction.identifier); + dispatchBreakpointActionSound(debuggerCallFrame->exec()); break; case ScriptBreakpointActionTypeProbe: { - NakedPtr<Exception> exception; + JSValue 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); + Deprecated::ScriptValue wrappedResult = Deprecated::ScriptValue(state->vm(), exception ? exception : result); + dispatchDidSampleProbe(state, breakpointAction.identifier, wrappedResult); break; } default: @@ -135,8 +137,7 @@ void ScriptDebugServer::dispatchDidPause(ScriptDebugListener* listener) 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)); + listener->didPause(state, Deprecated::ScriptValue(state->vm(), jsCallFrame), Deprecated::ScriptValue()); } void ScriptDebugServer::dispatchBreakpointActionLog(ExecState* exec, const String& message) @@ -144,52 +145,53 @@ void ScriptDebugServer::dispatchBreakpointActionLog(ExecState* exec, const Strin if (m_callingListeners) return; - ListenerSet& listeners = getListeners(); - if (listeners.isEmpty()) + ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject()); + if (!listeners) return; + ASSERT(!listeners->isEmpty()); TemporaryChange<bool> change(m_callingListeners, true); Vector<ScriptDebugListener*> listenersCopy; - copyToVector(listeners, listenersCopy); - for (auto* listener : listenersCopy) + copyToVector(*listeners, listenersCopy); + for (auto listener : listenersCopy) listener->breakpointActionLog(exec, message); } -void ScriptDebugServer::dispatchBreakpointActionSound(ExecState*, int breakpointActionIdentifier) +void ScriptDebugServer::dispatchBreakpointActionSound(ExecState* exec) { if (m_callingListeners) return; - ListenerSet& listeners = getListeners(); - if (listeners.isEmpty()) + ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject()); + if (!listeners) return; + ASSERT(!listeners->isEmpty()); TemporaryChange<bool> change(m_callingListeners, true); Vector<ScriptDebugListener*> listenersCopy; - copyToVector(listeners, listenersCopy); - for (auto* listener : listenersCopy) - listener->breakpointActionSound(breakpointActionIdentifier); + copyToVector(*listeners, listenersCopy); + for (auto listener : listenersCopy) + listener->breakpointActionSound(); } -void ScriptDebugServer::dispatchBreakpointActionProbe(ExecState* exec, const ScriptBreakpointAction& action, const Deprecated::ScriptValue& sampleValue) +void ScriptDebugServer::dispatchDidSampleProbe(ExecState* exec, int identifier, const Deprecated::ScriptValue& sample) { if (m_callingListeners) return; - ListenerSet& listeners = getListeners(); - if (listeners.isEmpty()) + ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject()); + if (!listeners) return; + ASSERT(!listeners->isEmpty()); TemporaryChange<bool> change(m_callingListeners, true); - unsigned sampleId = m_nextProbeSampleId++; - Vector<ScriptDebugListener*> listenersCopy; - copyToVector(listeners, listenersCopy); - for (auto* listener : listenersCopy) - listener->breakpointActionProbe(exec, action, m_currentProbeBatchId, sampleId, sampleValue); + copyToVector(*listeners, listenersCopy); + for (auto listener : listenersCopy) + listener->didSampleProbe(exec, identifier, m_hitCount, sample); } void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) @@ -247,29 +249,18 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProv if (m_callingListeners) return; - ListenerSet& listeners = getListeners(); - if (listeners.isEmpty()) + ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject()); + if (!listeners) return; + ASSERT(!listeners->isEmpty()); TemporaryChange<bool> change(m_callingListeners, true); bool isError = errorLine != -1; if (isError) - dispatchFailedToParseSource(listeners, sourceProvider, errorLine, errorMessage); + dispatchFailedToParseSource(*listeners, sourceProvider, errorLine, errorMessage); else - dispatchDidParseSource(listeners, sourceProvider, isContentScript(exec)); -} - -void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback) -{ - if (m_callingListeners) - return; - - TemporaryChange<bool> change(m_callingListeners, true); - - ListenerSet& listeners = getListeners(); - if (!listeners.isEmpty()) - dispatchFunctionToListeners(listeners, callback); + dispatchDidParseSource(*listeners, sourceProvider, isContentScript(exec)); } void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback) @@ -280,71 +271,68 @@ void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners (this->*callback)(copy[i]); } +void ScriptDebugServer::dispatchFunctionToListeners(JavaScriptExecutionCallback callback, JSGlobalObject* globalObject) +{ + if (m_callingListeners) + return; + + TemporaryChange<bool> change(m_callingListeners, true); + + if (ListenerSet* listeners = getListenersForGlobalObject(globalObject)) { + ASSERT(!listeners->isEmpty()); + dispatchFunctionToListeners(*listeners, callback); + } +} + void ScriptDebugServer::notifyDoneProcessingDebuggerEvents() { m_doneProcessingDebuggerEvents = true; } -void ScriptDebugServer::handleBreakpointHit(JSC::JSGlobalObject* globalObject, const JSC::Breakpoint& breakpoint) +bool ScriptDebugServer::needPauseHandling(JSGlobalObject* globalObject) { - ASSERT(isAttached(globalObject)); - - m_currentProbeBatchId++; + return !!getListenersForGlobalObject(globalObject); +} +void ScriptDebugServer::handleBreakpointHit(const JSC::Breakpoint& breakpoint) +{ + m_hitCount++; BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(breakpoint.id); if (it != m_breakpointIDToActions.end()) { - BreakpointActions actions = it->value; + 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 +void ScriptDebugServer::handleExceptionInBreakpointCondition(JSC::ExecState* exec, JSC::JSValue exception) const { reportException(exec, exception); } -void ScriptDebugServer::handlePause(JSGlobalObject* vmEntryGlobalObject, Debugger::ReasonForPause) +void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject) { - dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause); + dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, vmEntryGlobalObject); didPause(vmEntryGlobalObject); m_doneProcessingDebuggerEvents = false; runEventLoopWhilePaused(); didContinue(vmEntryGlobalObject); - dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue); + dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject); } -const BreakpointActions& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID) +const Vector<ScriptBreakpointAction>& 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(); + static NeverDestroyed<Vector<ScriptBreakpointAction>> emptyActionVector = Vector<ScriptBreakpointAction>(); return emptyActionVector; } -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 index 99eb7230c..6d55de241 100644 --- a/Source/JavaScriptCore/inspector/ScriptDebugServer.h +++ b/Source/JavaScriptCore/inspector/ScriptDebugServer.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -58,7 +58,7 @@ public: virtual void recompileAllJSFunctions() = 0; - const BreakpointActions& getActionsForBreakpoint(JSC::BreakpointID); + const Vector<ScriptBreakpointAction>& getActionsForBreakpoint(JSC::BreakpointID); class Task { WTF_MAKE_FAST_ALLOCATED; @@ -74,45 +74,41 @@ protected: ScriptDebugServer(bool isInWorkerThread = false); ~ScriptDebugServer(); - virtual ListenerSet& getListeners() = 0; + virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) = 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; + virtual void reportException(JSC::ExecState*, JSC::JSValue) const = 0; bool evaluateBreakpointAction(const ScriptBreakpointAction&); - void dispatchFunctionToListeners(JavaScriptExecutionCallback); + void dispatchFunctionToListeners(JavaScriptExecutionCallback, JSC::JSGlobalObject*); 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); + void dispatchBreakpointActionSound(JSC::ExecState*); + void dispatchDidSampleProbe(JSC::ExecState*, int probeIdentifier, const Deprecated::ScriptValue& sample); - bool m_doneProcessingDebuggerEvents {true}; + bool m_doneProcessingDebuggerEvents; private: + typedef Vector<ScriptBreakpointAction> BreakpointActions; 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 bool needPauseHandling(JSC::JSGlobalObject*) override final; + virtual void handleBreakpointHit(const JSC::Breakpoint&) override final; + virtual void handleExceptionInBreakpointCondition(JSC::ExecState*, JSC::JSValue exception) const override final; + virtual void handlePause(JSC::Debugger::ReasonForPause, JSC::JSGlobalObject*) override final; virtual void notifyDoneProcessingDebuggerEvents() override final; - Deprecated::ScriptValue exceptionOrCaughtValue(JSC::ExecState*); - - bool m_callingListeners {false}; - + unsigned m_hitCount; + bool m_callingListeners; BreakpointIDToActionsMap m_breakpointIDToActions; - - unsigned m_nextProbeSampleId {1}; - unsigned m_currentProbeBatchId {0}; }; } // namespace Inspector diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp index 05386901e..fcee46e9d 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp +++ b/Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -31,15 +31,17 @@ #include "config.h" #include "InspectorAgent.h" -#include "InspectorEnvironment.h" +#if ENABLE(INSPECTOR) + #include "InspectorValues.h" #include "ScriptValue.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> namespace Inspector { -InspectorAgent::InspectorAgent(InspectorEnvironment& environment) +InspectorAgent::InspectorAgent() : InspectorAgentBase(ASCIILiteral("Inspector")) - , m_environment(environment) , m_enabled(false) { } @@ -48,56 +50,41 @@ InspectorAgent::~InspectorAgent() { } -void InspectorAgent::didCreateFrontendAndBackend(FrontendChannel* frontendChannel, BackendDispatcher* backendDispatcher) +void InspectorAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher) { - m_frontendDispatcher = std::make_unique<InspectorFrontendDispatcher>(frontendChannel); - m_backendDispatcher = InspectorBackendDispatcher::create(backendDispatcher, this); + m_frontendDispatcher = std::make_unique<InspectorInspectorFrontendDispatcher>(frontendChannel); + m_backendDispatcher = InspectorInspectorBackendDispatcher::create(backendDispatcher, this); } -void InspectorAgent::willDestroyFrontendAndBackend(DisconnectReason) +void InspectorAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason) { m_frontendDispatcher = nullptr; - m_backendDispatcher = nullptr; + m_backendDispatcher.clear(); m_pendingEvaluateTestCommands.clear(); - ErrorString unused; - disable(unused); + ErrorString error; + disable(&error); } -void InspectorAgent::enable(ErrorString&) +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) { - if (!m_frontendDispatcher) - break; - - m_frontendDispatcher->evaluateForTestInFrontend(testCommand); - } + inspect(m_pendingInspectData.first, m_pendingInspectData.second); + for (Vector<std::pair<long, String>>::iterator it = m_pendingEvaluateTestCommands.begin(); m_frontendDispatcher && it != m_pendingEvaluateTestCommands.end(); ++it) + m_frontendDispatcher->evaluateForTestInFrontend(static_cast<int>((*it).first), (*it).second); m_pendingEvaluateTestCommands.clear(); } -void InspectorAgent::disable(ErrorString&) +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) +void InspectorAgent::inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints) { if (m_enabled && m_frontendDispatcher) { m_frontendDispatcher->inspect(objectToInspect, hints); @@ -110,43 +97,14 @@ void InspectorAgent::inspect(RefPtr<Protocol::Runtime::RemoteObject>&& objectToI m_pendingInspectData.second = hints; } -void InspectorAgent::evaluateForTestInFrontend(const String& script) +void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script) { if (m_enabled && m_frontendDispatcher) - 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(WTF::move(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(); + m_frontendDispatcher->evaluateForTestInFrontend(static_cast<int>(callId), script); else - m_frontendDispatcher->activateExtraDomains(domainNames.release()); + m_pendingEvaluateTestCommands.append(std::pair<long, String>(callId, script)); } -#endif } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/agents/InspectorAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorAgent.h index 4c6ef782c..c7dc9ba5a 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorAgent.h +++ b/Source/JavaScriptCore/inspector/agents/InspectorAgent.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -30,51 +30,40 @@ #ifndef InspectorAgent_h #define InspectorAgent_h -#include "InspectorBackendDispatchers.h" -#include "InspectorFrontendDispatchers.h" +#include "InspectorJSBackendDispatchers.h" +#include "InspectorJSFrontendDispatchers.h" #include "inspector/InspectorAgentBase.h" #include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace Inspector { -class BackendDispatcher; -class InspectorEnvironment; class InspectorObject; +class InstrumentingAgents; typedef String ErrorString; -class JS_EXPORT_PRIVATE InspectorAgent final : public InspectorAgentBase, public InspectorBackendDispatcherHandler { +class JS_EXPORT_PRIVATE InspectorAgent final : public InspectorAgentBase, public InspectorInspectorBackendDispatcherHandler { WTF_MAKE_NONCOPYABLE(InspectorAgent); - WTF_MAKE_FAST_ALLOCATED; public: - InspectorAgent(InspectorEnvironment&); + InspectorAgent(); virtual ~InspectorAgent(); - virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*) override; - virtual void willDestroyFrontendAndBackend(DisconnectReason) override; + virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) override; + virtual void willDestroyFrontendAndBackend(InspectorDisconnectReason reason) override; - virtual void enable(ErrorString&) override; - virtual void disable(ErrorString&) override; - virtual void initialized(ErrorString&) override; + virtual void enable(ErrorString*) override; + virtual void disable(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 + void inspect(PassRefPtr<TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints); + void evaluateForTestInFrontend(long testCallId, const String& script); private: - InspectorEnvironment& m_environment; - std::unique_ptr<InspectorFrontendDispatcher> m_frontendDispatcher; - RefPtr<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 + std::unique_ptr<InspectorInspectorFrontendDispatcher> m_frontendDispatcher; + RefPtr<InspectorInspectorBackendDispatcher> m_backendDispatcher; + Vector<std::pair<long, String>> m_pendingEvaluateTestCommands; + std::pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject>> m_pendingInspectData; bool m_enabled; }; diff --git a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp deleted file mode 100644 index 9ffd0484f..000000000 --- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (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 "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 = 1000; -static const int expireConsoleMessagesStep = 100; - -InspectorConsoleAgent::InspectorConsoleAgent(InjectedScriptManager* injectedScriptManager) - : InspectorAgentBase(ASCIILiteral("Console")) - , m_injectedScriptManager(injectedScriptManager) - , m_previousMessage(nullptr) - , m_expiredConsoleMessageCount(0) - , m_enabled(false) -{ -} - -InspectorConsoleAgent::~InspectorConsoleAgent() -{ -} - -void InspectorConsoleAgent::didCreateFrontendAndBackend(FrontendChannel* frontendChannel, BackendDispatcher* backendDispatcher) -{ - m_frontendDispatcher = std::make_unique<ConsoleFrontendDispatcher>(frontendChannel); - m_backendDispatcher = ConsoleBackendDispatcher::create(backendDispatcher, this); -} - -void InspectorConsoleAgent::willDestroyFrontendAndBackend(DisconnectReason) -{ - m_frontendDispatcher = nullptr; - m_backendDispatcher = nullptr; - - 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.get(), m_injectedScriptManager, false); - } - - size_t messageCount = m_consoleMessages.size(); - for (size_t i = 0; i < messageCount; ++i) - m_consoleMessages[i]->addToFrontend(m_frontendDispatcher.get(), 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_frontendDispatcher && 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(WTF::move(message)); -} - -Vector<unsigned> InspectorConsoleAgent::consoleMessageArgumentCounts() const -{ - Vector<unsigned> result(m_consoleMessages.size()); - for (size_t i = 0; i < m_consoleMessages.size(); i++) - result[i] = m_consoleMessages[i]->argumentCount(); - return result; -} - -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 = 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_frontendDispatcher && m_enabled) - m_previousMessage->updateRepeatCountInConsole(m_frontendDispatcher.get()); - } else { - m_previousMessage = consoleMessage.get(); - m_consoleMessages.append(WTF::move(consoleMessage)); - if (m_frontendDispatcher && m_enabled) - m_previousMessage->addToFrontend(m_frontendDispatcher.get(), m_injectedScriptManager, true); - } - - if (!m_frontendDispatcher && 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 deleted file mode 100644 index b9da99d38..000000000 --- a/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -* 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. AND ITS CONTRIBUTORS ``AS IS'' AND ANY -* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY -* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (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(InjectedScriptManager*); - virtual ~InspectorConsoleAgent(); - - virtual void didCreateFrontendAndBackend(FrontendChannel*, 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; - - virtual bool isWorkerAgent() const = 0; - - bool enabled() const { return m_enabled; } - void reset(); - - void addMessageToConsole(std::unique_ptr<ConsoleMessage>); - - Vector<unsigned> consoleMessageArgumentCounts() const; - - 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; - Vector<std::unique_ptr<ConsoleMessage>> m_consoleMessages; - int m_expiredConsoleMessageCount; - HashMap<String, unsigned> m_counts; - HashMap<String, double> m_times; - bool m_enabled; -}; - -} // namespace Inspector - -#endif // !defined(InspectorConsoleAgent_h) diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp index f0f0b48dd..06b759568 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp +++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -30,6 +30,8 @@ #include "config.h" #include "InspectorDebuggerAgent.h" +#if ENABLE(INSPECTOR) + #include "ContentSearchUtilities.h" #include "InjectedScript.h" #include "InjectedScriptManager.h" @@ -38,27 +40,28 @@ #include "ScriptDebugServer.h" #include "ScriptObject.h" #include "ScriptValue.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 String objectGroupForBreakpointAction(int identifier) { - DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, objectGroup, ("breakpoint-action-", AtomicString::ConstructFromLiteral)); - return makeString(objectGroup, String::number(action.identifier)); + DEFINE_STATIC_LOCAL(const AtomicString, objectGroup, ("breakpoint-action-", AtomicString::ConstructFromLiteral)); + return makeString(objectGroup, String::number(identifier)); } InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedScriptManager) : InspectorAgentBase(ASCIILiteral("Debugger")) , m_injectedScriptManager(injectedScriptManager) + , m_listener(nullptr) + , m_pausedScriptState(nullptr) , m_continueToLocationBreakpointID(JSC::noBreakpointID) + , m_enabled(false) + , m_javaScriptPauseScheduled(false) + , m_nextProbeSampleId(1) + , m_nextBreakpointActionIdentifier(1) { // FIXME: make breakReason optional so that there was no need to init it with "other". clearBreakDetails(); @@ -68,18 +71,18 @@ InspectorDebuggerAgent::~InspectorDebuggerAgent() { } -void InspectorDebuggerAgent::didCreateFrontendAndBackend(FrontendChannel* frontendChannel, BackendDispatcher* backendDispatcher) +void InspectorDebuggerAgent::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher) { - m_frontendDispatcher = std::make_unique<DebuggerFrontendDispatcher>(frontendChannel); - m_backendDispatcher = DebuggerBackendDispatcher::create(backendDispatcher, this); + m_frontendDispatcher = std::make_unique<InspectorDebuggerFrontendDispatcher>(frontendChannel); + m_backendDispatcher = InspectorDebuggerBackendDispatcher::create(backendDispatcher, this); } -void InspectorDebuggerAgent::willDestroyFrontendAndBackend(DisconnectReason reason) +void InspectorDebuggerAgent::willDestroyFrontendAndBackend(InspectorDisconnectReason reason) { m_frontendDispatcher = nullptr; - m_backendDispatcher = nullptr; + m_backendDispatcher.clear(); - bool skipRecompile = reason == DisconnectReason::InspectedTargetDestroyed; + bool skipRecompile = reason == InspectorDisconnectReason::InspectedTargetDestroyed; disable(skipRecompile); } @@ -102,10 +105,10 @@ void InspectorDebuggerAgent::disable(bool isBeingDestroyed) if (!m_enabled) return; - stopListeningScriptDebugServer(isBeingDestroyed); - clearInspectorBreakpointState(); + m_javaScriptBreakpoints.clear(); - ASSERT(m_javaScriptBreakpoints.isEmpty()); + stopListeningScriptDebugServer(isBeingDestroyed); + clearResolvedBreakpointState(); if (m_listener) m_listener->debuggerWasDisabled(); @@ -113,17 +116,17 @@ void InspectorDebuggerAgent::disable(bool isBeingDestroyed) m_enabled = false; } -void InspectorDebuggerAgent::enable(ErrorString&) +void InspectorDebuggerAgent::enable(ErrorString*) { enable(); } -void InspectorDebuggerAgent::disable(ErrorString&) +void InspectorDebuggerAgent::disable(ErrorString*) { disable(false); } -void InspectorDebuggerAgent::setBreakpointsActive(ErrorString&, bool active) +void InspectorDebuggerAgent::setBreakpointsActive(ErrorString*, bool active) { if (active) scriptDebugServer().activateBreakpoints(); @@ -136,60 +139,18 @@ bool InspectorDebuggerAgent::isPaused() return scriptDebugServer().isPaused(); } -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) +void InspectorDebuggerAgent::handleConsoleAssert() { if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) - breakProgram(DebuggerFrontendDispatcher::Reason::Assert, buildAssertPauseReason(message)); + breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Assert, nullptr); } -static Ref<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue) +static PassRefPtr<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, RefPtr<InspectorArray>& actions, bool isRegex, bool autoContinue) { - Ref<InspectorObject> breakpointObject = InspectorObject::create(); + RefPtr<InspectorObject> breakpointObject = InspectorObject::create(); breakpointObject->setString(ASCIILiteral("url"), url); - breakpointObject->setInteger(ASCIILiteral("lineNumber"), lineNumber); - breakpointObject->setInteger(ASCIILiteral("columnNumber"), columnNumber); + breakpointObject->setNumber(ASCIILiteral("lineNumber"), lineNumber); + breakpointObject->setNumber(ASCIILiteral("columnNumber"), columnNumber); breakpointObject->setString(ASCIILiteral("condition"), condition); breakpointObject->setBoolean(ASCIILiteral("isRegex"), isRegex); breakpointObject->setBoolean(ASCIILiteral("autoContinue"), autoContinue); @@ -211,19 +172,19 @@ static bool matches(const String& url, const String& pattern, bool isRegex) static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output) { - if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) { + if (typeString == Inspector::TypeBuilder::getJSEnumConstantValue(Inspector::TypeBuilder::Debugger::BreakpointAction::Type::Log)) { *output = ScriptBreakpointActionTypeLog; return true; } - if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) { + if (typeString == Inspector::TypeBuilder::getJSEnumConstantValue(Inspector::TypeBuilder::Debugger::BreakpointAction::Type::Evaluate)) { *output = ScriptBreakpointActionTypeEvaluate; return true; } - if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) { + if (typeString == Inspector::TypeBuilder::getJSEnumConstantValue(Inspector::TypeBuilder::Debugger::BreakpointAction::Type::Sound)) { *output = ScriptBreakpointActionTypeSound; return true; } - if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) { + if (typeString == Inspector::TypeBuilder::getJSEnumConstantValue(Inspector::TypeBuilder::Debugger::BreakpointAction::Type::Probe)) { *output = ScriptBreakpointActionTypeProbe; return true; } @@ -231,7 +192,7 @@ static bool breakpointActionTypeForString(const String& typeString, ScriptBreakp return false; } -bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString& errorString, RefPtr<InspectorArray>& actions, BreakpointActions* result) +bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString* errorString, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* result) { if (!actions) return true; @@ -244,42 +205,37 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString& errorStr 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"); + 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"); + 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"); + *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); + object->getString(ASCIILiteral("data"), &data); - result->append(ScriptBreakpointAction(type, identifier, data)); + result->append(ScriptBreakpointAction(type, m_nextBreakpointActionIdentifier++, 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) +void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) { - locations = Inspector::Protocol::Array<Inspector::Protocol::Debugger::Location>::create(); + locations = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>::create(); if (!optionalURL == !optionalURLRegex) { - errorString = ASCIILiteral("Either url or urlRegex must be specified."); + *errorString = ASCIILiteral("Either url or urlRegex must be specified."); return; } @@ -289,7 +245,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li String breakpointIdentifier = (isRegex ? "/" + url + "/" : url) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber); if (m_javaScriptBreakpoints.contains(breakpointIdentifier)) { - errorString = ASCIILiteral("Breakpoint at specified location already exists."); + *errorString = ASCIILiteral("Breakpoint at specified location already exists."); return; } @@ -297,15 +253,19 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li bool autoContinue = false; RefPtr<InspectorArray> actions; if (options) { - options->getString(ASCIILiteral("condition"), condition); - options->getBoolean(ASCIILiteral("autoContinue"), autoContinue); - options->getArray(ASCIILiteral("actions"), actions); + (*options)->getString(ASCIILiteral("condition"), &condition); + (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue); + actions = (*options)->getArray(ASCIILiteral("actions")); } - BreakpointActions breakpointActions; + Vector<ScriptBreakpointAction> breakpointActions; if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions)) return; + breakpointActionIdentifiers = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>::create(); + for (ScriptBreakpointAction& action : breakpointActions) + breakpointActionIdentifiers->addItem(action.identifier); + m_javaScriptBreakpoints.set(breakpointIdentifier, buildObjectForBreakpointCookie(url, lineNumber, columnNumber, condition, actions, isRegex, autoContinue)); ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue); @@ -314,81 +274,84 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li if (!matches(scriptURL, url, isRegex)) continue; - RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(breakpointIdentifier, it->key, breakpoint); + RefPtr<Inspector::TypeBuilder::Debugger::Location> location = resolveBreakpoint(breakpointIdentifier, it->key, breakpoint); if (location) - locations->addItem(WTF::move(location)); + locations->addItem(location); } *outBreakpointIdentifier = breakpointIdentifier; } -static bool parseLocation(ErrorString& errorString, const InspectorObject& location, JSC::SourceID& sourceID, unsigned& lineNumber, unsigned& columnNumber) +static bool parseLocation(ErrorString* errorString, 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."); + if (!location->getString(ASCIILiteral("scriptId"), &scriptIDStr) || !location->getNumber(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); + *sourceID = scriptIDStr.toIntPtr(); + *columnNumber = 0; + location->getNumber(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) +void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) { JSC::SourceID sourceID; unsigned lineNumber; unsigned columnNumber; - if (!parseLocation(errorString, location, sourceID, lineNumber, columnNumber)) + if (!parseLocation(errorString, location.get(), &sourceID, &lineNumber, &columnNumber)) return; String condition = emptyString(); bool autoContinue = false; RefPtr<InspectorArray> actions; if (options) { - options->getString(ASCIILiteral("condition"), condition); - options->getBoolean(ASCIILiteral("autoContinue"), autoContinue); - options->getArray(ASCIILiteral("actions"), actions); + (*options)->getString(ASCIILiteral("condition"), &condition); + (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue); + actions = (*options)->getArray(ASCIILiteral("actions")); } - BreakpointActions breakpointActions; + Vector<ScriptBreakpointAction> breakpointActions; if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions)) return; + breakpointActionIdentifiers = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>::create(); + for (ScriptBreakpointAction& action : breakpointActions) + breakpointActionIdentifiers->addItem(action.identifier); + 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."); + *errorString = ASCIILiteral("Breakpoint at specified location already exists."); return; } ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, breakpointActions, autoContinue); actualLocation = resolveBreakpoint(breakpointIdentifier, sourceID, breakpoint); if (!actualLocation) { - errorString = ASCIILiteral("Could not resolve breakpoint"); + *errorString = ASCIILiteral("Could not resolve breakpoint"); return; } *outBreakpointIdentifier = breakpointIdentifier; } -void InspectorDebuggerAgent::removeBreakpoint(ErrorString&, const String& 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 = scriptDebugServer().getActionsForBreakpoint(breakpointID); + Vector<JSC::BreakpointID> breakpointIDs = m_breakpointIdentifierToDebugServerBreakpointIDs.take(breakpointIdentifier); + for (auto breakpointID : breakpointIDs) { + const Vector<ScriptBreakpointAction>& breakpointActions = scriptDebugServer().getActionsForBreakpoint(breakpointID); for (auto& action : breakpointActions) - m_injectedScriptManager->releaseObjectGroup(objectGroupForBreakpointAction(action)); + m_injectedScriptManager->releaseObjectGroup(objectGroupForBreakpointAction(action.identifier)); scriptDebugServer().removeBreakpoint(breakpointID); } } -void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const InspectorObject& location) +void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<InspectorObject>& location) { if (m_continueToLocationBreakpointID != JSC::noBreakpointID) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID); @@ -398,7 +361,7 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const JSC::SourceID sourceID; unsigned lineNumber; unsigned columnNumber; - if (!parseLocation(errorString, location, sourceID, lineNumber, columnNumber)) + if (!parseLocation(errorString, location.get(), &sourceID, &lineNumber, &columnNumber)) return; ScriptBreakpoint breakpoint(lineNumber, columnNumber, "", false); @@ -406,7 +369,7 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const resume(errorString); } -RefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID sourceID, const ScriptBreakpoint& breakpoint) +PassRefPtr<Inspector::TypeBuilder::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()) @@ -425,59 +388,55 @@ RefPtr<Inspector::Protocol::Debugger::Location> InspectorDebuggerAgent::resolveB 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() + RefPtr<Inspector::TypeBuilder::Debugger::Location> location = Inspector::TypeBuilder::Debugger::Location::create() .setScriptId(String::number(sourceID)) - .setLineNumber(actualLineNumber) - .release(); + .setLineNumber(actualLineNumber); location->setColumnNumber(actualColumnNumber); - return WTF::move(location); + return 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) +void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptIDStr, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::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); + + JSC::SourceID sourceID = scriptIDStr.toIntPtr(); + ScriptsMap::iterator it = m_scripts.find(sourceID); + if (it != m_scripts.end()) + results = ContentSearchUtilities::searchInTextByLines(it->value.source, query, caseSensitive, isRegex); + else + *error = "No script for id: " + scriptIDStr; } -void InspectorDebuggerAgent::getScriptSource(ErrorString& error, const String& scriptIDStr, String* scriptSource) +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; + *error = "No script for id: " + scriptIDStr; } -void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details) +void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<Inspector::TypeBuilder::Debugger::FunctionDetails>& details) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId); if (injectedScript.hasNoValue()) { - errorString = ASCIILiteral("Function object id is obsolete"); + *errorString = ASCIILiteral("Function object id is obsolete"); return; } injectedScript.getFunctionDetails(errorString, functionId, &details); } -void InspectorDebuggerAgent::schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data) +void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data) { if (m_javaScriptPauseScheduled) return; m_breakReason = breakReason; - m_breakAuxData = WTF::move(data); + m_breakAuxData = data; scriptDebugServer().setPauseOnNextStatement(true); } @@ -490,49 +449,54 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement() scriptDebugServer().setPauseOnNextStatement(false); } -void InspectorDebuggerAgent::pause(ErrorString&) +void InspectorDebuggerAgent::pause(ErrorString*) { - schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason::PauseOnNextStatement, nullptr); + if (m_javaScriptPauseScheduled) + return; + clearBreakDetails(); + scriptDebugServer().setPauseOnNextStatement(true); m_javaScriptPauseScheduled = true; } -void InspectorDebuggerAgent::resume(ErrorString& errorString) +void InspectorDebuggerAgent::resume(ErrorString* errorString) { if (!assertPaused(errorString)) return; + m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup); scriptDebugServer().continueProgram(); } -void InspectorDebuggerAgent::stepOver(ErrorString& errorString) +void InspectorDebuggerAgent::stepOver(ErrorString* errorString) { if (!assertPaused(errorString)) return; + m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup); scriptDebugServer().stepOverStatement(); } -void InspectorDebuggerAgent::stepInto(ErrorString& errorString) +void InspectorDebuggerAgent::stepInto(ErrorString* errorString) { if (!assertPaused(errorString)) return; + m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup); scriptDebugServer().stepIntoStatement(); - - if (m_listener) - m_listener->stepInto(); + m_listener->stepInto(); } -void InspectorDebuggerAgent::stepOut(ErrorString& errorString) +void InspectorDebuggerAgent::stepOut(ErrorString* errorString) { if (!assertPaused(errorString)) return; + m_injectedScriptManager->releaseObjectGroup(InspectorDebuggerAgent::backtraceObjectGroup); scriptDebugServer().stepOutOfFunction(); } -void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString& errorString, const String& stringPauseState) +void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, const String& stringPauseState) { JSC::Debugger::PauseOnExceptionsState pauseState; if (stringPauseState == "none") @@ -542,20 +506,20 @@ void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString& errorString, cons else if (stringPauseState == "uncaught") pauseState = JSC::Debugger::PauseOnUncaughtExceptions; else { - errorString = ASCIILiteral("Unknown pause on exceptions mode: ") + stringPauseState; + *errorString = "Unknown pause on exceptions mode: " + stringPauseState; return; } scriptDebugServer().setPauseOnExceptionsState(static_cast<JSC::Debugger::PauseOnExceptionsState>(pauseState)); if (scriptDebugServer().pauseOnExceptionsState() != pauseState) - errorString = ASCIILiteral("Internal error. Could not change pause on exceptions state"); + *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) +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, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); if (injectedScript.hasNoValue()) { - errorString = ASCIILiteral("Inspected frame has gone"); + *errorString = ASCIILiteral("Inspected frame has gone"); return; } @@ -566,7 +530,7 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const 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); + injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, &result, wasThrown); if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) { unmuteConsole(); @@ -575,21 +539,29 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const } } -void InspectorDebuggerAgent::setOverlayMessage(ErrorString&, const String*) +void InspectorDebuggerAgent::setOverlayMessage(ErrorString*, const String*) { } void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText) { - if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) - breakProgram(DebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText)); + if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions) { + RefPtr<InspectorObject> directive = InspectorObject::create(); + directive->setString(ASCIILiteral("directiveText"), directiveText); + breakProgram(InspectorDebuggerFrontendDispatcher::Reason::CSPViolation, directive.release()); + } } -Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(InjectedScript injectedScript) +PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames() { - ASSERT(!injectedScript.hasNoValue()); - if (injectedScript.hasNoValue()) - return Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>::create(); + if (!m_pausedScriptState) + return Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>::create(); + + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m_pausedScriptState); + if (injectedScript.hasNoValue()) { + ASSERT_NOT_REACHED(); + return Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>::create(); + } return injectedScript.wrapCallFrames(m_currentCallStack); } @@ -620,31 +592,26 @@ void InspectorDebuggerAgent::didParseSource(JSC::SourceID sourceID, const Script return; for (auto it = m_javaScriptBreakpoints.begin(), end = m_javaScriptBreakpoints.end(); it != end; ++it) { - RefPtr<InspectorObject> breakpointObject; - if (!it->value->asObject(breakpointObject)) - return; - + RefPtr<InspectorObject> breakpointObject = it->value->asObject(); bool isRegex; - breakpointObject->getBoolean(ASCIILiteral("isRegex"), isRegex); + breakpointObject->getBoolean(ASCIILiteral("isRegex"), &isRegex); String url; - breakpointObject->getString(ASCIILiteral("url"), 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->getNumber(ASCIILiteral("lineNumber"), &breakpoint.lineNumber); + breakpointObject->getNumber(ASCIILiteral("columnNumber"), &breakpoint.columnNumber); + breakpointObject->getString(ASCIILiteral("condition"), &breakpoint.condition); + breakpointObject->getBoolean(ASCIILiteral("autoContinue"), &breakpoint.autoContinue); ErrorString errorString; - RefPtr<InspectorArray> actions; - breakpointObject->getArray(ASCIILiteral("actions"), actions); - if (!breakpointActionsFromProtocol(errorString, actions, &breakpoint.actions)) { + RefPtr<InspectorArray> actions = breakpointObject->getArray(ASCIILiteral("actions")); + if (!breakpointActionsFromProtocol(&errorString, actions, &breakpoint.actions)) { ASSERT_NOT_REACHED(); continue; } - RefPtr<Inspector::Protocol::Debugger::Location> location = resolveBreakpoint(it->key, sourceID, breakpoint); + RefPtr<Inspector::TypeBuilder::Debugger::Location> location = resolveBreakpoint(it->key, sourceID, breakpoint); if (location) m_frontendDispatcher->breakpointResolved(it->key, location); } @@ -655,53 +622,22 @@ void InspectorDebuggerAgent::failedToParseSource(const String& url, const String m_frontendDispatcher->scriptFailedToParse(url, data, firstLine, errorLine, errorMessage); } -void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) +void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) { 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 (scriptDebugServer().reasonForPause()) { - case JSC::Debugger::PausedForBreakpoint: { - JSC::BreakpointID debuggerBreakpointId = 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; + if (!exception.hasNoValue()) { + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); + if (!injectedScript.hasNoValue()) { + m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::Exception; + m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebuggerAgent::backtraceObjectGroup)->openAccessors(); + // m_breakAuxData might be null after this. } } - // 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_frontendDispatcher->paused(currentCallFrames(), m_breakReason, m_breakAuxData); m_javaScriptPauseScheduled = false; if (m_continueToLocationBreakpointID != JSC::noBreakpointID) { @@ -711,101 +647,69 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState* scriptState, const Depreca 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) +void InspectorDebuggerAgent::didSampleProbe(JSC::ExecState* scriptState, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) { - m_frontendDispatcher->playBreakpointActionSound(breakpointActionIdentifier); -} + int sampleId = m_nextProbeSampleId++; -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) + RefPtr<TypeBuilder::Runtime::RemoteObject> payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(probeIdentifier)); + RefPtr<TypeBuilder::Debugger::ProbeSample> result = TypeBuilder::Debugger::ProbeSample::create() + .setProbeId(probeIdentifier) .setSampleId(sampleId) - .setTimestamp(m_injectedScriptManager->inspectorEnvironment().executionStopwatch()->elapsedTime()) - .setPayload(payload.release()) - .release(); + .setBatchId(hitCount) + .setTimestamp(monotonicallyIncreasingTime()) + .setPayload(payload.release()); - m_frontendDispatcher->didSampleProbe(WTF::move(result)); + m_frontendDispatcher->didSampleProbe(result.release()); } -void InspectorDebuggerAgent::didContinue() +void InspectorDebuggerAgent::breakpointActionSound() { - if (m_didPauseStopwatch) { - m_didPauseStopwatch = false; - m_injectedScriptManager->inspectorEnvironment().executionStopwatch()->start(); - } + // FIXME: We should send a message to the frontend to make the frontend beep. +} +void InspectorDebuggerAgent::didContinue() +{ 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) +void InspectorDebuggerAgent::breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data) { m_breakReason = breakReason; - m_breakAuxData = WTF::move(data); + m_breakAuxData = data; scriptDebugServer().breakProgram(); } -void InspectorDebuggerAgent::clearInspectorBreakpointState() +void InspectorDebuggerAgent::clearResolvedBreakpointState() { ErrorString dummyError; Vector<String> breakpointIdentifiers; copyKeysToVector(m_breakpointIdentifierToDebugServerBreakpointIDs, breakpointIdentifiers); for (const String& identifier : breakpointIdentifiers) - removeBreakpoint(dummyError, identifier); - - m_javaScriptBreakpoints.clear(); + removeBreakpoint(&dummyError, identifier); - clearDebuggerBreakpointState(); -} - -void InspectorDebuggerAgent::clearDebuggerBreakpointState() -{ - scriptDebugServer().clearBreakpoints(); + scriptDebugServer().continueProgram(); 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; - - 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(); - - if (m_frontendDispatcher) - m_frontendDispatcher->globalObjectCleared(); + setOverlayMessage(&dummyError, nullptr); } -bool InspectorDebuggerAgent::assertPaused(ErrorString& errorString) +bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString) { if (!m_pausedScriptState) { - errorString = ASCIILiteral("Can only perform operation while paused."); + *errorString = ASCIILiteral("Can only perform operation while paused."); return false; } @@ -814,16 +718,18 @@ bool InspectorDebuggerAgent::assertPaused(ErrorString& errorString) void InspectorDebuggerAgent::clearBreakDetails() { - m_breakReason = DebuggerFrontendDispatcher::Reason::Other; + m_breakReason = InspectorDebuggerFrontendDispatcher::Reason::Other; m_breakAuxData = nullptr; } -void InspectorDebuggerAgent::clearExceptionValue() +void InspectorDebuggerAgent::didClearGlobalObject() { - if (m_hasExceptionValue) { - m_injectedScriptManager->clearExceptionValue(); - m_hasExceptionValue = false; - } + if (m_frontendDispatcher) + m_frontendDispatcher->globalObjectCleared(); + + clearResolvedBreakpointState(); } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h index 28249e276..0e652499d 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h +++ b/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h @@ -11,7 +11,7 @@ * 2. Redistributions in binary form must 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 + * 3. Neither the name of Apple Computer, 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. * @@ -30,8 +30,10 @@ #ifndef InspectorDebuggerAgent_h #define InspectorDebuggerAgent_h -#include "InspectorBackendDispatchers.h" -#include "InspectorFrontendDispatchers.h" +#if ENABLE(INSPECTOR) + +#include "InspectorJSBackendDispatchers.h" +#include "InspectorJSFrontendDispatchers.h" #include "bindings/ScriptValue.h" #include "debugger/Debugger.h" #include "inspector/InspectorAgentBase.h" @@ -40,13 +42,11 @@ #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> #include <wtf/Vector.h> #include <wtf/text/StringHash.h> -namespace WTF { -class Stopwatch; -} - namespace Inspector { class InjectedScript; @@ -57,7 +57,7 @@ class InspectorValue; class ScriptDebugServer; typedef String ErrorString; -class JS_EXPORT_PRIVATE InspectorDebuggerAgent : public InspectorAgentBase, public ScriptDebugListener, public DebuggerBackendDispatcherHandler { +class JS_EXPORT_PRIVATE InspectorDebuggerAgent : public InspectorAgentBase, public ScriptDebugListener, public InspectorDebuggerBackendDispatcherHandler { WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED; public: @@ -65,35 +65,35 @@ public: virtual ~InspectorDebuggerAgent(); - virtual void didCreateFrontendAndBackend(FrontendChannel*, 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; + virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) override; + virtual void willDestroyFrontendAndBackend(InspectorDisconnectReason) 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 RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) override; + virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) override; + virtual void removeBreakpoint(ErrorString*, const String& breakpointIdentifier) override; + virtual void continueToLocation(ErrorString*, const RefPtr<InspectorObject>& location) override; + virtual void searchInContent(ErrorString*, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::GenericTypes::SearchMatch>>&) override; + virtual void getScriptSource(ErrorString*, const String& scriptID, String* scriptSource) override; + virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<Inspector::TypeBuilder::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, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override; + virtual void setOverlayMessage(ErrorString*, const String*) override; bool isPaused(); - void handleConsoleAssert(const String& message); + void handleConsoleAssert(); - void schedulePauseOnNextStatement(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data); + void schedulePauseOnNextStatement(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); void cancelPauseOnNextStatement(); - void breakProgram(DebuggerFrontendDispatcher::Reason breakReason, RefPtr<InspectorObject>&& data); + void breakProgram(InspectorDebuggerFrontendDispatcher::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); void scriptExecutionBlockedByCSP(const String& directiveText); class Listener { @@ -112,7 +112,7 @@ protected: InspectorDebuggerAgent(InjectedScriptManager*); InjectedScriptManager* injectedScriptManager() const { return m_injectedScriptManager; } - virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0; + virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId) = 0; virtual void startListeningScriptDebugServer() = 0; virtual void stopListeningScriptDebugServer(bool skipRecompile) = 0; @@ -121,7 +121,7 @@ protected: virtual void enable(); virtual void disable(bool skipRecompile); - virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exceptionOrCaughtValue) override; + virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) override; virtual void didContinue() override; virtual String sourceMapURLForScript(const Script&); @@ -129,51 +129,45 @@ protected: void didClearGlobalObject(); private: - Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(InjectedScript); + PassRefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::CallFrame>> currentCallFrames(); 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 didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) 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; + virtual void breakpointActionSound() override; - RefPtr<Inspector::Protocol::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&); - bool assertPaused(ErrorString&); - void clearDebuggerBreakpointState(); - void clearInspectorBreakpointState(); + PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&); + bool assertPaused(ErrorString*); + void clearResolvedBreakpointState(); 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); + bool breakpointActionsFromProtocol(ErrorString*, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* 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; - Listener* m_listener {nullptr}; - JSC::ExecState* m_pausedScriptState {nullptr}; + std::unique_ptr<InspectorDebuggerFrontendDispatcher> m_frontendDispatcher; + RefPtr<InspectorDebuggerBackendDispatcher> m_backendDispatcher; + Listener* m_listener; + JSC::ExecState* m_pausedScriptState; Deprecated::ScriptValue m_currentCallStack; ScriptsMap m_scripts; BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs; BreakpointIdentifierToBreakpointMap m_javaScriptBreakpoints; - DebugServerBreakpointIDToBreakpointIdentifier m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier; JSC::BreakpointID m_continueToLocationBreakpointID; - DebuggerFrontendDispatcher::Reason m_breakReason; + InspectorDebuggerFrontendDispatcher::Reason::Enum m_breakReason; RefPtr<InspectorObject> m_breakAuxData; - bool m_enabled {false}; - bool m_javaScriptPauseScheduled {false}; - bool m_hasExceptionValue {false}; - bool m_didPauseStopwatch {false}; - RefPtr<WTF::Stopwatch> m_stopwatch; + bool m_enabled; + bool m_javaScriptPauseScheduled; + int m_nextProbeSampleId; + int m_nextBreakpointActionIdentifier; }; } // namespace Inspector +#endif // ENABLE(INSPECTOR) + #endif // !defined(InspectorDebuggerAgent_h) diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp index 83d7b69c3..76a47fb3a 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp +++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp @@ -32,8 +32,9 @@ #include "config.h" #include "InspectorRuntimeAgent.h" +#if ENABLE(INSPECTOR) + #include "Completion.h" -#include "HeapIterationScope.h" #include "InjectedScript.h" #include "InjectedScriptManager.h" #include "InspectorValues.h" @@ -41,10 +42,7 @@ #include "ParserError.h" #include "ScriptDebugServer.h" #include "SourceCode.h" -#include "TypeProfiler.h" -#include "TypeProfilerLog.h" -#include "VMEntryScope.h" -#include <wtf/CurrentTime.h> +#include <wtf/PassRefPtr.h> using namespace JSC; @@ -60,7 +58,6 @@ InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScri , m_injectedScriptManager(injectedScriptManager) , m_scriptDebugServer(nullptr) , m_enabled(false) - , m_isTypeProfilingEnabled(false) { } @@ -77,44 +74,44 @@ static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(Scrip return presentState; } -static Ref<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation) +static PassRefPtr<Inspector::TypeBuilder::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation) { - return Inspector::Protocol::Runtime::ErrorRange::create() + RefPtr<Inspector::TypeBuilder::Runtime::ErrorRange> result = Inspector::TypeBuilder::Runtime::ErrorRange::create() .setStartOffset(tokenLocation.startOffset) - .setEndOffset(tokenLocation.endOffset) - .release(); + .setEndOffset(tokenLocation.endOffset); + return result.release(); } -void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range) +void InspectorRuntimeAgent::parse(ErrorString*, const String& expression, Inspector::TypeBuilder::Runtime::SyntaxErrorType::Enum* result, Inspector::TypeBuilder::OptOutput<String>* message, RefPtr<Inspector::TypeBuilder::Runtime::ErrorRange>& range) { - VM& vm = globalVM(); + VM* vm = globalVM(); JSLockHolder lock(vm); ParserError error; - checkSyntax(vm, JSC::makeSource(expression), error); + checkSyntax(*vm, JSC::makeSource(expression), error); - switch (error.syntaxErrorType()) { + switch (error.m_syntaxErrorType) { case ParserError::SyntaxErrorNone: - *result = Inspector::Protocol::Runtime::SyntaxErrorType::None; + *result = Inspector::TypeBuilder::Runtime::SyntaxErrorType::None; break; case ParserError::SyntaxErrorIrrecoverable: - *result = Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable; + *result = Inspector::TypeBuilder::Runtime::SyntaxErrorType::Irrecoverable; break; case ParserError::SyntaxErrorUnterminatedLiteral: - *result = Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral; + *result = Inspector::TypeBuilder::Runtime::SyntaxErrorType::UnterminatedLiteral; break; case ParserError::SyntaxErrorRecoverable: - *result = Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable; + *result = Inspector::TypeBuilder::Runtime::SyntaxErrorType::Recoverable; break; } - if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) { - *message = error.message(); - range = buildErrorRangeObject(error.token().m_location); + if (error.m_syntaxErrorType != ParserError::SyntaxErrorNone) { + *message = error.m_message; + range = buildErrorRangeObject(error.m_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) +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, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); if (injectedScript.hasNoValue()) @@ -126,7 +123,7 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp if (asBool(doNotPauseOnExceptionsAndMuteConsole)) muteConsole(); - injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), &result, wasThrown, savedResultIndex); + injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &result, wasThrown); if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { unmuteConsole(); @@ -134,17 +131,17 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp } } -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) +void InspectorRuntimeAgent::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const RefPtr<InspectorArray>* const optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { - errorString = ASCIILiteral("Inspected frame has gone"); + *errorString = ASCIILiteral("Inspected frame has gone"); return; } String arguments; if (optionalArguments) - arguments = optionalArguments->toJSONString(); + arguments = (*optionalArguments)->toJSONString(); ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = ScriptDebugServer::DontPauseOnExceptions; if (asBool(doNotPauseOnExceptionsAndMuteConsole)) @@ -160,243 +157,40 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const Strin } } -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) +void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor>>& internalProperties) { InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId); if (injectedScript.hasNoValue()) { - errorString = ASCIILiteral("Inspected frame has gone"); + *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); + injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, &result); + injectedScript.getInternalProperties(errorString, objectId, &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) +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) +void InspectorRuntimeAgent::releaseObjectGroup(ErrorString*, const String& objectGroup) { m_injectedScriptManager->releaseObjectGroup(objectGroup); } -void InspectorRuntimeAgent::run(ErrorString&) +void InspectorRuntimeAgent::run(ErrorString*) { - // FIXME: <https://webkit.org/b/127634> Web Inspector: support debugging web workers -} - -void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const Inspector::InspectorArray& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions) -{ - static const bool verbose = false; - VM& vm = globalVM(); - typeDescriptions = Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>::create(); - if (!vm.typeProfiler()) { - errorString = ASCIILiteral("The VM does not currently have Type Information."); - return; - } - - double start = currentTimeMS(); - 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 = vm.typeProfiler()->findLocation(divot, sourceIDAsString.toIntPtrStrict(&okay), static_cast<TypeProfilerSearchDescriptor>(descriptor), 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(WTF::move(description)); - } - - double end = currentTimeMS(); - if (verbose) - dataLogF("Inspector::getRuntimeTypesForVariablesAtOffsets took %lfms\n", end - start); -} - -class TypeRecompiler : public MarkedBlock::VoidFunctor { -public: - inline void visit(JSCell* cell) - { - if (!cell->inherits(FunctionExecutable::info())) - return; - - FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell); - executable->clearCode(); - executable->clearUnlinkedCodeForRecompilation(); - } - inline IterationStatus operator()(JSCell* cell) - { - visit(cell); - return IterationStatus::Continue; - } -}; - -static void recompileAllJSFunctionsForTypeProfiling(VM& vm, bool shouldEnableTypeProfiling) -{ - bool shouldRecompileFromTypeProfiler = (shouldEnableTypeProfiling ? vm.enableTypeProfiler() : vm.disableTypeProfiler()); - bool shouldRecompileFromControlFlowProfiler = (shouldEnableTypeProfiling ? vm.enableControlFlowProfiler() : vm.disableControlFlowProfiler()); - bool needsToRecompile = shouldRecompileFromTypeProfiler || shouldRecompileFromControlFlowProfiler; - - if (needsToRecompile) { - vm.prepareToDeleteCode(); - TypeRecompiler recompiler; - HeapIterationScope iterationScope(vm.heap); - vm.heap.objectSpace().forEachLiveCell(iterationScope, recompiler); - } -} - -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 shouldEnableTypeProfiling) -{ - if (m_isTypeProfilingEnabled == shouldEnableTypeProfiling) - return; - - m_isTypeProfilingEnabled = shouldEnableTypeProfiling; - - VM& vm = globalVM(); - - // If JavaScript is running, it's not safe to recompile, since we'll end - // up throwing away code that is live on the stack. - if (vm.entryScope) { - vm.entryScope->setEntryScopeDidPopListener(this, - [=] (VM& vm, JSGlobalObject*) { - recompileAllJSFunctionsForTypeProfiling(vm, shouldEnableTypeProfiling); - } - ); - } else - recompileAllJSFunctionsForTypeProfiling(vm, shouldEnableTypeProfiling); -} - -void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks) -{ - VM& vm = globalVM(); - if (!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 = vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, 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) - .release(); - basicBlocks->addItem(WTF::move(location)); - } } } // namespace Inspector + +#endif // ENABLE(INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h index 25f3d7c14..2bc6e2994 100644 --- a/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h +++ b/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h @@ -32,8 +32,10 @@ #ifndef InspectorRuntimeAgent_h #define InspectorRuntimeAgent_h -#include "InspectorBackendDispatchers.h" -#include "InspectorFrontendDispatchers.h" +#if ENABLE(INSPECTOR) + +#include "InspectorJSBackendDispatchers.h" +#include "InspectorJSFrontendDispatchers.h" #include "inspector/InspectorAgentBase.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -50,30 +52,21 @@ class InspectorArray; class ScriptDebugServer; typedef String ErrorString; -class JS_EXPORT_PRIVATE InspectorRuntimeAgent : public InspectorAgentBase, public RuntimeBackendDispatcherHandler { +class JS_EXPORT_PRIVATE InspectorRuntimeAgent : public InspectorAgentBase, public InspectorRuntimeBackendDispatcherHandler { 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 run(ErrorString&) override; - 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; - + virtual void enable(ErrorString*) override { m_enabled = true; } + virtual void disable(ErrorString*) override { m_enabled = false; } + virtual void parse(ErrorString*, const String& expression, Inspector::TypeBuilder::Runtime::SyntaxErrorType::Enum* result, Inspector::TypeBuilder::OptOutput<String>* message, RefPtr<Inspector::TypeBuilder::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, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override final; + virtual void callFunctionOn(ErrorString*, const String& objectId, const String& expression, const RefPtr<Inspector::InspectorArray>* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>& result, Inspector::TypeBuilder::OptOutput<bool>* wasThrown) override final; + virtual void releaseObject(ErrorString*, const ErrorString& objectId) override final; + virtual void getProperties(ErrorString*, const String& objectId, const bool* ownProperties, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Runtime::InternalPropertyDescriptor>>& internalProperties) override final; + virtual void releaseObjectGroup(ErrorString*, const String& objectGroup) override final; + virtual void run(ErrorString*) override; + void setScriptDebugServer(ScriptDebugServer* scriptDebugServer) { m_scriptDebugServer = scriptDebugServer; } bool enabled() const { return m_enabled; } @@ -83,21 +76,19 @@ protected: InjectedScriptManager* injectedScriptManager() { return m_injectedScriptManager; } - virtual JSC::VM& globalVM() = 0; - virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0; + virtual JSC::VM* globalVM() = 0; + 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; bool m_enabled; - bool m_isTypeProfilingEnabled; }; } // namespace Inspector +#endif // ENABLE(INSPECTOR) #endif // InspectorRuntimeAgent_h diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp deleted file mode 100644 index fe112dd1e..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 "JSGlobalObjectConsoleAgent.h" - -namespace Inspector { - -JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(InjectedScriptManager* injectedScriptManager) - : InspectorConsoleAgent(injectedScriptManager) -{ -} - -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 deleted file mode 100644 index 0d79c5d1b..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 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(InjectedScriptManager*); - 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; - - virtual bool isWorkerAgent() const override { return false; } -}; - -} // namespace Inspector - -#endif // !defined(JSGlobalObjectConsoleAgent_h) diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp deleted file mode 100644 index 9ae76c62a..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 "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(InjectedScriptManager* injectedScriptManager, JSC::JSGlobalObject& globalObject, InspectorConsoleAgent* consoleAgent) - : InspectorDebuggerAgent(injectedScriptManager) - , m_scriptDebugServer(globalObject) - , m_consoleAgent(consoleAgent) -{ -} - -void JSGlobalObjectDebuggerAgent::startListeningScriptDebugServer() -{ - scriptDebugServer().addListener(this); -} - -void JSGlobalObjectDebuggerAgent::stopListeningScriptDebugServer(bool isBeingDestroyed) -{ - scriptDebugServer().removeListener(this, isBeingDestroyed); -} - -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 = m_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 deleted file mode 100644 index ac6b87169..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 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(InjectedScriptManager*, JSC::JSGlobalObject&, InspectorConsoleAgent*); - virtual ~JSGlobalObjectDebuggerAgent() { } - - virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; } - - virtual void startListeningScriptDebugServer() override; - virtual void stopListeningScriptDebugServer(bool isBeingDestroyed) override; - 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: - JSGlobalObjectScriptDebugServer m_scriptDebugServer; - InspectorConsoleAgent* m_consoleAgent; -}; - -} // namespace Inspector - -#endif // !defined(JSGlobalObjectDebuggerAgent_h) diff --git a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp b/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp deleted file mode 100644 index 46049f56c..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 "JSGlobalObjectRuntimeAgent.h" - -#include "InjectedScript.h" -#include "InjectedScriptManager.h" -#include "JSGlobalObject.h" - -using namespace JSC; - -namespace Inspector { - -JSGlobalObjectRuntimeAgent::JSGlobalObjectRuntimeAgent(InjectedScriptManager* injectedScriptManager, JSGlobalObject& globalObject) - : InspectorRuntimeAgent(injectedScriptManager) - , m_globalObject(globalObject) -{ -} - -void JSGlobalObjectRuntimeAgent::didCreateFrontendAndBackend(FrontendChannel* frontendChannel, BackendDispatcher* backendDispatcher) -{ - m_frontendDispatcher = std::make_unique<RuntimeFrontendDispatcher>(frontendChannel); - m_backendDispatcher = RuntimeBackendDispatcher::create(backendDispatcher, this); -} - -void JSGlobalObjectRuntimeAgent::willDestroyFrontendAndBackend(DisconnectReason reason) -{ - m_frontendDispatcher = nullptr; - m_backendDispatcher = nullptr; - - InspectorRuntimeAgent::willDestroyFrontendAndBackend(reason); -} - -VM& JSGlobalObjectRuntimeAgent::globalVM() -{ - return m_globalObject.vm(); -} - -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 deleted file mode 100644 index 631baec0e..000000000 --- a/Source/JavaScriptCore/inspector/agents/JSGlobalObjectRuntimeAgent.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 JSGlobalObjectRuntimeAgent_h -#define JSGlobalObjectRuntimeAgent_h - -#include "InspectorRuntimeAgent.h" - -namespace JSC { -class JSGlobalObject; -} - -namespace Inspector { - -class JSGlobalObjectRuntimeAgent final : public InspectorRuntimeAgent { -public: - JSGlobalObjectRuntimeAgent(InjectedScriptManager*, JSC::JSGlobalObject&); - - virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher*) override; - virtual void willDestroyFrontendAndBackend(DisconnectReason) override; - - virtual JSC::VM& globalVM() 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 deleted file mode 100644 index 5ff035358..000000000 --- a/Source/JavaScriptCore/inspector/augmentable/AlternateDispatchableAgent.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 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, std::unique_ptr<TAlternateDispatcher> alternateDispatcher) - : InspectorAgentBase(domainName) - , m_alternateDispatcher(WTF::move(alternateDispatcher)) - { - } - - virtual void didCreateFrontendAndBackend(FrontendChannel*, BackendDispatcher* backendDispatcher) override - { - m_backendDispatcher = TBackendDispatcher::create(backendDispatcher, nullptr); - m_backendDispatcher->setAlternateDispatcher(m_alternateDispatcher.get()); - m_alternateDispatcher->setBackendDispatcher(backendDispatcher); - } - - virtual void willDestroyFrontendAndBackend(DisconnectReason) override - { - m_backendDispatcher = nullptr; - m_alternateDispatcher->setBackendDispatcher(nullptr); - } - -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 deleted file mode 100644 index 2456ac591..000000000 --- a/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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/InspectorFrontendChannel.h> - -namespace Inspector { - -class InspectorAgentBase; - -class AugmentableInspectorController { -public: - virtual ~AugmentableInspectorController() { } - - virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const = 0; - virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient*) = 0; - - virtual FrontendChannel* frontendChannel() const = 0; - virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) = 0; - - bool connected() const { return !!frontendChannel(); } -}; - -} // 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 deleted file mode 100644 index fef1cf9b5..000000000 --- a/Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorControllerClient.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 deleted file mode 100644 index 86a984a12..000000000 --- a/Source/JavaScriptCore/inspector/protocol/ApplicationCache.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "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 deleted file mode 100644 index 1b3264bf4..000000000 --- a/Source/JavaScriptCore/inspector/protocol/CSS.json +++ /dev/null @@ -1,430 +0,0 @@ -{ - "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."} - ], - "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": "addRule", - "parameters": [ - { "name": "contextNodeId", "$ref": "DOM.NodeId" }, - { "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 special \"inspector\" stylesheet in the owner document of the context node." - }, - { - "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": "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 deleted file mode 100644 index 5b319d9da..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Console.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "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 $x command line API." } - ], - "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions)." - } - ], - "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 deleted file mode 100644 index b32b4e223..000000000 --- a/Source/JavaScriptCore/inspector/protocol/DOM.json +++ /dev/null @@ -1,555 +0,0 @@ -{ - "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": "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 deleted file mode 100644 index bfab308b0..000000000 --- a/Source/JavaScriptCore/inspector/protocol/DOMDebugger.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "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 deleted file mode 100644 index 812e70d3f..000000000 --- a/Source/JavaScriptCore/inspector/protocol/DOMStorage.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "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 deleted file mode 100644 index b959e0f2d..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Database.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "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 index a65522ff1..d80edeb3b 100644 --- a/Source/JavaScriptCore/inspector/protocol/Debugger.json +++ b/Source/JavaScriptCore/inspector/protocol/Debugger.json @@ -37,8 +37,7 @@ "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." } + { "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)." } ], "description": "Action to perform when a breakpoint is triggered." }, @@ -80,7 +79,7 @@ "id": "Scope", "type": "object", "properties": [ - { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "functionName"], "description": "Scope type." }, + { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch"], "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." @@ -96,30 +95,6 @@ { "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": [ @@ -149,7 +124,8 @@ ], "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." } + { "name": "locations", "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." }, + { "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." } ], "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." }, @@ -161,7 +137,8 @@ ], "returns": [ { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, - { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." } + { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." }, + { "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." } ], "description": "Sets JavaScript breakpoint at a given location." }, @@ -201,16 +178,16 @@ }, { "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": "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." } - ] + ], + "description": "Searches for given string in script content." }, { "name": "getScriptSource", @@ -230,7 +207,7 @@ "returns": [ { "name": "details", "$ref": "FunctionDetails", "description": "Information about the function." } ], - "description": "Returns detailed information on given function." + "description": "Returns detailed informtation on given function." }, { "name": "setPauseOnExceptions", @@ -248,13 +225,11 @@ { "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." } + { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." } ], "returns": [ { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, - { "name": "savedResultIndex", "type": "integer", "optional": true, "description": "If the result was saved, this is the $n index that can be used to access the value." } + { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." } ], "description": "Evaluates expression on a given call frame." }, @@ -309,7 +284,7 @@ "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": "reason", "type": "string", "enum": [ "XHR", "DOM", "EventListener", "exception", "assert", "CSPViolation", "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." @@ -320,17 +295,10 @@ }, { "name": "didSampleProbe", - "description": "Fires when a new probe sample is collected.", + "description": "Fires when a new proben 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/IndexedDB.json b/Source/JavaScriptCore/inspector/protocol/IndexedDB.json deleted file mode 100644 index 0e984e4e8..000000000 --- a/Source/JavaScriptCore/inspector/protocol/IndexedDB.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "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/InspectorDomain.json index 0420ebda0..83a213021 100644 --- a/Source/JavaScriptCore/inspector/protocol/Inspector.json +++ b/Source/JavaScriptCore/inspector/protocol/InspectorDomain.json @@ -9,16 +9,13 @@ { "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": "testCallId", "type": "integer" }, { "name": "script", "type": "string" } ] }, @@ -37,13 +34,6 @@ ] }, { - "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 deleted file mode 100644 index 61211c238..000000000 --- a/Source/JavaScriptCore/inspector/protocol/LayerTree.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "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": "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/Network.json b/Source/JavaScriptCore/inspector/protocol/Network.json deleted file mode 100644 index de141d214..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Network.json +++ /dev/null @@ -1,336 +0,0 @@ -{ - "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": "canClearBrowserCache", - "description": "Tells whether clearing browser cache is supported.", - "returns": [ - { "name": "result", "type": "boolean", "description": "True if browser cache can be cleared." } - ] - }, - { - "name": "clearBrowserCache", - "description": "Clears browser cache." - }, - { - "name": "canClearBrowserCookies", - "description": "Tells whether clearing browser cookies is supported.", - "returns": [ - { "name": "result", "type": "boolean", "description": "True if browser cookies can be cleared." } - ] - }, - { - "name": "clearBrowserCookies", - "description": "Clears browser cookies." - }, - { - "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 deleted file mode 100644 index 47efa75ef..000000000 --- a/Source/JavaScriptCore/inspector/protocol/OverlayTypes.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "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 deleted file mode 100644 index c210a8975..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Page.json +++ /dev/null @@ -1,357 +0,0 @@ -{ - "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 deleted file mode 100644 index 7bc26bda7..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Replay.json +++ /dev/null @@ -1,264 +0,0 @@ -{ - "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 index c321f6afd..f7bf133b4 100644 --- a/Source/JavaScriptCore/inspector/protocol/Runtime.json +++ b/Source/JavaScriptCore/inspector/protocol/Runtime.json @@ -12,15 +12,13 @@ "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": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean"], "description": "Object type." }, + { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." }, { "name": "className", "type": "string", "optional": true, "description": "Object class (constructor) name. Specified for <code>object</code> type values only." }, { "name": "value", "type": "any", "optional": true, "description": "Remote object value (in case of primitive values or JSON values if it was requested)." }, { "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." } + { "name": "preview", "$ref": "ObjectPreview", "optional": true, "description": "Preview containsing abbreviated property values." } ] }, { @@ -28,14 +26,9 @@ "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." } + { "name": "overflow", "type": "boolean", "description": "True iff some of the properties of the original did not fit." }, + { "name": "properties", "type": "array", "items": { "$ref": "PropertyPreview" }, "description": "List of the properties." } ] }, { @@ -43,27 +36,10 @@ "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": "type", "type": "string", "enum": ["object", "function", "undefined", "string", "number", "boolean"], "description": "Object type." }, { "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." } + { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." } ] }, { @@ -71,7 +47,7 @@ "type": "object", "description": "Object property descriptor.", "properties": [ - { "name": "name", "type": "string", "description": "Property name or symbol description." }, + { "name": "name", "type": "string", "description": "Property name." }, { "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)." }, @@ -79,9 +55,7 @@ { "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." } + { "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object." } ] }, { @@ -108,6 +82,11 @@ "description": "Id of an execution context." }, { + "id": "RuntimeFrameId", + "type": "string", + "description": "Unique frame identifier. FIXME: Duplicate of Network.FrameId <https://webkit.org/b/125664> Web Inspector: FIX Type Dependency Issues" + }, + { "id": "ExecutionContextDescription", "type": "object", "description": "Description of an isolated world.", @@ -115,7 +94,7 @@ { "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." } + { "name": "frameId", "$ref": "RuntimeFrameId", "description": "Id of the owning frame." } ] }, { @@ -132,64 +111,6 @@ { "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." } - ] } ], "commands": [ @@ -214,13 +135,11 @@ { "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." } + { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." } ], "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." } + { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." } ], "description": "Evaluates expression on global object." }, @@ -244,8 +163,7 @@ "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." } + { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." } ], "returns": [ { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." }, @@ -254,42 +172,6 @@ "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." } @@ -314,34 +196,6 @@ { "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": [ diff --git a/Source/JavaScriptCore/inspector/protocol/Timeline.json b/Source/JavaScriptCore/inspector/protocol/Timeline.json deleted file mode 100644 index 89ff1972f..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Timeline.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "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", - "ScrollLayer", - "ParseHTML", - "TimerInstall", - "TimerRemove", - "TimerFire", - "EvaluateScript", - "MarkLoad", - "MarkDOMContent", - "TimeStamp", - "Time", - "TimeEnd", - "XHRReadyStateChange", - "XHRLoad", - "FunctionCall", - "ProbeSample", - "ConsoleProfile", - "GCEvent", - "RequestAnimationFrame", - "CancelAnimationFrame", - "FireAnimationFrame", - "WebSocketCreate", - "WebSocketSendHandshakeRequest", - "WebSocketReceiveHandshakeResponse", - "WebSocketDestroy" - ], - "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/protocol/Worker.json b/Source/JavaScriptCore/inspector/protocol/Worker.json deleted file mode 100644 index 5269e1367..000000000 --- a/Source/JavaScriptCore/inspector/protocol/Worker.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "domain": "Worker", - "types": [], - "availability": "web", - "commands": [ - { - "name": "enable" - }, - { - "name": "disable" - }, - { - "name": "sendMessageToWorker", - "parameters": [ - { "name": "workerId", "type": "integer" }, - { "name": "message", "type": "object" } - ] - }, - { - "name": "canInspectWorkers", - "description": "Tells whether browser supports workers inspection.", - "returns": [ - { "name": "result", "type": "boolean", "description": "True if browser has workers support." } - ] - }, - { - "name": "connectToWorker", - "parameters": [ - { "name": "workerId", "type": "integer" } - ] - }, - { - "name": "disconnectFromWorker", - "parameters": [ - { "name": "workerId", "type": "integer" } - ] - }, - { - "name": "setAutoconnectToWorkers", - "parameters": [ - { "name": "value", "type": "boolean" } - ] - } - ], - "events": [ - { - "name": "workerCreated", - "parameters": [ - { "name": "workerId", "type": "integer" }, - { "name": "url", "type": "string" }, - { "name": "inspectorConnected", "type": "boolean" } - ] - }, - { - "name": "workerTerminated", - "parameters": [ - { "name": "workerId", "type": "integer" } - ] - }, - { - "name": "dispatchMessageFromWorker", - "parameters": [ - { "name": "workerId", "type": "integer" }, - { "name": "message", "type": "object" } - ] - }, - { - "name": "disconnectedFromWorker" - } - ] -} diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h b/Source/JavaScriptCore/inspector/remote/RemoteInspector.h deleted file mode 100644 index 68a3c53ec..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspector.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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 RemoteInspector_h -#define RemoteInspector_h - -#import "RemoteInspectorXPCConnection.h" -#import <wtf/Forward.h> -#import <wtf/HashMap.h> -#import <wtf/Lock.h> -#import <wtf/RetainPtr.h> - -OBJC_CLASS NSDictionary; -OBJC_CLASS NSString; - -namespace Inspector { - -class RemoteInspectorClient; -class RemoteInspectorDebuggable; -class RemoteInspectorDebuggableConnection; -struct RemoteInspectorDebuggableInfo; - -class JS_EXPORT_PRIVATE RemoteInspector final : public RemoteInspectorXPCConnection::Client { -public: - static void startDisabled(); - static RemoteInspector& singleton(); - friend class NeverDestroyed<RemoteInspector>; - - void registerDebuggable(RemoteInspectorDebuggable*); - void unregisterDebuggable(RemoteInspectorDebuggable*); - void updateDebuggable(RemoteInspectorDebuggable*); - void updateDebuggableAutomaticInspectCandidate(RemoteInspectorDebuggable*); - void sendMessageToRemoteFrontend(unsigned identifier, const String& message); - void setupFailed(unsigned identifier); - void setupCompleted(unsigned identifier); - bool waitingForAutomaticInspection(unsigned identifier); - - 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 nextAvailableIdentifier(); - - enum class StopSource { API, XPCMessage }; - void stopInternal(StopSource); - - void setupXPCConnectionIfNeeded(); - - NSDictionary *listingForDebuggable(const RemoteInspectorDebuggableInfo&) const; - void pushListingNow(); - void pushListingSoon(); - - 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); - - static bool startEnabled; - - // Debuggables can be registered from any thread at any time. - // Any debuggable 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, std::pair<RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo>> m_debuggableMap; - HashMap<unsigned, RefPtr<RemoteInspectorDebuggableConnection>> m_connectionMap; - RefPtr<RemoteInspectorXPCConnection> m_xpcConnection; - - dispatch_queue_t m_xpcQueue; - unsigned m_nextAvailableIdentifier; - int m_notifyToken; - bool m_enabled; - bool m_hasActiveDebugSession; - bool m_pushScheduled; - - pid_t m_parentProcessIdentifier; - RetainPtr<CFDataRef> m_parentProcessAuditData; - bool m_shouldSendParentProcessInformation; - bool m_automaticInspectionEnabled; - bool m_automaticInspectionPaused; - unsigned m_automaticInspectionCandidateIdentifier; -}; - -} // 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 deleted file mode 100644 index 5d9ddbdd8..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ - -#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" -#define WIRPageIdentifierKey @"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 WIRDestinationKey @"WIRDestinationKey" -#define WIRConnectionDiedMessage @"WIRConnectionDiedMessage" -#define WIRTypeKey @"WIRTypeKey" -#define WIRTypeJavaScript @"WIRTypeJavaScript" -#define WIRTypeWeb @"WIRTypeWeb" -#define WIRAutomaticallyPause @"WIRAutomaticallyPause" - -#define WIRAutomaticInspectionEnabledKey @"WIRAutomaticInspectionEnabledKey" -#define WIRAutomaticInspectionSessionIdentifierKey @"WIRAutomaticInspectionSessionIdentifierKey" -#define WIRAutomaticInspectionConfigurationMessage @"WIRAutomaticInspectionConfigurationMessage" -#define WIRAutomaticInspectionRejectMessage @"WIRAutomaticInspectionRejectMessage" -#define WIRAutomaticInspectionCandidateMessage @"WIRAutomaticInspectionCandidateMessage" - -// 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/RemoteInspectorDebuggable.cpp b/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp deleted file mode 100644 index ac83a18e9..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 "RemoteInspectorDebuggable.h" - -#if ENABLE(REMOTE_INSPECTOR) - -#include "EventLoop.h" -#include "InspectorFrontendChannel.h" -#include "RemoteInspector.h" - -namespace Inspector { - -RemoteInspectorDebuggable::RemoteInspectorDebuggable() - : m_identifier(0) - , m_allowed(false) -{ -} - -RemoteInspectorDebuggable::~RemoteInspectorDebuggable() -{ - RemoteInspector::singleton().unregisterDebuggable(this); -} - -void RemoteInspectorDebuggable::init() -{ - RemoteInspector::singleton().registerDebuggable(this); -} - -void RemoteInspectorDebuggable::update() -{ - RemoteInspector::singleton().updateDebuggable(this); -} - -void RemoteInspectorDebuggable::setRemoteDebuggingAllowed(bool allowed) -{ - if (m_allowed == allowed) - return; - - m_allowed = allowed; - - if (m_allowed && automaticInspectionAllowed()) - RemoteInspector::singleton().updateDebuggableAutomaticInspectCandidate(this); - else - RemoteInspector::singleton().updateDebuggable(this); -} - -RemoteInspectorDebuggableInfo RemoteInspectorDebuggable::info() const -{ - RemoteInspectorDebuggableInfo info; - info.identifier = identifier(); - info.type = type(); - info.name = name(); - info.url = url(); - info.hasLocalDebugger = hasLocalDebugger(); - info.remoteDebuggingAllowed = remoteDebuggingAllowed(); - return info; -} - -void RemoteInspectorDebuggable::pauseWaitingForAutomaticInspection() -{ - ASSERT(m_identifier); - ASSERT(m_allowed); - ASSERT(automaticInspectionAllowed()); - - EventLoop loop; - while (RemoteInspector::singleton().waitingForAutomaticInspection(identifier()) && !loop.ended()) - loop.cycle(); -} - -void RemoteInspectorDebuggable::unpauseForInitializedInspector() -{ - RemoteInspector::singleton().setupCompleted(identifier()); -} - -} // namespace Inspector - -#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h deleted file mode 100644 index 064b83ae8..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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 RemoteInspectorDebuggable_h -#define RemoteInspectorDebuggable_h - -#include <CoreFoundation/CFRunLoop.h> -#include <wtf/RetainPtr.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - -class FrontendChannel; - -struct RemoteInspectorDebuggableInfo; - -class JS_EXPORT_PRIVATE RemoteInspectorDebuggable { -public: - RemoteInspectorDebuggable(); - virtual ~RemoteInspectorDebuggable(); - - void init(); - void update(); - - unsigned identifier() const { return m_identifier; } - void setIdentifier(unsigned identifier) { m_identifier = identifier; } - - bool remoteDebuggingAllowed() const { return m_allowed; } - void setRemoteDebuggingAllowed(bool); - - CFRunLoopRef debuggerRunLoop() { return m_runLoop.get(); } - void setDebuggerRunLoop(CFRunLoopRef runLoop) { m_runLoop = runLoop; } - - RemoteInspectorDebuggableInfo info() const; - - enum DebuggableType { JavaScript, Web }; - virtual DebuggableType type() const = 0; - virtual String name() const { return String(); } // JavaScript and Web - virtual String url() const { return String(); } // Web - virtual bool hasLocalDebugger() const = 0; - - virtual void connect(FrontendChannel*, bool isAutomaticInspection) = 0; - virtual void disconnect() = 0; - virtual void dispatchMessageFromRemoteFrontend(const String& message) = 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(); - -private: - unsigned m_identifier; - bool m_allowed; - RetainPtr<CFRunLoopRef> m_runLoop; -}; - -struct RemoteInspectorDebuggableInfo { - RemoteInspectorDebuggableInfo() - : identifier(0) - , type(RemoteInspectorDebuggable::JavaScript) - , hasLocalDebugger(false) - , remoteDebuggingAllowed(false) - { - } - - unsigned identifier; - RemoteInspectorDebuggable::DebuggableType type; - String name; - String url; - bool hasLocalDebugger; - bool remoteDebuggingAllowed; -}; - -} // namespace Inspector - -#endif // RemoteInspectorDebuggable_h - -#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h deleted file mode 100644 index e5e5d4f5d..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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 RemoteInspectorDebuggableConnection_h -#define RemoteInspectorDebuggableConnection_h - -#import "InspectorFrontendChannel.h" -#import "RemoteInspectorDebuggable.h" -#import <mutex> -#import <wtf/Lock.h> -#import <wtf/RetainPtr.h> -#import <wtf/ThreadSafeRefCounted.h> - -OBJC_CLASS NSString; - -namespace Inspector { - -class RemoteInspectorBlock { -public: - RemoteInspectorBlock(void (^task)()) - : m_task(Block_copy(task)) - { - } - - RemoteInspectorBlock(const RemoteInspectorBlock& other) - : m_task(Block_copy(other.m_task)) - { - } - - ~RemoteInspectorBlock() - { - Block_release(m_task); - } - - RemoteInspectorBlock& operator=(const RemoteInspectorBlock& other) - { - void (^oldTask)() = m_task; - m_task = Block_copy(other.m_task); - Block_release(oldTask); - return *this; - } - - void operator()() const - { - m_task(); - } - -private: - void (^m_task)(); -}; - -typedef Vector<RemoteInspectorBlock> RemoteInspectorQueue; - -class RemoteInspectorDebuggableConnection final : public ThreadSafeRefCounted<RemoteInspectorDebuggableConnection>, public FrontendChannel { -public: - RemoteInspectorDebuggableConnection(RemoteInspectorDebuggable*, NSString *connectionIdentifier, NSString *destination, RemoteInspectorDebuggable::DebuggableType); - virtual ~RemoteInspectorDebuggableConnection(); - - NSString *destination() const; - NSString *connectionIdentifier() const; - unsigned identifier() const { return m_identifier; } - - bool setup(bool isAutomaticInspection, bool automaticallyPause); - - void close(); - void closeFromDebuggable(); - - void sendMessageToBackend(NSString *); - virtual bool sendMessageToFrontend(const String&) override; - - Lock& queueMutex() { return m_queueMutex; } - RemoteInspectorQueue queue() const { return m_queue; } - void clearQueue() { m_queue.clear(); } - -private: - void dispatchAsyncOnDebuggable(void (^block)()); - - void setupRunLoop(); - void teardownRunLoop(); - void queueTaskOnPrivateRunLoop(void (^block)()); - - // This connection from the RemoteInspector singleton to the Debuggable - // can be used on multiple threads. So any access to the debuggable - // itself must take this mutex to ensure m_debuggable is valid. - Lock m_debuggableMutex; - - // If a debuggable 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; - RemoteInspectorQueue m_queue; - Lock m_queueMutex; - - RemoteInspectorDebuggable* m_debuggable; - RetainPtr<NSString> m_connectionIdentifier; - RetainPtr<NSString> m_destination; - unsigned m_identifier; - bool m_connected; -}; - -} // namespace Inspector - -#endif // RemoteInspectorDebuggableConnection_h - -#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h deleted file mode 100644 index e97ca719e..000000000 --- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorXPCConnection.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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; -}; - -} // namespace Inspector - -#endif // RemoteInspectorXPCConnection_h - -#endif // ENABLE(REMOTE_INSPECTOR) diff --git a/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspector.py b/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspector.py new file mode 100755 index 000000000..9c6195ff4 --- /dev/null +++ b/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspector.py @@ -0,0 +1,2613 @@ +#!/usr/bin/env python +# Copyright (c) 2011 Google Inc. All rights reserved. +# Copyright (c) 2012 Intel Corporation. All rights reserved. +# 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: +# +# * 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. + +import os.path +import sys +import string +import optparse +import re +try: + import json +except ImportError: + import simplejson as json + +import CodeGeneratorInspectorStrings + + +DOMAIN_DEFINE_NAME_MAP = { + "Database": "SQL_DATABASE", + "IndexedDB": "INDEXED_DATABASE", +} + + +# Manually-filled map of type name replacements. +TYPE_NAME_FIX_MAP = { + "RGBA": "Rgba", # RGBA is reported to be conflicting with a define name in Windows CE. + "": "Empty", +} + + +TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", "Runtime.InternalPropertyDescriptor", + "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"]) + +TYPES_WITH_OPEN_FIELD_LIST_SET = frozenset(["Timeline.TimelineEvent", + # InspectorStyleSheet not only creates this property but wants to read it and modify it. + "CSS.CSSProperty", + # InspectorResourceAgent needs to update mime-type. + "Network.Response"]) + +EXACTLY_INT_SUPPORTED = False + +INSPECTOR_TYPES_GENERATOR_CONFIG_MAP = { + "JavaScript": { + "prefix": "JS", + "typebuilder_dependency": "", + "export_macro": "JS_EXPORT_PRIVATE", + }, + "Web": { + "prefix": "Web", + "typebuilder_dependency": "#include <inspector/InspectorJSTypeBuilders.h>", + "export_macro": "", + }, +} + +cmdline_parser = optparse.OptionParser(usage="usage: %prog [options] <Inspector.json>") +cmdline_parser.add_option("--output_h_dir") +cmdline_parser.add_option("--output_cpp_dir") +cmdline_parser.add_option("--output_js_dir") +cmdline_parser.add_option("--output_type") # JavaScript, Web +cmdline_parser.add_option("--write_always", action="store_true") +cmdline_parser.add_option("--no_verification", action="store_true") + +try: + arg_options, arg_values = cmdline_parser.parse_args() + if (len(arg_values) < 1): + raise Exception("At least one plain argument expected") + + input_json_filename = arg_values[0] + dependency_json_filenames = arg_values[1:] + + output_header_dirname = arg_options.output_h_dir + output_cpp_dirname = arg_options.output_cpp_dir + output_js_dirname = arg_options.output_js_dir + output_type = arg_options.output_type + + write_always = arg_options.write_always + verification = not arg_options.no_verification + if not output_header_dirname: + raise Exception("Output .h directory must be specified") + if not output_cpp_dirname: + raise Exception("Output .cpp directory must be specified") + if not output_js_dirname: + raise Exception("Output .js directory must be specified") + if output_type not in INSPECTOR_TYPES_GENERATOR_CONFIG_MAP.keys(): + raise Exception("Unknown output type. Allowed types are: %s" % INSPECTOR_TYPES_GENERATOR_CONFIG_MAP.keys()) +except Exception: + # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html + exc = sys.exc_info()[1] + sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) + sys.stderr.write("Usage: <script> Inspector.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir> --output_js_dir <output_js_dir> [--write_always] [--no_verification]\n") + exit(1) + + +def dash_to_camelcase(word): + return ''.join(x.capitalize() or '-' for x in word.split('-')) + + +def fix_camel_case(name): + refined = re.sub(r'-(\w)', lambda pat: pat.group(1).upper(), name) + refined = to_title_case(refined) + return re.sub(r'(?i)HTML|XML|WML|API|GC|XHR|DOM|CSS', lambda pat: pat.group(0).upper(), refined) + + +def to_title_case(name): + return name[:1].upper() + name[1:] + + +class Capitalizer: + @staticmethod + def lower_camel_case_to_upper(str): + if len(str) > 0 and str[0].islower(): + str = str[0].upper() + str[1:] + return str + + @staticmethod + def upper_camel_case_to_lower(str): + pos = 0 + while pos < len(str) and str[pos].isupper(): + pos += 1 + if pos == 0: + return str + if pos == 1: + return str[0].lower() + str[1:] + if pos < len(str): + pos -= 1 + possible_abbreviation = str[0:pos] + if possible_abbreviation not in Capitalizer.ABBREVIATION: + raise Exception("Unknown abbreviation %s" % possible_abbreviation) + str = possible_abbreviation.lower() + str[pos:] + return str + + @staticmethod + def camel_case_to_capitalized_with_underscores(str): + if len(str) == 0: + return str + output = Capitalizer.split_camel_case_(str) + return "_".join(output).upper() + + @staticmethod + def split_camel_case_(str): + output = [] + pos_being = 0 + pos = 1 + has_oneletter = False + while pos < len(str): + if str[pos].isupper(): + output.append(str[pos_being:pos].upper()) + if pos - pos_being == 1: + has_oneletter = True + pos_being = pos + pos += 1 + output.append(str[pos_being:]) + if has_oneletter: + array_pos = 0 + while array_pos < len(output) - 1: + if len(output[array_pos]) == 1: + array_pos_end = array_pos + 1 + while array_pos_end < len(output) and len(output[array_pos_end]) == 1: + array_pos_end += 1 + if array_pos_end - array_pos > 1: + possible_abbreviation = "".join(output[array_pos:array_pos_end]) + if possible_abbreviation.upper() in Capitalizer.ABBREVIATION: + output[array_pos:array_pos_end] = [possible_abbreviation] + else: + array_pos = array_pos_end - 1 + array_pos += 1 + return output + + ABBREVIATION = frozenset(["XHR", "DOM", "CSS"]) + +VALIDATOR_IFDEF_NAME = "!ASSERT_DISABLED" + + +class DomainNameFixes: + @classmethod + def get_fixed_data(cls, domain_name): + field_name_res = Capitalizer.upper_camel_case_to_lower(domain_name) + "Agent" + + class Res(object): + skip_js_bind = domain_name in cls.skip_js_bind_domains + + @staticmethod + def get_guard(): + if domain_name in DOMAIN_DEFINE_NAME_MAP: + define_name = DOMAIN_DEFINE_NAME_MAP[domain_name] + + class Guard: + @staticmethod + def generate_open(output): + output.append("#if ENABLE(%s)\n" % define_name) + + @staticmethod + def generate_close(output): + output.append("#endif // ENABLE(%s)\n" % define_name) + + return Guard + + return Res + + skip_js_bind_domains = set(["DOMDebugger"]) + + +class RawTypes(object): + @staticmethod + def get(json_type): + if json_type == "boolean": + return RawTypes.Bool + elif json_type == "string": + return RawTypes.String + elif json_type == "array": + return RawTypes.Array + elif json_type == "object": + return RawTypes.Object + elif json_type == "integer": + return RawTypes.Int + elif json_type == "number": + return RawTypes.Number + elif json_type == "any": + return RawTypes.Any + else: + raise Exception("Unknown type: %s" % json_type) + + # For output parameter all values are passed by pointer except RefPtr-based types. + class OutputPassModel: + class ByPointer: + @staticmethod + def get_argument_prefix(): + return "&" + + @staticmethod + def get_parameter_type_suffix(): + return "*" + + class ByReference: + @staticmethod + def get_argument_prefix(): + return "" + + @staticmethod + def get_parameter_type_suffix(): + return "&" + + class BaseType(object): + need_internal_runtime_cast_ = False + + @classmethod + def request_raw_internal_runtime_cast(cls): + if not cls.need_internal_runtime_cast_: + cls.need_internal_runtime_cast_ = True + + @classmethod + def get_raw_validator_call_text(cls): + return "RuntimeCastHelper::assertType<Inspector::InspectorValue::Type%s>" % cls.get_validate_method_params().template_type + + class String(BaseType): + @staticmethod + def get_getter_name(): + return "String" + + get_setter_name = get_getter_name + + @staticmethod + def get_c_initializer(): + return "\"\"" + + @staticmethod + def get_js_bind_type(): + return "string" + + @staticmethod + def get_validate_method_params(): + class ValidateMethodParams: + template_type = "String" + return ValidateMethodParams + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByPointer + + @staticmethod + def is_heavy_value(): + return True + + @staticmethod + def get_array_item_raw_c_type_text(): + return "String" + + @staticmethod + def get_raw_type_model(): + return TypeModel.String + + class Int(BaseType): + @staticmethod + def get_getter_name(): + return "Int" + + @staticmethod + def get_setter_name(): + return "Number" + + @staticmethod + def get_c_initializer(): + return "0" + + @staticmethod + def get_js_bind_type(): + return "number" + + @classmethod + def get_raw_validator_call_text(cls): + return "RuntimeCastHelper::assertInt" + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByPointer + + @staticmethod + def is_heavy_value(): + return False + + @staticmethod + def get_array_item_raw_c_type_text(): + return "int" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Int + + class Number(BaseType): + @staticmethod + def get_getter_name(): + return "Double" + + @staticmethod + def get_setter_name(): + return "Number" + + @staticmethod + def get_c_initializer(): + return "0" + + @staticmethod + def get_js_bind_type(): + return "number" + + @staticmethod + def get_validate_method_params(): + class ValidateMethodParams: + template_type = "Number" + return ValidateMethodParams + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByPointer + + @staticmethod + def is_heavy_value(): + return False + + @staticmethod + def get_array_item_raw_c_type_text(): + return "double" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Number + + class Bool(BaseType): + @staticmethod + def get_getter_name(): + return "Boolean" + + get_setter_name = get_getter_name + + @staticmethod + def get_c_initializer(): + return "false" + + @staticmethod + def get_js_bind_type(): + return "boolean" + + @staticmethod + def get_validate_method_params(): + class ValidateMethodParams: + template_type = "Boolean" + return ValidateMethodParams + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByPointer + + @staticmethod + def is_heavy_value(): + return False + + @staticmethod + def get_array_item_raw_c_type_text(): + return "bool" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Bool + + class Object(BaseType): + @staticmethod + def get_getter_name(): + return "Object" + + @staticmethod + def get_setter_name(): + return "Value" + + @staticmethod + def get_c_initializer(): + return "InspectorObject::create()" + + @staticmethod + def get_js_bind_type(): + return "object" + + @staticmethod + def get_output_argument_prefix(): + return "" + + @staticmethod + def get_validate_method_params(): + class ValidateMethodParams: + template_type = "Object" + return ValidateMethodParams + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByReference + + @staticmethod + def is_heavy_value(): + return True + + @staticmethod + def get_array_item_raw_c_type_text(): + return "Inspector::InspectorObject" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Object + + class Any(BaseType): + @staticmethod + def get_getter_name(): + return "Value" + + get_setter_name = get_getter_name + + @staticmethod + def get_c_initializer(): + raise Exception("Unsupported") + + @staticmethod + def get_js_bind_type(): + raise Exception("Unsupported") + + @staticmethod + def get_raw_validator_call_text(): + return "RuntimeCastHelper::assertAny" + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByReference + + @staticmethod + def is_heavy_value(): + return True + + @staticmethod + def get_array_item_raw_c_type_text(): + return "Inspector::InspectorValue" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Any + + class Array(BaseType): + @staticmethod + def get_getter_name(): + return "Array" + + @staticmethod + def get_setter_name(): + return "Value" + + @staticmethod + def get_c_initializer(): + return "InspectorArray::create()" + + @staticmethod + def get_js_bind_type(): + return "object" + + @staticmethod + def get_output_argument_prefix(): + return "" + + @staticmethod + def get_validate_method_params(): + class ValidateMethodParams: + template_type = "Array" + return ValidateMethodParams + + @staticmethod + def get_output_pass_model(): + return RawTypes.OutputPassModel.ByReference + + @staticmethod + def is_heavy_value(): + return True + + @staticmethod + def get_array_item_raw_c_type_text(): + return "Inspector::InspectorArray" + + @staticmethod + def get_raw_type_model(): + return TypeModel.Array + + +def replace_right_shift(input_str): + return input_str.replace(">>", "> >") + + +class CommandReturnPassModel: + class ByReference: + def __init__(self, var_type, set_condition): + self.var_type = var_type + self.set_condition = set_condition + + def get_return_var_type(self): + return self.var_type + + @staticmethod + def get_output_argument_prefix(): + return "" + + @staticmethod + def get_output_to_raw_expression(): + return "%s" + + def get_output_parameter_type(self): + return self.var_type + "&" + + def get_set_return_condition(self): + return self.set_condition + + class ByPointer: + def __init__(self, var_type): + self.var_type = var_type + + def get_return_var_type(self): + return self.var_type + + @staticmethod + def get_output_argument_prefix(): + return "&" + + @staticmethod + def get_output_to_raw_expression(): + return "%s" + + def get_output_parameter_type(self): + return self.var_type + "*" + + @staticmethod + def get_set_return_condition(): + return None + + class OptOutput: + def __init__(self, var_type): + self.var_type = var_type + + def get_return_var_type(self): + return "Inspector::TypeBuilder::OptOutput<%s>" % self.var_type + + @staticmethod + def get_output_argument_prefix(): + return "&" + + @staticmethod + def get_output_to_raw_expression(): + return "%s.getValue()" + + def get_output_parameter_type(self): + return "Inspector::TypeBuilder::OptOutput<%s>*" % self.var_type + + @staticmethod + def get_set_return_condition(): + return "%s.isAssigned()" + + +class TypeModel: + class RefPtrBased(object): + def __init__(self, class_name): + self.class_name = class_name + self.optional = False + + def get_optional(self): + result = TypeModel.RefPtrBased(self.class_name) + result.optional = True + return result + + def get_command_return_pass_model(self): + if self.optional: + set_condition = "%s" + else: + set_condition = None + return CommandReturnPassModel.ByReference(replace_right_shift("RefPtr<%s>" % self.class_name), set_condition) + + def get_input_param_type_text(self): + return replace_right_shift("PassRefPtr<%s>" % self.class_name) + + @staticmethod + def get_event_setter_expression_pattern(): + return "%s" + + class Enum(object): + def __init__(self, base_type_name): + self.type_name = base_type_name + "::Enum" + + def get_optional(base_self): + class EnumOptional: + @classmethod + def get_optional(cls): + return cls + + @staticmethod + def get_command_return_pass_model(): + return CommandReturnPassModel.OptOutput(base_self.type_name) + + @staticmethod + def get_input_param_type_text(): + return base_self.type_name + "*" + + @staticmethod + def get_event_setter_expression_pattern(): + raise Exception("TODO") + return EnumOptional + + def get_command_return_pass_model(self): + return CommandReturnPassModel.ByPointer(self.type_name) + + def get_input_param_type_text(self): + return self.type_name + + @staticmethod + def get_event_setter_expression_pattern(): + return "%s" + + class ValueType(object): + def __init__(self, type_name, is_heavy): + self.type_name = type_name + self.is_heavy = is_heavy + + def get_optional(self): + return self.ValueOptional(self) + + def get_command_return_pass_model(self): + return CommandReturnPassModel.ByPointer(self.type_name) + + def get_input_param_type_text(self): + if self.is_heavy: + return "const %s&" % self.type_name + else: + return self.type_name + + def get_opt_output_type_(self): + return self.type_name + + @staticmethod + def get_event_setter_expression_pattern(): + return "%s" + + class ValueOptional: + def __init__(self, base): + self.base = base + + def get_optional(self): + return self + + def get_command_return_pass_model(self): + return CommandReturnPassModel.OptOutput(self.base.get_opt_output_type_()) + + def get_input_param_type_text(self): + return "const %s* const" % self.base.type_name + + @staticmethod + def get_event_setter_expression_pattern(): + return "*%s" + + class ExactlyInt(ValueType): + def __init__(self): + TypeModel.ValueType.__init__(self, "int", False) + + def get_input_param_type_text(self): + return "Inspector::TypeBuilder::ExactlyInt" + + def get_opt_output_type_(self): + return "Inspector::TypeBuilder::ExactlyInt" + + @classmethod + def init_class(cls): + cls.Bool = cls.ValueType("bool", False) + if EXACTLY_INT_SUPPORTED: + cls.Int = cls.ExactlyInt() + else: + cls.Int = cls.ValueType("int", False) + cls.Number = cls.ValueType("double", False) + cls.String = cls.ValueType("String", True,) + cls.Object = cls.RefPtrBased("Inspector::InspectorObject") + cls.Array = cls.RefPtrBased("Inspector::InspectorArray") + cls.Any = cls.RefPtrBased("Inspector::InspectorValue") + +TypeModel.init_class() + + +# Collection of InspectorObject class methods that are likely to be overloaded in generated class. +# We must explicitly import all overloaded methods or they won't be available to user. +INSPECTOR_OBJECT_SETTER_NAMES = frozenset(["setValue", "setBoolean", "setNumber", "setString", "setValue", "setObject", "setArray"]) + + +def fix_type_name(json_name): + if json_name in TYPE_NAME_FIX_MAP: + fixed = TYPE_NAME_FIX_MAP[json_name] + + class Result(object): + class_name = fixed + + @staticmethod + def output_comment(writer): + writer.newline("// Type originally was named '%s'.\n" % json_name) + else: + + class Result(object): + class_name = json_name + + @staticmethod + def output_comment(writer): + pass + + return Result + + +class Writer: + def __init__(self, output, indent): + self.output = output + self.indent = indent + + def newline(self, str): + if (self.indent): + self.output.append(self.indent) + self.output.append(str) + + def append(self, str): + self.output.append(str) + + def newline_multiline(self, str): + parts = str.split('\n') + self.newline(parts[0]) + for p in parts[1:]: + self.output.append('\n') + if p: + self.newline(p) + + def append_multiline(self, str): + parts = str.split('\n') + self.append(parts[0]) + for p in parts[1:]: + self.output.append('\n') + if p: + self.newline(p) + + def get_indent(self): + return self.indent + + def get_indented(self, additional_indent): + return Writer(self.output, self.indent + additional_indent) + + def insert_writer(self, additional_indent): + new_output = [] + self.output.append(new_output) + return Writer(new_output, self.indent + additional_indent) + + +class EnumConstants: + map_ = {} + constants_ = [] + + @classmethod + def add_constant(cls, value): + if value in cls.map_: + return cls.map_[value] + else: + pos = len(cls.map_) + cls.map_[value] = pos + cls.constants_.append(value) + return pos + + @classmethod + def get_enum_constant_code(cls): + output = [] + for item in cls.constants_: + output.append(" \"" + item + "\"") + return ",\n".join(output) + "\n" + + +# Typebuilder code is generated in several passes: first typedefs, then other classes. +# Manual pass management is needed because we cannot have forward declarations for typedefs. +class TypeBuilderPass: + TYPEDEF = "typedef" + MAIN = "main" + + +class TypeBindings: + @staticmethod + def create_named_type_declaration(json_typable, context_domain_name, type_data): + json_type = type_data.get_json_type() + + class Helper: + is_ad_hoc = False + full_name_prefix_for_use = "Inspector::TypeBuilder::" + context_domain_name + "::" + full_name_prefix_for_impl = "Inspector::TypeBuilder::" + context_domain_name + "::" + + @staticmethod + def write_doc(writer): + if "description" in json_type: + writer.newline("/* ") + writer.append(json_type["description"]) + writer.append(" */\n") + + @staticmethod + def add_to_forward_listener(forward_listener): + forward_listener.add_type_data(type_data) + + + fixed_type_name = fix_type_name(json_type["id"]) + return TypeBindings.create_type_declaration_(json_typable, context_domain_name, fixed_type_name, Helper) + + @staticmethod + def create_ad_hoc_type_declaration(json_typable, context_domain_name, ad_hoc_type_context): + class Helper: + is_ad_hoc = True + full_name_prefix_for_use = ad_hoc_type_context.container_relative_name_prefix + full_name_prefix_for_impl = ad_hoc_type_context.container_full_name_prefix + + @staticmethod + def write_doc(writer): + pass + + @staticmethod + def add_to_forward_listener(forward_listener): + pass + fixed_type_name = ad_hoc_type_context.get_type_name_fix() + return TypeBindings.create_type_declaration_(json_typable, context_domain_name, fixed_type_name, Helper) + + @staticmethod + def create_type_declaration_(json_typable, context_domain_name, fixed_type_name, helper): + if json_typable["type"] == "string": + if "enum" in json_typable: + + class EnumBinding: + need_user_runtime_cast_ = False + need_internal_runtime_cast_ = False + + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @classmethod + def request_user_runtime_cast(cls, request): + if request: + cls.need_user_runtime_cast_ = True + request.acknowledge() + + @classmethod + def request_internal_runtime_cast(cls): + cls.need_internal_runtime_cast_ = True + + @classmethod + def get_code_generator(enum_binding_cls): + #FIXME: generate ad-hoc enums too once we figure out how to better implement them in C++. + comment_out = helper.is_ad_hoc + + class CodeGenerator: + @staticmethod + def generate_type_builder(writer, generate_context): + enum = json_typable["enum"] + helper.write_doc(writer) + enum_name = fixed_type_name.class_name + fixed_type_name.output_comment(writer) + writer.newline("struct ") + writer.append(enum_name) + writer.append(" {\n") + writer.newline(" enum Enum {\n") + for enum_item in enum: + enum_pos = EnumConstants.add_constant(enum_item) + + item_c_name = fix_camel_case(enum_item) + if item_c_name in TYPE_NAME_FIX_MAP: + item_c_name = TYPE_NAME_FIX_MAP[item_c_name] + writer.newline(" ") + writer.append(item_c_name) + writer.append(" = ") + writer.append("%s" % enum_pos) + writer.append(",\n") + writer.newline(" };\n") + if enum_binding_cls.need_user_runtime_cast_: + raise Exception("Not yet implemented") + + if enum_binding_cls.need_internal_runtime_cast_: + writer.append("#if %s\n" % VALIDATOR_IFDEF_NAME) + writer.newline(" static void assertCorrectValue(Inspector::InspectorValue* value);\n") + writer.append("#endif // %s\n" % VALIDATOR_IFDEF_NAME) + + validator_writer = generate_context.validator_writer + + domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name) + domain_guard = domain_fixes.get_guard() + if domain_guard: + domain_guard.generate_open(validator_writer) + + validator_writer.newline("void %s%s::assertCorrectValue(Inspector::InspectorValue* value)\n" % (helper.full_name_prefix_for_impl, enum_name)) + validator_writer.newline("{\n") + validator_writer.newline(" WTF::String s;\n") + validator_writer.newline(" bool cast_res = value->asString(&s);\n") + validator_writer.newline(" ASSERT(cast_res);\n") + if len(enum) > 0: + condition_list = [] + for enum_item in enum: + enum_pos = EnumConstants.add_constant(enum_item) + condition_list.append("s == \"%s\"" % enum_item) + validator_writer.newline(" ASSERT(%s);\n" % " || ".join(condition_list)) + validator_writer.newline("}\n") + + if domain_guard: + domain_guard.generate_close(validator_writer) + + validator_writer.newline("\n\n") + + writer.newline("}; // struct ") + writer.append(enum_name) + writer.append("\n") + + @staticmethod + def register_use(forward_listener): + pass + + @staticmethod + def get_generate_pass_id(): + return TypeBuilderPass.MAIN + + return CodeGenerator + + @classmethod + def get_validator_call_text(cls): + return helper.full_name_prefix_for_use + fixed_type_name.class_name + "::assertCorrectValue" + + @classmethod + def get_array_item_c_type_text(cls): + return helper.full_name_prefix_for_use + fixed_type_name.class_name + "::Enum" + + @staticmethod + def get_setter_value_expression_pattern(): + return "Inspector::TypeBuilder::get%sEnumConstantValue(%s)" + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.String + + @staticmethod + def get_type_model(): + return TypeModel.Enum(helper.full_name_prefix_for_use + fixed_type_name.class_name) + + return EnumBinding + else: + if helper.is_ad_hoc: + + class PlainString: + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @staticmethod + def request_user_runtime_cast(request): + raise Exception("Unsupported") + + @staticmethod + def request_internal_runtime_cast(): + pass + + @staticmethod + def get_code_generator(): + return None + + @classmethod + def get_validator_call_text(cls): + return RawTypes.String.get_raw_validator_call_text() + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.String + + @staticmethod + def get_type_model(): + return TypeModel.String + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @classmethod + def get_array_item_c_type_text(cls): + return cls.reduce_to_raw_type().get_array_item_raw_c_type_text() + + return PlainString + + else: + + class TypedefString: + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @staticmethod + def request_user_runtime_cast(request): + raise Exception("Unsupported") + + @staticmethod + def request_internal_runtime_cast(): + RawTypes.String.request_raw_internal_runtime_cast() + + @staticmethod + def get_code_generator(): + class CodeGenerator: + @staticmethod + def generate_type_builder(writer, generate_context): + helper.write_doc(writer) + fixed_type_name.output_comment(writer) + writer.newline("typedef String ") + writer.append(fixed_type_name.class_name) + writer.append(";\n\n") + + @staticmethod + def register_use(forward_listener): + pass + + @staticmethod + def get_generate_pass_id(): + return TypeBuilderPass.TYPEDEF + + return CodeGenerator + + @classmethod + def get_validator_call_text(cls): + return RawTypes.String.get_raw_validator_call_text() + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.String + + @staticmethod + def get_type_model(): + return TypeModel.ValueType("%s%s" % (helper.full_name_prefix_for_use, fixed_type_name.class_name), True) + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @classmethod + def get_array_item_c_type_text(cls): + return "const %s%s&" % (helper.full_name_prefix_for_use, fixed_type_name.class_name) + + return TypedefString + + elif json_typable["type"] == "integer": + if helper.is_ad_hoc: + + class PlainInteger: + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @staticmethod + def request_user_runtime_cast(request): + raise Exception("Unsupported") + + @staticmethod + def request_internal_runtime_cast(): + pass + + @staticmethod + def get_code_generator(): + return None + + @classmethod + def get_validator_call_text(cls): + return RawTypes.Int.get_raw_validator_call_text() + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.Int + + @staticmethod + def get_type_model(): + return TypeModel.Int + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @classmethod + def get_array_item_c_type_text(cls): + return cls.reduce_to_raw_type().get_array_item_raw_c_type_text() + + return PlainInteger + + else: + + class TypedefInteger: + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @staticmethod + def request_user_runtime_cast(request): + raise Exception("Unsupported") + + @staticmethod + def request_internal_runtime_cast(): + RawTypes.Int.request_raw_internal_runtime_cast() + + @staticmethod + def get_code_generator(): + class CodeGenerator: + @staticmethod + def generate_type_builder(writer, generate_context): + helper.write_doc(writer) + fixed_type_name.output_comment(writer) + writer.newline("typedef int ") + writer.append(fixed_type_name.class_name) + writer.append(";\n\n") + + @staticmethod + def register_use(forward_listener): + pass + + @staticmethod + def get_generate_pass_id(): + return TypeBuilderPass.TYPEDEF + + return CodeGenerator + + @classmethod + def get_validator_call_text(cls): + return RawTypes.Int.get_raw_validator_call_text() + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.Int + + @staticmethod + def get_type_model(): + return TypeModel.Int + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @classmethod + def get_array_item_c_type_text(cls): + return helper.full_name_prefix_for_use + fixed_type_name.class_name + + return TypedefInteger + + elif json_typable["type"] == "object": + if "properties" in json_typable: + + class ClassBinding: + resolve_data_ = None + need_user_runtime_cast_ = False + need_internal_runtime_cast_ = False + + @classmethod + def resolve_inner(cls, resolve_context): + if cls.resolve_data_: + return + + properties = json_typable["properties"] + main = [] + optional = [] + + ad_hoc_type_list = [] + + for prop in properties: + prop_name = prop["name"] + ad_hoc_type_context = cls.AdHocTypeContextImpl(prop_name, fixed_type_name.class_name, resolve_context, ad_hoc_type_list, helper.full_name_prefix_for_impl) + binding = resolve_param_type(prop, context_domain_name, ad_hoc_type_context) + + code_generator = binding.get_code_generator() + if code_generator: + code_generator.register_use(resolve_context.forward_listener) + + class PropertyData: + param_type_binding = binding + p = prop + + if prop.get("optional"): + optional.append(PropertyData) + else: + main.append(PropertyData) + + class ResolveData: + main_properties = main + optional_properties = optional + ad_hoc_types = ad_hoc_type_list + + cls.resolve_data_ = ResolveData + + for ad_hoc in ad_hoc_type_list: + ad_hoc.resolve_inner(resolve_context) + + @classmethod + def request_user_runtime_cast(cls, request): + if not request: + return + cls.need_user_runtime_cast_ = True + request.acknowledge() + cls.request_internal_runtime_cast() + + @classmethod + def request_internal_runtime_cast(cls): + if cls.need_internal_runtime_cast_: + return + cls.need_internal_runtime_cast_ = True + for p in cls.resolve_data_.main_properties: + p.param_type_binding.request_internal_runtime_cast() + for p in cls.resolve_data_.optional_properties: + p.param_type_binding.request_internal_runtime_cast() + + @classmethod + def get_code_generator(class_binding_cls): + class CodeGenerator: + @classmethod + def generate_type_builder(cls, writer, generate_context): + resolve_data = class_binding_cls.resolve_data_ + helper.write_doc(writer) + class_name = fixed_type_name.class_name + + is_open_type = (context_domain_name + "." + class_name) in TYPES_WITH_OPEN_FIELD_LIST_SET + + fixed_type_name.output_comment(writer) + writer.newline("class ") + writer.append(class_name) + writer.append(" : public ") + if is_open_type: + writer.append("Inspector::InspectorObject") + else: + writer.append("Inspector::InspectorObjectBase") + writer.append(" {\n") + writer.newline("public:\n") + ad_hoc_type_writer = writer.insert_writer(" ") + + for ad_hoc_type in resolve_data.ad_hoc_types: + code_generator = ad_hoc_type.get_code_generator() + if code_generator: + code_generator.generate_type_builder(ad_hoc_type_writer, generate_context) + + writer.newline_multiline( +""" enum { + NoFieldsSet = 0, +""") + + state_enum_items = [] + if len(resolve_data.main_properties) > 0: + pos = 0 + for prop_data in resolve_data.main_properties: + item_name = Capitalizer.lower_camel_case_to_upper(prop_data.p["name"]) + "Set" + state_enum_items.append(item_name) + writer.newline(" %s = 1 << %s,\n" % (item_name, pos)) + pos += 1 + all_fields_set_value = "(" + (" | ".join(state_enum_items)) + ")" + else: + all_fields_set_value = "0" + + writer.newline_multiline(CodeGeneratorInspectorStrings.class_binding_builder_part_1 + % (all_fields_set_value, class_name, class_name)) + + pos = 0 + for prop_data in resolve_data.main_properties: + prop_name = prop_data.p["name"] + + param_type_binding = prop_data.param_type_binding + param_raw_type = param_type_binding.reduce_to_raw_type() + + writer.newline_multiline(CodeGeneratorInspectorStrings.class_binding_builder_part_2 + % (state_enum_items[pos], + Capitalizer.lower_camel_case_to_upper(prop_name), + param_type_binding.get_type_model().get_input_param_type_text(), + state_enum_items[pos], prop_name, + param_raw_type.get_setter_name(), prop_name, + format_setter_value_expression(param_type_binding, "value"), + state_enum_items[pos])) + + pos += 1 + + writer.newline_multiline(CodeGeneratorInspectorStrings.class_binding_builder_part_3 + % (class_name, class_name, class_name, class_name, class_name)) + + writer.newline(" /*\n") + writer.newline(" * Synthetic constructor:\n") + writer.newline(" * RefPtr<%s> result = %s::create()" % (class_name, class_name)) + for prop_data in resolve_data.main_properties: + writer.append_multiline("\n * .set%s(...)" % Capitalizer.lower_camel_case_to_upper(prop_data.p["name"])) + writer.append_multiline(";\n */\n") + + writer.newline_multiline(CodeGeneratorInspectorStrings.class_binding_builder_part_4) + + writer.newline(" typedef Inspector::TypeBuilder::StructItemTraits ItemTraits;\n") + + for prop_data in resolve_data.optional_properties: + prop_name = prop_data.p["name"] + param_type_binding = prop_data.param_type_binding + setter_name = "set%s" % Capitalizer.lower_camel_case_to_upper(prop_name) + + writer.append_multiline("\n void %s" % setter_name) + writer.append("(%s value)\n" % param_type_binding.get_type_model().get_input_param_type_text()) + writer.newline(" {\n") + writer.newline(" this->set%s(ASCIILiteral(\"%s\"), %s);\n" + % (param_type_binding.reduce_to_raw_type().get_setter_name(), prop_data.p["name"], + format_setter_value_expression(param_type_binding, "value"))) + writer.newline(" }\n") + + + if setter_name in INSPECTOR_OBJECT_SETTER_NAMES: + writer.newline(" using Inspector::InspectorObjectBase::%s;\n\n" % setter_name) + + if class_binding_cls.need_user_runtime_cast_: + writer.newline(" static PassRefPtr<%s> runtimeCast(PassRefPtr<Inspector::InspectorValue> value)\n" % class_name) + writer.newline(" {\n") + writer.newline(" RefPtr<Inspector::InspectorObject> object;\n") + writer.newline(" bool castRes = value->asObject(&object);\n") + writer.newline(" ASSERT_UNUSED(castRes, castRes);\n") + writer.append("#if %s\n" % VALIDATOR_IFDEF_NAME) + writer.newline(" assertCorrectValue(object.get());\n") + writer.append("#endif // %s\n" % VALIDATOR_IFDEF_NAME) + writer.newline(" COMPILE_ASSERT(sizeof(%s) == sizeof(Inspector::InspectorObjectBase), type_cast_problem);\n" % class_name) + writer.newline(" return static_cast<%s*>(static_cast<Inspector::InspectorObjectBase*>(object.get()));\n" % class_name) + writer.newline(" }\n") + writer.append("\n") + + if class_binding_cls.need_internal_runtime_cast_: + writer.append("#if %s\n" % VALIDATOR_IFDEF_NAME) + writer.newline(" static %s void assertCorrectValue(Inspector::InspectorValue* value);\n" % INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["export_macro"]) + writer.append("#endif // %s\n" % VALIDATOR_IFDEF_NAME) + + closed_field_set = (context_domain_name + "." + class_name) not in TYPES_WITH_OPEN_FIELD_LIST_SET + + validator_writer = generate_context.validator_writer + + domain_fixes = DomainNameFixes.get_fixed_data(context_domain_name) + domain_guard = domain_fixes.get_guard() + if domain_guard: + domain_guard.generate_open(validator_writer) + + validator_writer.newline("void %s%s::assertCorrectValue(Inspector::InspectorValue* value)\n" % (helper.full_name_prefix_for_impl, class_name)) + validator_writer.newline("{\n") + validator_writer.newline(" RefPtr<InspectorObject> object;\n") + validator_writer.newline(" bool castRes = value->asObject(&object);\n") + validator_writer.newline(" ASSERT_UNUSED(castRes, castRes);\n") + for prop_data in resolve_data.main_properties: + validator_writer.newline(" {\n") + it_name = "%sPos" % prop_data.p["name"] + validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) + validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) + validator_writer.newline(" ASSERT(%s != object->end());\n" % it_name) + validator_writer.newline(" %s(%s->value.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + validator_writer.newline(" }\n") + + if closed_field_set: + validator_writer.newline(" int foundPropertiesCount = %s;\n" % len(resolve_data.main_properties)) + + for prop_data in resolve_data.optional_properties: + validator_writer.newline(" {\n") + it_name = "%sPos" % prop_data.p["name"] + validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) + validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) + validator_writer.newline(" if (%s != object->end()) {\n" % it_name) + validator_writer.newline(" %s(%s->value.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + if closed_field_set: + validator_writer.newline(" ++foundPropertiesCount;\n") + validator_writer.newline(" }\n") + validator_writer.newline(" }\n") + + if closed_field_set: + validator_writer.newline(" if (foundPropertiesCount != object->size())\n") + validator_writer.newline(" FATAL(\"Unexpected properties in object: %s\\n\", object->toJSONString().ascii().data());\n") + validator_writer.newline("}\n") + + if domain_guard: + domain_guard.generate_close(validator_writer) + + validator_writer.newline("\n\n") + + if is_open_type: + cpp_writer = generate_context.cpp_writer + writer.append("\n") + writer.newline(" // Property names for type generated as open.\n") + for prop_data in resolve_data.main_properties + resolve_data.optional_properties: + prop_name = prop_data.p["name"] + prop_field_name = Capitalizer.lower_camel_case_to_upper(prop_name) + writer.newline(" static const char* %s;\n" % (prop_field_name)) + cpp_writer.newline("const char* %s%s::%s = \"%s\";\n" % (helper.full_name_prefix_for_impl, class_name, prop_field_name, prop_name)) + + + writer.newline("};\n\n") + + @staticmethod + def generate_forward_declaration(writer): + class_name = fixed_type_name.class_name + writer.newline("class ") + writer.append(class_name) + writer.append(";\n") + + @staticmethod + def register_use(forward_listener): + helper.add_to_forward_listener(forward_listener) + + @staticmethod + def get_generate_pass_id(): + return TypeBuilderPass.MAIN + + return CodeGenerator + + @staticmethod + def get_validator_call_text(): + return helper.full_name_prefix_for_use + fixed_type_name.class_name + "::assertCorrectValue" + + @classmethod + def get_array_item_c_type_text(cls): + return helper.full_name_prefix_for_use + fixed_type_name.class_name + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.Object + + @staticmethod + def get_type_model(): + return TypeModel.RefPtrBased(helper.full_name_prefix_for_use + fixed_type_name.class_name) + + class AdHocTypeContextImpl: + def __init__(self, property_name, class_name, resolve_context, ad_hoc_type_list, parent_full_name_prefix): + self.property_name = property_name + self.class_name = class_name + self.resolve_context = resolve_context + self.ad_hoc_type_list = ad_hoc_type_list + self.container_full_name_prefix = parent_full_name_prefix + class_name + "::" + self.container_relative_name_prefix = "" + + def get_type_name_fix(self): + class NameFix: + class_name = Capitalizer.lower_camel_case_to_upper(self.property_name) + + @staticmethod + def output_comment(writer): + writer.newline("// Named after property name '%s' while generating %s.\n" % (self.property_name, self.class_name)) + + return NameFix + + def add_type(self, binding): + self.ad_hoc_type_list.append(binding) + + return ClassBinding + else: + + class PlainObjectBinding: + @classmethod + def resolve_inner(cls, resolve_context): + pass + + @staticmethod + def request_user_runtime_cast(request): + pass + + @staticmethod + def request_internal_runtime_cast(): + RawTypes.Object.request_raw_internal_runtime_cast() + + @staticmethod + def get_code_generator(): + pass + + @staticmethod + def get_validator_call_text(): + return "RuntimeCastHelper::assertType<InspectorValue::TypeObject>" + + @classmethod + def get_array_item_c_type_text(cls): + return cls.reduce_to_raw_type().get_array_item_raw_c_type_text() + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.Object + + @staticmethod + def get_type_model(): + return TypeModel.Object + + return PlainObjectBinding + elif json_typable["type"] == "array": + if "items" in json_typable: + + ad_hoc_types = [] + + class AdHocTypeContext: + container_full_name_prefix = "<not yet defined>" + container_relative_name_prefix = "" + + @staticmethod + def get_type_name_fix(): + return fixed_type_name + + @staticmethod + def add_type(binding): + ad_hoc_types.append(binding) + + item_binding = resolve_param_type(json_typable["items"], context_domain_name, AdHocTypeContext) + + class ArrayBinding: + resolve_data_ = None + need_internal_runtime_cast_ = False + + @classmethod + def resolve_inner(cls, resolve_context): + if cls.resolve_data_: + return + + class ResolveData: + item_type_binding = item_binding + ad_hoc_type_list = ad_hoc_types + + cls.resolve_data_ = ResolveData + + for t in ad_hoc_types: + t.resolve_inner(resolve_context) + + @classmethod + def request_user_runtime_cast(cls, request): + raise Exception("Not implemented yet") + + @classmethod + def request_internal_runtime_cast(cls): + if cls.need_internal_runtime_cast_: + return + cls.need_internal_runtime_cast_ = True + cls.resolve_data_.item_type_binding.request_internal_runtime_cast() + + @classmethod + def get_code_generator(array_binding_cls): + + class CodeGenerator: + @staticmethod + def generate_type_builder(writer, generate_context): + ad_hoc_type_writer = writer + + resolve_data = array_binding_cls.resolve_data_ + + for ad_hoc_type in resolve_data.ad_hoc_type_list: + code_generator = ad_hoc_type.get_code_generator() + if code_generator: + code_generator.generate_type_builder(ad_hoc_type_writer, generate_context) + + @staticmethod + def generate_forward_declaration(writer): + pass + + @staticmethod + def register_use(forward_listener): + item_code_generator = item_binding.get_code_generator() + if item_code_generator: + item_code_generator.register_use(forward_listener) + + @staticmethod + def get_generate_pass_id(): + return TypeBuilderPass.MAIN + + return CodeGenerator + + @classmethod + def get_validator_call_text(cls): + return cls.get_array_item_c_type_text() + "::assertCorrectValue" + + @classmethod + def get_array_item_c_type_text(cls): + return replace_right_shift("Inspector::TypeBuilder::Array<%s>" % cls.resolve_data_.item_type_binding.get_array_item_c_type_text()) + + @staticmethod + def get_setter_value_expression_pattern(): + return None + + @staticmethod + def reduce_to_raw_type(): + return RawTypes.Array + + @classmethod + def get_type_model(cls): + return TypeModel.RefPtrBased(cls.get_array_item_c_type_text()) + + return ArrayBinding + else: + # Fall-through to raw type. + pass + + raw_type = RawTypes.get(json_typable["type"]) + + return RawTypeBinding(raw_type) + + +class RawTypeBinding: + def __init__(self, raw_type): + self.raw_type_ = raw_type + + def resolve_inner(self, resolve_context): + pass + + def request_user_runtime_cast(self, request): + raise Exception("Unsupported") + + def request_internal_runtime_cast(self): + self.raw_type_.request_raw_internal_runtime_cast() + + def get_code_generator(self): + return None + + def get_validator_call_text(self): + return self.raw_type_.get_raw_validator_call_text() + + def get_array_item_c_type_text(self): + return self.raw_type_.get_array_item_raw_c_type_text() + + def get_setter_value_expression_pattern(self): + return None + + def reduce_to_raw_type(self): + return self.raw_type_ + + def get_type_model(self): + return self.raw_type_.get_raw_type_model() + + +class TypeData(object): + def __init__(self, json_type, json_domain, domain_data): + self.json_type_ = json_type + self.json_domain_ = json_domain + self.domain_data_ = domain_data + + if "type" not in json_type: + raise Exception("Unknown type") + + json_type_name = json_type["type"] + self.raw_type_ = RawTypes.get(json_type_name) + self.binding_being_resolved_ = False + self.binding_ = None + + def get_raw_type(self): + return self.raw_type_ + + def get_binding(self): + if not self.binding_: + if self.binding_being_resolved_: + raise Exception("Type %s is already being resolved" % self.json_type_["type"]) + # Resolve only lazily, because resolving one named type may require resolving some other named type. + self.binding_being_resolved_ = True + try: + self.binding_ = TypeBindings.create_named_type_declaration(self.json_type_, self.json_domain_["domain"], self) + finally: + self.binding_being_resolved_ = False + + return self.binding_ + + def get_json_type(self): + return self.json_type_ + + def get_name(self): + return self.json_type_["id"] + + def get_domain_name(self): + return self.json_domain_["domain"] + + +class DomainData: + def __init__(self, json_domain): + self.json_domain = json_domain + self.types_ = [] + + def add_type(self, type_data): + self.types_.append(type_data) + + def name(self): + return self.json_domain["domain"] + + def types(self): + return self.types_ + + +class TypeMap: + def __init__(self, api, dependency_api): + self.map_ = {} + self.domains_ = [] + self.domains_to_generate_ = [] + for json_domain in api["domains"]: + self.add_domain(json_domain, True) + for json_domain in dependency_api["domains"]: + self.add_domain(json_domain, False) + + def add_domain(self, json_domain, should_generate): + domain_name = json_domain["domain"] + + domain_map = {} + self.map_[domain_name] = domain_map + + domain_data = DomainData(json_domain) + self.domains_.append(domain_data) + + if should_generate: + # FIXME: The order of types should not matter. The generated code should work regardless of the order of types. + if domain_name == "Page": + self.domains_to_generate_.insert(0, domain_data) + else: + self.domains_to_generate_.append(domain_data) + + if "types" in json_domain: + for json_type in json_domain["types"]: + type_name = json_type["id"] + type_data = TypeData(json_type, json_domain, domain_data) + domain_map[type_name] = type_data + domain_data.add_type(type_data) + + def domains(self): + return self.domains_ + + def domains_to_generate(self): + return self.domains_to_generate_ + + def get(self, domain_name, type_name): + return self.map_[domain_name][type_name] + + +def resolve_param_type(json_parameter, scope_domain_name, ad_hoc_type_context): + if "$ref" in json_parameter: + json_ref = json_parameter["$ref"] + type_data = get_ref_data(json_ref, scope_domain_name) + return type_data.get_binding() + elif "type" in json_parameter: + result = TypeBindings.create_ad_hoc_type_declaration(json_parameter, scope_domain_name, ad_hoc_type_context) + ad_hoc_type_context.add_type(result) + return result + else: + raise Exception("Unknown type") + + +def resolve_param_raw_type(json_parameter, scope_domain_name): + if "$ref" in json_parameter: + json_ref = json_parameter["$ref"] + type_data = get_ref_data(json_ref, scope_domain_name) + return type_data.get_raw_type() + elif "type" in json_parameter: + json_type = json_parameter["type"] + return RawTypes.get(json_type) + else: + raise Exception("Unknown type") + + +def get_ref_data(json_ref, scope_domain_name): + dot_pos = json_ref.find(".") + if dot_pos == -1: + domain_name = scope_domain_name + type_name = json_ref + else: + domain_name = json_ref[:dot_pos] + type_name = json_ref[dot_pos + 1:] + + return type_map.get(domain_name, type_name) + + +input_file = open(input_json_filename, "r") +json_string = input_file.read() +json_api = json.loads(json_string) +input_file.close() +if not "domains" in json_api: + json_api = {"domains": [json_api]} + +dependency_api = {"domains": []} +for dependency_json_filename in dependency_json_filenames: + dependency_input_file = open(dependency_json_filename, "r") + dependency_json_string = dependency_input_file.read() + dependency_json_api = json.loads(dependency_json_string) + dependency_input_file.close() + if not "domains" in dependency_json_api: + dependency_json_api = {"domains": [dependency_json_api]} + dependency_api["domains"] += dependency_json_api["domains"] + + +class Templates: + def get_this_script_path_(absolute_path): + absolute_path = os.path.abspath(absolute_path) + components = [] + + def fill_recursive(path_part, depth): + if depth <= 0 or path_part == '/': + return + fill_recursive(os.path.dirname(path_part), depth - 1) + components.append(os.path.basename(path_part)) + + # Typical path is /Source/WebCore/inspector/CodeGeneratorInspector.py + # Let's take 4 components from the real path then. + fill_recursive(absolute_path, 4) + + return "/".join(components) + + file_header_ = ("// File is generated by %s\n\n" % get_this_script_path_(sys.argv[0]) + +"""// Copyright (c) 2013 Apple Inc. All Rights Reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +""") + + frontend_domain_class = string.Template(CodeGeneratorInspectorStrings.frontend_domain_class) + backend_dispatcher_constructor = string.Template(CodeGeneratorInspectorStrings.backend_dispatcher_constructor) + backend_dispatcher_dispatch_method = string.Template(CodeGeneratorInspectorStrings.backend_dispatcher_dispatch_method) + backend_dispatcher_dispatch_method_simple = string.Template(CodeGeneratorInspectorStrings.backend_dispatcher_dispatch_method_simple) + backend_method = string.Template(CodeGeneratorInspectorStrings.backend_method) + frontend_method = string.Template(CodeGeneratorInspectorStrings.frontend_method) + callback_method = string.Template(CodeGeneratorInspectorStrings.callback_method) + frontend_h = string.Template(file_header_ + CodeGeneratorInspectorStrings.frontend_h) + backend_h = string.Template(file_header_ + CodeGeneratorInspectorStrings.backend_h) + backend_cpp = string.Template(file_header_ + CodeGeneratorInspectorStrings.backend_cpp) + frontend_cpp = string.Template(file_header_ + CodeGeneratorInspectorStrings.frontend_cpp) + typebuilder_h = string.Template(file_header_ + CodeGeneratorInspectorStrings.typebuilder_h) + typebuilder_cpp = string.Template(file_header_ + CodeGeneratorInspectorStrings.typebuilder_cpp) + backend_js = string.Template(file_header_ + CodeGeneratorInspectorStrings.backend_js) + param_container_access_code = CodeGeneratorInspectorStrings.param_container_access_code + + + + + +type_map = TypeMap(json_api, dependency_api) + + +class NeedRuntimeCastRequest: + def __init__(self): + self.ack_ = None + + def acknowledge(self): + self.ack_ = True + + def is_acknowledged(self): + return self.ack_ + + +def resolve_all_types(): + runtime_cast_generate_requests = {} + for type_name in TYPES_WITH_RUNTIME_CAST_SET: + runtime_cast_generate_requests[type_name] = NeedRuntimeCastRequest() + + class ForwardListener: + type_data_set = set() + already_declared_set = set() + + @classmethod + def add_type_data(cls, type_data): + if type_data not in cls.already_declared_set: + cls.type_data_set.add(type_data) + + class ResolveContext: + forward_listener = ForwardListener + + for domain_data in type_map.domains(): + for type_data in domain_data.types(): + binding = type_data.get_binding() + binding.resolve_inner(ResolveContext) + # Do not generate forwards for this type any longer. + ForwardListener.already_declared_set.add(type_data) + + for domain_data in type_map.domains(): + for type_data in domain_data.types(): + full_type_name = "%s.%s" % (type_data.get_domain_name(), type_data.get_name()) + request = runtime_cast_generate_requests.pop(full_type_name, None) + binding = type_data.get_binding() + if request: + binding.request_user_runtime_cast(request) + + if request and not request.is_acknowledged(): + raise Exception("Failed to generate runtimeCast in " + full_type_name) + + # FIXME: This assumes all the domains are processed at once. Change this verification + # to only verify runtime casts for the domains being generated. + # if verification: + # for full_type_name in runtime_cast_generate_requests: + # raise Exception("Failed to generate runtimeCast. Type " + full_type_name + " not found") + + return ForwardListener + + +global_forward_listener = resolve_all_types() + + +def get_annotated_type_text(raw_type, annotated_type): + if annotated_type != raw_type: + return "/*%s*/ %s" % (annotated_type, raw_type) + else: + return raw_type + + +def format_setter_value_expression(param_type_binding, value_ref): + pattern = param_type_binding.get_setter_value_expression_pattern() + if pattern: + return pattern % (INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["prefix"], value_ref) + else: + return value_ref + + +class Generator: + frontend_domain_class_lines = [] + + backend_method_implementation_list = [] + frontend_method_list = [] + backend_js_domain_initializer_list = [] + + backend_handler_interface_list = [] + backend_handler_implementation_list = [] + backend_dispatcher_interface_list = [] + type_builder_fragments = [] + type_builder_forwards = [] + validator_impl_list = [] + type_builder_impl_list = [] + + + @staticmethod + def go(): + Generator.process_types(type_map) + + first_cycle_guardable_list_list = [ + Generator.backend_method_implementation_list, + Generator.backend_handler_interface_list, + Generator.backend_handler_implementation_list, + Generator.backend_dispatcher_interface_list] + + for json_domain in json_api["domains"]: + domain_name = json_domain["domain"] + domain_name_lower = domain_name.lower() + + domain_fixes = DomainNameFixes.get_fixed_data(domain_name) + + domain_guard = domain_fixes.get_guard() + + if domain_guard: + for l in first_cycle_guardable_list_list: + domain_guard.generate_open(l) + + frontend_method_declaration_lines = [] + + if ("commands" in json_domain or "events" in json_domain): + Generator.backend_js_domain_initializer_list.append("// %s.\n" % domain_name) + if not domain_fixes.skip_js_bind: + Generator.backend_js_domain_initializer_list.append("InspectorBackend.register%sDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, \"%s\");\n" % (domain_name, domain_name)) + + if "types" in json_domain: + for json_type in json_domain["types"]: + if "type" in json_type and json_type["type"] == "string" and "enum" in json_type: + enum_name = "%s.%s" % (domain_name, json_type["id"]) + Generator.process_enum(json_type, enum_name) + elif json_type["type"] == "object": + if "properties" in json_type: + for json_property in json_type["properties"]: + if "type" in json_property and json_property["type"] == "string" and "enum" in json_property: + enum_name = "%s.%s%s" % (domain_name, json_type["id"], to_title_case(json_property["name"])) + Generator.process_enum(json_property, enum_name) + + if "events" in json_domain: + if domain_guard: + domain_guard.generate_open(Generator.frontend_method_list) + domain_guard.generate_open(Generator.frontend_domain_class_lines) + + for json_event in json_domain["events"]: + Generator.process_event(json_event, domain_name, frontend_method_declaration_lines) + + Generator.frontend_domain_class_lines.append(Templates.frontend_domain_class.substitute(None, + exportMacro=INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["export_macro"], + domainClassName="Inspector%sFrontendDispatcher" % domain_name, + frontendDomainMethodDeclarations="".join(flatten_list(frontend_method_declaration_lines)))) + + if domain_guard: + domain_guard.generate_close(Generator.frontend_method_list) + domain_guard.generate_close(Generator.frontend_domain_class_lines) + + dispatcher_name = "Inspector" + Capitalizer.lower_camel_case_to_upper(domain_name) + "BackendDispatcher" + agent_interface_name = dispatcher_name + "Handler" + + if "commands" in json_domain: + Generator.backend_dispatcher_interface_list.append("class %s %s final : public Inspector::InspectorSupplementalBackendDispatcher {\n" % (INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["export_macro"], dispatcher_name)) + Generator.backend_dispatcher_interface_list.append("public:\n") + Generator.backend_dispatcher_interface_list.append(" static PassRefPtr<%s> create(Inspector::InspectorBackendDispatcher*, %s*);\n" % (dispatcher_name, agent_interface_name)) + Generator.backend_dispatcher_interface_list.append(" virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;\n") + Generator.backend_dispatcher_interface_list.append("private:\n") + + Generator.backend_handler_interface_list.append("class %s %s {\n" % (INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["export_macro"], agent_interface_name)) + Generator.backend_handler_interface_list.append("public:\n") + + backend_method_count = len(Generator.backend_method_implementation_list) + + dispatcher_if_chain = [] + dispatcher_commands_list = [] + for json_command in json_domain["commands"]: + Generator.process_command(json_command, domain_name, agent_interface_name, dispatcher_name, dispatcher_if_chain, dispatcher_commands_list) + + Generator.backend_handler_interface_list.append("protected:\n") + Generator.backend_handler_interface_list.append(" virtual ~%s();\n" % agent_interface_name) + Generator.backend_handler_interface_list.append("};\n\n") + + Generator.backend_handler_implementation_list.append("%s::~%s() { }\n" % (agent_interface_name, agent_interface_name)) + + Generator.backend_dispatcher_interface_list.append("private:\n") + Generator.backend_dispatcher_interface_list.append(" %s(Inspector::InspectorBackendDispatcher*, %s*);\n" % (dispatcher_name, agent_interface_name)) + Generator.backend_dispatcher_interface_list.append(" %s* m_agent;\n" % agent_interface_name) + Generator.backend_dispatcher_interface_list.append("};\n\n") + + Generator.backend_method_implementation_list.insert(backend_method_count, Templates.backend_dispatcher_constructor.substitute(None, + domainName=domain_name, + dispatcherName=dispatcher_name, + agentName=agent_interface_name)) + + if len(json_domain["commands"]) <= 5: + Generator.backend_method_implementation_list.insert(backend_method_count + 1, Templates.backend_dispatcher_dispatch_method_simple.substitute(None, + domainName=domain_name, + dispatcherName=dispatcher_name, + ifChain="\n".join(dispatcher_if_chain))) + else: + Generator.backend_method_implementation_list.insert(backend_method_count + 1, Templates.backend_dispatcher_dispatch_method.substitute(None, + domainName=domain_name, + dispatcherName=dispatcher_name, + dispatcherCommands="\n".join(dispatcher_commands_list))) + + if domain_guard: + for l in reversed(first_cycle_guardable_list_list): + domain_guard.generate_close(l) + Generator.backend_js_domain_initializer_list.append("\n") + + @staticmethod + def process_enum(json_enum, enum_name): + enum_members = [] + for member in json_enum["enum"]: + enum_members.append("%s: \"%s\"" % (fix_camel_case(member), member)) + + Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerEnum(\"%s\", {%s});\n" % ( + enum_name, ", ".join(enum_members))) + + @staticmethod + def process_event(json_event, domain_name, frontend_method_declaration_lines): + event_name = json_event["name"] + + ad_hoc_type_output = [] + frontend_method_declaration_lines.append(ad_hoc_type_output) + ad_hoc_type_writer = Writer(ad_hoc_type_output, " ") + + decl_parameter_list = [] + + json_parameters = json_event.get("parameters") + Generator.generate_send_method(json_parameters, event_name, domain_name, ad_hoc_type_writer, + decl_parameter_list, + Generator.EventMethodStructTemplate, + Generator.frontend_method_list, Templates.frontend_method, {"eventName": event_name}) + + backend_js_event_param_list = [] + if json_parameters: + for parameter in json_parameters: + parameter_name = parameter["name"] + backend_js_event_param_list.append("\"%s\"" % parameter_name) + + frontend_method_declaration_lines.append( + " void %s(%s);\n" % (event_name, ", ".join(decl_parameter_list))) + + Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerEvent(\"%s.%s\", [%s]);\n" % ( + domain_name, event_name, ", ".join(backend_js_event_param_list))) + + class EventMethodStructTemplate: + @staticmethod + def append_prolog(line_list): + line_list.append(" RefPtr<InspectorObject> paramsObject = InspectorObject::create();\n") + + @staticmethod + def append_epilog(line_list): + line_list.append(" jsonMessage->setObject(ASCIILiteral(\"params\"), paramsObject);\n") + + container_name = "paramsObject" + + @staticmethod + def process_command(json_command, domain_name, agent_interface_name, dispatcher_name, dispatcher_if_chain, dispatcher_commands_list): + json_command_name = json_command["name"] + + ad_hoc_type_output = [] + Generator.backend_handler_interface_list.append(ad_hoc_type_output) + ad_hoc_type_writer = Writer(ad_hoc_type_output, " ") + + Generator.backend_dispatcher_interface_list.append(" void %s(long callId, const Inspector::InspectorObject& message);\n" % json_command_name) + + Generator.backend_handler_interface_list.append(" virtual void %s(ErrorString*" % json_command_name) + + if not dispatcher_if_chain: + dispatcher_if_chain.append(" if (method == \"%s\")" % json_command_name) + else: + dispatcher_if_chain.append(" else if (method == \"%s\")" % json_command_name) + dispatcher_if_chain.append(" %s(callId, *message.get());" % json_command_name) + dispatcher_commands_list.append(" { \"%s\", &%s::%s }," % (json_command_name, dispatcher_name, json_command_name)) + + method_in_params_handling = [] + method_dispatch_handling = [] + method_out_params_handling = [] + method_ending_handling = [] + method_request_message_param_name = "" + agent_call_param_list = [] + js_parameters_text = "" + if "parameters" in json_command: + json_params = json_command["parameters"] + method_request_message_param_name = " message" + method_in_params_handling.append(" RefPtr<InspectorArray> protocolErrors = InspectorArray::create();\n") + method_in_params_handling.append(" RefPtr<InspectorObject> paramsContainer = message.getObject(ASCIILiteral(\"params\"));\n") + method_in_params_handling.append(" InspectorObject* paramsContainerPtr = paramsContainer.get();\n") + method_in_params_handling.append(" InspectorArray* protocolErrorsPtr = protocolErrors.get();\n") + js_param_list = [] + + for json_parameter in json_params: + json_param_name = json_parameter["name"] + param_raw_type = resolve_param_raw_type(json_parameter, domain_name) + + getter_name = param_raw_type.get_getter_name() + + optional = json_parameter.get("optional") + + non_optional_type_model = param_raw_type.get_raw_type_model() + if optional: + type_model = non_optional_type_model.get_optional() + else: + type_model = non_optional_type_model + + if optional: + code = (" bool %s_valueFound = false;\n" + " %s in_%s = InspectorBackendDispatcher::get%s(paramsContainerPtr, ASCIILiteral(\"%s\"), &%s_valueFound, protocolErrorsPtr);\n" % + (json_param_name, non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name, json_param_name)) + param = ", %s_valueFound ? &in_%s : nullptr" % (json_param_name, json_param_name) + # FIXME: pass optional refptr-values as PassRefPtr + formal_param_type_pattern = "const %s*" + else: + code = (" %s in_%s = InspectorBackendDispatcher::get%s(paramsContainerPtr, ASCIILiteral(\"%s\"), nullptr, protocolErrorsPtr);\n" % + (non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name, getter_name, json_param_name)) + param = ", in_%s" % json_param_name + # FIXME: pass not-optional refptr-values as NonNullPassRefPtr + if param_raw_type.is_heavy_value(): + formal_param_type_pattern = "const %s&" + else: + formal_param_type_pattern = "%s" + + method_in_params_handling.append(code) + agent_call_param_list.append(param) + Generator.backend_handler_interface_list.append(", %s in_%s" % (formal_param_type_pattern % non_optional_type_model.get_command_return_pass_model().get_return_var_type(), json_param_name)) + + js_bind_type = param_raw_type.get_js_bind_type() + js_param_text = "{\"name\": \"%s\", \"type\": \"%s\", \"optional\": %s}" % ( + json_param_name, + js_bind_type, + ("true" if ("optional" in json_parameter and json_parameter["optional"]) else "false")) + + js_param_list.append(js_param_text) + + method_in_params_handling.append(" if (protocolErrors->length()) {\n") + method_in_params_handling.append(" String errorMessage = String::format(\"Some arguments of method '%%s' can't be processed\", \"%s.%s\");\n" % (domain_name, json_command_name)) + method_in_params_handling.append(" m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::InvalidParams, errorMessage, protocolErrors.release());\n") + method_in_params_handling.append(" return;\n") + method_in_params_handling.append(" }\n") + method_in_params_handling.append("\n") + + js_parameters_text = ", ".join(js_param_list) + + method_dispatch_handling.append(" ErrorString error;\n") + method_dispatch_handling.append(" RefPtr<InspectorObject> result = InspectorObject::create();\n") + + if json_command.get("async") == True: + callback_name = Capitalizer.lower_camel_case_to_upper(json_command_name) + "Callback" + + callback_output = [] + callback_writer = Writer(callback_output, ad_hoc_type_writer.get_indent()) + + decl_parameter_list = [] + Generator.generate_send_method(json_command.get("returns"), json_command_name, domain_name, ad_hoc_type_writer, + decl_parameter_list, + Generator.CallbackMethodStructTemplate, + Generator.backend_method_implementation_list, Templates.callback_method, + {"callbackName": callback_name, "handlerName": agent_interface_name}) + + callback_writer.newline("class " + callback_name + " : public Inspector::InspectorBackendDispatcher::CallbackBase {\n") + callback_writer.newline("public:\n") + callback_writer.newline(" " + callback_name + "(PassRefPtr<Inspector::InspectorBackendDispatcher>, int id);\n") + callback_writer.newline(" void sendSuccess(" + ", ".join(decl_parameter_list) + ");\n") + callback_writer.newline("};\n") + + ad_hoc_type_output.append(callback_output) + + method_dispatch_handling.append(" RefPtr<%s::%s> callback = adoptRef(new %s::%s(m_backendDispatcher,callId));\n" % (agent_interface_name, callback_name, agent_interface_name, callback_name)) + method_ending_handling.append(" if (error.length()) {\n") + method_ending_handling.append(" callback->disable();\n") + method_ending_handling.append(" m_backendDispatcher->reportProtocolError(&callId, Inspector::InspectorBackendDispatcher::ServerError, error);\n") + method_ending_handling.append(" return;\n") + method_ending_handling.append(" }") + + agent_call_param_list.append(", callback") + Generator.backend_handler_interface_list.append(", PassRefPtr<%s> callback" % callback_name) + elif "returns" in json_command: + has_multiple_returns = len(json_command["returns"]) > 1 + if has_multiple_returns: + method_out_params_handling.append(" if (!error.length()) {\n") + else: + method_out_params_handling.append(" if (!error.length())\n") + + for json_return in json_command["returns"]: + + json_return_name = json_return["name"] + + optional = bool(json_return.get("optional")) + + return_type_binding = Generator.resolve_type_and_generate_ad_hoc(json_return, json_command_name, domain_name, ad_hoc_type_writer, agent_interface_name + "::") + + raw_type = return_type_binding.reduce_to_raw_type() + setter_type = raw_type.get_setter_name() + initializer = raw_type.get_c_initializer() + + type_model = return_type_binding.get_type_model() + if optional: + type_model = type_model.get_optional() + + code = " %s out_%s;\n" % (type_model.get_command_return_pass_model().get_return_var_type(), json_return_name) + param = ", %sout_%s" % (type_model.get_command_return_pass_model().get_output_argument_prefix(), json_return_name) + var_name = "out_%s" % json_return_name + setter_argument = type_model.get_command_return_pass_model().get_output_to_raw_expression() % var_name + if return_type_binding.get_setter_value_expression_pattern(): + setter_argument = return_type_binding.get_setter_value_expression_pattern() % (INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["prefix"], setter_argument) + + cook = " result->set%s(ASCIILiteral(\"%s\"), %s);\n" % (setter_type, json_return_name, setter_argument) + + set_condition_pattern = type_model.get_command_return_pass_model().get_set_return_condition() + if set_condition_pattern: + cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook + annotated_type = type_model.get_command_return_pass_model().get_output_parameter_type() + + param_name = "out_%s" % json_return_name + if optional: + param_name = "opt_" + param_name + + Generator.backend_handler_interface_list.append(", %s %s" % (annotated_type, param_name)) + method_out_params_handling.append(cook) + method_dispatch_handling.append(code) + + agent_call_param_list.append(param) + + if has_multiple_returns: + method_out_params_handling.append(" }\n") + method_out_params_handling.append("\n") + + method_dispatch_handling.append(" m_agent->%s(&error%s);\n" % (json_command_name, "".join(agent_call_param_list))) + method_dispatch_handling.append("\n") + + if not method_ending_handling: + method_ending_handling.append(" m_backendDispatcher->sendResponse(callId, result.release(), error);") + + backend_js_reply_param_list = [] + if "returns" in json_command: + for json_return in json_command["returns"]: + json_return_name = json_return["name"] + backend_js_reply_param_list.append("\"%s\"" % json_return_name) + + js_reply_list = "[%s]" % ", ".join(backend_js_reply_param_list) + + Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None, + dispatcherName=dispatcher_name, + methodName=json_command_name, + requestMessageObject=method_request_message_param_name, + methodInParametersHandling="".join(method_in_params_handling), + methodDispatchHandling="".join(method_dispatch_handling), + methodOutParametersHandling="".join(method_out_params_handling), + methodEndingHandling="".join(method_ending_handling))) + + Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerCommand(\"%s.%s\", [%s], %s);\n" % (domain_name, json_command_name, js_parameters_text, js_reply_list)) + Generator.backend_handler_interface_list.append(") = 0;\n") + + class CallbackMethodStructTemplate: + @staticmethod + def append_prolog(line_list): + pass + + @staticmethod + def append_epilog(line_list): + pass + + container_name = "jsonMessage" + + # Generates common code for event sending and callback response data sending. + @staticmethod + def generate_send_method(parameters, event_name, domain_name, ad_hoc_type_writer, decl_parameter_list, + method_struct_template, + generator_method_list, method_template, template_params): + method_line_list = [] + if parameters: + method_struct_template.append_prolog(method_line_list) + for json_parameter in parameters: + parameter_name = json_parameter["name"] + + param_type_binding = Generator.resolve_type_and_generate_ad_hoc(json_parameter, event_name, domain_name, ad_hoc_type_writer, "") + + raw_type = param_type_binding.reduce_to_raw_type() + raw_type_binding = RawTypeBinding(raw_type) + + optional = bool(json_parameter.get("optional")) + + setter_type = raw_type.get_setter_name() + + type_model = param_type_binding.get_type_model() + raw_type_model = raw_type_binding.get_type_model() + if optional: + type_model = type_model.get_optional() + raw_type_model = raw_type_model.get_optional() + + annotated_type = type_model.get_input_param_type_text() + mode_type_binding = param_type_binding + + decl_parameter_list.append("%s %s" % (annotated_type, parameter_name)) + + setter_argument = raw_type_model.get_event_setter_expression_pattern() % parameter_name + if mode_type_binding.get_setter_value_expression_pattern(): + setter_argument = mode_type_binding.get_setter_value_expression_pattern() % (INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["prefix"], setter_argument) + + setter_code = " %s->set%s(ASCIILiteral(\"%s\"), %s);\n" % (method_struct_template.container_name, setter_type, parameter_name, setter_argument) + if optional: + setter_code = (" if (%s)\n " % parameter_name) + setter_code + method_line_list.append(setter_code) + + method_struct_template.append_epilog(method_line_list) + + generator_method_list.append(method_template.substitute(None, + domainName=domain_name, + parameters=", ".join(decl_parameter_list), + code="".join(method_line_list), **template_params)) + + @staticmethod + def resolve_type_and_generate_ad_hoc(json_param, method_name, domain_name, ad_hoc_type_writer, container_relative_name_prefix_param): + param_name = json_param["name"] + ad_hoc_type_list = [] + + class AdHocTypeContext: + container_full_name_prefix = "<not yet defined>" + container_relative_name_prefix = container_relative_name_prefix_param + + @staticmethod + def get_type_name_fix(): + class NameFix: + class_name = Capitalizer.lower_camel_case_to_upper(param_name) + + @staticmethod + def output_comment(writer): + writer.newline("// Named after parameter '%s' while generating command/event %s.\n" % (param_name, method_name)) + + return NameFix + + @staticmethod + def add_type(binding): + ad_hoc_type_list.append(binding) + + type_binding = resolve_param_type(json_param, domain_name, AdHocTypeContext) + + class InterfaceForwardListener: + @staticmethod + def add_type_data(type_data): + pass + + class InterfaceResolveContext: + forward_listener = InterfaceForwardListener + + for type in ad_hoc_type_list: + type.resolve_inner(InterfaceResolveContext) + + class InterfaceGenerateContext: + validator_writer = "not supported in InterfaceGenerateContext" + cpp_writer = validator_writer + + for type in ad_hoc_type_list: + generator = type.get_code_generator() + if generator: + generator.generate_type_builder(ad_hoc_type_writer, InterfaceGenerateContext) + + return type_binding + + @staticmethod + def process_types(type_map): + output = Generator.type_builder_fragments + + class GenerateContext: + validator_writer = Writer(Generator.validator_impl_list, "") + cpp_writer = Writer(Generator.type_builder_impl_list, "") + + def generate_all_domains_code(out, type_data_callback): + writer = Writer(out, "") + for domain_data in type_map.domains_to_generate(): + domain_fixes = DomainNameFixes.get_fixed_data(domain_data.name()) + domain_guard = domain_fixes.get_guard() + + namespace_declared = [] + + def namespace_lazy_generator(): + if not namespace_declared: + if domain_guard: + domain_guard.generate_open(out) + writer.newline("namespace ") + writer.append(domain_data.name()) + writer.append(" {\n") + # What is a better way to change value from outer scope? + namespace_declared.append(True) + return writer + + for type_data in domain_data.types(): + type_data_callback(type_data, namespace_lazy_generator) + + if namespace_declared: + writer.append("} // ") + writer.append(domain_data.name()) + writer.append("\n\n") + + if domain_guard: + domain_guard.generate_close(out) + + def create_type_builder_caller(generate_pass_id): + def call_type_builder(type_data, writer_getter): + code_generator = type_data.get_binding().get_code_generator() + if code_generator and generate_pass_id == code_generator.get_generate_pass_id(): + writer = writer_getter() + + code_generator.generate_type_builder(writer, GenerateContext) + return call_type_builder + + generate_all_domains_code(output, create_type_builder_caller(TypeBuilderPass.MAIN)) + + Generator.type_builder_forwards.append("// Forward declarations.\n") + + def generate_forward_callback(type_data, writer_getter): + if type_data in global_forward_listener.type_data_set: + binding = type_data.get_binding() + binding.get_code_generator().generate_forward_declaration(writer_getter()) + generate_all_domains_code(Generator.type_builder_forwards, generate_forward_callback) + + Generator.type_builder_forwards.append("// End of forward declarations.\n\n") + + Generator.type_builder_forwards.append("// Typedefs.\n") + + generate_all_domains_code(Generator.type_builder_forwards, create_type_builder_caller(TypeBuilderPass.TYPEDEF)) + + Generator.type_builder_forwards.append("// End of typedefs.\n\n") + + +def flatten_list(input): + res = [] + + def fill_recursive(l): + for item in l: + if isinstance(item, list): + fill_recursive(item) + else: + res.append(item) + fill_recursive(input) + return res + + +# A writer that only updates file if it actually changed to better support incremental build. +class SmartOutput: + def __init__(self, file_name): + self.file_name_ = file_name + self.output_ = "" + + def write(self, text): + self.output_ += text + + def close(self): + text_changed = True + self.output_ = self.output_.rstrip() + "\n" + + try: + read_file = open(self.file_name_, "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 write_always: + out_file = open(self.file_name_, "w") + out_file.write(self.output_) + out_file.close() + + +Generator.go() + +output_file_name_prefix = INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["prefix"] + +backend_h_file = SmartOutput(output_header_dirname + ("/Inspector%sBackendDispatchers.h" % output_file_name_prefix)) +backend_cpp_file = SmartOutput(output_cpp_dirname + ("/Inspector%sBackendDispatchers.cpp" % output_file_name_prefix)) + +frontend_h_file = SmartOutput(output_header_dirname + ("/Inspector%sFrontendDispatchers.h" % output_file_name_prefix)) +frontend_cpp_file = SmartOutput(output_cpp_dirname + ("/Inspector%sFrontendDispatchers.cpp" % output_file_name_prefix)) + +typebuilder_h_file = SmartOutput(output_header_dirname + ("/Inspector%sTypeBuilders.h" % output_file_name_prefix)) +typebuilder_cpp_file = SmartOutput(output_cpp_dirname + ("/Inspector%sTypeBuilders.cpp" % output_file_name_prefix)) + +backend_js_file = SmartOutput(output_js_dirname + ("/Inspector%sBackendCommands.js" % output_file_name_prefix)) + + +backend_h_file.write(Templates.backend_h.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + handlerInterfaces="".join(flatten_list(Generator.backend_handler_interface_list)), + dispatcherInterfaces="".join(flatten_list(Generator.backend_dispatcher_interface_list)))) + +backend_cpp_file.write(Templates.backend_cpp.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + handlerImplementations="".join(flatten_list(Generator.backend_handler_implementation_list)), + methods="\n".join(Generator.backend_method_implementation_list))) + +frontend_h_file.write(Templates.frontend_h.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + domainClassList="".join(Generator.frontend_domain_class_lines))) + +frontend_cpp_file.write(Templates.frontend_cpp.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + methods="\n".join(Generator.frontend_method_list))) + +typebuilder_h_file.write(Templates.typebuilder_h.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + typeBuilderDependencies=INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["typebuilder_dependency"], + exportMacro=INSPECTOR_TYPES_GENERATOR_CONFIG_MAP[output_type]["export_macro"], + typeBuilders="".join(flatten_list(Generator.type_builder_fragments)), + forwards="".join(Generator.type_builder_forwards), + validatorIfdefName=VALIDATOR_IFDEF_NAME)) + +typebuilder_cpp_file.write(Templates.typebuilder_cpp.substitute(None, + outputFileNamePrefix=output_file_name_prefix, + enumConstantValues=EnumConstants.get_enum_constant_code(), + implCode="".join(flatten_list(Generator.type_builder_impl_list)), + validatorCode="".join(flatten_list(Generator.validator_impl_list)), + validatorIfdefName=VALIDATOR_IFDEF_NAME)) + +backend_js_file.write(Templates.backend_js.substitute(None, + domainInitializers="".join(Generator.backend_js_domain_initializer_list))) + +backend_h_file.close() +backend_cpp_file.close() + +frontend_h_file.close() +frontend_cpp_file.close() + +typebuilder_h_file.close() +typebuilder_cpp_file.close() + +backend_js_file.close() diff --git a/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspectorStrings.py b/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspectorStrings.py new file mode 100644 index 000000000..8de2cb0fa --- /dev/null +++ b/Source/JavaScriptCore/inspector/scripts/CodeGeneratorInspectorStrings.py @@ -0,0 +1,342 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# 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: +# +# * 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. + +# This file contains string resources for CodeGeneratorInspector. +# Its syntax is a Python syntax subset, suitable for manual parsing. + +frontend_domain_class = ( +"""class ${exportMacro} ${domainClassName} { +public: + ${domainClassName}(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { } +${frontendDomainMethodDeclarations}private: + InspectorFrontendChannel* m_inspectorFrontendChannel; +}; + +""") + +backend_dispatcher_constructor = ( +"""PassRefPtr<${dispatcherName}> ${dispatcherName}::create(InspectorBackendDispatcher* backendDispatcher, ${agentName}* agent) +{ + return adoptRef(new ${dispatcherName}(backendDispatcher, agent)); +} + +${dispatcherName}::${dispatcherName}(InspectorBackendDispatcher* backendDispatcher, ${agentName}* agent) + : InspectorSupplementalBackendDispatcher(backendDispatcher) + , m_agent(agent) +{ + m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("${domainName}"), this); +} +""") + +backend_dispatcher_dispatch_method_simple = ( +"""void ${dispatcherName}::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) +{ + Ref<${dispatcherName}> protect(*this); + +${ifChain} + else + m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "${domainName}" + '.' + method + "' was not found"); +} +""") + +backend_dispatcher_dispatch_method = ( +"""void ${dispatcherName}::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message) +{ + Ref<${dispatcherName}> protect(*this); + + typedef void (${dispatcherName}::*CallHandler)(long callId, const Inspector::InspectorObject& message); + typedef HashMap<String, CallHandler> DispatchMap; + DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ()); + if (dispatchMap.isEmpty()) { + static const struct MethodTable { + const char* name; + CallHandler handler; + } commands[] = { +${dispatcherCommands} + }; + size_t length = WTF_ARRAY_LENGTH(commands); + for (size_t i = 0; i < length; ++i) + dispatchMap.add(commands[i].name, commands[i].handler); + } + + HashMap<String, CallHandler>::iterator it = dispatchMap.find(method); + if (it == dispatchMap.end()) { + m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "${domainName}" + '.' + method + "' was not found"); + return; + } + + ((*this).*it->value)(callId, *message.get()); +} +""") + +backend_method = ( +"""void ${dispatcherName}::${methodName}(long callId, const InspectorObject&${requestMessageObject}) +{ +${methodInParametersHandling}${methodDispatchHandling}${methodOutParametersHandling}${methodEndingHandling} +} +""") + +frontend_method = ("""void Inspector${domainName}FrontendDispatcher::${eventName}(${parameters}) +{ + RefPtr<InspectorObject> jsonMessage = InspectorObject::create(); + jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("${domainName}.${eventName}")); +${code} + m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString()); +} +""") + +callback_method = ( +"""${handlerName}::${callbackName}::${callbackName}(PassRefPtr<InspectorBackendDispatcher> backendDispatcher, int id) : Inspector::InspectorBackendDispatcher::CallbackBase(backendDispatcher, id) { } + +void ${handlerName}::${callbackName}::sendSuccess(${parameters}) +{ + RefPtr<InspectorObject> jsonMessage = InspectorObject::create(); +${code} sendIfActive(jsonMessage, ErrorString()); +} +""") + +frontend_h = ( +"""#ifndef Inspector${outputFileNamePrefix}FrontendDispatchers_h +#define Inspector${outputFileNamePrefix}FrontendDispatchers_h + +#include "Inspector${outputFileNamePrefix}TypeBuilders.h" +#include <inspector/InspectorFrontendChannel.h> +#include <inspector/InspectorValues.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +namespace Inspector { + +#if ENABLE(INSPECTOR) + +${domainClassList} + +#endif // ENABLE(INSPECTOR) + +} // namespace Inspector + +#endif // !defined(Inspector${outputFileNamePrefix}FrontendDispatchers_h) +""") + +backend_h = ( +"""#ifndef Inspector${outputFileNamePrefix}BackendDispatchers_h +#define Inspector${outputFileNamePrefix}BackendDispatchers_h + +#include "Inspector${outputFileNamePrefix}TypeBuilders.h" +#include <inspector/InspectorBackendDispatcher.h> +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> + +namespace Inspector { + +typedef String ErrorString; + +${handlerInterfaces} + +${dispatcherInterfaces} +} // namespace Inspector + +#endif // !defined(Inspector${outputFileNamePrefix}BackendDispatchers_h) +""") + +backend_cpp = ( +""" +#include "config.h" +#include "Inspector${outputFileNamePrefix}BackendDispatchers.h" + +#if ENABLE(INSPECTOR) + +#include <inspector/InspectorFrontendChannel.h> +#include <inspector/InspectorValues.h> +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace Inspector { + +${handlerImplementations} + +${methods} +} // namespace Inspector + +#endif // ENABLE(INSPECTOR) +""") + +frontend_cpp = ( +""" + +#include "config.h" +#include "Inspector${outputFileNamePrefix}FrontendDispatchers.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/CString.h> +#include <wtf/text/WTFString.h> + +namespace Inspector { + +${methods} + +} // namespace Inspector + +#endif // ENABLE(INSPECTOR) +""") + +typebuilder_h = ( +""" +#ifndef Inspector${outputFileNamePrefix}TypeBuilders_h +#define Inspector${outputFileNamePrefix}TypeBuilders_h + +#if ENABLE(INSPECTOR) + +#include <inspector/InspectorTypeBuilder.h> +${typeBuilderDependencies} +#include <wtf/Assertions.h> +#include <wtf/PassRefPtr.h> + +namespace Inspector { + +namespace TypeBuilder { + +${forwards} + +${exportMacro} String get${outputFileNamePrefix}EnumConstantValue(int code); + +${typeBuilders} +} // namespace TypeBuilder + +} // namespace Inspector + +#endif // ENABLE(INSPECTOR) + +#endif // !defined(Inspector${outputFileNamePrefix}TypeBuilders_h) + +""") + +typebuilder_cpp = ( +""" + +#include "config.h" +#include "Inspector${outputFileNamePrefix}TypeBuilders.h" + +#if ENABLE(INSPECTOR) + +#include <wtf/text/CString.h> + +namespace Inspector { + +namespace TypeBuilder { + +static const char* const enum_constant_values[] = { +${enumConstantValues}}; + +String get${outputFileNamePrefix}EnumConstantValue(int code) { + return enum_constant_values[code]; +} + +} // namespace TypeBuilder + +${implCode} + +#if ${validatorIfdefName} + +${validatorCode} + +#endif // ${validatorIfdefName} + +} // namespace Inspector + +#endif // ENABLE(INSPECTOR) +""") + +backend_js = ( +""" + +${domainInitializers} +""") + +param_container_access_code = """ + RefPtr<InspectorObject> paramsContainer = message.getObject("params"); + InspectorObject* paramsContainerPtr = paramsContainer.get(); + InspectorArray* protocolErrorsPtr = protocolErrors.get(); +""" + +class_binding_builder_part_1 = ( +""" AllFieldsSet = %s + }; + + template<int STATE> + class Builder { + private: + RefPtr<Inspector::InspectorObject> m_result; + + template<int STEP> Builder<STATE | STEP>& castState() + { + return *reinterpret_cast<Builder<STATE | STEP>*>(this); + } + + Builder(PassRefPtr</*%s*/Inspector::InspectorObject> ptr) + { + COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state); + m_result = ptr; + } + friend class %s; + public: +""") + +class_binding_builder_part_2 = (""" + Builder<STATE | %s>& set%s(%s value) + { + COMPILE_ASSERT(!(STATE & %s), property_%s_already_set); + m_result->set%s(ASCIILiteral("%s"), %s); + return castState<%s>(); + } +""") + +class_binding_builder_part_3 = (""" + operator RefPtr<%s>& () + { + COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready); + COMPILE_ASSERT(sizeof(%s) == sizeof(Inspector::InspectorObject), cannot_cast); + return *reinterpret_cast<RefPtr<%s>*>(&m_result); + } + + PassRefPtr<%s> release() + { + return RefPtr<%s>(*this).release(); + } + }; + +""") + +class_binding_builder_part_4 = ( +""" static Builder<NoFieldsSet> create() + { + return Builder<NoFieldsSet>(Inspector::InspectorObject::create()); + } +""") diff --git a/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py b/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py deleted file mode 100644 index 6077fa97a..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# 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 deleted file mode 100644 index edd330da4..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py +++ /dev/null @@ -1,314 +0,0 @@ -#!/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 deleted file mode 100755 index 05f353097..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py +++ /dev/null @@ -1,263 +0,0 @@ -#!/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 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 = WTF::move(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 callId, 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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<${domainName}BackendDispatcher> protect(*this); - -${dispatchCases} - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found")); -}""") - - BackendDispatcherImplementationLargeSwitch = ( -"""void ${domainName}BackendDispatcher::dispatch(long callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<${domainName}BackendDispatcher> protect(*this); - - typedef void (${domainName}BackendDispatcher::*CallHandler)(long callId, const InspectorObject& message); - typedef HashMap<String, CallHandler> DispatchMap; - DEPRECATED_DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ()); - if (dispatchMap.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.add(commands[i].name, commands[i].handler); - } - - HashMap<String, CallHandler>::iterator it = dispatchMap.find(method); - if (it == dispatchMap.end()) { - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found")); - return; - } - - ((*this).*it->value)(callId, message.get()); -}""") - - 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 = ( -""" auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); -${inParameterDeclarations} - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } -""") - - BackendDispatcherImplementationAsyncCommand = ( -"""${domainName}BackendDispatcherHandler::${callbackName}::${callbackName}(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTF::move(backendDispatcher), id) { } - -void ${domainName}BackendDispatcherHandler::${callbackName}::sendSuccess(${formalParameters}) -{ - Ref<InspectorObject> jsonMessage = InspectorObject::create(); -${outParameterAssignments} - sendIfActive(WTF::move(jsonMessage), ErrorString()); -}""") - - FrontendDispatcherDomainDispatcherDeclaration = ( -"""${classAndExportMacro} ${domainName}FrontendDispatcher { -public: - ${domainName}FrontendDispatcher(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } -${eventDeclarations} -private: - FrontendChannel* m_frontendChannel; -};""") - - 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(WTF::move(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 WTF::move(*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 deleted file mode 100755 index d4a8d5afe..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/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"', - '<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 deleted file mode 100755 index 54bdb3e91..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py +++ /dev/null @@ -1,208 +0,0 @@ -#!/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 - -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 callId, const InspectorObject& message);" % 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 deleted file mode 100755 index 350f0854c..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py +++ /dev/null @@ -1,310 +0,0 @@ -#!/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 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/InspectorFrontendChannel.h>', - '<inspector/InspectorValues.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(callId, message);' % domain.commands[0].command_name) - for command in domain.commands[1:]: - cases.append(' else if (method == "%s")' % command.command_name) - cases.append(' %s(callId, message);' % 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 = ['callId'] - 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 = BackendDispatcher::%(keyedGetMethod)s(paramsContainer.get(), ASCIILiteral("%(parameterKey)s"), %(successOutParam)s, protocolErrors.get());' % 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(&callId, 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 callId, const InspectorObject&)' % command_args) - else: - lines.append('void %(domainName)sBackendDispatcher::%(commandName)s(long callId, const InspectorObject& message)' % 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(), callId));' % 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(' m_backendDispatcher->sendResponse(callId, WTF::move(result), 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 deleted file mode 100755 index ff09ab39b..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/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 - -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/InspectorFrontendChannel.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': '', - } - - 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 deleted file mode 100755 index 798157a06..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/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 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 = ['<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"), WTF::move(paramsObject));') - - lines.append('') - lines.append(' m_frontendChannel->sendMessageToFrontend(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 deleted file mode 100755 index b07b0b9c7..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py +++ /dev/null @@ -1,352 +0,0 @@ -#!/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"), WTF::move(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 deleted file mode 100755 index 2c263b504..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py +++ /dev/null @@ -1,183 +0,0 @@ -#!/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 deleted file mode 100755 index 3392c7845..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/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 deleted file mode 100755 index 29b38e887..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/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 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) 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 deleted file mode 100755 index 27bdd4a9b..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/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 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/InspectorFrontendChannel.h>', - '<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 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 = { - '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(callId, WTF::move(resultObject), String());') - else: - lines.append(' backendDispatcher()->sendResponse(callId, InspectorObject::create(), String());') - - 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 deleted file mode 100755 index 2002227d9..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_header.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/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 = [ - '"%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 RWIProtocolConfiguration : NSObject') - 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 deleted file mode 100755 index 53205cb9d..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_configuration_implementation.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/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 RWIProtocolConfiguration') - 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 deleted file mode 100755 index c31e991e3..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_conversion_helpers.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/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 deleted file mode 100755 index fb2de4f61..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/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 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/InspectorFrontendChannel.h>', - '<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(' FrontendChannel* frontendChannel = _controller->frontendChannel();') - lines.append(' if (!frontendChannel)') - lines.append(' return;') - 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(' frontendChannel->sendMessageToFrontend(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"), WTF::move(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 deleted file mode 100755 index 1d3751f35..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_header.py +++ /dev/null @@ -1,229 +0,0 @@ -#!/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/RWIProtocolJSONObject.h>', - ]) - - 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 deleted file mode 100755 index 2501ad324..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_internal_header.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/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, - '"RWIProtocolJSONObjectInternal.h"', - '<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 deleted file mode 100755 index 95b57f671..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_protocol_types_implementation.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/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 deleted file mode 100755 index a1923fe54..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generator.py +++ /dev/null @@ -1,241 +0,0 @@ -#!/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', '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", - # InspectorResourceAgent 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 deleted file mode 100644 index f2e330a72..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/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 deleted file mode 100755 index 2dabdc0ca..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/models.py +++ /dev/null @@ -1,591 +0,0 @@ -#!/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 self.is_optional not in [True, False]: - 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 self.is_optional not in [True, False]: - 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 deleted file mode 100755 index f6dd03cb5..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator.py +++ /dev/null @@ -1,523 +0,0 @@ -#!/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 deleted file mode 100755 index ef712b8db..000000000 --- a/Source/JavaScriptCore/inspector/scripts/codegen/objc_generator_templates.py +++ /dev/null @@ -1,155 +0,0 @@ -#!/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()->sendResponse(callId, InspectorObject::create(), error); - }; - -${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}"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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-combined-inspector-json.py b/Source/JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py index 53660318d..db163bfe4 100755 --- a/Source/JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py +++ b/Source/JavaScriptCore/inspector/scripts/generate-combined-inspector-json.py @@ -66,4 +66,3 @@ for file in files: print(string.rstrip()) print("]}") - diff --git a/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py b/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py deleted file mode 100755 index a1987aa90..000000000 --- a/Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py +++ /dev/null @@ -1,211 +0,0 @@ -#!/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 deleted file mode 100644 index 11262e889..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/commands-with-async-attribute.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "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 deleted file mode 100644 index 361d57d82..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/commands-with-optional-call-return-parameters.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "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 deleted file mode 100644 index 94a8ecb17..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/domains-with-varying-command-sizes.json +++ /dev/null @@ -1,54 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index cdad61df7..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/enum-values.json +++ /dev/null @@ -1,35 +0,0 @@ -{"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 deleted file mode 100644 index cabbf10b8..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/events-with-optional-parameters.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "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 deleted file mode 100644 index 15d6a4d9e..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result +++ /dev/null @@ -1,1637 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void executeSQLSyncOptionalReturnValues(long callId, const InspectorObject& message); - void executeSQLAsyncOptionalReturnValues(long callId, const InspectorObject& message); - void executeSQLSync(long callId, const InspectorObject& message); - void executeSQLAsync(long callId, const InspectorObject& message); -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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<DatabaseBackendDispatcher> protect(*this); - - if (method == "executeSQLSyncOptionalReturnValues") - executeSQLSyncOptionalReturnValues(callId, message); - else if (method == "executeSQLAsyncOptionalReturnValues") - executeSQLAsyncOptionalReturnValues(callId, message); - else if (method == "executeSQLSync") - executeSQLSync(callId, message); - else if (method == "executeSQLAsync") - executeSQLAsync(callId, message); - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found")); -} - -void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); - String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeSQLSyncOptionalReturnValues(callId, 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()); - } - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTF::move(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()); - sendIfActive(WTF::move(jsonMessage), ErrorString()); -} - -void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); - String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeSQLAsyncOptionalReturnValues(callId, in_databaseId, in_query); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback(m_backendDispatcher.copyRef(), callId)); - m_agent->executeSQLAsyncOptionalReturnValues(error, in_databaseId, in_query, callback.copyRef()); - - if (error.length()) { - callback->disable(); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::ServerError, error); - return; - } -} - -void DatabaseBackendDispatcher::executeSQLSync(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); - String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeSQLSync(callId, 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)); - } - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback::ExecuteSQLAsyncCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTF::move(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)); - sendIfActive(WTF::move(jsonMessage), ErrorString()); -} - -void DatabaseBackendDispatcher::executeSQLAsync(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); - String in_query = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("query"), nullptr, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeSQLAsync(callId, in_databaseId, in_query); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - Ref<DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback> callback = adoptRef(*new DatabaseBackendDispatcherHandler::ExecuteSQLAsyncCallback(m_backendDispatcher.copyRef(), callId)); - m_agent->executeSQLAsync(error, in_databaseId, in_query, callback.copyRef()); - - if (error.length()) { - callback->disable(); - m_backendDispatcher->reportProtocolError(&callId, 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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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(WTF::move(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 WTF::move(*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 callId, int in_databaseId, const String& in_query) override; - virtual void executeSQLAsyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) override; - virtual void executeSQLSync(long callId, int in_databaseId, const String& in_query) override; - virtual void executeSQLAsync(long callId, 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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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 "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/InspectorFrontendChannel.h> -#include <JavaScriptCore/InspectorValues.h> - -namespace Inspector { - -void ObjCInspectorDatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long callId, int in_databaseId, const String& in_query) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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 callId, int in_databaseId, const String& in_query) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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 callId, int in_databaseId, const String& in_query) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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 callId, int in_databaseId, const String& in_query) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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/InspectorFrontendChannel.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 deleted file mode 100644 index e349ecf6f..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result +++ /dev/null @@ -1,1486 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void executeAllOptionalParameters(long callId, const InspectorObject& message); - void executeNoOptionalParameters(long callId, const InspectorObject& message); -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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<DatabaseBackendDispatcher> protect(*this); - - if (method == "executeAllOptionalParameters") - executeAllOptionalParameters(callId, message); - else if (method == "executeNoOptionalParameters") - executeNoOptionalParameters(callId, message); - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found")); -} - -void DatabaseBackendDispatcher::executeAllOptionalParameters(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - bool opt_in_columnNames_valueFound = false; - RefPtr<Inspector::InspectorArray> opt_in_columnNames = BackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("columnNames"), &opt_in_columnNames_valueFound, protocolErrors.get()); - bool opt_in_notes_valueFound = false; - String opt_in_notes = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("notes"), &opt_in_notes_valueFound, protocolErrors.get()); - bool opt_in_timestamp_valueFound = false; - Inspector::Protocol::OptOutput<double> opt_in_timestamp = BackendDispatcher::getDouble(paramsContainer.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound, protocolErrors.get()); - bool opt_in_values_valueFound = false; - RefPtr<Inspector::InspectorObject> opt_in_values = BackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("values"), &opt_in_values_valueFound, protocolErrors.get()); - bool opt_in_payload_valueFound = false; - RefPtr<Inspector::InspectorValue> opt_in_payload = BackendDispatcher::getValue(paramsContainer.get(), ASCIILiteral("payload"), &opt_in_payload_valueFound, protocolErrors.get()); - bool opt_in_databaseId_valueFound = false; - int opt_in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), &opt_in_databaseId_valueFound, protocolErrors.get()); - bool opt_in_sqlError_valueFound = false; - RefPtr<Inspector::InspectorObject> opt_in_sqlError = BackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("sqlError"), &opt_in_sqlError_valueFound, protocolErrors.get()); - bool opt_in_screenColor_valueFound = false; - String opt_in_screenColor = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("screenColor"), &opt_in_screenColor_valueFound, protocolErrors.get()); - bool opt_in_alternateColors_valueFound = false; - RefPtr<Inspector::InspectorArray> opt_in_alternateColors = BackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("alternateColors"), &opt_in_alternateColors_valueFound, protocolErrors.get()); - bool opt_in_printColor_valueFound = false; - String opt_in_printColor = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("printColor"), &opt_in_printColor_valueFound, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeAllOptionalParameters(callId, 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()); - } - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void DatabaseBackendDispatcher::executeNoOptionalParameters(long callId, const InspectorObject& message) -{ - auto protocolErrors = Inspector::Protocol::Array<String>::create(); - RefPtr<InspectorObject> paramsContainer; - message.getObject(ASCIILiteral("params"), paramsContainer); - RefPtr<Inspector::InspectorArray> in_columnNames = BackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("columnNames"), nullptr, protocolErrors.get()); - String in_notes = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("notes"), nullptr, protocolErrors.get()); - double in_timestamp = BackendDispatcher::getDouble(paramsContainer.get(), ASCIILiteral("timestamp"), nullptr, protocolErrors.get()); - RefPtr<Inspector::InspectorObject> in_values = BackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("values"), nullptr, protocolErrors.get()); - RefPtr<Inspector::InspectorValue> in_payload = BackendDispatcher::getValue(paramsContainer.get(), ASCIILiteral("payload"), nullptr, protocolErrors.get()); - int in_databaseId = BackendDispatcher::getInteger(paramsContainer.get(), ASCIILiteral("databaseId"), nullptr, protocolErrors.get()); - RefPtr<Inspector::InspectorObject> in_sqlError = BackendDispatcher::getObject(paramsContainer.get(), ASCIILiteral("sqlError"), nullptr, protocolErrors.get()); - String in_screenColor = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("screenColor"), nullptr, protocolErrors.get()); - RefPtr<Inspector::InspectorArray> in_alternateColors = BackendDispatcher::getArray(paramsContainer.get(), ASCIILiteral("alternateColors"), nullptr, protocolErrors.get()); - String in_printColor = BackendDispatcher::getString(paramsContainer.get(), ASCIILiteral("printColor"), nullptr, protocolErrors.get()); - if (protocolErrors->length()) { - String errorMessage = String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters"); - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::InvalidParams, errorMessage, WTF::move(protocolErrors)); - return; - } - -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->executeNoOptionalParameters(callId, *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)); - } - m_backendDispatcher->sendResponse(callId, WTF::move(result), 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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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(WTF::move(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 WTF::move(*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 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) override; - 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) 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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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 "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/InspectorFrontendChannel.h> -#include <JavaScriptCore/InspectorValues.h> - -namespace Inspector { - -void ObjCInspectorDatabaseBackendDispatcher::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) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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 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) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - 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(callId, WTF::move(resultObject), String()); - }; - - 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/InspectorFrontendChannel.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 deleted file mode 100644 index 190b26002..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result +++ /dev/null @@ -1,1318 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void loadResource1(long callId, const InspectorObject& message); -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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void loadResource1(long callId, const InspectorObject& message); - void loadResource2(long callId, const InspectorObject& message); - void loadResource3(long callId, const InspectorObject& message); - void loadResource4(long callId, const InspectorObject& message); - void loadResource5(long callId, const InspectorObject& message); - void loadResource6(long callId, const InspectorObject& message); - void loadResource7(long callId, const InspectorObject& message); -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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<Network1BackendDispatcher> protect(*this); - - if (method == "loadResource1") - loadResource1(callId, message); - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found")); -} - -void Network1BackendDispatcher::loadResource1(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource1(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource1(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), 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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<Network3BackendDispatcher> protect(*this); - - typedef void (Network3BackendDispatcher::*CallHandler)(long callId, const InspectorObject& message); - typedef HashMap<String, CallHandler> DispatchMap; - DEPRECATED_DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ()); - if (dispatchMap.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.add(commands[i].name, commands[i].handler); - } - - HashMap<String, CallHandler>::iterator it = dispatchMap.find(method); - if (it == dispatchMap.end()) { - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Network3", '.', method, "' was not found")); - return; - } - - ((*this).*it->value)(callId, message.get()); -} - -void Network3BackendDispatcher::loadResource1(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource1(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource1(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource2(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource2(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource2(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource3(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource3(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource3(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource4(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource4(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource4(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource5(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource5(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource5(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource6(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource6(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource6(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), error); -} - -void Network3BackendDispatcher::loadResource7(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource7(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource7(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), 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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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 callId) override; -private: - RetainPtr<id<RWIProtocolNetwork1DomainHandler>> m_delegate; -}; - - - -class ObjCInspectorNetwork3BackendDispatcher final : public AlternateNetwork3BackendDispatcher { -public: - ObjCInspectorNetwork3BackendDispatcher(id<RWIProtocolNetwork3DomainHandler> handler) { m_delegate = handler; } - virtual void loadResource1(long callId) override; - virtual void loadResource2(long callId) override; - virtual void loadResource3(long callId) override; - virtual void loadResource4(long callId) override; - virtual void loadResource5(long callId) override; - virtual void loadResource6(long callId) override; - virtual void loadResource7(long callId) 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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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 "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/InspectorFrontendChannel.h> -#include <JavaScriptCore/InspectorValues.h> - -namespace Inspector { - -void ObjCInspectorNetwork1BackendDispatcher::loadResource1(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource1WithErrorCallback:errorCallback successCallback:successCallback]; -} - - - - -void ObjCInspectorNetwork3BackendDispatcher::loadResource1(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource1WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource2(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource2WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource3(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource3WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource4(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource4WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource5(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource5WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource6(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [m_delegate loadResource6WithErrorCallback:errorCallback successCallback:successCallback]; -} - -void ObjCInspectorNetwork3BackendDispatcher::loadResource7(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [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/InspectorFrontendChannel.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 deleted file mode 100644 index 9d74853c2..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result +++ /dev/null @@ -1,1172 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void commandWithEnumReturnValue(long callId, const InspectorObject& message); -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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<CommandDomainBackendDispatcher> protect(*this); - - if (method == "commandWithEnumReturnValue") - commandWithEnumReturnValue(callId, message); - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found")); -} - -void CommandDomainBackendDispatcher::commandWithEnumReturnValue(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->commandWithEnumReturnValue(callId); - 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)); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), 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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -class EventDomainFrontendDispatcher { -public: - EventDomainFrontendDispatcher(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } - // 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: - FrontendChannel* m_frontendChannel; -}; - -} // 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 <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"), WTF::move(paramsObject)); - - m_frontendChannel->sendMessageToFrontend(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 callId) 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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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 "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/InspectorFrontendChannel.h> -#include <JavaScriptCore/InspectorValues.h> - -namespace Inspector { - - - -void ObjCInspectorCommandDomainBackendDispatcher::commandWithEnumReturnValue(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^(RWIProtocolCommandDomainCommandWithEnumReturnValueReturnValue returnValue) { - Ref<InspectorObject> resultObject = InspectorObject::create(); - resultObject->setString(ASCIILiteral("returnValue"), toProtocolString(returnValue)); - backendDispatcher()->sendResponse(callId, WTF::move(resultObject), String()); - }; - - [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/InspectorFrontendChannel.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 -{ - FrontendChannel* frontendChannel = _controller->frontendChannel(); - if (!frontendChannel) - return; - - 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"), WTF::move(paramsObject)); - frontendChannel->sendMessageToFrontend(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 deleted file mode 100644 index 4b622d9de..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result +++ /dev/null @@ -1,1108 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -class DatabaseFrontendDispatcher { -public: - DatabaseFrontendDispatcher(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } - 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: - FrontendChannel* m_frontendChannel; -}; - -} // 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 <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"), WTF::move(paramsObject)); - - m_frontendChannel->sendMessageToFrontend(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"), WTF::move(paramsObject)); - - m_frontendChannel->sendMessageToFrontend(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(WTF::move(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 WTF::move(*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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 -{ - FrontendChannel* frontendChannel = _controller->frontendChannel(); - if (!frontendChannel) - return; - - 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"), WTF::move(paramsObject)); - frontendChannel->sendMessageToFrontend(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 -{ - FrontendChannel* frontendChannel = _controller->frontendChannel(); - if (!frontendChannel) - return; - - 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"), WTF::move(paramsObject)); - frontendChannel->sendMessageToFrontend(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 deleted file mode 100644 index 90d7195d6..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-domain-availability.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 3f756de32..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-call-parameter-names.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index ea148ff67..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-command-return-parameter-names.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index c71bbd21c..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-event-parameter-names.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 447cdf8e2..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-declarations.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index d5376a77a..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-duplicate-type-member-names.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 2655c2b90..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-enum-with-no-values.json-error +++ /dev/null @@ -1 +0,0 @@ -ERROR: Type reference with enum values must have at least one enum value. 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 deleted file mode 100644 index 97b2af0e4..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-parameter-flag.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 86df3750c..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-string-typed-optional-type-member.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 42f5753a4..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-declaration-using-type-reference.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index 4e462250c..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-type-with-lowercase-name.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index d3c782d89..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-declaration.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index faf6672cb..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/fail-on-unknown-type-reference-in-type-member.json-error +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index bb8d29d84..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result +++ /dev/null @@ -1,1159 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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 callId, const String& method, Ref<InspectorObject>&& message) override; -private: - void loadResource(long callId, const InspectorObject& message); -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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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 callId, const String& method, Ref<InspectorObject>&& message) -{ - Ref<Network1BackendDispatcher> protect(*this); - - if (method == "loadResource") - loadResource(callId, message); - else - m_backendDispatcher->reportProtocolError(&callId, BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found")); -} - -void Network1BackendDispatcher::loadResource(long callId, const InspectorObject&) -{ -#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS) - if (m_alternateDispatcher) { - m_alternateDispatcher->loadResource(callId); - return; - } -#endif - - ErrorString error; - Ref<InspectorObject> result = InspectorObject::create(); - m_agent->loadResource(error); - - m_backendDispatcher->sendResponse(callId, WTF::move(result), 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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -#if PLATFORM(WEB_EVENTS) -class Network3FrontendDispatcher { -public: - Network3FrontendDispatcher(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } - void resourceLoaded(); -private: - FrontendChannel* m_frontendChannel; -}; -#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 <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_frontendChannel->sendMessageToFrontend(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(WTF::move(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 WTF::move(*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 callId) 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"), WTF::move(alternateDispatcher)); - _controller->appendExtraAgent(WTF::move(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 "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/InspectorFrontendChannel.h> -#include <JavaScriptCore/InspectorValues.h> - -namespace Inspector { - -#if PLATFORM(WEB_COMMANDS) -void ObjCInspectorNetwork1BackendDispatcher::loadResource(long callId) -{ - id errorCallback = ^(NSString *error) { - backendDispatcher()->sendResponse(callId, InspectorObject::create(), error); - }; - - id successCallback = ^{ - backendDispatcher()->sendResponse(callId, InspectorObject::create(), String()); - }; - - [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/InspectorFrontendChannel.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 -{ - FrontendChannel* frontendChannel = _controller->frontendChannel(); - if (!frontendChannel) - return; - - Ref<InspectorObject> jsonMessage = InspectorObject::create(); - jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded")); - frontendChannel->sendMessageToFrontend(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 deleted file mode 100644 index c272f72b6..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result +++ /dev/null @@ -1,841 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index a8186e0b0..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result +++ /dev/null @@ -1,984 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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(WTF::move(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 WTF::move(*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"), WTF::move(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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 53b3f2216..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result +++ /dev/null @@ -1,826 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 7e9ef1e8a..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result +++ /dev/null @@ -1,893 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 6d63dd5ae..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result +++ /dev/null @@ -1,925 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 6e94941bc..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result +++ /dev/null @@ -1,1736 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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(WTF::move(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 WTF::move(*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(WTF::move(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 WTF::move(*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"), WTF::move(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"), WTF::move(value)); - } - - void setPayload(RefPtr<Inspector::InspectorValue> value) - { - InspectorObjectBase::setValue(ASCIILiteral("payload"), WTF::move(value)); - } - - void setError(RefPtr<Inspector::Protocol::Database::Error> value) - { - InspectorObjectBase::setObject(ASCIILiteral("error"), WTF::move(value)); - } - - void setErrorList(RefPtr<Inspector::Protocol::Database::ErrorList> value) - { - InspectorObjectBase::setArray(ASCIILiteral("errorList"), WTF::move(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(WTF::move(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 WTF::move(*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(WTF::move(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 WTF::move(*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(WTF::move(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 WTF::move(*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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 9eb1d40dd..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result +++ /dev/null @@ -1,1372 +0,0 @@ -### 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 <JavaScriptCore/InspectorBackendDispatcher.h> - -namespace Inspector { - -class AlternateBackendDispatcher { -public: - void setBackendDispatcher(RefPtr<BackendDispatcher>&& dispatcher) { m_backendDispatcher = WTF::move(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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.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/InspectorFrontendChannel.h> -#include <inspector/InspectorValues.h> -#include <wtf/text/WTFString.h> - -namespace Inspector { - - - -} // 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 <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(WTF::move(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 WTF::move(*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(WTF::move(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 WTF::move(*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"), WTF::move(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(WTF::move(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 WTF::move(*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"), WTF::move(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 "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/InspectorFrontendChannel.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/InspectorFrontendChannel.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 deleted file mode 100644 index 36ee2c600..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-domain-availability.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index bab76ca62..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-call-parameter-names.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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 deleted file mode 100644 index c8bb15c04..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-command-return-parameter-names.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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 deleted file mode 100644 index d3d3b3cc6..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-event-parameter-names.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "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 deleted file mode 100644 index 702fc6a32..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-declarations.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "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 deleted file mode 100644 index aebacee8b..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-duplicate-type-member-names.json +++ /dev/null @@ -1,15 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 232a7c324..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-enum-with-no-values.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "Database", - "types": [ - { - "id": "PrimaryColors", - "type": "string", - "enum": [] - } - ] -} 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 deleted file mode 100644 index 4012c79b6..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-parameter-flag.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "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 deleted file mode 100644 index ca3ef28a8..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-string-typed-optional-type-member.json +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 19b7590cc..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-declaration-using-type-reference.json +++ /dev/null @@ -1,13 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 531901e4a..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-type-with-lowercase-name.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "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 deleted file mode 100644 index d6887a274..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-declaration.json +++ /dev/null @@ -1,12 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index b817db504..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/fail-on-unknown-type-reference-in-type-member.json +++ /dev/null @@ -1,15 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 67cf8e582..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/generate-domains-with-feature-guards.json +++ /dev/null @@ -1,36 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 3bf4dff5c..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/same-type-id-different-domain.json +++ /dev/null @@ -1,22 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 20a0c1552..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/shadowed-optional-type-setters.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "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 deleted file mode 100644 index cbc9d5394..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-aliased-primitive-type.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "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 deleted file mode 100644 index cfb08bd94..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-array-type.json +++ /dev/null @@ -1,50 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 9f0aee9c9..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-enum-type.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "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 deleted file mode 100644 index 178309197..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/type-declaration-object-type.json +++ /dev/null @@ -1,83 +0,0 @@ -[ -{ - "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 deleted file mode 100644 index 83d94be89..000000000 --- a/Source/JavaScriptCore/inspector/scripts/tests/type-requiring-runtime-casts.json +++ /dev/null @@ -1,51 +0,0 @@ -[ -{ - "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 } - ] - } - ] -} -] |
