Adjust geolocation feature flag
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-20  Tim Horton  <timothy_horton@apple.com>
2
3         Adjust geolocation feature flag
4         https://bugs.webkit.org/show_bug.cgi?id=184856
5
6         Reviewed by Wenson Hsieh.
7
8         * Configurations/FeatureDefines.xcconfig:
9
10 2018-04-20  Chris Dumez  <cdumez@apple.com>
11
12         Unreviewed attempt to fix GTK build after r230867.
13
14         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDOMWindow.cpp:
15         (webkit_dom_dom_window_get_self):
16         (webkit_dom_dom_window_get_window):
17         (webkit_dom_dom_window_get_frames):
18         (webkit_dom_dom_window_get_opener):
19         (webkit_dom_dom_window_get_parent):
20         (webkit_dom_dom_window_get_top):
21
22 2018-04-20  Commit Queue  <commit-queue@webkit.org>
23
24         Unreviewed, rolling out r230873.
25         https://bugs.webkit.org/show_bug.cgi?id=184857
26
27         Broke the iOS build (Requested by cdumez on #webkit).
28
29         Reverted changeset:
30
31         "Disable backward and forward navigation swipes while in
32         fullscreen."
33         https://bugs.webkit.org/show_bug.cgi?id=184656
34         https://trac.webkit.org/changeset/230873
35
36 2018-04-20  Chris Dumez  <cdumez@apple.com>
37
38         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
39         https://bugs.webkit.org/show_bug.cgi?id=184210
40         <rdar://problem/39072354>
41
42         Reviewed by Wenson Hsieh.
43
44         r229828 tried to have some API tests happy on iOS by freezing the layer tree
45         during the navigation policy decision. However, this is observable by the client
46         application and a regression from when the policy delegate was synchronous.
47
48         To address the issue, this patch reverts r229828 and instead updates the iOS
49         API tests to wait for the next presentation update after navigating
50         before interacting with the view.
51
52         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
53         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
54         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
55         (WebKit::WebFrameLoaderClient::cancelPolicyCheck):
56         (WebKit::WebFrameLoaderClient::provisionalLoadStarted):
57         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
58         * WebProcess/WebPage/WebPage.cpp:
59         * WebProcess/WebPage/WebPage.h:
60
61 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
62
63         Limit cookie header access to Network process
64         https://bugs.webkit.org/show_bug.cgi?id=184764
65         <rdar://problem/36785285>
66
67         Reviewed by Youenn Fablet.
68
69         Revise the handling of cookie request headers so that we don't interact with them in the
70         WebContent process. They are only needed for interaction with the server and the network
71         process, so we should limit their scope to just the Network process.
72
73         Instead, we should handle a token that represents the cookie headers in the WebContent
74         process, which can be converted to the relevant cookie data in the network process when
75         needed.
76
77         * NetworkProcess/NetworkSocketStream.cpp:
78         (WebKit::NetworkSocketStream::sendHandshake):
79         * NetworkProcess/NetworkSocketStream.h:
80         * NetworkProcess/NetworkSocketStream.messages.in:
81         * WebProcess/Network/WebSocketStream.cpp:
82         (WebKit::WebSocketStream::networkProcessCrashed):
83         (WebKit::WebSocketStream::platformSendHandshake):
84         (WebKit::WebSocketStream::didSendHandshake):
85         * WebProcess/Network/WebSocketStream.h:
86         * WebProcess/Network/WebSocketStream.messages.in:
87
88 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
89
90         Disable backward and forward navigation swipes while in fullscreen.
91         https://bugs.webkit.org/show_bug.cgi?id=184656
92         rdar://problem/36057535
93
94         Reviewed by Tim Horton.
95
96         Disable navigation swipes while in fullscreen.
97
98         * UIProcess/Cocoa/ViewGestureController.cpp:
99         (WebKit::ViewGestureController::canSwipeInDirection const):
100
101 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
102
103         Element fullscreen, expose WKWebView _fullScreenPlaceholderView as iOS SPI
104         https://bugs.webkit.org/show_bug.cgi?id=184826
105         rdar://problem/39600825
106
107         Reviewed by Tim Horton.
108
109         Add _fullScreenPlaceholderView for iOS similar to the one for Mac.
110
111         * UIProcess/API/Cocoa/WKWebView.mm:
112         (-[WKWebView _fullScreenPlaceholderView]):
113         (-[WKWebView closeFullScreenWindowController]):
114         (-[WKWebView fullScreenPlaceholderView]): Deleted.
115         * UIProcess/API/Cocoa/WKWebViewInternal.h:
116         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
117         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.h:
118         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
119         (-[WKFullScreenWindowController webViewPlaceholder]):
120
121 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
122
123         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
124         https://bugs.webkit.org/show_bug.cgi?id=184822
125         <rdar://problem/38807319>
126
127         Reviewed by Tim Horton.
128
129         Fixes the bug by making a couple of tweaks: (1) don't use a separate codepath for inserting text in text inputs,
130         and (2) force a user typing gesture when inserting text using this codepath (i.e. WKTextInputListViewController).
131         Also adds plumbing to enable testing text entry with WKTextInputListViewController in extra zoom mode.
132
133         * UIProcess/API/Cocoa/WKWebView.mm:
134         (-[WKWebView _simulateTextEntered:]):
135         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
136
137         Introduce testing SPI to simulate text entry. Additionally, add a missing availability annotation around testing
138         SPI added in 2017 to help test drag and drop for iOS 11.
139
140         * UIProcess/ios/WKContentViewInteraction.h:
141         * UIProcess/ios/WKContentViewInteraction.mm:
142         (-[WKContentView _simulateTextEntered:]):
143         * WebProcess/WebPage/WebPage.cpp:
144         (WebKit::WebPage::setTextAsync):
145
146 2018-04-20  Jeremy Jones  <jeremyj@apple.com>
147
148         EnterFullscreen must update the minimum and maximum layout sizes.
149         https://bugs.webkit.org/show_bug.cgi?id=184828
150         rdar://problem/38435829
151
152         Reviewed by Jon Lee.
153
154         Without this, the WKWebView won't layout to the full size in fullscreen mode.
155
156         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
157         (-[WKFullScreenWindowController enterFullScreen]):
158
159 2018-04-18  Jer Noble  <jer.noble@apple.com>
160
161         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
162         https://bugs.webkit.org/show_bug.cgi?id=184762
163
164         Reviewed by Dan Bernstein.
165
166         * Configurations/BaseTarget.xcconfig:
167
168 2018-04-20  Youenn Fablet  <youenn@apple.com>
169
170         Refactor NetworkResourceLoader to check for m_networkLoadChecker presence before using it
171         https://bugs.webkit.org/show_bug.cgi?id=184755
172
173         Reviewed by Chris Dumez.
174
175         Make NetworkResourceLoader always use m_networkLoadChecker if there is one.
176         This is only used now for synchronous loads but will be used in the future for asynchronous loads as well.
177
178         Since we call didFail asynchronously to make sync/async handling more consistent,
179         We need to keep track of whether we will do clean-up twice.
180         A boolean is added for that purpose in NetworkResourceLoader.
181
182         There is a small change of behavior in the way we return an error.
183         Instead of returning a platformBadResponseError, we are now returning the error as computed by NetworkLoadChecker.
184         This allows getting some more error logging in the JS console.
185
186         * NetworkProcess/NetworkResourceLoader.cpp:
187         (WebKit::NetworkResourceLoader::didReceiveResponse):
188         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
189         (WebKit::NetworkResourceLoader::continueWillSendRedirectedRequest):
190         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
191         * NetworkProcess/NetworkResourceLoader.h:
192
193 2018-04-20  Timothy Hatcher  <timothy@apple.com>
194
195         Include missing files in WKContentViewInteraction.{mm,h}
196
197         https://bugs.webkit.org/show_bug.cgi?id=184832
198         rdar://problem/35377120
199
200         Reviewed by Wenson Hsieh.
201
202         Some WebDriver files were missing and should be included.
203
204         * UIProcess/ios/WKContentViewInteraction.h:
205         * UIProcess/ios/WKContentViewInteraction.mm:
206         (-[WKContentView setupInteraction]):
207         (-[WKContentView cleanupInteraction]):
208         (-[WKContentView _removeDefaultGestureRecognizers]):
209         (-[WKContentView _addDefaultGestureRecognizers]):
210
211 2018-04-20  Youenn Fablet  <youenn@apple.com>
212
213         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
214         https://bugs.webkit.org/show_bug.cgi?id=184369
215
216         Reviewed by Chris Dumez.
217
218         Use API to check for plugin availability for response at navigation time.
219
220         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
221         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
222         * WebProcess/WebPage/WebPage.cpp:
223         (WebKit::WebPage::canShowResponse const):
224         (WebKit::WebPage::canShowMIMEType const):
225         * WebProcess/WebPage/WebPage.h:
226
227 2018-04-20  Daniel Bates  <dabates@apple.com>
228
229         Remove Strong Password decoration when text field type changes
230         https://bugs.webkit.org/show_bug.cgi?id=184795
231         <rdar://problem/38325108>
232
233         Reviewed by Antti Koivisto.
234
235         Add injected bundle API and WebKit UI delegate SPI to notify the embedding client when the
236         Strong Password appearance of an HTML input element is resigned.
237
238         We add C SPI for Safari on Mac.
239
240         * UIProcess/API/APIUIClient.h:
241         (API::UIClient::didResignInputElementStrongPasswordAppearance):
242         * UIProcess/API/C/WKPage.cpp:
243         (WKPageSetPageUIClient):
244         * UIProcess/API/C/WKPageUIClient.h:
245         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
246         * UIProcess/Cocoa/UIDelegate.h:
247         * UIProcess/Cocoa/UIDelegate.mm:
248         (WebKit::UIDelegate::setDelegate):
249         (WebKit::UIDelegate::UIClient::didResignInputElementStrongPasswordAppearance):
250         * UIProcess/WebPageProxy.cpp:
251         (WebKit::WebPageProxy::didResignInputElementStrongPasswordAppearance):
252         * UIProcess/WebPageProxy.h:
253         * UIProcess/WebPageProxy.messages.in:
254         * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
255         (API::InjectedBundle::PageUIClient::didResignInputElementStrongPasswordAppearance):
256         * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
257         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
258         (WebKit::InjectedBundlePageUIClient::didResignInputElementStrongPasswordAppearance):
259         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
260         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
261         (WebKit::WebChromeClient::inputElementDidResignStrongPasswordAppearance):
262         * WebProcess/WebCoreSupport/WebChromeClient.h:
263
264 2018-04-20  Megan Gardner  <megan_gardner@apple.com>
265
266         Fixes for failing tests associated with switching Text Selection Assistants
267         https://bugs.webkit.org/show_bug.cgi?id=184806
268         <rdar://problem/39367905>
269
270         Reviewed by Beth Dakin and Wenson Hsieh.
271         
272         The major fix is the disabling the double tap noneditable text selection gesture.
273         The other fixes are small tweaks that shouldn't even be run into with the fix to 
274         the double tap gesture, but they are incorrect, so I am taking the opportunity to 
275         fix them now, in case we run into them again.
276
277         * UIProcess/ios/WKContentViewInteraction.mm:
278         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
279         We should not be allowing a double tap text gestures in non-editable web content.
280         We didn't have one with the old assistant. Fortunately, this is easily disabled.
281         (-[WKContentView canPerformActionForWebView:withSender:]):
282         We should not allow the lookup action if we do not actually have a selection.
283         It is meaningless without one.
284         (-[WKContentView selectedTextRange]):
285         We should not return a selection to UIKit if all we have is caret selection
286         in non-editable content. We have this for selections on Mac, but UIKit does
287         not know how to properly handle this, and will have incorrect behavior if we 
288         return a valid selection.
289
290 2018-04-20  Timothy Hatcher  <timothy@apple.com>
291
292         WebEvent fails to convert synthetic WebMouseEvent for automation
293
294         https://bugs.webkit.org/show_bug.cgi?id=184824
295         rdar://problem/35377120
296
297         Reviewed by Brian Burg.
298
299         Add WebEvent conversions that existed in PlatformEventFactoryIOS for legacy WebKit,
300         but never got added in WebIOSEventFactory and NativeWebMouseEvent for modern WebKit.
301         This affected WebDriver, and some events not being deliverd to the page.
302
303         * Shared/NativeWebMouseEvent.h:
304         (WebKit::NativeWebMouseEvent::nativeEvent const):
305         * Shared/ios/NativeWebMouseEventIOS.mm: Added.
306         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
307         * Shared/ios/WebIOSEventFactory.h:
308         * Shared/ios/WebIOSEventFactory.mm:
309         (WebIOSEventFactory::createWebMouseEvent):
310         * WebKit.xcodeproj/project.pbxproj:
311
312 2018-04-20  Michael Catanzaro  <mcatanzaro@igalia.com>
313
314         Unreviewed, fix -Wformat warning
315
316         * UIProcess/WebPageProxy.cpp:
317         (WebKit::WebPageProxy::didFinishLoadForFrame):
318
319 2018-04-20  Youenn Fablet  <youenn@apple.com>
320
321         Make PluginData cache its web visible plugins
322         https://bugs.webkit.org/show_bug.cgi?id=184421
323
324         Reviewed by Chris Dumez.
325
326         Rename methods.
327         Pass an URL instead of relying on Page URL as the page URL
328         might not always be the URL we want to check against plugins.
329         In particular when navigation is on-going, we want to check the
330         plugins against the being navigated URL.
331
332         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
333         (WebKit::WebPluginInfoProvider::pluginInfo):
334         (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
335         * WebProcess/Plugins/WebPluginInfoProvider.h:
336
337 2018-04-19  Carlos Garcia Campos  <cgarcia@igalia.com>
338
339         Unreviewed. Fix GTK+ build after r230830.
340
341         Add SimulatedInputDispatcher.cpp to the build.
342
343         * CMakeLists.txt:
344
345 2018-04-19  Brady Eidson  <beidson@apple.com>
346
347         Make back forward cache work with process swapping.
348         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
349
350         Reviewed by Chris Dumez.
351
352         We previously saved old processes in "SuspendedPageProxy" objects.
353         Now we reuse them when going back or forward.
354
355         * Platform/Logging.h:
356
357         * Shared/WebBackForwardListItem.cpp:
358         (WebKit::WebBackForwardListItem::setSuspendedPage):
359         (WebKit::WebBackForwardListItem::loggingString):
360         * Shared/WebBackForwardListItem.h:
361         (WebKit::WebBackForwardListItem::suspendedPage const):
362
363         Teach Navigation objects their source WebBackForwardListItems:
364         * UIProcess/API/APINavigation.cpp:
365         (API::Navigation::Navigation):
366         (API::Navigation::loggingString const):
367         * UIProcess/API/APINavigation.h:
368         (API::Navigation::create):
369         (API::Navigation::targetItem const):
370         (API::Navigation::fromItem const):
371         (API::Navigation::backForwardListItem): Deleted.
372
373         * UIProcess/Cocoa/NavigationState.mm:
374         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
375
376         * UIProcess/SuspendedPageProxy.cpp:
377         (WebKit::messageNamesToIgnoreWhileSuspended):
378         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
379         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
380         (WebKit::SuspendedPageProxy::webProcessDidClose):
381         (WebKit::SuspendedPageProxy::didReceiveMessage):
382         (WebKit::SuspendedPageProxy::loggingString const):
383         * UIProcess/SuspendedPageProxy.h:
384         (WebKit::SuspendedPageProxy::origin const):
385
386         * UIProcess/WebBackForwardList.cpp:
387         (WebKit::WebBackForwardList::WebBackForwardList):
388         (WebKit::WebBackForwardList::~WebBackForwardList):
389         (WebKit::WebBackForwardList::pageClosed):
390         (WebKit::WebBackForwardList::addItem):
391         (WebKit::WebBackForwardList::goToItem):
392         (WebKit::WebBackForwardList::removeAllItems):
393         (WebKit::WebBackForwardList::clear):
394         (WebKit::WebBackForwardList::restoreFromState):
395         (WebKit::WebBackForwardList::filteredItemStates const):
396         (WebKit::WebBackForwardList::itemStates const):
397         (WebKit::WebBackForwardList::loggingString):
398         * UIProcess/WebBackForwardList.h:
399
400         * UIProcess/WebNavigationState.cpp:
401         (WebKit::WebNavigationState::createLoadRequestNavigation):
402         (WebKit::WebNavigationState::createBackForwardNavigation):
403         * UIProcess/WebNavigationState.h:
404
405         * UIProcess/WebPageProxy.cpp:
406         (WebKit::WebPageProxy::reattachToWebProcess):
407         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
408         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
409         (WebKit::WebPageProxy::loadRequest):
410         (WebKit::WebPageProxy::loadFile):
411         (WebKit::WebPageProxy::goToBackForwardItem):
412         (WebKit::WebPageProxy::receivedPolicyDecision):
413         (WebKit::WebPageProxy::continueNavigationInNewProcess):
414         (WebKit::WebPageProxy::didCreateMainFrame):
415         (WebKit::WebPageProxy::didCreateSubframe):
416         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
417         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
418         (WebKit::WebPageProxy::didCommitLoadForFrame):
419         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
420         (WebKit::WebPageProxy::connectionWillOpen):
421         (WebKit::WebPageProxy::attachToProcessForNavigation): Deleted.
422         * UIProcess/WebPageProxy.h:
423
424         * UIProcess/WebProcessLifetimeTracker.cpp:
425         (WebKit::WebProcessLifetimeTracker::webPageEnteringWebProcess):
426         (WebKit::WebProcessLifetimeTracker::connectionWillOpen): Deleted.
427         * UIProcess/WebProcessLifetimeTracker.h:
428
429         * UIProcess/WebProcessPool.cpp:
430         (WebKit::WebProcessPool::processForNavigation):
431         (WebKit::WebProcessPool::registerSuspendedPageProxy):
432         (WebKit::WebProcessPool::unregisterSuspendedPageProxy):
433         * UIProcess/WebProcessPool.h:
434
435         * UIProcess/WebProcessProxy.cpp:
436         (WebKit::WebProcessProxy::suspendWebPageProxy):
437         (WebKit::WebProcessProxy::updateBackForwardItem):
438         (WebKit::WebProcessProxy::frameCreated):
439         * UIProcess/WebProcessProxy.h:
440
441         * WebProcess/WebPage/DrawingArea.h:
442         (WebKit::DrawingArea::attachDrawingArea):
443
444         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
445         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
446         (WebKit::WebBackForwardListProxy::addItem):
447         * WebProcess/WebPage/WebBackForwardListProxy.h:
448
449         * WebProcess/WebPage/WebPage.cpp:
450         (WebKit::m_credentialsMessenger):
451         (WebKit::WebPage::reinitializeWebPage):
452         (WebKit::WebPage::goToBackForwardItem):
453         (WebKit::WebPage::restoreSessionInternal):
454         (WebKit::WebPage::restoreSession):
455         (WebKit::WebPage::updateBackForwardListForReattach):
456         * WebProcess/WebPage/WebPage.h:
457         * WebProcess/WebPage/WebPage.messages.in:
458
459         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
460         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
461         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
462         (WebKit::TiledCoreAnimationDrawingArea::attachDrawingArea): Force a reattachment of the drawing
463           area from a resumed WebProcess to the UIProcess (to make the page cache work)
464
465 2018-04-19  Brian Burg  <bburg@apple.com>
466
467         Web Automation: add support for mouse/keyboard interaction sequences
468         https://bugs.webkit.org/show_bug.cgi?id=184603
469         <rdar://problem/39421839>
470
471         Reviewed by Timothy Hatcher.
472
473         Add new protocol methods and WebKit support for implementing the W3C Actions API.
474         This is a generic command for sending low-level mouse, key, and touch events to
475         test page behavior when performing drag-and-drop, gestures, or specific keydown/keyups.
476
477         To implement this functionality, this patch adds SimulatedInputDispatcher, a class
478         for dispatching input events asynchronously. Similar to the WebDriver specification,
479         this is designed as a keyframing API. Callers set up several "input sources" such
480         as keyboard or mouse, and then specify the states of that input source over time. The
481         dispatcher calculates diffs between the previous and current keyframes and generates
482         the appropriate events that would happen if a user caused the state transition.
483
484         For example, if a mouse input source's state changes, the dispatcher sends synthetic mousemove,
485         mousedown, or mouseup events depending on the pre- and post-state. This is uninteresting
486         and overcomplicated for simple key and mouse presses, but it's really designed with an
487         eye towards supporting mousemove interpolation and touch event interpolation in later patches.
488
489         The strategy for dispatching events depends on the input source type; right now, these
490         map directly to the existing platformSimulate{Mouse, Keyboard}Interaction methods. In
491         the future, the dispatch strategy may be elaborated for interpolated mousemove events.
492
493         This patch depends on support added in bug 184462.
494
495         No tests yet. When this command is hooked up to a driver, the code will be exercised by
496         W3C actions test suite, which is fairly complex at this point relative to end-user code.
497
498         * UIProcess/Automation/Automation.json: Add new types and commands.
499
500         * UIProcess/Automation/SimulatedInputDispatcher.h: Added.
501         (WebKit::SimulatedInputSourceState::emptyState):
502         (WebKit::SimulatedInputSource::create):
503         (WebKit::SimulatedInputSource::SimulatedInputSource):
504         (WebKit::SimulatedInputDispatcher::Client::~Client):
505         Add structs for input source, source state, and keyframe.
506         The dispatcher's client interface is implemented by WebAutomationSession.
507
508         (WebKit::SimulatedInputDispatcher::create):
509         * UIProcess/Automation/SimulatedInputDispatcher.cpp: Added.
510         (WebKit::SimulatedInputKeyFrame::SimulatedInputKeyFrame):
511         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
512         (WebKit::SimulatedInputKeyFrame::keyFrameFromStateOfInputSources):
513         (WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources):
514         (WebKit::SimulatedInputDispatcher::SimulatedInputDispatcher):
515         (WebKit::SimulatedInputDispatcher::~SimulatedInputDispatcher):
516         (WebKit::SimulatedInputDispatcher::isActive const):
517         (WebKit::SimulatedInputDispatcher::keyFrameTransitionDurationTimerFired):
518         (WebKit::SimulatedInputDispatcher::isKeyFrameTransitionComplete const):
519         (WebKit::SimulatedInputDispatcher::transitionToNextKeyFrame):
520         (WebKit::SimulatedInputDispatcher::transitionToNextInputSourceState):
521         (WebKit::SimulatedInputDispatcher::transitionBetweenKeyFrames):
522         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
523         (WebKit::SimulatedInputDispatcher::run):
524         (WebKit::SimulatedInputDispatcher::cancel):
525         (WebKit::SimulatedInputDispatcher::finishDispatching):
526         The dispatcher handles one interaction at a time. The interaction is described
527         by an array of keyframes, and each keyframe has an array of states. The dispatcher
528         transitions between keyframes by sequentially and asynchronously emitting events
529         that cause each input source state to transition as desired. Keyframe transitions
530         are additionally gated by a "maximum duration" timer. Each step that the dispatcher
531         executes is asynchronous, so the dispatcher keeps most state in members and uses
532         error argument lambdas as completion handlers for various async things.
533
534         * UIProcess/Automation/WebAutomationSession.h:
535         * UIProcess/Automation/WebAutomationSession.cpp:
536         (WebKit::WebAutomationSession::WebAutomationSession):
537         (WebKit::WebAutomationSession::inputDispatcherForPage):
538         (WebKit::WebAutomationSession::inputSourceForType const):
539         Add canonical input sources that are used to keep track of state across
540         interaction sequences.
541
542         (WebKit::WebAutomationSession::isSimulatingUserInteraction const):
543         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
544         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
545         Remove m_simulatingUserInteraction since it can be computed based on other members.
546
547         (WebKit::WebAutomationSession::willClosePage):
548         If the page is being torn down, stop the dispatcher if needed and cancel any
549         callbacks waiting for mouse/key events to be retired.
550
551         (WebKit::WebAutomationSession::simulateMouseInteraction):
552         (WebKit::WebAutomationSession::simulateKeyboardInteraction):
553         Add easy-to-use async methods for simulating mouse and key events. These are
554         hooked up to SimulatedInputDispatcher using async completion handlers.
555
556         (WebKit::protocolMouseButtonToWebMouseEventButton):
557         (WebKit::WebAutomationSession::performMouseInteraction):
558         (WebKit::WebAutomationSession::performKeyboardInteractions):
559         Adjust some naming.
560
561         (WebKit::simulatedInputSourceTypeFromProtocolSourceType):
562         (WebKit::WebAutomationSession::performInteractionSequence):
563         (WebKit::WebAutomationSession::cancelInteractionSequence):
564         Add command handlers for the new action commands in Automation protocol.
565
566         * UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
567         (WebKit::mouseButtonToGdkButton):
568         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
569         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
570         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
571         * UIProcess/Automation/ios/WebAutomationSessionIOS.mm:
572         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
573         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
574         Rename the keyboard platform method to match the naming of the mouse platform method.
575         Take advantage of the 'using' alias to make the tedious switches easier to read.
576
577         * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
578         (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
579         (WebKit::virtualKeyHasStickyModifier):
580         (WebKit::keyCodeForVirtualKey):
581         (WebKit::eventModifierFlagsForVirtualKey):
582         (WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):
583         (WebKit::WebAutomationSession::platformSimulateKeySequence):
584         (WebKit::keyHasStickyModifier): Deleted.
585         (WebKit::WebAutomationSession::platformSimulateKeyStroke): Deleted.
586         Allow the keyboard simulation method to take a virtual key and unichar to better
587         match how this is used by the Perform Actions command and its machinery.
588
589         * WebKit.xcodeproj/project.pbxproj:
590
591 2018-04-19  Jiewen Tan  <jiewen_tan@apple.com>
592
593         Remove access to keychain from the WebContent process
594         https://bugs.webkit.org/show_bug.cgi?id=184428
595         <rdar://problem/13150903>
596
597         Reviewed by Brent Fulgham.
598
599         Part 1.
600
601         Remove com.apple.identities from WebContent-iOS.entitlements, which is needed to encode/decode NSError’s userInfo[NSErrorClientCertificateChainKey]
602         when the corresponding NSErorr is relayed through WebContent Process from Networking Process to UI Process after a HTTPS client certificate
603         authentication is rejected becuase of bad certificates. This patch implements corresponding workarounds as well. The workaround works for mac, too.
604
605         Sadly, this change can only be tested manually at this moment. Please refer to the radar for testing steps.
606
607         * Configurations/WebContent-iOS.entitlements:
608         * Shared/mac/WebCoreArgumentCodersMac.mm:
609         (IPC::encodeNSError):
610         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
611         (WebKit::WebProcessPool::platformInitialize):
612
613 2018-04-19  David Kilzer  <ddkilzer@apple.com>
614
615         Enable Objective-C weak references
616         <https://webkit.org/b/184789>
617         <rdar://problem/39571716>
618
619         Reviewed by Dan Bernstein.
620
621         * Configurations/Base.xcconfig:
622         (CLANG_ENABLE_OBJC_WEAK): Enable.
623
624 2018-04-19  Youenn Fablet  <youenn@apple.com>
625
626         Web Inspector backend should get headers & cookies from network process separately from resource requests
627         https://bugs.webkit.org/show_bug.cgi?id=184396
628         <rdar://problem/38877384>
629
630         Reviewed by Brian Burg.
631
632         Add support for storing response and network metrics for every resource load.
633         This is made conditional on inspector being activated.
634         NetworkConnectionToWebProcess keeps a response and network metrics for every load.
635         This is cleared when inspector is going away or when a web process requests
636         the data.
637
638         WebLoaderStrategy gets this data through synchronous IPC.
639         Synchronous IPC is a temporary implementation until Inspector code gets refactored.
640
641         Updated WebLoaderStrategy to pass the sourceOrigin for every NetworkResourceLoader.
642         This activates additional sanitization based on cross origin status.
643
644         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
645         (WebKit::NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled):
646         * NetworkProcess/NetworkConnectionToWebProcess.h:
647         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationResponse):
648         (WebKit::NetworkConnectionToWebProcess::takeNetworkLoadInformationMetrics):
649         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationResponse):
650         (WebKit::NetworkConnectionToWebProcess::addNetworkLoadInformationMetrics):
651         (WebKit::NetworkConnectionToWebProcess::removeNetworkLoadInformation):
652         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
653         * NetworkProcess/NetworkResourceLoader.cpp:
654         (WebKit::NetworkResourceLoader::didReceiveResponse):
655         (WebKit::NetworkResourceLoader::didFinishLoading):
656         (WebKit::NetworkResourceLoader::didFailLoading):
657         * WebProcess/Network/WebLoaderStrategy.cpp:
658         (WebKit::WebLoaderStrategy::responseFromResourceLoadIdentifier):
659         (WebKit::WebLoaderStrategy::networkMetricsFromResourceLoadIdentifier):
660         * WebProcess/Network/WebLoaderStrategy.h:
661         * WebProcess/Network/WebResourceLoader.cpp:
662         (WebKit::WebResourceLoader::didReceiveResponse):
663
664 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
665
666         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
667         https://bugs.webkit.org/show_bug.cgi?id=184782
668         <rdar://problem/38346712>
669
670         Reviewed by Tim Horton.
671
672         In extra zoom mode, at initial scale, fixed position elements may take up a large portion of the viewport. This
673         leaves little room for non-fixed-position elements; to improve this experience, we introduce a mechanism to
674         extend the height of the layout viewport. By default, the layout viewport size is determined by the FrameView's
675         baseLayoutViewportSize, and passed into FrameView::computeUpdatedLayoutViewportRect in the client layer; in
676         extra zoom mode, if the layout viewport is shorter than the document width, we try to double the height of the
677         layout viewport and clamp to the document height if necessary.
678
679         * Shared/WebPreferences.yaml:
680
681         Add a new preference to determine the factor by which we should expand the height of the layout viewport. By
682         default, this is 0 (no increase in layout viewport height); in extra zoom mode, this is 1, which means we'll
683         increase the layout viewport's height by 1x the default height.
684
685         * Shared/WebPreferencesDefaultValues.h:
686         * UIProcess/API/Cocoa/WKWebView.mm:
687         (-[WKWebView activeMinimumLayoutSizes:]):
688
689         Fixes a bug when computing the active minimum layout size. If a minimum allowed layout width is specified, we
690         clamp the active layout width (normally the view size) so that it is no less than the minimum allowed layout
691         width. However, the height is currently unaffected, which causes FrameView::baseLayoutViewportSize to return a
692         bogus size, where the width is scaled to 320px but the height isn't. Instead, we should scale the layout height
693         to match the new width here.
694
695         * UIProcess/ios/WebPageProxyIOS.mm:
696         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
697
698         Expand the base viewport layout size if necessary, given the expansion factor in WebPreferences.
699
700         * WebProcess/WebPage/WebPage.cpp:
701         (WebKit::WebPage::updatePreferences):
702         * WebProcess/WebPage/ios/WebPageIOS.mm:
703         (WebKit::WebPage::dynamicViewportSizeUpdate):
704
705         Expand the base viewport layout size if necessary, given the expansion factor in Settings.
706
707 2018-04-19  Brian Burg  <bburg@apple.com>
708
709         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
710         https://bugs.webkit.org/show_bug.cgi?id=184462
711         <rdar://problem/39323336>
712
713         Reviewed by Carlos Garcia Campos and Tim Horton.
714
715         Covered by existing layout tests and actions endpoints in WebDriver test suite.
716
717         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
718         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
719         to dispatch more simulated events.
720
721         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
722         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
723         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
724         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
725         also be more than one mouse event waiting to be handled by WebProcess.
726
727         In the past, these queued mouse events were tracked with several member variables as different
728         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
729         checking the queue length.
730
731         * Platform/Logging.h: Add logging channel for mouse events.
732         * UIProcess/Automation/WebAutomationSession.cpp:
733         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
734         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
735         the convenience constructors and .toProtocolString() method.
736
737         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
738         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
739         prior to returning from the command, we need to abort any key event callbacks that are pending if an
740         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
741         be handled when the alert is dismissed and the nested run loop exits.
742
743         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
744         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
745         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
746         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
747
748         (WebKit::WebAutomationSession::performMouseInteraction):
749         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
750         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
751         so we also need to handle the case where there is nothing to be waited on because hit testing did
752         not return a target to deliver the event to.
753
754         (WebKit::WebAutomationSession::performKeyboardInteractions):
755         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
756         event waiting/handling code. Now it matches the types used for the mouse event case.
757
758         * UIProcess/Automation/WebAutomationSession.h:
759         (WebKit::AutomationCommandError::AutomationCommandError):
760         Add a helper struct to hold an enumerated error name and an optional free-form error message.
761
762         * UIProcess/WebPageProxy.h:
763         * UIProcess/WebPageProxy.cpp:
764         (WebKit::webMouseEventTypeString):
765         (WebKit::webKeyboardEventTypeString):
766         (WebKit::WebPageProxy::handleMouseEvent):
767         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
768         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
769         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
770         if there are more mouse events to be sent to WebProcess.
771
772         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
773         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
774         (WebKit::WebPageProxy::didReceiveEvent):
775         Unify the code paths for different mouse event types to all use the deque. They also will
776         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
777
778         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
779
780 2018-04-19  Andy Estes  <aestes@apple.com>
781
782         [iOS] Implement find-in-page in the new WKPDFView
783         https://bugs.webkit.org/show_bug.cgi?id=184654
784         <rdar://problem/39331654>
785
786         Reviewed by Tim Horton.
787
788         This is theoretically covered by existing WKPDFView API tests, but that's currently blocked
789         by <rdar://problem/39475542>.
790
791         * UIProcess/ios/WKPDFView.mm:
792         (stringCompareOptions):
793
794         Mapped _WKFindOptions to NSStringCompareOptions.
795
796         (-[WKPDFView _resetFind]):
797
798         Cancelled an in-progress search and reset the search state.
799
800         (-[WKPDFView _findString:withOptions:maxCount:completion:]):
801
802         Stored the completion block, find string, and max count, then called
803         -[PDFHostViewController findString:withOptions:].
804
805         (-[WKPDFView web_countStringMatches:options:maxCount:]):
806
807         Called -_findString:withOptions:maxCount:completion: with a completion block that calls
808         FindClient::didCountStringMatches() with _findStringCount.
809
810         (-[WKPDFView _computeFocusedSearchResultIndexWithOptions:didWrapAround:]):
811
812         Computed the focused search result index, taking _findStringCount and wrap-around into
813         account. There are two interesting cases to mention here:
814
815         1. We can't change focus while a search is in progress, because we can't properly handle
816         wrap-around without a _findStringCount. If a search is in progress, store the requested
817         focus change in _focusedSearchResultPendingOffset, which will be applied once the search
818         finishes.
819
820         2. If wrap-around is about to happen but the find options do not allow it, we need to call
821         FindClient::didFailToFindString(). Handle this by returning NO, which will tell
822         -_focusOnSearchResultWithOptions: to call didFailToFindString() if a search is not in
823         progress.
824
825         (-[WKPDFView _focusOnSearchResultWithOptions:]):
826
827         If -_computeFocusedSearchResultIndexWithOptions:didWrapAround: failed while a search is in
828         progress, just return early. Otherwise, call FindClient::didFailToFindString(). If
829         computing the index did not fail, call -[PDFHostViewController focusOnSearchResultAtIndex:]
830         to change focus and then call FindClient::didFindString() to inform the client.
831
832         (-[WKPDFView web_findString:options:maxCount:]):
833
834         If the find string is equal to _findString, change focus. Otherwise, start a new search.
835
836         (-[WKPDFView web_hideFindUI]):
837
838         Called -_resetFind.
839
840         (-[WKPDFView pdfHostViewController:findStringUpdate:done:]):
841
842         Stored the count in _findStringCount and called _findCompletion once the search is done.
843
844 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
845
846         The InternalFunction hierarchy should be in IsoSubspaces
847         https://bugs.webkit.org/show_bug.cgi?id=184721
848
849         Reviewed by Saam Barati.
850
851         * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
852         (WebKit::JSNPMethod::subspaceForImpl):
853         * WebProcess/Plugins/Netscape/JSNPMethod.h:
854         (WebKit::JSNPMethod::create): Deleted.
855         (WebKit::JSNPMethod::npIdentifier const): Deleted.
856         (WebKit::JSNPMethod::createStructure): Deleted.
857         * WebProcess/Plugins/Netscape/JSNPObject.cpp:
858         (WebKit::JSNPObject::subspaceForImpl):
859         * WebProcess/Plugins/Netscape/JSNPObject.h:
860         (WebKit::JSNPObject::create): Deleted.
861         (WebKit::JSNPObject::npObject const): Deleted.
862         (WebKit::JSNPObject::createStructure): Deleted.
863
864 2018-04-19  Brady Eidson  <beidson@apple.com>
865
866         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
867         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
868
869         Reviewed by Ryosuke Niwa.
870
871         With process swapping, the assumption that "back/forward items belong to a process" is invalid.
872
873         All HistoryItem/WebBackForwardListItems now need to be uniquely identified across all processes,
874         no matter which process they originated from, so there will never be a collision in the UIProcess.
875
876         This allows us to:
877         - Have the UIProcess to keep a single process-wide map of all WebBackForwardListItems
878         - Get rid of the per-WebProcess WebBackForwardListItem map
879         - Simplify a lot of WebBackForwardList(Proxy) code that no longer needs to keep that per-process
880           map in sync
881         - Get rid of a lot of other ancillary code
882
883         * Shared/SessionState.cpp:
884         (WebKit::BackForwardListItemState::decode):
885         * Shared/SessionState.h:
886
887         * Shared/WebBackForwardListItem.cpp:
888         (WebKit::WebBackForwardListItem::WebBackForwardListItem):
889         (WebKit::WebBackForwardListItem::~WebBackForwardListItem):
890         (WebKit::WebBackForwardListItem::itemForID):
891         (WebKit::WebBackForwardListItem::highestUsedItemID): Deleted.
892         * Shared/WebBackForwardListItem.h:
893         (WebKit::WebBackForwardListItem::itemID const):
894
895         * Shared/WebPageCreationParameters.cpp:
896         (WebKit::WebPageCreationParameters::encode const):
897         (WebKit::WebPageCreationParameters::decode):
898         * Shared/WebPageCreationParameters.h:
899
900         * UIProcess/WebBackForwardList.cpp:
901         (WebKit::WebBackForwardList::itemForID):
902         (WebKit::WebBackForwardList::pageClosed):
903         (WebKit::WebBackForwardList::addItem):
904         (WebKit::WebBackForwardList::restoreFromState):
905         (WebKit::generateWebBackForwardItemID): Deleted.
906         * UIProcess/WebBackForwardList.h:
907
908         * UIProcess/WebPageProxy.cpp:
909         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
910         (WebKit::WebPageProxy::initializeWebPage):
911         (WebKit::WebPageProxy::willGoToBackForwardListItem):
912         (WebKit::WebPageProxy::restoreFromSessionState):
913         (WebKit::WebPageProxy::backForwardAddItem):
914         (WebKit::WebPageProxy::backForwardGoToItem):
915         (WebKit::WebPageProxy::backForwardItemAtIndex):
916         (WebKit::WebPageProxy::creationParameters):
917         (WebKit::WebPageProxy::backForwardRemovedItem):
918         * UIProcess/WebPageProxy.h:
919         * UIProcess/WebPageProxy.messages.in:
920  
921         * UIProcess/WebProcessPool.cpp: Explicitly set the UIProcess Process::Identifier so it starts
922           at "1" and then the first child process starts at "2", etc etc.
923
924         * UIProcess/WebProcessProxy.cpp:
925         (WebKit::WebProcessProxy::removeWebPage):
926         (WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):
927         (WebKit::WebProcessProxy::updateBackForwardItem):
928         (WebKit::WebProcessProxy::webBackForwardItem const): Deleted.
929         (WebKit::WebProcessProxy::registerNewWebBackForwardListItem): Deleted.
930         (WebKit::WebProcessProxy::removeBackForwardItem): Deleted.
931         (WebKit::WebProcessProxy::addOrUpdateBackForwardItem): Deleted.
932         * UIProcess/WebProcessProxy.h:
933         * UIProcess/WebProcessProxy.messages.in:
934
935         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
936         (WebKit::toBackForwardListItemState):
937         (WebKit::applyFrameState):
938         (WebKit::toHistoryItem):
939         (WebKit::toPageState): Deleted.
940         * WebProcess/WebCoreSupport/SessionStateConversion.h:
941
942         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
943         (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
944
945         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
946         (WebKit::WebBackForwardListProxy::addItemFromUIProcess):
947         (WebKit::WK2NotifyHistoryItemChanged):
948         (WebKit::WebBackForwardListProxy::itemForID):
949         (WebKit::WebBackForwardListProxy::removeItem):
950         (WebKit::WebBackForwardListProxy::addItem): Previously this was a two-step process of adding an item
951           to the process and then associating it with the page. Now it's just directly adding it to the page,
952           so we don't need to call updateBackForwardItem first.
953         (WebKit::WebBackForwardListProxy::goToItem):
954         (WebKit::WebBackForwardListProxy::itemAtIndex):
955         (WebKit::WebBackForwardListProxy::close):
956         (WebKit::historyItemToIDMap): Deleted.
957         (WebKit::generateHistoryItemID): Deleted.
958         (WebKit::WebBackForwardListProxy::setHighestItemIDFromUIProcess): Deleted.
959         (WebKit::updateBackForwardItem): Deleted.
960         (WebKit::WebBackForwardListProxy::idForItem): Deleted.
961         * WebProcess/WebPage/WebBackForwardListProxy.h:
962
963         * WebProcess/WebPage/WebPage.cpp:
964         (WebKit::m_credentialsMessenger):
965         (WebKit::WebPage::goToBackForwardItem):
966         (WebKit::WebPage::restoreSessionInternal):
967         (WebKit::WebPage::didRemoveBackForwardItem):
968         * WebProcess/WebPage/WebPage.h:
969         * WebProcess/WebPage/WebPage.messages.in:
970
971 2018-04-19  Youenn Fablet  <youenn@apple.com>
972
973         NetworkProcess should use CSP/content blockers for sync XHR
974         https://bugs.webkit.org/show_bug.cgi?id=184760
975
976         Reviewed by Chris Dumez.
977
978         Setting CSP/ContentBlockers parameters for sync XHR loads.
979         * NetworkProcess/NetworkResourceLoader.cpp:
980
981 2018-04-19  Nan Wang  <n_wang@apple.com>
982
983         AX: AOM: respect the accessibility setting for dispatching the accessible events
984         https://bugs.webkit.org/show_bug.cgi?id=184619
985
986         Reviewed by Ryosuke Niwa.
987
988         Linked libAccessibility on iOS and macOS to use the platform accessibility settings
989         for allowing dispatching the accessibility events.
990
991         * Configurations/WebKit.xcconfig:
992         * UIProcess/API/Cocoa/WKWebView.mm:
993         (-[WKWebView _initializeWithConfiguration:]):
994         (accessibilityEventsEnabledChangedCallback):
995         (-[WKWebView _updateAccessibilityEventsEnabled]):
996         * UIProcess/API/Cocoa/WKWebViewInternal.h:
997         * UIProcess/WebPageProxy.cpp:
998         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
999         * UIProcess/WebPageProxy.h:
1000         * WebProcess/WebPage/WebPage.cpp:
1001         (WebKit::WebPage::updateAccessibilityEventsEnabled):
1002         * WebProcess/WebPage/WebPage.h:
1003         * WebProcess/WebPage/WebPage.messages.in:
1004
1005 2018-04-18  Chris Dumez  <cdumez@apple.com>
1006
1007         Rename WindowProxyController to WindowProxy
1008         https://bugs.webkit.org/show_bug.cgi?id=184756
1009
1010         Reviewed by Sam Weinig.
1011
1012         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
1013         needed use WindowProxyController type, which was a bit confusing.
1014
1015         * WebProcess/Plugins/PluginView.cpp:
1016         (WebKit::PluginView::windowScriptNPObject):
1017         * WebProcess/WebPage/WebPage.cpp:
1018         (WebKit::WebPage::frameBecameRemote):
1019
1020 2018-04-18  Youenn Fablet  <youenn@apple.com>
1021
1022         Allow SameOrigin credentials handling for synchronous XHR
1023         https://bugs.webkit.org/show_bug.cgi?id=184723
1024
1025         Reviewed by Alex Christensen.
1026
1027         In case of SameOrigin credentials, we need to stop the current load
1028         in case of cross origin redirection to restart a load with a different session.
1029         Covered by updated WK2 tests.
1030         Rebased WK1 tests since this is Wk1 only.
1031
1032         * NetworkProcess/NetworkResourceLoader.cpp:
1033         (WebKit::NetworkResourceLoader::startNetworkLoad):
1034         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1035         * NetworkProcess/NetworkResourceLoader.h:
1036
1037 2018-04-18  Chris Dumez  <cdumez@apple.com>
1038
1039         Set RemoteDOMWindow's initial opener
1040         https://bugs.webkit.org/show_bug.cgi?id=184716
1041
1042         Reviewed by Sam Weinig.
1043
1044         When a frame becomes remote, transfer the frame opener from the old
1045         frame to the new remote one.
1046
1047         * WebProcess/WebPage/WebPage.cpp:
1048         (WebKit::WebPage::frameBecameRemote):
1049
1050 2018-04-18  Youenn Fablet  <youenn@apple.com>
1051
1052         NetworkResourceLoader should not clean itself inside didReceiveResponse
1053         https://bugs.webkit.org/show_bug.cgi?id=184754
1054
1055         Reviewed by Chris Dumez.
1056
1057         Delay the cleanup to after the didReceiveResponse call so that NetworkLoad can terminate its work.
1058         Covered by XHR sync tests no longer crashing on GuardMalloc bots.
1059
1060         * NetworkProcess/NetworkResourceLoader.cpp:
1061         (WebKit::NetworkResourceLoader::didReceiveResponse):
1062
1063 2018-04-18  Jer Noble  <jer.noble@apple.com>
1064
1065         Fix rendering of WKRemoteView layers in the simulator
1066         https://bugs.webkit.org/show_bug.cgi?id=184752
1067
1068         Reviewed by Tim Horton.
1069
1070         * Platform/mac/LayerHostingContext.mm:
1071         (WebKit::LayerHostingContext::createForExternalHostingProcess):
1072
1073 2018-04-18  Jer Noble  <jer.noble@apple.com>
1074
1075         Fix entitlements and sandboxing for iphoneminimalsimulator
1076         https://bugs.webkit.org/show_bug.cgi?id=184692
1077
1078         Reviewed by Tim Horton.
1079
1080         Use the correct implementations for ChildProcess and NetworkProcess
1081         when building for iphoneminimalsimulator. Stub out imlementations
1082         which rely on methods not available in the iphoneminimalsimulator SDK.
1083
1084         * Configurations/Network-OSX.entitlements: Added.
1085         * Configurations/NetworkService.xcconfig:
1086         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1087         (WebKit::NetworkProcess::sourceApplicationAuditData const):
1088         * NetworkProcess/ios/NetworkProcessIOS.mm:
1089         * NetworkProcess/mac/NetworkProcessMac.mm:
1090         (WebKit::NetworkProcess::initializeProcessName):
1091         (WebKit::overrideSystemProxies):
1092         * Shared/ios/ChildProcessIOS.mm:
1093         (WebKit::ChildProcess::initializeSandbox):
1094         * Shared/mac/ChildProcessMac.mm:
1095         (WebKit::ChildProcess::setApplicationIsDaemon):
1096         (WebKit::enableSandboxStyleFileQuarantine):
1097         (WebKit::ChildProcess::initializeSandbox):
1098         (WebKit::ChildProcess::platformStopRunLoop):
1099         * Shared/mac/CodeSigning.mm:
1100         * WebKit.xcodeproj/project.pbxproj:
1101         * WebProcess/cocoa/WebProcessCocoa.mm:
1102         (WebKit::WebProcess::initializeSandbox):
1103
1104 2018-04-18  Commit Queue  <commit-queue@webkit.org>
1105
1106         Unreviewed, rolling out r230743.
1107         https://bugs.webkit.org/show_bug.cgi?id=184747
1108
1109         causes mouse clicks to not work on some platforms (Requested
1110         by brrian on #webkit).
1111
1112         Reverted changeset:
1113
1114         "Web Automation: simulated mouse interactions should not be
1115         done until associated DOM events have been dispatched"
1116         https://bugs.webkit.org/show_bug.cgi?id=184462
1117         https://trac.webkit.org/changeset/230743
1118
1119 2018-04-18  Brent Fulgham  <bfulgham@apple.com>
1120
1121         Avoid crash if ITP Debug mode is on, but ResourceLoadStatistics are not being used
1122         https://bugs.webkit.org/show_bug.cgi?id=184739
1123         <rdar://problem/39287964>
1124
1125         Reviewed by David Kilzer.
1126
1127         If a user has the ResourceLoadStatistics logic turned off, but has the ITP Debug experimental
1128         flag turned on, you can cause a crash.
1129
1130         This is because the WebsiteDataStore for the process doesn't bother creating a ResourceLoadStatisticsStore
1131         if the statistics machinery is not running. The ITP debug flag was being blindly set without checking
1132         if the statistics store exists or not, which can cause a crash.
1133
1134         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1135         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): Check if the statistics store exists
1136         before calling functions on it.
1137
1138 2018-04-18  Paul Knight  <pknight@apple.com>
1139
1140         Add -[_WKInputDelegateDelegate willStartInputSession:] for clients that want to configure input session before assisting form node
1141         https://bugs.webkit.org/show_bug.cgi?id=184662
1142
1143         Reviewed by Beth Dakin.
1144
1145         Clients may wish to configure a WKInputSession before we start assisting
1146         a node. Add a -[_WKInputDelegateDelegate _webView:willStartInputSession:]
1147         callback.
1148
1149         For example, clients that wish to present a custom input view will want
1150         to configure the WKFormInputSession's customInputView before the
1151         keyboard is presented. Otherwise the standard keyboard will begin to
1152         animate and then the custom input view will swap in later.
1153
1154         * UIProcess/API/Cocoa/_WKInputDelegate.h:
1155         * UIProcess/ios/WKContentViewInteraction.mm:
1156         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1157             Call -_webView:willStartInputSession: before assisting the node.
1158             Only create the form session if the delegate implements either
1159             the willStart or didStartInputSession callbacks.
1160
1161 2018-04-18  Chris Dumez  <cdumez@apple.com>
1162
1163         Add support for converting a local window to a remote window
1164         https://bugs.webkit.org/show_bug.cgi?id=184515
1165         <rdar://problem/39011318>
1166
1167         Reviewed by Ryosuke Niwa.
1168
1169         Add initial support for process-swapping when navigating cross-origin as a result
1170         of a window.open(). The window object returned by window.open() is initially same
1171         origin and is for about:blank. The navigation cross-origin then happens and the
1172         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
1173         hosted in another WebProcess).
1174
1175         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
1176         exceptions due to our incomplete implementation (e.g. w.location returns null) and
1177         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
1178         in a follow-up by relying on IPC.
1179
1180         * UIProcess/API/APIProcessPoolConfiguration.cpp:
1181         (API::ProcessPoolConfiguration::copy):
1182         * UIProcess/API/APIProcessPoolConfiguration.h:
1183         * UIProcess/API/C/WKContextConfigurationRef.cpp:
1184         (WKContextConfigurationProcessSwapsOnWindowOpenWithOpener):
1185         (WKContextConfigurationSetProcessSwapsOnWindowOpenWithOpener):
1186         * UIProcess/API/C/WKContextConfigurationRef.h:
1187         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1188         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1189         (-[_WKProcessPoolConfiguration setProcessSwapsOnWindowOpenWithOpener:]):
1190         (-[_WKProcessPoolConfiguration processSwapsOnWindowOpenWithOpener]):
1191         Add ProcessPool configuration flag to turn on processSwap on window.open(), even
1192         if there is an opener.
1193
1194         * UIProcess/WebPageProxy.cpp:
1195         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1196         If the navigation was triggered via window.open(), then set up on handler for when
1197         a DOMWindow is constructed for the main frame in the new process.
1198
1199         (WebKit::WebPageProxy::didCreateWindow):
1200         When a Window is constructed for the main frame in a new process on process swap,
1201         notify the old process that its representation of the window should become remote
1202         and provide it with the Frame / Window identifiers it needs.
1203
1204         * UIProcess/WebPageProxy.h:
1205         * UIProcess/WebPageProxy.messages.in:
1206
1207         * UIProcess/WebProcessPool.cpp:
1208         (WebKit::WebProcessPool::processForNavigation):
1209         Do process swapping on cross-origin window.open() if the corresponding setting is
1210         enabled.
1211
1212         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1213         (WebKit::WebFrameLoaderClient::didCreateWindow):
1214         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1215
1216         * WebProcess/WebPage/WebPage.cpp:
1217         (WebKit::WebPage::frameBecameRemote):
1218         This is called when process swapping has happened due to a window.open() navigation
1219         cross-origin, when a Frame / Window has been constructed in the new process. We do
1220         the following:
1221         - Construct a RemoteFrame / RemoteWindow using the provided global identifiers to
1222           represent the Frame / Window in the new process.
1223         - We transfer the WindowProxies from the old Frame's WindowProxyController to the
1224           new RemoteFrame's WindowProxyController.
1225         - We update the window proxied by those WindowProxies to be the new RemoteWindow.
1226         - We detach the old Frame as it is now remote and represented by the new RemoteFrame
1227           object we constructed.
1228         - If the old frame was the main frame (always the case currently), we close the page
1229           as it is no longer needed. The new RemoteFrame is currently owned by the RemoteWindow
1230           which is kept alive by its JS wrappers.
1231
1232         * WebProcess/WebPage/WebPage.h:
1233         * WebProcess/WebPage/WebPage.messages.in:
1234
1235 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1236
1237         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.1 release.
1238
1239         * gtk/NEWS: Add release notes for 2.21.1.
1240
1241 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1242
1243         Unreviewed. Remove symbols from webkitglib-symbols.map.
1244
1245         Remove symbols not present in WebKit.
1246
1247         * webkitglib-symbols.map:
1248
1249 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
1250
1251         Unreviewed. Add missing symbols to webkitglib-symbols.map.
1252
1253         Add symbols global in JSC and present in WebKit.
1254
1255         * webkitglib-symbols.map:
1256
1257 2018-04-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1258
1259         [Win][WebKit] Implement InjectedBundleWin.cpp
1260         https://bugs.webkit.org/show_bug.cgi?id=184525
1261
1262         Reviewed by Konstantin Tokarev.
1263
1264         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
1265         (WebKit::InjectedBundle::initialize):
1266
1267 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1268
1269         [Extra zoom mode] Programmatically changing focus when an element already has focus is a confusing experience
1270         https://bugs.webkit.org/show_bug.cgi?id=184635
1271         <rdar://problem/39440642>
1272
1273         Reviewed by Tim Horton.
1274
1275         Currently on iOS, we allow element focus to present UI if the keyboard is already shown. In extra zoom mode,
1276         this would lead to a confusing experience when the focus form control overlay is disabled, since fullscreen
1277         input view controllers are swapped out from underneath the user. Currently, this also puts the UI process into a
1278         bad state where the focused form control overlay is active, but still hidden. This patch makes some tweaks to
1279         input view controller handling in the UI process to address these issues, and also adds WebKitTestRunner support
1280         for simulating interactions with select menus in extra zoom mode. See comments below for more detail.
1281
1282         Test: fast/events/extrazoom/change-focus-during-change-event.html
1283
1284         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1285
1286         Add new SPI delegate hooks to notify the UI delegate when view controllers are presented or dismissed in extra
1287         zoom mode. See -presentViewControllerForCurrentAssistedNode and -dismissAllInputViewControllers.
1288
1289         * UIProcess/WebProcessProxy.cpp:
1290         (WebKit::WebProcessProxy::takeBackgroundActivityTokenForFullscreenInput):
1291         (WebKit::WebProcessProxy::releaseBackgroundActivityTokenForFullscreenInput):
1292
1293         See the comment below -dismissAllInputViewControllers.
1294
1295         * UIProcess/WebProcessProxy.h:
1296         * UIProcess/ios/WKContentViewInteraction.mm:
1297         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1298
1299         In extra zoom mode, when changing focus from one assisted node to another, only allow the second node to be
1300         assisted if the focused form control overlay is being shown. Otherwise, (i.e. when a fullscreen input view
1301         controller is being presented), don't allow focus to start an input session.
1302
1303         Additionally, make a minor tweak to allow the previous node to blur, even if we are not showing the keyboard for
1304         the new focused element. Without this adjustment, in the case where the page has programmatically focused
1305         another element while a fullscreen input view controller is presented, we'll show the old view controller for
1306         the new focused element.
1307
1308         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1309         (-[WKContentView dismissAllInputViewControllers:]):
1310
1311         Currently, when a fullscreen input view controller is presented, the web process gets backgrounded. This
1312         prevents event handlers from executing, which leads to strange behaviors in many cases (for instance: if we
1313         have a multiple select, and the "change" event handler blurs the select, the user may check or uncheck multiple
1314         items, but only the first change will actually take effect).
1315
1316         To fix this, we maintain a background activity token while presenting an input view controller.
1317
1318         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
1319
1320         Start hiding the focused form overlay when re-presenting an input view controller. This allows us to bail from
1321         showing fullscreen input UI for another focused element if focus programmatically changes while the current
1322         fullscreen input view controller is presented, due to the -isHidden check in -_startAssistingNode:.
1323
1324         (-[WKContentView selectFormAccessoryPickerRow:]):
1325
1326         Simulate tapping a given row in select menu UI in extra zoom mode.
1327
1328 2018-04-17  Conrad Shultz  <conrad_shultz@apple.com>
1329
1330         WebKit::DisplayLink maintains a strong reference to WebPageProxy, creating a reference cycle
1331         https://bugs.webkit.org/show_bug.cgi?id=184718
1332
1333         Reviewed by Tim Horton.
1334
1335         It turns out that the m_webPageProxy back-reference in DisplayLink, which was creating a
1336         reference cycle, wasn't ever read, so we can just remove it.
1337
1338         * UIProcess/mac/DisplayLink.cpp:
1339         (WebKit::DisplayLink::DisplayLink):
1340         * UIProcess/mac/DisplayLink.h:
1341
1342 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1343
1344         [Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode
1345         https://bugs.webkit.org/show_bug.cgi?id=184631
1346         <rdar://problem/39303706>
1347
1348         Reviewed by Tim Horton.
1349
1350         Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up
1351         to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally
1352         represents a character.
1353
1354         The first and second text legibility zoom scales are then computed based on the zoom scales needed to
1355         make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the
1356         text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the
1357         first and second text legibility scales may end up being close to one another, or even the same (in the case
1358         where there is only a single font size in the entire document). In this case, we just snap the first scale to
1359         the second, so that double tapping will only toggle between two zoom scales. In another case where the document
1360         has no text (e.g. an image document), we just fall back to a zoom scale of 1.
1361
1362         Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html
1363
1364         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1365         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
1366
1367 2018-04-17  Megan Gardner  <megan_gardner@apple.com>
1368
1369         Don't activate selection on become first responder
1370         https://bugs.webkit.org/show_bug.cgi?id=184719
1371
1372         Reviewed by Tim Horton.
1373         
1374         If we activate the selection immediately on becoming first responder, we cause the selection view to delete itself
1375         since it is not guaranteed to have selection rects immediately due to async/two process architecture. The selection
1376         is activated already when the selection rects change, so there is no reason to activate it now. This has likely worked
1377         in the past because this selection assistant was only for editable text, which would immediately set a caret, which 
1378         is a selection. Now that this is for non-editable text as well, activating the selection is problematic.
1379
1380         * UIProcess/ios/WKContentViewInteraction.mm:
1381         (-[WKContentView becomeFirstResponderForWebView]):
1382
1383 2018-04-11  Brian Burg  <bburg@apple.com>
1384
1385         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
1386         https://bugs.webkit.org/show_bug.cgi?id=184462
1387         <rdar://problem/39323336>
1388
1389         Reviewed by Carlos Garcia Campos and Tim Horton.
1390
1391         Covered by existing layout tests and actions endpoints in WebDriver test suite.
1392
1393         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
1394         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
1395         to dispatch more simulated events.
1396
1397         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
1398         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
1399         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
1400         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
1401         also be more than one mouse event waiting to be handled by WebProcess.
1402
1403         In the past, these queued mouse events were tracked with several member variables as different
1404         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
1405         checking the queue length.
1406
1407         * Platform/Logging.h: Add logging channel for mouse events.
1408         * UIProcess/Automation/WebAutomationSession.cpp:
1409         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
1410         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
1411         the convenience constructors and .toProtocolString() method.
1412
1413         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
1414         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
1415         prior to returning from the command, we need to abort any key event callbacks that are pending if an
1416         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
1417         be handled when the alert is dismissed and the nested run loop exits.
1418
1419         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
1420         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
1421         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
1422         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
1423
1424         (WebKit::WebAutomationSession::performMouseInteraction):
1425         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
1426         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
1427         so we also need to handle the case where there is nothing to be waited on because hit testing did
1428         not return a target to deliver the event to.
1429
1430         (WebKit::WebAutomationSession::performKeyboardInteractions):
1431         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
1432         event waiting/handling code. Now it matches the types used for the mouse event case.
1433
1434         * UIProcess/Automation/WebAutomationSession.h:
1435         (WebKit::AutomationCommandError::AutomationCommandError):
1436         Add a helper struct to hold an enumerated error name and an optional free-form error message.
1437
1438         * UIProcess/WebPageProxy.h:
1439         * UIProcess/WebPageProxy.cpp:
1440         (WebKit::webMouseEventTypeString):
1441         (WebKit::webKeyboardEventTypeString):
1442         (WebKit::WebPageProxy::handleMouseEvent):
1443         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
1444         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
1445         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
1446         if there are more mouse events to be sent to WebProcess.
1447
1448         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
1449         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
1450         (WebKit::WebPageProxy::didReceiveEvent):
1451         Unify the code paths for different mouse event types to all use the deque. They also will
1452         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
1453
1454         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
1455
1456 2018-04-17  Adrian Perez de Castro  <aperez@igalia.com>
1457
1458         [GTK][WPE] Build failure due to presence of Avahi's <dns_sd.h> header
1459         https://bugs.webkit.org/show_bug.cgi?id=184711
1460
1461         Unreviewed build fix.
1462
1463         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Set ENABLE_MDNS only for PLATFORM(COCOA).
1464
1465 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
1466
1467         Unreviewed rollout of r230632. Regression in memory usage.
1468
1469         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
1470
1471         * Shared/WebPreferences.yaml:
1472
1473 2018-04-17  Timothy Hatcher  <timothy@apple.com>
1474
1475         Always use LayerContentsType::IOSurface in minimal simulator mode
1476         https://bugs.webkit.org/show_bug.cgi?id=184710
1477
1478         Reviewed by Simon Fraser.
1479
1480         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1481         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1482
1483 2018-04-17  Ryosuke Niwa  <rniwa@webkit.org>
1484
1485         Release assert in InjectedBundle::postSynchronousMessage
1486         https://bugs.webkit.org/show_bug.cgi?id=184683
1487
1488         Reviewed by Wenson Hsieh.
1489
1490         Some injected bundles sends sync message when it's not safe to execute scripts.
1491
1492         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply option in InjectedBundle::postSynchronousMessage
1493         to avoid processing incoming sync IPC messages so that we don't execute arbitrary scripts in those cases.
1494
1495         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1496         (WebKit::InjectedBundle::postSynchronousMessage):
1497
1498 2018-04-17  Chris Dumez  <cdumez@apple.com>
1499
1500         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
1501         https://bugs.webkit.org/show_bug.cgi?id=184678
1502         <rdar://problem/39422122>
1503
1504         Reviewed by Alex Christensen.
1505
1506         Re-introduce synchronous code path which existed pre-r229831 and use it for fragment navigations.
1507
1508         * UIProcess/WebPageProxy.cpp:
1509         (WebKit::WebPageProxy::receivedPolicyDecision):
1510         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
1511         * UIProcess/WebPageProxy.h:
1512         * UIProcess/WebPageProxy.messages.in:
1513         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1514         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1515         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
1516
1517 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1518
1519         [WPE][GTK] GObject introspection annotation fixes: BackForwardList, NetworkProxySettings
1520         https://bugs.webkit.org/show_bug.cgi?id=184658
1521
1522         Reviewed by Carlos Garcia Campos.
1523
1524         Thanks to Dylan Simon for recommending these annotation fixes.
1525
1526         * UIProcess/API/glib/WebKitBackForwardList.cpp:
1527         * UIProcess/API/glib/WebKitNetworkProxySettings.cpp:
1528
1529 2018-04-17  Brent Fulgham  <bfulgham@apple.com>
1530
1531         [macOS] Don't establish unneeded Dock connections (Follow-up)
1532         https://bugs.webkit.org/show_bug.cgi?id=184664
1533         <rdar://problem/16863698>
1534
1535         Reviewed by Per Arne Vollan.
1536
1537         Because the Plugin process is driven by NSApplication's run loop, we aren't
1538         setting the 'don't connect to the dock' setting early enough.
1539
1540         This patch sets the flag in XPCServiceMain for those services that
1541         are linked to AppKit.
1542
1543         * PluginProcess/mac/PluginProcessMac.mm:
1544         (WebKit::PluginProcess::platformInitializeProcess): Remove unneeded code.
1545         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
1546         (main):
1547         * WebProcess/cocoa/WebProcessCocoa.mm:
1548         (WebKit::WebProcess::platformInitializeWebProcess): Remove unneeded code.
1549
1550 2018-04-17  Saam Barati  <sbarati@apple.com>
1551
1552         Add system trace points for process launch and for initializeWebProcess
1553         https://bugs.webkit.org/show_bug.cgi?id=184669
1554
1555         Reviewed by Simon Fraser.
1556
1557         * UIProcess/Launcher/ProcessLauncher.cpp:
1558         (WebKit::ProcessLauncher::ProcessLauncher):
1559         (WebKit::ProcessLauncher::didFinishLaunchingProcess):
1560         * WebProcess/WebProcess.cpp:
1561         (WebKit::WebProcess::initializeWebProcess):
1562
1563 2018-04-16  Timothy Hatcher  <timothy@apple.com>
1564
1565         Unreviewed 32-bit build fix for r230673.
1566
1567         https://bugs.webkit.org/show_bug.cgi?id=184657
1568         rdar://problem/39463307
1569
1570         * Configurations/PluginProcessShim.xcconfig: Use the correct names.
1571
1572 2018-04-16  Andy Estes  <aestes@apple.com>
1573
1574         [iOS] Enable WKPDFView by default
1575         https://bugs.webkit.org/show_bug.cgi?id=184675
1576         <rdar://problem/27885452>
1577
1578         Reviewed by Darin Adler.
1579
1580         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1581         (-[WKWebViewContentProviderRegistry init]):
1582
1583 2018-04-16  Brent Fulgham  <bfulgham@apple.com>
1584
1585         [macOS] Don't establish unneeded Dock connections
1586         https://bugs.webkit.org/show_bug.cgi?id=184664
1587         <rdar://problem/16863698>
1588
1589         Reviewed by Simon Fraser.
1590
1591         There is no reason for the WebContent or Plugin processes to interact with
1592         the Dock. We should tell AppKit that we don't want this connection, and to
1593         avoid creating such connections.
1594
1595         * PluginProcess/mac/PluginProcessMac.mm:
1596         (WebKit::PluginProcess::platformInitializeProcess): Tell NSApplication to
1597         not create a Dock connection.
1598         * WebProcess/cocoa/WebProcessCocoa.mm:
1599         (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
1600
1601 2018-04-16  Megan Gardner  <megan_gardner@apple.com>
1602
1603         Switch to UIWKTextInteractionAssistant for non-editable text
1604         https://bugs.webkit.org/show_bug.cgi?id=182834
1605
1606         Reviewed by Beth Dakin.
1607         
1608         Switch to only using one assistant for text selection.
1609
1610         * UIProcess/ios/WKContentViewInteraction.mm:
1611         (-[WKContentView useSelectionAssistantWithGranularity:]):
1612
1613 2018-04-16  Youenn Fablet  <youenn@apple.com>
1614
1615         Use NetworkLoadChecker to handle synchronous HTTP loads
1616         https://bugs.webkit.org/show_bug.cgi?id=184240
1617
1618         Reviewed by Chris Dumez.
1619
1620         For every NetworkResourceLoader synchronous load, we create a NetworkLoadChecker.
1621         NetworkLoadChecker handles all security checks in that case.
1622         This allows supporting cross-origin loads for synchronous XHR.
1623
1624         Updated NetworkCORSPreflightChecker to return the result as a ResourceError.
1625         This is used to convey any error message from NetworkProcess to the JS console.
1626         Ensure NetworkCORSPreflightChecker computes correctly Access-Control-Request-Headers value
1627         by providing the headers set by the application plus Referrer/Origin.
1628
1629         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
1630         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
1631         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
1632         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
1633         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
1634         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
1635         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
1636         * NetworkProcess/NetworkLoadChecker.cpp:
1637         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1638         * NetworkProcess/NetworkResourceLoader.cpp:
1639         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1640         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1641         (WebKit::NetworkResourceLoader::didReceiveResponse):
1642         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
1643         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1644         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
1645         (WebKit::NetworkResourceLoader::validateCacheEntry):
1646         * NetworkProcess/NetworkResourceLoader.h:
1647         * WebProcess/Network/WebLoaderStrategy.cpp:
1648         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1649         * WebProcess/Network/WebLoaderStrategy.h:
1650
1651 2018-04-16  Brian Burg  <bburg@apple.com>
1652
1653         [Cocoa] Web Automation: add SPI to terminate automation session and disconnect the remote end
1654         https://bugs.webkit.org/show_bug.cgi?id=184523
1655         <rdar://problem/39368599>
1656
1657         Reviewed by Simon Fraser.
1658
1659         When a user breaks the automation glass pane and chooses "Stop Session", there is no way
1660         for Safari to actually disconnect the remote connection using automation-related ObjC SPI.
1661         This can lead to sessions getting stuck and safaridriver is unable to request a new session.
1662
1663         Expose the -terminate method as SPI. This disconnects the remote connection and then notifies
1664         the session delegate that the remote disconnected. At that point, Safari can uninstall
1665         the session from the process pool and tear down other session state.
1666
1667         * UIProcess/API/Cocoa/_WKAutomationSession.h:
1668         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
1669         (-[_WKAutomationSession terminate]):
1670
1671 2018-04-16  Timothy Hatcher  <timothy@apple.com>
1672
1673         Clean up OTHER_LDFLAGS for WebKit processes
1674         https://bugs.webkit.org/show_bug.cgi?id=184657
1675
1676         Reviewed by Jer Noble.
1677
1678         * Configurations/PluginProcessShim.xcconfig:
1679         * Configurations/PluginService.32.xcconfig:
1680         * Configurations/PluginService.64.xcconfig:
1681         * Configurations/WebContentService.xcconfig:
1682
1683 2018-04-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1684
1685         [WPE] Install files needed for WebKitWebExtensions
1686         https://bugs.webkit.org/show_bug.cgi?id=179915
1687
1688         Reviewed by Žan Doberšek.
1689
1690         * PlatformWPE.cmake: Install pkg-config file, injected bundle, and API headers.
1691         * UIProcess/API/glib/WebKitWebContext.cpp: Load the injected bundle when installed.
1692         * wpe/wpe-web-extension.pc.in: Added.
1693
1694 2018-04-14  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1695
1696         [GTK][WPE] Build is broken after r230640
1697         https://bugs.webkit.org/show_bug.cgi?id=184623
1698
1699         Reviewed by Žan Doberšek.
1700
1701         UIProcess/SuspendedPageProxy.cpp was not included to CMake build in r230640.
1702
1703         * CMakeLists.txt: Added UIProcess/SuspendedPageProxy.cpp to WebKit_SOURCES.
1704
1705 2018-04-13  Ryan Haddad  <ryanhaddad@apple.com>
1706
1707         Unreviewed, rolling out r230447.
1708
1709         Caused flaky selection test failures on iOS
1710
1711         Reverted changeset:
1712
1713         "Switch to UIWKTextInteractionAssistant for non-editable text"
1714         https://bugs.webkit.org/show_bug.cgi?id=182834
1715         https://trac.webkit.org/changeset/230447
1716
1717 2018-04-13  Chris Dumez  <cdumez@apple.com>
1718
1719         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
1720         https://bugs.webkit.org/show_bug.cgi?id=184591
1721
1722         Reviewed by Sam Weinig.
1723
1724         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
1725         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
1726         This is work towards fixing Bug 184515.
1727
1728         * WebProcess/Plugins/PluginView.cpp:
1729         (WebKit::PluginView::windowScriptNPObject):
1730
1731 2018-04-13  Brady Eidson  <beidson@apple.com>
1732
1733         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
1734         https://bugs.webkit.org/show_bug.cgi?id=184559
1735
1736         Reviewed by Alex Christensen.
1737
1738         Before this patch, when a WebPageProxy navigates and is swapped to a new process, the old process almost always goes away.
1739
1740         This is not desirable for a few reasons:
1741         1 - We can't keep the PageCache working for back/forward scenarios
1742         2 - We throw away a "foo.com" web process, meaning the next time we need to host a "foo.com" web page we have to launch
1743             and initialize a new web process.
1744
1745         This patch adds a SuspendedPageProxy object to keep around the old web process and to manage communication with it.
1746
1747         For now, a WebPageProxy keeps exactly one "suspended page" representing the most recently visited page and its process.
1748         Additionally, that process is never reused.
1749
1750         So no benefit is achieved with this patch, but it enables future benefits.
1751
1752         * Platform/Logging.h:
1753
1754         * Shared/WebBackForwardListItem.cpp:
1755         (WebKit::WebBackForwardListItem::setSuspendedPage):
1756         * Shared/WebBackForwardListItem.h:
1757
1758         New object to represent the state of a WebPageProxy in an old web process that is not currently hosting the view.
1759         * UIProcess/SuspendedPageProxy.cpp: Added.
1760         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
1761         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
1762         (WebKit::SuspendedPageProxy::webProcessDidClose):
1763         (WebKit::SuspendedPageProxy::didFinishLoad):
1764         (WebKit::SuspendedPageProxy::didReceiveMessage):
1765         (WebKit::SuspendedPageProxy::loggingString const):
1766         * UIProcess/SuspendedPageProxy.h: Copied from Source/WebKit/Platform/Logging.h.
1767         (WebKit::SuspendedPageProxy::create):
1768         (WebKit::SuspendedPageProxy::page const):
1769         (WebKit::SuspendedPageProxy::process const):
1770         (WebKit::SuspendedPageProxy::item const):
1771         (WebKit::SuspendedPageProxy::finishedSuspending const):
1772
1773         * UIProcess/WebPageProxy.cpp:
1774         (WebKit::WebPageProxy::reattachToWebProcess):
1775         (WebKit::WebPageProxy::attachToProcessForNavigation):
1776         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
1777         (WebKit::WebPageProxy::suspendedPageProcessClosed):
1778         (WebKit::WebPageProxy::receivedPolicyDecision):
1779         (WebKit::WebPageProxy::didFinishLoadForFrame):
1780         * UIProcess/WebPageProxy.h:
1781
1782         * UIProcess/WebProcessProxy.cpp:
1783         (WebKit::WebProcessProxy::suspendWebPageProxy):
1784         (WebKit::WebProcessProxy::suspendedPageWasDestroyed):
1785         (WebKit::WebProcessProxy::removeWebPage):
1786         (WebKit::WebProcessProxy::didReceiveMessage): Optionally pass WebPageProxy messages along to SuspendedPageProxy objects.
1787         (WebKit::WebProcessProxy::didClose):
1788         (WebKit::WebProcessProxy::maybeShutDown):
1789         (WebKit::WebProcessProxy::canTerminateChildProcess): Don't terminate child processes if they still have suspended pages.
1790         * UIProcess/WebProcessProxy.h:
1791
1792         * WebKit.xcodeproj/project.pbxproj:
1793
1794         * WebProcess/WebPage/WebPage.cpp:
1795         (WebKit::WebPage::setIsSuspended):
1796         * WebProcess/WebPage/WebPage.h:
1797         (WebKit::WebPage::isSuspended const): For now, used only by WebProcess::updateActivePages. Will have more uses soon.
1798         * WebProcess/WebPage/WebPage.messages.in:
1799
1800         * WebProcess/WebProcess.messages.in:
1801         * WebProcess/cocoa/WebProcessCocoa.mm:
1802         (WebKit::WebProcess::updateActivePages): Allow the UIProcess to request an update of the web processes user visible name.
1803
1804 2018-04-13  Daniel Bates  <dabates@apple.com>
1805
1806         Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
1807         https://bugs.webkit.org/show_bug.cgi?id=184593
1808
1809         Reviewed by Alex Christensen.
1810
1811         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
1812         is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
1813         implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
1814         and the cognitive load to follow such a function call when reading the code.
1815
1816         No functionality changed. So, no new tests.
1817
1818         * NetworkProcess/NetworkLoad.cpp:
1819         (WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
1820         into this function.
1821         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
1822         into NetworkLoad::willPerformHTTPRedirection().
1823         * NetworkProcess/NetworkLoad.h:
1824
1825 2018-04-13  Daniel Bates  <dabates@apple.com>
1826
1827         Inline NetworkLoad::sharedDidReceiveResponse() into NetworkLoad::notifyDidReceiveResponse()
1828         https://bugs.webkit.org/show_bug.cgi?id=184592
1829
1830         Reviewed by Alex Christensen.
1831
1832         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedDidReceiveResponse()
1833         is only referenced from NetworkLoad::notifyDidReceiveResponse(). We should inline its
1834         implementation into the NetworkLoad::notifyDidReceiveResponse(), remove a function
1835         call, and the cognitive load to follow such a function call when reading the code.
1836
1837         No functionality changed. So, no new tests.
1838
1839         * NetworkProcess/NetworkLoad.cpp:
1840         (WebKit::NetworkLoad::notifyDidReceiveResponse): Moved the implementation of NetworkLoad::sharedDidReceiveResponse()
1841         into this function.
1842         (WebKit::NetworkLoad::sharedDidReceiveResponse): Deleted. Moved its implementation into
1843         NetworkLoad::notifyDidReceiveResponse().
1844         * NetworkProcess/NetworkLoad.h:
1845
1846 2018-04-13  Brent Fulgham  <bfulgham@apple.com>
1847
1848         REGRESSION(r230468): Improper assertion firing under STP
1849         <rdar://problem/39411676>
1850
1851         Unreviewed, rolling out an improper assertion.
1852
1853         I added an assertion in Bug 184322 that should not have been added. I did not notice that this
1854         call stack was always used in builds where NSApp is still active. Builds where we stop relying
1855         on AppKit runloops uses a different code path to shut down.
1856
1857         * Shared/mac/ChildProcessMac.mm:
1858         (WebKit::ChildProcess::stopNSAppRunLoop):
1859
1860 2018-04-12  Antoine Quint  <graouts@apple.com>
1861
1862         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
1863         https://bugs.webkit.org/show_bug.cgi?id=184569
1864         <rdar://problem/38671301>
1865
1866         Reviewed by Jon Lee.
1867
1868         * Shared/WebPreferences.yaml:
1869
1870 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1871
1872         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
1873         https://bugs.webkit.org/show_bug.cgi?id=184533
1874
1875         Reviewed by Philippe Normand.
1876
1877         Renamed GStreamerUtilities* files into GStreamerCommon* and
1878         modified files including them accordingly. Include
1879         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
1880         to avoid problems destroying objects when those files are
1881         forgotten to be included.
1882
1883         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1884         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1885         * WebProcess/soup/WebProcessSoup.cpp:
1886
1887 2018-04-12  Beth Dakin  <bdakin@apple.com>
1888
1889         Fix the MOBILE_WIFI build
1890         https://bugs.webkit.org/show_bug.cgi?id=184571
1891         -and corresponding-
1892         <rdar://problem/39398181>
1893
1894         Reviewed by Jer Noble.
1895
1896         * config.h:
1897
1898 2018-04-12  Beth Dakin  <bdakin@apple.com>
1899
1900         Use -iframework to ensure that frameworks from user paths and system paths are 
1901         ordered appropriately
1902         https://bugs.webkit.org/show_bug.cgi?id=184557
1903         -and corresponding-
1904         rdar://problem/39386359
1905
1906         Reviewed by Dean Jackson.
1907
1908         * Configurations/WebKit.xcconfig:
1909
1910 2018-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1911
1912         [Extra zoom mode] Suppress UI for inputs of type file in extra zoom mode
1913         https://bugs.webkit.org/show_bug.cgi?id=184556
1914         <rdar://problem/39062239>
1915
1916         Reviewed by Andy Estes.
1917
1918         When running in this mode, we don't have the facilities to present document picker UI. For now, just make this
1919         feature fail gracefully.
1920
1921         * UIProcess/ios/forms/WKFileUploadPanel.mm:
1922         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
1923         (-[WKFileUploadPanel platformSupportsPickerViewController]):
1924
1925 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
1926
1927         Remove block selection code
1928         https://bugs.webkit.org/show_bug.cgi?id=184470
1929
1930         Reviewed by Timothy Hatcher.
1931         
1932         Remove block selection code that isn't run and is currently not even used.
1933         Had to put this back in for a bug in the mid-year release, but we're past that
1934         so it's time for this to go away.
1935
1936         * Platform/spi/ios/UIKitSPI.h:
1937         * UIProcess/PageClient.h:
1938         * UIProcess/WebPageProxy.h:
1939         * UIProcess/WebPageProxy.messages.in:
1940         * UIProcess/ios/PageClientImplIOS.h:
1941         * UIProcess/ios/PageClientImplIOS.mm:
1942         (WebKit::PageClientImpl::stopAssistingNode):
1943         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
1944         * UIProcess/ios/WKContentViewInteraction.h:
1945         * UIProcess/ios/WKContentViewInteraction.mm:
1946         (toSelectionHandlePosition): Deleted.
1947         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
1948         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
1949         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
1950         * UIProcess/ios/WebPageProxyIOS.mm:
1951         (WebKit::WebPageProxy::saveImageToLibrary):
1952         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
1953         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
1954         * WebProcess/WebPage/WebPage.h:
1955         * WebProcess/WebPage/WebPage.messages.in:
1956         * WebProcess/WebPage/ios/WebPageIOS.mm:
1957         (WebKit::rangeAtWordBoundaryForPosition):
1958         (WebKit::distanceBetweenRectsForPosition): Deleted.
1959         (WebKit::rectsEssentiallyTheSame): Deleted.
1960         (WebKit::unionDOMRanges): Deleted.
1961         (WebKit::computeEdgeCenter): Deleted.
1962         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
1963         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
1964         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
1965         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
1966         (WebKit::shouldExpand): Deleted.
1967         (WebKit::WebPage::changeBlockSelection): Deleted.
1968         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
1969         
1970 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
1971
1972         Don't have selections get stuck in editable elements
1973         https://bugs.webkit.org/show_bug.cgi?id=184483
1974
1975         Reviewed by Timothy Hatcher.
1976         
1977         When selecting in editable elements, if the keyboard does not come up, which is not required,
1978         then the selections are stuck in that element. If you try and select something in web content,
1979         it will only select in the editable element. By clearing the assisted node when clearing a selection,
1980         it no longer sticks. Also, textSelectionAssistant should not be used as if we are currently editing. 
1981         Change it to the function we created for that purpose in a pervious patch.
1982
1983         * UIProcess/ios/WKContentViewInteraction.mm:
1984         (-[WKContentView clearSelection]):
1985         (-[WKContentView _isInteractingWithAssistedNode]):
1986
1987 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1988
1989         [WPE] Move libWPEWebInspectorResources.so to pkglibdir
1990         https://bugs.webkit.org/show_bug.cgi?id=184379
1991
1992         Reviewed by Žan Doberšek.
1993
1994         This is important to allow parallel installation.
1995
1996         * PlatformWPE.cmake:
1997
1998 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1999
2000         [WPE] Improve include hierarchy
2001         https://bugs.webkit.org/show_bug.cgi?id=184376
2002
2003         Reviewed by Žan Doberšek.
2004
2005         Install our headers under /usr/include/wpe-webkit-0.1/wpe instead of
2006         /usr/include/wpe-0.1/WPE/wpe. Too much WPE, not enough WebKit!
2007
2008         * PlatformWPE.cmake:
2009         * wpe/wpe-webkit.pc.in:
2010
2011 2018-04-11  Andy Estes  <aestes@apple.com>
2012
2013         [iOS] Add a mechanism for holding Wi-Fi assertions
2014         https://bugs.webkit.org/show_bug.cgi?id=184520
2015         <rdar://problem/39025726>
2016
2017         Reviewed by Sam Weinig.
2018
2019         Add plumbing for holding a Wi-Fi assertion on iOS as long as there are active
2020         network data tasks. This functionality is turned off by default right now.
2021
2022         * Configurations/Network-iOS.entitlements:
2023         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
2024         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
2025         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
2026         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp: Added.
2027         (WebKit::ensureWiFiManagerClient): Create a global WiFiManagerClient when needed.
2028         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder): If this is the first active
2029         Wi-Fi assertion holder, set the client's type to kWiFiClientTypeBackground.
2030         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder): If the last active Wi-Fi
2031         assertion holder is being destroyed, set the client's type back to
2032         kWiFiClientTypeNormal.
2033         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Added.
2034         * Platform/Logging.h: Added a logging channel for Wi-Fi assertions.
2035         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
2036         * WebKit.xcodeproj/project.pbxproj:
2037
2038 2018-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2039
2040         [GTK] Switch to use always complex text code path
2041         https://bugs.webkit.org/show_bug.cgi?id=183285
2042
2043         Reviewed by Michael Catanzaro.
2044
2045         Now that we have branched for 2.20, it's a good time to try using complex text path always. We can simply force
2046         it for GTK+ port and see how it works for the whole release cycle and if we don't notice any issues or
2047         performance regressions we release 2.22 with complex text path forced. A debug env variable is added to switch
2048         back to auto without having to recompile. After 2.22 is released we can make a final decision and remove the env
2049         variable.
2050
2051         * UIProcess/gtk/WebProcessPoolGtk.cpp:
2052         (WebKit::WebProcessPool::platformInitializeWebProcess): Force complex text code path unless
2053         WEBKIT_FORCE_COMPLEX_TEXT is present and set to 0.
2054
2055 2018-04-11  Zan Dobersek  <zdobersek@igalia.com>
2056
2057         [WPE] Make WebKitWebViewBackend object mandatory for webkit_web_view_new*() constructors
2058         https://bugs.webkit.org/show_bug.cgi?id=184513
2059
2060         Reviewed by Michael Catanzaro.
2061
2062         webkit_web_view_new*() constructors should always expect a non-null
2063         WebKitWebViewBackend object, forcing the user to specify how the
2064         wpe_view_backend object is managed for the WebKitWebView that's being
2065         created.
2066
2067         webkitWebViewBackendCreateDefault() and the default
2068         _WebKitWebViewBackend() constructor are removed. WPE-specific
2069         webkit_web_view_new*() entrypoints are updated to bail if the passed-in
2070         WebKitWebViewBackend object is null. Documentation is updated
2071         accordingly.
2072
2073         * UIProcess/API/glib/WebKitWebView.cpp:
2074         (webkitWebViewConstructed):
2075         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
2076         (webkitWebViewBackendCreateDefault): Deleted.
2077         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
2078         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
2079         (webkit_web_view_new):
2080         (webkit_web_view_new_with_context):
2081         (webkit_web_view_new_with_related_view):
2082         (webkit_web_view_new_with_settings):
2083         (webkit_web_view_new_with_user_content_manager):
2084
2085 2018-04-11  Fujii Hironori  <Hironori.Fujii@sony.com>
2086
2087         [curl][WebKit] Implement NetworkDataTaskCurl
2088         https://bugs.webkit.org/show_bug.cgi?id=184488
2089
2090         Reviewed by Alex Christensen.
2091
2092         * NetworkProcess/NetworkDataTask.cpp:
2093         (WebKit::NetworkDataTask::create):
2094         * NetworkProcess/curl/NetworkDataTaskCurl.cpp: Added.
2095         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
2096         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
2097         (WebKit::NetworkDataTaskCurl::resume):
2098         (WebKit::NetworkDataTaskCurl::suspend):
2099         (WebKit::NetworkDataTaskCurl::cancel):
2100         (WebKit::NetworkDataTaskCurl::invalidateAndCancel):
2101         (WebKit::NetworkDataTaskCurl::state const):
2102         (WebKit::NetworkDataTaskCurl::createCurlRequest):
2103         (WebKit::NetworkDataTaskCurl::curlDidSendData):
2104         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
2105         (WebKit::NetworkDataTaskCurl::curlDidReceiveBuffer):
2106         (WebKit::NetworkDataTaskCurl::curlDidComplete):
2107         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
2108         (WebKit::NetworkDataTaskCurl::shouldRedirectAsGET):
2109         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
2110         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
2111         (WebKit::NetworkDataTaskCurl::restartWithCredential):
2112         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
2113         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
2114         * NetworkProcess/curl/NetworkDataTaskCurl.h: Added.
2115         * PlatformWin.cmake:
2116
2117 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2118
2119         [Extra zoom mode] Support pushing input view controllers onto the navigation stack
2120         https://bugs.webkit.org/show_bug.cgi?id=184397
2121         <rdar://problem/39265294>
2122
2123         Reviewed by Timothy Hatcher.
2124
2125         Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
2126         the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
2127         and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
2128         within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
2129         presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
2130         approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
2131         UINavigationController to hook into this behavior, with modal presentation as a fallback.
2132
2133         At a high level, this patch makes the following tweaks to implement this behavior:
2134
2135         1. Store the currently presented view controller using a single member variable
2136            (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
2137            which view controller to present or dismiss much more straightforward.
2138
2139         2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
2140            pushing an input view controller onto the navigation stack after presenting the focused form control view
2141            controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
2142
2143         3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
2144            navigation stack rather than presenting them modally means that we end up in a state where neither the
2145            WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
2146            Instead, have the WKTimePickerViewController actually become first responder when presenting.
2147
2148         4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
2149            -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
2150            presentation.
2151
2152         * UIProcess/ios/WKContentViewInteraction.h:
2153
2154         Remove the separate member variables for each type of input view controller, and instead have one to keep track
2155         of the current (and only) presented input view controller.
2156
2157         * UIProcess/ios/WKContentViewInteraction.mm:
2158         (-[WKContentView _willStartScrollingOrZooming]):
2159         (-[WKContentView _didEndScrollingOrZooming]):
2160         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2161         (-[WKContentView _stopAssistingNode]):
2162
2163         Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
2164
2165         (-[WKContentView reloadContextViewForPresentedListViewController]):
2166
2167         Adjust for consolidation of the different input view controller member variables to a single member (see changes
2168         in WKContentViewInteraction.h).
2169
2170         (-[WKContentView addFocusedFormControlOverlay]):
2171         (-[WKContentView removeFocusedFormControlOverlay]):
2172         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
2173         (-[WKContentView dismissAllInputViewControllers:]):
2174
2175         Add an `animated` argument. In the case where a different view controller was presented after presenting the
2176         input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
2177         the web view or focus overlay underneath.
2178
2179         (-[WKContentView focusedFormControlViewDidSubmit:]):
2180         (-[WKContentView focusedFormControlViewDidCancel:]):
2181         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
2182         (-[WKContentView rectForFocusedFormControlView:]):
2183         (-[WKContentView nextRectForFocusedFormControlView:]):
2184         (-[WKContentView previousRectForFocusedFormControlView:]):
2185         (-[WKContentView scrollViewForFocusedFormControlView:]):
2186         (-[WKContentView actionNameForFocusedFormControlView:]):
2187         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
2188         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
2189         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
2190         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
2191         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
2192
2193         Boilerplate renaming of focus overlay delegate methods.
2194
2195         (-[WKContentView _wheelChangedWithEvent:]):
2196
2197         Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
2198
2199         (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
2200         (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
2201
2202         Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
2203
2204         (-[WKContentView dismissAllInputViewControllers]): Deleted.
2205         (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
2206         (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
2207         (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
2208         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2209         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2210         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
2211         (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
2212         (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
2213         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
2214         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
2215         (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
2216         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
2217         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
2218         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
2219
2220         Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
2221         the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
2222         present the focused form overlay as a separate view controller using the UINavigationController, and then
2223         immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
2224         updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
2225         this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
2226         overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
2227         the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
2228
2229         * WebKit.xcodeproj/project.pbxproj:
2230
2231 2018-04-11  Youenn Fablet  <youenn@apple.com>
2232
2233         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
2234         https://bugs.webkit.org/show_bug.cgi?id=184374
2235
2236         Reviewed by Chris Dumez.
2237
2238         Pass full FetchOptions parameters as part of NetworkResourceLoadParameters.
2239         This will allow handling redirection mode as well as credentials in case of cross origin redirections.
2240         In case of SameOrigin credentials and there is a redirection from same-origin to cross-origin,
2241         we will be able to stop using credentials without going to WebProcess.
2242
2243         To handle properly cross-origin checks, we have to be able to use SecurityOrigin as in WebProcess.
2244         We make WebProcess sends Origin Access White list information to NetworkProcess.
2245         This allows supporting the white list when doing loading in NetworkProcess.
2246         This only works consistently if all WebProcesses share the same whitelist.
2247
2248         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2249         (WebKit::NetworkConnectionToWebProcess::loadPing):
2250         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
2251         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
2252         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
2253         * NetworkProcess/NetworkConnectionToWebProcess.h:
2254         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2255         * NetworkProcess/NetworkLoadChecker.cpp:
2256         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
2257         (WebKit::NetworkLoadChecker::checkRedirection):
2258         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2259         (WebKit::NetworkLoadChecker::checkCORSRequest):
2260         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
2261         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
2262         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
2263         * NetworkProcess/NetworkLoadChecker.h:
2264         (WebKit::NetworkLoadChecker::create):
2265         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2266         (WebKit::NetworkResourceLoadParameters::encode const):
2267         (WebKit::NetworkResourceLoadParameters::decode):
2268         * NetworkProcess/NetworkResourceLoadParameters.h:
2269         * NetworkProcess/PingLoad.cpp:
2270         (WebKit::PingLoad::PingLoad):
2271         (WebKit::PingLoad::willPerformHTTPRedirection):
2272         * NetworkProcess/PingLoad.h:
2273         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2274         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
2275         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
2276         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
2277         * WebProcess/Network/WebLoaderStrategy.cpp:
2278         (WebKit::WebLoaderStrategy::startPingLoad):
2279
2280 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
2281
2282         [GTK] WaylandCompositorDisplay leaks its wl_display
2283         https://bugs.webkit.org/show_bug.cgi?id=184406
2284
2285         Reviewed by Carlos Garcia Campos.
2286
2287         Since we allocate our own wl_display here, need to chain up to the parent constructor
2288         passing NativeDisplayOwned::Yes, or it won't ever be released. Move the initialize call to
2289         the create function to ensure it's called after the constructor completes.
2290
2291         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
2292         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
2293         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
2294
2295 2018-04-11  Youenn Fablet  <youenn@apple.com>
2296
2297         Use more r-values in NetworkResourceLoader
2298         https://bugs.webkit.org/show_bug.cgi?id=184478
2299
2300         Reviewed by Chris Dumez.
2301
2302         Pass load parameters as r-values to remove some unneeded copies.
2303         Ditto for ResourceRequest inside NetworkResourceLoader.
2304
2305         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2306         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
2307         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
2308         * NetworkProcess/NetworkConnectionToWebProcess.h:
2309         * NetworkProcess/NetworkResourceLoader.cpp:
2310         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2311         (WebKit::NetworkResourceLoader::start):
2312         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
2313         (WebKit::NetworkResourceLoader::startNetworkLoad):
2314         (WebKit::NetworkResourceLoader::continueWillSendRequest):
2315         (WebKit::NetworkResourceLoader::validateCacheEntry):
2316         * NetworkProcess/NetworkResourceLoader.h:
2317
2318 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2319
2320         [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
2321         https://bugs.webkit.org/show_bug.cgi?id=184352
2322         <rdar://problem/39237683>
2323
2324         Reviewed by Andy Estes.
2325
2326         Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
2327         any information requested in the UI process that is dependent on the `title` of the focused element is broken
2328         in the case of select elements. An existing example of this is the title of the table view controller used to
2329         present select menus on iPad.
2330
2331         To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
2332         HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
2333         zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
2334         controller's title.
2335
2336         Test: fast/forms/ios/ipad/select-with-title.html
2337
2338         * UIProcess/API/Cocoa/WKWebView.mm:
2339         (-[WKWebView selectFormPopoverTitle]):
2340         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2341
2342         Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
2343         element.
2344
2345         * UIProcess/ios/WKContentViewInteraction.h:
2346         * UIProcess/ios/WKContentViewInteraction.mm:
2347         (-[WKContentView selectFormPopoverTitle]):
2348         * UIProcess/ios/forms/WKFormSelectControl.h:
2349         * UIProcess/ios/forms/WKFormSelectControl.mm:
2350         (-[WKFormSelectControl selectFormPopoverTitle]):
2351         * UIProcess/ios/forms/WKFormSelectPopover.h:
2352         * UIProcess/ios/forms/WKFormSelectPopover.mm:
2353         (-[WKSelectPopover initWithView:hasGroups:]):
2354         (-[WKSelectPopover tableViewController]):
2355         * WebProcess/WebPage/ios/WebPageIOS.mm:
2356
2357         Always send the title across if the focused node is an HTMLElement.
2358
2359         (WebKit::WebPage::getAssistedNodeInformation):
2360
2361 2018-04-11  Ryan Haddad  <ryanhaddad@apple.com>
2362
2363         Unreviewed, rolling out r230508.
2364
2365         Breaks internal builds.
2366
2367         Reverted changeset:
2368
2369         "Remove block selection code"
2370         https://bugs.webkit.org/show_bug.cgi?id=184470
2371         https://trac.webkit.org/changeset/230508
2372
2373 2018-04-11  Antoine Quint  <graouts@apple.com>
2374
2375         [Web Animations] Turn Web Animations on by default
2376         https://bugs.webkit.org/show_bug.cgi?id=184491
2377
2378         Reviewed by Simon Fraser.
2379
2380         * Shared/WebPreferences.yaml:
2381
2382 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2383
2384         Unreviewed test fix after r230468
2385
2386         Roll out an assertion added in r230468 that should not be present
2387         until https://bugs.webkit.org/show_bug.cgi?id=184451 is landed.
2388
2389         * Shared/mac/HangDetectionDisablerMac.mm:
2390         (WebKit::setClientsMayIgnoreEvents):
2391
2392 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
2393
2394         Unreviewed follow-up to r230468.
2395
2396         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
2397
2398         * UIProcess/mac/PageClientImplMac.mm:
2399         (WebKit::PageClientImpl::isViewWindowActive):
2400         (WebKit::PageClientImpl::setCursor):
2401
2402 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2403
2404         [Win] Add UserAgentWin.cpp
2405         https://bugs.webkit.org/show_bug.cgi?id=184438
2406
2407         Reviewed by Michael Catanzaro.
2408
2409         * WebProcess/WebPage/win/WebPageWin.cpp:
2410         (WebKit::WebPage::platformUserAgent const):
2411         Use WebCore::standardUserAgentForURL.
2412
2413 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
2414
2415         Remove block selection code
2416         https://bugs.webkit.org/show_bug.cgi?id=184470
2417
2418         Reviewed by Timothy Hatcher.
2419         
2420         Remove block selection code that isn't run and is currently not even used.
2421         Had to put this back in for a bug in the mid-year release, but we're past that
2422         so it's time for this to go away.
2423
2424         * Platform/spi/ios/UIKitSPI.h:
2425         * UIProcess/PageClient.h:
2426         * UIProcess/WebPageProxy.h:
2427         * UIProcess/WebPageProxy.messages.in:
2428         * UIProcess/ios/PageClientImplIOS.h:
2429         * UIProcess/ios/PageClientImplIOS.mm:
2430         (WebKit::PageClientImpl::stopAssistingNode):
2431         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
2432         * UIProcess/ios/WKContentViewInteraction.h:
2433         * UIProcess/ios/WKContentViewInteraction.mm:
2434         (toSelectionHandlePosition): Deleted.
2435         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
2436         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
2437         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
2438         * UIProcess/ios/WebPageProxyIOS.mm:
2439         (WebKit::WebPageProxy::saveImageToLibrary):
2440         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
2441         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
2442         * WebProcess/WebPage/WebPage.h:
2443         * WebProcess/WebPage/WebPage.messages.in:
2444         * WebProcess/WebPage/ios/WebPageIOS.mm:
2445         (WebKit::rangeAtWordBoundaryForPosition):
2446         (WebKit::distanceBetweenRectsForPosition): Deleted.
2447         (WebKit::rectsEssentiallyTheSame): Deleted.
2448         (WebKit::unionDOMRanges): Deleted.
2449         (WebKit::computeEdgeCenter): Deleted.
2450         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
2451         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
2452         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
2453         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
2454         (WebKit::shouldExpand): Deleted.
2455         (WebKit::WebPage::changeBlockSelection): Deleted.
2456         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
2457
2458 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2459
2460         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
2461         https://bugs.webkit.org/show_bug.cgi?id=184435
2462         <rdar://problem/38726260>
2463
2464         Reviewed by Dean Jackson.
2465
2466         Adds support for an alternate codepath when computing a zoom rect when double tapping that doesn't take the hit-
2467         tested node into account, and instead cycles the zoom scale between 2 fixed values (in addition to the initial
2468         scale). In the next patch, these fixed scales will be determined by computing zoom scales needed to make most of
2469         the text on the page legible (i.e. the first text legibility zoom scale), and another to make all of the text on
2470         the page legible, with the exception of outliers (this is the second text legibility zoom scale).
2471
2472         See comments below for more detail.
2473
2474         * UIProcess/Cocoa/ViewGestureController.h:
2475         * UIProcess/Cocoa/ViewGestureController.messages.in:
2476         * UIProcess/ios/SmartMagnificationController.h:
2477         * UIProcess/ios/SmartMagnificationController.messages.in:
2478         * UIProcess/ios/SmartMagnificationController.mm:
2479         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
2480         * UIProcess/mac/ViewGestureControllerMac.mm:
2481         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
2482         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
2483         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
2484
2485         Rename the boolean `isReplacedElement` argument to `fitEntireRect` instead. The UI process only uses this on iOS
2486         to determine whether or not to fit the entire element rect to the viewport and add padding. This patch renames
2487         this variable because we are not zooming to a replaced element in the case where text legibility on the page
2488         (rather than element geometry) is being used to figure out the zoom scale, but we still want to fit the entire
2489         target rect to the viewport.
2490
2491         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
2492
2493         If text legiblity zoom scaling is preferred, then compute first and second-level text legibility zoom scales to
2494         zoom to upon double tap (where the second zoom scale is greater than the first). To choose a target zoom
2495         scale, choose the lowest target zoom scale that is at least a small amount less than the current scale. If
2496         neither of the two scales fulfill this description, then zoom back out to the initial scale. This has the effect
2497         of consistently cycling between all three zoom scales as the user double taps.
2498
2499         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
2500
2501         Introduce a new helper method that computes and caches target scales to zoom to when double tapping to zoom. If
2502         a cached pair of target scales is already present, it skips this computation and immediately returns it.
2503
2504         (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
2505         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
2506
2507         Factor out logic to compute min and max zoom scales into a separate helper, and call it from both
2508         computeZoomInformationForNode and computeTextLegibilityScales.
2509
2510         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
2511
2512         Invalidate cached text legibility scales when layout is triggered.
2513
2514         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
2515         * WebProcess/WebPage/WebPage.cpp:
2516         (WebKit::WebPage::mainFrameDidLayout):
2517         * WebProcess/WebPage/WebPage.h:
2518         (WebKit::WebPage::viewportConfiguration const):
2519
2520         Expose WebPage's ViewportConfiguration as a const reference.
2521
2522         * WebProcess/WebPage/ios/WebPageIOS.mm:
2523         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
2524
2525         Adds a platform hook for opting into text-legibility-based zoom scaling instead of regular hit-testing-based
2526         zoom scaling heuristics.
2527
2528 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2529
2530         Fix availability annotations for _WKAttachment SPI
2531         https://bugs.webkit.org/show_bug.cgi?id=184473
2532         <rdar://problem/39319732>
2533
2534         Reviewed by Dan Bernstein.
2535
2536         _WKAttachmentInfo is available in WK_MAC_TBA and WK_IOS_TBA, but the SPI method -[_WKAttachment requestInfo:]
2537         is currently available in macOS 10.13.4 and iOS 11.3. Instead, the availability of this SPI should match the
2538         availability of the SPI object it depends on.
2539
2540         * UIProcess/API/Cocoa/_WKAttachment.h:
2541
2542 2018-04-10  Chris Dumez  <cdumez@apple.com>
2543
2544         Avoid constructing a service worker RegistrationStore for private sessions
2545         https://bugs.webkit.org/show_bug.cgi?id=184463
2546         <rdar://problem/36613948>
2547
2548         Reviewed by Youenn Fablet.
2549
2550         Avoid constructing a service worker RegistrationStore for private sessions since there
2551         is no need for persistence and the registrationDatabaseDirectory is the empty string in
2552         such cases.
2553
2554         * StorageProcess/StorageProcess.cpp:
2555         (WebKit::StorageProcess::initializeWebsiteDataStore):
2556
2557 2018-04-10  Andy Estes  <aestes@apple.com>
2558
2559         [iOS] Navigate to URL and page number annotations in WKPDFView
2560         https://bugs.webkit.org/show_bug.cgi?id=184410
2561
2562         Reviewed by Timothy Hatcher.
2563
2564         Implemented navigation to URL and page number (same-document) link annotations in PDFs.
2565
2566         * UIProcess/ios/WKPDFView.mm:
2567         (-[WKPDFView _scrollToURLFragment:]):
2568         (-[WKPDFView web_didSameDocumentNavigation:]):
2569         (-[WKPDFView pdfHostViewController:updatePageCount:]):
2570         (-[WKPDFView pdfHostViewController:goToURL:]):
2571         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
2572
2573 2018-04-10  Andy Estes  <aestes@apple.com>
2574
2575         [iOS] WKPDFView should conform to _WKWebViewPrintProvider
2576         https://bugs.webkit.org/show_bug.cgi?id=184471
2577
2578         Reviewed by Dan Bernstein.
2579
2580         * UIProcess/API/Cocoa/WKWebView.mm:
2581         (-[WKWebView _printProvider]):
2582
2583         The print provider will always be either _contentView or _customContentView, but
2584         might not be _currentContentView.
2585
2586         * UIProcess/ios/WKPDFView.mm:
2587         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
2588
2589         Asked _hostViewController for the page count, clamped to 1 if
2590         -[_WKWebViewPrintFormatter snapshotFirstPage] is YES.
2591
2592         (-[WKPDFView _wk_printedDocument]):
2593
2594         Created a CGPDFDocumentRef from _data and returned it.
2595
2596 2018-04-10  Youenn Fablet  <youenn@apple.com>
2597
2598         Beacon redirect responses should be CORS validated
2599         https://bugs.webkit.org/show_bug.cgi?id=184378
2600
2601         Reviewed by Chris Dumez.
2602
2603         Add CORS checks to any redirection response if mode is CORS.
2604         Update response tainting and redirected accordingly.
2605
2606         * NetworkProcess/NetworkLoadChecker.cpp:
2607         (WebKit::NetworkLoadChecker::checkRedirection):
2608         (WebKit::NetworkLoadChecker::validateResponse):
2609         * NetworkProcess/NetworkLoadChecker.h:
2610         * NetworkProcess/PingLoad.cpp:
2611         (WebKit::PingLoad::willPerformHTTPRedirection):
2612
2613 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
2614
2615         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
2616         https://bugs.webkit.org/show_bug.cgi?id=184268
2617         <rdar://problem/39144446>
2618
2619         Reviewed by Chris Dumez.
2620
2621         Webpage for multipart stream responses failed to refresh because content policy was set to 
2622         be ignore when provisonalDocumentLoader was null and navigation ID could not be retrieved. 
2623         As loading should not stop in this case, we set navigation ID 0 and still ask for content 
2624         policy.
2625
2626         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2627         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
2628
2629 2018-04-10  Andy Estes  <aestes@apple.com>
2630
2631         [iOS] Use PDFKit to render PDFs in WKWebView
2632         https://bugs.webkit.org/show_bug.cgi?id=184387
2633
2634         Reviewed by Beth Dakin.
2635
2636         Adopted PDFHostViewController for rendering PDFs in WKWebView.
2637
2638         This patch implements rendering the PDF document and page number indicator. Link
2639         navigation, find-in-page, and printing will be implemented in follow-up patches.
2640
2641         WKLegacyPDFView is still the default PDF view.
2642
2643         * Configurations/WebKit.xcconfig:
2644
2645         Linked WebKit with PDFKit on iOS.
2646
2647         * UIProcess/API/Cocoa/WKWebView.mm:
2648         (-[WKWebView _currentContentView]):
2649         (-[WKWebView viewForZoomingInScrollView:]):
2650
2651         When WKPDFView loads a PDF document, it replaces itself with a view vended by
2652         PDFHostViewController as the WKScrollView's content view. Abstracted WKWebView's
2653         concept of the "current content view" to be either the WKContentView or a view of
2654         the custom content view's choosing (-web_contentView).
2655
2656         (-[WKWebView scrollViewWillBeginZooming:withView:]):
2657         (-[WKWebView scrollViewDidZoom:]):
2658         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
2659
2660         Forwarded these calls to _customContentView if it responds to the equivalent
2661         WKWebViewContentProvider selectors.
2662
2663         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2664
2665         Defined new protocol selectors.
2666
2667         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2668         (-[WKWebViewContentProviderRegistry init]):
2669         * UIProcess/ios/WKLegacyPDFView.h:
2670         * UIProcess/ios/WKLegacyPDFView.mm:
2671
2672         Changed ENABLE(WKPDFVIEW) to ENABLE(WKLEGACYPDFVIEW).
2673
2674         (-[WKLegacyPDFView web_contentView]):
2675
2676         Added. Returns self as the content view.
2677
2678         * UIProcess/ios/WKPDFView.h: Added.
2679         * UIProcess/ios/WKPDFView.mm: Added.
2680         (-[WKPDFView dealloc]):
2681
2682         Removed the host view and page number indicator from their superviews.
2683
2684         (-[WKPDFView gestureRecognizerShouldBegin:]):
2685
2686         Forwarded to _hostViewController.
2687
2688         (-[WKPDFView web_initWithFrame:webView:]):
2689
2690         Set ours and the scroll view's background color to UIColor.grayColor to match
2691         WKLegacyPDFView.
2692
2693         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
2694
2695         Created a PDFHostViewController and set its root view as the scroll view's content
2696         view after removing the WKPDFView itself. This allows WKPDFView to act as a
2697         placeholder content view until the PDF is loaded. Added the host view controller's
2698         page number indicator to the fixed overlay view. Finally, loaded the PDF document
2699         by calling -[PDFHostViewController setDocumentData:withScrollView:].
2700
2701         (-[WKPDFView _offsetForPageNumberIndicator]):
2702
2703         Computed an offset for the page number indicator like WKLegacyPDFView did, taking
2704         into account the overlaid accessory views inset, computed unobscured safe area
2705         inset, and computed obscured inset.
2706
2707         (-[WKPDFView _movePageNumberIndicatorToPoint:animated:]):
2708
2709         Moved the page number indicator using the margin and animation duration from
2710         WKLegacyPDFView.
2711
2712         (-[WKPDFView _updateLayoutAnimated:]):
2713
2714         Added a convenience method to update the PDF view layout and position the page
2715         number indicator.
2716
2717         (-[WKPDFView web_setMinimumSize:]):
2718
2719         Updated our own frame in case we are still the placeholder content view.
2720         Called -_updateLayoutAnimated:.
2721
2722         (-[WKPDFView web_setOverlaidAccessoryViewsInset:]):
2723
2724         Stored the inset and called -_updateLayoutAnimated:.
2725
2726         (-[WKPDFView web_computedContentInsetDidChange]):
2727
2728         Called -_updateLayoutAnimated:.
2729
2730         (-[WKPDFView web_setFixedOverlayView:]):
2731
2732         Stored the fixed overlay view.
2733
2734         (-[WKPDFView web_didSameDocumentNavigation:]):
2735         (-[WKPDFView web_countStringMatches:options:maxCount:]):
2736         (-[WKPDFView web_findString:options:maxCount:]):
2737         (-[WKPDFView web_hideFindUI]):
2738
2739         Added FIXMEs.
2740
2741         (-[WKPDFView web_contentView]):
2742
2743         If there is a host view controller, return its root view. Otherwise, return self.
2744
2745         (-[WKPDFView web_scrollViewDidScroll:]):
2746         (-[WKPDFView web_scrollViewWillBeginZooming:withView:]):
2747         (-[WKPDFView web_scrollViewDidEndZooming:withView:atScale:]):
2748         (-[WKPDFView web_scrollViewDidZoom:]):
2749
2750         Called -[PDFHostViewController updatePDFViewLayout].
2751
2752         (-[WKPDFView web_dataRepresentation]):
2753
2754         Returned _data.
2755
2756         (-[WKPDFView web_suggestedFilename]):
2757
2758         Returned _suggestedFilename.
2759
2760         (-[WKPDFView web_isBackground]):
2761
2762         Returned self.isBackground.
2763
2764         * UIProcess/ios/WKSystemPreviewView.mm:
2765         (-[WKSystemPreviewView web_contentView]):
2766
2767         Added. Returns self as the content view.
2768
2769         * WebKit.xcodeproj/project.pbxproj:
2770
2771 2018-04-10  Miguel Gomez  <magomez@igalia.com>
2772
2773         [GTK][WPE] Race condition when destroying webprocesses
2774         https://bugs.webkit.org/show_bug.cgi?id=184445
2775
2776         Reviewed by Carlos Garcia Campos.
2777
2778         Ensure that the WebProcess is properly closing its pages when it's exiting because
2779         the UIProcess has invalidated the IPC connection.
2780
2781         * WebProcess/WebProcess.cpp:
2782         (WebKit::WebProcess::didClose):
2783
2784 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2785
2786         Add missing availability macros after r230462
2787         https://bugs.webkit.org/show_bug.cgi?id=184426
2788
2789         Reviewed by Timothy Hatcher.
2790
2791         Annotate new SPI added in r230462 with the appropriate availability macros.
2792
2793         * UIProcess/API/Cocoa/WKViewPrivate.h:
2794         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2795
2796 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2797
2798         Add ProcessPrivilege assertions to places that access NSApp
2799         https://bugs.webkit.org/show_bug.cgi?id=184322
2800         <rdar://problem/39194560>
2801
2802         Reviewed by Per Arne Vollan.
2803
2804         Add ProcessPrivilege assertions to places where we interact with NSApp so
2805         that we can prevent accidentally using them in the WebContent process.
2806
2807         * Shared/mac/ChildProcessMac.mm:
2808         (WebKit::ChildProcess::stopNSAppRunLoop):
2809         * Shared/mac/HangDetectionDisablerMac.mm:
2810         (WebKit::setClientsMayIgnoreEvents):
2811         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2812         (WebKit::WebProcessPool::platformInitializeWebProcess):
2813         * UIProcess/Cocoa/WebViewImpl.mm:
2814         (WebKit::WebViewImpl::WebViewImpl):
2815         (WebKit::WebViewImpl::becomeFirstResponder):
2816         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
2817         (WebKit::WebViewImpl::validateUserInterfaceItem):
2818         (WebKit::WebViewImpl::startSpeaking):
2819         (WebKit::WebViewImpl::stopSpeaking):
2820         (WebKit::applicationFlagsForDrag):
2821         (WebKit::WebViewImpl::doneWithKeyEvent):
2822         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
2823         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
2824         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
2825         (WebKit::PluginProcessProxy::enterFullscreen):
2826         (WebKit::PluginProcessProxy::beginModal):
2827         (WebKit::PluginProcessProxy::endModal):
2828         * UIProcess/mac/DisplayLink.cpp:
2829         (WebKit::DisplayLink::DisplayLink):
2830         (WebKit::DisplayLink::~DisplayLink):
2831         * UIProcess/mac/PageClientImplMac.mm:
2832         (WebKit::PageClientImpl::isViewWindowActive):
2833         (WebKit::PageClientImpl::setCursor):
2834         * UIProcess/mac/WebPageProxyMac.mm:
2835         (WebKit::WebPageProxy::getIsSpeaking):
2836         (WebKit::WebPageProxy::speak):
2837         (WebKit::WebPageProxy::stopSpeaking):
2838         (WebKit::WebPageProxy::startDisplayLink):
2839         * UIProcess/mac/WebPopupMenuProxyMac.mm:
2840         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
2841
2842 2018-04-09  John Wilander  <wilander@apple.com>
2843
2844         Refactor Ignore HSTS code
2845         https://bugs.webkit.org/show_bug.cgi?id=184433
2846         <rdar://problem/39298238>
2847
2848         Reviewed by Darin Adler.
2849
2850         This patch refactors our ignore HSTS code. The convenience functions are moved
2851         out of CFNetwork SPI in PAL, and into where they are used. It also switches
2852         from performSelector: calls to straight function calls, after checking that
2853         there is a responder.
2854
2855         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2856         (schemeWasUpgradedDueToDynamicHSTS):
2857         (setIgnoreHSTS):
2858         (ignoreHSTS):
2859             Add convenience functions here since they were moved out of
2860             CFNetworkSPI.h.
2861
2862 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2863
2864         Rename UNUSED to BUNUSED
2865         https://bugs.webkit.org/show_bug.cgi?id=184093
2866
2867         Reviewed by Yusuke Suzuki.
2868
2869         * UIProcess/API/Cocoa/WKWebView.mm:
2870         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
2871
2872 2018-04-09  Timothy Hatcher  <timothy@apple.com>
2873
2874         Add support for setting a background color on WKWebView and WKView
2875         https://bugs.webkit.org/show_bug.cgi?id=184426
2876
2877         Reviewed by Wenson Hsieh.
2878
2879         * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property.
2880         * UIProcess/API/Cocoa/WKWebView.mm:
2881         (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl.
2882         (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl.
2883         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property.
2884         * UIProcess/API/mac/WKView.mm:
2885         (-[WKView _backgroundColor]): Added. Call through to WebViewImpl.
2886         (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl.
2887         * UIProcess/Cocoa/WebViewImpl.h:
2888         * UIProcess/Cocoa/WebViewImpl.mm:
2889         (WebKit::WebViewImpl::setBackgroundColor): Added.
2890         (WebKit::WebViewImpl::backgroundColor const): Added.
2891         (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set.
2892
2893 2018-04-09  Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
2894
2895         [WinCairo] Add WebKit Shared/win event files for wincairo webkit
2896         https://bugs.webkit.org/show_bug.cgi?id=183043
2897
2898         Reviewed by Brent Fulgham.
2899
2900         * Shared/NativeWebKeyboardEvent.h:
2901         (WebKit::NativeWebKeyboardEvent::nativeEvent const):
2902         * Shared/NativeWebMouseEvent.h:
2903         (WebKit::NativeWebMouseEvent::nativeEvent const):
2904         * Shared/NativeWebTouchEvent.h:
2905         * Shared/NativeWebWheelEvent.h:
2906         (WebKit::NativeWebWheelEvent::nativeEvent const):
2907         * Shared/win/NativeWebKeyboardEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
2908         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
2909         * Shared/win/NativeWebMouseEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
2910         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
2911         * Shared/win/NativeWebTouchEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebTouchEvent.h.
2912         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
2913         * Shared/win/NativeWebWheelEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
2914         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
2915         * Shared/win/WebEventFactory.cpp: Added.
2916         (WebKit::relativeCursorPosition):
2917         (WebKit::point):
2918         (WebKit::horizontalScrollChars):
2919         (WebKit::verticalScrollLines):
2920         (WebKit::clickCount):
2921         (WebKit::IsKeyInDownState):
2922         (WebKit::modifiersForEvent):
2923         (WebKit::modifiersForCurrentKeyState):
2924         (WebKit::keyboardEventTypeForEvent):
2925         (WebKit::isSystemKeyEvent):
2926         (WebKit::isKeypadEvent):
2927         (WebKit::textFromEvent):
2928         (WebKit::unmodifiedTextFromEvent):
2929         (WebKit::keyIdentifierFromEvent):
2930         (WebKit::WebEventFactory::createWebMouseEvent):
2931         (WebKit::WebEventFactory::createWebWheelEvent):
2932         (WebKit::WebEventFactory::createWebKeyboardEvent):
2933         (WebKit::WebEventFactory::createWebTouchEvent):
2934         * Shared/win/WebEventFactory.h: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
2935         (WebKit::createNativeEvent):
2936
2937 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
2938
2939         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
2940         https://bugs.webkit.org/show_bug.cgi?id=184344
2941         <rdar://problem/39224969>
2942
2943         Reviewed by Per Arne Vollan.
2944
2945         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
2946         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
2947         we do not want to allow in the WebContent process.
2948
2949         Instead, we should just use the cached screen information the WebContent process already possesses.
2950
2951         This patch makes the following changes:
2952         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
2953            the WindowServer directly.
2954         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
2955            the user space version of the coordinates. A nil Window just means we want to get coordinates in
2956            terms of the primary display.
2957         3. Keep track of the primary display so we can refer to it later.
2958         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
2959         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
2960            than whichever screen happened to hash to the lowest value.
2961
2962         Reviewed by Per Arne Vollan.
2963
2964         * UIProcess/WebProcessPool.cpp:
2965         (WebKit::displayReconfigurationCallBack): Update for new getScreenProperties implementation.
2966         (WebKit::WebProcessPool::initializeNewWebProcess): Ditto.
2967         * WebProcess/WebProcess.cpp:
2968         (WebKit::WebProcess::setScreenProperties): Ditto.
2969         * WebProcess/WebProcess.h:
2970         * WebProcess/WebProcess.messages.in: Ditto.
2971
2972 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2973
2974         [WPE] Add API version to library soname and pkg-config files
2975         https://bugs.webkit.org/show_bug.cgi?id=180608
2976
2977         Reviewed by Žan Doberšek.
2978
2979         * PlatformWPE.cmake:
2980         * wpe/wpe-webkit.pc.in:
2981
2982 2018-04-09  Jer Noble  <jer.noble@apple.com>
2983
2984         Fix the selection assistant selectionView build
2985         https://bugs.webkit.org/show_bug.cgi?id=184423
2986         <rdar://problem/39288235>
2987
2988         Reviewed by Wenson Hsieh.
2989
2990         * Platform/spi/ios/UIKitSPI.h:
2991         * UIProcess/ios/WKContentView.mm:
2992         (-[WKContentView _didExitStableState]):
2993         * UIProcess/ios/WKContentViewInteraction.mm:
2994         (-[WKContentView _updateChangedSelection:]):
2995
2996 2018-04-09  Megan Gardner  <megan_gardner@apple.com>
2997
2998         Switch to UIWKTextInteractionAssistant for non-editable text
2999         https://bugs.webkit.org/show_bug.cgi?id=182834
3000
3001         Switch to only using one assistant for text selection.
3002
3003         Reviewed by Timothy Hatcher and Andy Estes.
3004
3005         * UIProcess/ios/WKContentViewInteraction.mm:
3006         (-[WKContentView useSelectionAssistantWithGranularity:]):
3007
3008 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3009
3010         Unreviewed, move 'using namespace' back to the right place after r230429
3011
3012         * Shared/glib/ProcessExecutablePathGLib.cpp:
3013
3014 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3015
3016         Unreviewed, rolling out r230390.
3017
3018         Broke accelerated compositing
3019
3020         Reverted changeset:
3021
3022         "[GTK] WaylandCompositorDisplay leaks its wl_display"
3023         https://bugs.webkit.org/show_bug.cgi?id=184406
3024         https://trac.webkit.org/changeset/230390
3025
3026 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3027
3028         [Extra zoom mode] Disable fast clicking by default in extra zoom mode
3029         https://bugs.webkit.org/show_bug.cgi?id=184411
3030         <rdar://problem/38726867>
3031
3032         Reviewed by Andy Estes.
3033
3034         As it turns out, existing fast-clicking heuristics don't work so well in extra zoom mode. Even at device-width,
3035         since the page is scaled to fit within the viewport, having single taps take precedence over double taps leads
3036         to a confusing experience when trying to double tap to zoom further on content that contains links and other
3037         click targets. Revert to legacy behavior here by disabling these heuristics.
3038
3039         * UIProcess/API/Cocoa/WKWebView.mm:
3040         (-[WKWebView _initializeWithConfiguration:]):
3041
3042 2018-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
3043
3044         [Extra zoom mode] Add an SPI hook for clients to opt in to focus overlay UI
3045         https://bugs.webkit.org/show_bug.cgi?id=184370
3046         <rdar://problem/39250494>
3047
3048         Reviewed by Timothy Hatcher and Andy Estes.
3049
3050         Add a new SPI hook for internal clients to opt in to showing the focused form control overlay. By default, the
3051         overlay is not shown.
3052
3053         * UIProcess/API/Cocoa/_WKInputDelegate.h:
3054
3055 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3056
3057         [WPE] Use GNU install directories
3058         https://bugs.webkit.org/show_bug.cgi?id=184377
3059
3060         Reviewed by Carlos Garcia Campos.
3061
3062         Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
3063         WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
3064
3065         * PlatformWPE.cmake:
3066         * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
3067         (WebKit::getExecutablePath):
3068         (WebKit::findWebKitProcess):
3069         (WebKit::executablePathOfWebProcess):
3070         (WebKit::executablePathOfPluginProcess):
3071         (WebKit::executablePathOfNetworkProcess):
3072         (WebKit::executablePathOfStorageProcess):
3073         * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
3074         * SourcesGTK.txt:
3075         * SourcesWPE.txt:
3076
3077 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
3078
3079         [GTK] WaylandCompositorDisplay leaks its wl_display
3080         https://bugs.webkit.org/show_bug.cgi?id=184406
3081
3082         Reviewed by Carlos Garcia Campos.
3083
3084         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
3085         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
3086         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): Fix the leak.
3087
3088 2018-04-08  Zan Dobersek  <zdobersek@igalia.com>
3089
3090         Non-Cocoa ports use default directory for ServiceWorker data during testing
3091         https://bugs.webkit.org/show_bug.cgi?id=183784
3092
3093         Reviewed by Youenn Fablet.
3094
3095         Add API to WKWebsiteDataStore that enables setting and retrieving the
3096         service worker registration directory for a given data store object.
3097         This enables setting the temporary directory for testing purposes in
3098         WebKitTestRunner.
3099
3100         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3101         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
3102         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
3103         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3104
3105 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
3106
3107         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
3108         https://bugs.webkit.org/show_bug.cgi?id=184127
3109
3110         Reviewed by Konstantin Tokarev.
3111
3112         * CMakeLists.txt: Link with WebCore as private,
3113         WebCoreHeaderInterface as public to WebKit if WebCore is a static
3114         library.
3115         * CMakeLists.txt:
3116         * PlatformGTK.cmake: Added PRIVATE keyword for WebKit_LIBRARIES.
3117         * PlatformWPE.cmake: Ditto.
3118         * PlatformWin.cmake: Ditto.
3119
3120 2018-04-08  Andy Estes  <aestes@apple.com>
3121
3122         [iOS] WKContentView and WKLegacyPDFView should share application state tracking logic
3123         https://bugs.webkit.org/show_bug.cgi?id=184402
3124
3125         Reviewed by Dan Bernstein.
3126
3127         WKContentView and WKLegacyPDFView have nearly identical logic for tracking
3128         application foreground state. Let's share it so we can more easily create new
3129         content views with proper application state tracking.
3130
3131         * UIProcess/ios/WKApplicationStateTrackingView.h: Added.
3132         * UIProcess/ios/WKApplicationStateTrackingView.mm: Added.
3133         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
3134         (-[WKApplicationStateTrackingView willMoveToWindow:]):
3135         (-[WKApplicationStateTrackingView didMoveToWindow]):
3136         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
3137         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]):
3138         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
3139         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
3140         (-[WKApplicationStateTrackingView isBackground]):
3141
3142         Moved common logic from WKContentView and WKLegacyPDFView into
3143         WKApplicationStateTrackingView.
3144
3145         * UIProcess/ios/WKContentView.h:
3146         * UIProcess/ios/WKContentView.mm:
3147         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
3148         (-[WKContentView willMoveToWindow:]):
3149         (-[WKContentView _applicationDidCreateWindowContext]):
3150         (-[WKContentView didMoveToWindow]): Deleted.
3151         (-[WKContentView isBackground]): Deleted.
3152         (-[WKContentView _applicationDidEnterBackground]): Deleted.
3153         (-[WKContentView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
3154         (-[WKContentView _applicationWillEnterForeground]): Deleted.
3155
3156         Made WKContentView a subclass of WKApplicationStateTrackingView.
3157
3158         * UIProcess/ios/WKLegacyPDFView.h:
3159         * UIProcess/ios/WKLegacyPDFView.mm:
3160         (-[WKLegacyPDFView web_initWithFrame:webView:]):
3161         (-[WKLegacyPDFView web_isBackground]):
3162         (-[WKLegacyPDFView _applicationWillEnterForeground]):
3163         (-[WKLegacyPDFView willMoveToWindow:]): Deleted.
3164         (-[WKLegacyPDFView didMoveToWindow]): Deleted.
3165         (-[WKLegacyPDFView _applicationDidEnterBackground]): Deleted.
3166         (-[WKLegacyPDFView _applicationDidCreateWindowContext]): Deleted.
3167         (-[WKLegacyPDFView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
3168
3169         Made WKLegacyPDFView a subclass of WKApplicationStateTrackingView.
3170
3171         * WebKit.xcodeproj/project.pbxproj:
3172
3173 2018-04-08  Dan Bernstein  <mitz@apple.com>
3174
3175         [Cocoa] Keep library validation disabled for WebContent.Development
3176         https://bugs.webkit.org/show_bug.cgi?id=184393
3177
3178         Reviewed by Anders Carlsson.
3179
3180         * Configurations/WebContent.Development.entitlements: Added. Includes the
3181           com.apple.security.cs.disable-library-validation entitlement set to true.
3182         * Configurations/WebContentService.Development.xcconfig: Set CODE_SIGN_ENTITLEMENTS to the
3183           above.
3184         * WebKit.xcodeproj/project.pbxproj: Added reference to new file.
3185
3186 2018-04-06  Brian Burg  <bburg@apple.com>
3187
3188         REGRESSION(r228371): WebAutomationSession::deleteAllCookies doesn't delete some cookies
3189         https://bugs.webkit.org/show_bug.cgi?id=184334
3190         <rdar://problem/39212863>
3191
3192         Reviewed by Timothy Hatcher.
3193
3194         When WebDriver adds a cookie for 'localhost', it actually uses the domain '.localhost' per RFC.
3195         When deleting cookies, we first fetch all cookies matching the document's hostname, and
3196         then delete them one by one. However, this code path does not add the dot prefix. This causes
3197         no cookies to match the requested domain, and thus none of them are deleted.
3198
3199         * UIProcess/Automation/WebAutomationSession.cpp:
3200         (WebKit::domainByAddingDotPrefixIfNeeded): Extract this helper method.
3201         (WebKit::WebAutomationSession::addSingleCookie): Use helper method.
3202         (WebKit::WebAutomationSession::deleteAllCookies): Add a dot prefix when
3203         requesting to delete all cookies for a hostname.
3204
3205 2018-04-06  Youenn Fablet  <youenn@apple.com>
3206
3207         Response headers should be filtered when sent from NetworkProcess to WebProcess
3208         https://bugs.webkit.org/show_bug.cgi?id=184310
3209
3210         Reviewed by Ryosuke Niwa.
3211
3212         Pass destination parameter to NetworkResourceLoader.
3213         Use new sanitization routine to filter response headers as needed:
3214         - Cross-origin routines are filtered by removing any non CORS allowed headers.
3215         - Same-origin responses are filtered by removing non used headers, except when filtering would be visible by JS (XHR, fetch).
3216         In all cases, Set-Cookie/Set-Cookie2 headers are filtered out.
3217
3218         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3219         (WebKit::NetworkResourceLoadParameters::encode const):
3220         (WebKit::NetworkResourceLoadParameters::decode):
3221         * NetworkProcess/NetworkResourceLoadParameters.h:
3222         * NetworkProcess/NetworkResourceLoader.cpp:
3223         (WebKit::NetworkResourceLoader::didReceiveResponse):
3224         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
3225         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
3226         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
3227         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
3228         * NetworkProcess/NetworkResourceLoader.h:
3229         * WebProcess/Network/WebLoaderStrategy.cpp:
3230         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
3231         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
3232         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
3233
3234 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
3235
3236         Make all sync IPCs during ScriptDisallowedScope set DoNotProcessIncomingMessagesWhenWaitingForSyncReply
3237         https://bugs.webkit.org/show_bug.cgi?id=182449
3238         <rdar://problem/39222541>
3239
3240         Reviewed by Chris Dumez.
3241
3242         Release assert that a sync IPC inside ScriptDisallowedScope sets DoNotProcessIncomingMessagesWhenWaitingForSyncReply
3243         to avoid executing arbitrary scripts as a result of processing incoming sync IPCs.
3244
3245         * Platform/IPC/Connection.h:
3246         (IPC::Connection::sendSync): Added the release assertion.
3247
3248 2018-04-05  Youenn Fablet  <youenn@apple.com>
3249
3250         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
3251         https://bugs.webkit.org/show_bug.cgi?id=184306
3252
3253         Reviewed by Ryosuke Niwa.
3254
3255         * NetworkProcess/NetworkContentRuleListManager.cpp:
3256         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
3257
3258 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
3259
3260         WebContent process is calling CGDisplayUsesInvertedPolarity
3261         https://bugs.webkit.org/show_bug.cgi?id=184337
3262         <rdar://problem/39215702>
3263
3264         Reviewed by Zalan Bujtas.
3265
3266         The PlatformScreenMac code is still calling display-related routines directly, specifically
3267         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
3268         the UIProcess.
3269         
3270         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
3271         the compile guards so all macOS builds use this behavior.
3272         
3273         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
3274         routines in the future.
3275
3276         * UIProcess/WebProcessPool.cpp:
3277         (WebKit::WebProcessPool::initializeNewWebProcess): Activate screen brokering code for all builds.
3278         * WebProcess/WebProcess.cpp: Ditto.
3279         * WebProcess/WebProcess.h: Ditto.
3280         * WebProcess/WebProcess.messages.in: Ditto.
3281
3282 2018-04-05  Brady Eidson  <beidson@apple.com>
3283
3284         Process Swap on Navigation causes many webpages to hang due to attempted process swap for iframe navigations.
3285         <rdar://problem/39162236> and https://bugs.webkit.org/show_bug.cgi?id=184318
3286
3287         Reviewed by Andy Estes.
3288
3289         * UIProcess/WebPageProxy.cpp:
3290         (WebKit::WebPageProxy::receivedPolicyDecision): Don't consider a swap if the navigation is not in the main frame.
3291
3292 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
3293
3294         WebContent process sometimes hangs in WebProcess::ensureNetworkProcessConnection
3295         https://bugs.webkit.org/show_bug.cgi?id=184326
3296
3297         Reviewed by Chris Dumez.
3298
3299         The hang was caused by UI process never sending the reply back to GetNetworkProcessConnection
3300         due to m_pendingOutgoingMachMessage being set and the event handler for DISPATCH_MACH_SEND_POSSIBLE
3301         never getting called. This is because the event handler registration happens asynchronously,
3302         and may not have completed by the time we send the first IPC to the web content process
3303         in which case it can timeout and we may never get the callback.
3304
3305         Fixed the hang by waiting for the event handler registration to be completed using
3306         dispatch_source_set_registration_handler. To do this, this patch adds a new boolean instance variable,
3307         m_isInitializingSendSource, to Connection which is set to true between the time mach port is created
3308         and until the event handler registration has been completed. platformCanSendOutgoingMessages returns
3309         false while m_isInitializingSendSource is set to prevent the attempt to send messages like we do when
3310         m_pendingOutgoingMachMessage is set to true.
3311
3312         * Platform/IPC/Connection.h:
3313         (IPC::Connection::m_isInitializingSendSource): Added.
3314         * Platform/IPC/mac/ConnectionMac.mm:
3315         (IPC::Connection::platformInvalidate): Set m_isInitializingSendSource to false.
3316         (IPC::Connection::sendMessage): Assert that m_isInitializingSendSource is false.
3317         (IPC::Connection::platformCanSendOutgoingMessages const): Return false if m_isInitializingSendSource
3318         is set to true.
3319         (IPC::Connection::sendOutgoingMessage): Assert that m_isInitializingSendSource is false.
3320         (IPC::Connection::initializeSendSource): Set m_isInitializingSendSource to true temporarily until
3321         dispatch_source_set_registration_handler's callback is called. Resume and send any pending outgoing
3322         messages.
3323         (IPC::Connection::resumeSendSource): Extracted from initializeSendSource.
3324
3325 2018-04-05  Youenn Fablet  <youenn@apple.com>
3326
3327         WebRTC data channel only applications require capture permissions for direct connections
3328         https://bugs.webkit.org/show_bug.cgi?id=174500
3329         <rdar://problem/34134281>
3330
3331         Unreviewed.
3332         Changed the code to suppress: "error: unused variable 'error' [-Werror,-Wunused-variable]"
3333         Added some logging to this error case as a side bonus.
3334
3335         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
3336         (WebKit::NetworkMDNSRegister::registerMDNSName):
3337
3338 2018-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3339
3340         REGRESSION(r229831): Test WebKit2.ProvisionalURLAfterWillSendRequestCallback times out since r229831
3341         https://bugs.webkit.org/show_bug.cgi?id=184293
3342
3343         Reviewed by Alex Christensen.
3344
3345         The problem is that after willSendRequest callback changes the request, the load is cancelled while
3346         transitioning to committed state. This happens because the load is not waiting for the response policy check, so
3347         it continues and when transitioning to committed, FrameLoader::closeURL() invalidates the current policy check
3348         that causes a load failure. The new request returned by the API doesn't have any requester, so it's no longer
3349         considered a main resource load. In the network process the resource load task doesn't wait for the response
3350         policy and continues the load, sending the data to the web process. Once the first data is received, the load
3351         transitions to commit, but the response policy check is still ongoing. This can only happen when using the C API
3352         (I don't know about the Cocoa API), but not with the GLib API because it doesn't allow to create a new request,
3353         only to modify the passed in one. With the C API we loss other internal things of the request like the priority,
3354         but I guess the most important one is the requester.
3355
3356         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3357         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
3358
3359 2018-04-04  Ryan Haddad  <ryanhaddad@apple.com>
3360
3361         Unreviewed, rolling out r230283.
3362
3363         Caused webkitpy test failures.
3364
3365         Reverted changeset:
3366
3367         "Use CompletionHandlers for DelayedReplies"
3368         https://bugs.webkit.org/show_bug.cgi?id=182269
3369         https://trac.webkit.org/changeset/230283
3370
3371 2018-04-04  Youenn Fablet  <youenn@apple.com>
3372
3373         webrtc/video-update-often.html is flakily crashing on iOS simulator Debug
3374         https://bugs.webkit.org/show_bug.cgi?id=184022
3375
3376         Reviewed by Jer Noble.
3377
3378         Remove client context once the new context identifier is set.
3379         Covered by test no longer crashing locally.
3380
3381         * WebProcess/cocoa/PlaybackSessionManager.mm:
3382         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
3383
3384 2018-04-04  Youenn Fablet  <youenn@apple.com>
3385
3386         WebRTC data channel only applications require capture permissions for direct connections
3387         https://bugs.webkit.org/show_bug.cgi?id=174500
3388         <rdar://problem/34134281>
3389
3390         Reviewed by Eric Carlson.
3391
3392         Add support for MDNS registration and resolution by NetworkProcess.
3393         WebProcess gives instruction to do the actual registrations/resolutions.
3394
3395         * CMakeLists.txt:
3396         * DerivedSources.make:
3397         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
3398         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
3399         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
3400         * NetworkProcess/NetworkConnectionToWebProcess.h:
3401         (WebKit::NetworkConnectionToWebProcess::mdnsRegister):
3402         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Added.
3403         (WebKit::NetworkMDNSRegister::NetworkMDNSRegister):
3404         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
3405         (WebKit::NetworkMDNSRegister::unregisterMDNSNames):
3406         (WebKit::PendingRegistrationRequest::PendingRegistrationRequest):
3407         (WebKit::registerMDNSNameCallback):
3408         (WebKit::NetworkMDNSRegister::registerMDNSName):
3409         (WebKit::PendingResolutionRequest::PendingResolutionRequest):
3410         (WebKit::PendingResolutionRequest::~PendingResolutionRequest):
3411         (WebKit::PendingResolutionRequest::timeout):
3412         (WebKit::resolveMDNSNameCallback):
3413         (WebKit::NetworkMDNSRegister::resolveMDNSName):
3414         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Added.
3415         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: Added.
3416         * Shared/WebPreferences.yaml: