Title: [175478] trunk/Source
Revision
175478
Author
[email protected]
Date
2014-11-03 11:36:14 -0800 (Mon, 03 Nov 2014)

Log Message

Web Inspector: ALTERNATE_DISPATCHERS Let the frontend know about extra agents
https://bugs.webkit.org/show_bug.cgi?id=138236

Reviewed by Brian Burg.

Source/_javascript_Core:

Inform the frontend about any extra domains the backend may have
above and beyond the default list of domains for the debuggable type.
This approach means there is almost no cost to normal debugging.
When a JSContext is debugged with extra agents, a message is sent
to the frontend letting it know which domains to then activate,
and perform any initialization work that may be required.

* inspector/InspectorAgentBase.h:
(Inspector::InspectorAgentBase::domainName):
* inspector/InspectorAgentRegistry.cpp:
(Inspector::InspectorAgentRegistry::appendExtraAgent):
* inspector/InspectorAgentRegistry.h:
* inspector/scripts/codegen/generator_templates.py:
Provide a way to get a list of just the extra domains.
To aggregate this list provide a different "append"
specifically for extra agents.

* inspector/JSGlobalObjectInspectorController.h:
* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
(Inspector::JSGlobalObjectInspectorController::connectFrontend):
When a frontend connects, inform it of the extra domains.

* inspector/protocol/Inspector.json:
* inspector/agents/InspectorAgent.h:
* inspector/agents/InspectorAgent.cpp:
(Inspector::InspectorAgent::enable):
(Inspector::InspectorAgent::activateExtraDomains):
Send an event with the extra domains to activate.

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass.prototype.activateDomain):
* UserInterface/Protocol/InspectorObserver.js:
(WebInspector.InspectorObserver.prototype.activateExtraDomains):
* UserInterface/Base/Object.js:
* UserInterface/Base/Test.js:
* UserInterface/Base/Main.js:
(WebInspector.activateExtraDomains):
Default state is that there are no extra domains. When extra domains
are activated, some agents need to be re-initialized. Dispatch a
model event so views also know to re-initialize.

* UserInterface/Controllers/ApplicationCacheManager.js:
(WebInspector.ApplicationCacheManager.prototype._mainResourceDidChange):
* UserInterface/Controllers/DOMTreeManager.js:
Be more careful about direct agent use during main resource changes.
That can happen with a JSContext extended with a Page agent.

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager):
(WebInspector.FrameResourceManager.prototype._mainFrameDidChange):
(WebInspector.FrameResourceManager.prototype._extraDomainsActivated):
* UserInterface/Controllers/StorageManager.js:
(WebInspector.StorageManager):
(WebInspector.StorageManager.prototype._databaseForIdentifier):
(WebInspector.StorageManager.prototype._extraDomainsActivated):
It is possible new window.FooAgent's are available. Perform expected
initialization re-checking if the agents are now available.

* UserInterface/Models/CSSCompletions.js:
Avoid re-initialization if we already did it. This should never
happen but this is just to be safe.

* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype._extraDomainsActivated):
Don't disallow expandable tree elements if this is a JSContext with
extra domains. If that JSContext has resources, we would have been
unable to see child resources.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (175477 => 175478)


--- trunk/Source/_javascript_Core/ChangeLog	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-11-03 19:36:14 UTC (rev 175478)
@@ -1,3 +1,40 @@
+2014-11-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: ALTERNATE_DISPATCHERS Let the frontend know about extra agents
+        https://bugs.webkit.org/show_bug.cgi?id=138236
+
+        Reviewed by Brian Burg.
+
+        Inform the frontend about any extra domains the backend may have
+        above and beyond the default list of domains for the debuggable type.
+        This approach means there is almost no cost to normal debugging.
+        When a JSContext is debugged with extra agents, a message is sent
+        to the frontend letting it know which domains to then activate,
+        and perform any initialization work that may be required.
+
+        * inspector/InspectorAgentBase.h:
+        (Inspector::InspectorAgentBase::domainName):
+        * inspector/InspectorAgentRegistry.cpp:
+        (Inspector::InspectorAgentRegistry::appendExtraAgent):
+        * inspector/InspectorAgentRegistry.h:
+        * inspector/scripts/codegen/generator_templates.py:
+        Provide a way to get a list of just the extra domains.
+        To aggregate this list provide a different "append"
+        specifically for extra agents.
+
+        * inspector/JSGlobalObjectInspectorController.h:
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        (Inspector::JSGlobalObjectInspectorController::connectFrontend):
+        When a frontend connects, inform it of the extra domains.
+
+        * inspector/protocol/Inspector.json:
+        * inspector/agents/InspectorAgent.h:
+        * inspector/agents/InspectorAgent.cpp:
+        (Inspector::InspectorAgent::enable):
+        (Inspector::InspectorAgent::activateExtraDomains):
+        Send an event with the extra domains to activate.
+
 2014-11-01  Michael Saboff  <[email protected]>
 
         Add scope operand to op_resolve_scope

Modified: trunk/Source/_javascript_Core/inspector/InspectorAgentBase.h (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/InspectorAgentBase.h	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/InspectorAgentBase.h	2014-11-03 19:36:14 UTC (rev 175478)
@@ -43,6 +43,8 @@
 public:
     virtual ~InspectorAgentBase() { }
 
+    String domainName() const { return m_name; }
+
     virtual void didCreateFrontendAndBackend(InspectorFrontendChannel*, InspectorBackendDispatcher*) = 0;
     virtual void willDestroyFrontendAndBackend(InspectorDisconnectReason reason) = 0;
     virtual void discardAgent() { }

Modified: trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.cpp (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.cpp	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.cpp	2014-11-03 19:36:14 UTC (rev 175478)
@@ -42,6 +42,15 @@
     m_agents.append(WTF::move(agent));
 }
 
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void InspectorAgentRegistry::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent)
+{
+    m_extraDomains.append(agent->domainName());
+
+    append(WTF::move(agent));
+}
+#endif
+
 void InspectorAgentRegistry::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
 {
     for (size_t i = 0; i < m_agents.size(); i++)

Modified: trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.h (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.h	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/InspectorAgentRegistry.h	2014-11-03 19:36:14 UTC (rev 175478)
@@ -28,6 +28,7 @@
 #define InspectorAgentRegistry_h
 
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
 namespace Inspector {
 
@@ -46,6 +47,11 @@
     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.
@@ -53,6 +59,9 @@
     InspectorAgentRegistry& operator=(const InspectorAgentRegistry&) = delete;
 
     Vector<std::unique_ptr<InspectorAgentBase>> m_agents;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    Vector<String> m_extraDomains;
+#endif
 };
 
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp	2014-11-03 19:36:14 UTC (rev 175478)
@@ -68,17 +68,19 @@
     , 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(std::make_unique<InspectorAgent>(*this));
+    m_agents.append(WTF::move(inspectorAgent));
     m_agents.append(WTF::move(runtimeAgent));
     m_agents.append(WTF::move(consoleAgent));
     m_agents.append(WTF::move(debuggerAgent));
@@ -111,6 +113,8 @@
     m_agents.didCreateFrontendAndBackend(frontendChannel, m_inspectorBackendDispatcher.get());
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    m_inspectorAgent->activateExtraDomains(m_agents.extraDomains());
+
     if (m_augmentingClient)
         m_augmentingClient->inspectorConnected();
 #endif

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h	2014-11-03 19:36:14 UTC (rev 175478)
@@ -53,7 +53,7 @@
 namespace Inspector {
 
 class InjectedScriptManager;
-class InspectorConsoleAgent;
+class InspectorAgent;
 class InspectorBackendDispatcher;
 class InspectorConsoleAgent;
 class InspectorDebuggerAgent;
@@ -110,6 +110,7 @@
     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;
     InspectorAgentRegistry m_agents;

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.cpp	2014-11-03 19:36:14 UTC (rev 175478)
@@ -74,6 +74,11 @@
     if (m_pendingInspectData.first)
         inspect(m_pendingInspectData.first, m_pendingInspectData.second);
 
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    if (m_pendingExtraDomainsData)
+        m_frontendDispatcher->activateExtraDomains(m_pendingExtraDomainsData);
+#endif
+
     for (auto& testCommand : m_pendingEvaluateTestCommands) {
         if (!m_frontendDispatcher)
             break;
@@ -115,6 +120,23 @@
         m_pendingEvaluateTestCommands.append(script);
 }
 
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void InspectorAgent::activateExtraDomains(const Vector<String>& extraDomains)
+{
+    if (extraDomains.isEmpty())
+        return;
+
+    RefPtr<Inspector::Protocol::Array<String>> domainNames = Inspector::Protocol::Array<String>::create();
+    for (auto domainName : extraDomains)
+        domainNames->addItem(domainName);
+
+    if (!m_enabled)
+        m_pendingExtraDomainsData = domainNames.release();
+    else
+        m_frontendDispatcher->activateExtraDomains(domainNames.release());
+}
+#endif
+
 } // namespace Inspector
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorAgent.h	2014-11-03 19:36:14 UTC (rev 175478)
@@ -64,12 +64,19 @@
     void inspect(PassRefPtr<Protocol::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints);
     void evaluateForTestInFrontend(const String& script);
 
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    void activateExtraDomains(const Vector<String>&);
+#endif
+
 private:
     InspectorEnvironment& m_environment;
     std::unique_ptr<InspectorInspectorFrontendDispatcher> m_frontendDispatcher;
     RefPtr<InspectorInspectorBackendDispatcher> m_backendDispatcher;
     Vector<String> m_pendingEvaluateTestCommands;
     std::pair<RefPtr<Protocol::Runtime::RemoteObject>, RefPtr<InspectorObject>> m_pendingInspectData;
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+    RefPtr<Inspector::Protocol::Array<String>> m_pendingExtraDomainsData;
+#endif
     bool m_enabled;
 };
 

Modified: trunk/Source/_javascript_Core/inspector/protocol/Inspector.json (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/protocol/Inspector.json	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/protocol/Inspector.json	2014-11-03 19:36:14 UTC (rev 175478)
@@ -37,6 +37,13 @@
             ]
         },
         {
+            "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"
         }

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objective_c.py (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objective_c.py	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objective_c.py	2014-11-03 19:36:14 UTC (rev 175478)
@@ -342,7 +342,7 @@
         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 is 'Inspector::Protocol::Array<String>':
+            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

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generator_templates.py	2014-11-03 19:36:14 UTC (rev 175478)
@@ -415,7 +415,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspector${domainName}BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<Inspector${domainName}BackendDispatcher, AlternateInspector${domainName}BackendDispatcher>>(ASCIILiteral("${domainName}"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<${objcPrefix}${domainName}DomainHandler>)${variableNamePrefix}Handler

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


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result	2014-11-03 19:36:14 UTC (rev 175478)
@@ -963,7 +963,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorDatabaseBackendDispatcher, AlternateInspectorDatabaseBackendDispatcher>>(ASCIILiteral("Database"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolDatabaseDomainHandler>)databaseHandler

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


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result	2014-11-03 19:36:14 UTC (rev 175478)
@@ -852,7 +852,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorDatabaseBackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorDatabaseBackendDispatcher, AlternateInspectorDatabaseBackendDispatcher>>(ASCIILiteral("Database"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolDatabaseDomainHandler>)databaseHandler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result	2014-11-03 19:36:14 UTC (rev 175478)
@@ -869,7 +869,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork1BackendDispatcher, AlternateInspectorNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork1DomainHandler>)network1Handler
@@ -887,7 +887,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork3BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork3BackendDispatcher, AlternateInspectorNetwork3BackendDispatcher>>(ASCIILiteral("Network3"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork3DomainHandler>)network3Handler

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result (175477 => 175478)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result	2014-11-03 19:36:14 UTC (rev 175478)
@@ -750,7 +750,7 @@
 
     auto alternateDispatcher = std::make_unique<ObjCInspectorNetwork1BackendDispatcher>(handler);
     auto alternateAgent = std::make_unique<AlternateDispatchableAgent<InspectorNetwork1BackendDispatcher, AlternateInspectorNetwork1BackendDispatcher>>(ASCIILiteral("Network1"), WTF::move(alternateDispatcher));
-    _controller->agentRegistry().append(WTF::move(alternateAgent));
+    _controller->agentRegistry().appendExtraAgent(WTF::move(alternateAgent));
 }
 
 - (id<RWIProtocolNetwork1DomainHandler>)network1Handler

Modified: trunk/Source/WebInspectorUI/ChangeLog (175477 => 175478)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-11-03 19:36:14 UTC (rev 175478)
@@ -1,3 +1,50 @@
+2014-11-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: ALTERNATE_DISPATCHERS Let the frontend know about extra agents
+        https://bugs.webkit.org/show_bug.cgi?id=138236
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Protocol/InspectorBackend.js:
+        (InspectorBackendClass.prototype.activateDomain):
+        * UserInterface/Protocol/InspectorObserver.js:
+        (WebInspector.InspectorObserver.prototype.activateExtraDomains):
+        * UserInterface/Base/Object.js:
+        * UserInterface/Base/Test.js:
+        * UserInterface/Base/Main.js:
+        (WebInspector.activateExtraDomains):
+        Default state is that there are no extra domains. When extra domains
+        are activated, some agents need to be re-initialized. Dispatch a
+        model event so views also know to re-initialize.
+
+        * UserInterface/Controllers/ApplicationCacheManager.js:
+        (WebInspector.ApplicationCacheManager.prototype._mainResourceDidChange):
+        * UserInterface/Controllers/DOMTreeManager.js:
+        Be more careful about direct agent use during main resource changes.
+        That can happen with a JSContext extended with a Page agent.
+
+        * UserInterface/Controllers/FrameResourceManager.js:
+        (WebInspector.FrameResourceManager):
+        (WebInspector.FrameResourceManager.prototype._mainFrameDidChange):
+        (WebInspector.FrameResourceManager.prototype._extraDomainsActivated):
+        * UserInterface/Controllers/StorageManager.js:
+        (WebInspector.StorageManager):
+        (WebInspector.StorageManager.prototype._databaseForIdentifier):
+        (WebInspector.StorageManager.prototype._extraDomainsActivated):
+        It is possible new window.FooAgent's are available. Perform expected
+        initialization re-checking if the agents are now available.
+
+        * UserInterface/Models/CSSCompletions.js:
+        Avoid re-initialization if we already did it. This should never
+        happen but this is just to be safe.
+
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel):
+        (WebInspector.ResourceSidebarPanel.prototype._extraDomainsActivated):
+        Don't disallow expandable tree elements if this is a JSContext with
+        extra domains. If that JSContext has resources, we would have been
+        unable to see child resources.
+
 2014-10-30  Dana Burkart  <[email protected]>
 
         <rdar://problem/18821260> Prepare for the mysterious future

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -23,12 +23,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Notification = {
-    GlobalModifierKeysDidChange: "global-modifiers-did-change",
-    PageArchiveStarted: "page-archive-started",
-    PageArchiveEnded: "page-archive-ended"
-};
-
 WebInspector.ContentViewCookieType = {
     ApplicationCache: "application-cache",
     CookieStorage: "cookie-storage",
@@ -53,6 +47,7 @@
     this._initializeWebSocketIfNeeded();
 
     this.debuggableType = InspectorFrontendHost.debuggableType() === "web" ? WebInspector.DebuggableType.Web : WebInspector.DebuggableType._javascript_;
+    this.hasExtraDomains = false;
 
     // Register observers for events from the InspectorBackend.
     if (InspectorBackend.registerInspectorDispatcher)
@@ -359,6 +354,22 @@
     this._contentLoaded = true;
 }
 
+WebInspector.activateExtraDomains = function(domains)
+{
+    console.assert(!this.hasExtraDomains);
+    this.hasExtraDomains = true;
+
+    for (var domain of domains) {
+        var agent = InspectorBackend.activateDomain(domain);
+        if (agent.enable)
+            agent.enable();
+    }
+
+    this.notifications.dispatchEventToListeners(WebInspector.Notification.ExtraDomainsActivated);
+
+    WebInspector.CSSCompletions.requestCSSNameCompletions();
+}
+
 WebInspector.sidebarPanelForCurrentContentView = function()
 {
     var currentContentView = this.contentBrowser.currentContentView;

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Object.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Object.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -189,3 +189,10 @@
 };
 
 WebInspector.notifications = new WebInspector.Object;
+
+WebInspector.Notification = {
+    GlobalModifierKeysDidChange: "global-modifiers-did-change",
+    PageArchiveStarted: "page-archive-started",
+    PageArchiveEnded: "page-archive-ended",
+    ExtraDomainsActivated: "extra-domains-activated",
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Test.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Test.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -23,8 +23,16 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+WebInspector.DebuggableType = {
+    Web: "web",
+    _javascript_: "_javascript_"
+};
+
 WebInspector.loaded = function()
 {
+    this.debuggableType = WebInspector.DebuggableType.Web;
+    this.hasExtraDomains = false;
+
     // Register observers for events from the InspectorBackend.
     // The initialization order should match the same in Main.js.
     InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/ApplicationCacheManager.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -119,7 +119,8 @@
             return;
         }
 
-        ApplicationCacheAgent.getManifestForFrame(event.target.id, this._manifestForFrameLoaded.bind(this, event.target.id));
+        if (window.ApplicationCacheAgent)
+            ApplicationCacheAgent.getManifestForFrame(event.target.id, this._manifestForFrameLoaded.bind(this, event.target.id));
     },
 
     _childFrameWasRemoved: function(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -471,7 +471,7 @@
             this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated, {documentNodeIdentifier: documentNodeIdentifier, flows: contentFlows});
         }
 
-        if (CSSAgent.getNamedFlowCollection)
+        if (window.CSSAgent && CSSAgent.getNamedFlowCollection)
             CSSAgent.getNamedFlowCollection(documentNodeIdentifier, onNamedFlowCollectionAvailable.bind(this));
     },
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -32,6 +32,8 @@
     if (window.NetworkAgent)
         NetworkAgent.enable();
 
+    WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+
     this.initialize();
 };
 
@@ -583,6 +585,12 @@
         if (this._mainFrame)
             this._mainFrame.markAsMainFrame();
         this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.MainFrameDidChange, {oldMainFrame: oldMainFrame});
+    },
+
+    _extraDomainsActivated: function()
+    {
+        if (window.PageAgent)
+            PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -37,6 +37,8 @@
 
     WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
+    WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+
     // COMPATIBILITY (iOS 6): DOMStorage was discovered via a DOMStorageObserver event. Now DOM Storage
     // is added whenever a new securityOrigin is discovered. Check for DOMStorageAgent.getDOMStorageItems,
     // which was renamed at the same time the change to start using securityOrigin was made.
@@ -304,5 +306,11 @@
         }
 
         return null;
+    },
+
+    _extraDomainsActivated: function()
+    {
+        if (window.DOMStorageAgent && DOMStorageAgent.getDOMStorageItems)
+            WebInspector.Frame.addEventListener(WebInspector.Frame.Event.SecurityOriginDidChange, this._securityOriginDidChange, this);
     }
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -76,6 +76,9 @@
 
 WebInspector.CSSCompletions.requestCSSNameCompletions = function()
 {
+    if (WebInspector.CSSCompletions.cssNameCompletions)
+        return;
+
     function propertyNamesCallback(error, names)
     {
         if (error)

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorBackend.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -101,8 +101,13 @@
 
     activateDomain: function(domainName, activationDebuggableType)
     {
-        if (!activationDebuggableType || InspectorFrontendHost.debuggableType() === activationDebuggableType)
-            this._agents[domainName].activate();
+        if (!activationDebuggableType || InspectorFrontendHost.debuggableType() === activationDebuggableType) {
+            var agent = this._agents[domainName];
+            agent.activate();
+            return agent;
+        }
+
+        return null;
     },
 
     // Private

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorObserver.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -65,6 +65,11 @@
     detached: function(reason)
     {
         // FIXME: Not implemented.
+    },
+
+    activateExtraDomains: function(domains)
+    {
+        WebInspector.activateExtraDomains(domains);
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (175477 => 175478)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2014-11-03 19:19:55 UTC (rev 175477)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js	2014-11-03 19:36:14 UTC (rev 175478)
@@ -83,6 +83,8 @@
     WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, this._scriptWasAdded, this);
     WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared, this._scriptsCleared, this);
 
+    WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
+
     this._resourcesContentTreeOutline = this.contentTreeOutline;
     this._searchContentTreeOutline = this.createContentTreeOutline();
 
@@ -623,7 +625,7 @@
                 this._extensionScriptsFolderTreeElement = new WebInspector.FolderTreeElement(WebInspector.UIString("Extension Scripts"));
             var parentFolderTreeElement = this._extensionScriptsFolderTreeElement;
         } else {
-            if (WebInspector.debuggableType === WebInspector.DebuggableType._javascript_)
+            if (WebInspector.debuggableType === WebInspector.DebuggableType._javascript_ && !WebInspector.hasExtraDomains)
                 insertIntoTopLevel = true;
             else {
                 if (!this._extraScriptsFolderTreeElement)
@@ -864,6 +866,12 @@
         this._cookieStorageRootTreeElement = null;
         this._applicationCacheRootTreeElement = null;
         this._applicationCacheURLTreeElementMap = {};
+    },
+
+    _extraDomainsActivated: function()
+    {
+        if (WebInspector.debuggableType === WebInspector.DebuggableType._javascript_)
+            this._resourcesContentTreeOutline.element.classList.remove(WebInspector.NavigationSidebarPanel.HideDisclosureButtonsStyleClassName);
     }
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to