Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerFor...
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-30  Tim Horton  <timothy_horton@apple.com>
2
3         Long-standing rare crash under -[WKWebView _web_immediateActionAnimationControllerForHitTestResultInternal...]
4         https://bugs.webkit.org/show_bug.cgi?id=197404
5         <rdar://problem/24589331>
6
7         Reviewed by Wenson Hsieh.
8
9         * UIProcess/mac/WKImmediateActionController.mm:
10         (-[WKImmediateActionController _updateImmediateActionItem]):
11         (-[WKImmediateActionController menuItem:previewItemAtPoint:]):
12         (-[WKImmediateActionController menuItem:itemFrameForPoint:]):
13         (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
14         Add some null checks; _webHitTestResult can be null if we (somehow) get
15         an immediate action gesture without having previously gotten a
16         mouseDidMoveOverElement from the Web Content process. Cover all our bases.
17
18 2019-04-30  Per Arne Vollan  <pvollan@apple.com>
19
20         [iOS] Fix crash caused by sandbox violation
21         https://bugs.webkit.org/show_bug.cgi?id=197416
22         <rdar://problem/50266257>
23
24         Reviewed by Brent Fulgham.
25
26         Add syscall to the iOS sandbox.
27
28         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
29
30 2019-04-30  Zalan Bujtas  <zalan@apple.com>
31
32         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
33         https://bugs.webkit.org/show_bug.cgi?id=197347
34         <rdar://problem/49393423>
35
36         Reviewed by Wenson Hsieh.
37
38         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
39
40         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
41         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
42
43         * UIProcess/WebPageProxy.h:
44         * UIProcess/ios/WKContentViewInteraction.h:
45         * UIProcess/ios/WKContentViewInteraction.mm:
46         (-[WKContentView setupInteraction]):
47         (-[WKContentView cleanupInteraction]):
48         (-[WKContentView _removeDefaultGestureRecognizers]):
49         (-[WKContentView _addDefaultGestureRecognizers]):
50         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
51         (-[WKContentView gestureRecognizerShouldBegin:]):
52         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
53         * UIProcess/ios/WebPageProxyIOS.mm:
54         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
55         * WebProcess/WebPage/WebPage.h:
56         * WebProcess/WebPage/WebPage.messages.in:
57         * WebProcess/WebPage/ios/WebPageIOS.mm:
58         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
59
60 2019-04-30  Antti Koivisto  <antti@apple.com>
61
62         Tighten type of ScrollingTree:rootNode() to ScrollingTreeFrameScrollingNode
63         https://bugs.webkit.org/show_bug.cgi?id=197414
64
65         Reviewed by Frédéric Wang.
66
67         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
68
69 2019-04-30  Carlos Garcia Campos  <cgarcia@igalia.com>
70
71         REGRESSION(r244750): [GTK][WPE] Network process is crashing in all layout tests
72         https://bugs.webkit.org/show_bug.cgi?id=197406
73
74         Reviewed by Žan Doberšek.
75
76         Do not trasnfer ownership of cachePath to traverseDirectory() lambda, since it's passed also as first argument
77         and it can be passed as a reference.
78
79         * NetworkProcess/cache/NetworkCacheStorage.cpp:
80         (WebKit::NetworkCache::Storage::deleteOldVersions):
81
82 2019-04-29  Truitt Savell  <tsavell@apple.com>
83
84         Unreviewed, rolling out r244755.
85
86         Casued several test failures on iOS
87
88         Reverted changeset:
89
90         "Double-tapping a post to like doesn't work on Instagram.com
91         (needs 'dblclick' event)"
92         https://bugs.webkit.org/show_bug.cgi?id=197347
93         https://trac.webkit.org/changeset/244755
94
95 2019-04-29  Chris Dumez  <cdumez@apple.com>
96
97         [iOS] The UIProcess may get killed for trying to stay runnable in the background for more than 30 seconds
98         https://bugs.webkit.org/show_bug.cgi?id=197385
99         <rdar://problem/50001505>
100
101         Reviewed by Geoffrey Garen.
102
103         If the UIProcess holds a background assertion for itself for 30 seconds, the assertion's invalidation handler
104         will get called and it is our responsibility to release this assertion or the UIProcess will get killed by the
105         system. The logic in ProcessAssertion would normally do that but it would also happily try and re-take another
106         background process assertion shortly after the previous one expired (and before the UIProcess got suspended).
107         When doing so, the new background assertion would expire right away and we would get killed without its
108         invalidation handler getting called.
109
110         To address the issue, the logic in ProcessAssertion will now prevent taking a new background assertion after
111         one expires and until the application becomes foreground again.
112
113         * UIProcess/ios/ProcessAssertionIOS.mm:
114         (-[WKProcessAssertionBackgroundTaskManager init]):
115         (-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
116
117 2019-04-29  Alex Christensen  <achristensen@webkit.org>
118
119         <rdar://problem/50299396> Fix internal High Sierra build
120         https://bugs.webkit.org/show_bug.cgi?id=197388
121
122         * Configurations/Base.xcconfig:
123
124 2019-04-29  Zalan Bujtas  <zalan@apple.com>
125
126         [iOS] Double-tapping a post to like doesn't work on Instagram.com (needs 'dblclick' event)
127         https://bugs.webkit.org/show_bug.cgi?id=197347
128         <rdar://problem/49393423>
129
130         Reviewed by Wenson Hsieh.
131
132         This patch adds support for dispatching dblclick event as the result of the double tap gesture.
133
134         1. The new double tap gesture recognizer always fires regardless of what type of action the other, existing double gesture recognizers (double-tap to zoom) trigger.
135         2. The dblclick event is dispatched on the node with registered dblclick event handler unless the node prohibits double tap gesture (touch-action != auto).
136
137         * UIProcess/WebPageProxy.h:
138         * UIProcess/ios/WKContentViewInteraction.h:
139         * UIProcess/ios/WKContentViewInteraction.mm:
140         (-[WKContentView setupInteraction]):
141         (-[WKContentView cleanupInteraction]):
142         (-[WKContentView _removeDefaultGestureRecognizers]):
143         (-[WKContentView _addDefaultGestureRecognizers]):
144         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
145         (-[WKContentView gestureRecognizerShouldBegin:]):
146         (-[WKContentView _doubleTapRecognizedForDoubleClick:]):
147         * UIProcess/ios/WebPageProxyIOS.mm:
148         (WebKit::WebPageProxy::handleDoubleTapForDoubleClickAtPoint):
149         * WebProcess/WebPage/WebPage.h:
150         * WebProcess/WebPage/WebPage.messages.in:
151         * WebProcess/WebPage/ios/WebPageIOS.mm:
152         (WebKit::WebPage::handleDoubleTapForDoubleClickAtPoint):
153
154 2019-04-29  Tim Horton  <timothy_horton@apple.com>
155
156         REGRESSION (r244142): Fandango accounts tab crashes under Color()
157         https://bugs.webkit.org/show_bug.cgi?id=197380
158         <rdar://problem/50186175>
159
160         Reviewed by Megan Gardner.
161
162         * UIProcess/API/Cocoa/WKWebView.mm:
163         (baseScrollViewBackgroundColor):
164         We now call -_updateScrollViewBackground from -setBackgroundColor:.
165         -setBackgroundColor: can be called from -[UIView initWithCoder:]; if it
166         is, WKWebView's _page is not yet initialized, so we crash. Return an invalid color.
167         Then, the caller falls back to WKContentView's backgroundColor. But WKContentView
168         isn't initialized yet either. So add a further fallback.
169
170 2019-04-29  Dean Jackson  <dino@apple.com>
171
172         Add InteractionIsHappening to SuppressSelectionAssistantReason
173         https://bugs.webkit.org/show_bug.cgi?id=197375
174         <rdar://problem/50304986>
175
176         Reviewed by Megan Gardner.
177
178         Add a new reason for suppressing the selection assistant, to
179         be used in a follow-up patch.
180
181         * UIProcess/ios/WKContentViewInteraction.h: Add InteractionIsHappening.
182
183 2019-04-29  Alex Christensen  <achristensen@webkit.org>
184
185         Storage::deleteOldVersions does not need to retain Storage
186         https://bugs.webkit.org/show_bug.cgi?id=197336
187         <rdar://problem/48679972>
188
189         Reviewed by Darin Adler.
190
191         * NetworkProcess/cache/NetworkCacheStorage.cpp:
192         (WebKit::NetworkCache::Storage::deleteOldVersions):
193         Something is wrong with the lifetime of Storage, but we only need a String, not the whole Storage.
194
195 2019-04-29  Brent Fulgham  <bfulgham@apple.com>
196
197         [Cocoa] Move common sandbox files from Shared/mac to Shared/Cocoa
198         https://bugs.webkit.org/show_bug.cgi?id=197376
199         <rdar://problem/50305272>
200
201         Reviewed by Dean Jackson.
202
203         The Apple sandboxing logic currently lives in the inappropriate 'Shared/mac' directory. This is
204         confusing because the code is used by all Apple ports, not just macOS.
205
206         This patch just moves the relevant files from 'Shared/mac' to 'Shared/Cocoa' to avoid this confusion.
207
208         * Shared/Cocoa/SandboxExtensionCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxExtensionMac.mm.
209         * Shared/Cocoa/SandboxInitialiationParametersCocoa.mm: Renamed from Source/WebKit/Shared/mac/SandboxInitialiationParametersMac.mm.
210         * Shared/Cocoa/SandboxUtilities.h: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.h.
211         * Shared/Cocoa/SandboxUtilities.mm: Renamed from Source/WebKit/Shared/mac/SandboxUtilities.mm.
212         * SourcesCocoa.txt:
213         * WebKit.xcodeproj/project.pbxproj:
214
215 2019-04-29  Alexander Mikhaylenko  <exalm7659@gmail.com>
216
217         [GTK] Back/forward gesture snapshot always times out
218         https://bugs.webkit.org/show_bug.cgi?id=197233
219
220         Reviewed by Michael Catanzaro.
221
222         Delaying web process launch caused a regression where we create ViewGestureController when the
223         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
224         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
225         snapshot always stays until timeout after performing the gesture.
226
227         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
228         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
229         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
230         and immediately apply it when creating the controller.
231
232         Since there is now a point where controller is null, make webkitWebViewBaseViewGestureController()
233         return null and add null checks everywhere.
234
235         * UIProcess/API/glib/WebKitWebView.cpp:
236         (enableBackForwardNavigationGesturesChanged):
237         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
238         * UIProcess/API/gtk/PageClientImpl.cpp:
239         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore): Add a null check.
240         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
241         (webkitWebViewBaseDraw): Ditto.
242         (webkitWebViewBaseScrollEvent): Ditto.
243         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
244         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
245         for the case ViewGestureController doesn't exist yet.
246         (webkitWebViewBaseViewGestureController): Return a pointer instead of reference.
247         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
248         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
249         immediately call setSwipeGestureEnabled() with the stored value.
250         (webkitWebViewBaseDidStartProvisionalLoadForMainFrame): Add a null check.
251         (webkitWebViewBaseDidFirstVisuallyNonEmptyLayoutForMainFrame):Ditto.
252         (webkitWebViewBaseDidFinishLoadForMainFrame): Ditto.
253         (webkitWebViewBaseDidFailLoadForMainFrame): Ditto.
254         (webkitWebViewBaseDidSameDocumentNavigationForMainFrame): Ditto.
255         (webkitWebViewBaseDidRestoreScrollPosition): Ditto.
256         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
257
258 2019-04-29  Chris Dumez  <cdumez@apple.com>
259
260         User-facing strings should use curly quotes instead of straight
261         https://bugs.webkit.org/show_bug.cgi?id=197370
262
263         Reviewed by Geoffrey Garen.
264
265         Update localizable alert text that was recently added to use curly quotes instead of
266         straight ones, as per our guidelines.
267
268         * UIProcess/Cocoa/WKOrientationAccessAlert.mm:
269         (WebKit::presentOrientationAccessAlert):
270         * UIProcess/Cocoa/WKStorageAccessAlert.mm:
271         (WebKit::presentStorageAccessAlert):
272
273 2019-04-29  Alex Christensen  <achristensen@webkit.org>
274
275         Build fix.
276
277         * UIProcess/ios/WKActionSheet.mm:
278         (-[WKActionSheet updateSheetPosition]):
279
280 2019-04-29  Commit Queue  <commit-queue@webkit.org>
281
282         Unreviewed, rolling out r244648.
283         https://bugs.webkit.org/show_bug.cgi?id=197363
284
285          Lots of tests  are crashing (Requested by KaL on #webkit).
286
287         Reverted changeset:
288
289         "[GTK] Back/forward gesture snapshot always times out"
290         https://bugs.webkit.org/show_bug.cgi?id=197233
291         https://trac.webkit.org/changeset/244648
292
293 2019-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
294
295         [WPE][GTK] window-object-cleared documentation should reference webkit_frame_get_js_context_for_script_world()
296         https://bugs.webkit.org/show_bug.cgi?id=197357
297
298         Reviewed by Carlos Garcia Campos.
299
300         We should recommend using the non-deprecated replacement for
301         webkit_frame_get_javascript_context_for_script_world().
302
303         * WebProcess/InjectedBundle/API/glib/WebKitScriptWorld.cpp:
304
305 2019-04-27  Chris Dumez  <cdumez@apple.com>
306
307         Improve safety of MachMessage class
308         https://bugs.webkit.org/show_bug.cgi?id=197323
309         <rdar://problem/44291920>
310
311         Reviewed by Darin Adler.
312
313         Improve safety of MachMessage class and clean things up a bit.
314
315         * Platform/IPC/mac/ConnectionMac.mm:
316         (IPC::Connection::sendOutgoingMessage):
317         - Pass MessageReceiverName / MessageName when constructing the MachMessage rather
318           than setting them afterwards since they never change for a given MachMessage.
319         - Set header->msgh_id to the right value right away instead of setting it first
320           to inlineBodyMessageID and then later fixing it to be outOfLineBodyMessageID
321           when the body is out of line.
322         - When messageBodyIsOOL was true, we would call getDescriptorAndSkip() which
323           would advance the pointer by sizeof(mach_msg_port_descriptor_t), even though
324           the descriptor type is mach_msg_ool_descriptor_t. This would not matter in
325           the end because we would not use the messageData pointer after this but
326           still.
327
328         * Platform/IPC/mac/MachMessage.cpp:
329         (IPC::MachMessage::create):
330         Use fastZeroedMalloc() instead of fastMalloc() for safety, given that this class
331         has a mach_msg_header_t flexible array member. This is what is recommended by the
332         mach documentation. It is much safer because it otherwize relies on the user
333         (Connection::sendOutgoingMessage()) to initialize ALL the message members
334         correctly. I suspect this was the cause of <rdar://problem/44291920> because
335         Connection::sendOutgoingMessage() would fail to initialize header->msgh_voucher_port
336         and the MachMessage destructor would then call mach_msg_destroy(header()), which
337         would mach_msg_destroy_port(header->msgh_voucher_port).
338
339         (IPC::MachMessage::MachMessage):
340         Pass MessageReceiverName / MessageName when constructing the MachMessage rather
341         than setting them afterwards since they never change for a given MachMessage.
342
343         (IPC::MachMessage::messageSize):
344         Drop if checks for portDescriptorCount and memoryDescriptorCount since the logic
345         will do the right thing even if they are 0.
346
347         * Platform/IPC/mac/MachMessage.h:
348         (IPC::MachMessage::header):
349         (IPC::MachMessage::messageReceiverName const):
350         (IPC::MachMessage::messageName const):
351
352 2019-04-26  Wenson Hsieh  <wenson_hsieh@apple.com>
353
354         Rename m_LayerTreeFreezeReasons to m_layerTreeFreezeReasons
355         https://bugs.webkit.org/show_bug.cgi?id=197343
356
357         Reviewed by Antti Koivisto.
358
359         No change in behavior.
360
361         * WebProcess/WebPage/WebPage.cpp:
362         (WebKit::WebPage::freezeLayerTree):
363         (WebKit::WebPage::unfreezeLayerTree):
364         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
365         * WebProcess/WebPage/WebPage.h:
366
367 2019-04-26  Keith Rollin  <krollin@apple.com>
368
369         Enable new build rule for post-processing headers when using XCBuild
370         https://bugs.webkit.org/show_bug.cgi?id=197340
371         <rdar://problem/50226685>
372
373         Reviewed by Brent Fulgham.
374
375         In Bug 197116, we conditionally disabled the old method for
376         post-processing header files when we are using the new XCBuild build
377         system. This check-in conditionally enables the new post-processing
378         facility. Note that the old system is disabled and the new system
379         enabled only when the USE_NEW_BUILD_SYSTEM environment variable is set
380         to YES.
381
382         * Configurations/WebKit.xcconfig:
383
384 2019-04-26  Jessie Berlin  <jberlin@webkit.org>
385
386         Add new mac target numbers
387         https://bugs.webkit.org/show_bug.cgi?id=197313
388
389         Reviewed by Alex Christensen.
390
391         * Configurations/Version.xcconfig:
392         * Configurations/WebKitTargetConditionals.xcconfig:
393
394 2019-04-26  Youenn Fablet  <youenn@apple.com>
395
396         Use kDNSServiceFlagsKnownUnique to speed up mdns name registration for ICE candidates
397         https://bugs.webkit.org/show_bug.cgi?id=197328
398
399         Reviewed by Eric Carlson.
400
401         This allows skipping the probing step of MDNS name registration.
402         We can do that as registered names are random UUIDs.
403
404         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
405         (WebKit::NetworkMDNSRegister::registerMDNSName):
406
407 2019-04-26  Chris Dumez  <cdumez@apple.com>
408
409         [iOS] Our process assertion should not allow idle sleep
410         https://bugs.webkit.org/show_bug.cgi?id=197317
411         <rdar://problem/50137740>
412
413         Reviewed by Geoffrey Garen.
414
415         Our process assertion should not allow idle sleep. This is bad for power because the device
416         may switch between sleep and awake state frequently, as it get woken up by network packages.
417
418         * UIProcess/ios/ProcessAssertionIOS.mm:
419
420 2019-04-26  Eric Carlson  <eric.carlson@apple.com>
421
422         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
423         https://bugs.webkit.org/show_bug.cgi?id=197171
424         <rdar://problem/47454979>
425
426         Reviewed by Youenn Fablet.
427
428         * Shared/ios/WebIconUtilities.mm:
429         (WebKit::iconForVideoFile):
430         * Shared/mac/WebCoreArgumentCodersMac.mm:
431         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
432         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
433         * UIProcess/Cocoa/UIDelegate.mm:
434         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
435         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
436         (WebKit::PlatformCALayerRemoteCustom::clone const):
437
438 2019-04-26  Commit Queue  <commit-queue@webkit.org>
439
440         Unreviewed, rolling out r244683.
441         https://bugs.webkit.org/show_bug.cgi?id=197320
442
443         Causing crash on iOS Simulator and EWS failures (Requested by
444         sroberts on #webkit).
445
446         Reverted changeset:
447
448         "[iOS] Add internal setting to force -webkit-text-size-adjust
449         to "auto""
450         https://bugs.webkit.org/show_bug.cgi?id=197275
451         https://trac.webkit.org/changeset/244683
452
453 2019-04-26  Youenn Fablet  <youenn@apple.com>
454
455         Use normal loading path for ping loads
456         https://bugs.webkit.org/show_bug.cgi?id=196807
457
458         Reviewed by Alex Christensen.
459
460         In case a NetworkResourceLoader has the keepAlive option we do the following:
461         - Always use NetworkLoadChecker as we might need it to do checks after the Web context is gone.
462         - In case of aborting a KeepAlive loader, remove it from NetworkConnectionToWebProcess map
463         and add it to a kept-alive NetworkSession load set. The loader is only kept alive if it
464         has not yet received a response. Mark the loader as kept-alive.
465         - In case loader is kept-alive, cancel the load as soon as a response is gathered.
466
467         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
468         (WebKit::NetworkConnectionToWebProcess::transferKeptAliveLoad):
469         * NetworkProcess/NetworkConnectionToWebProcess.h:
470         * NetworkProcess/NetworkProcess.cpp:
471         (WebKit::NetworkProcess::addKeptAliveLoad):
472         (WebKit::NetworkProcess::removeKeptAliveLoad):
473         * NetworkProcess/NetworkProcess.h:
474         * NetworkProcess/NetworkResourceLoadMap.cpp:
475         (WebKit::NetworkResourceLoadMap::remove):
476         (WebKit::NetworkResourceLoadMap::take):
477         * NetworkProcess/NetworkResourceLoadMap.h:
478         * NetworkProcess/NetworkResourceLoader.cpp:
479         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
480         (WebKit::NetworkResourceLoader::cleanup):
481         (WebKit::NetworkResourceLoader::abort):
482         (WebKit::NetworkResourceLoader::didReceiveResponse):
483         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
484         * NetworkProcess/NetworkResourceLoader.h:
485         * WebProcess/Network/WebLoaderStrategy.cpp:
486         (WebKit::maximumBufferingTime):
487         (WebKit::WebLoaderStrategy::usePingLoad const):
488         * WebProcess/Network/WebLoaderStrategy.h:
489
490 2019-04-26  Alex Christensen  <achristensen@webkit.org>
491
492         Fix internal High Sierra build after r244653
493         https://bugs.webkit.org/show_bug.cgi?id=197131
494
495         * DerivedSources.make:
496         -std=gnu++17 didn't exist yet.  -std=gnu++1z did.
497
498 2019-04-26  Alex Christensen  <achristensen@webkit.org>
499
500         Fix an internal High Sierra build after r244653
501        ​https://bugs.webkit.org/show_bug.cgi?id=197131
502
503         * DerivedSources.make:
504         Apparently we can't use gnu++17 when preprocessing Platform.h in the makefile.
505
506 2019-04-26  Sihui Liu  <sihui_liu@apple.com>
507
508         Stop IDB transactions to release locked database files when network process is ready to suspend
509         https://bugs.webkit.org/show_bug.cgi?id=196372
510         <rdar://problem/48930116>
511
512         Reviewed by Brady Eidson.
513
514         * NetworkProcess/NetworkProcess.cpp:
515         (WebKit::NetworkProcess::processWillSuspendImminently):
516         (WebKit::NetworkProcess::prepareToSuspend):
517         (WebKit::NetworkProcess::resume):
518
519 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
520
521         [iOS] Add internal setting to force -webkit-text-size-adjust to "auto"
522         https://bugs.webkit.org/show_bug.cgi?id=197275
523         <rdar://problem/50211019>
524
525         Reviewed by Simon Fraser.
526
527         * Shared/WebPreferences.yaml:
528         * UIProcess/WebPreferences.h:
529
530 2019-04-25  Myles C. Maxfield  <mmaxfield@apple.com>
531
532         [iOS] Implement idempotent mode for text autosizing
533         https://bugs.webkit.org/show_bug.cgi?id=197250
534         <rdar://problem/50211034>
535
536         Reviewed by Jon Lee.
537
538         Push the initial scale down into the page.
539
540         * WebProcess/WebPage/ios/WebPageIOS.mm:
541         (WebKit::WebPage::dynamicViewportSizeUpdate):
542         (WebKit::WebPage::viewportConfigurationChanged):
543
544 2019-04-25  Alex Christensen  <achristensen@webkit.org>
545
546         Make NetworkCache blobs safe for mmap instead of not using blobs
547         https://bugs.webkit.org/show_bug.cgi?id=197264
548         <rdar://problem/49564348>
549
550         Reviewed by Antti Koivisto.
551
552         This does what r244597 did for WKContentRuleLists but for the NetworkCache's blobs.
553         Those are the two cases where we were calling mmap and seeing crashes in apps with
554         default file protection of NSFileProtectionComplete.
555
556         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
557         (WebKit::NetworkCache::BlobStorage::add):
558         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
559         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath): Deleted.
560         * NetworkProcess/cache/NetworkCacheFileSystem.h:
561         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm:
562         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
563         * NetworkProcess/cache/NetworkCacheStorage.cpp:
564         (WebKit::NetworkCache::Storage::Storage):
565         (WebKit::NetworkCache::Storage::synchronize):
566         (WebKit::NetworkCache::Storage::mayContainBlob const):
567         (WebKit::NetworkCache::Storage::shouldStoreBodyAsBlob):
568         (WebKit::NetworkCache::estimateRecordsSize): Deleted.
569         * NetworkProcess/cache/NetworkCacheStorage.h:
570
571 2019-04-25  Simon Fraser  <simon.fraser@apple.com>
572
573         REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures
574         https://bugs.webkit.org/show_bug.cgi?id=188357
575         <rdar://problem/42986633>
576
577         Reviewed by Dean Jackson.
578         
579         DumpRenderTree had no code that set page.setCompositingPolicyOverride() to Normal, so some
580         tests would fall into low memory mode and have different behavior.
581         
582         Fix by moving the code that calls setCompositingPolicyOverride(Normal) from the WK2 layer
583         to Internals, so it's shared by DRT and WTR.
584         
585         We no longer need the WK2 C SPI glue.
586
587         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
588         (WKBundlePageSetEventThrottlingBehaviorOverride):
589         (WKBundlePageSetCompositingPolicyOverride): Deleted.
590         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
591
592 2019-04-25  Chris Dumez  <cdumez@apple.com>
593
594         Trying to load a main resource outside the sandbox should not crash the WebContent process
595         https://bugs.webkit.org/show_bug.cgi?id=197299
596         <rdar://problem/49808042>
597
598         Reviewed by Geoffrey Garen.
599
600         Trying to load a main resource outside the sandbox should not crash the WebContent process. We should
601         simply ignore the load and log an error message.
602
603         * UIProcess/WebPageProxy.cpp:
604         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
605
606 2019-04-25  Timothy Hatcher  <timothy@apple.com>
607
608         Only send a synthetic mouse out event if synthetic mouse move events were sent.
609         https://bugs.webkit.org/show_bug.cgi?id=197295
610         rdar://problem/49040233
611
612         Reviewed by Zalan Bujtas.
613
614         * WebProcess/WebPage/ios/WebPageIOS.mm:
615         (WebKit::WebPage::completeSyntheticClick):
616
617 2019-04-25  Timothy Hatcher  <timothy@apple.com>
618
619         Disable date and time inputs on iOSMac.
620         https://bugs.webkit.org/show_bug.cgi?id=197287
621         rdar://problem/46794376
622
623         Reviewed by Wenson Hsieh.
624
625         * Configurations/FeatureDefines.xcconfig:
626
627 2019-04-25  Brady Eidson  <beidson@apple.com>
628
629         REGRESSION (243388): WebProcess::shouldFreezeOnSuspension() decision is flipped
630         <rdar://problem/49755494> and https://bugs.webkit.org/show_bug.cgi?id=197284
631
632         Reviewed by Chris Dumez.
633
634         * WebProcess/cocoa/WebProcessCocoa.mm:
635         (WebKit::WebProcess::shouldFreezeOnSuspension const): If any non-suspended pages are in the process it should
636           be eligible. Only if all pages are suspended should it be jetsam-able.
637
638 2019-04-25  Alex Christensen  <achristensen@webkit.org>
639
640         Start using C++17
641         https://bugs.webkit.org/show_bug.cgi?id=197131
642
643         Reviewed by Darin Adler.
644
645         * Configurations/Base.xcconfig:
646         * DerivedSources.make:
647
648 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
649
650         [GTK] Back/Forward gesture interferes with scrolling
651         https://bugs.webkit.org/show_bug.cgi?id=197168
652
653         Reviewed by Michael Catanzaro.
654
655         When the gesture is released with 0 velocity close to an edge of the webview,
656         the finishing animation is way too long, and in some cases it can look like the
657         gesture is already over, when it's still animating. By scrolling vertically while
658         that happens, it's possible to reset animation over and over again.
659
660         To reduce the duration in this case, instead of using maximum possible duration
661         (400ms), introduce a base velocity and use it for calculating the duration if
662         the actual velocity, relative to the end point, is equal to or less than 0.
663
664         * UIProcess/gtk/ViewGestureControllerGtk.cpp:
665         (WebKit::ViewGestureController::SwipeProgressTracker::startAnimation):
666
667 2019-04-25  Alexander Mikhaylenko  <exalm7659@gmail.com>
668
669         [GTK] Back/forward gesture snapshot always times out
670         https://bugs.webkit.org/show_bug.cgi?id=197233
671
672         Reviewed by Michael Catanzaro.
673
674         Delaying web process launch caused a regression where we create ViewGestureController when the
675         web process doesn't yet exist. The controller immediately tries to connect to it and fails,
676         and because of that never receives DidHitRenderTreeSizeThreshold() message, so navigation
677         snapshot always stays until timeout after performing the gesture.
678
679         To prevent this, create the controller in webkitWebViewBaseDidRelaunchWebProcess() instead of
680         webkitWebViewBaseCreateWebPage(). Additionally, since settings are now created earlier than
681         ViewGestureController, store the value of whether swipe gesture is enabled in WebKitWebViewBase
682         and immediately apply it when creating the controller.
683
684         * UIProcess/API/glib/WebKitWebView.cpp:
685         (enableBackForwardNavigationGesturesChanged):
686         Move the logic into webkitWebViewBaseSetEnableBackForwardNavigationGesture().
687         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
688         (webkitWebViewBaseSetEnableBackForwardNavigationGesture): Added. In addition to what was in
689         WebKitWebViewBase::enableBackForwardNavigationGesturesChanged(), store the value in a field
690         for the case ViewGestureController doesn't exist yet.
691         (webkitWebViewBaseCreateWebPage): Stop creating ViewGestureController.
692         (webkitWebViewBaseDidRelaunchWebProcess): Move creating ViewGestureController here. Also
693         immediately call setSwipeGestureEnabled() with the stored value.
694         * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
695
696 2019-04-25  Youenn Fablet  <youenn@apple.com>
697
698         [Mac iOS WK2] Layout Test http/wpt/cache-storage/cache-quota-after-restart.any.html is a flaky failure
699         https://bugs.webkit.org/show_bug.cgi?id=197040
700         <rdar://problem/49997641>
701
702         Reviewed by Antti Koivisto.
703
704         Delay write operations in case synchronize is ongoing.
705         This is restricted to AvoidRandomness mode which is always used by CacheAPI
706         and is also used by network cache for layout tests.
707
708         Tested by cache-quota-after-restart.any.html no longer exhibiting write disk errors.
709
710         * NetworkProcess/cache/NetworkCacheStorage.cpp:
711         (WebKit::NetworkCache::Storage::synchronize):
712         (WebKit::NetworkCache::Storage::store):
713
714 2019-04-25  Commit Queue  <commit-queue@webkit.org>
715
716         Unreviewed, rolling out r244627.
717         https://bugs.webkit.org/show_bug.cgi?id=197282
718
719         Causing internal build failures (Requested by ShawnRoberts on
720         #webkit).
721
722         Reverted changeset:
723
724         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
725         https://bugs.webkit.org/show_bug.cgi?id=197171
726         https://trac.webkit.org/changeset/244627
727
728 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
729
730         [GTK] Hardcoded text color in input fields
731         https://bugs.webkit.org/show_bug.cgi?id=126907
732
733         Reviewed by Michael Catanzaro.
734
735         Implement PageClient::effectiveAppearanceIsDark() for GTK port.
736
737         * UIProcess/API/gtk/PageClientImpl.cpp:
738         (WebKit::PageClientImpl::effectiveAppearanceIsDark const): Check if gtk-application-prefer-dark-theme setting is
739         enabled, or the theme name contains the -dark suffix or the GTK_THEME environment variable contains the :dark suffix.
740         * UIProcess/API/gtk/PageClientImpl.h:
741         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
742         (themeChanged): Notify the WebPageProxy that the theme has changed.
743         (webkitWebViewBaseSetToplevelOnScreenWindow): Connect to notify::gtk-application-prefer-dark-theme and notify::gtk-theme-name.
744         * WebProcess/WebPage/WebPage.cpp:
745         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
746         (WebKit::WebPage::setUseDarkAppearance): Set gtk-application-prefer-dark-theme setting accordingly.
747
748 2019-04-24  Zalan Bujtas  <zalan@apple.com>
749
750         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
751         https://bugs.webkit.org/show_bug.cgi?id=196948
752         <rdar://problem/49927131>
753
754         Reviewed by Tim Horton.
755
756         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
757         after r244291 there's no reason to have it in DrawingArea.
758
759         * UIProcess/DrawingAreaProxy.h:
760         (WebKit::DrawingAreaProxy::didUpdateGeometry):
761         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
762         * UIProcess/DrawingAreaProxy.messages.in:
763         * UIProcess/WebPageProxy.cpp:
764         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
765         (WebKit::WebPageProxy::setViewLayoutSize):
766         * UIProcess/WebPageProxy.h:
767         * UIProcess/WebPageProxy.messages.in:
768         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
769         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
770         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
771         * UIProcess/mac/WebPageProxyMac.mm:
772         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
773         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
774         (WebKit::WebChromeClient::intrinsicContentsSizeChanged const):
775         * WebProcess/WebCoreSupport/WebChromeClient.h:
776         * WebProcess/WebPage/WebPage.cpp:
777         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
778         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
779         * WebProcess/WebPage/WebPage.h:
780         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
781         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
782         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
783         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
784
785 2019-04-24  Commit Queue  <commit-queue@webkit.org>
786
787         Unreviewed, rolling out r244228.
788         https://bugs.webkit.org/show_bug.cgi?id=197262
789
790         Causes compat issues (Requested by smfr on #webkit).
791
792         Reverted changeset:
793
794         "Unreviewed test gardening for Windows."
795         https://trac.webkit.org/changeset/244228
796
797 2019-04-24  Eric Carlson  <eric.carlson@apple.com>
798
799         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
800         https://bugs.webkit.org/show_bug.cgi?id=197171
801         <rdar://problem/47454979>
802
803         Reviewed by Youenn Fablet.
804
805         * Shared/ios/WebIconUtilities.mm:
806         (WebKit::iconForVideoFile):
807         * Shared/mac/WebCoreArgumentCodersMac.mm:
808         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
809         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
810         * UIProcess/Cocoa/UIDelegate.mm:
811         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
812         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
813         (WebKit::PlatformCALayerRemoteCustom::clone const):
814
815 2019-04-24  Per Arne Vollan  <pvollan@apple.com>
816
817         [macOS] Fix syscall sandbox violation
818         https://bugs.webkit.org/show_bug.cgi?id=197247
819         <rdar://problem/50026580>
820
821         Reviewed by Brent Fulgham.
822
823         A missing syscall in the sandbox of the WebContent process is causing a crash.
824
825         * WebProcess/com.apple.WebProcess.sb.in:
826
827 2019-04-24  John Wilander  <wilander@apple.com>
828
829         Age out unconverted Ad Click Attributions after one week.
830         https://bugs.webkit.org/show_bug.cgi?id=197238
831         <rdar://problem/50177349>
832
833         Reviewed by Chris Dumez.
834
835         AdClickAttributionManager::storeUnconverted() and
836         AdClickAttributionManager::convert() now start by calling the new
837         AdClickAttributionManager::clearExpired() function to remove any
838         expired, unconverted attributions before continuing.
839
840         The rest of the patch is infrastructure to allow tests to expire
841         all unconverted attributions early.
842
843         * NetworkProcess/AdClickAttributionManager.cpp:
844         (WebKit::AdClickAttributionManager::storeUnconverted):
845         (WebKit::AdClickAttributionManager::convert):
846         (WebKit::AdClickAttributionManager::clearExpired):
847         (WebKit::AdClickAttributionManager::markAllUnconvertedAsExpiredForTesting):
848         * NetworkProcess/AdClickAttributionManager.h:
849         * NetworkProcess/NetworkProcess.cpp:
850         (WebKit::NetworkProcess::markAdClickAttributionsAsExpiredForTesting):
851         * NetworkProcess/NetworkProcess.h:
852         * NetworkProcess/NetworkProcess.messages.in:
853         * NetworkProcess/NetworkSession.cpp:
854         (WebKit::NetworkSession::markAdClickAttributionsAsExpiredForTesting):
855         * NetworkProcess/NetworkSession.h:
856         * UIProcess/API/C/WKPage.cpp:
857         (WKPageSetAdClickAttributionConversionURLForTesting):
858         (WKPageMarkAdClickAttributionsAsExpiredForTesting):
859         * UIProcess/API/C/WKPagePrivate.h:
860         * UIProcess/WebPageProxy.cpp:
861         (WebKit::WebPageProxy::markAdClickAttributionsAsExpiredForTesting):
862         * UIProcess/WebPageProxy.h:
863
864 2019-04-24  Wenson Hsieh  <wenson_hsieh@apple.com>
865
866         Plumb the navigation's request when determining recommended compatibility mode
867         https://bugs.webkit.org/show_bug.cgi?id=197225
868         <rdar://problem/48389965>
869
870         Reviewed by Alex Christensen.
871
872         Adds a new argument to effectiveCompatibilityModeAfterAdjustingPolicies.
873
874         * UIProcess/WebPageProxy.cpp:
875         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
876         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
877         * UIProcess/WebPageProxy.h:
878
879 2019-04-24  Tim Horton  <timothy_horton@apple.com>
880
881         Clean up WKActionSheetAssistant's use of LaunchServices
882         https://bugs.webkit.org/show_bug.cgi?id=194645
883         <rdar://problem/47707952>
884
885         Reviewed by Andy Estes.
886
887         * UIProcess/ios/WKActionSheetAssistant.mm:
888         (applicationHasAppLinkEntitlements):
889         (-[WKActionSheetAssistant _appendAppLinkOpenActionsForURL:actions:elementInfo:]):
890         (-[WKActionSheetAssistant _appendOpenActionsForURL:actions:elementInfo:]):
891         (appLinkForURL): Deleted.
892         Make this function much more early-returny and flat.
893         Adopt LS sync SPI instead of using a semaphore ourselves.
894         Adopt modern open SPI.
895
896 2019-04-24  Simon Fraser  <simon.fraser@apple.com>
897
898         Make it possible to control the renderTreeAsText output by setting options on testRunner
899         https://bugs.webkit.org/show_bug.cgi?id=197133
900
901         Reviewed by Sam Weinig.
902
903         Add testRunner.setRenderTreeDumpOptions() and expose the subset of RenderAsTextFlag flags
904         that make sense in testing (those that don't dump unstable data like addresses), and plumb
905         these flags through the various framework layers.
906
907         Convert RenderAsTextBehavior to an OptionSet<RenderAsTextFlag>.
908
909         Fix code generation in WebKitTestRunner to generate bindings for IDL const values,
910         and hand-code DumpRenderTree bindings.
911
912         Some cleanup of the TestRunners, using member initializers.
913
914         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
915         (WKBundlePageCopyRenderTreeExternalRepresentation):
916         * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
917         * WebProcess/WebPage/WebPage.cpp:
918         (WebKit::toRenderAsTextFlags):
919         (WebKit::WebPage::renderTreeExternalRepresentation const):
920         (WebKit::WebPage::renderTreeExternalRepresentationForPrinting const):
921         * WebProcess/WebPage/WebPage.h:
922
923 2019-04-24  Alex Christensen  <achristensen@webkit.org>
924
925         WKContentRuleLists should have a maximum FileProtection of CompleteUnlessOpen
926         https://bugs.webkit.org/show_bug.cgi?id=197078
927         <rdar://problem/49564348>
928
929         Reviewed by Geoff Garen.
930
931         r242735 was a fix for crashes when using mmap'd memory in apps with default FileProtection of NSFileProtectionComplete.
932         It is more memory efficient and just as secure to reduce the FileProtection of these files to NSFileProtectionCompleteUnlessOpen.
933
934         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
935         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
936         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
937         (WebKit::NetworkCache::pathRegisteredAsUnsafeToMemoryMapForTesting): Deleted.
938         (WebKit::NetworkCache::registerPathAsUnsafeToMemoryMapForTesting): Deleted.
939         * NetworkProcess/cache/NetworkCacheFileSystem.h:
940         * NetworkProcess/cache/NetworkCacheFileSystemCocoa.mm: Added.
941         (WebKit::NetworkCache::isSafeToUseMemoryMapForPath):
942         (WebKit::NetworkCache::makeSafeToUseMemoryMapForPath):
943         * Shared/WebCompiledContentRuleList.cpp:
944         (WebKit::WebCompiledContentRuleList::conditionsApplyOnlyToDomain const):
945         (WebKit::WebCompiledContentRuleList::filtersWithoutConditionsBytecode const):
946         (WebKit::WebCompiledContentRuleList::filtersWithConditionsBytecode const):
947         (WebKit::WebCompiledContentRuleList::topURLFiltersBytecode const):
948         (WebKit::WebCompiledContentRuleList::actions const):
949         (WebKit::WebCompiledContentRuleList::usesCopiedMemory const): Deleted.
950         * Shared/WebCompiledContentRuleList.h:
951         * Shared/WebCompiledContentRuleListData.cpp:
952         (WebKit::WebCompiledContentRuleListData::encode const):
953         (WebKit::WebCompiledContentRuleListData::decode):
954         (WebKit::WebCompiledContentRuleListData::size const): Deleted.
955         (WebKit::WebCompiledContentRuleListData::dataPointer const): Deleted.
956         * Shared/WebCompiledContentRuleListData.h:
957         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
958         * SourcesCocoa.txt:
959         * UIProcess/API/APIContentRuleList.cpp:
960         (API::ContentRuleList::usesCopiedMemory const): Deleted.
961         * UIProcess/API/APIContentRuleList.h:
962         * UIProcess/API/APIContentRuleListStore.cpp:
963         (API::openAndMapOrCopyContentRuleList):
964         (API::compiledToFile):
965         (API::createExtension):
966         (API::ContentRuleListStore::getContentRuleListSource):
967         (API::ContentRuleListStore::readContentsOfFile): Deleted.
968         (API::MappedOrCopiedData::dataPointer const): Deleted.
969         * UIProcess/API/APIContentRuleListStore.h:
970         * UIProcess/API/Cocoa/APIContentRuleListStoreCocoa.mm:
971         (API::ContentRuleListStore::readContentsOfFile): Deleted.
972         * UIProcess/API/Cocoa/WKContentRuleListStore.mm:
973         (+[WKContentRuleListStore _registerPathAsUnsafeToMemoryMapForTesting:]): Deleted.
974         * UIProcess/API/Cocoa/WKContentRuleListStorePrivate.h:
975         * UIProcess/API/Cocoa/_WKUserContentFilter.mm:
976         (-[_WKUserContentFilter usesCopiedMemory]): Deleted.
977         * UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h:
978         * WebKit.xcodeproj/project.pbxproj:
979
980 2019-04-24  David Kilzer  <ddkilzer@apple.com>
981
982         Fix build due to missing SPI declaration of kAXSFullKeyboardAccessEnabledNotification
983
984         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Import
985         AccessibilitySupportSPI.h.
986
987 2019-04-24  Chris Dumez  <cdumez@apple.com>
988
989         URL set by document.open() is communicated with the WebPageProxy but not the WebFrameProxy
990         https://bugs.webkit.org/show_bug.cgi?id=197214
991         <rdar://problem/49237544>
992
993         Reviewed by Alex Christensen.
994
995         URL set by document.open() is communicated with the WebPageProxy (since r244361) but not the
996         WebFrameProxy. This patch fixes this.
997
998         * UIProcess/API/Cocoa/WKWebView.mm:
999         (-[WKWebView _mainFrameURL]):
1000         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1001         * UIProcess/FrameLoadState.cpp:
1002         (WebKit::FrameLoadState::didExplicitOpen):
1003         * UIProcess/FrameLoadState.h:
1004         * UIProcess/WebFrameProxy.cpp:
1005         (WebKit::WebFrameProxy::didExplicitOpen):
1006         * UIProcess/WebFrameProxy.h:
1007         * UIProcess/WebPageProxy.cpp:
1008         (WebKit::WebPageProxy::didExplicitOpenForFrame):
1009
1010 2019-04-24  Chris Dumez  <cdumez@apple.com>
1011
1012         X-Frame-Options header should be ignored when frame-ancestors CSP directive is present
1013         https://bugs.webkit.org/show_bug.cgi?id=197226
1014         <rdar://problem/50155649>
1015
1016         Reviewed by Alex Christensen.
1017
1018         * NetworkProcess/NetworkResourceLoader.cpp:
1019         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
1020
1021 2019-04-24  Dean Jackson  <dino@apple.com>
1022
1023         Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
1024         https://bugs.webkit.org/show_bug.cgi?id=197231
1025         <rdar://problem/50164234>
1026
1027         Reviewed by Antoine Quint.
1028
1029         Rename _highlightLongPressCanClick to _longPressCanClick since it will be
1030         used in other places.
1031
1032         Only attach the _highlightLongPressGestureRecognizer when we're not
1033         using long presses for preview. This might revert in the future, if we
1034         can set up an appropriate gesture resolution between the two.
1035
1036         * UIProcess/ios/WKContentViewInteraction.h:
1037         * UIProcess/ios/WKContentViewInteraction.mm:
1038         (-[WKContentView setupInteraction]):
1039         (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
1040         (-[WKContentView _highlightLongPressRecognized:]):
1041         (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
1042         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
1043         (-[WKContentView _previewItemControllerDidCancelPreview:]):
1044
1045 2019-04-24  chris fleizach  <cfleizach@apple.com>
1046
1047         AX: Remove deprecated Accessibility Object Model events
1048         https://bugs.webkit.org/show_bug.cgi?id=197073
1049         <rdar://problem/50027819>
1050
1051         Reviewed by Ryosuke Niwa.
1052
1053         * Platform/spi/ios/AccessibilitySupportSPI.h:
1054         * UIProcess/API/Cocoa/WKWebView.mm:
1055         (-[WKWebView _initializeWithConfiguration:]):
1056         (-[WKWebView dealloc]):
1057         (accessibilityEventsEnabledChangedCallback): Deleted.
1058         (-[WKWebView _updateAccessibilityEventsEnabled]): Deleted.
1059         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1060         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
1061         * UIProcess/WebPageProxy.cpp:
1062         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled): Deleted.
1063         * UIProcess/WebPageProxy.h:
1064         * WebProcess/WebPage/WebPage.cpp:
1065         (WebKit::WebPage::updateAccessibilityEventsEnabled): Deleted.
1066         * WebProcess/WebPage/WebPage.h:
1067         * WebProcess/WebPage/WebPage.messages.in:
1068
1069 2019-04-23  John Wilander  <wilander@apple.com>
1070
1071         Move Ad Click Attribution from internal feature to experimental feature
1072         https://bugs.webkit.org/show_bug.cgi?id=197218
1073         <rdar://problem/47651691>
1074
1075         Reviewed by Brent Fulgham.
1076
1077         * Shared/WebPreferences.yaml:
1078
1079 2019-04-23  Keith Rollin  <krollin@apple.com>
1080
1081         Add Xcode version check for Header post-processing scripts
1082         https://bugs.webkit.org/show_bug.cgi?id=197116
1083         <rdar://problem/50058968>
1084
1085         Reviewed by Brent Fulgham.
1086
1087         There are several places in our Xcode projects that post-process
1088         header files after they've been exported. Because of XCBuild, we're
1089         moving to a model where the post-processing is performed at the same
1090         time the header files are exported, rather than as a distinct
1091         post-processing step. This patch disables the distinct step when the
1092         inline processing is available.
1093
1094         In practice, this means prefixing appropriate post-processing Custom
1095         Build phases with:
1096
1097         if [ "${XCODE_VERSION_MAJOR}" -ge "1100" -a "${USE_NEW_BUILD_SYSTEM}" = "YES" ]; then
1098             # In this configuration, post-processing is performed at the same time as copying in the postprocess-header-rule script, so there's no need for this separate step.
1099             exit 0
1100         fi
1101
1102         * WebKit.xcodeproj/project.pbxproj:
1103
1104 2019-04-23  John Wilander  <wilander@apple.com>
1105
1106         Remove Ad Click Attribution data when removing website data
1107         https://bugs.webkit.org/show_bug.cgi?id=197215
1108         <rdar://problem/47668988>
1109
1110         Reviewed by Chris Dumez.
1111
1112         This patch adds a new WebsiteDataType called AdClickAttributions and flags
1113         it as owned by the network process.
1114
1115         The new website data type is added to the Cocoa API layer for
1116         website data records management.
1117
1118         When either of the two WebsiteDataStore::removeData() functions calls
1119         NetworkProcess::deleteWebsiteData() or
1120         NetworkProcess::deleteWebsiteDataForOrigins() over IPC, the network
1121         process now calls into AdClickAttributionManager::clear() and
1122         AdClickAttributionManager::clearForRegistrableDomain() respectively,
1123         if the website datatypes include WebsiteDataType::AdClickAttributions.
1124
1125         The patch removes a couple of completion handlers in NetworkSession function
1126         calls are because those are not asynchronous.
1127
1128         * NetworkProcess/AdClickAttributionManager.cpp:
1129         (WebKit::AdClickAttributionManager::clear):
1130         (WebKit::AdClickAttributionManager::clearForRegistrableDomain):
1131         (WebKit::AdClickAttributionManager::toString const):
1132         * NetworkProcess/AdClickAttributionManager.h:
1133         * NetworkProcess/NetworkProcess.cpp:
1134         (WebKit::NetworkProcess::deleteWebsiteData):
1135         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1136         (WebKit::NetworkProcess::clearAdClickAttribution):
1137         * NetworkProcess/NetworkSession.cpp:
1138         (WebKit::NetworkSession::clearAdClickAttribution):
1139         (WebKit::NetworkSession::clearAdClickAttributionForRegistrableDomain):
1140         * NetworkProcess/NetworkSession.h:
1141         * Shared/WebsiteData/WebsiteData.cpp:
1142         (WebKit::WebsiteData::ownerProcess):
1143         * Shared/WebsiteData/WebsiteDataType.h:
1144         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1145         (WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval):
1146         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1147         * UIProcess/API/Cocoa/WKWebsiteDataRecord.mm:
1148         (dataTypesToString):
1149         * UIProcess/API/Cocoa/WKWebsiteDataRecordInternal.h:
1150         (WebKit::toWebsiteDataType):
1151         (WebKit::toWKWebsiteDataTypes):
1152         * UIProcess/API/Cocoa/WKWebsiteDataRecordPrivate.h:
1153         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1154         (+[WKWebsiteDataStore _allWebsiteDataTypesIncludingPrivate]):
1155
1156 2019-04-23  Tim Horton  <timothy_horton@apple.com>
1157
1158         Return annotated text checking strings via UIWKDocumentContext
1159         https://bugs.webkit.org/show_bug.cgi?id=197177
1160         <rdar://problem/49064839>
1161
1162         Reviewed by Ryosuke Niwa.
1163
1164         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.h:
1165         * WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:
1166         (WebKit::TextCheckingControllerProxy::annotatedSubstringBetweenPositions):
1167         * WebProcess/WebPage/ios/WebPageIOS.mm:
1168         (WebKit::WebPage::requestDocumentEditingContext):
1169         Respect the UIWKDocumentRequestAnnotation flag, returning an attributed
1170         string containing the platform text checking annotations.
1171
1172 2019-04-23  Commit Queue  <commit-queue@webkit.org>
1173
1174         Unreviewed, rolling out r244556.
1175         https://bugs.webkit.org/show_bug.cgi?id=197212
1176
1177         Causing build failures on multiple builders (Requested by
1178         ShawnRoberts on #webkit).
1179
1180         Reverted changeset:
1181
1182         "Create AVFoundationSoftLink.{h,mm} to reduce duplicate code"
1183         https://bugs.webkit.org/show_bug.cgi?id=197171
1184         https://trac.webkit.org/changeset/244556
1185
1186 2019-04-23  Remy Demarest  <rdemarest@apple.com>
1187
1188         Build fix after r244545.
1189
1190         Reviewed by Tim Horton.
1191
1192         * Platform/spi/mac/AppKitSPI.h:
1193         The SPI was an IPI in High Sierra.
1194
1195 2019-04-23  Per Arne Vollan  <pvollan@apple.com>
1196
1197         [iOS] Input field on ddg.gg is auto focused when url is entered with the software keyboard
1198         https://bugs.webkit.org/show_bug.cgi?id=196740
1199
1200         Reviewed by Megan Gardner.
1201
1202         When an url for a page with an autofocused input field  is entered with the software keyboard,
1203         the input field is auto selected, and the software keyboard reappears. This does not happen
1204         when picking the url from favorites. After using the software keyboard to enter the url, the
1205         activity state is being changed to focused. The method '_elementDidFocus' checks whether the
1206         activity state changed, and allows the software keyboard to be shown in this case. To avoid
1207         showing the software keyboard in this case, send the changing activity state bitfield to the
1208         UI process, and check if the focus flag is the only flag set.
1209   
1210         * UIProcess/ios/WKContentViewInteraction.mm:
1211         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1212
1213 2019-04-23  Guy Lewin  <guy@lewin.co.il>
1214
1215         Multiple File Input Icon Set Regardless of File List
1216         https://bugs.webkit.org/show_bug.cgi?id=195537
1217
1218         Reviewed by Alexey Proskuryakov.
1219
1220         Add WKOpenPanelResultListenerChooseMediaFiles() to choose files with
1221         icon and display string on iOS file open panels
1222
1223         * UIProcess/API/C/WKOpenPanelResultListener.cpp:
1224         (WKOpenPanelResultListenerChooseMediaFiles):
1225         * UIProcess/API/C/WKOpenPanelResultListener.h:
1226
1227 2019-04-23  Eric Carlson  <eric.carlson@apple.com>
1228
1229         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code
1230         https://bugs.webkit.org/show_bug.cgi?id=197171
1231         <rdar://problem/47454979>
1232
1233         Reviewed by Youenn Fablet.
1234
1235         * Shared/ios/WebIconUtilities.mm:
1236         (WebKit::iconForVideoFile):
1237         * Shared/mac/WebCoreArgumentCodersMac.mm:
1238         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData):
1239         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData):
1240         * UIProcess/Cocoa/UIDelegate.mm:
1241         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
1242         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
1243         (WebKit::PlatformCALayerRemoteCustom::clone const):
1244
1245 2019-04-22  Dean Jackson  <dino@apple.com>
1246
1247         Use additional members and protocols from WebKitAdditions in WKContentViewInteraction
1248         https://bugs.webkit.org/show_bug.cgi?id=197184
1249         <rdar://problem/50113848>
1250
1251         Reviewed by Wenson Hsieh.
1252
1253         WebKitAdditions defines some macros to include additional members
1254         and protocols for WKContentViewInteraction.
1255
1256         It also defines some new functions. Provide empty version
1257         of those functions when WebKitAdditions is not available.
1258
1259         * UIProcess/ios/WKContentViewInteraction.h:
1260         * UIProcess/ios/WKContentViewInteraction.mm:
1261         (-[WKContentView _registerPreview]):
1262         (-[WKContentView _unregisterPreview]):
1263
1264 2019-04-23  Tim Horton  <timothy_horton@apple.com>
1265
1266         Action sheet shares a stringified URL instead of a URL object
1267         https://bugs.webkit.org/show_bug.cgi?id=197185
1268         <rdar://problem/49962249>
1269
1270         Reviewed by Darin Adler.
1271
1272         * UIProcess/Cocoa/WKShareSheet.h:
1273         * UIProcess/Cocoa/WKShareSheet.mm:
1274         (-[WKShareSheet presentWithParameters:inRect:completionHandler:]):
1275         (-[WKShareSheet presentWithParameters:completionHandler:]): Deleted.
1276         * UIProcess/Cocoa/WebViewImpl.mm:
1277         (WebKit::WebViewImpl::showShareSheet):
1278         * UIProcess/ios/PageClientImplIOS.mm:
1279         (WebKit::PageClientImpl::showShareSheet):
1280         Make it possible to optionally provide WKShareSheet with
1281         a rect to present relative to.
1282
1283         * UIProcess/ios/WKContentViewInteraction.h:
1284         * UIProcess/ios/WKContentViewInteraction.mm:
1285         (-[WKContentView _showShareSheet:inRect:completionHandler:]):
1286         (-[WKContentView actionSheetAssistant:shareElementWithURL:rect:]):
1287         (-[WKContentView _showShareSheet:completionHandler:]): Deleted.
1288         Instead of stringifying the URL and using the text selection assistant's
1289         share method, hand WKShareSheet a proper URL.
1290
1291 2019-04-23  Ryosuke Niwa  <rniwa@webkit.org>
1292
1293         [iOS] element.focus() sometimes fails to reveal the focused element when it becomes editable dynamically
1294         https://bugs.webkit.org/show_bug.cgi?id=197188
1295
1296         Reviewed by Wenson Hsieh.
1297
1298         Commit the scroll tree update before revealing the keyboard via editor state update.
1299
1300         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1301         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1302
1303 2019-04-23  Remy Demarest  <rdemarest@apple.com>
1304
1305         Fix layout issues occuring when entering full screen mode.
1306         https://bugs.webkit.org/show_bug.cgi?id=197086
1307         <rdar://problem/47733671>.
1308
1309         Reviewed by Darin Adler.
1310
1311         This issue is the result of changing the style mask of the window after entering
1312         full screen mode. Safari adds an invisible toolbar to display the URL of the page
1313         which ends up breaking the layout. Having that window use a style that includes a
1314         titlebar fixes the bug.
1315
1316         * Platform/spi/mac/AppKitSPI.h:
1317         Declare an SPI to be used in WKFullScreenWindowController.
1318
1319         * UIProcess/Cocoa/WebViewImpl.mm:
1320         (WebKit::WebViewImpl::fullScreenWindow): Make the full screen window show a titlebar
1321         and make the content view underlap the titlebar to match the current behavior.
1322         Remove NSWindowStyleMaskBorderless which has no effects since it is equal to zero.
1323
1324         * UIProcess/mac/WKFullScreenWindowController.mm:
1325         (-[WKFullScreenWindowController initWithWindow:webView:page:]): Hide the titlebar
1326         before beginning the animation to full screen.
1327         (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]): Show the title
1328         bar when in full screen instead of a blank bar.
1329         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): Hide the title
1330         bar to restore the initial setting.
1331
1332 2019-04-23  John Wilander  <wilander@apple.com>
1333
1334         Ad Click Attribution redirects to well-known location should not trigger a conversion if they are blocked by content blockers
1335         https://bugs.webkit.org/show_bug.cgi?id=197183
1336         <rdar://problem/47763188>
1337
1338         Reviewed by Alex Christensen.
1339
1340         Ad Click Attribution conversions are picked up in the redirect handler
1341         in WebKit::NetworkResourceLoader. Content blocking typically happens in
1342         the continued redirect request handling in the web content process and
1343         a blocked request comes back empty.
1344
1345         We need to call the WebKit::NetworkLoadChecker in the network process
1346         for these specific redirects, just like we do for Ping.
1347
1348         The change makes use of the existing function
1349         NetworkLoadChecker::enableContentExtensionsCheck() for this purpose.
1350
1351         In essence, this change makes it possible to block all conversions made
1352         to a "/.well-known/ad-click-attribution/" URL.
1353
1354         * NetworkProcess/NetworkResourceLoader.cpp:
1355         (WebKit::NetworkResourceLoader::handleAdClickAttributionConversion):
1356             New convenience function.
1357         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1358             Now calls NetworkLoadChecker::enableContentExtensionsCheck() if
1359             an Ad Click Attribution conversion was found in the redirect URL.
1360         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1361             If the request was not blocked, it will store any found conversion here.
1362         * NetworkProcess/NetworkResourceLoader.h:
1363
1364 2019-04-23  Don Olmstead  <don.olmstead@sony.com>
1365
1366         [CMake][Win] Use target oriented design for WebKit
1367         https://bugs.webkit.org/show_bug.cgi?id=197173
1368
1369         Reviewed by Alex Christensen.
1370
1371         Enumerate public framework headers for WinCairo's WebKit implementation and copy them.
1372         Migrate to use WebKit_DERIVED_SOURCES_DIR.
1373
1374         * CMakeLists.txt:
1375         * PlatformGTK.cmake:
1376         * PlatformWPE.cmake:
1377         * PlatformWin.cmake:
1378
1379 2019-04-23  Chris Dumez  <cdumez@apple.com>
1380
1381         [Process-Swap-On-Navigation] WebKit hangs when going back to a form submission's page due to Process-Swap-On-Navigation on iOS 12.2 and higher
1382         https://bugs.webkit.org/show_bug.cgi?id=197097
1383         <rdar://problem/50048318>
1384
1385         Reviewed by Alex Christensen.
1386
1387         The issue is that when doing a history navigation with form data, we try to resubmit the form.
1388         We initially use the ReturnCacheDataDontLoad cache policy without prompting the user to get
1389         cached data. If this fails, we sent a DidFailProvisionalLoadForFrame IPC to the UIProcess but
1390         the WebContent process actually retries the load with ReturnCacheDataElseLoad cache policy.
1391         This new load triggers a new decidePolicyForNavigationAction.
1392
1393         This would cause trouble with process-swapping because we normally destroy the
1394         ProvisionalPageProxy as soon as we receive a DidFailProvisionalLoadForFrame IPC from the
1395         provisional process. As a result, the provisional process would not be able to retry.
1396
1397         To address the issue, we add pass a flag with the DidFailProvisionalLoadForFrame IPC to
1398         if the load will continue or not. When this flag is set, the UIProcess does not destroy
1399         the provisional page.
1400
1401         * Scripts/webkit/messages.py:
1402         Minor IPC message handler build fix.
1403
1404         * UIProcess/API/Cocoa/WKURLSchemeTask.mm:
1405         (-[WKURLSchemeTaskImpl _onlyIfCached]):
1406         * UIProcess/API/Cocoa/WKURLSchemeTaskPrivate.h:
1407         Add new _onlyIfCached SPI to WKURLSchemeTaskPrivate to allow for API testing.
1408
1409         * UIProcess/ProvisionalPageProxy.cpp:
1410         (WebKit::ProvisionalPageProxy::cancel):
1411         Pass WillContinueLoading flag.
1412
1413         (WebKit::ProvisionalPageProxy::validateInput):
1414         Consider IPC with a navigationID of 0 as valid. When the navigation is triggered by the
1415         WebContent process, it sends us a DecidePolicyForNavigationActionAsync IPC with a navigationID
1416         of 0, until the UIProcess can generate a valid identifier.
1417
1418         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
1419
1420         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
1421         When the WebPageProxy has generated a navigationID for the new WebContent process-initiated
1422         navigation, update m_navigationID so that follow-up IPC is considered valid.
1423
1424         * UIProcess/ProvisionalPageProxy.h:
1425         * UIProcess/WebPageProxy.cpp:
1426         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1427         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
1428         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
1429         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1430         * UIProcess/WebPageProxy.h:
1431         * UIProcess/WebPageProxy.messages.in:
1432         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1433         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1434         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1435
1436 2019-04-22  Zalan Bujtas  <zalan@apple.com>
1437
1438         [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
1439         https://bugs.webkit.org/show_bug.cgi?id=197175
1440         <rdar://problem/49613013>
1441
1442         Reviewed by Simon Fraser.
1443
1444         Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
1445         However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
1446
1447         * WebProcess/WebPage/ios/WebPageIOS.mm:
1448         (WebKit::WebPage::completeSyntheticClick):
1449
1450 2019-04-22  Alex Christensen  <achristensen@webkit.org>
1451
1452         Deprecate WKContextCreateWithInjectedBundlePath
1453         https://bugs.webkit.org/show_bug.cgi?id=197169
1454
1455         Reviewed by Youenn Fablet.
1456
1457         * UIProcess/API/C/WKContext.h:
1458
1459 2019-04-22  Alex Christensen  <achristensen@webkit.org>
1460
1461         REGRESSION(r230681) Do not use stored credentials if WKBundlePageResourceLoadClient.shouldUseCredentialStorage returns false
1462         https://bugs.webkit.org/show_bug.cgi?id=197093
1463         <rdar://problem/49708268>
1464
1465         Reviewed by Chris Dumez.
1466
1467         Only get the StoredCredentialsPolicy from the NetworkLoadChecker if we haven't already been told not to use credentials.
1468         Also add some test infrastructure for clearing persistent credentials added by the test.
1469
1470         * NetworkProcess/NetworkProcess.cpp:
1471         (WebKit::NetworkProcess::removeCredential):
1472         * NetworkProcess/NetworkProcess.h:
1473         * NetworkProcess/NetworkProcess.messages.in:
1474         * NetworkProcess/NetworkResourceLoader.cpp:
1475         (WebKit::NetworkResourceLoader::startNetworkLoad):
1476         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1477         (WebKit::NetworkProcess::removeCredential):
1478         * UIProcess/API/Cocoa/WKProcessPool.mm:
1479         (-[WKProcessPool _removeCredential:forProtectionSpace:completionHandler:]):
1480         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1481         * UIProcess/WebProcessPool.cpp:
1482         (WebKit::WebProcessPool::removeCredential):
1483         * UIProcess/WebProcessPool.h:
1484
1485 2019-04-22  Chris Dumez  <cdumez@apple.com>
1486
1487         Delayed WebProcessLaunch may break the _relatedWebView SPI
1488         https://bugs.webkit.org/show_bug.cgi?id=197160
1489
1490         Reviewed by Alex Christensen.
1491
1492         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
1493         would relate a WebView to another which has not launched its initial process yet.
1494
1495         To address the issue, when we need a running process for a WebView which has a related view, we need
1496         to make sure the related view has a running process and use that process. Previously, we would share
1497         the "dummy" process instead.
1498
1499         * UIProcess/WebPageProxy.cpp:
1500         (WebKit::WebPageProxy::launchProcess):
1501         (WebKit::WebPageProxy::ensureRunningProcess):
1502         * UIProcess/WebPageProxy.h:
1503         * UIProcess/WebProcessPool.cpp:
1504         (WebKit::WebProcessPool::createWebPage):
1505
1506 2019-04-22  David Quesada  <david_quesada@apple.com>
1507
1508         Remove linked-on-or-after check for download attribute handling
1509         https://bugs.webkit.org/show_bug.cgi?id=197176
1510         rdar://problem/48459714
1511
1512         Reviewed by Alex Christensen.
1513
1514         There are no apps linked prior to this SDK version that are using the _WKDownload SPI,
1515         so it doesn't make sense to preserve the old behavior of forcing download-attribute
1516         links to start downloads.
1517
1518         * UIProcess/Cocoa/VersionChecks.h:
1519         * UIProcess/WebPageProxy.cpp:
1520         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1521
1522 2019-04-22  Chris Dumez  <cdumez@apple.com>
1523
1524         Unreviewed, rolling out r244502.
1525
1526         Caused crashes on the bots
1527
1528         Reverted changeset:
1529
1530         "Delayed WebProcessLaunch may break the _relatedWebView SPI"
1531         https://bugs.webkit.org/show_bug.cgi?id=197160
1532         https://trac.webkit.org/changeset/244502
1533
1534 2019-04-22  Ryan Haddad  <ryanhaddad@apple.com>
1535
1536         Unreviewed, rolling out r244437.
1537
1538         Still breaks internal tests.
1539
1540         Reverted changeset:
1541
1542         "InjectedBundle parameters often need initialization function
1543         called before unarchiving"
1544         https://bugs.webkit.org/show_bug.cgi?id=189709
1545         https://trac.webkit.org/changeset/244437
1546
1547 2019-04-22  Chris Dumez  <cdumez@apple.com>
1548
1549         Delayed WebProcessLaunch may break the _relatedWebView SPI
1550         https://bugs.webkit.org/show_bug.cgi?id=197160
1551
1552         Reviewed by Alex Christensen.
1553
1554         Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client
1555         would relate a WebView to another which has not launched its initial process yet.
1556
1557         To address the issue, when we need a running process for a WebView which has a related view, we need
1558         to make sure the related view has a running process and use that process. Previously, we would share
1559         the "dummy" process instead.
1560
1561         * UIProcess/WebPageProxy.cpp:
1562         (WebKit::WebPageProxy::launchProcess):
1563         (WebKit::WebPageProxy::ensureRunningProcess):
1564         * UIProcess/WebPageProxy.h:
1565         * UIProcess/WebProcessPool.cpp:
1566         (WebKit::WebProcessPool::createWebPage):
1567
1568 2019-04-22  Ludovico de Nittis  <ludovico.denittis@collabora.com>
1569
1570         [GTK] fix gtk_style_context_set_background deprecation
1571         https://bugs.webkit.org/show_bug.cgi?id=196912
1572
1573         Reviewed by Carlos Garcia Campos.
1574
1575         Since gtk 3.18 gtk_style_context_set_background has been deprecated.
1576         Backgrounds are not rendered in the UI process, so it can be
1577         simply removed.
1578
1579         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1580         (webkitWebViewBaseRealize):
1581
1582 2019-04-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1583
1584         Defer EditorState updates until the next layer tree flush in a few additional circumstances
1585         https://bugs.webkit.org/show_bug.cgi?id=197145
1586         <rdar://problem/50078170>
1587
1588         Reviewed by Darin Adler.
1589
1590         Gets rid of sendPartialEditorStateAndSchedulePostLayoutUpdate(), in favor of always scheduling a full editor
1591         state update after the next compositing flush.
1592
1593         * WebProcess/WebPage/WebPage.cpp:
1594         (WebKit::WebPage::updateEditorStateAfterLayoutIfEditabilityChanged):
1595         (WebKit::WebPage::setNeedsFontAttributes):
1596         (WebKit::WebPage::didChangeOverflowScrollPosition):
1597         (WebKit::WebPage::didChangeSelection):
1598         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
1599         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate): Deleted.
1600         * WebProcess/WebPage/WebPage.h:
1601         * WebProcess/WebPage/ios/WebPageIOS.mm:
1602         (WebKit::WebPage::platformEditorState const):
1603         (WebKit::WebPage::updateVisibleContentRects):
1604
1605 2019-04-21  Chris Dumez  <cdumez@apple.com>
1606
1607         Regression(r243767) WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset
1608         https://bugs.webkit.org/show_bug.cgi?id=197144
1609
1610         Reviewed by Darin Adler.
1611
1612         WebFrame::m_navigationIsContinuingInAnotherProcess flag is never reset since it was introduced in
1613         r243767. This leads to leaking Navigation objects in the UIProcess when reusing a previously
1614         suspended process because such process will no longer send the DidDestroyNavigation IPC.
1615
1616         It turns out that resetting the flags causes API tests such as ProcessSwap.QuickBackForwardNavigationWithPSON
1617         to ASSERT. This is because when the UIProcess quickly navigate back and forth without waiting for policy
1618         decisions, we may end up getting the policy decision for a particular navigation *after* we've sent the
1619         DidDestroyNavigation.
1620
1621         As a result, this patch reverts r243767 and fixes in the assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
1622         another way. We initially assumed that the logic in WebPageProxy::didDestroyNavigation() was failing to
1623         ignore the DidDestroyNavigation from the previous process after a swap due to a race, maybe because it was
1624         sometimes received too late and m_provisionalPage was already cleared. However, this would not make sense
1625         since the test is crashing consistently and the page would no longer be able to receive IPC from the
1626         previous process *after* we've committed the provisional process/page.
1627
1628         The real issue was that the DidDestroyNavigation IPC was received *before* we could construct the
1629         provisional page, which is why the logic in WebPageProxy::didDestroyNavigation() was failing to ignore
1630         the bad IPC. In WebPageProxy::receivedNavigationPolicyDecision(), we were calling receivedPolicyDecision()
1631         (which would send the DidReceivePolicyDecision to the previous WebProcess) and then continueNavigationInNewProcess()
1632         in order to construct the provisional page. I personally did not expect we could receive IPC between the
1633         calls to receivedNavigationPolicyDecision() and receivedPolicyDecision(), since we are not yielding and since
1634         the DidReceivePolicyDecision IPC is asynchronous. However, this is exactly what was happening in the context
1635         of this test. The reason is that the DidReceivePolicyDecision IPC was getting wrapped in a synchronous message
1636         and sent as synchronous message due to the Connection::m_inDispatchMessageMarkedToUseFullySynchronousModeForTesting
1637         flag which seems to get set in the test due to some EventSender IPC. I believe this is because the test uses
1638         EventSender to do a click on a link which triggers the navigation.
1639
1640         To address the issue, I now call receivedNavigationPolicyDecision() *after* continueNavigationInNewProcess()
1641         to make sure that we always start the provisional load in the new process before we tell the previous process
1642         to stop loading. This way, there is no way we get IPC from the previous process about the current navigation
1643         before we have a provisional page.
1644
1645         * UIProcess/WebPageProxy.cpp:
1646         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1647         (WebKit::WebPageProxy::didDestroyNavigation):
1648         * WebProcess/WebPage/WebFrame.cpp:
1649         (WebKit::WebFrame::didReceivePolicyDecision):
1650         (WebKit::WebFrame::documentLoaderDetached):
1651         * WebProcess/WebPage/WebFrame.h:
1652
1653 2019-04-20  Chris Dumez  <cdumez@apple.com>
1654
1655         Unreviewed, fix iOS build with recent SDKs.
1656
1657         * UIProcess/API/Cocoa/WKWebView.mm:
1658         (deviceOrientation):
1659         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1660         (-[WKFullScreenViewController initWithWebView:]):
1661         (-[WKFullScreenViewController viewWillTransitionToSize:withTransitionCoordinator:]):
1662         (-[WKFullScreenViewController _statusBarFrameDidChange:]):
1663
1664 2019-04-19  John Wilander  <wilander@apple.com>
1665
1666         Disable Ad Click Attribution in ephemeral sessions and make sure conversion requests use an ephemeral, stateless session
1667         https://bugs.webkit.org/show_bug.cgi?id=197108
1668         <rdar://problem/49918702>
1669
1670         Reviewed by Alex Christensen.
1671
1672         This patch introduces a new NSURLSession in WebKit::NetworkSessionCocoa called
1673         m_ephemeralStatelessCookielessSession. As its name implies, it's ephemeral, 
1674         stateless, and has a NSHTTPCookieAcceptPolicyNever cookie policy.
1675
1676         The new session can be invoked with the new enum value of
1677         WebCore::StoredCredentialsPolicy called EphemeralStatelessCookieless.
1678
1679         WebKit::AdClickAttributionManager::fireConversionRequest() makes use of
1680         the new session for its conversion requests.
1681
1682         This patch also makes sure that Ad Click Attributions cannot be stored in
1683         ephemeral sessions and already stored attributions cannot be converted in
1684         ephemeral sessions.
1685
1686         * NetworkProcess/AdClickAttributionManager.cpp:
1687         (WebKit::AdClickAttributionManager::fireConversionRequest):
1688         (WebKit::AdClickAttributionManager::toString const):
1689         * NetworkProcess/NetworkLoadChecker.h:
1690         * NetworkProcess/NetworkProcess.h:
1691         * NetworkProcess/NetworkProcess.messages.in:
1692         * NetworkProcess/NetworkResourceLoader.cpp:
1693         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1694         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1695         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1696             Calls NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession() lazily.
1697         (WebKit::NetworkDataTaskCocoa::~NetworkDataTaskCocoa):
1698         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1699         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
1700         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1701         (WebKit::NetworkSessionCocoa::initializeEphemeralStatelessCookielessSession):
1702         (WebKit::NetworkSessionCocoa::invalidateAndCancel):
1703         * Shared/WebCoreArgumentCoders.h:
1704
1705 2019-04-19  Daniel Bates  <dabates@apple.com>
1706
1707         Use RetainPtr and rename +autocorrectionRectsWithRects:lastRect: to +autocorrectionRectsWithFirstCGRect:lastCGRect:
1708         https://bugs.webkit.org/show_bug.cgi?id=197122
1709
1710         Reviewed by Wenson Hsieh.
1711
1712         * UIProcess/ios/WKContentViewInteraction.mm:
1713         (-[WKContentView requestAutocorrectionRectsForString:withCompletionHandler:]): Renamed; formerly named +autocorrectionRectsWithRects:lastRect:.
1714         While I am here use else-branch to initialize firstRect and lastRect just to make the code closer to the optimal
1715         assembly. Also use Vector::{isEmpty, first, last}() instead of using the index operator overload and size() for
1716         emptiness checks. The code is more readable at the cost being ever so slightly slower (due to the overflow checks
1717         in first() and last()), but this code is likely not hot enough for it to matter.
1718         (-[WKContentView applyAutocorrection:toString:withCompletionHandler:]): Update for renaming.
1719         (+[WKAutocorrectionRects autocorrectionRectsWithFirstCGRect:lastCGRect:]): Ditto.
1720         (+[WKAutocorrectionRects autocorrectionRectsWithRects:lastRect:]): Deleted.
1721
1722 2019-04-19  Daniel Bates  <dabates@apple.com>
1723
1724         -[WKAutocorrectionContext emptyAutocorrectionContext:] generates invalid empty context
1725         https://bugs.webkit.org/show_bug.cgi?id=197119
1726
1727         Reviewed by Wenson Hsieh.
1728
1729         Use the existing EditingRange type to represent the location and length of the marked text
1730         range for an autocorrection instead of managing integers. This type avoid the need to handle
1731         the special case for an empty range represented as NSMakeRange(NSNotFound, 0). Currently
1732         WKAutocorrectionContext incorrectly represents the empty range as NSMakeRange(WTF::notFound, 0).
1733
1734         While I am here, simplify the existing WebAutocorrectionContext encoder/decoder code and rename
1735         +[WKAutocorrectionContext autocorrectionContextWithContext:] to +autocorrectionContextWithWebContext
1736         to better reflect the expected source of the conversion: a Web-type.
1737
1738         * Shared/ios/WebAutocorrectionContext.h:
1739         (WebKit::WebAutocorrectionContext::encode const): Reformat while I am here to make this logic easy
1740         to amend without losing SVN history.
1741         (WebKit::WebAutocorrectionContext::decode): Simplify the code while I am here.
1742         * UIProcess/ios/WKContentViewInteraction.mm:
1743         (-[WKContentView _handleAutocorrectionContext:]): Update for renaming.
1744         (+[WKAutocorrectionContext emptyAutocorrectionContext]): Update for renaming.
1745         (+[WKAutocorrectionContext autocorrectionContextWithWebContext:]): Renamed; formerly named autocorrectionContextWithContext.
1746         (+[WKAutocorrectionContext autocorrectionContextWithContext:]): Deleted.
1747         * WebProcess/WebPage/ios/WebPageIOS.mm:
1748         (WebKit::WebPage::autocorrectionContext): Update to make use of EditingRange. Also instantiate
1749         the struct and return it, initializing its fields individually instead of using the constructor to
1750         make this code less error prone. It's easy to introduce an error with the constructor notation when
1751         amending the the struct because so many of the arguments are of the same data type. Individually
1752         initializing the struct fields makes it less likely for an ordering mistake to be introduced.
1753
1754 2019-04-19  Dean Jackson  <dino@apple.com>
1755
1756         Add more _WKElementActionTypes and provide API to create with custom types
1757         https://bugs.webkit.org/show_bug.cgi?id=197117
1758         <rdar://problem/50059548>
1759
1760         Reviewed by Tim Horton.
1761
1762         We were missing a few obvious types that are well-known
1763         browser actions, and/or should be visible in share sheets.
1764         Also, clean up the API for constructing new types.
1765
1766         * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
1767         in new tabs, windows and downloading.
1768         * UIProcess/API/Cocoa/_WKElementAction.mm:
1769         (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
1770         with type, title and action.
1771         (+[_WKElementAction elementActionWithType:]): Call new method.
1772
1773 2019-04-18  Daniel Bates  <dabates@apple.com>
1774
1775         Use existing KeyEventCodesIOS constants instead of duplicating them
1776         https://bugs.webkit.org/show_bug.cgi?id=197081
1777
1778         Rubber-stamped by Wenson Hsieh.
1779
1780         * UIProcess/ios/WKContentViewInteraction.mm:
1781         (-[WKContentView _interpretKeyEvent:isCharEvent:]): While I am here, remove the case for the space key
1782         as it is identical to the default switch case.
1783
1784 2019-04-19  Keith Rollin  <krollin@apple.com>
1785
1786         Add postprocess-header-rule scripts
1787         https://bugs.webkit.org/show_bug.cgi?id=197072
1788         <rdar://problem/50027299>
1789
1790         Reviewed by Brent Fulgham.
1791
1792         Several projects have post-processing build phases where exported
1793         headers are tweaked after they've been copied. This post-processing is
1794         performed via scripts called postprocess-headers.sh. For reasons
1795         related to XCBuild, we are now transitioning to a build process where
1796         the post-processing is performed at the same time as the
1797         exporting/copying. To support this process, add similar scripts named
1798         postprocess-header-rule, which are geared towards processing a single
1799         file at a time rather than all exported files at once. Also add a
1800         build rule that makes use of these scripts. These scripts and build
1801         rules are not used at the moment; they will come into use in an
1802         imminent patch.
1803
1804         Note that I've named these postprocess-header-rule rather than
1805         postprocess-header-rule.sh. Scripts in Tools/Scripts do not have
1806         suffixes indicating how the tool is implemented. Scripts in
1807         per-project Scripts folders appear to be mixed regarding the use of
1808         suffixes. I'm opting here to follow the Tools/Scripts convention, with
1809         the expectation that over time we completely standardize on that.
1810
1811         * Scripts/postprocess-header-rule: Added.
1812         * WebKit.xcodeproj/project.pbxproj:
1813
1814 2019-04-19  Brady Eidson  <beidson@apple.com>
1815
1816         Deprecate WebKit2 plug-in support.
1817         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1818
1819         Reviewed by Andy Estes.
1820
1821         * UIProcess/API/Cocoa/WKPreferences.h:
1822         * UIProcess/API/Cocoa/WKPreferences.mm:
1823         (-[WKPreferences encodeWithCoder:]):
1824         (-[WKPreferences initWithCoder:]):
1825         (-[WKPreferences javaEnabled]):
1826         (-[WKPreferences setJavaEnabled:]):
1827         (-[WKPreferences plugInsEnabled]):
1828         (-[WKPreferences setPlugInsEnabled:]):
1829
1830 2019-04-19  Chris Dumez  <cdumez@apple.com>
1831
1832         Minor PSON release logging improvements
1833         https://bugs.webkit.org/show_bug.cgi?id=197104
1834
1835         Reviewed by Darin Adler.
1836
1837         * UIProcess/SuspendedPageProxy.cpp:
1838         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1839         * UIProcess/WebPageProxy.cpp:
1840         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1841
1842 2019-04-19  Tim Horton  <timothy_horton@apple.com>
1843
1844         YouTube and Twitter embeds don't load in News
1845         https://bugs.webkit.org/show_bug.cgi?id=197111
1846         <rdar://problem/50010081>
1847
1848         Reviewed by Timothy Hatcher.
1849
1850         * WebProcess/com.apple.WebProcess.sb.in:
1851         Adjust this sandbox exception to include both platforms.
1852
1853 2019-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1854
1855         [iOS] Add quirks to disable autocorrection and autocapitalization in hidden editable areas on some websites
1856         https://bugs.webkit.org/show_bug.cgi?id=197102
1857         <rdar://problem/49864669>
1858
1859         Reviewed by Ryosuke Niwa.
1860
1861         If the quirk for disabling autocorrection and autocapitalization in hidden editable areas is active, then check
1862         whether the focused element is hidden, and turn off autocorrection and autocapitalization if needed.
1863
1864         * WebProcess/WebPage/ios/WebPageIOS.mm:
1865         (WebKit::WebPage::getFocusedElementInformation):
1866
1867 2019-04-19  Commit Queue  <commit-queue@webkit.org>
1868
1869         Unreviewed, rolling out r244447.
1870         https://bugs.webkit.org/show_bug.cgi?id=197103
1871
1872         Caused build failures with Internal and Opensource builders
1873         (Requested by ShawnRoberts on #webkit).
1874
1875         Reverted changeset:
1876
1877         "Deprecate WebKit2 plug-in support."
1878         https://bugs.webkit.org/show_bug.cgi?id=197080
1879         https://trac.webkit.org/changeset/244447
1880
1881 2019-04-18  Brady Eidson  <beidson@apple.com>
1882
1883         Deprecate WebKit2 plug-in support.
1884         <rdar://problem/43812306> and https://bugs.webkit.org/show_bug.cgi?id=197080
1885
1886         Reviewed by Andy Estes.
1887
1888         * UIProcess/API/Cocoa/WKPreferences.h:
1889         * UIProcess/API/Cocoa/WKPreferences.mm:
1890         (-[WKPreferences encodeWithCoder:]):
1891         (-[WKPreferences initWithCoder:]):
1892         (-[WKPreferences javaEnabled]):
1893         (-[WKPreferences setJavaEnabled:]):
1894         (-[WKPreferences plugInsEnabled]):
1895         (-[WKPreferences setPlugInsEnabled:]):
1896
1897 2019-04-18  Commit Queue  <commit-queue@webkit.org>
1898
1899         Unreviewed, rolling out r244434.
1900         https://bugs.webkit.org/show_bug.cgi?id=197089
1901
1902         caused 1 API test failure (Requested by zalan on #webkit).
1903
1904         Reverted changeset:
1905
1906         "Regression (r244291): Broken API Test
1907         AutoLayoutRenderingProgressRelativeOrdering"
1908         https://bugs.webkit.org/show_bug.cgi?id=196948
1909         https://trac.webkit.org/changeset/244434
1910
1911 2019-04-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1912
1913         Add new compatibility mode API on WKNavigation
1914         https://bugs.webkit.org/show_bug.cgi?id=197069
1915         <rdar://problem/50025800>
1916
1917         Reviewed by Tim Horton.
1918
1919         Adds a new property on WKNavigation.
1920
1921         * Shared/WebCompatibilityMode.h:
1922
1923         Drive-by fix: make this enum class 8 bits wide.
1924
1925         * UIProcess/API/APINavigation.h:
1926         (API::Navigation::setEffectiveCompatibilityMode):
1927         (API::Navigation::effectiveCompatibilityMode const):
1928
1929         Add a new member variable to API::Navigation.
1930
1931         * UIProcess/API/Cocoa/WKNavigation.h:
1932         * UIProcess/API/Cocoa/WKNavigation.mm:
1933         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
1934         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h:
1935
1936         Add various hooks into WebKitAdditions.
1937
1938         * UIProcess/WebPageProxy.cpp:
1939         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1940
1941         Set API::Navigation's effective compatibility mode.
1942
1943         (WebKit::WebPageProxy::effectiveCompatibilityModeAfterAdjustingPolicies):
1944
1945         Renamed and refactored this method to return the effective compatibility mode, chosen while adjusting website
1946         policies.
1947
1948         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode): Deleted.
1949         * UIProcess/WebPageProxy.h:
1950
1951 2019-04-18  Don Olmstead  <don.olmstead@sony.com>
1952
1953         [CMake] Make WebCore headers copies
1954         https://bugs.webkit.org/show_bug.cgi?id=182512
1955         <rdar://problem/37510435>
1956
1957         Reviewed by Alex Christensen.
1958
1959         WebCore now uses WebCore_PRIVATE_INCLUDE_DIRECTORIES for all ports. This revealed
1960         problems with WebKit's usage of WebCore headers. All include directories directly
1961         referencing the WebCore source tree we're removed from the CMake files. Any includes
1962         of WebCore headers using "*.h" were modified to <WebCore/*.h>
1963
1964         Removed generation of forwarding headers for WebCore using the perl script.
1965
1966         * CMakeLists.txt:
1967         * NetworkProcess/curl/NetworkDataTaskCurl.h:
1968         * PlatformWPE.cmake:
1969         * PlatformWin.cmake:
1970         * Scripts/generate-forwarding-headers.pl:
1971         * UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
1972         * UIProcess/API/wpe/WebKitColorPrivate.h:
1973         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp:
1974         * UIProcess/win/PageClientImpl.cpp:
1975
1976 2019-04-18  Chris Dumez  <cdumez@apple.com>
1977
1978         [iOS] Improve detection of when web views go to background / foreground
1979         https://bugs.webkit.org/show_bug.cgi?id=197035
1980         <rdar://problem/45281182>
1981
1982         Reviewed by Tim Horton.
1983
1984         Improve detection of when web views go to background / foreground on iOS.
1985
1986         * UIProcess/ApplicationStateTracker.mm:
1987         (WebKit::ApplicationStateTracker::ApplicationStateTracker): Deleted.
1988         (WebKit::ApplicationStateTracker::~ApplicationStateTracker): Deleted.
1989         (WebKit::ApplicationStateTracker::applicationDidEnterBackground): Deleted.
1990         (WebKit::ApplicationStateTracker::applicationDidFinishSnapshottingAfterEnteringBackground): Deleted.
1991         (WebKit::ApplicationStateTracker::applicationWillEnterForeground): Deleted.
1992
1993 2019-04-18  Jer Noble  <jer.noble@apple.com>
1994
1995         Refactoring: Pull all fullscreen code out of Document and into its own helper class
1996         https://bugs.webkit.org/show_bug.cgi?id=197017
1997
1998         Reviewed by Eric Carlson.
1999
2000         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2001         (WebKit::WebFullScreenManager::willEnterFullScreen):
2002         (WebKit::WebFullScreenManager::didEnterFullScreen):
2003         (WebKit::WebFullScreenManager::willExitFullScreen):
2004         (WebKit::WebFullScreenManager::didExitFullScreen):
2005         (WebKit::WebFullScreenManager::setAnimatingFullScreen):
2006         (WebKit::WebFullScreenManager::requestExitFullScreen):
2007         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
2008         (webkit_dom_document_webkit_cancel_fullscreen):
2009         (webkit_dom_document_webkit_exit_fullscreen):
2010         (webkit_dom_document_get_webkit_is_fullscreen):
2011         (webkit_dom_document_get_webkit_fullscreen_keyboard_input_allowed):
2012         (webkit_dom_document_get_webkit_current_fullscreen_element):
2013         (webkit_dom_document_get_webkit_fullscreen_element):
2014         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2015         (WebKit::WebChromeClient::createWindow):
2016
2017 2019-04-18  Megan Gardner  <megan_gardner@apple.com>
2018
2019         Update UIKit when a cut causes a selection change
2020         https://bugs.webkit.org/show_bug.cgi?id=197047
2021         <rdar://problem/36311563>
2022
2023         Reviewed by Wenson Hsieh.
2024
2025         We need to let UIKit know when a cut causes a selection change (always),
2026         so that is can appropriately update the button on the keyboard bar.
2027
2028         * UIProcess/ios/WKContentViewInteraction.mm:
2029         (-[WKContentView cutForWebView:]):
2030
2031 2019-04-18  Brent Fulgham  <bfulgham@apple.com>
2032
2033         InjectedBundle parameters often need initialization function called before unarchiving
2034         https://bugs.webkit.org/show_bug.cgi?id=189709
2035         <rdar://problem/44573653>
2036
2037         Reviewed by Ryosuke Niwa.
2038
2039         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2040         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2041         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2042         register additional classes that are safe for serialization.
2043
2044         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
2045         to be serialized by the InjectedBundle.
2046         
2047         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2048         Revise 'initialize' to call this new method.
2049
2050         * WebProcess/InjectedBundle/InjectedBundle.h:
2051         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2052         (WebKit::InjectedBundle::initialize): Use the new method.
2053         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2054         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2055         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2056         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2057         NSDictionary object may itself hold other kinds of objects.
2058         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2059         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
2060
2061 2019-04-18  Zalan Bujtas  <zalan@apple.com>
2062
2063         Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
2064         https://bugs.webkit.org/show_bug.cgi?id=196948
2065         <rdar://problem/49927131>
2066
2067         Reviewed by Tim Horton.
2068
2069         Move intrinsicContentSizeDidChange out of DrawingArea. Intrinsic content size is a layout concept and
2070         after r244291 there's no reason to have it in DrawingArea.
2071
2072         * UIProcess/DrawingAreaProxy.h:
2073         (WebKit::DrawingAreaProxy::didUpdateGeometry):
2074         (WebKit::DrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2075         * UIProcess/DrawingAreaProxy.messages.in:
2076         * UIProcess/WebPageProxy.cpp:
2077         (WebKit::WebPageProxy::didChangeIntrinsicContentSize):
2078         (WebKit::WebPageProxy::setViewLayoutSize):
2079         * UIProcess/WebPageProxy.h:
2080         * UIProcess/WebPageProxy.messages.in:
2081         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2082         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2083         (WebKit::TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange): Deleted.
2084         * UIProcess/mac/WebPageProxyMac.mm:
2085         (WebKit::WebPageProxy::intrinsicContentSizeDidChange): Deleted.
2086         * WebProcess/WebPage/WebPage.cpp:
2087         (WebKit::WebPage::updateIntrinsicContentSizeIfNeeded):
2088         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2089         * WebProcess/WebPage/WebPage.h:
2090         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2091         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2092         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2093         (WebKit::TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded): Deleted.
2094
2095 2019-04-18  Ryan Haddad  <ryanhaddad@apple.com>
2096
2097         Unreviewed, rolling out r244299.
2098
2099         Breaks internal tests.
2100
2101         Reverted changeset:
2102
2103         "InjectedBundle parameters often need initialization function
2104         called before unarchiving"
2105         https://bugs.webkit.org/show_bug.cgi?id=189709
2106         https://trac.webkit.org/changeset/244299
2107
2108 2019-04-18  Shawn Roberts  <sroberts@apple.com>
2109
2110         Unreviewed manual rollout of r244248 and r244409
2111         Causing assertion failures on Mac WK2 Debug builds
2112         https://bugs.webkit.org/show_bug.cgi?id=195623
2113
2114         * NetworkProcess/NetworkProcess.cpp:
2115         (WebKit::NetworkProcess::lowMemoryHandler):
2116         * NetworkProcess/NetworkProcess.h:
2117         (WebKit::NetworkProcess::prefetchCache): Deleted.
2118         * NetworkProcess/NetworkResourceLoader.cpp:
2119         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2120         (WebKit::NetworkResourceLoader::didReceiveResponse):
2121         (WebKit::NetworkResourceLoader::didReceiveBuffer):
2122         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
2123         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const): Deleted.
2124         * NetworkProcess/NetworkResourceLoader.h:
2125         * NetworkProcess/cache/PrefetchCache.cpp: Removed.
2126         * NetworkProcess/cache/PrefetchCache.h: Removed.
2127         * Shared/WebPreferences.yaml:
2128         * Sources.txt:
2129         * WebKit.xcodeproj/project.pbxproj:
2130
2131 2019-04-18  Devin Rousso  <drousso@apple.com>
2132
2133         Web Inspector: Canvas: enable WebGL2 for inspector page
2134         https://bugs.webkit.org/show_bug.cgi?id=196932
2135         <rdar://problem/49916213>
2136
2137         Reviewed by Timothy Hatcher.
2138
2139         * WebProcess/WebPage/WebInspectorUI.cpp:
2140         (WebKit::WebInspectorUI::WebInspectorUI):
2141
2142 2019-04-17  Devin Rousso  <drousso@apple.com>
2143
2144         Web Inspector: InspectorFrontendHost::inspectionLevel returns wrong value for inspector3
2145         https://bugs.webkit.org/show_bug.cgi?id=197044
2146
2147         Reviewed by Joseph Pecoraro.
2148
2149         * UIProcess/WebInspectorUtilities.h:
2150         * UIProcess/WebInspectorUtilities.cpp:
2151         (WebKit::trackInspectorPage):
2152         (WebKit::untrackInspectorPage):
2153         Determine the level of the inspector page by looking to see if the page being inspected is
2154         in the inspector page map. If so, we must be inspecting an inspector page and should use
2155         that inspector page's inspection level as the value to increment.
2156
2157         * UIProcess/WebInspectorProxy.cpp:
2158         (WebKit::WebInspectorProxy::createFrontendPage):
2159         * UIProcess/RemoteWebInspectorProxy.cpp:
2160         (WebKit::RemoteWebInspectorProxy::createFrontendPageAndWindow):
2161
2162 2019-04-17  Tim Horton  <timothy_horton@apple.com>
2163
2164         Adopt different scroll view flashing SPI
2165         https://bugs.webkit.org/show_bug.cgi?id=197043
2166         <rdar://problem/49996476>
2167
2168         Reviewed by Wenson Hsieh.
2169
2170         * Platform/spi/ios/UIKitSPI.h:
2171         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
2172         (-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
2173
2174 2019-04-17  Tim Horton  <timothy_horton@apple.com>
2175
2176         REGRESSION (r241988): Switching tabs is slow
2177         https://bugs.webkit.org/show_bug.cgi?id=197037
2178         <rdar://problem/49951473>
2179
2180         Reviewed by Simon Fraser.
2181
2182         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2183         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
2184         r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
2185         but WebPageProxy messages are identified by their WebPageProxy ID.
2186         Revert that one change. The rest of the patch looks OK.
2187
2188 2019-04-17  Rob Buis  <rbuis@igalia.com>
2189
2190         Link prefetch not useful for top-level navigation
2191         https://bugs.webkit.org/show_bug.cgi?id=195623
2192
2193         Reviewed by Alex Christensen.
2194
2195         Fix macOS and iOS Debug WK2 bots ASSERTS after r367404, by simply
2196         not sending the DidReceiveResponse message.
2197
2198         * NetworkProcess/NetworkResourceLoader.cpp:
2199         (WebKit::NetworkResourceLoader::didReceiveResponse):
2200
2201 2019-04-17  Truitt Savell  <tsavell@apple.com>
2202
2203         Unreviewed, rolling out r244400.
2204
2205         Caused testing to exit early with assertionon Debug WK2
2206
2207         Reverted changeset:
2208
2209         "UI↔Web deadlock when printing with a JavaScript alert
2210         visible"
2211         https://bugs.webkit.org/show_bug.cgi?id=196839
2212         https://trac.webkit.org/changeset/244400
2213
2214 2019-04-17  Brady Eidson  <beidson@apple.com>
2215
2216         Link clicks in PDFs shouldn't send referrer headers.
2217         <rdar://problem/21142581> and https://bugs.webkit.org/show_bug.cgi?id=196980
2218
2219         Reviewed by Tim Horton.
2220
2221         * WebProcess/Plugins/PDF/PDFPlugin.mm:
2222         (WebKit::PDFPlugin::clickedLink):
2223         * WebProcess/WebPage/WebPage.cpp:
2224         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
2225
2226 2019-04-17  Andy Estes  <aestes@apple.com>
2227
2228         [iOS] Support multiple file selection in UIDocumentPickerViewController
2229         https://bugs.webkit.org/show_bug.cgi?id=197014
2230         <rdar://problem/49963514>
2231
2232         Reviewed by Tim Horton.
2233
2234         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2235         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2236         Allowed multiple file selection in our UIDocumentPickerViewController when
2237         _allowMultipleFiles is YES.
2238
2239         (displayStringForDocumentsAtURLs):
2240         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
2241         Changed to support multiple file selection. When more than one file is selected, use
2242         WebCore::multipleFileUploadText() as the display string.
2243
2244 2019-04-17  Alex Christensen  <achristensen@webkit.org>
2245
2246         Make WebCompiledContentRuleListData non-default-constructible, move its nonserialized member to API::ContentRuleList
2247         https://bugs.webkit.org/show_bug.cgi?id=197033
2248
2249         Reviewed by Tim Horton.
2250
2251         This is just cleanup that makes the code nicer without changing behavior.
2252
2253         * Shared/WebCompiledContentRuleListData.cpp:
2254         (WebKit::WebCompiledContentRuleListData::encode const):
2255         (WebKit::WebCompiledContentRuleListData::decode):
2256         * Shared/WebCompiledContentRuleListData.h:
2257         (WebKit::WebCompiledContentRuleListData::WebCompiledContentRuleListData):
2258         * UIProcess/API/APIContentRuleList.h:
2259         * UIProcess/API/APIContentRuleListStore.cpp:
2260         (API::createExtension):
2261
2262 2019-04-17  John Wilander  <wilander@apple.com>
2263
2264         Add prioritization of ad click conversions and cleaning of sent ad click conversions
2265         https://bugs.webkit.org/show_bug.cgi?id=196934
2266         <rdar://problem/49917773>
2267
2268         Reviewed by Chris Dumez.
2269
2270         In this description, by "pair" I mean { AdClickAttribution::Source, AdClickAttribution::Destination }.
2271
2272         This patch adds handling of prioritization of conversions according to these rules:
2273         - If we have a matching unconverted attribution, convert it. This consumes the conversion.
2274         - If we have no previously converted attribution for this pair, just store.
2275         - If we have a previously converted attribution for this pair, replace it if the new one has higher priority.
2276         - If we had no matching unconverted attribution but do have a previously converted attribution for this
2277         pair, re-convert the previously converted attribution to make sure the highest priority gets set.
2278
2279         This handling is in part done by dividing the previous m_adClickAttributionMap into 
2280         m_unconvertedAdClickAttributionMap and m_convertedAdClickAttributionMap, which now use a std::pair
2281         as key instead of a nested HashMap.
2282
2283         This patch also changes AdClickAttributionManager::firePendingConversionRequests() so that it now
2284         removes attributions which have been sent out.
2285
2286         Finally, AdClickAttributionManager::clear() no longer clears m_conversionBaseURLForTesting and
2287         m_isRunningTest since doing so caused test flakiness. It is now up to the test case that sets these
2288         members to also clear them when done.
2289
2290         * NetworkProcess/AdClickAttributionManager.cpp:
2291         (WebKit::AdClickAttributionManager::storeUnconverted):
2292         (WebKit::AdClickAttributionManager::convert):
2293         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
2294         (WebKit::AdClickAttributionManager::clear):
2295         (WebKit::AdClickAttributionManager::toString const):
2296         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
2297         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource): Deleted.
2298         (WebKit::AdClickAttributionManager::store): Deleted.
2299         * NetworkProcess/AdClickAttributionManager.h:
2300         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2301         (WebKit::AdClickAttributionManager::setConversionURLForTesting): Deleted.
2302         * NetworkProcess/NetworkSession.cpp:
2303         (WebKit::NetworkSession::storeAdClickAttribution):
2304
2305 2019-04-17  Tim Horton  <timothy_horton@apple.com>
2306
2307         UI↔Web deadlock when printing with a JavaScript alert visible
2308         https://bugs.webkit.org/show_bug.cgi?id=196839
2309         <rdar://problem/49157642>
2310
2311         Reviewed by Andy Estes.
2312
2313         * Platform/IPC/Connection.cpp:
2314         (IPC::Connection::dispatchWorkQueueMessageReceiverMessage):
2315         (IPC::Connection::sendSyncReply):
2316         (IPC::Connection::dispatchSyncMessage):
2317         * Platform/IPC/Connection.h:
2318         (IPC::Connection::hasOutstandingOutgoingSynchronousReplies const):
2319         Keep track of whether we owe the other side of the connection any
2320         delayed sync replies.
2321
2322         * UIProcess/API/Cocoa/WKWebView.mm:
2323         (-[WKWebView _webViewPrintFormatter]):
2324         Most actions one can take with a _WKWebViewPrintFormatter involve
2325         synchronously messaging the Web Content process with an infinite timeout.
2326         Doing so while the Web Content process is awaiting a reply to a deferred-reply
2327         synchronous message (like, say, an alert()) results in an app-destroying deadlock.
2328         Instead of that, return a nil _WKWebViewPrintFormatter, indicating to the client
2329         that we can't print right now.
2330
2331         * UIProcess/ios/WKContentView.mm:
2332         (-[WKContentView _wk_pageCountForPrintFormatter:]):
2333         (-[WKContentView _wk_printedDocument]):
2334         The above isn't sufficient, though, because a sync message could arrive and
2335         be handled between creation and use of the _WKWebViewPrintFormatter.
2336         So, we also bail with a zero page count and null CGPDFDocument immediately
2337         before we would send a sync message to the Web Content process. Clients
2338         handle this less gracefully (e.g. showing a zero page PDF), but it is
2339         very rare compared to the above case.
2340
2341 2019-04-17  Zalan Bujtas  <zalan@apple.com>
2342
2343         [ContentChangeObserver] Use aria role as a hint whether a tap should result in a synthetic click
2344         https://bugs.webkit.org/show_bug.cgi?id=196988
2345         <rdar://problem/49955328>
2346
2347         Reviewed by Simon Fraser.
2348
2349         Tapping on elements with cretain aria role attributes should trigger synthetic click the same way it does on form control elements. 
2350
2351         * WebProcess/WebPage/ios/WebPageIOS.mm:
2352         (WebKit::isAriaRoleForImmediateClick):
2353         (WebKit::nodeAlwaysRequiresClick):
2354         (WebKit::WebPage::handleSyntheticClick):
2355
2356 2019-04-17  Alex Christensen  <achristensen@webkit.org>
2357
2358         WKRetainPtr's adoption constructor should be private
2359         https://bugs.webkit.org/show_bug.cgi?id=197019
2360
2361         Reviewed by Tim Horton.
2362
2363         RefPtr and RetainPtr have already done this.  It makes us use nicer syntax.
2364
2365         * UIProcess/API/C/WKContext.cpp:
2366         (WKContextSetDownloadClient):
2367         * UIProcess/API/cpp/WKRetainPtr.h:
2368         (WebKit::WKRetainPtr::WKRetainPtr):
2369         (WebKit::adoptWK):
2370
2371 2019-04-17  Alex Christensen  <achristensen@webkit.org>
2372
2373         Fix crash during teardown of PingLoad
2374         https://bugs.webkit.org/show_bug.cgi?id=197024
2375         <rdar://problem/49973077>
2376
2377         Reviewed by Jer Noble.
2378
2379         * NetworkProcess/PingLoad.cpp:
2380         (WebKit::PingLoad::initialize):
2381         Early return if weakThis is null.
2382
2383 2019-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2384
2385         REGRESSION (r243926): [iOS] Release assertion when computing editor state during an overflow scroll triggered by layout
2386         https://bugs.webkit.org/show_bug.cgi?id=197012
2387         <rdar://problem/49908848>
2388
2389         Reviewed by Simon Fraser.
2390
2391         We hit the release assertion due to the following sequence of events:
2392         - Dispatch a queued event (in this case, a scroll event)
2393         - Invoke the scroll event listener, which modifies layout in some way
2394         - This scrolls an overflow scrollable container under the scope of layout
2395         - Overflow scrolling then calls didChangeSelection and triggers an editor state update, which updates layout
2396
2397         In the case where the selection is in the main frame, we bail early due to the check for recursive layout (i.e.
2398         frameView->layoutContext().isInRenderTreeLayout()). However, in the case where the selection is inside a
2399         subframe, we end up skipping past this check, since the subframe's FrameView isn't currently laying out, and so
2400         we end up hitting the release assertion underneath the early return.
2401
2402         To fix this, simply defer editor state updates due to overflow scrolling until the next remote layer tree commit
2403         instead of computing and sending the information immediately. While this only defers editor state updates during
2404         overflow scrolling, <rdar://problem/47258878> tracks making editor state updates deferred in the general case.
2405
2406         Test: editing/selection/overflow-scroll-while-selecting-text.html
2407
2408         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
2409         (WebKit::WebEditorClient::overflowScrollPositionChanged):
2410         * WebProcess/WebPage/WebPage.cpp:
2411         (WebKit::WebPage::didChangeOverflowScrollPosition):
2412         (WebKit::WebPage::didChangeSelection):
2413         (WebKit::WebPage::didChangeSelectionOrOverflowScrollPosition):
2414         * WebProcess/WebPage/WebPage.h:
2415
2416 2019-04-17  Chris Dumez  <cdumez@apple.com>
2417
2418         Remember device orientation permission for the duration of the browsing session
2419         https://bugs.webkit.org/show_bug.cgi?id=196992
2420         <rdar://problem/49946067>
2421
2422         Reviewed by Alex Christensen.
2423
2424         Implement caching of device orientation permission decisions on the WebDeviceOrientationAndMotionAccessController,
2425         which is owned by the WebsiteDataStore. This way, if we already prompted the user of a given origin, we will
2426         remember the previous decision for the duration of the session and not prompt again.
2427
2428         * Shared/WebsitePoliciesData.cpp:
2429         (WebKit::WebsitePoliciesData::encode const):
2430         (WebKit::WebsitePoliciesData::decode):
2431         * Shared/WebsitePoliciesData.h:
2432         * UIProcess/API/APIWebsitePolicies.cpp:
2433         (API::WebsitePolicies::copy const):
2434         (API::WebsitePolicies::data):
2435         * UIProcess/API/APIWebsitePolicies.h:
2436         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2437         (toDeviceOrientationOrMotionPermissionState):
2438         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2439         (toWKWebsiteDeviceOrientationAndMotionAccessPolicy):
2440         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2441         * UIProcess/WebPageProxy.cpp:
2442         (WebKit::WebPageProxy::shouldAllowDeviceOrientationAndMotionAccess):
2443         * UIProcess/WebPageProxy.h:
2444         * UIProcess/WebPageProxy.messages.in:
2445         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.cpp: Added.
2446         (WebKit::WebDeviceOrientationAndMotionAccessController::shouldAllowDeviceOrientationAndMotionAccess):
2447         (WebKit::WebDeviceOrientationAndMotionAccessController::deviceOrientationPermission const):
2448         * UIProcess/WebsiteData/WebDeviceOrientationAndMotionAccessController.h: Copied from Source/WebCore/dom/DeviceOrientationAndMotionAccessController.h.
2449         * UIProcess/WebsiteData/WebsiteDataStore.h:
2450         (WebKit::WebsiteDataStore::deviceOrientationAndMotionAccessController):
2451         * WebKit.xcodeproj/project.pbxproj:
2452         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2453         (WebKit::WebChromeClient::shouldAllowDeviceOrientationAndMotionAccess):
2454         * WebProcess/WebCoreSupport/WebChromeClient.h:
2455         * WebProcess/WebPage/WebPage.cpp:
2456         (WebKit::WebPage::shouldAllowDeviceOrientationAndMotionAccess):
2457         * WebProcess/WebPage/WebPage.h:
2458
2459 2019-04-16  Andy Estes  <aestes@apple.com>
2460
2461         [iOSMac] Use UIDocumentPickerViewController for picking files
2462         https://bugs.webkit.org/show_bug.cgi?id=196999
2463         <rdar://problem/49961414>
2464
2465         Reviewed by Tim Horton.
2466
2467         * UIProcess/ios/forms/WKFileUploadPanel.mm:
2468         (-[WKFileUploadPanel _showDocumentPickerMenu]):
2469         Changed to present a UIDocumentPickerViewController on iOSMac.
2470
2471         (-[WKFileUploadPanel documentPicker:didPickDocumentsAtURLs:]):
2472         (-[WKFileUploadPanel documentPicker:didPickDocumentAtURL:]):
2473         Replaced a deprecated delegate method implementation.
2474
2475 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2476
2477         [iOS] [WebKit2] Add support for honoring -[UIMenuItem dontDismiss]
2478         https://bugs.webkit.org/show_bug.cgi?id=196919
2479         <rdar://problem/41630459>
2480
2481         Reviewed by Tim Horton.
2482
2483         Adds modern WebKit support for -dontDismiss by implementing a couple of new platform hooks. Covered by a new
2484         layout test: editing/selection/ios/selection-after-changing-text-with-callout-menu.html.
2485
2486         * Platform/spi/ios/UIKitSPI.h:
2487
2488         Declare the private -dontDismiss property of UIMenuItem.
2489
2490         * UIProcess/API/Cocoa/WKWebView.mm:
2491         (-[WKWebView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
2492
2493         Additionally teach the web view (not just the content view) to respond to the hook. This matters in the case
2494         where the WebKit client (most notably, Mail) overrides WKWebView methods to define custom actions in the menu
2495         controller. This scenario is exercised by the new layout test.
2496
2497         * UIProcess/ios/WKContentViewInteraction.h:
2498         * UIProcess/ios/WKContentViewInteraction.mm:
2499         (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
2500
2501         If an action was performed where callout bar fading was ignored, then in WebKit, don't allow selection changes
2502         to fade the callout bar until after the next remote layer tree commit.
2503
2504         (-[WKContentView _updateChangedSelection:]):
2505
2506         Stop suppressing selection updates when showing B/I/U controls, now that we can properly honor the -dontDismiss
2507         property. This was originally introduced in <rdar://problem/15199925>, presumably to ensure that B/I/U buttons
2508         (which have -dontDismiss set to YES) don't trigger selection change and end up dismissing themselves; however,
2509         if triggering B/I/U actually changes the selection rects, this also means that the selection rects on-screen
2510         would be stale after triggering these actions. This effect is most noticeable when bolding text.
2511
2512         (-[WKContentView shouldAllowHidingSelectionCommands]):
2513
2514 2019-04-16  Ross Kirsling  <ross.kirsling@sony.com>
2515
2516         Unreviewed non-unified build fix after r244307.
2517
2518         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2519
2520 2019-04-16  Megan Gardner  <megan_gardner@apple.com>
2521
2522         Allow sharing from imageSheet on an image document
2523         https://bugs.webkit.org/show_bug.cgi?id=196891
2524         <rdar://problem/25377386>
2525
2526         Reviewed by Tim Horton.
2527
2528         Allow sharing from an image sheet generated from an image document
2529         by storing the image URL and using it as a fallback for the URL.
2530         Store it as an image on WKElementAction to not accidentally trigger
2531         any actions that should actually be associated with pure URLs.
2532
2533         * UIProcess/API/Cocoa/_WKActivatedElementInfo.h:
2534         * UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
2535         (-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:]):
2536         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:]):
2537         (-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:userInfo:]):
2538         (-[_WKActivatedElementInfo imageURL]):
2539         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:]): Deleted.
2540         (-[_WKActivatedElementInfo _initWithType:URL:location:title:ID:rect:image:userInfo:]): Deleted.
2541         * UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
2542         * UIProcess/API/Cocoa/_WKElementAction.mm:
2543         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
2544         * UIProcess/ios/WKActionSheetAssistant.mm:
2545         (-[WKActionSheetAssistant showImageSheet]):
2546         (-[WKActionSheetAssistant defaultActionsForImageSheet:]):
2547         (-[WKActionSheetAssistant showLinkSheet]):
2548         * UIProcess/ios/WKContentViewInteraction.mm:
2549         (-[WKContentView _showAttachmentSheet]):
2550         (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
2551         (-[WKContentView _presentedViewControllerForPreviewItemController:]):
2552
2553 2019-04-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2554
2555         [Cocoa] Add a way for Apple-internal clients to opt into recommended compatibility mode
2556         https://bugs.webkit.org/show_bug.cgi?id=196977
2557         <rdar://problem/49871194>
2558
2559         Reviewed by Tim Horton.
2560
2561         Add a helper method to query whether the navigation client should bypass policy safeguards when determining the
2562         recommended compatibility mode. We bypass policy safeguards in Cocoa platforms if the navigation delegate
2563         implements the new navigation delegate API.
2564
2565         * UIProcess/API/APINavigationClient.h:
2566         (API::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
2567         * UIProcess/Cocoa/NavigationState.h:
2568         * UIProcess/Cocoa/NavigationState.mm:
2569         (WebKit::NavigationState::NavigationClient::shouldBypassCompatibilityModeSafeguards const):
2570
2571 2019-04-16  Per Arne Vollan  <pvollan@apple.com>
2572
2573         -[WKWebsiteDataStore fetchDataRecordsOfTypes:completionHandler:] never returns _WKWebsiteDataTypeCredentials
2574         https://bugs.webkit.org/show_bug.cgi?id=196991
2575         <rdar://problem/45507423>
2576
2577         Reviewed by Brent Fulgham.
2578
2579         The credentials are stored in the Network process. To enable fetching credentials from the Network process,
2580         a proper process access type needs to be set for the credential Website data type.
2581
2582         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2583         (WebKit::computeNetworkProcessAccessTypeForDataFetch):
2584
2585 2019-04-16  Alex Christensen  <achristensen@webkit.org>
2586
2587         REGRESSION(r244162) Clearing website data from ephemeral WKWebsiteDataStore should finish instead of asserting or hanging
2588         https://bugs.webkit.org/show_bug.cgi?id=196995
2589
2590         Reviewed by Brady Eidson.
2591
2592         Always call CompletionHandlers.  Otherwise things hang or assert.
2593         I added an API test that asserts without this change so we don't regress this again.
2594
2595         * NetworkProcess/cache/CacheStorageEngine.cpp:
2596         (WebKit::CacheStorage::Engine::clearAllCaches):
2597         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
2598
2599 2019-04-16  Chris Dumez  <cdumez@apple.com>
2600
2601         URL set by document.open() is not communicated to the UIProcess
2602         https://bugs.webkit.org/show_bug.cgi?id=196941
2603         <rdar://problem/49237544>
2604
2605         Reviewed by Geoff Garen.
2606
2607         Whenever the UIProcess is notified of an explicit document.open() call, update the
2608         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
2609         knows it committed a load (i.e. It is no longer showing the initially empty document).
2610
2611         * UIProcess/PageLoadState.cpp:
2612         (WebKit::PageLoadState::didExplicitOpen):
2613         * UIProcess/PageLoadState.h:
2614         * UIProcess/WebPageProxy.cpp:
2615         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2616         * UIProcess/WebPageProxy.h:
2617         * UIProcess/WebPageProxy.messages.in:
2618         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2619         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2620         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2621
2622 2019-04-16  Chris Dumez  <cdumez@apple.com>
2623
2624         Show prompt for device orientation access if the client does not implement the corresponding API delegate
2625         https://bugs.webkit.org/show_bug.cgi?id=196971
2626         <rdar://problem/49945840>
2627
2628         Reviewed by Alex Christensen.
2629
2630         Show prompt for device orientation access if the client does not implement the corresponding
2631         API delegate, instead of rejecting access by default.
2632
2633         * UIProcess/Cocoa/UIDelegate.mm:
2634         (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
2635         * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
2636         * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
2637         (WebKit::presentOrientationAccessAlert):
2638         * WebKit.xcodeproj/project.pbxproj:
2639
2640 2019-04-16  Zalan Bujtas  <zalan@apple.com>
2641
2642         REGRESSION(r243557)[ContentChangeObserver] Need to double tap text formatting elements in MS Word web app
2643         https://bugs.webkit.org/show_bug.cgi?id=196975
2644         <rdar://problem/49489849>
2645
2646         Reviewed by Simon Fraser.
2647
2648         This patch ensures that we always proceed with synthetic click on form elements.
2649
2650         Covered by existing tests.
2651
2652         * WebProcess/WebPage/ios/WebPageIOS.mm:
2653         (WebKit::WebPage::handleSyntheticClick):
2654
2655 2019-04-16  Timothy Hatcher  <timothy@apple.com>
2656
2657         FrameView base background color always starts white.
2658         https://bugs.webkit.org/show_bug.cgi?id=196976
2659
2660         Reviewed by Beth Dakin.
2661
2662         * WebProcess/WebPage/WebPage.cpp:
2663         (WebKit::WebPage::WebPage): Set m_backgroundColor before calling
2664         WebFrame::createWithCoreMainFrame so the call to create the FrameView
2665         for the empty page in transitionToCommittedForNewPage() gets
2666         the correct color from WebPage.
2667
2668 2019-04-16  Ryan Haddad  <ryanhaddad@apple.com>
2669
2670         Unreviewed, fix the build with recent SDKs.
2671
2672         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2673         (WebKit::WKWebViewState::store):
2674
2675 2019-04-16  Commit Queue  <commit-queue@webkit.org>
2676
2677         Unreviewed, rolling out r244321.
2678         https://bugs.webkit.org/show_bug.cgi?id=196968
2679
2680         Causing all WK2 Debug builds to exit early after Assertion
2681         failures. (Requested by ShawnRoberts on #webkit).
2682
2683         Reverted changeset:
2684
2685         "URL set by document.open() is not communicated to the
2686         UIProcess"
2687         https://bugs.webkit.org/show_bug.cgi?id=196941
2688         https://trac.webkit.org/changeset/244321
2689
2690 2019-04-15  Joseph Pecoraro  <pecoraro@apple.com>
2691
2692         Web Inspector: CRASH when reopening tab with docked inspector on crashed page
2693         https://bugs.webkit.org/show_bug.cgi?id=196954
2694         <rdar://problem/48716433>
2695
2696         Reviewed by Ryosuke Niwa.
2697
2698         * UIProcess/mac/WebInspectorProxyMac.mm:
2699         (WebKit::WebInspectorProxy::inspectedViewFrameDidChange):
2700
2701 2019-04-15  Chris Dumez  <cdumez@apple.com>
2702
2703         URL set by document.open() is not communicated to the UIProcess
2704         https://bugs.webkit.org/show_bug.cgi?id=196941
2705         <rdar://problem/49237544>
2706
2707         Reviewed by Geoffrey Garen.
2708
2709         Whenever the UIProcess is notified of an explicit document.open() call, update the
2710         PageLoadState to make sure the URL is up-to-date. Also make sure the page / process
2711         knows it committed a load (i.e. It is no longer showing the initially empty document).
2712
2713         * UIProcess/PageLoadState.cpp:
2714         (WebKit::PageLoadState::didExplicitOpen):
2715         * UIProcess/PageLoadState.h:
2716         * UIProcess/WebPageProxy.cpp:
2717         (WebKit::WebPageProxy::didExplicitOpenForFrame):
2718         * UIProcess/WebPageProxy.h:
2719         * UIProcess/WebPageProxy.messages.in:
2720         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2721         (WebKit::WebFrameLoaderClient::dispatchDidExplicitOpen):
2722         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2723
2724 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2725
2726         Stop using hyphenationFactor
2727         https://bugs.webkit.org/show_bug.cgi?id=196949
2728         <rdar://problem/49779594>
2729
2730         Reviewed by Geoffrey Garen.
2731
2732         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2733         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
2734         I added this use of hyphenationFactor in r241124 but the other changes in that revision make the use of hyphenationFactor redundant.
2735         There is a reason to remove it in the radar.
2736
2737 2019-04-15  Alex Christensen  <achristensen@webkit.org>
2738
2739         Forward declare WKWebView in _WKDiagnosticLoggingDelegate.h
2740
2741         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2742         This fixes builds where _WKDiagnosticLoggingDelegate.h is the only WebKit header included, such as my work on rdar://problem/35175989
2743
2744 2019-04-15  Jer Noble  <jer.noble@apple.com>
2745
2746         Add a DiagnosticLogging method taking an arbitrary dictionary of values.
2747         https://bugs.webkit.org/show_bug.cgi?id=196773
2748
2749         Reviewed by Alex Christensen.
2750
2751         In addition to adding the new logging delegate method (and piping everything into it), 
2752         add a new APIObject class to represent a signed integer.
2753
2754         * Shared/API/APINumber.h:
2755         * Shared/API/APIObject.h:
2756         * Shared/Cocoa/APIObject.mm:
2757         (API::Object::newObject):
2758         * Shared/Cocoa/WKNSNumber.mm:
2759         (-[WKNSNumber dealloc]):
2760         (-[WKNSNumber objCType]):
2761         (-[WKNSNumber getValue:]):
2762         (-[WKNSNumber longLongValue]):
2763         (-[WKNSNumber _apiObject]):
2764         * Shared/UserData.cpp:
2765         (WebKit::UserData::encode):
2766         (WebKit::UserData::decode):
2767         * UIProcess/API/APIDiagnosticLoggingClient.h:
2768         * UIProcess/API/C/WKPageDiagnosticLoggingClient.h:
2769         * UIProcess/API/Cocoa/_WKDiagnosticLoggingDelegate.h:
2770         * UIProcess/Cocoa/DiagnosticLoggingClient.h:
2771         * UIProcess/Cocoa/DiagnosticLoggingClient.mm:
2772         (WebKit::DiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2773         * UIProcess/ProvisionalPageProxy.cpp:
2774         (WebKit::ProvisionalPageProxy::didReceiveMessage):
2775         * UIProcess/WebPageDiagnosticLoggingClient.cpp:
2776         (WebKit::WebPageDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2777         * UIProcess/WebPageDiagnosticLoggingClient.h:
2778         * UIProcess/WebPageProxy.cpp:
2779         (WebKit::WebPageProxy::logDiagnosticMessageWithValueDictionary):
2780         * UIProcess/WebPageProxy.h:
2781         * UIProcess/WebPageProxy.messages.in:
2782         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.cpp:
2783         (WebKit::WebDiagnosticLoggingClient::logDiagnosticMessageWithValueDictionary):
2784         * WebProcess/WebCoreSupport/WebDiagnosticLoggingClient.h:
2785
2786 2019-04-15  Dean Jackson  <dino@apple.com>
2787
2788         Provide option to not create a longpress gesture recognizer
2789         https://bugs.webkit.org/show_bug.cgi?id=196937
2790         <rdar://problem/49918278>
2791
2792         Build fix for iOS platforms that don't have link preview.
2793
2794         * UIProcess/ios/WKContentViewInteraction.mm:
2795         (-[WKContentView setupInteraction]):
2796
2797 2019-04-15  Brent Fulgham  <bfulgham@apple.com>
2798
2799         InjectedBundle parameters often need initialization function called before unarchiving
2800         https://bugs.webkit.org/show_bug.cgi?id=189709
2801         <rdar://problem/44573653>
2802
2803         Reviewed by Ryosuke Niwa.
2804
2805         Handle the case where the InjectedBundle parameters do not successfully decode because they contain
2806         an unexpected class from the embedding program. If this happens, try decoding the bundle parameters
2807         after the bundle initialiation function runs, which gives the embedding program the opportunity to
2808         register additional classes that are safe for serialization.
2809
2810         Extend WKWebProcessPlugIn with a method that returns the names of any custom classes that need
2811         to be serialized by the InjectedBundle.
2812         
2813         Create a new 'decodeBundleParameters' method that contains the logic that used to live in 'initialize'.
2814         Revise 'initialize' to call this new method.
2815
2816         * WebProcess/InjectedBundle/InjectedBundle.h:
2817         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
2818         (WebKit::InjectedBundle::initialize): Use the new method.
2819         (WebKit::InjectedBundle::decodeBundleParameters): Added.
2820         (WebKit::InjectedBundle::setBundleParameters): Use 'decodeObjectOfClasses' with the more complete
2821         'classesForCoder' method to unarchive the passed bundle parameters, rather than the
2822         NSDictionary-specific method, since InjectedBundles often encode other types of objects, and the
2823         NSDictionary object may itself hold other kinds of objects.
2824         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:
2825         (WebKit::WKWebProcessPlugIn::additionalClassesForParameterCoder): Added.
2826
2827 2019-04-15  Dean Jackson  <dino@apple.com>
2828
2829         Provide option to not create a longpress gesture recognizer
2830         https://bugs.webkit.org/show_bug.cgi?id=196937
2831         <rdar://problem/49918278>
2832
2833         Reviewed by Antoine Quint.
2834
2835         A WebKitAdditions file has changed name to WKContentViewInteractionWKInteraction.mm.
2836
2837         Add a property to toggle if we should add a long press gesture
2838         recognizer.
2839
2840         * UIProcess/ios/WKContentViewInteraction.h:
2841         * UIProcess/ios/WKContentViewInteraction.mm:
2842         (-[WKContentView setupInteraction]):
2843         (shouldUsePreviewForLongPress):
2844         (-[WKContentView shouldUsePreviewForLongPress]):
2845
2846 2019-04-15  Don Olmstead  <don.olmstead@sony.com>
2847
2848         [CMake] WebCore derived sources should only be referenced inside WebCore
2849         https://bugs.webkit.org/show_bug.cgi?id=196904
2850
2851         Reviewed by Konstantin Tokarev.
2852
2853         Remove reference to DERIVED_SOURCES_WEBCORE_DIR in PlatformMac.cmake.
2854
2855         * PlatformMac.cmake:
2856
2857 2019-04-15  Zalan Bujtas  <zalan@apple.com>
2858
2859         DrawingArea should only capture painting related milestones
2860         https://bugs.webkit.org/show_bug.cgi?id=196926
2861         <rdar://problem/48003845>
2862
2863         Reviewed by Tim Horton.
2864
2865         While dispatching layout milestones (mixture of layout and painting items), the associated drawing areas should only capture the painting related milestones.
2866         These captured milestones get dispatched later in the commit handler to ensure that they are not forwarded prematurely.
2867         However the truly layout related milestones (e.g. DidFirstVisuallyNonEmptyLayout) should be dispatched right away with no delay.
2868
2869         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
2870         (WebKit::RemoteLayerTreeTransaction::newlyReachedPaintingMilestones const):
2871         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedPaintingMilestones):
2872         (WebKit::RemoteLayerTreeTransaction::newlyReachedLayoutMilestones const): Deleted.
2873         (WebKit::RemoteLayerTreeTransaction::setNewlyReachedLayoutMilestones): Deleted.
2874         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2875         (WebKit::RemoteLayerTreeTransaction::encode const):
2876         (WebKit::RemoteLayerTreeTransaction::decode):
2877         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2878         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2879         * WebProcess/WebPage/DrawingArea.h:
2880         (WebKit::DrawingArea::addMilestonesToDispatch):
2881         (WebKit::DrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2882         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2883         (WebKit::RemoteLayerTreeDrawingArea::addMilestonesToDispatch):
2884         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2885         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
2886         (WebKit::RemoteLayerTreeDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2887         * WebProcess/WebPage/WebPage.cpp:
2888         (WebKit::WebPage::dispatchDidReachLayoutMilestone):
2889         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2890         (WebKit::TiledCoreAnimationDrawingArea::addMilestonesToDispatch):
2891         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2892         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedPaintingMilestones):
2893         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
2894         (WebKit::TiledCoreAnimationDrawingArea::sendPendingNewlyReachedLayoutMilestones): Deleted.
2895         (WebKit::TiledCoreAnimationDrawingArea::dispatchDidReachLayoutMilestone): Deleted.
2896
2897 2019-04-15  John Wilander  <wilander@apple.com>
2898
2899         Send delayed Ad Click Attribution conversion requests to the click source
2900         https://bugs.webkit.org/show_bug.cgi?id=196838
2901         <rdar://problem/47650157>
2902
2903         Reviewed by Chris Dumez and Youenn Fablet.
2904
2905         This patch schedules a conversion request with appropriate data going to the
2906         click source as a result of an ad click conversion.
2907
2908         WebKit::AdClickAttributionManager makes use of existing WebKit::PingLoad
2909         infrastructure to make the request. This will probably be reworked into a
2910         dedicated load class further on.
2911
2912         New test infrastructure allows for an override of both the conversion URL
2913         and the 24-48 hour timer.
2914
2915         * NetworkProcess/AdClickAttributionManager.cpp: Added.
2916         (WebKit::AdClickAttributionManager::ensureDestinationMapForSource):
2917         (WebKit::AdClickAttributionManager::store):
2918         (WebKit::AdClickAttributionManager::startTimer):
2919             Convenience function to support test override.
2920         (WebKit::AdClickAttributionManager::convert):
2921             This function now sets the timer.
2922         (WebKit::AdClickAttributionManager::fireConversionRequest):
2923             Fire an individual request.
2924         (WebKit::AdClickAttributionManager::firePendingConversionRequests):
2925             This is the timer function that iterates over all pending attributions.
2926         (WebKit::AdClickAttributionManager::clear):
2927             Now clears the two new test settings members.
2928         (WebKit::AdClickAttributionManager::toString const):
2929         * NetworkProcess/AdClickAttributionManager.h: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.h.
2930         (WebKit::AdClickAttributionManager::AdClickAttributionManager):
2931         (WebKit::AdClickAttributionManager::setPingLoadFunction):
2932         (WebKit::AdClickAttributionManager::setOverrideTimerForTesting):
2933         (WebKit::AdClickAttributionManager::setConversionURLForTesting):
2934         * NetworkProcess/NetworkAdClickAttribution.cpp: Renamed from Source/WebKit/NetworkProcess/NetworkAdClickAttribution.cpp.
2935         * NetworkProcess/NetworkProcess.cpp:
2936         (WebKit::NetworkProcess::storeAdClickAttribution):
2937         (WebKit::NetworkProcess::dumpAdClickAttribution):
2938         (WebKit::NetworkProcess::clearAdClickAttribution):
2939         (WebKit::NetworkProcess::setAdClickAttributionOverrideTimerForTesting):
2940         (WebKit::NetworkProcess::setAdClickAttributionConversionURLForTesting):
2941         * NetworkProcess/NetworkProcess.h:
2942         * NetworkProcess/NetworkProcess.messages.in:
2943         * NetworkProcess/NetworkSession.cpp:
2944         (WebKit::NetworkSession::NetworkSession):
2945         (WebKit::NetworkSession::setAdClickAttributionOverrideTimerForTesting):
2946         (WebKit::NetworkSession::setAdClickAttributionConversionURLForTesting):
2947         * NetworkProcess/NetworkSession.h:
2948         * NetworkProcess/PingLoad.cpp:
2949         (WebKit::PingLoad::PingLoad):
2950         (WebKit::m_blobFiles):
2951         (WebKit::PingLoad::initialize):
2952             The PingLoad constructor is now split in two to allow for construction
2953             without a WebKit::NetworkConnectionToWebProcess object. The body of
2954             the constructor was moved into the new initialize() function which is
2955             shared between constructors.
2956         * NetworkProcess/PingLoad.h:
2957         * Sources.txt:
2958             Removed NetworkProcess/NetworkAdClickAttribution.cpp and added
2959             NetworkProcess/NetworkAdClickAttribution.cpp.
2960         * UIProcess/API/C/WKPage.cpp:
2961         (WKPageSetAdClickAttributionOverrideTimerForTesting):
2962         (WKPageSetAdClickAttributionConversionURLForTesting):
2963         * UIProcess/API/C/WKPagePrivate.h:
2964         * UIProcess/Network/NetworkProcessProxy.cpp:
2965         (WebKit::NetworkProcessProxy::dumpAdClickAttribution): Deleted.
2966         (WebKit::NetworkProcessProxy::clearAdClickAttribution): Deleted.
2967         * UIProcess/Network/NetworkProcessProxy.h:
2968         * UIProcess/WebPageProxy.cpp:
2969         (WebKit::WebPageProxy::dumpAdClickAttribution):
2970         (WebKit::WebPageProxy::clearAdClickAttribution):
2971         (WebKit::WebPageProxy::setAdClickAttributionOverrideTimerForTesting):
2972         (WebKit::WebPageProxy::setAdClickAttributionConversionURLForTesting):
2973         * UIProcess/WebPageProxy.h:
2974         * UIProcess/WebProcessPool.cpp:
2975         (WebKit::WebProcessPool::dumpAdClickAttribution): Deleted.
2976         (WebKit::WebProcessPool::clearAdClickAttribution): Deleted.
2977         * UIProcess/WebProcessPool.h:
2978         * WebKit.xcodeproj/project.pbxproj:
2979
2980 2019-04-15  Devin Rousso  <drousso@apple.com>
2981
2982         WebDriver: Set Cookie endpoint does not correctly set subdomain cookies
2983         https://bugs.webkit.org/show_bug.cgi?id=196872
2984         <rdar://problem/49233240>
2985
2986         Reviewed by Joseph Pecoraro.
2987
2988         * UIProcess/Automation/WebAutomationSession.cpp:
2989         (WebKit::WebAutomationSession::addSingleCookie):
2990         Rather than try to "force" the cookie to be set on the current active URL, use the cookie
2991         itself to figure out which domain it should be set on.
2992
2993 2019-04-15  Philippe Normand  <pnormand@igalia.com>
2994
2995         [GTK][WPE] Add enable-media websetting
2996         https://bugs.webkit.org/show_bug.cgi?id=196863
2997
2998         Reviewed by Michael Catanzaro.
2999
3000         It can be useful for headless browsers, for instance. The setting is enabled by default.
3001
3002         * Shared/WebPreferences.yaml:
3003         * UIProcess/API/glib/WebKitSettings.cpp:
3004         (webKitSettingsSetProperty):
3005         (webKitSettingsGetProperty):
3006         (webkit_settings_class_init):
3007         (webkit_settings_get_enable_media):
3008         (webkit_settings_set_enable_media):
3009         * UIProcess/API/gtk/WebKitSettings.h:
3010         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3011         * UIProcess/API/wpe/WebKitSettings.h:
3012         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
3013
3014 2019-04-14  Rob Buis  <rbuis@igalia.com>
3015
3016         Link prefetch not useful for top-level navigation
3017         https://bugs.webkit.org/show_bug.cgi?id=195623
3018
3019         Reviewed by Youenn Fablet.
3020
3021         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
3022         to the same url is done within a threshold (5 seconds), reuse the
3023         prefetch cache entry, move it to the disk cache and navigate to
3024         the url, meaning no extra network trip is needed. When not used within
3025         the threshold period, the prefetch entry will be erased using a timer.
3026
3027         * NetworkProcess/NetworkProcess.cpp:
3028         (WebKit::NetworkProcess::lowMemoryHandler):
3029         * NetworkProcess/NetworkProcess.h:
3030         (WebKit::NetworkProcess::prefetchCache):
3031         * NetworkProcess/NetworkResourceLoader.cpp:
3032         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3033         (WebKit::NetworkResourceLoader::didReceiveResponse):
3034         (WebKit::NetworkResourceLoader::didReceiveBuffer):
3035         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
3036         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
3037         * NetworkProcess/NetworkResourceLoader.h:
3038         * NetworkProcess/cache/PrefetchCache.cpp: Added.
3039         (WebKit::PrefetchCache::Entry::Entry):
3040         (WebKit::PrefetchCache::PrefetchCache):
3041         (WebKit::PrefetchCache::~PrefetchCache):
3042         (WebKit::PrefetchCache::clear):
3043         (WebKit::PrefetchCache::take):
3044         (WebKit::PrefetchCache::store):
3045         (WebKit::PrefetchCache::sessionPrefetchMap const):
3046         (WebKit::PrefetchCache::clearExpiredEntries):
3047         * NetworkProcess/cache/PrefetchCache.h: Added.
3048         (WebKit::PrefetchCache::Entry::response const):
3049         (WebKit::PrefetchCache::Entry::releaseBuffer):
3050         * Shared/WebPreferences.yaml:
3051         * Sources.txt:
3052         * WebKit.xcodeproj/project.pbxproj:
3053
3054 2019-04-14  Andy Estes  <aestes@apple.com>
3055
3056         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
3057         https://bugs.webkit.org/show_bug.cgi?id=196893
3058         <rdar://problem/48318983>
3059
3060         Reviewed by Anders Carlsson.
3061
3062         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
3063         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
3064         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
3065         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
3066         the LegacyCustomProtocolManagerProxy has been destroyed.
3067
3068         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
3069         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
3070         (-[WKCustomProtocolLoader cancel]):
3071         (-[WKCustomProtocolLoader connection:didFailWithError:]):
3072         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
3073         (-[WKCustomProtocolLoader connection:didReceiveData:]):
3074         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
3075         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
3076         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
3077         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
3078         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
3079         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
3080
3081 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
3082
3083         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
3084         https://bugs.webkit.org/show_bug.cgi?id=196742
3085
3086         Reviewed by Konstantin Tokarev.
3087
3088         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
3089
3090         * CMakeLists.txt:
3091         * PlatformWin.cmake:
3092         
3093         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
3094
3095 2019-04-13  Chris Dumez  <cdumez@apple.com>
3096
3097         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
3098         https://bugs.webkit.org/show_bug.cgi?id=196548
3099         <rdar://problem/49567254>
3100
3101         Reviewed by Darin Adler.
3102
3103         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
3104         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
3105         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
3106         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
3107         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
3108         incoming IPC that is not for its associated navigation.
3109
3110         * UIProcess/ProvisionalPageProxy.cpp:
3111         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
3112         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3113         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3114         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
3115         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
3116         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
3117         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3118         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3119         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
3120         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3121         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
3122
3123 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3124
3125         Unreviewed, try to fix the internal build after r244239
3126
3127         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
3128         import that was missing anyways.
3129
3130         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
3131
3132 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3133
3134         Enable modern compatibility mode by default in WKWebView on some devices
3135         https://bugs.webkit.org/show_bug.cgi?id=196883
3136         <rdar://problem/49864527>
3137
3138         Reviewed by Tim Horton.
3139
3140         Make some minor adjustments to new API.
3141
3142         * Shared/WebCompatibilityMode.h:
3143
3144         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
3145
3146         * Shared/WebPreferences.yaml:
3147         * Shared/WebPreferencesDefaultValues.h:
3148
3149         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
3150         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
3151
3152         * UIProcess/API/APIWebsitePolicies.h:
3153         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
3154
3155         Rename the withPreferences: label to just preferences:.
3156
3157         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
3158         * UIProcess/Cocoa/NavigationState.mm:
3159         (WebKit::NavigationState::setNavigationDelegate):
3160         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3161         * UIProcess/Cocoa/VersionChecks.h:
3162         * UIProcess/ios/WebPageProxyIOS.mm:
3163
3164 2019-04-12  Brian Burg  <bburg@apple.com>
3165
3166         WebDriver: fix typo in EnterFullscreen.js in error-handling code
3167         https://bugs.webkit.org/show_bug.cgi?id=196882
3168         <rdar://problem/49867122>
3169
3170         Reviewed by Devin Rousso.
3171
3172         * UIProcess/Automation/atoms/EnterFullscreen.js:
3173         (enterFullscreen):
3174
3175 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
3176
3177         Unreviewed fix for non-unified build.
3178
3179         * Shared/PrintInfo.cpp:
3180         Add missing include from r244202.
3181
3182 2019-04-12  Saam barati  <sbarati@apple.com>
3183
3184         Sometimes we need to user fewer CPUs in our threading calculations
3185         https://bugs.webkit.org/show_bug.cgi?id=196794
3186         <rdar://problem/49389497>
3187
3188         Reviewed by Yusuke Suzuki.
3189
3190         * WebProcess/com.apple.WebProcess.sb.in:
3191
3192 2019-04-12  Devin Rousso  <drousso@apple.com>
3193
3194         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
3195         https://bugs.webkit.org/show_bug.cgi?id=196847
3196         <rdar://problem/49609396>
3197
3198         Reviewed by Brian Burg.
3199
3200         * UIProcess/Automation/WebAutomationSession.cpp:
3201         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
3202
3203 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
3204
3205         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
3206         https://bugs.webkit.org/show_bug.cgi?id=196845
3207
3208         Reviewed by Ryosuke Niwa.
3209
3210         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
3211         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3212         * NetworkProcess/NetworkDataTask.cpp:
3213         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
3214         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
3215         * NetworkProcess/NetworkProcess.cpp:
3216         * NetworkProcess/NetworkResourceLoadMap.cpp:
3217         * NetworkProcess/NetworkResourceLoadMap.h:
3218         * NetworkProcess/NetworkResourceLoader.cpp:
3219         * NetworkProcess/PingLoad.h:
3220         * Shared/WebCompiledContentRuleListData.cpp:
3221         * Shared/gtk/WebEventFactory.cpp:
3222         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3223         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
3224         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
3225         (WKWebsiteDataStoreStatisticsResetToConsistentState):
3226         * UIProcess/Downloads/DownloadProxyMap.cpp:
3227         * UIProcess/InspectorTargetProxy.cpp:
3228         * UIProcess/PageClient.h:
3229         * UIProcess/ProcessAssertion.cpp:
3230         * UIProcess/ProvisionalPageProxy.h:
3231         * UIProcess/WebPageInspectorTargetAgent.h:
3232         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
3233         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3234         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
3235         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
3236         (WKBundleSetDatabaseQuota):
3237         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
3238         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
3239
3240 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
3241
3242         Update AudioSession route sharing policy
3243         https://bugs.webkit.org/show_bug.cgi?id=196776
3244         <rdar://problem/46501611>
3245
3246         Reviewed by Jer Noble.
3247
3248         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
3249         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
3250
3251 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3252
3253         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
3254         https://bugs.webkit.org/show_bug.cgi?id=196862
3255
3256         Reviewed by Darin Adler.
3257
3258         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
3259         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
3260
3261         * UIProcess/API/APIWebsitePolicies.cpp:
3262         (API::WebsitePolicies::copy const):
3263
3264 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
3265
3266         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
3267         https://bugs.webkit.org/show_bug.cgi?id=196803
3268         rdar://problem/49078202
3269
3270         Reviewed by Antti Koivisto.
3271
3272         Flip LegacyOverflowScrollingTouchEnabled to false.
3273
3274         * Shared/WebPreferences.yaml:
3275
3276 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3277
3278         [iOS] Software keyboard is shown too frequently on some websites
3279         https://bugs.webkit.org/show_bug.cgi?id=195856
3280         <rdar://problem/49191395>
3281
3282         Reviewed by Darin Adler.
3283
3284         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
3285         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
3286         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
3287         when the element is focused.
3288
3289         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
3290         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
3291         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
3292         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
3293         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
3294         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
3295         hardware keyboard is not attached.
3296
3297         * UIProcess/API/Cocoa/WKWebView.mm:
3298         (hardwareKeyboardAvailabilityChangedCallback):
3299         * UIProcess/ios/WKContentViewInteraction.h:
3300         * UIProcess/ios/WKContentViewInteraction.mm:
3301         (-[WKContentView shouldShowAutomaticKeyboardUI]):
3302
3303         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
3304
3305         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
3306
3307         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
3308         element with inputmode="none", we'll show the input accessory view once again.
3309
3310 2019-04-12  Antoine Quint  <graouts@apple.com>
3311
3312         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
3313         https://bugs.webkit.org/show_bug.cgi?id=196830
3314         <rdar://problem/49124313>
3315
3316         Reviewed by Wenson Hsieh.
3317
3318         We add a new policy to determine whether simulated mouse events dispatch are allowed.
3319
3320         * Shared/WebsitePoliciesData.cpp:
3321         (WebKit::WebsitePoliciesData::encode const):
3322         (WebKit::WebsitePoliciesData::decode):
3323         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3324         * Shared/WebsitePoliciesData.h:
3325         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
3326         * UIProcess/API/APIWebsitePolicies.cpp:
3327         (API::WebsitePolicies::copy const):
3328         (API::WebsitePolicies::data):
3329         * UIProcess/API/APIWebsitePolicies.h:
3330         * WebKit.xcodeproj/project.pbxproj:
3331
3332 2019-04-12  Chris Dumez  <cdumez@apple.com>
3333
3334         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
3335         https://bugs.webkit.org/show_bug.cgi?id=196781
3336         <rdar://problem/49789381>
3337
3338         Reviewed by Darin Adler.
3339
3340         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
3341         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
3342         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
3343         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
3344
3345         * UIProcess/Downloads/DownloadProxyMap.cpp:
3346         (WebKit::DownloadProxyMap::invalidate):
3347         (WebKit::DownloadProxyMap::processDidClose): Deleted.
3348         * UIProcess/Downloads/DownloadProxyMap.h:
3349         * UIProcess/Network/NetworkProcessProxy.cpp:
3350         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
3351         (WebKit::NetworkProcessProxy::didClose):
3352
3353 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3354
3355         [GTK] REGRESSION(r243860): Many tests failing
3356         https://bugs.webkit.org/show_bug.cgi?id=196791
3357
3358         Reviewed by Joanmarie Diggs.
3359
3360         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
3361         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
3362         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
3363         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
3364         notified of the changes in the accessibility tree.
3365
3366         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3367         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
3368         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
3369         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
3370         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
3371         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
3372         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
3373         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
3374         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
3375         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
3376
3377 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
3378
3379         Update 'Save Image' to more clear instructions
3380         https://bugs.webkit.org/show_bug.cgi?id=196833
3381         <rdar://problem/47446845>
3382
3383         Reviewed by Wenson Hsieh.
3384
3385         Just updating to a new string.
3386
3387         * UIProcess/API/Cocoa/_WKElementAction.mm:
3388         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
3389
3390 2019-04-11  Chris Dumez  <cdumez@apple.com>
3391
3392         Unable to run system Safari with trunk WebKit
3393         https://bugs.webkit.org/show_bug.cgi?id=196777
3394         <rdar://problem/49784574>
3395
3396         Reviewed by Alex Christensen.
3397
3398         * UIProcess/API/Cocoa/WKWebView.mm:
3399         (-[WKWebView _initializeWithConfiguration:]):
3400         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
3401         data store only happens for apps rebuilt using recent SDK.
3402
3403         * UIProcess/Cocoa/VersionChecks.h:
3404         * UIProcess/Cocoa/VersionChecks.mm:
3405         (WebKit::linkedOnOrAfter):
3406         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
3407           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
3408           be controlled by the caller.
3409         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
3410           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
3411           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
3412           0 value for sdkVersion.
3413
3414 2019-04-11  Zalan Bujtas  <zalan@apple.com>
3415
3416         Add @page margin support
3417         https://bugs.webkit.org/show_bug.cgi?id=196680
3418         <rdar://problem/45217707>
3419
3420         Reviewed by Tim Horton.
3421
3422         * Shared/PrintInfo.cpp:
3423         (WebKit::PrintInfo::encode const):
3424         (WebKit::PrintInfo::decode):
3425         * Shared/PrintInfo.h:
3426         * Shared/WebPreferences.yaml:
3427         * Shared/gtk/PrintInfoGtk.cpp:
3428         (WebKit::PrintInfo::PrintInfo):
3429         * Shared/mac/PrintInfoMac.mm:
3430         (WebKit::PrintInfo::PrintInfo):
3431         * UIProcess/API/C/WKPage.cpp:
3432         (WKPageComputePagesForPrinting):
3433         * UIProcess/API/C/WKPreferences.cpp:
3434         (WKPreferencesSetPageAtRuleSupportEnabled):
3435         (WKPreferencesGetPageAtRuleSupportEnabled):
3436         * UIProcess/API/C/WKPreferencesRefPrivate.h:
3437         * UIProcess/GenericCallback.h:
3438         * UIProcess/WebPageProxy.cpp:
3439         (WebKit::WebPageProxy::computedPagesCallback):
3440         * UIProcess/WebPageProxy.h:
3441         * UIProcess/WebPageProxy.messages.in:
3442         * UIProcess/mac/WKPrintingView.mm:
3443         (pageDidComputePageRects):
3444         (-[WKPrintingView _askPageToComputePageRects]):
3445         * WebProcess/WebPage/WebPage.cpp:
3446         (WebKit::WebPage::beginPrinting):
3447         (WebKit::WebPage::computePagesForPrinting):
3448         (WebKit::WebPage::computePagesForPrintingImpl):
3449         * WebProcess/WebPage/WebPage.h:
3450         * WebProcess/WebPage/ios/WebPageIOS.mm:
3451         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
3452
3453 2019-04-11  Dean Jackson  <dino@apple.com>
3454
3455         Extract UTI mapping and allow for additions
3456         https://bugs.webkit.org/show_bug.cgi?id=196822
3457         <rdar://problem/49822339>
3458
3459         Reviewed by Tim Horton.
3460
3461         Use the new helper to map MIME type to UTI.
3462
3463         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
3464         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
3465         * UIProcess/ios/WKSystemPreviewView.mm:
3466         (getUTIForSystemPreviewMIMEType):
3467
3468
3469 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3470
3471         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
3472         https://bugs.webkit.org/show_bug.cgi?id=196825
3473
3474         Reviewed by Simon Fraser.
3475
3476         Ensure the layer transactions IDs are sequential. So bail out of
3477         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
3478
3479         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
3480         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3481         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3482
3483 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3484
3485         Allow the MediaSource API to be enabled via website policy
3486         https://bugs.webkit.org/show_bug.cgi?id=196429
3487         <rdar://problem/48774333>
3488
3489         Reviewed by Tim Horton.
3490
3491         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
3492
3493         * Shared/WebPreferences.yaml:
3494
3495         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
3496         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
3497         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
3498
3499         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
3500         compatibility mode on WKWebpagePreferences.
3501
3502         * Shared/WebPreferences.yaml:
3503         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
3504         * Shared/WebsitePoliciesData.cpp:
3505         (WebKit::WebsitePoliciesData::encode const):
3506         (WebKit::WebsitePoliciesData::decode):
3507
3508         Add plumbing for m_mediaSourcePolicy in the set of website policies.
3509
3510         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
3511
3512         Update the document loader with the given media source policy. There are two possibilities when applying the set
3513         of policies to the document loader; either the document loader is already attached to a Frame, or the document
3514         loader is yet to be attached to a Frame.
3515
3516         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
3517         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
3518         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
3519
3520         * Shared/WebsitePoliciesData.h:
3521         * UIProcess/API/APIWebsitePolicies.cpp:
3522         (API::WebsitePolicies::data):
3523         * UIProcess/API/APIWebsitePolicies.h:
3524         * UIProcess/API/C/WKPage.cpp:
3525         (WKPageSetPageNavigationClient):
3526         * UIProcess/Cocoa/NavigationState.mm:
3527         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
3528
3529         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
3530         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
3531         default website policies on the web view configuration, even when using the C API to set the navigation client,
3532         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
3533         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
3534         webpage preferences.
3535
3536         * UIProcess/WebPageProxy.cpp:
3537         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3538         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
3539         * UIProcess/WebPageProxy.h:
3540         * WebKit.xcodeproj/project.pbxproj:
3541
3542 2019-04-11  Antti Koivisto  <antti@apple.com>
3543
3544         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
3545         https://bugs.webkit.org/show_bug.cgi?id=196813
3546         <rdar://problem/49393264>
3547
3548         Reviewed by Simon Fraser.
3549
3550         No test, can't repro.
3551
3552         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
3553         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
3554
3555         Null check the nodes.
3556
3557 2019-04-10  Chris Dumez  <cdumez@apple.com>
3558
3559         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
3560         https://bugs.webkit.org/show_bug.cgi?id=196784
3561
3562         Reviewed by Antti Koivisto.
3563
3564         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
3565         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
3566         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
3567         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
3568         not sometimes be gone by the time we need it.
3569
3570         * UIProcess/SuspendedPageProxy.cpp:
3571         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
3572
3573 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3574
3575         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
3576         https://bugs.webkit.org/show_bug.cgi?id=196809
3577         <rdar://49800762>
3578
3579         Reviewed by Brady Eidson.
3580
3581         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3582         (-[WKNavigationResponse _downloadAttribute]):
3583
3584 2019-04-10  Tim Horton  <timothy_horton@apple.com>
3585
3586         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
3587         https://bugs.webkit.org/show_bug.cgi?id=196797
3588         <rdar://problem/48484715>
3589
3590         Reviewed by Simon Fraser.
3591
3592         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
3593         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
3594         Validate the set of modifier keys pressed when handling a key event for scrolling:
3595         Ignore key events with multiple modifier keys pressed.
3596         Ignore key events with an invalid modifier key pressed for a given primary key.
3597
3598 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
3599
3600         requestAnimationFrame should execute before the next frame
3601         https://bugs.webkit.org/show_bug.cgi?id=177484
3602
3603         Reviewed by Simon Fraser.
3604
3605         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
3606         a single call to Page::updateRendering(). This new function implements 
3607         "Update the rendering" step of the HTML Event Loop specification
3608         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
3609
3610         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
3611         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
3612         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
3613         (WebKit::DrawingAreaCoordinatedGraphics::display):
3614         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
3615         (WebKit::LayerTreeHost::layerFlushTimerFired):
3616
3617         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3618         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
3619         -- Call Page::updateRendering() to make sure that "Update the rendering"
3620            happens immediately before updating the page.
3621
3622         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
3623            to be exactly before flushing the layers. This fixes the assertion
3624            ASSERT(m_inLayerFlush) which was firing when running a layout test.
3625            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
3626            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
3627            twice before calling didFlushLayers().
3628
3629         * WebProcess/WebPage/WebPage.cpp:
3630         (WebKit::WebPage::layoutIfNeeded):
3631         (WebKit::WebPage::updateRendering):
3632         (WebKit::WebPage::willDisplayPage): Deleted.
3633         * WebProcess/WebPage/WebPage.h:
3634         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3635         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3636
3637 2019-04-10  Devin Rousso  <drousso@apple.com>
3638
3639         Web Inspector: save sheet should be anchored underneath the tab bar when detached
3640         https://bugs.webkit.org/show_bug.cgi?id=196722
3641         <rdar://problem/49613280>
3642
3643         Reviewed by Timothy Hatcher.
3644
3645         * WebProcess/WebPage/WebInspectorUI.h:
3646         * WebProcess/WebPage/WebInspectorUI.cpp:
3647         (WebKit::WebInspectorUI::changeSheetRect): Added.
3648         * UIProcess/WebInspectorProxy.messages.in:
3649         * UIProcess/WebInspectorProxy.h:
3650         (WebKit::WebInspectorProxy::sheetRect const): Added.
3651         * UIProcess/WebInspectorProxy.cpp:
3652         (WebKit::WebInspectorProxy::setSheetRect): Added.
3653         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3654         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
3655         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3656         * UIProcess/mac/WebInspectorProxyMac.mm:
3657         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
3658         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3659         * UIProcess/win/WebInspectorProxyWin.cpp:
3660         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3661         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
3662         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
3663
3664         * WebProcess/WebPage/RemoteWebInspectorUI.h:
3665         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
3666         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
3667         * UIProcess/RemoteWebInspectorProxy.messages.in:
3668         * UIProcess/RemoteWebInspectorProxy.h:
3669         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
3670         * UIProcess/RemoteWebInspectorProxy.cpp:
3671         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
3672         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3673         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
3674         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3675         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
3676         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
3677         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
3678         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
3679
3680 2019-04-10  Andy Estes  <aestes@apple.com>
3681
3682         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
3683         https://bugs.webkit.org/show_bug.cgi?id=196785
3684         <rdar://problem/48240051>
3685
3686         Reviewed by Tim Horton.
3687
3688         * UIProcess/ios/WKPDFView.mm:
3689         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
3690
3691 2019-04-10  Chris Dumez  <cdumez@apple.com>
3692
3693         Unreviewed, rolling out r244146.
3694
3695         Caused a few DeviceOrientation API test failures on iOS
3696
3697         Reverted changeset:
3698
3699         "Unable to run system Safari with trunk WebKit"
3700         https://bugs.webkit.org/show_bug.cgi?id=196777
3701         https://trac.webkit.org/changeset/244146
3702
3703 2019-04-10  Devin Rousso  <drousso@apple.com>
3704
3705         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
3706         https://bugs.webkit.org/show_bug.cgi?id=196725
3707         <rdar://problem/49669810>
3708
3709         Reviewed by Timothy Hatcher.
3710
3711         * WebProcess/WebPage/WebInspector.cpp:
3712         (WebKit::WebInspector::showMainResourceForFrame):
3713
3714 2019-04-10  Youenn Fablet  <youenn@apple.com>
3715
3716         Clear Cache Storage structures before removing all related files
3717         https://bugs.webkit.org/show_bug.cgi?id=196650
3718
3719         Reviewed by Alex Christensen.
3720
3721         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
3722         To make things more deterministic, clear files/folders directly
3723         after CachesStorage structures have finished being cleared.
3724
3725         * NetworkProcess/cache/CacheStorageEngine.cpp:
3726         (WebKit::CacheStorage::Engine::clearAllCaches):
3727         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
3728
3729 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3730
3731         Add SPI WKNavigationResponse._downloadAttribute
3732         https://bugs.webkit.org/show_bug.cgi?id=196755
3733         <rdar://49587365>
3734
3735         Reviewed by Brady Eidson.
3736
3737         * UIProcess/API/APINavigationResponse.h:
3738         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
3739         (-[WKNavigationResponse _downloadAttribute]):
3740         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
3741         * UIProcess/ProvisionalPageProxy.cpp:
3742         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3743         * UIProcess/ProvisionalPageProxy.h:
3744         * UIProcess/WebPageProxy.cpp:
3745         (WebKit::WebPageProxy::decidePolicyForResponse):
3746         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3747         * UIProcess/WebPageProxy.h:
3748         * UIProcess/WebPageProxy.messages.in:
3749         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3750         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3751         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3752
3753 2019-04-10  Youenn Fablet  <youenn@apple.com>
3754
3755         SWClientConnection should not double hop to fire some events
3756         https://bugs.webkit.org/show_bug.cgi?id=196735
3757
3758         Reviewed by Alex Christensen.
3759
3760         Removed unnecessary method.
3761
3762         * WebProcess/Storage/WebSWClientConnection.cpp:
3763         * WebProcess/Storage/WebSWClientConnection.h:
3764
3765 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
3766
3767         [iOS] Fix iokit-get-properties sandbox violations
3768         https://bugs.webkit.org/show_bug.cgi?id=196782
3769         <rdar://problem/49497720>
3770
3771         Reviewed by Brent Fulgham.
3772
3773         Add iokit properties to the WebContent sandbox on iOS.
3774
3775         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3776
3777 2019-04-10  Tim Horton  <timothy_horton@apple.com>
3778
3779         Add modern API for overriding the page's specified viewport configuration
3780         https://bugs.webkit.org/show_bug.cgi?id=167734
3781         <rdar://problem/30331795>
3782
3783         Reviewed by Simon Fraser.
3784
3785         * Shared/WebPageCreationParameters.cpp:
3786         (WebKit::WebPageCreationParameters::encode const):
3787         (WebKit::WebPageCreationParameters::decode):
3788         * Shared/WebPageCreationParameters.h:
3789         Plumb overrideViewportArguments in WebPageCreationParameters, so that
3790         if the process crashes (or swaps) they are maintained.
3791
3792         * UIProcess/API/Cocoa/WKWebView.mm:
3793         (viewportArgumentsFromDictionary):
3794         (-[WKWebView _overrideViewportWithArguments:]):
3795         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
3796         object and use the existing (now improved) overrideViewportArguments mechanism
3797         to take over the page's viewport arguments.
3798
3799         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3800         * UIProcess/WebPageProxy.cpp:
3801         (WebKit::WebPageProxy::creationParameters):
3802         * UIProcess/WebPageProxy.h:
3803         * UIProcess/ios/WebPageProxyIOS.mm:
3804         (WebKit::WebPageProxy::setOverrideViewportArguments):
3805         * WebProcess/WebPage/WebPage.cpp:
3806         Plumb overrideViewportArguments around more.
3807
3808 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
3809
3810         Add runJavaScriptInFrame for WebPageProxy/WebPage
3811         https://bugs.webkit.org/show_bug.cgi?id=196750
3812         <rdar://problem/49755738>
3813
3814         Reviewed by Youenn Fablet.
3815
3816         Tests of the new method will be covered by the internal counterpart.
3817
3818         * UIProcess/WebFrameProxy.cpp:
3819         (WebKit::WebFrameProxy::loadData):
3820         * UIProcess/WebFrameProxy.h:
3821         Add a comment.
3822         * UIProcess/WebPageProxy.cpp:
3823         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
3824         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
3825         Merge the above two runJavaScriptInMainFrame*.
3826         (WebKit::WebPageProxy::runJavaScriptInFrame):
3827         * UIProcess/WebPageProxy.h:
3828         * WebProcess/WebPage/WebPage.cpp:
3829         (WebKit::WebPage::loadDataInFrame):
3830         Add an assertion.
3831         (WebKit::WebPage::runJavaScript):
3832         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
3833         (WebKit::WebPage::runJavaScriptInFrame):
3834         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
3835         * WebProcess/WebPage/WebPage.h:
3836         * WebProcess/WebPage/WebPage.messages.in:
3837
3838 2019-04-10  Chris Dumez  <cdumez@apple.com>
3839
3840         Unable to run system Safari with trunk WebKit
3841         https://bugs.webkit.org/show_bug.cgi?id=196777
3842         <rdar://problem/49784574>
3843
3844         Reviewed by Alex Christensen.
3845
3846         * UIProcess/API/Cocoa/WKWebView.mm:
3847         (-[WKWebView _initializeWithConfiguration:]):
3848         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
3849         data store only happens for apps rebuilt using recent SDK.
3850
3851         * UIProcess/Cocoa/VersionChecks.h:
3852         * UIProcess/Cocoa/VersionChecks.mm:
3853         (WebKit::linkedOnOrAfter):
3854         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
3855           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
3856           be controlled by the caller.
3857         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
3858           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
3859           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
3860           0 value for sdkVersion.
3861
3862 2019-04-10  Chris Dumez  <cdumez@apple.com>
3863
3864         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
3865         https://bugs.webkit.org/show_bug.cgi?id=196774
3866         <rdar://problem/49460572>
3867
3868         Reviewed by Alex Christensen.
3869
3870         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
3871         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
3872         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
3873         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
3874         case we would fail to close the WebPage and audio could keep playing.
3875
3876         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
3877         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
3878         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
3879         the DidFailToSuspendAfterProcessSwap is eventually received.
3880
3881         * UIProcess/SuspendedPageProxy.cpp:
3882         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3883         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
3884         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3885         * UIProcess/SuspendedPageProxy.h:
3886         * UIProcess/WebPageProxy.cpp:
3887         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
3888         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
3889         * UIProcess/WebPageProxy.h:
3890         * UIProcess/WebProcessPool.cpp:
3891         * UIProcess/WebProcessPool.h:
3892
3893 2019-04-10  Timothy Hatcher  <timothy@apple.com>
3894
3895         WKScrollView background color does not match WKWebView before content is loaded.
3896         https://bugs.webkit.org/show_bug.cgi?id=196745
3897         rdar://problem/49750810
3898
3899         Reviewed by Megan Gardner.
3900
3901         * UIProcess/API/Cocoa/WKWebView.mm:
3902         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
3903         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
3904         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
3905         _contentView.backgroundColor and it has changed.
3906
3907 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
3908
3909         Fix text autoscrolling when typing in modern webkit
3910         https://bugs.webkit.org/show_bug.cgi?id=196718
3911         <rdar://problem/49225507>
3912
3913         Reviewed by Tim Horton.
3914
3915         For staging only. We need to turn off UIKit's scrolling behavior to land
3916         the changes we are making. To keep from the build ever breaking,
3917         I am temporarily circumventing the changes in UIKit. This will be removed
3918         once the next UIKit submission happens.
3919
3920         * UIProcess/ios/WKContentViewInteraction.mm:
3921         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
3922         (-[WKContentView setUpTextSelectionAssistant]):
3923
3924 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3925
3926         [iOSMac] Opt into modern compatibility mode by default
3927         https://bugs.webkit.org/show_bug.cgi?id=196763
3928         <rdar://problem/49038732>
3929
3930         Reviewed by Tim Horton.
3931
3932         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
3933
3934         * Shared/WebPreferences.yaml:
3935         * Shared/WebPreferencesDefaultValues.h:
3936
3937 2019-04-10  Alex Christensen  <achristensen@webkit.org>
3938
3939         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
3940         https://bugs.webkit.org/show_bug.cgi?id=196744
3941         <rdar://49415309>
3942
3943         Reviewed by Chris Dumez.
3944
3945         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
3946         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
3947         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
3948         on the old one which is supposed to make it so all the message receivers associated with it have been removed
3949         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
3950         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
3951         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
3952         these messages so it can tear down the message receiver with the others it removes at close time.
3953
3954         * Shared/API/Cocoa/RemoteObjectRegistry.h:
3955         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3956         (-[WKWebProcessPlugInBrowserContextController dealloc]):
3957         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
3958         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3959         (WebKit::WebPage::addRemoteObjectRegistry):
3960         * WebProcess/WebPage/WebPage.cpp:
3961         (WebKit::WebPage::close):
3962         * WebProcess/WebPage/WebPage.h:
3963
3964 2019-04-10  Chris Dumez  <cdumez@apple.com>
3965
3966         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
3967
3968         * UIProcess/SuspendedPageProxy.h:
3969
3970 2019-04-10  Antoine Quint  <graouts@apple.com>
3971
3972         Enable Pointer Events on watchOS
3973         https://bugs.webkit.org/show_bug.cgi?id=196771
3974         <rdar://problem/49040909>
3975
3976         Reviewed by Dean Jackson.
3977
3978         * Configurations/FeatureDefines.xcconfig:
3979
3980 2019-04-10  Brady Eidson  <beidson@apple.com>
3981
3982         Background tabs are not fully reactivated after a link is opened from an external application.
3983         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
3984
3985         Reviewed by Chris Dumez.
3986
3987         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
3988         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
3989
3990         The WKApplicationStateTrackingView logic needs to be a little more resilient.
3991
3992         * UIProcess/ios/WKApplicationStateTrackingView.mm:
3993         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
3994         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
3995           background state then fake the relevant notification.
3996         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
3997         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
3998
3999 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
4000
4001         Unreviewed, build fix for r244097
4002
4003         * NetworkProcess/NetworkProcess.cpp:
4004         (WebKit::NetworkProcess::actualPrepareToSuspend):
4005         (WebKit::NetworkProcess::resume):
4006         Added guards for ENABLE(SERVICE_WORKER)
4007
4008 2019-04-09  Keith Rollin  <krollin@apple.com>
4009
4010         Unreviewed build maintenance -- update .xcfilelists.
4011
4012         * DerivedSources-input.xcfilelist:
4013         * DerivedSources-output.xcfilelist: