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