@@ -13089,10 +13089,10 @@ index 0000000000000000000000000000000000000000..41b5751cab626971cd12c5066218c6d1
13089
13089
+@end
13090
13090
diff --git a/Tools/Playwright/mac/AppDelegate.m b/Tools/Playwright/mac/AppDelegate.m
13091
13091
new file mode 100644
13092
- index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bcd5aa37db
13092
+ index 0000000000000000000000000000000000000000..828d172381e12ea0455045fdc098dfa7726ae040
13093
13093
--- /dev/null
13094
13094
+++ b/Tools/Playwright/mac/AppDelegate.m
13095
- @@ -0,0 +1,486 @@
13095
+ @@ -0,0 +1,488 @@
13096
13096
+/*
13097
13097
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
13098
13098
+ *
@@ -13453,7 +13453,7 @@ index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bc
13453
13453
+ return [controller webView];
13454
13454
+}
13455
13455
+
13456
- +- (WKWebView *)createHeadlessWebView:(WKWebViewConfiguration *)configuration
13456
+ +- (WKWebView *)createHeadlessWebView:(WKWebViewConfiguration *)configuration forPopup:(BOOL)popup
13457
13457
+{
13458
13458
+ NSRect rect = NSMakeRect(0, 0, 1024, 768);
13459
13459
+ NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
@@ -13467,9 +13467,11 @@ index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bc
13467
13467
+
13468
13468
+ webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
13469
13469
+ [window.contentView addSubview:webView];
13470
- + NSURL *url = [NSURL _webkit_URLWithUserTypedString:_initialURL ? _initialURL : @"about:blank"];
13471
- + _initialURL = nil;
13472
- + [webView loadRequest:[NSURLRequest requestWithURL:url]];
13470
+ + if (!popup) {
13471
+ + NSURL *url = [NSURL _webkit_URLWithUserTypedString:_initialURL ? _initialURL : @"about:blank"];
13472
+ + _initialURL = nil;
13473
+ + [webView loadRequest:[NSURLRequest requestWithURL:url]];
13474
+ + }
13473
13475
+ [_headlessWindows addObject:window];
13474
13476
+ webView.UIDelegate = self;
13475
13477
+ return [webView autorelease];
@@ -13478,7 +13480,7 @@ index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bc
13478
13480
+- (WKWebView *)createHeadlessPage:(uint64_t)sessionID
13479
13481
+{
13480
13482
+ WKWebViewConfiguration *configuration = [self sessionConfiguration:sessionID];
13481
- + return [self createHeadlessWebView:configuration];
13483
+ + return [self createHeadlessWebView:configuration forPopup:NO ];
13482
13484
+}
13483
13485
+
13484
13486
+- (_WKBrowserContext *)createBrowserContext
@@ -13575,7 +13577,7 @@ index 0000000000000000000000000000000000000000..84e0cd9c2d20111e936e4b16519d20bc
13575
13577
+
13576
13578
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
13577
13579
+{
13578
- + return [self createHeadlessWebView:configuration];
13580
+ + return [self createHeadlessWebView:configuration forPopup:YES ];
13579
13581
+}
13580
13582
+
13581
13583
+@end
@@ -13792,10 +13794,10 @@ index 0000000000000000000000000000000000000000..4dbf13c8fb31a745ae8e1965a457d4fb
13792
13794
+@end
13793
13795
diff --git a/Tools/Playwright/mac/BrowserWindowController.m b/Tools/Playwright/mac/BrowserWindowController.m
13794
13796
new file mode 100644
13795
- index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881ddbc19bb45
13797
+ index 0000000000000000000000000000000000000000..033c4fcda83002cda5d069205d4f605d02f1e1f5
13796
13798
--- /dev/null
13797
13799
+++ b/Tools/Playwright/mac/BrowserWindowController.m
13798
- @@ -0,0 +1,834 @@
13800
+ @@ -0,0 +1,826 @@
13799
13801
+/*
13800
13802
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
13801
13803
+ *
@@ -13946,8 +13948,6 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
13946
13948
+
13947
13949
+- (void)awakeFromNib
13948
13950
+{
13949
- + self.window.styleMask &= ~NSWindowStyleMaskFullSizeContentView;
13950
- +
13951
13951
+ _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:_configuration];
13952
13952
+ _webView._windowOcclusionDetectionEnabled = NO;
13953
13953
+
@@ -13994,13 +13994,14 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
13994
13994
+ return nil;
13995
13995
+ _configuration = [configuration copy];
13996
13996
+ _isPrivateBrowsingWindow = !_configuration.websiteDataStore.isPersistent;
13997
+ + self.window.styleMask &= ~NSWindowStyleMaskFullSizeContentView;
13997
13998
+ return self;
13998
13999
+}
13999
14000
+
14000
14001
+- (void)dealloc
14001
14002
+{
14002
14003
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
14003
- +
14004
+ +
14004
14005
+ [progressIndicator unbind:NSHiddenBinding];
14005
14006
+ [progressIndicator unbind:NSValueBinding];
14006
14007
+
@@ -14079,7 +14080,7 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14079
14080
+ return [self canZoomOut];
14080
14081
+ if (action == @selector(resetZoom:))
14081
14082
+ return [self canResetZoom];
14082
- +
14083
+ +
14083
14084
+ if (action == @selector(toggleZoomMode:))
14084
14085
+ [menuItem setState:_zoomTextOnly ? NSControlStateValueOn : NSControlStateValueOff];
14085
14086
+ else if (action == @selector(showHideWebInspector:))
@@ -14258,7 +14259,6 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14258
14259
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
14259
14260
+{
14260
14261
+ BrowserWindowController *controller = [[BrowserWindowController alloc] initWithConfiguration:configuration];
14261
- + [controller awakeFromNib];
14262
14262
+ [controller.window makeKeyAndOrderFront:self];
14263
14263
+
14264
14264
+ return controller->_webView;
@@ -14286,7 +14286,7 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14286
14286
+
14287
14287
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript confirm dialog from %@.", [frame.request.URL absoluteString]]];
14288
14288
+ [alert setInformativeText:message];
14289
- +
14289
+ +
14290
14290
+ [alert addButtonWithTitle:@"OK"];
14291
14291
+ [alert addButtonWithTitle:@"Cancel"];
14292
14292
+
@@ -14304,14 +14304,14 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14304
14304
+
14305
14305
+ [alert setMessageText:[NSString stringWithFormat:@"JavaScript prompt dialog from %@.", [frame.request.URL absoluteString]]];
14306
14306
+ [alert setInformativeText:prompt];
14307
- +
14307
+ +
14308
14308
+ [alert addButtonWithTitle:@"OK"];
14309
14309
+ [alert addButtonWithTitle:@"Cancel"];
14310
- +
14310
+ +
14311
14311
+ NSTextField* input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)];
14312
14312
+ [input setStringValue:defaultText];
14313
14313
+ [alert setAccessoryView:input];
14314
- +
14314
+ +
14315
14315
+ _alert = alert;
14316
14316
+ [alert beginSheetModalForWindow:self.window completionHandler:^void (NSModalResponse response) {
14317
14317
+ [input validateEditing];
@@ -14438,12 +14438,6 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14438
14438
+ decisionHandler(WKNavigationActionPolicyAllow);
14439
14439
+ return;
14440
14440
+ }
14441
- +
14442
- + if (navigationAction._userInitiatedAction && !navigationAction._userInitiatedAction.isConsumed) {
14443
- + [navigationAction._userInitiatedAction consume];
14444
- + [[NSWorkspace sharedWorkspace] openURL:navigationAction.request.URL];
14445
- + }
14446
- +
14447
14441
+ decisionHandler(WKNavigationActionPolicyCancel);
14448
14442
+}
14449
14443
+
@@ -14487,7 +14481,7 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14487
14481
+ NSView *container = [[[NSView alloc] initWithFrame:NSMakeRect(0, 0, 200, 48)] autorelease];
14488
14482
+ NSTextField *userInput = [[[NSTextField alloc] initWithFrame:NSMakeRect(0, 24, 200, 24)] autorelease];
14489
14483
+ NSTextField *passwordInput = [[[NSSecureTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 24)] autorelease];
14490
- +
14484
+ +
14491
14485
+ [alert setMessageText:[NSString stringWithFormat:@"Log in to %@:%lu.", challenge.protectionSpace.host, challenge.protectionSpace.port]];
14492
14486
+ [alert addButtonWithTitle:@"Log in"];
14493
14487
+ [alert addButtonWithTitle:@"Cancel"];
@@ -14496,7 +14490,7 @@ index 0000000000000000000000000000000000000000..7a745879d076017df30afd77ded881dd
14496
14490
+ [alert setAccessoryView:container];
14497
14491
+ [userInput setNextKeyView:passwordInput];
14498
14492
+ [alert.window setInitialFirstResponder:userInput];
14499
- +
14493
+ +
14500
14494
+ [alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse response) {
14501
14495
+ [userInput validateEditing];
14502
14496
+ if (response == NSAlertFirstButtonReturn)
0 commit comments