browser(webkit): headless beforeunload dialog handler added (#378)

This commit is contained in:
Pavel Feldman 2020-01-04 21:16:25 -08:00 committed by GitHub
parent 2f45ebbb72
commit ccfb2cb26c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -1 +1 @@
1060
1061

View File

@ -8914,7 +8914,7 @@ index 45ef1a6424ea3a01cef14b88d6610aabe98446aa..30964dbd4ccfca341585c2c2ae06a403
IBOutlet NSMenuItem *_newWebKit1WindowItem;
diff --git a/Tools/MiniBrowser/mac/AppDelegate.m b/Tools/MiniBrowser/mac/AppDelegate.m
index b6af4ef724fbc3641efa1c7135c1faf405b0a79d..0afe6ceec4fdd46c0b12f0fec94975365aa76b07 100644
index b6af4ef724fbc3641efa1c7135c1faf405b0a79d..8dc5e82221092b2b59862c70af65c2d2a10d0a74 100644
--- a/Tools/MiniBrowser/mac/AppDelegate.m
+++ b/Tools/MiniBrowser/mac/AppDelegate.m
@@ -33,7 +33,9 @@
@ -9105,7 +9105,7 @@ index b6af4ef724fbc3641efa1c7135c1faf405b0a79d..0afe6ceec4fdd46c0b12f0fec9497536
[_extensionManagerWindowController showWindow:sender];
}
@@ -345,4 +406,148 @@ - (IBAction)clearDefaultStoreWebsiteData:(id)sender
@@ -345,4 +406,159 @@ - (IBAction)clearDefaultStoreWebsiteData:(id)sender
}];
}
@ -9238,6 +9238,17 @@ index b6af4ef724fbc3641efa1c7135c1faf405b0a79d..0afe6ceec4fdd46c0b12f0fec9497536
+ [_dialogs addObject:dialog];
+}
+
+- (void)_webView:(WKWebView *)webView runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler
+{
+ WebViewDialog* dialog = [[WebViewDialog alloc] autorelease];
+ dialog.webView = webView;
+ dialog.completionHandler = ^void (BOOL accept, NSString* value) {
+ completionHandler(accept);
+ [_dialogs removeObject:dialog];
+ };
+ [_dialogs addObject:dialog];
+}
+
+- (void)webView:(WKWebView *)webView handleJavaScriptDialog:(BOOL)accept value:(NSString *)value
+{
+ for (WebViewDialog *dialog in _dialogs) {