Title: [248497] trunk/Source
Revision
248497
Author
drou...@apple.com
Date
2019-08-10 00:02:28 -0700 (Sat, 10 Aug 2019)

Log Message

Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
https://bugs.webkit.org/show_bug.cgi?id=200587

Reviewed by Joseph Pecoraro.

WK1 inspector sends messages to the frontend using `WebCore::InspectorClient::doDispatchMessageOnFrontendPage`,
which does not do any sort of queueing to wait until the frontend is loaded (`InspectorFrontendHost.loaded()`).

Now that we are sending messages immediately, we should always queue.

Source/WebCore:

Covered by existing tests (which were failing after r248454, and now won't fail).

* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::setDockingUnavailable):
(WebCore::InspectorFrontendClientLocal::setAttachedWindow):
(WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
(WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
(WebCore::InspectorFrontendClientLocal::startProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::stopProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::showConsole):
(WebCore::InspectorFrontendClientLocal::showResources):
(WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
(WebCore::InspectorFrontendClientLocal::dispatch): Added.
(WebCore::InspectorFrontendClientLocal::dispatchMessage): Added.
(WebCore::InspectorFrontendClientLocal::dispatchMessageAsync): Added.
(WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
Provide additional ways for subclasses to call other `InspectorFrontendAPI` methods using
the "on load" queue.

* testing/Internals.cpp:
(WebCore::InspectorStubFrontend::sendMessageToFrontend):
(WebCore::InspectorStubFrontend::frontendLoaded): Deleted.
Leverage the base `InspectorFrontendClientLocal`'s functions for queueing messages.

* inspector/InspectorClient.h:
* inspector/InspectorClient.cpp: Removed.
(WebCore::InspectorClient::doDispatchMessageOnFrontendPage): Deleted.

* inspector/agents/InspectorTimelineAgent.cpp:
Add missing include.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

Source/WebInspectorUI:

* UserInterface/Test/TestStub.js:
(InspectorFrontendAPI.dispatch): Added.

* UserInterface/Models/Frame.js:
(WI.Frame.prototype.markDOMContentReadyEvent):
(WI.Frame.prototype.markLoadEvent):

* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype.pageDOMContentLoadedEventFired):
(WI.TimelineManager.prototype.pageLoadEventFired):

Source/WebKitLegacy/cf:

* WebCoreSupport/WebInspectorClientCF.cpp:
(WebInspectorClient::sendMessageToFrontend):
Leverage the base `InspectorFrontendClientLocal`'s functions for queueing messages.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248496 => 248497)


--- trunk/Source/WebCore/ChangeLog	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/ChangeLog	2019-08-10 07:02:28 UTC (rev 248497)
@@ -1,3 +1,50 @@
+2019-08-10  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
+        https://bugs.webkit.org/show_bug.cgi?id=200587
+
+        Reviewed by Joseph Pecoraro.
+
+        WK1 inspector sends messages to the frontend using `WebCore::InspectorClient::doDispatchMessageOnFrontendPage`,
+        which does not do any sort of queueing to wait until the frontend is loaded (`InspectorFrontendHost.loaded()`).
+
+        Now that we are sending messages immediately, we should always queue.
+
+        Covered by existing tests (which were failing after r248454, and now won't fail).
+
+        * inspector/InspectorFrontendClientLocal.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::setDockingUnavailable):
+        (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
+        (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
+        (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
+        (WebCore::InspectorFrontendClientLocal::startProfilingJavaScript):
+        (WebCore::InspectorFrontendClientLocal::stopProfilingJavaScript):
+        (WebCore::InspectorFrontendClientLocal::showConsole):
+        (WebCore::InspectorFrontendClientLocal::showResources):
+        (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
+        (WebCore::InspectorFrontendClientLocal::dispatch): Added.
+        (WebCore::InspectorFrontendClientLocal::dispatchMessage): Added.
+        (WebCore::InspectorFrontendClientLocal::dispatchMessageAsync): Added.
+        (WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
+        Provide additional ways for subclasses to call other `InspectorFrontendAPI` methods using
+        the "on load" queue.
+
+        * testing/Internals.cpp:
+        (WebCore::InspectorStubFrontend::sendMessageToFrontend):
+        (WebCore::InspectorStubFrontend::frontendLoaded): Deleted.
+        Leverage the base `InspectorFrontendClientLocal`'s functions for queueing messages.
+
+        * inspector/InspectorClient.h:
+        * inspector/InspectorClient.cpp: Removed.
+        (WebCore::InspectorClient::doDispatchMessageOnFrontendPage): Deleted.
+
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        Add missing include.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2019-08-09  Yusuke Suzuki  <ysuz...@apple.com>
 
         Universal XSS in JSObject::putInlineSlow and JSValue::putToPrimitive

Modified: trunk/Source/WebCore/Sources.txt (248496 => 248497)


--- trunk/Source/WebCore/Sources.txt	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/Sources.txt	2019-08-10 07:02:28 UTC (rev 248497)
@@ -1331,7 +1331,6 @@
 inspector/InspectorAuditDOMObject.cpp
 inspector/InspectorAuditResourcesObject.cpp
 inspector/InspectorCanvas.cpp
-inspector/InspectorClient.cpp
 inspector/InspectorController.cpp
 inspector/InspectorDatabaseResource.cpp
 inspector/InspectorFrontendClientLocal.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (248496 => 248497)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-08-10 07:02:28 UTC (rev 248497)
@@ -9500,7 +9500,6 @@
 		7A0E771C10C00DB100A0276E /* JSInspectorFrontendHost.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHost.cpp; sourceTree = "<group>"; };
 		7A0E771D10C00DB100A0276E /* JSInspectorFrontendHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInspectorFrontendHost.h; sourceTree = "<group>"; };
 		7A1D7FCA18F85F0F00C385AD /* en */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; name = en; path = en.lproj/mediaControlsLocalizedStrings.js; sourceTree = SOURCE_ROOT; };
-		7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorClient.cpp; sourceTree = "<group>"; };
 		7A22731E20C9F9D900DB1DEF /* WebKitNSImageExtras.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitNSImageExtras.mm; sourceTree = "<group>"; };
 		7A22731F20C9F9DA00DB1DEF /* WebKitNSImageExtras.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebKitNSImageExtras.h; sourceTree = "<group>"; };
 		7A29BA67187B732200F29CEB /* TemporaryOpenGLSetting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemporaryOpenGLSetting.h; sourceTree = "<group>"; };
@@ -17004,7 +17003,6 @@
 				9109E9C5222CABC800BB6264 /* InspectorAuditResourcesObject.h */,
 				6A22E8721F1042C400F546C3 /* InspectorCanvas.cpp */,
 				6A22E86F1F10418600F546C3 /* InspectorCanvas.h */,
-				7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */,
 				1C81B9580E97330800266E07 /* InspectorClient.h */,
 				1C81B9570E97330800266E07 /* InspectorController.cpp */,
 				1C81B9560E97330800266E07 /* InspectorController.h */,
@@ -25539,11 +25537,11 @@
 				C24A57BB21FEAFEA004C6DD1 /* WHLSLPrepare.h */,
 				522E1A172297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.cpp */,
 				522E1A192297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.h */,
-				526B3F0122FB7BDD0076D37D /* WHLSLPruneUnreachableStandardLibraryFunctions.cpp */,
-				526B3F0322FB7BDE0076D37D /* WHLSLPruneUnreachableStandardLibraryFunctions.h */,
 				C21BF73A21CD8D7000227979 /* WHLSLProgram.h */,
 				1CAA82F62242AE0500E84BBB /* WHLSLPropertyResolver.cpp */,
 				1CAA82F72242AE0500E84BBB /* WHLSLPropertyResolver.h */,
+				526B3F0122FB7BDD0076D37D /* WHLSLPruneUnreachableStandardLibraryFunctions.cpp */,
+				526B3F0322FB7BDE0076D37D /* WHLSLPruneUnreachableStandardLibraryFunctions.h */,
 				1CA0C2E021EEB5F500A11860 /* WHLSLRecursionChecker.cpp */,
 				1CA0C2DE21EEB5F400A11860 /* WHLSLRecursionChecker.h */,
 				C234A9AD21E92C19003C984D /* WHLSLRecursiveTypeChecker.cpp */,

Deleted: trunk/Source/WebCore/inspector/InspectorClient.cpp (248496 => 248497)


--- trunk/Source/WebCore/inspector/InspectorClient.cpp	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/inspector/InspectorClient.cpp	2019-08-10 07:02:28 UTC (rev 248497)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "InspectorClient.h"
-
-#include "Frame.h"
-#include "InspectorController.h"
-#include "Page.h"
-#include "ScriptController.h"
-#include "ScriptSourceCode.h"
-#include <_javascript_Core/FrameTracers.h>
-
-namespace WebCore {
-using namespace JSC;
-using namespace Inspector;
-
-void InspectorClient::doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message)
-{
-    if (!frontendPage)
-        return;
-
-    SuspendExceptionScope scope(&frontendPage->inspectorController().vm());
-    String dispatchToFrontend = makeString("InspectorFrontendAPI.dispatchMessageAsync(", message, ");");
-    frontendPage->mainFrame().script().evaluate(ScriptSourceCode(dispatchToFrontend));
-}
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorClient.h (248496 => 248497)


--- trunk/Source/WebCore/inspector/InspectorClient.h	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/inspector/InspectorClient.h	2019-08-10 07:02:28 UTC (rev 248497)
@@ -69,8 +69,6 @@
 #if ENABLE(REMOTE_INSPECTOR)
     virtual bool allowRemoteInspectionToPageDirectly() const { return false; }
 #endif
-
-    WEBCORE_EXPORT static void doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (248496 => 248497)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2019-08-10 07:02:28 UTC (rev 248497)
@@ -45,11 +45,13 @@
 #include "InspectorPageAgent.h"
 #include "Page.h"
 #include "ScriptController.h"
+#include "ScriptSourceCode.h"
 #include "ScriptState.h"
 #include "Settings.h"
 #include "Timer.h"
 #include "UserGestureIndicator.h"
 #include "WindowFeatures.h"
+#include <_javascript_Core/FrameTracers.h>
 #include <_javascript_Core/InspectorBackendDispatchers.h>
 #include <wtf/Deque.h>
 #include <wtf/text/CString.h>
@@ -214,7 +216,7 @@
 
 void InspectorFrontendClientLocal::setDockingUnavailable(bool unavailable)
 {
-    evaluateOnLoad(makeString("[\"setDockingUnavailable\", ", unavailable ? "true" : "false", ']'));
+    dispatch(makeString("[\"setDockingUnavailable\", ", unavailable ? "true" : "false", ']'));
 }
 
 void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
@@ -284,7 +286,7 @@
 
     m_dockSide = dockSide;
 
-    evaluateOnLoad(makeString("[\"setDockSide\", \"", side, "\"]"));
+    dispatch(makeString("[\"setDockSide\", \"", side, "\"]"));
 }
 
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
@@ -308,7 +310,7 @@
 
 void InspectorFrontendClientLocal::setDebuggingEnabled(bool enabled)
 {
-    evaluateOnLoad(makeString("[\"setDebuggingEnabled\", ", enabled ? "true" : "false", ']'));
+    dispatch(makeString("[\"setDebuggingEnabled\", ", enabled ? "true" : "false", ']'));
 }
 
 bool InspectorFrontendClientLocal::isTimelineProfilingEnabled()
@@ -320,7 +322,7 @@
 
 void InspectorFrontendClientLocal::setTimelineProfilingEnabled(bool enabled)
 {
-    evaluateOnLoad(makeString("[\"setTimelineProfilingEnabled\", ", enabled ? "true" : "false", ']'));
+    dispatch(makeString("[\"setTimelineProfilingEnabled\", ", enabled ? "true" : "false", ']'));
 }
 
 bool InspectorFrontendClientLocal::isProfilingJavaScript()
@@ -332,28 +334,28 @@
 
 void InspectorFrontendClientLocal::startProfilingJavaScript()
 {
-    evaluateOnLoad("[\"startProfilingJavaScript\"]");
+    dispatch("[\"startProfilingJavaScript\"]");
 }
 
 void InspectorFrontendClientLocal::stopProfilingJavaScript()
 {
-    evaluateOnLoad("[\"stopProfilingJavaScript\"]");
+    dispatch("[\"stopProfilingJavaScript\"]");
 }
 
 void InspectorFrontendClientLocal::showConsole()
 {
-    evaluateOnLoad("[\"showConsole\"]");
+    dispatch("[\"showConsole\"]");
 }
 
 void InspectorFrontendClientLocal::showResources()
 {
-    evaluateOnLoad("[\"showResources\"]");
+    dispatch("[\"showResources\"]");
 }
 
 void InspectorFrontendClientLocal::showMainResourceForFrame(Frame* frame)
 {
     String frameId = m_inspectedPageController->ensurePageAgent().frameId(frame);
-    evaluateOnLoad(makeString("[\"showMainResourceForFrame\", \"", frameId, "\"]"));
+    dispatch(makeString("[\"showMainResourceForFrame\", \"", frameId, "\"]"));
 }
 
 unsigned InspectorFrontendClientLocal::constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight)
@@ -381,6 +383,29 @@
     return m_inspectedPageController->inspectionLevel() + 1;
 }
 
+void InspectorFrontendClientLocal::dispatch(const String& signature)
+{
+    ASSERT(!signature.isEmpty());
+    ASSERT(signature.startsWith('['));
+    ASSERT(signature.endsWith(']'));
+
+    evaluateOnLoad("InspectorFrontendAPI.dispatch(" + signature + ")");
+}
+
+void InspectorFrontendClientLocal::dispatchMessage(const String& messageObject)
+{
+    ASSERT(!messageObject.isEmpty());
+
+    evaluateOnLoad("InspectorFrontendAPI.dispatchMessage(" + messageObject + ")");
+}
+
+void InspectorFrontendClientLocal::dispatchMessageAsync(const String& messageObject)
+{
+    ASSERT(!messageObject.isEmpty());
+
+    evaluateOnLoad("InspectorFrontendAPI.dispatchMessageAsync(" + messageObject + ")");
+}
+
 bool InspectorFrontendClientLocal::evaluateAsBoolean(const String& _expression_)
 {
     auto& state = *mainWorldExecState(&m_frontendPage->mainFrame());
@@ -389,10 +414,13 @@
 
 void InspectorFrontendClientLocal::evaluateOnLoad(const String& _expression_)
 {
-    if (m_frontendLoaded)
-        m_frontendPage->mainFrame().script().executeScript("if (InspectorFrontendAPI) InspectorFrontendAPI.dispatch(" + _expression_ + ")");
-    else
+    if (!m_frontendLoaded) {
         m_evaluateOnLoad.append(_expression_);
+        return;
+    }
+
+    JSC::SuspendExceptionScope scope(&m_frontendPage->inspectorController().vm());
+    m_frontendPage->mainFrame().script().evaluate(ScriptSourceCode(_expression_));
 }
 
 Page* InspectorFrontendClientLocal::inspectedPage() const

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (248496 => 248497)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2019-08-10 07:02:28 UTC (rev 248497)
@@ -116,6 +116,11 @@
 
     WEBCORE_EXPORT Page* inspectedPage() const;
     Page* frontendPage() const { return m_frontendPage; }
+
+    WEBCORE_EXPORT void dispatch(const String& signature);
+    WEBCORE_EXPORT void dispatchMessage(const String& messageObject);
+    WEBCORE_EXPORT void dispatchMessageAsync(const String& messageObject);
+
 protected:
     virtual void setAttachedWindowHeight(unsigned) = 0;
     virtual void setAttachedWindowWidth(unsigned) = 0;

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (248496 => 248497)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2019-08-10 07:02:28 UTC (rev 248497)
@@ -38,6 +38,7 @@
 #include "Frame.h"
 #include "InspectorCPUProfilerAgent.h"
 #include "InspectorClient.h"
+#include "InspectorController.h"
 #include "InspectorMemoryAgent.h"
 #include "InspectorPageAgent.h"
 #include "InstrumentingAgents.h"

Modified: trunk/Source/WebCore/testing/Internals.cpp (248496 => 248497)


--- trunk/Source/WebCore/testing/Internals.cpp	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebCore/testing/Internals.cpp	2019-08-10 07:02:28 UTC (rev 248497)
@@ -322,7 +322,6 @@
     virtual ~InspectorStubFrontend();
 
 private:
-    void frontendLoaded() final;
     void attachWindow(DockSide) final { }
     void detachWindow() final { }
     void closeWindow() final;
@@ -339,8 +338,6 @@
     ConnectionType connectionType() const final { return ConnectionType::Local; }
 
     RefPtr<DOMWindow> m_frontendWindow;
-    Vector<String> m_messages;
-    bool m_loaded { false };
 };
 
 InspectorStubFrontend::InspectorStubFrontend(Page& inspectedPage, RefPtr<DOMWindow>&& frontendWindow)
@@ -358,15 +355,6 @@
     closeWindow();
 }
 
-void InspectorStubFrontend::frontendLoaded()
-{
-    m_loaded = true;
-
-    for (auto& message : m_messages)
-        sendMessageToFrontend(message);
-    m_messages.clear();
-}
-
 void InspectorStubFrontend::closeWindow()
 {
     if (!m_frontendWindow)
@@ -381,14 +369,7 @@
 
 void InspectorStubFrontend::sendMessageToFrontend(const String& message)
 {
-    ASSERT_ARG(message, !message.isEmpty());
-
-    if (!m_loaded) {
-        m_messages.append(message);
-        return;
-    }
-
-    InspectorClient::doDispatchMessageOnFrontendPage(frontendPage(), message);
+    dispatchMessageAsync(message);
 }
 
 static bool markerTypeFrom(const String& markerType, DocumentMarker::MarkerType& result)

Modified: trunk/Source/WebInspectorUI/ChangeLog (248496 => 248497)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-08-10 07:02:28 UTC (rev 248497)
@@ -1,3 +1,26 @@
+2019-08-10  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
+        https://bugs.webkit.org/show_bug.cgi?id=200587
+
+        Reviewed by Joseph Pecoraro.
+
+        WK1 inspector sends messages to the frontend using `WebCore::InspectorClient::doDispatchMessageOnFrontendPage`,
+        which does not do any sort of queueing to wait until the frontend is loaded (`InspectorFrontendHost.loaded()`).
+
+        Now that we are sending messages immediately, we should always queue.
+
+        * UserInterface/Test/TestStub.js:
+        (InspectorFrontendAPI.dispatch): Added.
+
+        * UserInterface/Models/Frame.js:
+        (WI.Frame.prototype.markDOMContentReadyEvent):
+        (WI.Frame.prototype.markLoadEvent):
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WI.TimelineManager.prototype.pageDOMContentLoadedEventFired):
+        (WI.TimelineManager.prototype.pageLoadEventFired):
+
 2019-08-09  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: Node details sidebar sections have unclear delineation in Dark Mode

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (248496 => 248497)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2019-08-10 07:02:28 UTC (rev 248497)
@@ -551,11 +551,11 @@
             return;
 
         console.assert(this._activeRecording);
-        console.assert(isNaN(WI.networkManager.mainFrame.domContentReadyEventTimestamp));
 
         let computedTimestamp = this._activeRecording.computeElapsedTime(timestamp);
 
-        WI.networkManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);
+        if (WI.networkManager.mainFrame)
+            WI.networkManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);
 
         let eventMarker = new WI.TimelineMarker(computedTimestamp, WI.TimelineMarker.Type.DOMContentEvent);
         this._activeRecording.addEventMarker(eventMarker);
@@ -567,11 +567,11 @@
             return;
 
         console.assert(this._activeRecording);
-        console.assert(isNaN(WI.networkManager.mainFrame.loadEventTimestamp));
 
         let computedTimestamp = this._activeRecording.computeElapsedTime(timestamp);
 
-        WI.networkManager.mainFrame.markLoadEvent(computedTimestamp);
+        if (WI.networkManager.mainFrame)
+            WI.networkManager.mainFrame.markLoadEvent(computedTimestamp);
 
         let eventMarker = new WI.TimelineMarker(computedTimestamp, WI.TimelineMarker.Type.LoadEvent);
         this._activeRecording.addEventMarker(eventMarker);

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js (248496 => 248497)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js	2019-08-10 07:02:28 UTC (rev 248497)
@@ -266,11 +266,15 @@
 
     markDOMContentReadyEvent(timestamp)
     {
+        console.assert(isNaN(this._domContentReadyEventTimestamp));
+
         this._domContentReadyEventTimestamp = timestamp || NaN;
     }
 
     markLoadEvent(timestamp)
     {
+        console.assert(isNaN(this._loadEventTimestamp));
+
         this._loadEventTimestamp = timestamp || NaN;
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js (248496 => 248497)


--- trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/TestStub.js	2019-08-10 07:02:28 UTC (rev 248497)
@@ -25,6 +25,7 @@
  */
 
 InspectorFrontendAPI = {};
+InspectorFrontendAPI.dispatch = function () { };
 InspectorFrontendAPI.dispatchMessageAsync = InspectorProtocol.dispatchMessageFromBackend;
 
 window.ProtocolTest = new ProtocolTestHarness();

Modified: trunk/Source/WebKitLegacy/cf/ChangeLog (248496 => 248497)


--- trunk/Source/WebKitLegacy/cf/ChangeLog	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebKitLegacy/cf/ChangeLog	2019-08-10 07:02:28 UTC (rev 248497)
@@ -1,3 +1,19 @@
+2019-08-10  Devin Rousso  <drou...@apple.com>
+
+        Web Inspector: REGRESSION(r248454): WK1 inspector frontend client doesn't queue messages to the frontend before it's loaded
+        https://bugs.webkit.org/show_bug.cgi?id=200587
+
+        Reviewed by Joseph Pecoraro.
+
+        WK1 inspector sends messages to the frontend using `WebCore::InspectorClient::doDispatchMessageOnFrontendPage`,
+        which does not do any sort of queueing to wait until the frontend is loaded (`InspectorFrontendHost.loaded()`).
+
+        Now that we are sending messages immediately, we should always queue.
+
+        * WebCoreSupport/WebInspectorClientCF.cpp:
+        (WebInspectorClient::sendMessageToFrontend):
+        Leverage the base `InspectorFrontendClientLocal`'s functions for queueing messages.
+
 2019-07-02  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Debug: "Reset Web Inspector" should also clear the saved window size and attachment side

Modified: trunk/Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp (248496 => 248497)


--- trunk/Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp	2019-08-10 04:00:23 UTC (rev 248496)
+++ trunk/Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp	2019-08-10 07:02:28 UTC (rev 248497)
@@ -96,7 +96,7 @@
 
 void WebInspectorClient::sendMessageToFrontend(const String& message)
 {
-    doDispatchMessageOnFrontendPage(m_frontendPage, message);
+    m_frontendClient->dispatchMessageAsync(message);
 }
 
 bool WebInspectorClient::inspectorAttachDisabled()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to