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