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