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