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