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