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