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