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