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