00243e174e3c32230e381ff6acbfa07a269773c7
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-28  Antti Koivisto  <antti@apple.com>
2
3         WebUserContentController::removeUserScriptMessageHandlerInternal may deref and delete itself
4         https://bugs.webkit.org/show_bug.cgi?id=193901
5         <rdar://problem/47338669>
6
7         Reviewed by David Kilzer.
8
9         Don't know how to repro.
10
11         * WebProcess/UserContent/WebUserContentController.cpp:
12         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
13
14         Calling userMessageHandlers.removeFirstMatching() may remove the last ref to this
15         (because WebUserMessageHandlerDescriptorProxy refs WebUserContentController).
16         Fix by protecting this over the function.
17
18 2018-12-15  Darin Adler  <darin@apple.com>
19
20         Replace many uses of String::format with more type-safe alternatives
21         https://bugs.webkit.org/show_bug.cgi?id=192742
22
23         Reviewed by Mark Lam.
24
25         * Shared/WebMemorySampler.cpp:
26         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
27
28         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
29         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
30
31         * UIProcess/WebInspectorUtilities.cpp:
32         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
33         * UIProcess/WebProcessPool.cpp:
34         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
35         (WebKit::WebProcessPool::startMemorySampler): Ditto.
36
37 2019-01-27  Jiewen Tan  <jiewen_tan@apple.com>
38
39         Use a load optimizer for some sites
40         https://bugs.webkit.org/show_bug.cgi?id=193881
41         <rdar://problem/46325455>
42
43         Reviewed by Brent Fulgham.
44
45         We will try to speed up some sites with a dedicated load optimizer. The load optimizer lives
46         within the WebsiteDataStore as one client instance should have only one and it should live
47         as long as the client lives. How does the load optimizer work? It intercepts every load in
48         the navigation state. If a request meets some requirements, it will then fetch the request
49         from its own cache. Once the fetch succeeds, the original load will be ignored and the
50         optimizer will display the cached content.
51
52         Covered by API tests.
53
54         * SourcesCocoa.txt:
55         * UIProcess/Cocoa/LoadOptimizer.h: Added.
56         * UIProcess/Cocoa/LoadOptimizer.mm: Added.
57         * UIProcess/Cocoa/MediaCaptureUtilities.h:
58         * UIProcess/Cocoa/NavigationState.mm:
59         (WebKit::tryInterceptNavigation):
60         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
61         (WebKit::tryAppLink): Deleted.
62         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
63         (WebKit::WebsiteDataStore::WebsiteDataStore):
64         * UIProcess/WebsiteData/WebsiteDataStore.h:
65         (WebKit::WebsiteDataStore::loadOptimizer):
66         * WebKit.xcodeproj/project.pbxproj:
67
68 2019-01-25  Brian Burg  <bburg@apple.com>
69
70         Web Automation: add support for simulating single touches to Automation.performInteractionSequence
71         https://bugs.webkit.org/show_bug.cgi?id=193852
72         <rdar://problem/28360781>
73
74         Reviewed by Joseph Pecoraro and Simon Fraser.
75
76         This patch makes it possible to simulate touches via the Actions API. The approach is to
77         use a stripped down version of HIDEventGenerator to send HID events to the UIWindow.
78         The initial version supports a single touch point; this may be expanded if needed, but
79         so far it hasn't been an impediment when running desktop-oriented WebDriver test suites.
80
81         As part of implementing this support, I went through and added [somewhat obnoxious] ENABLE()
82         guards so that we don't mistakenly compile mouse support on iOS and touch on Mac,
83         and vice versa. Each of the interaction methods---touch, mouse, keyboard---can be independently
84         compiled out. If none is supported (i.e., Windows), then we don't even try to compile
85         platformSimulate*Interaction methods or SimulatedInputDispatcher. This allows WebAutomationSession
86         to not include members and code that are never going to be used on a particular platform.
87
88         This functionality is covered by existing WebDriver test suites that use Element Click command.
89         Additional tests that explicitly include 'touch' pointerType will be submitted to WPT later.
90
91         * UIProcess/Automation/Automation.json: Update comment.
92
93         * UIProcess/Automation/SimulatedInputDispatcher.h:
94         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
95         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
96         - Add appropriate guards for code specific to each interaction type.
97         - Handle SimulatedInputSourceType::Touch and call out to dispatch events.
98
99         * UIProcess/Automation/WebAutomationSession.h:
100         * UIProcess/Automation/WebAutomationSession.cpp:
101         (WebKit::WebAutomationSession::WebAutomationSession):
102         (WebKit::WebAutomationSession::terminate):
103         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
104         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
105         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
106         (WebKit::WebAutomationSession::willClosePage):
107         Add appropriate guards for code specific to each interaction type.
108
109         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
110         Add new hook so that we can detect when a touch simulation is in progress.
111         We don't rely on checking WebKit's event queue, so use a flag.
112
113         (WebKit::WebAutomationSession::simulateTouchInteraction):
114         (WebKit::WebAutomationSession::performMouseInteraction):
115         (WebKit::WebAutomationSession::performKeyboardInteractions):
116         (WebKit::WebAutomationSession::cancelInteractionSequence):
117         (WebKit::WebAutomationSession::performInteractionSequence):
118         - Add appropriate guards for code specific to each interaction type.
119         - Bail out immediately if a requested interaction type is not supported.
120         - Shim Touch input type to Mouse if mouse is not supported but touches are.
121         Nearly all WebDriver tests in the wild will be requesting a 'mouse' pointerType,
122         so this is necessary for compatibility. It's easier to shim at this level than try
123         to implement platformSimulateMouseInteraction for iOS because
124         platformSimulateMouseinteraction does not use a completion handler but the iOS
125         implementation would require that.
126
127         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Deleted.
128         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Deleted.
129         - Remove these stubs. Platform methods of this class are no longer being filled
130         with stubs on unsupported platforms because we expect the command to fail earlier.
131
132         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
133         (WebKit::WebAutomationSession::platformSimulateTouchInteraction):
134         - Add appropriate guards for code specific to each interaction type.
135         - Implement new platform method to simulate touches. This uses _WKTouchEventGenerator.
136
137         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
138         Add appropriate guards for code specific to each interaction type.
139
140         * UIProcess/_WKTouchEventGenerator.h: Added.
141         * UIProcess/_WKTouchEventGenerator.mm: Added.
142         (simpleCurveInterpolation):
143         (calculateNextCurveLocation):
144         (delayBetweenMove):
145         (+[_WKTouchEventGenerator sharedTouchEventGenerator]):
146         (+[_WKTouchEventGenerator nextEventCallbackID]):
147         (-[_WKTouchEventGenerator init]):
148         (-[_WKTouchEventGenerator dealloc]):
149         (-[_WKTouchEventGenerator _createIOHIDEventType:]):
150         (-[_WKTouchEventGenerator _sendHIDEvent:]):
151         (-[_WKTouchEventGenerator _sendMarkerHIDEventWithCompletionBlock:]):
152         (-[_WKTouchEventGenerator _updateTouchPoints:count:]):
153         (-[_WKTouchEventGenerator touchDownAtPoints:touchCount:]):
154         (-[_WKTouchEventGenerator touchDown:touchCount:]):
155         (-[_WKTouchEventGenerator touchDown:]):
156         (-[_WKTouchEventGenerator liftUpAtPoints:touchCount:]):
157         (-[_WKTouchEventGenerator liftUp:touchCount:]):
158         (-[_WKTouchEventGenerator liftUp:]):
159         (-[_WKTouchEventGenerator moveToPoints:touchCount:duration:]):
160         (-[_WKTouchEventGenerator touchDown:completionBlock:]):
161         (-[_WKTouchEventGenerator liftUp:completionBlock:]):
162         (-[_WKTouchEventGenerator moveToPoint:duration:completionBlock:]):
163         (-[_WKTouchEventGenerator receivedHIDEvent:]):
164         Copied and simplified from HIDEventGenerator in WebKitTestRunner.
165
166         * WebKit.xcodeproj/project.pbxproj:
167         Add _WKTouchEventGenerator.{h,mm} and make it a private header. The client needs to
168         route received HID events to -receivedHIDEvent: in order to detect when the marker
169         HID event has been processed (and thus the interaction is completed).
170
171         * config.h: Add ENABLE(WEBDRIVER_*_INTERACTIONS) macros here.
172
173 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
174
175         Have composited RenderIFrame layers make FrameHosting scrolling tree nodes to parent the iframe's scrolling node
176         https://bugs.webkit.org/show_bug.cgi?id=193879
177
178         Reviewed by Antti Koivisto.
179
180         Need a specialization of dump() for ScrollingStateFrameHostingNode to avoid infinite recursion.
181
182         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
183         (WebKit::dump):
184
185 2019-01-27  Chris Fleizach  <cfleizach@apple.com>
186
187         AX: Introduce a static accessibility tree
188         https://bugs.webkit.org/show_bug.cgi?id=193348
189         <rdar://problem/47203295>
190
191         Reviewed by Ryosuke Niwa.
192
193         * Configurations/FeatureDefines.xcconfig:
194         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
195         (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
196
197 2019-01-26  Simon Fraser  <simon.fraser@apple.com>
198
199         Allow scrolling tree nodes to exist in a detached state
200         https://bugs.webkit.org/show_bug.cgi?id=193754
201
202         Reviewed by Zalan Bujtas.
203
204         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
205         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
206
207 2019-01-25  Tim Horton  <timothy_horton@apple.com>
208
209         REGRESSION (r238818): Snapshot is removed too late after swiping back on Twitter
210         https://bugs.webkit.org/show_bug.cgi?id=193860
211         <rdar://problem/47535022>
212
213         Reviewed by Antti Koivisto.
214
215         * UIProcess/Cocoa/ViewGestureController.cpp:
216         (WebKit::ViewGestureController::didStartProvisionalOrSameDocumentLoadForMainFrame):
217         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
218         (WebKit::ViewGestureController::didSameDocumentNavigationForMainFrame):
219         * UIProcess/Cocoa/ViewGestureController.h:
220         Treat provisional load and same document load the same: they already both
221         unpause the snapshot removal tracker, request render tree size notifications,
222         but same-document navigation was missing the call to dispatchAfterEnsuringDrawing
223         and thus would get stuck waiting for RepaintAfterNavigation.
224
225 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
226
227         Need a mechanism to override navigator.userAgent
228         https://bugs.webkit.org/show_bug.cgi?id=193762
229         <rdar://problem/47504939>
230
231         Reviewed by Brent Fulgham.
232
233         This patch adds a new _WKWebsitePolicies SPI to specify the user agent string returned by
234         navigator.userAgent without affecting the user agent string used to send network requests.
235
236         Tests: WebKit.WebsitePoliciesCustomJavaScriptUserAgent
237                WebKit.WebsitePoliciesCustomUserAgents
238
239         * Shared/WebsitePoliciesData.cpp:
240         (WebKit::WebsitePoliciesData::encode const):
241         (WebKit::WebsitePoliciesData::decode):
242         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
243         * Shared/WebsitePoliciesData.h:
244         * UIProcess/API/APIWebsitePolicies.cpp:
245         (API::WebsitePolicies::data):
246         * UIProcess/API/APIWebsitePolicies.h:
247         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
248         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
249         (-[_WKWebsitePolicies setCustomJavaScriptUserAgent:]):
250         (-[_WKWebsitePolicies customJavaScriptUserAgent]):
251
252 2019-01-25  Devin Rousso  <drousso@apple.com>
253
254         Web Inspector: provide a way to edit page settings on a remote target
255         https://bugs.webkit.org/show_bug.cgi?id=193813
256         <rdar://problem/47359510>
257
258         Reviewed by Joseph Pecoraro.
259
260         * WebProcess/WebPage/WebInspectorUI.h:
261         (WebKit::WebInspectorUI::isRemote() const): Added.
262         * WebProcess/WebPage/RemoteWebInspectorUI.h:
263         (WebKit::RemoteWebInspectorUI::isRemote() const): Added.
264
265 2019-01-25  Dean Jackson  <dino@apple.com>
266
267         REGRESSION: Some USDz from 3rd party websites don't go directly to AR QL
268         https://bugs.webkit.org/show_bug.cgi?id=193831
269         <rdar://problem/47399263>
270
271         Reviewed by Chris Dumez.
272
273         A System Preview (<a rel="ar">) displays in a modal and doesn't trigger
274         a navigation. If the link was cross origin, it was causing a process swap,
275         which meant that the response defaulted back to a navigation.
276
277         The fix is to not cause a PSON when the navigation is a system preview.
278
279         * UIProcess/API/APINavigation.h:
280         (API::Navigation::shouldForceDownload const): This is now just tracking
281         the "download" attribute, and not including System Preview.
282         (API::Navigation::isSystemPreview const): New method to check for a
283         navigation triggered as a System Preview.
284         * UIProcess/WebPageProxy.cpp: Move the code from receivedPolicyDecision to
285         receivedNavigationPolicyDecision, so that downloads and System Previews are
286         detected before we decide to change process.
287         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
288         (WebKit::WebPageProxy::receivedPolicyDecision):
289
290 2019-01-25  Tim Horton  <timothy_horton@apple.com>
291
292         Find-in-page on nyt.com scrolls around without touching the screen when find holes are visible
293         https://bugs.webkit.org/show_bug.cgi?id=193853
294
295         Reviewed by Simon Fraser.
296
297         * WebProcess/WebPage/ios/FindControllerIOS.mm:
298         (WebKit::FindController::updateFindIndicator):
299         There is no reason to scroll/zoom to the find indicator just because the
300         holes are up, we should only do it on initial indicator presentation.
301         This was a mistake in r178755 that was previously never exercised because
302         isShowingOverlay was always false.
303
304 2019-01-25  Keith Rollin  <krollin@apple.com>
305
306         Update Xcode projects with "Check .xcfilelists" build phase
307         https://bugs.webkit.org/show_bug.cgi?id=193790
308         <rdar://problem/47201374>
309
310         Reviewed by Alex Christensen.
311
312         Support for XCBuild includes specifying inputs and outputs to various
313         Run Script build phases. These inputs and outputs are specified as
314         .xcfilelist files. Once created, these .xcfilelist files need to be
315         kept up-to-date. In order to check that they are up-to-date or not,
316         add an Xcode build step that invokes an external script that performs
317         the checking. If the .xcfilelists are found to be out-of-date, update
318         them, halt the build, and instruct the developer to restart the build
319         with up-to-date files.
320
321         At this time, the checking and regenerating is performed only if the
322         WK_ENABLE_CHECK_XCFILELISTS environment variable is set to 1. People
323         who want to use this facility can set this variable and test out the
324         checking/regenerating. Once it seems like there are no egregious
325         issues that upset a developer's workflow, we'll unconditionally enable
326         this facility.
327
328         * Scripts/check-xcfilelists.sh: Added.
329         * WebKit.xcodeproj/project.pbxproj:
330
331 2019-01-25  Alex Christensen  <achristensen@webkit.org>
332
333         Move logic from ChildProcess::setApplicationIsDaemon to NetworkProcess::initializeProcess
334         https://bugs.webkit.org/show_bug.cgi?id=193844
335
336         Reviewed by Andy Estes.
337
338         This simplifies ChildProcess and removes NetworkProcess-specific code from this generic abstraction.
339
340         * NetworkProcess/mac/NetworkProcessMac.mm:
341         (WebKit::NetworkProcess::initializeProcess):
342         * Shared/ios/ChildProcessIOS.mm:
343         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
344         * Shared/mac/ChildProcessMac.mm:
345         (WebKit::ChildProcess::setApplicationIsDaemon): Deleted.
346
347 2019-01-25  Keith Rollin  <krollin@apple.com>
348
349         Update Xcode projects with "Apply Configuration to XCFileLists" build target
350         https://bugs.webkit.org/show_bug.cgi?id=193781
351         <rdar://problem/47201153>
352
353         Reviewed by Alex Christensen.
354
355         Part of generating the .xcfilelists used as part of adopting XCBuild
356         includes running `make DerivedSources.make` from a standalone script.
357         It’s important for this invocation to have the same environment as
358         when the actual build invokes `make DerivedSources.make`. If the
359         environments are different, then the two invocations will provide
360         different results. In order to get the same environment in the
361         standalone script, have the script launch xcodebuild targeting the
362         "Apply Configuration to XCFileLists" build target, which will then
363         re-invoke our standalone script. The script is now running again, this
364         time in an environment with all workspace, project, target, xcconfig
365         and other environment variables established.
366
367         The "Apply Configuration to XCFileLists" build target accomplishes
368         this task via a small embedded shell script that consists only of:
369
370             eval "${WK_SUBLAUNCH_SCRIPT_PARAMETERS[@]}"
371
372         The process that invokes "Apply Configuration to XCFileLists" first
373         sets WK_SUBLAUNCH_SCRIPT_PARAMETERS to an array of commands to be
374         evaluated and exports it into the shell environment. When xcodebuild
375         is invoked, it inherits the value of this variable and can `eval` the
376         contents of that variable. Our external standalone script can then set
377         WK_SUBLAUNCH_SCRIPT_PARAMETERS to the path to itself, along with a set
378         of command-line parameters needed to restart itself in the appropriate
379         state.
380
381         * WebKit.xcodeproj/project.pbxproj:
382
383 2019-01-25  Alex Christensen  <achristensen@webkit.org>
384
385         Add SPI to inform an application that "Go Back" has been clicked from a safe browsing warning
386         https://bugs.webkit.org/show_bug.cgi?id=193802
387         <rdar://problem/46010580>
388
389         Reviewed by Andy Estes.
390
391         * UIProcess/API/APIUIClient.h:
392         (API::UIClient::didClickGoBackFromSafeBrowsingWarning):
393         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
394         * UIProcess/Cocoa/UIDelegate.h:
395         * UIProcess/Cocoa/UIDelegate.mm:
396         (WebKit::UIDelegate::setDelegate):
397         (WebKit::UIDelegate::UIClient::didClickGoBackFromSafeBrowsingWarning):
398         * UIProcess/WebPageProxy.cpp:
399         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
400
401 2019-01-25  Daniel Bates  <dabates@apple.com>
402
403         [iOS] Pressing Tab key doesn't move to next cell with Google Sheets
404         https://bugs.webkit.org/show_bug.cgi?id=193048
405         <rdar://problem/46433836>
406
407         Reviewed by Brent Fulgham.
408
409         WebCore knows how interpret the Tab and Shift + Tab keys. When building with UIKit keyboard additions
410         we do not need to register key commands for handling them from the UIProcess code. Instead UIKit will
411         sends key events for these commands to us. This will make the behavior of these key commands when executed
412         in an editable field match the behavior of these command when executed in a non-editable field since
413         both code paths will now go through WebCore.
414
415         * UIProcess/ios/WKContentViewInteraction.mm:
416         (-[WKContentView keyCommands]): Only compile when building with !USE(UIKIT_KEYBOARD_ADDITIONS).
417
418 2019-01-25  Alex Christensen  <achristensen@webkit.org>
419
420         Fix Linux build.
421
422         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
423         (WebKit::NetworkConnectionToWebProcess::requestResourceLoadStatisticsUpdate):
424
425 2019-01-25  Keith Rollin  <krollin@apple.com>
426
427         Update WebKitAdditions.xcconfig with correct order of variable definitions
428         https://bugs.webkit.org/show_bug.cgi?id=193793
429         <rdar://problem/47532439>
430
431         Reviewed by Alex Christensen.
432
433         XCBuild changes the way xcconfig variables are evaluated. In short,
434         all config file assignments are now considered in part of the
435         evaluation. When using the new build system and an .xcconfig file
436         contains multiple assignments of the same build setting:
437
438         - Later assignments using $(inherited) will inherit from earlier
439           assignments in the xcconfig file.
440         - Later assignments not using $(inherited) will take precedence over
441           earlier assignments. An assignment to a more general setting will
442           mask an earlier assignment to a less general setting. For example,
443           an assignment without a condition ('FOO = bar') will completely mask
444           an earlier assignment with a condition ('FOO[sdk=macos*] = quux').
445
446         This affects some of our .xcconfig files, in that sometimes platform-
447         or sdk-specific definitions appear before the general definitions.
448         Under the new evaluations rules, the general definitions alway take
449         effect because they always overwrite the more-specific definitions. The
450         solution is to swap the order, so that the general definitions are
451         established first, and then conditionally overwritten by the
452         more-specific definitions.
453
454         * Configurations/BaseTarget.xcconfig:
455         * Configurations/Version.xcconfig:
456         * Configurations/WebKit.xcconfig:
457
458 2019-01-25  Keith Rollin  <krollin@apple.com>
459
460         Update existing .xcfilelists
461         https://bugs.webkit.org/show_bug.cgi?id=193791
462         <rdar://problem/47201706>
463
464         Reviewed by Alex Christensen.
465
466         Many .xcfilelist files were added in r238824 in order to support
467         XCBuild. Update these with recent changes to the set of build files
468         and with the current generate-xcfilelist script.
469
470         * DerivedSources-input.xcfilelist:
471         * DerivedSources-output.xcfilelist:
472         * UnifiedSources-input.xcfilelist:
473         * UnifiedSources-output.xcfilelist:
474
475 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
476
477         [iOS] Deny mach lookups to services not used.
478         https://bugs.webkit.org/show_bug.cgi?id=193828
479
480         Reviewed by Brent Fulgham.
481
482         Start denying mach lookups to iOS services, which were previously allowed with reporting.
483         Living-on has indicated that these services are not used.
484
485         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
486
487 2019-01-25  Brent Fulgham  <bfulgham@apple.com>
488
489         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
490         https://bugs.webkit.org/show_bug.cgi?id=193297
491         <rdar://problem/47158841>
492
493         Reviewed by Alex Christensen.
494
495         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
496         it off in the UIProcess. It also updates test infrastructure to work with this change
497         in architecture.
498
499         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
500         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
501         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
502         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
503         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
504         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
505         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
506         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
507         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
508         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
509         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
510         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
511         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
512         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
513         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
514         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
515         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
516         * NetworkProcess/NetworkSession.cpp:
517         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
518         * UIProcess/WebProcessPool.cpp:
519         (WebKit::WebProcessPool::ensureNetworkProcess):
520         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
521         (WebKit::WebsiteDataStore::parameters):
522         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
523         (WebKit::WebsiteDataStore::removeData):
524         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
525         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
526         * Webprocess/WebProcess.cpp:
527         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
528
529 2019-01-25  Ryosuke Niwa  <rniwa@webkit.org>
530
531         iOS: inputmode="none" disables hardware keyboard's globe key
532         https://bugs.webkit.org/show_bug.cgi?id=193811
533         <rdar://problem/47406553>
534
535         Reviewed by Wenson Hsieh.
536
537         Removed the support for inputmode="none" for now since we need a new SPI from UIKit
538         to properly implement this feature some time in the future.
539
540         * UIProcess/ios/WKContentViewInteraction.mm:
541         (-[WKContentView _zoomToRevealFocusedElement]):
542         (-[WKContentView inputView]):
543         (-[WKContentView requiresAccessoryView]):
544         (-[WKContentView textInputTraits]):
545
546 2019-01-25  David Kilzer  <ddkilzer@apple.com>
547
548         Move soft-linking of Lookup.framework out of LookupSPI.h
549         <https://webkit.org/b/193815>
550
551         Reviewed by Tim Horton.
552
553         * UIProcess/Cocoa/WebViewImpl.mm:
554         (-[WKWindowVisibilityObserver dealloc]):
555         (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
556         - Move soft-linking to LookupSoftLink.{h,mm}.
557
558 2019-01-25  Antti Koivisto  <antti@apple.com>
559
560         REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures
561         https://bugs.webkit.org/show_bug.cgi?id=193818
562         <rdar://problem/47456584>
563
564         Reviewed by Tim Horton.
565
566         We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it
567         from a wrong process (the one we are leaving behind).
568
569         * UIProcess/Cocoa/ViewGestureController.cpp:
570         (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
571
572         Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use.
573
574         (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
575         * UIProcess/Cocoa/ViewGestureController.h:
576         (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
577         (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
578         * UIProcess/mac/ViewGestureControllerMac.mm:
579         (WebKit::ViewGestureController::endSwipeGesture):
580
581         Don't request immediately, save the threshold to SnapshotRemovalTracker.
582
583         (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
584
585         Do the request to the right process.
586
587         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
588         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold):
589
590         Ensure we send the notification even if we reached the threshold before it was requested.
591
592         (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded):
593         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
594         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
595         (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted.
596
597 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
598
599         [iOS] Rename some WebKit-internal functions and variables that reference "data interaction"
600         https://bugs.webkit.org/show_bug.cgi?id=193829
601
602         Reviewed by Tim Horton.
603
604         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
605         (WebKit::WebPageProxy::setDragCaretRect):
606         * UIProcess/PageClient.h:
607         * UIProcess/WebPageProxy.h:
608         * UIProcess/WebPageProxy.messages.in:
609         * UIProcess/ios/PageClientImplIOS.h:
610         * UIProcess/ios/PageClientImplIOS.mm:
611         (WebKit::PageClientImpl::didHandleDragStartRequest):
612         (WebKit::PageClientImpl::didConcludeEditDrag):
613         (WebKit::PageClientImpl::didChangeDragCaretRect):
614         (WebKit::PageClientImpl::didHandleStartDataInteractionRequest): Deleted.
615         (WebKit::PageClientImpl::didConcludeEditDataInteraction): Deleted.
616         (WebKit::PageClientImpl::didChangeDataInteractionCaretRect): Deleted.
617         * UIProcess/ios/WKContentViewInteraction.h:
618         * UIProcess/ios/WKContentViewInteraction.mm:
619         (-[WKContentView setupInteraction]):
620         (-[WKContentView cleanupInteraction]):
621         (-[WKContentView setupDragAndDropInteractions]):
622         (-[WKContentView teardownDragAndDropInteractions]):
623         (-[WKContentView _didHandleDragStartRequest:]):
624         (-[WKContentView _didConcludeEditDrag:]):
625         (-[WKContentView _didChangeDragCaretRect:currentRect:]):
626         (-[WKContentView _dragInteraction:prepareForSession:completion:]):
627         (-[WKContentView setupDataInteractionDelegates]): Deleted.
628         (-[WKContentView teardownDataInteractionDelegates]): Deleted.
629         (-[WKContentView _didHandleStartDataInteractionRequest:]): Deleted.
630         (-[WKContentView _didConcludeEditDataInteraction:]): Deleted.
631         (-[WKContentView _didChangeDataInteractionCaretRect:currentRect:]): Deleted.
632         * UIProcess/ios/WebPageProxyIOS.mm:
633         (WebKit::WebPageProxy::didHandleDragStartRequest):
634         (WebKit::WebPageProxy::requestDragStart):
635         (WebKit::WebPageProxy::didConcludeEditDrag):
636         (WebKit::WebPageProxy::didHandleStartDataInteractionRequest): Deleted.
637         (WebKit::WebPageProxy::requestStartDataInteraction): Deleted.
638         (WebKit::WebPageProxy::didConcludeEditDataInteraction): Deleted.
639         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
640         (WebKit::WebDragClient::didConcludeEditDrag):
641         * WebProcess/WebPage/WebPage.h:
642         * WebProcess/WebPage/WebPage.messages.in:
643         * WebProcess/WebPage/ios/WebPageIOS.mm:
644         (WebKit::WebPage::requestDragStart):
645         (WebKit::WebPage::requestAdditionalItemsForDragSession):
646         (WebKit::WebPage::didConcludeEditDrag):
647         (WebKit::WebPage::requestStartDataInteraction): Deleted.
648         (WebKit::WebPage::didConcludeEditDataInteraction): Deleted.
649
650 2019-01-25  Alex Christensen  <achristensen@webkit.org>
651
652         WKWebView.goBack should reload if there is a safe browsing warning
653         https://bugs.webkit.org/show_bug.cgi?id=193805
654         <rdar://problem/46908216>
655
656         Reviewed by Geoff Garen.
657
658         If a WKWebView is showing a safe browsing warning and the user clicks a back button
659         in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet,
660         so actually going back will appear to the user to go back twice.  We can't just do nothing because the
661         app is in a state where it is expecting a navigation to happen.  Reloading achieves what the user expects
662         and makes the app work like the app expects.
663
664         * UIProcess/API/C/WKPage.cpp:
665         (WKPageGoBack):
666         * UIProcess/API/Cocoa/WKWebView.mm:
667         (-[WKWebView goBack]):
668         * UIProcess/PageClient.h:
669         (WebKit::PageClient::hasSafeBrowsingWarning const):
670         * UIProcess/mac/PageClientImplMac.h:
671         * UIProcess/mac/PageClientImplMac.mm:
672         (WebKit::PageClientImpl::hasSafeBrowsingWarning const):
673
674 2019-01-25  Chris Dumez  <cdumez@apple.com>
675
676         Regression(PSON) cross-site provisional page is not canceled if a new same-site one is started
677         https://bugs.webkit.org/show_bug.cgi?id=193788
678         <rdar://problem/47531231>
679
680         Reviewed by Alex Christensen.
681
682         When the page starts a new provisional load, make sure we cancel any pending one in the provisional
683         process, as it would have happened in the first provisional load happened in the same process.
684         Without this, we could have 2 parallel loads happening, one in the committed process and another
685         in the provisional one, leading to assertion failures in debug.
686
687         * UIProcess/WebPageProxy.cpp:
688         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
689
690 2019-01-25  Chris Dumez  <cdumez@apple.com>
691
692         Drop WebKit::WebKitPolicyAction type as it is no longer needed
693         https://bugs.webkit.org/show_bug.cgi?id=193827
694
695         Reviewed by Antti Koivisto.
696
697         Drop WebKit::WebKitPolicyAction type as it is no longer needed. It is now identical to
698         WebCore::PolicyAction.
699
700         * Shared/WebPolicyAction.h: Removed.
701         * UIProcess/WebFramePolicyListenerProxy.cpp:
702         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
703         (WebKit::WebFramePolicyListenerProxy::use):
704         (WebKit::WebFramePolicyListenerProxy::download):
705         (WebKit::WebFramePolicyListenerProxy::ignore):
706         * UIProcess/WebFramePolicyListenerProxy.h:
707         * UIProcess/WebFrameProxy.cpp:
708         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
709         * UIProcess/WebFrameProxy.h:
710         * UIProcess/WebPageProxy.cpp:
711         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
712         (WebKit::WebPageProxy::receivedPolicyDecision):
713         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
714         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
715         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
716         (WebKit::WebPageProxy::decidePolicyForResponseShared):
717         * UIProcess/WebPageProxy.h:
718         * WebKit.xcodeproj/project.pbxproj:
719         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
720         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
721         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
722         * WebProcess/WebPage/WebFrame.cpp:
723         (WebKit::WebFrame::didReceivePolicyDecision):
724         (WebKit::toPolicyAction): Deleted.
725         * WebProcess/WebPage/WebFrame.h:
726         * WebProcess/WebPage/WebPage.cpp:
727         (WebKit::WebPage::didReceivePolicyDecision):
728         * WebProcess/WebPage/WebPage.h:
729
730 2019-01-25  Per Arne Vollan  <pvollan@apple.com>
731
732         [iOS] Add logging of calls
733         https://bugs.webkit.org/show_bug.cgi?id=193784
734
735         Reviewed by Brent Fulgham.
736
737         Add permissive logging of calls on iOS.
738
739         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
740
741 2019-01-25  Chris Dumez  <cdumez@apple.com>
742
743         Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction()
744         https://bugs.webkit.org/show_bug.cgi?id=193779
745         <rdar://problem/46170903>
746
747         Reviewed by Antti Koivisto.
748
749         * UIProcess/Cocoa/NavigationState.mm:
750         (WebKit::tryAppLink):
751         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
752         We were crashing when trying to get the URL of the main frame, which was sad because we never
753         ended up using the main frame URL. Therefore, this patch drops the code in question.
754
755         * UIProcess/ProvisionalPageProxy.cpp:
756         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
757         Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting
758         from the process is related to its main frame.
759
760 2019-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
761
762         Need a way for JavaScript (or bundle) code to participate in undo
763         https://bugs.webkit.org/show_bug.cgi?id=190009
764         <rdar://problem/44807048>
765
766         Reviewed by Ryosuke Niwa.
767
768         Invalidate undo steps when removing them from WebPage. Invalidation is a no-op for editing actions that come
769         from the UA, but for custom undo steps backed by an UndoItem, we clear out the custom undo step's pointer to its
770         UndoItem and additionally disconnect the UndoItem from its UndoManager.
771
772         * WebProcess/WebPage/WebPage.cpp:
773         (WebKit::WebPage::addWebUndoStep):
774         (WebKit::WebPage::removeWebEditCommand):
775         * WebProcess/WebPage/WebUndoStep.h:
776         (WebKit::WebUndoStep::invalidate):
777
778 2019-01-25  Patrick Griffis  <pgriffis@igalia.com>
779
780         [GTK][WPE] Add API to add paths to sandbox
781         https://bugs.webkit.org/show_bug.cgi?id=193571
782
783         This allows applications to add paths to the web process
784         if required by web extensions.
785
786         Reviewed by Michael Catanzaro.
787
788         * UIProcess/API/glib/WebKitWebContext.cpp:
789         (webkit_web_context_add_path_to_sandbox):
790         * UIProcess/API/gtk/WebKitWebContext.h:
791         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
792         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
793         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
794         (WebKit::bubblewrapSpawn):
795         * UIProcess/WebProcessPool.h:
796         * UIProcess/glib/WebProcessProxyGLib.cpp:
797         (WebKit::WebProcessProxy::platformGetLaunchOptions):
798
799 2019-01-24  Ryosuke Niwa  <rniwa@webkit.org>
800
801         iOS: Split keyboard should not shrink visualViewport.height
802         https://bugs.webkit.org/show_bug.cgi?id=193798
803
804         Reviewed by Tim Horton.
805
806         Treat a split keyboard like a floating keyboard and don't consider its input view bounds in computing the visible content rects.
807
808         No new tests since while it's possible to transition between split and merged keyboard using some SPI,
809         there isn't a reliable mechanism to reset the keyboard state. e.g. we need to wait for a hard-coded amount of time.
810
811         * Platform/spi/ios/UIKitSPI.h:
812         * UIProcess/API/Cocoa/WKWebView.mm:
813         (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]):
814
815 2019-01-24  Eric Carlson  <eric.carlson@apple.com>
816
817         [iOS] Silence MediaPlayer compile warnings
818         https://bugs.webkit.org/show_bug.cgi?id=193780
819         <rdar://problem/47518428>
820
821         Reviewed by Jer Noble.
822
823         * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
824
825 2019-01-24  Truitt Savell  <tsavell@apple.com>
826
827         Unreviewed, rolling out r240446.
828
829         Casued 5 API failures
830
831         Reverted changeset:
832
833         "Activate the WebResourceLoadStatisticsStore in the
834         NetworkProcess and deactivate it in the UIProcess."
835         https://bugs.webkit.org/show_bug.cgi?id=193297
836         https://trac.webkit.org/changeset/240446
837
838 2019-01-24  Brent Fulgham  <bfulgham@apple.com>
839
840         Activate the WebResourceLoadStatisticsStore in the NetworkProcess and deactivate it in the UIProcess.
841         https://bugs.webkit.org/show_bug.cgi?id=193297
842         <rdar://problem/47158841>
843
844         Reviewed by Alex Christensen.
845
846         This patch activates the ResourceLoadStatistics code in the NetworkProcess, and turns
847         it off in the UIProcess. It also updates test infrastructure to work with this change
848         in architecture.
849
850         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
851         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceLoading): Added.
852         (WebKit::ResourceLoadStatisticsMemoryStore::logSubresourceRedirect): Added.
853         (WebKit::ResourceLoadStatisticsMemoryStore::logWebSocketLoading): Added.
854         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
855         (WebKit::WebResourceLoadStatisticsStore::logSubresourceLoading): Added.
856         (WebKit::WebResourceLoadStatisticsStore::logSubresourceRedirect): Added.
857         (WebKit::WebResourceLoadStatisticsStore::logWebSocketLoading): Added.
858         (WebKit::WebResourceLoadStatisticsStore::removeAllStorageAccess):
859         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCap):
860         (WebKit::WebResourceLoadStatisticsStore::setCacheMaxAgeCapForPrevalentResources): Deleted.
861         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
862         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
863         (WebKit::NetworkConnectionToWebProcess::logSubresourceLoading): Added.
864         (WebKit::NetworkConnectionToWebProcess::logSubresourceRedirect): Added.
865         (WebKit::NetworkConnectionToWebProcess::logWebSocketLoading): Added.
866         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
867         * NetworkProcess/NetworkSession.cpp:
868         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
869         * UIProcess/WebProcessPool.cpp:
870         (WebKit::WebProcessPool::ensureNetworkProcess):
871         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
872         (WebKit::WebsiteDataStore::parameters):
873         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
874         (WebKit::WebsiteDataStore::removeData):
875         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
876         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
877         * Webprocess/WebProcess.cpp:
878         (WebKit::WebProcess::initializeWebProcess): Register new ResourceLoadObserver callbacks.
879
880 2019-01-24  John Wilander  <wilander@apple.com>
881
882         Add Ad Click Attribution as an internal/experimental feature
883         https://bugs.webkit.org/show_bug.cgi?id=193685
884         <rdar://problem/47450399>
885
886         Reviewed by Brent Fulgham.
887
888         * Shared/WebPreferences.yaml:
889             Added AdClickAttributionEnabled as a runtime enabled feature, off by default.
890
891 2019-01-24  Antti Koivisto  <antti@apple.com>
892
893         [PSON] Flash on back navigation on Mac
894         https://bugs.webkit.org/show_bug.cgi?id=193716
895         <rdar://problem/47148458>
896
897         Reviewed by Chris Dumez.
898
899         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
900
901         * UIProcess/SuspendedPageProxy.cpp:
902         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
903         (WebKit::SuspendedPageProxy::close):
904
905         Track closed state so we don't send the message twice, causing unhandled message errors in web process.
906
907         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
908
909         Close the suspended page if the suspension fails.
910         Skip this if we are using web process side compositing on Mac.
911
912         * UIProcess/SuspendedPageProxy.h:
913         * UIProcess/WebPageProxy.cpp:
914         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
915
916         On Mac, close the failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
917
918         * UIProcess/WebProcessPool.cpp:
919         (WebKit::WebProcessPool::closeFailedSuspendedPagesForPage):
920         * UIProcess/WebProcessPool.h:
921         * WebProcess/WebPage/WebPage.cpp:
922         (WebKit::WebPage::suspendForProcessSwap):
923
924         Don't close the page on suspension failure. This is now managed by the UI process.
925
926 2019-01-24  Chris Dumez  <cdumez@apple.com>
927
928         Regression(PSON) Back/Forward list items' URL sometimes gets replaced with the URL of a subframe
929         https://bugs.webkit.org/show_bug.cgi?id=193761
930         <rdar://problem/47456405>
931
932         Reviewed by Alex Christensen.
933
934         When doing a history navigation cross-process, the UIProcess would first send the back/forward list items
935         to the destination WebProcess via WebPage::updateBackForwardListForReattach(), then ask the process to
936         navigate to the expected back/forward list item.
937
938         WebPage::updateBackForwardListForReattach() would call restoreSessionInternal(), which would call
939         toHistoryItem() on each BackForwardListItem. This may end up creating more than one HistoryItem for each
940         BackForwardListItem because HistoryItems are part of a tree (each frame has its own list of history items).
941
942         Note that BackForwardListItems and HistoryItem share a BackForwardItemIdentifier which is a
943         (processIdentifier, itemIdentifier) pair. We normally generate the HistoryItem's identifier from inside
944         its constructor like so:
945         `{ Process::identifier(), generateObjectIdentifier<BackForwardItemIdentifier::ItemIdentifierType>() }`
946
947         However, when calling updateBackForwardListForReattach() and constructing children HistoryItem,
948         applyFrameState() would generate the identifier by itself and passing it to the HistoryItem constructor.
949         Its genegates the ID the exact same way so this would in theory not be a problem. Unfortunately, both
950         calls to generateObjectIdentifier() get inlined and both call sites end up with their own static counter
951         to generate ids. As a result, we may end up with conflicts as HistoryItems for child frames (restored
952         by restoreSessionInternal()) can end up with the same identifier as HistoryItems for top frames.
953
954         This confusion would lead to the WebContent process sending the UIProcess bad information and the URL
955         of subframes could end up as the WebBackForwardListItem's mainframe URL.
956
957         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
958         (WebKit::applyFrameState):
959         Stop calling generateObjectIdentifier() explicitly and let the HistoryItem constructor take care of it.
960         Calling generateObjectIdentifier() for the same type from different places is not safe due to inlining.
961
962 2019-01-24  Ross Kirsling  <ross.kirsling@sony.com>
963
964         Move FileSystem to WTF
965         https://bugs.webkit.org/show_bug.cgi?id=193602
966
967         Reviewed by Yusuke Suzuki.
968
969         * NetworkProcess/Classifier/ResourceLoadStatisticsPersistentStorage.cpp:
970         * NetworkProcess/NetworkDataTaskBlob.h:
971         * NetworkProcess/NetworkProcess.cpp:
972         * NetworkProcess/cache/CacheStorageEngine.cpp:
973         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
974         * NetworkProcess/cache/NetworkCache.cpp:
975         * NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
976         * NetworkProcess/cache/NetworkCacheData.cpp:
977         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
978         * NetworkProcess/cache/NetworkCacheFileSystem.h:
979         * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm:
980         * NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:
981         * NetworkProcess/cache/NetworkCacheStatistics.cpp:
982         * NetworkProcess/cache/NetworkCacheStorage.cpp:
983         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
984         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
985         * NetworkProcess/mac/NetworkProcessMac.mm:
986         * NetworkProcess/soup/NetworkProcessSoup.cpp:
987         * PluginProcess/unix/PluginProcessMainUnix.cpp:
988         * Shared/PersistencyUtils.cpp:
989         * Shared/Plugins/Netscape/unix/NetscapePluginModuleUnix.cpp:
990         * Shared/Plugins/unix/PluginSearchPath.cpp:
991         * Shared/WebMemorySampler.h:
992         * Shared/glib/ProcessExecutablePathGLib.cpp:
993         * Shared/ios/ChildProcessIOS.mm:
994         * Shared/mac/ChildProcessMac.mm:
995         * Shared/mac/SandboxExtensionMac.mm:
996         * UIProcess/API/APIContentRuleListStore.cpp:
997         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm:
998         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
999         * UIProcess/API/glib/IconDatabase.cpp:
1000         * UIProcess/API/glib/WebKitFaviconDatabase.cpp:
1001         * UIProcess/API/glib/WebKitFileChooserRequest.cpp:
1002         * UIProcess/API/glib/WebKitWebContext.cpp:
1003         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1004         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp:
1005         * UIProcess/Automation/WebAutomationSession.cpp:
1006         * UIProcess/Cocoa/DownloadClient.mm:
1007         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1008         * UIProcess/Cocoa/WebViewImpl.mm:
1009         * UIProcess/DeviceIdHashSaltStorage.cpp:
1010         * UIProcess/Downloads/DownloadProxy.cpp:
1011         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1012         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
1013         * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
1014         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1015         * UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp:
1016         * UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp:
1017         * UIProcess/ServiceWorkerProcessProxy.cpp:
1018         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
1019         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
1020         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1021         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1022         * UIProcess/glib/WebProcessProxyGLib.cpp:
1023         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1024         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1025         * UIProcess/ios/WKContentViewInteraction.mm:
1026         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1027         * UIProcess/mac/WebPageProxyMac.mm:
1028         * UIProcess/win/WebProcessPoolWin.cpp:
1029         * UIProcess/win/WebView.cpp:
1030         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1031         * WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp:
1032         * WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp:
1033         * WebProcess/MediaCache/WebMediaKeyStorageManager.cpp:
1034         * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
1035         * WebProcess/Plugins/PluginProcessConnection.cpp:
1036         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1037         * WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp:
1038         * WebProcess/WebPage/win/WebInspectorUIWin.cpp:
1039         * WebProcess/cocoa/WebProcessCocoa.mm:
1040
1041 2019-01-23  Simon Fraser  <simon.fraser@apple.com>
1042
1043         Create "frame hosting" nodes for the scrolling tree
1044         https://bugs.webkit.org/show_bug.cgi?id=193753
1045
1046         Reviewed by Antti Koivisto.
1047
1048         When the scrolling tree crosses frame boundaries, mutations in the parent frame currently
1049         require the iframe's scrolling node to get reparented in a new ancestor, which requires
1050         a layer tree walk of the parent frame. This is error-prone, and not very future-proof.
1051
1052         Fix this by introducing "frame hosting" scrolling tree nodes. These are mostly inert
1053         nodes that are owned by the RenderIFrame's layer backing in the parent frame, and exist
1054         to provide a consistent parent node for the subframe's scrolling node.
1055
1056         This patch adds the node types, but does not instantiate them yet.
1057
1058         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
1059         (ArgumentCoder<ScrollingStateFrameHostingNode>::encode):
1060         (ArgumentCoder<ScrollingStateFrameHostingNode>::decode):
1061         (WebKit::encodeNodeAndDescendants):
1062         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
1063         (WebKit::dump):
1064         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1065         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1066         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
1067         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
1068         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1069         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1070
1071 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
1072
1073         [Curl] Unreviewed build fix for r240292 and friends.
1074
1075         WinCairo test stability must be restored in subsequent patch.
1076
1077         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1078         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1079         (WebKit::NetworkProcess::setNetworkProxySettings):
1080
1081 2019-01-23  Commit Queue  <commit-queue@webkit.org>
1082
1083         Unreviewed, rolling out r240403.
1084         https://bugs.webkit.org/show_bug.cgi?id=193757
1085
1086         "Causes multiple crashes on macOS port (probably used wrong
1087         ENABLE macro)" (Requested by ddkilzer on #webkit).
1088
1089         Reverted changeset:
1090
1091         "[Curl] Unreviewed build fix for r240292 and friends."
1092         https://trac.webkit.org/changeset/240403
1093
1094 2019-01-23  Ross Kirsling  <ross.kirsling@sony.com>
1095
1096         [Curl] Unreviewed build fix for r240292 and friends.
1097
1098         WinCairo test stability must be restored in subsequent patch.
1099
1100         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1101         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1102         (WebKit::NetworkProcess::setNetworkProxySettings):
1103
1104 2019-01-23  Alex Christensen  <achristensen@webkit.org>
1105
1106         Stop using NetworkProcess::singleton
1107         https://bugs.webkit.org/show_bug.cgi?id=193700
1108
1109         Reviewed by Don Olmstead.
1110
1111         This replaces it with a NeverDestroyed<NetworkProcess> and paves the way for more interesting things.
1112
1113         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
1114         * NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
1115         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1116         * NetworkProcess/NetworkProcess.cpp:
1117         (WebKit::NetworkProcess::NetworkProcess):
1118         (WebKit::NetworkProcess::singleton): Deleted.
1119         * NetworkProcess/NetworkProcess.h:
1120         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1121         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1122         * NetworkProcess/win/NetworkProcessMainWin.cpp:
1123         (WebKit::initializeChildProcess<WebKit::NetworkProcess>):
1124         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1125         (WebKit::initializeChildProcess):
1126         (WebKit::XPCServiceInitializer):
1127
1128 2019-01-23  Ryan Haddad  <ryanhaddad@apple.com>
1129
1130         Unreviewed, rolling out r240343.
1131
1132         Caused 4 PSON API test failures.
1133
1134         Reverted changeset:
1135
1136         "[PSON] Flash on back navigation on Mac"
1137         https://bugs.webkit.org/show_bug.cgi?id=193716
1138         https://trac.webkit.org/changeset/240343
1139
1140 2019-01-23  Chris Dumez  <cdumez@apple.com>
1141
1142         Deprecate API to limit the maximum number of WebProcesses
1143         https://bugs.webkit.org/show_bug.cgi?id=193725
1144         <rdar://problem/47464879>
1145
1146         Reviewed by Geoff Garen.
1147
1148         Deprecate API to limit the maximum number of WebProcesses and make it a no-op. It adds
1149         complexity and is not safe (conflicts with PSON).
1150
1151         Add a new usesSingleWebProcess SPI to _WKProcessPoolConfiguration to be used by
1152         Minibrowser / Safari in order to disable process per tab (can be useful for debugging).
1153         Note that enabling the single WebProcess mode will disable PSON and process prewarming.
1154
1155         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1156         (API::ProcessPoolConfiguration::createWithLegacyOptions):
1157         (API::ProcessPoolConfiguration::copy):
1158         * UIProcess/API/APIProcessPoolConfiguration.h:
1159         * UIProcess/API/C/WKContext.cpp:
1160         (WKContextSetMaximumNumberOfProcesses):
1161         (WKContextGetMaximumNumberOfProcesses):
1162         * UIProcess/API/C/WKContext.h:
1163         * UIProcess/API/Cocoa/WKProcessPool.mm:
1164         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
1165         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1166         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1167         (-[_WKProcessPoolConfiguration maximumProcessCount]):
1168         (-[_WKProcessPoolConfiguration setMaximumProcessCount:]):
1169         (-[_WKProcessPoolConfiguration usesSingleWebProcess]):
1170         (-[_WKProcessPoolConfiguration setUsesSingleWebProcess:]):
1171         (-[_WKProcessPoolConfiguration description]):
1172         * UIProcess/API/glib/WebKitWebContext.cpp:
1173         (webkitWebContextConstructed):
1174         (webkit_web_context_set_process_model):
1175         (webkit_web_context_set_web_process_count_limit):
1176         * UIProcess/WebProcessPool.cpp:
1177         (WebKit::WebProcessPool::createNewWebProcessRespectingProcessCountLimit):
1178         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1179         (WebKit::WebProcessPool::processForNavigationInternal):
1180         * UIProcess/WebProcessPool.h:
1181
1182 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
1183
1184         Switch NetworkStorageSession portions of ResourceLoadStatistics to Async message passing style
1185         https://bugs.webkit.org/show_bug.cgi?id=193659
1186         <rdar://problem/47433290>
1187
1188         Reviewed by Alex Christensen.
1189
1190         Change the implementations of ResourceLoadStatistics code in NetworkStorageSession to use the
1191         'sendWithAsyncReply' so that more of the code is autogenerated. This should make test runs more
1192         consistent, and should reduce the possibility of bookkeeping errors in the message handling
1193         implementations.
1194
1195         Fix the implementation of NetworkProcessProxy::clearCallbackStates to remove the manually constructed
1196         (and incomplete) message callbacks. These errors are a big reason to move to the auto-generated
1197         'sendWithAsyncReply' implementatoin. Ditto for NetworkProcessProxy::didClose.
1198
1199         This patch also moves an initializaton call (WebsiteDataStore::didCreateNetworkProcess) from
1200         'ensureNetworkProcess' to 'processDidFinishLaunching'. In current code, the call happens before
1201         a connection is established to the network process, causing initialization messages to get dropped
1202         leading to test system flakiness.
1203
1204         Finally: The WK API test code was updated to ensure that completion handlers are always called, even
1205         when built without ENABLE_RESOURCE_LOAD_STATISTICS defined.
1206
1207         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1208         * NetworkProcess/Classifier/ShouldGrandfatherStatistics.h: Added.
1209         * NetworkProcess/Classifier/StorageAccessStatus.h: Added.
1210         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1211         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
1212         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
1213         * NetworkProcess/NetworkProcess.cpp:
1214         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1215         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
1216         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
1217         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1218         (WebKit::NetworkProcess::requestStorageAccess):
1219         (WebKit::NetworkProcess::grantStorageAccess):
1220         (WebKit::NetworkProcess::removeAllStorageAccess):
1221         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
1222         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
1223         (WebKit::NetworkProcess::deleteWebsiteData):
1224         * NetworkProcess/NetworkProcess.h:
1225         * NetworkProcess/NetworkProcess.messages.in:
1226         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1227         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
1228         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
1229         (WKWebsiteDataStoreStatisticsResetToConsistentState):
1230         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
1231         * UIProcess/Network/NetworkProcessProxy.cpp:
1232         (WebKit::NetworkProcessProxy::clearCallbackStates): Remove incomplete clean-up code that
1233         is now autogenerated.
1234         (WebKit::NetworkProcessProxy::didClose): Ditto.
1235         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
1236         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
1237         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
1238         (WebKit::NetworkProcessProxy::hasStorageAccessForFrame):
1239         (WebKit::NetworkProcessProxy::requestStorageAccess):
1240         (WebKit::NetworkProcessProxy::grantStorageAccess):
1241         (WebKit::NetworkProcessProxy::removeAllStorageAccess):
1242         (WebKit::NetworkProcessProxy::setCacheMaxAgeCapForPrevalentResources):
1243         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
1244         (WebKit::NetworkProcessProxy::resetCacheMaxAgeCapForPrevalentResources):
1245         (WebKit::NetworkProcessProxy::didUpdateBlockCookies): Deleted.
1246         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies): Deleted.
1247         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings): Deleted.
1248         (WebKit::NetworkProcessProxy::storageAccessRequestResult): Deleted.
1249         (WebKit::NetworkProcessProxy::storageAccessOperationResult): Deleted.
1250         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess): Deleted.
1251         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources): Deleted.
1252         * UIProcess/Network/NetworkProcessProxy.h:
1253         * UIProcess/Network/NetworkProcessProxy.messages.in:
1254         * UIProcess/WebPageProxy.cpp:
1255         * UIProcess/WebProcessPool.cpp:
1256         (WebKit::WebProcessPool::ensureNetworkProcess): Move WebsiteDataStore 'didCreateNetworkProcess'
1257         to 'processDidFinishLaunching'. Currently the call happens before a connection is established,
1258         causing initialization messages to get dropped.
1259         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
1260         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1261         (WebKit::WebsiteDataStore::removeData):
1262         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
1263         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
1264         (WebKit::WebsiteDataStore::setGrandfatheringTime):
1265         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
1266         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
1267         (WebKit::WebsiteDataStore::setPrevalentResource):
1268         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
1269         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
1270         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
1271         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
1272         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
1273         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
1274         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
1275         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
1276         * UIProcess/WebsiteData/WebsiteDataStore.h:
1277         * WebKit.xcodeproj/project.pbxproj:
1278
1279 2019-01-23  Sihui Liu  <sihui_liu@apple.com>
1280
1281         Clean up IndexedDB files between tests
1282         https://bugs.webkit.org/show_bug.cgi?id=192796
1283         <rdar://problem/46824999>
1284
1285         Reviewed by Geoffrey Garen.
1286
1287         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
1288         (WKWebsiteDataStoreRemoveAllIndexedDatabases):
1289         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
1290
1291 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1292
1293         [iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
1294         https://bugs.webkit.org/show_bug.cgi?id=193182
1295         <rdar://problem/47452154>
1296
1297         Reviewed by Tim Horton.
1298
1299         Fix an existing bug where blurring an element doesn't always un-suppress text interactions.
1300
1301         * UIProcess/ios/WKContentViewInteraction.mm:
1302         (-[WKContentView _elementDidBlur]):
1303
1304 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1305
1306         Minor improvements to NetworkProcess
1307         https://bugs.webkit.org/show_bug.cgi?id=193708
1308
1309         Reviewed by Alex Christensen.
1310
1311         * NetworkProcess/NetworkProcess.cpp:
1312         (WebKit::NetworkProcess::switchToNewTestingSession): Fix a spelling error.
1313         (WebKit::NetworkProcess::ensureSession): Add useful assertion.
1314         (WebKit::NetworkProcess::defaultStorageSession const): Split into platform functions.
1315         (WebKit::NetworkProcess::destroySession): Add useful assertion.
1316         * NetworkProcess/NetworkProcess.h:
1317         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1318         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1319         * NetworkProcess/curl/NetworkProcessCurl.cpp:
1320         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1321         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1322         (WebKit::NetworkProcess::platformCreateDefaultStorageSession const):
1323
1324 2019-01-23  Daniel Bates  <dabates@apple.com>
1325
1326         Fix the Apple Internal build. See <rdar://problem/47486758>.
1327
1328         * UIProcess/ios/WKContentViewInteraction.mm:
1329         (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]):
1330
1331 2019-01-23  Per Arne Vollan  <pvollan@apple.com>
1332
1333         [macOS] Sandbox fails to compile
1334         https://bugs.webkit.org/show_bug.cgi?id=193727
1335         <rdar://problem/47476903>
1336
1337         Reviewed by Brent Fulgham.
1338
1339         Use '(with send-signal SIGKILL)' instead of '(with termination)'.
1340
1341         * WebProcess/com.apple.WebProcess.sb.in:
1342
1343 2019-01-23  Brent Fulgham  <bfulgham@apple.com>
1344
1345         REGRESSION (r240243): CrashTracer: WebKitTestRunnerApp at com.apple.WebKit: WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const + 32
1346         https://bugs.webkit.org/show_bug.cgi?id=193723
1347         <rdar://problem/47476802>
1348
1349         Reviewed by David Kilzer.
1350
1351         The new code added in r240243 could attempt to submit telemetry after the relevant
1352         WebResourceLoadStatisticsStore was destroyed. We should guard against this possibility.
1353
1354         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
1355         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
1356
1357 2019-01-23  Antti Koivisto  <antti@apple.com>
1358
1359         [PSON] Flash on back navigation on Mac
1360         https://bugs.webkit.org/show_bug.cgi?id=193716
1361         <rdar://problem/47148458>
1362
1363         Reviewed by Chris Dumez.
1364
1365         We close the page immediately if we fail to suspend. Layers disappear and we get a flash.
1366
1367         * UIProcess/SuspendedPageProxy.cpp:
1368         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1369
1370         Remove the suspended page (so closing it on web process side) if the suspension fails.
1371         Skip this if we are using web process side compositing on Mac.
1372
1373         * UIProcess/WebPageProxy.cpp:
1374         (WebKit::WebPageProxy::enterAcceleratedCompositingMode):
1375
1376         On Mac, remove failed SuspendedPageProxy when entering compositing mode. At this point we don't need it to keep layers alive.
1377
1378         * UIProcess/WebProcessPool.cpp:
1379         (WebKit::WebProcessPool::removeFailedSuspendedPagesForPage):
1380         * UIProcess/WebProcessPool.h:
1381         * WebProcess/WebPage/WebPage.cpp:
1382         (WebKit::WebPage::suspendForProcessSwap):
1383
1384         Don't close the page on suspension failure.
1385
1386 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1387
1388         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
1389         https://bugs.webkit.org/show_bug.cgi?id=193706
1390         <rdar://problem/44807048>
1391
1392         Reviewed by Ryosuke Niwa.
1393
1394         * UIProcess/Cocoa/WebViewImpl.mm:
1395         (WebKit::WebViewImpl::registerEditCommand):
1396         * UIProcess/WebEditCommandProxy.cpp:
1397         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
1398         * UIProcess/WebEditCommandProxy.h:
1399
1400         Drive-by tweak: make WebEditCommandProxy's backpointer to its WebPageProxy a WeakPtr instead of a raw pointer.
1401         Additionally, call clear() instead of setting m_page to 0 upon invalidation. Also, turn the WebPageProxy*
1402         argument into a WebPageProxy&, since the WebPageProxy must exist when it creates a new WebEditCommandProxy.
1403
1404         (WebKit::WebEditCommandProxy::create):
1405         (WebKit::WebEditCommandProxy::label const):
1406         (WebKit::WebEditCommandProxy::invalidate):
1407         (WebKit::WebEditCommandProxy::editAction const): Deleted.
1408
1409         Adjust UI-side logic to just handle the undo/redo label, rather than map the edit action to a localized string.
1410
1411         * UIProcess/WebPageProxy.cpp:
1412         (WebKit::WebPageProxy::registerEditCommandForUndo):
1413         (WebKit::WebPageProxy::resetState):
1414
1415         Tweak this to use std::exchange instead of copying all the WebEditCommandProxy RefPtrs into a separate Vector
1416         and then iterating over the Vector.
1417
1418         * UIProcess/WebPageProxy.h:
1419         * UIProcess/WebPageProxy.messages.in:
1420
1421         Adjust this so that we only send the undo/redo label over IPC, rather than the edit action type.
1422
1423         * UIProcess/ios/PageClientImplIOS.mm:
1424         (WebKit::PageClientImpl::registerEditCommand):
1425         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1426         (WebKit::WebEditorClient::registerUndoStep):
1427
1428 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1429
1430         [SOUP] Remove libsoup cruft from WebProcess
1431         https://bugs.webkit.org/show_bug.cgi?id=193710
1432
1433         Reviewed by Carlos Garcia Campos.
1434
1435         SoupNetworkSession is no longer accessible from the web process because it's owned
1436         (indirectly) by NetworkProcess after r240292. It doesn't make sense to have any libsoup
1437         code under WebProcess anymore. The current libsoup code consists of (a) unused stuff to be
1438         removed, (b) stuff unrelated to libsoup, which should move to a WebProcessGLib.cpp, and (c)
1439         WebKitSoupRequestInputStream, which is only used by NetworkProcess and should move there
1440
1441         * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.cpp.
1442         (AsyncReadData::AsyncReadData):
1443         (webkitSoupRequestInputStreamReadAsyncResultComplete):
1444         (webkitSoupRequestInputStreamPendingReadAsyncComplete):
1445         (webkitSoupRequestInputStreamHasDataToRead):
1446         (webkitSoupRequestInputStreamIsWaitingForData):
1447         (webkitSoupRequestInputStreamReadAsync):
1448         (webkitSoupRequestInputStreamReadFinish):
1449         (webkitSoupRequestInputStreamFinalize):
1450         (webkit_soup_request_input_stream_init):
1451         (webkit_soup_request_input_stream_class_init):
1452         (webkitSoupRequestInputStreamNew):
1453         (webkitSoupRequestInputStreamAddData):
1454         (webkitSoupRequestInputStreamDidFailWithError):
1455         (webkitSoupRequestInputStreamFinished):
1456         * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Renamed from Source/WebKit/WebProcess/soup/WebKitSoupRequestInputStream.h.
1457         * SourcesGTK.txt:
1458         * SourcesWPE.txt:
1459         * UIProcess/soup/WebProcessPoolSoup.cpp:
1460         (WebKit::WebProcessPool::setNetworkProxySettings): Don't send message to web processes.
1461         * WebProcess/WebProcess.h:
1462         * WebProcess/WebProcess.messages.in:
1463         * WebProcess/glib/WebProcessGLib.cpp: Renamed from Source/WebKit/WebProcess/soup/WebProcessSoup.cpp.
1464         (WebKit::WebProcess::platformSetCacheModel):
1465         (WebKit::WebProcess::platformInitializeWebProcess):
1466         (WebKit::WebProcess::platformTerminate):
1467
1468 2019-01-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1469
1470         [SOUP] Clean up NetworkStorageSession
1471         https://bugs.webkit.org/show_bug.cgi?id=193707
1472
1473         Reviewed by Carlos Garcia Campos.
1474
1475         Restore an important call to clearSoupNetworkSession that was removed in r240292. Also,
1476         adapt to NetworkStorageSessions API changes.
1477
1478         * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp:
1479         (WebKit::LegacyCustomProtocolManager::registerScheme):
1480         * NetworkProcess/soup/NetworkProcessMainSoup.cpp:
1481         * NetworkProcess/soup/NetworkProcessSoup.cpp:
1482         (WebKit::NetworkProcess::userPreferredLanguagesChanged):
1483         (WebKit::NetworkProcess::setNetworkProxySettings):
1484         * NetworkProcess/soup/NetworkSessionSoup.cpp:
1485         (WebKit::NetworkSessionSoup::soupSession const):
1486
1487 2019-01-23  Philippe Normand  <pnormand@igalia.com>
1488
1489         [GTK] Crash when browsing inspector:// uri without port set
1490         https://bugs.webkit.org/show_bug.cgi?id=193721
1491
1492         Reviewed by Michael Catanzaro.
1493
1494         * UIProcess/API/gtk/WebKitRemoteInspectorProtocolHandler.cpp:
1495         (WebKit::RemoteInspectorProtocolHandler::handleRequest): Return
1496         back to caller after setting the error, if no port was provided
1497         along with the inspector URL.
1498
1499 2019-01-23  David Kilzer  <ddkilzer@apple.com>
1500
1501         Switch remaining CoreMedia soft-linking in WebKit over to CoreMediaSoftLink.{cpp,h}
1502         <https://webkit.org/b/193694>
1503         <rdar://problem/47464025>
1504
1505         Reviewed by Tim Horton.
1506
1507         * Shared/ios/WebIconUtilities.mm:
1508         - Switch to using CoreMediaSoftLink.{h,mm} in PAL.
1509
1510 2019-01-22  Chris Dumez  <cdumez@apple.com>
1511
1512         Regression(r240178) Some API tests are crashing
1513         https://bugs.webkit.org/show_bug.cgi?id=193680
1514
1515         Reviewed by Alex Christensen.
1516
1517         r240178 made sure that userScripts / scriptMessageHandlers / contentExtensions are always
1518         properly populated in the WebPageCreationParameters. This was needed in case we need to
1519         reconstruct the WebUserContentController on the WebProcess side. However, this caused a
1520         regression in the case we reuse a process where the WebUserContentController still exists
1521         (because it was kept alive, e.g. by the WebPageGroup). In that case, we would add duplicate
1522         entries to the existing WebUserContentController instance because its "add" methods did not
1523         have duplicate checks. To address the issue, this patch adds duplicate checks to the
1524         WebUserContentController "add" methods.
1525
1526         * WebProcess/UserContent/WebUserContentController.cpp:
1527         (WebKit::WebUserContentController::addUserScriptMessageHandlerInternal):
1528         (WebKit::WebUserContentController::removeUserScriptMessageHandlerInternal):
1529         (WebKit::WebUserContentController::addUserScriptInternal):
1530         (WebKit::WebUserContentController::removeUserScriptInternal):
1531         (WebKit::WebUserContentController::addUserStyleSheetInternal):
1532         (WebKit::WebUserContentController::removeUserStyleSheetInternal):
1533         (WebKit::WebUserContentController::forEachUserMessageHandler const):
1534         * WebProcess/UserContent/WebUserContentController.h:
1535
1536 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1537
1538         Unreviewed attempt to fix GTK/WPE bots
1539         https://bugs.webkit.org/show_bug.cgi?id=193580
1540         <rdar://problem/47457742>
1541
1542         Doesn't make sense to clear the storage session right after creating it. This should fix
1543         network process crash on startup under G_DEBUG=fatal-criticals due to the storage session
1544         not having a cookie jar.
1545
1546         * NetworkProcess/NetworkProcess.cpp:
1547         (WebKit::NetworkProcess::NetworkProcess):
1548
1549 2019-01-22  Megan Gardner  <megan_gardner@apple.com>
1550
1551         Cancel Web Touches Properly so that long presses on YouTube links do not incorrectly trigger a load
1552         https://bugs.webkit.org/show_bug.cgi?id=193687
1553         <rdar://problem/47056717>
1554
1555         Reviewed by Tim Horton.
1556
1557         Cancel web gestures when a long press is recognized.
1558
1559         * Platform/spi/ios/UIKitSPI.h:
1560         * UIProcess/ios/WKContentViewInteraction.mm:
1561         (-[WKContentView _cancelWebGestureRecognizer]):
1562         (-[WKContentView _longPressRecognized:]):
1563
1564 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1565
1566         Fix an internal build failure after r240292
1567         https://bugs.webkit.org/show_bug.cgi?id=193580
1568
1569         Rubber-stamped by Wenson Hsieh.
1570
1571         * SourcesCocoa.txt:
1572         * UIProcess/mac/WebContextMenuProxyMac.mm:
1573         (-[WKMenuTarget forwardContextMenuAction:]):
1574         * WebKit.xcodeproj/project.pbxproj:
1575         It was apparently unclear to the compiler sometimes which "state" selector to use, and this apparently mattered.
1576         Tell the compiler to use the NSMenuItem selector, but at runtime it doesn't matter.
1577
1578 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1579
1580         Unreviewed, fix -Wunused-but-set-variable warning
1581         https://bugs.webkit.org/show_bug.cgi?id=193660
1582         <rdar://problem/47433602>
1583
1584         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1585         (WebKit::WebsiteDataStore::removeData):
1586
1587 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1588
1589         Unreviewed, further build fixes after r240292
1590         https://bugs.webkit.org/show_bug.cgi?id=193580
1591         <rdar://problem/47457742>
1592
1593         Oops.
1594
1595         * NetworkProcess/NetworkProcess.cpp:
1596         (WebKit::NetworkProcess::defaultStorageSession const):
1597
1598 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1599
1600         Unreviewed, further build fixes after r240292
1601         https://bugs.webkit.org/show_bug.cgi?id=193580
1602         <rdar://problem/47457742>
1603
1604         This builds for libsoup. Doesn't work, but at least builds.
1605
1606         Also, speculative fixes for curl.
1607
1608         * NetworkProcess/NetworkProcess.cpp:
1609         (WebKit::NetworkProcess::defaultStorageSession const):
1610
1611 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1612
1613         Unreviewed, further build fixes after r240292
1614         https://bugs.webkit.org/show_bug.cgi?id=193580
1615         <rdar://problem/47457742>
1616
1617         Still not working yet.
1618
1619         * NetworkProcess/NetworkProcess.cpp:
1620         (WebKit::NetworkProcess::NetworkProcess):
1621         * UIProcess/API/APIHTTPCookieStore.h:
1622
1623 2019-01-22  Antti Koivisto  <antti@apple.com>
1624
1625         [iOS] Flash when swiping back to Google search result page
1626         https://bugs.webkit.org/show_bug.cgi?id=193668
1627         <rdar://problem/47071684>
1628
1629         Reviewed by Simon Fraser.
1630
1631         If the google page is scrolled, there is sometimes a short flash.
1632
1633         When restoring the page state we also restore exposedContentRect which is used to determine
1634         which part of the page to create layers for. Scroll position is restored by the UI process
1635         later so we rely on this to get the right layers for the initial view update.
1636
1637         A viewport configuration update may sometimes trample over the restored exposedContentRect,
1638         moving it to top left. In this case the initial layer tree unfreeze commit may not have
1639         layers to cover the actual visible view position.
1640
1641         * WebProcess/WebPage/WebPage.cpp:
1642         (WebKit::WebPage::didCommitLoad):
1643         * WebProcess/WebPage/WebPage.h:
1644         * WebProcess/WebPage/ios/WebPageIOS.mm:
1645         (WebKit::WebPage::restorePageState):
1646
1647         Set a bit to indicate we have already restored the exposedContentRect.
1648
1649         (WebKit::WebPage::viewportConfigurationChanged):
1650
1651         Only reset exposedContentRect if wasn't already set by restorePageState.
1652
1653 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1654
1655         Fix more builds.
1656
1657         * SourcesCocoa.txt:
1658         * WebKit.xcodeproj/project.pbxproj:
1659
1660 2019-01-22  Michael Catanzaro  <mcatanzaro@igalia.com>
1661
1662         Another build fix after r240292
1663         https://bugs.webkit.org/show_bug.cgi?id=193580
1664         <rdar://problem/47457742>
1665
1666         Unreviewed, still not enough to fix soup builds, but closer.
1667
1668         * UIProcess/API/APIHTTPCookieStore.h:
1669
1670 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1671
1672         Fix some builds after r240292
1673         https://bugs.webkit.org/show_bug.cgi?id=193580
1674
1675         * NetworkProcess/NetworkProcess.cpp:
1676         (WebKit::NetworkProcess::switchToNewTestingSession):
1677         * NetworkProcess/cache/NetworkCache.cpp:
1678         (WebKit::NetworkCache::Cache::retrieve):
1679
1680 2019-01-22  Brian Burg  <bburg@apple.com>
1681
1682         Automation.computeElementLayout should return visual viewport-aware coordinates
1683         https://bugs.webkit.org/show_bug.cgi?id=193598
1684         <rdar://problem/35325644>
1685
1686         Unreviewed, restore a mistakenly-deleted line whose absence causes hangs.
1687
1688         * Shared/CoordinateSystem.h:
1689
1690 2019-01-22  Alex Christensen  <achristensen@webkit.org>
1691
1692         Move NetworkStorageSession ownership to NetworkProcess
1693         https://bugs.webkit.org/show_bug.cgi?id=193580
1694
1695         Reviewed by Geoff Garen.
1696
1697         * NetworkProcess/Cookies/WebCookieManager.cpp:
1698         (WebKit::WebCookieManager::WebCookieManager):
1699         (WebKit::WebCookieManager::getHostnamesWithCookies):
1700         (WebKit::WebCookieManager::deleteCookiesForHostname):
1701         (WebKit::WebCookieManager::deleteAllCookies):
1702         (WebKit::WebCookieManager::deleteCookie):
1703         (WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
1704         (WebKit::WebCookieManager::getAllCookies):
1705         (WebKit::WebCookieManager::getCookies):
1706         (WebKit::WebCookieManager::setCookie):
1707         (WebKit::WebCookieManager::setCookies):
1708         (WebKit::WebCookieManager::startObservingCookieChanges):
1709         (WebKit::WebCookieManager::stopObservingCookieChanges):
1710         * NetworkProcess/Cookies/WebCookieManager.h:
1711         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
1712         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
1713         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1714         (WebKit::storageSession):
1715         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1716         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1717         (WebKit::NetworkConnectionToWebProcess::cookiesEnabled):
1718         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1719         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1720         (WebKit::NetworkConnectionToWebProcess::deleteCookie):
1721         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForFrame):
1722         (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage):
1723         * NetworkProcess/NetworkProcess.cpp:
1724         (WebKit::NetworkProcess::initializeNetworkProcess):
1725         (WebKit::NetworkProcess::clearCachedCredentials):
1726         (WebKit::NetworkProcess::switchToNewTestingSession):
1727         (WebKit::NetworkProcess::ensureSession):
1728         (WebKit::NetworkProcess::storageSession const):
1729         (WebKit::NetworkProcess::defaultStorageSession const):
1730         (WebKit::NetworkProcess::forEachNetworkStorageSession):
1731         (WebKit::NetworkProcess::destroySession):
1732         (WebKit::NetworkProcess::updatePrevalentDomainsToBlockCookiesFor):
1733         (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
1734         (WebKit::NetworkProcess::hasStorageAccessForFrame):
1735         (WebKit::NetworkProcess::getAllStorageAccessEntries):
1736         (WebKit::NetworkProcess::grantStorageAccess):
1737         (WebKit::NetworkProcess::removeAllStorageAccess):
1738         (WebKit::NetworkProcess::removePrevalentDomains):
1739         (WebKit::NetworkProcess::setCacheMaxAgeCapForPrevalentResources):
1740         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
1741         (WebKit::NetworkProcess::fetchWebsiteData):
1742         (WebKit::NetworkProcess::deleteWebsiteData):
1743         (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
1744         * NetworkProcess/NetworkProcess.h:
1745         * NetworkProcess/NetworkResourceLoader.cpp:
1746         (WebKit::NetworkResourceLoader::validateCacheEntryForMaxAgeCapValidation):
1747         (WebKit::NetworkResourceLoader::logCookieInformation const):
1748         * NetworkProcess/NetworkSession.cpp:
1749         (WebKit::NetworkSession::networkStorageSession const):
1750         * NetworkProcess/NetworkStorageSessionProvider.h:
1751         * NetworkProcess/cache/NetworkCache.cpp:
1752         (WebKit::NetworkCache::makeUseDecision):
1753         (WebKit::NetworkCache::Cache::retrieve):
1754         (WebKit::NetworkCache::Cache::makeEntry):
1755         (WebKit::NetworkCache::Cache::makeRedirectEntry):
1756         (WebKit::NetworkCache::Cache::update):
1757         * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp:
1758         (WebKit::NetworkCache::SpeculativeLoad::willSendRedirectedRequest):
1759         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1760         (WebKit::NetworkProcess::platformSyncAllCookies):
1761         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1762         (-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
1763         (-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
1764         (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
1765         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1766         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1767         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1768         * SourcesCocoa.txt:
1769         * UIProcess/API/APIHTTPCookieStore.cpp:
1770         (API::HTTPCookieStore::~HTTPCookieStore):
1771         (API::HTTPCookieStore::cookies):
1772         (API::HTTPCookieStore::setCookie):
1773         (API::HTTPCookieStore::deleteCookie):
1774         (API::HTTPCookieStore::registerObserver):
1775         (API::HTTPCookieStore::unregisterObserver):
1776         (API::HTTPCookieStore::registerForNewProcessPoolNotifications):
1777         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
1778         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
1779         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
1780         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
1781         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
1782         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
1783         * UIProcess/API/APIHTTPCookieStore.h:
1784         * UIProcess/API/Cocoa/APIHTTPCookieStoreCocoa.mm: Added.
1785         (API::HTTPCookieStore::flushDefaultUIProcessCookieStore):
1786         (API::HTTPCookieStore::getAllDefaultUIProcessCookieStoreCookies):
1787         (API::HTTPCookieStore::setCookieInDefaultUIProcessCookieStore):
1788         (API::HTTPCookieStore::deleteCookieFromDefaultUIProcessCookieStore):
1789         (API::HTTPCookieStore::startObservingChangesToDefaultUIProcessCookieStore):
1790         (API::HTTPCookieStore::stopObservingChangesToDefaultUIProcessCookieStore):
1791         * UIProcess/WebProcessPool.cpp:
1792         (WebKit::WebProcessPool::clearCachedCredentials):
1793         * WebKit.xcodeproj/project.pbxproj:
1794         * WebProcess/Plugins/PluginView.cpp:
1795         (WebKit::PluginView::getAuthenticationInfo):
1796         * WebProcess/WebProcess.cpp:
1797         (WebKit::WebProcess::deleteWebsiteData):
1798         (WebKit::WebProcess::clearCachedCredentials): Deleted.
1799         * WebProcess/WebProcess.h:
1800         * WebProcess/WebProcess.messages.in:
1801
1802 2019-01-22  Per Arne Vollan  <pvollan@apple.com>
1803
1804         [macOS] Adjust logging policy in WebKit's sandbox
1805         https://bugs.webkit.org/show_bug.cgi?id=193454
1806
1807         Reviewed by Brent Fulgham.
1808
1809         Add a rule to initially deny all calls, since the default is to allow every call.
1810         Later rules allow syscalls that we determined are needed for proper WebKit function.
1811         This reduces the API surface available to attackers.
1812
1813         * WebProcess/com.apple.WebProcess.sb.in:
1814
1815 2019-01-22  Daniel Bates  <dabates@apple.com>
1816
1817         [iOS] WebKit should handle shift state changes when using the software keyboard
1818         https://bugs.webkit.org/show_bug.cgi?id=191475
1819         <rdar://problem/45949246>
1820
1821         Reviewed by Brent Fulgham.
1822
1823         Implement UIKit SPI to be notified of shift state changes to the software keyboard
1824         and dispatch a synthetic keydown or keyup event for either the Shift key or Caps Lock
1825         key.
1826
1827         A side benefit of this change is that we now show and hide the caps lock indicator
1828         in a focused password field when caps lock is enabled or disabled using the software
1829         keyboard, respectively.
1830
1831         * Platform/spi/ios/UIKitSPI.h: Expose more SPI.
1832         * SourcesCocoa.txt:
1833         * UIProcess/ios/WKContentViewInteraction.mm:
1834         (-[WKContentView modifierFlagsDidChangeFrom:to:]): Create a synthetic flags changed
1835         web event based on the state change and dispatch it.
1836         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Early return if the event
1837         was a synethic flags change event so that we do not notify UIKit about this event
1838         as it does not know anything about such synthetic events.
1839         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.h: Added.
1840         * UIProcess/ios/WKSyntheticFlagsChangedWebEvent.mm: Added.
1841         (-[WKSyntheticFlagsChangedWebEvent initWithKeyCode:modifiers:keyDown:]):
1842         (-[WKSyntheticFlagsChangedWebEvent initWithCapsLockState:]):
1843         (-[WKSyntheticFlagsChangedWebEvent initWithShiftState:]):
1844         * WebKit.xcodeproj/project.pbxproj:
1845
1846 2019-01-22  Daniel Bates  <dabates@apple.com>
1847
1848         [iOS] Interpret text key commands on keydown and app key commands on keypress
1849         https://bugs.webkit.org/show_bug.cgi?id=192897
1850         <rdar://problem/46857378>
1851
1852         Reviewed by Brent Fulgham.
1853
1854         Adopt SPI to interpret text key commands and app key commands independently on keydown (isCharEvent
1855         is false) and keypress (isCharEvent is true), respectively.
1856
1857         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
1858         * UIProcess/ios/WKContentViewInteraction.mm:
1859         (-[WKContentView _interpretKeyEvent:isCharEvent:]):
1860
1861 2019-01-22  David Kilzer  <ddkilzer@apple.com>
1862
1863         C strings in ClientCertificateAuthenticationXPCConstants.h are duplicated
1864         <https://webkit.org/b/193607>
1865         <rdar://problem/47334613>
1866
1867         Reviewed by Alex Christensen.
1868
1869         * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
1870         (WebKit::AuthenticationManager::initializeConnection):
1871         * UIProcess/Authentication/cocoa/AuthenticationChallengeProxyCocoa.mm:
1872         (WebKit::AuthenticationChallengeProxy::sendClientCertificateCredentialOverXpc):
1873         - Update name of constants.
1874
1875         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.cpp: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h.
1876         * Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h:
1877         - Put constant values in a namespace, and move values to
1878           ClientCertificateAuthenticationXPCConstants.cpp.
1879
1880         * SourcesCocoa.txt:
1881         * UnifiedSources-input.xcfilelist:
1882         * WebKit.xcodeproj/project.pbxproj:
1883         - Add ClientCertificateAuthenticationXPCConstants.cpp.
1884
1885 2019-01-22  David Kilzer  <ddkilzer@apple.com>
1886
1887         Switch remaining QuickLook soft-linking in WebCore, WebKit over to QuickLookSoftLink.{cpp,h}
1888         <https://webkit.org/b/193654>
1889         <rdar://problem/47430290>
1890
1891         Reviewed by Alex Christensen.
1892
1893         - Moves QuickLookSoftLink.{h,mm} to PAL.
1894         - Adds soft-link to 3 classes to consolidate QuickLook.framework
1895           soft-linking.
1896         - Updates existing source to work with above changes.
1897
1898         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
1899         (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
1900         (WebKit::SystemPreviewController::start):
1901         * UIProcess/ios/WKSystemPreviewView.mm:
1902         (-[WKSystemPreviewView web_setContentProviderData:suggestedFilename:]):
1903         - Switch to using QuickLookSoftLink.{h,mm} in PAL.
1904
1905 2019-01-22  Oriol Brufau  <obrufau@igalia.com>
1906
1907         [css-logical] Implement flow-relative margin, padding and border shorthands
1908         https://bugs.webkit.org/show_bug.cgi?id=188697
1909
1910         Reviewed by Simon Fraser and Antti Koivisto.
1911
1912         Add a CSSLogicalEnabled runtime flag.
1913
1914         * Shared/WebPreferences.yaml:
1915
1916 2019-01-22  Frederic Wang  <fwang@igalia.com>
1917
1918         Enable CSSOMViewScrollingAPI
1919         https://bugs.webkit.org/show_bug.cgi?id=189472
1920
1921         Reviewed by Simon Fraser.
1922
1923         This patch enables the CSSOMViewScrollingAPI option by default. This feature has already been
1924         enabled in tests since r235855. Basically, this change fixes an old compatibility issue
1925         regarding which scrolling element correspond to the viewport in standard mode (WebKit uses
1926         document.body while Gecko/Edge/Chromium use document.documentElement as described in the
1927         CSSOM View specification). WebKit developers writing tests can use document.scrollingElement
1928         for that purpose, so that they work independently of whether the option is enabled.
1929
1930         [1] https://lists.webkit.org/pipermail/webkit-dev/2018-January/029857.html
1931
1932         * Shared/WebPreferences.yaml: Enable by default and remove "experimental" category in
1933         accordance with the new policy. Instead, keep an internal flag only for developers.
1934
1935 2019-01-21  Antti Koivisto  <antti@apple.com>
1936
1937         [iOS] Handle hit testing for subframes
1938         https://bugs.webkit.org/show_bug.cgi?id=192303
1939
1940         Reviewed by Frédéric Wang.
1941
1942         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1943         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
1944
1945         Only set delegatesScrolling for the main frame.
1946
1947 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
1948
1949         Unreviewed test fix after r240243
1950         Nhttps://bugs.webkit.org/show_bug.cgi?id=193660
1951         <rdar://problem/47433602>
1952
1953         The new ResourceLoadStatistics section of 'removeData' was incrementing the
1954         pending callback count before deciding whether to send a message to delete
1955         data. This left the count out-of-balance leading to the operation never
1956         completing.
1957
1958         This patch also prevents sending a second message to the NetworkProcess
1959         requesting data be deleted if the message was already sent in an earlier
1960         section of the method (e.g., as typically happens when all website data
1961         is being deleted).
1962
1963         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1964         (WebKit::WebsiteDataStore::removeData):
1965
1966 2019-01-21  Brent Fulgham  <bfulgham@apple.com>
1967
1968         Implement message handlers for NetworkProcess-based ResourceLoadStatistics
1969         https://bugs.webkit.org/show_bug.cgi?id=193556
1970         <rdar://problem/47368501>
1971
1972         Reviewed by Alex Christensen.
1973
1974         This patch adds a number of sibling methods for tracking ResourceLoadStatistics when the
1975         observations are being handled in the NetworkProcess, rather than the UIProcess. The
1976         original versions of these methods will be removed as part of Bug 193303.
1977
1978         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
1979         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
1980         (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
1981         (WebKit::ResourceLoadStatisticsMemoryStore::grandfatherExistingWebsiteData):
1982         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.h:
1983         (WebKit::ResourceLoadStatisticsMemoryStore::store const):
1984         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
1985         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
1986         (WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenTelemetryWasCaptured):
1987         (WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
1988         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
1989         (WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
1990         (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
1991         (WebKit::WebResourceLoadStatisticsStore::callHasStorageAccessForFrameHandler):
1992         (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
1993         (WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
1994         (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
1995         (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
1996         (WebKit::WebResourceLoadStatisticsStore::setLastSeen):
1997         (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
1998         (WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
1999         (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
2000         (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
2001         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubresourceUnder):
2002         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
2003         (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
2004         (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
2005         (WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
2006         (WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
2007         (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
2008         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
2009         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
2010         (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
2011         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
2012         (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
2013         (WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2014         (WebKit::WebResourceLoadStatisticsStore::logTestingEvent):
2015         (WebKit::WebResourceLoadStatisticsStore::notifyResourceLoadStatisticsProcessed):
2016         (WebKit::WebResourceLoadStatisticsStore::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2017         (WebKit::WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsWithWebsiteData):
2018         (WebKit::WebResourceLoadStatisticsStore::sendDiagnosticMessageWithValue const):
2019         (WebKit::WebResourceLoadStatisticsStore::notifyPageStatisticsTelemetryFinished const):
2020         * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
2021         * NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp:
2022         (WebKit::submitTopList):
2023         (WebKit::submitTopLists):
2024         (WebKit::notifyPages):
2025         (WebKit::WebResourceLoadStatisticsTelemetry::calculateAndSubmit):
2026         (WebKit::nonEphemeralWebPageProxy): Deleted.
2027         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2028         (WebKit::NetworkConnectionToWebProcess::logUserInteraction):
2029         * NetworkProcess/NetworkConnectionToWebProcess.h:
2030         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2031         * NetworkProcess/NetworkProcess.cpp:
2032         (WebKit::NetworkProcess::dumpResourceLoadStatistics):
2033         (WebKit::NetworkProcess::isGrandfathered):
2034         (WebKit::NetworkProcess::isPrevalentResource):
2035         (WebKit::NetworkProcess::isVeryPrevalentResource):
2036         (WebKit::NetworkProcess::setGrandfathered):
2037         (WebKit::NetworkProcess::setPrevalentResource):
2038         (WebKit::NetworkProcess::setPrevalentResourceForDebugMode):
2039         (WebKit::NetworkProcess::setVeryPrevalentResource):
2040         (WebKit::NetworkProcess::clearPrevalentResource):
2041         (WebKit::NetworkProcess::submitTelemetry):
2042         (WebKit::NetworkProcess::scheduleCookieBlockingUpdate):
2043         (WebKit::NetworkProcess::scheduleClearInMemoryAndPersistent):
2044         (WebKit::NetworkProcess::resetParametersToDefaultValues):
2045         (WebKit::NetworkProcess::scheduleStatisticsAndDataRecordsProcessing):
2046         (WebKit::NetworkProcess::setNotifyPagesWhenDataRecordsWereScanned):
2047         (WebKit::NetworkProcess::setNotifyPagesWhenTelemetryWasCaptured):
2048         (WebKit::NetworkProcess::setSubframeUnderTopFrameOrigin):
2049         (WebKit::NetworkProcess::isRegisteredAsRedirectingTo):
2050         (WebKit::NetworkProcess::isRegisteredAsSubFrameUnder):
2051         (WebKit::NetworkProcess::setSubresourceUnderTopFrameOrigin):
2052         (WebKit::NetworkProcess::setSubresourceUniqueRedirectTo):
2053         (WebKit::NetworkProcess::setSubresourceUniqueRedirectFrom):
2054         (WebKit::NetworkProcess::isRegisteredAsSubresourceUnder):
2055         (WebKit::NetworkProcess::setTopFrameUniqueRedirectTo):
2056         (WebKit::NetworkProcess::setTopFrameUniqueRedirectFrom):
2057         (WebKit::NetworkProcess::setLastSeen):
2058         (WebKit::NetworkProcess::hasStorageAccess):
2059         (WebKit::NetworkProcess::requestStorageAccess):
2060         (WebKit::NetworkProcess::grantStorageAccess):
2061         (WebKit::NetworkProcess::logUserInteraction):
2062         (WebKit::NetworkProcess::hadUserInteraction):
2063         (WebKit::NetworkProcess::clearUserInteraction):
2064         (WebKit::NetworkProcess::setGrandfatheringTime):
2065         (WebKit::NetworkProcess::setMaxStatisticsEntries):
2066         (WebKit::NetworkProcess::setMinimumTimeBetweenDataRecordsRemoval):
2067         (WebKit::NetworkProcess::setPruneEntriesDownTo):
2068         (WebKit::NetworkProcess::setTimeToLiveUserInteraction):
2069         (WebKit::NetworkProcess::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2070         (WebKit::NetworkProcess::setResourceLoadStatisticsEnabled):
2071         (WebKit::NetworkProcess::setResourceLoadStatisticsDebugMode):
2072         (WebKit::NetworkProcess::resetCacheMaxAgeCapForPrevalentResources):
2073         (WebKit::NetworkProcess::deleteWebsiteData):
2074         (WebKit::filterForTopLevelDomains):
2075         (WebKit::NetworkProcess::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2076         (WebKit::NetworkProcess::topPrivatelyControlledDomainsWithWebsiteData):
2077         * NetworkProcess/NetworkProcess.h:
2078         * NetworkProcess/NetworkProcess.messages.in:
2079         * NetworkProcess/NetworkSession.cpp:
2080         (WebKit::NetworkSession::setResourceLoadStatisticsEnabled):
2081         (WebKit::NetworkSession::notifyResourceLoadStatisticsProcessed):
2082         (WebKit::NetworkSession::logDiagnosticMessageWithValue):
2083         (WebKit::NetworkSession::notifyPageStatisticsTelemetryFinished):
2084         (WebKit::NetworkSession::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
2085         (WebKit::NetworkSession::topPrivatelyControlledDomainsWithWebsiteData):
2086         (WebKit::NetworkSession::enableResourceLoadStatistics): Deleted.
2087         * NetworkProcess/NetworkSession.h:
2088         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2089         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2090         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2091         (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
2092         (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
2093         (WKWebsiteDataStoreSetStatisticsLastSeen):
2094         (WKWebsiteDataStoreSetStatisticsPrevalentResource):
2095         (WKWebsiteDataStoreSetStatisticsVeryPrevalentResource):
2096         (WKWebsiteDataStoreDumpResourceLoadStatistics):
2097         (WKWebsiteDataStoreIsStatisticsPrevalentResource):
2098         (WKWebsiteDataStoreIsStatisticsVeryPrevalentResource):
2099         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubresourceUnder):
2100         (WKWebsiteDataStoreIsStatisticsRegisteredAsSubFrameUnder):
2101         (WKWebsiteDataStoreIsStatisticsRegisteredAsRedirectingTo):
2102         (WKWebsiteDataStoreSetStatisticsHasHadUserInteraction):
2103         (WKWebsiteDataStoreIsStatisticsHasHadUserInteraction):
2104         (WKWebsiteDataStoreSetStatisticsGrandfathered):
2105         (WKWebsiteDataStoreIsStatisticsGrandfathered):
2106         (WKWebsiteDataStoreSetStatisticsSubframeUnderTopFrameOrigin):
2107         (WKWebsiteDataStoreSetStatisticsSubresourceUnderTopFrameOrigin):
2108         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectTo):
2109         (WKWebsiteDataStoreSetStatisticsSubresourceUniqueRedirectFrom):
2110         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectTo):
2111         (WKWebsiteDataStoreSetStatisticsTopFrameUniqueRedirectFrom):
2112         (WKWebsiteDataStoreSetStatisticsTimeToLiveUserInteraction):
2113         (WKWebsiteDataStoreStatisticsProcessStatisticsAndDataRecords):
2114         (WKWebsiteDataStoreStatisticsUpdateCookieBlocking):
2115         (WKWebsiteDataStoreStatisticsSubmitTelemetry):
2116         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenDataRecordsWereScanned):
2117         (WKWebsiteDataStoreSetStatisticsShouldClassifyResourcesBeforeDataRecordsRemoval):
2118         (WKWebsiteDataStoreSetStatisticsNotifyPagesWhenTelemetryWasCaptured):
2119         (WKWebsiteDataStoreSetStatisticsMinimumTimeBetweenDataRecordsRemoval):
2120         (WKWebsiteDataStoreSetStatisticsGrandfatheringTime):
2121         (WKWebsiteDataStoreSetStatisticsMaxStatisticsEntries):
2122         (WKWebsiteDataStoreSetStatisticsPruneEntriesDownTo):
2123         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStore):
2124         (WKWebsiteDataStoreStatisticsClearInMemoryAndPersistentStoreModifiedSinceHours):
2125         (WKWebsiteDataStoreStatisticsResetToConsistentState):
2126         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2127         (-[WKWebsiteDataStore _setResourceLoadStatisticsTestingCallback:]):
2128         * UIProcess/Network/NetworkProcessProxy.cpp:
2129         (WebKit::NetworkProcessProxy::clearCallbackStates):
2130         (WebKit::NetworkProcessProxy::didClose):
2131         (WebKit::nonEphemeralWebPageProxy):
2132         (WebKit::NetworkProcessProxy::logGlobalDiagnosticMessageWithValue):
2133         (WebKit::NetworkProcessProxy::dumpResourceLoadStatistics):
2134         (WebKit::NetworkProcessProxy::didDumpResourceLoadStatistics):
2135         (WebKit::NetworkProcessProxy::updatePrevalentDomainsToBlockCookiesFor):
2136         (WebKit::NetworkProcessProxy::didUpdateBlockCookies):
2137         (WebKit::NetworkProcessProxy::isPrevalentResource):
2138         (WebKit::NetworkProcessProxy::isPrevalentResourceResult):
2139         (WebKit::NetworkProcessProxy::isVeryPrevalentResource):
2140         (WebKit::NetworkProcessProxy::setPrevalentResource):
2141         (WebKit::NetworkProcessProxy::setPrevalentResourceForDebugMode):
2142         (WebKit::NetworkProcessProxy::setVeryPrevalentResource):
2143         (WebKit::NetworkProcessProxy::didSetResourceLoadStatisticData):
2144         (WebKit::NetworkProcessProxy::setLastSeen):
2145         (WebKit::NetworkProcessProxy::clearPrevalentResource):
2146         (WebKit::NetworkProcessProxy::scheduleCookieBlockingUpdate):
2147         (WebKit::NetworkProcessProxy::didScheduleCookieBlockingUpdate):
2148         (WebKit::NetworkProcessProxy::scheduleClearInMemoryAndPersistent):
2149         (WebKit::NetworkProcessProxy::didScheduleStatisticsProcessing):
2150         (WebKit::NetworkProcessProxy::scheduleStatisticsAndDataRecordsProcessing):
2151         (WebKit::NetworkProcessProxy::logUserInteraction):
2152         (WebKit::NetworkProcessProxy::hasHadUserInteraction):
2153         (WebKit::NetworkProcessProxy::didHaveUserInteraction):
2154         (WebKit::NetworkProcessProxy::clearUserInteraction):
2155         (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
2156         (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
2157         (WebKit::NetworkProcessProxy::setTimeToLiveUserInteraction):
2158         (WebKit::NetworkProcessProxy::didUpdateRuntimeSettings):
2159         (WebKit::NetworkProcessProxy::setNotifyPagesWhenTelemetryWasCaptured):
2160         (WebKit::NetworkProcessProxy::setNotifyPagesWhenDataRecordsWereScanned):
2161         (WebKit::NetworkProcessProxy::setSubframeUnderTopFrameOrigin):
2162         (WebKit::NetworkProcessProxy::isRegisteredAsRedirectingTo):
2163         (WebKit::NetworkProcessProxy::didIsRegisteredAsRedirectingTo):
2164         (WebKit::NetworkProcessProxy::isRegisteredAsSubFrameUnder):
2165         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubFrameUnder):
2166         (WebKit::NetworkProcessProxy::setSubresourceUnderTopFrameOrigin):
2167         (WebKit::NetworkProcessProxy::isRegisteredAsSubresourceUnder):
2168         (WebKit::NetworkProcessProxy::didIsRegisteredAsSubresourceUnder):
2169         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectTo):
2170         (WebKit::NetworkProcessProxy::setSubresourceUniqueRedirectFrom):
2171         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectTo):
2172         (WebKit::NetworkProcessProxy::setTopFrameUniqueRedirectFrom):
2173         (WebKit::NetworkProcessProxy::isGrandfathered):
2174         (WebKit::NetworkProcessProxy::didIsGrandfathered):
2175         (WebKit::NetworkProcessProxy::setGrandfathered):
2176         (WebKit::NetworkProcessProxy::hasStorageAccess):
2177         (WebKit::NetworkProcessProxy::requestStorageAccess):
2178         (WebKit::NetworkProcessProxy::grantStorageAccess):
2179         (WebKit::NetworkProcessProxy::storageAccessRequestResult):
2180         (WebKit::NetworkProcessProxy::storageAccessOperationResult):
2181         (WebKit::NetworkProcessProxy::didRemoveAllStorageAccess):
2182         (WebKit::NetworkProcessProxy::didSetCacheMaxAgeCapForPrevalentResources):
2183         (WebKit::NetworkProcessProxy::setCacheMaxAgeCap):
2184         (WebKit::NetworkProcessProxy::setGrandfatheringTime):
2185         (WebKit::NetworkProcessProxy::setMaxStatisticsEntries):
2186         (WebKit::NetworkProcessProxy::setMinimumTimeBetweenDataRecordsRemoval):
2187         (WebKit::NetworkProcessProxy::setPruneEntriesDownTo):
2188         (WebKit::NetworkProcessProxy::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2189         (WebKit::NetworkProcessProxy::setResourceLoadStatisticsDebugMode):
2190         (WebKit::NetworkProcessProxy::resetParametersToDefaultValues):
2191         (WebKit::NetworkProcessProxy::submitTelemetry):
2192         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsProcessed):
2193         (WebKit::NetworkProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
2194         (WebKit::NetworkProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
2195         (WebKit::NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished):
2196         (WebKit::NetworkProcessProxy::didLogUserInteraction): Deleted.
2197         (WebKit::NetworkProcessProxy::didResetCacheMaxAgeCapForPrevalentResources): Deleted.
2198         * UIProcess/Network/NetworkProcessProxy.h:
2199         * UIProcess/Network/NetworkProcessProxy.messages.in:
2200         * UIProcess/WebPageProxy.cpp:
2201         (WebKit::WebPageProxy::nonEphemeralWebPageProxy):
2202         * UIProcess/WebPageProxy.h:
2203         * UIProcess/WebProcessPool.cpp:
2204         (WebKit::WebProcessPool::ensureNetworkProcess):
2205         * UIProcess/WebProcessProxy.cpp:
2206         (WebKit::WebProcessProxy::notifyWebsiteDataScanForTopPrivatelyControlledDomainsFinished):
2207         (WebKit::WebProcessProxy::notifyWebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished):
2208         * UIProcess/WebProcessProxy.h:
2209         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2210         (WebKit::WebsiteDataStore::parameters):
2211         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2212         (WebKit::WebsiteDataStore::removeData):
2213         (WebKit::WebsiteDataStore::setMaxStatisticsEntries):
2214         (WebKit::WebsiteDataStore::setPruneEntriesDownTo):
2215         (WebKit::WebsiteDataStore::setGrandfatheringTime):
2216         (WebKit::WebsiteDataStore::setCacheMaxAgeCap):
2217         (WebKit::WebsiteDataStore::setMinimumTimeBetweenDataRecordsRemoval):
2218         (WebKit::WebsiteDataStore::dumpResourceLoadStatistics):
2219         (WebKit::WebsiteDataStore::isPrevalentResource):
2220         (WebKit::WebsiteDataStore::setPrevalentResource):
2221         (WebKit::WebsiteDataStore::setPrevalentResourceForDebugMode):
2222         (WebKit::WebsiteDataStore::isVeryPrevalentResource):
2223         (WebKit::WebsiteDataStore::setVeryPrevalentResource):
2224         (WebKit::WebsiteDataStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
2225         (WebKit::WebsiteDataStore::setSubframeUnderTopFrameOrigin):
2226         (WebKit::WebsiteDataStore::isRegisteredAsSubFrameUnder):
2227         (WebKit::WebsiteDataStore::setSubresourceUnderTopFrameOrigin):
2228         (WebKit::WebsiteDataStore::isRegisteredAsSubresourceUnder):
2229         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectTo):
2230         (WebKit::WebsiteDataStore::setSubresourceUniqueRedirectFrom):
2231         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectTo):
2232         (WebKit::WebsiteDataStore::setTopFrameUniqueRedirectFrom):
2233         (WebKit::WebsiteDataStore::isRegisteredAsRedirectingTo):
2234         (WebKit::WebsiteDataStore::clearPrevalentResource):
2235         (WebKit::WebsiteDataStore::resetParametersToDefaultValues):
2236         (WebKit::WebsiteDataStore::submitTelemetry):
2237         (WebKit::WebsiteDataStore::scheduleClearInMemoryAndPersistent):
2238         (WebKit::WebsiteDataStore::scheduleCookieBlockingUpdate):
2239         (WebKit::WebsiteDataStore::scheduleStatisticsAndDataRecordsProcessing):
2240         (WebKit::WebsiteDataStore::updatePrevalentDomainsToBlockCookiesFor):
2241         (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
2242         (WebKit::WebsiteDataStore::setLastSeen):
2243         (WebKit::WebsiteDataStore::setNotifyPagesWhenDataRecordsWereScanned):
2244         (WebKit::WebsiteDataStore::setNotifyPagesWhenTelemetryWasCaptured):
2245         (WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
2246         (WebKit::WebsiteDataStore::getAllStorageAccessEntries):
2247         (WebKit::WebsiteDataStore::grantStorageAccessHandler):
2248         (WebKit::WebsiteDataStore::removeAllStorageAccessHandler):
2249         (WebKit::WebsiteDataStore::removePrevalentDomains):
2250         (WebKit::WebsiteDataStore::hasStorageAccess):
2251         (WebKit::WebsiteDataStore::requestStorageAccess):
2252         (WebKit::WebsiteDataStore::grantStorageAccess):
2253         (WebKit::WebsiteDataStore::setTimeToLiveUserInteraction):
2254         (WebKit::WebsiteDataStore::logUserInteraction):
2255         (WebKit::WebsiteDataStore::hasHadUserInteraction):
2256         (WebKit::WebsiteDataStore::clearUserInteraction):
2257         (WebKit::WebsiteDataStore::isGrandfathered):
2258         (WebKit::WebsiteDataStore::setGrandfathered):
2259         (WebKit::WebsiteDataStore::setCacheMaxAgeCapForPrevalentResources):
2260         (WebKit::WebsiteDataStore::resetCacheMaxAgeCapForPrevalentResources):
2261         (WebKit::WebsiteDataStore::webPageWasAdded):
2262         (WebKit::WebsiteDataStore::webPageWasInvalidated):
2263         (WebKit::WebsiteDataStore::webProcessWillOpenConnection):
2264         (WebKit::WebsiteDataStore::webPageWillOpenConnection):
2265         (WebKit::WebsiteDataStore::webPageDidCloseConnection):
2266         (WebKit::WebsiteDataStore::webProcessDidCloseConnection):
2267         (WebKit::WebsiteDataStore::isAssociatedProcessPool const):
2268         (WebKit::WebsiteDataStore::processPools const):
2269         (WebKit::WebsiteDataStore::resourceLoadStatisticsEnabled const):
2270         (WebKit::WebsiteDataStore::setResourceLoadStatisticsEnabled):
2271         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
2272         (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback):
2273         (WebKit::WebsiteDataStore::logTestingEvent):
2274         * UIProcess/WebsiteData/WebsiteDataStore.h:
2275         (WebKit::WebsiteDataStore::setStatisticsTestingCallback):
2276         * WebProcess/WebProcess.cpp:
2277         (WebKit::WebProcess::initializeWebProcess):
2278
2279 2019-01-15  Darin Adler  <darin@apple.com>
2280
2281         Use references rather than pointers for register/unregister functions, and more
2282         https://bugs.webkit.org/show_bug.cgi?id=175028
2283
2284         Reviewed by Daniel Bates.
2285
2286         * WebProcess/FullScreen/WebFullScreenManager.cpp:
2287         (WebKit::WebFullScreenManager::willEnterFullScreen): Update for change to the
2288         functions in Document; pass a reference.
2289         (WebKit::WebFullScreenManager::didEnterFullScreen): Ditto, don't pass the element.
2290         (WebKit::WebFullScreenManager::willExitFullScreen): Ditto.
2291         (WebKit::WebFullScreenManager::didExitFullScreen): Ditto.
2292
2293         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
2294         (WebKit::UserMediaPermissionRequestManager::startUserMediaRequest): Pass a reference.
2295         (WebKit::UserMediaPermissionRequestManager::mediaCanStart): Ditto.
2296         (WebKit::UserMediaPermissionRequestManager::removeMediaRequestFromMaps): Ditto.
2297         * WebProcess/Plugins/PluginView.cpp:
2298         (WebKit::PluginView::~PluginView): Ditto.
2299         (WebKit::PluginView::initializePlugin): Ditto.
2300
2301 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2302
2303         Unreviewed, fix -Wreturn-type warning
2304         https://bugs.webkit.org/show_bug.cgi?id=193333
2305         <rdar://problem/45649489>
2306
2307         * UIProcess/Automation/WebAutomationSession.cpp:
2308         (WebKit::toProtocol):
2309
2310 2019-01-20  chris fleizach  <cfleizach@apple.com>
2311
2312         AX: Support returning relative frames for accessibility
2313         https://bugs.webkit.org/show_bug.cgi?id=193414
2314         <rdar://problem/47268501>
2315
2316         Reviewed by Zalan Bujtas.
2317
2318         * UIProcess/API/Cocoa/WKWebView.mm:
2319         (-[WKWebView accessibilityAttributeValue:forParameter:]):
2320         (-[WKWebView IGNORE_WARNINGS_END]):
2321         * UIProcess/API/mac/WKView.mm:
2322         (-[WKView accessibilityAttributeValue:forParameter:]):
2323         (-[WKView IGNORE_WARNINGS_END]):
2324         * UIProcess/Cocoa/WebViewImpl.h:
2325         * UIProcess/Cocoa/WebViewImpl.mm:
2326         (WebKit::WebViewImpl::accessibilityAttributeValue):
2327         * UIProcess/ios/WKContentView.mm:
2328         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
2329
2330 2019-01-20  Michael Catanzaro  <mcatanzaro@igalia.com>
2331
2332         Unreviewed, rolling out r240209.
2333
2334         Broke GTK/WPE injected bundle
2335
2336         Reverted changeset:
2337
2338         "AX: Support returning relative frames for accessibility"
2339         https://bugs.webkit.org/show_bug.cgi?id=193414
2340         https://trac.webkit.org/changeset/240209
2341
2342 2019-01-12  Dan Bernstein  <mitz@apple.com>
2343
2344         [Cocoa] Avoid importing directly from subumbrella frameworks
2345         https://bugs.webkit.org/show_bug.cgi?id=186016
2346         <rdar://problem/40591038>
2347
2348         Reviewed by Sam Weinig.
2349
2350         * Configurations/BaseTarget.xcconfig: Removed -iframework options from OTHER_CFLAGS and
2351           OTHER_CPLUSPLUSFLAGS.
2352         * UIProcess/Automation/mac/WebAutomationSessionMac.mm: Import Carbon.h instead of an
2353           HIToolbox header.
2354         * UIProcess/Cocoa/WebViewImpl.mm: Ditto.
2355         * UIProcess/mac/WKPrintingView.mm: Import Quartz.h instead of a PDFKit header.
2356         * UIProcess/mac/WKTextInputWindowController.mm: Import Carbon.h instead of an HIToolbox
2357           header.
2358         * WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h: Import Quartz.h instead of a
2359           PDFKit header.
2360         * WebProcess/Plugins/PDF/PDFLayerControllerSPI.h: Ditto.
2361         * WebProcess/Plugins/PDF/PDFPlugin.mm: Ditto.
2362         * WebProcess/Plugins/PDF/PDFPluginAnnotation.mm: Ditto.
2363         * WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm: Ditto.
2364         * WebProcess/Plugins/PDF/PDFPluginPasswordField.mm: Ditto.
2365         * WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm: Ditto.
2366         * WebProcess/WebPage/mac/WebPageMac.mm: Ditto.
2367
2368 2019-01-20  chris fleizach  <cfleizach@apple.com>
2369
2370         AX: Support returning relative frames for accessibility
2371         https://bugs.webkit.org/show_bug.cgi?id=193414
2372         <rdar://problem/47268501>
2373
2374         Reviewed by Zalan Bujtas.
2375
2376         * UIProcess/API/Cocoa/WKWebView.mm:
2377         (-[WKWebView accessibilityAttributeValue:forParameter:]):
2378         (-[WKWebView IGNORE_WARNINGS_END]):
2379         * UIProcess/API/mac/WKView.mm:
2380         (-[WKView accessibilityAttributeValue:forParameter:]):
2381         (-[WKView IGNORE_WARNINGS_END]):
2382         * UIProcess/Cocoa/WebViewImpl.h:
2383         * UIProcess/Cocoa/WebViewImpl.mm:
2384         (WebKit::WebViewImpl::accessibilityAttributeValue):
2385         * UIProcess/ios/WKContentView.mm:
2386         (-[WKContentView accessibilityConvertRelativeFrameFromPage:]):
2387
2388 2019-01-20  Antoine Quint  <graouts@apple.com>
2389
2390         Add a POINTER_EVENTS feature flag
2391         https://bugs.webkit.org/show_bug.cgi?id=193577
2392         <rdar://problem/47408511>
2393
2394         Unreviewed. Also enable Pointer Events for iosmac.
2395
2396         * Configurations/FeatureDefines.xcconfig:
2397
2398 2019-01-19  David Kilzer  <ddkilzer@apple.com>
2399
2400         Follow-up: iOS: Updating input mode should update the software keyboard
2401         <https://bugs.webkit.org/show_bug.cgi?id=193565>
2402         <rdar://problem/47376334>
2403
2404         * WebProcess/WebPage/WebPage.cpp:
2405         (WebKit::WebPage::focusedElementDidChangeInputMode): Fix iOS
2406         Debug builds after r240199 by downcasting `element` to
2407         `HTMLElement` before calling canonicalInputMode().
2408
2409 2019-01-19  David Kilzer  <ddkilzer@apple.com>
2410
2411         Sort WebKit Xcode project file
2412
2413         * WebKit.xcodeproj/project.pbxproj:
2414
2415 2019-01-19  Antoine Quint  <graouts@apple.com>
2416
2417         Add a POINTER_EVENTS feature flag
2418         https://bugs.webkit.org/show_bug.cgi?id=193577
2419
2420         Reviewed by Dean Jackson.
2421
2422         * Configurations/FeatureDefines.xcconfig:
2423
2424 2019-01-18  Ryosuke Niwa  <rniwa@webkit.org>
2425
2426         iOS: Updating input mode should update the software keyboard
2427         https://bugs.webkit.org/show_bug.cgi?id=193565
2428         <rdar://problem/47376334>
2429
2430         Reviewed by Wenson Hsieh.
2431
2432         Update the software keyboard when the inputmode content attribute on the focused element had been mutated.
2433
2434         * Scripts/webkit/messages.py:
2435         * Shared/WebCoreArgumentCoders.h:
2436         * UIProcess/PageClient.h:
2437         * UIProcess/WebPageProxy.h:
2438         * UIProcess/WebPageProxy.messages.in:
2439         * UIProcess/ios/PageClientImplIOS.h:
2440         * UIProcess/ios/PageClientImplIOS.mm:
2441         (WebKit::PageClientImpl::focusedElementDidChangeInputMode):
2442         * UIProcess/ios/WKContentViewInteraction.h:
2443         * UIProcess/ios/WKContentViewInteraction.mm:
2444         (-[WKContentView _didUpdateInputMode:]):
2445         * UIProcess/ios/WebPageProxyIOS.mm:
2446         (WebKit::WebPageProxy::focusedElementDidChangeInputMode):
2447         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2448         (WebKit::WebChromeClient::focusedElementDidChangeInputMode):
2449         * WebProcess/WebCoreSupport/WebChromeClient.h:
2450         * WebProcess/WebPage/WebPage.cpp:
2451         (WebKit::WebPage::focusedElementDidChangeInputMode):
2452         * WebProcess/WebPage/WebPage.h:
2453
2454 2019-01-18  Tim Horton  <timothy_horton@apple.com>
2455
2456         Adjust WKDrawingView protocol method name
2457         https://bugs.webkit.org/show_bug.cgi?id=193604
2458
2459         Reviewed by Wenson Hsieh.
2460
2461         * UIProcess/ios/WKDrawingView.mm:
2462         (-[WKDrawingView canvasViewDrawingDidChange:]):
2463         (-[WKDrawingView drawingDidChange:]): Deleted.
2464
2465 2019-01-18  David Kilzer  <ddkilzer@apple.com>
2466
2467         [WebKit] Change Xcode folders to map to folders on disk
2468
2469         * WebKit.xcodeproj/project.pbxproj: Update these folders:
2470         - Shared/Authentication
2471         - Shared/Authentication/cocoa
2472
2473 2019-01-18  Brian Burg  <bburg@apple.com>
2474
2475         Automation.computeElementLayout should return visual viewport-aware coordinates
2476         https://bugs.webkit.org/show_bug.cgi?id=193598
2477         <rdar://problem/35325644>
2478
2479         Reviewed by Simon Fraser.
2480
2481         Previously I added CoordinateSystem::VisualViewport to stub out this for iOS.
2482         But I think that it's a mistake for safaridriver to care about VisualViewport
2483         being enabled or not, because it is a runtime-switchable setting.
2484
2485         This patch removes CoordinateSystem::VisualViewport. Make the existing
2486         CoordinateSystem::LayoutViewport use visual viewport semantics if needed.
2487
2488         This is tested by WebDriver element clicking tests. There should not be any
2489         difference in behavior until it is possible to zoom with gestures via WebDriver.
2490
2491         * Shared/CoordinateSystem.h:
2492         * UIProcess/Automation/Automation.json:
2493         * UIProcess/Automation/WebAutomationSession.cpp:
2494         (WebKit::protocolStringToCoordinateSystem):
2495         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2496         (WebKit::WebAutomationSessionProxy::computeElementLayout):
2497
2498 2019-01-18  Daniel Bates  <dabates@apple.com>
2499
2500         Fix some build issues.
2501
2502         Include missing header WKDrawingCoordinator.
2503
2504         * UIProcess/ios/WKInkPickerView.mm:
2505
2506 2019-01-18  Tim Horton  <timothy_horton@apple.com>
2507
2508         Get rid of ADVANCED_SPELL_CHECKING
2509         https://bugs.webkit.org/show_bug.cgi?id=193592
2510
2511         Reviewed by Wenson Hsieh.
2512
2513         * UIProcess/Cocoa/WebViewImpl.mm:
2514         (WebKit::WebViewImpl::requestCandidatesForSelectionIfNeeded):
2515         (WebKit::WebViewImpl::insertText):
2516         * UIProcess/mac/TextCheckerMac.mm:
2517         (WebKit::TextChecker::checkTextOfParagraph):
2518         (WebKit::TextChecker::getGuessesForWord):
2519
2520 2019-01-18  Chris Dumez  <cdumez@apple.com>
2521
2522         Regression(PSON) Content blockers are sometimes lost on back navigation cross-site
2523         https://bugs.webkit.org/show_bug.cgi?id=193588
2524         <rdar://problem/47131566>
2525
2526         Reviewed by Alex Christensen.
2527
2528         When the WebPageProxy needs to create initialization parameters for its WebPage in the
2529         WebContent process, it calls WebProcessProxy::addWebUserContentControllerProxy()
2530         which calls WebUserContentControllerProxy::addProcess(). This last call is supposed to
2531         register the WebProcessProxy with the WebUserContentControllerProxy and adding the
2532         contentRuleLists to the WebPageCreationParameters. The issue is that if the
2533         WebUserContentControllerProxy already knows about this WebProcessProxy, it would return
2534         early and not populate the WebPageCreationParameters.
2535
2536         In PSON world, when navigating back to a page that failed to enter page cache, we reuse
2537         the process where we previously loaded the page but re-create a new WebPage on the
2538         WebContent process site. When this happens, WebUserContentControllerProxy would not
2539         add the contentRuleLists to the WebPageCreationParameters and the new WebPage in the
2540         previously-suspended process would be missing them.
2541
2542         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2543         (WebKit::WebUserContentControllerProxy::addProcess):
2544
2545 2019-01-18  Jer Noble  <jer.noble@apple.com>
2546
2547         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
2548         https://bugs.webkit.org/show_bug.cgi?id=189553
2549
2550         Reviewed by Tim Horton.
2551
2552         * Configurations/Base.xcconfig:
2553         * Configurations/BaseTarget.xcconfig:
2554         * Configurations/SDKVariant.xcconfig: Added.
2555
2556 2019-01-18  Antti Koivisto  <antti@apple.com>
2557
2558         Implement asynchronous frame scrolling for iOS
2559         https://bugs.webkit.org/show_bug.cgi?id=193539
2560         <rdar://problem/47379873>
2561
2562         Reviewed by Simon Fraser.
2563
2564         Add a scrolling node type that can handle UIScrollView backed frames.
2565         It basically just instantiates and forwards to the existing ScrollingTreeScrollingNodeDelegateIOS.
2566
2567         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
2568         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
2569         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
2570         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
2571         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h: Added.
2572         * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm: Added.
2573         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::create):
2574         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::ScrollingTreeFrameScrollingNodeRemoteIOS):
2575         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::~ScrollingTreeFrameScrollingNodeRemoteIOS):
2576         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateBeforeChildren):
2577         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
2578         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
2579         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::scrollPosition const):
2580         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::setScrollLayerPosition):
2581         (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll):
2582         * WebKit.xcodeproj/project.pbxproj:
2583
2584 2019-01-18  Chris Dumez  <cdumez@apple.com>
2585
2586         Regression(PSON) Scroll position is not always restored properly when navigating back
2587         https://bugs.webkit.org/show_bug.cgi?id=193578
2588         <rdar://problem/47386331>
2589
2590         Reviewed by Tim Horton.
2591
2592         Fix issues causing the scroll position to not be restored at all (or incorrectly) when
2593         navigating back cross-site with PSON enabled. Also make sure that the swipe gesture
2594         snapshot really stays up until we've restored the scroll position.
2595
2596         Note that even after those changes, I can still sometimes reproduce a white flash when
2597         swiping back to Google search results (scroll position being correct now). This is
2598         tracked by <rdar://problem/47071684> and happens even if I disable PSON entirely.
2599
2600         * Shared/SessionState.cpp:
2601         (WebKit::FrameState::encode const):
2602         (WebKit::FrameState::decode):
2603         * Shared/SessionState.h:
2604         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2605         (WebKit::toFrameState):
2606         (WebKit::applyFrameState):
2607         obscuredInsets is present on the HistoryItem in the WebProcess but was never passed to
2608         or stored by the UIProcess on the WebBackForwardListItem. obscuredInsets is needed to
2609         properly restore the scrollPosition (position was 70px off on my iPad without this).
2610         With PSON enabled, if you swipe back cross-process and the previous page was not put
2611         into PageCache, then the HistoryItem is gone on the WebProcess side. What happens is
2612         that the UIProcess sends its WebBackForwardListItem to the WebProcess, which restores
2613         the HistoryItem there, and then asks it to load it. The obscuredInsets was getting lost
2614         in the process since the UIProcess never knew about it.
2615
2616         * UIProcess/Cocoa/ViewGestureController.cpp:
2617         (WebKit::ViewGestureController::didReachMainFrameLoadTerminalState):
2618         Drop logic that was causing the ViewGestureController to not wait for the scroll position
2619         to be restored before taking down the snapshot, when UI-side compositing is enabled.
2620         If you look at the comment above the code, you'll see that the code in question was meant
2621         to impact only the non-UI side compositing code path. As a matter of fact, when the code
2622         was reviewed at https://bugs.webkit.org/show_bug.cgi?id=151224, it was protected by a
2623         #if PLATFORM(MAC), before getting modified the wrong way before landing. In practice, we
2624         would have often restored the scroll position by the time the load is finished so it would
2625         not cause a flash in most cases. However, with PSON enabled and the layer tree freezing we
2626         do on process-swap, the first post-scroll restoration layer tree commit may now occur a
2627         little bit later and we would lose the race more often.
2628
2629         * UIProcess/WebProcessProxy.cpp:
2630         (WebKit::WebProcessProxy::updateBackForwardItem):
2631         * UIProcess/WebProcessProxy.h:
2632         When adding PageCache support to PSON, we used to navigate the "suspended" page to
2633         about:blank. This would lead to unwanted WebProcessProxy::updateBackForwardItem()
2634         calls from the WebProcess which we wanted to ignore. We thus added logic to ignore
2635         updateBackForwardItem() IPC from the old WebProcess after a swap. The issue with this
2636         is that we sometimes miss/ignore legit updates to the HistoryItem from the old process,
2637         in particular with regards to the scroll position and the pageScaleFactor. So if you
2638         swiped and then quickly enough did a cross-site navigation, the UIProcess'
2639         WebBackForwardList would not get updated with the latest scroll position and we would
2640         thus fail to restore it later on. To address the issue, we now stop ignoring updates
2641         from the old WebProcess after a swap. This logic is no longer needed since we no longer
2642         navigate the old page to about:blank after a swap, we merely suspend it "in place".
2643
2644 2019-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2645
2646         Remove some last vestiges of assisted node terminology in WebKit
2647         https://bugs.webkit.org/show_bug.cgi?id=193572
2648
2649         Reviewed by Tim Horton.
2650
2651         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2652         * UIProcess/ios/WKContentViewInteraction.mm:
2653         (-[WKContentView gestureRecognizerShouldBegin:]):
2654         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
2655         (-[WKContentView _showKeyboard]):
2656         (-[WKContentView _hideKeyboard]):
2657
2658         Add a FIXME about invoking `-reloadInputViews` on watchOS when the focused element is blurred.
2659
2660         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2661         (-[WKContentView _elementDidBlur]):
2662         (-[WKContentView updateCurrentFocusedElementInformation:]):
2663         (-[WKContentView _startAssistingKeyboard]): Deleted.
2664         (-[WKContentView _stopAssistingKeyboard]): Deleted.
2665         * WebProcess/WebPage/ios/WebPageIOS.mm:
2666         (WebKit::WebPage::getFocusedElementInformation):
2667
2668 2019-01-18  Youenn Fablet  <youenn@apple.com>
2669
2670         Add a new SPI to request for cache storage quota increase
2671         https://bugs.webkit.org/show_bug.cgi?id=193323
2672
2673         Reviewed by Alex Christensen.
2674
2675         Add a delegate on the WebSiteDataStore for WebKit to ask for quota update.
2676         The current SPI is currently CacheStorage specific but future work should
2677         make it so that other storage like IDB use the same mechanism.
2678         By default, quota remains unchanged if delegate is not implemented.
2679
2680         * NetworkProcess/NetworkProcess.cpp:
2681         * UIProcess/API/Cocoa/WKStorageQuotaDelegatePrivate.h: Added.
2682         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2683         (WebsiteDataStoreQuotaManager::WebsiteDataStoreQuotaManager):
2684         (-[WKWebsiteDataStore _quotaDelegate]):
2685         (-[WKWebsiteDataStore set_quotaDelegate:]):
2686         * UIProcess/API/Cocoa/WKWebsiteDataStoreInternal.h:
2687         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2688         * UIProcess/Network/NetworkProcessProxy.cpp:
2689         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
2690         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2691         (WebKit::WebsiteDataStore::WebsiteDataStore):
2692         * UIProcess/WebsiteData/WebsiteDataStore.h:
2693         (WebKit::WebsiteDataStore::quotaManager):
2694         (WebKit::WebsiteDataStore::setQuotaManager):
2695         * UIProcess/WebsiteData/WebsiteDataStoreQuotaManager.h: Added.
2696         (WebKit::WebsiteDataStoreQuotaManager::~WebsiteDataStoreQuotaManager):
2697         (WebKit::WebsiteDataStoreQuotaManager::requestCacheStorageSpace):
2698         * WebKit.xcodeproj/project.pbxproj:
2699
2700 2019-01-18  Philippe Normand  <pnormand@igalia.com>
2701
2702         [WPE] Add Qt extension
2703         https://bugs.webkit.org/show_bug.cgi?id=191464
2704
2705         Reviewed by Carlos Garcia Campos.
2706
2707         This new extension is a QML plugin embedding a WPE ViewBackend
2708         implementation. It provides a public API very similar to Qt's
2709         WebView module. It comes with a simple mini-browser implemented in
2710         QML.
2711
2712         QtWPE is known to work with the Wayland-EGL (in GNOME and Weston
2713         compositors) and EGLFS QPAs.
2714
2715         * PlatformWPE.cmake:
2716         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.cpp: Added.
2717         (WPEQmlExtensionPlugin::registerTypes):
2718         * UIProcess/API/wpe/qt/WPEQmlExtensionPlugin.h: Added.
2719         * UIProcess/API/wpe/qt/WPEQtView.cpp: Added.
2720         (WPEQtView::WPEQtView):
2721         (WPEQtView::~WPEQtView):
2722         (WPEQtView::geometryChanged):
2723         (WPEQtView::configureWindow):
2724         (WPEQtView::createOffscreen):
2725         (WPEQtView::backendCreated):
2726         (WPEQtView::notifyUrlChangedCallback):
2727         (WPEQtView::notifyTitleChangedCallback):
2728         (WPEQtView::notifyLoadProgressCallback):
2729         (WPEQtView::notifyLoadChangedCallback):
2730         (WPEQtView::notifyLoadFailedCallback):
2731         (WPEQtView::updatePaintNode):
2732         (WPEQtView::url const):
2733         (WPEQtView::setUrl):
2734         (WPEQtView::loadProgress const):
2735         (WPEQtView::title const):
2736         (WPEQtView::canGoBack const):
2737         (WPEQtView::isLoading const):
2738         (WPEQtView::canGoForward const):
2739         (WPEQtView::goBack):
2740         (WPEQtView::goForward):
2741         (WPEQtView::reload):
2742         (WPEQtView::stop):
2743         (WPEQtView::loadHtml):
2744         (WPEQtView::jsAsyncReadyCallback):
2745         (WPEQtView::handleJsResult):
2746         (WPEQtView::runJavaScript):
2747         (WPEQtView::mousePressEvent):
2748         (WPEQtView::mouseReleaseEvent):
2749         (WPEQtView::hoverEnterEvent):
2750         (WPEQtView::hoverLeaveEvent):
2751         (WPEQtView::hoverMoveEvent):
2752         (WPEQtView::wheelEvent):
2753         (WPEQtView::keyPressEvent):
2754         (WPEQtView::keyReleaseEvent):
2755         (WPEQtView::touchEvent):
2756         * UIProcess/API/wpe/qt/WPEQtView.h: Added.
2757         * UIProcess/API/wpe/qt/WPEQtViewBackend.cpp: Added.
2758         (configureCallback):
2759         (WPEQtViewBackend::WPEQtViewBackend):
2760         (WPEQtViewBackend::~WPEQtViewBackend):
2761         (WPEQtViewBackend::configureGlibEglDisplay):
2762         (WPEQtViewBackend::configureEglDisplay):
2763         (WPEQtViewBackend::initialize):
2764         (WPEQtViewBackend::backend const):
2765         (WPEQtViewBackend::resize):
2766         (WPEQtViewBackend::getTexture):
2767         (WPEQtViewBackend::initSurface):
2768         (WPEQtViewBackend::displayImage):
2769         (WPEQtViewBackend::modifiers const):
2770         (WPEQtViewBackend::dispatchHoverEnterEvent):
2771         (WPEQtViewBackend::dispatchHoverLeaveEvent):
2772         (WPEQtViewBackend::dispatchHoverMoveEvent):
2773         (WPEQtViewBackend::dispatchMousePressEvent):
2774         (WPEQtViewBackend::dispatchMouseReleaseEvent):
2775         (WPEQtViewBackend::dispatchWheelEvent):
2776         (WPEQtViewBackend::dispatchKeyEvent):
2777         (WPEQtViewBackend::dispatchTouchEvent):
2778         * UIProcess/API/wpe/qt/WPEQtViewBackend.h: Added.
2779         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.cpp: Added.
2780         (WPEQtViewLoadRequest::WPEQtViewLoadRequest):
2781         (WPEQtViewLoadRequest::~WPEQtViewLoadRequest):
2782         (WPEQtViewLoadRequest::url const):
2783         (WPEQtViewLoadRequest::status const):
2784         (WPEQtViewLoadRequest::errorString const):
2785         * UIProcess/API/wpe/qt/WPEQtViewLoadRequest.h: Added.
2786         * UIProcess/API/wpe/qt/WPEQtViewLoadRequestPrivate.h: Added.
2787         (WPEQtViewLoadRequestPrivate::WPEQtViewLoadRequestPrivate):
2788         (WPEQtViewLoadRequestPrivate::~WPEQtViewLoadRequestPrivate):
2789         * UIProcess/API/wpe/qt/qmldir: Added.
2790
2791 2019-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2792
2793         [iOS] Content offset jumps erratically when autoscrolling near scroll view content inset areas
2794         https://bugs.webkit.org/show_bug.cgi?id=193494
2795         <rdar://problem/46859627>
2796
2797         Reviewed by Simon Fraser and Tim Horton.
2798
2799         Adds `contentInsets` to `VisibleContentRectUpdateInfo`. This keeps track of the visible content insets
2800         surrounding the unobscured content rect. See WebCore ChangeLog for more details.
2801
2802         * Shared/VisibleContentRectUpdateInfo.cpp:
2803         (WebKit::VisibleContentRectUpdateInfo::encode const):
2804         (WebKit::VisibleContentRectUpdateInfo::decode):
2805         (WebKit::operator<<):
2806         * Shared/VisibleContentRectUpdateInfo.h:
2807         (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
2808         (WebKit::VisibleContentRectUpdateInfo::contentInsets const):
2809         (WebKit::operator==):
2810         * UIProcess/API/Cocoa/WKWebView.mm:
2811         (-[WKWebView _computedObscuredInset]):
2812         (-[WKWebView _computedContentInset]):
2813         (-[WKWebView _computedUnobscuredSafeAreaInset]):
2814
2815         We don't care about source compatibility with iOS 10 and below anymore, so we should change these >= iOS 11
2816         target checks to simply `PLATFORM(IOS)`.
2817
2818         (-[WKWebView _updateVisibleContentRects]):
2819
2820         Compute the visible content insets on all sides of the unobscured content rect. These insets are scaled to
2821         content coordinates.
2822
2823         * UIProcess/ios/WKContentView.h:
2824         * UIProcess/ios/WKContentView.mm:
2825         (floatBoxExtent):
2826
2827         Add a helper to convert `UIEdgeInsets` to `WebCore::FloatBoxExtent`, and use it in a few places below.
2828
2829         (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
2830         (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted.
2831         * WebProcess/WebPage/ios/WebPageIOS.mm:
2832         (WebKit::WebPage::updateVisibleContentRects):
2833
2834         Update the Page's content insets.
2835
2836 2019-01-17  Truitt Savell  <tsavell@apple.com>
2837
2838         Unreviewed, rolling out r240124.
2839
2840         This commit broke an internal build.
2841
2842         Reverted changeset:
2843
2844         "SDK_VARIANT build destinations should be separate from non-
2845         SDK_VARIANT builds"
2846         https://bugs.webkit.org/show_bug.cgi?id=189553
2847         https://trac.webkit.org/changeset/240124
2848
2849 2019-01-17  John Wilander  <wilander@apple.com>
2850
2851         Add infrastructure to enable/disable ITP Debug Mode through Preferences
2852         https://bugs.webkit.org/show_bug.cgi?id=193510
2853         <rdar://problem/47330969>
2854
2855         Reviewed by Dean Jackson.
2856
2857         * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
2858         (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
2859         (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
2860         (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
2861             These functions are now suited for runtime switching of ITP Debug Mode.
2862         * Shared/WebPreferences.yaml:
2863             Changed name from ResourceLoadStatisticsDebugMode to ItpDebugModeEnabled.
2864         * UIProcess/API/Cocoa/WKPreferences.mm:
2865         (-[WKPreferences _setItpDebugModeEnabled:]):
2866         (-[WKPreferences _itpDebugModeEnabled]):
2867             New private preferences functions.
2868         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2869         * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
2870         (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
2871             Removed support for old experimental user default. Added a new one that's
2872             not connected to any UI, i.e. merely for command line debugging where
2873             ITP Debug Mode needs to be on all the time.
2874
2875 2019-01-17  Tim Horton  <timothy_horton@apple.com>
2876
2877         Adopt NSTextCheckingSuppressInitialCapitalizationKey
2878         https://bugs.webkit.org/show_bug.cgi?id=193545
2879
2880         Reviewed by Dean Jackson.
2881
2882         * UIProcess/mac/TextCheckerMac.mm:
2883         (WebKit::TextChecker::checkTextOfParagraph):
2884         (WebKit::TextChecker::getGuessesForWord):
2885
2886 2019-01-17  Jer Noble  <jer.noble@apple.com>
2887
2888         SDK_VARIANT build destinations should be separate from non-SDK_VARIANT builds
2889         https://bugs.webkit.org/show_bug.cgi?id=189553
2890
2891         Reviewed by Tim Horton.
2892
2893         * Configurations/Base.xcconfig:
2894         * Configurations/BaseTarget.xcconfig:
2895         * Configurations/SDKVariant.xcconfig: Added.
2896
2897 2019-01-16  Dean Jackson  <dino@apple.com>
2898
2899         (iPad) Link tapping is sluggish on many sites
2900         https://bugs.webkit.org/show_bug.cgi?id=193522
2901         <rdar://problem/47102987>
2902
2903         Reviewed by Wenson Hsieh.
2904
2905         Some WKWebView clients might set the initial zoom scale of the page to
2906         something other than 1, which disables the "fast tap" behaviour.
2907         The fix is very simple -- just check against the initial scale rather
2908         than 1.
2909
2910         The most likely regression from this would be pages designed for desktop,
2911         but provide a viewport tag saying width=device-width and initial-scale.
2912         They might stop allowing double-tap-to-zoom.
2913
2914         * UIProcess/API/Cocoa/WKWebView.mm:
2915         (-[WKWebView _allowsDoubleTapGestures]): Check against initial page scale.
2916
2917 2019-01-17  Alex Christensen  <achristensen@webkit.org>
2918
2919         Stop using NetworkStorageSession::storageSession in WebCore
2920         https://bugs.webkit.org/show_bug.cgi?id=193529
2921
2922         Reviewed by Tim Horton.
2923
2924         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2925         (WebKit::NetworkConnectionToWebProcess::createSocketStream):
2926         * NetworkProcess/NetworkProcess.h:
2927         * NetworkProcess/NetworkSocketStream.cpp:
2928         (WebKit::NetworkSocketStream::create):
2929         (WebKit::NetworkSocketStream::NetworkSocketStream):
2930         * NetworkProcess/NetworkSocketStream.h:
2931         * NetworkProcess/NetworkStorageSessionProvider.h: Added.
2932         * WebKit.xcodeproj/project.pbxproj:
2933         * WebProcess/Network/WebSocketProvider.cpp:
2934         (WebKit::WebSocketProvider::createSocketStreamHandle):
2935         * WebProcess/Network/WebSocketProvider.h:
2936         * WebProcess/WebPage/WebCookieJar.cpp:
2937         (WebKit::WebCookieJar::WebCookieJar):
2938         * WebProcess/WebPage/WebCookieJar.h:
2939
2940 2019-01-16  Youenn Fablet  <youenn@apple.com>
2941
2942         Add a new SPI for controlling getUserMedia
2943         https://bugs.webkit.org/show_bug.cgi?id=192793
2944
2945         Reviewed by Eric Carlson.
2946
2947         Some weaknesses of the current getUserMedia/enumerateDevices SPI were found.
2948         In particular:
2949         - The hash salt should be handled by WebKit not by apps using WebKit.
2950         - No need to expose the frame URL, only the top level origin is needed.
2951         - The names of the callback are changed to improve the intent of these callbacks.
2952         Addressed these by creating a new SPI which will replace the current one.
2953         The current SPI will be removed later on.
2954
2955         Did some refactoring by making the callbacks not return false.
2956         Instead, implement the default behavior inside the request objects as deny methods.
2957         Some further refactoring will be done as a follow-up to better align the C API with the Cocoa API.
2958
2959         * UIProcess/API/APIUIClient.h:
2960         (API::UIClient::decidePolicyForUserMediaPermissionRequest):
2961         (API::UIClient::checkUserMediaPermissionForOrigin):
2962         * UIProcess/API/C/WKPage.cpp:
2963         (WKPageSetPageUIClient):
2964         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2965         * UIProcess/API/Cocoa/WKWebView.mm:
2966         (-[WKWebView _mediaCaptureState]):
2967         (-[WKWebView _setMediaCaptureMuted:]):
2968         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2969         * UIProcess/API/glib/WebKitUIClient.cpp:
2970         * UIProcess/Cocoa/MediaCaptureUtilities.h: Added.
2971         * UIProcess/Cocoa/MediaCaptureUtilities.mm: Added.
2972         * UIProcess/Cocoa/UIDelegate.h:
2973         * UIProcess/Cocoa/UIDelegate.mm:
2974         (WebKit::UIDelegate::setDelegate):
2975         (WebKit::requestUserMediaAuthorizationForFrame):
2976         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest):
2977         (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin):
2978         (WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
2979         * UIProcess/UserMediaPermissionCheckProxy.h:
2980         (WebKit::UserMediaPermissionCheckProxy::deny):
2981         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2982         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
2983         (WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
2984         * UIProcess/UserMediaPermissionRequestProxy.h:
2985
2986 2019-01-16  Youenn Fablet  <youenn@apple.com>
2987
2988         Pipe cache quota request from Network Process to UIProcess
2989         https://bugs.webkit.org/show_bug.cgi?id=193296
2990
2991         Reviewed by Alex Christensen.
2992
2993         When cache storage hits quota for a given origin, pipe the request back to NetworkProcess.
2994         No record will be put until the quota request is answered.
2995         The request is sent from CacheStorage::Caches to CacheStorage::Engine and to NetworkProcess.
2996         NetworkProcess then sends it to NetworkProcessProxy.
2997         Currently NetworkProcessProxy just answers by keeping the quota as it is.
2998         In the future, NetworkProcessProxy should make a delegate call to let the app using WebKit
2999         make a decision on the quota. This will allow prompting user to bump it as done for other data.
3000
3001         * NetworkProcess/NetworkProcess.cpp:
3002         (WebKit::NetworkProcess::requestCacheStorageSpace):
3003         * NetworkProcess/NetworkProcess.h:
3004         * NetworkProcess/cache/CacheStorageEngine.cpp:
3005         (WebKit::CacheStorage::Engine::~Engine):
3006         (WebKit::CacheStorage::Engine::from):
3007         (WebKit::CacheStorage::Engine::Engine):
3008         (WebKit::CacheStorage::Engine::requestSpace):
3009         (WebKit::CacheStorage::Engine::requestSpaceCompleted):
3010         * NetworkProcess/cache/CacheStorageEngine.h:
3011         * NetworkProcess/cache/CacheStorageEngineCache.cpp:
3012         (WebKit::CacheStorage::Cache::put):
3013         (WebKit::CacheStorage::Cache::retryPuttingPendingRecords):
3014         * NetworkProcess/cache/CacheStorageEngineCache.h:
3015         * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
3016         (WebKit::CacheStorage::Caches::requestSpace):
3017         (WebKit::CacheStorage::Caches::notifyCachesOfRequestSpaceEnd):
3018         * NetworkProcess/cache/CacheStorageEngineCaches.h:
3019         (WebKit::CacheStorage::Caches::isRequestingSpace const):
3020         * UIProcess/Network/NetworkProcessProxy.cpp:
3021         (WebKit::NetworkProcessProxy::requestCacheStorageSpace):
3022         * UIProcess/Network/NetworkProcessProxy.h:
3023         * UIProcess/Network/NetworkProcessProxy.messages.in:
3024
3025 2019-01-16  Alex Christensen  <achristensen@webkit.org>
3026
3027         sendBeacon to previously-unvisited https domain always fails
3028         https://bugs.webkit.org/show_bug.cgi?id=193508
3029
3030         Reviewed by Geoffrey Garen.
3031
3032         * NetworkProcess/PingLoad.cpp:
3033         (WebKit::PingLoad::didReceiveChallenge):
3034         If a ping load is doing a TLS handshake, continue if the server has good certificates.
3035
3036 2019-01-16  Youenn Fablet  <youenn@apple.com>
3037
3038         ASSERTION FAILED: m_networkLoadInformationByID.contains(identifier) in WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics
3039         https://bugs.webkit.org/show_bug.cgi?id=189097
3040         <rdar://problem/43856423>
3041
3042         Reviewed by Alex Christensen.
3043
3044         In case where the inspector is launched, it will instruct the NetworkConnectionToWebProcess to start capturing network metrics.
3045         If this happens in the middle of a load, addNetworkLoadInformationMetrics might fail since addNetworkLoadInformation will not be called.
3046         To fix this issue, store whether to capture metrics at NetworkResourceLoader level.
3047
3048         To ensure that the case of switching back and forth capture of metrics, disable loader capture of metrics whenver NetworkConnectionToWebProcess is asked to.
3049
3050         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3051         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
3052         * NetworkProcess/NetworkConnectionToWebProcess.h:
3053         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
3054         * NetworkProcess/NetworkResourceLoader.cpp:
3055         (WebKit::m_shouldCaptureExtraNetworkLoadMetrics):
3056         (WebKit::NetworkResourceLoader::shouldCaptureExtraNetworkLoadMetrics const):
3057         * NetworkProcess/NetworkResourceLoader.h:
3058
3059 2019-01-16  Alex Christensen  <achristensen@webkit.org>
3060
3061         Revert r239938
3062         https://bugs.webkit.org/show_bug.cgi?id=193267
3063         <rdar://problem/47297304>
3064
3065         * Configurations/WebContent-iOS.entitlements:
3066
3067 2019-01-16  Chris Dumez  <cdumez@apple.com>
3068
3069         Regression(r240046) Several API tests are crashing
3070         https://bugs.webkit.org/show_bug.cgi?id=193509
3071
3072         Reviewed by Geoffrey Garen.
3073
3074         The crashes would happen because loadRequestShared() would take a WebProcessProxy& in parameter but
3075         then call reattachToWebProcess() if the page is not valid, which would replace m_process and invalidate
3076         our process reference.
3077
3078         To address the issue, move the reattachToWebProcess() call to loadRequest(), before calling
3079         loadRequestShared(). Also, update *Shared() methods to take a Ref<WebProcessProxy>&& instead
3080         of a WebProcessProxy& in parameter. Since we call client delegates, we need to make sure
3081         our process stays alive.
3082
3083         * UIProcess/ProvisionalPageProxy.cpp:
3084         (WebKit::ProvisionalPageProxy::loadData):
3085         (WebKit::ProvisionalPageProxy::loadRequest):
3086         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3087         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
3088         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3089         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3090         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
3091         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
3092         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3093         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3094         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
3095         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
3096         * UIProcess/WebPageProxy.cpp:
3097         (WebKit::WebPageProxy::loadRequest):
3098         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3099         (WebKit::WebPageProxy::loadData):
3100         (WebKit::WebPageProxy::loadDataWithNavigationShared):
3101         (WebKit::WebPageProxy::didPerformDragControllerAction):
3102         (WebKit::WebPageProxy::findPlugin):
3103         (WebKit::WebPageProxy::didCreateMainFrame):
3104         (WebKit::WebPageProxy::didCreateSubframe):
3105         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3106         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3107         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3108         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
3109         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3110         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3111         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
3112         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
3113         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3114         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3115         (WebKit::WebPageProxy::didCommitLoadForFrame):
3116         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3117         (WebKit::WebPageProxy::didFinishLoadForFrame):
3118         (WebKit::WebPageProxy::didFailLoadForFrame):
3119         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3120         (WebKit::WebPageProxy::didReceiveTitleForFrame):
3121         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3122         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
3123         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
3124         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
3125         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3126         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3127         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3128         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3129         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3130         (WebKit::WebPageProxy::decidePolicyForResponse):
3131         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3132         (WebKit::WebPageProxy::unableToImplementPolicy):
3133         (WebKit::WebPageProxy::willSubmitForm):
3134         (WebKit::WebPageProxy::didNavigateWithNavigationData):
3135         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
3136         (WebKit::WebPageProxy::didPerformClientRedirect):
3137         (WebKit::WebPageProxy::didPerformClientRedirectShared):
3138         (WebKit::WebPageProxy::didPerformServerRedirect):
3139         (WebKit::WebPageProxy::didUpdateHistoryTitle):
3140         (WebKit::WebPageProxy::createNewPage):
3141         (WebKit::WebPageProxy::runJavaScriptAlert):
3142         (WebKit::WebPageProxy::runJavaScriptConfirm):
3143         (WebKit::WebPageProxy::runJavaScriptPrompt):
3144         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
3145         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3146         (WebKit::WebPageProxy::runOpenPanel):
3147         (WebKit::WebPageProxy::printFrame):
3148         (WebKit::WebPageProxy::backForwardGoToItem):
3149         (WebKit::WebPageProxy::backForwardGoToItemShared):
3150         (WebKit::WebPageProxy::learnWord):
3151         (WebKit::WebPageProxy::ignoreWord):
3152         (WebKit::WebPageProxy::didReceiveEvent):
3153         (WebKit::WebPageProxy::editingRangeCallback):
3154         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
3155         (WebKit::WebPageProxy::focusedFrameChanged):
3156         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
3157         (WebKit::WebPageProxy::exceededDatabaseQuota):
3158         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
3159         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
3160         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
3161         (WebKit::WebPageProxy::startURLSchemeTask):
3162         (WebKit::WebPageProxy::startURLSchemeTaskShared):
3163         (WebKit::WebPageProxy::stopURLSchemeTask):
3164         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
3165         * UIProcess/WebPageProxy.h:
3166
3167 2019-01-16  Chris Dumez  <cdumez@apple.com>
3168
3169         Regression(PSON) View becomes blank after click a cross-site download link
3170         https://bugs.webkit.org/show_bug.cgi?id=193361
3171         <rdar://problem/47099573>
3172
3173         Reviewed by Geoffrey Garen.
3174
3175         The issue tracked by rdar://problem/47099573 is that a provisional load may get
3176         canceled (or converted into a download) *after* we've decided to process-swap.
3177         In such cases, the view should keep displaying the current site and it should
3178         still be interactive. However, with the previous PSON model, the view (pageProxy)
3179         would have already swapped to the new process and would end up displaying the
3180         initially empty document.
3181
3182         To address the issue, this patch introduces the concept of a provisional load
3183         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
3184         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
3185         provisional page until after the load was committed in the new process. This means
3186         that the view / WebPageProxy keeps using the old process and displays the current
3187         content until a load has committed in the provisional page. If no load commits
3188         in the provisional process (e.g. because the load is cancelled or converted into
3189         a download), then we merely destroy the ProvisionalPageProxy and terminate its
3190         process, without impacting the WebPageProxy.
3191
3192         * Shared/WebPageCreationParameters.cpp:
3193         (WebKit::WebPageCreationParameters::encode const):
3194         (WebKit::WebPageCreationParameters::decode):
3195         * Shared/WebPageCreationParameters.h:
3196         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
3197         delay attaching the drawing area in case of a process-swap, no matter what
3198         now that the previous process is kept alive until the provisional load is
3199         committed in the new process.
3200
3201         * Shared/WebPolicyAction.h:
3202         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
3203         process-swap, we now tell the previous process to simply ignore the load, while
3204         we create a ProvisionalPageProxy to do the new load in a new process.
3205         Suspension of the previous page in the old process, happens later, when a load
3206         is actually committed in the new process.
3207
3208         * Sources.txt:
3209         Add new ProvisionalPageProxy file.
3210
3211         * UIProcess/API/Cocoa/WKWebView.mm:
3212         (-[WKWebView _killWebContentProcessAndResetState]):
3213         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
3214         process and the provisional one, to maintain previous behavior in our API tests.
3215
3216         * UIProcess/API/gtk/PageClientImpl.cpp:
3217         (WebKit::PageClientImpl::createDrawingAreaProxy):
3218         * UIProcess/API/gtk/PageClientImpl.h:
3219         * UIProcess/API/wpe/PageClientImpl.cpp:
3220         (WebKit::PageClientImpl::createDrawingAreaProxy):
3221         * UIProcess/API/wpe/PageClientImpl.h:
3222         * UIProcess/AcceleratedDrawingAreaProxy.cpp:
3223         (WebKit::AcceleratedDrawingAreaProxy::AcceleratedDrawingAreaProxy):
3224         (WebKit::AcceleratedDrawingAreaProxy::didUpdateBackingStoreState):
3225         (WebKit::AcceleratedDrawingAreaProxy::sendUpdateBackingStoreState):
3226         (WebKit::AcceleratedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState):
3227         (WebKit::AcceleratedDrawingAreaProxy::setNativeSurfaceHandleForCompositing):
3228         (WebKit::AcceleratedDrawingAreaProxy::destroyNativeSurfaceHandleForCompositing):
3229         * UIProcess/AcceleratedDrawingAreaProxy.h:
3230         * UIProcess/Cocoa/WebViewImpl.h:
3231         * UIProcess/Cocoa/WebViewImpl.mm:
3232         (WebKit::WebViewImpl::createDrawingAreaProxy):
3233         * UIProcess/DrawingAreaProxy.cpp:
3234         (WebKit::DrawingAreaProxy::DrawingAreaProxy):
3235         (WebKit::DrawingAreaProxy::~DrawingAreaProxy):
3236         (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
3237         * UIProcess/DrawingAreaProxy.h:
3238         (WebKit::DrawingAreaProxy::process):
3239         * UIProcess/DrawingAreaProxyImpl.cpp:
3240         (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
3241         (WebKit::DrawingAreaProxyImpl::update):
3242         * UIProcess/DrawingAreaProxyImpl.h:
3243         * UIProcess/PageClient.h:
3244         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
3245         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
3246         (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
3247         (WebKit::RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy):
3248         (WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
3249         (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
3250         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart):
3251         (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidEnd):
3252         (WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
3253         (WebKit::RemoteLayerTreeDrawingAreaProxy::waitForDidUpdateActivityState):
3254         (WebKit::RemoteLayerTreeDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3255         * UIProcess/ios/PageClientImplIOS.h:
3256         * UIProcess/ios/PageClientImplIOS.mm:
3257         (WebKit::PageClientImpl::createDrawingAreaProxy):
3258         * UIProcess/ios/WKContentView.h:
3259         * UIProcess/ios/WKContentView.mm:
3260         (-[WKContentView _createDrawingAreaProxy:]):
3261         * UIProcess/mac/PageClientImplMac.h:
3262         * UIProcess/mac/PageClientImplMac.mm:
3263         (WebKit::PageClientImpl::createDrawingAreaProxy):
3264         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
3265         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
3266         (WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
3267         (WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
3268         (WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
3269         (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
3270         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
3271         (WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry):
3272         (WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
3273         (WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom):
3274         (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
3275         * UIProcess/mac/WebPageProxyMac.mm:
3276         * UIProcess/win/PageClientImpl.cpp:
3277         (WebKit::PageClientImpl::createDrawingAreaProxy):
3278         * UIProcess/win/PageClientImpl.h:
3279         * UIProcess/win/PageClientImpl.cpp:
3280         (WebKit::PageClientImpl::createDrawingAreaProxy):
3281         * UIProcess/win/PageClientImpl.h:
3282         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3283         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3284         Pass the drawing area's associated process when constructing it and store it as a member
3285         in addition to the page. This is necessary now that a page can be associated with 2
3286         WebProcesses at a time, each having its own drawing area.
3287
3288         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3289         (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
3290         Pass the process.
3291
3292         * UIProcess/ProvisionalPageProxy.cpp: Added.
3293         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3294         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3295         (WebKit::ProvisionalPageProxy::processDidTerminate):
3296         (WebKit::ProvisionalPageProxy::takeDrawingArea):
3297         (WebKit::ProvisionalPageProxy::cancel):
3298         (WebKit::ProvisionalPageProxy::processDidFinishLaunching):
3299         (WebKit::ProvisionalPageProxy::finishInitializingWebPageAfterProcessLaunch):
3300         (WebKit::ProvisionalPageProxy::initializeWebPage):
3301         (WebKit::ProvisionalPageProxy::loadData):
3302         (WebKit::ProvisionalPageProxy::loadRequest):
3303         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
3304         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3305         (WebKit::ProvisionalPageProxy::didPerformClientRedirect):
3306         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3307         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3308         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
3309         (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData):
3310         (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame):
3311         (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync):
3312         (WebKit::ProvisionalPageProxy::decidePolicyForResponse):
3313         (WebKit::ProvisionalPageProxy::startURLSchemeTask):
3314         (WebKit::ProvisionalPageProxy::backForwardGoToItem):
3315         (WebKit::ProvisionalPageProxy::didReceiveMessage):
3316         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
3317         * UIProcess/ProvisionalPageProxy.h: Added.
3318         (WebKit::ProvisionalPageProxy::page):
3319         (WebKit::ProvisionalPageProxy::mainFrame const):
3320         (WebKit::ProvisionalPageProxy::process):
3321         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
3322         (WebKit::ProvisionalPageProxy::navigationID const):
3323         (WebKit::ProvisionalPageProxy::drawingArea const):
3324         New WebPageProxy-like class which is owned by the WebPageProxy and proxies IPC from
3325         the provisional process.
3326
3327         * UIProcess/SuspendedPageProxy.cpp:
3328         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3329         (WebKit::SuspendedPageProxy::unsuspend):
3330         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3331         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
3332         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
3333         which tries to register itself as an IPC message receiver for the same pageID when
3334         a process-swap occurs and we're switching to a suspended page.
3335
3336         * UIProcess/WebFrameProxy.cpp:
3337         (WebKit::WebFrameProxy::isMainFrame const):
3338         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
3339         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
3340         m_mainFrame to maintain previous behavior.
3341
3342         * UIProcess/WebPageProxy.cpp:
3343         (WebKit::WebPageProxy::provisionalDrawingArea const):
3344         Add getter for the provisional drawing area. We normally only deal with the page's current drawing area, but
3345         the ViewGestureController needs access to the provisional once to display the swipe gesture snapshot.
3346
3347         (WebKit::WebPageProxy::swapToWebProcess):
3348         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
3349         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
3350         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
3351         the ProvisionalPageProxy which started the provisional load.
3352
3353         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3354         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3355         committed in the provisional process.
3356
3357         (WebKit::WebPageProxy::setDrawingArea):
3358         (WebKit::WebPageProxy::initializeWebPage):
3359         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3360           committed in the provisional process.
3361         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
3362
3363         (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
3364         (WebKit::WebPageProxy::loadRequest):
3365         (WebKit::WebPageProxy::loadRequestWithNavigationShared):
3366         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
3367         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
3368
3369         (WebKit::WebPageProxy::loadData):
3370         (WebKit::WebPageProxy::loadDataWithNavigationShared):
3371         (WebKit::WebPageProxy::stopLoading):
3372         (WebKit::WebPageProxy::reload):
3373         (WebKit::WebPageProxy::didPerformDragControllerAction):
3374         (WebKit::WebPageProxy::findPlugin):
3375         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3376         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
3377         Suspension now happens later, only if we end up committing the provisional load in the new process.
3378         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
3379         to happen a bit later but it is clearer if we do this as early as possible I think.
3380
3381         (WebKit::WebPageProxy::commitProvisionalPage):
3382         When the load is committed in the new process, we call WebPageProxy::commitProvisionalPage(). It takes care of:
3383         - Actually swapping the WebPageProxy to the new process by calling processDidTerminate() / swapToWebProcess().
3384         - Suspending the current page.
3385         - Letting the client know the load is comitted
3386         - Destroy the ProvisionalPageProxy.
3387         This work used to happen earlier in continueNavigationInNewProcess().
3388
3389         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3390         Moved some of the logic to commitProvisionalPage(). We now merely start the load in a new ProvisionalPageProxy,
3391         without actually having the WebPageProxy switch to the new process yet.
3392
3393         (WebKit::WebPageProxy::didCreateMainFrame):
3394         (WebKit::WebPageProxy::didCreateSubframe):
3395         (WebKit::WebPageProxy::didCreateWindow):
3396         Drop some code that is no longer needed, now that the ProvisionalPageProxy takes care of this.
3397
3398         (WebKit::WebPageProxy::didDestroyNavigation):
3399         On process-swap, when telling the previous process to ignore the load and starting the new load in a new
3400         ProvisionalPageProxy, the previous WebPage attempts to destroy the navigation. In this case, we ignore
3401         the call since the navigation is merely taken over by the ProvisionalPageProxy.
3402
3403         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
3404         (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
3405         Moved some PSON logic to the ProvisionalPageProxy instead.
3406
3407         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3408         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrameShared):
3409         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
3410         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
3411         (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
3412         (WebKit::WebPageProxy::didChangeProvisionalURLForFrameShared):
3413
3414         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
3415         (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
3416         When didFailProvisionalLoadForFrame() is called for a ProvisionalPageProxy, destroy it.
3417
3418         (WebKit::WebPageProxy::didCommitLoadForFrame):
3419         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
3420         (WebKit::WebPageProxy::didFinishLoadForFrame):
3421         (WebKit::WebPageProxy::didFailLoadForFrame):
3422         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
3423         (WebKit::WebPageProxy::didReceiveTitleForFrame):
3424         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
3425         (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
3426         (WebKit::WebPageProxy::didRunInsecureContentForFrame):
3427         (WebKit::WebPageProxy::frameDidBecomeFrameSet):
3428         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
3429         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsyncShared):
3430         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3431         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3432         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3433         (WebKit::WebPageProxy::decidePolicyForResponse):
3434         (WebKit::WebPageProxy::decidePolicyForResponseShared):
3435         (WebKit::WebPageProxy::unableToImplementPolicy):
3436         (WebKit::WebPageProxy::willSubmitForm):
3437         (WebKit::WebPageProxy::didNavigateWithNavigationData):
3438         (WebKit::WebPageProxy::didNavigateWithNavigationDataShared):
3439         (WebKit::WebPageProxy::didPerformClientRedirect):
3440         (WebKit::WebPageProxy::didPerformClientRedirectShared):
3441         (WebKit::WebPageProxy::didPerformServerRedirect):
3442         (WebKit::WebPageProxy::didUpdateHistoryTitle):
3443         (WebKit::WebPageProxy::createNewPage):
3444         (WebKit::WebPageProxy::runJavaScriptAlert):
3445         (WebKit::WebPageProxy::runJavaScriptConfirm):
3446         (WebKit::WebPageProxy::runJavaScriptPrompt):
3447         (WebKit::WebPageProxy::unavailablePluginButtonClicked):
3448         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
3449         (WebKit::WebPageProxy::runOpenPanel):
3450         (WebKit::WebPageProxy::printFrame):
3451         (WebKit::WebPageProxy::backForwardGoToItem):
3452         (WebKit::WebPageProxy::backForwardGoToItemShared):
3453         (WebKit::WebPageProxy::learnWord):
3454         (WebKit::WebPageProxy::ignoreWord):
3455         (WebKit::WebPageProxy::didReceiveEvent):
3456         (WebKit::WebPageProxy::editingRangeCallback):
3457         (WebKit::WebPageProxy::rectForCharacterRangeCallback):
3458         (WebKit::WebPageProxy::focusedFrameChanged):
3459         (WebKit::WebPageProxy::frameSetLargestFrameChanged):
3460
3461         (WebKit::WebPageProxy::provisionalProcessDidTerminate):
3462         Cancel the provisiona load and destroy the ProvisionalPageProxy if
3463         the provisional process crashes.
3464
3465         (WebKit::WebPageProxy::resetState):
3466         Drop some code that is no longer needed.
3467
3468         (WebKit::WebPageProxy::creationParameters):
3469         - Move the hasRegisteredServiceWorkers flag initialization from the call site to here now that we have
3470         more than one call site. This was just some bad factoring.
3471         - Take the process in parameter now that we page can be associated with several processes at a time.
3472
3473         (WebKit::WebPageProxy::exceededDatabaseQuota):
3474         (WebKit::WebPageProxy::requestGeolocationPermissionForFrame):
3475         (WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
3476         (WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
3477         (WebKit::WebPageProxy::startURLSchemeTask):
3478         (WebKit::WebPageProxy::startURLSchemeTaskShared):
3479         (WebKit::WebPageProxy::stopURLSchemeTask):
3480         (WebKit::WebPageProxy::loadSynchronousURLSchemeTask):
3481         (WebKit::WebPageProxy::checkURLReceivedFromCurrentOrPreviousWebProcess):
3482         (WebKit::WebPageProxy::willAcquireUniversalFileReadSandboxExtension):
3483         * UIProcess/WebPageProxy.h:
3484         (WebKit::WebPageProxy::visitedLinkStore):
3485         (WebKit::WebPageProxy::provisionalPageProxy const):
3486
3487         * UIProcess/WebProcessProxy.cpp:
3488         (WebKit::WebProcessProxy::hasProvisionalPageWithID const):
3489         (WebKit::WebProcessProxy::updateBackForwardItem):
3490         (WebKit::WebProcessProxy::processDidTerminateOrFailedToLaunch):
3491         (WebKit::WebProcessProxy::didFinishLaunching):
3492         (WebKit::WebProcessProxy::canTerminateChildProcess):
3493         * UIProcess/WebProcessProxy.h:
3494         (WebKit::WebProcessProxy::addProvisionalPageProxy):
3495         (WebKit::WebProcessProxy::removeProvisionalPageProxy):
3496         Before updating a BackForwardListItem, we normally make sure the process has a WebPageProxy with the
3497         item's pageID. We have to tweak the logic because there may now be no WebPageProxy with this pageID
3498         associated with this process yet, because it is still a ProvisionalPageProxy.        
3499
3500         * UIProcess/WebURLSchemeHandler.cpp:
3501         (WebKit::WebURLSchemeHandler::startTask):
3502         * UIProcess/WebURLSchemeHandler.h:
3503         * UIProcess/WebURLSchemeTask.cpp:
3504         (WebKit::WebURLSchemeTask::create):
3505         (WebKit::WebURLSchemeTask::WebURLSchemeTask):
3506         (WebKit::WebURLSchemeTask::didPerformRedirection):
3507         (WebKit::WebURLSchemeTask::didReceiveResponse):
3508         (WebKit::WebURLSchemeTask::didReceiveData):
3509         (WebKit::WebURLSchemeTask::didComplete):
3510         (WebKit::WebURLSchemeTask::pageDestroyed):
3511         * UIProcess/WebURLSchemeTask.h:
3512         Pass the process when constructing a WebURLSchemeTask and store it as a data member in addition to
3513         the page. This is necessary now that a WebPageProxy can be associated with several WebProcesses.
3514
3515         * UIProcess/ios/ViewGestureControllerIOS.mm:
3516         (WebKit::ViewGestureController::endSwipeGesture):
3517         Use the provisional drawing area to display the swipe snapshot as it may differ from the one currently
3518         associated with the page in case of process swap.
3519
3520         * WebKit.xcodeproj/project.pbxproj:
3521         Add ProvisionalPageProxy class.
3522
3523         * WebProcess/WebPage/WebFrame.cpp:
3524         (WebKit::toPolicyAction):
3525         (WebKit::WebFrame::didReceivePolicyDecision):
3526         * WebProcess/WebPage/WebPage.cpp:
3527         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3528         (WebKit::WebPage::reinitializeWebPage):
3529         (WebKit::WebPage::didReceivePolicyDecision):
3530         Stop dealing with WebPolicyAction::Suspend as it no longer exists.
3531
3532         (WebKit::WebPage::didCompletePageTransition):
3533
3534         (WebKit::WebPage::setIsSuspended):
3535         Suspend the Page when setIsSuspended(true) is called, now that there is no longer a WebPolicyAction::Suspend.
3536         setIsSuspended(true) IPC is sent when we actually commit the provisional page.
3537
3538         * WebProcess/WebPage/WebPage.h:
3539
3540 2019-01-16  Tim Horton  <timothy_horton@apple.com>
3541
3542         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
3543         https://bugs.webkit.org/show_bug.cgi?id=193468
3544         <rdar://problem/38645869>
3545
3546         Reviewed by Zalan Bujtas.
3547
3548         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3549         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
3550         Adjust the null-check a bit; Zalan pointed out that the layout could
3551         be responsible for the Frame/RenderView going away, so we should bail
3552         *after* layout, not before.
3553
3554 2019-01-15  Fujii Hironori  <Hironori.Fujii@sony.com>
3555
3556         Unreviewed WinCairo build fix.
3557
3558         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
3559         (WebKit::WebPageInspectorTargetController::connectInspector): Use 'auto' instead of unprefixed InspectorTarget.
3560         (WebKit::WebPageInspectorTargetController::disconnectInspector): Ditto.
3561         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend): Ditto.
3562
3563 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3564
3565         Reduce use of NetworkStorageSession::defaultStorageSession in WebCore
3566         https://bugs.webkit.org/show_bug.cgi?id=193368
3567
3568         Reviewed by Geoff Garen.
3569
3570         * WebProcess/Plugins/PluginView.cpp:
3571         (WebKit::PluginView::getAuthenticationInfo):
3572
3573 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3574
3575         Remove more NetworkProcess::singleton use
3576         https://bugs.webkit.org/show_bug.cgi?id=193484
3577
3578         Reviewed by Geoffrey Garen.
3579
3580         This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager.
3581         This is the kind of awful duct tape code that keeps me awake at night, but it's necessary
3582         because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than
3583         one NetworkProcess object.  To make it work well enough until we remove LegacyCustomProtocolManager,
3584         use the last NetworkProcess object that has been created.
3585
3586         * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm:
3587         (newestNetworkProcess):
3588         (LegacyCustomProtocolManager::networkProcessCreated):
3589         (+[WKCustomProtocol canInitWithRequest:]):
3590         (-[WKCustomProtocol initWithRequest:cachedResponse:client:]):
3591         (-[WKCustomProtocol startLoading]):
3592         (-[WKCustomProtocol stopLoading]):
3593         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp:
3594         (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager):
3595         (WebKit::LegacyCustomProtocolManager::startLoading):
3596         (WebKit::LegacyCustomProtocolManager::stopLoading):
3597         * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h:
3598         * NetworkProcess/NetworkProcess.cpp:
3599         (WebKit::NetworkProcess::NetworkProcess):
3600
3601 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3602
3603         Fix WinCairo build after r240014
3604         https://bugs.webkit.org/show_bug.cgi?id=161106
3605
3606         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3607
3608 2019-01-15  Ryosuke Niwa  <rniwa@webkit.org>
3609
3610         VisualViewport API should be updated upon opening of keyboard
3611         https://bugs.webkit.org/show_bug.cgi?id=193475
3612
3613         Reviewed by Simon Fraser.
3614
3615         The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport
3616         unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects.
3617
3618         Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in
3619         unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated
3620         while the keyboard is getting brought up.
3621
3622         * Shared/VisibleContentRectUpdateInfo.h:
3623         (WebKit::operator==):
3624         * WebProcess/WebPage/ios/WebPageIOS.mm:
3625         (WebKit::WebPage::updateVisibleContentRects):
3626
3627 2019-01-15  Megan Gardner  <megan_gardner@apple.com>
3628
3629         Add Reveal support in iOSMac
3630         https://bugs.webkit.org/show_bug.cgi?id=193408
3631         <rdar://problem/47300699>
3632
3633         Reviewed by Tim Horton.
3634
3635         Add calls to DictionaryLookup from the appropriate places.
3636
3637         * UIProcess/PageClient.h:
3638         * UIProcess/ios/PageClientImplIOS.h:
3639         * UIProcess/ios/PageClientImplIOS.mm:
3640         (WebKit::PageClientImpl::didPerformDictionaryLookup):
3641         * UIProcess/ios/WebPageProxyIOS.mm:
3642         (WebKit::WebPageProxy::didPerformDictionaryLookup):
3643         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
3644         (WebKit::WebPage::dictionaryPopupInfoForRange):
3645
3646 2019-01-15  Claudio Saavedra  <csaavedra@igalia.com>
3647
3648         [SOUP] Remove usage of NetworkProcess::singleton()
3649         https://bugs.webkit.org/show_bug.cgi?id=193444
3650
3651         Reviewed by Michael Catanzaro.
3652
3653         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3654         (WebKit::NetworkDataTaskSoup::download):
3655         (WebKit::NetworkDataTaskSoup::didWriteDownload):
3656         (WebKit::NetworkDataTaskSoup::didFinishDownload):
3657         (WebKit::NetworkDataTaskSoup::didFailDownload):
3658         * NetworkProcess/soup/NetworkSessionSoup.cpp:
3659         (WebKit::NetworkSessionSoup::NetworkSessionSoup):
3660
3661 2019-01-15  Eric Carlson  <eric.carlson@apple.com>
3662
3663         Fix incorrect ASSERT added in r239840
3664         https://bugs.webkit.org/show_bug.cgi?id=193466
3665         <rdar://problem/47095142>
3666
3667         Reviewed by Youenn Fablet.
3668
3669         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3670         (WebKit::UserMediaCaptureManager::Source::Source):
3671
3672 2019-01-15  Tim Horton  <timothy_horton@apple.com>
3673
3674         Frequent null-deref under TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded()
3675         https://bugs.webkit.org/show_bug.cgi?id=193468
3676         <rdar://problem/38645869>
3677
3678         Reviewed by Beth Dakin.
3679
3680         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3681         (WebKit::TiledCoreAnimationDrawingArea::scaleViewToFitDocumentIfNeeded):
3682         I'm not sure why this got *worse*, but we should null-check RenderView.
3683         It's OK to bail from scaleViewToFitDocumentIfNeeded, we'll re-do it
3684         the next time we paint (which will surely happen if we gain a RenderView).
3685
3686 2019-01-15  Chris Dumez  <cdumez@apple.com>
3687
3688         Unreviewed, rolling out r239993, r239995, r239997, and
3689         r239999.
3690
3691         Caused assertions under
3692         ViewGestureController::disconnectFromProcess()
3693
3694         Reverted changesets:
3695
3696         "Regression(PSON) View becomes blank after click a cross-site
3697         download link"
3698         https://bugs.webkit.org/show_bug.cgi?id=193361
3699         https://trac.webkit.org/changeset/239993
3700
3701         "Unreviewed iOS build fix after r239993."
3702         https://trac.webkit.org/changeset/239995
3703
3704         "Fix iOS build after r239993"
3705         https://bugs.webkit.org/show_bug.cgi?id=193361
3706         https://trac.webkit.org/changeset/239997
3707
3708         "Unreviewed, revert part of r239997 as it is not needed to fix
3709         the build."
3710         https://trac.webkit.org/changeset/239999
3711
3712 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3713
3714         Stop using CookiesStrategy
3715         https://bugs.webkit.org/show_bug.cgi?id=161106
3716
3717         Reviewed by Don Olmstead and Antti Koivisto.
3718
3719         * NetworkProcess/NetworkProcessPlatformStrategies.cpp:
3720         (WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted.
3721         * NetworkProcess/NetworkProcessPlatformStrategies.h:
3722         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
3723         * Scripts/webkit/messages.py:
3724         * Sources.txt:
3725         * WebKit.xcodeproj/project.pbxproj:
3726         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3727         (WebKit::WebAutomationSessionProxy::getCookiesForFrame):
3728         (WebKit::WebAutomationSessionProxy::deleteCookie):
3729         * WebProcess/Plugins/PluginView.cpp:
3730         (WebKit::PluginView::cookiesForURL):
3731         (WebKit::PluginView::setCookiesForURL):
3732         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3733         (WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted.
3734         (WebKit::WebPlatformStrategies::cookiesForDOM): Deleted.
3735         (WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted.
3736         (WebKit::WebPlatformStrategies::cookiesEnabled): Deleted.
3737         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted.
3738         (WebKit::WebPlatformStrategies::getRawCookies): Deleted.
3739         (WebKit::WebPlatformStrategies::deleteCookie): Deleted.
3740         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
3741         * WebProcess/WebPage/WebCookieJar.cpp: Added.
3742         (WebKit::WebCookieJar::cookies const):
3743         (WebKit::WebCookieJar::setCookies):
3744         (WebKit::WebCookieJar::cookiesEnabled const):
3745         (WebKit::WebCookieJar::cookieRequestHeaderFieldValue const):
3746         (WebKit::WebCookieJar::getRawCookies const):
3747         (WebKit::WebCookieJar::deleteCookie):
3748         * WebProcess/WebPage/WebCookieJar.h: Added.
3749         * WebProcess/WebPage/WebPage.cpp:
3750         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3751
3752 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3753
3754         Remove reporting for iOS mach lookups confirmed in-use
3755         https://bugs.webkit.org/show_bug.cgi?id=193455
3756         <rdar://problem/47259551>
3757
3758         Reviewed by Brent Fulgham.
3759
3760         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3761
3762 2019-01-15  Tim Horton  <timothy_horton@apple.com>
3763
3764         Cannot tab out of WKWebView on macOS
3765         https://bugs.webkit.org/show_bug.cgi?id=161448
3766         <rdar://problem/28100085>
3767
3768         Reviewed by Dean Jackson.
3769
3770         * UIProcess/WebPageProxy.cpp:
3771         (WebKit::WebPageProxy::takeFocus):
3772         If the UIDelegate doesn't implement takeFocus, provide a simple default
3773         implementation that just uses AppKit's key view loop to move the focus.
3774
3775         * UIProcess/API/APIUIClient.h:
3776         (API::UIClient::takeFocus):
3777         * UIProcess/API/C/WKPage.cpp:
3778         (WKPageSetPageUIClient):
3779         * UIProcess/Cocoa/UIDelegate.h:
3780         * UIProcess/Cocoa/UIDelegate.mm:
3781         (WebKit::UIDelegate::UIClient::takeFocus):
3782         Make API::UIClient's takeFocus return a bool indicating whether the
3783         client implements it or not.
3784
3785         * UIProcess/PageClient.h:
3786         * UIProcess/mac/PageClientImplMac.h:
3787         * UIProcess/mac/PageClientImplMac.mm:
3788         (WebKit::PageClientImpl::takeFocus):
3789         Plumb takeFocus to WebViewImpl.
3790
3791         * UIProcess/Cocoa/WebViewImpl.h:
3792         * UIProcess/Cocoa/WebViewImpl.mm:
3793         (WebKit::WebViewImpl::takeFocus):
3794         Borrow the relevant portion of WebKitLegacy's implementation of takeFocus,
3795         shifting focus to the next/previous key view in the window.
3796
3797 2019-01-15  Youenn Fablet  <youenn@apple.com>
3798
3799         Remove the specific handling of ephemeral sessions from CacheStorage::Engine::from
3800         https://bugs.webkit.org/show_bug.cgi?id=193400
3801
3802         Reviewed by Alex Christensen.
3803
3804         It is no longer needed as we correctly handle ephemeral sessions removal.
3805
3806         * NetworkProcess/cache/CacheStorageEngine.cpp:
3807         (WebKit::CacheStorage::Engine::from):
3808
3809 2019-01-15  Alex Christensen  <achristensen@webkit.org>
3810
3811         Fix iOS build after r239993
3812         https://bugs.webkit.org/show_bug.cgi?id=193361
3813
3814         * UIProcess/ProvisionalPageProxy.h:
3815         * UIProcess/SuspendedPageProxy.h:
3816
3817 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3818
3819         [macOS] Adjust logging policy in WebKit's sandbox
3820         https://bugs.webkit.org/show_bug.cgi?id=193454
3821         <rdar://problem/47256325>
3822
3823         Reviewed by Brent Fulgham.
3824
3825         * WebProcess/com.apple.WebProcess.sb.in:
3826
3827 2019-01-15  Chris Dumez  <cdumez@apple.com>
3828
3829         Unreviewed iOS build fix after r239993.
3830
3831         * UIProcess/SuspendedPageProxy.h:
3832
3833 2019-01-15  Per Arne Vollan  <pvollan@apple.com>
3834
3835         Add allow directive for MTLCompilerService.xpc to PluginProcess and WebContent
3836         https://bugs.webkit.org/show_bug.cgi?id=193453
3837         <rdar://problem/47268166>
3838
3839         Reviewed by Brent Fulgham.
3840
3841         * PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
3842         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
3843         * WebProcess/com.apple.WebProcess.sb.in:
3844
3845 2019-01-15  Chris Dumez  <cdumez@apple.com>
3846
3847         Regression(PSON) View becomes blank after click a cross-site download link
3848         https://bugs.webkit.org/show_bug.cgi?id=193361
3849         <rdar://problem/47099573>
3850
3851         Reviewed by Geoff Garen.
3852
3853         The issue tracked by rdar://problem/47099573 is that a provisional load may get
3854         canceled (or converted into a download) *after* we've decided to process-swap.
3855         In such cases, the view should keep displaying the current site and it should
3856         still be interactive. However, with the previous PSON model, the view (pageProxy)
3857         would have already swapped to the new process and would end up displaying the
3858         initially empty document.
3859
3860         To address the issue, this patch introduces the concept of a provisional load
3861         in the UIProcess, handled by a ProvisionalPageProxy which has its own privisional
3862         process. The WebPageProxy owns the ProvisionalPageProxy but we do not commit the
3863         provisional page until after the load was committed in the new process. This means
3864         that the view / WebPageProxy keeps using the old process and displays the current
3865         content until a load has committed in the provisional page. If no load commits
3866         in the provisional process (e.g. because the load is cancelled or converted into
3867         a download), then we merely destroy the ProvisionalPageProxy and terminate its
3868         process, without impacting the WebPageProxy.
3869
3870         * Shared/WebPageCreationParameters.cpp:
3871         (WebKit::WebPageCreationParameters::encode const):
3872         (WebKit::WebPageCreationParameters::decode):
3873         * Shared/WebPageCreationParameters.h:
3874         Rename isSwapFromSuspended to isProcessSwap for clarity as we always want to
3875         delay attaching the drawing area in case of a process-swap, no matter what
3876         now that the previous process is kept alive until the provisional load is
3877         committed in the new process.
3878
3879         * Shared/WebPolicyAction.h:
3880         Drop Suspend policy action. At decidePolicyForNavigationAction time, in case of
3881         process-swap, we now tell the previous process to simply ignore the load, while
3882         we create a ProvisionalPageProxy to do the new load in a new process.
3883         Suspension of the previous page in the old process, happens later, when a load
3884         is actually committed in the new process.
3885
3886         * Sources.txt:
3887         Add new ProvisionalPageProxy file.
3888
3889         * UIProcess/API/Cocoa/WKWebView.mm:
3890         (-[WKWebView _killWebContentProcessAndResetState]):
3891         When calling _killWebContentProcessAndResetState on a WKWebView, kill both the current
3892         process and the provisional one, to maintain previous behavior in our API tests.
3893
3894         * UIProcess/PageClient.h:
3895         Tiny build fix.
3896
3897         * UIProcess/ProvisionalPageProxy.cpp: Added.
3898         (WebKit::ProvisionalPageProxy::ProvisionalPageProxy):
3899         (WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
3900         (WebKit::ProvisionalPageProxy::takeDrawingArea):
3901         (WebKit::ProvisionalPageProxy::cancel):
3902         (WebKit::ProvisionalPageProxy::initializeWebPage):
3903         (WebKit::ProvisionalPageProxy::loadDataWithNavigation):
3904         (WebKit::ProvisionalPageProxy::loadRequestWithNavigation):
3905         (WebKit::ProvisionalPageProxy::goToBackForwardItem):
3906         (WebKit::ProvisionalPageProxy::didCreateMainFrame):
3907         (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
3908         (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
3909         (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
3910         (WebKit::ProvisionalPageProxy::didReceiveMessage):
3911         (WebKit::ProvisionalPageProxy::didReceiveSyncMessage):
3912         * UIProcess/ProvisionalPageProxy.h: Added.
3913         (WebKit::ProvisionalPageProxy::page):
3914         (WebKit::ProvisionalPageProxy::mainFrame const):
3915         (WebKit::ProvisionalPageProxy::process):
3916         (WebKit::ProvisionalPageProxy::processSwapRequestedByClient const):
3917         (WebKit::ProvisionalPageProxy::navigationID const):
3918         Add new ProvisionalPageProxy class to wrap the provisional load in the new process
3919         after a swap. The provisional page is owned by the WebPageProxy and we only commit
3920         the provisional page when the load is committed. Until then, the WebPageProxy keeps
3921         using the old process and displaying the current content.
3922
3923         * UIProcess/SuspendedPageProxy.cpp:
3924         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3925         (WebKit::SuspendedPageProxy::unsuspend):
3926         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
3927         Unregister the SuspendedPageProxy as an IPC message receiver a little bit earlier
3928         when we're going to unsuspend it. This avoids conflicting with the ProvisionalPageProxy
3929         which tries to register itself as an IPC message receiver for the same pageID when
3930         a process-swap occurs and we're switching to a suspended page.
3931
3932         * UIProcess/WebFrameProxy.cpp:
3933         (WebKit::WebFrameProxy::isMainFrame const):
3934         WebFrameProxy::isMainFrame() relies on checking that the frame is the WebPageProxy's m_mainFrame.
3935         Now that the WebPageProxy can have a ProvisionalPageProxy, also check if it is the ProvisionalPageProxy's
3936         m_mainFrame to maintain previous behavior.
3937
3938         * UIProcess/WebPageProxy.cpp:
3939         (WebKit::WebPageProxy::swapToWebProcess):
3940         swapToWebProcess() no longer takes care of unsuspending the SuspendedPage because we now call swapToWebProcess()
3941         later, when a load is actually committed in the provisional page / process. swapToWebProcess() now also needs
3942         to initialize some data members such as the drawing area and the main frame as it is transferring them over from
3943         the ProvisionalPageProxy which started the provisional load.
3944
3945         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3946         We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3947         committed in the provisional process.
3948
3949         (WebKit::WebPageProxy::initializeWebPage):
3950         - We no longer need IsSwapFromSuspended parameter as this is called later now, after a load has actually been
3951           committed in the provisional process.
3952         - Factor some code out to WebPageProxy::setDrawingArea() so that it can be shared with swapToWebProcess().
3953
3954         (WebKit::WebPageProxy::loadRequestWithNavigation):
3955         Only call setPendingAPIRequestURL() in loadRequestWithNavigation() only if ShouldTreatAsContinuingLoad is not
3956         Yes. This avoids hitting some assertions as this was already called during the first API call if needed.
3957
3958         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3959         In case of process swap, tell the previous process to ignore the load instead of suspending it right away.
3960         Suspension now happens later, only if we end up committing the provisional load in the new process.
3961         Also discard the SuspendedPage if it failed to suspend (we only reuse its process in this case). This used
3962         to happen a bi