- Revision
- 259931
- Author
- [email protected]
- Date
- 2020-04-11 11:36:40 -0700 (Sat, 11 Apr 2020)
Log Message
REGRESSION (Safari 13.1?): Web Inspector: Debugger hang at breakpoint when using Keyboard Maestro
https://bugs.webkit.org/show_bug.cgi?id=210177
<rdar://problem/61485723>
Reviewed by Joseph Pecoraro.
Partial revert of r251036 <https://webkit.org/b/202716> to go back to using AppKit APIs
instead of `CFRunLoopRunInMode`. Only seems to affect WebKitLegacy.
* inspector/PageScriptDebugServer.h:
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
(WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused):
* inspector/mac/PageScriptDebugServerMac.mm: Added.
(WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused):
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (259930 => 259931)
--- trunk/Source/WebCore/ChangeLog 2020-04-11 15:35:04 UTC (rev 259930)
+++ trunk/Source/WebCore/ChangeLog 2020-04-11 18:36:40 UTC (rev 259931)
@@ -1,3 +1,24 @@
+2020-04-11 Devin Rousso <[email protected]>
+
+ REGRESSION (Safari 13.1?): Web Inspector: Debugger hang at breakpoint when using Keyboard Maestro
+ https://bugs.webkit.org/show_bug.cgi?id=210177
+ <rdar://problem/61485723>
+
+ Reviewed by Joseph Pecoraro.
+
+ Partial revert of r251036 <https://webkit.org/b/202716> to go back to using AppKit APIs
+ instead of `CFRunLoopRunInMode`. Only seems to affect WebKitLegacy.
+
+ * inspector/PageScriptDebugServer.h:
+ * inspector/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
+ (WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused):
+ * inspector/mac/PageScriptDebugServerMac.mm: Added.
+ (WebCore::PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused):
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2020-04-08 Darin Adler <[email protected]>
Use Node::length to replace Node::maxCharacterOffset and lastOffsetInNode; switch more offsets from int to unsigned
Modified: trunk/Source/WebCore/SourcesCocoa.txt (259930 => 259931)
--- trunk/Source/WebCore/SourcesCocoa.txt 2020-04-11 15:35:04 UTC (rev 259930)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2020-04-11 18:36:40 UTC (rev 259931)
@@ -112,6 +112,8 @@
history/mac/HistoryItemMac.mm
+inspector/mac/PageScriptDebugServerMac.mm
+
loader/archive/cf/LegacyWebArchive.cpp
loader/archive/cf/LegacyWebArchiveMac.mm
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (259930 => 259931)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-04-11 15:35:04 UTC (rev 259930)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-04-11 18:36:40 UTC (rev 259931)
@@ -10681,6 +10681,7 @@
91278D6021DEDAF000B57184 /* WorkerAuditAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerAuditAgent.h; sourceTree = "<group>"; };
913FE5982362799900F9446A /* InspectorAnimationAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InspectorAnimationAgent.cpp; path = inspector/agents/InspectorAnimationAgent.cpp; sourceTree = SOURCE_ROOT; };
913FE59A2362799900F9446A /* InspectorAnimationAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InspectorAnimationAgent.h; path = inspector/agents/InspectorAnimationAgent.h; sourceTree = SOURCE_ROOT; };
+ 9174EA5D2440F9A50008349C /* PageScriptDebugServerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageScriptDebugServerMac.mm; sourceTree = "<group>"; };
9175CE5721E281EB00DF2C27 /* InspectorAuditDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorAuditDOMObject.cpp; sourceTree = "<group>"; };
9175CE5721E281EB00DF2C28 /* JSInspectorAuditDOMObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorAuditDOMObject.cpp; sourceTree = "<group>"; };
9175CE5821E281EC00DF2C27 /* InspectorAuditDOMObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorAuditDOMObject.h; sourceTree = "<group>"; };
@@ -17629,6 +17630,7 @@
isa = PBXGroup;
children = (
A5B81C831FAA44060037D1E6 /* agents */,
+ 9174EA5C2440F98A0008349C /* mac */,
A584FE311864D5AF00843B10 /* CommandLineAPIHost.cpp */,
A584FE321864D5AF00843B10 /* CommandLineAPIHost.h */,
A584FE331864D5AF00843B10 /* CommandLineAPIHost.idl */,
@@ -21755,6 +21757,14 @@
name = Quota;
sourceTree = "<group>";
};
+ 9174EA5C2440F98A0008349C /* mac */ = {
+ isa = PBXGroup;
+ children = (
+ 9174EA5D2440F9A50008349C /* PageScriptDebugServerMac.mm */,
+ );
+ path = mac;
+ sourceTree = "<group>";
+ };
93309D86099E64910056E581 /* editing */ = {
isa = PBXGroup;
children = (
Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (259930 => 259931)
--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp 2020-04-11 15:35:04 UTC (rev 259930)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp 2020-04-11 18:36:40 UTC (rev 259931)
@@ -116,7 +116,7 @@
m_page.incrementNestedRunLoopCount();
while (!m_doneProcessingDebuggerEvents) {
- if (RunLoop::cycle() == RunLoop::CycleResult::Stop)
+ if (!platformShouldContinueRunningEventLoopWhilePaused())
break;
}
@@ -176,4 +176,11 @@
}
}
+#if !PLATFORM(MAC)
+bool PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused()
+{
+ return RunLoop::cycle() != RunLoop::CycleResult::Stop;
+}
+#endif // !PLATFORM(MAC)
+
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.h (259930 => 259931)
--- trunk/Source/WebCore/inspector/PageScriptDebugServer.h 2020-04-11 15:35:04 UTC (rev 259930)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.h 2020-04-11 18:36:40 UTC (rev 259931)
@@ -58,6 +58,8 @@
void setJavaScriptPaused(const PageGroup&, bool paused);
void setJavaScriptPaused(Frame&, bool paused);
+ bool platformShouldContinueRunningEventLoopWhilePaused();
+
Page& m_page;
};
Added: trunk/Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm (0 => 259931)
--- trunk/Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm (rev 0)
+++ trunk/Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm 2020-04-11 18:36:40 UTC (rev 259931)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "PageScriptDebugServer.h"
+
+#if PLATFORM(MAC)
+
+#import <wtf/ProcessPrivilege.h>
+
+namespace WebCore {
+
+bool PageScriptDebugServer::platformShouldContinueRunningEventLoopWhilePaused()
+{
+ // Be very careful before removing this code. It has been tried multiple times, always ending up
+ // breaking inspection of WebKitLegacy (in MiniBrowser, in 3rd party apps, or sometimes both).
+ // - <https://webkit.org/b/117596> <rdar://problem/14133001>
+ // - <https://webkit.org/b/210177> <rdar://problem/61485723>
+
+#if ENABLE(WEBPROCESS_NSRUNLOOP)
+ if (![NSApp isRunning]) {
+ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]];
+ return true;
+ }
+
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+#endif
+
+ [NSApp setWindowsNeedUpdate:YES];
+
+ if (NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate dateWithTimeIntervalSinceNow:0.05] inMode:NSDefaultRunLoopMode dequeue:YES])
+ [NSApp sendEvent:event];
+
+ return true;
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(MAC)