b7034f33d0947bb5aa67ea28e8e5bb0345cccdc2
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-26  Andy Estes  <aestes@apple.com>
2
3         Try again to fix the iOS build after r231063.
4
5         * Configurations/Base.xcconfig:
6
7 2018-04-26  Jer Noble  <jer.noble@apple.com>
8
9         WK_COCOA_TOUCH the WK_ACCESSIBILITY_LDFLAGS
10         https://bugs.webkit.org/show_bug.cgi?id=185007
11         <rdar://problem/39735943>
12
13         Reviewed by Timothy Hatcher.
14
15         * Configurations/WebKit.xcconfig:
16
17 2018-04-26  Jer Noble  <jer.noble@apple.com>
18
19         Unreviewed build fix; fix iOS TAPI build step after r231063.
20
21         * Configurations/WebKit.xcconfig:
22
23 2018-04-26  Jer Noble  <jer.noble@apple.com>
24
25         WK_COCOA_TOUCH all the things.
26         https://bugs.webkit.org/show_bug.cgi?id=185006
27
28         Reviewed by Tim Horton.
29
30         * Configurations/BaseTarget.xcconfig:
31         * Configurations/WebKit.xcconfig:
32
33 2018-04-26  Daniel Bates  <dabates@apple.com>
34
35         Remove WebCore::-qualifier in NetworkLoadChecker.cpp
36         https://bugs.webkit.org/show_bug.cgi?id=185037
37
38         Reviewed by Youenn Fablet.
39
40         It is unncesssary to qualify WebCore types in NetworkLoadChecker.cpp as it has a
41         "using namespace WebCore" directive.
42
43         * NetworkProcess/NetworkLoadChecker.cpp:
44         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
45         (WebKit::NetworkLoadChecker::checkRedirection):
46         (WebKit::NetworkLoadChecker::validateResponse):
47         (WebKit::NetworkLoadChecker::continueCheckingRequest): Removed extra space character and unnecessary
48         parentheses from the right-hand side of the assignment to m_storedCredentialsPolicy.
49         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
50
51 2018-04-26  Daniel Bates  <dabates@apple.com>
52
53         Rename NetworkLoadChecker::returnError() to NetworkLoadChecker::accessControlErrorForValidationHandler()
54         https://bugs.webkit.org/show_bug.cgi?id=185035
55
56         Reviewed by Youenn Fablet.
57
58         Substitute NetworkLoadChecker::accessControlErrorForValidationHandler() for NetworkLoadChecker::returnError()
59         to better describe that it is a convenience function that returns a wrapped ResourceError object,
60         that represents an access control error, suitable to be passed directly to a validation handler.
61
62         * NetworkProcess/NetworkLoadChecker.cpp:
63         (WebKit::NetworkLoadChecker::checkRedirection): Update as needed for renaming.
64         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler): Use auto -> syntax to avoid the need to
65         class-qualify the return type. Also renamed parameter from error to message as it represents the message/description
66         for the access control error.
67         (WebKit::NetworkLoadChecker::checkRequest): Update as needed for renaming. Also substitute "message" for "error"
68         to match the argument of accessControlErrorForValidationHandler() with the same name.
69         (WebKit::NetworkLoadChecker::continueCheckingRequest): Update as needed for renaming.
70         (WebKit::NetworkLoadChecker::returnError): Deleted; renamed to accessControlErrorForValidationHandler().
71         * NetworkProcess/NetworkLoadChecker.h:
72
73 2018-04-26  Jiewen Tan  <jiewen_tan@apple.com>
74
75         Remove access to keychain from the WebContent process
76         https://bugs.webkit.org/show_bug.cgi?id=184428
77         <rdar://problem/13150903>
78
79         Part 3.
80
81         Tighten WebContent Process' sandbox profile to all Security.framework services.
82
83         Reviewed by Brent Fulgham.
84
85         * WebProcess/com.apple.WebProcess.sb.in:
86
87 2018-04-26  Youenn Fablet  <youenn@apple.com>
88
89         Make cross origin redirection error messages consistent between SubresourceLoader and NetworkLoadChecker
90         https://bugs.webkit.org/show_bug.cgi?id=185023
91
92         Reviewed by Chris Dumez.
93
94         Align NetworkLoadChecker with what SubresourceLoader is doing so that we can keep WK1 and WK2 error messages as consistent as possible.
95
96         * NetworkProcess/NetworkLoadChecker.cpp:
97         (WebKit::NetworkLoadChecker::checkRedirection):
98         (WebKit::NetworkLoadChecker::validateResponse):
99
100 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
101
102         Activate selection when interacting with editable content
103         https://bugs.webkit.org/show_bug.cgi?id=185017
104
105         Reviewed by Tim Horton.
106         
107         Fixes a regression from r231016 where selection now does not work when interacting with
108         editable content. When we go into editable content, we should turn on the assistant.
109         This fulfills the requirement of user interaction as well, so any javascript selections
110         after this point should be valid.
111
112         * UIProcess/ios/WKContentViewInteraction.mm:
113         (-[WKContentView _startAssistingKeyboard]):
114         (-[WKContentView _stopAssistingKeyboard]):
115
116 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
117
118         Disable content filtering in minimal simulator mode
119         https://bugs.webkit.org/show_bug.cgi?id=185027
120         <rdar://problem/39736091>
121
122         Reviewed by Jer Noble.
123
124         * Configurations/FeatureDefines.xcconfig:
125
126 2018-04-26  Brady Eidson  <beidson@apple.com>
127
128         Add a setting for keeping around all processes and always reusing them per-origin.
129         <rdar://problem/39695798> and https://bugs.webkit.org/show_bug.cgi?id=185020
130
131         Reviewed by Andy Estes.
132
133         * UIProcess/API/APIProcessPoolConfiguration.cpp:
134         (API::ProcessPoolConfiguration::copy):
135         * UIProcess/API/APIProcessPoolConfiguration.h:
136
137         * UIProcess/API/C/WKContextConfigurationRef.cpp:
138         (WKContextConfigurationAlwaysKeepAndReuseSwappedProcesses):
139         (WKContextConfigurationSetAlwaysKeepAndReuseSwappedProcesses):
140         * UIProcess/API/C/WKContextConfigurationRef.h:
141
142         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
143         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
144         (-[_WKProcessPoolConfiguration setAlwaysKeepAndReuseSwappedProcesses:]):
145         (-[_WKProcessPoolConfiguration alwaysKeepAndReuseSwappedProcesses]):
146
147         * UIProcess/SuspendedPageProxy.cpp:
148         (WebKit::SuspendedPageProxy::webProcessDidClose):
149         (WebKit::SuspendedPageProxy::destroyWebPageInWebProcess):
150         * UIProcess/SuspendedPageProxy.h:
151
152         * UIProcess/WebPageProxy.cpp:
153         (WebKit::WebPageProxy::suspendedPageClosed):
154         (WebKit::WebPageProxy::suspendedPageProcessClosed): Deleted.
155         * UIProcess/WebPageProxy.h:
156         (WebKit::WebPageProxy::suspendedPage const):
157
158         * UIProcess/WebProcessPool.cpp:
159         (WebKit::WebProcessPool::shouldTerminate):
160         (WebKit::WebProcessPool::disconnectProcess):
161         (WebKit::WebProcessPool::addProcessToOriginCacheSet):
162         (WebKit::WebProcessPool::removeProcessFromOriginCacheSet):
163         (WebKit::WebProcessPool::processForNavigation): If a swap will occur, cache the old process.
164         (WebKit::WebProcessPool::processForNavigationInternal): Consider re-using a previously cached process.
165         * UIProcess/WebProcessPool.h:
166
167         * WebProcess/WebPage/WebPage.cpp:
168         (WebKit::m_credentialsMessenger):
169
170 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
171
172         [INTL] Implement Intl.PluralRules
173         https://bugs.webkit.org/show_bug.cgi?id=184312
174
175         Reviewed by JF Bastien.
176
177         Added Intl.PluralRules feature flag.
178
179         * Configurations/FeatureDefines.xcconfig:
180
181 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
182
183         [GTK][WPE] Initial ASYNC_SCROLLING support
184         https://bugs.webkit.org/show_bug.cgi?id=184961
185
186         Reviewed by Carlos Garcia Campos.
187
188         Guard RemoteScrollingCoordinator and RemoteScrollingCoordinatorProxy
189         usage in WebChromeClient and WebPageProxy, respectively, with
190         PLATFORM(COCOA) in addition to the ASYNC_SCROLLING guards.
191
192         Despite enabling the code at build-time, the feature (as intended) is
193         not yet used because of the DrawingArea rejection in the WebPage
194         constructor.
195
196         * UIProcess/WebPageProxy.cpp:
197         (WebKit::WebPageProxy::initializeWebPage):
198         (WebKit::WebPageProxy::handleWheelEvent):
199         (WebKit::WebPageProxy::updateTouchEventTracking):
200         * UIProcess/WebPageProxy.h:
201         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
202         (WebKit::WebChromeClient::createScrollingCoordinator const):
203
204 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
205
206         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
207         https://bugs.webkit.org/show_bug.cgi?id=184643
208
209         Reviewed by Žan Doberšek.
210
211         Adapt to single-header WPE includes.
212
213         Null-initialize padding to silence -Wmissing-field-initializers. (Yuck.)
214
215         * Shared/NativeWebTouchEvent.h:
216         * Shared/wpe/WebEventFactory.cpp:
217         * UIProcess/API/glib/WebKitPrivate.cpp:
218         * UIProcess/API/wpe/CompositingManagerProxy.cpp:
219         * UIProcess/API/wpe/ScrollGestureController.h:
220         * UIProcess/API/wpe/WPEView.cpp:
221         (WKWPE::m_backend):
222         * UIProcess/API/wpe/WebKitWebViewBackend.h:
223         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
224         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
225         (WebKit::AcceleratedSurfaceWPE::initialize):
226
227 2018-04-25  Saam Barati  <sbarati@apple.com>
228
229         dlopen the bundle's executable before calling -[NSBundle load] since that will also do a bunch of other things we don't need
230         https://bugs.webkit.org/show_bug.cgi?id=184904
231
232         Reviewed by Geoffrey Garen.
233
234         Loading an NSBundle does a lot of work to find the principal class inside
235         the bundle. This means it walks all the objective C class names loaded
236         by the bundle. Doing this is *really* expensive.
237         
238         Some users of the injected bundle define a WKBundleInitialize function.
239         In such a case, we don't need the principal class, so we can skip loading
240         the NSBundle. Now, before we load the bundle, we dlopen and dlsym looking
241         for the WKBundleInitialize function. If we find it, we skip loading
242         the bundle. If we don't find the WKBundleInitialize function, we fall
243         back to loading the bundle and finding the principal class.
244         
245         This speeds up initializeWebProcess by ~70ms on my MBP.
246
247         * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
248         (WebKit::InjectedBundle::initialize):
249
250 2018-04-25  Youenn Fablet  <youenn@apple.com>
251
252         Use NetworkLoadChecker for all subresource loads except fetch/XHR
253         https://bugs.webkit.org/show_bug.cgi?id=184870
254         <rdar://problem/39370034>
255
256         Reviewed by Chris Dumez.
257
258         Relax rules to check for non HTTP(s) redirections to throw only when WebProcess says to load it after redirection.
259         This allows WebProcess to load redirected non HTTP(s) URLs, such as data URLs.
260         We keep these checks when WebProcess asks to continue the load and for all PingLoads.
261
262         Update error messages to be more consistent with WK1.
263
264         * NetworkProcess/NetworkLoadChecker.cpp:
265         (WebKit::NetworkLoadChecker::checkRedirection):
266         (WebKit::NetworkLoadChecker::continueCheckingRequest):
267         (WebKit::NetworkLoadChecker::validateResourceResponse):
268         (WebKit::NetworkLoadChecker::continueCheckingRequest):
269         * NetworkProcess/NetworkLoadChecker.h:
270         (WebKit::NetworkLoadChecker::validateResponse):
271         * NetworkProcess/NetworkResourceLoader.cpp:
272         (WebKit::shouldUseNetworkLoadChecker):
273         (WebKit::NetworkResourceLoader::continueWillSendRequest):
274
275 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
276
277         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
278         https://bugs.webkit.org/show_bug.cgi?id=184962
279
280         Reviewed by Youenn Fablet.
281         <rdar://problem/39715044>
282
283         Build fix. Revert the change in r231019 to remove the empty URL and about:blank check here.
284         These checks are for the source / originating URL, not the target URL.
285
286         * UIProcess/WebProcessPool.cpp:
287         (WebKit::WebProcessPool::processForNavigation):
288
289 2018-04-25  Youenn Fablet  <youenn@apple.com>
290
291         WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier should use DoNotProcessIncomingMessagesWhenWaitingForSyncReply
292         https://bugs.webkit.org/show_bug.cgi?id=184978
293         <rdar://problem/39667094>
294
295         Reviewed by Simon Fraser.
296
297         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply to keep a consistent state after the sync IPC call.
298
299         * WebProcess/Network/WebLoaderStrategy.cpp:
300         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
301         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
302
303 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
304
305         Remove access to keychain from the WebContent process
306         https://bugs.webkit.org/show_bug.cgi?id=184428
307         <rdar://problem/13150903>
308
309         Reviewed by Brent Fulgham.
310
311         This patch does the followings:
312         1. Added necessary support to move HTMLKeygenElement's operation from WebContent Process to UI Process.
313         2. Craft new SPI copySignedPublicKeyAndChallengeString to supply HTMLKeygenElement with dummy data such
314         that WebKitTestRunner tests will not modify the underlying key store (e.g., the macOS Keychain).
315
316         * UIProcess/API/APINavigationClient.h:
317         (API::NavigationClient::signedPublicKeyAndChallengeString):
318         * UIProcess/API/C/WKPage.cpp:
319         (WKPageSetPageNavigationClient):
320         * UIProcess/API/C/WKPageNavigationClient.h:
321         * UIProcess/Cocoa/NavigationState.h:
322         * UIProcess/Cocoa/NavigationState.mm:
323         (WebKit::NavigationState::NavigationClient::signedPublicKeyAndChallengeString):
324         * UIProcess/WebPageProxy.cpp:
325         (WebKit::WebPageProxy::signedPublicKeyAndChallengeString):
326         * UIProcess/WebPageProxy.h:
327         * UIProcess/WebPageProxy.messages.in:
328         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
329         (WebKit::WebChromeClient::signedPublicKeyAndChallengeString const):
330         * WebProcess/WebCoreSupport/WebChromeClient.h:
331
332 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
333
334         [Extra zoom mode] The search field on www.bing.com is missing label text
335         https://bugs.webkit.org/show_bug.cgi?id=184975
336         <rdar://problem/39723081>
337
338         Reviewed by Tim Horton.
339
340         Adds support for displaying the "aria-label" attribute as the input view's label text in extra zoom mode. Also
341         adds support for grabbing the input label's text for testing.
342
343         Test: fast/forms/extrazoom/form-control-label-text.html
344
345         * Shared/AssistedNodeInformation.cpp:
346         (WebKit::AssistedNodeInformation::encode const):
347         (WebKit::AssistedNodeInformation::decode):
348         * Shared/AssistedNodeInformation.h:
349         * UIProcess/API/Cocoa/WKWebView.mm:
350         (-[WKWebView formInputLabel]):
351         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
352         * UIProcess/ios/WKContentViewInteraction.h:
353         * UIProcess/ios/WKContentViewInteraction.mm:
354         (-[WKContentView formInputLabel]):
355         * WebProcess/WebPage/ios/WebPageIOS.mm:
356         (WebKit::WebPage::getAssistedNodeInformation):
357
358 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
359
360         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
361         https://bugs.webkit.org/show_bug.cgi?id=184962
362
363         Reviewed by Youenn Fablet.
364
365         Don't create a new WebContent process when navigating to a blob object URL since doing so
366         can result in a race condition in which the blog URL is removed from the blob registry of
367         the network process by the time the navigation gets commited. This causes a failure in
368         fast/dom/HTMLAnchorElement/anchor-download-unset.html and oher layout tests.
369
370         In the future, the network process should verify that a given WebContent process has access
371         to a given blob URL. For now, we rely on WebContent process to tell us whether it can
372         navigate to a given blob URL or not.
373
374         * Shared/NavigationActionData.cpp:
375         (WebKit::NavigationActionData::encode const): Encode newly added treatAsSameOriginNavigation.
376         (WebKit::NavigationActionData::decode): Ditto for decoding.
377         * Shared/NavigationActionData.h:
378         (WebKit::NavigationActionData::treatAsSameOriginNavigation): Added.
379         * UIProcess/API/APINavigation.h:
380         (API::Navigation::setTreatAsSameOriginNavigation): Added.
381         (API::Navigation::treatAsSameOriginNavigation const): Added.
382         * UIProcess/API/APIProcessPoolConfiguration.h:
383         * UIProcess/WebPageProxy.cpp:
384         (WebKit::WebPageProxy::decidePolicyForNavigationAction): Use the current process when
385         treatAsSameOriginNavigation is set to true; i.e. when navigating to a blob URL the current
386         document has access.
387         * UIProcess/WebProcessPool.cpp:
388         (WebKit::WebProcessPool::processForNavigation):
389         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
390         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
391
392 2018-04-25  Megan Gardner  <megan_gardner@apple.com>
393
394         Don't activate Selection Assistant unless it is actually needed.
395         https://bugs.webkit.org/show_bug.cgi?id=184944
396         <rdar://problem/39469671>
397
398         Reviewed by Tim Horton.
399         
400         Don't activate the selection unless we need to. Activating on init is overeager and allowing Javascript to 
401         activate selections without user input.
402
403         * UIProcess/ios/WKContentViewInteraction.mm:
404         (-[WKContentView useSelectionAssistantWithGranularity:]):
405
406 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
407
408         Fix entitlements and sandbox configurations in WebKit after r230778
409         https://bugs.webkit.org/show_bug.cgi?id=184960
410         <rdar://problem/39662827>
411
412         Reviewed by Tim Horton.
413
414         Build fixes for watchOS and tvOS after r230778.
415
416         * Configurations/BaseXPCService.xcconfig:
417         * Configurations/NetworkService.xcconfig:
418         * Configurations/WebContentService.xcconfig:
419
420 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
421
422         Unreviewed build fix after r231008.
423
424         * NetworkProcess/NetworkDataTask.cpp:
425         (WebKit::NetworkDataTask::create): Forgot to remove an unneeded constructor argument.
426
427 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
428
429         Don't Block First Party Cookies on Redirects
430         https://bugs.webkit.org/show_bug.cgi?id=184948
431         <rdar://problem/39534099>
432
433         Reviewed by Youenn Fablet.
434
435         Top-level navigations should not be subject to cookie blocking behavior. When performing redirects for main frame
436         navigation we are blocking cookies, leading to site breakage.
437         
438         We need to keep track of which NetworkDataTasks are due to a main frame navigation. When a redirect is performed
439         on the main frame, we should treat the new origin as the 'first party for cookies' and avoid blocking cookies for
440         that URL.
441
442         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
443         (WebKit::NetworkConnectionToWebProcess::preconnectTo): Use the correct parameter type. We actually serialize
444         NetworkResourceLoadParameters over IPC, so we should get access to all the members of this child class.
445         * NetworkProcess/NetworkConnectionToWebProcess.h:
446         * NetworkProcess/NetworkDataTask.cpp:
447         (WebKit::NetworkDataTask::create): Pass new 'loadIsForNavigation' flag to create methods. 
448         (WebKit::NetworkDataTask::NetworkDataTask): Capture 'loadIsForNavigation' in constructor.
449         * NetworkProcess/NetworkDataTask.h:
450         (WebKit::NetworkDataTask::isTopLevelNavigation const): Added.
451         * NetworkProcess/NetworkDataTaskBlob.cpp:
452         (WebKit::NetworkDataTaskBlob::NetworkDataTaskBlob): Accept new constructor argument.
453         * NetworkProcess/NetworkDataTaskBlob.h:
454         * NetworkProcess/NetworkLoad.cpp:
455         (WebKit::NetworkLoad::willPerformHTTPRedirection): Retain requester value from old request during redirect.
456         * NetworkProcess/NetworkResourceLoadParameters.cpp:
457         (NetworkResourceLoadParameters::decode): Update to pass new flag.
458         (NetworkResourceLoadParameters::encode): Ditto.
459         * NetworkProcess/NetworkLoadParameters.h:
460         * NetworkProcess/capture/NetworkDataTaskReplay.cpp:
461         (WebKit::NetworkCapture::NetworkDataTaskReplay::NetworkDataTaskReplay): Accept new constructor argument.
462         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
463         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
464         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa): Accept new constructor argument.
465         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
466         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
467         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl): Accept new constructor argument.
468         * NetworkProcess/curl/NetworkDataTaskCurl.h:
469         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
470         (WebKit::NetworkDataTaskSoup::NetworkDataTaskSoup): Accept new constructor argument.
471         * NetworkProcess/soup/NetworkDataTaskSoup.h:
472
473 2018-04-25  Youenn Fablet  <youenn@apple.com>
474
475         Ensure DNT is set for redirections handled in NetworkProcess
476         https://bugs.webkit.org/show_bug.cgi?id=184890
477
478         Reviewed by Ryosuke Niwa.
479
480         Compute whether DNT header should be set on requests based on:
481         - request has a DNT header
482         - session is ephemeral (aka private browsing mode)
483         In both cases, we ensure a DNT header is added for any request triggered by a redirection.
484
485         Covered by http/wpt/fetch/dnt-header-after-redirection.html.
486
487         * NetworkProcess/NetworkLoadChecker.cpp:
488         (WebKit::NetworkLoadChecker::check):
489         (WebKit::NetworkLoadChecker::prepareRedirectedRequest):
490         * NetworkProcess/NetworkLoadChecker.h:
491         * NetworkProcess/NetworkResourceLoader.cpp:
492         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
493         (WebKit::NetworkResourceLoader::continueWillSendRequest):
494         * NetworkProcess/PingLoad.cpp:
495         (WebKit::PingLoad::willPerformHTTPRedirection):
496         * WebProcess/Network/WebLoaderStrategy.cpp:
497         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
498
499 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
500
501         [WPE] Remove deprecated functions and properties from the API
502         https://bugs.webkit.org/show_bug.cgi?id=179295
503
504         Reviewed by Žan Doberšek.
505
506         * UIProcess/API/glib/WebKitCookieManager.cpp:
507         * UIProcess/API/glib/WebKitFormSubmissionRequest.cpp:
508         * UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
509         (webkitNavigationPolicyDecisionGetProperty):
510         (webkit_navigation_policy_decision_class_init):
511         * UIProcess/API/glib/WebKitSettings.cpp:
512         (webKitSettingsSetProperty):
513         (webKitSettingsGetProperty):
514         (webkit_settings_class_init):
515         * UIProcess/API/glib/WebKitWebContext.cpp:
516         (webkitWebContextGetProperty):
517         (webkitWebContextSetProperty):
518         (webkit_web_context_class_init):
519         * UIProcess/API/glib/WebKitWebView.cpp:
520         (webkit_web_view_class_init):
521         (webkitWebViewHandleAuthenticationChallenge):
522         (webkitWebViewWebProcessTerminated):
523         * UIProcess/API/wpe/WebKitCookieManager.h:
524         * UIProcess/API/wpe/WebKitFormSubmissionRequest.h:
525         * UIProcess/API/wpe/WebKitNavigationPolicyDecision.h:
526         * UIProcess/API/wpe/WebKitSettings.h:
527         * UIProcess/API/wpe/WebKitWebContext.h:
528
529 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
530
531         Unreviewed, silence -Wreturn-type warning
532         https://bugs.webkit.org/show_bug.cgi?id=184560
533
534         * NetworkProcess/NetworkResourceLoader.cpp:
535         (WebKit::shouldCancelCrossOriginLoad):
536
537 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
538
539         [GTK] Miscellaneous build cleanups
540         https://bugs.webkit.org/show_bug.cgi?id=184399
541
542         Reviewed by Žan Doberšek.
543
544         * PlatformGTK.cmake:
545
546 2018-04-25  Dean Jackson  <dino@apple.com>
547
548         Make a better flag for system preview, and disable it where necessary
549         https://bugs.webkit.org/show_bug.cgi?id=184968
550         <rdar://problem/39686506>
551
552         Reviewed by Eric Carlson.
553
554         Use USE(SYSTEM_PREVIEW).
555
556         * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
557         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
558         (-[WKWebViewContentProviderRegistry init]):
559         * UIProcess/ios/WKSystemPreviewView.mm:
560
561 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
562
563         [GTK] Implement MouseEvent.buttons
564         https://bugs.webkit.org/show_bug.cgi?id=184913
565
566         Reviewed by Žan Doberšek.
567
568         It's currently returning always 0.
569
570         * Shared/gtk/WebEventFactory.cpp:
571         (WebKit::pressedMouseButtons): Helper function to get the pressed mouse buttons.
572         (WebKit::WebEventFactory::createWebMouseEvent): Pass presssed mouse buttons to constructor instead of 0.
573         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
574         (WebKit::WebAutomationSession::platformSimulateMouseInteraction): Include the mouse buttons state in automation
575         synthesized events and update m_currentModifiers with the mouse buttons state.
576         (WebKit::keyCodeForVirtualKey): Do not set the state here.
577         (WebKit::modifiersForKeyCode): Helper to get the modifiers for a key code.
578         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction): Initialize the modifiers also when
579         virtualKey is std::nullopt;
580
581 2018-04-24  Nan Wang  <n_wang@apple.com>
582
583         AX: soft link libAccessibility.dylb
584         https://bugs.webkit.org/show_bug.cgi?id=184919
585
586         Reviewed by Dan Bernstein.
587
588         Weakly linked libAccessibility.dylib on macOS.
589
590         * Configurations/WebKit.xcconfig:
591         * UIProcess/API/Cocoa/WKWebView.mm:
592         (-[WKWebView _initializeWithConfiguration:]):
593         (-[WKWebView _updateAccessibilityEventsEnabled]):
594
595 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
596
597         [WinCairo] Add WKView and WKAPI
598         https://bugs.webkit.org/show_bug.cgi?id=182869
599
600         Reviewed by Alex Christensen.
601
602         Resurrected source files for WebKit for Windows port which was
603         removed in r139003.
604
605         * PlatformWin.cmake: Renamed the output name of WebKit to WebKit2
606         not to conflict WebKitLegacy. Added source files and include paths.
607         * UIProcess/API/C/WKAPICast.h:
608         * UIProcess/API/C/win/WKAPICastWin.h: Added.
609         * UIProcess/API/C/win/WKView.cpp: Added.
610         (WKViewCreate):
611         (WKViewGetWindow):
612         (WKViewGetPage):
613         (WKViewSetParentWindow):
614         (WKViewWindowAncestryDidChange):
615         (WKViewSetIsInWindow):
616         (WKViewSetScrollOffsetOnNextResize):
617         * UIProcess/API/C/win/WKView.h: Added.
618         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added.
619         (API::WebsiteDataStore::defaultApplicationCacheDirectory):
620         (API::WebsiteDataStore::defaultCacheStorageDirectory):
621         (API::WebsiteDataStore::defaultNetworkCacheDirectory):
622         (API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory):
623         (API::WebsiteDataStore::defaultServiceWorkerRegistrationDirectory):
624         (API::WebsiteDataStore::defaultLocalStorageDirectory):
625         (API::WebsiteDataStore::defaultMediaKeysStorageDirectory):
626         (API::WebsiteDataStore::defaultWebSQLDatabaseDirectory):
627         (API::WebsiteDataStore::defaultResourceLoadStatisticsDirectory):
628         (API::WebsiteDataStore::cacheDirectoryFileSystemRepresentation):
629         (API::WebsiteDataStore::websiteDataDirectoryFileSystemRepresentation):
630         (API::WebsiteDataStore::defaultDataStoreConfiguration):
631         * UIProcess/Launcher/ProcessLauncher.h:
632         * UIProcess/Launcher/win/ProcessLauncherWin.cpp: Added.
633         (WebKit::processName):
634         (WebKit::ProcessLauncher::launchProcess):
635         (WebKit::ProcessLauncher::terminateProcess):
636         (WebKit::ProcessLauncher::platformInvalidate):
637         * UIProcess/Network/NetworkProcessProxy.cpp:
638         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
639         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
640         * UIProcess/WebsiteData/win/WebsiteDataStoreWin.cpp: Added.
641         (WebKit::WebsiteDataStore::platformInitialize):
642         (WebKit::WebsiteDataStore::platformDestroy):
643         (WebKit::WebsiteDataStore::platformRemoveRecentSearches):
644         * UIProcess/win/PageClientImpl.cpp: Added.
645         (WebKit::PageClientImpl::PageClientImpl):
646         (WebKit::PageClientImpl::createDrawingAreaProxy):
647         (WebKit::PageClientImpl::setViewNeedsDisplay):
648         (WebKit::PageClientImpl::requestScroll):
649         (WebKit::PageClientImpl::viewScrollPosition):
650         (WebKit::PageClientImpl::viewSize):
651         (WebKit::PageClientImpl::isViewWindowActive):
652         (WebKit::PageClientImpl::isViewFocused):
653         (WebKit::PageClientImpl::isViewVisible):
654         (WebKit::PageClientImpl::isViewInWindow):
655         (WebKit::PageClientImpl::PageClientImpl::processDidExit):
656         (WebKit::PageClientImpl::didRelaunchProcess):
657         (WebKit::PageClientImpl::toolTipChanged):
658         (WebKit::PageClientImpl::setCursor):
659         (WebKit::PageClientImpl::setCursorHiddenUntilMouseMoves):
660         (WebKit::PageClientImpl::didChangeViewportProperties):
661         (WebKit::PageClientImpl::registerEditCommand):
662         (WebKit::PageClientImpl::clearAllEditCommands):
663         (WebKit::PageClientImpl::canUndoRedo):
664         (WebKit::PageClientImpl::executeUndoRedo):
665         (WebKit::PageClientImpl::convertToDeviceSpace):
666         (WebKit::PageClientImpl::convertToUserSpace):
667         (WebKit::PageClientImpl::screenToRootView):
668         (WebKit::PageClientImpl::rootViewToScreen):
669         (WebKit::PageClientImpl::doneWithKeyEvent):
670         (WebKit::PageClientImpl::createPopupMenuProxy):
671         (WebKit::PageClientImpl::createContextMenuProxy):
672         (WebKit::createColorPicker):
673         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
674         (WebKit::PageClientImpl::exitAcceleratedCompositingMode):
675         (WebKit::PageClientImpl::updateAcceleratedCompositingMode):
676         (WebKit::PageClientImpl::pageClosed):
677         (WebKit::PageClientImpl::preferencesDidChange):
678         (WebKit::PageClientImpl::didChangeContentSize):
679         (WebKit::PageClientImpl::handleDownloadRequest):
680         (WebKit::PageClientImpl::didCommitLoadForMainFrame):
681         (WebKit::PageClientImpl::fullScreenManagerProxyClient):
682         (WebKit::PageClientImpl::closeFullScreenManager):
683         (WebKit::PageClientImpl::isFullScreen):
684         (WebKit::PageClientImpl::enterFullScreen):
685         (WebKit::PageClientImpl::exitFullScreen):
686         (WebKit::PageClientImpl::beganEnterFullScreen):
687         (WebKit::PageClientImpl::beganExitFullScreen):
688         (WebKit::PageClientImpl::doneWithTouchEvent):
689         (WebKit::PageClientImpl::wheelEventWasNotHandledByWebCore):
690         (WebKit::PageClientImpl::didFinishLoadingDataForCustomContentProvider):
691         (WebKit::PageClientImpl::navigationGestureDidBegin):
692         (WebKit::PageClientImpl::navigationGestureWillEnd):
693         (WebKit::PageClientImpl::navigationGestureDidEnd):
694         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
695         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
696         (WebKit::PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame):
697         (WebKit::PageClientImpl::didFinishLoadForMainFrame):
698         (WebKit::PageClientImpl::didSameDocumentNavigationForMainFrame):
699         (WebKit::PageClientImpl::didChangeBackgroundColor):
700         (WebKit::PageClientImpl::isPlayingAudioWillChange):
701         (WebKit::PageClientImpl::isPlayingAudioDidChange):
702         (WebKit::PageClientImpl::refView):
703         (WebKit::PageClientImpl::derefView):
704         * UIProcess/win/PageClientImpl.h: Added.
705         * UIProcess/win/TextCheckerWin.cpp: Added.
706         (WebKit::checkerState):
707         (WebKit::TextChecker::state):
708         (WebKit::TextChecker::setTestingMode):
709         (WebKit::TextChecker::isTestingMode):
710         (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
711         (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
712         (WebKit::TextChecker::setGrammarCheckingEnabled):
713         (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
714         (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
715         (WebKit::TextChecker::uniqueSpellDocumentTag):
716         (WebKit::TextChecker::closeSpellDocumentWithTag):
717         (WebKit::TextChecker::checkSpellingOfString):
718         (WebKit::TextChecker::checkGrammarOfString):
719         (WebKit::TextChecker::spellingUIIsShowing):
720         (WebKit::TextChecker::toggleSpellingUIIsShowing):
721         (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
722         (WebKit::TextChecker::updateSpellingUIWithGrammarString):
723         (WebKit::TextChecker::getGuessesForWord):
724         (WebKit::TextChecker::learnWord):
725         (WebKit::TextChecker::ignoreWord):
726         (WebKit::TextChecker::requestCheckingOfString):
727         (WebKit::TextChecker::checkTextOfParagraph):
728         * UIProcess/win/WebContextMenuProxyWin.cpp: Added.
729         (WebKit::WebContextMenuProxyWin::show):
730         (WebKit::WebContextMenuProxyWin::showContextMenuWithItems):
731         (WebKit::WebContextMenuProxyWin::WebContextMenuProxyWin):
732         (WebKit::WebContextMenuProxyWin::~WebContextMenuProxyWin):
733         * UIProcess/win/WebContextMenuProxyWin.h: Added.
734         (WebKit::WebContextMenuProxyWin::create):
735         * UIProcess/win/WebInspectorProxyWin.cpp: Added.
736         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
737         (WebKit::WebInspectorProxy::platformCreateFrontendWindow):
738         (WebKit::WebInspectorProxy::platformCloseFrontendPageAndWindow):
739         (WebKit::WebInspectorProxy::platformDidCloseForCrash):
740         (WebKit::WebInspectorProxy::platformInvalidate):
741         (WebKit::WebInspectorProxy::platformHide):
742         (WebKit::WebInspectorProxy::platformBringToFront):
743         (WebKit::WebInspectorProxy::platformBringInspectedPageToFront):
744         (WebKit::WebInspectorProxy::platformIsFront):
745         (WebKit::WebInspectorProxy::platformInspectedURLChanged):
746         (WebKit::WebInspectorProxy::inspectorPageURL):
747         (WebKit::WebInspectorProxy::inspectorTestPageURL):
748         (WebKit::WebInspectorProxy::inspectorBaseURL):
749         (WebKit::WebInspectorProxy::platformInspectedWindowHeight):
750         (WebKit::WebInspectorProxy::platformInspectedWindowWidth):
751         (WebKit::WebInspectorProxy::platformAttach):
752         (WebKit::WebInspectorProxy::platformDetach):
753         (WebKit::WebInspectorProxy::platformSetAttachedWindowHeight):
754         (WebKit::WebInspectorProxy::platformSetAttachedWindowWidth):
755         (WebKit::WebInspectorProxy::platformStartWindowDrag):
756         (WebKit::WebInspectorProxy::platformSave):
757         (WebKit::WebInspectorProxy::platformAppend):
758         (WebKit::WebInspectorProxy::platformAttachAvailabilityChanged):
759         * UIProcess/win/WebPageProxyWin.cpp: Added.
760         (WebKit::WebPageProxy::platformInitialize):
761         (WebKit::WebPageProxy::standardUserAgent):
762         (WebKit::WebPageProxy::saveRecentSearches):
763         (WebKit::WebPageProxy::loadRecentSearches):
764         (WebKit::WebPageProxy::editorStateChanged):
765         * UIProcess/win/WebPreferencesWin.cpp: Added.
766         (WebKit::WebPreferences::platformInitializeStore):
767         (WebKit::WebPreferences::platformUpdateStringValueForKey):
768         (WebKit::WebPreferences::platformUpdateBoolValueForKey):
769         (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
770         (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
771         (WebKit::WebPreferences::platformUpdateFloatValueForKey):
772         (WebKit::WebPreferences::platformGetStringUserValueForKey):
773         (WebKit::WebPreferences::platformGetBoolUserValueForKey):
774         (WebKit::WebPreferences::platformGetUInt32UserValueForKey):
775         (WebKit::WebPreferences::platformGetDoubleUserValueForKey):
776         * UIProcess/win/WebProcessPoolWin.cpp: Added.
777         (WebKit::WebProcessPool::platformInitialize):
778         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
779         (WebKit::WebProcessPool::platformInitializeWebProcess):
780         (WebKit::WebProcessPool::platformInvalidateContext):
781         (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory):
782         (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory):
783         (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory):
784         (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory):
785         (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory):
786         (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory):
787         (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory):
788         (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory):
789         (WebKit::WebProcessPool::platformResolvePathsForSandboxExtensions):
790         * UIProcess/win/WebView.cpp: Added.
791         (WebKit::WebView::WebViewWndProc):
792         (WebKit::WebView::wndProc):
793         (WebKit::WebView::registerWebViewWindowClass):
794         (WebKit::WebView::WebView):
795         (WebKit::WebView::~WebView):
796         (WebKit::WebView::initialize):
797         (WebKit::WebView::setParentWindow):
798         (WebKit::findTopLevelParentWindow):
799         (WebKit::WebView::windowAncestryDidChange):
800         (WebKit::WebView::onMouseEvent):
801         (WebKit::WebView::onWheelEvent):
802         (WebKit::WebView::onHorizontalScroll):
803         (WebKit::WebView::onVerticalScroll):
804         (WebKit::WebView::onKeyEvent):
805         (WebKit::drawPageBackground):
806         (WebKit::WebView::paint):
807         (WebKit::WebView::onPaintEvent):
808         (WebKit::WebView::onPrintClientEvent):
809         (WebKit::WebView::onSizeEvent):
810         (WebKit::WebView::onWindowPositionChangedEvent):
811         (WebKit::WebView::onSetFocusEvent):
812         (WebKit::WebView::onKillFocusEvent):
813         (WebKit::WebView::onTimerEvent):
814         (WebKit::WebView::onShowWindowEvent):
815         (WebKit::WebView::onSetCursor):
816         (WebKit::WebView::updateActiveState):
817         (WebKit::WebView::updateActiveStateSoon):
818         (WebKit::initCommonControls):
819         (WebKit::WebView::initializeToolTipWindow):
820         (WebKit::WebView::startTrackingMouseLeave):
821         (WebKit::WebView::stopTrackingMouseLeave):
822         (WebKit::WebView::shouldInitializeTrackPointHack):
823         (WebKit::WebView::close):
824         (WebKit::WebView::cursorToShow const):
825         (WebKit::WebView::updateNativeCursor):
826         (WebKit::WebView::setOverrideCursor):
827         (WebKit::WebView::setIsInWindow):
828         (WebKit::WebView::setIsVisible):
829         (WebKit::WebView::isWindowActive):
830         (WebKit::WebView::isFocused):
831         (WebKit::WebView::isVisible):
832         (WebKit::WebView::isInWindow):
833         (WebKit::WebView::setScrollOffsetOnNextResize):
834         (WebKit::WebView::setViewNeedsDisplay):
835         (WebKit::WebView::createColorChooserProxy):
836         (WebKit::WebView::didCommitLoadForMainFrame):
837         (WebKit::WebView::customRepresentationZoomFactor):
838         (WebKit::WebView::setCustomRepresentationZoomFactor):
839         (WebKit::WebView::findStringInCustomRepresentation):
840         (WebKit::WebView::countStringMatchesInCustomRepresentation):
841         (WebKit::WebView::nativeWindow):
842         (WebKit::WebView::windowReceivedMessage):
843         * UIProcess/win/WebView.h: Added.
844         (WebKit::WebView::create):
845         (WebKit::WebView::window const):
846         (WebKit::WebView::page const):
847         (WebKit::WebView::drawingArea):
848         (WebKit::WebView::setWasActivatedByMouseEvent):
849
850 2018-04-24  Fujii Hironori  <Hironori.Fujii@sony.com>
851
852         Implement Same-Site cookies
853         https://bugs.webkit.org/show_bug.cgi?id=159464
854         <rdar://problem/27196358>
855
856         Unreviewed build fix.
857
858         WinCairo WebKit2 can't compile since r230921.
859
860         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
861         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
862         CookieJarCurlDatabase::cookieRequestHeaderFieldValue needs
863         SameSiteInfo.
864
865 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
866
867         Add a new "color-filter" CSS property as an experimental feature
868         https://bugs.webkit.org/show_bug.cgi?id=184940
869
870         Reviewed by Jon Lee.
871         
872         Add the color-filter property as an experimental feature.
873
874         * Shared/WebPreferences.yaml:
875
876 2018-04-24  Saam Barati  <sbarati@apple.com>
877
878         Keep around a pre-warmed process when doing process swap on navigation
879         https://bugs.webkit.org/show_bug.cgi?id=184765
880         <rdar://problem/39685099>
881
882         Reviewed by Ryosuke Niwa and Brady Eidson.
883
884         This patch makes it so that WebProcessPool prewarms a process when process
885         swap on navigation is turned on. When we do a process swap on navigation,
886         we first try to grab a prewarmed process before creating a new one.
887         
888         We try to be smart about when to create these processes. The initial heuristic
889         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
890         layout milestone. We're going to try to improve on this heuristic in:
891         https://bugs.webkit.org/show_bug.cgi?id=184899
892         
893         This is a 40% progression on PLT with process swap on navigation turned on.
894
895         * UIProcess/API/Cocoa/WKProcessPool.mm:
896         (-[WKProcessPool _prewarmedWebProcessCount]):
897         (-[WKProcessPool _webProcessCountIgnoringPrewarmed]):
898         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
899         * UIProcess/ServiceWorkerProcessProxy.cpp:
900         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
901         * UIProcess/WebPageProxy.cpp:
902         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
903         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
904         * UIProcess/WebPageProxy.h:
905         * UIProcess/WebProcessPool.cpp:
906         (WebKit::WebProcessPool::createNewWebProcess):
907         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
908         (WebKit::WebProcessPool::warmInitialProcess):
909         (WebKit::WebProcessPool::disconnectProcess):
910         (WebKit::WebProcessPool::createWebPage):
911         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
912         (WebKit::WebProcessPool::processForNavigation):
913         * UIProcess/WebProcessPool.h:
914         * UIProcess/WebProcessProxy.cpp:
915         (WebKit::WebProcessProxy::create):
916         (WebKit::WebProcessProxy::WebProcessProxy):
917         (WebKit::m_isInPrewarmedPool):
918         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
919         * UIProcess/WebProcessProxy.h:
920         (WebKit::WebProcessProxy::isInPrewarmedPool const):
921         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
922
923 2018-04-24  Commit Queue  <commit-queue@webkit.org>
924
925         Unreviewed, rolling out r230971.
926         https://bugs.webkit.org/show_bug.cgi?id=184939
927
928         This fix was not appropriate (Requested by n_wang on #webkit).
929
930         Reverted changeset:
931
932         "AX: soft link libAccessibility.dylb"
933         https://bugs.webkit.org/show_bug.cgi?id=184919
934         https://trac.webkit.org/changeset/230971
935
936 2018-04-24  Nan Wang  <n_wang@apple.com>
937
938         AX: soft link libAccessibility.dylb
939         https://bugs.webkit.org/show_bug.cgi?id=184919
940
941         Reviewed by Chris Fleizach.
942
943         Make sure we soft link the library so that it won't crash
944         if it's missing in the system.
945
946         * Configurations/WebKit.xcconfig:
947         * UIProcess/API/Cocoa/WKWebView.mm:
948         (-[WKWebView _initializeWithConfiguration:]):
949         (-[WKWebView _updateAccessibilityEventsEnabled]):
950
951 2018-04-24  John Wilander  <wilander@apple.com>
952
953         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
954         https://bugs.webkit.org/show_bug.cgi?id=184560
955         <rdar://problem/38901344>
956
957         Reviewed by Youenn Fablet and Daniel Bates.
958
959         This patch implements significant parts of https://github.com/whatwg/fetch/issues/687.
960         We consume the From-Origin response header and only load the resource if:
961         - The header is non-existent, empty, or invalid.
962         - The header specifies 'same' and the resource's origin matches the originating
963           document's origin and the origins up the frame tree.
964         - The header specifies 'same-site' and the resource's eTLD+1 matches the originating
965           document's eTLD+1 and the eTLD+1 of the documents up the frame tree.
966
967         This feature is experimental and off by default.
968
969         * NetworkProcess/NetworkResourceLoadParameters.cpp:
970         (WebKit::NetworkResourceLoadParameters::encode const):
971         (WebKit::NetworkResourceLoadParameters::decode):
972             Support for the two new load parameters:
973             - shouldEnableFromOriginResponseHeader
974             - frameAncestorOrigins
975         * NetworkProcess/NetworkResourceLoadParameters.h:
976         * NetworkProcess/NetworkResourceLoader.cpp:
977         (WebKit::areFrameAncestorsSameSite):
978         (WebKit::areFrameAncestorsSameOrigin):
979         (WebKit::shouldCancelCrossOriginLoad):
980             The three functions above implement the new blocking logic.
981         (WebKit::fromOriginResourceError):
982             Convenience function that returns an error with the From-Origin error message.
983         (WebKit::NetworkResourceLoader::didReceiveResponse):
984             Now checks for a From-Origin response header.
985         (WebKit::NetworkResourceLoader::didFailLoading):
986             Now checks for a From-Origin response header.
987         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
988             Now checks for a From-Origin response header.
989         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
990             Now checks for a From-Origin response header.
991         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
992             Now checks for a From-Origin response header.
993         * Shared/WebCoreArgumentCoders.cpp:
994         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::encode):
995         (IPC::ArgumentCoder<Vector<RefPtr<SecurityOrigin>>>::decode):
996             Now encodes and decodes vectors of RefPtr<WebCore::SecurityOrigin>.
997         * Shared/WebCoreArgumentCoders.h:
998         * Shared/WebPreferences.yaml:
999             Added From-Origin support as an experimental feature.
1000         * UIProcess/API/C/WKPreferences.cpp:
1001         (WKPreferencesSetFromOriginResponseHeaderEnabled):
1002         (WKPreferencesGetFromOriginResponseHeaderEnabled):
1003         * UIProcess/API/C/WKPreferencesRef.h:
1004         * WebProcess/Network/WebLoaderStrategy.cpp:
1005         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1006             Sets the two new load parameters:
1007             - shouldEnableFromOriginResponseHeader
1008             - frameAncestorOrigins
1009
1010 2018-04-24  Jer Noble  <jer.noble@apple.com>
1011
1012         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
1013         https://bugs.webkit.org/show_bug.cgi?id=184786
1014
1015         Reviewed by Tim Horton.
1016
1017         * Configurations/BaseTarget.xcconfig:
1018         * DerivedSources.make:
1019
1020 2018-04-24  Ryan Haddad  <ryanhaddad@apple.com>
1021
1022         Unreviewed, rolling out r230938.
1023
1024         Introduced two ProcessSwap API test failures.
1025
1026         Reverted changeset:
1027
1028         "Keep around a pre-warmed process when doing process swap on
1029         navigation"
1030         https://bugs.webkit.org/show_bug.cgi?id=184765
1031         https://trac.webkit.org/changeset/230938
1032
1033 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1034
1035         [CoordGraphics] Remove dead fixed layer code
1036         https://bugs.webkit.org/show_bug.cgi?id=184912
1037
1038         Reviewed by Michael Catanzaro.
1039
1040         Drop the unused fixed layer handling  code in CoordinatedGraphicsScene.
1041         The m_fixedLayers container can be removed, along with the
1042         adjustPositionForFixedLayers() method that operated on that container.
1043
1044         This was the only method that operated with the m_scrollPosition member
1045         variable and the contentsPosition argument that's passed to the
1046         CoordinatedGraphicsScene::paintToCurrentGLContext() method. Both of
1047         these are removed, along with the scrollPosition attribute on the
1048         CoordinatedGraphicsState struct.
1049
1050         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1051         (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
1052         (WebKit::CoordinatedGraphicsScene::setLayerState):
1053         (WebKit::CoordinatedGraphicsScene::deleteLayer):
1054         (WebKit::CoordinatedGraphicsScene::commitSceneState):
1055         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
1056         (WebKit::CoordinatedGraphicsScene::adjustPositionForFixedLayers): Deleted.
1057         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
1058         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
1059         (WebKit::ThreadedCompositor::renderLayerTree):
1060         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1061         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
1062
1063 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1064
1065         REGRESSION(r230950): Faulty commit sequencing in CoordinatedGraphicsScene
1066         https://bugs.webkit.org/show_bug.cgi?id=184917
1067
1068         Reviewed by Michael Catanzaro.
1069
1070         After r230950, current animation state for a given layer is also taken
1071         into account when determining whether or not the layer requires a
1072         backing store. For that to work properly, all the animation state has
1073         to be updated before the backing store work. This patch changes the
1074         order of helper method invocations in
1075         CoordinatedGraphicsScene::setLayerState() to address that.
1076
1077         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1078         (WebKit::CoordinatedGraphicsScene::setLayerState):
1079
1080 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1081
1082         [CoordGraphics] Remove unused fixed layout functionality
1083         https://bugs.webkit.org/show_bug.cgi?id=184908
1084
1085         Reviewed by Carlos Garcia Campos.
1086
1087         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
1088         support. As such, we're able to remove a lot of unused code and
1089         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
1090         in both WebCore and WebKit.
1091
1092         Remove USE(COORDINATED_GRAPHICS) special-casing from the
1093         WebPage::setUseFixedLayout() method. This is not possible to enable for
1094         the GTK+ and WPE ports that use the CoordinatedGraphics subsytem via
1095         API. Removing all this unlocks removing considerable amounts of dead
1096         code and complexities in CoordinatedGraphics.
1097
1098         WebChromeClient::delegatedScrollRequested() method is removed, along
1099         with the WebPage::pageDidRequestScroll() method that was only called
1100         from there.
1101
1102         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1103         (WebKit::WebChromeClient::delegatedScrollRequested): Deleted.
1104         * WebProcess/WebCoreSupport/WebChromeClient.h:
1105         * WebProcess/WebPage/WebPage.cpp:
1106         (WebKit::WebPage::setUseFixedLayout):
1107         (WebKit::WebPage::pageDidRequestScroll): Deleted.
1108         * WebProcess/WebPage/WebPage.h:
1109
1110 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
1111
1112         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
1113         https://bugs.webkit.org/show_bug.cgi?id=184143
1114
1115         Reviewed by Carlos Garcia Campos.
1116
1117         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1118         (WebKit::layerShouldHaveBackingStore):
1119         Mirror CoordinatedGraphicsLayer's backing store requirements.
1120
1121 2018-04-23  Daniel Bates  <dabates@apple.com>
1122
1123         Implement Same-Site cookies
1124         https://bugs.webkit.org/show_bug.cgi?id=159464
1125         <rdar://problem/27196358>
1126
1127         Reviewed by Brent Fulgham.
1128
1129         Pass the Same-Site info through the WebKit abstractions.
1130
1131         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1132         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1133         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1134         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1135         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1136         * NetworkProcess/NetworkConnectionToWebProcess.h:
1137         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1138         * NetworkProcess/NetworkResourceLoader.cpp:
1139         (WebKit::NetworkResourceLoader::logCookieInformation const):
1140         (WebKit::logBlockedCookieInformation):
1141         (logCookieInformationInternal):
1142         (NetworkResourceLoader::logCookieInformation):
1143         * NetworkProcess/NetworkResourceLoader.h:
1144         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1145         (WebKit::NetworkCache::constructRevalidationRequest):
1146         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
1147         (WebKit::NetworkCache::SubresourceInfo::encode const):
1148         (WebKit::NetworkCache::SubresourceInfo::decode):
1149         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
1150         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
1151         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
1152         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
1153         a top-level navigation.
1154         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1155         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
1156         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
1157         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1158         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1159         * UIProcess/WebProcessPool.cpp:
1160         (WebKit::WebProcessPool::download):
1161         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1162         (WebKit::WebPlatformStrategies::cookiesForDOM):
1163         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
1164         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1165         (WebKit::WebPlatformStrategies::getRawCookies):
1166         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1167
1168 2018-04-23  Youenn Fablet  <youenn@apple.com>
1169
1170         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
1171         https://bugs.webkit.org/show_bug.cgi?id=184763
1172
1173         Reviewed by Chris Dumez.
1174
1175         Set all required NetworkResourceLoadParameters for asynchronous loads.
1176         This includes preflight policy, CSP response headers, SecurityOrigin and content blockers identifier.
1177
1178         Update NetworkLoadChecker to handle preflight policy.
1179         This is not needed right now since sync XHR and ping loads are using the default ConsiderPreflight policy.
1180         But this will be needed for XHR/fetch/EventSource loads. 
1181
1182         * NetworkProcess/NetworkLoadChecker.cpp:
1183         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1184         (WebKit::NetworkLoadChecker::checkRedirection):
1185         (WebKit::NetworkLoadChecker::validateResponse):
1186         (WebKit::NetworkLoadChecker::checkCORSRequest):
1187         * NetworkProcess/NetworkLoadChecker.h:
1188         (WebKit::NetworkLoadChecker::create):
1189         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1190         (WebKit::NetworkResourceLoadParameters::encode const):
1191         (WebKit::NetworkResourceLoadParameters::decode):
1192         * NetworkProcess/NetworkResourceLoadParameters.h:
1193         * NetworkProcess/NetworkResourceLoader.cpp:
1194         * NetworkProcess/PingLoad.cpp:
1195         (WebKit::PingLoad::PingLoad):
1196         * WebProcess/Network/WebLoaderStrategy.cpp:
1197         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1198
1199 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1200
1201         [Extra zoom mode] REGRESSION(230860) Unable to change time input values using UI
1202         https://bugs.webkit.org/show_bug.cgi?id=184901
1203         <rdar://problem/39664797>
1204
1205         Reviewed by Tim Horton.
1206
1207         Fixes the bug by falling back to setting the value of the focused input element in the case where the selection
1208         is not editable. Also adds plumbing to make time pickers testable in extra zoom mode.
1209
1210         * UIProcess/API/Cocoa/WKWebView.mm:
1211         (-[WKWebView setTimePickerValueToHour:minute:]):
1212         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1213         * UIProcess/ios/WKContentViewInteraction.h:
1214         * UIProcess/ios/WKContentViewInteraction.mm:
1215         (-[WKContentView setTimePickerValueToHour:minute:]):
1216
1217         Add plumbing to make it possible for WebKitTestRunner to simulate picking a time from the given hours and
1218         minutes. This is currently only implemented for extra zoom mode, but may be implemented for UIKit's time picker
1219         as well in the future by adjusting -[WKContentView setTimePickerValueToHour:minute:].
1220
1221         * WebProcess/WebPage/WebPage.cpp:
1222         (WebKit::WebPage::setTextAsync):
1223
1224 2018-04-23  Saam Barati  <sbarati@apple.com>
1225
1226         Keep around a pre-warmed process when doing process swap on navigation
1227         https://bugs.webkit.org/show_bug.cgi?id=184765
1228
1229         Reviewed by Ryosuke Niwa.
1230
1231         This patch makes it so that WebProcessPool prewarms a process when process
1232         swap on navigation is turned on. When we do a process swap on navigation,
1233         we first try to grab a prewarmed process before creating a new one.
1234         
1235         We try to be smart about when to create these processes. The initial heuristic
1236         that this patch chooses is when we reach the DidFirstVisuallyNonEmptyLayout
1237         layout milestone. We're going to try to improve on this heuristic in:
1238         https://bugs.webkit.org/show_bug.cgi?id=184899
1239         
1240         This is a 40% progression on PLT with process swap on navigation turned on.
1241
1242         * UIProcess/ServiceWorkerProcessProxy.cpp:
1243         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
1244         * UIProcess/WebPageProxy.cpp:
1245         (WebKit::WebPageProxy::notifyProcessPoolToPrewarm):
1246         (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
1247         * UIProcess/WebPageProxy.h:
1248         * UIProcess/WebProcessPool.cpp:
1249         (WebKit::WebProcessPool::createNewWebProcess):
1250         (WebKit::WebProcessPool::tryTakePrewarmedProcess):
1251         (WebKit::WebProcessPool::warmInitialProcess):
1252         (WebKit::WebProcessPool::disconnectProcess):
1253         (WebKit::WebProcessPool::createWebPage):
1254         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
1255         (WebKit::WebProcessPool::processForNavigation):
1256         * UIProcess/WebProcessPool.h:
1257         * UIProcess/WebProcessProxy.cpp:
1258         (WebKit::WebProcessProxy::create):
1259         (WebKit::WebProcessProxy::WebProcessProxy):
1260         (WebKit::m_isInPrewarmedPool):
1261         (WebKit::m_userMediaCaptureManagerProxy): Deleted.
1262         * UIProcess/WebProcessProxy.h:
1263         (WebKit::WebProcessProxy::isInPrewarmedPool const):
1264         (WebKit::WebProcessProxy::setIsInPrewarmedPool):
1265
1266 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
1267
1268         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
1269         https://bugs.webkit.org/show_bug.cgi?id=184405
1270
1271         Reviewed by Carlos Garcia Campos.
1272
1273         Switch to std::unique_ptr.
1274
1275         * UIProcess/gtk/WaylandCompositor.cpp:
1276         (WebKit::WaylandCompositor::WaylandCompositor):
1277         * UIProcess/gtk/WaylandCompositor.h:
1278         (WebKit::WaylandCompositor::DisplayDeleter::operator()):
1279
1280 2018-04-23  Daniel Bates  <dabates@apple.com>
1281
1282         Attempt to fix the Apple Internal build following r230921
1283         (https://bugs.webkit.org/show_bug.cgi?id=159464)
1284
1285         Forward declare some SPI. Add availability guard.
1286
1287         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1288
1289 2018-04-23  Zalan Bujtas  <zalan@apple.com>
1290
1291         [LayoutFormattingContext] Initial commit.
1292         https://bugs.webkit.org/show_bug.cgi?id=184896
1293
1294         Reviewed by Antti Koivisto.
1295
1296         * Configurations/FeatureDefines.xcconfig:
1297
1298 2018-04-23  Daniel Bates  <dabates@apple.com>
1299
1300         Implement Same-Site cookies
1301         https://bugs.webkit.org/show_bug.cgi?id=159464
1302         <rdar://problem/27196358>
1303
1304         Reviewed by Brent Fulgham.
1305
1306         Pass the Same-Site info through the WebKit abstractions.
1307
1308         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1309         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
1310         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
1311         (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue):
1312         (WebKit::NetworkConnectionToWebProcess::getRawCookies):
1313         * NetworkProcess/NetworkConnectionToWebProcess.h:
1314         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1315         * NetworkProcess/NetworkResourceLoader.cpp:
1316         (WebKit::NetworkResourceLoader::logCookieInformation const):
1317         (WebKit::logBlockedCookieInformation):
1318         (logCookieInformationInternal):
1319         (NetworkResourceLoader::logCookieInformation):
1320         * NetworkProcess/NetworkResourceLoader.h:
1321         * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
1322         (WebKit::NetworkCache::constructRevalidationRequest):
1323         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
1324         (WebKit::NetworkCache::SubresourceInfo::encode const):
1325         (WebKit::NetworkCache::SubresourceInfo::decode):
1326         (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
1327         * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
1328         (WebKit::NetworkCache::SubresourceInfo::isSameSite const):
1329         (WebKit::NetworkCache::SubresourceInfo::isTopSite const): Returns false; subresources do not represent
1330         a top-level navigation.
1331         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1332         (WebKit::NetworkDataTaskCocoa::isThirdPartyRequest):
1333         (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
1334         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1335         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
1336         * UIProcess/WebProcessPool.cpp:
1337         (WebKit::WebProcessPool::download):
1338         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1339         (WebKit::WebPlatformStrategies::cookiesForDOM):
1340         (WebKit::WebPlatformStrategies::setCookiesFromDOM):
1341         (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
1342         (WebKit::WebPlatformStrategies::getRawCookies):
1343         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1344
1345 2018-04-23  Chris Dumez  <cdumez@apple.com>
1346
1347         WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
1348         https://bugs.webkit.org/show_bug.cgi?id=184889
1349         <rdar://problem/38151530>
1350
1351         Reviewed by Brady Eidson.
1352
1353         In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
1354         as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
1355         for the same assertion state, which would cause duplicate logging but also some unnecessary work.
1356
1357         * UIProcess/ProcessThrottler.cpp:
1358         (WebKit::ProcessThrottler::updateAssertionNow):
1359
1360 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
1361
1362         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
1363         https://bugs.webkit.org/show_bug.cgi?id=184881
1364
1365         Reviewed by Michael Catanzaro.
1366
1367         The CompositingCoordinator::setVisibleContentsRect() method is always
1368         called with a (0,0) FloatPoint value as the trajectory vector parameter,
1369         which is already the default value in TiledBackingStore where this ends
1370         up. Removing this call chain also enables removing some unnecessary and
1371         odd code in the CoordinatedGraphicsLayer class.
1372
1373         This doesn't yet touch the trajectory logic in the TiledBackingStore
1374         class since it's not yet a given this won't be used in the future. But
1375         if that will be necessary, hope is to not use it this way.
1376
1377         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1378         (WebKit::CompositingCoordinator::setVisibleContentsRect):
1379         (WebKit::CompositingCoordinator::mainContentsLayer): Deleted.
1380         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
1381         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1382         (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect):
1383         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
1384         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1385         (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewport):
1386
1387 2018-04-23  Fujii Hironori  <Hironori.Fujii@sony.com>
1388
1389         [Win][WK2] REGRESSION(r230834) 'getpid': identifier not found
1390         https://bugs.webkit.org/show_bug.cgi?id=184877
1391
1392         Reviewed by Yusuke Suzuki.
1393
1394         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1395         (WebKit::WebBackForwardListProxy::addItem): Use WTF::getCurrentProcessID() instead of getpid().
1396         * WebProcess/WebPage/WebPage.cpp:
1397         (WebKit::WebPage::goToBackForwardItem): Ditto.
1398
1399 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
1400
1401         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
1402         https://bugs.webkit.org/show_bug.cgi?id=184810
1403
1404         Reviewed by Carlos Garcia Campos.
1405
1406         CoordinatedBackingStore should inherit directly from RefCounted<> now
1407         that TextureMapperBackingStore doesn't anymore.
1408
1409         * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
1410         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
1411         (WebKit::CoordinatedGraphicsScene::createBackingStoreIfNeeded):
1412
1413 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
1414
1415         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
1416         https://bugs.webkit.org/show_bug.cgi?id=184811
1417
1418         Reviewed by Carlos Garcia Campos.
1419
1420         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1421         (WebKit::CompositingCoordinator::flushPendingLayerChanges): Stop setting
1422         the removed contentsSize and coveredRect attributes. These were only
1423         ever set to the appropriate values, but were then never used anywhere.
1424
1425 2018-04-22  Matt Baker  <mattbaker@apple.com>
1426
1427         Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
1428         https://bugs.webkit.org/show_bug.cgi?id=184865
1429         <rdar://problem/37764960>
1430
1431         Reviewed by Brian Burg.
1432
1433         Replace the early return removed in https://bugs.webkit.org/show_bug.cgi?id=177661,
1434         so that WKWebInspectorProxyObjCAdapter and the view controller can be reused
1435         when reopening the Inspector while the WebView is still alive.
1436
1437         * UIProcess/mac/WebInspectorProxyMac.mm:
1438         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1439
1440 2018-04-22  Paul Knight  <pknight@apple.com>
1441
1442         Add -[WKInputDelegate _webView:decidePolicyForFocusedElement:] so clients can request default focusing behavior
1443         https://bugs.webkit.org/show_bug.cgi?id=184844
1444
1445         Reviewed by Dan Bernstein.
1446
1447         If a client doesn't implement -[_WKInputDelegate _webView:focusShouldStartInputSession:] the default
1448         focus behavior only brings up the keyboard if it's already onscreen, the interaction is user driven,
1449         and other factors that even depend on what feature flags are enabled.
1450
1451         If a client implements _webView:focusShouldStartInputSession:, they don't have a good way to specifiy
1452         they'd like to fall back to the default behavior. This makes it difficult for a client to use the
1453         default in most cases, but sometimes allow programmatic focus from the page, for example.
1454
1455         Add a new delegate method -_webView:decidePolicyForFocusedElement: that returns a new enum type
1456         _WKFocusStartsInputSessionPolicy. Clients can return _WKFocusStartsInputSessionPolicyAuto to request
1457         the default behavior, or _WKFocusStartsInputSessionPolicyAllow / Disallow to directly control whether
1458         the keyboard appears to assist the focused node.
1459
1460         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1461         * UIProcess/ios/WKContentViewInteraction.mm:
1462         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1463
1464 2018-04-21  Jeremy Jones  <jeremyj@apple.com>
1465
1466         Disable backward and forward navigation swipes while in fullscreen.
1467         https://bugs.webkit.org/show_bug.cgi?id=184656
1468         rdar://problem/36057535
1469
1470         Reviewed by Tim Horton.
1471
1472         Disable navigation swipes while in fullscreen.
1473
1474         * UIProcess/Cocoa/ViewGestureController.cpp:
1475         (WebKit::ViewGestureController::canSwipeInDirection const):
1476
1477 2018-04-21  Youenn Fablet  <youenn@apple.com>
1478
1479         Activate NetworkLoadChecker for media loads
1480         https://bugs.webkit.org/show_bug.cgi?id=184841
1481
1482         Reviewed by Eric Carlson.
1483
1484         Instantiate a NetworkLoadChecker for NetworkResourceLoader for audio/video loads.
1485
1486         Move CORS checks for response after handling of 304 checks.
1487         For 304 checks, we need to do the CORS checks on the validated cached response, not the 304 received response.
1488
1489         Updated ResourceError argument coder to explicitly pass the error type
1490         as some errors created by NetworkLoadChecker would otherwise be received as General errors by WebProcess.
1491         Updated platform data encoding of ResourceError accordingly.
1492
1493         All changes are covered by regular media loading layout tests.
1494
1495         * NetworkProcess/NetworkResourceLoader.cpp:
1496         (WebKit::shouldUseNetworkLoadChecker):
1497         (WebKit::NetworkResourceLoader::didReceiveResponse):
1498         * Shared/WebCoreArgumentCoders.cpp:
1499         (IPC::ArgumentCoder<ResourceError>::encode):
1500         (IPC::ArgumentCoder<ResourceError>::decode):
1501         * Shared/mac/WebCoreArgumentCodersMac.mm:
1502         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
1503         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
1504         We need to set the type after decoding the NSError as ResourceError tries to guess the type from NSError data.
1505         * Shared/soup/WebCoreArgumentCodersSoup.cpp:
1506         (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
1507         (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
1508
1509 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1510
1511         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
1512         https://bugs.webkit.org/show_bug.cgi?id=184480
1513
1514         Reviewed by Michael Catanzaro.
1515
1516         Connect to GTlsConnection::accept-certificate signal instead of SoupMessage::notify::tls-errors to perform the
1517         TLS errors check.
1518
1519         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1520         (WebKit::NetworkDataTaskSoup::createRequest): Do not connect to SoupMessage::notify::tls-errors.
1521         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback): Call tlsConnectionAcceptCertificate() is
1522         the task is still ongoing.
1523         (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate): Check TLS errors here.
1524         (WebKit::NetworkDataTaskSoup::networkEventCallback): Pass the stream to networkEvent.
1525         (WebKit::NetworkDataTaskSoup::networkEvent): Connect to GTlsConnection::accept-certificate.
1526         * NetworkProcess/soup/NetworkDataTaskSoup.h:
1527
1528 2018-04-20  Timothy Hatcher  <timothy@apple.com>
1529
1530         NULL dereference crash sometimes under [super initWithCoder:] in WebView
1531
1532         https://bugs.webkit.org/show_bug.cgi?id=184851
1533         rdar://problem/39611236
1534
1535         Reviewed by Tim Horton.
1536
1537         * UIProcess/API/Cocoa/WKWebView.mm:
1538         (-[WKWebView _initializeWithConfiguration:]):
1539         (-[WKWebView effectiveAppearanceDidChange]):
1540         Added a null check and call the code later in initialization.
1541
1542 2018-04-20  Tim Horton  <timothy_horton@apple.com>
1543
1544         Adjust geolocation feature flag
1545         https://bugs.webkit.org/show_bug.cgi?id=184856
1546
1547         Reviewed by Wenson Hsieh.
1548
1549         * Configurations/FeatureDefines.xcconfig:
1550
1551 2018-04-20  Chris Dumez  <cdumez@apple.com>
1552
1553         Unreviewed attempt to fix GTK build after r230867.
1554
1555         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
1556         (webkit_dom_dom_window_get_self):
1557         (webkit_dom_dom_window_get_window):
1558         (webkit_dom_dom_window_get_frames):
1559         (webkit_dom_dom_window_get_opener):
1560         (webkit_dom_dom_window_get_parent):
1561         (webkit_dom_dom_window_get_top):
1562
1563 2018-04-20  Commit Queue  <commit-queue@webkit.org>
1564
1565         Unreviewed, rolling out r230873.
1566         https://bugs.webkit.org/show_bug.cgi?id=184857
1567
1568         Broke the iOS build (Requested by cdumez on #webkit).
1569
1570         Reverted changeset:
1571
1572         "Disable backward and forward navigation swipes while in
1573         fullscreen."
1574         https://bugs.webkit.org/show_bug.cgi?id=184656
1575         https://trac.webkit.org/changeset/230873
1576
1577 2018-04-20  Chris Dumez  <cdumez@apple.com>
1578
1579         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
1580         https://bugs.webkit.org/show_bug.cgi?id=184210
1581         <rdar://problem/39072354>
1582
1583         Reviewed by Wenson Hsieh.
1584
1585         r229828 tried to have some API tests happy on iOS by freezing the layer tree
1586         during the navigation policy decision. However, this is observable by the client
1587         application and a regression from when the policy delegate was synchronous.
1588
1589         To address the issue, this patch reverts r229828 and instead updates the iOS
1590         API tests to wait for the next presentation update after navigating
1591         before interacting with the view.
1592
1593         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1594         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1595         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1596         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
1597         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
1598         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1599         * WebProcess/WebPage/WebPage.cpp:
1600         * WebProcess/WebPage/WebPage.h:
1601
1602 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
1603
1604         Limit cookie header access to Network process
1605         https://bugs.webkit.org/show_bug.cgi?id=184764
1606         <rdar://problem/36785285>
1607
1608         Reviewed by Youenn Fablet.
1609
1610         Revise the handling of cookie request headers so that we don't interact with them in the
1611         WebContent process. They are only needed for interaction with the server and the network
1612         process, so we should limit their scope to just the Network process.
1613
1614         Instead, we should handle a token that represents the cookie headers in the WebContent
1615         process, which can be converted to the relevant cookie data in the network process when
1616         needed.
1617
1618         * NetworkProcess/NetworkSocketStream.cpp:
1619         (WebKit::NetworkSocketStream::sendHandshake):
1620         * NetworkProcess/NetworkSocketStream.h:
1621         * NetworkProcess/NetworkSocketStream.messages.in:
1622         * WebProcess/Network/WebSocketStream.cpp:
1623         (WebKit::WebSocketStream::networkProcessCrashed):
1624         (WebKit::WebSocketStream::platformSendHandshake):
1625         (WebKit::WebSocketStream::didSendHandshake):
1626         * WebProcess/Network/WebSocketStream.h:
1627         * WebProcess/Network/WebSocketStream.messages.in:
1628
1629 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
1630
1631         Disable backward and forward navigation swipes while in fullscreen.
1632         https://bugs.webkit.org/show_bug.cgi?id=184656
1633         rdar://problem/36057535
1634
1635         Reviewed by Tim Horton.
1636
1637         Disable navigation swipes while in fullscreen.
1638
1639         * UIProcess/Cocoa/ViewGestureController.cpp:
1640         (WebKit::ViewGestureController::canSwipeInDirection const):
1641
1642 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
1643
1644         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
1645         https://bugs.webkit.org/show_bug.cgi?id=184826
1646         rdar://problem/39600825
1647
1648         Reviewed by Tim Horton.
1649
1650         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
1651
1652         * UIProcess/API/Cocoa/WKWebView.mm:
1653         (-[WKWebView _fullScreenPlaceholderView]):
1654         (-[WKWebView closeFullScreenWindowController]):
1655         (-[WKWebView fullScreenPlaceholderView]): Deleted.
1656         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1657         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1658         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
1659         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1660         (-[WKFullScreenWindowController webViewPlaceholder]):
1661
1662 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1663
1664         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
1665         https://bugs.webkit.org/show_bug.cgi?id=184822
1666         <rdar://problem/38807319>
1667
1668         Reviewed by Tim Horton.
1669
1670         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
1671         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
1672         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
1673
1674         * UIProcess/API/Cocoa/WKWebView.mm:
1675         (-[WKWebView _simulateTextEntered:]):
1676         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1677
1678         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
1679         SPI added in 2017 to help test drag and drop for iOS 11.
1680
1681         * UIProcess/ios/WKContentViewInteraction.h:
1682         * UIProcess/ios/WKContentViewInteraction.mm:
1683         (-[WKContentView _simulateTextEntered:]):
1684         * WebProcess/WebPage/WebPage.cpp:
1685         (WebKit::WebPage::setTextAsync):
1686
1687 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
1688
1689         EnterFullscreen must update the minimum and maximum layout sizes.
1690         https://bugs.webkit.org/show_bug.cgi?id=184828
1691         rdar://problem/38435829
1692
1693         Reviewed by Jon Lee.
1694
1695         Without this, the WKWebView won't layout to the full size in fullscreen mode.
1696
1697         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
1698         (-[WKFullScreenWindowController enterFullScreen]):
1699
1700 2018-04-18  Jer Noble  <jer.noble@apple.com>
1701
1702         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
1703         https://bugs.webkit.org/show_bug.cgi?id=184762
1704
1705         Reviewed by Dan Bernstein.
1706
1707         * Configurations/BaseTarget.xcconfig:
1708
1709 2018-04-20  Youenn Fablet  <youenn@apple.com>
1710
1711         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
1712         https://bugs.webkit.org/show_bug.cgi?id=184755
1713
1714         Reviewed by Chris Dumez.
1715
1716         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
1717         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
1718
1719         Since we call didFail asynchronously to make sync/async handling more consistent,
1720         We need to keep track of whether we will do clean-up twice.
1721         A boolean is added for that purpose in NetworkResourceLoader.
1722
1723         There is a small change of behavior in the way we return an error.
1724         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
1725         This allows getting some more error logging in the JS console.
1726
1727         * NetworkProcess/NetworkResourceLoader.cpp:
1728         (WebKit::NetworkResourceLoader::didReceiveResponse):
1729         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1730         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
1731         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1732         * NetworkProcess/NetworkResourceLoader.h:
1733
1734 2018-04-20  Timothy Hatcher  <timothy@apple.com>
1735
1736         Include missing files in WKContentViewInteraction.{mm,h}
1737
1738         https://bugs.webkit.org/show_bug.cgi?id=184832
1739         rdar://problem/35377120
1740
1741         Reviewed by Wenson Hsieh.
1742
1743         Some WebDriver files were missing and should be included.
1744
1745         * UIProcess/ios/WKContentViewInteraction.h:
1746         * UIProcess/ios/WKContentViewInteraction.mm:
1747         (-[WKContentView setupInteraction]):
1748         (-[WKContentView cleanupInteraction]):
1749         (-[WKContentView _removeDefaultGestureRecognizers]):
1750         (-[WKContentView _addDefaultGestureRecognizers]):
1751
1752 2018-04-20  Youenn Fablet  <youenn@apple.com>
1753
1754         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
1755         https://bugs.webkit.org/show_bug.cgi?id=184369
1756
1757         Reviewed by Chris Dumez.
1758
1759         Use API to check for plugin availability for response at navigation time.
1760
1761         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1762         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1763         * WebProcess/WebPage/WebPage.cpp:
1764         (WebKit::WebPage::canShowResponse const):
1765         (WebKit::WebPage::canShowMIMEType const):
1766         * WebProcess/WebPage/WebPage.h:
1767
1768 2018-04-20  Daniel Bates  <dabates@apple.com>
1769
1770         Remove Strong Password decoration when text field type changes
1771         https://bugs.webkit.org/show_bug.cgi?id=184795
1772         <rdar://problem/38325108>
1773
1774         Reviewed by Antti Koivisto.
1775
1776         Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
1777         Strong Password appearance of an HTML input element is resigned.
1778
1779         We add C SPI for Safari on Mac.
1780
1781         * UIProcess/API/APIUIClient.h:
1782         (API::UIClient::didResignInputElementStrongPasswordAppearance):
1783         * UIProcess/API/C/WKPage.cpp:
1784         (WKPageSetPageUIClient):
1785         * UIProcess/API/C/WKPageUIClient.h:
1786         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1787         * UIProcess/Cocoa/UIDelegate.h:
1788         * UIProcess/Cocoa/UIDelegate.mm:
1789         (WebKit::UIDelegate::setDelegate):
1790         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
1791         * UIProcess/WebPageProxy.cpp:
1792         (WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
1793         * UIProcess/WebPageProxy.h:
1794         * UIProcess/WebPageProxy.messages.in:
1795         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
1796         (API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
1797         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
1798         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1799         (WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
1800         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
1801         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1802         (WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
1803         * WebProcess/WebCoreSupport/WebChromeClient.h:
1804
1805 2018-04-20  Megan Gardner  <megan_gardner@apple.com>
1806
1807         Fixes for failing tests associated with switching Text Selection Assistants
1808         https://bugs.webkit.org/show_bug.cgi?id=184806
1809         <rdar://problem/39367905>
1810
1811         Reviewed by Beth Dakin and Wenson Hsieh.
1812         
1813         The major fix is the disabling the double tap noneditable text selection gesture.
1814         The other fixes are small tweaks that shouldn't even be run into with the fix to 
1815         the double tap gesture, but they are incorrect, so I am taking the opportunity to 
1816         fix them now, in case we run into them again.
1817
1818         * UIProcess/ios/WKContentViewInteraction.mm:
1819         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1820         We should not be allowing a double tap text gestures in non-editable web content.
1821         We didn't have one with the old assistant. Fortunately, this is easily disabled.
1822         (-[WKContentView canPerformActionForWebView:withSender:]):
1823         We should not allow the lookup action if we do not actually have a selection.
1824         It is meaningless without one.
1825         (-[WKContentView selectedTextRange]):
1826         We should not return a selection to UIKit if all we have is caret selection
1827         in non-editable content. We have this for selections on Mac, but UIKit does
1828         not know how to properly handle this, and will have incorrect behavior if we 
1829         return a valid selection.
1830
1831 2018-04-20  Timothy Hatcher  <timothy@apple.com>
1832
1833         WebEvent fails to convert synthetic WebMouseEvent for automation
1834
1835         https://bugs.webkit.org/show_bug.cgi?id=184824
1836         rdar://problem/35377120
1837
1838         Reviewed by Brian Burg.
1839
1840         Add WebEvent conversions that existed in PlatformEventFactoryIOS for legacy WebKit,
1841         but never got added in WebIOSEventFactory and NativeWebMouseEvent for modern WebKit.
1842         This affected WebDriver, and some events not being deliverd to the page.
1843
1844         * Shared/NativeWebMouseEvent.h:
1845         (WebKit::NativeWebMouseEvent::nativeEvent const):
1846         * Shared/ios/NativeWebMouseEventIOS.mm: Added.
1847         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
1848         * Shared/ios/WebIOSEventFactory.h:
1849         * Shared/ios/WebIOSEventFactory.mm:
1850         (WebIOSEventFactory::createWebMouseEvent):
1851         * WebKit.xcodeproj/project.pbxproj:
1852
1853 2018-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
1854
1855         Unreviewed, fix -Wformat warning
1856
1857         * UIProcess/WebPageProxy.cpp:
1858         (WebKit::WebPageProxy::didFinishLoadForFrame):
1859
1860 2018-04-20  Youenn Fablet  <youenn@apple.com>
1861
1862         Make PluginData cache its web visible plugins
1863         https://bugs.webkit.org/show_bug.cgi?id=184421
1864
1865         Reviewed by Chris Dumez.
1866
1867         Rename methods.
1868         Pass an URL instead of relying on Page URL as the page URL
1869         might not always be the URL we want to check against plugins.
1870         In particular when navigation is on-going, we want to check the
1871         plugins against the being navigated URL.
1872
1873         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1874         (WebKit::WebPluginInfoProvider::pluginInfo):
1875         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
1876         * WebProcess/Plugins/WebPluginInfoProvider.h:
1877
1878 2018-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1879
1880         Unreviewed. Fix GTK+ build after r230830.
1881
1882         Add SimulatedInputDispatcher.cpp to the build.
1883
1884         * CMakeLists.txt:
1885
1886 2018-04-19  Brady Eidson  <beidson@apple.com>
1887
1888         Make back forward cache work with process swapping.
1889         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
1890
1891         Reviewed by Chris Dumez.
1892
1893         We previously saved old processes in "SuspendedPageProxy" objects.
1894         Now we reuse them when going back or forward.
1895
1896         * Platform/Logging.h:
1897
1898         * Shared/WebBackForwardListItem.cpp:
1899         (WebKit::WebBackForwardListItem::setSuspendedPage):
1900         (WebKit::WebBackForwardListItem::loggingString):
1901         * Shared/WebBackForwardListItem.h:
1902         (WebKit::WebBackForwardListItem::suspendedPage const):
1903
1904         Teach Navigation objects their source WebBackForwardListItems:
1905         * UIProcess/API/APINavigation.cpp:
1906         (API::Navigation::Navigation):
1907         (API::Navigation::loggingString const):
1908         * UIProcess/API/APINavigation.h:
1909         (API::Navigation::create):
1910         (API::Navigation::targetItem const):
1911         (API::Navigation::fromItem const):
1912         (API::Navigation::backForwardListItem): Deleted.
1913
1914         * UIProcess/Cocoa/NavigationState.mm:
1915         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
1916
1917         * UIProcess/SuspendedPageProxy.cpp:
1918         (WebKit::messageNamesToIgnoreWhileSuspended):
1919         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1920         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1921         (WebKit::SuspendedPageProxy::webProcessDidClose):
1922         (WebKit::SuspendedPageProxy::didReceiveMessage):
1923         (WebKit::SuspendedPageProxy::loggingString const):
1924         * UIProcess/SuspendedPageProxy.h:
1925         (WebKit::SuspendedPageProxy::origin const):
1926
1927         * UIProcess/WebBackForwardList.cpp:
1928         (WebKit::WebBackForwardList::WebBackForwardList):
1929         (WebKit::WebBackForwardList::~WebBackForwardList):
1930         (WebKit::WebBackForwardList::pageClosed):
1931         (WebKit::WebBackForwardList::addItem):
1932         (WebKit::WebBackForwardList::goToItem):
1933         (WebKit::WebBackForwardList::removeAllItems):
1934         (WebKit::WebBackForwardList::clear):
1935         (WebKit::WebBackForwardList::restoreFromState):
1936         (WebKit::WebBackForwardList::filteredItemStates const):
1937         (WebKit::WebBackForwardList::itemStates const):
1938         (WebKit::WebBackForwardList::loggingString):
1939         * UIProcess/WebBackForwardList.h:
1940
1941         * UIProcess/WebNavigationState.cpp:
1942         (WebKit::WebNavigationState::createLoadRequestNavigation):
1943         (WebKit::WebNavigationState::createBackForwardNavigation):
1944         * UIProcess/WebNavigationState.h:
1945
1946         * UIProcess/WebPageProxy.cpp:
1947         (WebKit::WebPageProxy::reattachToWebProcess):
1948         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
1949         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1950         (WebKit::WebPageProxy::loadRequest):
1951         (WebKit::WebPageProxy::loadFile):
1952         (WebKit::WebPageProxy::goToBackForwardItem):
1953         (WebKit::WebPageProxy::receivedPolicyDecision):
1954         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1955         (WebKit::WebPageProxy::didCreateMainFrame):
1956         (WebKit::WebPageProxy::didCreateSubframe):
1957         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1958         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1959         (WebKit::WebPageProxy::didCommitLoadForFrame):
1960         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1961         (WebKit::WebPageProxy::connectionWillOpen):
1962         (WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
1963         * UIProcess/WebPageProxy.h:
1964
1965         * UIProcess/WebProcessLifetimeTracker.cpp:
1966         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
1967         (WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
1968         * UIProcess/WebProcessLifetimeTracker.h:
1969
1970         * UIProcess/WebProcessPool.cpp:
1971         (WebKit::WebProcessPool::processForNavigation):
1972         (WebKit::WebProcessPool::registerSuspendedPageProxy):
1973         (WebKit::WebProcessPool::unregisterSuspendedPageProxy):
1974         * UIProcess/WebProcessPool.h:
1975
1976         * UIProcess/WebProcessProxy.cpp:
1977         (WebKit::WebProcessProxy::suspendWebPageProxy):
1978         (WebKit::WebProcessProxy::updateBackForwardItem):
1979         (WebKit::WebProcessProxy::frameCreated):
1980         * UIProcess/WebProcessProxy.h:
1981
1982         * WebProcess/WebPage/DrawingArea.h:
1983         (WebKit::DrawingArea::attachDrawingArea):
1984
1985         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1986         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
1987         (WebKit::WebBackForwardListProxy::addItem):
1988         * WebProcess/WebPage/WebBackForwardListProxy.h:
1989
1990         * WebProcess/WebPage/WebPage.cpp:
1991         (WebKit::m_credentialsMessenger):
1992         (WebKit::WebPage::reinitializeWebPage):
1993         (WebKit::WebPage::goToBackForwardItem):
1994         (WebKit::WebPage::restoreSessionInternal):
1995         (WebKit::WebPage::restoreSession):
1996         (WebKit::WebPage::updateBackForwardListForReattach):
1997         * WebProcess/WebPage/WebPage.h:
1998         * WebProcess/WebPage/WebPage.messages.in:
1999
2000         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2001         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2002         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
2003         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
2004           area from a resumed WebProcess to the UIProcess (to make the page cache work)
2005
2006 2018-04-19  Brian Burg  <bburg@apple.com>
2007
2008         Web Automation: add support for mouse/keyboard interaction sequences
2009         https://bugs.webkit.org/show_bug.cgi?id=184603
2010         <rdar://problem/39421839>
2011
2012         Reviewed by Timothy Hatcher.
2013
2014         Add new protocol methods and WebKit support for implementing the W3C Actions API.
2015         This is a generic command for sending low-level mouse, key, and touch events to
2016         test page behavior when performing drag-and-drop, gestures, or specific keydown/keyups.
2017
2018         To implement this functionality, this patch adds SimulatedInputDispatcher, a class
2019         for dispatching input events asynchronously. Similar to the WebDriver specification,
2020         this is designed as a keyframing API. Callers set up several "input sources" such
2021         as keyboard or mouse, and then specify the states of that input source over time. The
2022         dispatcher calculates diffs between the previous and current keyframes and generates
2023         the appropriate events that would happen if a user caused the state transition.
2024
2025         For example, if a mouse input source's state changes, the dispatcher sends synthetic mousemove,
2026         mousedown, or mouseup events depending on the pre- and post-state. This is uninteresting
2027         and overcomplicated for simple key and mouse presses, but it's really designed with an
2028         eye towards supporting mousemove interpolation and touch event interpolation in later patches.
2029
2030         The strategy for dispatching events depends on the input source type; right now, these
2031         map directly to the existing platformSimulate{Mouse, Keyboard}Interaction methods. In
2032         the future, the dispatch strategy may be elaborated for interpolated mousemove events.
2033
2034         This patch depends on support added in bug 184462.
2035
2036         No tests yet. When this command is hooked up to a driver, the code will be exercised by
2037         W3C actions test suite, which is fairly complex at this point relative to end-user code.
2038
2039         * UIProcess/Automation/Automation.json: Add new types and commands.
2040
2041         * UIProcess/Automation/SimulatedInputDispatcher.h: Added.
2042         (WebKit::SimulatedInputSourceState::emptyState):
2043         (WebKit::SimulatedInputSource::create):
2044         (WebKit::SimulatedInputSource::SimulatedInputSource):
2045         (WebKit::SimulatedInputDispatcher::Client::~Client):
2046         Add structs for input source, source state, and keyframe.
2047         The dispatcher's client interface is implemented by WebAutomationSession.
2048
2049         (WebKit::SimulatedInputDispatcher::create):
2050         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Added.
2051         (WebKit::SimulatedInputKeyFrame::SimulatedInputKeyFrame):
2052         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
2053         (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources):
2054         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
2055         (WebKit::SimulatedInputDispatcher::SimulatedInputDispatcher):
2056         (WebKit::SimulatedInputDispatcher::~SimulatedInputDispatcher):
2057         (WebKit::SimulatedInputDispatcher::isActive const):
2058         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
2059         (WebKit::SimulatedInputDispatcher::isKeyFrameTransitionComplete const):
2060         (WebKit::SimulatedInputDispatcher::transitionToNextKeyFrame):
2061         (WebKit::SimulatedInputDispatcher::transitionToNextInputSourceState):
2062         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
2063         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
2064         (WebKit::SimulatedInputDispatcher::run):
2065         (WebKit::SimulatedInputDispatcher::cancel):
2066         (WebKit::SimulatedInputDispatcher::finishDispatching):
2067         The dispatcher handles one interaction at a time. The interaction is described
2068         by an array of keyframes, and each keyframe has an array of states. The dispatcher
2069         transitions between keyframes by sequentially and asynchronously emitting events
2070         that cause each input source state to transition as desired. Keyframe transitions
2071         are additionally gated by a "maximum duration" timer. Each step that the dispatcher
2072         executes is asynchronous, so the dispatcher keeps most state in members and uses
2073         error argument lambdas as completion handlers for various async things.
2074
2075         * UIProcess/Automation/WebAutomationSession.h:
2076         * UIProcess/Automation/WebAutomationSession.cpp:
2077         (WebKit::WebAutomationSession::WebAutomationSession):
2078         (WebKit::WebAutomationSession::inputDispatcherForPage):
2079         (WebKit::WebAutomationSession::inputSourceForType const):
2080         Add canonical input sources that are used to keep track of state across
2081         interaction sequences.
2082
2083         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
2084         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
2085         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2086         Remove m_simulatingUserInteraction since it can be computed based on other members.
2087
2088         (WebKit::WebAutomationSession::willClosePage):
2089         If the page is being torn down, stop the dispatcher if needed and cancel any
2090         callbacks waiting for mouse/key events to be retired.
2091
2092         (WebKit::WebAutomationSession::simulateMouseInteraction):
2093         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
2094         Add easy-to-use async methods for simulating mouse and key events. These are
2095         hooked up to SimulatedInputDispatcher using async completion handlers.
2096
2097         (WebKit::protocolMouseButtonToWebMouseEventButton):
2098         (WebKit::WebAutomationSession::performMouseInteraction):
2099         (WebKit::WebAutomationSession::performKeyboardInteractions):
2100         Adjust some naming.
2101
2102         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
2103         (WebKit::WebAutomationSession::performInteractionSequence):
2104         (WebKit::WebAutomationSession::cancelInteractionSequence):
2105         Add command handlers for the new action commands in Automation protocol.
2106
2107         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
2108         (WebKit::mouseButtonToGdkButton):
2109         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
2110         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2111         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
2112         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
2113         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2114         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
2115         Rename the keyboard platform method to match the naming of the mouse platform method.
2116         Take advantage of the 'using' alias to make the tedious switches easier to read.
2117
2118         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
2119         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
2120         (WebKit::virtualKeyHasStickyModifier):
2121         (WebKit::keyCodeForVirtualKey):
2122         (WebKit::eventModifierFlagsForVirtualKey):
2123         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
2124         (WebKit::WebAutomationSession::platformSimulateKeySequence):
2125         (WebKit::keyHasStickyModifier): Deleted.
2126         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
2127         Allow the keyboard simulation method to take a virtual key and unichar to better
2128         match how this is used by the Perform Actions command and its machinery.
2129
2130         * WebKit.xcodeproj/project.pbxproj:
2131
2132 2018-04-19  Jiewen Tan  <jiewen_tan@apple.com>
2133
2134         Remove access to keychain from the WebContent process
2135         https://bugs.webkit.org/show_bug.cgi?id=184428
2136         <rdar://problem/13150903>
2137
2138         Reviewed by Brent Fulgham.
2139
2140         Part 1.
2141
2142         Remove com.apple.identities from WebContent-iOS.entitlements, which is needed to encode/decode NSError’s userInfo[NSErrorClientCertificateChainKey]
2143         when the corresponding NSErorr is relayed through WebContent Process from Networking Process to UI Process after a HTTPS client certificate
2144         authentication is rejected becuase of bad certificates. This patch implements corresponding workarounds as well. The workaround works for mac, too.
2145
2146         Sadly, this change can only be tested manually at this moment. Please refer to the radar for testing steps.
2147
2148         * Configurations/WebContent-iOS.entitlements:
2149         * Shared/mac/WebCoreArgumentCodersMac.mm:
2150         (IPC::encodeNSError):
2151         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2152         (WebKit::WebProcessPool::platformInitialize):
2153
2154 2018-04-19  David Kilzer  <ddkilzer@apple.com>
2155
2156         Enable Objective-C weak references
2157         <https://webkit.org/b/184789>
2158         <rdar://problem/39571716>
2159
2160         Reviewed by Dan Bernstein.
2161
2162         * Configurations/Base.xcconfig:
2163         (CLANG_ENABLE_OBJC_WEAK): Enable.
2164
2165 2018-04-19  Youenn Fablet  <youenn@apple.com>
2166
2167         Web Inspector backend should get headers & cookies from network process separately from resource requests
2168         https://bugs.webkit.org/show_bug.cgi?id=184396
2169         <rdar://problem/38877384>
2170
2171         Reviewed by Brian Burg.
2172
2173         Add support for storing response and network metrics for every resource load.
2174         This is made conditional on inspector being activated.
2175         NetworkConnectionToWebProcess keeps a response and network metrics for every load.
2176         This is cleared when inspector is going away or when a web process requests
2177         the data.
2178
2179         WebLoaderStrategy gets this data through synchronous IPC.
2180         Synchronous IPC is a temporary implementation until Inspector code gets refactored.
2181
2182         Updated WebLoaderStrategy to pass the sourceOrigin for every NetworkResourceLoader.
2183         This activates additional sanitization based on cross origin status.
2184
2185         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2186         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
2187         * NetworkProcess/NetworkConnectionToWebProcess.h:
2188         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationResponse):
2189         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
2190         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationResponse):
2191         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
2192         (WebKit::NetworkConnectionToWebProcess::removeNetworkLoadInformation):
2193         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2194         * NetworkProcess/NetworkResourceLoader.cpp:
2195         (WebKit::NetworkResourceLoader::didReceiveResponse):
2196         (WebKit::NetworkResourceLoader::didFinishLoading):
2197         (WebKit::NetworkResourceLoader::didFailLoading):
2198         * WebProcess/Network/WebLoaderStrategy.cpp:
2199         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
2200         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
2201         * WebProcess/Network/WebLoaderStrategy.h:
2202         * WebProcess/Network/WebResourceLoader.cpp:
2203         (WebKit::WebResourceLoader::didReceiveResponse):
2204
2205 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
2206
2207         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
2208         https://bugs.webkit.org/show_bug.cgi?id=184782
2209         <rdar://problem/38346712>
2210
2211         Reviewed by Tim Horton.
2212
2213         In extra zoom mode, at initial scale, fixed position elements may take up a large portion of the viewport. This
2214         leaves little room for non-fixed-position elements; to improve this experience, we introduce a mechanism to
2215         extend the height of the layout viewport. By default, the layout viewport size is determined by the FrameView's
2216         baseLayoutViewportSize, and passed into FrameView::computeUpdatedLayoutViewportRect in the client layer; in
2217         extra zoom mode, if the layout viewport is shorter than the document width, we try to double the height of the
2218         layout viewport and clamp to the document height if necessary.
2219
2220         * Shared/WebPreferences.yaml:
2221
2222         Add a new preference to determine the factor by which we should expand the height of the layout viewport. By
2223         default, this is 0 (no increase in layout viewport height); in extra zoom mode, this is 1, which means we'll
2224         increase the layout viewport's height by 1x the default height.
2225
2226         * Shared/WebPreferencesDefaultValues.h:
2227         * UIProcess/API/Cocoa/WKWebView.mm:
2228         (-[WKWebView activeMinimumLayoutSizes:]):
2229
2230         Fixes a bug when computing the active minimum layout size. If a minimum allowed layout width is specified, we
2231         clamp the active layout width (normally the view size) so that it is no less than the minimum allowed layout
2232         width. However, the height is currently unaffected, which causes FrameView::baseLayoutViewportSize to return a
2233         bogus size, where the width is scaled to 320px but the height isn't. Instead, we should scale the layout height
2234         to match the new width here.
2235
2236         * UIProcess/ios/WebPageProxyIOS.mm:
2237         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
2238
2239         Expand the base viewport layout size if necessary, given the expansion factor in WebPreferences.
2240
2241         * WebProcess/WebPage/WebPage.cpp:
2242         (WebKit::WebPage::updatePreferences):
2243         * WebProcess/WebPage/ios/WebPageIOS.mm:
2244         (WebKit::WebPage::dynamicViewportSizeUpdate):
2245
2246         Expand the base viewport layout size if necessary, given the expansion factor in Settings.
2247
2248 2018-04-19  Brian Burg  <bburg@apple.com>
2249
2250         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
2251         https://bugs.webkit.org/show_bug.cgi?id=184462
2252         <rdar://problem/39323336>
2253
2254         Reviewed by Carlos Garcia Campos and Tim Horton.
2255
2256         Covered by existing layout tests and actions endpoints in WebDriver test suite.
2257
2258         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
2259         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
2260         to dispatch more simulated events.
2261
2262         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
2263         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
2264         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
2265         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
2266         also be more than one mouse event waiting to be handled by WebProcess.
2267
2268         In the past, these queued mouse events were tracked with several member variables as different
2269         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
2270         checking the queue length.
2271
2272         * Platform/Logging.h: Add logging channel for mouse events.
2273         * UIProcess/Automation/WebAutomationSession.cpp:
2274         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
2275         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
2276         the convenience constructors and .toProtocolString() method.
2277
2278         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2279         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
2280         prior to returning from the command, we need to abort any key event callbacks that are pending if an
2281         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
2282         be handled when the alert is dismissed and the nested run loop exits.
2283
2284         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
2285         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2286         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
2287         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
2288
2289         (WebKit::WebAutomationSession::performMouseInteraction):
2290         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
2291         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
2292         so we also need to handle the case where there is nothing to be waited on because hit testing did
2293         not return a target to deliver the event to.
2294
2295         (WebKit::WebAutomationSession::performKeyboardInteractions):
2296         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
2297         event waiting/handling code. Now it matches the types used for the mouse event case.
2298
2299         * UIProcess/Automation/WebAutomationSession.h:
2300         (WebKit::AutomationCommandError::AutomationCommandError):
2301         Add a helper struct to hold an enumerated error name and an optional free-form error message.
2302
2303         * UIProcess/WebPageProxy.h:
2304         * UIProcess/WebPageProxy.cpp:
2305         (WebKit::webMouseEventTypeString):
2306         (WebKit::webKeyboardEventTypeString):
2307         (WebKit::WebPageProxy::handleMouseEvent):
2308         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2309         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
2310         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
2311         if there are more mouse events to be sent to WebProcess.
2312
2313         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
2314         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
2315         (WebKit::WebPageProxy::didReceiveEvent):
2316         Unify the code paths for different mouse event types to all use the deque. They also will
2317         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
2318
2319         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
2320
2321 2018-04-19  Andy Estes  <aestes@apple.com>
2322
2323         [iOS] Implement find-in-page in the new WKPDFView
2324         https://bugs.webkit.org/show_bug.cgi?id=184654
2325         <rdar://problem/39331654>
2326
2327         Reviewed by Tim Horton.
2328
2329         This is theoretically covered by existing WKPDFView API tests, but that's currently blocked
2330         by <rdar://problem/39475542>.
2331
2332         * UIProcess/ios/WKPDFView.mm:
2333         (stringCompareOptions):
2334
2335         Mapped _WKFindOptions to NSStringCompareOptions.
2336
2337         (-[WKPDFView _resetFind]):
2338
2339         Cancelled an in-progress search and reset the search state.
2340
2341         (-[WKPDFView _findString:withOptions:maxCount:completion:]):
2342
2343         Stored the completion block, find string, and max count, then called
2344         -[PDFHostViewController findString:withOptions:].
2345
2346         (-[WKPDFView web_countStringMatches:options:maxCount:]):
2347
2348         Called -_findString:withOptions:maxCount:completion: with a completion block that calls
2349         FindClient::didCountStringMatches() with _findStringCount.
2350
2351         (-[WKPDFView _computeFocusedSearchResultIndexWithOptions:didWrapAround:]):
2352
2353         Computed the focused search result index, taking _findStringCount and wrap-around into
2354         account. There are two interesting cases to mention here:
2355
2356         1. We can't change focus while a search is in progress, because we can't properly handle
2357         wrap-around without a _findStringCount. If a search is in progress, store the requested
2358         focus change in _focusedSearchResultPendingOffset, which will be applied once the search
2359         finishes.
2360
2361         2. If wrap-around is about to happen but the find options do not allow it, we need to call
2362         FindClient::didFailToFindString(). Handle this by returning NO, which will tell
2363         -_focusOnSearchResultWithOptions: to call didFailToFindString() if a search is not in
2364         progress.
2365
2366         (-[WKPDFView _focusOnSearchResultWithOptions:]):
2367
2368         If -_computeFocusedSearchResultIndexWithOptions:didWrapAround: failed while a search is in
2369         progress, just return early. Otherwise, call FindClient::didFailToFindString(). If
2370         computing the index did not fail, call -[PDFHostViewController focusOnSearchResultAtIndex:]
2371         to change focus and then call FindClient::didFindString() to inform the client.
2372
2373         (-[WKPDFView web_findString:options:maxCount:]):
2374
2375         If the find string is equal to _findString, change focus. Otherwise, start a new search.
2376
2377         (-[WKPDFView web_hideFindUI]):
2378
2379         Called -_resetFind.
2380
2381         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
2382
2383         Stored the count in _findStringCount and called _findCompletion once the search is done.
2384
2385 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
2386
2387         The InternalFunction hierarchy should be in IsoSubspaces
2388         https://bugs.webkit.org/show_bug.cgi?id=184721
2389
2390         Reviewed by Saam Barati.
2391
2392         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
2393         (WebKit::JSNPMethod::subspaceForImpl):
2394         * WebProcess/Plugins/Netscape/JSNPMethod.h:
2395         (WebKit::JSNPMethod::create): Deleted.
2396         (WebKit::JSNPMethod::npIdentifier const): Deleted.
2397         (WebKit::JSNPMethod::createStructure): Deleted.
2398         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
2399         (WebKit::JSNPObject::subspaceForImpl):
2400         * WebProcess/Plugins/Netscape/JSNPObject.h:
2401         (WebKit::JSNPObject::create): Deleted.
2402         (WebKit::JSNPObject::npObject const): Deleted.
2403         (WebKit::JSNPObject::createStructure): Deleted.
2404
2405 2018-04-19  Brady Eidson  <beidson@apple.com>
2406
2407         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
2408         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
2409
2410         Reviewed by Ryosuke Niwa.
2411
2412         With process swapping, the assumption that "back/forward items belong to a process" is invalid.
2413
2414         All HistoryItem/WebBackForwardListItems now need to be uniquely identified across all processes,
2415         no matter which process they originated from, so there will never be a collision in the UIProcess.
2416
2417         This allows us to:
2418         - Have the UIProcess to keep a single process-wide map of all WebBackForwardListItems
2419         - Get rid of the per-WebProcess WebBackForwardListItem map
2420         - Simplify a lot of WebBackForwardList(Proxy) code that no longer needs to keep that per-process
2421           map in sync
2422         - Get rid of a lot of other ancillary code
2423
2424         * Shared/SessionState.cpp:
2425         (WebKit::BackForwardListItemState::decode):
2426         * Shared/SessionState.h:
2427
2428         * Shared/WebBackForwardListItem.cpp:
2429         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
2430         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
2431         (WebKit::WebBackForwardListItem::itemForID):
2432         (WebKit::WebBackForwardListItem::highestUsedItemID): Deleted.
2433         * Shared/WebBackForwardListItem.h:
2434         (WebKit::WebBackForwardListItem::itemID const):
2435
2436         * Shared/WebPageCreationParameters.cpp:
2437         (WebKit::WebPageCreationParameters::encode const):
2438         (WebKit::WebPageCreationParameters::decode):
2439         * Shared/WebPageCreationParameters.h:
2440
2441         * UIProcess/WebBackForwardList.cpp:
2442         (WebKit::WebBackForwardList::itemForID):
2443         (WebKit::WebBackForwardList::pageClosed):
2444         (WebKit::WebBackForwardList::addItem):
2445         (WebKit::WebBackForwardList::restoreFromState):
2446         (WebKit::generateWebBackForwardItemID): Deleted.
2447         * UIProcess/WebBackForwardList.h:
2448
2449         * UIProcess/WebPageProxy.cpp:
2450         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
2451         (WebKit::WebPageProxy::initializeWebPage):
2452         (WebKit::WebPageProxy::willGoToBackForwardListItem):
2453         (WebKit::WebPageProxy::restoreFromSessionState):
2454         (WebKit::WebPageProxy::backForwardAddItem):
2455         (WebKit::WebPageProxy::backForwardGoToItem):
2456         (WebKit::WebPageProxy::backForwardItemAtIndex):
2457         (WebKit::WebPageProxy::creationParameters):
2458         (WebKit::WebPageProxy::backForwardRemovedItem):
2459         * UIProcess/WebPageProxy.h:
2460         * UIProcess/WebPageProxy.messages.in:
2461  
2462         * UIProcess/WebProcessPool.cpp: Explicitly set the UIProcess Process::Identifier so it starts
2463           at "1" and then the first child process starts at "2", etc etc.
2464
2465         * UIProcess/WebProcessProxy.cpp:
2466         (WebKit::WebProcessProxy::removeWebPage):
2467         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
2468         (WebKit::WebProcessProxy::updateBackForwardItem):
2469         (WebKit::WebProcessProxy::webBackForwardItem const): Deleted.
2470         (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Deleted.
2471         (WebKit::WebProcessProxy::removeBackForwardItem): Deleted.
2472         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Deleted.
2473         * UIProcess/WebProcessProxy.h:
2474         * UIProcess/WebProcessProxy.messages.in:
2475
2476         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
2477         (WebKit::toBackForwardListItemState):
2478         (WebKit::applyFrameState):
2479         (WebKit::toHistoryItem):
2480         (WebKit::toPageState): Deleted.
2481         * WebProcess/WebCoreSupport/SessionStateConversion.h:
2482
2483         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2484         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
2485
2486         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
2487         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
2488         (WebKit::WK2NotifyHistoryItemChanged):
2489         (WebKit::WebBackForwardListProxy::itemForID):
2490         (WebKit::WebBackForwardListProxy::removeItem):
2491         (WebKit::WebBackForwardListProxy::addItem): Previously this was a two-step process of adding an item
2492           to the process and then associating it with the page. Now it's just directly adding it to the page,
2493           so we don't need to call updateBackForwardItem first.
2494         (WebKit::WebBackForwardListProxy::goToItem):
2495         (WebKit::WebBackForwardListProxy::itemAtIndex):
2496         (WebKit::WebBackForwardListProxy::close):
2497         (WebKit::historyItemToIDMap): Deleted.
2498         (WebKit::generateHistoryItemID): Deleted.
2499         (WebKit::WebBackForwardListProxy::setHighestItemIDFromUIProcess): Deleted.
2500         (WebKit::updateBackForwardItem): Deleted.
2501         (WebKit::WebBackForwardListProxy::idForItem): Deleted.
2502         * WebProcess/WebPage/WebBackForwardListProxy.h:
2503
2504         * WebProcess/WebPage/WebPage.cpp:
2505         (WebKit::m_credentialsMessenger):
2506         (WebKit::WebPage::goToBackForwardItem):
2507         (WebKit::WebPage::restoreSessionInternal):
2508         (WebKit::WebPage::didRemoveBackForwardItem):
2509         * WebProcess/WebPage/WebPage.h:
2510         * WebProcess/WebPage/WebPage.messages.in:
2511
2512 2018-04-19  Youenn Fablet  <youenn@apple.com>
2513
2514         NetworkProcess should use CSP/content blockers for sync XHR
2515         https://bugs.webkit.org/show_bug.cgi?id=184760
2516
2517         Reviewed by Chris Dumez.
2518
2519         Setting CSP/ContentBlockers parameters for sync XHR loads.
2520         * NetworkProcess/NetworkResourceLoader.cpp:
2521
2522 2018-04-19  Nan Wang  <n_wang@apple.com>
2523
2524         AX: AOM: respect the accessibility setting for dispatching the accessible events
2525         https://bugs.webkit.org/show_bug.cgi?id=184619
2526
2527         Reviewed by Ryosuke Niwa.
2528
2529         Linked libAccessibility on iOS and macOS to use the platform accessibility settings
2530         for allowing dispatching the accessibility events.
2531
2532         * Configurations/WebKit.xcconfig:
2533         * UIProcess/API/Cocoa/WKWebView.mm:
2534         (-[WKWebView _initializeWithConfiguration:]):
2535         (accessibilityEventsEnabledChangedCallback):
2536         (-[WKWebView _updateAccessibilityEventsEnabled]):
2537         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2538         * UIProcess/WebPageProxy.cpp:
2539         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
2540         * UIProcess/WebPageProxy.h:
2541         * WebProcess/WebPage/WebPage.cpp:
2542         (WebKit::WebPage::updateAccessibilityEventsEnabled):
2543         * WebProcess/WebPage/WebPage.h:
2544         * WebProcess/WebPage/WebPage.messages.in:
2545
2546 2018-04-18  Chris Dumez  <cdumez@apple.com>
2547
2548         Rename WindowProxyController to WindowProxy
2549         https://bugs.webkit.org/show_bug.cgi?id=184756
2550
2551         Reviewed by Sam Weinig.
2552
2553         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
2554         needed use WindowProxyController type, which was a bit confusing.
2555
2556         * WebProcess/Plugins/PluginView.cpp:
2557         (WebKit::PluginView::windowScriptNPObject):
2558         * WebProcess/WebPage/WebPage.cpp:
2559         (WebKit::WebPage::frameBecameRemote):
2560
2561 2018-04-18  Youenn Fablet  <youenn@apple.com>
2562
2563         Allow SameOrigin credentials handling for synchronous XHR
2564         https://bugs.webkit.org/show_bug.cgi?id=184723
2565
2566         Reviewed by Alex Christensen.
2567
2568         In case of SameOrigin credentials, we need to stop the current load
2569         in case of cross origin redirection to restart a load with a different session.
2570         Covered by updated WK2 tests.
2571         Rebased WK1 tests since this is Wk1 only.
2572
2573         * NetworkProcess/NetworkResourceLoader.cpp:
2574         (WebKit::NetworkResourceLoader::startNetworkLoad):
2575         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2576         * NetworkProcess/NetworkResourceLoader.h:
2577
2578 2018-04-18  Chris Dumez  <cdumez@apple.com>
2579
2580         Set RemoteDOMWindow's initial opener
2581         https://bugs.webkit.org/show_bug.cgi?id=184716
2582
2583         Reviewed by Sam Weinig.
2584
2585         When a frame becomes remote, transfer the frame opener from the old
2586         frame to the new remote one.
2587
2588         * WebProcess/WebPage/WebPage.cpp:
2589         (WebKit::WebPage::frameBecameRemote):
2590
2591 2018-04-18  Youenn Fablet  <youenn@apple.com>
2592
2593         NetworkResourceLoader should not clean itself inside didReceiveResponse
2594         https://bugs.webkit.org/show_bug.cgi?id=184754
2595
2596         Reviewed by Chris Dumez.
2597
2598         Delay the cleanup to after the didReceiveResponse call so that NetworkLoad can terminate its work.
2599         Covered by XHR sync tests no longer crashing on GuardMalloc bots.
2600
2601         * NetworkProcess/NetworkResourceLoader.cpp:
2602         (WebKit::NetworkResourceLoader::didReceiveResponse):
2603
2604 2018-04-18  Jer Noble  <jer.noble@apple.com>
2605
2606         Fix rendering of WKRemoteView layers in the simulator
2607         https://bugs.webkit.org/show_bug.cgi?id=184752
2608
2609         Reviewed by Tim Horton.
2610
2611         * Platform/mac/LayerHostingContext.mm:
2612         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2613
2614 2018-04-18  Jer Noble  <jer.noble@apple.com>
2615
2616         Fix entitlements and sandboxing for iphoneminimalsimulator
2617         https://bugs.webkit.org/show_bug.cgi?id=184692
2618
2619         Reviewed by Tim Horton.
2620
2621         Use the correct implementations for ChildProcess and NetworkProcess
2622         when building for iphoneminimalsimulator. Stub out imlementations
2623         which rely on methods not available in the iphoneminimalsimulator SDK.
2624
2625         * Configurations/Network-OSX.entitlements: Added.
2626         * Configurations/NetworkService.xcconfig:
2627         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2628         (WebKit::NetworkProcess::sourceApplicationAuditData const):
2629         * NetworkProcess/ios/NetworkProcessIOS.mm:
2630         * NetworkProcess/mac/NetworkProcessMac.mm:
2631         (WebKit::NetworkProcess::initializeProcessName):
2632         (WebKit::overrideSystemProxies):
2633         * Shared/ios/ChildProcessIOS.mm:
2634         (WebKit::ChildProcess::initializeSandbox):
2635         * Shared/mac/ChildProcessMac.mm:
2636         (WebKit::ChildProcess::setApplicationIsDaemon):
2637         (WebKit::enableSandboxStyleFileQuarantine):
2638         (WebKit::ChildProcess::initializeSandbox):
2639         (WebKit::ChildProcess::platformStopRunLoop):
2640         * Shared/mac/CodeSigning.mm:
2641         * WebKit.xcodeproj/project.pbxproj:
2642         * WebProcess/cocoa/WebProcessCocoa.mm:
2643         (WebKit::WebProcess::initializeSandbox):
2644
2645 2018-04-18  Commit Queue  <commit-queue@webkit.org>
2646
2647         Unreviewed, rolling out r230743.
2648         https://bugs.webkit.org/show_bug.cgi?id=184747
2649
2650         causes mouse clicks to not work on some platforms (Requested
2651         by brrian on #webkit).
2652
2653         Reverted changeset:
2654
2655         "Web Automation: simulated mouse interactions should not be
2656         done until associated DOM events have been dispatched"
2657         https://bugs.webkit.org/show_bug.cgi?id=184462
2658         https://trac.webkit.org/changeset/230743
2659
2660 2018-04-18  Brent Fulgham  <bfulgham@apple.com>
2661
2662         Avoid crash if ITP Debug mode is on, but ResourceLoadStatistics are not being used
2663         https://bugs.webkit.org/show_bug.cgi?id=184739
2664         <rdar://problem/39287964>
2665
2666         Reviewed by David Kilzer.
2667
2668         If a user has the ResourceLoadStatistics logic turned off, but has the ITP Debug experimental
2669         flag turned on, you can cause a crash.
2670
2671         This is because the WebsiteDataStore for the process doesn't bother creating a ResourceLoadStatisticsStore
2672         if the statistics machinery is not running. The ITP debug flag was being blindly set without checking
2673         if the statistics store exists or not, which can cause a crash.
2674
2675         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2676         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): Check if the statistics store exists
2677         before calling functions on it.
2678
2679 2018-04-18  Paul Knight  <pknight@apple.com>
2680
2681         Add -[_WKInputDelegateDelegate willStartInputSession:] for clients that want to configure input session before assisting form node
2682         https://bugs.webkit.org/show_bug.cgi?id=184662
2683
2684         Reviewed by Beth Dakin.
2685
2686         Clients may wish to configure a WKInputSession before we start assisting
2687         a node. Add a -[_WKInputDelegateDelegate _webView:willStartInputSession:]
2688         callback.
2689
2690         For example, clients that wish to present a custom input view will want
2691         to configure the WKFormInputSession's customInputView before the
2692         keyboard is presented. Otherwise the standard keyboard will begin to
2693         animate and then the custom input view will swap in later.
2694
2695         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2696         * UIProcess/ios/WKContentViewInteraction.mm:
2697         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2698             Call -_webView:willStartInputSession: before assisting the node.
2699             Only create the form session if the delegate implements either
2700             the willStart or didStartInputSession callbacks.
2701
2702 2018-04-18  Chris Dumez  <cdumez@apple.com>
2703
2704         Add support for converting a local window to a remote window
2705         https://bugs.webkit.org/show_bug.cgi?id=184515
2706         <rdar://problem/39011318>
2707
2708         Reviewed by Ryosuke Niwa.
2709
2710         Add initial support for process-swapping when navigating cross-origin as a result
2711         of a window.open(). The window object returned by window.open() is initially same
2712         origin and is for about:blank. The navigation cross-origin then happens and the
2713         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
2714         hosted in another WebProcess).
2715
2716         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
2717         exceptions due to our incomplete implementation (e.g. w.location returns null) and
2718         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
2719         in a follow-up by relying on IPC.
2720
2721         * UIProcess/API/APIProcessPoolConfiguration.cpp:
2722         (API::ProcessPoolConfiguration::copy):
2723         * UIProcess/API/APIProcessPoolConfiguration.h:
2724         * UIProcess/API/C/WKContextConfigurationRef.cpp:
2725         (WKContextConfigurationProcessSwapsOnWindowOpenWithOpener):
2726         (WKContextConfigurationSetProcessSwapsOnWindowOpenWithOpener):
2727         * UIProcess/API/C/WKContextConfigurationRef.h:
2728         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2729         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
2730         (-[_WKProcessPoolConfiguration setProcessSwapsOnWindowOpenWithOpener:]):
2731         (-[_WKProcessPoolConfiguration processSwapsOnWindowOpenWithOpener]):
2732         Add ProcessPool configuration flag to turn on processSwap on window.open(), even
2733         if there is an opener.
2734
2735         * UIProcess/WebPageProxy.cpp:
2736         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2737         If the navigation was triggered via window.open(), then set up on handler for when
2738         a DOMWindow is constructed for the main frame in the new process.
2739
2740         (WebKit::WebPageProxy::didCreateWindow):
2741         When a Window is constructed for the main frame in a new process on process swap,
2742         notify the old process that its representation of the window should become remote
2743         and provide it with the Frame / Window identifiers it needs.
2744
2745         * UIProcess/WebPageProxy.h:
2746         * UIProcess/WebPageProxy.messages.in:
2747
2748         * UIProcess/WebProcessPool.cpp:
2749         (WebKit::WebProcessPool::processForNavigation):
2750         Do process swapping on cross-origin window.open() if the corresponding setting is
2751         enabled.
2752
2753         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2754         (WebKit::WebFrameLoaderClient::didCreateWindow):
2755         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
2756
2757         * WebProcess/WebPage/WebPage.cpp:
2758         (WebKit::WebPage::frameBecameRemote):
2759         This is called when process swapping has happened due to a window.open() navigation
2760         cross-origin, when a Frame / Window has been constructed in the new process. We do
2761         the following:
2762         - Construct a RemoteFrame / RemoteWindow using the provided global identifiers to
2763           represent the Frame / Window in the new process.
2764         - We transfer the WindowProxies from the old Frame's WindowProxyController to the
2765           new RemoteFrame's WindowProxyController.
2766         - We update the window proxied by those WindowProxies to be the new RemoteWindow.
2767         - We detach the old Frame as it is now remote and represented by the new RemoteFrame
2768           object we constructed.
2769         - If the old frame was the main frame (always the case currently), we close the page
2770           as it is no longer needed. The new RemoteFrame is currently owned by the RemoteWindow
2771           which is kept alive by its JS wrappers.
2772
2773         * WebProcess/WebPage/WebPage.h:
2774         * WebProcess/WebPage/WebPage.messages.in:
2775
2776 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2777
2778         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.1 release.
2779
2780         * gtk/NEWS: Add release notes for 2.21.1.
2781
2782 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2783
2784         Unreviewed. Remove symbols from webkitglib-symbols.map.
2785
2786         Remove symbols not present in WebKit.
2787
2788         * webkitglib-symbols.map:
2789
2790 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
2791
2792         Unreviewed. Add missing symbols to webkitglib-symbols.map.
2793
2794         Add symbols global in JSC and present in WebKit.
2795
2796         * webkitglib-symbols.map:
2797
2798 2018-04-18  Fujii Hironori  <Hironori.Fujii@sony.com>
2799
2800         [Win][WebKit] Implement InjectedBundleWin.cpp
2801         https://bugs.webkit.org/show_bug.cgi?id=184525
2802
2803         Reviewed by Konstantin Tokarev.
2804
2805         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
2806         (WebKit::InjectedBundle::initialize):
2807
2808 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2809
2810         [Extra zoom mode] Programmatically changing focus when an element already has focus is a confusing experience
2811         https://bugs.webkit.org/show_bug.cgi?id=184635
2812         <rdar://problem/39440642>
2813
2814         Reviewed by Tim Horton.
2815
2816         Currently on iOS, we allow element focus to present UI if the keyboard is already shown. In extra zoom mode,
2817         this would lead to a confusing experience when the focus form control overlay is disabled, since fullscreen
2818         input view controllers are swapped out from underneath the user. Currently, this also puts the UI process into a
2819         bad state where the focused form control overlay is active, but still hidden. This patch makes some tweaks to
2820         input view controller handling in the UI process to address these issues, and also adds WebKitTestRunner support
2821         for simulating interactions with select menus in extra zoom mode. See comments below for more detail.
2822
2823         Test: fast/events/extrazoom/change-focus-during-change-event.html
2824
2825         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2826
2827         Add new SPI delegate hooks to notify the UI delegate when view controllers are presented or dismissed in extra
2828         zoom mode. See -presentViewControllerForCurrentAssistedNode and -dismissAllInputViewControllers.
2829
2830         * UIProcess/WebProcessProxy.cpp:
2831         (WebKit::WebProcessProxy::takeBackgroundActivityTokenForFullscreenInput):
2832         (WebKit::WebProcessProxy::releaseBackgroundActivityTokenForFullscreenInput):
2833
2834         See the comment below -dismissAllInputViewControllers.
2835
2836         * UIProcess/WebProcessProxy.h:
2837         * UIProcess/ios/WKContentViewInteraction.mm:
2838         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2839
2840         In extra zoom mode, when changing focus from one assisted node to another, only allow the second node to be
2841         assisted if the focused form control overlay is being shown. Otherwise, (i.e. when a fullscreen input view
2842         controller is being presented), don't allow focus to start an input session.
2843
2844         Additionally, make a minor tweak to allow the previous node to blur, even if we are not showing the keyboard for
2845         the new focused element. Without this adjustment, in the case where the page has programmatically focused
2846         another element while a fullscreen input view controller is presented, we'll show the old view controller for
2847         the new focused element.
2848
2849         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2850         (-[WKContentView dismissAllInputViewControllers:]):
2851
2852         Currently, when a fullscreen input view controller is presented, the web process gets backgrounded. This
2853         prevents event handlers from executing, which leads to strange behaviors in many cases (for instance: if we
2854         have a multiple select, and the "change" event handler blurs the select, the user may check or uncheck multiple
2855         items, but only the first change will actually take effect).
2856
2857         To fix this, we maintain a background activity token while presenting an input view controller.
2858
2859         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
2860
2861         Start hiding the focused form overlay when re-presenting an input view controller. This allows us to bail from
2862         showing fullscreen input UI for another focused element if focus programmatically changes while the current
2863         fullscreen input view controller is presented, due to the -isHidden check in -_startAssistingNode:.
2864
2865         (-[WKContentView selectFormAccessoryPickerRow:]):
2866
2867         Simulate tapping a given row in select menu UI in extra zoom mode.
2868
2869 2018-04-17  Conrad Shultz  <conrad_shultz@apple.com>
2870
2871         WebKit::DisplayLink maintains a strong reference to WebPageProxy, creating a reference cycle
2872         https://bugs.webkit.org/show_bug.cgi?id=184718
2873
2874         Reviewed by Tim Horton.
2875
2876         It turns out that the m_webPageProxy back-reference in DisplayLink, which was creating a
2877         reference cycle, wasn't ever read, so we can just remove it.
2878
2879         * UIProcess/mac/DisplayLink.cpp:
2880         (WebKit::DisplayLink::DisplayLink):
2881         * UIProcess/mac/DisplayLink.h:
2882
2883 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2884
2885         [Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode
2886         https://bugs.webkit.org/show_bug.cgi?id=184631
2887         <rdar://problem/39303706>
2888
2889         Reviewed by Tim Horton.
2890
2891         Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up
2892         to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally
2893         represents a character.
2894
2895         The first and second text legibility zoom scales are then computed based on the zoom scales needed to
2896         make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the
2897         text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the
2898         first and second text legibility scales may end up being close to one another, or even the same (in the case
2899         where there is only a single font size in the entire document). In this case, we just snap the first scale to
2900         the second, so that double tapping will only toggle between two zoom scales. In another case where the document
2901         has no text (e.g. an image document), we just fall back to a zoom scale of 1.
2902
2903         Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html
2904
2905         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2906         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
2907
2908 2018-04-17  Megan Gardner  <megan_gardner@apple.com>
2909
2910         Don't activate selection on become first responder
2911         https://bugs.webkit.org/show_bug.cgi?id=184719
2912
2913         Reviewed by Tim Horton.
2914         
2915         If we activate the selection immediately on becoming first responder, we cause the selection view to delete itself
2916         since it is not guaranteed to have selection rects immediately due to async/two process architecture. The selection
2917         is activated already when the selection rects change, so there is no reason to activate it now. This has likely worked
2918         in the past because this selection assistant was only for editable text, which would immediately set a caret, which 
2919         is a selection. Now that this is for non-editable text as well, activating the selection is problematic.
2920
2921         * UIProcess/ios/WKContentViewInteraction.mm:
2922         (-[WKContentView becomeFirstResponderForWebView]):
2923
2924 2018-04-11  Brian Burg  <bburg@apple.com>
2925
2926         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
2927         https://bugs.webkit.org/show_bug.cgi?id=184462
2928         <rdar://problem/39323336>
2929
2930         Reviewed by Carlos Garcia Campos and Tim Horton.
2931
2932         Covered by existing layout tests and actions endpoints in WebDriver test suite.
2933
2934         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
2935         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
2936         to dispatch more simulated events.
2937
2938         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
2939         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
2940         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
2941         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
2942         also be more than one mouse event waiting to be handled by WebProcess.
2943
2944         In the past, these queued mouse events were tracked with several member variables as different
2945         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
2946         checking the queue length.
2947
2948         * Platform/Logging.h: Add logging channel for mouse events.
2949         * UIProcess/Automation/WebAutomationSession.cpp:
2950         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
2951         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
2952         the convenience constructors and .toProtocolString() method.
2953
2954         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
2955         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
2956         prior to returning from the command, we need to abort any key event callbacks that are pending if an
2957         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
2958         be handled when the alert is dismissed and the nested run loop exits.
2959
2960         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
2961         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
2962         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
2963         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
2964
2965         (WebKit::WebAutomationSession::performMouseInteraction):
2966         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
2967         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
2968         so we also need to handle the case where there is nothing to be waited on because hit testing did
2969         not return a target to deliver the event to.
2970
2971         (WebKit::WebAutomationSession::performKeyboardInteractions):
2972         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
2973         event waiting/handling code. Now it matches the types used for the mouse event case.
2974
2975         * UIProcess/Automation/WebAutomationSession.h:
2976         (WebKit::AutomationCommandError::AutomationCommandError):
2977         Add a helper struct to hold an enumerated error name and an optional free-form error message.
2978
2979         * UIProcess/WebPageProxy.h:
2980         * UIProcess/WebPageProxy.cpp:
2981         (WebKit::webMouseEventTypeString):
2982         (WebKit::webKeyboardEventTypeString):
2983         (WebKit::WebPageProxy::handleMouseEvent):
2984         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
2985         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
2986         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
2987         if there are more mouse events to be sent to WebProcess.
2988
2989         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
2990         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
2991         (WebKit::WebPageProxy::didReceiveEvent):
2992         Unify the code paths for different mouse event types to all use the deque. They also will
2993         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
2994
2995         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
2996
2997 2018-04-17  Adrian Perez de Castro  <aperez@igalia.com>
2998
2999         [GTK][WPE] Build failure due to presence of Avahi's <dns_sd.h> header
3000         https://bugs.webkit.org/show_bug.cgi?id=184711
3001
3002         Unreviewed build fix.
3003
3004         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Set ENABLE_MDNS only for PLATFORM(COCOA).
3005
3006 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
3007
3008         Unreviewed rollout of r230632. Regression in memory usage.
3009
3010         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
3011
3012         * Shared/WebPreferences.yaml:
3013
3014 2018-04-17  Timothy Hatcher  <timothy@apple.com>
3015
3016         Always use LayerContentsType::IOSurface in minimal simulator mode
3017         https://bugs.webkit.org/show_bug.cgi?id=184710
3018
3019         Reviewed by Simon Fraser.
3020
3021         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
3022         (WebKit::RemoteLayerTreeHost::updateLayerTree):
3023
3024 2018-04-17  Ryosuke Niwa  <rniwa@webkit.org>
3025
3026         Release assert in InjectedBundle::postSynchronousMessage
3027         https://bugs.webkit.org/show_bug.cgi?id=184683
3028
3029         Reviewed by Wenson Hsieh.
3030
3031         Some injected bundles sends sync message when it's not safe to execute scripts.
3032
3033         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply option in InjectedBundle::postSynchronousMessage
3034         to avoid processing incoming sync IPC messages so that we don't execute arbitrary scripts in those cases.
3035
3036         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3037         (WebKit::InjectedBundle::postSynchronousMessage):
3038
3039 2018-04-17  Chris Dumez  <cdumez@apple.com>
3040
3041         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
3042         https://bugs.webkit.org/show_bug.cgi?id=184678
3043         <rdar://problem/39422122>
3044
3045         Reviewed by Alex Christensen.
3046
3047         Re-introduce synchronous code path which existed pre-r229831 and use it for fragment navigations.
3048
3049         * UIProcess/WebPageProxy.cpp:
3050         (WebKit::WebPageProxy::receivedPolicyDecision):
3051         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3052         * UIProcess/WebPageProxy.h:
3053         * UIProcess/WebPageProxy.messages.in:
3054         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3055         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3056         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3057
3058 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
3059
3060         [WPE][GTK] GObject introspection annotation fixes: BackForwardList, NetworkProxySettings
3061         https://bugs.webkit.org/show_bug.cgi?id=184658
3062
3063         Reviewed by Carlos Garcia Campos.
3064
3065         Thanks to Dylan Simon for recommending these annotation fixes.
3066
3067         * UIProcess/API/glib/WebKitBackForwardList.cpp:
3068         * UIProcess/API/glib/WebKitNetworkProxySettings.cpp:
3069
3070 2018-04-17  Brent Fulgham  <bfulgham@apple.com>
3071
3072         [macOS] Don't establish unneeded Dock connections (Follow-up)
3073         https://bugs.webkit.org/show_bug.cgi?id=184664
3074         <rdar://problem/16863698>
3075
3076         Reviewed by Per Arne Vollan.
3077
3078         Because the Plugin process is driven by NSApplication's run loop, we aren't
3079         setting the 'don't connect to the dock' setting early enough.
3080
3081         This patch sets the flag in XPCServiceMain for those services that
3082         are linked to AppKit.
3083
3084         * PluginProcess/mac/PluginProcessMac.mm:
3085         (WebKit::PluginProcess::platformInitializeProcess): Remove unneeded code.
3086         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
3087         (main):
3088         * WebProcess/cocoa/WebProcessCocoa.mm:
3089         (WebKit::WebProcess::platformInitializeWebProcess): Remove unneeded code.
3090
3091 2018-04-17  Saam Barati  <sbarati@apple.com>
3092
3093         Add system trace points for process launch and for initializeWebProcess
3094         https://bugs.webkit.org/show_bug.cgi?id=184669
3095
3096         Reviewed by Simon Fraser.
3097
3098         * UIProcess/Launcher/ProcessLauncher.cpp:
3099         (WebKit::ProcessLauncher::ProcessLauncher):
3100         (WebKit::ProcessLauncher::didFinishLaunchingProcess):
3101         * WebProcess/WebProcess.cpp:
3102         (WebKit::WebProcess::initializeWebProcess):
3103
3104 2018-04-16  Timothy Hatcher  <timothy@apple.com>
3105
3106         Unreviewed 32-bit build fix for r230673.
3107
3108         https://bugs.webkit.org/show_bug.cgi?id=184657
3109         rdar://problem/39463307
3110
3111         * Configurations/PluginProcessShim.xcconfig: Use the correct names.
3112
3113 2018-04-16  Andy Estes  <aestes@apple.com>
3114
3115         [iOS] Enable WKPDFView by default
3116         https://bugs.webkit.org/show_bug.cgi?id=184675
3117         <rdar://problem/27885452>
3118
3119         Reviewed by Darin Adler.
3120
3121         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
3122         (-[WKWebViewContentProviderRegistry init]):
3123
3124 2018-04-16  Brent Fulgham  <bfulgham@apple.com>
3125
3126         [macOS] Don't establish unneeded Dock connections
3127         https://bugs.webkit.org/show_bug.cgi?id=184664
3128         <rdar://problem/16863698>
3129
3130         Reviewed by Simon Fraser.
3131
3132         There is no reason for the WebContent or Plugin processes to interact with
3133         the Dock. We should tell AppKit that we don't want this connection, and to
3134         avoid creating such connections.
3135
3136         * PluginProcess/mac/PluginProcessMac.mm:
3137         (WebKit::PluginProcess::platformInitializeProcess): Tell NSApplication to
3138         not create a Dock connection.
3139         * WebProcess/cocoa/WebProcessCocoa.mm:
3140         (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
3141
3142 2018-04-16  Megan Gardner  <megan_gardner@apple.com>
3143
3144         Switch to UIWKTextInteractionAssistant for non-editable text
3145         https://bugs.webkit.org/show_bug.cgi?id=182834
3146
3147         Reviewed by Beth Dakin.
3148         
3149         Switch to only using one assistant for text selection.
3150
3151         * UIProcess/ios/WKContentViewInteraction.mm:
3152         (-[WKContentView useSelectionAssistantWithGranularity:]):
3153
3154 2018-04-16  Youenn Fablet  <youenn@apple.com>
3155
3156         Use NetworkLoadChecker to handle synchronous HTTP loads
3157         https://bugs.webkit.org/show_bug.cgi?id=184240
3158
3159         Reviewed by Chris Dumez.
3160
3161         For every NetworkResourceLoader synchronous load, we create a NetworkLoadChecker.
3162         NetworkLoadChecker handles all security checks in that case.
3163         This allows supporting cross-origin loads for synchronous XHR.
3164
3165         Updated NetworkCORSPreflightChecker to return the result as a ResourceError.
3166         This is used to convey any error message from NetworkProcess to the JS console.
3167         Ensure NetworkCORSPreflightChecker computes correctly Access-Control-Request-Headers value
3168         by providing the headers set by the application plus Referrer/Origin.
3169
3170         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
3171         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
3172         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
3173         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
3174         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
3175         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
3176         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
3177         * NetworkProcess/NetworkLoadChecker.cpp:
3178         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3179         * NetworkProcess/NetworkResourceLoader.cpp:
3180         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
3181         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3182         (WebKit::NetworkResourceLoader::didReceiveResponse):
3183         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3184         (WebKit::NetworkResourceLoader::continueWillSendRequest):
3185         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3186         (WebKit::NetworkResourceLoader::validateCacheEntry):
3187         * NetworkProcess/NetworkResourceLoader.h:
3188         * WebProcess/Network/WebLoaderStrategy.cpp:
3189         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
3190         * WebProcess/Network/WebLoaderStrategy.h:
3191
3192 2018-04-16  Brian Burg  <bburg@apple.com>
3193
3194         [Cocoa] Web Automation: add SPI to terminate automation session and disconnect the remote end
3195         https://bugs.webkit.org/show_bug.cgi?id=184523
3196         <rdar://problem/39368599>
3197
3198         Reviewed by Simon Fraser.
3199
3200         When a user breaks the automation glass pane and chooses "Stop Session", there is no way
3201         for Safari to actually disconnect the remote connection using automation-related ObjC SPI.
3202         This can lead to sessions getting stuck and safaridriver is unable to request a new session.
3203
3204         Expose the -terminate method as SPI. This disconnects the remote connection and then notifies
3205         the session delegate that the remote disconnected. At that point, Safari can uninstall
3206         the session from the process pool and tear down other session state.
3207
3208         * UIProcess/API/Cocoa/_WKAutomationSession.h:
3209         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
3210         (-[_WKAutomationSession terminate]):
3211
3212 2018-04-16  Timothy Hatcher  <timothy@apple.com>
3213
3214         Clean up OTHER_LDFLAGS for WebKit processes
3215         https://bugs.webkit.org/show_bug.cgi?id=184657
3216
3217         Reviewed by Jer Noble.
3218
3219         * Configurations/PluginProcessShim.xcconfig:
3220         * Configurations/PluginService.32.xcconfig:
3221         * Configurations/PluginService.64.xcconfig:
3222         * Configurations/WebContentService.xcconfig:
3223
3224 2018-04-15  Michael Catanzaro  <mcatanzaro@igalia.com>
3225
3226         [WPE] Install files needed for WebKitWebExtensions
3227         https://bugs.webkit.org/show_bug.cgi?id=179915
3228
3229         Reviewed by Žan Doberšek.
3230
3231         * PlatformWPE.cmake: Install pkg-config file, injected bundle, and API headers.
3232         * UIProcess/API/glib/WebKitWebContext.cpp: Load the injected bundle when installed.
3233         * wpe/wpe-web-extension.pc.in: Added.
3234
3235 2018-04-14  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
3236
3237         [GTK][WPE] Build is broken after r230640
3238         https://bugs.webkit.org/show_bug.cgi?id=184623
3239
3240         Reviewed by Žan Doberšek.
3241
3242         UIProcess/SuspendedPageProxy.cpp was not included to CMake build in r230640.
3243
3244         * CMakeLists.txt: Added UIProcess/SuspendedPageProxy.cpp to WebKit_SOURCES.
3245
3246 2018-04-13  Ryan Haddad  <ryanhaddad@apple.com>
3247
3248         Unreviewed, rolling out r230447.
3249
3250         Caused flaky selection test failures on iOS
3251
3252         Reverted changeset:
3253
3254         "Switch to UIWKTextInteractionAssistant for non-editable text"
3255         https://bugs.webkit.org/show_bug.cgi?id=182834
3256         https://trac.webkit.org/changeset/230447
3257
3258 2018-04-13  Chris Dumez  <cdumez@apple.com>
3259
3260         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
3261         https://bugs.webkit.org/show_bug.cgi?id=184591
3262
3263         Reviewed by Sam Weinig.
3264
3265         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
3266         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
3267         This is work towards fixing Bug 184515.
3268
3269         * WebProcess/Plugins/PluginView.cpp:
3270         (WebKit::PluginView::windowScriptNPObject):
3271
3272 2018-04-13  Brady Eidson  <beidson@apple.com>
3273
3274         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
3275         https://bugs.webkit.org/show_bug.cgi?id=184559
3276
3277         Reviewed by Alex Christensen.
3278
3279         Before this patch, when a WebPageProxy navigates and is swapped to a new process, the old process almost always goes away.
3280
3281         This is not desirable for a few reasons:
3282         1 - We can't keep the PageCache working for back/forward scenarios
3283         2 - We throw away a "foo.com" web process, meaning the next time we need to host a "foo.com" web page we have to launch
3284             and initialize a new web process.
3285
3286         This patch adds a SuspendedPageProxy object to keep around the old web process and to manage communication with it.
3287
3288         For now, a WebPageProxy keeps exactly one "suspended page" representing the most recently visited page and its process.
3289         Additionally, that process is never reused.
3290
3291         So no benefit is achieved with this patch, but it enables future benefits.
3292
3293         * Platform/Logging.h:
3294
3295         * Shared/WebBackForwardListItem.cpp:
3296         (WebKit::WebBackForwardListItem::setSuspendedPage):
3297         * Shared/WebBackForwardListItem.h:
3298
3299         New object to represent the state of a WebPageProxy in an old web process that is not currently hosting the view.
3300         * UIProcess/SuspendedPageProxy.cpp: Added.
3301         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
3302         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
3303         (WebKit::SuspendedPageProxy::webProcessDidClose):
3304         (WebKit::SuspendedPageProxy::didFinishLoad):
3305         (WebKit::SuspendedPageProxy::didReceiveMessage):
3306         (WebKit::SuspendedPageProxy::loggingString const):
3307         * UIProcess/SuspendedPageProxy.h: Copied from Source/WebKit/Platform/Logging.h.
3308         (WebKit::SuspendedPageProxy::create):
3309         (WebKit::SuspendedPageProxy::page const):
3310         (WebKit::SuspendedPageProxy::process const):
3311         (WebKit::SuspendedPageProxy::item const):
3312         (WebKit::SuspendedPageProxy::finishedSuspending const):
3313
3314         * UIProcess/WebPageProxy.cpp:
3315         (WebKit::WebPageProxy::reattachToWebProcess):
3316         (WebKit::WebPageProxy::attachToProcessForNavigation):
3317         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
3318         (WebKit::WebPageProxy::suspendedPageProcessClosed):
3319         (WebKit::WebPageProxy::receivedPolicyDecision):
3320         (WebKit::WebPageProxy::didFinishLoadForFrame):
3321         * UIProcess/WebPageProxy.h:
3322
3323         * UIProcess/WebProcessProxy.cpp:
3324         (WebKit::WebProcessProxy::suspendWebPageProxy):
3325         (WebKit::WebProcessProxy::suspendedPageWasDestroyed):
3326         (WebKit::WebProcessProxy::removeWebPage):
3327         (WebKit::WebProcessProxy::didReceiveMessage): Optionally pass WebPageProxy messages along to SuspendedPageProxy objects.
3328         (WebKit::WebProcessProxy::didClose):
3329         (WebKit::WebProcessProxy::maybeShutDown):
3330         (WebKit::WebProcessProxy::canTerminateChildProcess): Don't terminate child processes if they still have suspended pages.
3331         * UIProcess/WebProcessProxy.h:
3332
3333         * WebKit.xcodeproj/project.pbxproj:
3334
3335         * WebProcess/WebPage/WebPage.cpp:
3336         (WebKit::WebPage::setIsSuspended):
3337         * WebProcess/WebPage/WebPage.h:
3338         (WebKit::WebPage::isSuspended const): For now, used only by WebProcess::updateActivePages. Will have more uses soon.
3339         * WebProcess/WebPage/WebPage.messages.in:
3340
3341         * WebProcess/WebProcess.messages.in:
3342         * WebProcess/cocoa/WebProcessCocoa.mm:
3343         (WebKit::WebProcess::updateActivePages): Allow the UIProcess to request an update of the web processes user visible name.
3344
3345 2018-04-13  Daniel Bates  <dabates@apple.com>
3346
3347         Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
3348         https://bugs.webkit.org/show_bug.cgi?id=184593
3349
3350         Reviewed by Alex Christensen.
3351
3352         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
3353         is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
3354         implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
3355         and the cognitive load to follow such a function call when reading the code.
3356
3357         No functionality changed. So, no new tests.
3358
3359         * NetworkProcess/NetworkLoad.cpp:
3360         (WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
3361         into this function.
3362         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
3363         into NetworkLoad::willPerformHTTPRedirection().
3364         * NetworkProcess/NetworkLoad.h:
3365
3366 2018-04-13  Daniel Bates  <dabates@apple.com>
3367
3368         Inline NetworkLoad::sharedDidReceiveResponse() into NetworkLoad::notifyDidReceiveResponse()
3369         https://bugs.webkit.org/show_bug.cgi?id=184592
3370
3371         Reviewed by Alex Christensen.
3372
3373         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedDidReceiveResponse()
3374         is only referenced from NetworkLoad::notifyDidReceiveResponse(). We should inline its
3375         implementation into the NetworkLoad::notifyDidReceiveResponse(), remove a function
3376         call, and the cognitive load to follow such a function call when reading the code.
3377
3378         No functionality changed. So, no new tests.
3379
3380         * NetworkProcess/NetworkLoad.cpp:
3381         (WebKit::NetworkLoad::notifyDidReceiveResponse): Moved the implementation of NetworkLoad::sharedDidReceiveResponse()
3382         into this function.
3383         (WebKit::NetworkLoad::sharedDidReceiveResponse): Deleted. Moved its implementation into
3384         NetworkLoad::notifyDidReceiveResponse().
3385         * NetworkProcess/NetworkLoad.h:
3386
3387 2018-04-13  Brent Fulgham  <bfulgham@apple.com>
3388
3389         REGRESSION(r230468): Improper assertion firing under STP
3390         <rdar://problem/39411676>
3391
3392         Unreviewed, rolling out an improper assertion.
3393
3394         I added an assertion in Bug 184322 that should not have been added. I did not notice that this
3395         call stack was always used in builds where NSApp is still active. Builds where we stop relying
3396         on AppKit runloops uses a different code path to shut down.
3397
3398         * Shared/mac/ChildProcessMac.mm:
3399         (WebKit::ChildProcess::stopNSAppRunLoop):
3400
3401 2018-04-12  Antoine Quint  <graouts@apple.com>
3402
3403         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
3404         https://bugs.webkit.org/show_bug.cgi?id=184569
3405         <rdar://problem/38671301>
3406
3407         Reviewed by Jon Lee.
3408
3409         * Shared/WebPreferences.yaml:
3410
3411 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3412
3413         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
3414         https://bugs.webkit.org/show_bug.cgi?id=184533
3415
3416         Reviewed by Philippe Normand.
3417
3418         Renamed GStreamerUtilities* files into GStreamerCommon* and
3419         modified files including them accordingly. Include
3420         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
3421         to avoid problems destroying objects when those files are
3422         forgotten to be included.
3423
3424         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3425         * UIProcess/wpe/WebProcessPoolWPE.cpp:
3426         * WebProcess/soup/WebProcessSoup.cpp:
3427
3428 2018-04-12  Beth Dakin  <bdakin@apple.com>
3429
3430         Fix the MOBILE_WIFI build
3431         https://bugs.webkit.org/show_bug.cgi?id=184571
3432         -and corresponding-
3433         <rdar://problem/39398181>
3434
3435         Reviewed by Jer Noble.
3436
3437         * config.h:
3438
3439 2018-04-12  Beth Dakin  <bdakin@apple.com>
3440
3441         Use -iframework to ensure that frameworks from user paths and system paths are 
3442         ordered appropriately
3443         https://bugs.webkit.org/show_bug.cgi?id=184557
3444         -and corresponding-
3445         rdar://problem/39386359
3446
3447         Reviewed by Dean Jackson.
3448
3449         * Configurations/WebKit.xcconfig:
3450
3451 2018-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
3452
3453         [Extra zoom mode] Suppress UI for inputs of type file in extra zoom mode
3454         https://bugs.webkit.org/show_bug.cgi?id=184556
3455         <rdar://problem/39062239>
3456
3457         Reviewed by Andy Estes.
3458
3459         When running in this mode, we don't have the facilities to present document picker UI. For now, just make this
3460         feature fail gracefully.
3461
3462         * UIProcess/ios/forms/WKFileUploadPanel.mm:
3463         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
3464         (-[WKFileUploadPanel platformSupportsPickerViewController]):
3465
3466 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
3467
3468         Remove block selection code
3469         https://bugs.webkit.org/show_bug.cgi?id=184470
3470
3471         Reviewed by Timothy Hatcher.
3472         
3473         Remove block selection code that isn't run and is currently not even used.
3474         Had to put this back in for a bug in the mid-year release, but we're past that
3475         so it's time for this to go away.
3476
3477         * Platform/spi/ios/UIKitSPI.h:
3478         * UIProcess/PageClient.h:
3479         * UIProcess/WebPageProxy.h:
3480         * UIProcess/WebPageProxy.messages.in:
3481         * UIProcess/ios/PageClientImplIOS.h:
3482         * UIProcess/ios/PageClientImplIOS.mm:
3483         (WebKit::PageClientImpl::stopAssistingNode):
3484         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
3485         * UIProcess/ios/WKContentViewInteraction.h:
3486         * UIProcess/ios/WKContentViewInteraction.mm:
3487         (toSelectionHandlePosition): Deleted.
3488         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
3489         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
3490         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
3491         * UIProcess/ios/WebPageProxyIOS.mm:
3492         (WebKit::WebPageProxy::saveImageToLibrary):
3493         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
3494         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
3495         * WebProcess/WebPage/WebPage.h:
3496         * WebProcess/WebPage/WebPage.messages.in:
3497         * WebProcess/WebPage/ios/WebPageIOS.mm:
3498         (WebKit::rangeAtWordBoundaryForPosition):
3499         (WebKit::distanceBetweenRectsForPosition): Deleted.
3500         (WebKit::rectsEssentiallyTheSame): Deleted.
3501         (WebKit::unionDOMRanges): Deleted.
3502         (WebKit::computeEdgeCenter): Deleted.
3503         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
3504         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
3505         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
3506         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
3507         (WebKit::shouldExpand): Deleted.
3508         (WebKit::WebPage::changeBlockSelection): Deleted.
3509         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
3510         
3511 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
3512
3513         Don't have selections get stuck in editable elements
3514         https://bugs.webkit.org/show_bug.cgi?id=184483
3515
3516         Reviewed by Timothy Hatcher.
3517         
3518         When selecting in editable elements, if the keyboard does not come up, which is not required,
3519         then the selections are stuck in that element. If you try and select something in web content,
3520         it will only select in the editable element. By clearing the assisted node when clearing a selection,
3521         it no longer sticks. Also, textSelectionAssistant should not be used as if we are currently editing. 
3522         Change it to the function we created for that purpose in a pervious patch.
3523
3524         * UIProcess/ios/WKContentViewInteraction.mm:
3525         (-[WKContentView clearSelection]):
3526         (-[WKContentView _isInteractingWithAssistedNode]):
3527
3528 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3529
3530         [WPE] Move libWPEWebInspectorResources.so to pkglibdir
3531         https://bugs.webkit.org/show_bug.cgi?id=184379
3532
3533         Reviewed by Žan Doberšek.
3534
3535         This is important to allow parallel installation.
3536
3537         * PlatformWPE.cmake:
3538
3539 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
3540
3541         [WPE] Improve include hierarchy
3542         https://bugs.webkit.org/show_bug.cgi?id=184376
3543
3544         Reviewed by Žan Doberšek.
3545
3546         Install our headers under /usr/include/wpe-webkit-0.1/wpe instead of
3547         /usr/include/wpe-0.1/WPE/wpe. Too much WPE, not enough WebKit!
3548
3549         * PlatformWPE.cmake:
3550         * wpe/wpe-webkit.pc.in:
3551
3552 2018-04-11  Andy Estes  <aestes@apple.com>
3553
3554         [iOS] Add a mechanism for holding Wi-Fi assertions
3555         https://bugs.webkit.org/show_bug.cgi?id=184520
3556         <rdar://problem/39025726>
3557
3558         Reviewed by Sam Weinig.
3559
3560         Add plumbing for holding a Wi-Fi assertion on iOS as long as there are active
3561         network data tasks. This functionality is turned off by default right now.
3562
3563         * Configurations/Network-iOS.entitlements:
3564         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
3565         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3566         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
3567         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp: Added.
3568         (WebKit::ensureWiFiManagerClient): Create a global WiFiManagerClient when needed.
3569         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder): If this is the first active
3570         Wi-Fi assertion holder, set the client's type to kWiFiClientTypeBackground.
3571         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder): If the last active Wi-Fi
3572         assertion holder is being destroyed, set the client's type back to
3573         kWiFiClientTypeNormal.
3574         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Added.
3575         * Platform/Logging.h: Added a logging channel for Wi-Fi assertions.
3576         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
3577         * WebKit.xcodeproj/project.pbxproj:
3578
3579 2018-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3580
3581         [GTK] Switch to use always complex text code path
3582         https://bugs.webkit.org/show_bug.cgi?id=183285
3583
3584         Reviewed by Michael Catanzaro.
3585
3586         Now that we have branched for 2.20, it's a good time to try using complex text path always. We can simply force
3587         it for GTK+ port and see how it works for the whole release cycle and if we don't notice any issues or
3588         performance regressions we release 2.22 with complex text path forced. A debug env variable is added to switch
3589         back to auto without having to recompile. After 2.22 is released we can make a final decision and remove the env
3590         variable.
3591
3592         * UIProcess/gtk/WebProcessPoolGtk.cpp:
3593         (WebKit::WebProcessPool::platformInitializeWebProcess): Force complex text code path unless
3594         WEBKIT_FORCE_COMPLEX_TEXT is present and set to 0.
3595
3596 2018-04-11  Zan Dobersek  <zdobersek@igalia.com>
3597
3598         [WPE] Make WebKitWebViewBackend object mandatory for webkit_web_view_new*() constructors
3599         https://bugs.webkit.org/show_bug.cgi?id=184513
3600
3601         Reviewed by Michael Catanzaro.
3602
3603         webkit_web_view_new*() constructors should always expect a non-null
3604         WebKitWebViewBackend object, forcing the user to specify how the
3605         wpe_view_backend object is managed for the WebKitWebView that's being
3606         created.
3607
3608         webkitWebViewBackendCreateDefault() and the default
3609         _WebKitWebViewBackend() constructor are removed. WPE-specific
3610         webkit_web_view_new*() entrypoints are updated to bail if the passed-in
3611         WebKitWebViewBackend object is null. Documentation is updated
3612         accordingly.
3613
3614         * UIProcess/API/glib/WebKitWebView.cpp:
3615         (webkitWebViewConstructed):
3616         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
3617         (webkitWebViewBackendCreateDefault): Deleted.
3618         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
3619         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
3620         (webkit_web_view_new):
3621         (webkit_web_view_new_with_context):
3622         (webkit_web_view_new_with_related_view):
3623         (webkit_web_view_new_with_settings):
3624         (webkit_web_view_new_with_user_content_manager):
3625
3626 2018-04-11  Fujii Hironori  <Hironori.Fujii@sony.com>
3627
3628         [curl][WebKit] Implement NetworkDataTaskCurl
3629         https://bugs.webkit.org/show_bug.cgi?id=184488
3630
3631         Reviewed by Alex Christensen.
3632
3633         * NetworkProcess/NetworkDataTask.cpp:
3634         (WebKit::NetworkDataTask::create):
3635         * NetworkProcess/curl/NetworkDataTaskCurl.cpp: Added.
3636         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
3637         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
3638         (WebKit::NetworkDataTaskCurl::resume):
3639         (WebKit::NetworkDataTaskCurl::suspend):
3640         (WebKit::NetworkDataTaskCurl::cancel):
3641         (WebKit::NetworkDataTaskCurl::invalidateAndCancel):
3642         (WebKit::NetworkDataTaskCurl::state const):
3643         (WebKit::NetworkDataTaskCurl::createCurlRequest):
3644         (WebKit::NetworkDataTaskCurl::curlDidSendData):
3645         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
3646         (WebKit::NetworkDataTaskCurl::curlDidReceiveBuffer):
3647         (WebKit::NetworkDataTaskCurl::curlDidComplete):
3648         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
3649         (WebKit::NetworkDataTaskCurl::shouldRedirectAsGET):
3650         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
3651         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
3652         (WebKit::NetworkDataTaskCurl::restartWithCredential):
3653         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
3654         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
3655         * NetworkProcess/curl/NetworkDataTaskCurl.h: Added.
3656         * PlatformWin.cmake:
3657
3658 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3659
3660         [Extra zoom mode] Support pushing input view controllers onto the navigation stack
3661         https://bugs.webkit.org/show_bug.cgi?id=184397
3662         <rdar://problem/39265294>
3663
3664         Reviewed by Timothy Hatcher.
3665
3666         Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
3667         the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
3668         and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
3669         within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
3670         presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
3671         approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
3672         UINavigationController to hook into this behavior, with modal presentation as a fallback.
3673
3674         At a high level, this patch makes the following tweaks to implement this behavior:
3675
3676         1. Store the currently presented view controller using a single member variable
3677            (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
3678            which view controller to present or dismiss much more straightforward.
3679
3680         2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
3681            pushing an input view controller onto the navigation stack after presenting the focused form control view
3682            controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
3683
3684         3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
3685            navigation stack rather than presenting them modally means that we end up in a state where neither the
3686            WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
3687            Instead, have the WKTimePickerViewController actually become first responder when presenting.
3688
3689         4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
3690            -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
3691            presentation.
3692
3693         * UIProcess/ios/WKContentViewInteraction.h:
3694
3695         Remove the separate member variables for each type of input view controller, and instead have one to keep track
3696         of the current (and only) presented input view controller.
3697
3698         * UIProcess/ios/WKContentViewInteraction.mm:
3699         (-[WKContentView _willStartScrollingOrZooming]):
3700         (-[WKContentView _didEndScrollingOrZooming]):
3701         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3702         (-[WKContentView _stopAssistingNode]):
3703
3704         Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
3705
3706         (-[WKContentView reloadContextViewForPresentedListViewController]):
3707
3708         Adjust for consolidation of the different input view controller member variables to a single member (see changes
3709         in WKContentViewInteraction.h).
3710
3711         (-[WKContentView addFocusedFormControlOverlay]):
3712         (-[WKContentView removeFocusedFormControlOverlay]):
3713         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3714         (-[WKContentView dismissAllInputViewControllers:]):
3715
3716         Add an `animated` argument. In the case where a different view controller was presented after presenting the
3717         input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
3718         the web view or focus overlay underneath.
3719
3720         (-[WKContentView focusedFormControlViewDidSubmit:]):
3721         (-[WKContentView focusedFormControlViewDidCancel:]):
3722         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
3723         (-[WKContentView rectForFocusedFormControlView:]):
3724         (-[WKContentView nextRectForFocusedFormControlView:]):
3725         (-[WKContentView previousRectForFocusedFormControlView:]):
3726         (-[WKContentView scrollViewForFocusedFormControlView:]):
3727         (-[WKContentView actionNameForFocusedFormControlView:]):
3728         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
3729         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
3730         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
3731         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
3732         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
3733
3734         Boilerplate renaming of focus overlay delegate methods.
3735
3736         (-[WKContentView _wheelChangedWithEvent:]):
3737
3738         Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
3739
3740         (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
3741         (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
3742
3743         Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
3744
3745         (-[WKContentView dismissAllInputViewControllers]): Deleted.
3746         (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
3747         (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
3748         (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
3749         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
3750         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
3751         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
3752         (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
3753         (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
3754         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
3755         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
3756         (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
3757         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
3758         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
3759         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
3760
3761         Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
3762         the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
3763         present the focused form overlay as a separate view controller using the UINavigationController, and then
3764         immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
3765         updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
3766         this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
3767         overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
3768         the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
3769
3770         * WebKit.xcodeproj/project.pbxproj:
3771
3772 2018-04-11  Youenn Fablet  <youenn@apple.com>
3773
3774         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
3775         https://bugs.webkit.org/show_bug.cgi?id=184374
3776
3777         Reviewed by Chris Dumez.
3778
3779         Pass full FetchOptions parameters as part of NetworkResourceLoadParameters.
3780         This will allow handling redirection mode as well as credentials in case of cross origin redirections.
3781         In case of SameOrigin credentials and there is a redirection from same-origin to cross-origin,
3782         we will be able to stop using credentials without going to WebProcess.
3783
3784         To handle properly cross-origin checks, we have to be able to use SecurityOrigin as in WebProcess.
3785         We make WebProcess sends Origin Access White list information to NetworkProcess.
3786         This allows supporting the white list when doing loading in NetworkProcess.
3787         This only works consistently if all WebProcesses share the same whitelist.
3788
3789         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3790         (WebKit::NetworkConnectionToWebProcess::loadPing):
3791         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
3792         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
3793         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
3794         * NetworkProcess/NetworkConnectionToWebProcess.h:
3795         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
3796         * NetworkProcess/NetworkLoadChecker.cpp:
3797         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3798         (WebKit::NetworkLoadChecker::checkRedirection):
3799         (WebKit::NetworkLoadChecker::continueCheckingRequest):
3800         (WebKit::NetworkLoadChecker::checkCORSRequest):
3801         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
3802         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3803         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
3804         * NetworkProcess/NetworkLoadChecker.h:
3805         (WebKit::NetworkLoadChecker::create):
3806         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3807         (WebKit::NetworkResourceLoadParameters::encode const):
3808         (WebKit::NetworkResourceLoadParameters::decode):
3809         * NetworkProcess/NetworkResourceLoadParameters.h:
3810         * NetworkProcess/PingLoad.cpp:
3811         (WebKit::PingLoad::PingLoad):
3812         (WebKit::PingLoad::willPerformHTTPRedirection):
3813         * NetworkProcess/PingLoad.h:
3814         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3815         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
3816         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
3817         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
3818         * WebProcess/Network/WebLoaderStrategy.cpp:
3819         (WebKit::WebLoaderStrategy::startPingLoad):
3820
3821 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3822
3823         [GTK] WaylandCompositorDisplay leaks its wl_display
3824         https://bugs.webkit.org/show_bug.cgi?id=184406
3825
3826         Reviewed by Carlos Garcia Campos.
3827
3828         Since we allocate our own wl_display here, need to chain up to the parent constructor
3829         passing NativeDisplayOwned::Yes, or it won't ever be released. Move the initialize call to
3830         the create function to ensure it's called after the constructor completes.
3831
3832         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
3833         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
3834         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
3835
3836 2018-04-11  Youenn Fablet  <youenn@apple.com>
3837
3838         Use more r-values in NetworkResourceLoader
3839         https://bugs.webkit.org/show_bug.cgi?id=184478
3840
3841         Reviewed by Chris Dumez.
3842
3843         Pass load parameters as r-values to remove some unneeded copies.
3844         Ditto for ResourceRequest inside NetworkResourceLoader.
3845
3846         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3847         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
3848         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
3849         * NetworkProcess/NetworkConnectionToWebProcess.h:
3850         * NetworkProcess/NetworkResourceLoader.cpp:
3851         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
3852         (WebKit::NetworkResourceLoader::start):
3853         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3854         (WebKit::NetworkResourceLoader::startNetworkLoad):
3855         (WebKit::NetworkResourceLoader::continueWillSendRequest):
3856         (WebKit::NetworkResourceLoader::validateCacheEntry):
3857         * NetworkProcess/NetworkResourceLoader.h:
3858
3859 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3860
3861         [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
3862         https://bugs.webkit.org/show_bug.cgi?id=184352
3863         <rdar://problem/39237683>
3864
3865         Reviewed by Andy Estes.
3866
3867         Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
3868         any information requested in the UI process that is dependent on the `title` of the focused element is broken
3869         in the case of select elements. An existing example of this is the title of the table view controller used to
3870         present select menus on iPad.
3871
3872         To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
3873         HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
3874         zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
3875         controller's title.
3876
3877         Test: fast/forms/ios/ipad/select-with-title.html
3878
3879         * UIProcess/API/Cocoa/WKWebView.mm:
3880         (-[WKWebView selectFormPopoverTitle]):
3881         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3882
3883         Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
3884         element.
3885
3886         * UIProcess/ios/WKContentViewInteraction.h:
3887         * UIProcess/ios/WKContentViewInteraction.mm:
3888         (-[WKContentView selectFormPopoverTitle]):
3889         * UIProcess/ios/forms/WKFormSelectControl.h:
3890         * UIProcess/ios/forms/WKFormSelectControl.mm:
3891         (-[WKFormSelectControl selectFormPopoverTitle]):
3892         * UIProcess/ios/forms/WKFormSelectPopover.h:
3893         * UIProcess/ios/forms/WKFormSelectPopover.mm:
3894         (-[WKSelectPopover initWithView:hasGroups:]):
3895         (-[WKSelectPopover tableViewController]):
3896         * WebProcess/WebPage/ios/WebPageIOS.mm:
3897
3898         Always send the title across if the focused node is an HTMLElement.
3899
3900         (WebKit::WebPage::getAssistedNodeInformation):
3901
3902 2018-04-11  Ryan Haddad  <ryanhaddad@apple.com>
3903
3904         Unreviewed, rolling out r230508.
3905
3906         Breaks internal builds.
3907
3908         Reverted changeset:
3909
3910         "Remove block selection code"
3911         https://bugs.webkit.org/show_bug.cgi?id=184470
3912         https://trac.webkit.org/changeset/230508
3913
3914 2018-04-11  Antoine Quint  <graouts@apple.com>
3915
3916         [Web Animations] Turn Web Animations on by default
3917         https://bugs.webkit.org/show_bug.cgi?id=184491
3918
3919         Reviewed by Simon Fraser.
3920
3921         * Shared/WebPreferences.yaml:
3922
3923 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
3924
3925         Unreviewed test fix after r230468
3926
3927         Roll out an assertion added in r230468 that should not be present
3928         until https://bugs.webkit.org/show_bug.cgi?id=184451 is landed.
3929
3930         * Shared/mac/HangDetectionDisablerMac.mm:
3931         (WebKit::setClientsMayIgnoreEvents):
3932
3933 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
3934
3935         Unreviewed follow-up to r230468.
3936
3937         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
3938
3939         * UIProcess/mac/PageClientImplMac.mm:
3940         (WebKit::PageClientImpl::isViewWindowActive):
3941         (WebKit::PageClientImpl::setCursor):
3942
3943 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
3944
3945         [Win] Add UserAgentWin.cpp
3946         https://bugs.webkit.org/show_bug.cgi?id=184438
3947
3948         Reviewed by Michael Catanzaro.
3949
3950         * WebProcess/WebPage/win/WebPageWin.cpp:
3951         (WebKit::WebPage::platformUserAgent const):
3952         Use WebCore::standardUserAgentForURL.
3953
3954 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
3955
3956         Remove block selection code
3957         https://bugs.webkit.org/show_bug.cgi?id=184470
3958
3959         Reviewed by Timothy Hatcher.
3960         
3961         Remove block selection code that isn't run and is currently not even used.
3962         Had to put this back in for a bug in the mid-year release, but we're past that
3963         so it's time for this to go away.
3964
3965         * Platform/spi/ios/UIKitSPI.h:
3966         * UIProcess/PageClient.h:
3967         * UIProcess/WebPageProxy.h:
3968         * UIProcess/WebPageProxy.messages.in:
3969         * UIProcess/ios/PageClientImplIOS.h:
3970         * UIProcess/ios/PageClientImplIOS.mm:
3971         (WebKit::PageClientImpl::stopAssistingNode):
3972         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
3973         * UIProcess/ios/WKContentViewInteraction.h:
3974         * UIProcess/ios/WKContentViewInteraction.mm:
3975         (toSelectionHandlePosition): Deleted.
3976         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
3977         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
3978         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
3979         * UIProcess/ios/WebPageProxyIOS.mm:
3980         (WebKit::WebPageProxy::saveImageToLibrary):
3981         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
3982         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
3983         * WebProcess/WebPage/WebPage.h:
3984         * WebProcess/WebPage/WebPage.messages.in:
3985         * WebProcess/WebPage/ios/WebPageIOS.mm:
3986         (WebKit::rangeAtWordBoundaryForPosition):
3987         (WebKit::distanceBetweenRectsForPosition): Deleted.
3988         (WebKit::rectsEssentiallyTheSame): Deleted.
3989         (WebKit::unionDOMRanges): Deleted.
3990         (WebKit::computeEdgeCenter): Deleted.
3991         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
3992         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
3993         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
3994         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
3995         (WebKit::shouldExpand): Deleted.
3996         (WebKit::WebPage::changeBlockSelection): Deleted.