Skip to content

Commit 70d727d

Browse files
authored
browser(webkit): ensure autorelease pools are drained on mac (#1933)
Drive-by: do not require 10.15-only QuickLookThumbnailing framework on 10.14.
1 parent 9bd55e9 commit 70d727d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

browser_patches/webkit/BUILD_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1205
1+
1206

browser_patches/webkit/patches/bootstrap.diff

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5588,6 +5588,19 @@ index 44737686187a06a92c408ea60b63a48ac8481334..c754a763688b52e7ddd47493296ef9b0
55885588
}
55895589

55905590
bool PlatformKeyboardEvent::currentCapsLockState()
5591+
diff --git a/Source/WebKit/Configurations/WebKit.xcconfig b/Source/WebKit/Configurations/WebKit.xcconfig
5592+
index c8300ab14a7273942d580acd5de7ec1ff53d3d34..ea757e7e44cfb3cffa5f24083da18c279a128ff8 100644
5593+
--- a/Source/WebKit/Configurations/WebKit.xcconfig
5594+
+++ b/Source/WebKit/Configurations/WebKit.xcconfig
5595+
@@ -130,7 +130,7 @@ WK_QUICKLOOK_THUMBNAILING_LDFLAGS_MACOS_SINCE_1015 = -framework QuickLookThumbna
5596+
WK_QUICKLOOK_THUMBNAILING_LDFLAGS_iphoneos = -framework QuickLookThumbnailing;
5597+
WK_QUICKLOOK_THUMBNAILING_LDFLAGS_iphonesimulator = -framework QuickLookThumbnailing;
5598+
5599+
-FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -framework QuickLookThumbnailing -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS) $(WK_QUICKLOOK_THUMBNAILING_LDFLAGS);
5600+
+FRAMEWORK_AND_LIBRARY_LDFLAGS = -lobjc -framework CFNetwork -framework CoreAudio -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework IOKit -framework IOSurface -framework WebKitLegacy -lnetwork $(WK_ACCESSIBILITY_LDFLAGS) $(WK_APPKIT_LDFLAGS) $(WK_ASSERTION_SERVICES_LDFLAGS) $(WK_RUNNINGBOARD_SERVICES_LDFLAGS) $(WK_AUTHKIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_PREDICTION_LDFLAGS) $(WK_CORE_SERVICES_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_LIBSANDBOX_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_PDFKIT_LDFLAGS) $(WK_SAFE_BROWSING_LDFLAGS) $(WK_SECURITY_INTERFACE_LDFLAGS) $(WK_UIKIT_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS) $(WK_WEBINSPECTORUI_LDFLAGS) $(WK_QUICKLOOK_THUMBNAILING_LDFLAGS);
5601+
5602+
// Prevent C++ standard library basic_stringstream, operator new, delete and their related exception types from being exported as weak symbols.
5603+
UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv -Wl,-unexported_symbol -Wl,__Znwm -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1EOS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSEDn -Wl,-unexported_symbol -Wl,__ZNKSt3__18functionIFvN7WebCore12PolicyActionEEEclES2_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEE4swapERS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC1ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEC2ERKS4_ -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED1Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEED2Ev -Wl,-unexported_symbol -Wl,__ZNSt3__18functionIFvN7WebCore12PolicyActionEEEaSERKS4_ -Wl,-unexported_symbol -Wl,__ZTVNSt3__117bad_function_callE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_13basic_istreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE0_NS_14basic_iostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE16_NS_13basic_ostreamIcS2_EE -Wl,-unexported_symbol -Wl,__ZTTNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTVNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE -Wl,-unexported_symbol -Wl,__ZTCNSt3__118basic_stringstreamIcNS_11char_traitsIcEENS_9allocatorIcEEEE8_NS_13basic_ostreamIcS2_EE;
55915604
diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp
55925605
index f62e98610dd2e74efcf0c899475e6d095b8f916b..e0a7d93c6700869adc7ba612f07fe3cf77e221af 100644
55935606
--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp

browser_patches/webkit/src/Tools/Playwright/mac/BrowserWindowController.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,33 @@ - (void)windowWillClose:(NSNotification *)notification
388388
[_webView removeFromSuperview];
389389
_textFinder.hideInterfaceCallback = nil;
390390
[self release];
391+
392+
// Post two events (don't ask me why!) to spin event loop and drain
393+
// automatically created autorelease pools that will release our window.
394+
// See https://www.mikeash.com/pyblog/more-fun-with-autorelease.html
395+
// for some discussion.
396+
NSEvent* event1 = [NSEvent
397+
otherEventWithType:NSEventTypeApplicationDefined
398+
location:NSMakePoint(0, 0)
399+
modifierFlags:0
400+
timestamp:[[NSDate date] timeIntervalSince1970]
401+
windowNumber:0
402+
context:nil
403+
subtype:0
404+
data1:0
405+
data2:0];
406+
[NSApp postEvent:event1 atStart:YES];
407+
NSEvent* event2 = [NSEvent
408+
otherEventWithType:NSEventTypeApplicationDefined
409+
location:NSMakePoint(0, 0)
410+
modifierFlags:0
411+
timestamp:[[NSDate date] timeIntervalSince1970]
412+
windowNumber:0
413+
context:nil
414+
subtype:0
415+
data1:0
416+
data2:0];
417+
[NSApp postEvent:event2 atStart:NO];
391418
}
392419

393420
- (void)webViewDidClose:(WKWebView *)webView {

0 commit comments

Comments
 (0)