Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fea5366

Browse filesBrowse files
committed
Make sure we are no longer show the previous page when running a JS prompt
https://bugs.webkit.org/show_bug.cgi?id=215782 <rdar://problem/67698601> Reviewed by Simon Fraser. Source/WebCore: Add linked-on-after check for the behavior change to minimize the risk of breakage. * platform/cocoa/VersionChecks.h: Source/WebKit: Make sure we are no longer show the previous page when running a JS prompt. If we have not yet done a layer tree commit since the last load commit, then we are likely still showing the previous page. If we are asked to run a JS prompt / alert / confirm at this point, it would be confusing to still show the previous page. In order to address the issue, we now make the view blank in such scenario (ideally, we'd have painted the new page but this is currently not a trivial thing to do). To make the view blank, the approach chosen was to add a blank overlay view on top of the content. This overlay view gets taken down as soon as we paint the view again. * SourcesCocoa.txt: * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _hasBlankOverlay]): (-[WKWebView _setHasBlankOverlay:]): * UIProcess/API/Cocoa/WKWebViewInternal.h: * UIProcess/API/Cocoa/WKWebViewPrivate.h: * UIProcess/Cocoa/PageClientImplCocoa.h: * UIProcess/Cocoa/PageClientImplCocoa.mm: (WebKit::PageClientImplCocoa::setHasBlankOverlay): * UIProcess/Cocoa/WKBlankOverlayView.h: Added. * UIProcess/Cocoa/WKBlankOverlayView.mm: Added. (-[WKBlankOverlayView initWithFrame:]): * UIProcess/PageClient.h: (WebKit::PageClient::setHasBlankOverlay): * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate): * UIProcess/WebPageProxy.h: * UIProcess/WebPageProxy.messages.in: * UIProcess/ios/WebPageProxyIOS.mm: (WebKit::WebPageProxy::didCommitLayerTree): * UIProcess/mac/WebPageProxyMac.mm: (WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad): * WebKit.xcodeproj/project.pbxproj: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: (WebKit::TiledCoreAnimationDrawingArea::updateRendering): * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::didUpdateRendering): Canonical link: https://commits.webkit.org/236096@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275434 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 54c27eb commit fea5366
Copy full SHA for fea5366

22 files changed

+281-5Lines changed: 281 additions & 5 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Source/WebCore/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/WebCore/ChangeLog
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2021-04-02 Chris Dumez <cdumez@apple.com>
2+
3+
Make sure we are no longer show the previous page when running a JS prompt
4+
https://bugs.webkit.org/show_bug.cgi?id=215782
5+
<rdar://problem/67698601>
6+
7+
Reviewed by Simon Fraser.
8+
9+
Add linked-on-after check for the behavior change to minimize the risk of
10+
breakage.
11+
12+
* platform/cocoa/VersionChecks.h:
13+
114
2021-04-02 Devin Rousso <drousso@apple.com>
215

316
[iPadOS] unable to reorder tabs on `*.mybinder.org`
Collapse file

‎Source/WebCore/platform/cocoa/VersionChecks.h‎

Copy file name to clipboardExpand all lines: Source/WebCore/platform/cocoa/VersionChecks.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ enum class SDKVersion : uint32_t {
7171
FirstWithoutWeChatScrollingQuirk = DYLD_IOS_VERSION_14_5,
7272
FirstWithDOMWindowReuseRestriction = DYLD_IOS_VERSION_14_5,
7373
FirstWithSharedNetworkProcess = DYLD_IOS_VERSION_14_5,
74+
FirstWithBlankViewOnJSPrompt = DYLD_IOS_VERSION_14_5,
7475
#elif PLATFORM(MAC)
7576
FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
7677
FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
@@ -92,6 +93,7 @@ enum class SDKVersion : uint32_t {
9293
FirstWithHTMLDocumentSupportedPropertyNames = DYLD_MACOSX_VERSION_11_3,
9394
FirstWithNullOriginForNonSpecialSchemedURLs = DYLD_MACOSX_VERSION_12_00,
9495
FirstWithDOMWindowReuseRestriction = DYLD_MACOSX_VERSION_11_3,
96+
FirstWithBlankViewOnJSPrompt = DYLD_MACOSX_VERSION_11_3,
9597
#endif
9698
};
9799

Collapse file

‎Source/WebKit/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/WebKit/ChangeLog
+51Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
1+
2021-04-02 Chris Dumez <cdumez@apple.com>
2+
3+
Make sure we are no longer show the previous page when running a JS prompt
4+
https://bugs.webkit.org/show_bug.cgi?id=215782
5+
<rdar://problem/67698601>
6+
7+
Reviewed by Simon Fraser.
8+
9+
Make sure we are no longer show the previous page when running a JS prompt.
10+
If we have not yet done a layer tree commit since the last load commit, then
11+
we are likely still showing the previous page. If we are asked to run a JS
12+
prompt / alert / confirm at this point, it would be confusing to still show
13+
the previous page. In order to address the issue, we now make the view blank
14+
in such scenario (ideally, we'd have painted the new page but this is
15+
currently not a trivial thing to do).
16+
17+
To make the view blank, the approach chosen was to add a blank overlay view
18+
on top of the content. This overlay view gets taken down as soon as we
19+
paint the view again.
20+
21+
* SourcesCocoa.txt:
22+
* UIProcess/API/Cocoa/WKWebView.mm:
23+
(-[WKWebView _hasBlankOverlay]):
24+
(-[WKWebView _setHasBlankOverlay:]):
25+
* UIProcess/API/Cocoa/WKWebViewInternal.h:
26+
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
27+
* UIProcess/Cocoa/PageClientImplCocoa.h:
28+
* UIProcess/Cocoa/PageClientImplCocoa.mm:
29+
(WebKit::PageClientImplCocoa::setHasBlankOverlay):
30+
* UIProcess/Cocoa/WKBlankOverlayView.h: Added.
31+
* UIProcess/Cocoa/WKBlankOverlayView.mm: Added.
32+
(-[WKBlankOverlayView initWithFrame:]):
33+
* UIProcess/PageClient.h:
34+
(WebKit::PageClient::setHasBlankOverlay):
35+
* UIProcess/WebPageProxy.cpp:
36+
(WebKit::WebPageProxy::stopMakingViewBlankDueToLackOfRenderingUpdate):
37+
* UIProcess/WebPageProxy.h:
38+
* UIProcess/WebPageProxy.messages.in:
39+
* UIProcess/ios/WebPageProxyIOS.mm:
40+
(WebKit::WebPageProxy::didCommitLayerTree):
41+
* UIProcess/mac/WebPageProxyMac.mm:
42+
(WebKit::WebPageProxy::didUpdateRenderingAfterCommittingLoad):
43+
* WebKit.xcodeproj/project.pbxproj:
44+
* WebProcess/WebPage/WebPage.cpp:
45+
(WebKit::WebPage::didCommitLoad):
46+
* WebProcess/WebPage/WebPage.h:
47+
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
48+
(WebKit::TiledCoreAnimationDrawingArea::updateRendering):
49+
* WebProcess/WebPage/mac/WebPageMac.mm:
50+
(WebKit::WebPage::didUpdateRendering):
51+
152
2021-04-02 Per Arne <pvollan@apple.com>
253

354
Add IOKit method filter telemetry
Collapse file

‎Source/WebKit/SourcesCocoa.txt‎

Copy file name to clipboardExpand all lines: Source/WebKit/SourcesCocoa.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ UIProcess/Cocoa/WebProcessPoolCocoa.mm
413413
UIProcess/Cocoa/WebProcessProxyCocoa.mm
414414
UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm
415415
UIProcess/Cocoa/WebViewImpl.mm
416+
UIProcess/Cocoa/WKBlankOverlayView.mm
416417
UIProcess/Cocoa/WKContactPicker.mm
417418
UIProcess/Cocoa/WKEditCommand.mm
418419
UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm
Collapse file

‎Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm‎

Copy file name to clipboardExpand all lines: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,26 @@ - (void)_didInvalidateDataForAttachment:(API::Attachment&)attachment
14551455

14561456
#endif // ENABLE(ATTACHMENT_ELEMENT)
14571457

1458+
- (BOOL)_hasBlankOverlay
1459+
{
1460+
return !!_blankOverlayView;
1461+
}
1462+
1463+
- (void)_setHasBlankOverlay:(BOOL)hasBlankOverlay
1464+
{
1465+
if (!!_blankOverlayView == hasBlankOverlay)
1466+
return;
1467+
1468+
if (hasBlankOverlay) {
1469+
auto backgroundColor = _page->backgroundColor().valueOr(WebCore::Color::white);
1470+
_blankOverlayView = adoptNS([[WKBlankOverlayView alloc] initWithFrame:[self bounds] color:platformColor(backgroundColor)]);
1471+
[self addSubview:_blankOverlayView.get()];
1472+
} else {
1473+
[_blankOverlayView removeFromSuperview];
1474+
_blankOverlayView = nullptr;
1475+
}
1476+
}
1477+
14581478
- (id <_WKAppHighlightDelegate>)_appHighlightDelegate
14591479
{
14601480
#if ENABLE(APP_HIGHLIGHTS)
Collapse file

‎Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h‎

Copy file name to clipboardExpand all lines: Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#import "PDFPluginIdentifier.h"
2727
#import "SameDocumentNavigationType.h"
28+
#import "WKBlankOverlayView.h"
2829
#import "WKShareSheet.h"
2930
#import "WKWebViewConfiguration.h"
3031
#import "WKWebViewPrivate.h"
@@ -132,6 +133,8 @@ class ViewGestureController;
132133
_WKRenderingProgressEvents _observedRenderingProgressEvents;
133134
BOOL _usePlatformFindUI;
134135

136+
RetainPtr<WKBlankOverlayView> _blankOverlayView;
137+
135138
#if PLATFORM(MAC)
136139
std::unique_ptr<WebKit::WebViewImpl> _impl;
137140
RetainPtr<WKTextFinderClient> _textFinderClient;
Collapse file

‎Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h‎

Copy file name to clipboardExpand all lines: Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ for this property.
366366
- (void)_didEnableBrowserExtensions:(NSDictionary<NSString *, NSString *> *)extensionIDToNameMap WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
367367
- (void)_didDisableBrowserExtensions:(NSSet<NSString *> *)extensionIDs WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
368368

369+
@property (nonatomic, setter=_setHasBlankOverlay:) BOOL _hasBlankOverlay WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
370+
369371
@property (nonatomic, weak, setter=_setAppHighlightDelegate:) id <_WKAppHighlightDelegate> _appHighlightDelegate WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
370372
- (void)_restoreAppHighlights:(NSArray<NSData *> *)data WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
371373
- (void)_addAppHighlight WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
Collapse file

‎Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h‎

Copy file name to clipboardExpand all lines: Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class PageClientImplCocoa : public PageClient {
6060

6161
bool scrollingUpdatesDisabledForTesting() final;
6262

63+
void setHasBlankOverlay(bool) final;
64+
6365
#if ENABLE(ATTACHMENT_ELEMENT)
6466
void didInsertAttachment(API::Attachment&, const String& source) final;
6567
void didRemoveAttachment(API::Attachment&) final;
Collapse file

‎Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm‎

Copy file name to clipboardExpand all lines: Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#import "WKWebViewConfigurationPrivate.h"
3030
#import "WKWebViewInternal.h"
31+
#import "WKWebViewPrivate.h"
3132
#import "WKWebViewPrivateForTesting.h"
3233
#import <WebCore/AlternativeTextUIController.h>
3334
#import <wtf/Vector.h>
@@ -79,6 +80,11 @@
7980
return [m_webView _scrollingUpdatesDisabledForTesting];
8081
}
8182

83+
void PageClientImplCocoa::setHasBlankOverlay(bool hasBlankOverlay)
84+
{
85+
[m_webView _setHasBlankOverlay:hasBlankOverlay];
86+
}
87+
8288
#if ENABLE(ATTACHMENT_ELEMENT)
8389

8490
void PageClientImplCocoa::didInsertAttachment(API::Attachment& attachment, const String& source)
Collapse file
+46Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (C) 2021 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#if PLATFORM(MAC)
29+
#import <AppKit/AppKit.h>
30+
31+
using ColorType = NSColor;
32+
using ViewType = NSView;
33+
using RectType = NSRect;
34+
#else
35+
#import <UIKit/UIKit.h>
36+
37+
using ColorType = UIColor;
38+
using ViewType = UIView;
39+
using RectType = CGRect;
40+
#endif
41+
42+
@interface WKBlankOverlayView : ViewType
43+
44+
- (instancetype)initWithFrame:(RectType)frame color:(ColorType*)color;
45+
46+
@end

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.