Unreviewed, rolling out r239524.
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-02  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r239524.
4         https://bugs.webkit.org/show_bug.cgi?id=193083
5
6         basic browsing seems not to work (Requested by thorton on
7         #webkit).
8
9         Reverted changeset:
10
11         "Expand use of sourceApplicationAuditData"
12         https://bugs.webkit.org/show_bug.cgi?id=192995
13         https://trac.webkit.org/changeset/239524
14
15 2019-01-01  Jeff Miller  <jeffm@apple.com>
16
17         Update user-visible copyright strings to include 2019
18         https://bugs.webkit.org/show_bug.cgi?id=192811
19
20         Reviewed by Mark Lam.
21
22         * Info.plist:
23         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
24         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
25         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
26         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
27         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
28
29 2018-12-28  Wenson Hsieh  <wenson_hsieh@apple.com>
30
31         Move WKEditCommandObjC and WKEditorUndoTargetObjC into a separate file
32         https://bugs.webkit.org/show_bug.cgi?id=193049
33
34         Reviewed by Sam Weinig.
35
36         Pull common code (WKEditCommandObjC and WKEditorUndoTargetObjC) on iOS and macOS out into a separate file. No
37         change in behavior.
38
39         * SourcesCocoa.txt:
40         * UIProcess/Cocoa/WKEditCommand.h: Added.
41         * UIProcess/Cocoa/WKEditCommand.mm: Added.
42
43         Rename WKEditCommandObjC to WKEditCommand, and WKEditorUndoTargetObjC to WKEditorUndoTarget. The ObjC suffix in
44         the name seems to diverge from the common naming scheme in other parts of WebKit, where most WK- and _WK-
45         prefixed names already refer to Objective-C objects. Additionally, mark -[WKEditCommand init] as unavailable.
46
47         (-[WKEditCommand initWithWebEditCommandProxy:]):
48
49         Make the return type instancetype instead of id, and also make this take a Ref<WebEditCommandProxy>&& instead
50         of a RefPtr.
51
52         (-[WKEditCommand command]):
53
54         Make this return a reference to the WebEditCommandProxy, rather than a pointer, since the WebEditCommandProxy
55         should always be non-null.
56
57         (-[WKEditorUndoTarget undoEditing:]):
58         (-[WKEditorUndoTarget redoEditing:]):
59         * UIProcess/Cocoa/WebViewImpl.h:
60         * UIProcess/Cocoa/WebViewImpl.mm:
61         (WebKit::WebViewImpl::WebViewImpl):
62         (WebKit::WebViewImpl::registerEditCommand):
63
64         Use WTFMove instead of copying the Ref when creating a WKEditCommand.
65
66         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
67         (-[WKEditCommandObjC command]): Deleted.
68         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
69         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
70         * UIProcess/ios/PageClientImplIOS.h:
71         * UIProcess/ios/PageClientImplIOS.mm:
72         (WebKit::PageClientImpl::PageClientImpl):
73         (WebKit::PageClientImpl::registerEditCommand):
74
75         Use WTFMove instead of creating a new RefPtr when creating a WKEditCommand.
76
77         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
78         (-[WKEditCommandObjC command]): Deleted.
79         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
80         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
81         * UIProcess/mac/PageClientImplMac.h:
82         * WebKit.xcodeproj/project.pbxproj:
83
84 2018-12-27  Alex Christensen  <achristensen@webkit.org>
85
86         Resurrect Mac CMake build
87         https://bugs.webkit.org/show_bug.cgi?id=192658
88
89         Reviewed by Yusuke Suzuki.
90
91         * PlatformMac.cmake:
92
93 2018-12-26  Fujii Hironori  <Hironori.Fujii@sony.com>
94
95         [MSVC] error C2381: 'WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker': redefinition; '__declspec(noreturn)' or '[[noreturn]]' differs
96         https://bugs.webkit.org/show_bug.cgi?id=193030
97
98         Reviewed by Ross Kirsling.
99
100         Windows Debug builds are failing to compile due to
101         NO_RETURN_DUE_TO_ASSERT inconsistency of
102         NetworkHTTPSUpgradeChecker destructor's definition and
103         declaration.
104
105         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added
106         NO_RETURN_DUE_TO_ASSERT to NetworkHTTPSUpgradeChecker destructor
107         declaration.
108         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Removed
109         NO_RETURN_DUE_TO_ASSERT from the definition.
110
111 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
112
113         [WebKit][Win] Remove using namespace in the global scope
114         https://bugs.webkit.org/show_bug.cgi?id=192968
115
116         Reviewed by Alex Christensen.
117
118         Moved using namespace statements in the global scope to inside
119         namespaces.
120         <https://webkit.org/code-style-guidelines/#using-position>
121
122         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
123         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
124         * NetworkProcess/curl/NetworkProcessCurl.cpp:
125         * NetworkProcess/curl/NetworkSessionCurl.cpp:
126         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
127         * Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp:
128         * Shared/WebWheelEvent.cpp:
129         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
130         * Shared/win/NativeWebKeyboardEventWin.cpp:
131         * Shared/win/WebEventFactory.cpp:
132         * UIProcess/Automation/WebAutomationSession.cpp:
133
134 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
135
136         Remove "using namespace std;"
137         https://bugs.webkit.org/show_bug.cgi?id=192973
138
139         Reviewed by Alex Christensen.
140
141         * Platform/IPC/win/ConnectionWin.cpp:
142
143 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
144
145         Change ScrollingNodeType to an enum class
146         https://bugs.webkit.org/show_bug.cgi?id=193009
147
148         Reviewed by Zalan Bujtas.
149
150         Change the ScrollingNodeType enum to an enum class.
151         
152         No behavior change.
153
154         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
155         (WebKit::encodeNodeAndDescendants):
156         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
157         (WebKit::dump):
158         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
159         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
160         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
161         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
162         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
163         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
164         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
165         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
166
167 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
168
169         [iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546>
170         https://bugs.webkit.org/show_bug.cgi?id=193019
171
172         Reviewed by Dan Bernstein.
173
174         Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
175         of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
176         we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
177         through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
178         changes to WKWebViewPrivate.h.
179
180         * UIProcess/API/Cocoa/WKWebView.mm:
181         (-[WKWebView canPerformAction:withSender:]):
182         (-[WKWebView targetForAction:withSender:]):
183         (-[WKWebView _setFont:sender:]):
184         (-[WKWebView _setFontSize:sender:]):
185         (-[WKWebView _setTextColor:sender:]):
186         (-[WKWebView setFont:sender:]): Deleted.
187         (-[WKWebView setTextColor:sender:]): Deleted.
188         (-[WKWebView setFontSize:sender:]): Deleted.
189         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
190         * UIProcess/ios/WKContentViewInteraction.h:
191         * UIProcess/ios/WKContentViewInteraction.mm:
192         (-[WKContentView canPerformActionForWebView:withSender:]):
193         (-[WKContentView setFontForWebView:sender:]): Deleted.
194         (-[WKContentView setFontSizeForWebView:sender:]): Deleted.
195         (-[WKContentView setTextColorForWebView:sender:]): Deleted.
196
197 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
198
199         Fix fast/ruby/ruby-base-merge-block-children-crash-2.html after r239543
200         https://bugs.webkit.org/show_bug.cgi?id=193015
201         <rdar://problem/46583527>
202
203         Reviewed by Tim Horton.
204
205         Fix the crash by gracefully handling integer overflow when computing the area of a very large editable element.
206
207         * UIProcess/ios/WKContentViewInteraction.mm:
208         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
209         (-[WKContentView _updateChangedSelection:]):
210
211 2018-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
212
213         [iOS] Suppress native selection behaviors when focusing a very small editable element
214         https://bugs.webkit.org/show_bug.cgi?id=193005
215         <rdar://problem/46583527>
216
217         Reviewed by Tim Horton.
218
219         In r238146, I added a mechanism to detect when the selection is hidden within transparent editable elements, and
220         used this to suppress native selection on iOS (such as selection handles, highlight, callout bar, etc.) to avoid
221         conflicts between the page's editing UI and the platform.
222
223         However, one additional technique observed on some websites involves hiding the selection by moving it into a
224         tiny (1x1) editable element. Here, we currently still present a callout bar with editing actions, as well as
225         show a selection caret or handles on iOS. To fix this, we extend the mechanism added in r238146 by also
226         suppressing the selection assistant in the case where the editable element's area is beneath a tiny minimum
227         threshold.
228
229         Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html
230
231         * Shared/EditorState.cpp:
232         (WebKit::EditorState::PostLayoutData::encode const):
233         (WebKit::EditorState::PostLayoutData::decode):
234         (WebKit::operator<<):
235         * Shared/EditorState.h:
236
237         Rename selectionClipRect to focusedElementRect. We currently propagate the bounds of the focused element to the
238         UI process through EditorState updates, but only for the purpose of returning it in the computed selection clip
239         rect; instead, rename this member to something more general-purpose, so we can also use it when determining
240         whether to suppress the selection assistant.
241
242         * UIProcess/API/Cocoa/WKWebView.mm:
243         (-[WKWebView _candidateRect]):
244         * UIProcess/Cocoa/WebViewImpl.mm:
245         (WebKit::WebViewImpl::handleRequestedCandidates):
246         * UIProcess/ios/WKContentViewInteraction.h:
247
248         Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny editable elements.
249
250         * UIProcess/ios/WKContentViewInteraction.mm:
251         (-[WKContentView _zoomToRevealFocusedElement]):
252         (-[WKContentView _selectionClipRect]):
253         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
254         (-[WKContentView _updateChangedSelection:]):
255
256         Check the size of the focused element, and begin or stop suppressing the selection assistant accordingly.
257
258         * WebProcess/WebPage/ios/WebPageIOS.mm:
259         (WebKit::WebPage::platformEditorState const):
260         * WebProcess/WebPage/mac/WebPageMac.mm:
261         (WebKit::WebPage::platformEditorState const):
262
263 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
264
265         Use Ref<> as much as possible
266         https://bugs.webkit.org/show_bug.cgi?id=192808
267
268         Reviewed by Alex Christensen.
269
270         * PluginProcess/WebProcessConnection.cpp:
271         (WebKit::WebProcessConnection::create):
272         * PluginProcess/WebProcessConnection.h:
273         * UIProcess/API/Cocoa/WKConnection.mm:
274         (-[WKConnection sendMessageWithName:body:]):
275         * UIProcess/API/Cocoa/WKWebView.mm:
276         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
277         (-[WKWebView _takeViewSnapshot]):
278         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
279         * UIProcess/API/glib/WebKitGeolocationProvider.cpp:
280         (WebKit::WebKitGeolocationProvider::notifyPositionChanged):
281         * UIProcess/API/glib/WebKitWebContext.cpp:
282         (webkit_web_context_allow_tls_certificate_for_host):
283         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
284         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
285         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
286         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
287         * UIProcess/BackingStore.cpp:
288         (WebKit::BackingStore::incorporateUpdate):
289         * UIProcess/Cocoa/NavigationState.mm:
290         (WebKit::createErrorWithRecoveryAttempter):
291         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
292         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
293         (WebKit::PlaybackSessionManagerProxy::create):
294         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
295         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
296         (WebKit::VideoFullscreenManagerProxy::create):
297         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
298         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
299         * UIProcess/Cocoa/WebViewImpl.mm:
300         (WebKit::WebViewImpl::takeViewSnapshot):
301         * UIProcess/Downloads/DownloadProxyMap.cpp:
302         (WebKit::DownloadProxyMap::createDownloadProxy):
303         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
304         (WebKit::WebNotificationManagerProxy::show):
305         * UIProcess/WebPageProxy.cpp:
306         (WebKit::WebPageProxy::didCreateSubframe):
307         * UIProcess/WebProcessPool.cpp:
308         (WebKit::WebProcessPool::getStatistics):
309         (WebKit::WebProcessPool::requestWebContentStatistics):
310         (WebKit::WebProcessPool::requestNetworkingStatistics):
311         * UIProcess/WebProcessPool.h:
312         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
313         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
314         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
315         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
316         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
317         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
318         * UIProcess/ios/WKGeolocationProviderIOS.mm:
319         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
320         * UIProcess/mac/PageClientImplMac.mm:
321         (WebKit::PageClientImpl::setPromisedDataForImage):
322         * UIProcess/win/WebInspectorProxyWin.cpp:
323         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
324         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
325         (-[WKDOMRange initWithDocument:]):
326         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
327         (WebKit::InjectedBundleRangeHandle::renderedImage):
328         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
329         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
330         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
331         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
332         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
333         (WebKit::NetscapePlugin::snapshot):
334         * WebProcess/Plugins/PDF/PDFPlugin.mm:
335         (WebKit::PDFPlugin::addArchiveResource):
336         (WebKit::PDFPlugin::snapshot):
337         (WebKit::PDFPlugin::writeItemsToPasteboard):
338         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
339         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
340         * WebProcess/Plugins/PluginProxy.cpp:
341         (WebKit::PluginProxy::snapshot):
342         * WebProcess/Plugins/PluginView.cpp:
343         (WebKit::PluginView::performURLRequest):
344         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
345         (WebKit::WebChromeClient::exceededDatabaseQuota):
346         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
347         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
348         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
349         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
350         (WebKit::WebPlatformStrategies::getPathnamesForType):
351         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
352         (WebKit::convertCairoSurfaceToShareableBitmap):
353         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
354         (WebKit::WebDragClient::declareAndWriteDragImage):
355         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
356         (WebKit::WebPage::dictionaryPopupInfoForRange):
357         * WebProcess/WebPage/DrawingAreaImpl.cpp:
358         (WebKit::DrawingAreaImpl::display):
359         * WebProcess/WebPage/FindController.cpp:
360         (WebKit::FindController::updateFindIndicator):
361         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
362         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
363         * WebProcess/WebPage/WebFrame.cpp:
364         (WebKit::WebFrame::webArchiveData):
365         * WebProcess/WebPage/WebPage.cpp:
366         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
367         (WebKit::WebPage::performDragControllerAction):
368         * WebProcess/WebPage/ios/FindControllerIOS.mm:
369         (WebKit::FindController::updateFindIndicator):
370         * WebProcess/WebPage/ios/WebPageIOS.mm:
371         (WebKit::WebPage::replaceDictatedText):
372         (WebKit::WebPage::getPositionInformation):
373         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
374         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
375         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
376         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
377         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
378         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
379         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
380         (WebKit::StorageNamespaceImpl::storageArea):
381         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
382         (WebKit::StorageNamespaceImpl::copy):
383         * WebProcess/WebStorage/StorageNamespaceImpl.h:
384         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
385         (WebKit::WebStorageNamespaceProvider::getOrCreate):
386         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
387         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
388         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
389         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
390         * WebProcess/WebStorage/WebStorageNamespaceProvider.h:
391         * WebProcess/cocoa/PlaybackSessionManager.mm:
392         (WebKit::PlaybackSessionManager::createModelAndInterface):
393         * WebProcess/cocoa/VideoFullscreenManager.mm:
394         (WebKit::VideoFullscreenManager::createModelAndInterface):
395
396 2018-12-21  Chris Dumez  <cdumez@apple.com>
397
398         navigator.userAgent in service workers does not reflect customUserAgent set by client
399         https://bugs.webkit.org/show_bug.cgi?id=192951
400
401         Reviewed by Youenn Fablet.
402
403         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
404         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
405         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
406         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
407         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
408         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
409         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
410         * WebProcess/Storage/WebSWClientConnection.cpp:
411         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
412         * WebProcess/Storage/WebSWClientConnection.h:
413         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
414         (WebKit::WebSWContextManagerConnection::installServiceWorker):
415         * WebProcess/Storage/WebSWContextManagerConnection.h:
416         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
417
418 2018-12-21  Alex Christensen  <achristensen@webkit.org>
419
420         Expand use of sourceApplicationAuditData
421         https://bugs.webkit.org/show_bug.cgi?id=192995
422         <rdar://problem/46627875>
423
424         Reviewed by Brady Eidson.
425
426         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
427         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
428
429         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
430         (WebKit::NetworkProcess::sourceApplicationAuditData const):
431         * Platform/IPC/Connection.h:
432         * Platform/IPC/mac/ConnectionMac.mm:
433         (IPC::Connection::getAuditToken):
434         * WebProcess/WebProcess.cpp:
435         (WebKit::WebProcess::initializeWebProcess):
436         * WebProcess/cocoa/WebProcessCocoa.mm:
437         (WebKit::WebProcess::sourceApplicationAuditData const):
438
439 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
440
441         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
442         https://bugs.webkit.org/show_bug.cgi?id=192061
443
444         Reviewed by Dewei Zhu.
445
446         Part 5.
447
448         Add some additional temporary logging info to determine if the time out value passed to the timer is respected.
449         Once the bug is determined and fixed, we should remove all logging added in this patch.
450
451         Reviewed by Dewei Zhu.
452
453         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
454         (WebKit::AuthenticatorManager::initTimeOutTimer):
455         (WebKit::AuthenticatorManager::timeOutTimerFired):
456
457 2018-12-21  Keith Rollin  <krollin@apple.com>
458
459         Crash in com.apple.WebKit: WebKit::WebResourceLoader::willSendRequest + 223
460         https://bugs.webkit.org/show_bug.cgi?id=192989
461
462         Reviewed by Chris Dumez.
463
464         willSendRequest is calling maybeLoadFallbackForRedirect, which can
465         delete “this”. After that, some new logging code tries to access
466         “this” and causes the crash. Fix this by adjusting the scope of a
467         "protectedThis".
468
469         * WebProcess/Network/WebResourceLoader.cpp:
470         (WebKit::WebResourceLoader::willSendRequest):
471
472 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
473
474         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
475         https://bugs.webkit.org/show_bug.cgi?id=190466
476
477         Reviewed by Youenn Fablet.
478
479         Added persistency to the DeviceIdHashSaltStorage. Implemented a
480         decoder and an encoder for the HashSaltForOrigin struct to store
481         it in a file, this allows us to save the lastTimeUsed, the origin
482         and the hash salt. It uses a new directory where it creates a file
483         per hash salt, the name of the file is the hash salt to avoid
484         leaking information in the system. The last time used and the
485         origin are stored inside the file, it also adds a version
486         directory used to change the structure of the file in the future,
487         if we need to do it. In the DeviceIdHashSaltStorage class the disk
488         operations happen in a WorkQueue, but all interactions go in the
489         main thread. We added code to handle the operations when the load
490         still did not finish.
491
492         * Platform/Logging.h:
493         Added channel DiskPersistency..
494         * Sources.txt: Added new files.
495         * UIProcess/API/APIProcessPoolConfiguration.cpp: Added code to set
496         the directory for the deviceIdHashSalts. That way we can use the
497         configuration when creating the DeviceIdHashSaltStorage.
498         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
499         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
500         (API::ProcessPoolConfiguration::copy):
501         * UIProcess/API/APIProcessPoolConfiguration.h:
502         * UIProcess/API/APIWebsiteDataStore.cpp:
503         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
504         Added code to set the directory in the disk used to store the
505         information.
506         * UIProcess/API/APIWebsiteDataStore.h: Ditto.
507         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Added dummy
508         implementation to get the directory in cocoa.
509         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
510         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
511         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Defined the
512         default directories used to store the information in the disk.
513         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
514         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
515         (API::WebsiteDataStore::defaultDataStoreConfiguration):
516         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
517         (webkitWebsiteDataManagerGetDataStore): Added the directory used
518         to store the information.
519         (webkit_website_data_manager_remove): Modified the way we use to
520         make sure when we remove the cookies we also remove the hash salts.
521         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added dummy
522         implementations to get the directory in windows platform.
523         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
524         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
525         * UIProcess/API/C/WKBackForwardListItemRef.cpp: Add namespace, it
526         seems some unified build compilation issue.
527         * UIProcess/DeviceIdHashSaltStorage.cpp:
528         (WebKit::DeviceIdHashSaltStorage::create): Added a create method
529         used to pass the directory and the persistency status of the websitedatastore.
530         (WebKit::DeviceIdHashSaltStorage::completeHandler): Added to share
531         the code copying the origins to complete the get handler.
532         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall):
533         Added to share the code when completing the task of getting a new
534         hash salt.
535         (WebKit::DeviceIdHashSaltStorage::DeviceIdHashSaltStorage): Added
536         a new constructor for the create method.
537         (WebKit::getSecurityOriginData): Added to get the
538         SecurityOriginData from a field in the decoder and do all the
539         checks.
540         (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk): Open the
541         directory and restore all the hash salts from disk to the memory
542         structure.
543         (WebKit::DeviceIdHashSaltStorage::createEncoderFromData const):
544         Creates the decoder to store the HashSaltForOrigin structure.
545         (WebKit::DeviceIdHashSaltStorage::storeHashSaltToDisk): Write to
546         disk a decoder object created from a HashSaltForOrigin
547         structure. It uses the writeEncoderToDisk function.
548         (WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin): Make
549         sure we store in disk a new hash salt when it is generated and the
550         WebsiteDataStore is persistent. Add a completionHandler to return
551         the value found or generated, this way we can control if the
552         HashMap is already loaded from disk.
553         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
554         Make sure we run the get in a queue now that we store information
555         in disk.
556         (WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDiskIfNeeded):
557         Added code to make sure we remove the files in disk.
558         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
559         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
560         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
561         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
562         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
563         * UIProcess/PersistencyUtils.cpp: Added file to share the
564         persistency code with the ResourceLoadStatisticsPersistentStorage class.
565         (WebKit::createDecoderForFile): Ditto.
566         (WebKit::writeEncoderToDisk): Ditto.
567         * UIProcess/PersistencyUtils.h: Ditto.
568         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Use the
569         new PersistencyUtils functions shared with the
570         DeviceIdHashSaltStorage class.
571         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
572         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
573         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
574         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: After
575         changing the API of the deviceIdHashSaltForOrigin we now use a
576         completionHandler because it could happen the HashMap is not still
577         loaded and we would have to wait for it. We refactored the calls
578         to the method to use this new completionHandler.
579         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
580         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
581         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
582         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
583         (WebKit::WebsiteDataStore::WebsiteDataStore): Create the
584         DeviceIdHashSaltStorage class with the persistency information.
585         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): Make
586         sure we have the directory to store the information.
587         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: Add get
588         and set functions for the deviceHashSaltStorageDirectory.
589         * WebKit.xcodeproj/project.pbxproj: Added PersistencyUtils file to
590         the xcode compilation.
591
592 2018-12-20  Alex Christensen  <achristensen@webkit.org>
593
594         Remove unused NetworkProcessCreationParameters
595         https://bugs.webkit.org/show_bug.cgi?id=192961
596
597         Reviewed by Andy Estes.
598
599         loadThrottleLatency isn't used since I replaced it with NetworkSessionCreationParameters.loadThrottleLatency in r238654
600         presentingApplicationPID has no effect because that value is only used in the WebProcess in NetworkExtensionContentFilter::initialize
601
602         * NetworkProcess/NetworkProcess.cpp:
603         (WebKit::NetworkProcess::initializeNetworkProcess):
604         * NetworkProcess/NetworkProcessCreationParameters.cpp:
605         (WebKit::NetworkProcessCreationParameters::encode const):
606         (WebKit::NetworkProcessCreationParameters::decode):
607         * NetworkProcess/NetworkProcessCreationParameters.h:
608         * UIProcess/WebProcessPool.cpp:
609         (WebKit::WebProcessPool::ensureNetworkProcess):
610
611 2018-12-20  Chris Dumez  <cdumez@apple.com>
612
613         Use Optional::hasValue() instead of Optional::has_value()
614         https://bugs.webkit.org/show_bug.cgi?id=192948
615
616         Reviewed by Tim Horton.
617
618         * UIProcess/Automation/WebAutomationSession.cpp:
619         (WebKit::AutomationCommandError::toProtocolString):
620         (WebKit::WebAutomationSession::willClosePage):
621         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
622         (WebKit::WebAutomationSessionProxy::computeElementLayout):
623
624 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
625
626         Flicker when exiting element fullscreen.
627         https://bugs.webkit.org/show_bug.cgi?id=192774
628         rdar://problem/33088878
629
630         Reviewed by Jer Noble.
631
632         Fixes an issue where the web page would flicker upon exiting element fullscreen.
633
634         Replace WebView with a snapshot while the WebView is restyled and resized for inline.
635
636         * UIProcess/mac/WKFullScreenWindowController.h:
637         * UIProcess/mac/WKFullScreenWindowController.mm:
638         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
639         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
640         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
641
642 2018-12-20  Chris Dumez  <cdumez@apple.com>
643
644         Move HTTPS_UPGRADE code behind a runtime flag, off by default
645         https://bugs.webkit.org/show_bug.cgi?id=192937
646
647         Reviewed by Youenn Fablet.
648
649         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
650
651         * Configurations/WebKit.xcconfig:
652         * DerivedSources.make:
653         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
654         * NetworkProcess/NetworkHTTPSUpgradeChecker.h:
655         * NetworkProcess/NetworkLoadChecker.cpp:
656         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
657         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
658         (WebKit::NetworkLoadChecker::checkRequest):
659         * NetworkProcess/NetworkLoadChecker.h:
660         * NetworkProcess/NetworkProcess.h:
661         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
662         * NetworkProcess/NetworkResourceLoadParameters.cpp:
663         (WebKit::NetworkResourceLoadParameters::encode const):
664         (WebKit::NetworkResourceLoadParameters::decode):
665         * NetworkProcess/NetworkResourceLoadParameters.h:
666         * NetworkProcess/NetworkResourceLoader.cpp:
667         * NetworkProcess/PingLoad.cpp:
668         (WebKit::PingLoad::PingLoad):
669         * Shared/WebPreferences.yaml:
670         * WebProcess/Network/WebLoaderStrategy.cpp:
671         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
672         * config.h:
673
674 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
675
676         [WebAuthN] Add a runtime flag for local authenticator
677         https://bugs.webkit.org/show_bug.cgi?id=192792
678         <rdar://problem/46798738>
679
680         Reviewed by Brent Fulgham.
681
682         * Shared/WebPreferences.yaml:
683         * UIProcess/API/C/WKPreferences.cpp:
684         (WKPreferencesSetWebAuthenticationLocalAuthenticatorEnabled):
685         (WKPreferencesGetWebAuthenticationLocalAuthenticatorEnabled):
686         * UIProcess/API/C/WKPreferencesRefPrivate.h:
687         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
688         (WebKit::LocalService::isAvailable):
689
690 2018-12-20  Chris Dumez  <cdumez@apple.com>
691
692         Use Optional::valueOr() instead of Optional::value_or()
693         https://bugs.webkit.org/show_bug.cgi?id=192933
694
695         Reviewed by Geoffrey Garen.
696
697         * Shared/API/c/WKSecurityOriginRef.cpp:
698         (WKSecurityOriginGetPort):
699         * UIProcess/API/APIProcessPoolConfiguration.h:
700         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
701         (-[WKSecurityOrigin port]):
702         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
703         (-[WKWebViewConfiguration _cpuLimit]):
704         * UIProcess/API/glib/WebKitSecurityOrigin.cpp:
705         (webkit_security_origin_get_port):
706         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
707         (webkitWebViewBaseHandleWheelEvent):
708         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
709         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
710         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
711         * UIProcess/Automation/WebAutomationSession.cpp:
712         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
713         (WebKit::WebAutomationSession::performInteractionSequence):
714         * UIProcess/Automation/WebAutomationSessionMacros.h:
715         * UIProcess/ServiceWorkerProcessProxy.cpp:
716         (WebKit::ServiceWorkerProcessProxy::start):
717         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
718         (WebKit::AuthenticatorManager::initTimeOutTimer):
719         * UIProcess/WebPageProxy.cpp:
720         (WebKit::WebPageProxy::deviceScaleFactor const):
721         * UIProcess/WebPageProxy.h:
722         (WebKit::WebPageProxy::viewportSizeForCSSViewportUnits const):
723         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
724         (WebKit::WebPopupMenuProxyGtk::activateItem):
725         * UIProcess/mac/LegacySessionStateCoding.cpp:
726         (WebKit::encodeFormDataElement):
727         * WebProcess/Network/WebLoaderStrategy.cpp:
728         (WebKit::WebLoaderStrategy::scheduleLoad):
729         * WebProcess/Plugins/PDF/PDFPlugin.mm:
730         (WebKit::PDFPlugin::convertFromPDFViewToRootView const):
731         (WebKit::PDFPlugin::boundsOnScreen const):
732         (WebKit::PDFPlugin::geometryDidChange):
733         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
734         (WebKit::toFormData):
735         * WebProcess/WebPage/ios/WebPageIOS.mm:
736         (WebKit::WebPage::updateVisibleContentRects):
737         * WebProcess/WebPage/wpe/CompositingManager.cpp:
738         (WebKit::CompositingManager::releaseConnectionFd):
739
740 2018-12-20  Keith Rollin  <krollin@apple.com>
741
742         Improve release-level page-load logging
743         https://bugs.webkit.org/show_bug.cgi?id=192872
744         <rdar://problem/46850309>
745
746         Reviewed by Chris Dumez.
747
748         There are a number of reported bugs that are difficult or impossible
749         to track down with our current level of logging. Additionally, some
750         software groups lower in the page-loading stack have requested logging
751         sufficient for tracking a user-visible error message down to the
752         requested resource that caused the message. Add more-comprehensive
753         logging to address these issues/requests.
754
755         * UIProcess/WebPageProxy.cpp:
756         (WebKit::m_editableImageController):
757         (WebKit::WebPageProxy::~WebPageProxy):
758         (WebKit::WebPageProxy::reattachToWebProcess):
759         (WebKit::WebPageProxy::swapToWebProcess):
760         (WebKit::WebPageProxy::reattachToWebProcessForReload):
761         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
762         (WebKit::WebPageProxy::close):
763         (WebKit::WebPageProxy::tryClose):
764         (WebKit::WebPageProxy::loadRequest):
765         (WebKit::WebPageProxy::loadRequestWithNavigation):
766         (WebKit::WebPageProxy::loadFile):
767         (WebKit::WebPageProxy::loadData):
768         (WebKit::WebPageProxy::loadDataWithNavigation):
769         (WebKit::WebPageProxy::loadAlternateHTML):
770         (WebKit::WebPageProxy::loadWebArchiveData):
771         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
772         (WebKit::WebPageProxy::stopLoading):
773         (WebKit::WebPageProxy::reload):
774         (WebKit::WebPageProxy::goToBackForwardItem):
775         (WebKit::WebPageProxy::tryRestoreScrollPosition):
776         (WebKit::WebPageProxy::updateThrottleState):
777         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
778         (WebKit::WebPageProxy::continueNavigationInNewProcess):
779         (WebKit::WebPageProxy::restoreFromSessionState):
780         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
781         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
782         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
783         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
784         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
785         (WebKit::WebPageProxy::didCommitLoadForFrame):
786         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
787         (WebKit::WebPageProxy::didFinishLoadForFrame):
788         (WebKit::WebPageProxy::didFailLoadForFrame):
789         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
790         (WebKit::WebPageProxy::didNavigateWithNavigationData):
791         (WebKit::WebPageProxy::didPerformClientRedirect):
792         (WebKit::WebPageProxy::didPerformServerRedirect):
793         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
794         (WebKit::WebPageProxy::processDidBecomeResponsive):
795         (WebKit::WebPageProxy::processDidTerminate):
796         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
797         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
798         (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
799         (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
800         * WebProcess/Network/WebLoaderStrategy.cpp:
801         (WebKit::WebLoaderStrategy::scheduleLoad):
802         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
803         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
804         * WebProcess/Network/WebResourceLoader.cpp:
805         (WebKit::WebResourceLoader::willSendRequest):
806         (WebKit::WebResourceLoader::didReceiveResponse):
807         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
808         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
809         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
810
811 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
812
813         [iOS] Replace "node assistance" terminology in WebKit with "focused element"
814         https://bugs.webkit.org/show_bug.cgi?id=192936
815
816         Reviewed by Tim Horton.
817
818         Renames a few methods and data structures in WebKit, to refer to "focused elements" rather than "assisted nodes";
819         see below for more details. No new tests, because there should be no change in behavior.
820
821         * Shared/FocusedElementInformation.cpp: Renamed from Source/WebKit/Shared/AssistedNodeInformation.cpp.
822         (WebKit::OptionItem::encode const):
823         (WebKit::OptionItem::decode):
824         (WebKit::FocusedElementInformation::encode const):
825         (WebKit::FocusedElementInformation::decode):
826         * Shared/FocusedElementInformation.h: Renamed from Source/WebKit/Shared/AssistedNodeInformation.h.
827
828         Rename AssistedNodeInformation to FocusedElementInformation. Additionally, introduce a named type for the
829         focusedElementIdentifier (which is currently just a `uint64_t`).
830
831         (WebKit::OptionItem::OptionItem):
832         * Shared/ios/InteractionInformationAtPosition.h:
833         * Shared/ios/InteractionInformationAtPosition.mm:
834         (WebKit::InteractionInformationAtPosition::encode const):
835         (WebKit::InteractionInformationAtPosition::decode):
836         * SourcesCocoa.txt:
837         * UIProcess/API/Cocoa/WKWebView.mm:
838         (-[WKWebView _shouldUpdateKeyboardWithInfo:]):
839         * UIProcess/PageClient.h:
840         * UIProcess/WebPageProxy.cpp:
841         (WebKit::WebPageProxy::resetStateAfterProcessExited):
842         * UIProcess/WebPageProxy.h:
843
844         Rename NodeAssistanceArguments to ElementDidFocusArguments (and also add a FIXME for removing this mechanism
845         eventually).
846
847         (WebKit::WebPageProxy::focusNextFocusedElement):
848         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
849         * UIProcess/WebPageProxy.messages.in:
850
851         Rename StartAssistingNode to ElementDidFocus, and StopAssistingNode to ElementDidBlur.
852
853         * UIProcess/ios/PageClientImplIOS.h:
854         * UIProcess/ios/PageClientImplIOS.mm:
855         (WebKit::PageClientImpl::elementDidFocus):
856         (WebKit::PageClientImpl::isFocusingElement):
857         (WebKit::PageClientImpl::elementDidBlur):
858         (WebKit::PageClientImpl::startAssistingNode): Deleted.
859         (WebKit::PageClientImpl::isAssistingNode): Deleted.
860         (WebKit::PageClientImpl::stopAssistingNode): Deleted.
861         * UIProcess/ios/WKContentView.h:
862         * UIProcess/ios/WKContentView.mm:
863         (-[WKContentView isFocusingElement]):
864         (-[WKContentView _didCommitLoadForMainFrame]):
865         (-[WKContentView isAssistingNode]): Deleted.
866         * UIProcess/ios/WKContentViewInteraction.h:
867         * UIProcess/ios/WKContentViewInteraction.mm:
868         (-[WKFocusedElementInfo initWithFocusedElementInformation:isUserInitiated:userObject:]):
869         (hasFocusedElement):
870         (-[WKContentView cleanupInteraction]):
871         (-[WKContentView shouldHideSelectionWhenScrolling]):
872         (-[WKContentView resignFirstResponderForWebView]):
873         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
874         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
875         (-[WKContentView _zoomToRevealFocusedElement]):
876         (-[WKContentView inputView]):
877         (-[WKContentView _selectionClipRect]):
878         (-[WKContentView gestureRecognizerShouldBegin:]):
879         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
880         (-[WKContentView clearSelection]):
881         (-[WKContentView requiresAccessoryView]):
882         (-[WKContentView canPerformActionForWebView:withSender:]):
883         (-[WKContentView _isInteractingWithFocusedElement]):
884         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
885         (-[WKContentView selectPositionAtPoint:completionHandler:]):
886         (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
887         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
888         (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
889         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
890         (-[WKContentView accessoryTab:]):
891         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
892         (-[WKContentView accessoryClear]):
893         (-[WKContentView _updateAccessory]):
894         (-[WKContentView insertTextSuggestion:]):
895         (-[WKContentView setSelectedTextRange:]):
896         (-[WKContentView textInputTraits]):
897         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
898         (-[WKContentView focusedElementInformation]):
899         (-[WKContentView focusedSelectElementOptions]):
900         (rectToRevealWhenZoomingToFocusedElement):
901         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
902         (-[WKContentView _elementDidBlur]):
903         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
904         (-[WKContentView updateCurrentFocusedElementInformation:]):
905         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
906         (-[WKContentView focusedFormControlViewDidSubmit:]):
907         (-[WKContentView focusedFormControlViewDidCancel:]):
908         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
909         (-[WKContentView rectForFocusedFormControlView:]):
910         (-[WKContentView nextRectForFocusedFormControlView:]):
911         (-[WKContentView previousRectForFocusedFormControlView:]):
912         (-[WKContentView actionNameForFocusedFormControlView:]):
913         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
914         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
915         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
916         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
917         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
918         (-[WKContentView numberOfItemsInSelectMenu:]):
919         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
920         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
921         (-[WKContentView selectMenuUsesMultipleSelection:]):
922         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
923         (-[WKContentView _updateChangedSelection:]):
924         (-[WKContentView _autofillContext]):
925         (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]):
926         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
927         (-[WKContentView inputLabelTextForViewController:]):
928         (-[WKContentView initialValueForViewController:]):
929         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
930         (-[WKContentView numericInputModeForListViewController:]):
931         (-[WKContentView textContentTypeForListViewController:]):
932         (-[WKContentView allowsDictationInputForListViewController:]):
933         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]): Deleted.
934         (hasAssistedNode): Deleted.
935
936         Replaced with hasFocusedElement.
937
938         (-[WKContentView _isInteractingWithAssistedNode]): Deleted.
939         (-[WKContentView assistedNodeInformation]): Deleted.
940         (-[WKContentView assistedNodeSelectOptions]): Deleted.
941         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Deleted.
942         (-[WKContentView _stopAssistingNode]): Deleted.
943         (-[WKContentView updateCurrentAssistedNodeInformation:]): Deleted.
944         (-[WKContentView presentViewControllerForCurrentAssistedNode]): Deleted.
945         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
946         (-[WKDataListSuggestionsControl textAlignment]):
947         * UIProcess/ios/WebPageProxyIOS.mm:
948         (WebKit::WebPageProxy::focusedElementInformationCallback):
949         (WebKit::WebPageProxy::requestFocusedElementInformation):
950         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
951         (WebKit::WebPageProxy::didCommitLayerTree):
952         (WebKit::WebPageProxy::selectWithGesture):
953         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
954         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
955         (WebKit::WebPageProxy::selectPositionAtPoint):
956         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
957         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
958         (WebKit::WebPageProxy::blurFocusedElement):
959         (WebKit::WebPageProxy::elementDidFocus):
960         (WebKit::WebPageProxy::elementDidBlur):
961         (WebKit::WebPageProxy::focusNextFocusedElement):
962         (WebKit::WebPageProxy::setFocusedElementValue):
963         (WebKit::WebPageProxy::setFocusedElementValueAsNumber):
964         (WebKit::WebPageProxy::setFocusedElementSelectedIndex):
965         (WebKit::WebPageProxy::assistedNodeInformationCallback): Deleted.
966         (WebKit::WebPageProxy::requestAssistedNodeInformation): Deleted.
967         (WebKit::WebPageProxy::blurAssistedNode): Deleted.
968         (WebKit::WebPageProxy::startAssistingNode): Deleted.
969         (WebKit::WebPageProxy::stopAssistingNode): Deleted.
970         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
971         (WebKit::WebPageProxy::setAssistedNodeValue): Deleted.
972         (WebKit::WebPageProxy::setAssistedNodeValueAsNumber): Deleted.
973         (WebKit::WebPageProxy::setAssistedNodeSelectedIndex): Deleted.
974         * UIProcess/ios/forms/WKFormColorPicker.mm:
975         (-[WKColorPicker initWithView:]):
976         (-[WKColorPicker setControlValueFromUIColor:]):
977         * UIProcess/ios/forms/WKFormInputControl.mm:
978         (-[WKDateTimePicker initWithView:datePickerMode:]):
979         (-[WKDateTimePicker shouldPresentGregorianCalendar:]):
980         (-[WKDateTimePicker _dateChangedSetAsNumber]):
981         (-[WKDateTimePicker _dateChangedSetAsString]):
982         (-[WKDateTimePicker controlBeginEditing]):
983         (-[WKFormInputControl initWithView:]):
984         (-[WKDateTimePopover clear:]):
985         (-[WKDateTimePopover initWithView:datePickerMode:]):
986         * UIProcess/ios/forms/WKFormPopover.mm:
987         (-[WKRotatingPopover presentPopoverAnimated:]):
988         * UIProcess/ios/forms/WKFormSelectControl.h:
989         * UIProcess/ios/forms/WKFormSelectControl.mm:
990         (-[WKFormSelectControl initWithView:]):
991         * UIProcess/ios/forms/WKFormSelectPicker.mm:
992         (-[WKMultipleSelectPicker initWithView:]):
993         (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
994         (-[WKMultipleSelectPicker pickerView:numberOfRowsInComponent:]):
995         (-[WKMultipleSelectPicker findItemIndexAt:]):
996         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
997         (-[WKSelectSinglePicker initWithView:]):
998         (-[WKSelectSinglePicker controlEndEditing]):
999         (-[WKSelectSinglePicker pickerView:numberOfRowsInComponent:]):
1000         (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
1001         (-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
1002         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1003         (-[WKSelectTableViewController initWithView:hasGroups:]):
1004         (-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
1005         (-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
1006         (-[WKSelectTableViewController findItemIndexAt:]):
1007         (-[WKSelectTableViewController findItemAt:]):
1008         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
1009         (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
1010         (-[WKSelectPopover initWithView:hasGroups:]):
1011         * WebKit.xcodeproj/project.pbxproj:
1012         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1013         (WebKit::WebChromeClient::elementDidFocus):
1014         (WebKit::WebChromeClient::elementDidRefocus):
1015         (WebKit::WebChromeClient::elementDidBlur):
1016         * WebProcess/WebPage/WebPage.cpp:
1017         (WebKit::WebPage::didStartPageTransition):
1018         (WebKit::WebPage::setTextAsync):
1019         (WebKit::WebPage::resetFocusedElementForFrame):
1020         (WebKit::WebPage::elementDidRefocus):
1021         (WebKit::WebPage::elementDidFocus):
1022         (WebKit::WebPage::elementDidBlur):
1023         (WebKit::WebPage::didCommitLoad):
1024         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
1025         * WebProcess/WebPage/WebPage.h:
1026
1027         Refactor elementDid{Refocus|Focus|Blur} to take `Element&` rather than `Node*`.
1028
1029         * WebProcess/WebPage/WebPage.messages.in:
1030         * WebProcess/WebPage/ios/WebPageIOS.mm:
1031
1032         Replace m_assistedNode (a `RefPtr<Node>`) with m_focusedElement (a `RefPtr<Element>`).
1033
1034         (WebKit::WebPage::platformEditorState const):
1035         (WebKit::WebPage::completeSyntheticClick):
1036         (WebKit::WebPage::requestFocusedElementInformation):
1037         (WebKit::WebPage::blurFocusedElement):
1038         (WebKit::WebPage::setFocusedElementValue):
1039         (WebKit::WebPage::setFocusedElementValueAsNumber):
1040         (WebKit::WebPage::setFocusedElementSelectedIndex):
1041         (WebKit::innerFrameQuad):
1042         (WebKit::constrainPoint):
1043         (WebKit::WebPage::selectWithGesture):
1044         (WebKit::WebPage::startAutoscrollAtPosition):
1045         (WebKit::WebPage::visiblePositionInFocusedNodeForPoint):
1046         (WebKit::WebPage::selectPositionAtPoint):
1047         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1048         (WebKit::WebPage::rangeForGranularityAtPoint):
1049         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1050         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1051         (WebKit::WebPage::updateSelectionWithExtentPoint):
1052         (WebKit::WebPage::getPositionInformation):
1053         (WebKit::WebPage::focusNextFocusedElement):
1054         (WebKit::WebPage::getFocusedElementInformation):
1055         (WebKit::WebPage::autofillLoginCredentials):
1056         (WebKit::WebPage::requestAssistedNodeInformation): Deleted.
1057         (WebKit::WebPage::blurAssistedNode): Deleted.
1058         (WebKit::WebPage::setAssistedNodeValue): Deleted.
1059         (WebKit::WebPage::setAssistedNodeValueAsNumber): Deleted.
1060         (WebKit::WebPage::setAssistedNodeSelectedIndex): Deleted.
1061         (WebKit::WebPage::focusNextAssistedNode): Deleted.
1062         (WebKit::WebPage::getAssistedNodeInformation): Deleted.
1063
1064 2018-12-20  Brent Fulgham  <bfulgham@apple.com>
1065
1066         WKWebView default UA doesn't freeze the build number
1067         https://bugs.webkit.org/show_bug.cgi?id=192809
1068         <rdar://problem/44687185>
1069
1070         Reviewed by Andy Estes.
1071
1072         Always reports the frozen build number.
1073
1074         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1075         (defaultApplicationNameForUserAgent): Do not expose the actual build number through this API.
1076
1077 2018-12-20  Jer Noble  <jer.noble@apple.com>
1078
1079         Enable MediaCapabilities by default.
1080         https://bugs.webkit.org/show_bug.cgi?id=192340
1081         <rdar://problem/46435149>
1082
1083         Reviewed by Dean Jackson.
1084
1085         * Shared/WebPreferences.yaml:
1086
1087 2018-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1088
1089         [GTK] WebDriver: tests in imported/w3c/webdriver/tests/element_clear/user_prompts.py are failing
1090         https://bugs.webkit.org/show_bug.cgi?id=192927
1091
1092         Reviewed by Michael Catanzaro.
1093
1094         Give the focus back to the web view when a dialog is dismissed.
1095
1096         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1097         (webkitWebViewBaseContainerRemove):
1098
1099 2018-12-20  Tim Horton  <timothy_horton@apple.com>
1100
1101         Unparented WKWebView can't retrieve main resource data for a main frame plugin
1102         https://bugs.webkit.org/show_bug.cgi?id=192923
1103         <rdar://problem/46859068>
1104
1105         Reviewed by Wenson Hsieh.
1106
1107         * WebProcess/Plugins/PluginView.cpp:
1108         (WebKit::PluginView::liveResourceData const):
1109         If the WKWebView is unparented, we may not immediately initialize the plugin.
1110         In that case, PluginView holds on to the backing data until the plugin
1111         is initialized. If a WKWebView API client asks for the backing data
1112         for the plugin during this time, we should return it, instead of bailing.
1113
1114 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1115
1116         [iOS] Focusing an editable element should scroll to reveal the selection
1117         https://bugs.webkit.org/show_bug.cgi?id=192802
1118         <rdar://problem/46781759>
1119
1120         Reviewed by Tim Horton.
1121
1122         Currently, when tapping on an editable element, logic in -[WKWebView _zoomToFocusRect:…:] attempts to adjust the
1123         visible viewport such that the rect containing the selection is visible. However, AssistedNodeInformation's
1124         selectionRect is used here, which (as the FIXME in WebPage::getAssistedNodeInformation notes) is either the last
1125         touch location, or the top left of the element if the touch location is outside of the element's bounding rect.
1126         This leads to confusing and undesirable behavior when tapping near the bottom of a large contenteditable element
1127         to focus it, since the actual selection will end up near the top of the element, yet we'll try to scroll to
1128         reveal the bottom of the element, which causes the visible selection to scroll offscreen. Notably, this affects
1129         scenarios involving editable web views embedded in apps, such as Mail compose.
1130
1131         Right now, we use the last touch location as an approximation for the selection rect because the selection may
1132         have not yet been updated at the moment when focus moves into an editable element. To fix this, we defer the
1133         process of zooming to the focused element rect until after the selection changes and the UI process is updated
1134         with information about the new selection rects.
1135
1136         Test: editing/selection/ios/selection-is-visible-after-focusing-editable-area.html
1137
1138         * Shared/AssistedNodeInformation.cpp:
1139         (WebKit::AssistedNodeInformation::encode const):
1140         (WebKit::AssistedNodeInformation::decode):
1141         * Shared/AssistedNodeInformation.h:
1142
1143         Rename selectionRect to elementInteractionLocation, to more accurately reflect its value and purpose. This isn't
1144         strictly always the last touch location, since we may default to the focused element location instead if the
1145         last touch location is outside of the element rect.
1146
1147         * UIProcess/API/Cocoa/WKWebView.mm:
1148         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1149
1150         Tweak a constant that determines the minimum amount of margin to leave between the selection rect and the edge
1151         of the window when scrolling to reveal the focused element. Previously, this was larger than necessary to
1152         accomodate for the fact that the "selection rect" used when zooming to the focused element did not take the
1153         actual selection into account at all, and was simply a 1 by 1 rect; this meant that the margin needed to be
1154         large enough to exceed the usual height of a text caret in editable content. Since we now use the real selection
1155         rect, we can be much less generous with this margin.
1156
1157         * UIProcess/ios/WKContentViewInteraction.h:
1158         * UIProcess/ios/WKContentViewInteraction.mm:
1159         (-[WKContentView cleanupInteraction]):
1160         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
1161
1162         Don't additionally update the selection in the middle of triggering zooming to the focused element; on
1163         particular versions of iOS, this now attempts to scroll the selection rect on-screen, which then conflicts with
1164         zooming to reveal the focused element.
1165
1166         (-[WKContentView _zoomToRevealFocusedElement]):
1167
1168         Renamed from _displayFormNodeInputView to _zoomToRevealFocusedElement, to make the purpose of this function more
1169         clear. Additionally, pull logic to update the accessory view out of this method, so that it's strictly concerned
1170         with zooming to the focused element.
1171
1172         (-[WKContentView inputView]):
1173
1174         Add a FIXME describing the implications of zooming to the focused element in the implementation of -inputView.
1175         See also: <https://bugs.webkit.org/show_bug.cgi?id=192878>.
1176
1177         (-[WKContentView accessoryTab:]):
1178
1179         Fix a subtle issue when keeping track of _didAccessoryTabInitiateFocus. Currently, this is set to YES in
1180         -accessoryTab: and unset in _displayFormNodeInputView, but since _displayFormNodeInputView may be invoked
1181         multiple times for the same focused element (see: -inputView), we might end up zooming to the focused element
1182         with _didAccessoryTabInitiateFocus set to NO, even though we initiated focus with the previous/next buttons.
1183
1184         Instead, temporarily set a different ivar, _isChangingFocusUsingAccessoryTab, to YES in -accessoryTab:, and
1185         unset it in the completion handler after the focused element has changed. Then, when we _startAssistingNode:,
1186         set _didAccessoryTabInitiateFocus to _isChangingFocusUsingAccessoryTab. This ensures that the correctness of
1187         _didAccessoryTabInitiateFocus isn't tied to the number of times -[WKContentView inputView] is invoked when
1188         focusing an element.
1189
1190         (shouldZoomToRevealSelectionRect):
1191         (rectToRevealWhenZoomingToFocusedElement):
1192
1193         Add a helper method to determine the selection rect to use when zooming to reveal the focused element. ASSERTs
1194         that we have post-layout data in the EditorState.
1195
1196         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1197
1198         When "assisting" a focused element, immediately zoom to it if we don't need selection information to compute the
1199         rect to zoom to; otherwise, defer zooming until we receive the first editor state update in the UI process that
1200         contains information about our selection rects.
1201
1202         (-[WKContentView _stopAssistingNode]):
1203         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
1204
1205         If necessary, reveal the focused element by zooming.
1206
1207         (-[WKContentView _updateInitialWritingDirectionIfNecessary]):
1208
1209         Pull this initial writing direction update logic out into a separate helper method.
1210
1211         (-[WKContentView _displayFormNodeInputView]): Deleted.
1212
1213         Replaced by _zoomToRevealFocusedElement.
1214
1215         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1216         (WebKit::WebChromeClient::elementDidRefocus):
1217
1218         This currently calls WebChromeClient::elementDidFocus; instead, call the new WebPage::elementDidRefocus;
1219         additionally, make this available on all PLATFORM(COCOA), rather than just IOS_FAMILY.
1220
1221         * WebProcess/WebCoreSupport/WebChromeClient.h:
1222         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1223         (WebKit::WebChromeClient::elementDidRefocus): Deleted.
1224
1225         Replaced by the PLATFORM(COCOA) version.
1226
1227         * WebProcess/WebPage/WebPage.cpp:
1228         (WebKit::WebPage::elementDidRefocus):
1229
1230         When refocusing an element, ensure that post-layout editor state data is sent to the UI process by including a
1231         full EditorState in the next layer tree transaction.
1232
1233         * WebProcess/WebPage/WebPage.h:
1234         * WebProcess/WebPage/ios/WebPageIOS.mm:
1235         (WebKit::WebPage::completeSyntheticClick):
1236
1237         Call elementDidRefocus instead of elementDidFocus, in the case where the existing focused element is clicked.
1238
1239         (WebKit::WebPage::getAssistedNodeInformation):
1240
1241         Adjust for the change from selectionRect to elementInteractionLocation.
1242
1243 2018-12-20  Patrick Griffis  <pgriffis@igalia.com>
1244
1245         [GTK][WPE] Grant the sandbox read access to XDG_DATA_HOME/prgname
1246         https://bugs.webkit.org/show_bug.cgi?id=192929
1247
1248         Reviewed by Michael Catanzaro.
1249
1250         * UIProcess/API/glib/WebKitWebContext.cpp:
1251         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1252         (WebKit::bubblewrapSpawn):
1253
1254 2018-12-20  Chris Dumez  <cdumez@apple.com>
1255
1256         [PSON] SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache
1257         https://bugs.webkit.org/show_bug.cgi?id=192873
1258
1259         Reviewed by Antti Koivisto.
1260
1261         SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache, preventing
1262         the process from suspending on iOS.
1263
1264         * UIProcess/SuspendedPageProxy.cpp:
1265         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1266         (WebKit::SuspendedPageProxy::didReceiveMessage):
1267         (WebKit::SuspendedPageProxy::didSuspend): Deleted.
1268         (WebKit::SuspendedPageProxy::didFailToSuspend): Deleted.
1269         * UIProcess/SuspendedPageProxy.h:
1270
1271 2018-12-19  Chris Dumez  <cdumez@apple.com>
1272
1273         wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
1274         https://bugs.webkit.org/show_bug.cgi?id=192728
1275         <rdar://problem/46746779>
1276
1277         Reviewed by Geoff Garen.
1278
1279         * NetworkProcess/*:
1280         * Platform/*:
1281         * Scripts/*:
1282         * Shared/*:
1283         * UIProcess/*:
1284         * WebProcess/*:
1285
1286 2018-12-19  Michael Catanzaro  <mcatanzaro@igalia.com>
1287
1288         Unreviewed, silence -Wpragmas warning
1289
1290         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
1291
1292 2018-12-19  Vivek Seth  <v_seth@apple.com>
1293
1294         HTTPS Upgrade: Use full sqlite upgrade list
1295         https://bugs.webkit.org/show_bug.cgi?id=192736
1296         <rdar://problem/45851427>
1297
1298         Reviewed by Chris Dumez.
1299
1300         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Added.
1301         (WebKit::NetworkHTTPSUpgradeCheckerDatabasePath):
1302         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
1303         (WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker):
1304         (WebKit::NetworkHTTPSUpgradeChecker::query):
1305         (WebKit::NetworkHTTPSUpgradeChecker::isAlwaysOnLoggingAllowed const):
1306         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added.
1307         (WebKit::NetworkHTTPSUpgradeChecker::didSetupCompleteSuccessfully const):
1308         * NetworkProcess/NetworkLoadChecker.cpp:
1309         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
1310         (WebKit::NetworkLoadChecker::checkRequest):
1311         * NetworkProcess/NetworkLoadChecker.h:
1312         * NetworkProcess/NetworkProcess.h:
1313         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
1314         * Sources.txt:
1315         * WebKit.xcodeproj/project.pbxproj:
1316
1317 2018-12-19  Tim Horton  <timothy_horton@apple.com>
1318
1319         Use delegate instead of drawingDelegate in WKDrawingView
1320         https://bugs.webkit.org/show_bug.cgi?id=192899
1321         <rdar://problem/46733339>
1322
1323         Reviewed by Wenson Hsieh.
1324
1325         * UIProcess/ios/WKDrawingView.mm:
1326         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
1327         Do the dance.
1328
1329 2018-12-19  Alex Christensen  <achristensen@webkit.org>
1330
1331         Navigations away from the SafeBrowsing interstitial show a flash of old content
1332         https://bugs.webkit.org/show_bug.cgi?id=192676
1333
1334         Reviewed by Chris Dumez.
1335
1336         When a user clicks through a safe browsing warning, do not remove the warning until content is drawn for the destination.
1337         Otherwise, the user will confusingly see the page before the warning while the navigation happens.
1338         We can only do this for warnings caused by main frame navigations, though.  Other warnings (such as those caused by iframes)
1339         need to be cleared immediately, and we still need to clear the warning immediately if the user has said to go back.
1340
1341         This change is reflected in an updated API test.
1342
1343         * UIProcess/API/Cocoa/WKWebView.mm:
1344         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1345         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
1346         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
1347         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
1348         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1349         (-[WKSafeBrowsingWarning forMainFrameNavigation]):
1350         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
1351         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1352         * UIProcess/Cocoa/WebViewImpl.h:
1353         * UIProcess/Cocoa/WebViewImpl.mm:
1354         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1355         (WebKit::WebViewImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
1356         * UIProcess/PageClient.h:
1357         (WebKit::PageClient::clearSafeBrowsingWarningIfForMainFrameNavigation):
1358         * UIProcess/SafeBrowsingWarning.h:
1359         (WebKit::SafeBrowsingWarning::create):
1360         (WebKit::SafeBrowsingWarning::forMainFrameNavigation const):
1361         * UIProcess/WebPageProxy.cpp:
1362         (WebKit::WebPageProxy::didReachLayoutMilestone):
1363         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
1364         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1365         * UIProcess/WebPageProxy.h:
1366         * UIProcess/ios/PageClientImplIOS.h:
1367         * UIProcess/mac/PageClientImplMac.h:
1368         * UIProcess/mac/PageClientImplMac.mm:
1369         (WebKit::PageClientImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
1370
1371 2018-12-19  Tim Horton  <timothy_horton@apple.com>
1372
1373         UI process crash when focusing an editable image
1374         https://bugs.webkit.org/show_bug.cgi?id=192839
1375         <rdar://problem/46786670>
1376
1377         Reviewed by Wenson Hsieh.
1378
1379         * SourcesCocoa.txt:
1380         * UIProcess/ios/WKContentViewInteraction.h:
1381         * UIProcess/ios/WKContentViewInteraction.mm:
1382         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
1383         (-[WKContentView inputView]):
1384         (-[WKContentView requiresAccessoryView]):
1385         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1386         (-[WKContentView _stopAssistingNode]):
1387         (-[WKContentView _installInkPickerForDrawingViewWithID:]):
1388         (-[WKContentView _uninstallInkPicker]):
1389         * UIProcess/ios/WKInkPickerView.h: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.h.
1390         * UIProcess/ios/WKInkPickerView.mm: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.mm.
1391         (-[WKInkPickerView initWithDrawingView:]):
1392         (-[WKInkPickerView didPickInk]):
1393         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
1394         (-[WKInkPickerView inlineInkPicker:didSelectTool:]):
1395         (-[WKInkPickerView inlineInkPicker:didSelectColor:]):
1396         (-[WKInkPickerView inkPickerSize]):
1397         (-[WKInkPickerView layoutSubviews]):
1398         (-[WKInkPickerView sizeThatFits:]):
1399         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
1400         * WebKit.xcodeproj/project.pbxproj:
1401         Make WKInkPickerView a WKWebView subview instead of an inputView.
1402         Also, don't force the keyboard to be visible when an editable image is focused.
1403
1404 2018-12-19  Eric Carlson  <eric.carlson@apple.com>
1405
1406         [MediaStream] Force system camera/microphone TCC prompt if necessary
1407         https://bugs.webkit.org/show_bug.cgi?id=192820
1408         <rdar://problem/42680098>
1409
1410         Reviewed by Jer Noble.
1411
1412         * UIProcess/Cocoa/UIDelegate.mm:
1413         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Enable TCC check 
1414         and prompt on Mojave.
1415
1416 2018-12-19  Megan Gardner  <megan_gardner@apple.com>
1417
1418         Allow clients to set the navigator platform
1419         https://bugs.webkit.org/show_bug.cgi?id=192735
1420
1421         Reviewed by Tim Horton.
1422
1423         Add private API to allow clients to override the default navigator
1424         platform. Some websites check for the platform, which 
1425         interfears with our request desktop site feature. This should
1426         help more sites function as expected.
1427
1428         * Shared/WebsitePoliciesData.cpp:
1429         (WebKit::WebsitePoliciesData::encode const):
1430         (WebKit::WebsitePoliciesData::decode):
1431         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
1432         * Shared/WebsitePoliciesData.h:
1433         * UIProcess/API/APIWebsitePolicies.cpp:
1434         (API::WebsitePolicies::data):
1435         * UIProcess/API/APIWebsitePolicies.h:
1436         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
1437         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
1438         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
1439         (-[_WKWebsitePolicies customNavigatorPlatform]):
1440         * UIProcess/Cocoa/NavigationState.mm:
1441         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1442
1443 2018-12-19  Truitt Savell  <tsavell@apple.com>
1444
1445         Unreviewed, rolling out r239358.
1446
1447         Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
1448         crash on Debug bots
1449
1450         Reverted changeset:
1451
1452         "Clean up IndexedDB files between tests"
1453         https://bugs.webkit.org/show_bug.cgi?id=192796
1454         https://trac.webkit.org/changeset/239358
1455
1456 2018-12-18  Alex Christensen  <achristensen@webkit.org>
1457
1458         REGRESSION(r239134) iOS safe browsing warning unable to show details
1459         https://bugs.webkit.org/show_bug.cgi?id=192837
1460
1461         Reviewed by Tim Horton.
1462
1463         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
1464         (-[WKSafeBrowsingWarning addContent]):
1465         I had a fragile design that relied on the internal view heirarchy structure of UIScrollView,
1466         which I changed in r239134 by introducing a layout which changed where its scrollbars were in the view heirarchy.
1467         I now have a more robust design that saves a WeakObjCPtr to the view I need to traverse to.
1468         Testing is problematic because this had to do with scrollbars and UIScrollView internals which seem to behave
1469         differently in TestWebKitAPI, but I verified manually that this fixes the issue.
1470
1471 2018-12-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1472
1473         [Win][Clang] Fix compilation warnings under Source/WebKit directory
1474         https://bugs.webkit.org/show_bug.cgi?id=192695
1475
1476         Reviewed by Alex Christensen.
1477
1478         * NetworkProcess/cache/NetworkCacheData.cpp:
1479         (makeSalt): Enclosed by #if !OS(WINDOWS).
1480         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
1481         (WebKit::NetworkCache::directoryEntryType): Ditto.
1482         * Platform/win/ModuleWin.cpp:
1483         (WebKit::Module::platformFunctionPointer const): Cast a function pointer with reinterpret_cast<void*>().
1484         * UIProcess/DrawingAreaProxyImpl.cpp:
1485         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
1486         Moved the initializer of m_webPage in order to be encluded by #if PLATFORM(GTK).
1487         * UIProcess/DrawingAreaProxyImpl.h: Ditto.
1488         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
1489         (WebKit::processName): Removed the duplicated 'const' type qualifier.
1490         * UIProcess/win/WebInspectorProxyWin.cpp:
1491         (WebKit::WebInspectorProxy::platformAttach): Removed an unused variable.
1492         (WebKit::WebInspectorProxy::platformDetach): Ditto.
1493         * UIProcess/win/WebPopupMenuProxyWin.cpp: Ditto.
1494         * UIProcess/win/WebView.cpp:
1495         (WebKit::WebView::paint): Ditto.
1496         (WebKit::WebPopupMenu::setUpPlatformData): Ditto.
1497         * UIProcess/win/WebPopupMenuProxyWin.h: Marked override methods with 'override'.
1498         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h: Ditto.
1499         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Removed an unused variable.
1500
1501 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1502
1503         [macOS] fast/forms/datalist/datalist-textinput-suggestions-order.html sometimes crashes after r239337
1504         https://bugs.webkit.org/show_bug.cgi?id=192836
1505         <rdar://problem/45321184>
1506
1507         Reviewed by Tim Horton.
1508
1509         r239337 exposed a subtle issue in the implementation of `-[WKDataListSuggestionsView updateWithInformation:]`,
1510         wherein we might end up recomputing information for table view cells at rows that no longer exist. This currently
1511         happens because we first set the datalist's `_suggestions`, then change the table view's frame, and then finally
1512         reload the table view; however, in the case where the number of suggestions decreased and the frame changed
1513         (which prompts AppKit to ask us again for table cell views), we'll attempt to access an out-of-bounds index in
1514         the `_suggestions` vector.
1515
1516         To address this, we change our suggestions and immediately reload the table view before updating `NSTableView`'s
1517         frame, so that we only provide table view cells for rows that actually correspond to items in `_suggestions`.
1518
1519         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
1520         (-[WKDataListSuggestionsView updateWithInformation:]):
1521
1522 2018-12-18  Jiewen Tan  <jiewen_tan@apple.com>
1523
1524         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
1525         https://bugs.webkit.org/show_bug.cgi?id=192061
1526
1527         Reviewed by Dewei Zhu.
1528
1529         Part 4.
1530
1531         Add some additional temporary logging info to determine if the time out value passed to the timer is right.
1532         Once the bug is determined and fixed, we should remove all logging added in this patch.
1533
1534         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1535         (WebKit::AuthenticatorManager::initTimeOutTimer):
1536
1537 2018-12-18  Sihui Liu  <sihui_liu@apple.com>
1538
1539         Clean up IndexedDB files between tests
1540         https://bugs.webkit.org/show_bug.cgi?id=192796
1541
1542         Reviewed by Geoffrey Garen.
1543
1544         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1545         (WKWebsiteDataStoreRemoveAllIndexedDatabasesSync):
1546         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1547
1548 2018-12-18  Vivek Seth  <v_seth@apple.com>
1549
1550         HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future
1551         https://bugs.webkit.org/show_bug.cgi?id=192612
1552         <rdar://problem/46651207>
1553
1554         Reviewed by Andy Estes.
1555
1556         * Configurations/WebKit.xcconfig:
1557         * DerivedSources.make:
1558         * Scripts/generate-https-upgrade-database.sh: Added.
1559         * WebKit.xcodeproj/project.pbxproj:
1560
1561 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1562
1563         Unreviewed, fix the 32-bit watchOS build after r239314
1564
1565         * UIProcess/API/Cocoa/WKWebView.mm:
1566         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1567
1568 2018-12-18  Alex Christensen  <achristensen@webkit.org>
1569
1570         WKWebView has old URL while displaying SafeBrowsing interstitial, for link-click navigations
1571         https://bugs.webkit.org/show_bug.cgi?id=192675
1572
1573         Reviewed by Geoffrey Garen.
1574
1575         When a safe browsing warning is being shown, WKWebView.URL should be the unsafe website, not the safe website before it.
1576
1577         * UIProcess/API/Cocoa/WKWebView.mm:
1578         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
1579         (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
1580         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1581         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
1582         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
1583         * UIProcess/SafeBrowsingWarning.h:
1584         (WebKit::SafeBrowsingWarning::create):
1585         (WebKit::SafeBrowsingWarning::url const):
1586         * UIProcess/WebPageProxy.cpp:
1587         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1588
1589 2018-12-18  Chris Dumez  <cdumez@apple.com>
1590
1591         Regression(r239182) SuspendedPage's process reuse for link navigation optimization sometimes broken
1592         https://bugs.webkit.org/show_bug.cgi?id=192772
1593
1594         Reviewed by Antti Koivisto.
1595
1596         With r239182, if the page in the previous process would fail to enter PageCache, we would destroy
1597         the corresponding SuspendedPageProxy, which would potentially terminate the process. This would
1598         regress performance when trying to navigate back in history to that page. This would also regress
1599         performance when link-navigating to the same domain as we would have previously reused the suspended
1600         page's process for such navigation.
1601
1602         Address the issue by keeping the SuspendedPageProxy alive even if the WebPage fails to suspend.
1603         When trying to reuse a SuspendedPageProxy, if the page failed to suspend, reuse its process but
1604         not the suspended page itself.
1605
1606         * UIProcess/SuspendedPageProxy.cpp:
1607         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1608         (WebKit::SuspendedPageProxy::waitUntilReadyToUnsuspend):
1609         (WebKit::SuspendedPageProxy::unsuspend):
1610         (WebKit::SuspendedPageProxy::didSuspend):
1611         (WebKit::SuspendedPageProxy::didFailToSuspend):
1612         (WebKit::SuspendedPageProxy::loggingString const):
1613         * UIProcess/SuspendedPageProxy.h:
1614         * UIProcess/WebPageProxy.cpp:
1615         (WebKit::WebPageProxy::swapToWebProcess):
1616         * UIProcess/WebProcessPool.cpp:
1617         (WebKit::WebProcessPool::processForNavigationInternal):
1618
1619 2018-12-17  Jiewen Tan  <jiewen_tan@apple.com>
1620
1621         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
1622         https://bugs.webkit.org/show_bug.cgi?id=192061
1623
1624         Reviewed by Dewei Zhu.
1625
1626         Part 3.
1627
1628         Add some additional temporary logging info to determine if the timer is working as expected.
1629         Once the bug is determined and fixed, we should remove all logging added in this patch.
1630
1631         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1632         (WebKit::AuthenticatorManager::respondReceived):
1633         (WebKit::AuthenticatorManager::initTimeOutTimer):
1634         (WebKit::AuthenticatorManager::timeOutTimerFired):
1635         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
1636         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
1637
1638 2018-12-17  Saam barati  <sbarati@apple.com>
1639
1640         Enable HTTP and HTTPS proxies on iOS and make it a property of the NSURLSession
1641         https://bugs.webkit.org/show_bug.cgi?id=192374
1642         <rdar://problem/46506286>
1643
1644         Reviewed by Alex Christensen.
1645
1646         This patch makes it so that we can use HTTP/HTTPS proxies on iOS as well.
1647         To enable on iOS, you can do something like:
1648         $ defaults write -g WebKit2HTTPProxy -string "http://localhost:8080"
1649         $ defaults write -g WebKit2HTTPSProxy -string "http://localhost:8080"
1650         
1651         This patch also changes the Proxy to be enabled on a per NSURLSession
1652         basis instead of a per process basis.
1653
1654         * NetworkProcess/NetworkProcess.cpp:
1655         (WebKit::NetworkProcess::initializeNetworkProcess):
1656         * NetworkProcess/NetworkSessionCreationParameters.cpp:
1657         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
1658         (WebKit::NetworkSessionCreationParameters::encode const):
1659         (WebKit::NetworkSessionCreationParameters::decode):
1660         * NetworkProcess/NetworkSessionCreationParameters.h:
1661         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1662         (WebKit::proxyDictionary):
1663         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1664         * NetworkProcess/mac/NetworkProcessMac.mm:
1665         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
1666         (WebKit::overrideSystemProxies): Deleted.
1667         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1668         (-[WKWebsiteDataStore _initWithConfiguration:]):
1669         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
1670         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
1671         (-[_WKWebsiteDataStoreConfiguration httpProxy]):
1672         (-[_WKWebsiteDataStoreConfiguration setHTTPProxy:]):
1673         (-[_WKWebsiteDataStoreConfiguration httpsProxy]):
1674         (-[_WKWebsiteDataStoreConfiguration setHTTPSProxy:]):
1675         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1676         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
1677         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1678         (WebKit::WebsiteDataStore::parameters):
1679         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1680         (WebKit::WebsiteDataStoreConfiguration::copy):
1681         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1682         (WebKit::WebsiteDataStoreConfiguration::httpProxy const):
1683         (WebKit::WebsiteDataStoreConfiguration::setHTTPProxy):
1684         (WebKit::WebsiteDataStoreConfiguration::httpsProxy const):
1685         (WebKit::WebsiteDataStoreConfiguration::setHTTPSProxy):
1686
1687 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1688
1689         Tap highlights should not be shown on iOSMac
1690         https://bugs.webkit.org/show_bug.cgi?id=192797
1691         <rdar://problem/46793995>
1692
1693         Reviewed by Tim Horton.
1694
1695         WKWebViews in iOSMac should avoid painting tap highlights, since tap highlights are not present in the rest of
1696         the macOS platform. Simply disable this functionality by bailing in `-[WKContentView _showTapHighlight]`.
1697
1698         * UIProcess/ios/WKContentViewInteraction.mm:
1699         (-[WKContentView _showTapHighlight]):
1700
1701 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1702
1703         Unreviewed, fix the iOSMac engineering build again
1704
1705         After r239311, `WebProcessProxy::fullKeyboardAccessEnabled` in `WebProcessProxyIOS.mm` attempts to use
1706         `WKFullKeyboardAccessWatcher`, which is guarded by `ENABLE(FULL_KEYBOARD_ACCESS)`. However, on iOSMac,
1707         `ENABLE(FULL_KEYBOARD_ACCESS)` is 0. Fix the build by putting access to `WKFullKeyboardAccessWatcher` behind
1708         `ENABLE(FULL_KEYBOARD_ACCESS)`.
1709
1710         * UIProcess/ios/WebProcessProxyIOS.mm:
1711         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
1712
1713 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1714
1715         Unreviewed, fix the iOSMac engineering build
1716
1717         `generateRequestID()` is only invoked from code under `ENABLE(MEDIA_STREAM)`; move it under this guard to avoid
1718         an unused function warning.
1719
1720         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1721
1722 2018-12-17  David Kilzer  <ddkilzer@apple.com>
1723
1724         clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit()
1725         <https://webkit.org/b/192707>
1726         <rdar://problem/46734926>
1727
1728         Reviewed by Daniel Bates.
1729
1730         * WebProcess/cocoa/WebProcessCocoa.mm:
1731         (WebKit::WebProcess::updateCPUMonitorState):
1732         - Pass m_cpuLimit directly since getting its value causes an
1733           identical std::optional<double> to be created unnecessarily.
1734
1735 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1736
1737         [iOS] Focusing a large editable element always scrolls to the top of the element
1738         https://bugs.webkit.org/show_bug.cgi?id=192745
1739         <rdar://problem/46758445>
1740
1741         Reviewed by Tim Horton.
1742
1743         Currently, when focusing form controls or editable elements, we try to scroll such that the focused element rect
1744         is centered within the visible area. In the case of very large focusable elements whose dimensions exceed the
1745         width or height of the visible area, we instead scroll such that the top left point of the element is at the top
1746         left corner of the visible area.
1747
1748         However, this results in unnecessary scrolling if the top of the element is already near the top of the visible
1749         area. For WebKit2-based rich text editors that have an editable body element with a top content inset that
1750         contains additional content, this means we will always scroll the additional content away when focusing the
1751         editable body.
1752
1753         To avoid this behavior, adjust focused element zooming logic for editable elements that are too large to be
1754         centered in the visible area, such that we only scroll the top left position of the focused element to the top
1755         half or top right of the visible area, respectively. This reduces the amount of scrolling when focusing large
1756         editable elements, while still making it clear which element is being focused.
1757
1758         * Platform/spi/ios/UIKitSPI.h:
1759         * UIProcess/API/Cocoa/WKWebView.mm:
1760         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1761
1762         Make some small adjustments to improve the readability of this method by using `clampTo` instead of clamping
1763         values by comparing and setting values.
1764
1765         Also, fix an existing bug wherein focusable elements that are meant to be centered within the visible area are
1766         currently offset by half the difference between the bottom inset amount and the top inset amount, in the case
1767         where the `_obscuredInsets` SPI is used to specify content insets for the web view (i.e., MobileSafari).
1768
1769         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1770
1771         Make a couple of arguments `const FloatRect&` instead of just `FloatRect`.
1772
1773 2018-12-17  Ryosuke Niwa  <rniwa@webkit.org>
1774
1775         offsetLeft and offsetParent should adjust across shadow boundaries
1776         https://bugs.webkit.org/show_bug.cgi?id=157437
1777         <rdar://problem/26154021>
1778
1779         Reviewed by Simon Fraser.
1780
1781         Use *forBindings variants of offsetLeft, offsetTop, and offsetParent.
1782
1783         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
1784         (webkit_dom_element_get_offset_left):
1785         (webkit_dom_element_get_offset_top):
1786         (webkit_dom_element_get_offset_parent):
1787
1788 2018-12-17  Chris Fleizach  <cfleizach@apple.com>
1789
1790         Some builds are broken after r239262
1791         https://bugs.webkit.org/show_bug.cgi?id=192777
1792
1793         Reviewed by Simon Fraser.
1794
1795         * Platform/spi/ios/AccessibilitySupportSPI.h:
1796         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h:
1797         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
1798         (platformIsFullKeyboardAccessEnabled):
1799         (-[WKFullKeyboardAccessWatcher init]):
1800         Fix the build by being more clear about when it's OK to use AccessibilitySupport.
1801
1802 2018-12-17  Chris Dumez  <cdumez@apple.com>
1803
1804         Allow passing nil as session state to [WKWebView _restoreSessionState:]
1805         https://bugs.webkit.org/show_bug.cgi?id=192789
1806         <rdar://problem/46755277>
1807
1808         Reviewed by Alex Christensen.
1809
1810         Allow passing nil as session state to [WKWebView _restoreSessionState:] instead of crashing.
1811
1812         * UIProcess/API/Cocoa/WKWebView.mm:
1813         (-[WKWebView _restoreSessionState:andNavigate:]):
1814
1815 2018-12-17  Alex Christensen  <achristensen@webkit.org>
1816
1817         Fix occasional null-dereference crash in WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame
1818         https://bugs.webkit.org/show_bug.cgi?id=192744
1819         <rdar://problem/45842668>
1820
1821         Reviewed by Chris Dumez.
1822
1823         * UIProcess/WebPageProxy.cpp:
1824         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1825         Things happen.  Navigations can be null.  If they are, we shouldn't dereference pointers to them.
1826
1827 2018-12-17  Chris Dumez  <cdumez@apple.com>
1828
1829         Unreviewed, revert recent CrashReporterClient build fixes as they are no longer needed.
1830
1831         * Platform/cocoa/WKCrashReporter.mm:
1832
1833 2018-12-17  Suresh Koppisetty  <skoppisettyt@apple.com>
1834
1835         Rollout r235411
1836         https://bugs.webkit.org/show_bug.cgi?id=192778
1837         <rdar://46789485>
1838
1839         Disabling access to CoreServices is causing a performance
1840         regression in process launch time.  See <rdar://46141878>
1841
1842         Reviewed by Alex Christensen.
1843
1844         * WebProcess/com.apple.WebProcess.sb.in:
1845
1846 2018-12-17  Zan Dobersek  <zdobersek@igalia.com>
1847
1848         Unreviewed WPE build fix after r239277.
1849
1850         * UIProcess/API/C/WKContext.cpp:
1851         (WKContextClearCurrentModifierStateForTesting):
1852         Use the WebKit:: namespace specifier as it is used across this file.
1853
1854 2018-12-17  Commit Queue  <commit-queue@webkit.org>
1855
1856         Unreviewed, rolling out r239265 and r239274.
1857         https://bugs.webkit.org/show_bug.cgi?id=192765
1858
1859         unorm_normalize is deprecated, and broke an internal build
1860         (Requested by Truitt on #webkit).
1861
1862         Reverted changesets:
1863
1864         "[GTK][WPE] Need a function to convert internal URI to display
1865         ("pretty") URI"
1866         https://bugs.webkit.org/show_bug.cgi?id=174816
1867         https://trac.webkit.org/changeset/239265
1868
1869         "Fix the Apple Internal Mac build with a newer SDK"
1870         https://trac.webkit.org/changeset/239274
1871
1872 2018-12-17  Daniel Bates  <dabates@apple.com>
1873
1874         Implement UIScriptController::toggleCapsLock() for iOS
1875         https://bugs.webkit.org/show_bug.cgi?id=191815
1876
1877         Reviewed by Andy Estes.
1878
1879         Add test infrastructure to clear the current modifier state. We will use this to ensure that
1880         the caps lock state does not persist between tests.
1881
1882         * UIProcess/API/C/WKContext.cpp:
1883         (WKContextClearCurrentModifierStateForTesting): Added.
1884         * UIProcess/API/C/WKContextPrivate.h:
1885         * UIProcess/WebProcessPool.cpp:
1886         (WebKit::WebProcessPool::clearCurrentModifierStateForTesting): Added.
1887         * UIProcess/WebProcessPool.h:
1888         * WebProcess/WebProcess.cpp:
1889         (WebKit::WebProcess::clearCurrentModifierStateForTesting): Added.
1890         * WebProcess/WebProcess.h:
1891         * WebProcess/WebProcess.messages.in:
1892
1893 2018-12-17  David Kilzer  <ddkilzer@apple.com>
1894
1895         REGRESSION (r239262): Fix broken builds prior to Mojave
1896         <https://bugs.webkit.org/show_bug.cgi?id=192373>
1897         <rdar://problem/46462670>
1898
1899         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
1900         Wrap header in ENABLE(ACCESSIBILITY_EVENTS) to fix the build.
1901
1902 2018-12-17  Daniel Bates  <dabates@apple.com>
1903
1904         [iOS] Remove -[WebEvent initWithKeyEventType:...:characterSet:]
1905         https://bugs.webkit.org/show_bug.cgi?id=192633
1906
1907         Reviewed by Wenson Hsieh.
1908
1909         Update code to use the modern initializer.
1910
1911         * UIProcess/ios/WKWebEvent.mm:
1912         (-[WKWebEvent initWithEvent:]):
1913
1914 2018-12-17  Matt Lewis  <jlewis3@apple.com>
1915
1916         Unreviewed, rolling out r239254.
1917
1918         This broke the Windows 10 Debug build
1919
1920         Reverted changeset:
1921
1922         "Replace many uses of String::format with more type-safe
1923         alternatives"
1924         https://bugs.webkit.org/show_bug.cgi?id=192742
1925         https://trac.webkit.org/changeset/239254
1926
1927 2018-12-17  David Kilzer  <ddkilzer@apple.com>
1928
1929         clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
1930         <https://webkit.org/b/192751>
1931         <rdar://problem/46771623>
1932
1933         Reviewed by Daniel Bates.
1934
1935         Change loop variables to const references to avoid unnecessary
1936         copies.
1937
1938         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1939         (WebKit::WebSWServerConnection::~WebSWServerConnection):
1940         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1941         (WebKit::RemoteLayerTreeTransaction::encode const):
1942         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1943         (WebKit::toNSErrors):
1944         * UIProcess/Automation/WebAutomationSession.cpp:
1945         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
1946         (WebKit::WebAutomationSession::performKeyboardInteractions):
1947         (WebKit::WebAutomationSession::performInteractionSequence):
1948         * UIProcess/Plugins/PluginProcessManager.cpp:
1949         (WebKit::PluginProcessManager::getPluginProcess):
1950         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
1951         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1952         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
1953         * UIProcess/WebPageProxy.cpp:
1954         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
1955         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1956         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
1957         (WebKit::LocalStorageDatabaseTracker::origins const):
1958         (WebKit::LocalStorageDatabaseTracker::originDetails):
1959         * WebProcess/WebPage/WebPage.cpp:
1960         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
1961         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1962         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
1963
1964 2018-12-17  Ms2ger  <Ms2ger@igalia.com>
1965
1966         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
1967         https://bugs.webkit.org/show_bug.cgi?id=174816
1968
1969         Reviewed by Michael Catanzaro.
1970
1971         Add webkit_uri_for_display for GTK and WPE.
1972
1973         * PlatformGTK.cmake:
1974         * PlatformWPE.cmake:
1975         * SourcesGTK.txt:
1976         * SourcesWPE.txt:
1977         * UIProcess/API/glib/WebKitURIUtilities.cpp: Added.
1978         (webkit_uri_for_display):
1979         * UIProcess/API/gtk/WebKitURIUtilities.h: Added.
1980         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1981         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1982         * UIProcess/API/gtk/webkit2.h:
1983         * UIProcess/API/wpe/WebKitURIUtilities.h: Added.
1984         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
1985         * UIProcess/API/wpe/docs/wpe-docs.sgml:
1986         * UIProcess/API/wpe/webkit.h:
1987
1988 2018-12-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1989
1990         [WPE] Add API to notify about frame displayed view backend callback
1991         https://bugs.webkit.org/show_bug.cgi?id=192224
1992
1993         Reviewed by Michael Catanzaro.
1994
1995         Add API to add a callback to the view to be called when the view backend notifies that a frame has been
1996         displayed.
1997
1998         * UIProcess/API/glib/WebKitWebView.cpp:
1999         (FrameDisplayedCallback::FrameDisplayedCallback):
2000         (FrameDisplayedCallback::~FrameDisplayedCallback):
2001         (webkit_web_view_add_frame_displayed_callback):
2002         (webkit_web_view_remove_frame_displayed_callback):
2003         * UIProcess/API/wpe/WebKitWebView.h:
2004         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2005
2006 2018-12-16  Chris Fleizach  <cfleizach@apple.com>
2007
2008         AX: Support keyboard access preference for iOS in WebKit
2009         https://bugs.webkit.org/show_bug.cgi?id=192373
2010         <rdar://problem/46462670>
2011
2012         Reviewed by Tim Horton.
2013
2014         * Platform/spi/ios/AccessibilitySupportSPI.h:
2015         * PlatformMac.cmake:
2016         * SourcesCocoa.txt:
2017         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h: Added.
2018         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Added.
2019         (platformIsFullKeyboardAccessEnabled):
2020         (-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
2021         (-[WKFullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
2022         (-[WKFullKeyboardAccessWatcher init]):
2023         (+[WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
2024         * UIProcess/ios/WebProcessProxyIOS.mm:
2025         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
2026         * UIProcess/mac/WKFullKeyboardAccessWatcher.h: Removed.
2027         * UIProcess/mac/WKFullKeyboardAccessWatcher.mm: Removed.
2028         * WebKit.xcodeproj/project.pbxproj:
2029
2030 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
2031
2032         Unreviewed follow up after r239260
2033         https://bugs.webkit.org/show_bug.cgi?id=192714
2034         <rdar://problem/46762407>
2035
2036         * Platform/win/SharedMemoryWin.cpp:
2037         (WebKit::SharedMemory::allocate): Use PAGE_READWRITE directly instead
2038         of going through the protectAttribute() function, which is removed
2039         because it is now unused.
2040
2041 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
2042
2043         Unify SharedMemory factory functions
2044         https://bugs.webkit.org/show_bug.cgi?id=192714
2045
2046         Reviewed by Darin Adler.
2047
2048         This unifies SharedMemory so in the following way, across platforms:
2049
2050         - SharedMemory::create() is removed, to avoid ambiguity.
2051         - SharedMemory::allocate() always allocates a new block of shared memory.
2052         - SharedMemory::wrapMap() always creates a SharedMemory object which refers to an
2053           existing region of memory resulting from memory-mapping a file.
2054
2055         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
2056         (WebKit::NetworkCache::Data::tryCreateSharedMemory const): Use SharedMemory::wrapMap().
2057         * Platform/SharedMemory.h: Remove the definition of SharedMemory::create(), and make
2058         SharedMemory::wrapMap() available on OS(DARWIN) as well.
2059         * Platform/cocoa/SharedMemoryCocoa.cpp:
2060         (WebKit::SharedMemory::wrapMap): Renamed from ::create().
2061         * Platform/unix/SharedMemoryUnix.cpp:
2062         (WebKit::SharedMemory::allocate): Renamed from ::create().
2063         * Platform/win/SharedMemoryWin.cpp:
2064         (WebKit::SharedMemory::allocate): Renamed from ::create()
2065         * UIProcess/API/APIContentRuleListStore.cpp:
2066         (API::createExtension): Use NetworkCache::Data::tryCreateSharedMemory() instead of
2067         SharedMemory::create().
2068
2069 2018-12-15  Chris Fleizach  <cfleizach@apple.com>
2070
2071         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2072         https://bugs.webkit.org/show_bug.cgi?id=192449
2073         <rdar://problem/46595508>
2074
2075         Reviewed by Darin Adler.
2076
2077         Part 7: Files in UIProcess/API
2078
2079         * UIProcess/API/APIContentRuleListStore.cpp:
2080         * UIProcess/API/APIHitTestResult.cpp:
2081         * UIProcess/API/APINavigation.cpp:
2082         * UIProcess/API/APIOpenPanelParameters.cpp:
2083         * UIProcess/API/APIPageConfiguration.cpp:
2084         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2085         (WKApplicationCacheManagerGetTypeID):
2086         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2087         (WKApplicationCacheManagerDeleteEntriesForOrigin):
2088         (WKApplicationCacheManagerDeleteAllEntries):
2089         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
2090         (WKAuthenticationDecisionListenerGetTypeID):
2091         (WKAuthenticationDecisionListenerUseCredential):
2092         (WKAuthenticationDecisionListenerCancel):
2093         (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue):
2094         * UIProcess/API/C/WKBackForwardListItemRef.cpp:
2095         (WKBackForwardListItemGetTypeID):
2096         (WKBackForwardListItemCopyURL):
2097         (WKBackForwardListItemCopyTitle):
2098         (WKBackForwardListItemCopyOriginalURL):
2099         * UIProcess/API/C/WKContext.cpp:
2100         (WKContextGetTypeID):
2101         (WKContextCreate):
2102         (WKContextCreateWithInjectedBundlePath):
2103         (WKContextCreateWithConfiguration):
2104         (WKContextSetClient):
2105         (WKContextSetInjectedBundleClient):
2106         (WKContextSetHistoryClient):
2107         (WKContextSetDownloadClient):
2108         (WKContextSetConnectionClient):
2109         (WKContextDownloadURLRequest):
2110         (WKContextResumeDownload):
2111         (WKContextSetInitializationUserDataForInjectedBundle):
2112         (WKContextPostMessageToInjectedBundle):
2113         (WKContextGetGlobalStatistics):
2114         (WKContextAddVisitedLink):
2115         (WKContextClearVisitedLinks):
2116         (WKContextSetCacheModel):
2117         (WKContextGetCacheModel):
2118         (WKContextSetMaximumNumberOfProcesses):
2119         (WKContextGetMaximumNumberOfProcesses):
2120         (WKContextSetAlwaysUsesComplexTextCodePath):
2121         (WKContextSetShouldUseFontSmoothing):
2122         (WKContextSetAdditionalPluginsDirectory):
2123         (WKContextRefreshPlugIns):
2124         (WKContextRegisterURLSchemeAsEmptyDocument):
2125         (WKContextRegisterURLSchemeAsSecure):
2126         (WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy):
2127         (WKContextRegisterURLSchemeAsCachePartitioned):
2128         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
2129         (WKContextSetDomainRelaxationForbiddenForURLScheme):
2130         (WKContextSetCanHandleHTTPSServerTrustEvaluation):
2131         (WKContextSetPrewarmsProcessesAutomatically):
2132         (WKContextSetCustomWebContentServiceBundleIdentifier):
2133         (WKContextSetDiskCacheSpeculativeValidationEnabled):
2134         (WKContextPreconnectToServer):
2135         (WKContextGetCookieManager):
2136         (WKContextGetWebsiteDataStore):
2137         (WKContextGetGeolocationManager):
2138         (WKContextGetMediaSessionFocusManager):
2139         (WKContextGetNotificationManager):
2140         (WKContextStartMemorySampler):
2141         (WKContextStopMemorySampler):
2142         (WKContextAllowSpecificHTTPSCertificateForHost):
2143         (WKContextDisableProcessTermination):
2144         (WKContextEnableProcessTermination):
2145         (WKContextSetHTTPPipeliningEnabled):
2146         (WKContextWarmInitialProcess):
2147         (WKContextGetStatistics):
2148         (WKContextGetStatisticsWithOptions):
2149         (WKContextJavaScriptConfigurationFileEnabled):
2150         (WKContextSetJavaScriptConfigurationFileEnabled):
2151         (WKContextGarbageCollectJavaScriptObjects):
2152         (WKContextSetJavaScriptGarbageCollectorTimerEnabled):
2153         (WKContextUseTestingNetworkSession):
2154         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
2155         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
2156         (WKContextClearCachedCredentials):
2157         (WKContextCopyPlugInAutoStartOriginHashes):
2158         (WKContextSetPlugInAutoStartOriginHashes):
2159         (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
2160         (WKContextSetPlugInAutoStartOrigins):
2161         (WKContextSetInvalidMessageFunction):
2162         (WKContextSetMemoryCacheDisabled):
2163         (WKContextSetFontWhitelist):
2164         (WKContextTerminateNetworkProcess):
2165         (WKContextTerminateServiceWorkerProcess):
2166         (WKContextGetNetworkProcessIdentifier):
2167         (WKContextAddSupportedPlugin):
2168         (WKContextClearSupportedPlugins):
2169         (WKContextSetIDBPerOriginQuota):
2170         * UIProcess/API/C/WKPage.cpp:
2171         (WKPageLoadURLWithShouldOpenExternalURLsPolicy):
2172         (WKPageLoadURLWithUserData):
2173         (WKPageLoadURLRequestWithUserData):
2174         (WKPageSetPaginationMode):
2175         (WKPageGetPaginationMode):
2176         (WKPageSetPageLoaderClient):
2177         (WKPageSetPagePolicyClient):
2178         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
2179
2180 2018-12-15  Darin Adler  <darin@apple.com>
2181
2182         Use warning-ignoring macros more consistently and simply
2183         https://bugs.webkit.org/show_bug.cgi?id=192743
2184
2185         Reviewed by Mark Lam.
2186
2187         * UIProcess/ios/WKDrawingView.mm:
2188         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2189         Use ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
2190         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2191         (-[WKFullScreenWindowController _EVOrganizationName]): Ditto.
2192
2193         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: Use
2194         IGNORE_WARNINGS_BEGIN/END instead of IGNORE_CLANG_WARNINGS_BEGIN/END
2195         because there is no need to accomodate non-clang compilers here.
2196         Also use #pragma once, add a missing "explicit", and fix conditionals.
2197
2198 2018-12-15  Darin Adler  <darin@apple.com>
2199
2200         Replace many uses of String::format with more type-safe alternatives
2201         https://bugs.webkit.org/show_bug.cgi?id=192742
2202
2203         Reviewed by Mark Lam.
2204
2205         * Shared/WebMemorySampler.cpp:
2206         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
2207
2208         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2209         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
2210
2211         * UIProcess/WebInspectorUtilities.cpp:
2212         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
2213         * UIProcess/WebProcessPool.cpp:
2214         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
2215         (WebKit::WebProcessPool::startMemorySampler): Ditto.
2216
2217 2018-12-14  Ryan Haddad  <ryanhaddad@apple.com>
2218
2219         Unreviewed, fix the build with recent SDKs.
2220
2221         * UIProcess/ios/WKDrawingView.mm:
2222         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2223
2224 2018-12-14  Jiewen Tan  <jiewen_tan@apple.com>
2225
2226         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2227         https://bugs.webkit.org/show_bug.cgi?id=192061
2228
2229         Reviewed by Dewei Zhu.
2230
2231         Part 2.
2232
2233         Add some additional temporary logging info. Since the failure cannot be reproduced easily by human, we have to
2234         rely on the test infrastructure to reporoduce it. Once the bug is determined and fixed, we should remove all
2235         logging added in this patch.
2236
2237         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
2238         (WebKit::HidService::deviceAdded):
2239         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
2240         (WebKit::CtapHidAuthenticator::makeCredential):
2241         (WebKit::CtapHidAuthenticator::getAssertion):
2242         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2243         (WebKit::CtapHidDriver::Worker::write):
2244         (WebKit::CtapHidDriver::Worker::read):
2245         (WebKit::CtapHidDriver::Worker::returnMessage):
2246         (WebKit::CtapHidDriver::transact):
2247         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2248         (WebKit::CtapHidDriver::continueAfterResponseReceived):
2249
2250 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
2251
2252         [GTK] Unreviewed build fix.
2253
2254         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Add missing WebPolicyAction.h include.
2255
2256 2018-12-14  Chris Dumez  <cdumez@apple.com>
2257
2258         Unreviewed, fix assertion failure in API test after r239210.
2259
2260         * WebProcess/WebPage/WebPage.cpp:
2261         (WebKit::WebPage::createDocumentLoader):
2262
2263 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
2264
2265         [SOUP] Unreviewed build fix after r239219
2266
2267         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2268         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Remove
2269         handling of PolicyAction::Suspend, which is no longer available.
2270
2271 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
2272
2273         Unreviewed, apply post-landing review comments after r239221.
2274
2275         * UIProcess/WebPageDebuggable.cpp:
2276         (WebKit::WebPageDebuggable::url const):
2277         Switch to WTF::blankURL() instead of using "about:blank" directly.
2278
2279 2018-12-14  Chris Dumez  <cdumez@apple.com>
2280
2281         [PSON] Process-swapping on a loadHTMLString causes duplicate decidePolicyForNavigationAction delegate calls
2282         https://bugs.webkit.org/show_bug.cgi?id=192704
2283
2284         Reviewed by Geoffrey Garen.
2285
2286         Process-swapping on a loadHTMLString causes duplicate decidePolicyForNavigationAction delegate calls. This
2287         is because we were failing to pass the ShouldTreatAsContinuingLoad flag to the WebContent process when
2288         doing a LoadData.
2289
2290         * UIProcess/WebPageProxy.cpp:
2291         (WebKit::WebPageProxy::loadData):
2292         (WebKit::WebPageProxy::loadDataWithNavigation):
2293         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2294         * UIProcess/WebPageProxy.h:
2295         * WebProcess/WebPage/WebPage.cpp:
2296         (WebKit::WebPage::loadDataImpl):
2297         (WebKit::WebPage::loadData):
2298         (WebKit::WebPage::loadAlternateHTML):
2299         * WebProcess/WebPage/WebPage.h:
2300
2301 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
2302
2303         Web Inspector: Prefer "about:blank" instead of an empty string for WebPageDebuggable url
2304         https://bugs.webkit.org/show_bug.cgi?id=192691
2305         <rdar://problem/46719798>
2306
2307         Reviewed by Darin Adler.
2308
2309         * UIProcess/WebPageDebuggable.cpp:
2310         (WebKit::WebPageDebuggable::url const):
2311         Instead of an empty string, return "about:blank" in bail cases.
2312         When inspecting the page that matches the contents.
2313
2314 2018-12-14  Chris Dumez  <cdumez@apple.com>
2315
2316         [PSON] Stop exposing PolicyAction::Suspend to WebCore
2317         https://bugs.webkit.org/show_bug.cgi?id=192701
2318
2319         Reviewed by Brady Eidson.
2320
2321         Introduce a new WebPolicyAction enum that is used at WebKit2 layer and augments
2322         WebCore::PolicyAction with a "Suspend" value.
2323
2324         * NetworkProcess/NetworkDataTaskBlob.cpp:
2325         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
2326         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2327         (toNSURLSessionResponseDisposition):
2328         * Shared/WebPolicyAction.h: Added.
2329         * UIProcess/WebFramePolicyListenerProxy.cpp:
2330         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
2331         (WebKit::WebFramePolicyListenerProxy::use):
2332         (WebKit::WebFramePolicyListenerProxy::download):
2333         (WebKit::WebFramePolicyListenerProxy::ignore):
2334         * UIProcess/WebFramePolicyListenerProxy.h:
2335         * UIProcess/WebFrameProxy.cpp:
2336         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
2337         * UIProcess/WebFrameProxy.h:
2338         * UIProcess/WebPageProxy.cpp:
2339         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2340         (WebKit::WebPageProxy::receivedPolicyDecision):
2341         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2342         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2343         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
2344         (WebKit::WebPageProxy::decidePolicyForResponse):
2345         * UIProcess/WebPageProxy.h:
2346         * UIProcess/WebPageProxy.messages.in:
2347         * WebKit.xcodeproj/project.pbxproj:
2348         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2349         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2350         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2351         * WebProcess/WebPage/WebFrame.cpp:
2352         (WebKit::toPolicyAction):
2353         (WebKit::WebFrame::didReceivePolicyDecision):
2354         * WebProcess/WebPage/WebFrame.h:
2355         * WebProcess/WebPage/WebPage.cpp:
2356         (WebKit::WebPage::didReceivePolicyDecision):
2357         * WebProcess/WebPage/WebPage.h:
2358         * WebProcess/WebPage/WebPage.messages.in:
2359
2360 2018-12-14  David Quesada  <david_quesada@apple.com>
2361
2362         Remove a global 'using namespace WebKit' in WebViewImpl.mm
2363         https://bugs.webkit.org/show_bug.cgi?id=192690
2364
2365         Reviewed by Tim Horton.
2366
2367         * UIProcess/Cocoa/WebViewImpl.mm:
2368         (-[WKTextListTouchBarViewController initWithWebViewImpl:]):
2369         (-[WKTextListTouchBarViewController _selectList:]):
2370         (-[WKTextListTouchBarViewController setCurrentListType:]):
2371         (-[WKTextTouchBarItemController initWithWebViewImpl:]):
2372
2373 2018-12-14  Chris Dumez  <cdumez@apple.com>
2374
2375         [PSON] WebsitePolicies are lost on process-swap
2376         https://bugs.webkit.org/show_bug.cgi?id=192694
2377         <rdar://problem/46715748>
2378
2379         Reviewed by Brady Eidson.
2380
2381         In case of process-swap on navigation, instead of sending the websitePolicies to the old
2382         process, send them to the new process as we trigger the navigation. We tell the new process
2383         that it is continuing a load and it will therefore not re-trigger a decidePolicyForNavigationAction.
2384
2385         * Shared/LoadParameters.cpp:
2386         (WebKit::LoadParameters::encode const):
2387         (WebKit::LoadParameters::decode):
2388         * Shared/LoadParameters.h:
2389         * UIProcess/WebPageProxy.cpp:
2390         (WebKit::WebPageProxy::reattachToWebProcessForReload):
2391         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
2392         (WebKit::WebPageProxy::loadRequestWithNavigation):
2393         (WebKit::WebPageProxy::loadDataWithNavigation):
2394         (WebKit::WebPageProxy::goToBackForwardItem):
2395         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
2396         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2397         * UIProcess/WebPageProxy.h:
2398         * WebProcess/WebPage/WebPage.cpp:
2399         (WebKit::WebPage::loadRequest):
2400         (WebKit::WebPage::loadDataImpl):
2401         (WebKit::WebPage::loadData):
2402         (WebKit::WebPage::loadAlternateHTML):
2403         (WebKit::WebPage::goToBackForwardItem):
2404         (WebKit::WebPage::createDocumentLoader):
2405         * WebProcess/WebPage/WebPage.h:
2406         * WebProcess/WebPage/WebPage.messages.in:
2407
2408 2018-12-14  Patrick Griffis  <pgriffis@igalia.com>
2409
2410         [GTK][WPE] Fix forwarding webkit socket to flatpak sandbox
2411         https://bugs.webkit.org/show_bug.cgi?id=192622
2412
2413         Reviewed by Michael Catanzaro.
2414
2415         This fixes running with the sandbox enabled in Flatpak.
2416
2417         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
2418         (WebKit::flatpakSpawn):
2419         * UIProcess/Launcher/glib/FlatpakLauncher.h:
2420         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
2421         (WebKit::ProcessLauncher::launchProcess):
2422
2423 2018-12-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2424
2425         [WPE] Use new view state API from libwpe
2426         https://bugs.webkit.org/show_bug.cgi?id=191906
2427
2428         Reviewed by Žan Doberšek.
2429
2430         Remove WKViewSetViewState from the C API.
2431
2432         * UIProcess/API/C/wpe/WKAPICastWPE.h:
2433         * UIProcess/API/C/wpe/WKView.cpp:
2434         * UIProcess/API/C/wpe/WKView.h:
2435         * UIProcess/API/wpe/WPEView.cpp:
2436         (WKWPE::View::View): Add implementation for activity_state_changed vfunc of the view backend client.):
2437         (WKWPE::View::setViewState): Remove the default flags.
2438         * UIProcess/API/wpe/WPEView.h:
2439         (WKWPE::View::setViewState const): Make it private.
2440
2441 2018-12-13  Joseph Pecoraro  <pecoraro@apple.com>
2442
2443         [iOS] Web Inspector: Occasional UIProcess crashes under WebPageProxy::showInspectorIndication
2444         https://bugs.webkit.org/show_bug.cgi?id=192689
2445         <rdar://problem/46323610>
2446
2447         Reviewed by Simon Fraser.
2448
2449         * UIProcess/WebPageProxy.cpp:
2450         (WebKit::WebPageProxy::close):
2451         * UIProcess/WebPageProxy.h:
2452         Don't wait until ~WebPageProxy to destroy the WebPageProxyDebuggable
2453         which broadcasts it as a remote inspector target. Terminate this
2454         as soon as the WebPageProxy closes and becomes invalid.
2455
2456 2018-12-13  Chris Dumez  <cdumez@apple.com>
2457
2458         Unreviewed build fix for tvOS.
2459
2460         * Platform/cocoa/WKCrashReporter.mm:
2461
2462 2018-12-13  Chris Dumez  <cdumez@apple.com>
2463
2464         Unreviewed build fix for tvOS.
2465
2466         * Platform/cocoa/WKCrashReporter.mm:
2467
2468 2018-12-13  Chris Dumez  <cdumez@apple.com>
2469
2470         [PSON] We should not need to navigate to 'about:blank' to suspend pages
2471         https://bugs.webkit.org/show_bug.cgi?id=192668
2472         <rdar://problem/46701466>
2473
2474         Reviewed by Alex Christensen.
2475
2476         To support PageCache when process-swap on cross-site navigation is enabled,
2477         we've been navigating the previous process to 'about:blank' when swapping.
2478         This would trigger PageCaching of the page in the old process. While
2479         convenient, this design has led to a lot of bugs because we did not really
2480         want a navigation to happen in the old process.
2481
2482         To address the issue, when a WebPage is asked to suspend (for process-swap),
2483         we now attempt to add it to PageCache and save it on the current HistoryItem,
2484         *without* triggering any navigation. Any pending navigation gets cancelled
2485         and we just suspend in place.
2486
2487         Later on, when we want to go back to this HistoryItem, we simply leverage the
2488         existing WebPage::goToBackForwardItem() code path. The only subtlety is that
2489         we're actually asking the WebPage to load a HistoryItem that is the current
2490         one in the History. I had to tweak a some logic / assertions to support this
2491         as this is not something we usually do. However, it actually works with very
2492         little changes and successfully restores the PageCache entry on the current
2493         HistoryItem.
2494
2495         There is no expected overall behavior change and ProcessSwap API tests (which
2496         cover PageCache) still pass. This is merely a simpler design because it avoids
2497         navigating to about:blank.
2498
2499         * UIProcess/SuspendedPageProxy.cpp:
2500         (WebKit::SuspendedPageProxy::didSuspend):
2501         (WebKit::SuspendedPageProxy::didReceiveMessage):
2502         * UIProcess/SuspendedPageProxy.h:
2503         * UIProcess/WebPageProxy.cpp:
2504         (WebKit::WebPageProxy::didSuspendAfterProcessSwap):
2505         * UIProcess/WebPageProxy.h:
2506         * UIProcess/WebPageProxy.messages.in:
2507         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2508         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2509         * WebProcess/WebPage/WebDocumentLoader.cpp:
2510         (WebKit::WebDocumentLoader::setNavigationID):
2511         * WebProcess/WebPage/WebFrame.cpp:
2512         (WebKit::WebFrame::didReceivePolicyDecision):
2513         * WebProcess/WebPage/WebPage.cpp:
2514         (WebKit::WebPage::suspendForProcessSwap):
2515         * WebProcess/WebPage/WebPage.h:
2516         * WebProcess/cocoa/WebProcessCocoa.mm:
2517         (WebKit::origin):
2518
2519 2018-12-13  Per Arne Vollan  <pvollan@apple.com>
2520
2521         [macOS] Remove with-report from 3 services that are currently needed on macOS
2522         https://bugs.webkit.org/show_bug.cgi?id=192593
2523         <rdar://problem/46604752>
2524
2525         Reviewed by Brent Fulgham.
2526
2527         * WebProcess/com.apple.WebProcess.sb.in:
2528
2529 2018-12-13  Youenn Fablet  <youenn@apple.com>
2530
2531         On page close, WebPage::m_userMediaPermissionRequestManager is nullified too early
2532         https://bugs.webkit.org/show_bug.cgi?id=192657
2533
2534         Reviewed by Eric Carlson.
2535
2536         Instead of nullifying the manager, make it a UniqueRef and clear it on closing the page.
2537         This ensures we revoke the sandbox extensions as early as possible and keep the manager lifetime simple.
2538
2539         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2540         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager):
2541         (WebKit::UserMediaPermissionRequestManager::clear):
2542         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
2543         * WebProcess/WebPage/WebPage.cpp:
2544         (WebKit::WebPage::close):
2545         * WebProcess/WebPage/WebPage.h:
2546         (WebKit::WebPage::userMediaPermissionRequestManager):
2547
2548 2018-12-13  Chris Fleizach  <cfleizach@apple.com>
2549
2550         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2551         https://bugs.webkit.org/show_bug.cgi?id=192449
2552         <rdar://problem/46595508>
2553
2554         Reviewed by Darin Adler.
2555
2556         Part 6: Files in plugin process and UI process.
2557
2558         * PluginProcess/PluginControllerProxy.cpp:
2559         * PluginProcess/PluginProcess.cpp:
2560         * PluginProcess/WebProcessConnection.cpp:
2561         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
2562         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
2563         * UIProcess/mac/WebPageProxyMac.mm:
2564
2565 2018-12-13  Eric Carlson  <eric.carlson@apple.com>
2566
2567         [MediaStream] Calculate width or height when constraints contain only the other
2568         https://bugs.webkit.org/show_bug.cgi?id=192632
2569         <rdar://problem/46665734>
2570
2571         Reviewed by Youenn Fablet.
2572
2573         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
2574         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable): Deleted,
2575         replaced with videoSampleAvailable.
2576
2577         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
2578         (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Use original frame
2579         size if necessary when calculating new frame size.
2580
2581 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2582
2583         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2584         https://bugs.webkit.org/show_bug.cgi?id=192449
2585         <rdar://problem/46595508>
2586
2587         Reviewed by Darin Adler.
2588
2589         Part 5: Files in WebProcess folder.
2590
2591         * WebProcess/Cache/WebCacheStorageConnection.cpp:
2592         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
2593         (mediaTimeToCurrentTime):
2594         (-[WKAnimationDelegate initWithLayerID:layerTreeHost:]):
2595         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
2596         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
2597
2598 2018-12-12  Ross Kirsling  <ross.kirsling@sony.com>
2599
2600         [MSVC] Unreviewed build fix for r239080.
2601
2602         * UIProcess/WebPageProxy.cpp:
2603         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap):
2604
2605 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2606
2607         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2608         https://bugs.webkit.org/show_bug.cgi?id=192449
2609         <rdar://problem/46595508>
2610
2611         Reviewed by Darin Adler.
2612
2613         Part 4: Handling NetworkProcess folder.
2614
2615         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2616         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2617         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2618         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2619         * NetworkProcess/ios/NetworkProcessIOS.mm:
2620         * NetworkProcess/mac/NetworkProcessMac.mm:
2621         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2622
2623 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2624
2625         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2626         https://bugs.webkit.org/show_bug.cgi?id=192449
2627         <rdar://problem/46595508>
2628
2629         Reviewed by Tim Horton.
2630
2631         Fix iosmac build.
2632
2633         * UIProcess/ios/WKContentViewInteraction.mm:
2634         (-[WKContentView _hoverGestureRecognizerChanged:]):
2635
2636 2018-12-12  Alex Christensen  <achristensen@webkit.org>
2637
2638         Implement safe browsing in WebKit on WatchOS
2639         https://bugs.webkit.org/show_bug.cgi?id=192641
2640         <rdar://problem/46376188>
2641
2642         Reviewed by Geoff Garen.
2643
2644         WatchOS has a few special requirements:
2645         1. The margin size needs to be smaller and the title font smaller to fit on the screen.
2646         2. The exclamation point cannot be beside the title or it won't fit on the screen.  I put it above the title.
2647         3. The application must be told when the safe browsing warning has been shown.  I added a new delegate callback.
2648         4. The UIScrollView's contentSize must be set even before the details are shown to be able to scroll down to the buttons.
2649            This was already an issue on small WKWebViews on iOS, so this fixes both operating systems.
2650
2651         * Configurations/WebKit.xcconfig:
2652         * UIProcess/API/APIUIClient.h:
2653         (API::UIClient::didShowSafeBrowsingWarning):
2654         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2655         * UIProcess/Cocoa/UIDelegate.h:
2656         * UIProcess/Cocoa/UIDelegate.mm:
2657         (WebKit::UIDelegate::setDelegate):
2658         (WebKit::UIDelegate::UIClient::didShowSafeBrowsingWarning):
2659         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2660         (fontOfSize):
2661         (buttonSize):
2662         (-[WKSafeBrowsingWarning addContent]):
2663         (-[WKSafeBrowsingWarning showDetailsClicked]):
2664         (-[WKSafeBrowsingWarning updateContentSize]):
2665         (buttonWidth): Deleted.
2666         * UIProcess/WebPageProxy.cpp:
2667         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2668
2669 2018-12-12  Commit Queue  <commit-queue@webkit.org>
2670
2671         Unreviewed, rolling out r239129 and r239131.
2672         https://bugs.webkit.org/show_bug.cgi?id=192646
2673
2674         Casued macOS and iOS Debug testing to fail early (Requested by
2675         Truitt on #webkit).
2676
2677         Reverted changesets:
2678
2679         "Unreviewed build fix for WinCairo Debug after r239080(?)."
2680         https://trac.webkit.org/changeset/239129
2681
2682         "Unreviewed fix for Cocoa Debug test instability following
2683         r239129."
2684         https://trac.webkit.org/changeset/239131
2685
2686 2018-12-12  Vivek Seth  <v_seth@apple.com>
2687
2688         HTTPS Upgrade: Figure out if/how to tell clients that the HTTPS upgrade happened
2689         https://bugs.webkit.org/show_bug.cgi?id=192375
2690         <rdar://problem/45851159>
2691
2692         Reviewed by Chris Dumez.
2693
2694         Use simulated redirect to tell clients that HTTPS Upgrade happened.
2695
2696         * NetworkProcess/NetworkLoadChecker.cpp:
2697         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2698         (WebKit::NetworkLoadChecker::checkRedirection):
2699         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler):
2700         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
2701         (WebKit::NetworkLoadChecker::checkRequest):
2702         (WebKit::NetworkLoadChecker::continueCheckingRequestOrDoSyntheticRedirect):
2703         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2704         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded): Deleted.
2705         * NetworkProcess/NetworkLoadChecker.h:
2706         * NetworkProcess/NetworkResourceLoader.cpp:
2707         (WebKit::NetworkResourceLoader::start):
2708         * NetworkProcess/PingLoad.cpp:
2709
2710 2018-12-12  Ross Kirsling  <ross.kirsling@sony.com>
2711
2712         Unreviewed fix for Cocoa Debug test instability following r239129.
2713
2714         * UIProcess/WebPageProxy.cpp:
2715         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap): Deleted.
2716         * UIProcess/WebPageProxy.h:
2717         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap):
2718         Move the whole assertion to the declaration site.
2719
2720 2018-12-12  Chris Dumez  <cdumez@apple.com>
2721
2722         Add a preference to enable / disable devicemotion and deviceorientation events
2723         https://bugs.webkit.org/show_bug.cgi?id=192631
2724         <rdar://problem/46646244>
2725
2726         Reviewed by Geoffrey Garen.
2727
2728         Add setting to toggle support for the deviceorientation / devicemotion events:
2729         - https://w3c.github.io/deviceorientation/
2730
2731         * Shared/WebPreferences.yaml:
2732         * UIProcess/API/Cocoa/WKPreferences.mm:
2733         (-[WKPreferences _setDeviceOrientationEventEnabled:]):
2734         (-[WKPreferences _deviceOrientationEventEnabled]):
2735         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2736
2737 2018-12-12  Ross Kirsling  <ross.kirsling@sony.com>
2738
2739         Unreviewed build fix for WinCairo Debug after r239080(?).
2740
2741         MSVC gives a redefinition error if noreturn is specified on the definition instead of the declaration.
2742
2743         * UIProcess/WebPageProxy.cpp:
2744         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap):
2745         * UIProcess/WebPageProxy.h:
2746         Move NO_RETURN_DUE_TO_ASSERT to the declaration site.
2747
2748 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2749
2750         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2751         https://bugs.webkit.org/show_bug.cgi?id=192449
2752         <rdar://problem/46595508>
2753
2754         Reviewed by Darin Adler.
2755
2756         Part 2: UIProcess/Cocoa and UIProcess/ios folders.
2757
2758         * UIProcess/Cocoa/WebViewImpl.h:
2759         * UIProcess/Cocoa/WebViewImpl.mm:
2760         * UIProcess/ios/WKContentView.mm:
2761         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
2762         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
2763         (-[WKContentView dealloc]):
2764         (-[WKContentView page]):
2765         (-[WKContentView updateFixedClippingView:]):
2766         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2767         (-[WKContentView _updateForScreen:]):
2768         (-[WKContentView _accessibilityRegisterUIProcessTokens]):
2769         (-[WKContentView _createDrawingAreaProxy]):
2770         (-[WKContentView _didCommitLayerTree:]):
2771         (-[WKContentView _wk_pageCountForPrintFormatter:]):
2772         * UIProcess/ios/WKContentViewInteraction.mm:
2773         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
2774         (hasAssistedNode):
2775         (-[WKContentView setupInteraction]):
2776         (-[WKContentView positionInformation]):
2777         (-[WKContentView _webTouchEventsRecognized:]):
2778         (inflateQuad):
2779         (-[WKContentView _updateTapHighlight]):
2780         (-[WKContentView _showTapHighlight]):
2781         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
2782         (-[WKContentView _displayFormNodeInputView]):
2783         (-[WKContentView inputView]):
2784         (-[WKContentView _actionForLongPressFromPositionInformation:]):
2785         (-[WKContentView currentPositionInformation]):
2786         (-[WKContentView doAfterPositionInformationUpdate:forRequest:]):
2787         (-[WKContentView _currentPositionInformationIsValidForRequest:]):
2788         (-[WKContentView _hasValidOutstandingPositionInformationRequest:]):
2789         (-[WKContentView _currentPositionInformationIsApproximatelyValidForRequest:]):
2790         (-[WKContentView gestureRecognizerShouldBegin:]):
2791         (-[WKContentView hasSelectablePositionAtPoint:]):
2792         (-[WKContentView pointIsNearMarkedText:]):
2793         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2794         (-[WKContentView webSelectionRectsForSelectionRects:]):
2795         (-[WKContentView _twoFingerSingleTapGestureRecognized:]):
2796         (-[WKContentView _stylusSingleTapRecognized:]):
2797         (-[WKContentView _singleTapCommited:]):
2798         (-[WKContentView _attemptClickAtLocation:]):
2799         (-[WKContentView _positionInformationDidChange:]):
2800         (-[WKContentView requiresAccessoryView]):
2801         (-[WKContentView supportedPasteboardTypesForCurrentSelection]):
2802         (-[WKContentView _lookupForWebView:]):
2803         (-[WKContentView _shareForWebView:]):
2804         (-[WKContentView textStylingAtPosition:inDirection:]):
2805         (-[WKContentView canPerformActionForWebView:withSender:]):
2806         (-[WKContentView selectForWebView:]):
2807         (-[WKContentView _accessibilityRetrieveRectsEnclosingSelectionOffset:withGranularity:]):
2808         (-[WKContentView _accessibilityRetrieveRectsAtSelectionOffset:withText:completionHandler:]):
2809         (toGestureType):
2810         (toUIWKGestureType):
2811         (toSelectionTouch):
2812         (toUIWKSelectionTouch):
2813         (toGestureRecognizerState):
2814         (toUIGestureRecognizerState):
2815         (toUIWKSelectionFlags):
2816         (toWKTextGranularity):
2817         (toWKSelectionDirection):
2818         (selectionChangedWithGesture):
2819         (selectionChangedWithTouch):
2820         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
2821         (-[WKContentView autocorrectionData]):
2822         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]):
2823         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
2824         (-[WKContentView _updateAccessory]):
2825         (-[WKContentView selectedTextRange]):
2826         (-[WKContentView setMarkedText:selectedRange:]):
2827         (coreWritingDirection):
2828         (-[WKContentView closestPositionToPoint:]):
2829         (-[WKContentView insertText:]):
2830         (-[WKContentView textInputTraits]):
2831         (-[WKContentView handleKeyWebEvent:]):
2832         (-[WKContentView handleKeyWebEvent:withCompletionHandler:]):
2833         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
2834         (-[WKContentView keyboardScrollViewAnimator:distanceForIncrement:]):
2835         (-[WKContentView assistedNodeInformation]):
2836         (-[WKContentView assistedNodeSelectOptions]):
2837         (isAssistableInputType):
2838         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2839         (-[WKContentView _stopAssistingNode]):
2840         (-[WKContentView updateCurrentAssistedNodeInformation:]):
2841         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2842         (-[WKContentView actionNameForFocusedFormControlView:]):
2843         (-[WKContentView selectWordForReplacement]):
2844         (-[WKContentView _updateChangedSelection:]):
2845         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
2846         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
2847         (-[WKContentView _showPlaybackTargetPicker:fromRect:routeSharingPolicy:routingContextUID:]):
2848         (-[WKContentView _showRunOpenPanel:resultListener:]):
2849         (-[WKContentView _showShareSheet:completionHandler:]):
2850         (-[WKContentView positionInformationForActionSheetAssistant:]):
2851         (-[WKContentView updatePositionInformationForActionSheetAssistant:]):
2852         (-[WKContentView _startDrag:item:]):
2853         (-[WKContentView _didHandleAdditionalDragItemsRequest:]):
2854         (-[WKContentView _didHandleStartDataInteractionRequest:]):
2855         (dropOperationForWebCoreDragOperation):
2856         (-[WKContentView dragDataForDropSession:dragDestinationAction:]):
2857         (-[WKContentView _didConcludeEditDataInteraction:]):
2858         (-[WKContentView _didPerformDragOperation:]):
2859         (-[WKContentView _prepareToDragPromisedAttachment:]):
2860         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
2861         (-[WKContentView _autofillContext]):
2862         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
2863         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
2864         (-[WKContentView dragInteraction:itemsForBeginningSession:]):
2865         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2866         (-[WKContentView dragInteraction:session:didEndWithOperation:]):
2867         (-[WKContentView dragInteraction:item:willAnimateCancelWithAnimator:]):
2868         (-[WKContentView dropInteraction:performDrop:]):
2869         (-[WKContentView dropInteraction:sessionDidEnd:]):
2870         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
2871         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
2872         (-[WKContentView numericInputModeForListViewController:]):
2873         (-[WKContentView textContentTypeForListViewController:]):
2874         (-[WKContentView allowsDictationInputForListViewController:]):
2875         (-[WKContentView _simulateLongPressActionAtLocation:]):
2876         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
2877         (-[WKContentView _presentationRectsForPreviewItemController:]):
2878         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2879         (WKFullScreenViewControllerPlaybackSessionModelClient::setInterface):
2880         (WKFullScreenViewControllerVideoFullscreenModelClient::setInterface):
2881         (WKFullScreenViewControllerVideoFullscreenModelClient::interface const):
2882         (-[WKFullScreenViewController videoControlsManagerDidChange]):
2883         (-[WKFullScreenViewController _manager]):
2884         (-[WKFullScreenViewController _togglePiPAction:]):
2885         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2886         (-[WKFullscreenAnimationController configureInitialAndFinalStatesForTransition:]):
2887         (-[WKFullScreenWindowController isFullScreen]):
2888         (-[WKFullScreenWindowController enterFullScreen]):
2889         (-[WKFullScreenWindowController beganEnterFullScreenWithInitialFrame:finalFrame:]):
2890         (-[WKFullScreenWindowController exitFullScreen]):
2891         (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]):
2892         (-[WKFullScreenWindowController _completedExitFullScreen]):
2893         (-[WKFullScreenWindowController webViewDidRemoveFromSuperviewWhileInFullscreen]):
2894         (-[WKFullScreenWindowController _exitFullscreenImmediately]):
2895         (-[WKFullScreenWindowController _manager]):
2896
2897 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2898
2899         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2900         https://bugs.webkit.org/show_bug.cgi?id=192449
2901         <rdar://problem/46595508>
2902
2903         Reviewed by Darin Adler.
2904
2905         Part 1: Files in Shared folder.
2906
2907         * Shared/API/c/WKRenderLayer.cpp:
2908         (WKRenderLayerGetFrameContentsLayer):
2909         * Shared/API/c/cf/WKErrorCF.cpp:
2910         (WKErrorCreateWithCFError):
2911         (WKErrorCopyCFError):
2912         * Shared/API/c/cg/WKImageCG.cpp:
2913         (WKImageCreateCGImage):
2914         (WKImageCreateFromCGImage):
2915         * Shared/API/c/mac/WKWebArchive.cpp:
2916         (WKWebArchiveGetTypeID):
2917         (WKWebArchiveCreate):
2918         (WKWebArchiveCreateWithData):
2919         (WKWebArchiveCreateFromRange):
2920         (WKWebArchiveCopyMainResource):
2921         (WKWebArchiveCopySubresources):
2922         (WKWebArchiveCopySubframeArchives):
2923         (WKWebArchiveCopyData):
2924         * Shared/API/c/mac/WKWebArchiveResource.cpp:
2925         (WKWebArchiveResourceGetTypeID):
2926         (WKWebArchiveResourceCreate):
2927         (WKWebArchiveResourceCopyData):
2928         (WKWebArchiveResourceCopyURL):
2929         (WKWebArchiveResourceCopyMIMEType):
2930         (WKWebArchiveResourceCopyTextEncoding):
2931         * Shared/ChildProcess.cpp:
2932         * Shared/ContextMenuContextData.cpp:
2933         * Shared/EditorState.cpp:
2934         * Shared/Plugins/NPIdentifierData.cpp:
2935         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
2936         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
2937         * Shared/SessionState.cpp:
2938         * Shared/SessionTracker.cpp:
2939         * Shared/ShareableBitmap.cpp:
2940         * Shared/ShareableResource.cpp:
2941         * Shared/VisibleContentRectUpdateInfo.cpp:
2942         * Shared/WebBackForwardListItem.cpp:
2943         * Shared/WebContextMenuItemData.cpp:
2944         * Shared/WebCoreArgumentCoders.cpp:
2945         * Shared/WebHitTestResultData.cpp:
2946         * Shared/WebImage.cpp:
2947         * Shared/WebMediaSessionMetadata.cpp:
2948         * Shared/WebMemorySampler.cpp:
2949         * Shared/WebMouseEvent.cpp:
2950         * Shared/WebRenderObject.cpp:
2951         * Shared/WebSQLiteDatabaseTracker.cpp:
2952         * Shared/WebWheelEvent.cpp:
2953         * Shared/cf/ArgumentCodersCF.cpp:
2954         * Shared/ios/WebPlatformTouchPointIOS.cpp:
2955
2956 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
2957
2958         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2959         https://bugs.webkit.org/show_bug.cgi?id=192449
2960         <rdar://problem/46595508>
2961
2962         Reviewed by Darin Adler.
2963
2964         Part 1: Files in NetworkProcess.
2965
2966         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
2967         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2968         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2969         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
2970         * NetworkProcess/ios/NetworkProcessIOS.mm:
2971         * NetworkProcess/mac/NetworkProcessMac.mm:
2972         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2973
2974 2018-12-12  Chris Dumez  <cdumez@apple.com>
2975
2976         Unreviewed build with with recent macOS SDKs.
2977
2978         * Platform/cocoa/WKCrashReporter.mm:
2979
2980 2018-12-12  Chris Dumez  <cdumez@apple.com>
2981
2982         Unreviewed attempt to fix GTK build after r239104.
2983
2984         * UIProcess/WebPageProxy.cpp:
2985         (WebKit::WebPageProxy::performDragControllerAction):
2986
2987 2018-12-12  Chris Dumez  <cdumez@apple.com>
2988
2989         Unreviewed attempt to fix build with older SDKs after r239110.
2990
2991         * Platform/cocoa/WKCrashReporter.mm:
2992
2993 2018-12-12  Chris Dumez  <cdumez@apple.com>
2994
2995         Unreviewed, fix build with recent SDKs.
2996
2997         * Platform/cocoa/WKCrashReporter.mm:
2998
2999 2018-12-09  Darin Adler  <darin@apple.com>
3000
3001         [iOS] Zero memory containing the password for PDF documents when a WKPDFView is deallocated
3002         https://bugs.webkit.org/show_bug.cgi?id=192536
3003         rdar://problem/41174451
3004
3005         Reviewed by Tim Horton.
3006
3007         * UIProcess/ios/WKPDFView.mm: Took out PLATFORM(IOSMAC) since
3008         this class is not compiled on that platform at this time. Can always
3009         add it back later.
3010         (-[WKPDFView dealloc]): Zero out characters of _passwordForPrinting.
3011         (-[WKPDFView pdfHostViewController:documentDidUnlockWithPassword:]):
3012         Initialize _passwordForPrinting; use a CString instead of retaining
3013         an NSString since we can zero that out easily.
3014         (-[WKPDFView _ensureDocumentForPrinting]): Use _passwordForPrinting.
3015
3016 2018-12-12  Commit Queue  <commit-queue@webkit.org>
3017
3018         Unreviewed, rolling out r239103.
3019         https://bugs.webkit.org/show_bug.cgi?id=192627
3020
3021         It broke the built because it depends on another patch that
3022         didn't land yet (Requested by KaL on #webkit).
3023
3024         Reverted changeset:
3025
3026         "[WPE] Add API to notify about frame displayed view backend
3027         callback"
3028         https://bugs.webkit.org/show_bug.cgi?id=192224
3029         https://trac.webkit.org/changeset/239103
3030
3031 2018-12-12  Chris Dumez  <cdumez@apple.com>
3032
3033         Restore MESSAGE_CHECK_URL() security check on sourceURL in didPerformClientRedirect()
3034         https://bugs.webkit.org/show_bug.cgi?id=191982
3035         <rdar://problem/46258054>
3036
3037         Reviewed by Alex Christensen.
3038
3039         Have the WebPageProxy remember the local paths it previously visited so that the
3040         MESSAGE_CHECK_URL() checks still work when process-swap on navigation is enabled.
3041
3042         Add back MESSAGE_CHECK_URL() on sourceURL in didPerformClientRedirect().
3043
3044         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3045         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
3046         * UIProcess/RemoteWebInspectorProxy.cpp:
3047         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
3048         * UIProcess/WebInspectorProxy.cpp:
3049         (WebKit::WebInspectorProxy::createFrontendPage):
3050         * UIProcess/WebPageProxy.cpp:
3051         (WebKit::WebPageProxy::loadRequestWithNavigation):
3052         (WebKit::WebPageProxy::loadFile):
3053         (WebKit::WebPageProxy::loadDataWithNavigation):
3054         (WebKit::WebPageProxy::loadAlternateHTML):
3055         (WebKit::WebPageProxy::reload):
3056         (WebKit::WebPageProxy::didPerformClientRedirect):
3057         (WebKit::WebPageProxy::backForwardGoToItem):
3058         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
3059         (WebKit::WebPageProxy::addPreviouslyVisitedPath):
3060         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
3061         * UIProcess/WebPageProxy.h:
3062         * UIProcess/WebProcessProxy.cpp:
3063         (WebKit::WebProcessProxy::assumeReadAccessToBaseURL):
3064         * UIProcess/WebProcessProxy.h:
3065         * UIProcess/mac/WebPageProxyMac.mm:
3066
3067 2018-11-30  Carlos Garcia Campos  <cgarcia@igalia.com>
3068
3069         [WPE] Add API to notify about frame displayed view backend callback
3070         https://bugs.webkit.org/show_bug.cgi?id=192224
3071
3072         Reviewed by Michael Catanzaro.
3073
3074         Add API to add a callback to the view to be called when the view backend notifies that a frame has been
3075         displayed.
3076
3077         * UIProcess/API/glib/WebKitWebView.cpp:
3078         (FrameDisplayedCallback::FrameDisplayedCallback):
3079         (FrameDisplayedCallback::~FrameDisplayedCallback):
3080         (webkit_web_view_add_frame_displayed_callback):
3081         (webkit_web_view_remove_frame_displayed_callback):
3082         * UIProcess/API/wpe/WebKitWebView.h:
3083
3084 2018-12-11  Justin Michaud  <justin_michaud@apple.com>
3085
3086         Implement feature flag for CSS Typed OM
3087         https://bugs.webkit.org/show_bug.cgi?id=192610
3088
3089         Reviewed by Ryosuke Niwa.
3090
3091         * Configurations/FeatureDefines.xcconfig:
3092         * Shared/WebPreferences.yaml:
3093         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3094         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
3095
3096 2018-12-11  Fujii Hironori  <Hironori.Fujii@sony.com>
3097
3098         [Win][Clang] Fix warning -Wmissing-field-initializers
3099         https://bugs.webkit.org/show_bug.cgi?id=192584
3100
3101         Reviewed by Yusuke Suzuki.
3102
3103         Initialize a struct with '{ }' instead of '= {0}'.
3104
3105         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
3106         (WebKit::ProcessLauncher::launchProcess):
3107         * UIProcess/win/WebPopupMenuProxyWin.cpp:
3108         (WebKit::WebPopupMenuProxyWin::showPopupMenu):
3109         * UIProcess/win/WebView.cpp:
3110         (WebKit::WebView::initializeToolTipWindow):
3111         (WebKit::WebView::setToolTip):
3112
3113 2018-12-11  Chris Dumez  <cdumez@apple.com>
3114
3115         PSON logic gets confused by concurrent decidePolicyForNavigationAction requests
3116         https://bugs.webkit.org/show_bug.cgi?id=192482
3117         <rdar://problem/46470145>
3118
3119         Reviewed by Antti Koivisto.
3120
3121         It is possible to get 2 parallel decidePolicyForNavigationAction() requests from the
3122         WebProcess when a new load is started before responding to the existing policy
3123         decision. This would lead to several issues with regards to PSON:
3124         - We would decide to swap for the first policy decision and tell the WebProcess to
3125           suspend. However, because the WebProcess issued a new decidePolicyForNavigationAction
3126           since for the same frame, the previous one is invalidated and the WebProcess would
3127           ignore our request to suspend.
3128         - We would hit assertions later on because the navigation has been destroyed and yet
3129           we're getting a didStartProvisionalLoad for it.
3130         - swapToWebProcess() was asynchronous so that it would wait for the destination
3131           SuspendedPage to finish suspending before asking it to unsuspend. This led to various
3132           problems because anything can happen in the UIProcess while we're waiting for the
3133           suspension (e.g. another load). Also, we may create the SuspendedPageProxy for
3134           the current page too late and start getting IPC from the previous process about
3135           the suspension load to about:blank.
3136
3137         To address these issues, the following design is now implemented:
3138         - swapToWebProcess() is no longer asynchronous
3139         - instead, WebProcessPool::processForNavigation() is now asynchronous. This is better
3140           because at this point we have not yet told the WebProcess about the policy decision.
3141           We already properly deal with the policy decision being made asynchronously. This
3142           also allows us to choose another process if the SuspendedPage we'd like to use
3143           failed to suspend.
3144         - If the WebProcess receives a PolicyAction::Suspend but ignores it, have it send an
3145           IPC to the UIProcess so that the SuspendedPageProxy knows about it. We then destroy
3146           the SuspendedPageProxy and make sure it is not used.
3147         - After the asynchronous process selection, if the navigation has been destroy, abort
3148           the process-swap to avoid hitting assertions later on due to doing a load for a
3149           destroyed navigation.
3150
3151         * UIProcess/SuspendedPageProxy.cpp:
3152         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3153         Make sure m_whenReadyToConsume completion handler gets called if necessary if the
3154         SuspendedPageProxy gets destroyed. We pass null so that the SuspendedPage is not
3155         used.
3156
3157         (WebKit::SuspendedPageProxy::whenReadyToConsume):
3158         Add whenReadyToConsume() utility method to get a completion handler called when
3159         the SuspendedPageProxy is ready to be used. This basically means we have to wait
3160         for the page to finish its about:blank suspension load. If the suspension fails
3161         then we call the completion handler with null to indicate that the suspended
3162         page is not usable.
3163
3164         (WebKit::SuspendedPageProxy::unsuspendAndConsume):
3165         Rename unsuspend() to unsuspendAndConsume() and make it synchronous. This only gets
3166         called after whenReadyToConsume()'s completion handler has been called and if we
3167         do decide to use the SuspendedPageProxy. It tells the WebProcess to unsuspend and
3168         removes the SuspendedPageProxy from the WebProcessPool.
3169
3170         (WebKit::SuspendedPageProxy::didFinishLoad):
3171         rename m_finishedSuspendingHandler to m_whenReadyToConsume.
3172
3173         (WebKit::SuspendedPageProxy::didFailToSuspend):
3174         Add new didFailToSuspend() that gets called when the WebProcess sends us an IPC telling
3175         us it ignored our request to suspend. We then call m_whenReadyToConsume completion
3176         handler with null and destroy the SuspendedPageProxy.
3177
3178         (WebKit::SuspendedPageProxy::didReceiveMessage):
3179         * UIProcess/SuspendedPageProxy.h:
3180
3181         * UIProcess/WebNavigationState.h:
3182         (WebKit::WebNavigationState::hasNavigation const):
3183         Add utility function to query if a navigation is still valid.
3184
3185         * UIProcess/WebPageProxy.cpp:
3186         (WebKit::WebPageProxy::swapToWebProcess):
3187         Update method so that it is no longer asynchronous. Some of its code was also moved to
3188         continueNavigationInNewProcess() for clarity.
3189
3190         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3191         Deal with WebProcessPool::processForNavigation() now being asynchronous.
3192
3193         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3194         Update code now that swapToWebProcess() is no longer asynchronous. Some of the swapToWebProcess()
3195         code was also moved here for clarity.
3196
3197         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap):
3198
3199         * UIProcess/WebPageProxy.h:
3200         * UIProcess/WebPageProxy.messages.in:
3201         Add new DidFailToSuspendAfterProcessSwap IPC message.
3202
3203         * UIProcess/WebProcessPool.cpp:
3204         (WebKit::WebProcessPool::processForNavigation):
3205         (WebKit::WebProcessPool::processForNavigationInternal):
3206         * UIProcess/WebProcessPool.h:
3207         Make asynchronous. If we decide to use a SuspendedPageProxy's process, then call
3208         whenReadyToConsume() on it to wait for it to suspend. If the SuspendedPageProxy
3209         fails to suspend use a new process instead.
3210
3211         * WebProcess/WebPage/WebFrame.cpp:
3212         (WebKit::WebFrame::didReceivePolicyDecision):
3213         If we ignore the policy decision and the decision was "Suspend", send the DidFailToSuspendAfterProcessSwap
3214         IPC to the UIProcess so that the SuspendedPageProxy knows about it.
3215
3216 2018-12-11  Andy Estes  <aestes@apple.com>
3217
3218         Introduce makeBlockPtr for lambdas
3219         https://bugs.webkit.org/show_bug.cgi?id=192594
3220
3221         Reviewed by Alex Christensen.
3222
3223         Adopted makeBlockPtr.
3224
3225         * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm:
3226         (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]):
3227         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
3228         (WebKit::NetworkCache::IOChannel::read):
3229         (WebKit::NetworkCache::IOChannel::write):
3230         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3231         (WebKit::NetworkProcess::clearDiskCache):
3232         (WebKit::saveCookies):
3233         * NetworkProcess/watchos/NetworkProximityAssertion.mm:
3234         (WebKit::BluetoothProximityAssertion::suspend):
3235         * UIProcess/API/Cocoa/WKWebView.mm:
3236         (-[WKWebView _setInputDelegate:]):
3237         * UIProcess/API/mac/WKView.mm:
3238         (-[WKView maybeInstallIconLoadingClient]):
3239         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
3240         (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard):
3241         (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup):
3242         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
3243         (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
3244         * UIProcess/Cocoa/AutomationSessionClient.mm:
3245         (WebKit::AutomationSessionClient::requestNewPageWithOptions):
3246         (WebKit::AutomationSessionClient::requestSwitchToPage):
3247         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
3248         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
3249         (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
3250         * UIProcess/Cocoa/DownloadClient.mm:
3251         (WebKit::DownloadClient::didReceiveAuthenticationChallenge):
3252         (WebKit::DownloadClient::decideDestinationWithSuggestedFilename):
3253         * UIProcess/Cocoa/IconLoadingDelegate.mm:
3254         (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon):
3255         * UIProcess/Cocoa/NavigationState.mm:
3256         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
3257         (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const):
3258         (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const):
3259         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3260         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
3261         (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
3262         * UIProcess/Cocoa/UIDelegate.mm:
3263         (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu):
3264         (WebKit::UIDelegate::UIClient::createNewPage):
3265         (WebKit::UIDelegate::UIClient::runJavaScriptAlert):
3266         (WebKit::UIDelegate::UIClient::runJavaScriptConfirm):
3267         (WebKit::UIDelegate::UIClient::runJavaScriptPrompt):
3268         (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm):
3269         (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest):
3270         (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel):
3271         (WebKit::UIDelegate::UIClient::exceededDatabaseQuota):
3272         (WebKit::UIDelegate::UIClient::windowFrame):
3273         (WebKit::UIDelegate::UIClient::toolbarsAreVisible):
3274         (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest):
3275         (WebKit::UIDelegate::UIClient::runOpenPanel):
3276         (WebKit::requestUserMediaAuthorizationForDevices):
3277         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
3278         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
3279         (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota):
3280         (WebKit::UIDelegate::UIClient::requestPointerLock):
3281         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3282         (-[WKSafeBrowsingWarning clickedOnLink:]):
3283         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3284         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
3285         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm:
3286         (WebKit::HidConnection::send):
3287         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3288         (WebKit::LocalConnection::getUserConsent const):
3289         (WebKit::LocalConnection::getAttestation const):
3290         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
3291         (WebKit::MockHidConnection::send):
3292         * UIProcess/ios/PageClientImplIOS.mm:
3293         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
3294         * UIProcess/ios/WKGeolocationProviderIOS.mm:
3295         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
3296         * UIProcess/mac/ServicesController.mm:
3297         (WebKit::hasCompatibleServicesForItems):
3298         (WebKit::ServicesController::refreshExistingServices):
3299         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3300         (PageLoaderClient::didStartProvisionalLoadForFrame):
3301
3302 2018-12-11  Alex Christensen  <achristensen@webkit.org>
3303
3304         Fix an internal build failure after r239014
3305         https://bugs.webkit.org/show_bug.cgi?id=192205
3306
3307         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3308         (fontOfSize):
3309         There's a system that doesn't have safe browsing or UIFontTextStyleLargeTitle.
3310
3311 2018-12-11  Brian Burg  <bburg@apple.com>
3312
3313         SimulatedInputDispatcher::transitionInputSourceToState() can reuse a moved-from completion handler
3314         https://bugs.webkit.org/show_bug.cgi?id=191155
3315         <rdar://problem/45745569>
3316
3317         Reviewed by Joseph Pecoraro.
3318
3319         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
3320         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
3321         Add an ASSERT to guard against unexpected inputs where >1 VirtualKey changes per state.
3322         webkitdriver needs to be updated to not produce such states in this scenario, but this will
3323         avoid a runtime crash caused by trying to call a moved-out completion handler a second time.
3324
3325 2018-12-11  Commit Queue  <commit-queue@webkit.org>
3326
3327         Unreviewed, rolling out r239071.
3328         https://bugs.webkit.org/show_bug.cgi?id=192588
3329
3330         Broke WPE build due to undefined references to toAPI() and
3331         toImpl() inside the C API (Requested by magomez on #webkit).
3332
3333         Reverted changeset:
3334
3335         "[meta][WebKit] Remove using namespace WebCore and WebKit in
3336         the global scope for unified source builds"
3337         https://bugs.webkit.org/show_bug.cgi?id=192449
3338         https://trac.webkit.org/changeset/239071
3339
3340 2018-12-10  Chris Fleizach  <cfleizach@apple.com>
3341
3342         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3343         https://bugs.webkit.org/show_bug.cgi?id=192449
3344
3345         Reviewed by Darin Adler.
3346
3347         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
3348         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3349         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3350         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3351         * NetworkProcess/ios/NetworkProcessIOS.mm:
3352         * NetworkProcess/mac/NetworkProcessMac.mm:
3353         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3354         * Platform/spi/ios/AccessibilitySupportSPI.h:
3355         * PlatformMac.cmake:
3356         * PluginProcess/PluginControllerProxy.cpp:
3357         * PluginProcess/PluginProcess.cpp:
3358         * PluginProcess/WebProcessConnection.cpp:
3359         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
3360         * Shared/API/c/cf/WKErrorCF.cpp:
3361         (WKErrorCreateWithCFError):
3362         (WKErrorCopyCFError):
3363         * Shared/API/c/cg/WKImageCG.cpp:
3364         (WKImageCreateCGImage):
3365         (WKImageCreateFromCGImage):
3366         * Shared/ChildProcess.cpp:
3367         * Shared/ContextMenuContextData.cpp:
3368         * Shared/EditorState.cpp:
3369         * Shared/Plugins/NPIdentifierData.cpp:
3370         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
3371         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
3372         * Shared/SessionState.cpp:
3373         * Shared/SessionTracker.cpp:
3374         * Shared/ShareableBitmap.cpp:
3375         * Shared/ShareableResource.cpp:
3376         * Shared/VisibleContentRectUpdateInfo.cpp:
3377         * Shared/WebBackForwardListItem.cpp:
3378         * Shared/WebContextMenuItemData.cpp:
3379         * Shared/WebCoreArgumentCoders.cpp:
3380         * Shared/WebHitTestResultData.cpp:
3381         * Shared/WebImage.cpp:
3382         * Shared/WebMediaSessionMetadata.cpp:
3383         * Shared/WebMemorySampler.cpp:
3384         * Shared/WebMouseEvent.cpp:
3385         * Shared/WebRenderObject.cpp:
3386         * Shared/WebSQLiteDatabaseTracker.cpp:
3387         * Shared/WebWheelEvent.cpp:
3388         * Shared/cf/ArgumentCodersCF.cpp:
3389         * Shared/ios/WebPlatformTouchPointIOS.cpp:
3390         * SourcesCocoa.txt:
3391         * UIProcess/API/APIContentRuleListStore.cpp:
3392         * UIProcess/API/APIHitTestResult.cpp:
3393         * UIProcess/API/APINavigation.cpp:
3394         * UIProcess/API/APIOpenPanelParameters.cpp:
3395         * UIProcess/API/APIPageConfiguration.cpp:
3396         * UIProcess/API/C/WKPage.cpp:
3397         (WKPageLoadURLWithShouldOpenExternalURLsPolicy):
3398         (WKPageLoadURLWithUserData):
3399         (WKPageLoadURLRequestWithUserData):
3400         (WKPageSetPaginationMode):
3401         (WKPageGetPaginationMode):
3402         (WKPageSetPageLoaderClient):
3403         (WKPageSetPagePolicyClient):
3404         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
3405         * UIProcess/Cocoa/WebViewImpl.h:
3406         * UIProcess/Cocoa/WebViewImpl.mm:
3407         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3408         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
3409         * UIProcess/ios/WKContentView.mm:
3410         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
3411         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
3412         (-[WKContentView dealloc]):
3413         (-[WKContentView page]):
3414         (-[WKContentView updateFixedClippingView:]):
3415         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
3416         (-[WKContentView _updateForScreen:]):
3417         (-[WKContentView _accessibilityRegisterUIProcessTokens]):
3418         (-[WKContentView _createDrawingAreaProxy]):
3419         (-[WKContentView _didCommitLayerTree:]):
3420         (-[WKContentView _wk_pageCountForPrintFormatter:]):
3421         * UIProcess/ios/WKContentViewInteraction.mm:
3422         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]):
3423         (hasAssistedNode):
3424         (-[WKContentView setupInteraction]):
3425         (-[WKContentView positionInformation]):
3426         (-[WKContentView _webTouchEventsRecognized:]):
3427         (inflateQuad):