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