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