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