Title: [207508] trunk/Tools
Revision
207508
Author
ander...@apple.com
Date
2016-10-18 17:21:50 -0700 (Tue, 18 Oct 2016)

Log Message

Add an beforeunload alert to the WebKitLegacy MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=163634

Reviewed by Sam Weinig.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:]):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (207507 => 207508)


--- trunk/Tools/ChangeLog	2016-10-19 00:20:53 UTC (rev 207507)
+++ trunk/Tools/ChangeLog	2016-10-19 00:21:50 UTC (rev 207508)
@@ -1,3 +1,13 @@
+2016-10-18  Anders Carlsson  <ander...@apple.com>
+
+        Add an beforeunload alert to the WebKitLegacy MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=163634
+
+        Reviewed by Sam Weinig.
+
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:]):
+
 2016-10-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r207443.

Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (207507 => 207508)


--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2016-10-19 00:20:53 UTC (rev 207507)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2016-10-19 00:21:50 UTC (rev 207508)
@@ -371,4 +371,21 @@
     [alert release];
 }
 
+- (BOOL)webView:(WebView *)sender runBeforeUnloadConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame
+{
+    NSAlert *alert = [[NSAlert alloc] init];
+
+    alert.messageText = [NSString stringWithFormat:@"_javascript_ before unload dialog from %@.", frame.dataSource.request.URL.absoluteString];
+    alert.informativeText = message;
+
+    [alert addButtonWithTitle:@"Leave Page"];
+    [alert addButtonWithTitle:@"Stay On Page"];
+
+    NSModalResponse response = [alert runModal];
+    
+    [alert release];
+
+    return response == NSAlertFirstButtonReturn;
+}
+
 @end
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to