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