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