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