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