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