[GTK][WPE] Add enable-media websetting
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-04-15  Philippe Normand  <pnormand@igalia.com>
2
3         [GTK][WPE] Add enable-media websetting
4         https://bugs.webkit.org/show_bug.cgi?id=196863
5
6         Reviewed by Michael Catanzaro.
7
8         It can be useful for headless browsers, for instance. The setting is enabled by default.
9
10         * Shared/WebPreferences.yaml:
11         * UIProcess/API/glib/WebKitSettings.cpp:
12         (webKitSettingsSetProperty):
13         (webKitSettingsGetProperty):
14         (webkit_settings_class_init):
15         (webkit_settings_get_enable_media):
16         (webkit_settings_set_enable_media):
17         * UIProcess/API/gtk/WebKitSettings.h:
18         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
19         * UIProcess/API/wpe/WebKitSettings.h:
20         * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
21
22 2019-04-14  Rob Buis  <rbuis@igalia.com>
23
24         Link prefetch not useful for top-level navigation
25         https://bugs.webkit.org/show_bug.cgi?id=195623
26
27         Reviewed by Youenn Fablet.
28
29         Cache cross-domain top-level prefetches in a dedicated cache. When a navigation
30         to the same url is done within a threshold (5 seconds), reuse the
31         prefetch cache entry, move it to the disk cache and navigate to
32         the url, meaning no extra network trip is needed. When not used within
33         the threshold period, the prefetch entry will be erased using a timer.
34
35         * NetworkProcess/NetworkProcess.cpp:
36         (WebKit::NetworkProcess::lowMemoryHandler):
37         * NetworkProcess/NetworkProcess.h:
38         (WebKit::NetworkProcess::prefetchCache):
39         * NetworkProcess/NetworkResourceLoader.cpp:
40         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
41         (WebKit::NetworkResourceLoader::didReceiveResponse):
42         (WebKit::NetworkResourceLoader::didReceiveBuffer):
43         (WebKit::NetworkResourceLoader::tryStoreAsCacheEntry):
44         (WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):
45         * NetworkProcess/NetworkResourceLoader.h:
46         * NetworkProcess/cache/PrefetchCache.cpp: Added.
47         (WebKit::PrefetchCache::Entry::Entry):
48         (WebKit::PrefetchCache::PrefetchCache):
49         (WebKit::PrefetchCache::~PrefetchCache):
50         (WebKit::PrefetchCache::clear):
51         (WebKit::PrefetchCache::take):
52         (WebKit::PrefetchCache::store):
53         (WebKit::PrefetchCache::sessionPrefetchMap const):
54         (WebKit::PrefetchCache::clearExpiredEntries):
55         * NetworkProcess/cache/PrefetchCache.h: Added.
56         (WebKit::PrefetchCache::Entry::response const):
57         (WebKit::PrefetchCache::Entry::releaseBuffer):
58         * Shared/WebPreferences.yaml:
59         * Sources.txt:
60         * WebKit.xcodeproj/project.pbxproj:
61
62 2019-04-14  Andy Estes  <aestes@apple.com>
63
64         [Cocoa] WKCustomProtocolLoader should store a WeakPtr to its LegacyCustomProtocolManagerProxy
65         https://bugs.webkit.org/show_bug.cgi?id=196893
66         <rdar://problem/48318983>
67
68         Reviewed by Anders Carlsson.
69
70         In addition to manually invalidating each WKCustomProtocolLoader's _customProtocolManagerProxy
71         pointer when the LegacyCustomProtocolManagerClient is invalidated, use a WeakPtr in case the
72         LegacyCustomProtocolManagerProxy is ever destroyed without first invalidating the client.
73         Also add null pointer checks to NSURLConnectionDelegate methods, which might be called after
74         the LegacyCustomProtocolManagerProxy has been destroyed.
75
76         * UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm:
77         (-[WKCustomProtocolLoader initWithLegacyCustomProtocolManagerProxy:customProtocolID:request:]):
78         (-[WKCustomProtocolLoader cancel]):
79         (-[WKCustomProtocolLoader connection:didFailWithError:]):
80         (-[WKCustomProtocolLoader connection:didReceiveResponse:]):
81         (-[WKCustomProtocolLoader connection:didReceiveData:]):
82         (-[WKCustomProtocolLoader connection:willSendRequest:redirectResponse:]):
83         (-[WKCustomProtocolLoader connectionDidFinishLoading:]):
84         (WebKit::LegacyCustomProtocolManagerClient::startLoading):
85         (WebKit::LegacyCustomProtocolManagerClient::invalidate):
86         (-[WKCustomProtocolLoader customProtocolManagerProxyDestroyed]): Deleted.
87         * UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.h:
88
89 2019-04-14  Don Olmstead  <don.olmstead@sony.com>
90
91         [CMake] JavaScriptCore derived sources should only be referenced inside JavaScriptCore
92         https://bugs.webkit.org/show_bug.cgi?id=196742
93
94         Reviewed by Konstantin Tokarev.
95
96         Don't set JavaScriptCore_SCRIPTS_DIR now that it is set within WebKitFS.
97
98         * CMakeLists.txt:
99         * PlatformWin.cmake:
100         
101         Remove use of DERIVED_SOURCES_JAVASCRIPTCORE_DIR.
102
103 2019-04-13  Chris Dumez  <cdumez@apple.com>
104
105         [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash
106         https://bugs.webkit.org/show_bug.cgi?id=196548
107         <rdar://problem/49567254>
108
109         Reviewed by Darin Adler.
110
111         Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously,
112         some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this
113         was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently
114         doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy
115         even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all
116         incoming IPC that is not for its associated navigation.
117
118         * UIProcess/ProvisionalPageProxy.cpp:
119         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
120         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
121         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
122         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
123         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
124         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
125         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
126         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
127         (WebKit::ProvisionalPageProxy::didPerformServerRedirect):
128         (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
129         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync):
130
131 2019-04-13  Wenson Hsieh  <wenson_hsieh@apple.com>
132
133         Unreviewed, try to fix the internal build after r244239
134
135         Force the bots to regenerate WKWebpagePreferences.h by touching the file. Adds a `Foundation/Foundation.h`
136         import that was missing anyways.
137
138         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
139
140 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
141
142         Enable modern compatibility mode by default in WKWebView on some devices
143         https://bugs.webkit.org/show_bug.cgi?id=196883
144         <rdar://problem/49864527>
145
146         Reviewed by Tim Horton.
147
148         Make some minor adjustments to new API.
149
150         * Shared/WebCompatibilityMode.h:
151
152         Rename WebCompatibilityMode::Default to WebCompatibilityMode::Recommended.
153
154         * Shared/WebPreferences.yaml:
155         * Shared/WebPreferencesDefaultValues.h:
156
157         Now that the role of the UseModernCompatibilityModeByDefault debug preference is limited to bypassing linked-on-
158         or-after and app bundle compatibility hacks, we no longer make this default to true in iOSMac.
159
160         * UIProcess/API/APIWebsitePolicies.h:
161         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
162
163         Rename the withPreferences: label to just preferences:.
164
165         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
166         * UIProcess/Cocoa/NavigationState.mm:
167         (WebKit::NavigationState::setNavigationDelegate):
168         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
169         * UIProcess/Cocoa/VersionChecks.h:
170         * UIProcess/ios/WebPageProxyIOS.mm:
171
172 2019-04-12  Brian Burg  <bburg@apple.com>
173
174         WebDriver: fix typo in EnterFullscreen.js in error-handling code
175         https://bugs.webkit.org/show_bug.cgi?id=196882
176         <rdar://problem/49867122>
177
178         Reviewed by Devin Rousso.
179
180         * UIProcess/Automation/atoms/EnterFullscreen.js:
181         (enterFullscreen):
182
183 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
184
185         Unreviewed fix for non-unified build.
186
187         * Shared/PrintInfo.cpp:
188         Add missing include from r244202.
189
190 2019-04-12  Saam barati  <sbarati@apple.com>
191
192         Sometimes we need to user fewer CPUs in our threading calculations
193         https://bugs.webkit.org/show_bug.cgi?id=196794
194         <rdar://problem/49389497>
195
196         Reviewed by Yusuke Suzuki.
197
198         * WebProcess/com.apple.WebProcess.sb.in:
199
200 2019-04-12  Devin Rousso  <drousso@apple.com>
201
202         WebDriver: evaluating javascript shouldn't fail if a dialog is shown
203         https://bugs.webkit.org/show_bug.cgi?id=196847
204         <rdar://problem/49609396>
205
206         Reviewed by Brian Burg.
207
208         * UIProcess/Automation/WebAutomationSession.cpp:
209         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
210
211 2019-04-12  Ross Kirsling  <ross.kirsling@sony.com>
212
213         WebKit should build successfully even with -DENABLE_UNIFIED_BUILDS=OFF
214         https://bugs.webkit.org/show_bug.cgi?id=196845
215
216         Reviewed by Ryosuke Niwa.
217
218         * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.h:
219         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
220         * NetworkProcess/NetworkDataTask.cpp:
221         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
222         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Include wtf/Forward.h for String and CompletionHandler fwd decls.
223         * NetworkProcess/NetworkProcess.cpp:
224         * NetworkProcess/NetworkResourceLoadMap.cpp:
225         * NetworkProcess/NetworkResourceLoadMap.h:
226         * NetworkProcess/NetworkResourceLoader.cpp:
227         * NetworkProcess/PingLoad.h:
228         * Shared/WebCompiledContentRuleListData.cpp:
229         * Shared/gtk/WebEventFactory.cpp:
230         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
231         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
232         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
233         (WKWebsiteDataStoreStatisticsResetToConsistentState):
234         * UIProcess/Downloads/DownloadProxyMap.cpp:
235         * UIProcess/InspectorTargetProxy.cpp:
236         * UIProcess/PageClient.h:
237         * UIProcess/ProcessAssertion.cpp:
238         * UIProcess/ProvisionalPageProxy.h:
239         * UIProcess/WebPageInspectorTargetAgent.h:
240         * UIProcess/geoclue/GeoclueGeolocationProvider.cpp:
241         * WebProcess/Cache/WebCacheStorageConnection.cpp:
242         (WebKit::WebCacheStorageConnection::updateQuotaBasedOnSpaceUsage):
243         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
244         (WKBundleSetDatabaseQuota):
245         * WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
246         Add missing includes / forward declarations to address compiler errors on GTK / WinCairo.
247
248 2019-04-12  Eric Carlson  <eric.carlson@apple.com>
249
250         Update AudioSession route sharing policy
251         https://bugs.webkit.org/show_bug.cgi?id=196776
252         <rdar://problem/46501611>
253
254         Reviewed by Jer Noble.
255
256         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
257         (-[WKAirPlayRoutePicker showFromView:routeSharingPolicy:routingContextUID:hasVideo:]):
258
259 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
260
261         WebsitePolicies doesn't copy its media source policy in WebsitePolicies::copy
262         https://bugs.webkit.org/show_bug.cgi?id=196862
263
264         Reviewed by Darin Adler.
265
266         Add a missing bit of code to copy m_mediaSourcePolicy over when making a copy of WebsitePolicies. This doesn't
267         have any observable effect, since m_mediaSourcePolicy isn't currently exposed as SPI on WKWebpagePreferences.
268
269         * UIProcess/API/APIWebsitePolicies.cpp:
270         (API::WebsitePolicies::copy const):
271
272 2019-04-12  Simon Fraser  <simon.fraser@apple.com>
273
274         [iOS WK2] Make -webkit-overflow-scrolling be a no-op
275         https://bugs.webkit.org/show_bug.cgi?id=196803
276         rdar://problem/49078202
277
278         Reviewed by Antti Koivisto.
279
280         Flip LegacyOverflowScrollingTouchEnabled to false.
281
282         * Shared/WebPreferences.yaml:
283
284 2019-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
285
286         [iOS] Software keyboard is shown too frequently on some websites
287         https://bugs.webkit.org/show_bug.cgi?id=195856
288         <rdar://problem/49191395>
289
290         Reviewed by Darin Adler.
291
292         On some websites, hidden editable elements are very frequently focused upon user interaction. Currently, this
293         causes the software keyboard to pop in and out unexpectedly; luckily, these same sites also apply
294         inputmode="none" to the hidden editable element, which ought to ensure that the software keyboard doesn't appear
295         when the element is focused.
296
297         However, since we disabled support for inputmode="none" in r240497, the software keyboard is no longer
298         suppressed, and becomes a big nuissance. r240497 removed support for this feature because, when using a hardware
299         keyboard, pressing the globe key no longer showed UI for switching languages. However, support for inputmode
300         none makes a much larger impact when a software keyboard is used (since the entire software keyboard animates in
301         and out), whereas a hardware keyboard only displays an input accessory view. For this reason, we can mitigate
302         this bug without reintroducing <rdar://problem/47406553> by re-enabling inputmode="none", but only when a
303         hardware keyboard is not attached.
304
305         * UIProcess/API/Cocoa/WKWebView.mm:
306         (hardwareKeyboardAvailabilityChangedCallback):
307         * UIProcess/ios/WKContentViewInteraction.h:
308         * UIProcess/ios/WKContentViewInteraction.mm:
309         (-[WKContentView shouldShowAutomaticKeyboardUI]):
310
311         Don't show the keyboard if inputmode is none and a hardware keyboard is not attached.
312
313         (-[WKContentView _hardwareKeyboardAvailabilityChanged]):
314
315         Reload input views if the inputmode is none to ensure that if a hardware keyboard is attached while editing an
316         element with inputmode="none", we'll show the input accessory view once again.
317
318 2019-04-12  Antoine Quint  <graouts@apple.com>
319
320         Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
321         https://bugs.webkit.org/show_bug.cgi?id=196830
322         <rdar://problem/49124313>
323
324         Reviewed by Wenson Hsieh.
325
326         We add a new policy to determine whether simulated mouse events dispatch are allowed.
327
328         * Shared/WebsitePoliciesData.cpp:
329         (WebKit::WebsitePoliciesData::encode const):
330         (WebKit::WebsitePoliciesData::decode):
331         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
332         * Shared/WebsitePoliciesData.h:
333         * Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
334         * UIProcess/API/APIWebsitePolicies.cpp:
335         (API::WebsitePolicies::copy const):
336         (API::WebsitePolicies::data):
337         * UIProcess/API/APIWebsitePolicies.h:
338         * WebKit.xcodeproj/project.pbxproj:
339
340 2019-04-12  Chris Dumez  <cdumez@apple.com>
341
342         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash
343         https://bugs.webkit.org/show_bug.cgi?id=196781
344         <rdar://problem/49789381>
345
346         Reviewed by Darin Adler.
347
348         When the network process gets terminated by the client, the NetworkProcessProxy object (and thus its DownloadProxyMap member) get
349         destroyed right away, before we get a call to didClose(IPC::Connection&). As a result, if there are ongoing downloads at the time
350         of the termination, we will hit the assertion above. To address the issue, update the NetworkProcessProxy destructor to invalidate
351         its DownloadProxyMap member, similator to what it does in didClose(IPC::Connection&).
352
353         * UIProcess/Downloads/DownloadProxyMap.cpp:
354         (WebKit::DownloadProxyMap::invalidate):
355         (WebKit::DownloadProxyMap::processDidClose): Deleted.
356         * UIProcess/Downloads/DownloadProxyMap.h:
357         * UIProcess/Network/NetworkProcessProxy.cpp:
358         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
359         (WebKit::NetworkProcessProxy::didClose):
360
361 2019-04-11  Carlos Garcia Campos  <cgarcia@igalia.com>
362
363         [GTK] REGRESSION(r243860): Many tests failing
364         https://bugs.webkit.org/show_bug.cgi?id=196791
365
366         Reviewed by Joanmarie Diggs.
367
368         Calling updateAccessibilityTree() on document loaded was causing a re-layout because of the backing store update
369         that confused all those tests. We shouldn't need to update the accessibility tree on document load, it should
370         happen automatically when root object is attached/detached. This patch emits children-changed::add when the root
371         object wrapper is attached and children-changed::remove when the root object is detached. That way ATs are
372         notified of the changes in the accessibility tree.
373
374         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
375         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad): Remove call to WebPage::updateAccessibilityTree().
376         * WebProcess/WebPage/WebPage.h: Remove updateAccessibilityTree().
377         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
378         (coreRootObjectWrapperDetachedCallback): Emit children-changed::remove.
379         (rootWebAreaWrapper): Helper to get the root WebArea wrapper.
380         (accessibilityRootObjectWrapper): Set the parent here when root object is created and emit children-changed::add.
381         (webkitWebPageAccessibilityObjectRefChild): Dot no set the parent here, it's now set when the root object is created.
382         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Remove webkitWebPageAccessibilityObjectRefresh().
383         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
384
385 2019-04-11  Megan Gardner  <megan_gardner@apple.com>
386
387         Update 'Save Image' to more clear instructions
388         https://bugs.webkit.org/show_bug.cgi?id=196833
389         <rdar://problem/47446845>
390
391         Reviewed by Wenson Hsieh.
392
393         Just updating to a new string.
394
395         * UIProcess/API/Cocoa/_WKElementAction.mm:
396         (+[_WKElementAction _elementActionWithType:customTitle:assistant:]):
397
398 2019-04-11  Chris Dumez  <cdumez@apple.com>
399
400         Unable to run system Safari with trunk WebKit
401         https://bugs.webkit.org/show_bug.cgi?id=196777
402         <rdar://problem/49784574>
403
404         Reviewed by Alex Christensen.
405
406         * UIProcess/API/Cocoa/WKWebView.mm:
407         (-[WKWebView _initializeWithConfiguration:]):
408         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
409         data store only happens for apps rebuilt using recent SDK.
410
411         * UIProcess/Cocoa/VersionChecks.h:
412         * UIProcess/Cocoa/VersionChecks.mm:
413         (WebKit::linkedOnOrAfter):
414         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
415           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
416           be controlled by the caller.
417         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
418           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
419           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
420           0 value for sdkVersion.
421
422 2019-04-11  Zalan Bujtas  <zalan@apple.com>
423
424         Add @page margin support
425         https://bugs.webkit.org/show_bug.cgi?id=196680
426         <rdar://problem/45217707>
427
428         Reviewed by Tim Horton.
429
430         * Shared/PrintInfo.cpp:
431         (WebKit::PrintInfo::encode const):
432         (WebKit::PrintInfo::decode):
433         * Shared/PrintInfo.h:
434         * Shared/WebPreferences.yaml:
435         * Shared/gtk/PrintInfoGtk.cpp:
436         (WebKit::PrintInfo::PrintInfo):
437         * Shared/mac/PrintInfoMac.mm:
438         (WebKit::PrintInfo::PrintInfo):
439         * UIProcess/API/C/WKPage.cpp:
440         (WKPageComputePagesForPrinting):
441         * UIProcess/API/C/WKPreferences.cpp:
442         (WKPreferencesSetPageAtRuleSupportEnabled):
443         (WKPreferencesGetPageAtRuleSupportEnabled):
444         * UIProcess/API/C/WKPreferencesRefPrivate.h:
445         * UIProcess/GenericCallback.h:
446         * UIProcess/WebPageProxy.cpp:
447         (WebKit::WebPageProxy::computedPagesCallback):
448         * UIProcess/WebPageProxy.h:
449         * UIProcess/WebPageProxy.messages.in:
450         * UIProcess/mac/WKPrintingView.mm:
451         (pageDidComputePageRects):
452         (-[WKPrintingView _askPageToComputePageRects]):
453         * WebProcess/WebPage/WebPage.cpp:
454         (WebKit::WebPage::beginPrinting):
455         (WebKit::WebPage::computePagesForPrinting):
456         (WebKit::WebPage::computePagesForPrintingImpl):
457         * WebProcess/WebPage/WebPage.h:
458         * WebProcess/WebPage/ios/WebPageIOS.mm:
459         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
460
461 2019-04-11  Dean Jackson  <dino@apple.com>
462
463         Extract UTI mapping and allow for additions
464         https://bugs.webkit.org/show_bug.cgi?id=196822
465         <rdar://problem/49822339>
466
467         Reviewed by Tim Horton.
468
469         Use the new helper to map MIME type to UTI.
470
471         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
472         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
473         * UIProcess/ios/WKSystemPreviewView.mm:
474         (getUTIForSystemPreviewMIMEType):
475
476
477 2019-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
478
479         REGRESSION (r244182): RemoteLayerTreeDrawingArea::flushLayers() should not be reentrant
480         https://bugs.webkit.org/show_bug.cgi?id=196825
481
482         Reviewed by Simon Fraser.
483
484         Ensure the layer transactions IDs are sequential. So bail out of
485         RemoteLayerTreeDrawingArea::flushLayers() if reentrancy is detected.
486
487         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
488         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
489         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
490
491 2019-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
492
493         Allow the MediaSource API to be enabled via website policy
494         https://bugs.webkit.org/show_bug.cgi?id=196429
495         <rdar://problem/48774333>
496
497         Reviewed by Tim Horton.
498
499         Adds support for using WebsitePolicies to determine whether to enable the MediaSource API.
500
501         * Shared/WebPreferences.yaml:
502
503         Disengage the mediaSourceEnabled internal preference from the corresponding WebCore setting; to ensure that
504         setting the preference to `true` still results in enabling the MediaSource API, we instead make it such that
505         turning on mediaSourceEnabled causes WebsitePolicies to set its WebsiteMediaSourcePolicy to Enable.
506
507         In the future, we should deprecate and remove this preference, in favor of simply setting preferred
508         compatibility mode on WKWebpagePreferences.
509
510         * Shared/WebPreferences.yaml:
511         * Shared/WebsiteMediaSourcePolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
512         * Shared/WebsitePoliciesData.cpp:
513         (WebKit::WebsitePoliciesData::encode const):
514         (WebKit::WebsitePoliciesData::decode):
515
516         Add plumbing for m_mediaSourcePolicy in the set of website policies.
517
518         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
519
520         Update the document loader with the given media source policy. There are two possibilities when applying the set
521         of policies to the document loader; either the document loader is already attached to a Frame, or the document
522         loader is yet to be attached to a Frame.
523
524         In the first case, we update Frame's settings on the spot, by calling the new applyPoliciesToSettings helper
525         method. In the second scenario, we stash the policy state on DocumentLoader; when the DocumentLoader is attached
526         to a Frame, we'll then update the Frame's settings using DocumentLoader's policy.
527
528         * Shared/WebsitePoliciesData.h:
529         * UIProcess/API/APIWebsitePolicies.cpp:
530         (API::WebsitePolicies::data):
531         * UIProcess/API/APIWebsitePolicies.h:
532         * UIProcess/API/C/WKPage.cpp:
533         (WKPageSetPageNavigationClient):
534         * UIProcess/Cocoa/NavigationState.mm:
535         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
536
537         Move code that adjusts website policies after deciding policies for the navigation action from NavigationClient
538         ::decidePolicyForNavigationAction to the completion handler of the policy listener. This allows us to respect
539         default website policies on the web view configuration, even when using the C API to set the navigation client,
540         and also allows us to have a single call site for adjustPoliciesForCompatibilityMode. This also enables our
541         layout tests to opt into modern compatibility mode by default, when specifying modern compatibility mode on
542         webpage preferences.
543
544         * UIProcess/WebPageProxy.cpp:
545         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
546         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
547         * UIProcess/WebPageProxy.h:
548         * WebKit.xcodeproj/project.pbxproj:
549
550 2019-04-11  Antti Koivisto  <antti@apple.com>
551
552         REGRESSION: changing iPad orientation on blogger.com crashes under RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations()
553         https://bugs.webkit.org/show_bug.cgi?id=196813
554         <rdar://problem/49393264>
555
556         Reviewed by Simon Fraser.
557
558         No test, can't repro.
559
560         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
561         (WebKit::RemoteScrollingCoordinatorProxy::establishLayerTreeScrollingRelations):
562
563         Null check the nodes.
564
565 2019-04-10  Chris Dumez  <cdumez@apple.com>
566
567         Regression(r244144) ProcessSwap.ReuseSuspendedProcessLoadHTMLString API test is flaky
568         https://bugs.webkit.org/show_bug.cgi?id=196784
569
570         Reviewed by Antti Koivisto.
571
572         When we enter accelerated compositing mode in the new process, we supposed to *close* the last
573         SuspendedPageProxy, not destroy it. This was causing flakiness in the test because it was testing
574         that we were using the SuspendedPageProxy's process for a cross-site link navigation, which is
575         an optimization. This optimization was partly broken by r244144 as the SuspendedPageProxy would
576         not sometimes be gone by the time we need it.
577
578         * UIProcess/SuspendedPageProxy.cpp:
579         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
580
581 2019-04-10  Alex Christensen  <achristensen@webkit.org>
582
583         WKNavigationResponse._downloadAttribute should be nil when no download attribute is present
584         https://bugs.webkit.org/show_bug.cgi?id=196809
585         <rdar://49800762>
586
587         Reviewed by Brady Eidson.
588
589         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
590         (-[WKNavigationResponse _downloadAttribute]):
591
592 2019-04-10  Tim Horton  <timothy_horton@apple.com>
593
594         REGRESSION (r241734): ⌥⌘↑ and ⌥⌘↓ no longer navigate to previous/next Reading List article
595         https://bugs.webkit.org/show_bug.cgi?id=196797
596         <rdar://problem/48484715>
597
598         Reviewed by Simon Fraser.
599
600         * UIProcess/ios/WKKeyboardScrollingAnimator.mm:
601         (-[WKKeyboardScrollingAnimator keyboardScrollForEvent:]):
602         Validate the set of modifier keys pressed when handling a key event for scrolling:
603         Ignore key events with multiple modifier keys pressed.
604         Ignore key events with an invalid modifier key pressed for a given primary key.
605
606 2019-04-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
607
608         requestAnimationFrame should execute before the next frame
609         https://bugs.webkit.org/show_bug.cgi?id=177484
610
611         Reviewed by Simon Fraser.
612
613         Replace the calls to Page::layoutIfNeeded() and willDisplayPage() by
614         a single call to Page::updateRendering(). This new function implements 
615         "Update the rendering" step of the HTML Event Loop specification
616         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
617
618         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
619         (WebKit::DrawingAreaCoordinatedGraphics::scheduleCompositingLayerFlush):
620         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState):
621         (WebKit::DrawingAreaCoordinatedGraphics::display):
622         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
623         (WebKit::LayerTreeHost::layerFlushTimerFired):
624
625         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
626         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
627         -- Call Page::updateRendering() to make sure that "Update the rendering"
628            happens immediately before updating the page.
629
630         -- Move the call to RemoteLayerBackingStoreCollection::willFlushLayers()
631            to be exactly before flushing the layers. This fixes the assertion
632            ASSERT(m_inLayerFlush) which was firing when running a layout test.
633            RemoteLayerTreeDrawingArea::flushLayers() now can call itself through
634            TestRunner::notifyDone(). flushLayers() was calling willFlushLayers()
635            twice before calling didFlushLayers().
636
637         * WebProcess/WebPage/WebPage.cpp:
638         (WebKit::WebPage::layoutIfNeeded):
639         (WebKit::WebPage::updateRendering):
640         (WebKit::WebPage::willDisplayPage): Deleted.
641         * WebProcess/WebPage/WebPage.h:
642         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
643         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
644
645 2019-04-10  Devin Rousso  <drousso@apple.com>
646
647         Web Inspector: save sheet should be anchored underneath the tab bar when detached
648         https://bugs.webkit.org/show_bug.cgi?id=196722
649         <rdar://problem/49613280>
650
651         Reviewed by Timothy Hatcher.
652
653         * WebProcess/WebPage/WebInspectorUI.h:
654         * WebProcess/WebPage/WebInspectorUI.cpp:
655         (WebKit::WebInspectorUI::changeSheetRect): Added.
656         * UIProcess/WebInspectorProxy.messages.in:
657         * UIProcess/WebInspectorProxy.h:
658         (WebKit::WebInspectorProxy::sheetRect const): Added.
659         * UIProcess/WebInspectorProxy.cpp:
660         (WebKit::WebInspectorProxy::setSheetRect): Added.
661         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
662         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
663         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
664         * UIProcess/mac/WebInspectorProxyMac.mm:
665         (-[WKWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
666         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
667         * UIProcess/win/WebInspectorProxyWin.cpp:
668         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
669         * UIProcess/wpe/WebInspectorProxyWPE.cpp:
670         (WebKit::WebInspectorProxy::platformSetSheetRect): Added.
671
672         * WebProcess/WebPage/RemoteWebInspectorUI.h:
673         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
674         (WebKit::RemoteWebInspectorUI::changeSheetRect): Added.
675         * UIProcess/RemoteWebInspectorProxy.messages.in:
676         * UIProcess/RemoteWebInspectorProxy.h:
677         (WebKit::RemoteWebInspectorProxy::sheetRect const): Added.
678         * UIProcess/RemoteWebInspectorProxy.cpp:
679         (WebKit::RemoteWebInspectorProxy::setSheetRect): Added.
680         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
681         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
682         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
683         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
684         (-[WKRemoteWebInspectorProxyObjCAdapter window:willPositionSheet:usingRect:]): Added.
685         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
686         (WebKit::RemoteWebInspectorProxy::platformSetSheetRect): Added.
687
688 2019-04-10  Andy Estes  <aestes@apple.com>
689
690         [iOS] Let PDFHostViewController specify the background color to use for WKPDFView
691         https://bugs.webkit.org/show_bug.cgi?id=196785
692         <rdar://problem/48240051>
693
694         Reviewed by Tim Horton.
695
696         * UIProcess/ios/WKPDFView.mm:
697         (-[WKPDFView web_initWithFrame:webView:mimeType:]):
698
699 2019-04-10  Chris Dumez  <cdumez@apple.com>
700
701         Unreviewed, rolling out r244146.
702
703         Caused a few DeviceOrientation API test failures on iOS
704
705         Reverted changeset:
706
707         "Unable to run system Safari with trunk WebKit"
708         https://bugs.webkit.org/show_bug.cgi?id=196777
709         https://trac.webkit.org/changeset/244146
710
711 2019-04-10  Devin Rousso  <drousso@apple.com>
712
713         Web Inspector: REGRESSION: lazy agents used outside of frontend/instrumentation can be accessed before being created
714         https://bugs.webkit.org/show_bug.cgi?id=196725
715         <rdar://problem/49669810>
716
717         Reviewed by Timothy Hatcher.
718
719         * WebProcess/WebPage/WebInspector.cpp:
720         (WebKit::WebInspector::showMainResourceForFrame):
721
722 2019-04-10  Youenn Fablet  <youenn@apple.com>
723
724         Clear Cache Storage structures before removing all related files
725         https://bugs.webkit.org/show_bug.cgi?id=196650
726
727         Reviewed by Alex Christensen.
728
729         Previously, we were clearing files in parallel to clearing the internal CacheStorage structures.
730         To make things more deterministic, clear files/folders directly
731         after CachesStorage structures have finished being cleared.
732
733         * NetworkProcess/cache/CacheStorageEngine.cpp:
734         (WebKit::CacheStorage::Engine::clearAllCaches):
735         (WebKit::CacheStorage::Engine::clearCachesForOrigin):
736
737 2019-04-10  Alex Christensen  <achristensen@webkit.org>
738
739         Add SPI WKNavigationResponse._downloadAttribute
740         https://bugs.webkit.org/show_bug.cgi?id=196755
741         <rdar://49587365>
742
743         Reviewed by Brady Eidson.
744
745         * UIProcess/API/APINavigationResponse.h:
746         * UIProcess/API/Cocoa/WKNavigationResponse.mm:
747         (-[WKNavigationResponse _downloadAttribute]):
748         * UIProcess/API/Cocoa/WKNavigationResponsePrivate.h:
749         * UIProcess/ProvisionalPageProxy.cpp:
750         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
751         * UIProcess/ProvisionalPageProxy.h:
752         * UIProcess/WebPageProxy.cpp:
753         (WebKit::WebPageProxy::decidePolicyForResponse):
754         (WebKit::WebPageProxy::decidePolicyForResponseShared):
755         * UIProcess/WebPageProxy.h:
756         * UIProcess/WebPageProxy.messages.in:
757         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
758         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
759         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
760
761 2019-04-10  Youenn Fablet  <youenn@apple.com>
762
763         SWClientConnection should not double hop to fire some events
764         https://bugs.webkit.org/show_bug.cgi?id=196735
765
766         Reviewed by Alex Christensen.
767
768         Removed unnecessary method.
769
770         * WebProcess/Storage/WebSWClientConnection.cpp:
771         * WebProcess/Storage/WebSWClientConnection.h:
772
773 2019-04-10  Per Arne Vollan  <pvollan@apple.com>
774
775         [iOS] Fix iokit-get-properties sandbox violations
776         https://bugs.webkit.org/show_bug.cgi?id=196782
777         <rdar://problem/49497720>
778
779         Reviewed by Brent Fulgham.
780
781         Add iokit properties to the WebContent sandbox on iOS.
782
783         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
784
785 2019-04-10  Tim Horton  <timothy_horton@apple.com>
786
787         Add modern API for overriding the page's specified viewport configuration
788         https://bugs.webkit.org/show_bug.cgi?id=167734
789         <rdar://problem/30331795>
790
791         Reviewed by Simon Fraser.
792
793         * Shared/WebPageCreationParameters.cpp:
794         (WebKit::WebPageCreationParameters::encode const):
795         (WebKit::WebPageCreationParameters::decode):
796         * Shared/WebPageCreationParameters.h:
797         Plumb overrideViewportArguments in WebPageCreationParameters, so that
798         if the process crashes (or swaps) they are maintained.
799
800         * UIProcess/API/Cocoa/WKWebView.mm:
801         (viewportArgumentsFromDictionary):
802         (-[WKWebView _overrideViewportWithArguments:]):
803         Add SPI to set override viewport arguments. Parse them into a ViewportArguments
804         object and use the existing (now improved) overrideViewportArguments mechanism
805         to take over the page's viewport arguments.
806
807         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
808         * UIProcess/WebPageProxy.cpp:
809         (WebKit::WebPageProxy::creationParameters):
810         * UIProcess/WebPageProxy.h:
811         * UIProcess/ios/WebPageProxyIOS.mm:
812         (WebKit::WebPageProxy::setOverrideViewportArguments):
813         * WebProcess/WebPage/WebPage.cpp:
814         Plumb overrideViewportArguments around more.
815
816 2019-04-10  Jiewen Tan  <jiewen_tan@apple.com>
817
818         Add runJavaScriptInFrame for WebPageProxy/WebPage
819         https://bugs.webkit.org/show_bug.cgi?id=196750
820         <rdar://problem/49755738>
821
822         Reviewed by Youenn Fablet.
823
824         Tests of the new method will be covered by the internal counterpart.
825
826         * UIProcess/WebFrameProxy.cpp:
827         (WebKit::WebFrameProxy::loadData):
828         * UIProcess/WebFrameProxy.h:
829         Add a comment.
830         * UIProcess/WebPageProxy.cpp:
831         (WebKit::WebPageProxy::runJavaScriptInMainFrame):
832         (WebKit::WebPageProxy::runJavaScriptInMainFrameScriptWorld):
833         Merge the above two runJavaScriptInMainFrame*.
834         (WebKit::WebPageProxy::runJavaScriptInFrame):
835         * UIProcess/WebPageProxy.h:
836         * WebProcess/WebPage/WebPage.cpp:
837         (WebKit::WebPage::loadDataInFrame):
838         Add an assertion.
839         (WebKit::WebPage::runJavaScript):
840         (WebKit::WebPage::runJavaScriptInMainFrameScriptWorld):
841         (WebKit::WebPage::runJavaScriptInFrame):
842         (WebKit::WebPage::runJavaScriptInMainFrame): Deleted.
843         * WebProcess/WebPage/WebPage.h:
844         * WebProcess/WebPage/WebPage.messages.in:
845
846 2019-04-10  Chris Dumez  <cdumez@apple.com>
847
848         Unable to run system Safari with trunk WebKit
849         https://bugs.webkit.org/show_bug.cgi?id=196777
850         <rdar://problem/49784574>
851
852         Reviewed by Alex Christensen.
853
854         * UIProcess/API/Cocoa/WKWebView.mm:
855         (-[WKWebView _initializeWithConfiguration:]):
856         Add a linkedOnAfter check so that throwing exceptions when related web views use a different
857         data store only happens for apps rebuilt using recent SDK.
858
859         * UIProcess/Cocoa/VersionChecks.h:
860         * UIProcess/Cocoa/VersionChecks.mm:
861         (WebKit::linkedOnOrAfter):
862         - By default, linkedOnOrAfter assumed Safari / MobileSafari is always linked-on-after. To satisfy my
863           use cases, I introduced a new AssumeSafariIsAlwaysLinkedOnAfter parameter so that this behavior can
864           be controlled by the caller.
865         - In the header, DYLD_IOS_VERSION_* / DYLD_MACOS_VERSION_* constants are 0 when building with the
866           non-internal SDK. As a result, the check instead linkedOnOrAfter() would cause us to always return
867           true, which was wrong. I therefore updated the check inside linkedOnOrAfter() to special-case the
868           0 value for sdkVersion.
869
870 2019-04-10  Chris Dumez  <cdumez@apple.com>
871
872         Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
873         https://bugs.webkit.org/show_bug.cgi?id=196774
874         <rdar://problem/49460572>
875
876         Reviewed by Alex Christensen.
877
878         r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
879         IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
880         IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
881         IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
882         case we would fail to close the WebPage and audio could keep playing.
883
884         To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
885         EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
886         will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
887         the DidFailToSuspendAfterProcessSwap is eventually received.
888
889         * UIProcess/SuspendedPageProxy.cpp:
890         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
891         (WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
892         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
893         * UIProcess/SuspendedPageProxy.h:
894         * UIProcess/WebPageProxy.cpp:
895         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
896         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
897         * UIProcess/WebPageProxy.h:
898         * UIProcess/WebProcessPool.cpp:
899         * UIProcess/WebProcessPool.h:
900
901 2019-04-10  Timothy Hatcher  <timothy@apple.com>
902
903         WKScrollView background color does not match WKWebView before content is loaded.
904         https://bugs.webkit.org/show_bug.cgi?id=196745
905         rdar://problem/49750810
906
907         Reviewed by Megan Gardner.
908
909         * UIProcess/API/Cocoa/WKWebView.mm:
910         (scrollViewBackgroundColor): Default to _contentView.backgroundColor on invalid base color.
911         (-[WKWebView _processDidExit]): Reset to _contentView.backgroundColor.
912         (-[WKWebView setBackgroundColor:]): Call _updateScrollViewBackground since it can use
913         _contentView.backgroundColor and it has changed.
914
915 2019-04-10  Megan Gardner  <megan_gardner@apple.com>
916
917         Fix text autoscrolling when typing in modern webkit
918         https://bugs.webkit.org/show_bug.cgi?id=196718
919         <rdar://problem/49225507>
920
921         Reviewed by Tim Horton.
922
923         For staging only. We need to turn off UIKit's scrolling behavior to land
924         the changes we are making. To keep from the build ever breaking,
925         I am temporarily circumventing the changes in UIKit. This will be removed
926         once the next UIKit submission happens.
927
928         * UIProcess/ios/WKContentViewInteraction.mm:
929         (-[WKUIWKTextInteractionAssistant scrollSelectionToVisible]):
930         (-[WKContentView setUpTextSelectionAssistant]):
931
932 2019-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
933
934         [iOSMac] Opt into modern compatibility mode by default
935         https://bugs.webkit.org/show_bug.cgi?id=196763
936         <rdar://problem/49038732>
937
938         Reviewed by Tim Horton.
939
940         Achieve this by limiting legacy compatibility mode by default to non-iOSMac iOS only.
941
942         * Shared/WebPreferences.yaml:
943         * Shared/WebPreferencesDefaultValues.h:
944
945 2019-04-10  Alex Christensen  <achristensen@webkit.org>
946
947         RemoteObjectRegistry message receiver should be removed when WebPage::close is called instead of waiting until dealloc
948         https://bugs.webkit.org/show_bug.cgi?id=196744
949         <rdar://49415309>
950
951         Reviewed by Chris Dumez.
952
953         This is a similar problem to the one I fixed in r241306 so I piggy-backed on the same test.
954         When you do a cross site navigation but the previous page is in a suspended process then you navigate back,
955         you can get two WebPage objects in the same process with the same IDs.  WebPage::close has been called
956         on the old one which is supposed to make it so all the message receivers associated with it have been removed
957         so we don't have any loss of communication, but we missed the RemoteObjectRegistry messages, which are owned
958         by the ObjC bundle object wrapping the WebPage (which can keep it alive if a strong reference to it is held).
959         To fix the assertion that happens in this case and the resulting communication breakage, teach the WebPage about
960         these messages so it can tear down the message receiver with the others it removes at close time.
961
962         * Shared/API/Cocoa/RemoteObjectRegistry.h:
963         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
964         (-[WKWebProcessPlugInBrowserContextController dealloc]):
965         (-[WKWebProcessPlugInBrowserContextController _remoteObjectRegistry]):
966         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
967         (WebKit::WebPage::addRemoteObjectRegistry):
968         * WebProcess/WebPage/WebPage.cpp:
969         (WebKit::WebPage::close):
970         * WebProcess/WebPage/WebPage.h:
971
972 2019-04-10  Chris Dumez  <cdumez@apple.com>
973
974         Unreviewed, drop SuspendedPageProxy data member that is unused after r244075.
975
976         * UIProcess/SuspendedPageProxy.h:
977
978 2019-04-10  Antoine Quint  <graouts@apple.com>
979
980         Enable Pointer Events on watchOS
981         https://bugs.webkit.org/show_bug.cgi?id=196771
982         <rdar://problem/49040909>
983
984         Reviewed by Dean Jackson.
985
986         * Configurations/FeatureDefines.xcconfig:
987
988 2019-04-10  Brady Eidson  <beidson@apple.com>
989
990         Background tabs are not fully reactivated after a link is opened from an external application.
991         <rdar://problem/49533278> and https://bugs.webkit.org/show_bug.cgi?id=196705
992
993         Reviewed by Chris Dumez.
994
995         If an app unparents a WKWebView right after activation but before the "applicationWillEnterForeground" notification
996         is dispatched, then that WKWebView is in a broken state with a frozen layer tree.
997
998         The WKApplicationStateTrackingView logic needs to be a little more resilient.
999
1000         * UIProcess/ios/WKApplicationStateTrackingView.mm:
1001         (-[WKApplicationStateTrackingView willMoveToWindow:]): When clearing the window, remember the current background state.
1002         (-[WKApplicationStateTrackingView didMoveToWindow]): If our last observed background state doesn't match the current
1003           background state then fake the relevant notification.
1004         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]): Remember that we've observed a backgrounding.
1005         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]): Remember that we've observed a foregrounding.
1006
1007 2019-04-10  Diego Pino Garcia  <dpino@igalia.com>
1008
1009         Unreviewed, build fix for r244097
1010
1011         * NetworkProcess/NetworkProcess.cpp:
1012         (WebKit::NetworkProcess::actualPrepareToSuspend):
1013         (WebKit::NetworkProcess::resume):
1014         Added guards for ENABLE(SERVICE_WORKER)
1015
1016 2019-04-09  Keith Rollin  <krollin@apple.com>
1017
1018         Unreviewed build maintenance -- update .xcfilelists.
1019
1020         * DerivedSources-input.xcfilelist:
1021         * DerivedSources-output.xcfilelist:
1022
1023 2019-04-09  Zalan Bujtas  <zalan@apple.com>
1024
1025         [AutoSizing] Avoid making text paragraphs scroll horizontally when there is a wide table
1026         https://bugs.webkit.org/show_bug.cgi?id=196743
1027         <rdar://problem/43897551>
1028
1029         Reviewed by Tim Horton.
1030
1031         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1032         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1033         * WebProcess/WebPage/WebPage.cpp:
1034         (WebKit::WebPage::setViewLayoutSize):
1035
1036 2019-04-09  Youenn Fablet  <youenn@apple.com>
1037
1038         Close service worker database on network process suspension
1039         https://bugs.webkit.org/show_bug.cgi?id=196623
1040         <rdar://problem/48930869>
1041
1042         Reviewed by Alex Christensen.
1043
1044         Close service worker database when preparing to suspend.
1045         On resume, push changes if any is needed.
1046
1047         * NetworkProcess/NetworkProcess.cpp:
1048         (WebKit::NetworkProcess::actualPrepareToSuspend):
1049         (WebKit::NetworkProcess::cancelPrepareToSuspend):
1050         (WebKit::NetworkProcess::processDidResume):
1051         * UIProcess/API/Cocoa/WKProcessPool.mm:
1052         (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
1053         (-[WKProcessPool _sendNetworkProcessDidResume]):
1054         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1055         * UIProcess/Network/NetworkProcessProxy.h:
1056         * UIProcess/WebProcessPool.cpp:
1057         (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently):
1058         (WebKit::WebProcessPool::sendNetworkProcessDidResume):
1059         * UIProcess/WebProcessPool.h:
1060
1061 2019-04-09  Daniel Bates  <dabates@apple.com>
1062
1063         [iPad] Should open popover when the spacebar is pressed
1064         https://bugs.webkit.org/show_bug.cgi?id=196360
1065         <rdar://problem/49389129>
1066
1067         Reviewed by Brent Fulgham.
1068
1069         Pressing the spacebar should open the popover for a focused popup button (e.g. <select>) on iOS
1070         just like it does on the Mac.
1071
1072         For now, we keep the iPhone behavior of blurring the element when the Done button is pressed and
1073         hence pressing spacebar does nothing (because there is no focused element).
1074
1075         * UIProcess/ios/WKContentViewInteraction.h:
1076         * UIProcess/ios/WKContentViewInteraction.mm:
1077         (-[WKContentView accessoryOpen]): Added. Extracted the logic from -_elementDidFocus to scroll to
1078         the focused element, update the accessory and then tell the accessory to begin editing.
1079         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1080         Write in terms of -accessoryOpen.
1081         * UIProcess/ios/forms/WKFormPeripheralBase.mm:
1082         (-[WKFormPeripheralBase handleKeyEvent:]): Interpret the spacebar when the peripheral is closed (!_editing)
1083         and call -accessoryOpen to ultimately call back to this peripheral to tell it to begin editing,
1084         which will cause the popover to appear again.
1085
1086 2019-04-09  Chris Dumez  <cdumez@apple.com>
1087
1088         Unreviewed, fix webkitpy failure after r244085.
1089
1090         Use a list instead of a set for header includes so that the order is
1091         maintained.
1092
1093         * Scripts/webkit/messages.py:
1094
1095 2019-04-09  Andy Estes  <aestes@apple.com>
1096
1097         [Apple Pay] Add release logging to PaymentCoordinator
1098         https://bugs.webkit.org/show_bug.cgi?id=196738
1099
1100         Reviewed by Alex Christensen.
1101
1102         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1103         (WebKit::WebPaymentCoordinator::isAlwaysOnLoggingAllowed const):
1104         * WebProcess/ApplePay/WebPaymentCoordinator.h:
1105
1106 2019-04-09  Jer Noble  <jer.noble@apple.com>
1107
1108         [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
1109         https://bugs.webkit.org/show_bug.cgi?id=196659
1110
1111         Reviewed by Chris Dumez.
1112
1113         * Platform/IPC/Connection.h:
1114         (IPC::Connection::sendWithAsyncReply):
1115         * Platform/spi/ios/AssertionServicesSPI.h:
1116         * Shared/Cocoa/ProcessTaskStateObserver.h: Added.
1117         (WebKit::ProcessTaskStateObserver::setClient):
1118         (WebKit::ProcessTaskStateObserver::client):
1119         (WebKit::ProcessTaskStateObserver::taskState const):
1120         * Shared/Cocoa/ProcessTaskStateObserver.mm: Added.
1121         (-[WKProcessTaskStateObserverDelegate process:taskStateDidChange:]):
1122         (WebKit::toProcessTaskStateObserverTaskState):
1123         (WebKit::ProcessTaskStateObserver::ProcessTaskStateObserver):
1124         (WebKit::ProcessTaskStateObserver::~ProcessTaskStateObserver):
1125         (WebKit::ProcessTaskStateObserver::setTaskState):
1126         * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
1127         (WebKit::WebProcessProxy::processWasUnexpectedlyUnsuspended):
1128         * UIProcess/ProcessAssertion.h:
1129         * UIProcess/ProcessThrottler.cpp:
1130         (WebKit::ProcessThrottler::updateAssertion):
1131         * UIProcess/ProcessThrottler.h:
1132         (WebKit::ProcessThrottler::shouldBeRunnable const):
1133         * UIProcess/WebProcessProxy.h:
1134         * UIProcess/WebProcessProxy.messages.in:
1135         * UIProcess/ios/ProcessAssertionIOS.mm:
1136         (WebKit::reasonForState):
1137         (WebKit::toBKSProcessAssertionReason):
1138         (WebKit::ProcessAssertion::ProcessAssertion):
1139         * WebKit.xcodeproj/project.pbxproj:
1140         * WebProcess/WebProcess.cpp:
1141         (WebKit::WebProcess::actualPrepareToSuspend):
1142         (WebKit::WebProcess::cancelPrepareToSuspend):
1143         (WebKit::WebProcess::processDidResume):
1144         * WebProcess/WebProcess.h:
1145         * WebProcess/cocoa/WebProcessCocoa.mm:
1146         (WebKit::WebProcess::processTaskStateDidChange):
1147
1148 2019-04-09  Alex Christensen  <achristensen@webkit.org>
1149
1150         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1151         https://bugs.webkit.org/show_bug.cgi?id=196665
1152         <rdar://45115669>
1153
1154         Reviewed by Geoff Garen.
1155
1156         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1157
1158         * UIProcess/API/Cocoa/WKWebView.mm:
1159         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1160         * UIProcess/Cocoa/WebViewImpl.mm:
1161         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1162
1163 2019-04-09  John Wilander  <wilander@apple.com>
1164
1165         Pick up Ad Click Attribution conversions in NetworkResourceLoader::willSendRedirectedRequest()
1166         https://bugs.webkit.org/show_bug.cgi?id=196558
1167         <rdar://problem/47650245>
1168
1169         Reviewed by Youenn Fablet.
1170
1171         So called pixel requests have traditionally been used to send ad click
1172         attribution data to click sources. The privacy implications of such
1173         pixel requests are severe which is in part why browsers have started to
1174         block cookies from being sent in such third-party requests.
1175
1176         To allow for a smooth transition to more privacy-friendly ad click
1177         attribution, we should allow servers to make a redirect to
1178         https://click-source.example/.well-known/ad-click-attribution/ to
1179         trigger a so called conversion.
1180
1181         This patch checks for the well-known location in the path component of
1182         the redirect URL. If the request indeed goes to the well-known location,
1183         we parse the conversion data and send it to the storage in the network
1184         session.
1185
1186         * NetworkProcess/NetworkAdClickAttribution.cpp:
1187         (WebKit::NetworkAdClickAttribution::convert):
1188             Reporting function.
1189         * NetworkProcess/NetworkAdClickAttribution.h:
1190         * NetworkProcess/NetworkResourceLoader.cpp:
1191         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1192             Now checks for the well-known location through a call to
1193             WebCore::AdClickAttribution::parseConversionRequest().
1194         * NetworkProcess/NetworkSession.cpp:
1195         (WebKit::NetworkSession::convertAdClickAttribution):
1196             Piping to WebKit::NetworkAdClickAttribution::convert().
1197         * NetworkProcess/NetworkSession.h:
1198
1199 2019-04-09  Chris Dumez  <cdumez@apple.com>
1200
1201         [iOS] WebContent processes should be marked as "Foreground Running" when their view is visible
1202         https://bugs.webkit.org/show_bug.cgi?id=196695
1203         <rdar://problem/48073787>
1204
1205         Reviewed by Tim Horton.
1206
1207         In order for WebContent processes to get marked as "Foreground Running" when their view
1208         is visible on iOS, we now construct a _UILayerHostView in the UIProcess and add it as
1209         a subview of the WKContentView. The _UILayerHostView's visibility target is the
1210         WebContent process currently associated with the view.
1211
1212         * Platform/spi/ios/UIKitSPI.h:
1213         * UIProcess/PageClient.h:
1214         (WebKit::PageClient::didCreateContextForVisibilityPropagation):
1215         * UIProcess/WebPageProxy.h:
1216         * UIProcess/WebProcessProxy.h:
1217         (WebKit::WebProcessProxy::contextIDForVisibilityPropagation):
1218         * UIProcess/WebProcessProxy.messages.in:
1219         * UIProcess/ios/PageClientImplIOS.h:
1220         * UIProcess/ios/PageClientImplIOS.mm:
1221         (WebKit::PageClientImpl::didCreateContextForVisibilityPropagation):
1222         * UIProcess/ios/WKContentView.h:
1223         * UIProcess/ios/WKContentView.mm:
1224         (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
1225         (-[WKContentView _setupVisibilityPropagationView]):
1226         (-[WKContentView _processDidExit]):
1227         (-[WKContentView _didRelaunchProcess]):
1228         (-[WKContentView _processDidCreateContextForVisibilityPropagation]):
1229         * UIProcess/ios/WebPageProxyIOS.mm:
1230         (WebKit::WebPageProxy::didCreateContextForVisibilityPropagation):
1231         * UIProcess/ios/WebProcessProxyIOS.mm:
1232         (WebKit::WebProcessProxy::didCreateContextForVisibilityPropagation):
1233         * WebProcess/WebProcess.h:
1234         * WebProcess/cocoa/WebProcessCocoa.mm:
1235         (WebKit::WebProcess::platformInitializeWebProcess):
1236
1237 2019-04-09  Sihui Liu  <sihui_liu@apple.com>
1238
1239         Remove unnecessary network process assertion for IDB close
1240         https://bugs.webkit.org/show_bug.cgi?id=196693
1241
1242         Reviewed by Geoffrey Garen.
1243
1244         * NetworkProcess/NetworkProcess.cpp:
1245         (WebKit::NetworkProcess::createIDBServer):
1246         (WebKit::NetworkProcess::notifyHoldingLockedFiles): Deleted.
1247         * NetworkProcess/NetworkProcess.h:
1248         * UIProcess/Network/NetworkProcessProxy.cpp:
1249         (WebKit::NetworkProcessProxy::didClose):
1250         (WebKit::NetworkProcessProxy::setIsIDBDatabaseHoldingLockedFiles): Deleted.
1251         * UIProcess/Network/NetworkProcessProxy.h:
1252         * UIProcess/Network/NetworkProcessProxy.messages.in:
1253
1254 2019-04-09  Chris Dumez  <cdumez@apple.com>
1255
1256         Loads using loadHTMLString() cause flashing when process-swapping
1257         https://bugs.webkit.org/show_bug.cgi?id=196714
1258         <rdar://problem/49637354>
1259
1260         Reviewed by Antti Koivisto.
1261
1262         Our logic to decide if we should construct a SuspendedPageProxy on process-swap was assuming
1263         a SuspendedPageProxy is only useful for PageCache and would therefore not create one if PageCache
1264         is disabled or if there is no associated WebBackForwardListItem. However, constructing a
1265         SuspendedPageProxy is also useful to prevent flashing when process-swapping as we need to keep
1266         displaying the layer of the previous process until there is something meaningful to show in the
1267         new process.
1268
1269         This patch makes it so that we now construct a SuspendedPageProxy on process-swap, even if
1270         PageCache is disabled or if there is no associated WebBackForwardListItem. The process in
1271         question will not be useful for PageCache but it will avoid flashing. The SuspendedPageProxy's
1272         process may also get used for future navigations to the same site (as demonstrated by the
1273         API test) which is beneficial for performance.
1274
1275         * UIProcess/SuspendedPageProxy.cpp:
1276         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1277         * UIProcess/SuspendedPageProxy.h:
1278         * UIProcess/WebPageProxy.cpp:
1279         (WebKit::WebPageProxy::suspendCurrentPageIfPossible):
1280         * UIProcess/WebProcessPool.cpp:
1281         (WebKit::WebProcessPool::findReusableSuspendedPageProcess):
1282
1283 2019-04-08  Don Olmstead  <don.olmstead@sony.com>
1284
1285         [CMake][WinCairo] Separate copied headers into different directories
1286         https://bugs.webkit.org/show_bug.cgi?id=196655
1287
1288         Reviewed by Michael Catanzaro.
1289
1290         * CMakeLists.txt:
1291         * PlatformWin.cmake:
1292
1293 2019-04-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1294
1295         [iOS] Do not allow starting selection drags when selection views are not visible
1296         https://bugs.webkit.org/show_bug.cgi?id=196686
1297         <rdar://problem/49399192>
1298
1299         Reviewed by Tim Horton.
1300
1301         Currently, on iOS, it's possible to start dragging selected text in a web view even if the selection itself is
1302         not visible. This can happen if the user selects some text, focuses a native text field, and then long presses
1303         the previously selected text. This is because the text is still selected in the document since we don't clear
1304         the selection when resigning first responder on iOS, despite the fact that the native selection view is no
1305         longer present.
1306
1307         To fix this, we add plumbing to specify the set of allowed drag source actions when requesting drag start; this
1308         set of allowed drag source actions only includes DragSourceActionSelection if the selection view can be visible
1309         (i.e. the content view is first responder, and isn't suppressing text interactions). We then update WebPage's
1310         allowed drag source actions with this given set of actions, while sending "dragstart" to the page.
1311
1312         * UIProcess/WebPageProxy.h:
1313         * UIProcess/ios/WKContentViewInteraction.mm:
1314         (-[WKContentView hasSelectablePositionAtPoint:]):
1315         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1316
1317         Only bail out of text selection in text that is already selected if the web view allows dragging text selections
1318         (i.e. the web view is first responder, and is not suppressing text interactions).
1319
1320         (-[WKContentView _allowedDragSourceActions]):
1321         (-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
1322         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
1323
1324         Pass the set of allowed drag source actions when requesting a drag start or adding items to an existing session.
1325
1326         * UIProcess/ios/WebPageProxyIOS.mm:
1327         (WebKit::WebPageProxy::requestDragStart):
1328         (WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
1329
1330         Plumb the allowed drag source actions from the UI process (WKContentView) over to the web process (WebPage).
1331
1332         * WebProcess/WebCoreSupport/WebDragClient.cpp:
1333         (WebKit::WebDragClient::dragSourceActionMaskForPoint):
1334
1335         Instead of always returning Any, consult WebPage's allowed drag source actions.
1336
1337         * WebProcess/WebPage/WebPage.h:
1338         (WebKit::WebPage::allowedDragSourceActions const):
1339         * WebProcess/WebPage/WebPage.messages.in:
1340         * WebProcess/WebPage/ios/WebPageIOS.mm:
1341         (WebKit::WebPage::requestDragStart):
1342         (WebKit::WebPage::requestAdditionalItemsForDragSession):
1343
1344         Set WebPage's allowed drag source actions to the given set of actions when sending a drag start to the page.
1345
1346 2019-04-08  Justin Fan  <justin_fan@apple.com>
1347
1348         [Web GPU] Fix Web GPU experimental feature on iOS
1349         https://bugs.webkit.org/show_bug.cgi?id=196632
1350
1351         Reviewed by Myles C. Maxfield.
1352
1353         Add feature conditionals for iOS 11.
1354         Properly make Web GPU available on iOS 11+.
1355
1356         * Configurations/FeatureDefines.xcconfig:
1357         * Configurations/WebKitTargetConditionals.xcconfig:
1358
1359 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1360
1361         Fix selector name after r243834
1362         https://bugs.webkit.org/show_bug.cgi?id=196549
1363
1364         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1365         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1366         I forgot the colon in the setter's name.
1367
1368 2019-04-08  Antti Koivisto  <antti@apple.com>
1369
1370         Compute touch actions for touch point from remote layer tree regions
1371         https://bugs.webkit.org/show_bug.cgi?id=196701
1372
1373         Reviewed by Simon Fraser.
1374
1375         Add a function for finding the right layer and getting the touch actions in UI process side.
1376
1377         The code is not used yet.
1378
1379         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
1380         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1381         (WebKit::touchActionsForPoint):
1382
1383         Use the same code as overlap hit testing for collecting the candidate layers for the touch point,
1384         taking event regions into account.
1385         Return the touch actions from the deepest event sensitive layer hit.
1386
1387         (-[UIView _web_findDescendantViewAtPoint:withEvent:]):
1388
1389         Modernize.
1390
1391 2019-04-08  Brent Fulgham  <bfulgham@apple.com>
1392
1393         Make HSTS list handling more robust against unexpected content 
1394         https://bugs.webkit.org/show_bug.cgi?id=196552
1395         <rdar://problem/43403817>
1396
1397         Reviewed by Chris Dumez.
1398
1399         Crash logs indicate we sometimes encounter null key values during processing.
1400         This patch adds some debug assertions to catch this in test environments, and
1401         allows the code to skip the bad entries if encountered.
1402
1403         It also avoids calling CFDictionaryApplyFunction when the HSTS policies returned
1404         by _CFNetworkCopyHSTSPolicies is nullptr, which is a possible return value.
1405
1406         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1407         (WebKit::filterPreloadHSTSEntry):
1408         (WebKit::NetworkProcess::getHostNamesWithHSTSCache):
1409
1410 2019-04-05  Brian Burg  <bburg@apple.com>
1411
1412         Web Automation: clean up some WebAutomationSession methods to use modern async IPC
1413         https://bugs.webkit.org/show_bug.cgi?id=196168
1414
1415         Reviewed by Devin Rousso.
1416
1417         Modern WebKit IPC is capable of providing completion handlers and can track callback IDs.
1418         So, most messages between WebAutomationSession and its proxy can use this facility and stop
1419         keeping track of callback IDs manually. This makes most code easier to read on both the
1420         sender and receiver side.
1421
1422         There are two cases that could not be converted:
1423         - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to
1424         be able to cancel all pending replies when a page navigates away, the web process crashes,
1425         or when handling an alert.
1426         - For takeScreenshot, there is not currently support in the modern async IPC code paths for
1427         sending the result back. ShareableBitmap and friends lack a modern decoder implementation.
1428
1429         * UIProcess/Automation/WebAutomationSession.cpp:
1430         (WebKit::WebAutomationSession::resolveChildFrameHandle):
1431         (WebKit::WebAutomationSession::resolveParentFrameHandle):
1432         (WebKit::WebAutomationSession::computeElementLayout):
1433         (WebKit::WebAutomationSession::selectOptionElement):
1434         (WebKit::WebAutomationSession::getAllCookies):
1435         (WebKit::WebAutomationSession::deleteSingleCookie):
1436         (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
1437         (WebKit::WebAutomationSession::didResolveChildFrame): Deleted.
1438         (WebKit::WebAutomationSession::didResolveParentFrame): Deleted.
1439         (WebKit::WebAutomationSession::didComputeElementLayout): Deleted.
1440         (WebKit::WebAutomationSession::didSelectOptionElement): Deleted.
1441         (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted.
1442         (WebKit::WebAutomationSession::didDeleteCookie): Deleted.
1443         * UIProcess/Automation/WebAutomationSession.h:
1444         * UIProcess/Automation/WebAutomationSession.messages.in:
1445         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1446         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
1447         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
1448         (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
1449         (WebKit::WebAutomationSessionProxy::resolveParentFrame):
1450         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1451         (WebKit::WebAutomationSessionProxy::selectOptionElement):
1452         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
1453         (WebKit::WebAutomationSessionProxy::deleteCookie):
1454         * WebProcess/Automation/WebAutomationSessionProxy.h:
1455         * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
1456
1457 2019-04-08  Alex Christensen  <achristensen@webkit.org>
1458
1459         REGRESSION(236463) DownloadManager can call a null CompletionHandler
1460         https://bugs.webkit.org/show_bug.cgi?id=196414
1461         <rdar://problem/48389434>
1462
1463         Reviewed by Geoff Garen.
1464
1465         * NetworkProcess/NetworkResourceLoader.cpp:
1466         (WebKit::NetworkResourceLoader::convertToDownload):
1467         DownloadManager::continueDecidePendingDownloadDestination is being called when there is no completion handler.
1468         r236463 introduced an unchecked code path that can allow this to happen.
1469
1470 2019-04-07  Commit Queue  <commit-queue@webkit.org>
1471
1472         Unreviewed, rolling out r243956.
1473         https://bugs.webkit.org/show_bug.cgi?id=196688
1474
1475         Broke API Test SafeBrowsing.WKWebViewGoBackIFrame (Requested
1476         by aakashjain on #webkit).
1477
1478         Reverted changeset:
1479
1480         "Clicking "Go Back" from a safe browsing warning from an
1481         iframe should navigate the WKWebView back to the previous
1482         page"
1483         https://bugs.webkit.org/show_bug.cgi?id=196665
1484         https://trac.webkit.org/changeset/243956
1485
1486 2019-04-07  Geoffrey Garen  <ggaren@apple.com>
1487
1488         Remove stray byte added by r241131
1489         https://bugs.webkit.org/show_bug.cgi?id=196682
1490
1491         Reviewed by Alexey Proskuryakov.
1492
1493         Sublime Text thinks WKWebView.mm is binary instead of text.
1494
1495         According to online documentation and bisecting, this is because r241131
1496         introduced a stray byte (probably a null byte?) into the file.
1497
1498         I fixed this with Cmd-C Cmd-V.
1499
1500         * UIProcess/API/Cocoa/WKWebView.mm:
1501         (-[WKWebView _initializeWithConfiguration:]):
1502
1503 2019-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1504
1505         Hide next and previous form control buttons when WKWebView is editable
1506         https://bugs.webkit.org/show_bug.cgi?id=196672
1507         <rdar://problem/35625321>
1508
1509         Reviewed by Tim Horton.
1510
1511         Adopt new UIKit SPI to hide or show next and previous controls in the form accessory view when changing
1512         editability.
1513
1514         Test: KeyboardInputTests.FormNavigationAssistantBarButtonItems
1515
1516         * Platform/spi/ios/UIKitSPI.h:
1517         * UIProcess/API/Cocoa/WKWebView.mm:
1518         (-[WKWebView _setEditable:]):
1519         * UIProcess/ios/WKContentViewInteraction.h:
1520         * UIProcess/ios/WKContentViewInteraction.mm:
1521         (-[WKContentView _updateAccessory]):
1522         (-[WKContentView _didChangeWebViewEditability]):
1523
1524 2019-04-06  Antti Koivisto  <antti@apple.com>
1525
1526         Combine event and touch action regions into a single class
1527         https://bugs.webkit.org/show_bug.cgi?id=196644
1528         <rdar://problem/49643614>
1529
1530         Reviewed by Darin Adler.
1531
1532         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
1533         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1534         (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
1535         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1536         (WebKit::RemoteLayerTreeNode::eventRegion const):
1537         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1538         (WebKit::RemoteLayerTreeNode::setEventRegion):
1539         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1540         (WebKit::PlatformCALayerRemote::setEventRegion):
1541         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
1542
1543 2019-04-05  Yongjun Zhang  <yongjun_zhang@apple.com>
1544
1545         We should pass minimumEffectiveDeviceWidth to web process on new page creation.
1546         https://bugs.webkit.org/show_bug.cgi?id=196077
1547         <rdar://problem/49108202>
1548
1549         Reviewed by Chris Dumez.
1550
1551         When a new web view is created, it is possible we don't have the web content process till a load
1552         is requested. This patch stashes minimumEffectiveDeviceWidth in WebPageProxy.cpp and passes that
1553         value down to web process via WebPageCreationParameters when a new process is created, just like
1554         we did for other values like viewportConfigurationLayoutSizeScaleFactor or viewportConfigurationViewLayoutSize.
1555
1556         * Shared/WebPageCreationParameters.cpp:
1557         (WebKit::WebPageCreationParameters::encode const): Encode viewportConfigurationMinimumEffectiveDeviceWidth value.
1558         (WebKit::WebPageCreationParameters::decode): Decode viewportConfigurationMinimumEffectiveDeviceWidth value.
1559         * Shared/WebPageCreationParameters.h:
1560         * UIProcess/API/Cocoa/WKWebView.mm: Now that we stash the minimumEffectiveDeviceWidth value in WebPageProxy, we
1561             don't need the iVar in WKWebView any more.
1562         (-[WKWebView _dispatchSetViewLayoutSize:]): Use _page->minimumEffectiveDeviceWidth().
1563         (-[WKWebView _setViewScale:]): Ditto.
1564         (-[WKWebView _setMinimumEffectiveDeviceWidth:]): Ditto.
1565         (-[WKWebView _minimumEffectiveDeviceWidth]): Ditto.
1566         * UIProcess/WebPageProxy.cpp:
1567         (WebKit::WebPageProxy::creationParameters): Also add viewportConfigurationMinimumEffectiveDeviceWidth to
1568             web process creation parameter.
1569         * UIProcess/WebPageProxy.h:
1570         (WebKit::WebPageProxy::minimumEffectiveDeviceWidth const): Returns m_viewportConfigurationMinimumEffectiveDeviceWidth.
1571         * UIProcess/ios/WebPageProxyIOS.mm:
1572         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Pass parameters.viewportConfigurationMinimumEffectiveDeviceWidth
1573             to web process.
1574         * WebProcess/WebPage/WebPage.cpp:
1575         (WebKit::WebPage::WebPage): Take viewportConfigurationMinimumEffectiveDeviceWidth value from the parameter and
1576             set that to viewport configuration.
1577
1578 2019-04-05  Jer Noble  <jer.noble@apple.com>
1579
1580         [Cocoa] Deactivate the audio session before the WebProcess suspends.
1581         https://bugs.webkit.org/show_bug.cgi?id=196658
1582
1583         Reviewed by Eric Carlson.
1584
1585         Notify the PlatformMediaSessionManager when the process suspends or resumes.
1586
1587         * WebProcess/WebProcess.cpp:
1588         (WebKit::WebProcess::actualPrepareToSuspend):
1589         (WebKit::WebProcess::cancelPrepareToSuspend):
1590         (WebKit::WebProcess::processDidResume):
1591
1592 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1593
1594         [iOS] Web process gets suspended while holding locked database files
1595         https://bugs.webkit.org/show_bug.cgi?id=196519
1596         <rdar://problem/49531797>
1597
1598         Reviewed by Chris Dumez.
1599
1600         * WebProcess/WebProcess.cpp:
1601         (WebKit::WebProcess::actualPrepareToSuspend):
1602
1603 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1604
1605         Clicking "Go Back" from a safe browsing warning from an iframe should navigate the WKWebView back to the previous page
1606         https://bugs.webkit.org/show_bug.cgi?id=196665
1607         <rdar://45115669>
1608
1609         Reviewed by Geoff Garen.
1610
1611         It is insufficient to just not navigate the subframe.  We must leave the page that contained it.
1612
1613         * UIProcess/API/Cocoa/WKWebView.mm:
1614         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
1615         * UIProcess/Cocoa/WebViewImpl.mm:
1616         (WebKit::WebViewImpl::showSafeBrowsingWarning):
1617
1618 2019-04-05  Alex Christensen  <achristensen@webkit.org>
1619
1620         Undeprecate WKNavigationData
1621         https://bugs.webkit.org/show_bug.cgi?id=196559
1622         <rdar://44927425>
1623
1624         Reviewed by Geoff Garen.
1625
1626         * UIProcess/API/Cocoa/WKNavigationData.h:
1627         It is used to communicate information from FrameLoaderClient::updateGlobalHistory() to the application.
1628         This use in WKBrowsingContextHistoryDelegate is definitely still deprecated, but its use in
1629         WKHistoryDelegatePrivate does not have an adequate replacement yet, so it must remain undeprecated SPI.
1630
1631 2019-04-05  Sihui Liu  <sihui_liu@apple.com>
1632
1633         [iOS] Web process gets suspended while holding locked database files
1634         https://bugs.webkit.org/show_bug.cgi?id=196519
1635         <rdar://problem/49531797>
1636
1637         Reviewed by Chris Dumez.
1638
1639         * Shared/WebSQLiteDatabaseTracker.cpp:
1640         (WebKit::WebSQLiteDatabaseTracker::~WebSQLiteDatabaseTracker):
1641         * Shared/WebSQLiteDatabaseTracker.h:
1642         * WebProcess/WebProcess.cpp:
1643         (WebKit::m_webSQLiteDatabaseTracker):
1644         (WebKit::WebProcess::actualPrepareToSuspend):
1645         (WebKit::WebProcess::processWillSuspendImminently):
1646         (WebKit::WebProcess::cancelPrepareToSuspend):
1647         (WebKit::WebProcess::processDidResume):
1648         * WebProcess/WebProcess.h:
1649
1650 2019-04-05  Commit Queue  <commit-queue@webkit.org>
1651
1652         Unreviewed, rolling out r243833.
1653         https://bugs.webkit.org/show_bug.cgi?id=196645
1654
1655         This change breaks build of WPE and GTK ports (Requested by
1656         annulen on #webkit).
1657
1658         Reverted changeset:
1659
1660         "[CMake][WTF] Mirror XCode header directories"
1661         https://bugs.webkit.org/show_bug.cgi?id=191662
1662         https://trac.webkit.org/changeset/243833
1663
1664 2019-04-05  David Kilzer  <ddkilzer@apple.com>
1665
1666         REGRESSION(r240685): Remove duplicate Headers entry for _WKInspectorWindow.h in Xcode project
1667         <https://bugs.webkit.org/show_bug.cgi?id=193951>
1668         <rdar://problem/47621366>
1669
1670         Fixes the following build warnings:
1671             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installhdrs/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1672             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_installapi/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1673             Warning: Multiple build commands for output file WebKit2_WebKit.roots/BuildRecords/WebKit2_install/Root/System/Library/Frameworks/WebKit.framework/PrivateHeaders/_WKInspectorWindow.h
1674
1675         * WebKit.xcodeproj/project.pbxproj: Remove duplicate entry for
1676         _WKInspectorWindow.h.  In r240685, a second Headers entry was
1677         added, but the first one was never removed.
1678
1679 2019-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1680
1681         [ATK] Use a smart pointer for AccessibilityObject wrapper and remove GTK specific code
1682         https://bugs.webkit.org/show_bug.cgi?id=196593
1683         <rdar://problem/49599153>
1684
1685         Reviewed by Michael Catanzaro.
1686
1687         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp:
1688         (accessibilityRootObjectWrapper): Cast wrapper() as AtkObject.
1689
1690 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1691
1692         Simple iframe scrolling test fails to get a composited scrolling frame in WebKitTestRunnerApp
1693         https://bugs.webkit.org/show_bug.cgi?id=196635
1694
1695         Reviewed by Antti Koivisto.
1696
1697         Remove WKBundleSetAsyncFrameScrollingEnabled().
1698
1699         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
1700         (WKBundleSetAsyncFrameScrollingEnabled): Deleted.
1701         * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
1702
1703 2019-04-04  Simon Fraser  <simon.fraser@apple.com>
1704
1705         [iOS WK2] REGRESSION (r242687): Programmatic scroll of overflow scroll results in bad rendering
1706         https://bugs.webkit.org/show_bug.cgi?id=195584
1707
1708         Reviewed by Zalan Bujtas.
1709
1710         Push data to the scrolling tree about whether an overflow:scroll scroll was programmatic, by having
1711         RenderLayer::scrollToOffset() call into AsyncScrollingCoordinator::requestScrollPositionUpdate(),
1712         just as we do for frames.
1713
1714         AsyncScrollingCoordinator::requestScrollPositionUpdate() is generalized to take any ScrollableArea.
1715
1716         Fix an assumption in the ScrollingTree that we only care about programmatic scrolls on the root node.
1717         ScrollingTree::commitTreeState() no longer sets isHandlingProgrammaticScroll; instead,
1718         callers of ScrollingTreeScrollingNode::scrollTo() pass a ScrollType. Commit functions pass
1719         ScrollType::Programmatic when handling RequestedScrollPosition changes as necessary.
1720
1721         Programmatic scrolls need to get to the scrolling tree in the UI process so that we update
1722         the tree's notion of scroll position, and trigger actual UIScrollView scrolls (layers may have
1723         already been put in the right locations, but the UI process needs to know that a scroll happened).
1724         However, we need to prevent notifications from programmatic scrolls getting back to the
1725         web process, because this causes jumpiness. This is done via an early return in
1726         RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll().
1727
1728         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1729         (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll):
1730         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
1731         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren): Subframe nodes have
1732         a delegate, and that will take care of the requestedScrollPosition update.
1733         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
1734         * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
1735         (WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren):
1736         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
1737         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren):
1738
1739 2019-04-04  Ryan Haddad  <ryanhaddad@apple.com>
1740
1741         Unreviewed, rolling out r243888.
1742
1743         Introduced layout test crashes.
1744
1745         Reverted changeset:
1746
1747         "[macOS][iOS] Add filter to syscall sandbox rule"
1748         https://bugs.webkit.org/show_bug.cgi?id=196613
1749         https://trac.webkit.org/changeset/243888
1750
1751 2019-04-04  Youenn Fablet  <youenn@apple.com>
1752
1753         Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
1754         https://bugs.webkit.org/show_bug.cgi?id=196543
1755
1756         Reviewed by Alex Christensen.
1757
1758         Renamed methods used to set cache storage quota to be storage generic
1759         since they will apply to all storage.
1760
1761         Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
1762         to NetworkProcess (start-up time and new WebsiteDataStore time).
1763
1764         Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
1765
1766         * NetworkProcess/NetworkProcess.cpp:
1767         (WebKit::NetworkProcess::initializeNetworkProcess):
1768         (WebKit::NetworkProcess::addWebsiteDataStore):
1769         (WebKit::NetworkProcess::initializeStorageQuota):
1770         (WebKit::NetworkProcess::setCacheStorageParameters):
1771         * NetworkProcess/NetworkProcess.h:
1772         * NetworkProcess/NetworkProcess.messages.in:
1773         * Shared/WebsiteDataStoreParameters.cpp:
1774         (WebKit::WebsiteDataStoreParameters::encode const):
1775         (WebKit::WebsiteDataStoreParameters::decode):
1776         * Shared/WebsiteDataStoreParameters.h:
1777         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1778         (WKWebsiteDataStoreSetPerOriginStorageQuota):
1779         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
1780         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1781         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1782         (-[WKWebsiteDataStore _perOriginStorageQuota]):
1783         (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
1784         (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
1785         (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
1786         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
1787         * UIProcess/Network/NetworkProcessProxy.cpp:
1788         (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
1789         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1790         (WebKit::WebsiteDataStore::parameters):
1791         * UIProcess/WebsiteData/WebsiteDataStore.h:
1792         (WebKit::WebsiteDataStore::perOriginStorageQuota const):
1793         (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
1794         (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
1795         (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
1796         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
1797         (WebKit::WebsiteDataStoreConfiguration::copy):
1798         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
1799         (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
1800         (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
1801         (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
1802         (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
1803
1804 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1805
1806         Changing default website policies shouldn't change default website policies in subsequent navigations
1807         https://bugs.webkit.org/show_bug.cgi?id=196562
1808         <rdar://problem/49573377>
1809
1810         Reviewed by Tim Horton.
1811
1812         Currently, changing the default WKWebpagePreferences object when deciding navigation policy causes the set of
1813         default policies to change in subsequent navigations. Among other things, this prevents clients from passing
1814         a modified version of the default website policies into the decision handler without impacting future
1815         navigations. To fix this, teach API::WebsitePolicies to make a copy of itself, and then use this to pass a copy
1816         of the default website policies to the navigation delegate when deciding navigation policies.
1817
1818         Test: DoNotAllowChangingDefaultWebpagePreferencesInDelegateMethod
1819
1820         * UIProcess/API/APIWebsitePolicies.cpp:
1821         (API::WebsitePolicies::copy const):
1822
1823         Add a helper method to copy a set of website policies.
1824
1825         * UIProcess/API/APIWebsitePolicies.h:
1826         * UIProcess/Cocoa/NavigationState.mm:
1827         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1828
1829 2019-04-04  Michael Catanzaro  <mcatanzaro@igalia.com>
1830
1831         Unreviewed, fix -Wreturn-type warning
1832
1833         * Shared/WebsiteData/WebsiteData.cpp:
1834         (WebKit::WebsiteData::ownerProcess):
1835
1836 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1837
1838         [macOS] Fix sandbox violations
1839         https://bugs.webkit.org/show_bug.cgi?id=196616
1840         <rdar://problem/49498040>
1841
1842         Reviewed by Brent Fulgham.
1843
1844         Fix some observed sandbox violations in the WebContent process on macOS.
1845
1846         * WebProcess/com.apple.WebProcess.sb.in:
1847
1848 2019-04-04  Eric Carlson  <eric.carlson@apple.com>
1849
1850         [MediaStream] Host should be able to mute screen capture and camera/microphone independently
1851         https://bugs.webkit.org/show_bug.cgi?id=196555
1852         <rdar://problem/47303865>
1853
1854         Reviewed by Youenn Fablet.
1855
1856         * UIProcess/API/C/WKPagePrivate.h: Add kWKMediaScreenCaptureMuted.
1857
1858         * UIProcess/API/Cocoa/WKWebView.mm:
1859         (-[WKWebView _setPageMuted:]):
1860         (-[WKWebView _setMediaCaptureMuted:]): Deleted, it was unused.
1861         (-[WKWebView _muteMediaCapture]): Deleted, it was unused.
1862         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1863
1864         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
1865         (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): Fix
1866         a log comment typo.
1867
1868         * UIProcess/WebPageProxy.cpp:
1869         (WebKit::WebPageProxy::setMediaStreamCaptureMuted): Use the new flag.
1870         (WebKit::WebPageProxy::activateMediaStreamCaptureInPage): Ditto.
1871         (WebKit::WebPageProxy::setMuted): Ditto.
1872         * UIProcess/WebPageProxy.h:
1873         (WebKit::WebPageProxy::isMediaStreamCaptureMuted const): Ditto.
1874
1875 2019-04-04  Per Arne Vollan  <pvollan@apple.com>
1876
1877         [macOS][iOS] Add filter to syscall sandbox rule
1878         https://bugs.webkit.org/show_bug.cgi?id=196613
1879         <rdar://problem/49531420>
1880
1881         Reviewed by Brent Fulgham.
1882
1883         This will restrict the existing sandbox rule for the syscall.
1884
1885         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
1886         * WebProcess/com.apple.WebProcess.sb.in:
1887
1888 2019-04-04  Youenn Fablet  <youenn@apple.com>
1889
1890         Service Worker Process does not have the right domain name
1891         https://bugs.webkit.org/show_bug.cgi?id=196585
1892
1893         Reviewed by Chris Dumez.
1894
1895         * Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
1896         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
1897         Updated extraInitializationData to go from "security-origin" to "registrable-domain".
1898
1899 2019-04-04  Chris Dumez  <cdumez@apple.com>
1900
1901         Temporarily disable delayed WebProcess launch on iOS to address PLT regression
1902         https://bugs.webkit.org/show_bug.cgi?id=196604
1903         <rdar://problem/49074131>
1904
1905         Reviewed by Geoffrey Garen.
1906
1907         Temporarily disable delayed WebProcess launch on iOS to address PLT regression. This
1908         is while I figure out how to enable this on iOS without regressed PLT.
1909
1910         * UIProcess/WebProcessPool.h:
1911
1912 2019-04-04  Miguel Gomez  <magomez@igalia.com>
1913
1914         [CoordGraphics] Revalidate need for 'coordinated update completion' in ThreadedCompositor
1915         https://bugs.webkit.org/show_bug.cgi?id=188839
1916
1917         Reviewed by Žan Doberšek.
1918
1919         Even if a platform layer has changed, don't wait for a main thread callback to finish the
1920         CompositingRunLoop update. It can be finished as soon as we receive the frameComplete signal.
1921
1922         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
1923         (WebKit::CompositingRunLoop::scheduleUpdate):
1924         (WebKit::CompositingRunLoop::stopUpdates):
1925         (WebKit::CompositingRunLoop::updateCompleted):
1926         (WebKit::CompositingRunLoop::updateTimerFired):
1927         (WebKit::CompositingRunLoop::compositionCompleted): Deleted.
1928         * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
1929         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1930         (WebKit::ThreadedCompositor::renderLayerTree):
1931         (WebKit::ThreadedCompositor::sceneUpdateFinished):
1932         (WebKit::ThreadedCompositor::displayRefreshMonitor):
1933         (WebKit::ThreadedCompositor::handleDisplayRefreshMonitorUpdate): Deleted.
1934         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
1935         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
1936         (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
1937
1938 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1939
1940         [ATK] Cleanup WebPageAccessibilityObjectAtk
1941         https://bugs.webkit.org/show_bug.cgi?id=196537
1942
1943         Reviewed by Michael Catanzaro.
1944
1945         Several changes and cleanups:
1946
1947          - Add WebKit prefix so that style checker doesn't complain about GObject conventions.
1948          - Rename the header to remove the Atk prefix to match the cpp file and class name.
1949          - Use pragma once.
1950          - Use nullptr instead of 0.
1951          - Use WEBKIT_DEFINE_TYPE instead of G_DEFINE_TYPE.
1952          - Return generic AtkObject* from constructor.
1953
1954         * SourcesGTK.txt:
1955         * WebProcess/WebPage/WebPage.h:
1956         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.cpp: Renamed from Source/WebKit/WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp.
1957         (accessibilityRootObjectWrapper):
1958         (webkitWebPageAccessibilityObjectInitialize):
1959         (webkitWebPageAccessibilityObjectGetIndexInParent):
1960         (webkitWebPageAccessibilityObjectGetNChildren):
1961         (webkitWebPageAccessibilityObjectRefChild):
1962         (webkit_web_page_accessibility_object_class_init):
1963         (webkitWebPageAccessibilityObjectNew):
1964         (webkitWebPageAccessibilityObjectRefresh):
1965         * WebProcess/WebPage/atk/WebKitWebPageAccessibilityObject.h: Added.
1966         * WebProcess/WebPage/atk/WebPageAccessibilityObject.h: Removed.
1967         * WebProcess/WebPage/gtk/WebPageGtk.cpp:
1968         (WebKit::WebPage::platformInitialize):
1969         (WebKit::WebPage::updateAccessibilityTree):
1970
1971 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1972
1973         [ATK] Set ATK_STATE_TRANSIENT on the atk socket until it's embedded
1974         https://bugs.webkit.org/show_bug.cgi?id=196535
1975
1976         Reviewed by Michael Catanzaro.
1977
1978         This way the properties are not cached. Right now, if number of children is queried before the socket is
1979         embedded, 0 is returned and cached, so ATs don't see the child even after the socket has been embedded.
1980
1981         * UIProcess/API/gtk/WebKitWebViewBaseAccessible.cpp:
1982         (webkitWebViewBaseAccessibleRefStateSet): Set ATK_STATE_TRANSIENT is the socket is not occupied.
1983         * UIProcess/gtk/WebPageProxyGtk.cpp:
1984         (WebKit::WebPageProxy::bindAccessibilityTree): Unset ATK_STATE_TRANSIENT.
1985
1986 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1987
1988         [ATK] Embed the AtkSocket as soon as we receive the plug ID
1989         https://bugs.webkit.org/show_bug.cgi?id=196534
1990
1991         Reviewed by Michael Catanzaro.
1992
1993         We are currently storing the ID and waiting for the next time get_accessible is called to embed the socket. We
1994         can simply embed the socket when the plug ID is received.
1995
1996         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1997         (webkitWebViewBaseGetAccessible):
1998         * UIProcess/WebPageProxy.h:
1999         * UIProcess/gtk/WebPageProxyGtk.cpp:
2000         (WebKit::WebPageProxy::bindAccessibilityTree):
2001
2002 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2003
2004         [ATK] Don't touch accessibility tree in WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld
2005         https://bugs.webkit.org/show_bug.cgi?id=193914
2006
2007         Reviewed by Michael Catanzaro.
2008
2009         Move it to dispatchDidFinishDocumentLoad, since we know we have the document at that point and we can create the
2010         root accessibility object wrapper.
2011
2012         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2013         (WebKit::WebFrameLoaderClient::dispatchDidFinishDocumentLoad):
2014         (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
2015
2016 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2017
2018         Simplify some "programmaticScroll" code paths
2019         https://bugs.webkit.org/show_bug.cgi?id=196589
2020
2021         Reviewed by Zalan Bujtas.
2022
2023         * WebProcess/WebPage/RemoteLayerTree/RemoteScrollingCoordinator.mm: Remove the parameter.
2024         (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): Use the enum type.
2025         * WebProcess/WebPage/ios/WebPageIOS.mm:
2026         (WebKit::WebPage::updateVisibleContentRects):
2027
2028 2019-04-03  Chris Dumez  <cdumez@apple.com>
2029
2030         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash
2031         https://bugs.webkit.org/show_bug.cgi?id=196588
2032         <rdar://problem/49365787>
2033
2034         Reviewed by Ryosuke Niwa.
2035
2036         The page's focusedFrame / frameSetLargestFrame do not get cleared on process swap or crash.
2037         This can lead to returning stale frames to the client if it asks for those.
2038
2039         * UIProcess/WebPageProxy.cpp:
2040         (WebKit::WebPageProxy::resetState):
2041
2042 2019-04-03  Simon Fraser  <simon.fraser@apple.com>
2043
2044         Remove the isProgrammaticScroll argument to requestScroll() because no-one uses it
2045         https://bugs.webkit.org/show_bug.cgi?id=196587
2046
2047         Reviewed by Zalan Bujtas.
2048
2049         This argument was unused.
2050
2051         * UIProcess/API/gtk/PageClientImpl.cpp:
2052         (WebKit::PageClientImpl::requestScroll):
2053         * UIProcess/API/gtk/PageClientImpl.h:
2054         * UIProcess/API/wpe/PageClientImpl.cpp:
2055         (WebKit::PageClientImpl::requestScroll):
2056         * UIProcess/API/wpe/PageClientImpl.h:
2057         * UIProcess/PageClient.h:
2058         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2059         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
2060         * UIProcess/WebPageProxy.cpp:
2061         (WebKit::WebPageProxy::requestScroll):
2062         * UIProcess/WebPageProxy.h:
2063         * UIProcess/ios/PageClientImplIOS.h:
2064         * UIProcess/ios/PageClientImplIOS.mm:
2065         (WebKit::PageClientImpl::requestScroll):
2066         * UIProcess/mac/PageClientImplMac.h:
2067         * UIProcess/mac/PageClientImplMac.mm:
2068         (WebKit::PageClientImpl::requestScroll):
2069         * UIProcess/win/PageClientImpl.cpp:
2070         (WebKit::PageClientImpl::requestScroll):
2071         * UIProcess/win/PageClientImpl.h:
2072
2073 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2074
2075         -apple-trailing-word is needed for browser detection
2076         https://bugs.webkit.org/show_bug.cgi?id=196575
2077
2078         Unreviewed.
2079
2080         * Configurations/FeatureDefines.xcconfig:
2081
2082 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2083
2084         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2085         https://bugs.webkit.org/show_bug.cgi?id=196526
2086         <rdar://problem/49532923>
2087
2088         Reviewed by Tim Horton.
2089
2090         Change UseModernCompatibilityModeByDefault from an internal preference to a debug preference, so that it may be
2091         enabled for all apps on the system.
2092
2093         * Shared/WebPreferences.yaml:
2094
2095 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2096
2097         Fix internal build after r243829
2098         https://bugs.webkit.org/show_bug.cgi?id=196549
2099
2100         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2101         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2102         Some SDK's don't include this selector in the header.
2103         Use NSSelectorFromString.
2104
2105 2019-04-03  Don Olmstead  <don.olmstead@sony.com>
2106
2107         [CMake][WTF] Mirror XCode header directories
2108         https://bugs.webkit.org/show_bug.cgi?id=191662
2109
2110         Reviewed by Konstantin Tokarev.
2111
2112         Use WTFFramework as a dependency and include frameworks/WTF.cmake for AppleWin internal
2113         builds.
2114
2115         * CMakeLists.txt:
2116
2117 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2118
2119         Add SPI to disable legacy TLS fallback
2120         https://bugs.webkit.org/show_bug.cgi?id=196549
2121         <rdar://44979744>
2122
2123         Reviewed by Geoffrey Garen.
2124
2125         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2126         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2127         (WebKit::NetworkSessionCreationParameters::encode const):
2128         (WebKit::NetworkSessionCreationParameters::decode):
2129         * NetworkProcess/NetworkSessionCreationParameters.h:
2130         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2131         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2132         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2133         (-[WKWebsiteDataStore _setAllowsTLSFallback:]):
2134         (-[WKWebsiteDataStore _allowsTLSFallback]):
2135         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2136         * UIProcess/WebProcessPool.cpp:
2137         (WebKit::WebProcessPool::ensureNetworkProcess):
2138         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2139         (WebKit::WebsiteDataStore::parameters):
2140         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2141         (WebKit::WebsiteDataStore::setSourceApplicationSecondaryIdentifier):
2142         (WebKit::WebsiteDataStore::setAllowsTLSFallback):
2143         (WebKit::WebsiteDataStore::setSourceApplicationBundleIdentifier):
2144         * UIProcess/WebsiteData/WebsiteDataStore.h:
2145         (WebKit::WebsiteDataStore::allowsTLSFallback const):
2146         (WebKit::WebsiteDataStore::networkingHasBegun):
2147         (WebKit::WebsiteDataStore::finalizeApplicationIdentifiers): Deleted.
2148
2149 2019-04-03  Myles C. Maxfield  <mmaxfield@apple.com>
2150
2151         Remove support for -apple-trailing-word
2152         https://bugs.webkit.org/show_bug.cgi?id=196525
2153
2154         Reviewed by Zalan Bujtas.
2155
2156         This CSS property is nonstandard and not used.
2157
2158         * Configurations/FeatureDefines.xcconfig:
2159
2160 2019-04-03  Alex Christensen  <achristensen@webkit.org>
2161
2162         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
2163         https://bugs.webkit.org/show_bug.cgi?id=196476
2164
2165         Reviewed by Chris Dumez.
2166
2167         Re-apply a change I reverted in r241754 now that it's safe to do so.
2168
2169         * UIProcess/WebPageProxy.cpp:
2170         (WebKit::WebPageProxy::didCommitLoadForFrame):
2171
2172 2019-04-03  Daniel Bates  <dabates@apple.com>
2173
2174         [iOS] Should be able to dismiss picker or popover using the keyboard
2175         https://bugs.webkit.org/show_bug.cgi?id=196272
2176         <rdar://problem/48943170>
2177
2178         Reviewed by Wenson Hsieh.
2179
2180         Intercept key events and route them to the current input peripheral (if we have one). Add a base key event handler
2181         for all form peripherals that dismisses the accessory when either the Escape key is pressed or Command + . is pressed.
2182         I will fix this issue for the file upload picker/popover in <https://bugs.webkit.org/show_bug.cgi?id=196287>.
2183
2184         * SourcesCocoa.txt: Add file WKFormPeripheralBase.mm.
2185         * UIProcess/ios/WKContentViewInteraction.mm:
2186         (-[WKContentView endEditingAndUpdateFocusAppearanceWithReason]): Added.
2187         (-[WKContentView resignFirstResponderForWebView]): Write in terms of -endEditingAndUpdateFocusAppearance.
2188         (-[WKContentView inputView]): Code style nit while I am here; add an empty line to demarcate the "crazy"
2189         code that the FIXME is referring to and should ideally be removed from the code that is sane to always do.
2190         (-[WKContentView accessoryDone]): When the accessory is dismissed via the Done button (iPhone) or by pressing
2191         Escape or Command + . using a hardware keyboard (iPhone or iPad) then end the current editing session, but
2192         do not resign first responder status as the page activation state should not be changed.
2193         (-[WKContentView _handleKeyUIEvent:]): Bring back this code when building with USE(UIKIT_KEYBOARD_ADDITIONS)
2194         as we need to route key events to the input peripheral (if we have one). If the input peripheral handles it
2195         then we're done: no need to let UIKit or WebKit handle it when building with USE(UIKIT_KEYBOARD_ADDITIONS),
2196         respectively. If the input peripheral does not handle it then do what we do now.
2197         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2198         If the element is re-focused and we have an input peripheral then we want to ensure we are first responder,
2199         reveal the focused element, update the accessory and tell the peripheral that editing has begun (again).
2200         For all other element re-focusing where we don't have a peripheral do what we do now. Also, update _isEditable
2201         to reflect whether the focused element contains selectable text. This is what UIKit wants to know when it queries
2202         -isEditable. Now that we no longer blur the focused element on iPad when the popover is dismissed and keep the
2203         peripheral until there is a focus change we need to ensure that we give the correct answer to UIKit on view
2204         editability. Otherwise, UIKit thinks it needs to update the text selection state when a popup button is tapped
2205         again (as part of its gesture recognizer logic) and this causes an assertion failure in UIKit after it calls back
2206         into us to ask for selection details, which we correctly respond with the equivalent of "we have none" and is
2207         not the answer UIKit expects since we told it we are editable. (Currently we manage to get away with telling UIKit
2208         we are always editable because it is not possible to perform a selection operation when we have a popover open.
2209         Closing the popover blurs the element, setting -isEditable to NO and deallocates the peripheral avoiding this issue).
2210         * UIProcess/ios/forms/WKFormColorControl.h:
2211         * UIProcess/ios/forms/WKFormColorControl.mm:
2212         (-[WKColorPopover controlEndEditing]): Dismiss the popover.
2213         (-[WKFormColorControl initWithView:]): Modified to call base class initializer.
2214         (-[WKFormColorControl assistantView]): Deleted.
2215         (-[WKFormColorControl beginEditing]): Deleted.
2216         (-[WKFormColorControl endEditing]): Deleted.
2217         * UIProcess/ios/forms/WKFormInputControl.h:
2218         * UIProcess/ios/forms/WKFormInputControl.mm:
2219         (-[WKFormInputControl initWithView:]): Modified to call base class initializer.
2220         (-[WKFormInputControl dateTimePickerCalendarType]): Write in terms of self.control.
2221         (-[WKDateTimePopover controlEndEditing]): Dismiss the popover and tell the controller that editing ended.
2222         (-[WKFormInputControl beginEditing]): Deleted.
2223         (-[WKFormInputControl endEditing]): Deleted.
2224         (-[WKFormInputControl assistantView]): Deleted.
2225         * UIProcess/ios/forms/WKFormPeripheral.h:
2226         * UIProcess/ios/forms/WKFormPeripheralBase.h: Added.
2227         * UIProcess/ios/forms/WKFormPeripheralBase.mm: Added.
2228         (-[WKFormPeripheralBase initWithView:control:]): Take ownership of the passed WKFormControl.
2229         (-[WKFormPeripheralBase beginEditing]): Turn around and tell the control.
2230         (-[WKFormPeripheralBase endEditing]): Ditto.
2231         (-[WKFormPeripheralBase assistantView]): Ditto.
2232         (-[WKFormPeripheralBase control]): Return the control.
2233         (-[WKFormPeripheralBase handleKeyEvent:]): Dismiss the accessory (in the same way we dismiss when the Done
2234         button is pressed on iPhone) on keydown of the Escape key or when we receive a UIKeyInputEscape event (for
2235         Command + .).
2236         * UIProcess/ios/forms/WKFormSelectControl.h:
2237         * UIProcess/ios/forms/WKFormSelectControl.mm:
2238         (-[WKFormSelectControl initWithView:]): Modified to call base class initializer.
2239         (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]): Write in terms of self.control.
2240         (-[WKFormSelectControl selectFormPopoverTitle]): Ditto.
2241         (-[WKFormSelectControl assistantView]): Deleted.
2242         (-[WKFormSelectControl beginEditing]): Deleted.
2243         (-[WKFormSelectControl endEditing]): Deleted.
2244         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2245         (-[WKSelectPopover controlEndEditing]): Dismiss the popover.
2246         * WebKit.xcodeproj/project.pbxproj: Add files WKFormPeripheralBase.{h, mm}.
2247
2248 2019-04-03  Youenn Fablet  <youenn@apple.com>
2249
2250         Resetting quota should take into account third party origins
2251         https://bugs.webkit.org/show_bug.cgi?id=196462
2252
2253         Reviewed by Geoffrey Garen.
2254
2255         When clearing the storage quota, we were resetting it to the default value
2256         without taking care of whether third party or not.
2257         Updated the code to ensure that the default quota is computed based on the origin.
2258
2259         Updated existing test to cover this case.
2260
2261         * NetworkProcess/NetworkProcess.cpp:
2262         (WebKit::NetworkProcess::clearStorageQuota):
2263         (WebKit::NetworkProcess::setCacheStorageParameters):
2264         (WebKit::NetworkProcess::updateQuotaBasedOnSpaceUsageForTesting):
2265         (WebKit::NetworkProcess::storageQuotaManager):
2266         * NetworkProcess/NetworkProcess.h:
2267         (WebKit::NetworkProcess::StorageQuotaManagers::defaultQuota const):
2268         (WebKit::NetworkProcess::StorageQuotaManagers::setDefaultQuotas):
2269         (WebKit::NetworkProcess::StorageQuotaManagers::managersPerOrigin):
2270
2271 2019-04-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2272
2273         Get rid of HTMLInputElement::setEditingValue
2274         https://bugs.webkit.org/show_bug.cgi?id=196402
2275
2276         Reviewed by Darin Adler.
2277
2278         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp:
2279         (webkit_dom_element_html_input_element_set_editing_value):
2280         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLInputElement.cpp:
2281         (webkit_dom_html_input_element_set_editing_value):
2282
2283 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2284
2285         Add a WebKit internal feature flag to always enable modern compatibility mode by default
2286         https://bugs.webkit.org/show_bug.cgi?id=196526
2287         <rdar://problem/49532923>
2288
2289         Reviewed by Antoine Quint.
2290
2291         * Shared/WebPreferences.yaml:
2292
2293 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2294
2295         Introduce and add plumbing for a website policy for meta viewport tag handling
2296         https://bugs.webkit.org/show_bug.cgi?id=196285
2297
2298         Reviewed by Tim Horton.
2299
2300         Add WebsiteMetaViewportPolicy, a bit that can be used to determine whether to respect or ignore the meta
2301         viewport tag and use native web page parameters instead of the default parameters.
2302
2303         * Shared/WebsiteMetaViewportPolicy.h: Copied from Source/WebKit/Shared/WebsitePoliciesData.h.
2304         * Shared/WebsitePoliciesData.cpp:
2305         (WebKit::WebsitePoliciesData::encode const):
2306         (WebKit::WebsitePoliciesData::decode):
2307         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2308
2309         Convert WebKit::WebsiteMetaViewportPolicy into WebCore::MetaViewportPolicy.
2310
2311         * Shared/WebsitePoliciesData.h:
2312         * UIProcess/API/APIWebsitePolicies.cpp:
2313         (API::WebsitePolicies::data):
2314         * UIProcess/API/APIWebsitePolicies.h:
2315
2316         Add additional plumbing for the policy flag.
2317
2318         * WebKit.xcodeproj/project.pbxproj:
2319         * WebProcess/WebPage/ios/WebPageIOS.mm:
2320         (WebKit::WebPage::resetViewportDefaultConfiguration):
2321
2322         Use native web page parameters if either "shouldIgnoreMetaViewport" is enabled, or the new policy is set.
2323         Eventually, the policy should completely replace the former preference once no internal clients depend on it.
2324
2325 2019-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2326
2327         Add plumbing for a compatibility mode preference in WebKit
2328         https://bugs.webkit.org/show_bug.cgi?id=196005
2329
2330         Reviewed by Tim Horton.
2331
2332         Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
2333         (API::WebsitePolicies) for compatibility mode.
2334
2335         * Shared/WebCompatibilityMode.h: Added.
2336         * UIProcess/API/APIWebsitePolicies.h:
2337         * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
2338         * UIProcess/Cocoa/NavigationState.mm:
2339         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2340         * UIProcess/WebPageProxy.cpp:
2341         (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
2342         * UIProcess/WebPageProxy.h:
2343         * UIProcess/ios/WebPageProxyIOS.mm:
2344         * WebKit.xcodeproj/project.pbxproj:
2345
2346 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2347
2348         [CoordinatedGraphics] Hidden pages are not suspended after a web view resize
2349         https://bugs.webkit.org/show_bug.cgi?id=196487
2350
2351         Reviewed by Žan Doberšek.
2352
2353         When resizing the window, the hidden tabs are updated too, to avoid flickering or getting the old size when
2354         switching tabs. For that we need to resume painting but we are not suspending it again after the update.
2355
2356         * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
2357         (WebKit::DrawingAreaCoordinatedGraphics::updateBackingStoreState): Suspend the painting again after a
2358         synchronous update if needed.
2359
2360 2019-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2361
2362         Web Inspector: [GTK] Copy copies to nowhere
2363         https://bugs.webkit.org/show_bug.cgi?id=181228
2364
2365         Reviewed by Michael Catanzaro.
2366
2367         The thing is that those items are actually submenu items, with options, for example in the case of Copy to copy
2368         HTML, Text, XPath, etc. We are not correctly handling submenus when populating the context menu received from
2369         the web process.
2370
2371         * UIProcess/gtk/WebContextMenuProxyGtk.cpp:
2372         (WebKit::WebContextMenuProxyGtk::populateSubMenu): Helper to populate submenu items recursively.
2373         (WebKit::WebContextMenuProxyGtk::populate): Handle submenu items.
2374         * UIProcess/gtk/WebContextMenuProxyGtk.h:
2375
2376 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2377
2378         [Cocoa] Add new API around WKWebpagePreferences in WKNavigationDelegate and WKWebViewConfiguration
2379         https://bugs.webkit.org/show_bug.cgi?id=196284
2380         <rdar://problem/47228232>
2381
2382         Reviewed by Tim Horton.
2383
2384         Tests for both of these APIs will be added in a subsequent patch.
2385
2386         * Shared/API/Cocoa/WebKit.h:
2387         * UIProcess/API/APIPageConfiguration.cpp:
2388         (API::PageConfiguration::defaultWebsitePolicies const):
2389         (API::PageConfiguration::setDefaultWebsitePolicies):
2390         * UIProcess/API/APIPageConfiguration.h:
2391         * UIProcess/API/Cocoa/WKNavigationDelegate.h:
2392
2393         Add a new navigation delegate hook to allow clients to return a WKWebpagePreference targeting the given
2394         navigation action.
2395
2396         * UIProcess/API/Cocoa/WKWebView.mm:
2397         (-[WKWebView _initializeWithConfiguration:]):
2398         * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
2399         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2400
2401         Add new API on WKWebViewConfiguration to specify a default WKWebpagePreference to use when navigating.
2402
2403         (-[WKWebViewConfiguration copyWithZone:]):
2404         (-[WKWebViewConfiguration defaultWebpagePreferences]):
2405         (-[WKWebViewConfiguration setDefaultWebpagePreferences:]):
2406         * UIProcess/API/Cocoa/WKWebpagePreferences.h:
2407         * UIProcess/Cocoa/NavigationState.h:
2408         * UIProcess/Cocoa/NavigationState.mm:
2409         (WebKit::NavigationState::setNavigationDelegate):
2410         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2411
2412         Invoke the new WKWebpagePreferences-based navigation delegate method.
2413
2414         * WebKit.xcodeproj/project.pbxproj:
2415         * mac/postprocess-framework-headers.sh:
2416         * mac/replace-webkit-additions-in-framework-headers.sh: Added.
2417
2418         Move logic in the "Postprocess Framework Headers" step responsible for stripping away included files from
2419         WebKitAdditions out into a separate build phase, called "Replace WebKitAdditions in Framework Headers". This
2420         ensures headers attempting to include from WebKitAdditions have these additional statements removed.
2421
2422 2019-04-02  Geoffrey Garen  <ggaren@apple.com>
2423
2424         Eliminate plugin sandbox exceptions
2425         https://bugs.webkit.org/show_bug.cgi?id=196510
2426
2427         Reviewed by Chris Dumez.
2428
2429         * PluginProcess/mac/PluginProcessMac.mm:
2430         (WebKit::PluginProcess::initializeSandbox):
2431         * UIProcess/Plugins/PluginInfoStore.cpp:
2432         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2433         * UIProcess/Plugins/PluginInfoStore.h:
2434         * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
2435         (WebKit::PluginInfoStore::shouldUsePlugin):
2436         (WebKit::PluginInfoStore::shouldAllowPluginToRunUnsandboxed): Deleted.
2437
2438 2019-04-02  Alex Christensen  <achristensen@webkit.org>
2439
2440         Fix assertion in http/tests/adClickAttribution/store-ad-click-attribution.html
2441         https://bugs.webkit.org/show_bug.cgi?id=196503
2442
2443         Reviewed by Chris Dumez.
2444
2445         In WebPageProxy::didDestroyNavigation we try to ignore a request to destroy a navigation from a page being navigated from
2446         during a cross-site navigation, but if the old web process sends the message after WebPageProxy::commitProvisionalPage
2447         has been called, we can still destroy a navigation when we are continuing a navigation in another process.  To prevent this,
2448         have the process not send the message when it knows the navigation is continuing in another process.
2449         Also make the use of unchecked navigation pointers more robust by checking it for nullity.
2450
2451         * UIProcess/WebPageProxy.cpp:
2452         (WebKit::WebPageProxy::didCommitLoadForFrame):
2453         * WebProcess/WebPage/WebFrame.cpp:
2454         (WebKit::WebFrame::didReceivePolicyDecision):
2455         (WebKit::WebFrame::documentLoaderDetached):
2456         * WebProcess/WebPage/WebFrame.h:
2457
2458 2019-04-02  Per Arne Vollan  <pvollan@apple.com>
2459
2460         [iOS] Fix iokit-get-properties sandbox violation in the WebContent process
2461         https://bugs.webkit.org/show_bug.cgi?id=196500
2462         <rdar://problem/49497788>
2463
2464         Reviewed by Brent Fulgham.
2465
2466         Attempting to get the iokit properties 'product-description', 'artwork-display-gamut' and
2467         'artwork-scale-factor' is causing sandbox violations.
2468
2469         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
2470
2471 2019-04-02  Chris Dumez  <cdumez@apple.com>
2472
2473         [WK2] Add support for Window's beforeprint / afterprint events
2474         https://bugs.webkit.org/show_bug.cgi?id=196478
2475
2476         Reviewed by Alex Christensen.
2477
2478         Add support for Window's beforeprint / afterprint events as per:
2479         - https://html.spec.whatwg.org/#dom-print
2480
2481         Blink and Gecko already support this.
2482
2483         * WebProcess/WebPage/WebPage.cpp:
2484         (WebKit::WebPage::beginPrinting):
2485         (WebKit::WebPage::endPrinting):
2486
2487 2019-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2488
2489         REGRESSION (r243726): Crash at unrecognized selector: -[WKWebpagePreferences webpagePreferences]
2490         https://bugs.webkit.org/show_bug.cgi?id=196496
2491         <rdar://problem/49521634>
2492
2493         Reviewed by Chris Dumez.
2494
2495         r243726 made an incorrect assumption that all callers of -decidePolicyForNavigationAction:decisionHandler: and
2496         -decidePolicyForNavigationAction:userInfo:decisionHandler: must be instances of _WKWebsitePolicies, as opposed
2497         to the new WKWebpagePreferences. However, it's possible for clients (in this case, Safari) to already generate
2498         and pass in an instance of WKWebpagePreferences by bridging the C API opaque ref (WKWebsitePoliciesRef) into the
2499         Objective-C object (which is now WKWebpagePreferences, after my change).
2500
2501         To maintain binary compatibility of trunk WebKit against prior versions of Safari, we need to handle both
2502         WKWebpagePreferences and the soon-to-be-deprecated _WKWebsitePolicies in the navigation action policy decision
2503         handler.
2504
2505         Tests:  WebKit.WebsitePoliciesWithBridgingCast
2506                 WebKit.WebsitePoliciesWithUnexpectedType
2507
2508         * UIProcess/Cocoa/NavigationState.mm:
2509         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2510
2511 2019-04-01  Chris Dumez  <cdumez@apple.com>
2512
2513         Unreviewed, drop debug logging landed as part of r242903 by mistake.
2514
2515         * UIProcess/WebPageProxy.cpp:
2516         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2517
2518 2019-04-01  Remy Demarest  <rdemarest@apple.com>
2519
2520         Add SPI to give injected bundles access to displayed PDFDocuments
2521         https://bugs.webkit.org/show_bug.cgi?id=196471
2522         <rdar://problem/48080768>
2523
2524         Reviewed by Tim Horton.
2525
2526         * WebKit.xcodeproj/project.pbxproj:
2527
2528         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.h: Added.
2529         * WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm: Added.
2530         (WKBundlePageGetPDFDocumentInFrame):
2531
2532 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2533
2534         [WebKit2] Introduce a public version of WKWebsitePolicies
2535         https://bugs.webkit.org/show_bug.cgi?id=195989
2536         <rdar://problem/47228232>
2537
2538         Reviewed by Tim Horton.
2539
2540         Expose the existing _WKWebsitePolicies object as WKWebpagePreferences, in what will eventually become a public
2541         header in the WebKit SDK (WKWebpagePreferences.h). Following a similar transitioning strategy as
2542         _WKWebsiteDataStore and WKWebsiteDataStore, we move existing logic from _WKWebsitePolicies to WKWebpagePreferences
2543         and make _WKWebsitePolicies a wrapper around WKWebpagePreferences.
2544
2545         No change in behavior.
2546
2547         * Shared/Cocoa/APIObject.mm:
2548         (API::Object::newObject):
2549
2550         Wrap API::WebsitePolicies with WKWebpagePreferences.
2551
2552         * SourcesCocoa.txt:
2553         * UIProcess/API/Cocoa/WKWebView.mm:
2554         (-[WKWebView _updateWebsitePolicies:]):
2555         * UIProcess/API/Cocoa/WKWebpagePreferences.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2556         * UIProcess/API/Cocoa/WKWebpagePreferences.mm: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm.
2557
2558         Introduce WKWebpagePreferences.
2559
2560         (+[WKWebpagePreferences defaultPreferences]):
2561         (-[WKWebpagePreferences dealloc]):
2562         (-[WKWebpagePreferences init]):
2563         (-[WKWebpagePreferences _setContentBlockersEnabled:]):
2564         (-[WKWebpagePreferences _contentBlockersEnabled]):
2565         (-[WKWebpagePreferences _setAllowedAutoplayQuirks:]):
2566         (-[WKWebpagePreferences _allowedAutoplayQuirks]):
2567         (-[WKWebpagePreferences _setAutoplayPolicy:]):
2568         (-[WKWebpagePreferences _autoplayPolicy]):
2569         (-[WKWebpagePreferences _setDeviceOrientationAndMotionAccessPolicy:]):
2570         (-[WKWebpagePreferences _deviceOrientationAndMotionAccessPolicy]):
2571         (-[WKWebpagePreferences _setPopUpPolicy:]):
2572         (-[WKWebpagePreferences _popUpPolicy]):
2573         (-[WKWebpagePreferences _customHeaderFields]):
2574         (-[WKWebpagePreferences _setCustomHeaderFields:]):
2575         (-[WKWebpagePreferences _websiteDataStore]):
2576         (-[WKWebpagePreferences _setWebsiteDataStore:]):
2577         (-[WKWebpagePreferences _setCustomUserAgent:]):
2578         (-[WKWebpagePreferences _customUserAgent]):
2579         (-[WKWebpagePreferences _setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2580         (-[WKWebpagePreferences _customJavaScriptUserAgentAsSiteSpecificQuirks]):
2581         (-[WKWebpagePreferences _setCustomNavigatorPlatform:]):
2582         (-[WKWebpagePreferences _customNavigatorPlatform]):
2583         (-[WKWebpagePreferences _apiObject]):
2584         * UIProcess/API/Cocoa/WKWebpagePreferencesInternal.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h.
2585         * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: Copied from Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h.
2586
2587         Reintroduce all the interfaces currently available on _WKWebsitePolicies as underscore-prefixed SPI on
2588         WKWebpagePreferences.
2589
2590         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2591         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2592
2593         Make _WKWebsitePolicies wrap WKWebpagePreferences, and plumb all existing SPI on WKWebsitePolicies through to
2594         WKWebpagePreferences.
2595
2596         (-[_WKWebsitePolicies init]):
2597         (-[_WKWebsitePolicies webpagePreferences]):
2598         (-[_WKWebsitePolicies setContentBlockersEnabled:]):
2599         (-[_WKWebsitePolicies contentBlockersEnabled]):
2600         (-[_WKWebsitePolicies setAllowedAutoplayQuirks:]):
2601         (-[_WKWebsitePolicies allowedAutoplayQuirks]):
2602         (-[_WKWebsitePolicies setAutoplayPolicy:]):
2603         (-[_WKWebsitePolicies autoplayPolicy]):
2604         (-[_WKWebsitePolicies setDeviceOrientationAndMotionAccessPolicy:]):
2605         (-[_WKWebsitePolicies deviceOrientationAndMotionAccessPolicy]):
2606         (-[_WKWebsitePolicies setPopUpPolicy:]):
2607         (-[_WKWebsitePolicies popUpPolicy]):
2608         (-[_WKWebsitePolicies customHeaderFields]):
2609         (-[_WKWebsitePolicies setCustomHeaderFields:]):
2610         (-[_WKWebsitePolicies websiteDataStore]):
2611         (-[_WKWebsitePolicies setWebsiteDataStore:]):
2612         (-[_WKWebsitePolicies setCustomUserAgent:]):
2613         (-[_WKWebsitePolicies customUserAgent]):
2614         (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]):
2615         (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]):
2616         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2617         (-[_WKWebsitePolicies customNavigatorPlatform]):
2618         (-[_WKWebsitePolicies description]):
2619         (-[_WKWebsitePolicies _apiObject]):
2620         (-[_WKWebsitePolicies dealloc]): Deleted.
2621         * UIProcess/API/Cocoa/_WKWebsitePoliciesInternal.h:
2622         * UIProcess/Cocoa/NavigationState.mm:
2623         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2624         * WebKit.xcodeproj/project.pbxproj:
2625
2626 2019-04-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2627
2628         Unable to copy and paste a PDF from Notes into Mail compose body
2629         https://bugs.webkit.org/show_bug.cgi?id=196442
2630         <rdar://problem/48573098>
2631
2632         Reviewed by Tim Horton.
2633
2634         Relax the -canPerformAction: logic in the case of pasting an attachment. Consider an NSItemProvider to possibly
2635         paste as an attachment if either it has a preferred presentation style of UIPreferredPresentationStyleAttachment
2636         or has a style of UIPreferredPresentationStyleUnspecified, but has a suggested file name.
2637
2638         This allows for the "Paste" action to be shown in the callout menu when copying and pasting a non-text file.
2639
2640         * UIProcess/ios/WKContentViewInteraction.mm:
2641         (-[WKContentView canPerformActionForWebView:withSender:]):
2642
2643 2019-04-01  Tim Horton  <timothy_horton@apple.com>
2644
2645         Make UIWKDocumentContext rects per-character instead of per-word
2646         https://bugs.webkit.org/show_bug.cgi?id=196459
2647
2648         Reviewed by Wenson Hsieh.
2649
2650         * WebProcess/WebPage/ios/WebPageIOS.mm:
2651         (WebKit::WebPage::requestDocumentEditingContext):
2652         Switch to CharacterIterator instead of TextIterator directly, to get
2653         per-character rects as the API requests.
2654
2655 2019-04-01  Chris Dumez  <cdumez@apple.com>
2656
2657         UIProcess crash when a prewarmed process is terminated
2658         https://bugs.webkit.org/show_bug.cgi?id=196451
2659         <rdar://problem/49245471>
2660
2661         Reviewed by Geoffrey Garen.
2662
2663         Stop assuming that WebProcessProxy::m_websiteDataStore is non-null as this is no longer
2664         true after r243384. For example, prewarmed WebContent processe do not get a data store
2665         until they actually get used.
2666
2667         * UIProcess/API/Cocoa/WKProcessPool.mm:
2668         (-[WKProcessPool _prewarmedProcessIdentifier]):
2669         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2670         * UIProcess/WebProcessPool.cpp:
2671         (WebKit::WebProcessPool::networkProcessIdentifier):
2672         (WebKit::WebProcessPool::prewarmedProcessIdentifier):
2673         * UIProcess/WebProcessPool.h:
2674         * UIProcess/WebProcessProxy.cpp:
2675         (WebKit::WebProcessProxy::didClose):
2676         (WebKit::WebProcessProxy::didFinishLaunching):
2677         (WebKit::WebProcessProxy::requestTermination):
2678         (WebKit::WebProcessProxy::isReleaseLoggingAllowed const):
2679         * UIProcess/WebProcessProxy.h:
2680
2681 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2682
2683         [GTK][WPE] Add more websitedatastore directories to web process sandbox
2684         https://bugs.webkit.org/show_bug.cgi?id=196447
2685
2686         Reviewed by Michael Catanzaro.
2687
2688         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2689         (WebKit::bubblewrapSpawn):
2690         * UIProcess/glib/WebProcessProxyGLib.cpp:
2691         (WebKit::WebProcessProxy::platformGetLaunchOptions):
2692
2693 2019-04-01  Per Arne Vollan  <pvollan@apple.com>
2694
2695         [macOS] Crash when loading Twitter with autoplay video enabled.
2696         https://bugs.webkit.org/show_bug.cgi?id=196446
2697         <rdar://problem/49060359>
2698
2699         Reviewed by Brent Fulgham.
2700
2701         This is caused by a syscall violation.
2702
2703         * WebProcess/com.apple.WebProcess.sb.in:
2704
2705 2019-04-01  Patrick Griffis  <pgriffis@igalia.com>
2706
2707         [GTK][WPE] Fix seccomp rule for blacklisting TIOCSTI
2708         https://bugs.webkit.org/show_bug.cgi?id=196297
2709
2710         Reviewed by Michael Catanzaro.
2711
2712         More information can be found here: https://www.exploit-db.com/exploits/46594
2713
2714         Note that this sandbox never made it into production so does not
2715         warrant any CVE specific to WebKit.
2716
2717         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
2718         (WebKit::setupSeccomp):
2719
2720 2019-03-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2721
2722         [iOS] Crash when changing inputmode for certain types of focusable elements
2723         https://bugs.webkit.org/show_bug.cgi?id=196431
2724         <rdar://problem/49454962>
2725
2726         Reviewed by Tim Horton.
2727
2728         The crash is happening because WebPage::focusedElementDidChangeInputMode assumes that the document's focused
2729         element must be the same as m_focusedElement in WebPage. However, this is not the case, since m_focusedElement
2730         is only set for certain types of elements that require user input (e.g. text fields, editable content, select
2731         menus, etc.). The function then attempts to dereference m_focusedElement, which may be null if the document's
2732         focused element doesn't fall into one of the aforementioned categories.
2733
2734         To fix this, bail if the element that is changing inputmode is not equal to the WebPage's current focused
2735         element. See below for more details.
2736
2737         Test: fast/forms/change-inputmode-crash.html
2738
2739         * WebProcess/WebPage/WebPage.cpp:
2740         (WebKit::isTextFormControlOrEditableContent):
2741
2742         Clean up some existing logic by introducing a helper method for determining whether an element should
2743         propagate inputmode attribute changes to the UI process. Also, check the element type using type traits instead
2744         of checking against the tag name.
2745
2746         (WebKit::WebPage::elementDidFocus):
2747         (WebKit::WebPage::focusedElementDidChangeInputMode):
2748
2749 2019-03-31  Sam Weinig  <weinig@apple.com>
2750
2751         Remove more i386 specific configurations
2752         https://bugs.webkit.org/show_bug.cgi?id=196430
2753
2754         Reviewed by Alexey Proskuryakov.
2755
2756         * Configurations/BaseTarget.xcconfig:
2757         WK_HAVE_CORE_PREDICTION can now be enabled unconditionally.
2758  
2759         * Configurations/FeatureDefines.xcconfig:
2760         ENABLE_WEB_AUTHN_macosx can now be enabled unconditionally on macOS.
2761
2762 2019-03-31  Andy Estes  <aestes@apple.com>
2763
2764         [iOS] WebKit should consult the navigation response policy delegate before previewing a QuickLook document
2765         https://bugs.webkit.org/show_bug.cgi?id=196433
2766         <rdar://problem/49293305>
2767
2768         Reviewed by Tim Horton.
2769
2770         Added WKWebViewConfiguration SPI for setting the QuickLook navigation response policy
2771         decision behavior. The configuration setting defaults to YES for clients linked on or after
2772         this WebKit change and NO otherwise.
2773
2774         * NetworkProcess/NetworkResourceLoader.cpp:
2775         (WebKit::NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions):
2776         * Shared/WebPreferences.yaml:
2777         * Shared/ios/QuickLookDocumentData.cpp:
2778         (WebKit::QuickLookDocumentData::isEmpty const):
2779         * Shared/ios/QuickLookDocumentData.h:
2780         * UIProcess/API/Cocoa/WKWebView.mm:
2781         (-[WKWebView _initializeWithConfiguration:]):
2782         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
2783         (defaultShouldDecidePolicyBeforeLoadingQuickLookPreview):
2784         (-[WKWebViewConfiguration init]):
2785         (-[WKWebViewConfiguration encodeWithCoder:]):
2786         (-[WKWebViewConfiguration initWithCoder:]):
2787         (-[WKWebViewConfiguration copyWithZone:]):
2788         (-[WKWebViewConfiguration _shouldDecidePolicyBeforeLoadingQuickLookPreview]):
2789         (-[WKWebViewConfiguration _setShouldDecidePolicyBeforeLoadingQuickLookPreview:]):
2790         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2791         * UIProcess/Cocoa/VersionChecks.h:
2792         * WebProcess/WebCoreSupport/ios/WebPreviewLoaderClient.cpp:
2793         (WebKit::WebPreviewLoaderClient::didReceiveDataArray):
2794
2795 2019-03-30  Zalan Bujtas  <zalan@apple.com>
2796
2797         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
2798         https://bugs.webkit.org/show_bug.cgi?id=196408
2799         <rdar://problem/49436797>
2800
2801         Reviewed by Simon Fraser.
2802
2803         Hover intent fails when an unrelated frame commits a load the same time.
2804         cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
2805         (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
2806
2807         * WebProcess/WebPage/ios/WebPageIOS.mm:
2808         (WebKit::WebPage::cancelPotentialTap):
2809         (WebKit::WebPage::cancelPotentialTapInFrame):
2810
2811 2019-03-29  John Wilander  <wilander@apple.com>
2812
2813         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
2814         https://bugs.webkit.org/show_bug.cgi?id=196407
2815         <rdar://problem/47859936>
2816
2817         Reviewed by Brent Fulgham.
2818
2819         The two WebResourceLoadStatisticsStore IPC endpoints were left behind when we
2820         moved Resource Load Statistics from the UI process to the network process. One
2821         of the endpoints is the message RequestStorageAccessUnderOpener which underpins
2822         our compatibility fix for federated logins using popups. This patch redirects
2823         these IPC calls to the network process and cleans up some assumptions around
2824         them.
2825
2826         * CMakeLists.txt:
2827             Removed the old IPC receiver.
2828         * DerivedSources.make:
2829             Removed the old IPC receiver.
2830         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
2831         (WebKit::WebResourceLoadStatisticsStore::requestUpdate): Deleted.
2832             This is no longer needed since there is a dedicated update mechanism
2833             that actually sends the update.
2834         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2835         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2836         (WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
2837         (WebKit::NetworkConnectionToWebProcess::requestStorageAccessUnderOpener):
2838             Two new IPC receivers to pipe the calls to the network process.
2839         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate): Deleted.
2840             NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated now serves
2841             this purpose.
2842         * NetworkProcess/NetworkConnectionToWebProcess.h:
2843         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2844         * UIProcess/WebResourceLoadStatisticsStore.messages.in: Removed.
2845             Removed the old IPC receiver.
2846         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2847         * WebKit.xcodeproj/project.pbxproj:
2848         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
2849         (WKBundleResourceLoadStatisticsNotifyObserver):
2850             Function name update.
2851         * WebProcess/WebProcess.cpp:
2852             Now calls IPC to the network process instead of the UI process.
2853
2854 2019-03-29  Myles C. Maxfield  <mmaxfield@apple.com>
2855
2856         Delete WebMetal implementation in favor of WebGPU
2857         https://bugs.webkit.org/show_bug.cgi?id=195418
2858
2859         Reviewed by Dean Jackson.
2860
2861         * Configurations/FeatureDefines.xcconfig:
2862         * Shared/WebPreferences.yaml:
2863         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2864         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2865
2866 2019-03-29  Takashi Komori  <Takashi.Komori@sony.com>
2867
2868         [Curl] Add Server Trust Evaluation Support.
2869         https://bugs.webkit.org/show_bug.cgi?id=191646
2870
2871         Reviewed by Fujii Hironori.
2872
2873         Tests: http/tests/ssl/iframe-upgrade.https.html
2874                http/tests/ssl/mixedContent/insecure-websocket.html
2875                http/tests/ssl/upgrade-origin-usage.html
2876
2877         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
2878         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
2879         (WebKit::NetworkDataTaskCurl::tryServerTrustEvaluation):
2880         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2881         * NetworkProcess/curl/NetworkDataTaskCurl.h:
2882
2883 2019-03-29  Cathie Chen  <cathiechen@igalia.com>
2884
2885         Implement ResizeObserver.
2886         https://bugs.webkit.org/show_bug.cgi?id=157743
2887
2888         Reviewed by Simon Fraser.
2889
2890         Add WebPreferences and FeatureDefines for ResizeObserver.
2891
2892         * Configurations/FeatureDefines.xcconfig:
2893         * Shared/WebPreferences.yaml:
2894
2895 2019-03-28  Timothy Hatcher  <timothy@apple.com>
2896
2897         CFDictionary encoder crashes on non-string keys.
2898         https://bugs.webkit.org/show_bug.cgi?id=196388
2899         rdar://problem/49339242
2900
2901         Reviewed by Ryosuke Niwa.
2902
2903         Allow non-string keys in CFDictionary encoding/decoding. Encode the correct
2904         size for dictionaries and arrays when unknown keys or values are skipped.
2905         Allow null array encoding and decoding like dictionary already allowed.
2906
2907         * Shared/cf/ArgumentCodersCF.cpp:
2908         (IPC::encode):
2909         (IPC::decode):
2910
2911 2019-03-28  John Wilander  <wilander@apple.com>
2912
2913         Resource Load Statistics: IPC to the WebsiteDataStore in the UI process from NetworkProcess::deleteWebsiteDataForRegistrableDomains()
2914         https://bugs.webkit.org/show_bug.cgi?id=196281
2915         <rdar://problem/48938748>
2916
2917         Reviewed by Alex Christensen.
2918
2919         The move of Resource Load Statistics to the network process requires that it
2920         calls the UI process when clearing website data (previously the other way
2921         around). This patch achieves that.
2922
2923         Specifically, NetworkProcess::deleteWebsiteDataForRegistrableDomains() now
2924         filters its WebsiteDataTypes down to just the ones applicable for the UI
2925         process and then calls DeleteWebsiteDataInUIProcessForRegistrableDomains over
2926         IPC.
2927
2928         NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains() on
2929         the UI process side makes use of the re-introduced
2930         WebsiteDataStore::fetchDataForRegistrableDomains() function to get the relevant
2931         data records and call WebsiteDataStore::removeData(). The re-introduced
2932         WebsiteDataStore::fetchDataForRegistrableDomains() was removed as dead code in
2933         https://trac.webkit.org/changeset/242056/webkit, then under the name
2934         WebsiteDataStore::fetchDataForTopPrivatelyControlledDomains(). The reason it
2935         was dead code was the lack of IPC call that this patch adds.
2936
2937         * NetworkProcess/NetworkProcess.cpp:
2938         (WebKit::NetworkProcess::deleteWebsiteDataForRegistrableDomains):
2939            Now calls DeleteWebsiteDataInUIProcessForRegistrableDomains over IPC if there
2940            are WebsiteDataTypes applicable to the UI process.
2941         * NetworkProcess/NetworkProcess.h:
2942         * Shared/WebsiteData/WebsiteData.cpp:
2943         (WebKit::WebsiteData::ownerProcess):
2944         (WebKit::WebsiteData::filter):
2945             Convenience functions to manage process ownership of website data types.
2946         * Shared/WebsiteData/WebsiteData.h:
2947         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2948         (WKWebsiteDataStoreStatisticsHasLocalStorage):
2949             Test infrastructure, called by the TestRunner.
2950         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2951         * UIProcess/Network/NetworkProcessProxy.cpp:
2952         (WebKit::NetworkProcessProxy::deleteWebsiteDataInUIProcessForRegistrableDomains):
2953             New function to be called from the network process.
2954         * UIProcess/Network/NetworkProcessProxy.h:
2955         * UIProcess/Network/NetworkProcessProxy.messages.in:
2956         * UIProcess/WebsiteData/WebsiteDataRecord.cpp:
2957         (WebKit::WebsiteDataRecord::matches const):
2958             Now matches with WebCore::RegistrableDomain instead of a string.
2959         (WebKit::WebsiteDataRecord::matchesTopPrivatelyControlledDomain const): Deleted.
2960             Replaced by WebsiteDataRecord::matches().
2961         * UIProcess/WebsiteData/WebsiteDataRecord.h:
2962         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2963         (WebKit::WebsiteDataStore::fetchDataForRegistrableDomains):
2964             Re-introduced. It was removed as dead code in r242056.
2965         (WebKit::computeNetworkProcessAccessTypeForDataRemoval):
2966         (WebKit::WebsiteDataStore::hasLocalStorageForTesting const):
2967             Test infrastructure, called by the TestRunner.
2968         * UIProcess/WebsiteData/WebsiteDataStore.h:
2969
2970 2019-03-28  Jiewen Tan  <jiewen_tan@apple.com>
2971
2972         API::Data::createWithoutCopying should do a null check before calling CFRelease
2973         https://bugs.webkit.org/show_bug.cgi?id=196276
2974         <rdar://problem/48059859>
2975
2976         Reviewed by Alex Christensen.
2977
2978         * Shared/Cocoa/APIDataCocoa.mm:
2979         (API::Data::createWithoutCopying):
2980
2981 2019-03-28  Per Arne Vollan  <pvollan@apple.com>
2982
2983         [iOS] Automatic focus of input field is flaky
2984         https://bugs.webkit.org/show_bug.cgi?id=196302
2985
2986         Reviewed by Brent Fulgham.
2987
2988         Sometimes the status of whether a keyboard is connected can be incorrect, both in the UI process, and in
2989         the WebContent process. Fix this by sending the keyboard status to the WebContent process as part of the
2990         Web page creation parameters. Stop caching the keyboard status in the Web process proxy, and call
2991         [UIKeyboard isInHardwareKeyboardMode] instead, since this method is swizzled in the test harness.
2992
2993         * Shared/WebPageCreationParameters.cpp:
2994         (WebKit::WebPageCreationParameters::encode const):
2995         (WebKit::WebPageCreationParameters::decode):
2996         * Shared/WebPageCreationParameters.h:
2997         * UIProcess/API/Cocoa/WKWebView.mm:
2998         (hardwareKeyboardAvailabilityChangedCallback):
2999         * UIProcess/WebPageProxy.cpp:
3000         (WebKit::WebPageProxy::creationParameters):
3001         * UIProcess/WebPageProxy.h:
3002         * UIProcess/WebProcessProxy.cpp:
3003         * UIProcess/WebProcessProxy.h:
3004         (WebKit::WebProcessProxy::setKeyboardIsAttached): Deleted.
3005         (WebKit::WebProcessProxy::keyboardIsAttached const): Deleted.
3006         * UIProcess/ios/WKContentViewInteraction.mm:
3007         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3008         * UIProcess/ios/WebPageProxyIOS.mm:
3009         (WebKit::WebPageProxy::isInHardwareKeyboardMode):
3010         (WebKit::WebPageProxy::applicationWillEnterForeground):
3011         * WebProcess/WebPage/WebPage.cpp:
3012         * WebProcess/WebPage/WebPage.h:
3013
3014 2019-03-28  Tim Horton  <timothy_horton@apple.com>
3015
3016         Fix the build.
3017
3018         * UIProcess/ios/WKActionSheetAssistant.mm:
3019         (-[WKActionSheetAssistant showImageSheet]):
3020         * UIProcess/ios/WKContentViewInteraction.mm:
3021         (-[WKContentView actionSheetAssistant:showCustomSheetForElement:]):
3022
3023 2019-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
3024
3025         [WPE][GTK] webkit_web_resource_get_data_finish can return NULL without setting error
3026         https://bugs.webkit.org/show_bug.cgi?id=186276
3027
3028         Reviewed by Carlos Garcia Campos.
3029
3030         Currently it's possible for webkit_web_resource_get_data_finish() to return NULL without
3031         setting the error parameter. This is illegal because it is an API guarantee (and a GObject
3032         convention) that if an error parameter exists, it should be set whenever a function call
3033         returns NULL. Epiphany correctly dereferences the error in this case without checking if it
3034         is NULL, because it knows it does not have to, and crashes. Fix this. We'll return a byte
3035         array of length 1 containing a NUL character. This isn't great, but there's not really any
3036         better solution without deprecating the API or returning an error code to indicate an empty
3037         resource, and it at least fixes the Epiphany crash.
3038
3039         This does not fix bug #186276, in which this function incorrectly returns no data when it
3040         ought to. But that is a different bug. Now, at least we won't crash when no data is
3041         available.
3042
3043         * UIProcess/API/glib/WebKitWebResource.cpp:
3044         (resourceDataCallback):
3045
3046 2019-03-28  Daniel Bates  <dabates@apple.com>
3047
3048         [iPad] Tapping on a popup form control may not show a popover
3049         https://bugs.webkit.org/show_bug.cgi?id=196322
3050         <rdar://problem/49229632>
3051
3052         Reviewed by Wenson Hsieh.
3053
3054         Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews
3055         to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only
3056         needs to call -inputView when it actually needs to display the input view (the keyboard). For
3057         popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral
3058         as part of the logic in the UI process to focus a new element before we call -reloadInputViews.
3059
3060         * UIProcess/ios/WKContentViewInteraction.mm:
3061         (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView().
3062         (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to
3063         end the input sessions and nullify the input peripheral before we tell the web process to switch
3064         focus as opposed to letting this happen after the web process tells us it focused a new element.
3065         (createInputPeripheralWithView): Added.
3066         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3067         Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming
3068         first responder because creating the peripheral has known side-effects: for popup buttons it
3069         tells the popup controller to present the popover. For key input to popovers to work from the get-go,
3070         the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272>
3071         for more details.
3072
3073 2019-03-28  Víctor Manuel Jáquez Leal  <vjaquez@igalia.com>
3074
3075         Silence lot of warnings when compiling with clang
3076         https://bugs.webkit.org/show_bug.cgi?id=196310
3077
3078         Reviewed by Michael Catanzaro.
3079
3080         * UIProcess/API/glib/WebKitInjectedBundleClient.cpp: add missing
3081         override clause.
3082         * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: add
3083         missing override clause.
3084
3085 2019-03-27  Ryosuke Niwa  <rniwa@webkit.org>
3086
3087         [macOS] Select element doesn't show popup if select element had lost focus while popup was previosuly shown
3088         https://bugs.webkit.org/show_bug.cgi?id=196336
3089
3090         Reviewed by Tim Horton.
3091
3092         The bug was caused by WebPopupMenu::hide never notifying PopupClient that the popup had been dismissed.
3093         This resulted in RenderMenuList::m_popupIsVisible to be never reset.
3094
3095         Also fixed a bug in WebPopupMenuProxyMac::hidePopupMenu that this function was never dismissing
3096         the popup as the selector "dismissPopUp", on the contrary to its name, does not dimiss the popup.
3097         Send cancelTracking to NSMenu instead, which DOES dismiss the popup.
3098
3099         Tests: fast/forms/select/mac-wk2/blur-dismisses-select-popup.html
3100                fast/forms/select/mac-wk2/open-select-popup-after-dismissing-by-blur.html
3101
3102         * UIProcess/mac/WebPopupMenuProxyMac.mm:
3103         (WebKit::WebPopupMenuProxyMac::hidePopupMenu):
3104         * WebProcess/WebCoreSupport/WebPopupMenu.cpp:
3105         (WebKit::WebPopupMenu::hide):
3106
3107 2019-03-27  Dean Jackson  <dino@apple.com>
3108
3109         [ARKit] Black view when opening a 3D model usdz file in new tab
3110         https://bugs.webkit.org/show_bug.cgi?id=196333
3111         <rdar://problem/47693367>
3112
3113         Reviewed by Tim Horton.
3114
3115         When opening a new WKSystemPreviewView, we were exiting if there was no
3116         presentingViewController. This code was unnecessary, and causing blank
3117         content when opening a new tab.
3118
3119         * UIProcess/ios/WKSystemPreviewView.mm:
3120         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
3121         Remove the code looking for a presentingViewController.
3122
3123 2019-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3124
3125         Need a way to include WebKitAdditions code in WebKit API headers
3126         https://bugs.webkit.org/show_bug.cgi?id=196173
3127
3128         Reviewed by Tim Horton.
3129
3130         Introduce a mechanism that allows us to insert code from WebKitAdditions into public or private SDK headers
3131         using `#import`s of the form:
3132
3133         ```
3134         #if USE(APPLE_INTERNAL_SDK)
3135         #import <WebKitAdditions/WKWebViewConfigurationAdditions.h>
3136         #endif
3137         ```
3138
3139         The resulting header in the built products directory will contain the contents of the imported file inserted in
3140         place of the `#if USE(APPLE_INTERNAL_SDK) … #endif` block; however, when building with the Apple internal SDK,
3141         the additions header content will be imported by the usual means.
3142
3143         * mac/postprocess-framework-headers.sh:
3144         * mac/replace-webkit-additions-includes.py: Added.
3145
3146         Add a step when post-processing framework headers to replace instances of `#if USE(APPLE_INTERNAL_SDK) … #endif`
3147         with the text content of the additions files. The replacement script first searches in the built products
3148         directory for the matching additions file, and falls back to the SDK if no matching file is found. If neither
3149         are present (e.g. a build using the public SDK), then the block is simply replaced by the empty string.
3150
3151         (read_content_from_webkit_additions):
3152         (main):
3153
3154 2019-03-27  Andy Estes  <aestes@apple.com>
3155
3156         REGRESSION (r242686): package-root creates roots with broken symlinks in WebKit.framework/XPCServices/
3157         https://bugs.webkit.org/show_bug.cgi?id=196317
3158
3159         Reviewed by Dan Bernstein.
3160
3161         Removed some remnants of the Storage Process.
3162
3163         * Configurations/BaseTarget.xcconfig:
3164         * Resources/SandboxProfiles/ios/com.apple.WebKit.Storage.sb: Removed.
3165         * WebKit.xcodeproj/project.pbxproj:
3166
3167 2019-03-27  Keith Rollin  <krollin@apple.com>
3168
3169         Include the CFNetworking task UUID to the NSError when a resource-load fails
3170         https://bugs.webkit.org/show_bug.cgi?id=196156
3171
3172         Reviewed by Alex Christensen.
3173
3174         In order to help track the connection between a failed resource-load
3175         and a user-visible error message, include the CFNetworking task UUID
3176         in the associated error as an element of the userInfo property. This
3177         can then be pulled out and reported in the logging at the point the
3178         error is reported to the user.
3179
3180         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3181         (-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):
3182
3183 2019-03-27  Chris Dumez  <cdumez@apple.com>
3184
3185         [ iOS Sim ] REGRESSION (r242277) Layout Test http/tests/cookies/same-site/lax-samesite-cookie-after-cross-site-history-load.php is a flaky timeout
3186         https://bugs.webkit.org/show_bug.cgi?id=195425
3187         <rdar://problem/48682403>
3188
3189         Reviewed by Alex Christensen.
3190
3191         When process-swapping on history navigation, we lookup the WebProcessProxy we'd like to use from the
3192         process identifier that is saved on the WebBackForwardListItem, to try and load the item in the process
3193         in which it was previously loaded. However, we were failing to check if the WebProcess in question was
3194         still running so we could potentially try to use a process that's already exited.
3195
3196         * UIProcess/WebProcessPool.cpp:
3197         (WebKit::WebProcessPool::processForNavigationInternal):
3198
3199 2019-03-27  Zalan Bujtas  <zalan@apple.com>
3200
3201         [ContentChangeObserver] Always dispatch the synthetic click asynchronously
3202         https://bugs.webkit.org/show_bug.cgi?id=196278
3203         <rdar://problem/49299968>
3204
3205         Reviewed by Simon Fraser.
3206
3207         This patch ensures that all completeSyntheticClick() calls happen in an asynchronous manner (unless the feature is turned off).
3208
3209         * WebProcess/WebPage/ios/WebPageIOS.mm:
3210         (WebKit::dispatchSyntheticMouseMove):
3211         (WebKit::WebPage::handleSyntheticClick):
3212
3213 2019-03-27  Tim Horton  <timothy_horton@apple.com>
3214
3215         Fix some more deprecation warnings in WKDrawingView
3216         https://bugs.webkit.org/show_bug.cgi?id=196282
3217         <rdar://problem/47637608>
3218
3219         Reviewed by Wenson Hsieh.
3220
3221         * Platform/spi/ios/PencilKitSPI.h:
3222         * SourcesCocoa.txt:
3223         * UIProcess/ios/PencilKitSoftLink.h:
3224         * UIProcess/ios/PencilKitSoftLink.mm:
3225         * UIProcess/ios/WKContentViewInteraction.mm:
3226         * UIProcess/ios/WKDrawingCoordinator.h:
3227         * UIProcess/ios/WKDrawingCoordinator.mm:
3228         (-[WKDrawingCoordinator initWithContentView:]):
3229         (-[WKDrawingCoordinator currentInk]):
3230         (-[WKDrawingCoordinator undoManagerForInkPicker:]):
3231         (-[WKDrawingCoordinator containingViewForInkPicker:]):
3232         (-[WKDrawingCoordinator inkPickerDidToggleRuler:]):
3233         (-[WKDrawingCoordinator inkPickerDidChangeInk:]):
3234         (-[WKDrawingCoordinator installInkPickerForDrawing:]):
3235         (-[WKDrawingCoordinator uninstallInkPicker]):
3236         (-[WKDrawingCoordinator inkPicker]): Deleted.
3237         (-[WKDrawingCoordinator didChangeRulerState:]): Deleted.
3238         (-[WKDrawingCoordinator didChangeInk:]): Deleted.
3239         * UIProcess/ios/WKDrawingView.mm:
3240         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
3241         * UIProcess/ios/WKInkPickerView.h: Removed.
3242         * UIProcess/ios/WKInkPickerView.mm: Removed.
3243         * WebKit.xcodeproj/project.pbxproj:
3244         Adopt the new names.
3245
3246 2019-03-27  Carlos Garcia Campos  <cgarcia@igalia.com>
3247
3248         Geolocation request not complete when watch request was started in a different web process
3249         https://bugs.webkit.org/show_bug.cgi?id=195996
3250
3251         Reviewed by Alex Christensen.
3252
3253         In WebGeolocationManagerProxy::startUpdating() we do nothing when the provider is already updating. We should
3254         reply with a DidChangePosition using the last known position, if available. If we are updating, but we still
3255         don't have a known position, the request will be completed when
3256         WebGeolocationManagerProxy::providerDidChangePosition() is called since it always notifies all web
3257         processes.
3258
3259         * UIProcess/WebGeolocationManagerProxy.cpp:
3260         (WebKit::WebGeolocationManagerProxy::providerDidChangePosition): Cache the position.
3261         (WebKit::WebGeolocationManagerProxy::startUpdating): Reply using cached position if already known.
3262         * UIProcess/WebGeolocationManagerProxy.h:
3263         (WebKit::WebGeolocationManagerProxy::lastPosition const): Return cached position.
3264         * WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
3265         (WebKit::WebGeolocationClient::lastPosition): Remove the FIXME since we don't want this feature.
3266
3267 2019-03-26  Brent Fulgham  <bfulgham@apple.com>
3268
3269         [macOS] Correct kerberos-related sandbox violations
3270         https://bugs.webkit.org/show_bug.cgi?id=196279
3271         <rdar://problem/48622502>
3272
3273         Reviewed by Per Arne Vollan.
3274
3275         We need to allow communications with a Kerberos-related service on macOS
3276         until <rdar://problem/35542803> is fixed.
3277
3278         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3279
3280 2019-03-26  Chris Dumez  <cdumez@apple.com>
3281
3282         [macOS] The network process is not exiting reliably when the WebProcessPool is destroyed
3283         https://bugs.webkit.org/show_bug.cgi?id=196277
3284         <rdar://problem/49127581>
3285
3286         Reviewed by Alex Christensen.
3287
3288         When, an AuxiliaryProcess receives the AuxiliaryProcess::Terminate IPC, it calls stopRunLoop()
3289         to exit. WebProcess overrides AuxiliaryProcess::stopRunLoop() to call exit(0) on the main
3290         thread. Other auxiliary processes such as the NetworkProcess would end up calling
3291         platformStopRunLoop(). On iOS and iOSMac, platformStopRunLoop() calls XPCServiceExit(), which
3292         makes sense since auxiliary processes run their run loop by calling xpc_main(). However, on
3293         macOS, platformStopRunLoop() was calling RunLoop::main().stop() to exit instead, which was
3294         unreliable as demonstrated by the test app attached to the radar.
3295
3296         Updating platformStopRunLoop() to call XPCServiceExit() on macOS fixes the problem and I now
3297         see the NetworkProcess exiting reliably there. This is the approach I have chosen in this
3298         patch since it appears to be reliable and it makes the code consistent on all Cocoa platforms.
3299
3300         * Shared/AuxiliaryProcess.cpp:
3301         * Shared/Cocoa/AuxiliaryProcessCocoa.mm:
3302         (WebKit::AuxiliaryProcess::platformStopRunLoop):
3303         * Shared/ios/AuxiliaryProcessIOS.mm:
3304         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3305         * Shared/mac/AuxiliaryProcessMac.mm:
3306         (WebKit::AuxiliaryProcess::platformStopRunLoop): Deleted.
3307
3308 2019-03-26  Keith Rollin  <krollin@apple.com>
3309
3310         Inhibit CFNetwork logging in private sessions
3311         https://bugs.webkit.org/show_bug.cgi?id=196268
3312         <rdar://problem/48210793>
3313
3314         Reviewed by Alex Christensen.
3315
3316         Before performing any logging, the NetworkProcess checks to see if
3317         it's performing an operation associated with a private (ephemeral)
3318         browsing session. If so, it skips the logging. However, networking
3319         layers below the NetworkProcess don't know about private browsing, so
3320         they would still perform their own logging. CFNetwork now has a flag
3321         that lets us control that, so set it to False if private browsing.
3322
3323         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3324         (WebKit::configurationForSessionID):
3325
3326 2019-03-26  Chris Dumez  <cdumez@apple.com>
3327
3328         Add basic layout test coverage for File Picker on iOS
3329         https://bugs.webkit.org/show_bug.cgi?id=196265
3330
3331         Reviewed by Wenson Hsieh.
3332
3333         Add layout test infrastructure to test the file picker on iOS.
3334
3335         * UIProcess/API/Cocoa/WKWebView.mm:
3336         (-[WKWebView _dismissFilePicker]):
3337         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3338         * UIProcess/ios/WKContentViewInteraction.h:
3339         * UIProcess/ios/WKContentViewInteraction.mm:
3340         (-[WKContentView dismissFilePicker]):
3341         (-[WKContentView _contentsOfUserInterfaceItem:]):
3342         * UIProcess/ios/forms/WKFileUploadPanel.h:
3343         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3344         (-[WKFileUploadPanel currentAvailableActionTitles]):
3345
3346 2019-03-26  Daniel Bates  <dabates@apple.com>
3347
3348         [iOS][WK2] Use a better concept to describe the reason we defer zooming a focused element: selectabiltiy
3349         https://bugs.webkit.org/show_bug.cgi?id=196264
3350
3351         Reviewed by Wenson Hsieh.
3352
3353         Rename shouldDeferZoomingToSelectionWhenRevealingFocusedElement() to mayContainSelectableText() to describe
3354         the criterion that we will use to decide whether to defer zooming or not. We defer zooming only for elements
3355         that may support text selection on initial focus because we do not have an up-to-date selection rect at that
3356         time. For element, like <select>, that do not support text selection, we can zoom them immediately when focused.
3357
3358         * UIProcess/ios/WKContentViewInteraction.mm:
3359         (mayContainSelectableText): Renamed from shouldDeferZoomingToSelectionWhenRevealingFocusedElement.
3360         List all the input types in the switch block and remove the default case to force the compiler to check that we
3361         covered all cases. This will prevent unforseen keyboard issues (why isn't the keyboard shown? or why is the keyboard shown?)
3362         for future input types that we may add.
3363         (rectToRevealWhenZoomingToFocusedElement): Update for renaming.
3364         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Add a
3365         comment to explain why we may need to defer the zoom: the focused element supports text selection and we need
3366         to wait for the web process to call back to provide an up-to-date selection rect for us to zoom and reveal.
3367         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]): Update for renaming.
3368         (shouldDeferZoomingToSelectionWhenRevealingFocusedElement): Deleted.
3369
3370 2019-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3371
3372         Implement async paste method on UIWKInteractionViewProtocol
3373         https://bugs.webkit.org/show_bug.cgi?id=196267
3374         <rdar://problem/49236346>
3375
3376         Reviewed by Tim Horton.
3377
3378         Implement a new UIWKInteractionViewProtocol hook to perform a paste command, and invoke the given completion
3379         handler when pasting is finished.
3380
3381         Test: UIPasteboardTests.PasteWithCompletionHandler
3382
3383         * UIProcess/ios/WKContentViewInteraction.mm:
3384         (-[WKContentView pasteWithCompletionHandler:]):
3385
3386 2019-03-26  Per Arne Vollan  <pvollan@apple.com>
3387
3388         [macOS] Fix sandbox violations
3389         https://bugs.webkit.org/show_bug.cgi?id=196262
3390         <rdar://problem/47738015>
3391
3392         Reviewed by Brent Fulgham.
3393
3394         Fix various observed sandbox violations.
3395
3396         * NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
3397         * WebProcess/com.apple.WebProcess.sb.in:
3398
3399 2019-03-26  Tomoki Imai  <Tomoki.Imai@sony.com>
3400
3401         Assertion failure !isInAcceleratedCompositingMode() in DrawingAreaProxyCoordinatedGraphics::incorporateUpdate when forceCompositingMode is turned on
3402         https://bugs.webkit.org/show_bug.cgi?id=195879
3403
3404         Reviewed by Carlos Garcia Campos.
3405
3406         The root cause is that DrawingAreaProxyCoordinatedGraphics::isInAcceleratedCompositingMode checks both of alwaysUseCompositing() and !m_layerTreeContext.isEmpty().
3407         alwaysUseCompositing() refers preferences, which is written by the application (UIProcess).
3408         On the other hand, m_layerTreeContext is changed when it receives enterAcceleratedCompositingMode/exitAcceleratedCompositingMode from WebProcess.
3409
3410         It results when we set forceCompositingMode and acceleratedCompositingEnabled to true, WebProcess and UIProcess is out of sync until WebProcess sends enterAcceleratedCompositingMode message.
3411         In such situation, WebProcess sends incorporateUpdate to UIProcess because WebProcess is in non-AC mode, but isInAcceleratedCompositingMode becomes true in UIProcess side.
3412
3413         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
3414         (WebKit::DrawingAreaProxyCoordinatedGraphics::~DrawingAreaProxyCoordinatedGraphics): Should call exitAcceleratedCompositingMode even when alwaysUseCompositing is true.
3415         (WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode): enterAcceleratedCompositingMode should check enterAcceleratedCompositingMode is not called twice.
3416         * UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h: Remove alwaysUseCompositing from isInAcceleratedCompositingMode
3417
3418 2019-03-26  Antoine Quint  <graouts@apple.com>
3419
3420         Remove mousemoveEventHandlingPreventsDefault internal setting and quirk
3421         https://bugs.webkit.org/show_bug.cgi?id=196254
3422         <rdar://problem/49124334>
3423