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