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