Unreviewed, rolling out r189338.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Sep 2015 04:54:09 +0000 (04:54 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Sep 2015 04:54:09 +0000 (04:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148785

Caused tons of crashes (Requested by cdumez on #webkit).

Reverted changeset:

"Web Inspector: InspectorController should support multiple
frontend channels"
https://bugs.webkit.org/show_bug.cgi?id=148538
http://trac.webkit.org/changeset/189338

Patch by Commit Queue <commit-queue@webkit.org> on 2015-09-03

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189340 268f45cc-cd09-0410-ab3c-d52691b4dbfc

50 files changed:
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp [deleted file]
Source/JavaScriptCore/inspector/InspectorFrontendRouter.h [deleted file]
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.h
Source/JavaScriptCore/inspector/agents/InspectorAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
Source/JavaScriptCore/inspector/augmentable/AugmentableInspectorController.h
Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggable.h
Source/JavaScriptCore/inspector/remote/RemoteInspectorDebuggableConnection.mm
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py
Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectDebuggable.h
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/inspector/InspectorFrontendRouter.h [deleted file]
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/inspector/InspectorClient.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/WorkerInspectorController.h
Source/WebCore/page/PageDebuggable.cpp
Source/WebCore/page/PageDebuggable.h
Source/WebCore/testing/Internals.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.h
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp

index c18a318..47e0833 100644 (file)
@@ -323,7 +323,6 @@ set(JavaScriptCore_SOURCES
     inspector/InjectedScriptManager.cpp
     inspector/InjectedScriptModule.cpp
     inspector/InspectorAgentRegistry.cpp
-    inspector/InspectorFrontendRouter.cpp
     inspector/InspectorBackendDispatcher.cpp
     inspector/InspectorValues.cpp
     inspector/JSGlobalObjectConsoleClient.cpp
index 940bf84..f68b33c 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [ES6] Instantiate Module Environment bindings and execute module
index 25390fb..4a8010a 100644 (file)
     <ClCompile Include="..\inspector\InjectedScriptModule.cpp" />
     <ClCompile Include="..\inspector\InspectorAgentRegistry.cpp" />
     <ClCompile Include="..\inspector\InspectorBackendDispatcher.cpp" />
-    <ClCompile Include="..\inspector\InspectorFrontendRouter.cpp" />
     <ClCompile Include="..\inspector\InspectorValues.cpp" />
     <ClCompile Include="..\inspector\JSInjectedScriptHost.cpp" />
     <ClCompile Include="..\inspector\JSInjectedScriptHostPrototype.cpp" />
     <ClInclude Include="..\inspector\InspectorBackendDispatcher.h" />
     <ClInclude Include="..\inspector\InspectorEnvironment.h" />
     <ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
-    <ClInclude Include="..\inspector\InspectorFrontendRouter.h" />
     <ClInclude Include="..\inspector\InspectorValues.h" />
     <ClInclude Include="..\inspector\JSInjectedScriptHost.h" />
     <ClInclude Include="..\inspector\JSInjectedScriptHostPrototype.h" />
index 9867e86..cde83e0 100644 (file)
                99E45A2618A1B2590026D88F /* EncodedValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2118A1B2590026D88F /* EncodedValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                99E45A2718A1B2590026D88F /* InputCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2218A1B2590026D88F /* InputCursor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                99E45A2818A1B2590026D88F /* NondeterministicInput.h in Headers */ = {isa = PBXBuildFile; fileRef = 99E45A2318A1B2590026D88F /* NondeterministicInput.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               99F1A6FE1B8E6D9400463B26 /* InspectorFrontendRouter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */; };
-               99F1A7011B98FBEC00463B26 /* InspectorFrontendRouter.h in Headers */ = {isa = PBXBuildFile; fileRef = 99F1A7001B98FBEC00463B26 /* InspectorFrontendRouter.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9E729407190F01A5001A91B5 /* InitializeThreading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E178636C0D9BEEC300D74E75 /* InitializeThreading.cpp */; };
                9E729408190F021E001A91B5 /* InitializeLLVMPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCEFAC51805E75500472CE4 /* InitializeLLVMPOSIX.cpp */; };
                9E72940B190F0514001A91B5 /* BundlePath.h in Headers */ = {isa = PBXBuildFile; fileRef = 9E72940A190F0514001A91B5 /* BundlePath.h */; };
                99E45A2118A1B2590026D88F /* EncodedValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncodedValue.h; sourceTree = "<group>"; };
                99E45A2218A1B2590026D88F /* InputCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InputCursor.h; sourceTree = "<group>"; };
                99E45A2318A1B2590026D88F /* NondeterministicInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NondeterministicInput.h; sourceTree = "<group>"; };
-               99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontendRouter.cpp; sourceTree = "<group>"; };
-               99F1A7001B98FBEC00463B26 /* InspectorFrontendRouter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendRouter.h; sourceTree = "<group>"; };
                9B4954E81A6640DB002815A6 /* ParserFunctionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserFunctionInfo.h; sourceTree = "<group>"; };
                9E729409190F0306001A91B5 /* BundlePath.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundlePath.mm; sourceTree = "<group>"; };
                9E72940A190F0514001A91B5 /* BundlePath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BundlePath.h; sourceTree = "<group>"; };
                A5BA15DF1823409200A82E69 /* inspector */ = {
                        isa = PBXGroup;
                        children = (
-                               99F1A7001B98FBEC00463B26 /* InspectorFrontendRouter.h */,
                                A513E5CC185FB992007E95AD /* agents */,
                                A5EA70E319F5B0E20098F5EC /* augmentable */,
                                A532438D185696CA002ED692 /* protocol */,
                                A593CF7B1840360300BFCE27 /* InspectorBackendDispatcher.h */,
                                A5D0A1BA1862301B00C7B496 /* InspectorEnvironment.h */,
                                A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */,
-                               99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */,
                                A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */,
                                A593CF801840377100BFCE27 /* InspectorValues.cpp */,
                                A593CF811840377100BFCE27 /* InspectorValues.h */,
                                A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */,
                                0F898F321B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.h in Headers */,
                                86D3B2C410156BDE002865E7 /* ARMAssembler.h in Headers */,
-                               99F1A7011B98FBEC00463B26 /* InspectorFrontendRouter.h in Headers */,
                                7964656A1B952FF0003059EE /* GetPutInfo.h in Headers */,
                                797E07AA1B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h in Headers */,
                                0FE050281AA9095600D33B33 /* ScopedArguments.h in Headers */,
                                C225494315F7DBAA0065E898 /* SlotVisitor.cpp in Sources */,
                                9330402C0E6A764000786E6A /* SmallStrings.cpp in Sources */,
                                E3EF88741B66DF23003F26CB /* JSPropertyNameIterator.cpp in Sources */,
-                               99F1A6FE1B8E6D9400463B26 /* InspectorFrontendRouter.cpp in Sources */,
                                0F8F2B9E17306C8D007DBDA5 /* SourceCode.cpp in Sources */,
                                0F493AFA16D0CAD30084508B /* SourceProvider.cpp in Sources */,
                                E33E8D1C1B9013C300346B52 /* JSNativeStdFunction.cpp in Sources */,
index 0936b41..4d45da9 100644 (file)
@@ -28,7 +28,6 @@
 #include "InspectorBackendDispatcher.h"
 
 #include "InspectorFrontendChannel.h"
-#include "InspectorFrontendRouter.h"
 #include "InspectorValues.h"
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/CString.h>
 
 namespace Inspector {
 
-SupplementalBackendDispatcher::SupplementalBackendDispatcher(BackendDispatcher& backendDispatcher)
-    : m_backendDispatcher(backendDispatcher)
-{
-}
-
-SupplementalBackendDispatcher::~SupplementalBackendDispatcher()
-{
-}
-
 BackendDispatcher::CallbackBase::CallbackBase(Ref<BackendDispatcher>&& backendDispatcher, long requestId)
     : m_backendDispatcher(WTF::move(backendDispatcher))
     , m_requestId(requestId)
@@ -79,28 +69,15 @@ void BackendDispatcher::CallbackBase::sendSuccess(RefPtr<InspectorObject>&& part
     m_backendDispatcher->sendResponse(m_requestId, WTF::move(partialMessage));
 }
 
-BackendDispatcher::BackendDispatcher(Ref<FrontendRouter>&& router)
-    : m_frontendRouter(WTF::move(router))
-{
-}
-
-Ref<BackendDispatcher> BackendDispatcher::create(Ref<FrontendRouter>&& router)
+Ref<BackendDispatcher> BackendDispatcher::create(FrontendChannel* frontendChannel)
 {
-    return adoptRef(*new BackendDispatcher(WTF::move(router)));
-}
-
-bool BackendDispatcher::isActive() const
-{
-    return m_frontendRouter->hasFrontends();
+    return adoptRef(*new BackendDispatcher(frontendChannel));
 }
 
 void BackendDispatcher::registerDispatcherForDomain(const String& domain, SupplementalBackendDispatcher* dispatcher)
 {
-    ASSERT_ARG(dispatcher, dispatcher);
-
-    // FIXME: <https://webkit.org/b/148492> Agents should only register with the backend once,
-    // and we should re-add the assertion that only one dispatcher is registered per domain.
-    m_dispatchers.set(domain, dispatcher);
+    auto result = m_dispatchers.add(domain, dispatcher);
+    ASSERT_UNUSED(result, result.isNewEntry);
 }
 
 void BackendDispatcher::dispatch(const String& message)
@@ -188,6 +165,9 @@ void BackendDispatcher::dispatch(const String& message)
 
 void BackendDispatcher::sendResponse(long requestId, RefPtr<InspectorObject>&& result)
 {
+    if (!m_frontendChannel)
+        return;
+
     ASSERT(!m_protocolErrors.size());
 
     // The JSON-RPC 2.0 specification requires that the "error" member have the value 'null'
@@ -195,7 +175,7 @@ void BackendDispatcher::sendResponse(long requestId, RefPtr<InspectorObject>&& r
     Ref<InspectorObject> responseMessage = InspectorObject::create();
     responseMessage->setObject(ASCIILiteral("result"), result);
     responseMessage->setInteger(ASCIILiteral("id"), requestId);
-    m_frontendRouter->sendResponse(responseMessage->toJSONString());
+    m_frontendChannel->sendMessageToFrontend(responseMessage->toJSONString());
 }
 
 void BackendDispatcher::sendPendingErrors()
@@ -210,6 +190,9 @@ void BackendDispatcher::sendPendingErrors()
         -32000, // ServerError
     };
 
+    if (!m_frontendChannel)
+        return;
+    
     // To construct the error object, only use the last error's code and message.
     // Per JSON-RPC 2.0, Section 5.1, the 'data' member may contain nested errors,
     // but only one top-level Error object should be sent per request.
@@ -244,7 +227,7 @@ void BackendDispatcher::sendPendingErrors()
         message->setValue(ASCIILiteral("id"), InspectorValue::null());
     }
 
-    m_frontendRouter->sendResponse(message->toJSONString());
+    m_frontendChannel->sendMessageToFrontend(message->toJSONString());
 
     m_protocolErrors.clear();
     m_currentRequestId = Nullopt;
index c61cf1d..f22482d 100644 (file)
 namespace Inspector {
 
 class BackendDispatcher;
-class FrontendRouter;
+class FrontendChannel;
 
 typedef String ErrorString;
 
 class SupplementalBackendDispatcher : public RefCounted<SupplementalBackendDispatcher> {
 public:
-    SupplementalBackendDispatcher(BackendDispatcher&);
-    virtual ~SupplementalBackendDispatcher();
+    SupplementalBackendDispatcher(BackendDispatcher& backendDispatcher)
+        : m_backendDispatcher(backendDispatcher) { }
+    virtual ~SupplementalBackendDispatcher() { }
     virtual void dispatch(long requestId, const String& method, Ref<InspectorObject>&& message) = 0;
 protected:
     Ref<BackendDispatcher> m_backendDispatcher;
@@ -50,7 +51,7 @@ protected:
 
 class BackendDispatcher : public RefCounted<BackendDispatcher> {
 public:
-    JS_EXPORT_PRIVATE static Ref<BackendDispatcher> create(Ref<FrontendRouter>&&);
+    JS_EXPORT_PRIVATE static Ref<BackendDispatcher> create(FrontendChannel*);
 
     class JS_EXPORT_PRIVATE CallbackBase : public RefCounted<CallbackBase> {
     public:
@@ -68,7 +69,8 @@ public:
         bool m_alreadySent { false };
     };
 
-    bool isActive() const;
+    void clearFrontend() { m_frontendChannel = nullptr; }
+    bool isActive() const { return !!m_frontendChannel; }
 
     bool hasProtocolErrors() const { return m_protocolErrors.size() > 0; }
 
@@ -102,9 +104,12 @@ public:
     RefPtr<InspectorArray> getArray(InspectorObject*, const String& name, bool* valueFound);
 
 private:
-    BackendDispatcher(Ref<FrontendRouter>&&);
+    BackendDispatcher(FrontendChannel* channel)
+        : m_frontendChannel(channel)
+    {
+    }
 
-    Ref<FrontendRouter> m_frontendRouter;
+    FrontendChannel* m_frontendChannel;
     HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
 
     // Protocol errors reported for the top-level request being processed.
diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.cpp
deleted file mode 100644 (file)
index 287a678..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "InspectorFrontendRouter.h"
-
-#include "InspectorFrontendChannel.h"
-#include <wtf/Assertions.h>
-
-namespace Inspector {
-
-Ref<FrontendRouter> FrontendRouter::create()
-{
-    return adoptRef(*new FrontendRouter);
-}
-
-void FrontendRouter::connectFrontend(FrontendChannel* connection)
-{
-    ASSERT_ARG(connection, connection);
-
-    if (m_connections.contains(connection)) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    m_connections.append(connection);
-}
-
-void FrontendRouter::disconnectFrontend(FrontendChannel* connection)
-{
-    ASSERT_ARG(connection, connection);
-
-    if (!m_connections.contains(connection)) {
-        ASSERT_NOT_REACHED();
-        return;
-    }
-
-    m_connections.removeFirst(connection);
-}
-
-void FrontendRouter::disconnectAllFrontends()
-{
-    m_connections.clear();
-}
-
-// FIXME: <https://webkit.org/b/148492> remove this method once agents move to using FrontendRouter directly.
-FrontendChannel* FrontendRouter::leakChannel() const
-{
-    if (m_connections.size())
-        return m_connections.at(0);
-
-    return nullptr;
-}
-
-bool FrontendRouter::hasLocalFrontend() const
-{
-    for (auto* connection : m_connections) {
-        if (connection->connectionType() == FrontendChannel::ConnectionType::Local)
-            return true;
-    }
-
-    return false;
-}
-
-bool FrontendRouter::hasRemoteFrontend() const
-{
-    for (auto* connection : m_connections) {
-        if (connection->connectionType() == FrontendChannel::ConnectionType::Remote)
-            return true;
-    }
-
-    return false;
-}
-
-void FrontendRouter::sendEvent(const String& message) const
-{
-    for (auto* connection : m_connections)
-        connection->sendMessageToFrontend(message);
-}
-
-void FrontendRouter::sendResponse(const String& message) const
-{
-    // FIXME: send responses to the appropriate frontend.
-    for (auto* connection : m_connections)
-        connection->sendMessageToFrontend(message);
-}
-
-} // namespace Inspector
diff --git a/Source/JavaScriptCore/inspector/InspectorFrontendRouter.h b/Source/JavaScriptCore/inspector/InspectorFrontendRouter.h
deleted file mode 100644 (file)
index 4a6411b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef InspectorFrontendRouter_h
-#define InspectorFrontendRouter_h
-
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
-
-namespace Inspector {
-
-class FrontendChannel;
-
-class JS_EXPORT_PRIVATE FrontendRouter : public RefCounted<FrontendRouter> {
-public:
-    static Ref<FrontendRouter> create();
-
-    bool hasFrontends() const { return !m_connections.isEmpty(); }
-    bool hasLocalFrontend() const;
-    bool hasRemoteFrontend() const;
-
-    void connectFrontend(FrontendChannel*);
-    void disconnectFrontend(FrontendChannel*);
-    void disconnectAllFrontends();
-
-    // FIXME: <https://webkit.org/b/148492> remove this method once agents move to using FrontendRouter directly.
-    FrontendChannel* leakChannel() const;
-
-    void sendEvent(const String& message) const;
-    void sendResponse(const String& message) const;
-
-private:
-    Vector<FrontendChannel*, 2> m_connections;
-};
-
-} // namespace Inspector
-
-#endif // !defined(InspectorFrontendRouter_h)
index 3350fc0..143d7f1 100644 (file)
@@ -35,7 +35,6 @@
 #include "InspectorAgent.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorFrontendChannel.h"
-#include "InspectorFrontendRouter.h"
 #include "JSGlobalObject.h"
 #include "JSGlobalObjectConsoleAgent.h"
 #include "JSGlobalObjectConsoleClient.h"
@@ -64,8 +63,7 @@ namespace Inspector {
 JSGlobalObjectInspectorController::JSGlobalObjectInspectorController(JSGlobalObject& globalObject)
     : m_globalObject(globalObject)
     , m_injectedScriptManager(std::make_unique<InjectedScriptManager>(*this, InjectedScriptHost::create()))
-    , m_frontendRouter(FrontendRouter::create())
-    , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
+    , m_frontendChannel(nullptr)
     , m_executionStopwatch(Stopwatch::create())
     , m_includeNativeCallStackWithExceptions(true)
     , m_isAutomaticInspection(false)
@@ -100,24 +98,22 @@ JSGlobalObjectInspectorController::~JSGlobalObjectInspectorController()
 
 void JSGlobalObjectInspectorController::globalObjectDestroyed()
 {
-    disconnectAllFrontends();
+    disconnectFrontend(DisconnectReason::InspectedTargetDestroyed);
 
     m_injectedScriptManager->disconnect();
 }
 
 void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* frontendChannel, bool isAutomaticInspection)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
+    ASSERT(!m_frontendChannel);
+    ASSERT(!m_backendDispatcher);
 
     m_isAutomaticInspection = isAutomaticInspection;
 
-    bool connectedFirstFrontend = !m_frontendRouter->hasFrontends();
-    m_frontendRouter->connectFrontend(frontendChannel);
+    m_frontendChannel = frontendChannel;
+    m_backendDispatcher = BackendDispatcher::create(frontendChannel);
 
-    if (!connectedFirstFrontend)
-        return;
-
-    m_agents.didCreateFrontendAndBackend(frontendChannel, &m_backendDispatcher.get());
+    m_agents.didCreateFrontendAndBackend(frontendChannel, m_backendDispatcher.get());
 
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
     m_inspectorAgent->activateExtraDomains(m_agents.extraDomains());
@@ -127,31 +123,16 @@ void JSGlobalObjectInspectorController::connectFrontend(FrontendChannel* fronten
 #endif
 }
 
-void JSGlobalObjectInspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+void JSGlobalObjectInspectorController::disconnectFrontend(DisconnectReason reason)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
-
-    m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
-
-    m_frontendRouter->disconnectFrontend(frontendChannel);
-
-    m_isAutomaticInspection = false;
-
-    bool disconnectedLastFrontend = !m_frontendRouter->hasFrontends();
-    if (!disconnectedLastFrontend)
+    if (!m_frontendChannel)
         return;
 
-#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
-    if (m_augmentingClient)
-        m_augmentingClient->inspectorDisconnected();
-#endif
-}
-
-void JSGlobalObjectInspectorController::disconnectAllFrontends()
-{
-    m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectedTargetDestroyed);
+    m_agents.willDestroyFrontendAndBackend(reason);
 
-    m_frontendRouter->disconnectAllFrontends();
+    m_backendDispatcher->clearFrontend();
+    m_backendDispatcher = nullptr;
+    m_frontendChannel = nullptr;
 
     m_isAutomaticInspection = false;
 
@@ -163,11 +144,15 @@ void JSGlobalObjectInspectorController::disconnectAllFrontends()
 
 void JSGlobalObjectInspectorController::dispatchMessageFromFrontend(const String& message)
 {
-    m_backendDispatcher->dispatch(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);
@@ -277,11 +262,13 @@ void JSGlobalObjectInspectorController::appendExtraAgent(std::unique_ptr<Inspect
 {
     String domainName = agent->domainName();
 
-    agent->didCreateFrontendAndBackend(m_frontendRouter->leakChannel(), &m_backendDispatcher.get());
+    if (m_frontendChannel)
+        agent->didCreateFrontendAndBackend(m_frontendChannel, m_backendDispatcher.get());
 
     m_agents.appendExtraAgent(WTF::move(agent));
 
-    m_inspectorAgent->activateExtraDomain(domainName);
+    if (m_frontendChannel)
+        m_inspectorAgent->activateExtraDomain(domainName);
 }
 #endif
 
index aae32e3..6e3f94e 100644 (file)
@@ -53,7 +53,6 @@ namespace Inspector {
 
 class BackendDispatcher;
 class FrontendChannel;
-class FrontendRouter;
 class InjectedScriptManager;
 class InspectorAgent;
 class InspectorConsoleAgent;
@@ -74,9 +73,7 @@ public:
     ~JSGlobalObjectInspectorController();
 
     void connectFrontend(FrontendChannel*, bool isAutomaticInspection);
-    void disconnectFrontend(FrontendChannel*);
-    void disconnectAllFrontends();
-
+    void disconnectFrontend(DisconnectReason);
     void dispatchMessageFromFrontend(const String&);
 
     void globalObjectDestroyed();
@@ -102,7 +99,7 @@ public:
     virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const override { return m_augmentingClient; } 
     virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient* client) override { m_augmentingClient = client; }
 
-    virtual const FrontendRouter& frontendRouter() const override { return m_frontendRouter.get(); }
+    virtual FrontendChannel* frontendChannel() const override { return m_frontendChannel; }
     virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) override;
 #endif
 
@@ -116,8 +113,8 @@ private:
     InspectorConsoleAgent* m_consoleAgent;
     InspectorDebuggerAgent* m_debuggerAgent;
     AgentRegistry m_agents;
-    Ref<FrontendRouter> m_frontendRouter;
-    Ref<BackendDispatcher> m_backendDispatcher;
+    FrontendChannel* m_frontendChannel;
+    RefPtr<BackendDispatcher> m_backendDispatcher;
     Ref<WTF::Stopwatch> m_executionStopwatch;
     bool m_includeNativeCallStackWithExceptions;
     bool m_isAutomaticInspection;
index 86224ba..7b2f3cf 100644 (file)
@@ -32,7 +32,6 @@
 #include "InspectorAgent.h"
 
 #include "InspectorEnvironment.h"
-#include "InspectorFrontendRouter.h"
 #include "InspectorValues.h"
 #include "ScriptValue.h"
 
index 1f1d9b1..88d8151 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "ConsoleMessage.h"
 #include "InjectedScriptManager.h"
-#include "InspectorFrontendRouter.h"
 #include "ScriptArguments.h"
 #include "ScriptCallFrame.h"
 #include "ScriptCallStack.h"
index acac170..c2f63ce 100644 (file)
@@ -33,7 +33,6 @@
 #include "ContentSearchUtilities.h"
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
-#include "InspectorFrontendRouter.h"
 #include "InspectorValues.h"
 #include "RegularExpression.h"
 #include "ScriptDebugServer.h"
index addfebc..32104a2 100644 (file)
@@ -37,7 +37,6 @@
 #include "HeapIterationScope.h"
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
-#include "InspectorFrontendRouter.h"
 #include "InspectorValues.h"
 #include "JSLock.h"
 #include "ParserError.h"
index b0d25b0..2456ac5 100644 (file)
@@ -29,7 +29,7 @@
 #if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
 
 #include <JavaScriptCore/AugmentableInspectorControllerClient.h>
-#include <JavaScriptCore/InspectorFrontendRouter.h>
+#include <JavaScriptCore/InspectorFrontendChannel.h>
 
 namespace Inspector {
 
@@ -42,10 +42,10 @@ public:
     virtual AugmentableInspectorControllerClient* augmentableInspectorControllerClient() const = 0;
     virtual void setAugmentableInspectorControllerClient(AugmentableInspectorControllerClient*) = 0;
 
-    virtual const FrontendRouter& frontendRouter() const = 0;
+    virtual FrontendChannel* frontendChannel() const = 0;
     virtual void appendExtraAgent(std::unique_ptr<InspectorAgentBase>) = 0;
 
-    bool connected() const { return frontendRouter().hasFrontends(); }
+    bool connected() const { return !!frontendChannel(); }
 };
 
 } // namespace Inspector
index da24299..064b83a 100644 (file)
@@ -64,7 +64,7 @@ public:
     virtual bool hasLocalDebugger() const = 0;
 
     virtual void connect(FrontendChannel*, bool isAutomaticInspection) = 0;
-    virtual void disconnect(FrontendChannel*) = 0;
+    virtual void disconnect() = 0;
     virtual void dispatchMessageFromRemoteFrontend(const String& message) = 0;
     virtual void setIndicating(bool) { } // Default is to do nothing.
     virtual void pause() { };
index ed6cd60..bedaad7 100644 (file)
@@ -191,7 +191,7 @@ void RemoteInspectorDebuggableConnection::close()
 
             if (m_debuggable) {
                 if (m_connected)
-                    m_debuggable->disconnect(this);
+                    m_debuggable->disconnect();
 
                 m_debuggable = nullptr;
             }
index 375ce05..d4a8d5a 100755 (executable)
@@ -47,7 +47,6 @@ class CppAlternateBackendDispatcherHeaderGenerator(Generator):
     def generate_output(self):
         headers = [
             '"InspectorProtocolTypes.h"',
-            '<inspector/InspectorFrontendRouter.h>',
             '<JavaScriptCore/InspectorBackendDispatcher.h>',
         ]
 
index b36c0b1..1251149 100755 (executable)
@@ -50,7 +50,6 @@ class CppBackendDispatcherImplementationGenerator(Generator):
     def generate_output(self):
         secondary_headers = [
             '<inspector/InspectorFrontendChannel.h>',
-            '<inspector/InspectorFrontendRouter.h>',
             '<inspector/InspectorValues.h>',
             '<wtf/NeverDestroyed.h>',
             '<wtf/text/CString.h>']
index 94018e5..fb2de4f 100755 (executable)
@@ -98,7 +98,9 @@ class ObjCFrontendDispatcherImplementationGenerator(Generator):
         lines = []
         lines.append(self._generate_event_signature(domain, event))
         lines.append('{')
-        lines.append('    const FrontendRouter& router = _controller->frontendRouter();')
+        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)
@@ -124,7 +126,7 @@ class ObjCFrontendDispatcherImplementationGenerator(Generator):
         lines.append('    jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("%s.%s"));' % (domain.domain_name, event.event_name))
         if event.event_parameters:
             lines.extend(self._generate_event_out_parameters(domain, event))
-        lines.append('    router.sendEvent(jsonMessage->toJSONString());')
+        lines.append('    frontendChannel->sendMessageToFrontend(jsonMessage->toJSONString());')
         lines.append('}')
         return '\n'.join(lines)
 
index 2aea203..eecc5ba 100644 (file)
@@ -56,11 +56,11 @@ void JSGlobalObjectDebuggable::connect(FrontendChannel* frontendChannel, bool au
     m_globalObject.inspectorController().connectFrontend(frontendChannel, automaticInspection);
 }
 
-void JSGlobalObjectDebuggable::disconnect(FrontendChannel* frontendChannel)
+void JSGlobalObjectDebuggable::disconnect()
 {
     JSLockHolder locker(&m_globalObject.vm());
 
-    m_globalObject.inspectorController().disconnectFrontend(frontendChannel);
+    m_globalObject.inspectorController().disconnectFrontend(DisconnectReason::InspectorDestroyed);
 }
 
 void JSGlobalObjectDebuggable::pause()
index 03fd17d..60ce58a 100644 (file)
@@ -54,7 +54,7 @@ public:
     virtual bool hasLocalDebugger() const override { return false; }
 
     virtual void connect(Inspector::FrontendChannel*, bool automaticInspection) override;
-    virtual void disconnect(Inspector::FrontendChannel*) override;
+    virtual void disconnect() override;
     virtual void dispatchMessageFromRemoteFrontend(const String& message) override;
     virtual void pause() override;
 
index cba0cd6..7dcbde0 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: InspectorController should support multiple frontend channels
diff --git a/Source/WebCore/ForwardingHeaders/inspector/InspectorFrontendRouter.h b/Source/WebCore/ForwardingHeaders/inspector/InspectorFrontendRouter.h
deleted file mode 100644 (file)
index 4a9b6a7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef WebCore_FWD_InspectorFrontendRouter_h
-#define WebCore_FWD_InspectorFrontendRouter_h
-#include <JavaScriptCore/InspectorFrontendRouter.h>
-#endif
index c45ac1f..066c3ae 100644 (file)
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorBackendDispatcher.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorEnvironment.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorFrontendChannel.h" />
-    <ClInclude Include="..\ForwardingHeaders\inspector\InspectorFrontendRouter.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorBackendDispatchers.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorFrontendDispatchers.h" />
     <ClInclude Include="..\ForwardingHeaders\inspector\InspectorProtocolObjects.h" />
index 6d39a4c..ee7d8fa 100644 (file)
 #ifndef InspectorClient_h
 #define InspectorClient_h
 
+#include "InspectorForwarding.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 
-namespace Inspector {
-class FrontendChannel;
-}
-
 namespace WebCore {
 
 class FloatRect;
@@ -48,7 +45,7 @@ public:
 
     virtual void inspectorDestroyed() = 0;
 
-    virtual Inspector::FrontendChannel* openInspectorFrontend(InspectorController*) = 0;
+    virtual InspectorFrontendChannel* openInspectorFrontend(InspectorController*) = 0;
     virtual void closeInspectorFrontend() = 0;
     virtual void bringFrontendToFront() = 0;
     virtual void didResizeMainFrame(Frame*) { }
index 8a7df20..277f16b 100644 (file)
@@ -68,7 +68,6 @@
 #include <inspector/InspectorBackendDispatcher.h>
 #include <inspector/InspectorBackendDispatchers.h>
 #include <inspector/InspectorFrontendDispatchers.h>
-#include <inspector/InspectorFrontendRouter.h>
 #include <inspector/agents/InspectorAgent.h>
 #include <profiler/LegacyProfiler.h>
 #include <runtime/JSLock.h>
@@ -86,8 +85,6 @@ namespace WebCore {
 InspectorController::InspectorController(Page& page, InspectorClient* inspectorClient)
     : m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create()))
-    , m_frontendRouter(FrontendRouter::create())
-    , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
     , m_overlay(std::make_unique<InspectorOverlay>(page, inspectorClient))
     , m_executionStopwatch(Stopwatch::create())
     , m_page(page)
@@ -180,8 +177,7 @@ InspectorController::~InspectorController()
 
 void InspectorController::inspectedPageDestroyed()
 {
-    disconnectAllFrontends();
-
+    disconnectFrontend(DisconnectReason::InspectedTargetDestroyed);
     m_injectedScriptManager->disconnect();
     m_inspectorClient->inspectorDestroyed();
     m_inspectorClient = nullptr;
@@ -194,12 +190,12 @@ void InspectorController::setInspectorFrontendClient(InspectorFrontendClient* in
 
 bool InspectorController::hasLocalFrontend() const
 {
-    return m_frontendRouter->hasLocalFrontend();
+    return m_frontendChannel && m_frontendChannel->connectionType() == FrontendChannel::ConnectionType::Local;
 }
 
 bool InspectorController::hasRemoteFrontend() const
 {
-    return m_frontendRouter->hasRemoteFrontend();
+    return m_frontendChannel && m_frontendChannel->connectionType() == FrontendChannel::ConnectionType::Remote;
 }
 
 bool InspectorController::hasInspectorFrontendClient() const
@@ -223,96 +219,74 @@ void InspectorController::didClearWindowObjectInWorld(Frame& frame, DOMWrapperWo
 
 void InspectorController::connectFrontend(Inspector::FrontendChannel* frontendChannel, bool isAutomaticInspection)
 {
-    ASSERT_ARG(frontendChannel, frontendChannel);
+    ASSERT(frontendChannel);
     ASSERT(m_inspectorClient);
+    ASSERT(!m_frontendChannel);
+    ASSERT(!m_backendDispatcher);
 
-    bool connectedFirstFrontend = !m_frontendRouter->hasFrontends();
     m_isAutomaticInspection = isAutomaticInspection;
 
-    m_frontendRouter->connectFrontend(frontendChannel);
+    m_frontendChannel = frontendChannel;
+    m_backendDispatcher = BackendDispatcher::create(frontendChannel);
 
-    InspectorInstrumentation::frontendCreated();
+    m_agents.didCreateFrontendAndBackend(frontendChannel, m_backendDispatcher.get());
 
-    if (connectedFirstFrontend) {
-        InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get());
-        m_agents.didCreateFrontendAndBackend(frontendChannel, &m_backendDispatcher.get());
-    }
+    InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get());
+    InspectorInstrumentation::frontendCreated();
 
 #if ENABLE(REMOTE_INSPECTOR)
-    if (!m_frontendRouter->hasRemoteFrontend())
+    if (!hasRemoteFrontend())
         m_page.remoteInspectorInformationDidChange();
 #endif
 }
 
-void InspectorController::disconnectFrontend(FrontendChannel* frontendChannel)
+void InspectorController::disconnectFrontend(DisconnectReason reason)
 {
-    // The local frontend client should be disconnected first so it stops sending messages.
-    ASSERT(!m_frontendRouter->hasLocalFrontend() || !m_inspectorFrontendClient);
-
-    m_frontendRouter->disconnectFrontend(frontendChannel);
-    m_isAutomaticInspection = false;
-
-    InspectorInstrumentation::frontendDeleted();
-
-    bool disconnectedLastFrontend = !m_frontendRouter->hasFrontends();
-    if (disconnectedLastFrontend) {
-        // Release overlay page resources.
-        m_overlay->freePage();
-        m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectorDestroyed);
-        InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get());
-    }
+    if (!m_frontendChannel)
+        return;
 
 #if ENABLE(REMOTE_INSPECTOR)
-    if (!m_frontendRouter->hasFrontends())
+    if (!hasRemoteFrontend())
         m_page.remoteInspectorInformationDidChange();
 #endif
-}
 
-void InspectorController::disconnectAllFrontends()
-{
-    // The local frontend client should be disconnected first so it stops sending messages.
-    ASSERT(!m_frontendRouter->hasLocalFrontend() || !m_inspectorFrontendClient);
+    m_agents.willDestroyFrontendAndBackend(reason);
 
-    m_agents.willDestroyFrontendAndBackend(DisconnectReason::InspectedTargetDestroyed);
+    m_backendDispatcher->clearFrontend();
+    m_backendDispatcher = nullptr;
+    m_frontendChannel = nullptr;
 
-    m_frontendRouter->disconnectAllFrontends();
     m_isAutomaticInspection = false;
 
     // Release overlay page resources.
     m_overlay->freePage();
-
-    while (InspectorInstrumentation::hasFrontends())
-        InspectorInstrumentation::frontendDeleted();
-
+    InspectorInstrumentation::frontendDeleted();
     InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get());
-    
-#if ENABLE(REMOTE_INSPECTOR)
-    m_page.remoteInspectorInformationDidChange();
-#endif
 }
 
 void InspectorController::show()
 {
-    ASSERT(!m_frontendRouter->hasRemoteFrontend());
-
-    // The local frontend client should be disconnected if there's no local frontend.
-    ASSERT(m_frontendRouter->hasLocalFrontend() || !m_inspectorFrontendClient);
+    ASSERT(!hasRemoteFrontend());
 
     if (!enabled())
         return;
 
-    if (m_frontendRouter->hasLocalFrontend())
+    if (m_frontendChannel)
         m_inspectorClient->bringFrontendToFront();
-    else if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openInspectorFrontend(this))
-        connectFrontend(frontendChannel);
+    else {
+        if (Inspector::FrontendChannel* frontendChannel = m_inspectorClient->openInspectorFrontend(this)) {
+            bool isAutomaticInspection = false;
+            connectFrontend(frontendChannel, isAutomaticInspection);
+        }
+    }
 }
 
 void InspectorController::close()
 {
-    if (m_frontendRouter->hasLocalFrontend())
-        m_inspectorClient->closeInspectorFrontend();
-
-    ASSERT(!m_frontendRouter->hasLocalFrontend());
+    if (!m_frontendChannel)
+        return;
+    disconnectFrontend(DisconnectReason::InspectorDestroyed);
+    m_inspectorClient->closeInspectorFrontend();
 }
 
 void InspectorController::setProcessId(long processId)
@@ -363,7 +337,8 @@ Page& InspectorController::inspectedPage() const
 
 void InspectorController::dispatchMessageFromFrontend(const String& message)
 {
-    m_backendDispatcher->dispatch(message);
+    if (m_backendDispatcher)
+        m_backendDispatcher->dispatch(message);
 }
 
 void InspectorController::hideHighlight()
index 6e15ced..dfb7e85 100644 (file)
@@ -45,7 +45,6 @@
 namespace Inspector {
 class BackendDispatcher;
 class FrontendChannel;
-class FrontendRouter;
 class InspectorAgent;
 class InspectorObject;
 
@@ -99,9 +98,8 @@ public:
     bool hasLocalFrontend() const;
     bool hasRemoteFrontend() const;
 
-    WEBCORE_EXPORT void connectFrontend(Inspector::FrontendChannel*, bool isAutomaticInspection = false);
-    WEBCORE_EXPORT void disconnectFrontend(Inspector::FrontendChannel*);
-    WEBCORE_EXPORT void disconnectAllFrontends();
+    WEBCORE_EXPORT void connectFrontend(Inspector::FrontendChannel*, bool isAutomaticInspection);
+    WEBCORE_EXPORT void disconnectFrontend(Inspector::DisconnectReason);
     void setProcessId(long);
 
     void inspect(Node*);
@@ -142,8 +140,8 @@ private:
 
     Ref<InstrumentingAgents> m_instrumentingAgents;
     std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
-    Ref<Inspector::FrontendRouter> m_frontendRouter;
-    Ref<Inspector::BackendDispatcher> m_backendDispatcher;
+    RefPtr<Inspector::BackendDispatcher> m_backendDispatcher;
+    Inspector::FrontendChannel* m_frontendChannel { nullptr };
     std::unique_ptr<InspectorOverlay> m_overlay;
     Ref<WTF::Stopwatch> m_executionStopwatch;
     Inspector::AgentRegistry m_agents;
index c7f6a6e..cc473d7 100644 (file)
@@ -44,7 +44,6 @@
 #include "SQLTransactionErrorCallback.h"
 #include "SQLValue.h"
 #include "VoidCallback.h"
-#include <inspector/InspectorFrontendRouter.h>
 #include <inspector/InspectorValues.h>
 #include <wtf/Vector.h>
 
index a3eabb7..ef3b185 100644 (file)
@@ -64,7 +64,6 @@
 #include <inspector/InjectedScript.h>
 #include <inspector/InjectedScriptManager.h>
 #include <inspector/InspectorFrontendDispatchers.h>
-#include <inspector/InspectorFrontendRouter.h>
 #include <inspector/InspectorValues.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/Vector.h>
index 1432ef0..8579199 100644 (file)
@@ -62,7 +62,6 @@
 #include "URL.h"
 #include "WebSocketFrame.h"
 #include <inspector/IdentifiersFactory.h>
-#include <inspector/InspectorFrontendRouter.h>
 #include <inspector/InspectorValues.h>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
index 8a22d5c..22b087e 100644 (file)
@@ -48,7 +48,6 @@
 #include "WorkerThread.h"
 #include <inspector/InspectorBackendDispatcher.h>
 #include <inspector/InspectorFrontendDispatchers.h>
-#include <inspector/InspectorFrontendRouter.h>
 #include <wtf/Stopwatch.h>
 
 using namespace Inspector;
@@ -81,8 +80,6 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope& workerGl
     , m_instrumentingAgents(InstrumentingAgents::create(*this))
     , m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create()))
     , m_executionStopwatch(Stopwatch::create())
-    , m_frontendRouter(FrontendRouter::create())
-    , m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
 {
     auto runtimeAgent = std::make_unique<WorkerRuntimeAgent>(*m_injectedScriptManager, &workerGlobalScope);
     m_runtimeAgent = runtimeAgent.get();
@@ -117,27 +114,27 @@ WorkerInspectorController::~WorkerInspectorController()
 
 void WorkerInspectorController::connectFrontend()
 {
-    ASSERT(!m_frontendRouter->hasFrontends());
-    ASSERT(!m_forwardingChannel);
-
-    m_forwardingChannel = std::make_unique<PageInspectorProxy>(m_workerGlobalScope);
-    m_frontendRouter->connectFrontend(m_forwardingChannel.get());
-    m_agents.didCreateFrontendAndBackend(m_forwardingChannel.get(), &m_backendDispatcher.get());
+    ASSERT(!m_frontendChannel);
+    m_frontendChannel = std::make_unique<PageInspectorProxy>(m_workerGlobalScope);
+    m_backendDispatcher = BackendDispatcher::create(m_frontendChannel.get());
+    m_agents.didCreateFrontendAndBackend(m_frontendChannel.get(), m_backendDispatcher.get());
 }
 
 void WorkerInspectorController::disconnectFrontend(Inspector::DisconnectReason reason)
 {
-    ASSERT(m_frontendRouter->hasFrontends());
-    ASSERT(m_forwardingChannel);
+    if (!m_frontendChannel)
+        return;
 
     m_agents.willDestroyFrontendAndBackend(reason);
-    m_frontendRouter->disconnectFrontend(m_forwardingChannel.get());
-    m_forwardingChannel = nullptr;
+    m_backendDispatcher->clearFrontend();
+    m_backendDispatcher = nullptr;
+    m_frontendChannel = nullptr;
 }
 
 void WorkerInspectorController::dispatchMessageFromFrontend(const String& message)
 {
-    m_backendDispatcher->dispatch(message);
+    if (m_backendDispatcher)
+        m_backendDispatcher->dispatch(message);
 }
 
 void WorkerInspectorController::resume()
index 5bde1e1..de81480 100644 (file)
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 
-namespace Inspector {
-class FrontendRouter;
-};
-
 namespace WebCore {
 
 class InspectorInstrumentation;
@@ -82,10 +78,9 @@ private:
     std::unique_ptr<WebInjectedScriptManager> m_injectedScriptManager;
     WorkerRuntimeAgent* m_runtimeAgent { nullptr };
     Inspector::AgentRegistry m_agents;
-    std::unique_ptr<Inspector::FrontendChannel> m_forwardingChannel;
+    std::unique_ptr<Inspector::FrontendChannel> m_frontendChannel;
     Ref<WTF::Stopwatch> m_executionStopwatch;
-    Ref<Inspector::FrontendRouter> m_frontendRouter;
-    Ref<Inspector::BackendDispatcher> m_backendDispatcher;
+    RefPtr<Inspector::BackendDispatcher> m_backendDispatcher;
     Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
 };
 
index 24983be..fe7b294 100644 (file)
@@ -80,10 +80,10 @@ void PageDebuggable::connect(Inspector::FrontendChannel* channel, bool isAutomat
     inspectorController.connectFrontend(channel, isAutomaticInspection);
 }
 
-void PageDebuggable::disconnect(Inspector::FrontendChannel* channel)
+void PageDebuggable::disconnect()
 {
     InspectorController& inspectorController = m_page.inspectorController();
-    inspectorController.disconnectFrontend(channel);
+    inspectorController.disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
 
     if (m_forcedDeveloperExtrasEnabled) {
         m_forcedDeveloperExtrasEnabled = false;
index b29094f..6aefcc3 100644 (file)
@@ -49,7 +49,7 @@ public:
     virtual bool hasLocalDebugger() const override;
 
     virtual void connect(Inspector::FrontendChannel*, bool isAutomaticInspection) override;
-    virtual void disconnect(Inspector::FrontendChannel*) override;
+    virtual void disconnect() override;
     virtual void dispatchMessageFromRemoteFrontend(const String& message) override;
     virtual void setIndicating(bool) override;
 
index 0ef7cf7..31bf517 100644 (file)
@@ -1734,8 +1734,9 @@ PassRefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
     m_frontendClient = std::make_unique<InspectorFrontendClientDummy>(&page->inspectorController(), frontendPage);
     frontendPage->inspectorController().setInspectorFrontendClient(m_frontendClient.get());
 
+    bool isAutomaticInspection = false;
     m_frontendChannel = std::make_unique<InspectorFrontendChannelDummy>(frontendPage);
-    page->inspectorController().connectFrontend(m_frontendChannel.get());
+    page->inspectorController().connectFrontend(m_frontendChannel.get(), isAutomaticInspection);
 
     return m_frontendWindow;
 }
@@ -1746,13 +1747,9 @@ void Internals::closeDummyInspectorFrontend()
     ASSERT(page);
     ASSERT(m_frontendWindow);
 
-    Page* frontendPage = m_frontendWindow->document()->page();
-    ASSERT(frontendPage);
+    page->inspectorController().disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
 
-    frontendPage->inspectorController().setInspectorFrontendClient(nullptr);
     m_frontendClient = nullptr;
-
-    page->inspectorController().disconnectFrontend(m_frontendChannel.get());
     m_frontendChannel = nullptr;
 
     m_frontendWindow->close(m_frontendWindow->scriptExecutionContext());
index 91dee99..81fb2b2 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: InspectorController should support multiple frontend channels
index 01b4bc9..c50dbb7 100644 (file)
@@ -124,7 +124,7 @@ public:
 
     virtual void bringToFront() override;
     virtual void closeWindow() override;
-    void disconnectFromBackend();
+    virtual void disconnectFromBackend();
 
     virtual void attachWindow(DockSide) override;
     virtual void detachWindow() override;
index 6e5456b..806003a 100644 (file)
@@ -87,7 +87,7 @@ static const CGFloat initialWindowHeight = 650;
 - (WebInspectorClient*)inspectorClient;
 - (void)setAttachedWindowHeight:(unsigned)height;
 - (void)setDockingUnavailable:(BOOL)unavailable;
-- (void)destroyInspectorView;
+- (void)destroyInspectorView:(bool)notifyInspectorController;
 @end
 
 
@@ -130,7 +130,6 @@ void WebInspectorClient::closeInspectorFrontend()
 
 void WebInspectorClient::bringFrontendToFront()
 {
-    ASSERT(m_frontendClient);
     m_frontendClient->bringToFront();
 }
 
@@ -253,12 +252,12 @@ void WebInspectorFrontendClient::bringToFront()
 
 void WebInspectorFrontendClient::closeWindow()
 {
-    [m_windowController.get() destroyInspectorView];
+    [m_windowController.get() destroyInspectorView:true];
 }
 
 void WebInspectorFrontendClient::disconnectFromBackend()
 {
-    [m_windowController.get() destroyInspectorView];
+    [m_windowController.get() destroyInspectorView:false];
 }
 
 void WebInspectorFrontendClient::attachWindow(DockSide)
@@ -523,7 +522,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
 
 - (BOOL)windowShouldClose:(id)sender
 {
-    [self destroyInspectorView];
+    [self destroyInspectorView:true];
 
     return YES;
 }
@@ -677,7 +676,7 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
     // Do nothing.
 }
 
-- (void)destroyInspectorView
+- (void)destroyInspectorView:(bool)notifyInspectorController
 {
     RetainPtr<WebInspectorWindowController> protect(self);
 
@@ -693,9 +692,9 @@ void WebInspectorFrontendClient::append(const String& suggestedURL, const String
 
     _visible = NO;
 
-    if (Page* inspectedPage = [_inspectedWebView.get() page]) {
-        inspectedPage->inspectorController().setInspectorFrontendClient(nullptr);
-        inspectedPage->inspectorController().disconnectFrontend(_inspectorClient);
+    if (notifyInspectorController) {
+        if (Page* inspectedPage = [_inspectedWebView.get() page])
+            inspectedPage->inspectorController().disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
     }
 
     [_webView close];
index 366d61d..4c60ae2 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: InspectorController should support multiple frontend channels
index f845e25..45d4ab0 100644 (file)
@@ -174,7 +174,7 @@ WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(Ins
 void WebInspectorClient::closeInspectorFrontend()
 {
     if (m_frontendClient)
-        m_frontendClient->destroyInspectorView();
+        m_frontendClient->destroyInspectorView(false);
 }
 
 void WebInspectorClient::bringFrontendToFront()
@@ -237,7 +237,7 @@ WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView
 
 WebInspectorFrontendClient::~WebInspectorFrontendClient()
 {
-    destroyInspectorView();
+    destroyInspectorView(true);
 }
 
 void WebInspectorFrontendClient::frontendLoaded()
@@ -269,7 +269,7 @@ void WebInspectorFrontendClient::bringToFront()
 
 void WebInspectorFrontendClient::closeWindow()
 {
-    destroyInspectorView();
+    destroyInspectorView(true);
 }
 
 void WebInspectorFrontendClient::attachWindow(DockSide)
@@ -421,7 +421,7 @@ void WebInspectorFrontendClient::showWindowWithoutNotifications()
     m_inspectorClient->updateHighlight();
 }
 
-void WebInspectorFrontendClient::destroyInspectorView()
+void WebInspectorFrontendClient::destroyInspectorView(bool notifyInspectorController)
 {
     m_inspectorClient->releaseFrontend();
 
@@ -431,10 +431,10 @@ void WebInspectorFrontendClient::destroyInspectorView()
 
     closeWindowWithoutNotifications();
 
-    m_inspectedWebView->page()->inspectorController().setInspectorFrontendClient(nullptr);
-    m_inspectedWebView->page()->inspectorController().disconnectFrontend(m_inspectorClient);
-    m_inspectorClient->updateHighlight();
-
+    if (notifyInspectorController) {
+        m_inspectedWebView->page()->inspectorController().disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
+        m_inspectorClient->updateHighlight();
+    }
     ::DestroyWindow(m_frontendHwnd);
 }
 
index 9568da0..9fb386e 100644 (file)
@@ -113,7 +113,7 @@ public:
 
     virtual void inspectedURLChanged(const WTF::String& newURL);
 
-    void destroyInspectorView();
+    void destroyInspectorView(bool notifyInspectorController);
 
 private:
     void closeWindowWithoutNotifications();
index 888a82c..1bf955f 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: InspectorController should support multiple frontend channels
index 66e9bc7..5a7f170 100644 (file)
@@ -82,19 +82,17 @@ void WebInspectorClient::inspectorDestroyed()
     delete this;
 }
 
-Inspector::FrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* controller)
+WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* controller)
 {
-    m_page->inspector()->openFrontendConnection(controller->isUnderTest());
+    m_page->inspector()->createInspectorPage(controller->isUnderTest());
 
     return m_page->inspector();
 }
 
 void WebInspectorClient::closeInspectorFrontend()
 {
-    if (m_page->inspector()) {
-        m_page->corePage()->inspectorController().disconnectFrontend(m_page->inspector());
-        m_page->inspector()->closeFrontendConnection();
-    }
+    if (m_page->inspector())
+        m_page->inspector()->closeFrontend();
 }
 
 void WebInspectorClient::bringFrontendToFront()
index b8380b1..9a4400b 100644 (file)
@@ -27,6 +27,7 @@
 #define WebInspectorClient_h
 
 #include <WebCore/InspectorClient.h>
+#include <WebCore/InspectorForwarding.h>
 #include <WebCore/PageOverlay.h>
 #include <wtf/HashSet.h>
 
@@ -52,7 +53,7 @@ private:
     // WebCore::InspectorClient
     void inspectorDestroyed() override;
 
-    Inspector::FrontendChannel* openInspectorFrontend(WebCore::InspectorController*) override;
+    WebCore::InspectorFrontendChannel* openInspectorFrontend(WebCore::InspectorController*) override;
     void closeInspectorFrontend() override;
     void bringFrontendToFront() override;
     void didResizeMainFrame(WebCore::Frame*) override;
index 5969aa2..e0ad754 100644 (file)
@@ -70,7 +70,7 @@ WebInspector::~WebInspector()
 }
 
 // Called from WebInspectorClient
-void WebInspector::openFrontendConnection(bool underTest)
+void WebInspector::createInspectorPage(bool underTest)
 {
 #if OS(DARWIN)
     mach_port_t listeningPort;
@@ -93,7 +93,7 @@ void WebInspector::openFrontendConnection(bool underTest)
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::CreateInspectorPage(connectionClientPort, canAttachWindow(), underTest), m_page->pageID());
 }
 
-void WebInspector::closeFrontendConnection()
+void WebInspector::closeFrontend()
 {
     WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::DidClose(), m_page->pageID());
 
@@ -262,7 +262,8 @@ void WebInspector::remoteFrontendConnected()
 {
     if (m_page->corePage()) {
         m_remoteFrontendConnected = true;
-        m_page->corePage()->inspectorController().connectFrontend(this);
+        bool isAutomaticInspection = false;
+        m_page->corePage()->inspectorController().connectFrontend(this, isAutomaticInspection);
     }
 }
 
@@ -271,7 +272,7 @@ void WebInspector::remoteFrontendDisconnected()
     m_remoteFrontendConnected = false;
 
     if (m_page->corePage())
-        m_page->corePage()->inspectorController().disconnectFrontend(this);
+        m_page->corePage()->inspectorController().disconnectFrontend(Inspector::DisconnectReason::InspectorDestroyed);
 }
 #endif
 
index 0012879..04008e1 100644 (file)
@@ -97,9 +97,9 @@ private:
     bool canAttachWindow();
 
     // Called from WebInspectorClient
-    void openFrontendConnection(bool underTest);
-    void closeFrontendConnection();
+    void createInspectorPage(bool underTest);
 
+    void closeFrontend();
     void bringToFront();
 
     WebPage* m_page;
index 35ce5c4..a644614 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-03  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r189338.
+        https://bugs.webkit.org/show_bug.cgi?id=148785
+
+        Caused tons of crashes (Requested by cdumez on #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: InspectorController should support multiple
+        frontend channels"
+        https://bugs.webkit.org/show_bug.cgi?id=148538
+        http://trac.webkit.org/changeset/189338
+
 2015-09-03  Brian Burg  <bburg@apple.com>
 
         Web Inspector: InspectorController should support multiple frontend channels
index 02a91bc..492622e 100644 (file)
@@ -2039,13 +2039,6 @@ static void runTest(const string& inputLine)
 
     workQueue.clear();
 
-    // If the test page could have possibly opened the Web Inspector frontend,
-    // then try to close it in case it was accidentally left open.
-    if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
-        gTestRunner->closeWebInspector();
-        gTestRunner->setDeveloperExtrasEnabled(false);
-    }
-
     if (gTestRunner->closeRemainingWindowsWhenComplete()) {
         NSArray* array = [DumpRenderTreeWindow openWindows];
 
@@ -2069,6 +2062,12 @@ static void runTest(const string& inputLine)
         }
     }
 
+    // If developer extras enabled Web Inspector may have been open by the test.
+    if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
+        gTestRunner->closeWebInspector();
+        gTestRunner->setDeveloperExtrasEnabled(false);
+    }
+
     resetWebViewToConsistentStateBeforeTesting();
 
     // Loading an empty request synchronously replaces the document with a blank one, which is necessary
index d02cfec..e56eb1f 100644 (file)
@@ -1147,13 +1147,6 @@ static void runTest(const string& inputLine)
     // EventSendingController clearSavedEvents
     workQueue.clear();
 
-    // If the test page could have possibly opened the Web Inspector frontend,
-    // then try to close it in case it was accidentally left open.
-    if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
-        ::gTestRunner->closeWebInspector();
-        ::gTestRunner->setDeveloperExtrasEnabled(false);
-    }
-
     if (::gTestRunner->closeRemainingWindowsWhenComplete()) {
         Vector<HWND> windows = openWindows();
         unsigned size = windows.size();
@@ -1168,6 +1161,11 @@ static void runTest(const string& inputLine)
         }
     }
 
+    if (shouldEnableDeveloperExtras(pathOrURL.c_str())) {
+        ::gTestRunner->closeWebInspector();
+        ::gTestRunner->setDeveloperExtrasEnabled(false);
+    }
+
     resetWebViewToConsistentStateBeforeTesting();
 
     // Loading an empty request synchronously replaces the document with a blank one, which is necessary