Title: [249240] branches/safari-608-branch
- Revision
- 249240
- Author
- [email protected]
- Date
- 2019-08-28 22:57:14 -0700 (Wed, 28 Aug 2019)
Log Message
Cherry-pick r249224. rdar://problem/54819205
Null check webFrame when creating a print preview to prevent a crash.
https://bugs.webkit.org/show_bug.cgi?id=201237
<rdar://problem/51618863>
Reviewed by Tim Horton.
Source/WebKit:
Move and expend a null check to keep from crashing when making a print preview.
* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _drawPreview:]):
(-[WKPrintingView drawRect:]):
Tools:
Test to verify that if we don't have the WebPageProxy, we will not crash when making a print preview.
* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (249239 => 249240)
--- branches/safari-608-branch/Source/WebKit/ChangeLog 2019-08-29 05:57:12 UTC (rev 249239)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog 2019-08-29 05:57:14 UTC (rev 249240)
@@ -1,3 +1,45 @@
+2019-08-28 Kocsen Chung <[email protected]>
+
+ Cherry-pick r249224. rdar://problem/54819205
+
+ Null check webFrame when creating a print preview to prevent a crash.
+ https://bugs.webkit.org/show_bug.cgi?id=201237
+ <rdar://problem/51618863>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Move and expend a null check to keep from crashing when making a print preview.
+
+ * UIProcess/mac/WKPrintingView.mm:
+ (-[WKPrintingView _drawPreview:]):
+ (-[WKPrintingView drawRect:]):
+
+ Tools:
+
+ Test to verify that if we don't have the WebPageProxy, we will not crash when making a print preview.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-28 Megan Gardner <[email protected]>
+
+ Null check webFrame when creating a print preview to prevent a crash.
+ https://bugs.webkit.org/show_bug.cgi?id=201237
+ <rdar://problem/51618863>
+
+ Reviewed by Tim Horton.
+
+ Move and expend a null check to keep from crashing when making a print preview.
+
+ * UIProcess/mac/WKPrintingView.mm:
+ (-[WKPrintingView _drawPreview:]):
+ (-[WKPrintingView drawRect:]):
+
2019-08-27 Alan Coon <[email protected]>
Revert r249147. rdar://problem/54751753
Modified: branches/safari-608-branch/Source/WebKit/UIProcess/mac/WKPrintingView.mm (249239 => 249240)
--- branches/safari-608-branch/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2019-08-29 05:57:12 UTC (rev 249239)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2019-08-29 05:57:14 UTC (rev 249240)
@@ -504,6 +504,9 @@
- (void)_drawPreview:(NSRect)nsRect
{
ASSERT(RunLoop::isMain());
+
+ if (!_webFrame || !_webFrame->page())
+ return;
WebCore::IntRect scaledPrintingRect(nsRect);
scaledPrintingRect.scale(1 / _totalScaleFactorForPrinting);
@@ -519,9 +522,6 @@
_latestExpectedPreviewCallback = existingCallback;
} else {
// Preview isn't available yet, request it asynchronously.
- if (!_webFrame->page())
- return;
-
// Return to printing mode if we're already back to screen (e.g. due to window resizing).
_webFrame->page()->beginPrinting(_webFrame.get(), WebKit::PrintInfo([_printOperation printInfo]));
Modified: branches/safari-608-branch/Tools/ChangeLog (249239 => 249240)
--- branches/safari-608-branch/Tools/ChangeLog 2019-08-29 05:57:12 UTC (rev 249239)
+++ branches/safari-608-branch/Tools/ChangeLog 2019-08-29 05:57:14 UTC (rev 249240)
@@ -1,3 +1,44 @@
+2019-08-28 Kocsen Chung <[email protected]>
+
+ Cherry-pick r249224. rdar://problem/54819205
+
+ Null check webFrame when creating a print preview to prevent a crash.
+ https://bugs.webkit.org/show_bug.cgi?id=201237
+ <rdar://problem/51618863>
+
+ Reviewed by Tim Horton.
+
+ Source/WebKit:
+
+ Move and expend a null check to keep from crashing when making a print preview.
+
+ * UIProcess/mac/WKPrintingView.mm:
+ (-[WKPrintingView _drawPreview:]):
+ (-[WKPrintingView drawRect:]):
+
+ Tools:
+
+ Test to verify that if we don't have the WebPageProxy, we will not crash when making a print preview.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (TEST):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-08-28 Megan Gardner <[email protected]>
+
+ Null check webFrame when creating a print preview to prevent a crash.
+ https://bugs.webkit.org/show_bug.cgi?id=201237
+ <rdar://problem/51618863>
+
+ Reviewed by Tim Horton.
+
+ Test to verify that if we don't have the WebPageProxy, we will not crash when making a print preview.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (TEST):
+
2019-08-18 Babak Shafiei <[email protected]>
Cherry-pick r248823. rdar://problem/54454713
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (249239 => 249240)
--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2019-08-29 05:57:12 UTC (rev 249239)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2019-08-29 05:57:14 UTC (rev 249240)
@@ -427,6 +427,21 @@
TestWebKitAPI::Util::run(&drawFooterCalled);
}
+TEST(WebKit, PrintPreview)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+ auto delegate = adoptNS([[PrintDelegate alloc] init]);
+ [webView setUIDelegate:delegate.get()];
+ [webView loadHTMLString:@"<head><title>test_title</title></head><body _onload_='print()'>hello world!</body>" baseURL:[NSURL URLWithString:@"http://example.com/"]];
+ TestWebKitAPI::Util::run(&done);
+
+ NSPrintOperation *operation = [webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]];
+ NSPrintOperation.currentOperation = operation;
+ auto previewView = [operation view];
+ [webView _close];
+ [previewView drawRect:CGRectMake(0, 0, 10, 10)];
+}
+
@interface NotificationDelegate : NSObject <WKUIDelegatePrivate> {
bool _allowNotifications;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes