[Win] Add UserAgentWin.cpp
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2
3         [Win] Add UserAgentWin.cpp
4         https://bugs.webkit.org/show_bug.cgi?id=184438
5
6         Reviewed by Michael Catanzaro.
7
8         * WebProcess/WebPage/win/WebPageWin.cpp:
9         (WebKit::WebPage::platformUserAgent const):
10         Use WebCore::standardUserAgentForURL.
11
12 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
13
14         Remove block selection code
15         https://bugs.webkit.org/show_bug.cgi?id=184470
16
17         Reviewed by Timothy Hatcher.
18         
19         Remove block selection code that isn't run and is currently not even used.
20         Had to put this back in for a bug in the mid-year release, but we're past that
21         so it's time for this to go away.
22
23         * Platform/spi/ios/UIKitSPI.h:
24         * UIProcess/PageClient.h:
25         * UIProcess/WebPageProxy.h:
26         * UIProcess/WebPageProxy.messages.in:
27         * UIProcess/ios/PageClientImplIOS.h:
28         * UIProcess/ios/PageClientImplIOS.mm:
29         (WebKit::PageClientImpl::stopAssistingNode):
30         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
31         * UIProcess/ios/WKContentViewInteraction.h:
32         * UIProcess/ios/WKContentViewInteraction.mm:
33         (toSelectionHandlePosition): Deleted.
34         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
35         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
36         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
37         * UIProcess/ios/WebPageProxyIOS.mm:
38         (WebKit::WebPageProxy::saveImageToLibrary):
39         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
40         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
41         * WebProcess/WebPage/WebPage.h:
42         * WebProcess/WebPage/WebPage.messages.in:
43         * WebProcess/WebPage/ios/WebPageIOS.mm:
44         (WebKit::rangeAtWordBoundaryForPosition):
45         (WebKit::distanceBetweenRectsForPosition): Deleted.
46         (WebKit::rectsEssentiallyTheSame): Deleted.
47         (WebKit::unionDOMRanges): Deleted.
48         (WebKit::computeEdgeCenter): Deleted.
49         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
50         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
51         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
52         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
53         (WebKit::shouldExpand): Deleted.
54         (WebKit::WebPage::changeBlockSelection): Deleted.
55         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
56
57 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
58
59         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
60         https://bugs.webkit.org/show_bug.cgi?id=184435
61         <rdar://problem/38726260>
62
63         Reviewed by Dean Jackson.
64
65         Adds support for an alternate codepath when computing a zoom rect when double tapping that doesn't take the hit-
66         tested node into account, and instead cycles the zoom scale between 2 fixed values (in addition to the initial
67         scale). In the next patch, these fixed scales will be determined by computing zoom scales needed to make most of
68         the text on the page legible (i.e. the first text legibility zoom scale), and another to make all of the text on
69         the page legible, with the exception of outliers (this is the second text legibility zoom scale).
70
71         See comments below for more detail.
72
73         * UIProcess/Cocoa/ViewGestureController.h:
74         * UIProcess/Cocoa/ViewGestureController.messages.in:
75         * UIProcess/ios/SmartMagnificationController.h:
76         * UIProcess/ios/SmartMagnificationController.messages.in:
77         * UIProcess/ios/SmartMagnificationController.mm:
78         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
79         * UIProcess/mac/ViewGestureControllerMac.mm:
80         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
81         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
82         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
83
84         Rename the boolean `isReplacedElement` argument to `fitEntireRect` instead. The UI process only uses this on iOS
85         to determine whether or not to fit the entire element rect to the viewport and add padding. This patch renames
86         this variable because we are not zooming to a replaced element in the case where text legibility on the page
87         (rather than element geometry) is being used to figure out the zoom scale, but we still want to fit the entire
88         target rect to the viewport.
89
90         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
91
92         If text legiblity zoom scaling is preferred, then compute first and second-level text legibility zoom scales to
93         zoom to upon double tap (where the second zoom scale is greater than the first). To choose a target zoom
94         scale, choose the lowest target zoom scale that is at least a small amount less than the current scale. If
95         neither of the two scales fulfill this description, then zoom back out to the initial scale. This has the effect
96         of consistently cycling between all three zoom scales as the user double taps.
97
98         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
99
100         Introduce a new helper method that computes and caches target scales to zoom to when double tapping to zoom. If
101         a cached pair of target scales is already present, it skips this computation and immediately returns it.
102
103         (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
104         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
105
106         Factor out logic to compute min and max zoom scales into a separate helper, and call it from both
107         computeZoomInformationForNode and computeTextLegibilityScales.
108
109         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
110
111         Invalidate cached text legibility scales when layout is triggered.
112
113         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
114         * WebProcess/WebPage/WebPage.cpp:
115         (WebKit::WebPage::mainFrameDidLayout):
116         * WebProcess/WebPage/WebPage.h:
117         (WebKit::WebPage::viewportConfiguration const):
118
119         Expose WebPage's ViewportConfiguration as a const reference.
120
121         * WebProcess/WebPage/ios/WebPageIOS.mm:
122         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
123
124         Adds a platform hook for opting into text-legibility-based zoom scaling instead of regular hit-testing-based
125         zoom scaling heuristics.
126
127 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
128
129         Fix availability annotations for _WKAttachment SPI
130         https://bugs.webkit.org/show_bug.cgi?id=184473
131         <rdar://problem/39319732>
132
133         Reviewed by Dan Bernstein.
134
135         _WKAttachmentInfo is available in WK_MAC_TBA and WK_IOS_TBA, but the SPI method -[_WKAttachment requestInfo:]
136         is currently available in macOS 10.13.4 and iOS 11.3. Instead, the availability of this SPI should match the
137         availability of the SPI object it depends on.
138
139         * UIProcess/API/Cocoa/_WKAttachment.h:
140
141 2018-04-10  Chris Dumez  <cdumez@apple.com>
142
143         Avoid constructing a service worker RegistrationStore for private sessions
144         https://bugs.webkit.org/show_bug.cgi?id=184463
145         <rdar://problem/36613948>
146
147         Reviewed by Youenn Fablet.
148
149         Avoid constructing a service worker RegistrationStore for private sessions since there
150         is no need for persistence and the registrationDatabaseDirectory is the empty string in
151         such cases.
152
153         * StorageProcess/StorageProcess.cpp:
154         (WebKit::StorageProcess::initializeWebsiteDataStore):
155
156 2018-04-10  Andy Estes  <aestes@apple.com>
157
158         [iOS] Navigate to URL and page number annotations in WKPDFView
159         https://bugs.webkit.org/show_bug.cgi?id=184410
160
161         Reviewed by Timothy Hatcher.
162
163         Implemented navigation to URL and page number (same-document) link annotations in PDFs.
164
165         * UIProcess/ios/WKPDFView.mm:
166         (-[WKPDFView _scrollToURLFragment:]):
167         (-[WKPDFView web_didSameDocumentNavigation:]):
168         (-[WKPDFView pdfHostViewController:updatePageCount:]):
169         (-[WKPDFView pdfHostViewController:goToURL:]):
170         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
171
172 2018-04-10  Andy Estes  <aestes@apple.com>
173
174         [iOS] WKPDFView should conform to _WKWebViewPrintProvider
175         https://bugs.webkit.org/show_bug.cgi?id=184471
176
177         Reviewed by Dan Bernstein.
178
179         * UIProcess/API/Cocoa/WKWebView.mm:
180         (-[WKWebView _printProvider]):
181
182         The print provider will always be either _contentView or _customContentView, but
183         might not be _currentContentView.
184
185         * UIProcess/ios/WKPDFView.mm:
186         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
187
188         Asked _hostViewController for the page count, clamped to 1 if
189         -[_WKWebViewPrintFormatter snapshotFirstPage] is YES.
190
191         (-[WKPDFView _wk_printedDocument]):
192
193         Created a CGPDFDocumentRef from _data and returned it.
194
195 2018-04-10  Youenn Fablet  <youenn@apple.com>
196
197         Beacon redirect responses should be CORS validated
198         https://bugs.webkit.org/show_bug.cgi?id=184378
199
200         Reviewed by Chris Dumez.
201
202         Add CORS checks to any redirection response if mode is CORS.
203         Update response tainting and redirected accordingly.
204
205         * NetworkProcess/NetworkLoadChecker.cpp:
206         (WebKit::NetworkLoadChecker::checkRedirection):
207         (WebKit::NetworkLoadChecker::validateResponse):
208         * NetworkProcess/NetworkLoadChecker.h:
209         * NetworkProcess/PingLoad.cpp:
210         (WebKit::PingLoad::willPerformHTTPRedirection):
211
212 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
213
214         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
215         https://bugs.webkit.org/show_bug.cgi?id=184268
216         <rdar://problem/39144446>
217
218         Reviewed by Chris Dumez.
219
220         Webpage for multipart stream responses failed to refresh because content policy was set to 
221         be ignore when provisonalDocumentLoader was null and navigation ID could not be retrieved. 
222         As loading should not stop in this case, we set navigation ID 0 and still ask for content 
223         policy.
224
225         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
226         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
227
228 2018-04-10  Andy Estes  <aestes@apple.com>
229
230         [iOS] Use PDFKit to render PDFs in WKWebView
231         https://bugs.webkit.org/show_bug.cgi?id=184387
232
233         Reviewed by Beth Dakin.
234
235         Adopted PDFHostViewController for rendering PDFs in WKWebView.
236
237         This patch implements rendering the PDF document and page number indicator. Link
238         navigation, find-in-page, and printing will be implemented in follow-up patches.
239
240         WKLegacyPDFView is still the default PDF view.
241
242         * Configurations/WebKit.xcconfig:
243
244         Linked WebKit with PDFKit on iOS.
245
246         * UIProcess/API/Cocoa/WKWebView.mm:
247         (-[WKWebView _currentContentView]):
248         (-[WKWebView viewForZoomingInScrollView:]):
249
250         When WKPDFView loads a PDF document, it replaces itself with a view vended by
251         PDFHostViewController as the WKScrollView's content view. Abstracted WKWebView's
252         concept of the "current content view" to be either the WKContentView or a view of
253         the custom content view's choosing (-web_contentView).
254
255         (-[WKWebView scrollViewWillBeginZooming:withView:]):
256         (-[WKWebView scrollViewDidZoom:]):
257         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
258
259         Forwarded these calls to _customContentView if it responds to the equivalent
260         WKWebViewContentProvider selectors.
261
262         * UIProcess/Cocoa/WKWebViewContentProvider.h:
263
264         Defined new protocol selectors.
265
266         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
267         (-[WKWebViewContentProviderRegistry init]):
268         * UIProcess/ios/WKLegacyPDFView.h:
269         * UIProcess/ios/WKLegacyPDFView.mm:
270
271         Changed ENABLE(WKPDFVIEW) to ENABLE(WKLEGACYPDFVIEW).
272
273         (-[WKLegacyPDFView web_contentView]):
274
275         Added. Returns self as the content view.
276
277         * UIProcess/ios/WKPDFView.h: Added.
278         * UIProcess/ios/WKPDFView.mm: Added.
279         (-[WKPDFView dealloc]):
280
281         Removed the host view and page number indicator from their superviews.
282
283         (-[WKPDFView gestureRecognizerShouldBegin:]):
284
285         Forwarded to _hostViewController.
286
287         (-[WKPDFView web_initWithFrame:webView:]):
288
289         Set ours and the scroll view's background color to UIColor.grayColor to match
290         WKLegacyPDFView.
291
292         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
293
294         Created a PDFHostViewController and set its root view as the scroll view's content
295         view after removing the WKPDFView itself. This allows WKPDFView to act as a
296         placeholder content view until the PDF is loaded. Added the host view controller's
297         page number indicator to the fixed overlay view. Finally, loaded the PDF document
298         by calling -[PDFHostViewController setDocumentData:withScrollView:].
299
300         (-[WKPDFView _offsetForPageNumberIndicator]):
301
302         Computed an offset for the page number indicator like WKLegacyPDFView did, taking
303         into account the overlaid accessory views inset, computed unobscured safe area
304         inset, and computed obscured inset.
305
306         (-[WKPDFView _movePageNumberIndicatorToPoint:animated:]):
307
308         Moved the page number indicator using the margin and animation duration from
309         WKLegacyPDFView.
310
311         (-[WKPDFView _updateLayoutAnimated:]):
312
313         Added a convenience method to update the PDF view layout and position the page
314         number indicator.
315
316         (-[WKPDFView web_setMinimumSize:]):
317
318         Updated our own frame in case we are still the placeholder content view.
319         Called -_updateLayoutAnimated:.
320
321         (-[WKPDFView web_setOverlaidAccessoryViewsInset:]):
322
323         Stored the inset and called -_updateLayoutAnimated:.
324
325         (-[WKPDFView web_computedContentInsetDidChange]):
326
327         Called -_updateLayoutAnimated:.
328
329         (-[WKPDFView web_setFixedOverlayView:]):
330
331         Stored the fixed overlay view.
332
333         (-[WKPDFView web_didSameDocumentNavigation:]):
334         (-[WKPDFView web_countStringMatches:options:maxCount:]):
335         (-[WKPDFView web_findString:options:maxCount:]):
336         (-[WKPDFView web_hideFindUI]):
337
338         Added FIXMEs.
339
340         (-[WKPDFView web_contentView]):
341
342         If there is a host view controller, return its root view. Otherwise, return self.
343
344         (-[WKPDFView web_scrollViewDidScroll:]):
345         (-[WKPDFView web_scrollViewWillBeginZooming:withView:]):
346         (-[WKPDFView web_scrollViewDidEndZooming:withView:atScale:]):
347         (-[WKPDFView web_scrollViewDidZoom:]):
348
349         Called -[PDFHostViewController updatePDFViewLayout].
350
351         (-[WKPDFView web_dataRepresentation]):
352
353         Returned _data.
354
355         (-[WKPDFView web_suggestedFilename]):
356
357         Returned _suggestedFilename.
358
359         (-[WKPDFView web_isBackground]):
360
361         Returned self.isBackground.
362
363         * UIProcess/ios/WKSystemPreviewView.mm:
364         (-[WKSystemPreviewView web_contentView]):
365
366         Added. Returns self as the content view.
367
368         * WebKit.xcodeproj/project.pbxproj:
369
370 2018-04-10  Miguel Gomez  <magomez@igalia.com>
371
372         [GTK][WPE] Race condition when destroying webprocesses
373         https://bugs.webkit.org/show_bug.cgi?id=184445
374
375         Reviewed by Carlos Garcia Campos.
376
377         Ensure that the WebProcess is properly closing its pages when it's exiting because
378         the UIProcess has invalidated the IPC connection.
379
380         * WebProcess/WebProcess.cpp:
381         (WebKit::WebProcess::didClose):
382
383 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
384
385         Add missing availability macros after r230462
386         https://bugs.webkit.org/show_bug.cgi?id=184426
387
388         Reviewed by Timothy Hatcher.
389
390         Annotate new SPI added in r230462 with the appropriate availability macros.
391
392         * UIProcess/API/Cocoa/WKViewPrivate.h:
393         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
394
395 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
396
397         Add ProcessPrivilege assertions to places that access NSApp
398         https://bugs.webkit.org/show_bug.cgi?id=184322
399         <rdar://problem/39194560>
400
401         Reviewed by Per Arne Vollan.
402
403         Add ProcessPrivilege assertions to places where we interact with NSApp so
404         that we can prevent accidentally using them in the WebContent process.
405
406         * Shared/mac/ChildProcessMac.mm:
407         (WebKit::ChildProcess::stopNSAppRunLoop):
408         * Shared/mac/HangDetectionDisablerMac.mm:
409         (WebKit::setClientsMayIgnoreEvents):
410         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
411         (WebKit::WebProcessPool::platformInitializeWebProcess):
412         * UIProcess/Cocoa/WebViewImpl.mm:
413         (WebKit::WebViewImpl::WebViewImpl):
414         (WebKit::WebViewImpl::becomeFirstResponder):
415         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
416         (WebKit::WebViewImpl::validateUserInterfaceItem):
417         (WebKit::WebViewImpl::startSpeaking):
418         (WebKit::WebViewImpl::stopSpeaking):
419         (WebKit::applicationFlagsForDrag):
420         (WebKit::WebViewImpl::doneWithKeyEvent):
421         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
422         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
423         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
424         (WebKit::PluginProcessProxy::enterFullscreen):
425         (WebKit::PluginProcessProxy::beginModal):
426         (WebKit::PluginProcessProxy::endModal):
427         * UIProcess/mac/DisplayLink.cpp:
428         (WebKit::DisplayLink::DisplayLink):
429         (WebKit::DisplayLink::~DisplayLink):
430         * UIProcess/mac/PageClientImplMac.mm:
431         (WebKit::PageClientImpl::isViewWindowActive):
432         (WebKit::PageClientImpl::setCursor):
433         * UIProcess/mac/WebPageProxyMac.mm:
434         (WebKit::WebPageProxy::getIsSpeaking):
435         (WebKit::WebPageProxy::speak):
436         (WebKit::WebPageProxy::stopSpeaking):
437         (WebKit::WebPageProxy::startDisplayLink):
438         * UIProcess/mac/WebPopupMenuProxyMac.mm:
439         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
440
441 2018-04-09  John Wilander  <wilander@apple.com>
442
443         Refactor Ignore HSTS code
444         https://bugs.webkit.org/show_bug.cgi?id=184433
445         <rdar://problem/39298238>
446
447         Reviewed by Darin Adler.
448
449         This patch refactors our ignore HSTS code. The convenience functions are moved
450         out of CFNetwork SPI in PAL, and into where they are used. It also switches
451         from performSelector: calls to straight function calls, after checking that
452         there is a responder.
453
454         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
455         (schemeWasUpgradedDueToDynamicHSTS):
456         (setIgnoreHSTS):
457         (ignoreHSTS):
458             Add convenience functions here since they were moved out of
459             CFNetworkSPI.h.
460
461 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
462
463         Rename UNUSED to BUNUSED
464         https://bugs.webkit.org/show_bug.cgi?id=184093
465
466         Reviewed by Yusuke Suzuki.
467
468         * UIProcess/API/Cocoa/WKWebView.mm:
469         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
470
471 2018-04-09  Timothy Hatcher  <timothy@apple.com>
472
473         Add support for setting a background color on WKWebView and WKView
474         https://bugs.webkit.org/show_bug.cgi?id=184426
475
476         Reviewed by Wenson Hsieh.
477
478         * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property.
479         * UIProcess/API/Cocoa/WKWebView.mm:
480         (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl.
481         (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl.
482         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property.
483         * UIProcess/API/mac/WKView.mm:
484         (-[WKView _backgroundColor]): Added. Call through to WebViewImpl.
485         (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl.
486         * UIProcess/Cocoa/WebViewImpl.h:
487         * UIProcess/Cocoa/WebViewImpl.mm:
488         (WebKit::WebViewImpl::setBackgroundColor): Added.
489         (WebKit::WebViewImpl::backgroundColor const): Added.
490         (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set.
491
492 2018-04-09  Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
493
494         [WinCairo] Add WebKit Shared/win event files for wincairo webkit
495         https://bugs.webkit.org/show_bug.cgi?id=183043
496
497         Reviewed by Brent Fulgham.
498
499         * Shared/NativeWebKeyboardEvent.h:
500         (WebKit::NativeWebKeyboardEvent::nativeEvent const):
501         * Shared/NativeWebMouseEvent.h:
502         (WebKit::NativeWebMouseEvent::nativeEvent const):
503         * Shared/NativeWebTouchEvent.h:
504         * Shared/NativeWebWheelEvent.h:
505         (WebKit::NativeWebWheelEvent::nativeEvent const):
506         * Shared/win/NativeWebKeyboardEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
507         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
508         * Shared/win/NativeWebMouseEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
509         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
510         * Shared/win/NativeWebTouchEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebTouchEvent.h.
511         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
512         * Shared/win/NativeWebWheelEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
513         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
514         * Shared/win/WebEventFactory.cpp: Added.
515         (WebKit::relativeCursorPosition):
516         (WebKit::point):
517         (WebKit::horizontalScrollChars):
518         (WebKit::verticalScrollLines):
519         (WebKit::clickCount):
520         (WebKit::IsKeyInDownState):
521         (WebKit::modifiersForEvent):
522         (WebKit::modifiersForCurrentKeyState):
523         (WebKit::keyboardEventTypeForEvent):
524         (WebKit::isSystemKeyEvent):
525         (WebKit::isKeypadEvent):
526         (WebKit::textFromEvent):
527         (WebKit::unmodifiedTextFromEvent):
528         (WebKit::keyIdentifierFromEvent):
529         (WebKit::WebEventFactory::createWebMouseEvent):
530         (WebKit::WebEventFactory::createWebWheelEvent):
531         (WebKit::WebEventFactory::createWebKeyboardEvent):
532         (WebKit::WebEventFactory::createWebTouchEvent):
533         * Shared/win/WebEventFactory.h: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
534         (WebKit::createNativeEvent):
535
536 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
537
538         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
539         https://bugs.webkit.org/show_bug.cgi?id=184344
540         <rdar://problem/39224969>
541
542         Reviewed by Per Arne Vollan.
543
544         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
545         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
546         we do not want to allow in the WebContent process.
547
548         Instead, we should just use the cached screen information the WebContent process already possesses.
549
550         This patch makes the following changes:
551         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
552            the WindowServer directly.
553         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
554            the user space version of the coordinates. A nil Window just means we want to get coordinates in
555            terms of the primary display.
556         3. Keep track of the primary display so we can refer to it later.
557         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
558         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
559            than whichever screen happened to hash to the lowest value.
560
561         Reviewed by Per Arne Vollan.
562
563         * UIProcess/WebProcessPool.cpp:
564         (WebKit::displayReconfigurationCallBack): Update for new getScreenProperties implementation.
565         (WebKit::WebProcessPool::initializeNewWebProcess): Ditto.
566         * WebProcess/WebProcess.cpp:
567         (WebKit::WebProcess::setScreenProperties): Ditto.
568         * WebProcess/WebProcess.h:
569         * WebProcess/WebProcess.messages.in: Ditto.
570
571 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
572
573         [WPE] Add API version to library soname and pkg-config files
574         https://bugs.webkit.org/show_bug.cgi?id=180608
575
576         Reviewed by Žan Doberšek.
577
578         * PlatformWPE.cmake:
579         * wpe/wpe-webkit.pc.in:
580
581 2018-04-09  Jer Noble  <jer.noble@apple.com>
582
583         Fix the selection assistant selectionView build
584         https://bugs.webkit.org/show_bug.cgi?id=184423
585         <rdar://problem/39288235>
586
587         Reviewed by Wenson Hsieh.
588
589         * Platform/spi/ios/UIKitSPI.h:
590         * UIProcess/ios/WKContentView.mm:
591         (-[WKContentView _didExitStableState]):
592         * UIProcess/ios/WKContentViewInteraction.mm:
593         (-[WKContentView _updateChangedSelection:]):
594
595 2018-04-09  Megan Gardner  <megan_gardner@apple.com>
596
597         Switch to UIWKTextInteractionAssistant for non-editable text
598         https://bugs.webkit.org/show_bug.cgi?id=182834
599
600         Switch to only using one assistant for text selection.
601
602         Reviewed by Timothy Hatcher and Andy Estes.
603
604         * UIProcess/ios/WKContentViewInteraction.mm:
605         (-[WKContentView useSelectionAssistantWithGranularity:]):
606
607 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
608
609         Unreviewed, move 'using namespace' back to the right place after r230429
610
611         * Shared/glib/ProcessExecutablePathGLib.cpp:
612
613 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
614
615         Unreviewed, rolling out r230390.
616
617         Broke accelerated compositing
618
619         Reverted changeset:
620
621         "[GTK] WaylandCompositorDisplay leaks its wl_display"
622         https://bugs.webkit.org/show_bug.cgi?id=184406
623         https://trac.webkit.org/changeset/230390
624
625 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
626
627         [Extra zoom mode] Disable fast clicking by default in extra zoom mode
628         https://bugs.webkit.org/show_bug.cgi?id=184411
629         <rdar://problem/38726867>
630
631         Reviewed by Andy Estes.
632
633         As it turns out, existing fast-clicking heuristics don't work so well in extra zoom mode. Even at device-width,
634         since the page is scaled to fit within the viewport, having single taps take precedence over double taps leads
635         to a confusing experience when trying to double tap to zoom further on content that contains links and other
636         click targets. Revert to legacy behavior here by disabling these heuristics.
637
638         * UIProcess/API/Cocoa/WKWebView.mm:
639         (-[WKWebView _initializeWithConfiguration:]):
640
641 2018-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
642
643         [Extra zoom mode] Add an SPI hook for clients to opt in to focus overlay UI
644         https://bugs.webkit.org/show_bug.cgi?id=184370
645         <rdar://problem/39250494>
646
647         Reviewed by Timothy Hatcher and Andy Estes.
648
649         Add a new SPI hook for internal clients to opt in to showing the focused form control overlay. By default, the
650         overlay is not shown.
651
652         * UIProcess/API/Cocoa/_WKInputDelegate.h:
653
654 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
655
656         [WPE] Use GNU install directories
657         https://bugs.webkit.org/show_bug.cgi?id=184377
658
659         Reviewed by Carlos Garcia Campos.
660
661         Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
662         WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
663
664         * PlatformWPE.cmake:
665         * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
666         (WebKit::getExecutablePath):
667         (WebKit::findWebKitProcess):
668         (WebKit::executablePathOfWebProcess):
669         (WebKit::executablePathOfPluginProcess):
670         (WebKit::executablePathOfNetworkProcess):
671         (WebKit::executablePathOfStorageProcess):
672         * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
673         * SourcesGTK.txt:
674         * SourcesWPE.txt:
675
676 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
677
678         [GTK] WaylandCompositorDisplay leaks its wl_display
679         https://bugs.webkit.org/show_bug.cgi?id=184406
680
681         Reviewed by Carlos Garcia Campos.
682
683         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
684         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
685         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): Fix the leak.
686
687 2018-04-08  Zan Dobersek  <zdobersek@igalia.com>
688
689         Non-Cocoa ports use default directory for ServiceWorker data during testing
690         https://bugs.webkit.org/show_bug.cgi?id=183784
691
692         Reviewed by Youenn Fablet.
693
694         Add API to WKWebsiteDataStore that enables setting and retrieving the
695         service worker registration directory for a given data store object.
696         This enables setting the temporary directory for testing purposes in
697         WebKitTestRunner.
698
699         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
700         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
701         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
702         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
703
704 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
705
706         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
707         https://bugs.webkit.org/show_bug.cgi?id=184127
708
709         Reviewed by Konstantin Tokarev.
710
711         * CMakeLists.txt: Link with WebCore as private,
712         WebCoreHeaderInterface as public to WebKit if WebCore is a static
713         library.
714         * CMakeLists.txt:
715         * PlatformGTK.cmake: Added PRIVATE keyword for WebKit_LIBRARIES.
716         * PlatformWPE.cmake: Ditto.
717         * PlatformWin.cmake: Ditto.
718
719 2018-04-08  Andy Estes  <aestes@apple.com>
720
721         [iOS] WKContentView and WKLegacyPDFView should share application state tracking logic
722         https://bugs.webkit.org/show_bug.cgi?id=184402
723
724         Reviewed by Dan Bernstein.
725
726         WKContentView and WKLegacyPDFView have nearly identical logic for tracking
727         application foreground state. Let's share it so we can more easily create new
728         content views with proper application state tracking.
729
730         * UIProcess/ios/WKApplicationStateTrackingView.h: Added.
731         * UIProcess/ios/WKApplicationStateTrackingView.mm: Added.
732         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
733         (-[WKApplicationStateTrackingView willMoveToWindow:]):
734         (-[WKApplicationStateTrackingView didMoveToWindow]):
735         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
736         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]):
737         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
738         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
739         (-[WKApplicationStateTrackingView isBackground]):
740
741         Moved common logic from WKContentView and WKLegacyPDFView into
742         WKApplicationStateTrackingView.
743
744         * UIProcess/ios/WKContentView.h:
745         * UIProcess/ios/WKContentView.mm:
746         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
747         (-[WKContentView willMoveToWindow:]):
748         (-[WKContentView _applicationDidCreateWindowContext]):
749         (-[WKContentView didMoveToWindow]): Deleted.
750         (-[WKContentView isBackground]): Deleted.
751         (-[WKContentView _applicationDidEnterBackground]): Deleted.
752         (-[WKContentView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
753         (-[WKContentView _applicationWillEnterForeground]): Deleted.
754
755         Made WKContentView a subclass of WKApplicationStateTrackingView.
756
757         * UIProcess/ios/WKLegacyPDFView.h:
758         * UIProcess/ios/WKLegacyPDFView.mm:
759         (-[WKLegacyPDFView web_initWithFrame:webView:]):
760         (-[WKLegacyPDFView web_isBackground]):
761         (-[WKLegacyPDFView _applicationWillEnterForeground]):
762         (-[WKLegacyPDFView willMoveToWindow:]): Deleted.
763         (-[WKLegacyPDFView didMoveToWindow]): Deleted.
764         (-[WKLegacyPDFView _applicationDidEnterBackground]): Deleted.
765         (-[WKLegacyPDFView _applicationDidCreateWindowContext]): Deleted.
766         (-[WKLegacyPDFView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
767
768         Made WKLegacyPDFView a subclass of WKApplicationStateTrackingView.
769
770         * WebKit.xcodeproj/project.pbxproj:
771
772 2018-04-08  Dan Bernstein  <mitz@apple.com>
773
774         [Cocoa] Keep library validation disabled for WebContent.Development
775         https://bugs.webkit.org/show_bug.cgi?id=184393
776
777         Reviewed by Anders Carlsson.
778
779         * Configurations/WebContent.Development.entitlements: Added. Includes the
780           com.apple.security.cs.disable-library-validation entitlement set to true.
781         * Configurations/WebContentService.Development.xcconfig: Set CODE_SIGN_ENTITLEMENTS to the
782           above.
783         * WebKit.xcodeproj/project.pbxproj: Added reference to new file.
784
785 2018-04-06  Brian Burg  <bburg@apple.com>
786
787         REGRESSION(r228371): WebAutomationSession::deleteAllCookies doesn't delete some cookies
788         https://bugs.webkit.org/show_bug.cgi?id=184334
789         <rdar://problem/39212863>
790
791         Reviewed by Timothy Hatcher.
792
793         When WebDriver adds a cookie for 'localhost', it actually uses the domain '.localhost' per RFC.
794         When deleting cookies, we first fetch all cookies matching the document's hostname, and
795         then delete them one by one. However, this code path does not add the dot prefix. This causes
796         no cookies to match the requested domain, and thus none of them are deleted.
797
798         * UIProcess/Automation/WebAutomationSession.cpp:
799         (WebKit::domainByAddingDotPrefixIfNeeded): Extract this helper method.
800         (WebKit::WebAutomationSession::addSingleCookie): Use helper method.
801         (WebKit::WebAutomationSession::deleteAllCookies): Add a dot prefix when
802         requesting to delete all cookies for a hostname.
803
804 2018-04-06  Youenn Fablet  <youenn@apple.com>
805
806         Response headers should be filtered when sent from NetworkProcess to WebProcess
807         https://bugs.webkit.org/show_bug.cgi?id=184310
808
809         Reviewed by Ryosuke Niwa.
810
811         Pass destination parameter to NetworkResourceLoader.
812         Use new sanitization routine to filter response headers as needed:
813         - Cross-origin routines are filtered by removing any non CORS allowed headers.
814         - Same-origin responses are filtered by removing non used headers, except when filtering would be visible by JS (XHR, fetch).
815         In all cases, Set-Cookie/Set-Cookie2 headers are filtered out.
816
817         * NetworkProcess/NetworkResourceLoadParameters.cpp:
818         (WebKit::NetworkResourceLoadParameters::encode const):
819         (WebKit::NetworkResourceLoadParameters::decode):
820         * NetworkProcess/NetworkResourceLoadParameters.h:
821         * NetworkProcess/NetworkResourceLoader.cpp:
822         (WebKit::NetworkResourceLoader::didReceiveResponse):
823         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
824         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
825         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
826         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
827         * NetworkProcess/NetworkResourceLoader.h:
828         * WebProcess/Network/WebLoaderStrategy.cpp:
829         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
830         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
831         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
832
833 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
834
835         Make all sync IPCs during ScriptDisallowedScope set DoNotProcessIncomingMessagesWhenWaitingForSyncReply
836         https://bugs.webkit.org/show_bug.cgi?id=182449
837         <rdar://problem/39222541>
838
839         Reviewed by Chris Dumez.
840
841         Release assert that a sync IPC inside ScriptDisallowedScope sets DoNotProcessIncomingMessagesWhenWaitingForSyncReply
842         to avoid executing arbitrary scripts as a result of processing incoming sync IPCs.
843
844         * Platform/IPC/Connection.h:
845         (IPC::Connection::sendSync): Added the release assertion.
846
847 2018-04-05  Youenn Fablet  <youenn@apple.com>
848
849         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
850         https://bugs.webkit.org/show_bug.cgi?id=184306
851
852         Reviewed by Ryosuke Niwa.
853
854         * NetworkProcess/NetworkContentRuleListManager.cpp:
855         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
856
857 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
858
859         WebContent process is calling CGDisplayUsesInvertedPolarity
860         https://bugs.webkit.org/show_bug.cgi?id=184337
861         <rdar://problem/39215702>
862
863         Reviewed by Zalan Bujtas.
864
865         The PlatformScreenMac code is still calling display-related routines directly, specifically
866         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
867         the UIProcess.
868         
869         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
870         the compile guards so all macOS builds use this behavior.
871         
872         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
873         routines in the future.
874
875         * UIProcess/WebProcessPool.cpp:
876         (WebKit::WebProcessPool::initializeNewWebProcess): Activate screen brokering code for all builds.
877         * WebProcess/WebProcess.cpp: Ditto.
878         * WebProcess/WebProcess.h: Ditto.
879         * WebProcess/WebProcess.messages.in: Ditto.
880
881 2018-04-05  Brady Eidson  <beidson@apple.com>
882
883         Process Swap on Navigation causes many webpages to hang due to attempted process swap for iframe navigations.
884         <rdar://problem/39162236> and https://bugs.webkit.org/show_bug.cgi?id=184318
885
886         Reviewed by Andy Estes.
887
888         * UIProcess/WebPageProxy.cpp:
889         (WebKit::WebPageProxy::receivedPolicyDecision): Don't consider a swap if the navigation is not in the main frame.
890
891 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
892
893         WebContent process sometimes hangs in WebProcess::ensureNetworkProcessConnection
894         https://bugs.webkit.org/show_bug.cgi?id=184326
895
896         Reviewed by Chris Dumez.
897
898         The hang was caused by UI process never sending the reply back to GetNetworkProcessConnection
899         due to m_pendingOutgoingMachMessage being set and the event handler for DISPATCH_MACH_SEND_POSSIBLE
900         never getting called. This is because the event handler registration happens asynchronously,
901         and may not have completed by the time we send the first IPC to the web content process
902         in which case it can timeout and we may never get the callback.
903
904         Fixed the hang by waiting for the event handler registration to be completed using
905         dispatch_source_set_registration_handler. To do this, this patch adds a new boolean instance variable,
906         m_isInitializingSendSource, to Connection which is set to true between the time mach port is created
907         and until the event handler registration has been completed. platformCanSendOutgoingMessages returns
908         false while m_isInitializingSendSource is set to prevent the attempt to send messages like we do when
909         m_pendingOutgoingMachMessage is set to true.
910
911         * Platform/IPC/Connection.h:
912         (IPC::Connection::m_isInitializingSendSource): Added.
913         * Platform/IPC/mac/ConnectionMac.mm:
914         (IPC::Connection::platformInvalidate): Set m_isInitializingSendSource to false.
915         (IPC::Connection::sendMessage): Assert that m_isInitializingSendSource is false.
916         (IPC::Connection::platformCanSendOutgoingMessages const): Return false if m_isInitializingSendSource
917         is set to true.
918         (IPC::Connection::sendOutgoingMessage): Assert that m_isInitializingSendSource is false.
919         (IPC::Connection::initializeSendSource): Set m_isInitializingSendSource to true temporarily until
920         dispatch_source_set_registration_handler's callback is called. Resume and send any pending outgoing
921         messages.
922         (IPC::Connection::resumeSendSource): Extracted from initializeSendSource.
923
924 2018-04-05  Youenn Fablet  <youenn@apple.com>
925
926         WebRTC data channel only applications require capture permissions for direct connections
927         https://bugs.webkit.org/show_bug.cgi?id=174500
928         <rdar://problem/34134281>
929
930         Unreviewed.
931         Changed the code to suppress: "error: unused variable 'error' [-Werror,-Wunused-variable]"
932         Added some logging to this error case as a side bonus.
933
934         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
935         (WebKit::NetworkMDNSRegister::registerMDNSName):
936
937 2018-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
938
939         REGRESSION(r229831): Test WebKit2.ProvisionalURLAfterWillSendRequestCallback times out since r229831
940         https://bugs.webkit.org/show_bug.cgi?id=184293
941
942         Reviewed by Alex Christensen.
943
944         The problem is that after willSendRequest callback changes the request, the load is cancelled while
945         transitioning to committed state. This happens because the load is not waiting for the response policy check, so
946         it continues and when transitioning to committed, FrameLoader::closeURL() invalidates the current policy check
947         that causes a load failure. The new request returned by the API doesn't have any requester, so it's no longer
948         considered a main resource load. In the network process the resource load task doesn't wait for the response
949         policy and continues the load, sending the data to the web process. Once the first data is received, the load
950         transitions to commit, but the response policy check is still ongoing. This can only happen when using the C API
951         (I don't know about the Cocoa API), but not with the GLib API because it doesn't allow to create a new request,
952         only to modify the passed in one. With the C API we loss other internal things of the request like the priority,
953         but I guess the most important one is the requester.
954
955         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
956         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
957
958 2018-04-04  Ryan Haddad  <ryanhaddad@apple.com>
959
960         Unreviewed, rolling out r230283.
961
962         Caused webkitpy test failures.
963
964         Reverted changeset:
965
966         "Use CompletionHandlers for DelayedReplies"
967         https://bugs.webkit.org/show_bug.cgi?id=182269
968         https://trac.webkit.org/changeset/230283
969
970 2018-04-04  Youenn Fablet  <youenn@apple.com>
971
972         webrtc/video-update-often.html is flakily crashing on iOS simulator Debug
973         https://bugs.webkit.org/show_bug.cgi?id=184022
974
975         Reviewed by Jer Noble.
976
977         Remove client context once the new context identifier is set.
978         Covered by test no longer crashing locally.
979
980         * WebProcess/cocoa/PlaybackSessionManager.mm:
981         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
982
983 2018-04-04  Youenn Fablet  <youenn@apple.com>
984
985         WebRTC data channel only applications require capture permissions for direct connections
986         https://bugs.webkit.org/show_bug.cgi?id=174500
987         <rdar://problem/34134281>
988
989         Reviewed by Eric Carlson.
990
991         Add support for MDNS registration and resolution by NetworkProcess.
992         WebProcess gives instruction to do the actual registrations/resolutions.
993
994         * CMakeLists.txt:
995         * DerivedSources.make:
996         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
997         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
998         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
999         * NetworkProcess/NetworkConnectionToWebProcess.h:
1000         (WebKit::NetworkConnectionToWebProcess::mdnsRegister):
1001         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Added.
1002         (WebKit::NetworkMDNSRegister::NetworkMDNSRegister):
1003         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
1004         (WebKit::NetworkMDNSRegister::unregisterMDNSNames):
1005         (WebKit::PendingRegistrationRequest::PendingRegistrationRequest):
1006         (WebKit::registerMDNSNameCallback):
1007         (WebKit::NetworkMDNSRegister::registerMDNSName):
1008         (WebKit::PendingResolutionRequest::PendingResolutionRequest):
1009         (WebKit::PendingResolutionRequest::~PendingResolutionRequest):
1010         (WebKit::PendingResolutionRequest::timeout):
1011         (WebKit::resolveMDNSNameCallback):
1012         (WebKit::NetworkMDNSRegister::resolveMDNSName):
1013         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Added.
1014         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: Added.
1015         * Shared/WebPreferences.yaml:
1016         * UIProcess/API/C/WKPreferences.cpp:
1017         (WKPreferencesSetWebRTCMDNSICECandidatesEnabled):
1018         (WKPreferencesGetWebRTCMDNSICECandidatesEnabled):
1019         * UIProcess/API/C/WKPreferencesRef.h:
1020         * WebKit.xcodeproj/project.pbxproj:
1021         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1022         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
1023         * WebProcess/Network/NetworkProcessConnection.cpp:
1024         (WebKit::NetworkProcessConnection::didReceiveMessage):
1025         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
1026         (WebKit::LibWebRTCNetwork::mdnsRegister):
1027         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
1028         (WebKit::LibWebRTCProvider::unregisterMDNSNames):
1029         (WebKit::LibWebRTCProvider::registerMDNSName):
1030         (WebKit::LibWebRTCProvider::resolveMDNSName):
1031         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
1032         * WebProcess/Network/webrtc/WebMDNSRegister.cpp: Added.
1033         (WebKit::WebMDNSRegister::finishedRegisteringMDNSName):
1034         (WebKit::WebMDNSRegister::finishedResolvingMDNSName):
1035         (WebKit::WebMDNSRegister::unregisterMDNSNames):
1036         (WebKit::WebMDNSRegister::registerMDNSName):
1037         (WebKit::WebMDNSRegister::resolveMDNSName):
1038         * WebProcess/Network/webrtc/WebMDNSRegister.h: Added.
1039         * WebProcess/Network/webrtc/WebMDNSRegister.messages.in: Added.
1040
1041 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1042
1043         Use CompletionHandlers for DelayedReplies
1044         https://bugs.webkit.org/show_bug.cgi?id=182269
1045
1046         Reviewed by Youenn Fablet.
1047
1048         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
1049         called once and only once.  This is what CompletionHandlers are for.
1050
1051         No change in behavior.  Just cleaner code.
1052
1053         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1054         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1055         * NetworkProcess/NetworkConnectionToWebProcess.h:
1056         * NetworkProcess/NetworkResourceLoader.cpp:
1057         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
1058         (WebKit::sendReplyToSynchronousRequest):
1059         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1060         * NetworkProcess/NetworkResourceLoader.h:
1061         * Platform/IPC/Connection.h:
1062         * Platform/IPC/HandleMessage.h:
1063         (IPC::callMemberFunctionImpl):
1064         (IPC::callMemberFunction):
1065         (IPC::handleMessageDelayed):
1066         * PluginProcess/PluginControllerProxy.cpp:
1067         (WebKit::PluginControllerProxy::setInitializationReply):
1068         (WebKit::PluginControllerProxy::takeInitializationReply):
1069         * PluginProcess/PluginControllerProxy.h:
1070         * PluginProcess/WebProcessConnection.cpp:
1071         (WebKit::WebProcessConnection::destroyPlugin):
1072         (WebKit::WebProcessConnection::createPlugin):
1073         (WebKit::WebProcessConnection::createPluginAsynchronously):
1074         * PluginProcess/WebProcessConnection.h:
1075         * Scripts/webkit/messages.py:
1076         (message_to_struct_declaration):
1077         (generate_message_handler):
1078         * UIProcess/Network/NetworkProcessProxy.cpp:
1079         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
1080         (WebKit::NetworkProcessProxy::networkProcessCrashed):
1081         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
1082         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
1083         * UIProcess/Network/NetworkProcessProxy.h:
1084         * UIProcess/Plugins/PluginProcessManager.cpp:
1085         (WebKit::PluginProcessManager::getPluginProcessConnection):
1086         * UIProcess/Plugins/PluginProcessManager.h:
1087         * UIProcess/Plugins/PluginProcessProxy.cpp:
1088         (WebKit::PluginProcessProxy::getPluginProcessConnection):
1089         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
1090         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
1091         * UIProcess/Plugins/PluginProcessProxy.h:
1092         * UIProcess/Storage/StorageProcessProxy.cpp:
1093         (WebKit::StorageProcessProxy::getStorageProcessConnection):
1094         (WebKit::StorageProcessProxy::didClose):
1095         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
1096         * UIProcess/Storage/StorageProcessProxy.h:
1097         * UIProcess/WebPageProxy.cpp:
1098         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
1099         (WebKit::WebPageProxy::createNewPage):
1100         (WebKit::WebPageProxy::runJavaScriptAlert):
1101         (WebKit::WebPageProxy::runJavaScriptConfirm):
1102         (WebKit::WebPageProxy::runJavaScriptPrompt):
1103         (WebKit::WebPageProxy::webGLPolicyForURL):
1104         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
1105         (WebKit::WebPageProxy::getToolbarsAreVisible):
1106         (WebKit::WebPageProxy::getMenuBarIsVisible):
1107         (WebKit::WebPageProxy::getStatusBarIsVisible):
1108         (WebKit::WebPageProxy::getWindowFrame):
1109         (WebKit::WebPageProxy::screenToRootView):
1110         (WebKit::WebPageProxy::rootViewToScreen):
1111         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
1112         (WebKit::WebPageProxy::exceededDatabaseQuota):
1113         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
1114         * UIProcess/WebPageProxy.h:
1115         * UIProcess/WebProcessPool.cpp:
1116         (WebKit::WebProcessPool::networkProcessCrashed):
1117         (WebKit::WebProcessPool::getNetworkProcessConnection):
1118         (WebKit::WebProcessPool::getStorageProcessConnection):
1119         * UIProcess/WebProcessPool.h:
1120         * UIProcess/WebProcessProxy.cpp:
1121         (WebKit::WebProcessProxy::getPluginProcessConnection):
1122         (WebKit::WebProcessProxy::getNetworkProcessConnection):
1123         (WebKit::WebProcessProxy::getStorageProcessConnection):
1124         * UIProcess/WebProcessProxy.h:
1125         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1126         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
1127         * WebProcess/Storage/WebSWContextManagerConnection.h:
1128         * WebProcess/WebPage/WebPage.h:
1129         * WebProcess/WebPage/ios/WebPageIOS.mm:
1130         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
1131
1132 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1133
1134         Remove legacyCustomProtocolManager from NetworkSessionCreationParameters
1135         https://bugs.webkit.org/show_bug.cgi?id=182178
1136
1137         Reviewed by Youenn Fablet.
1138
1139         Now that we only make NetworkSessions in the NetworkProcess, we don't need to pass this parameter around.
1140
1141         * NetworkProcess/NetworkProcess.cpp:
1142         (WebKit::NetworkProcess::initializeNetworkProcess):
1143         * NetworkProcess/NetworkSessionCreationParameters.h:
1144         (WebKit::NetworkSessionCreationParameters::decode):
1145         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1146         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
1147         * NetworkProcess/mac/RemoteNetworkingContext.mm:
1148         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
1149         * Shared/WebsiteDataStoreParameters.cpp:
1150         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
1151         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
1152         (WebKit::WebsiteDataStore::parameters):
1153
1154 2018-04-04  Alex Christensen  <achristensen@webkit.org>
1155
1156         Move PingHandle to WebKitLegacy
1157         https://bugs.webkit.org/show_bug.cgi?id=184145
1158
1159         Reviewed by Youenn Fablet.
1160
1161         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1162
1163 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
1164
1165         Failures from mach port reference handling should be fatal
1166         https://bugs.webkit.org/show_bug.cgi?id=184202
1167         <rdar://problem/37771114>
1168
1169         Reviewed by Anders Carlsson.
1170
1171         Update for new location of MachSendRight.h. Switch to
1172         #pragma once in a few places.
1173
1174         * Platform/IPC/mac/ConnectionMac.mm:
1175         (IPC::Connection::platformInvalidate): Adopt new 'safe mach_port_t deallocation' function.
1176         (IPC::Connection::initializeSendSource): Ditto.
1177         (IPC::Connection::receiveSourceEventHandler): Ditto.
1178         * Platform/SharedMemory.h:
1179         * Platform/cocoa/SharedMemoryCocoa.cpp:
1180         (WebKit::SharedMemory::Handle::clear): Ditto.
1181         (WebKit::makeMemoryEntry): Ditto.
1182         (WebKit::SharedMemory::createSendRight const): Ditto.
1183         * Platform/mac/LayerHostingContext.h:
1184         * Platform/mac/LayerHostingContext.mm:
1185         * PluginProcess/PluginControllerProxy.h:
1186         * PluginProcess/PluginProcess.h:
1187         (WebKit::PluginProcess::compositingRenderServerPort const):
1188         * Scripts/messages.py:
1189         (headers_for_type): Update for new location of MachSendRight.
1190         * Shared/Plugins/PluginProcessCreationParameters.h:
1191         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
1192         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1193         (WebKit::RemoteLayerBackingStore::encode const):
1194         * Shared/WebCoreArgumentCoders.h:
1195         * Shared/WebProcessCreationParameters.h:
1196         * Shared/mac/WebCoreArgumentCodersMac.mm:
1197         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1198         * UIProcess/DrawingAreaProxy.cpp:
1199         * UIProcess/DrawingAreaProxy.h:
1200         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1201         (WebKit::ProcessLauncher::launchProcess): Ditto. Remove uneeded mach_port_dealloc called after
1202         xpc_dictionary_set_mach_send. While '..._set_mach_send' retains the send right, it gets automatically
1203         released when the message is handled. We only want to manually deallocate the send right if
1204         the message failed to send.
1205         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1206         * UIProcess/WebPageProxy.cpp:
1207         * UIProcess/WebPageProxy.h:
1208         * UIProcess/WebPageProxy.messages.in:
1209         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
1210         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1211         * UIProcess/mac/WKViewLayoutStrategy.mm:
1212         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
1213         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
1214         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
1215         * WebProcess/Plugins/PluginController.h:
1216         * WebProcess/Plugins/PluginView.h:
1217         * WebProcess/WebPage/DrawingArea.h:
1218         (WebKit::DrawingArea::addFence):
1219         (WebKit::DrawingArea::updateGeometry):
1220         * WebProcess/WebPage/DrawingArea.messages.in:
1221         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
1222         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1223         (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
1224         * WebProcess/WebPage/WebPage.cpp:
1225         (WebKit::WebPage::setTopContentInsetFenced):
1226         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1227         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1228         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
1229         * WebProcess/WebProcess.h:
1230         (WebKit::WebProcess::compositingRenderServerPort const):
1231         * WebProcess/cocoa/VideoFullscreenManager.mm:
1232         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
1233
1234 2018-04-04  Beth Dakin  <bdakin@apple.com>
1235
1236         Fix the print formatter build
1237         https://bugs.webkit.org/show_bug.cgi?id=184289
1238         -and corresponding-
1239         rdar://problem/39164641
1240
1241         Reviewed by Dan Bernstein.
1242
1243         * UIProcess/API/Cocoa/WKWebView.mm:
1244         (-[WKWebView _webViewPrintFormatter]):
1245         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1246         * UIProcess/_WKWebViewPrintFormatter.h:
1247         * UIProcess/_WKWebViewPrintFormatter.mm:
1248         * UIProcess/_WKWebViewPrintFormatterInternal.h:
1249         * UIProcess/ios/WKContentView.mm:
1250         * UIProcess/ios/WKPDFView.mm:
1251
1252 2018-04-04  Andy Estes  <aestes@apple.com>
1253
1254         [iOS] Rename WKPDFView to WKLegacyPDFView
1255         https://bugs.webkit.org/show_bug.cgi?id=184286
1256
1257         Rubber-stamped by Wenson Hsieh.
1258
1259         A series of upcoming patches will implement a new WKPDFView based on PDFKit.
1260
1261         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1262         (-[WKWebViewContentProviderRegistry init]):
1263         * UIProcess/ios/WKLegacyPDFView.h: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.h.
1264         * UIProcess/ios/WKLegacyPDFView.mm: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.mm.
1265         (-[WKLegacyPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
1266         * WebKit.xcodeproj/project.pbxproj:
1267
1268 2018-04-04  Yousuke Kimoto  <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
1269
1270         [WinCairo] Add WebKit Shared/win files for wincairo webkit
1271         https://bugs.webkit.org/show_bug.cgi?id=183044
1272
1273         Reviewed by Alex Christensen.
1274
1275         * Shared/win/ChildProcessMainWin.cpp: Added.
1276
1277 2018-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1278
1279         [Extra zoom mode] Remove effective font size constraints when determining focus zoom scale
1280         https://bugs.webkit.org/show_bug.cgi?id=184287
1281         <rdar://problem/39063886>
1282
1283         Reviewed by Timothy Hatcher.
1284
1285         As it turns out, form controls on some important websites can be very wide, with a small font size, which
1286         renders the approach taken in <https://trac.webkit.org/r230171> moot, since we'll just end up zooming to a scale
1287         that is too large anyways. To mitigate this for now, remove the minimum font scaling threshold while we think of
1288         more clever ways to account for this scenario.
1289
1290         * UIProcess/API/Cocoa/WKWebView.mm:
1291         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1292
1293 2018-04-04  Fujii Hironori  <Hironori.Fujii@sony.com>
1294
1295         [Win] WebFrameLoaderClient: 'getpid': identifier not found
1296         https://bugs.webkit.org/show_bug.cgi?id=184291
1297
1298         Reviewed by Konstantin Tokarev.
1299
1300         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1301         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1302         Use WTF::getCurrentProcessID() instead of getpid().
1303         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
1304
1305 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1306
1307         ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
1308         https://bugs.webkit.org/show_bug.cgi?id=153210
1309
1310         Reviewed by Alex Christensen.
1311
1312         The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
1313         FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
1314         FrameLoader::reload() returns before creating the document loader.
1315
1316         * WebProcess/WebPage/WebPage.cpp:
1317         (WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
1318         and reset it otherwise.
1319
1320 2018-04-03  Youenn Fablet  <youenn@apple.com>
1321
1322         Make NetworkProcess get ContentBlocker information from UIProcess
1323         https://bugs.webkit.org/show_bug.cgi?id=184205
1324         <rdar://problem/39146551>
1325
1326         Unreviewed.
1327         Updated decode/encode methods to not hit null identifier assertion.
1328
1329         * Shared/WebPageCreationParameters.cpp:
1330         (WebKit::WebPageCreationParameters::encode const):
1331         (WebKit::WebPageCreationParameters::decode):
1332         * Shared/WebPageGroupData.cpp:
1333         (WebKit::WebPageGroupData::encode const):
1334         (WebKit::WebPageGroupData::decode):
1335
1336 2018-04-03  Andy Estes  <aestes@apple.com>
1337
1338         [iOS] WKWebView shouldn't know about WKPDFView
1339         https://bugs.webkit.org/show_bug.cgi?id=184283
1340
1341         Reviewed by Timothy Hatcher.
1342
1343         WKWebView shouldn't be checking if _customContentView is a particular kind of
1344         class (e.g., WKPDFView). Instead, it should interact with the _customContentView
1345         using the WKWebViewContentProvider protocol.
1346
1347         Reimplement -_isBackground, -_isDisplayingPDF, -_dataForDisplayedPDF, and
1348         -_suggestedFilenameForDisplayedPDF using new WKWebViewContentProvider protocol
1349         methods that WKPDFView implements.
1350
1351         * UIProcess/API/Cocoa/WKWebView.mm:
1352         (-[WKWebView _isBackground]):
1353         (-[WKWebView _isDisplayingPDF]):
1354         (-[WKWebView _dataForDisplayedPDF]):
1355         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
1356         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1357         * UIProcess/ios/WKPDFView.h:
1358         * UIProcess/ios/WKPDFView.mm:
1359         (-[WKPDFView web_dataRepresentation]):
1360         (-[WKPDFView web_suggestedFilename]):
1361         (-[WKPDFView web_isBackground]):
1362         (-[WKPDFView suggestedFilename]): Deleted.
1363         (-[WKPDFView pdfDocument]): Deleted.
1364         (-[WKPDFView isBackground]): Deleted.
1365
1366 2018-04-03  Brent Fulgham  <bfulgham@apple.com>
1367
1368         Guard against keychain/certificate access outside the network process
1369         https://bugs.webkit.org/show_bug.cgi?id=184214
1370         <rdar://problem/38734795>
1371
1372         Reviewed by Youenn Fablet.
1373
1374         Use the ProcessPrivilege assertions to guard against accessing the Keychain from
1375         a non-Networking process.
1376
1377         * Shared/cf/ArgumentCodersCF.cpp:
1378         (IPC::encode): Assert if we access the keychain from a proces other than the Network or UI process.
1379         (IPC::decode): Ditto.
1380
1381 2018-04-03  Youenn Fablet  <youenn@apple.com>
1382
1383         NetworkResourceLoader does not need to expose all redirect response headers
1384         https://bugs.webkit.org/show_bug.cgi?id=184114
1385         <rdar://problem/39010557>
1386
1387         Reviewed by Ryosuke Niwa.
1388
1389         WebProcess instructs NetworkProcess whether to sanitize response headers based on a runtime flag.
1390         We sanitize redirection response headers in case this is not related to a navigation load.
1391         Navigation loads may currently require the full response for content blockers.
1392
1393         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1394         (WebKit::NetworkResourceLoadParameters::encode const):
1395         (WebKit::NetworkResourceLoadParameters::decode):
1396         * NetworkProcess/NetworkResourceLoadParameters.h:
1397         * NetworkProcess/NetworkResourceLoader.cpp:
1398         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1399         (WebKit::NetworkResourceLoader::sanitizeRedirectResponseIfPossible):
1400         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
1401         * NetworkProcess/NetworkResourceLoader.h:
1402         * Shared/WebPreferences.yaml:
1403         * UIProcess/API/C/WKPreferences.cpp:
1404         (WKPreferencesSetRestrictedHTTPResponseAccess):
1405         (WKPreferencesGetRestrictedHTTPResponseAccess):
1406         * UIProcess/API/C/WKPreferencesRef.h:
1407         * WebProcess/Network/WebLoaderStrategy.cpp:
1408         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1409         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1410         (WebKit::WebLoaderStrategy::startPingLoad):
1411         (WebKit::WebLoaderStrategy::preconnectTo):
1412
1413 2018-04-03  Youenn Fablet  <youenn@apple.com>
1414
1415         Make NetworkProcess get ContentBlocker information from UIProcess
1416         https://bugs.webkit.org/show_bug.cgi?id=184205
1417
1418         Reviewed by Alex Christensen.
1419
1420         Make NetworkProcess get content blockers from UIProcess directly.
1421         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
1422         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
1423
1424         This is both more efficient than passing them for each PingLoad and safer in the sense
1425         that a compromised WebProcess will not be able to bypass any of these.
1426         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
1427
1428         Covered by existing beacon+content blocker tests.
1429
1430         Did some refactoring to add a typed content blocker identifier.
1431         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
1432         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
1433
1434         * CMakeLists.txt:
1435         * DerivedSources.make:
1436         * NetworkProcess/NetworkLoadChecker.cpp:
1437         (WebKit::NetworkLoadChecker::checkRequest):
1438         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1439         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
1440         * NetworkProcess/NetworkLoadChecker.h:
1441         (WebKit::NetworkLoadChecker::setContentExtensionController):
1442         * NetworkProcess/NetworkProcess.cpp:
1443         (WebKit::NetworkProcess::didReceiveMessage):
1444         * NetworkProcess/NetworkProcess.h:
1445         (WebKit::NetworkProcess::networkUserContentController):
1446         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1447         (WebKit::NetworkResourceLoadParameters::encode const):
1448         (WebKit::NetworkResourceLoadParameters::decode):
1449         * NetworkProcess/NetworkResourceLoadParameters.h:
1450         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
1451         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
1452         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1453         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
1454         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
1455         (WebKit::NetworkContentRuleListManager::remove):
1456         * NetworkProcess/NetworkContentRuleListManager.h: Added.
1457         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
1458         * NetworkProcess/PingLoad.cpp:
1459         * Scripts/webkit/messages.py:
1460         * Shared/UserContentControllerIdentifier.h: Added.
1461         * Shared/WebPageCreationParameters.cpp:
1462         (WebKit::WebPageCreationParameters::decode):
1463         * Shared/WebPageCreationParameters.h:
1464         * Shared/WebPageGroupData.cpp:
1465         (WebKit::WebPageGroupData::decode):
1466         * Shared/WebPageGroupData.h:
1467         * UIProcess/Network/NetworkProcessProxy.cpp:
1468         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1469         (WebKit::NetworkProcessProxy::contentExtensionRules):
1470         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
1471         * UIProcess/Network/NetworkProcessProxy.h:
1472         * UIProcess/Network/NetworkProcessProxy.messages.in:
1473         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1474         (WebKit::WebUserContentControllerProxy::get):
1475         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
1476         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
1477         (WebKit::WebUserContentControllerProxy::addProcess):
1478         (WebKit::WebUserContentControllerProxy::removeProcess):
1479         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1480         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1481         (WebKit::WebUserContentControllerProxy::addUserScript):
1482         (WebKit::WebUserContentControllerProxy::removeUserScript):
1483         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1484         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1485         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1486         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1487         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
1488         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
1489         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
1490         (WebKit::WebUserContentControllerProxy::addContentRuleList):
1491         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
1492         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
1493         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1494         (WebKit::WebUserContentControllerProxy::create):
1495         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
1496         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
1497         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
1498         (WebKit::WebUserContentControllerProxy::identifier const):
1499         * WebKit.xcodeproj/project.pbxproj:
1500         * WebProcess/Network/WebLoaderStrategy.cpp:
1501         (WebKit::WebLoaderStrategy::startPingLoad):
1502         * WebProcess/UserContent/WebUserContentController.cpp:
1503         (WebKit::WebUserContentController::getOrCreate):
1504         (WebKit::WebUserContentController::WebUserContentController):
1505         (WebKit::WebUserContentController::~WebUserContentController):
1506         * WebProcess/UserContent/WebUserContentController.h:
1507         * WebProcess/WebPage/WebPage.h:
1508         (WebKit::WebPage::userContentControllerIdentifier const):
1509
1510 2018-04-03  Andy Estes  <aestes@apple.com>
1511
1512         [Mac] Prioritize file promises over filenames during drag and drop
1513         https://bugs.webkit.org/show_bug.cgi?id=184237
1514         <rdar://problem/38278076>
1515
1516         Reviewed by Wenson Hsieh.
1517
1518         * UIProcess/Cocoa/WebViewImpl.mm:
1519         (WebKit::WebViewImpl::performDragOperation):
1520
1521 2018-04-03  Brady Eidson  <beidson@apple.com>
1522
1523         Make SessionStorage work with process swapping.
1524         https://bugs.webkit.org/show_bug.cgi?id=184270
1525
1526         Reviewed by Andy Estes.
1527
1528         Due to a minor process accounting error, WebPageProxys weren't always being reconnected with their
1529         WebsiteDataStore's StorageManager when doing process swaps.
1530
1531         Fix that error, and SessionStorage "just works."
1532
1533         * UIProcess/WebPageProxy.cpp:
1534         (WebKit::WebPageProxy::webProcessWillShutDown):
1535         (WebKit::WebPageProxy::processDidTerminate): For NavigationSwap termination, make sure to tell the 
1536           process lifetime tracker that this page was removed.
1537
1538         * UIProcess/WebProcessLifetimeObserver.h:
1539         (WebKit::WebProcessLifetimeObserver::webPageWasInvalidated): Renamed from "webPageWasRemoved"
1540         (WebKit::WebProcessLifetimeObserver::webPageWasRemoved): Deleted.
1541
1542         * UIProcess/WebProcessLifetimeTracker.cpp:
1543         (WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess): Renamed from "webProcessWillShutDown"
1544         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
1545         (WebKit::WebProcessLifetimeTracker::webProcessWillShutDown): Deleted.
1546         * UIProcess/WebProcessLifetimeTracker.h:
1547
1548         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1549         (WebKit::WebsiteDataStore::webPageWasInvalidated):
1550         (WebKit::WebsiteDataStore::webPageWasRemoved): Deleted.
1551         * UIProcess/WebsiteData/WebsiteDataStore.h:
1552
1553 2018-04-03  Commit Queue  <commit-queue@webkit.org>
1554
1555         Unreviewed, rolling out r230210.
1556         https://bugs.webkit.org/show_bug.cgi?id=184277
1557
1558         it is breaking internal bots (Requested by youenn on #webkit).
1559
1560         Reverted changeset:
1561
1562         "Make NetworkProcess get ContentBlocker information from
1563         UIProcess"
1564         https://bugs.webkit.org/show_bug.cgi?id=184205
1565         https://trac.webkit.org/changeset/230210
1566
1567 2018-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1568
1569         [Extra zoom mode] Update time picker to use platform view controller
1570         https://bugs.webkit.org/show_bug.cgi?id=184252
1571         <rdar://problem/38804795>
1572
1573         Reviewed by Andy Estes.
1574
1575         Adjust for some small WKTimePickerViewController changes, and remove some files that we no longer need.
1576
1577         * UIProcess/ios/WKContentViewInteraction.mm:
1578         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1579         (-[WKContentView textInputController:didCommitText:]): Deleted.
1580         (-[WKContentView textInputController:didCommitText:withSuggestion:]): Deleted.
1581         (-[WKContentView textInputControllerDidRequestDismissal:]): Deleted.
1582         * UIProcess/ios/forms/WKTextFormControlViewController.h: Removed.
1583         * UIProcess/ios/forms/WKTextFormControlViewController.mm: Removed.
1584         * UIProcess/ios/forms/WKTextSuggestionButton.h: Removed.
1585         * UIProcess/ios/forms/WKTextSuggestionButton.mm: Removed.
1586         * WebKit.xcodeproj/project.pbxproj:
1587
1588 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
1589
1590         Xcode prepends line comments from WTF/Compiler.h to *.sb files
1591         https://bugs.webkit.org/show_bug.cgi?id=184166
1592
1593         Reviewed by Brent Fulgham.
1594
1595         * DerivedSources.make:
1596         Strip ;-comments from *.sb.in files before preprocessing so we can stop treating Platform.h/Compiler.h as C89.
1597
1598 2018-04-03  Chris Dumez  <cdumez@apple.com>
1599
1600         Drop MainFrame class
1601         https://bugs.webkit.org/show_bug.cgi?id=184191
1602
1603         Reviewed by Darin Adler.
1604
1605         Drop MainFrame class and move contents into Page / Frame since there is a 1:1
1606         relationship between the Page and the MainFrame.
1607
1608         This is ground work for introducing LocalFrame / RemoteFrame concepts.
1609
1610         * Shared/WebRenderLayer.cpp:
1611         * Shared/WebRenderObject.cpp:
1612         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
1613         (WebKit::WebPaymentCoordinator::paymentCoordinator):
1614         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1615         * WebProcess/FullScreen/WebFullScreenManager.cpp:
1616         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1617         (WKBundlePageInstallPageOverlay):
1618         (WKBundlePageUninstallPageOverlay):
1619         (WKBundlePageInstallPageOverlayWithAnimation):
1620         (WKBundlePageUninstallPageOverlayWithAnimation):
1621         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
1622         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
1623         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1624         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1625         * WebProcess/Plugins/PluginView.cpp:
1626         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
1627         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1628         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
1629         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1630         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
1631         (WebKit::WebInspectorClient::~WebInspectorClient):
1632         (WebKit::WebInspectorClient::highlight):
1633         (WebKit::WebInspectorClient::hideHighlight):
1634         (WebKit::WebInspectorClient::showPaintRect):
1635         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1636         * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
1637         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
1638         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1639         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
1640         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
1641         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
1642         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
1643         * WebProcess/WebPage/FindController.cpp:
1644         (WebKit::FindController::updateFindUIAfterPageScroll):
1645         (WebKit::FindController::hideFindUI):
1646         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
1647         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1648         (WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
1649         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
1650         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
1651         * WebProcess/WebPage/WebFrame.cpp:
1652         * WebProcess/WebPage/WebInspector.cpp:
1653         * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
1654         * WebProcess/WebPage/WebPage.cpp:
1655         (WebKit::WebPage::mainFrame const):
1656         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
1657         (WebKit::WebPage::plugInIntersectsSearchRect):
1658         * WebProcess/WebPage/WebPage.h:
1659         * WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp:
1660         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1661         * WebProcess/WebPage/ios/WebPageIOS.mm:
1662         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1663         (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
1664         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
1665         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
1666         (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
1667         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
1668         * WebProcess/WebPage/mac/WebPageMac.mm:
1669         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
1670         (WebKit::WebPage::dataDetectorsDidPresentUI):
1671         (WebKit::WebPage::dataDetectorsDidChangeUI):
1672         (WebKit::WebPage::dataDetectorsDidHideUI):
1673         * WebProcess/WebProcess.cpp:
1674         * WebProcess/WebStorage/StorageAreaMap.cpp:
1675
1676 2018-04-03  Youenn Fablet  <youenn@apple.com>
1677
1678         Make NetworkProcess get ContentBlocker information from UIProcess
1679         https://bugs.webkit.org/show_bug.cgi?id=184205
1680
1681         Reviewed by Alex Christensen.
1682
1683         Make NetworkProcess get content blockers from UIProcess directly.
1684         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
1685         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
1686
1687         This is both more efficient than passing them for each PingLoad and safer in the sense
1688         that a compromised WebProcess will not be able to bypass any of these.
1689         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
1690
1691         Covered by existing beacon+content blocker tests.
1692
1693         Did some refactoring to add a typed content blocker identifier.
1694         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
1695         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
1696
1697         * CMakeLists.txt:
1698         * DerivedSources.make:
1699         * NetworkProcess/NetworkLoadChecker.cpp:
1700         (WebKit::NetworkLoadChecker::checkRequest):
1701         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1702         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
1703         * NetworkProcess/NetworkLoadChecker.h:
1704         (WebKit::NetworkLoadChecker::setContentExtensionController):
1705         * NetworkProcess/NetworkProcess.cpp:
1706         (WebKit::NetworkProcess::didReceiveMessage):
1707         * NetworkProcess/NetworkProcess.h:
1708         (WebKit::NetworkProcess::networkUserContentController):
1709         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1710         (WebKit::NetworkResourceLoadParameters::encode const):
1711         (WebKit::NetworkResourceLoadParameters::decode):
1712         * NetworkProcess/NetworkResourceLoadParameters.h:
1713         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
1714         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
1715         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
1716         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
1717         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
1718         (WebKit::NetworkContentRuleListManager::remove):
1719         * NetworkProcess/NetworkContentRuleListManager.h: Added.
1720         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
1721         * NetworkProcess/PingLoad.cpp:
1722         * Scripts/webkit/messages.py:
1723         * Shared/UserContentControllerIdentifier.h: Added.
1724         * Shared/WebPageCreationParameters.cpp:
1725         (WebKit::WebPageCreationParameters::decode):
1726         * Shared/WebPageCreationParameters.h:
1727         * Shared/WebPageGroupData.cpp:
1728         (WebKit::WebPageGroupData::decode):
1729         * Shared/WebPageGroupData.h:
1730         * UIProcess/Network/NetworkProcessProxy.cpp:
1731         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
1732         (WebKit::NetworkProcessProxy::contentExtensionRules):
1733         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
1734         * UIProcess/Network/NetworkProcessProxy.h:
1735         * UIProcess/Network/NetworkProcessProxy.messages.in:
1736         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
1737         (WebKit::WebUserContentControllerProxy::get):
1738         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
1739         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
1740         (WebKit::WebUserContentControllerProxy::addProcess):
1741         (WebKit::WebUserContentControllerProxy::removeProcess):
1742         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
1743         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
1744         (WebKit::WebUserContentControllerProxy::addUserScript):
1745         (WebKit::WebUserContentControllerProxy::removeUserScript):
1746         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
1747         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
1748         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
1749         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
1750         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
1751         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
1752         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
1753         (WebKit::WebUserContentControllerProxy::addContentRuleList):
1754         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
1755         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
1756         * UIProcess/UserContent/WebUserContentControllerProxy.h:
1757         (WebKit::WebUserContentControllerProxy::create):
1758         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
1759         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
1760         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
1761         (WebKit::WebUserContentControllerProxy::identifier const):
1762         * WebKit.xcodeproj/project.pbxproj:
1763         * WebProcess/Network/WebLoaderStrategy.cpp:
1764         (WebKit::WebLoaderStrategy::startPingLoad):
1765         * WebProcess/UserContent/WebUserContentController.cpp:
1766         (WebKit::WebUserContentController::getOrCreate):
1767         (WebKit::WebUserContentController::WebUserContentController):
1768         (WebKit::WebUserContentController::~WebUserContentController):
1769         * WebProcess/UserContent/WebUserContentController.h:
1770         * WebProcess/WebPage/WebPage.h:
1771         (WebKit::WebPage::userContentControllerIdentifier const):
1772
1773 2018-04-02  Beth Dakin  <bdakin@apple.com>
1774
1775         Fix the managed configurations build
1776         https://bugs.webkit.org/show_bug.cgi?id=184253
1777         -and corresponding-
1778         rdar://problem/39078586
1779
1780         Reviewed by Dan Bernstein.
1781
1782         * UIProcess/ios/WKContentViewInteraction.mm:
1783         (-[WKContentView canPerformActionForWebView:withSender:]):
1784         (-[WKContentView _defineForWebView:]):
1785
1786 2018-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1787
1788         [Enchant] Clean up TextCheckerEnchant
1789         https://bugs.webkit.org/show_bug.cgi?id=184233
1790
1791         Reviewed by Michael Catanzaro.
1792
1793         Use TextCheckerEnchant as a singleton now, instead of implementing the singleton here.
1794
1795         * UIProcess/gtk/TextCheckerGtk.cpp:
1796         (WebKit::TextChecker::checkSpellingOfString):
1797         (WebKit::TextChecker::getGuessesForWord):
1798         (WebKit::TextChecker::learnWord):
1799         (WebKit::TextChecker::ignoreWord):
1800         (WebKit::TextChecker::setSpellCheckingLanguages):
1801         (WebKit::TextChecker::loadedSpellCheckingLanguages):
1802         (WebKit::enchantTextChecker): Deleted.
1803
1804 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1805
1806         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
1807         https://bugs.webkit.org/show_bug.cgi?id=183346
1808
1809         Reviewed by Michael Catanzaro.
1810
1811         Pass the request cancellable to NetworkStorageSession::getCredentialFromPersistentStorage().
1812
1813         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
1814         (WebKit::NetworkDataTaskSoup::authenticate):
1815
1816 2018-04-02  Brady Eidson  <beidson@apple.com>
1817
1818         Process swapping on navigation needs to handle server redirects.
1819         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
1820
1821         Reviewed by Alex Christensen.
1822
1823         The same rules we apply to process swapping for basic navigations need to apply
1824         to server redirects as well.
1825
1826         There's three interesting cases we need to support that are covered by new API tests:
1827         1 - The initial load in a WKWebView redirects cross-origin.
1828         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
1829         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
1830
1831         Supporting all 3 of these brought their own little challenges.
1832
1833         By teaching Navigation objects more about redirects I was able to support all 3 cases.
1834
1835         * UIProcess/API/APINavigation.cpp:
1836         (API::Navigation::Navigation):
1837         (API::Navigation::setCurrentRequest):
1838         (API::Navigation::appendRedirectionURL):
1839         (API::Navigation::loggingString const):
1840         (API::Navigation::loggingURL const): Deleted.
1841         * UIProcess/API/APINavigation.h:
1842         (API::Navigation::originalRequest const):
1843         (API::Navigation::currentRequest const):
1844         (API::Navigation::currentRequestProcessIdentifier const):
1845         (API::Navigation::setCurrentRequestIsRedirect):
1846         (API::Navigation::currentRequestIsRedirect const):
1847         (API::Navigation::request const): Deleted.
1848
1849         * UIProcess/API/Cocoa/WKNavigation.mm:
1850         (-[WKNavigation _request]):
1851
1852         * UIProcess/WebPageProxy.cpp:
1853         (WebKit::WebPageProxy::receivedPolicyDecision):
1854         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
1855           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
1856         (WebKit::WebPageProxy::didCreateMainFrame):
1857         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
1858           cross-origin redirect that is just starting back up in a new WebProcess.
1859         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1860         (WebKit::WebPageProxy::didCommitLoadForFrame):
1861         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1862         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
1863           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
1864         * UIProcess/WebPageProxy.h:
1865         * UIProcess/WebPageProxy.messages.in:
1866
1867         * UIProcess/WebProcessPool.cpp:
1868         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
1869           be used to continue a navigation.
1870         * UIProcess/WebProcessPool.h:
1871
1872         * UIProcess/WebProcessProxy.h:
1873         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
1874         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
1875
1876         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1877         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1878         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1879
1880 2018-04-02  Eric Carlson  <eric.carlson@apple.com>
1881
1882         [Extra zoom mode] Replace video with a placeholder image during fullscreen transition
1883         https://bugs.webkit.org/show_bug.cgi?id=184188
1884         <rdar://problem/38940307>
1885
1886         Reviewed by Youenn Fablet.
1887
1888         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1889         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
1890         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1891         (WebKit::VideoFullscreenModelContext::willExitFullscreen):
1892         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
1893         (WebKit::VideoFullscreenManagerProxy::willExitFullscreen):
1894         * WebProcess/cocoa/VideoFullscreenManager.h:
1895         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
1896         * WebProcess/cocoa/VideoFullscreenManager.mm:
1897         (WebKit::VideoFullscreenManager::willExitFullscreen):
1898
1899 2018-04-02  Brian Burg  <bburg@apple.com>
1900
1901         [Cocoa] Fix some internal builds that consume WebDriver atoms
1902         https://bugs.webkit.org/show_bug.cgi?id=184197
1903
1904         Reviewed by Dan Bernstein.
1905
1906         * WebKit.xcodeproj/project.pbxproj:
1907         Use a Run Script phase to copy WebDriver atoms to WebKit.framework
1908         private headers during the installhdrs phase.
1909
1910 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
1911
1912         Unreviewed, rolling out r230174.
1913
1914         Caused LayoutTests to exit early with assertion failures.
1915
1916         Reverted changeset:
1917
1918         "Process swapping on navigation needs to handle server
1919         redirects."
1920         https://bugs.webkit.org/show_bug.cgi?id=184142
1921         https://trac.webkit.org/changeset/230174
1922
1923 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1924
1925         [Extra zoom mode] Update date picker UI to latest specifications
1926         https://bugs.webkit.org/show_bug.cgi?id=184234
1927         <rdar://problem/38804760>
1928
1929         Reviewed by Timothy Hatcher.
1930
1931         Rename WKTextFormControlListViewControllerDelegate to WKTextInputListViewControllerDelegate and adjust for the
1932         new initializer of WKDatePickerViewController.
1933
1934         * UIProcess/ios/WKContentViewInteraction.mm:
1935         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1936
1937 2018-04-02  Brady Eidson  <beidson@apple.com>
1938
1939         Process swapping on navigation needs to handle server redirects.
1940         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
1941
1942         Reviewed by Alex Christensen.
1943
1944         The same rules we apply to process swapping for basic navigations need to apply
1945         to server redirects as well.
1946
1947         There's three interesting cases we need to support that are covered by new API tests:
1948         1 - The initial load in a WKWebView redirects cross-origin.
1949         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
1950         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
1951
1952         Supporting all 3 of these brought their own little challenges.
1953
1954         By teaching Navigation objects more about redirects I was able to support all 3 cases.
1955
1956         * UIProcess/API/APINavigation.cpp:
1957         (API::Navigation::Navigation):
1958         (API::Navigation::setCurrentRequest):
1959         (API::Navigation::appendRedirectionURL):
1960         (API::Navigation::loggingString const):
1961         (API::Navigation::loggingURL const): Deleted.
1962         * UIProcess/API/APINavigation.h:
1963         (API::Navigation::originalRequest const):
1964         (API::Navigation::currentRequest const):
1965         (API::Navigation::currentRequestProcessIdentifier const):
1966         (API::Navigation::setCurrentRequestIsRedirect):
1967         (API::Navigation::currentRequestIsRedirect const):
1968         (API::Navigation::request const): Deleted.
1969
1970         * UIProcess/API/Cocoa/WKNavigation.mm:
1971         (-[WKNavigation _request]):
1972
1973         * UIProcess/WebPageProxy.cpp:
1974         (WebKit::WebPageProxy::receivedPolicyDecision):
1975         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
1976           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
1977         (WebKit::WebPageProxy::didCreateMainFrame):
1978         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
1979           cross-origin redirect that is just starting back up in a new WebProcess.
1980         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1981         (WebKit::WebPageProxy::didCommitLoadForFrame):
1982         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
1983         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
1984           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
1985         * UIProcess/WebPageProxy.h:
1986         * UIProcess/WebPageProxy.messages.in:
1987
1988         * UIProcess/WebProcessPool.cpp:
1989         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
1990           be used to continue a navigation.
1991         * UIProcess/WebProcessPool.h:
1992
1993         * UIProcess/WebProcessProxy.h:
1994         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
1995         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
1996
1997         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1998         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
1999         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2000
2001 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2002
2003         [Extra zoom mode] Zoom level is sometimes excessive when zooming to focused form controls
2004         https://bugs.webkit.org/show_bug.cgi?id=184222
2005         <rdar://problem/39063886>
2006
2007         Reviewed by Timothy Hatcher.
2008
2009         Upon interactively focusing an element, we zoom and scroll to reveal that element. The heuristics introduced in
2010         <https://trac.webkit.org/r168744> work by computing a target scale, and then a point to zoom to given that
2011         scale. Currently, this scale is dependent on the computed font size of the form control, such that the form
2012         control would be scaled to have an effective font size of 16.
2013
2014         However, in extra zoom mode, applying these same heuristics (ironically) results in excessive zoom levels, since
2015         scaling the font up to 16 would cause most form controls to zoom so far in that we lose context of surrounding
2016         elements such as labels and other form controls; the fact that the element is highlighted by the focused form
2017         control overlay makes this even more confusing, since part of the focus overlay highlight rect often ends up
2018         outside the viewport.
2019
2020         To fix this, we make a couple of tweaks to focus rect zooming in extra zoom mode. (1) Instead of computing
2021         target zoom level based on font size, try to zoom such that the focused element rect fills up most of the
2022         viewport (similar to double-tap zooming). This ensures that the focused form control overlay's highlight rect
2023         makes sense in most cases, with few exceptions (e.g. the element frame is larger than the viewport). (2)
2024         Introduce a minimum legible font size of 11, and compute the minimium scale needed such that the form control
2025         font would appear to be at least this legible font size. Then, clamp the target scale chosen by (1) to this
2026         minimum scale.
2027
2028         One additional consideration for (1) is that naively scaling to fit the element rect to the viewport (with some
2029         fixed margins) would cause the viewport scale to always change when moving focus between form controls of
2030         different dimensions, even if the current scale is more or less appropriate for all the focusable elements. To
2031         address this, instead of computing a single target zoom scale for an element rect, compute a range of possible
2032         target zoom scales (where the minimum and maximum values depend on the margin we add around the element rect).
2033         If the current scale already falls within this target scale range, then we won't bother adjusting the scale at
2034         all (unless the font size is too small — see (2)). If the current scale falls outside the target scale range, we
2035         then make the minimal adjustment needed to ensure that the element rect fits well within the viewport without
2036         being too small.
2037
2038         * UIProcess/API/Cocoa/WKWebView.mm:
2039         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2040
2041         Move some logic around so that the target scale is computed after computing the visible size. Also renames some
2042         constants local to this function (WKWebViewStandardFontSize, kMinimumHeightToShowContentAboveKeyboard,
2043         UIWebFormAnimationDuration, CaretOffsetFromWindowEdge) such that they now share a consistent naming style.
2044
2045 2018-04-02  Jer Noble  <jer.noble@apple.com>
2046
2047         Enable Legacy EME for all WebKit & WebKitLegacy clients
2048         https://bugs.webkit.org/show_bug.cgi?id=184018
2049         <rdar://problem/34887387>
2050
2051         Reviewed by Eric Carlson.
2052
2053         * Shared/WebPreferences.yaml:
2054         * Shared/WebPreferencesDefaultValues.h:
2055
2056 2018-04-02  Jer Noble  <jer.noble@apple.com>
2057
2058         REGRESSION (229680): Fullscreen video does not work (youtube, netflix)
2059         https://bugs.webkit.org/show_bug.cgi?id=184235
2060
2061         Reviewed by Eric Carlson.
2062
2063         Enable the Fullscreen API by default.
2064
2065         * Shared/WebPreferences.yaml:
2066         * Shared/WebPreferencesDefaultValues.h:
2067
2068 2018-04-02  Fujii Hironori  <Hironori.Fujii@sony.com>
2069
2070         [Win] MSVC can't compile WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent
2071         https://bugs.webkit.org/show_bug.cgi?id=184120
2072
2073         Reviewed by Alex Christensen.
2074
2075         It seems that MSVC can't compile the code using `this` in a
2076         generalized lambda capture in another lambda.
2077
2078         In this case, there is no need to copy `protectedThis` for the
2079         inner lambda. Move `protectedThis` of the outer lambda to the
2080         inner as well as `callback`.
2081
2082         * UIProcess/WebResourceLoadStatisticsStore.cpp:
2083         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
2084         Moved `protectedThis` from the outer lambda to the inner.
2085
2086 2018-04-02  Dan Bernstein  <mitz@apple.com>
2087
2088         Build fix after r230121
2089
2090         * Configurations/WebKit.xcconfig: Disabled framework header postprocessing when building for
2091           iOS 11.*
2092         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Reverted r230159.
2093
2094 2018-04-02  Dan Bernstein  <mitz@apple.com>
2095
2096         Fixed the build when BOOL is not bool.
2097         <rdar://problem/39094484>
2098
2099         Reviewed by Jer Noble.
2100
2101         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
2102         (-[WKFullScreenViewController videoControlsManagerDidChange]): Removed the write-only ivar
2103           _hasControlsManager, the assignment to which was causing the compiler error.
2104
2105 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
2106
2107         Unreviewed build fix.
2108
2109         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Update availability annotation.
2110
2111 2018-04-02  Michael Catanzaro  <mcatanzaro@igalia.com>
2112
2113         [GTK] DragAndDropHandler.cpp should include GUniquePtrGtk.h
2114         https://bugs.webkit.org/show_bug.cgi?id=184119
2115
2116         Reviewed by Daniel Bates.
2117
2118         * UIProcess/gtk/DragAndDropHandler.cpp:
2119
2120 2018-04-02  Frederic Wang  <fwang@igalia.com>
2121
2122         Fix warnings for unused lambda captures in Source/WebKit
2123         https://bugs.webkit.org/show_bug.cgi?id=173555
2124
2125         Reviewed by Konstantin Tokarev.
2126
2127         When release logs are disabled, several lambda captures are unused, causing compilation
2128         failures with -Wunused-lambda-capture. This patch marks the corresponding variables as unused
2129         in order to fix these warnings.
2130
2131         Based on initial patch by: Konstantin Tokarev  <annulen@yandex.ru>
2132
2133         * NetworkProcess/NetworkResourceLoader.cpp:
2134         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2135         * UIProcess/Network/NetworkProcessProxy.cpp:
2136         (WebKit::NetworkProcessProxy::fetchWebsiteData):
2137         (WebKit::NetworkProcessProxy::deleteWebsiteData):
2138         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
2139         * UIProcess/WebProcessProxy.cpp:
2140         (WebKit::WebProcessProxy::fetchWebsiteData):
2141         (WebKit::WebProcessProxy::deleteWebsiteData):
2142         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
2143         * UIProcess/ios/WKContentViewInteraction.mm:
2144         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
2145
2146 2018-04-02  Alejandro G. Castro  <alex@igalia.com>
2147
2148         [GTK] Make libwebrtc backend buildable for GTK  port
2149         https://bugs.webkit.org/show_bug.cgi?id=178860
2150
2151         Reviewed by Youenn Fablet.
2152
2153         * CMakeLists.txt: Add RTC network classes to the compilation and
2154         the libwebrtc includes.
2155         * PlatformGTK.cmake: Add the libwebrtc directory.
2156         * SourcesGTK.txt: Add RTC files to the compilation.
2157
2158 2018-03-30  Chris Dumez  <cdumez@apple.com>
2159
2160         REGRESSION (r229828): Facebook login popup is blank
2161         https://bugs.webkit.org/show_bug.cgi?id=184206
2162         <rdar://problem/39057006>
2163
2164         Reviewed by Wenson Hsieh.
2165
2166         Add assertion to make sure we never try to do a policy check to
2167         a resource response while a policy check for a navigation is
2168         pending. This assertion was being hit by several of our redirection
2169         tests without my fix.
2170
2171         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2172         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2173
2174 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2175
2176         Unreviewed, rolling out r230125.
2177
2178         Build fix broke more builds.
2179
2180         Reverted changeset:
2181
2182         "Unreviewed build fix, remove unused lambda capture."
2183         https://trac.webkit.org/changeset/230125
2184
2185 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
2186
2187         Unreviewed build fix, remove unused lambda capture.
2188
2189         * NetworkProcess/NetworkResourceLoader.cpp:
2190         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2191
2192 2018-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2193
2194         [Extra zoom mode] Adopt list view controller UI for numeric input types
2195         https://bugs.webkit.org/show_bug.cgi?id=184184
2196         <rdar://problem/37238916>
2197
2198         Reviewed by Timothy Hatcher.
2199
2200         Remove existing logic for presenting a number pad view controller, since number pads will now be handled as a
2201         special case of general text form controls in extra zoom mode.
2202
2203         * UIProcess/ios/WKContentViewInteraction.h:
2204         * UIProcess/ios/WKContentViewInteraction.mm:
2205         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2206         (-[WKContentView dismissAllInputViewControllers]):
2207         (-[WKContentView _wheelChangedWithEvent:]):
2208
2209 2018-03-30  Dan Bernstein  <mitz@apple.com>
2210
2211         Update availability annotations to match the macOS 10.13.4 and iOS 11.3 GM SDKs
2212         https://bugs.webkit.org/show_bug.cgi?id=184173
2213
2214         Reviewed by Alex Christensen.
2215
2216         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13.4 and 11.3, respectively, in all declarations that
2217         appear in the GM SDKs.
2218
2219         * Shared/API/Cocoa/_WKNSWindowExtras.h:
2220         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
2221         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
2222         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
2223         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2224         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
2225         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
2226         * UIProcess/API/Cocoa/WKViewPrivate.h:
2227         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
2228         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2229         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
2230         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
2231         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
2232         * UIProcess/API/Cocoa/_WKAttachment.h:
2233         * UIProcess/API/Cocoa/_WKAutomationSession.h:
2234         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
2235         * UIProcess/API/Cocoa/_WKDownload.h:
2236         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
2237         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
2238         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
2239         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
2240         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
2241         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
2242         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2243         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2244         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
2245         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
2246
2247 2018-03-30  Youenn Fablet  <youenn@apple.com>
2248
2249         NetworkLoadChecker should upgrade redirects if needed
2250         https://bugs.webkit.org/show_bug.cgi?id=184098
2251
2252         Reviewed by Chris Dumez.
2253
2254         In case of redirections, upgrade URL according CSP.
2255
2256         * NetworkProcess/NetworkLoadChecker.cpp:
2257         (WebKit::NetworkLoadChecker::checkRequest):
2258         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
2259
2260 2018-03-30  JF Bastien  <jfbastien@apple.com>
2261
2262         Update messages.py codegen for String, fix tests
2263         https://bugs.webkit.org/show_bug.cgi?id=184179
2264         <rdar://problem/39041352>
2265
2266         Reviewed by Mark Lam.
2267
2268         I updated some of the code in
2269         https://trac.webkit.org/changeset/230097 and auto-magically used a
2270         script to update copyright headers... and that broke the tests
2271         which checked for a particular date. Update all of the headers.
2272
2273         Part of this change updates the code generated by messages.py
2274
2275         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
2276         * Scripts/webkit/MessageReceiver-expected.cpp:
2277         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
2278         * Scripts/webkit/MessagesSuperclass-expected.h:
2279         * Scripts/webkit/messages.py:
2280         * Scripts/webkit/messages_unittest.py:
2281         (GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
2282         generate a better error message
2283
2284 2018-03-29  JF Bastien  <jfbastien@apple.com>
2285
2286         Use Forward.h instead of forward-declaring WTF::String
2287         https://bugs.webkit.org/show_bug.cgi?id=184172
2288         <rdar://problem/39026146>
2289
2290         Reviewed by Yusuke Suzuki.
2291
2292         As part of #184164 I'm changing WTF::String, and the forward
2293         declarations are just wrong because I'm making it templated. We
2294         should use Forward.h anyways, so do that instead.
2295
2296         * Scripts/webkit/LegacyMessages-expected.h:
2297         * Scripts/webkit/Messages-expected.h:
2298         * Scripts/webkit/MessagesSuperclass-expected.h:
2299         * UIProcess/WebOpenPanelResultListenerProxy.h:
2300
2301 2018-03-29  Brian Burg  <bburg@apple.com>
2302
2303         Web Automation: clipToViewport is ignored for element screenshots
2304         https://bugs.webkit.org/show_bug.cgi?id=184158
2305         <rdar://problem/39014307>
2306
2307         Reviewed by Timothy Hatcher.
2308
2309         In §19.2 Take Element Screenshot, step 5.2 says that we should clip
2310         the element screenshot rect with the visible viewport rect. We don't
2311         do that right now even though we pass over clipToViewport.
2312
2313         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
2314         (WebKit::snapshotRectForScreenshot):
2315         Clip the rect to viewport if needed.
2316
2317         (WebKit::WebAutomationSessionProxy::takeScreenshot):
2318         This scrollIntoView is misplaced; by this point we have already done
2319         the math to figure out the screenshot rect. Move it before computing the rect.
2320
2321 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
2322
2323         REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection::initializeSendSource()
2324         https://bugs.webkit.org/show_bug.cgi?id=184122
2325         <rdar://problem/39003606>
2326
2327         Reviewed by Chris Dumez.
2328
2329         One of the new assertions added in r230035 begin firing while running tests locally. This was happening
2330         because the WebInspector was attempting to open a new connection to a web process that had already
2331         terminated its mach port connection (a dead port).
2332         
2333         We should avoid opening new connections when the port we were given is already dead.
2334
2335         * Platform/IPC/Connection.h:
2336         (IPC::Connection::identifierIsValid): Added.
2337         * Platform/IPC/mac/ConnectionMac.mm:
2338         (IPC::Connection::platformInitialize): Do not perform initialization on a dead (or null) port.
2339         (IPC::Connection::open): Add some assertions that ports are in a valid state.
2340         (IPC::Connection::sendOutgoingMessage): Assert that the send port is not dead.
2341         (IPC::Connection::receiveSourceEventHandler): Assert that the receive port is valid.
2342         * UIProcess/ChildProcessProxy.cpp:
2343         (WebKit::ChildProcessProxy::didFinishLaunching): Treat a dead port as a signal that the
2344         child process failed to launch.
2345         * UIProcess/Network/NetworkProcessProxy.cpp:
2346         (WebKit::NetworkProcessProxy::didFinishLaunching): Ditto.
2347         * UIProcess/Plugins/PluginProcessProxy.cpp:
2348         (WebKit::PluginProcessProxy::didFinishLaunching): Ditto.
2349         * UIProcess/Storage/StorageProcessProxy.cpp:
2350         (WebKit::StorageProcessProxy::didFinishLaunching): Ditto.
2351         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
2352         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Ditto.
2353         * WebProcess/WebPage/WebInspectorUI.cpp:
2354         (WebKit::WebInspectorUI::establishConnection): Ditto.
2355         * WebProcess/WebProcess.cpp:
2356         (WebKit::WebProcess::ensureNetworkProcessConnection): Ditto.
2357         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Ditto.
2358
2359 2018-03-29  Youenn Fablet  <youenn@apple.com>
2360
2361         Synchronize SecurityOrigin related scheme registries with NetworkProcess
2362         https://bugs.webkit.org/show_bug.cgi?id=184140
2363
2364         Reviewed by Chris Dumez.
2365
2366         Add syncing of scheme registries that are used by SecurityOrigin and ContentSecurityPolicy
2367         so that we can properly use them in NetworkProcess as we do in WebProcess.
2368         The registries that are not synced are:
2369         - URLSchemeAsEmptyDocument
2370         - URLSchemeDomainRelaxationForbidden
2371         - URLSchemeAsCachePartitioned
2372         - URLSchemeAsCanDisplayOnlyIfCanRequest
2373
2374         * NetworkProcess/NetworkProcess.cpp:
2375         (WebKit::NetworkProcess::initializeNetworkProcess):
2376         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
2377         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
2378         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
2379         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
2380         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
2381         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
2382         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
2383         * NetworkProcess/NetworkProcess.h:
2384         * NetworkProcess/NetworkProcess.messages.in:
2385         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2386         (WebKit::NetworkProcessCreationParameters::encode const):
2387         (WebKit::NetworkProcessCreationParameters::decode):
2388         * NetworkProcess/NetworkProcessCreationParameters.h:
2389         * UIProcess/WebProcessPool.cpp:
2390         (WebKit::WebProcessPool::ensureNetworkProcess):
2391         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
2392         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
2393         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
2394         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
2395         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
2396         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
2397         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
2398
2399 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
2400
2401         REGRESSION(r229480): ERROR: Unhandled web process message 'WebCookieManager:SetHTTPCookieAcceptPolicy'
2402         https://bugs.webkit.org/show_bug.cgi?id=184124
2403         <rdar://problem/38998971>
2404
2405         Reviewed by Chris Dumez.
2406
2407         Cookie accept policy messages were still being sent to the WebContent process after
2408         I removed cookie access in r229480. The WebContent process no longer recognizes these
2409         messages, and generates logging to that effect.
2410         
2411         This patch stops sending these unnecessary messages to the WebContent process. Only the
2412         Network process needs to receive this information.
2413
2414         * UIProcess/WebCookieManagerProxy.cpp:
2415         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
2416
2417 2018-03-29  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
2418
2419         [WPE] Floating point exception in WebEventFactory::createWebWheelEvent
2420         https://bugs.webkit.org/show_bug.cgi?id=184037
2421
2422         Reviewed by Žan Doberšek.
2423
2424         * Shared/wpe/WebEventFactory.cpp:
2425         (WebKit::WebEventFactory::createWebWheelEvent): Use std::copysign() to avoid division by 0.
2426
2427 2018-03-28  Zalan Bujtas  <zalan@apple.com>
2428
2429         Make it possible to override the screen size
2430         https://bugs.webkit.org/show_bug.cgi?id=184111
2431         <rdar://problem/38972181>
2432
2433         Reviewed by Tim Horton.
2434
2435         * Shared/WebPageCreationParameters.cpp:
2436         (WebKit::WebPageCreationParameters::encode const):
2437         (WebKit::WebPageCreationParameters::decode):
2438         * Shared/WebPageCreationParameters.h:
2439         * UIProcess/WebPageProxy.cpp:
2440         (WebKit::WebPageProxy::creationParameters):
2441         * UIProcess/WebPageProxy.h:
2442         * UIProcess/ios/WebPageProxyIOS.mm:
2443         (WebKit::WebPageProxy::overrideScreenSize):
2444         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2445         (WebKit::WebChromeClient::overrideScreenSize const):
2446         * WebProcess/WebCoreSupport/WebChromeClient.h:
2447         * WebProcess/WebPage/WebPage.cpp:
2448         * WebProcess/WebPage/WebPage.h:
2449         * WebProcess/WebPage/ios/WebPageIOS.mm:
2450         (WebKit::WebPage::overrideScreenSize const):
2451
2452 2018-03-28  Chris Dumez  <cdumez@apple.com>
2453
2454         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
2455         https://bugs.webkit.org/show_bug.cgi?id=183962
2456         <rdar://problem/38817833>
2457
2458         Reviewed by Brady Eidson.
2459
2460         Swap WebProcess on for the initial navigation in a new Window that was opened
2461         via window.open(), when the new URL is cross-origin compared to the opener's
2462         origin. For now, we only swap process if 'noopener' property is set when calling
2463         window.open(). This is because we do not support the remote DOMWindows yet.
2464
2465         * Shared/NavigationActionData.cpp:
2466         (WebKit::NavigationActionData::encode const):
2467         (WebKit::NavigationActionData::decode):
2468         * Shared/NavigationActionData.h:
2469         * UIProcess/API/APINavigation.h:
2470         (API::Navigation::setIsCrossOriginWindowOpenNavigation):
2471         (API::Navigation::isCrossOriginWindowOpenNavigation const):
2472         (API::Navigation::setOpener):
2473         (API::Navigation::opener const):
2474         * UIProcess/WebPageProxy.cpp:
2475         (WebKit::WebPageProxy::receivedPolicyDecision):
2476         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2477         * UIProcess/WebProcessPool.cpp:
2478         (WebKit::WebProcessPool::processForNavigation):
2479         * UIProcess/WebProcessPool.h:
2480         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2481         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2482
2483 2018-03-28  Per Arne Vollan  <pvollan@apple.com>
2484
2485         Adopt WEBPROCESS_WINDOWSERVER_BLOCKING compiler guard in WebProcess.
2486         https://bugs.webkit.org/show_bug.cgi?id=183959
2487         <rdar://problem/38965719>
2488
2489         Reviewed by Brent Fulgham.
2490
2491         Use the compile guard to guard the call to CGSSetDenyWindowServerConnections.
2492
2493         * WebProcess/WebProcess.cpp:
2494         (WebKit::WebProcess::initializeProcess):
2495
2496 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2497
2498         Unreviewed build fix after r230045.
2499
2500         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Add missing include (breaks iOS).
2501
2502 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2503
2504         Protect against invalid mach ports returned by mach_port_request_notification
2505         https://bugs.webkit.org/show_bug.cgi?id=184106
2506         <rdar://problem/37865316>
2507
2508         Reviewed by Chris Dumez.
2509
2510         * Platform/IPC/Connection.h:
2511         (IPC::Connection::Identifier::Identifier): Use default initializer syntax.
2512         * Platform/IPC/mac/ConnectionMac.mm:
2513         (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging.
2514         (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification'
2515         and clean up if it experienced an error.
2516         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2517         (WebKit::ProcessLauncher::launchProcess): Ditto.
2518
2519 2018-03-28  Dean Jackson  <dino@apple.com>
2520
2521         WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
2522         https://bugs.webkit.org/show_bug.cgi?id=184107
2523         <rdar://problem/38967492>
2524
2525         Reviewed by Tim Horton.
2526
2527         There is no need for this class to be a UIScrollViewDelegate. Instead
2528         the protocol should have an optional method that is effectively
2529         scrollViewDidScroll.
2530
2531         * UIProcess/API/Cocoa/WKWebView.mm:
2532         (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
2533         if it exists.
2534         * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
2535         and add an optional web_scrollViewDidScroll.
2536         * UIProcess/ios/WKPDFView.mm:
2537         (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
2538         (-[WKPDFView scrollViewDidScroll:]): Deleted.
2539         * UIProcess/ios/WKSystemPreviewView.mm:
2540         (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
2541
2542 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2543
2544         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
2545         https://bugs.webkit.org/show_bug.cgi?id=184092
2546         <rdar://problem/38939917>
2547
2548         Reviewed by Tim Horton.
2549
2550         Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
2551         normal text autosizing values.
2552
2553         * Shared/WebPreferences.yaml:
2554         * UIProcess/API/Cocoa/WKPreferences.mm:
2555         (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
2556         (-[WKPreferences _shouldEnableTextAutosizingBoost]):
2557         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2558
2559 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
2560
2561         Avoid uninitialized mach ports
2562         https://bugs.webkit.org/show_bug.cgi?id=184090
2563         <rdar://problem/37261129>
2564
2565         Reviewed by Chris Dumez.
2566
2567         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
2568         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
2569         there is a potential for us to try to use invalid ports.
2570
2571         We should always check return values, and ensure that the mach port variables we seek to initialize are
2572         kept in a valid state.
2573
2574         Reviewed by Chris Dumez.
2575
2576         * NetworkProcess/NetworkProcess.cpp:
2577         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess): Initialize new port to a safe default and
2578         check the return state of the allocation function.
2579         * Platform/IPC/Connection.h:
2580         * Platform/IPC/mac/ConnectionMac.mm:
2581         (IPC::Connection::open): Ditto.
2582         (IPC::Connection::initializeSendSource): Ditto.
2583         (IPC::readFromMachPort): Ditto.
2584         (IPC::Connection::receiveSourceEventHandler): Ditto.
2585         * Platform/SharedMemory.h:
2586         * Platform/cocoa/SharedMemoryCocoa.cpp:
2587         (WebKit::makeMemoryEntry): Ditto.
2588         * Platform/mac/MachUtilities.cpp:
2589         (setMachPortQueueLength): Ditto.
2590         (setMachExceptionPort): Ditto.
2591         * PluginProcess/PluginProcess.cpp:
2592         (WebKit::PluginProcess::createWebProcessConnection): Ditto.
2593         * StorageProcess/StorageProcess.cpp:
2594         (WebKit::StorageProcess::createStorageToWebProcessConnection): Ditto.
2595         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2596         (WebKit::ProcessLauncher::launchProcess): Ditto.
2597         * WebProcess/WebPage/WebInspector.cpp:
2598         (WebKit::WebInspector::openFrontendConnection): Ditto.
2599
2600 2018-03-28  Michael Catanzaro  <mcatanzaro@igalia.com>
2601
2602         Fails to build webkitgtk+ after git-svn-id: http://svn.webkit.org/repository/webkit/trunk@229877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2603         https://bugs.webkit.org/show_bug.cgi?id=184081
2604
2605         Unreviewed, switch to use UNUSED_PARAM()
2606
2607         * UIProcess/WebPageProxy.cpp:
2608         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2609
2610 2018-03-28  Tim Horton  <timothy_horton@apple.com>
2611
2612         Make use of HAVE(CORE_ANIMATION_RENDER_SERVER) in more places
2613         https://bugs.webkit.org/show_bug.cgi?id=184072
2614         <rdar://problem/38946530>
2615
2616         Reviewed by Dan Bernstein.
2617
2618         * Platform/mac/LayerHostingContext.mm:
2619         (WebKit::LayerHostingContext::createForExternalHostingProcess):
2620         * UIProcess/mac/ViewSnapshotStore.h:
2621         * UIProcess/mac/ViewSnapshotStore.mm:
2622         (WebKit::ViewSnapshot::clearImage):
2623
2624 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2625
2626         Revert an unnecessary workaround when zooming focused form controls
2627         https://bugs.webkit.org/show_bug.cgi?id=184067
2628         <rdar://problem/38805254>
2629
2630         Reviewed by Tim Horton.
2631
2632         Reverts an unintended change introduced in r227984.
2633
2634         * UIProcess/ios/WKContentViewInteraction.mm:
2635         (-[WKContentView _displayFormNodeInputView]):
2636
2637 2018-03-28  Miguel Gomez  <magomez@igalia.com>
2638
2639         [GTK][WPE] Remove UpdateAtlas
2640         https://bugs.webkit.org/show_bug.cgi?id=184042
2641
2642         Reviewed by Žan Doberšek.
2643
2644         Remove all the code related to UpdateAtlas handling.
2645
2646         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
2647         (WebKit::CoordinatedGraphicsScene::updateTilesIfNeeded):
2648         (WebKit::CoordinatedGraphicsScene::commitSceneState):
2649         (WebKit::CoordinatedGraphicsScene::purgeGLResources):
2650         (WebKit::CoordinatedGraphicsScene::syncUpdateAtlases): Deleted.
2651         (WebKit::CoordinatedGraphicsScene::createUpdateAtlas): Deleted.
2652         (WebKit::CoordinatedGraphicsScene::removeUpdateAtlas): Deleted.
2653         (WebKit::CoordinatedGraphicsScene::releaseUpdateAtlases): Deleted.
2654         * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
2655         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
2656         (WebKit::ThreadedCompositor::renderLayerTree):
2657         (WebKit::ThreadedCompositor::releaseUpdateAtlases): Deleted.
2658         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
2659         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
2660         (WebKit::WebChromeClient::delegatedScrollRequested):
2661         (WebKit::WebChromeClient::resetUpdateAtlasForTesting): Deleted.
2662         * WebProcess/WebCoreSupport/WebChromeClient.h:
2663         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
2664         (WebKit::AcceleratedDrawingArea::resetUpdateAtlasForTesting): Deleted.
2665         * WebProcess/WebPage/AcceleratedDrawingArea.h:
2666         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
2667         (WebKit::CompositingCoordinator::CompositingCoordinator):
2668         (WebKit::CompositingCoordinator::flushPendingLayerChanges):
2669         (WebKit::CompositingCoordinator::clearPendingStateChanges):
2670         (WebKit::CompositingCoordinator::renderNextFrame):
2671         (WebKit::CompositingCoordinator::purgeBackingStores):
2672         (WebKit::CompositingCoordinator::createUpdateAtlas): Deleted.
2673         (WebKit::CompositingCoordinator::removeUpdateAtlas): Deleted.
2674         (WebKit::CompositingCoordinator::getCoordinatedBuffer): Deleted.
2675         (): Deleted.
2676         (WebKit::CompositingCoordinator::scheduleReleaseInactiveAtlases): Deleted.
2677         (WebKit::CompositingCoordinator::releaseInactiveAtlasesTimerFired): Deleted.
2678         (WebKit::CompositingCoordinator::releaseAtlases): Deleted.
2679         (WebKit::CompositingCoordinator::clearUpdateAtlases): Deleted.
2680         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
2681         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
2682         (WebKit::CoordinatedLayerTreeHost::clearUpdateAtlases): Deleted.
2683         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
2684         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
2685         (WebKit::ThreadedCoordinatedLayerTreeHost::releaseUpdateAtlases): Deleted.
2686         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
2687         * WebProcess/WebPage/DrawingArea.h:
2688         * WebProcess/WebPage/LayerTreeHost.h:
2689         (WebKit::LayerTreeHost::setIsDiscardable):
2690
2691 2018-03-28  Carlos Garcia Campos  <cgarcia@igalia.com>
2692
2693         REGRESSION(r229998): WebDriver: MiniBrowser is crashing in a lot of tests after r229998
2694         https://bugs.webkit.org/show_bug.cgi?id=184075
2695
2696         Reviewed by Žan Doberšek.
2697
2698         This is because we are using a value after it has been moved.
2699
2700         * UIProcess/Automation/WebAutomationSession.cpp:
2701         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext): Save a reference to page in a local variable
2702         before using it when it's also going to be moved in the lambda capture.
2703
2704 2018-03-27  Michael Catanzaro  <mcatanzaro@igalia.com>
2705
2706         Unreviewed, fix typo in variable name
2707
2708         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
2709         (webkitWebViewBaseCrossingNotifyEvent):
2710
2711 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
2712
2713         The layout test fast/canvas/webgl/read-pixels-test.html is timing out.
2714         https://bugs.webkit.org/show_bug.cgi?id=183923
2715         <rdar://problem/38756869>
2716
2717         Reviewed by Brent Fulgham.
2718
2719         Send OpenGL display mask to the WebContent process when the display ID is changing.
2720
2721         * UIProcess/WebPageProxy.cpp:
2722         (WebKit::WebPageProxy::windowScreenDidChange):
2723         * WebProcess/WebPage/WebPage.h:
2724         * WebProcess/WebPage/WebPage.messages.in:
2725         * WebProcess/WebPage/mac/WebPageMac.mm:
2726         (WebKit::WebPage::openGLDisplayMaskChanged):
2727
2728 2018-03-27  Youenn Fablet  <youenn@apple.com>
2729
2730         Move request checking out of PingLoad for future reuse in NetworkLoad
2731         https://bugs.webkit.org/show_bug.cgi?id=183865
2732
2733         Reviewed by Chris Dumez.
2734
2735         Introduce NetworkLoadChecker as a way to validate requests before sending them in the network process.
2736         Validation encompasses: CORS checks, CSP and Content Extensions on both main request and redirected requests if any.
2737
2738         Make PingLoad use NetworkLoadChecker. Future patch should make NetworkLoad to use it as well whenever needed.
2739
2740         Make NetworkCORSPreflightChecker takes a CompletionHandler instead of a Function.
2741         Ensure this callback is called even if preflight is not completed by returning a Canceled error.
2742
2743         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
2744         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
2745         (WebKit::NetworkCORSPreflightChecker::returnResult):
2746         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
2747         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
2748         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
2749         * NetworkProcess/NetworkCORSPreflightChecker.h:
2750         * NetworkProcess/NetworkLoadChecker.cpp: Added.
2751         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2752         (WebKit::NetworkLoadChecker::check):
2753         (WebKit::NetworkLoadChecker::checkRedirection):
2754         (WebKit::NetworkLoadChecker::returnError):
2755         (WebKit::NetworkLoadChecker::checkRequest):
2756         (WebKit::NetworkLoadChecker::checkCORSRequest):
2757         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
2758         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2759         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2760         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
2761         (WebKit::NetworkLoadChecker::contentExtensionsBackend):
2762         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2763         * NetworkProcess/NetworkLoadChecker.h: Added.
2764         (WebKit::NetworkLoadChecker::setCSPResponseHeaders):
2765         (WebKit::NetworkLoadChecker::setContentExtensionRuleLists):
2766         (WebKit::NetworkLoadChecker::url const):
2767         (WebKit::NetworkLoadChecker::storedCredentialsPolicy const):
2768         (WebKit::NetworkLoadChecker::isChecking const):
2769         (WebKit::NetworkLoadChecker::isRedirected const):
2770         * NetworkProcess/PingLoad.cpp:
2771         (WebKit::PingLoad::PingLoad):
2772         (WebKit::PingLoad::~PingLoad):
2773         (WebKit::PingLoad::willPerformHTTPRedirection):
2774         (WebKit::PingLoad::didReceiveChallenge):
2775         (WebKit::PingLoad::wasBlocked):
2776         (WebKit::PingLoad::cannotShowURL):
2777         (WebKit::PingLoad::timeoutTimerFired):
2778         (WebKit::PingLoad::currentURL const):
2779         * NetworkProcess/PingLoad.h:
2780         * WebKit.xcodeproj/project.pbxproj:
2781
2782 2018-03-27  Jiewen Tan  <jiewen_tan@apple.com>
2783
2784         [WebAuthN] Implement authenticatorGetAssertion
2785         https://bugs.webkit.org/show_bug.cgi?id=183881
2786         <rdar://problem/37258628>
2787
2788         Reviewed by Brent Fulgham.
2789
2790         * Shared/WebPreferences.yaml:
2791         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.cpp:
2792         (WebKit::WebCredentialsMessengerProxy::makeCredential):
2793         (WebKit::WebCredentialsMessengerProxy::getAssertion):
2794         (WebKit::WebCredentialsMessengerProxy::getAssertionReply):
2795         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.h:
2796         * UIProcess/CredentialManagement/WebCredentialsMessengerProxy.messages.in:
2797         * WebProcess/CredentialManagement/WebCredentialsMessenger.cpp:
2798         (WebKit::WebCredentialsMessenger::getAssertion):
2799         (WebKit::WebCredentialsMessenger::getAssertionReply):
2800         * WebProcess/CredentialManagement/WebCredentialsMessenger.messages.in:
2801
2802 2018-03-27  Chris Dumez  <cdumez@apple.com>
2803
2804         Avoid constructing SecurityOrigin objects from non-main threads
2805         https://bugs.webkit.org/show_bug.cgi?id=184024
2806
2807         Reviewed by Youenn Fablet.
2808
2809         Avoid constructing SecurityOrigin objects from non-main threads as much as possible.
2810
2811         * WebProcess/Storage/WebSWClientConnection.cpp:
2812         (WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
2813         (WebKit::WebSWClientConnection::matchRegistration):
2814         (WebKit::WebSWClientConnection::getRegistrations):
2815         * WebProcess/Storage/WebSWClientConnection.h:
2816         * WebProcess/Storage/WebSWOriginTable.cpp:
2817         (WebKit::WebSWOriginTable::contains const):
2818         * WebProcess/Storage/WebSWOriginTable.h:
2819
2820 2018-03-27  Chris Dumez  <cdumez@apple.com>
2821
2822         Move online state detection from the WebProcess to the NetworkProcess
2823         https://bugs.webkit.org/show_bug.cgi?id=183989
2824         <rdar://problem/37093299>
2825
2826         Reviewed by Youenn Fablet.
2827
2828         Move online state detection from the WebProcess to the NetworkProcess. This avoid executing the same (expensive) code in
2829         EACH web process whenever a network interface's state changes. Now, the Network Process monitors network interfaces
2830         and determines the online state whenever an interface's state changes. If the onLine state changes, it notifies all
2831         its connected WebProcesses via IPC.
2832
2833         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2834         (WebKit::NetworkConnectionToWebProcess::setOnLineState):
2835         * NetworkProcess/NetworkConnectionToWebProcess.h:
2836         * NetworkProcess/NetworkProcess.cpp:
2837         (WebKit::NetworkProcess::NetworkProcess):
2838         (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
2839         * WebProcess/Network/NetworkProcessConnection.cpp:
2840         (WebKit::NetworkProcessConnection::setOnLineState):
2841         * WebProcess/Network/NetworkProcessConnection.h:
2842         * WebProcess/Network/NetworkProcessConnection.messages.in:
2843         * WebProcess/Network/WebLoaderStrategy.cpp:
2844         (WebKit::WebLoaderStrategy::isOnLine const):
2845         (WebKit::WebLoaderStrategy::addOnlineStateChangeListener):
2846         (WebKit::WebLoaderStrategy::setOnLineState):
2847         * WebProcess/Network/WebLoaderStrategy.h:
2848
2849 2018-03-27  Wenson Hsieh  <wenson_hsieh@apple.com>
2850
2851         [Extra zoom mode] Add support for new focused form control overlay behaviors
2852         https://bugs.webkit.org/show_bug.cgi?id=184043
2853         <rdar://problem/38758727>
2854
2855         Reviewed by Tim Horton.
2856
2857         See below for more details.
2858
2859         * UIProcess/ios/WKContentViewInteraction.mm:
2860         (-[WKContentView _willStartScrollingOrZooming]):
2861         (-[WKContentView _didEndScrollingOrZooming]):
2862
2863         Suppress focused form control navigation while the scroll view is undergoing a scroll or zoom animation (e.g.,
2864         when moving from one focused form control to another).
2865
2866         (-[WKContentView textInputController:didCommitText:withSuggestion:]):
2867
2868         When dismissing an input view controller, allow focused form control navigation only after updating assisted
2869         node information to ensure that focus rects aren't stale as the user begins to navigate between forms.
2870
2871         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]):
2872         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]):
2873         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]):
2874         (-[WKContentView scrollViewForFocusedFormControlController:]):
2875         (-[WKContentView highlightedRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2876
2877         Implement some new focused form overlay delegate hooks to vend the scroll view, as well as the rects of next and
2878         previous focusable form controls.
2879
2880 2018-03-27  Brent Fulgham  <bfulgham@apple.com>
2881
2882         Further refine cookie read/write logging
2883         https://bugs.webkit.org/show_bug.cgi?id=184044
2884         <rdar://problem/38915610>
2885
2886         Reviewed by Chris Dumez.
2887
2888         Cookie logging was passing the partition, rather than the first party, when logging, which
2889         prevented logging in cases where partitioning or blocking was active. This patch corrects
2890         these calls so that logging is generated in these cases, too.
2891
2892         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2893         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): Call log routines if needed.
2894         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): Ditto.
2895         * NetworkProcess/NetworkResourceLoader.cpp:
2896         (WebKit::escapeIDForJSON): Make available to use in multiple functions.
2897         (WebKit::NetworkResourceLoader::logCookieInformation const): Revise to use shared
2898         convenience functions.
2899         (WebKit::logBlockedCookieInformation): Added.
2900         (WebKit::logCookieInformationInternal): Added.
2901         (WebKit::NetworkResourceLoader::logCookieInformation): Revise to use shared
2902         convenience functions.
2903         * NetworkProcess/NetworkResourceLoader.h:
2904
2905 2018-03-27  Brian Burg  <bburg@apple.com>
2906
2907         Web Automation: support enter/exit fullscreen and hide/restore window operations
2908         https://bugs.webkit.org/show_bug.cgi?id=182837
2909         <rdar://problem/37580732>
2910
2911         Reviewed by Tim Horton.
2912
2913         The W3C specification is more explicit about when to exit fullscreen and
2914         restore the window for a browsing context. So, WebKit needs to have support
2915         for performing these operations on behalf of a driver.
2916
2917         Based on prototyping, it is sufficient to use a JavaScript atom to enter
2918         fullscreen mode. This is included in the patch as EnterFullscreen.js and
2919         can be used to implement the §10.7.5 Fullscreen Window command.
2920
2921         Other window operations cannot be peformed from JavaScript, so we need to
2922         delegate these operations to the session client (i.e., Safari).
2923         This patch adds session client callouts for restoring, minimizing, and
2924         switching to a browsing context.
2925
2926         Exiting fullscreen happens implicitly (per specification) when setting a
2927         window frame without an actual frame, or when switching/restoring/minimizing a window.
2928         If needed, a driver can call Set Window Rect in this way to unfullscreen a context.
2929         Similarly, a driver can restore a minimized window using Set Window Rect.
2930
2931         * UIProcess/API/APIAutomationSessionClient.h:
2932         (API::AutomationSessionClient::requestHideWindowOfPage):
2933         (API::AutomationSessionClient::requestRestoreWindowOfPage):
2934         (API::AutomationSessionClient::requestSwitchToPage):
2935         Add new API client methods.
2936
2937         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
2938         Add new Cocoa API delegate methods.
2939
2940         * UIProcess/Automation/Automation.json:
2941         Make the switch to browsing context command asynchronous, since this functionality
2942         is not always synchronous, and we prefer to use completion handlers in the delegates.
2943
2944         Add new protocol method for hiding the window of a browsing context.
2945         This is expected to minimize/miniaturize a window for desktop window managers.
2946
2947         * UIProcess/Automation/WebAutomationSession.h:
2948         * UIProcess/Automation/WebAutomationSession.cpp:
2949         (WebKit::WebAutomationSession::switchToBrowsingContext):
2950         Make this function asynchronous. Call out to the session client.
2951
2952         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
2953         Follow the steps in the specification to restore window and exit fullscreen.
2954
2955         (WebKit::WebAutomationSession::hideWindowOfBrowsingContext):
2956         Exit fullscreen and call out to the session client.
2957
2958         (WebKit::WebAutomationSession::exitFullscreenWindowForPage):
2959         This is a little strange. Because there is no async API for exiting fullscreen
2960         from C++ code, we hook into willEnterFullScreen and didExitFullScreen and send
2961         out the response if the page exited fullscreen after we requested it to do so.
2962         Because the W3C specification mandates that drivers only process one command at
2963         a time, there will only ever be one callback installed by this method at a time.
2964
2965         (WebKit::WebAutomationSession::restoreWindowForPage):
2966         (WebKit::WebAutomationSession::hideWindowForPage):
2967         Call out to the session client.
2968
2969         (WebKit::WebAutomationSession::didEnterFullScreenForPage):
2970         (WebKit::WebAutomationSession::didExitFullScreenForPage):
2971         Add methods to be called by instrumentation hooks in WebFullScreenManagerProxy.
2972
2973         * UIProcess/Automation/atoms/EnterFullscreen.js: Added.
2974         (enterFullscreen):
2975
2976         * UIProcess/Cocoa/AutomationSessionClient.h:
2977         * UIProcess/Cocoa/AutomationSessionClient.mm:
2978         (WebKit::AutomationSessionClient::AutomationSessionClient):
2979         (WebKit::AutomationSessionClient::requestSwitchToPage):
2980         (WebKit::AutomationSessionClient::requestHideWindowOfPage):
2981         (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
2982         (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
2983         Add boilerplate to convert C++ API client to Objective-C delegate methods.
2984
2985         * UIProcess/WebFullScreenManagerProxy.cpp:
2986         (WebKit::WebFullScreenManagerProxy::didEnterFullScreen):
2987         (WebKit::WebFullScreenManagerProxy::didExitFullScreen):
2988         Notify the automation session if the page is under automation and
2989         enters or exits fullscreen.
2990
2991         * WebKit.xcodeproj/project.pbxproj:
2992         Add EnterFullscreen.js to the list of WebDriver atoms. These are copied
2993         as WebKit2 private headers and used by driver implementations.
2994
2995 2018-03-27  Eric Carlson  <eric.carlson@apple.com>
2996
2997         Make AVFoundationEnabled preference available on iOS
2998         https://bugs.webkit.org/show_bug.cgi?id=183876
2999         <rdar://problem/38726459>
3000
3001         Reviewed by Youenn Fablet.
3002
3003         * Shared/WebPreferences.yaml: Set AVFoundationEnabled with DEFAULT_AVFOUNDATION_ENABLED.
3004         * Shared/WebPreferencesDefaultValues.h:
3005
3006         * UIProcess/API/Cocoa/WKPreferences.mm:
3007         (-[WKPreferences _setAVFoundationEnabled:]): Enable for iOS.
3008         (-[WKPreferences _avFoundationEnabled]): Ditto.
3009         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3010
3011 2018-03-26  Tim Horton  <timothy_horton@apple.com>
3012
3013         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebKit
3014         https://bugs.webkit.org/show_bug.cgi?id=184030
3015         <rdar://problem/38895281>
3016
3017         Reviewed by Dan Bernstein.
3018
3019         * Configurations/Base.xcconfig:
3020         * Configurations/BaseTarget.xcconfig:
3021         * Configurations/WebKit.xcconfig:
3022
3023 2018-03-26  Tim Horton  <timothy_horton@apple.com>
3024
3025         Add and adopt HAVE(CORE_ANIMATION_RENDER_SERVER)
3026         https://bugs.webkit.org/show_bug.cgi?id=184026
3027         <rdar://problem/38883321>
3028
3029         Reviewed by Sam Weinig.
3030
3031         * UIProcess/API/Cocoa/WKWebView.mm:
3032         (-[WKWebView _takeViewSnapshot]):
3033         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
3034
3035 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3036
3037         [Extra zoom mode] Refactor input view controller presentation and dismissal helpers
3038         https://bugs.webkit.org/show_bug.cgi?id=184020
3039         Work towards <rdar://problem/38758727>
3040
3041         Reviewed by Tim Horton.
3042
3043         We currently have separate presentation and dismissal helpers for each type of view controller corresponding to
3044         a focused element type. This is excessive, considering that all of these helpers are only invoked from one place
3045         (either -presentViewControllerForCurrentAssistedNode or -dismissAllInputViewControllers), with the exception of
3046         the focused form control overlay.
3047
3048         This refactoring allows us to then adjust the timing of first responder restoration logic, such that the focused
3049         form control view controller can receive forwarded events from the web view. See below for more detail.
3050
3051         * UIProcess/ios/WKContentViewInteraction.mm:
3052         (-[WKContentView presentFocusedFormControlViewController:]):
3053         (-[WKContentView dismissFocusedFormControlViewController:]):
3054
3055         Remove logic to restore the web view as first responder.
3056
3057         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3058         (-[WKContentView dismissAllInputViewControllers]):
3059
3060         Restore first responder after dismissing a view controller that was presented when focusing a form control, only
3061         if the web view was first responder before presentation.
3062
3063         (-[WKContentView presentDatePickerViewController:]): Deleted.
3064         (-[WKContentView dismissDatePickerViewController:]): Deleted.
3065         (-[WKContentView presentTimePickerViewController:]): Deleted.
3066         (-[WKContentView dismissTimePickerViewController:]): Deleted.
3067         (-[WKContentView presentSelectMenuViewController:]): Deleted.
3068         (-[WKContentView dismissSelectMenuViewController:]): Deleted.
3069         (-[WKContentView dismissNumberPadViewController:]): Deleted.
3070         (-[WKContentView presentNumberPadViewController:]): Deleted.
3071         (-[WKContentView presentTextInputViewController:]): Deleted.
3072         (-[WKContentView dismissTextInputViewController:]): Deleted.
3073
3074 2018-03-06  Brian Burg  <bburg@apple.com>
3075
3076         Web Automation: provide a way to ask clients for a new tab or window
3077         https://bugs.webkit.org/show_bug.cgi?id=183381
3078         <rdar://problem/38167301>
3079
3080         Reviewed by Timothy Hatcher.
3081
3082         Add support for specifying browsing context options when requesting
3083         a new browsing context from the automation session client/delegate.
3084         This is currently just used for specifying tab vs window, but could
3085         also be used for things like toggling certain browser chrome or features.
3086
3087         There is no guarantee that the client has a notion of tabs vs windows,
3088         so this option is purely advisory and should not cause the command to
3089         fail if it cannot be honored.
3090
3091         This behavior caused by specifying this option is client-specific, so no
3092         new tests are included in WebKit for this change.
3093
3094         * UIProcess/API/APIAutomationSessionClient.h:
3095         (API::AutomationSessionClient::didRequestNewPageWithOptions):
3096         (API::AutomationSessionClient::didRequestNewWindow): Deleted.
3097         Add options parameter.
3098
3099         * UIProcess/API/glib/WebKitAutomationSession.cpp:
3100         Adjust to new signature. More work is needed to plumb this information
3101         to the public API for GTK/WPE and support it in WebKitGTK driver.
3102
3103         * UIProcess/Automation/Automation.json: Add new optional parameter.
3104
3105         * UIProcess/Automation/WebAutomationSession.h:
3106         * UIProcess/Automation/WebAutomationSession.cpp:
3107         (WebKit::WebAutomationSession::createBrowsingContext):
3108         Convert the protocol option to an API option.
3109
3110         * UIProcess/Cocoa/AutomationSessionClient.h:
3111         * UIProcess/Cocoa/AutomationSessionClient.mm:
3112         (WebKit::AutomationSessionClient::AutomationSessionClient):
3113         (WebKit::toAPI):
3114         (WebKit::AutomationSessionClient::didRequestNewPageWithOptions):
3115         (WebKit::AutomationSessionClient::didRequestNewWindow): Deleted.
3116         Convert the internal option to a Cocoa SPI option and pass it along.
3117
3118         * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
3119         Adjust delegate methods to include options. Clients need to adopt the new signature(s).
3120
3121 2018-03-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3122
3123         [Extra zoom mode] Add plumbing for next and previous focusable element rects
3124         https://bugs.webkit.org/show_bug.cgi?id=184016
3125         Work towards <rdar://problem/38758727>
3126
3127         Reviewed by Tim Horton.
3128
3129         When building up AssistedNodeInformation, we currently compute the element rect of the current focused element,
3130         as well as flags indicating whether or not there are next or previous focusable elements. For
3131         <rdar://problem/38758727>, we additionally send the rects of the next or previous focusable elements as well.
3132
3133         * Shared/AssistedNodeInformation.cpp:
3134         (WebKit::AssistedNodeInformation::encode const):
3135         (WebKit::AssistedNodeInformation::decode):
3136
3137         IPC support for nextNodeRect and previousNodeRect.
3138
3139         * Shared/AssistedNodeInformation.h:
3140         * WebProcess/WebPage/ios/WebPageIOS.mm:
3141         (WebKit::elementRectInRootViewCoordinates):
3142
3143         Add a helper to compute an element's rect in root view coordinates. We use this to compute the rects of the
3144         current focused element as well as those of the next and previous elements, if any.
3145
3146         (WebKit::WebPage::getAssistedNodeInformation):
3147         (WebKit::hasAssistableElement): Deleted.
3148
3149         Since we need the next or previous focusable element to get its rect, we don't need this helper anymore.
3150
3151 2018-03-26  Chris Dumez  <cdumez@apple.com>
3152
3153         Use SecurityOriginData more consistently in Service Worker code
3154         https://bugs.webkit.org/show_bug.cgi?id=183969
3155
3156         Reviewed by Darin Adler.
3157
3158         Use SecurityOriginData more consistently in Service Worker code to avoid constructing
3159         SecurityOrigin objects unnecessarily.
3160
3161         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3162         (WebKit::NetworkResourceLoadParameters::encode const):
3163         * Shared/API/c/WKSecurityOriginRef.cpp:
3164         (WKSecurityOriginCopyDatabaseIdentifier):
3165         * StorageProcess/ServiceWorker/WebSWOriginStore.cpp:
3166         (WebKit::WebSWOriginStore::addToStore):
3167         (WebKit::WebSWOriginStore::removeFromStore):
3168         * StorageProcess/ServiceWorker/WebSWOriginStore.h:
3169         * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
3170         (WebKit::WebSWServerConnection::scheduleJobInServer):
3171         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
3172         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3173         (WebKit::WebSWServerToContextConnection::WebSWServerToContextConnection):
3174         * StorageProcess/ServiceWorker/WebSWServerToContextConnection.h:
3175         * StorageProcess/StorageProcess.cpp:
3176         (WebKit::StorageProcess::connectionToContextProcessWasClosed):
3177         (WebKit::StorageProcess::needsServerToContextConnectionForOrigin const):
3178         (WebKit::StorageProcess::createStorageToWebProcessConnection):
3179         (WebKit::StorageProcess::deleteWebsiteDataForOrigins):
3180         (WebKit::StorageProcess::serverToContextConnectionForOrigin):
3181         (WebKit::StorageProcess::createServerToContextConnection):
3182         (WebKit::StorageProcess::swContextConnectionMayNoLongerBeNeeded):
3183         * StorageProcess/StorageProcess.h:
3184         * UIProcess/API/APIFrameInfo.cpp:
3185         (API::FrameInfo::create):
3186         * UIProcess/API/C/WKApplicationCacheManager.cpp:
3187         (WKApplicationCacheManagerDeleteEntriesForOrigin):
3188         * UIProcess/API/C/WKKeyValueStorageManager.cpp:
3189         (WKKeyValueStorageManagerDeleteEntriesForOrigin):
3190         * UIProcess/API/C/WKResourceCacheManager.cpp:
3191         (WKResourceCacheManagerClearCacheForOrigin):
3192         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3193         (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
3194         (WKWebsiteDataStoreGetFetchCacheSizeForOrigin):
3195         * UIProcess/ServiceWorkerProcessProxy.cpp:
3196         (WebKit::ServiceWorkerProcessProxy::create):
3197         (WebKit::ServiceWorkerProcessProxy::ServiceWorkerProcessProxy):
3198         (WebKit::ServiceWorkerProcessProxy::getLaunchOptions):
3199         * UIProcess/ServiceWorkerProcessProxy.h:
3200         * UIProcess/Storage/StorageProcessProxy.cpp:
3201         (WebKit::StorageProcessProxy::getStorageProcessConnection):
3202         * UIProcess/WebProcessPool.cpp:
3203         (WebKit::WebProcessPool::establishWorkerContextConnectionToStorageProcess):
3204         (WebKit::WebProcessPool::disconnectProcess):
3205         (WebKit::WebProcessPool::updateProcessAssertions):
3206         * UIProcess/WebProcessPool.h:
3207         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
3208         (WebKit::WebsiteDataStore::fetchDataAndApply):
3209         * WebProcess/Geolocation/GeolocationPermissionRequestManager.cpp:
3210         (WebKit::GeolocationPermissionRequestManager::startRequestForGeolocation):
3211         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3212         (WKBundlePageCopyOriginsWithApplicationCache):
3213         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3214         (WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
3215         (WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):
3216         * WebProcess/Storage/WebSWClientConnection.cpp:
3217         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
3218         (WebKit::WebSWClientConnection::matchRegistration):
3219         (WebKit::WebSWClientConnection::whenRegistrationReady):
3220         (WebKit::WebSWClientConnection::getRegistrations):
3221         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3222         (WebKit::WebChromeClient::exceededDatabaseQuota):
3223         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
3224         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3225         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3226         * WebProcess/WebProcess.cpp:
3227         (WebKit::WebProcess::fetchWebsiteData):
3228         * WebProcess/WebStorage/StorageAreaImpl.cpp:
3229         (WebKit::StorageAreaImpl::securityOrigin const):
3230         * WebProcess/WebStorage/StorageAreaImpl.h:
3231         * WebProcess/WebStorage/StorageAreaMap.cpp:
3232         (WebKit::StorageAreaMap::StorageAreaMap):
3233         (WebKit::StorageAreaMap::dispatchSessionStorageEvent):
3234         (WebKit::StorageAreaMap::dispatchLocalStorageEvent):
3235         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
3236         (WebKit::StorageNamespaceImpl::didDestroyStorageAreaMap):
3237
3238 2018-03-26  Brent Fulgham  <bfulgham@apple.com>
3239
3240         Warn against cookie access in the WebContent process using ProcessPrivilege assertions
3241         https://bugs.webkit.org/show_bug.cgi?id=183911
3242         <rdar://problem/38762306>
3243
3244         Reviewed by Youenn Fablet.
3245
3246         Add a set of ProcessPrivilege assertions to enforce the rule that the WebContent process
3247         should never call Cookie API directly. That should only happen in the Networking or
3248         UIProcess. 
3249
3250         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
3251         (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy):
3252         (WebKit::WebCookieManager::platformGetHTTPCookieAcceptPolicy):
3253         * NetworkProcess/NetworkProcess.cpp:
3254         (WebKit::NetworkProcess::initializeNetworkProcess):
3255         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
3256         (WebKit::NetworkDataTaskCocoa::applyCookieBlockingPolicy):
3257         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
3258         (WebKit::NetworkProcess::setSharedHTTPCookieStorage):
3259         (WebKit::NetworkProcess::syncAllCookies):
3260         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3261         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
3262         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3263         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
3264         * PluginProcess/PluginProcess.cpp:
3265         (WebKit::PluginProcess::initializeProcess):
3266         * Shared/cf/CookieStorageUtilsCF.mm:
3267         (WebKit::cookieStorageFromIdentifyingData):
3268         (WebKit::identifyingDataFromCookieStorage):
3269         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
3270         (WebKit::WebProcessPool::platformInitializeWebProcess):
3271         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
3272         (WebKit::privateBrowsingSession):
3273         * UIProcess/WebProcessPool.cpp:
3274         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
3275         (WebKit::WebsiteDataStore::parameters):
3276         * UIProcess/mac/WebCookieManagerProxyMac.mm:
3277         (WebKit::WebCookieManagerProxy::persistHTTPCookieAcceptPolicy):
3278         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3279         (WebKit::InjectedBundle::setPrivateBrowsingEnabled):
3280         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3281         (WebKit::WebFrameLoaderClient::createNetworkingContext):
3282         * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
3283         (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession):
3284         (WebKit::WebFrameNetworkingContext::storageSession const):
3285         * WebProcess/WebProcess.cpp:
3286         (WebKit::WebProcess::initializeProcess):
3287
3288 2018-03-26  Alex Christensen  <achristensen@webkit.org>
3289
3290         Merge ResourceHandleClient::willCacheResponseAsync with ResourceHandleClient::willCacheResponse
3291         https://bugs.webkit.org/show_bug.cgi?id=183965
3292
3293         Reviewed by Chris Dumez.
3294
3295         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3296         (WebKit::WebFrameLoaderClient::willCacheResponse const):
3297         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
3298
3299 2018-03-25  Carlos Garcia Campos  <cgarcia@igalia.com>
3300
3301         [GTK][WPE] Add API to convert between DOM and JSCValue
3302         https://bugs.webkit.org/show_bug.cgi?id=183448
3303
3304         Reviewed by Michael Catanzaro.
3305
3306         Add methods to get a JSCValue for a WebKitDOMObject and to create a WebKitDOMNode from a JSCValue. Deprecate
3307         most of the GTK+ DOM bindings API and move the non-deprecated parts to glib dir to be exposed by WPE too.
3308
3309         * PlatformGTK.cmake:
3310         * PlatformWPE.cmake:
3311         * SourcesGTK.txt:
3312         * SourcesWPE.txt:
3313         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
3314         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.cpp.
3315         * WebProcess/InjectedBundle/API/glib/DOM/DOMObjectCache.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
3316         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocument.cpp: Added.
3317         (WebKit::kit):
3318         (WebKit::core):
3319         (WebKit::wrapDocument):
3320         (webkit_dom_document_class_init):
3321         (webkit_dom_document_init):
3322         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMDocumentPrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentPrivate.h.
3323         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElement.cpp: Added.
3324         (WebKit::kit):
3325         (WebKit::core):
3326         (WebKit::wrapElement):
3327         (webkit_dom_element_class_init):
3328         (webkit_dom_element_init):
3329         (webkit_dom_element_html_input_element_is_user_edited):
3330         (webkit_dom_element_html_input_element_get_auto_filled):
3331         (webkit_dom_element_html_input_element_set_auto_filled):
3332         (webkit_dom_element_html_input_element_set_editing_value):
3333         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMElementPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementPrivate.h.
3334         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNode.cpp: Added.
3335         (_WebKitDOMNodePrivate::~_WebKitDOMNodePrivate):
3336         (WebKit::kit):
3337         (WebKit::core):
3338         (WebKit::wrapNode):
3339         (webkitDOMNodeConstructor):
3340         (webkitDOMNodeFinalize):
3341         (webkit_dom_node_init):
3342         (webkit_dom_node_class_init):
3343         (webkitDOMNodeSetCoreObject):
3344         (webkitDOMNodeGetCoreObject):
3345         (webkit_dom_node_for_js_value):
3346         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMNodePrivate.h: Copied from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMNodePrivate.h.
3347         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMObject.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMObject.cpp.
3348         (webkitDOMObjectSetProperty):
3349         (webkit_dom_object_class_init):
3350         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.cpp: Added.
3351         (WebKit::wrap):
3352         * WebProcess/InjectedBundle/API/glib/DOM/WebKitDOMPrivate.h: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/DOMObjectCache.h.
3353         * WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp:
3354         (webkit_frame_get_js_value_for_dom_object):
3355         (webkit_frame_get_js_value_for_dom_object_in_script_world):
3356         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
3357         (webkit_web_page_class_init):
3358         (webkitWebPageCreate):
3359         (webkit_web_page_get_dom_document):
3360         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectEventListener.cpp:
3361         (WebKit::GObjectEventListener::handleEvent):
3362         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectNodeFilterCondition.cpp:
3363         * WebProcess/InjectedBundle/API/gtk/DOM/GObjectXPathNSResolver.cpp:
3364         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.cpp:
3365         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMAttr.h:
3366         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.cpp:
3367         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMBlob.h:
3368         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.cpp:
3369         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCDATASection.h:
3370         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.cpp:
3371         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRule.h:
3372         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.cpp:
3373         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSRuleList.h:
3374         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.cpp:
3375         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleDeclaration.h:
3376         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.cpp:
3377         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSStyleSheet.h:
3378         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.cpp:
3379         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCSSValue.h:
3380         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.cpp:
3381         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMCharacterData.h:
3382         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.cpp:
3383         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRect.h:
3384         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.cpp:
3385         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMClientRectList.h:
3386         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.cpp:
3387         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMComment.h:
3388         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.cpp:
3389         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMImplementation.h:
3390         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.cpp:
3391         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMSelection.h:
3392         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.cpp:
3393         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMTokenList.h:
3394         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
3395         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.h:
3396         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDeprecated.cpp:
3397         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.h:
3398         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.cpp:
3399         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentFragment.h:
3400         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp.
3401         (webkitDOMDocumentDOMEventTargetInit):
3402         (webkitDOMDocumentInstallProperties):
3403         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.cpp:
3404         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentType.h:
3405         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.h:
3406         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Renamed from Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp.
3407         (webkitDOMElementDOMEventTargetInit):
3408         (webkitDOMElementInstallProperties):
3409         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.cpp:
3410         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEvent.h:
3411         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.cpp:
3412         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMEventTarget.h:
3413         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.cpp:
3414         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFile.h:
3415         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.cpp:
3416         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMFileList.h:
3417         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.cpp:
3418         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAnchorElement.h:
3419         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.cpp:
3420         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAppletElement.h:
3421         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.cpp:
3422         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLAreaElement.h:
3423         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.cpp:
3424         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMHTMLBRElement.h: