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