Title: [172980] trunk/Source
Revision
172980
Author
[email protected]
Date
2014-08-26 15:38:36 -0700 (Tue, 26 Aug 2014)

Log Message

Web Inspector: put feature flags for Inspector domains in the protocol specification
https://bugs.webkit.org/show_bug.cgi?id=136027

Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Remove the hardcoded map of domains to feature guards, and instead parse it from the specification.

Test: inspector/scripts/tests/generate-domains-with-feature-guards.json

* inspector/scripts/codegen/generator.py:
(Generator.wrap_with_guard_for_domain):
* inspector/scripts/codegen/models.py:
(Protocol.parse_domain):
(Domain.__init__):
(Domains):
* inspector/scripts/tests/generate-domains-with-feature-guards.json: Added.
* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:

Source/WebCore:

Add 'featureGuard' settings to wrap domains with ENABLE macros.

No new tests. No behavior was changed.

* inspector/protocol/Database.json:
* inspector/protocol/IndexedDB.json:
* inspector/protocol/Replay.json:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (172979 => 172980)


--- trunk/Source/_javascript_Core/ChangeLog	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-08-26 22:38:36 UTC (rev 172980)
@@ -1,3 +1,27 @@
+2014-08-26  Brian J. Burg  <[email protected]>
+
+        Web Inspector: put feature flags for Inspector domains in the protocol specification
+        https://bugs.webkit.org/show_bug.cgi?id=136027
+
+        Reviewed by Timothy Hatcher.
+
+        Remove the hardcoded map of domains to feature guards, and instead parse it from the specification.
+
+        Test: inspector/scripts/tests/generate-domains-with-feature-guards.json
+
+        * inspector/scripts/codegen/generator.py:
+        (Generator.wrap_with_guard_for_domain):
+        * inspector/scripts/codegen/models.py:
+        (Protocol.parse_domain):
+        (Domain.__init__):
+        (Domains):
+        * inspector/scripts/tests/generate-domains-with-feature-guards.json: Added.
+        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
+        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
+        * inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
+        * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
+        * inspector/scripts/tests/expected/type-declaration-object-type.json-result:
+
 2014-08-26  Andy Estes  <[email protected]>
 
         [Cocoa] Some projects are incorrectly installed to $BUILT_PRODUCTS_DIR

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py	2014-08-26 22:38:36 UTC (rev 172980)
@@ -47,13 +47,6 @@
     'any': 'Inspector::InspectorValue'
 }
 
-# FIXME: This should be converted into a property on the domain in JSON.
-_DOMAIN_TO_CPP_GUARD_MAP = {
-    'Database': "ENABLE(SQL_DATABASE)",
-    'IndexedDB': "ENABLE(INDEXED_DATABASE)",
-    'Replay': "ENABLE(WEB_REPLAY)",
-}
-
 _ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'XHR', 'XML'])
 
 # These objects are built manually by creating and setting InspectorValues.
@@ -209,7 +202,7 @@
     # Miscellaneous text manipulation routines.
     @staticmethod
     def wrap_with_guard_for_domain(domain, text):
-        guard = _DOMAIN_TO_CPP_GUARD_MAP.get(domain.domain_name)
+        guard = domain.feature_guard
         if guard is not None:
             lines = [
                 '#if %s' % guard,

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py	2014-08-26 22:38:36 UTC (rev 172980)
@@ -318,7 +318,7 @@
                 raise ParseException("Malformed domain specification: events is not an array")
             events.extend([self.parse_event(event) for event in json['events']])
 
-        self.domains.append(Domain(json['domain'], json.get('description', ""), isSupplemental, types, commands, events))
+        self.domains.append(Domain(json['domain'], json.get('description', ""), json.get("featureGuard"), isSupplemental, types, commands, events))
 
     def parse_type_declaration(self, json):
         check_for_required_properties(['id', 'type'], json, "type")
@@ -469,9 +469,10 @@
 
 
 class Domain:
-    def __init__(self, domain_name, description, isSupplemental, type_declarations, commands, events):
+    def __init__(self, domain_name, description, feature_guard, isSupplemental, type_declarations, commands, events):
         self.domain_name = domain_name
         self.description = description
+        self.feature_guard = feature_guard
         self.is_supplemental = isSupplemental
         self.type_declarations = type_declarations
         self.commands = commands
@@ -492,7 +493,7 @@
 
 
 class Domains:
-    GLOBAL = Domain("", "The global domain, in which primitive types are implicitly declared.", True, [], [], [])
+    GLOBAL = Domain("", "The global domain, in which primitive types are implicitly declared.", None, True, [], [], [])
 
 
 class TypeDeclaration:

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-08-26 22:38:36 UTC (rev 172980)
@@ -83,7 +83,6 @@
 
 typedef String ErrorString;
 
-#if ENABLE(SQL_DATABASE)
 class InspectorDatabaseBackendDispatcherHandler {
 public:
     // Named after parameter 'screenColor' while generating command/event executeSQLSyncOptionalReturnValues.
@@ -116,9 +115,7 @@
 protected:
     virtual ~InspectorDatabaseBackendDispatcherHandler();
 };
-#endif // ENABLE(SQL_DATABASE)
 
-#if ENABLE(SQL_DATABASE)
 class InspectorDatabaseBackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
     static PassRefPtr<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
@@ -132,7 +129,6 @@
     InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
     InspectorDatabaseBackendDispatcherHandler* m_agent;
 };
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -183,11 +179,8 @@
 
 namespace Inspector {
 
-#if ENABLE(SQL_DATABASE)
 InspectorDatabaseBackendDispatcherHandler::~InspectorDatabaseBackendDispatcherHandler() { }
-#endif // ENABLE(SQL_DATABASE)
 
-#if ENABLE(SQL_DATABASE)
 PassRefPtr<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
 {
     return adoptRef(new InspectorDatabaseBackendDispatcher(backendDispatcher, agent));
@@ -401,7 +394,6 @@
         return;
     }
 }
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -556,22 +548,18 @@
 namespace Protocol {
 
 // Forward declarations.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 class Error;
 enum class PrimaryColors;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of forward declarations.
 
 
 // Typedefs.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /* Unique identifier of Database object. */
 typedef int DatabaseId;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of typedefs.
 
 String getTestEnumConstantValue(int code);
@@ -581,7 +569,6 @@
     return getTestEnumConstantValue(static_cast<int>(enumValue));
 }
 
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /*  */
 enum class PrimaryColors {
@@ -658,7 +645,6 @@
 };
 
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 
 
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-08-26 22:38:36 UTC (rev 172980)
@@ -80,7 +80,6 @@
 
 typedef String ErrorString;
 
-#if ENABLE(SQL_DATABASE)
 class InspectorDatabaseBackendDispatcherHandler {
 public:
     // Named after parameter 'screenColor' while generating command/event executeAllOptionalParameters.
@@ -101,9 +100,7 @@
 protected:
     virtual ~InspectorDatabaseBackendDispatcherHandler();
 };
-#endif // ENABLE(SQL_DATABASE)
 
-#if ENABLE(SQL_DATABASE)
 class InspectorDatabaseBackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
 public:
     static PassRefPtr<InspectorDatabaseBackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
@@ -115,7 +112,6 @@
     InspectorDatabaseBackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorDatabaseBackendDispatcherHandler*);
     InspectorDatabaseBackendDispatcherHandler* m_agent;
 };
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -166,11 +162,8 @@
 
 namespace Inspector {
 
-#if ENABLE(SQL_DATABASE)
 InspectorDatabaseBackendDispatcherHandler::~InspectorDatabaseBackendDispatcherHandler() { }
-#endif // ENABLE(SQL_DATABASE)
 
-#if ENABLE(SQL_DATABASE)
 PassRefPtr<InspectorDatabaseBackendDispatcher> InspectorDatabaseBackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorDatabaseBackendDispatcherHandler* agent)
 {
     return adoptRef(new InspectorDatabaseBackendDispatcher(backendDispatcher, agent));
@@ -308,7 +301,6 @@
     }
     m_backendDispatcher->sendResponse(callId, result.release(), error);
 }
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -463,22 +455,18 @@
 namespace Protocol {
 
 // Forward declarations.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 class Error;
 enum class PrimaryColors;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of forward declarations.
 
 
 // Typedefs.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /* Unique identifier of Database object. */
 typedef int DatabaseId;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of typedefs.
 
 String getTestEnumConstantValue(int code);
@@ -488,7 +476,6 @@
     return getTestEnumConstantValue(static_cast<int>(enumValue));
 }
 
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /*  */
 enum class PrimaryColors {
@@ -565,7 +552,6 @@
 };
 
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 
 
 

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result	2014-08-26 22:38:36 UTC (rev 172980)
@@ -183,7 +183,6 @@
 
 
 
-#if ENABLE(SQL_DATABASE)
 class InspectorDatabaseFrontendDispatcher {
 public:
     InspectorDatabaseFrontendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }
@@ -192,7 +191,6 @@
 private:
     InspectorFrontendChannel* m_inspectorFrontendChannel;
 };
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -241,7 +239,6 @@
 
 namespace Inspector {
 
-#if ENABLE(SQL_DATABASE)
 void InspectorDatabaseFrontendDispatcher::didExecuteOptionalParameters(PassRefPtr<Inspector::Protocol::Array<String>> columnNames, const String* const notes, const double* const timestamp, PassRefPtr<Inspector::InspectorObject> values, PassRefPtr<Inspector::InspectorValue> payload, PassRefPtr<Inspector::Protocol::Database::Error> sqlError, const Inspector::Protocol::Database::PrimaryColors* const screenColor, const String* const printColor)
 {
     RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
@@ -285,7 +282,6 @@
 
     m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
 }
-#endif // ENABLE(SQL_DATABASE)
 
 } // namespace Inspector
 
@@ -341,23 +337,19 @@
 namespace Protocol {
 
 // Forward declarations.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 class Error;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of forward declarations.
 
 
 // Typedefs.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /* Unique identifier of Database object. */
 typedef String DatabaseId;
 
 typedef String PrimaryColors;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 // End of typedefs.
 
 String getTestEnumConstantValue(int code);
@@ -367,7 +359,6 @@
     return getTestEnumConstantValue(static_cast<int>(enumValue));
 }
 
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /* Database error. */
 class Error : public Inspector::InspectorObjectBase {
@@ -438,7 +429,6 @@
 };
 
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 
 
 

Copied: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result (from rev 172979, trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result) (0 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	                        (rev 0)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	2014-08-26 22:38:36 UTC (rev 172980)
@@ -0,0 +1,523 @@
+### Begin File: InspectorTestBackendCommands.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+// Network1.
+InspectorBackend.registerCommand("Network1.loadResource", [], []);
+
+// Network3.
+InspectorBackend.registerNetwork3Dispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Network3");
+InspectorBackend.registerEvent("Network3.resourceLoaded", []);
+### End File: InspectorTestBackendCommands.js
+
+### Begin File: InspectorTestBackendDispatchers.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorTestBackendDispatchers_h
+#define InspectorTestBackendDispatchers_h
+
+#if ENABLE(INSPECTOR)
+
+#include "InspectorTestProtocolTypes.h"
+#include <inspector/InspectorBackendDispatcher.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+typedef String ErrorString;
+
+#if PLATFORM(WEB_COMMANDS)
+class InspectorNetwork1BackendDispatcherHandler {
+public:
+    virtual void loadResource(ErrorString*) = 0;
+protected:
+    virtual ~InspectorNetwork1BackendDispatcherHandler();
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+#if PLATFORM(WEB_COMMANDS)
+class InspectorNetwork1BackendDispatcher final : public Inspector::InspectorSupplementalBackendDispatcher {
+public:
+    static PassRefPtr<InspectorNetwork1BackendDispatcher> create(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    virtual void dispatch(long callId, const String& method, PassRefPtr<Inspector::InspectorObject> message) override;
+private:
+    void loadResource(long callId, const Inspector::InspectorObject& message);
+private:
+    InspectorNetwork1BackendDispatcher(Inspector::InspectorBackendDispatcher*, InspectorNetwork1BackendDispatcherHandler*);
+    InspectorNetwork1BackendDispatcherHandler* m_agent;
+};
+#endif // PLATFORM(WEB_COMMANDS)
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(InspectorTestBackendDispatchers_h)
+### End File: InspectorTestBackendDispatchers.h
+
+### Begin File: InspectorTestBackendDispatchers.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorTestBackendDispatchers.h"
+
+#if ENABLE(INSPECTOR)
+
+#include <inspector/InspectorFrontendChannel.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+#if PLATFORM(WEB_COMMANDS)
+InspectorNetwork1BackendDispatcherHandler::~InspectorNetwork1BackendDispatcherHandler() { }
+#endif // PLATFORM(WEB_COMMANDS)
+
+#if PLATFORM(WEB_COMMANDS)
+PassRefPtr<InspectorNetwork1BackendDispatcher> InspectorNetwork1BackendDispatcher::create(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+{
+    return adoptRef(new InspectorNetwork1BackendDispatcher(backendDispatcher, agent));
+}
+
+InspectorNetwork1BackendDispatcher::InspectorNetwork1BackendDispatcher(InspectorBackendDispatcher* backendDispatcher, InspectorNetwork1BackendDispatcherHandler* agent)
+    : InspectorSupplementalBackendDispatcher(backendDispatcher)
+    , m_agent(agent)
+{
+    m_backendDispatcher->registerDispatcherForDomain(ASCIILiteral("Network1"), this);
+}
+
+void InspectorNetwork1BackendDispatcher::dispatch(long callId, const String& method, PassRefPtr<InspectorObject> message)
+{
+    Ref<InspectorNetwork1BackendDispatcher> protect(*this);
+
+    if (method == "loadResource")
+        loadResource(callId, *message.get());
+    else
+        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "Network1" + '.' + method + "' was not found");
+}
+
+void InspectorNetwork1BackendDispatcher::loadResource(long callId, const InspectorObject&)
+{
+    ErrorString error;
+    RefPtr<InspectorObject> result = InspectorObject::create();
+    m_agent->loadResource(&error);
+
+    m_backendDispatcher->sendResponse(callId, result.release(), error);
+}
+#endif // PLATFORM(WEB_COMMANDS)
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+### End File: InspectorTestBackendDispatchers.cpp
+
+### Begin File: InspectorTestFrontendDispatchers.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorTestFrontendDispatchers_h
+#define InspectorTestFrontendDispatchers_h
+
+#if ENABLE(INSPECTOR)
+
+#include "InspectorTestProtocolTypes.h"
+#include <inspector/InspectorFrontendChannel.h>
+#include <inspector/InspectorValues.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+
+
+#if PLATFORM(WEB_EVENTS)
+class InspectorNetwork3FrontendDispatcher {
+public:
+    InspectorNetwork3FrontendDispatcher(InspectorFrontendChannel* inspectorFrontendChannel) : m_inspectorFrontendChannel(inspectorFrontendChannel) { }
+    void resourceLoaded();
+private:
+    InspectorFrontendChannel* m_inspectorFrontendChannel;
+};
+#endif // PLATFORM(WEB_EVENTS)
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(InspectorTestFrontendDispatchers_h)
+### End File: InspectorTestFrontendDispatchers.h
+
+### Begin File: InspectorTestFrontendDispatchers.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorTestFrontendDispatchers.h"
+
+#if ENABLE(INSPECTOR)
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+#if PLATFORM(WEB_EVENTS)
+void InspectorNetwork3FrontendDispatcher::resourceLoaded()
+{
+    RefPtr<InspectorObject> jsonMessage = InspectorObject::create();
+    jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Network3.resourceLoaded"));
+
+    m_inspectorFrontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());
+}
+#endif // PLATFORM(WEB_EVENTS)
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+### End File: InspectorTestFrontendDispatchers.cpp
+
+### Begin File: InspectorTestProtocolTypes.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#ifndef InspectorTestProtocolTypes_h
+#define InspectorTestProtocolTypes_h
+
+#if ENABLE(INSPECTOR)
+
+#include <inspector/InspectorJSProtocolTypes.h>
+#include <inspector/InspectorProtocolTypes.h>
+#include <wtf/Assertions.h>
+#include <wtf/PassRefPtr.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 getTestEnumConstantValue(int code);
+
+template<typename T> String getTestEnumConstantValue(T enumValue)
+{
+    return getTestEnumConstantValue(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<Inspector::InspectorObject> m_result;
+
+        template<int STEP> Builder<STATE | STEP>& castState()
+        {
+            return *reinterpret_cast<Builder<STATE | STEP>*>(this);
+        }
+
+        Builder(PassRefPtr</*NetworkError*/Inspector::InspectorObject> ptr)
+        {
+            COMPILE_ASSERT(STATE == NoFieldsSet, builder_created_in_non_init_state);
+            m_result = ptr;
+        }
+        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->setNumber(ASCIILiteral("code"), value);
+            return castState<CodeSet>();
+        }
+
+        operator RefPtr<NetworkError>& ()
+        {
+            COMPILE_ASSERT(STATE == AllFieldsSet, result_is_not_ready);
+            COMPILE_ASSERT(sizeof(NetworkError) == sizeof(Inspector::InspectorObject), cannot_cast);
+            return *reinterpret_cast<RefPtr<NetworkError>*>(&m_result);
+        }
+
+        PassRefPtr<NetworkError> release()
+        {
+            return RefPtr<NetworkError>(*this).release();
+        }
+    };
+
+    /*
+     * Synthetic constructor:
+     * RefPtr<NetworkError> result = NetworkError::create()
+     *     .setMessage(...)
+     *     .setCode(...);
+     */
+    static Builder<NoFieldsSet> create()
+    {
+        return Builder<NoFieldsSet>(Inspector::InspectorObject::create());
+    }
+    typedef Inspector::Protocol::StructItemTraits ItemTraits;
+};
+
+} // Network2
+#endif // PLATFORM(WEB_TYPES)
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(InspectorTestProtocolTypes_h)
+### End File: InspectorTestProtocolTypes.h
+
+### Begin File: InspectorTestProtocolTypes.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/_javascript_Core/inspector/scripts/generate-inspector-protocol-bindings.py
+
+#include "config.h"
+#include "InspectorTestProtocolTypes.h"
+
+#if ENABLE(INSPECTOR)
+
+#include <wtf/text/CString.h>
+
+namespace Inspector {
+
+namespace Protocol {
+
+static const char* const enum_constant_values[] = {
+};
+
+String getTestEnumConstantValue(int code) {
+    return enum_constant_values[code];
+}
+
+
+
+} // namespace Protocol
+
+} // namespace Inspector
+
+#endif // ENABLE(INSPECTOR)
+
+### End File: InspectorTestProtocolTypes.cpp

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result (172979 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result	2014-08-26 22:38:36 UTC (rev 172980)
@@ -279,7 +279,6 @@
 namespace Protocol {
 
 // Forward declarations.
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 class DummyObject;
 class Error;
@@ -287,7 +286,6 @@
 class OptionalParameterBundle;
 class ParameterBundle;
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 
 namespace Test {
 class ParameterBundle;
@@ -304,7 +302,6 @@
     return getTestEnumConstantValue(static_cast<int>(enumValue));
 }
 
-#if ENABLE(SQL_DATABASE)
 namespace Database {
 /* Database error. */
 class Error : public Inspector::InspectorObjectBase {
@@ -652,7 +649,6 @@
 };
 
 } // Database
-#endif // ENABLE(SQL_DATABASE)
 
 namespace Test {
 class ParameterBundle : public Inspector::InspectorObjectBase {

Added: trunk/Source/_javascript_Core/inspector/scripts/tests/generate-domains-with-feature-guards.json (0 => 172980)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generate-domains-with-feature-guards.json	                        (rev 0)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generate-domains-with-feature-guards.json	2014-08-26 22:38:36 UTC (rev 172980)
@@ -0,0 +1,36 @@
+[
+{
+    "domain": "Network1",
+    "featureGuard": "PLATFORM(WEB_COMMANDS)",
+    "commands": [
+        {
+            "name": "loadResource",
+            "description": "Loads a resource in the context of a frame on the inspected page without cross origin checks."
+        }
+    ]
+},
+{
+    "domain": "Network2",
+    "featureGuard": "PLATFORM(WEB_TYPES)",
+    "types": [
+        {
+            "id": "NetworkError",
+            "type": "object",
+            "properties": [
+                { "name": "message", "type": "string", "description": "Error message." },
+                { "name": "code", "type": "integer", "description": "Error code." }
+            ]
+        }
+    ]
+},
+{
+    "domain": "Network3",
+    "featureGuard": "PLATFORM(WEB_EVENTS)",
+    "events": [
+        {
+            "name": "resourceLoaded",
+            "description": "A resource was loaded."
+        }
+    ]
+}
+]

Modified: trunk/Source/WebCore/ChangeLog (172979 => 172980)


--- trunk/Source/WebCore/ChangeLog	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/WebCore/ChangeLog	2014-08-26 22:38:36 UTC (rev 172980)
@@ -1,3 +1,18 @@
+2014-08-26  Brian J. Burg  <[email protected]>
+
+        Web Inspector: put feature flags for Inspector domains in the protocol specification
+        https://bugs.webkit.org/show_bug.cgi?id=136027
+
+        Reviewed by Timothy Hatcher.
+
+        Add 'featureGuard' settings to wrap domains with ENABLE macros.
+
+        No new tests. No behavior was changed.
+
+        * inspector/protocol/Database.json:
+        * inspector/protocol/IndexedDB.json:
+        * inspector/protocol/Replay.json:
+
 2014-08-26  Andy Estes  <[email protected]>
 
         [Cocoa] Some projects are incorrectly installed to $BUILT_PRODUCTS_DIR

Modified: trunk/Source/WebCore/inspector/protocol/Database.json (172979 => 172980)


--- trunk/Source/WebCore/inspector/protocol/Database.json	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/WebCore/inspector/protocol/Database.json	2014-08-26 22:38:36 UTC (rev 172980)
@@ -1,5 +1,6 @@
 {
     "domain": "Database",
+    "featureGuard": "ENABLE(SQL_DATABASE)",
     "types": [
         {
             "id": "DatabaseId",

Modified: trunk/Source/WebCore/inspector/protocol/IndexedDB.json (172979 => 172980)


--- trunk/Source/WebCore/inspector/protocol/IndexedDB.json	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/WebCore/inspector/protocol/IndexedDB.json	2014-08-26 22:38:36 UTC (rev 172980)
@@ -1,5 +1,6 @@
 {
     "domain": "IndexedDB",
+    "featureGuard": "ENABLE(INDEXED_DATABASE)",
     "types": [
         {
             "id": "DatabaseWithObjectStores",

Modified: trunk/Source/WebCore/inspector/protocol/Replay.json (172979 => 172980)


--- trunk/Source/WebCore/inspector/protocol/Replay.json	2014-08-26 22:36:19 UTC (rev 172979)
+++ trunk/Source/WebCore/inspector/protocol/Replay.json	2014-08-26 22:38:36 UTC (rev 172980)
@@ -1,6 +1,7 @@
 {
     "domain": "Replay",
     "description": "Controls web replay, and manages recording sessions and segments.",
+    "featureGuard": "ENABLE(WEB_REPLAY)",
     "types": [
         {
             "id": "SessionIdentifier", "description": "Unique replay session identifier.",
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to