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