8be6fcdcf61f76ae1c8cd854ef7453e2b3e6e8c8
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-04-19  Youenn Fablet  <youenn@apple.com>
2
3         NetworkProcess should use CSP/content blockers for sync XHR
4         https://bugs.webkit.org/show_bug.cgi?id=184760
5
6         Reviewed by Chris Dumez.
7
8         Setting CSP/ContentBlockers parameters for sync XHR loads.
9         * NetworkProcess/NetworkResourceLoader.cpp:
10
11 2018-04-19  Nan Wang  <n_wang@apple.com>
12
13         AX: AOM: respect the accessibility setting for dispatching the accessible events
14         https://bugs.webkit.org/show_bug.cgi?id=184619
15
16         Reviewed by Ryosuke Niwa.
17
18         Linked libAccessibility on iOS and macOS to use the platform accessibility settings
19         for allowing dispatching the accessibility events.
20
21         * Configurations/WebKit.xcconfig:
22         * UIProcess/API/Cocoa/WKWebView.mm:
23         (-[WKWebView _initializeWithConfiguration:]):
24         (accessibilityEventsEnabledChangedCallback):
25         (-[WKWebView _updateAccessibilityEventsEnabled]):
26         * UIProcess/API/Cocoa/WKWebViewInternal.h:
27         * UIProcess/WebPageProxy.cpp:
28         (WebKit::WebPageProxy::updateAccessibilityEventsEnabled):
29         * UIProcess/WebPageProxy.h:
30         * WebProcess/WebPage/WebPage.cpp:
31         (WebKit::WebPage::updateAccessibilityEventsEnabled):
32         * WebProcess/WebPage/WebPage.h:
33         * WebProcess/WebPage/WebPage.messages.in:
34
35 2018-04-18  Chris Dumez  <cdumez@apple.com>
36
37         Rename WindowProxyController to WindowProxy
38         https://bugs.webkit.org/show_bug.cgi?id=184756
39
40         Reviewed by Sam Weinig.
41
42         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
43         needed use WindowProxyController type, which was a bit confusing.
44
45         * WebProcess/Plugins/PluginView.cpp:
46         (WebKit::PluginView::windowScriptNPObject):
47         * WebProcess/WebPage/WebPage.cpp:
48         (WebKit::WebPage::frameBecameRemote):
49
50 2018-04-18  Youenn Fablet  <youenn@apple.com>
51
52         Allow SameOrigin credentials handling for synchronous XHR
53         https://bugs.webkit.org/show_bug.cgi?id=184723
54
55         Reviewed by Alex Christensen.
56
57         In case of SameOrigin credentials, we need to stop the current load
58         in case of cross origin redirection to restart a load with a different session.
59         Covered by updated WK2 tests.
60         Rebased WK1 tests since this is Wk1 only.
61
62         * NetworkProcess/NetworkResourceLoader.cpp:
63         (WebKit::NetworkResourceLoader::startNetworkLoad):
64         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
65         * NetworkProcess/NetworkResourceLoader.h:
66
67 2018-04-18  Chris Dumez  <cdumez@apple.com>
68
69         Set RemoteDOMWindow's initial opener
70         https://bugs.webkit.org/show_bug.cgi?id=184716
71
72         Reviewed by Sam Weinig.
73
74         When a frame becomes remote, transfer the frame opener from the old
75         frame to the new remote one.
76
77         * WebProcess/WebPage/WebPage.cpp:
78         (WebKit::WebPage::frameBecameRemote):
79
80 2018-04-18  Youenn Fablet  <youenn@apple.com>
81
82         NetworkResourceLoader should not clean itself inside didReceiveResponse
83         https://bugs.webkit.org/show_bug.cgi?id=184754
84
85         Reviewed by Chris Dumez.
86
87         Delay the cleanup to after the didReceiveResponse call so that NetworkLoad can terminate its work.
88         Covered by XHR sync tests no longer crashing on GuardMalloc bots.
89
90         * NetworkProcess/NetworkResourceLoader.cpp:
91         (WebKit::NetworkResourceLoader::didReceiveResponse):
92
93 2018-04-18  Jer Noble  <jer.noble@apple.com>
94
95         Fix rendering of WKRemoteView layers in the simulator
96         https://bugs.webkit.org/show_bug.cgi?id=184752
97
98         Reviewed by Tim Horton.
99
100         * Platform/mac/LayerHostingContext.mm:
101         (WebKit::LayerHostingContext::createForExternalHostingProcess):
102
103 2018-04-18  Jer Noble  <jer.noble@apple.com>
104
105         Fix entitlements and sandboxing for iphoneminimalsimulator
106         https://bugs.webkit.org/show_bug.cgi?id=184692
107
108         Reviewed by Tim Horton.
109
110         Use the correct implementations for ChildProcess and NetworkProcess
111         when building for iphoneminimalsimulator. Stub out imlementations
112         which rely on methods not available in the iphoneminimalsimulator SDK.
113
114         * Configurations/Network-OSX.entitlements: Added.
115         * Configurations/NetworkService.xcconfig:
116         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
117         (WebKit::NetworkProcess::sourceApplicationAuditData const):
118         * NetworkProcess/ios/NetworkProcessIOS.mm:
119         * NetworkProcess/mac/NetworkProcessMac.mm:
120         (WebKit::NetworkProcess::initializeProcessName):
121         (WebKit::overrideSystemProxies):
122         * Shared/ios/ChildProcessIOS.mm:
123         (WebKit::ChildProcess::initializeSandbox):
124         * Shared/mac/ChildProcessMac.mm:
125         (WebKit::ChildProcess::setApplicationIsDaemon):
126         (WebKit::enableSandboxStyleFileQuarantine):
127         (WebKit::ChildProcess::initializeSandbox):
128         (WebKit::ChildProcess::platformStopRunLoop):
129         * Shared/mac/CodeSigning.mm:
130         * WebKit.xcodeproj/project.pbxproj:
131         * WebProcess/cocoa/WebProcessCocoa.mm:
132         (WebKit::WebProcess::initializeSandbox):
133
134 2018-04-18  Commit Queue  <commit-queue@webkit.org>
135
136         Unreviewed, rolling out r230743.
137         https://bugs.webkit.org/show_bug.cgi?id=184747
138
139         causes mouse clicks to not work on some platforms (Requested
140         by brrian on #webkit).
141
142         Reverted changeset:
143
144         "Web Automation: simulated mouse interactions should not be
145         done until associated DOM events have been dispatched"
146         https://bugs.webkit.org/show_bug.cgi?id=184462
147         https://trac.webkit.org/changeset/230743
148
149 2018-04-18  Brent Fulgham  <bfulgham@apple.com>
150
151         Avoid crash if ITP Debug mode is on, but ResourceLoadStatistics are not being used
152         https://bugs.webkit.org/show_bug.cgi?id=184739
153         <rdar://problem/39287964>
154
155         Reviewed by David Kilzer.
156
157         If a user has the ResourceLoadStatistics logic turned off, but has the ITP Debug experimental
158         flag turned on, you can cause a crash.
159
160         This is because the WebsiteDataStore for the process doesn't bother creating a ResourceLoadStatisticsStore
161         if the statistics machinery is not running. The ITP debug flag was being blindly set without checking
162         if the statistics store exists or not, which can cause a crash.
163
164         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
165         (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode): Check if the statistics store exists
166         before calling functions on it.
167
168 2018-04-18  Paul Knight  <pknight@apple.com>
169
170         Add -[_WKInputDelegateDelegate willStartInputSession:] for clients that want to configure input session before assisting form node
171         https://bugs.webkit.org/show_bug.cgi?id=184662
172
173         Reviewed by Beth Dakin.
174
175         Clients may wish to configure a WKInputSession before we start assisting
176         a node. Add a -[_WKInputDelegateDelegate _webView:willStartInputSession:]
177         callback.
178
179         For example, clients that wish to present a custom input view will want
180         to configure the WKFormInputSession's customInputView before the
181         keyboard is presented. Otherwise the standard keyboard will begin to
182         animate and then the custom input view will swap in later.
183
184         * UIProcess/API/Cocoa/_WKInputDelegate.h:
185         * UIProcess/ios/WKContentViewInteraction.mm:
186         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
187             Call -_webView:willStartInputSession: before assisting the node.
188             Only create the form session if the delegate implements either
189             the willStart or didStartInputSession callbacks.
190
191 2018-04-18  Chris Dumez  <cdumez@apple.com>
192
193         Add support for converting a local window to a remote window
194         https://bugs.webkit.org/show_bug.cgi?id=184515
195         <rdar://problem/39011318>
196
197         Reviewed by Ryosuke Niwa.
198
199         Add initial support for process-swapping when navigating cross-origin as a result
200         of a window.open(). The window object returned by window.open() is initially same
201         origin and is for about:blank. The navigation cross-origin then happens and the
202         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
203         hosted in another WebProcess).
204
205         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
206         exceptions due to our incomplete implementation (e.g. w.location returns null) and
207         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
208         in a follow-up by relying on IPC.
209
210         * UIProcess/API/APIProcessPoolConfiguration.cpp:
211         (API::ProcessPoolConfiguration::copy):
212         * UIProcess/API/APIProcessPoolConfiguration.h:
213         * UIProcess/API/C/WKContextConfigurationRef.cpp:
214         (WKContextConfigurationProcessSwapsOnWindowOpenWithOpener):
215         (WKContextConfigurationSetProcessSwapsOnWindowOpenWithOpener):
216         * UIProcess/API/C/WKContextConfigurationRef.h:
217         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
218         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
219         (-[_WKProcessPoolConfiguration setProcessSwapsOnWindowOpenWithOpener:]):
220         (-[_WKProcessPoolConfiguration processSwapsOnWindowOpenWithOpener]):
221         Add ProcessPool configuration flag to turn on processSwap on window.open(), even
222         if there is an opener.
223
224         * UIProcess/WebPageProxy.cpp:
225         (WebKit::WebPageProxy::continueNavigationInNewProcess):
226         If the navigation was triggered via window.open(), then set up on handler for when
227         a DOMWindow is constructed for the main frame in the new process.
228
229         (WebKit::WebPageProxy::didCreateWindow):
230         When a Window is constructed for the main frame in a new process on process swap,
231         notify the old process that its representation of the window should become remote
232         and provide it with the Frame / Window identifiers it needs.
233
234         * UIProcess/WebPageProxy.h:
235         * UIProcess/WebPageProxy.messages.in:
236
237         * UIProcess/WebProcessPool.cpp:
238         (WebKit::WebProcessPool::processForNavigation):
239         Do process swapping on cross-origin window.open() if the corresponding setting is
240         enabled.
241
242         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
243         (WebKit::WebFrameLoaderClient::didCreateWindow):
244         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
245
246         * WebProcess/WebPage/WebPage.cpp:
247         (WebKit::WebPage::frameBecameRemote):
248         This is called when process swapping has happened due to a window.open() navigation
249         cross-origin, when a Frame / Window has been constructed in the new process. We do
250         the following:
251         - Construct a RemoteFrame / RemoteWindow using the provided global identifiers to
252           represent the Frame / Window in the new process.
253         - We transfer the WindowProxies from the old Frame's WindowProxyController to the
254           new RemoteFrame's WindowProxyController.
255         - We update the window proxied by those WindowProxies to be the new RemoteWindow.
256         - We detach the old Frame as it is now remote and represented by the new RemoteFrame
257           object we constructed.
258         - If the old frame was the main frame (always the case currently), we close the page
259           as it is no longer needed. The new RemoteFrame is currently owned by the RemoteWindow
260           which is kept alive by its JS wrappers.
261
262         * WebProcess/WebPage/WebPage.h:
263         * WebProcess/WebPage/WebPage.messages.in:
264
265 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
266
267         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.1 release.
268
269         * gtk/NEWS: Add release notes for 2.21.1.
270
271 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
272
273         Unreviewed. Remove symbols from webkitglib-symbols.map.
274
275         Remove symbols not present in WebKit.
276
277         * webkitglib-symbols.map:
278
279 2018-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
280
281         Unreviewed. Add missing symbols to webkitglib-symbols.map.
282
283         Add symbols global in JSC and present in WebKit.
284
285         * webkitglib-symbols.map:
286
287 2018-04-18  Fujii Hironori  <Hironori.Fujii@sony.com>
288
289         [Win][WebKit] Implement InjectedBundleWin.cpp
290         https://bugs.webkit.org/show_bug.cgi?id=184525
291
292         Reviewed by Konstantin Tokarev.
293
294         * WebProcess/InjectedBundle/win/InjectedBundleWin.cpp:
295         (WebKit::InjectedBundle::initialize):
296
297 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
298
299         [Extra zoom mode] Programmatically changing focus when an element already has focus is a confusing experience
300         https://bugs.webkit.org/show_bug.cgi?id=184635
301         <rdar://problem/39440642>
302
303         Reviewed by Tim Horton.
304
305         Currently on iOS, we allow element focus to present UI if the keyboard is already shown. In extra zoom mode,
306         this would lead to a confusing experience when the focus form control overlay is disabled, since fullscreen
307         input view controllers are swapped out from underneath the user. Currently, this also puts the UI process into a
308         bad state where the focused form control overlay is active, but still hidden. This patch makes some tweaks to
309         input view controller handling in the UI process to address these issues, and also adds WebKitTestRunner support
310         for simulating interactions with select menus in extra zoom mode. See comments below for more detail.
311
312         Test: fast/events/extrazoom/change-focus-during-change-event.html
313
314         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
315
316         Add new SPI delegate hooks to notify the UI delegate when view controllers are presented or dismissed in extra
317         zoom mode. See -presentViewControllerForCurrentAssistedNode and -dismissAllInputViewControllers.
318
319         * UIProcess/WebProcessProxy.cpp:
320         (WebKit::WebProcessProxy::takeBackgroundActivityTokenForFullscreenInput):
321         (WebKit::WebProcessProxy::releaseBackgroundActivityTokenForFullscreenInput):
322
323         See the comment below -dismissAllInputViewControllers.
324
325         * UIProcess/WebProcessProxy.h:
326         * UIProcess/ios/WKContentViewInteraction.mm:
327         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
328
329         In extra zoom mode, when changing focus from one assisted node to another, only allow the second node to be
330         assisted if the focused form control overlay is being shown. Otherwise, (i.e. when a fullscreen input view
331         controller is being presented), don't allow focus to start an input session.
332
333         Additionally, make a minor tweak to allow the previous node to blur, even if we are not showing the keyboard for
334         the new focused element. Without this adjustment, in the case where the page has programmatically focused
335         another element while a fullscreen input view controller is presented, we'll show the old view controller for
336         the new focused element.
337
338         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
339         (-[WKContentView dismissAllInputViewControllers:]):
340
341         Currently, when a fullscreen input view controller is presented, the web process gets backgrounded. This
342         prevents event handlers from executing, which leads to strange behaviors in many cases (for instance: if we
343         have a multiple select, and the "change" event handler blurs the select, the user may check or uncheck multiple
344         items, but only the first change will actually take effect).
345
346         To fix this, we maintain a background activity token while presenting an input view controller.
347
348         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
349
350         Start hiding the focused form overlay when re-presenting an input view controller. This allows us to bail from
351         showing fullscreen input UI for another focused element if focus programmatically changes while the current
352         fullscreen input view controller is presented, due to the -isHidden check in -_startAssistingNode:.
353
354         (-[WKContentView selectFormAccessoryPickerRow:]):
355
356         Simulate tapping a given row in select menu UI in extra zoom mode.
357
358 2018-04-17  Conrad Shultz  <conrad_shultz@apple.com>
359
360         WebKit::DisplayLink maintains a strong reference to WebPageProxy, creating a reference cycle
361         https://bugs.webkit.org/show_bug.cgi?id=184718
362
363         Reviewed by Tim Horton.
364
365         It turns out that the m_webPageProxy back-reference in DisplayLink, which was creating a
366         reference cycle, wasn't ever read, so we can just remove it.
367
368         * UIProcess/mac/DisplayLink.cpp:
369         (WebKit::DisplayLink::DisplayLink):
370         * UIProcess/mac/DisplayLink.h:
371
372 2018-04-17  Wenson Hsieh  <wenson_hsieh@apple.com>
373
374         [Extra zoom mode] Double tap to zoom should account for text legibility in extra zoom mode
375         https://bugs.webkit.org/show_bug.cgi?id=184631
376         <rdar://problem/39303706>
377
378         Reviewed by Tim Horton.
379
380         Implement the text legibility heuristic alluded to in r230506 by iterating through text runs in the document (up
381         to a maximum of 200) and building a histogram of font sizes that appear in the document, where each tally
382         represents a character.
383
384         The first and second text legibility zoom scales are then computed based on the zoom scales needed to
385         make 50% and 90% of the text legible, respectively. Here, a zoom scale that makes text legible is such that the
386         text would have an apparent font size of a hard-coded constant (currently, 12) after zooming. This means the
387         first and second text legibility scales may end up being close to one another, or even the same (in the case
388         where there is only a single font size in the entire document). In this case, we just snap the first scale to
389         the second, so that double tapping will only toggle between two zoom scales. In another case where the document
390         has no text (e.g. an image document), we just fall back to a zoom scale of 1.
391
392         Test: fast/events/extrazoom/double-tap-to-zoom-on-full-width-text.html
393
394         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
395         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
396
397 2018-04-17  Megan Gardner  <megan_gardner@apple.com>
398
399         Don't activate selection on become first responder
400         https://bugs.webkit.org/show_bug.cgi?id=184719
401
402         Reviewed by Tim Horton.
403         
404         If we activate the selection immediately on becoming first responder, we cause the selection view to delete itself
405         since it is not guaranteed to have selection rects immediately due to async/two process architecture. The selection
406         is activated already when the selection rects change, so there is no reason to activate it now. This has likely worked
407         in the past because this selection assistant was only for editable text, which would immediately set a caret, which 
408         is a selection. Now that this is for non-editable text as well, activating the selection is problematic.
409
410         * UIProcess/ios/WKContentViewInteraction.mm:
411         (-[WKContentView becomeFirstResponderForWebView]):
412
413 2018-04-11  Brian Burg  <bburg@apple.com>
414
415         Web Automation: simulated mouse interactions should not be done until associated DOM events have been dispatched
416         https://bugs.webkit.org/show_bug.cgi?id=184462
417         <rdar://problem/39323336>
418
419         Reviewed by Carlos Garcia Campos and Tim Horton.
420
421         Covered by existing layout tests and actions endpoints in WebDriver test suite.
422
423         In preparation for implementing the W3C WebDriver command "Perform Actions", we need a way to
424         know when a simulated mouse event has been fully processed by WebProcess and it is okay to continue
425         to dispatch more simulated events.
426
427         This patch makes mouse events go through a queue as they are delivered to WebPageProxy. The approach
428         is very similar to how key events are handled. In the key event case, lots of WebEvents can come out
429         of typing one keystroke, so these need to be queued up and retired one by one when the WebProcess has
430         finished handling each event. In some mouse event cases---particularly fake mouse moves---there can
431         also be more than one mouse event waiting to be handled by WebProcess.
432
433         In the past, these queued mouse events were tracked with several member variables as different
434         use cases emerged. These are all replaced with ordinary deque operations, such as peeking or
435         checking the queue length.
436
437         * Platform/Logging.h: Add logging channel for mouse events.
438         * UIProcess/Automation/WebAutomationSession.cpp:
439         (WebKit::AutomationCommandError::toProtocolString): Add type-safe helper class for command errors.
440         In future patches we can hide knowledge of how this is sent over the protocol by relying more on
441         the convenience constructors and .toProtocolString() method.
442
443         (WebKit::WebAutomationSession::willShowJavaScriptDialog):
444         This section needs adjustments. Since performMouseInteraction now depends on key events being processed
445         prior to returning from the command, we need to abort any key event callbacks that are pending if an
446         alert pops up as a result of sending a mousedown event. Any mouse events that are still queued will
447         be handled when the alert is dismissed and the nested run loop exits.
448
449         (WebKit::WebAutomationSession::mouseEventsFlushedForPage):
450         (WebKit::WebAutomationSession::keyboardEventsFlushedForPage):
451         Modernize this a bit. Don't spread knowledge about how commands are sent back out into event handling code.
452         Our wrapper callbacks in performXXXInteraction handle the protocol-specific details of the response.
453
454         (WebKit::WebAutomationSession::performMouseInteraction):
455         Add code similar to performKeyboardInteractions so that the command doesn't finish until the mouse
456         event has been fully handled. Unlike keyboards, sometimes mouse interactions don't turn into WebEvents
457         so we also need to handle the case where there is nothing to be waited on because hit testing did
458         not return a target to deliver the event to.
459
460         (WebKit::WebAutomationSession::performKeyboardInteractions):
461         Modernize a little bit to use generic callbacks rather than protocol-generated callbacks in the
462         event waiting/handling code. Now it matches the types used for the mouse event case.
463
464         * UIProcess/Automation/WebAutomationSession.h:
465         (WebKit::AutomationCommandError::AutomationCommandError):
466         Add a helper struct to hold an enumerated error name and an optional free-form error message.
467
468         * UIProcess/WebPageProxy.h:
469         * UIProcess/WebPageProxy.cpp:
470         (WebKit::webMouseEventTypeString):
471         (WebKit::webKeyboardEventTypeString):
472         (WebKit::WebPageProxy::handleMouseEvent):
473         (WebKit::WebPageProxy::processNextQueuedMouseEvent):
474         Split the old method into handleMouseEvent (called by other code) and processNextQueuedMouseEvent.
475         The latter sends the next mouse event to WebProcess, and can be triggered in didReceiveEvent
476         if there are more mouse events to be sent to WebProcess.
477
478         (WebKit::WebPageProxy::isProcessingMouseEvents const): Added.
479         (WebKit::WebPageProxy::currentlyProcessedMouseDownEvent): Reimplemented on top of the deque.
480         (WebKit::WebPageProxy::didReceiveEvent):
481         Unify the code paths for different mouse event types to all use the deque. They also will
482         notify the automation session if there are no more mouse events to send (i.e., interaction is over).
483
484         (WebKit::WebPageProxy::resetStateAfterProcessExited): Add handling for new map.
485
486 2018-04-17  Adrian Perez de Castro  <aperez@igalia.com>
487
488         [GTK][WPE] Build failure due to presence of Avahi's <dns_sd.h> header
489         https://bugs.webkit.org/show_bug.cgi?id=184711
490
491         Unreviewed build fix.
492
493         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Set ENABLE_MDNS only for PLATFORM(COCOA).
494
495 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
496
497         Unreviewed rollout of r230632. Regression in memory usage.
498
499         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
500
501         * Shared/WebPreferences.yaml:
502
503 2018-04-17  Timothy Hatcher  <timothy@apple.com>
504
505         Always use LayerContentsType::IOSurface in minimal simulator mode
506         https://bugs.webkit.org/show_bug.cgi?id=184710
507
508         Reviewed by Simon Fraser.
509
510         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
511         (WebKit::RemoteLayerTreeHost::updateLayerTree):
512
513 2018-04-17  Ryosuke Niwa  <rniwa@webkit.org>
514
515         Release assert in InjectedBundle::postSynchronousMessage
516         https://bugs.webkit.org/show_bug.cgi?id=184683
517
518         Reviewed by Wenson Hsieh.
519
520         Some injected bundles sends sync message when it's not safe to execute scripts.
521
522         Use DoNotProcessIncomingMessagesWhenWaitingForSyncReply option in InjectedBundle::postSynchronousMessage
523         to avoid processing incoming sync IPC messages so that we don't execute arbitrary scripts in those cases.
524
525         * WebProcess/InjectedBundle/InjectedBundle.cpp:
526         (WebKit::InjectedBundle::postSynchronousMessage):
527
528 2018-04-17  Chris Dumez  <cdumez@apple.com>
529
530         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
531         https://bugs.webkit.org/show_bug.cgi?id=184678
532         <rdar://problem/39422122>
533
534         Reviewed by Alex Christensen.
535
536         Re-introduce synchronous code path which existed pre-r229831 and use it for fragment navigations.
537
538         * UIProcess/WebPageProxy.cpp:
539         (WebKit::WebPageProxy::receivedPolicyDecision):
540         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
541         * UIProcess/WebPageProxy.h:
542         * UIProcess/WebPageProxy.messages.in:
543         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
544         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
545         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
546
547 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
548
549         [WPE][GTK] GObject introspection annotation fixes: BackForwardList, NetworkProxySettings
550         https://bugs.webkit.org/show_bug.cgi?id=184658
551
552         Reviewed by Carlos Garcia Campos.
553
554         Thanks to Dylan Simon for recommending these annotation fixes.
555
556         * UIProcess/API/glib/WebKitBackForwardList.cpp:
557         * UIProcess/API/glib/WebKitNetworkProxySettings.cpp:
558
559 2018-04-17  Brent Fulgham  <bfulgham@apple.com>
560
561         [macOS] Don't establish unneeded Dock connections (Follow-up)
562         https://bugs.webkit.org/show_bug.cgi?id=184664
563         <rdar://problem/16863698>
564
565         Reviewed by Per Arne Vollan.
566
567         Because the Plugin process is driven by NSApplication's run loop, we aren't
568         setting the 'don't connect to the dock' setting early enough.
569
570         This patch sets the flag in XPCServiceMain for those services that
571         are linked to AppKit.
572
573         * PluginProcess/mac/PluginProcessMac.mm:
574         (WebKit::PluginProcess::platformInitializeProcess): Remove unneeded code.
575         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
576         (main):
577         * WebProcess/cocoa/WebProcessCocoa.mm:
578         (WebKit::WebProcess::platformInitializeWebProcess): Remove unneeded code.
579
580 2018-04-17  Saam Barati  <sbarati@apple.com>
581
582         Add system trace points for process launch and for initializeWebProcess
583         https://bugs.webkit.org/show_bug.cgi?id=184669
584
585         Reviewed by Simon Fraser.
586
587         * UIProcess/Launcher/ProcessLauncher.cpp:
588         (WebKit::ProcessLauncher::ProcessLauncher):
589         (WebKit::ProcessLauncher::didFinishLaunchingProcess):
590         * WebProcess/WebProcess.cpp:
591         (WebKit::WebProcess::initializeWebProcess):
592
593 2018-04-16  Timothy Hatcher  <timothy@apple.com>
594
595         Unreviewed 32-bit build fix for r230673.
596
597         https://bugs.webkit.org/show_bug.cgi?id=184657
598         rdar://problem/39463307
599
600         * Configurations/PluginProcessShim.xcconfig: Use the correct names.
601
602 2018-04-16  Andy Estes  <aestes@apple.com>
603
604         [iOS] Enable WKPDFView by default
605         https://bugs.webkit.org/show_bug.cgi?id=184675
606         <rdar://problem/27885452>
607
608         Reviewed by Darin Adler.
609
610         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
611         (-[WKWebViewContentProviderRegistry init]):
612
613 2018-04-16  Brent Fulgham  <bfulgham@apple.com>
614
615         [macOS] Don't establish unneeded Dock connections
616         https://bugs.webkit.org/show_bug.cgi?id=184664
617         <rdar://problem/16863698>
618
619         Reviewed by Simon Fraser.
620
621         There is no reason for the WebContent or Plugin processes to interact with
622         the Dock. We should tell AppKit that we don't want this connection, and to
623         avoid creating such connections.
624
625         * PluginProcess/mac/PluginProcessMac.mm:
626         (WebKit::PluginProcess::platformInitializeProcess): Tell NSApplication to
627         not create a Dock connection.
628         * WebProcess/cocoa/WebProcessCocoa.mm:
629         (WebKit::WebProcess::platformInitializeWebProcess): Ditto.
630
631 2018-04-16  Megan Gardner  <megan_gardner@apple.com>
632
633         Switch to UIWKTextInteractionAssistant for non-editable text
634         https://bugs.webkit.org/show_bug.cgi?id=182834
635
636         Reviewed by Beth Dakin.
637         
638         Switch to only using one assistant for text selection.
639
640         * UIProcess/ios/WKContentViewInteraction.mm:
641         (-[WKContentView useSelectionAssistantWithGranularity:]):
642
643 2018-04-16  Youenn Fablet  <youenn@apple.com>
644
645         Use NetworkLoadChecker to handle synchronous HTTP loads
646         https://bugs.webkit.org/show_bug.cgi?id=184240
647
648         Reviewed by Chris Dumez.
649
650         For every NetworkResourceLoader synchronous load, we create a NetworkLoadChecker.
651         NetworkLoadChecker handles all security checks in that case.
652         This allows supporting cross-origin loads for synchronous XHR.
653
654         Updated NetworkCORSPreflightChecker to return the result as a ResourceError.
655         This is used to convey any error message from NetworkProcess to the JS console.
656         Ensure NetworkCORSPreflightChecker computes correctly Access-Control-Request-Headers value
657         by providing the headers set by the application plus Referrer/Origin.
658
659         * NetworkProcess/NetworkCORSPreflightChecker.cpp:
660         (WebKit::NetworkCORSPreflightChecker::~NetworkCORSPreflightChecker):
661         (WebKit::NetworkCORSPreflightChecker::willPerformHTTPRedirection):
662         (WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
663         (WebKit::NetworkCORSPreflightChecker::didCompleteWithError):
664         (WebKit::NetworkCORSPreflightChecker::wasBlocked):
665         (WebKit::NetworkCORSPreflightChecker::cannotShowURL):
666         * NetworkProcess/NetworkLoadChecker.cpp:
667         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
668         * NetworkProcess/NetworkResourceLoader.cpp:
669         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
670         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
671         (WebKit::NetworkResourceLoader::didReceiveResponse):
672         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
673         (WebKit::NetworkResourceLoader::continueWillSendRequest):
674         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
675         (WebKit::NetworkResourceLoader::validateCacheEntry):
676         * NetworkProcess/NetworkResourceLoader.h:
677         * WebProcess/Network/WebLoaderStrategy.cpp:
678         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
679         * WebProcess/Network/WebLoaderStrategy.h:
680
681 2018-04-16  Brian Burg  <bburg@apple.com>
682
683         [Cocoa] Web Automation: add SPI to terminate automation session and disconnect the remote end
684         https://bugs.webkit.org/show_bug.cgi?id=184523
685         <rdar://problem/39368599>
686
687         Reviewed by Simon Fraser.
688
689         When a user breaks the automation glass pane and chooses "Stop Session", there is no way
690         for Safari to actually disconnect the remote connection using automation-related ObjC SPI.
691         This can lead to sessions getting stuck and safaridriver is unable to request a new session.
692
693         Expose the -terminate method as SPI. This disconnects the remote connection and then notifies
694         the session delegate that the remote disconnected. At that point, Safari can uninstall
695         the session from the process pool and tear down other session state.
696
697         * UIProcess/API/Cocoa/_WKAutomationSession.h:
698         * UIProcess/API/Cocoa/_WKAutomationSession.mm:
699         (-[_WKAutomationSession terminate]):
700
701 2018-04-16  Timothy Hatcher  <timothy@apple.com>
702
703         Clean up OTHER_LDFLAGS for WebKit processes
704         https://bugs.webkit.org/show_bug.cgi?id=184657
705
706         Reviewed by Jer Noble.
707
708         * Configurations/PluginProcessShim.xcconfig:
709         * Configurations/PluginService.32.xcconfig:
710         * Configurations/PluginService.64.xcconfig:
711         * Configurations/WebContentService.xcconfig:
712
713 2018-04-15  Michael Catanzaro  <mcatanzaro@igalia.com>
714
715         [WPE] Install files needed for WebKitWebExtensions
716         https://bugs.webkit.org/show_bug.cgi?id=179915
717
718         Reviewed by Žan Doberšek.
719
720         * PlatformWPE.cmake: Install pkg-config file, injected bundle, and API headers.
721         * UIProcess/API/glib/WebKitWebContext.cpp: Load the injected bundle when installed.
722         * wpe/wpe-web-extension.pc.in: Added.
723
724 2018-04-14  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
725
726         [GTK][WPE] Build is broken after r230640
727         https://bugs.webkit.org/show_bug.cgi?id=184623
728
729         Reviewed by Žan Doberšek.
730
731         UIProcess/SuspendedPageProxy.cpp was not included to CMake build in r230640.
732
733         * CMakeLists.txt: Added UIProcess/SuspendedPageProxy.cpp to WebKit_SOURCES.
734
735 2018-04-13  Ryan Haddad  <ryanhaddad@apple.com>
736
737         Unreviewed, rolling out r230447.
738
739         Caused flaky selection test failures on iOS
740
741         Reverted changeset:
742
743         "Switch to UIWKTextInteractionAssistant for non-editable text"
744         https://bugs.webkit.org/show_bug.cgi?id=182834
745         https://trac.webkit.org/changeset/230447
746
747 2018-04-13  Chris Dumez  <cdumez@apple.com>
748
749         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
750         https://bugs.webkit.org/show_bug.cgi?id=184591
751
752         Reviewed by Sam Weinig.
753
754         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
755         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
756         This is work towards fixing Bug 184515.
757
758         * WebProcess/Plugins/PluginView.cpp:
759         (WebKit::PluginView::windowScriptNPObject):
760
761 2018-04-13  Brady Eidson  <beidson@apple.com>
762
763         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
764         https://bugs.webkit.org/show_bug.cgi?id=184559
765
766         Reviewed by Alex Christensen.
767
768         Before this patch, when a WebPageProxy navigates and is swapped to a new process, the old process almost always goes away.
769
770         This is not desirable for a few reasons:
771         1 - We can't keep the PageCache working for back/forward scenarios
772         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
773             and initialize a new web process.
774
775         This patch adds a SuspendedPageProxy object to keep around the old web process and to manage communication with it.
776
777         For now, a WebPageProxy keeps exactly one "suspended page" representing the most recently visited page and its process.
778         Additionally, that process is never reused.
779
780         So no benefit is achieved with this patch, but it enables future benefits.
781
782         * Platform/Logging.h:
783
784         * Shared/WebBackForwardListItem.cpp:
785         (WebKit::WebBackForwardListItem::setSuspendedPage):
786         * Shared/WebBackForwardListItem.h:
787
788         New object to represent the state of a WebPageProxy in an old web process that is not currently hosting the view.
789         * UIProcess/SuspendedPageProxy.cpp: Added.
790         (WebKit::SuspendedPageProxy::SuspendedPageProxy):
791         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
792         (WebKit::SuspendedPageProxy::webProcessDidClose):
793         (WebKit::SuspendedPageProxy::didFinishLoad):
794         (WebKit::SuspendedPageProxy::didReceiveMessage):
795         (WebKit::SuspendedPageProxy::loggingString const):
796         * UIProcess/SuspendedPageProxy.h: Copied from Source/WebKit/Platform/Logging.h.
797         (WebKit::SuspendedPageProxy::create):
798         (WebKit::SuspendedPageProxy::page const):
799         (WebKit::SuspendedPageProxy::process const):
800         (WebKit::SuspendedPageProxy::item const):
801         (WebKit::SuspendedPageProxy::finishedSuspending const):
802
803         * UIProcess/WebPageProxy.cpp:
804         (WebKit::WebPageProxy::reattachToWebProcess):
805         (WebKit::WebPageProxy::attachToProcessForNavigation):
806         (WebKit::WebPageProxy::maybeCreateSuspendedPage):
807         (WebKit::WebPageProxy::suspendedPageProcessClosed):
808         (WebKit::WebPageProxy::receivedPolicyDecision):
809         (WebKit::WebPageProxy::didFinishLoadForFrame):
810         * UIProcess/WebPageProxy.h:
811
812         * UIProcess/WebProcessProxy.cpp:
813         (WebKit::WebProcessProxy::suspendWebPageProxy):
814         (WebKit::WebProcessProxy::suspendedPageWasDestroyed):
815         (WebKit::WebProcessProxy::removeWebPage):
816         (WebKit::WebProcessProxy::didReceiveMessage): Optionally pass WebPageProxy messages along to SuspendedPageProxy objects.
817         (WebKit::WebProcessProxy::didClose):
818         (WebKit::WebProcessProxy::maybeShutDown):
819         (WebKit::WebProcessProxy::canTerminateChildProcess): Don't terminate child processes if they still have suspended pages.
820         * UIProcess/WebProcessProxy.h:
821
822         * WebKit.xcodeproj/project.pbxproj:
823
824         * WebProcess/WebPage/WebPage.cpp:
825         (WebKit::WebPage::setIsSuspended):
826         * WebProcess/WebPage/WebPage.h:
827         (WebKit::WebPage::isSuspended const): For now, used only by WebProcess::updateActivePages. Will have more uses soon.
828         * WebProcess/WebPage/WebPage.messages.in:
829
830         * WebProcess/WebProcess.messages.in:
831         * WebProcess/cocoa/WebProcessCocoa.mm:
832         (WebKit::WebProcess::updateActivePages): Allow the UIProcess to request an update of the web processes user visible name.
833
834 2018-04-13  Daniel Bates  <dabates@apple.com>
835
836         Inline NetworkLoad::sharedWillSendRedirectedRequest() into NetworkLoad::willPerformHTTPRedirection()
837         https://bugs.webkit.org/show_bug.cgi?id=184593
838
839         Reviewed by Alex Christensen.
840
841         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedWillSendRedirectedRequest()
842         is only referenced from NetworkLoad::willPerformHTTPRedirection(). We should inline its
843         implementation into the NetworkLoad::willPerformHTTPRedirection(), remove a function call,
844         and the cognitive load to follow such a function call when reading the code.
845
846         No functionality changed. So, no new tests.
847
848         * NetworkProcess/NetworkLoad.cpp:
849         (WebKit::NetworkLoad::willPerformHTTPRedirection): Moved the implementation of NetworkLoad::sharedWillSendRedirectedRequest()
850         into this function.
851         (WebKit::NetworkLoad::sharedWillSendRedirectedRequest): Deleted. Moved its implementation
852         into NetworkLoad::willPerformHTTPRedirection().
853         * NetworkProcess/NetworkLoad.h:
854
855 2018-04-13  Daniel Bates  <dabates@apple.com>
856
857         Inline NetworkLoad::sharedDidReceiveResponse() into NetworkLoad::notifyDidReceiveResponse()
858         https://bugs.webkit.org/show_bug.cgi?id=184592
859
860         Reviewed by Alex Christensen.
861
862         Following the removal of the pre-Network Session code in r227364, NetworkLoad::sharedDidReceiveResponse()
863         is only referenced from NetworkLoad::notifyDidReceiveResponse(). We should inline its
864         implementation into the NetworkLoad::notifyDidReceiveResponse(), remove a function
865         call, and the cognitive load to follow such a function call when reading the code.
866
867         No functionality changed. So, no new tests.
868
869         * NetworkProcess/NetworkLoad.cpp:
870         (WebKit::NetworkLoad::notifyDidReceiveResponse): Moved the implementation of NetworkLoad::sharedDidReceiveResponse()
871         into this function.
872         (WebKit::NetworkLoad::sharedDidReceiveResponse): Deleted. Moved its implementation into
873         NetworkLoad::notifyDidReceiveResponse().
874         * NetworkProcess/NetworkLoad.h:
875
876 2018-04-13  Brent Fulgham  <bfulgham@apple.com>
877
878         REGRESSION(r230468): Improper assertion firing under STP
879         <rdar://problem/39411676>
880
881         Unreviewed, rolling out an improper assertion.
882
883         I added an assertion in Bug 184322 that should not have been added. I did not notice that this
884         call stack was always used in builds where NSApp is still active. Builds where we stop relying
885         on AppKit runloops uses a different code path to shut down.
886
887         * Shared/mac/ChildProcessMac.mm:
888         (WebKit::ChildProcess::stopNSAppRunLoop):
889
890 2018-04-12  Antoine Quint  <graouts@apple.com>
891
892         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
893         https://bugs.webkit.org/show_bug.cgi?id=184569
894         <rdar://problem/38671301>
895
896         Reviewed by Jon Lee.
897
898         * Shared/WebPreferences.yaml:
899
900 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
901
902         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
903         https://bugs.webkit.org/show_bug.cgi?id=184533
904
905         Reviewed by Philippe Normand.
906
907         Renamed GStreamerUtilities* files into GStreamerCommon* and
908         modified files including them accordingly. Include
909         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
910         to avoid problems destroying objects when those files are
911         forgotten to be included.
912
913         * UIProcess/gtk/WebProcessPoolGtk.cpp:
914         * UIProcess/wpe/WebProcessPoolWPE.cpp:
915         * WebProcess/soup/WebProcessSoup.cpp:
916
917 2018-04-12  Beth Dakin  <bdakin@apple.com>
918
919         Fix the MOBILE_WIFI build
920         https://bugs.webkit.org/show_bug.cgi?id=184571
921         -and corresponding-
922         <rdar://problem/39398181>
923
924         Reviewed by Jer Noble.
925
926         * config.h:
927
928 2018-04-12  Beth Dakin  <bdakin@apple.com>
929
930         Use -iframework to ensure that frameworks from user paths and system paths are 
931         ordered appropriately
932         https://bugs.webkit.org/show_bug.cgi?id=184557
933         -and corresponding-
934         rdar://problem/39386359
935
936         Reviewed by Dean Jackson.
937
938         * Configurations/WebKit.xcconfig:
939
940 2018-04-12  Wenson Hsieh  <wenson_hsieh@apple.com>
941
942         [Extra zoom mode] Suppress UI for inputs of type file in extra zoom mode
943         https://bugs.webkit.org/show_bug.cgi?id=184556
944         <rdar://problem/39062239>
945
946         Reviewed by Andy Estes.
947
948         When running in this mode, we don't have the facilities to present document picker UI. For now, just make this
949         feature fail gracefully.
950
951         * UIProcess/ios/forms/WKFileUploadPanel.mm:
952         (-[WKFileUploadPanel presentWithParameters:resultListener:]):
953         (-[WKFileUploadPanel platformSupportsPickerViewController]):
954
955 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
956
957         Remove block selection code
958         https://bugs.webkit.org/show_bug.cgi?id=184470
959
960         Reviewed by Timothy Hatcher.
961         
962         Remove block selection code that isn't run and is currently not even used.
963         Had to put this back in for a bug in the mid-year release, but we're past that
964         so it's time for this to go away.
965
966         * Platform/spi/ios/UIKitSPI.h:
967         * UIProcess/PageClient.h:
968         * UIProcess/WebPageProxy.h:
969         * UIProcess/WebPageProxy.messages.in:
970         * UIProcess/ios/PageClientImplIOS.h:
971         * UIProcess/ios/PageClientImplIOS.mm:
972         (WebKit::PageClientImpl::stopAssistingNode):
973         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
974         * UIProcess/ios/WKContentViewInteraction.h:
975         * UIProcess/ios/WKContentViewInteraction.mm:
976         (toSelectionHandlePosition): Deleted.
977         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
978         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
979         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
980         * UIProcess/ios/WebPageProxyIOS.mm:
981         (WebKit::WebPageProxy::saveImageToLibrary):
982         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
983         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
984         * WebProcess/WebPage/WebPage.h:
985         * WebProcess/WebPage/WebPage.messages.in:
986         * WebProcess/WebPage/ios/WebPageIOS.mm:
987         (WebKit::rangeAtWordBoundaryForPosition):
988         (WebKit::distanceBetweenRectsForPosition): Deleted.
989         (WebKit::rectsEssentiallyTheSame): Deleted.
990         (WebKit::unionDOMRanges): Deleted.
991         (WebKit::computeEdgeCenter): Deleted.
992         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
993         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
994         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
995         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
996         (WebKit::shouldExpand): Deleted.
997         (WebKit::WebPage::changeBlockSelection): Deleted.
998         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
999         
1000 2018-04-12  Megan Gardner  <megan_gardner@apple.com>
1001
1002         Don't have selections get stuck in editable elements
1003         https://bugs.webkit.org/show_bug.cgi?id=184483
1004
1005         Reviewed by Timothy Hatcher.
1006         
1007         When selecting in editable elements, if the keyboard does not come up, which is not required,
1008         then the selections are stuck in that element. If you try and select something in web content,
1009         it will only select in the editable element. By clearing the assisted node when clearing a selection,
1010         it no longer sticks. Also, textSelectionAssistant should not be used as if we are currently editing. 
1011         Change it to the function we created for that purpose in a pervious patch.
1012
1013         * UIProcess/ios/WKContentViewInteraction.mm:
1014         (-[WKContentView clearSelection]):
1015         (-[WKContentView _isInteractingWithAssistedNode]):
1016
1017 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1018
1019         [WPE] Move libWPEWebInspectorResources.so to pkglibdir
1020         https://bugs.webkit.org/show_bug.cgi?id=184379
1021
1022         Reviewed by Žan Doberšek.
1023
1024         This is important to allow parallel installation.
1025
1026         * PlatformWPE.cmake:
1027
1028 2018-04-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1029
1030         [WPE] Improve include hierarchy
1031         https://bugs.webkit.org/show_bug.cgi?id=184376
1032
1033         Reviewed by Žan Doberšek.
1034
1035         Install our headers under /usr/include/wpe-webkit-0.1/wpe instead of
1036         /usr/include/wpe-0.1/WPE/wpe. Too much WPE, not enough WebKit!
1037
1038         * PlatformWPE.cmake:
1039         * wpe/wpe-webkit.pc.in:
1040
1041 2018-04-11  Andy Estes  <aestes@apple.com>
1042
1043         [iOS] Add a mechanism for holding Wi-Fi assertions
1044         https://bugs.webkit.org/show_bug.cgi?id=184520
1045         <rdar://problem/39025726>
1046
1047         Reviewed by Sam Weinig.
1048
1049         Add plumbing for holding a Wi-Fi assertion on iOS as long as there are active
1050         network data tasks. This functionality is turned off by default right now.
1051
1052         * Configurations/Network-iOS.entitlements:
1053         * NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
1054         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
1055         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
1056         * NetworkProcess/cocoa/WiFiAssertionHolder.cpp: Added.
1057         (WebKit::ensureWiFiManagerClient): Create a global WiFiManagerClient when needed.
1058         (WebKit::WiFiAssertionHolder::WiFiAssertionHolder): If this is the first active
1059         Wi-Fi assertion holder, set the client's type to kWiFiClientTypeBackground.
1060         (WebKit::WiFiAssertionHolder::~WiFiAssertionHolder): If the last active Wi-Fi
1061         assertion holder is being destroyed, set the client's type back to
1062         kWiFiClientTypeNormal.
1063         * NetworkProcess/cocoa/WiFiAssertionHolder.h: Added.
1064         * Platform/Logging.h: Added a logging channel for Wi-Fi assertions.
1065         * Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb:
1066         * WebKit.xcodeproj/project.pbxproj:
1067
1068 2018-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1069
1070         [GTK] Switch to use always complex text code path
1071         https://bugs.webkit.org/show_bug.cgi?id=183285
1072
1073         Reviewed by Michael Catanzaro.
1074
1075         Now that we have branched for 2.20, it's a good time to try using complex text path always. We can simply force
1076         it for GTK+ port and see how it works for the whole release cycle and if we don't notice any issues or
1077         performance regressions we release 2.22 with complex text path forced. A debug env variable is added to switch
1078         back to auto without having to recompile. After 2.22 is released we can make a final decision and remove the env
1079         variable.
1080
1081         * UIProcess/gtk/WebProcessPoolGtk.cpp:
1082         (WebKit::WebProcessPool::platformInitializeWebProcess): Force complex text code path unless
1083         WEBKIT_FORCE_COMPLEX_TEXT is present and set to 0.
1084
1085 2018-04-11  Zan Dobersek  <zdobersek@igalia.com>
1086
1087         [WPE] Make WebKitWebViewBackend object mandatory for webkit_web_view_new*() constructors
1088         https://bugs.webkit.org/show_bug.cgi?id=184513
1089
1090         Reviewed by Michael Catanzaro.
1091
1092         webkit_web_view_new*() constructors should always expect a non-null
1093         WebKitWebViewBackend object, forcing the user to specify how the
1094         wpe_view_backend object is managed for the WebKitWebView that's being
1095         created.
1096
1097         webkitWebViewBackendCreateDefault() and the default
1098         _WebKitWebViewBackend() constructor are removed. WPE-specific
1099         webkit_web_view_new*() entrypoints are updated to bail if the passed-in
1100         WebKitWebViewBackend object is null. Documentation is updated
1101         accordingly.
1102
1103         * UIProcess/API/glib/WebKitWebView.cpp:
1104         (webkitWebViewConstructed):
1105         * UIProcess/API/wpe/WebKitWebViewBackend.cpp:
1106         (webkitWebViewBackendCreateDefault): Deleted.
1107         * UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:
1108         * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
1109         (webkit_web_view_new):
1110         (webkit_web_view_new_with_context):
1111         (webkit_web_view_new_with_related_view):
1112         (webkit_web_view_new_with_settings):
1113         (webkit_web_view_new_with_user_content_manager):
1114
1115 2018-04-11  Fujii Hironori  <Hironori.Fujii@sony.com>
1116
1117         [curl][WebKit] Implement NetworkDataTaskCurl
1118         https://bugs.webkit.org/show_bug.cgi?id=184488
1119
1120         Reviewed by Alex Christensen.
1121
1122         * NetworkProcess/NetworkDataTask.cpp:
1123         (WebKit::NetworkDataTask::create):
1124         * NetworkProcess/curl/NetworkDataTaskCurl.cpp: Added.
1125         (WebKit::NetworkDataTaskCurl::NetworkDataTaskCurl):
1126         (WebKit::NetworkDataTaskCurl::~NetworkDataTaskCurl):
1127         (WebKit::NetworkDataTaskCurl::resume):
1128         (WebKit::NetworkDataTaskCurl::suspend):
1129         (WebKit::NetworkDataTaskCurl::cancel):
1130         (WebKit::NetworkDataTaskCurl::invalidateAndCancel):
1131         (WebKit::NetworkDataTaskCurl::state const):
1132         (WebKit::NetworkDataTaskCurl::createCurlRequest):
1133         (WebKit::NetworkDataTaskCurl::curlDidSendData):
1134         (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
1135         (WebKit::NetworkDataTaskCurl::curlDidReceiveBuffer):
1136         (WebKit::NetworkDataTaskCurl::curlDidComplete):
1137         (WebKit::NetworkDataTaskCurl::curlDidFailWithError):
1138         (WebKit::NetworkDataTaskCurl::shouldRedirectAsGET):
1139         (WebKit::NetworkDataTaskCurl::willPerformHTTPRedirection):
1140         (WebKit::NetworkDataTaskCurl::tryHttpAuthentication):
1141         (WebKit::NetworkDataTaskCurl::restartWithCredential):
1142         (WebKit::NetworkDataTaskCurl::appendCookieHeader):
1143         (WebKit::NetworkDataTaskCurl::handleCookieHeaders):
1144         * NetworkProcess/curl/NetworkDataTaskCurl.h: Added.
1145         * PlatformWin.cmake:
1146
1147 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1148
1149         [Extra zoom mode] Support pushing input view controllers onto the navigation stack
1150         https://bugs.webkit.org/show_bug.cgi?id=184397
1151         <rdar://problem/39265294>
1152
1153         Reviewed by Timothy Hatcher.
1154
1155         Currently, all input view controllers in extra zoom mode are presented modally. However, the latest iteration of
1156         the HI specification depicts most of these view controllers (with the exception of time pickers) being presented
1157         and dismissed via navigation stack. Since WebKit's iOS API surface doesn't force clients to embed WKWebViews
1158         within a view controller with a corresponding UINavigationController, we cannot always guarantee that UI
1159         presented when focusing form controls in a web view will be pushed onto the navigation stack; as such, the
1160         approach taken in this patch will automatically allow WKWebView clients that already embed WKWebViews within a
1161         UINavigationController to hook into this behavior, with modal presentation as a fallback.
1162
1163         At a high level, this patch makes the following tweaks to implement this behavior:
1164
1165         1. Store the currently presented view controller using a single member variable
1166            (_presentedFullScreenInputViewController) instead of having one for each type. This makes bookkeepping around
1167            which view controller to present or dismiss much more straightforward.
1168
1169         2. Replace WKFocusedFormControlViewController with just WKFocusedFormControlView. This addresses problems with
1170            pushing an input view controller onto the navigation stack after presenting the focused form control view
1171            controller modally. Now, we'll only need to present or push one view controller on the navigation stack.
1172
1173         3. Remove -handleWheelEvent: forwarding to date and time pickers. Pushing date picker view controllers onto the
1174            navigation stack rather than presenting them modally means that we end up in a state where neither the
1175            WKContentView nor WKTimePickerViewController are first responder, which renders time pickers unusable.
1176            Instead, have the WKTimePickerViewController actually become first responder when presenting.
1177
1178         4. Lastly, and most importantly: change -presentViewControllerForCurrentAssistedNode and
1179            -dismissAllInputViewControllers to try and push onto a navigation stack if possible, and fall back to modal
1180            presentation.
1181
1182         * UIProcess/ios/WKContentViewInteraction.h:
1183
1184         Remove the separate member variables for each type of input view controller, and instead have one to keep track
1185         of the current (and only) presented input view controller.
1186
1187         * UIProcess/ios/WKContentViewInteraction.mm:
1188         (-[WKContentView _willStartScrollingOrZooming]):
1189         (-[WKContentView _didEndScrollingOrZooming]):
1190         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1191         (-[WKContentView _stopAssistingNode]):
1192
1193         Boilerplate renaming of _focusedFormControlViewController => _focusedFormControlView.
1194
1195         (-[WKContentView reloadContextViewForPresentedListViewController]):
1196
1197         Adjust for consolidation of the different input view controller member variables to a single member (see changes
1198         in WKContentViewInteraction.h).
1199
1200         (-[WKContentView addFocusedFormControlOverlay]):
1201         (-[WKContentView removeFocusedFormControlOverlay]):
1202         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
1203         (-[WKContentView dismissAllInputViewControllers:]):
1204
1205         Add an `animated` argument. In the case where a different view controller was presented after presenting the
1206         input view controller, this allows us to dismiss the other view controller with animation, and directly reveal
1207         the web view or focus overlay underneath.
1208
1209         (-[WKContentView focusedFormControlViewDidSubmit:]):
1210         (-[WKContentView focusedFormControlViewDidCancel:]):
1211         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
1212         (-[WKContentView rectForFocusedFormControlView:]):
1213         (-[WKContentView nextRectForFocusedFormControlView:]):
1214         (-[WKContentView previousRectForFocusedFormControlView:]):
1215         (-[WKContentView scrollViewForFocusedFormControlView:]):
1216         (-[WKContentView actionNameForFocusedFormControlView:]):
1217         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
1218         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
1219         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
1220         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
1221         (-[WKContentView focusedFormControllerDidUpdateSuggestions:]):
1222
1223         Boilerplate renaming of focus overlay delegate methods.
1224
1225         (-[WKContentView _wheelChangedWithEvent:]):
1226
1227         Remove event forwarding hacks for date and time inputs, now that they directly become first responder.
1228
1229         (-[WKContentView presentFocusedFormControlViewController:]): Deleted.
1230         (-[WKContentView dismissFocusedFormControlViewController:]): Deleted.
1231
1232         Renamed to -addFocusedFormControlOverlay and -removeFocusedFormControlOverlay.
1233
1234         (-[WKContentView dismissAllInputViewControllers]): Deleted.
1235         (-[WKContentView focusedFormControlControllerDidSubmit:]): Deleted.
1236         (-[WKContentView focusedFormControlControllerDidCancel:]): Deleted.
1237         (-[WKContentView focusedFormControlControllerDidBeginEditing:]): Deleted.
1238         (-[WKContentView rectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
1239         (-[WKContentView nextRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
1240         (-[WKContentView previousRectForFocusedFormControlController:inCoordinateSpace:]): Deleted.
1241         (-[WKContentView scrollViewForFocusedFormControlController:]): Deleted.
1242         (-[WKContentView actionNameForFocusedFormControlController:]): Deleted.
1243         (-[WKContentView focusedFormControlControllerDidRequestNextNode:]): Deleted.
1244         (-[WKContentView focusedFormControlControllerDidRequestPreviousNode:]): Deleted.
1245         (-[WKContentView hasNextNodeForFocusedFormControlController:]): Deleted.
1246         (-[WKContentView hasPreviousNodeForFocusedFormControlController:]): Deleted.
1247         * UIProcess/ios/forms/WKFocusedFormControlViewController.h: Removed.
1248         * UIProcess/ios/forms/WKFocusedFormControlViewController.mm: Removed.
1249
1250         Completely remove WKFocusedFormControlViewController; instead, just directly place the focused form overlay in
1251         the WKWebView's hierarchy. In the case where we have a navigation stack to push to, we can no longer modally
1252         present the focused form overlay as a separate view controller using the UINavigationController, and then
1253         immediately push the input view controller on top of the navigation stack, since the navigation stack isn't
1254         updated until after the animation of the focused form overlay presentation is complete. Rather than hack around
1255         this limitation by dispatch_after-ing after presenting the overlay's view controller, we should just make the
1256         overlay a view. This also fixes the case where a client embedding a WKWebView that is smaller than the bounds of
1257         the screen will no longer see the entire screen dim when focusing an input, but instead, just the web content.
1258
1259         * WebKit.xcodeproj/project.pbxproj:
1260
1261 2018-04-11  Youenn Fablet  <youenn@apple.com>
1262
1263         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
1264         https://bugs.webkit.org/show_bug.cgi?id=184374
1265
1266         Reviewed by Chris Dumez.
1267
1268         Pass full FetchOptions parameters as part of NetworkResourceLoadParameters.
1269         This will allow handling redirection mode as well as credentials in case of cross origin redirections.
1270         In case of SameOrigin credentials and there is a redirection from same-origin to cross-origin,
1271         we will be able to stop using credentials without going to WebProcess.
1272
1273         To handle properly cross-origin checks, we have to be able to use SecurityOrigin as in WebProcess.
1274         We make WebProcess sends Origin Access White list information to NetworkProcess.
1275         This allows supporting the white list when doing loading in NetworkProcess.
1276         This only works consistently if all WebProcesses share the same whitelist.
1277
1278         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1279         (WebKit::NetworkConnectionToWebProcess::loadPing):
1280         (WebKit::NetworkConnectionToWebProcess::addOriginAccessWhitelistEntry):
1281         (WebKit::NetworkConnectionToWebProcess::removeOriginAccessWhitelistEntry):
1282         (WebKit::NetworkConnectionToWebProcess::resetOriginAccessWhitelists):
1283         * NetworkProcess/NetworkConnectionToWebProcess.h:
1284         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
1285         * NetworkProcess/NetworkLoadChecker.cpp:
1286         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1287         (WebKit::NetworkLoadChecker::checkRedirection):
1288         (WebKit::NetworkLoadChecker::continueCheckingRequest):
1289         (WebKit::NetworkLoadChecker::checkCORSRequest):
1290         (WebKit::NetworkLoadChecker::checkCORSRedirectedRequest):
1291         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
1292         (WebKit::NetworkLoadChecker::doesNotNeedCORSCheck const):
1293         * NetworkProcess/NetworkLoadChecker.h:
1294         (WebKit::NetworkLoadChecker::create):
1295         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1296         (WebKit::NetworkResourceLoadParameters::encode const):
1297         (WebKit::NetworkResourceLoadParameters::decode):
1298         * NetworkProcess/NetworkResourceLoadParameters.h:
1299         * NetworkProcess/PingLoad.cpp:
1300         (WebKit::PingLoad::PingLoad):
1301         (WebKit::PingLoad::willPerformHTTPRedirection):
1302         * NetworkProcess/PingLoad.h:
1303         * WebProcess/InjectedBundle/InjectedBundle.cpp:
1304         (WebKit::InjectedBundle::addOriginAccessWhitelistEntry):
1305         (WebKit::InjectedBundle::removeOriginAccessWhitelistEntry):
1306         (WebKit::InjectedBundle::resetOriginAccessWhitelists):
1307         * WebProcess/Network/WebLoaderStrategy.cpp:
1308         (WebKit::WebLoaderStrategy::startPingLoad):
1309
1310 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
1311
1312         [GTK] WaylandCompositorDisplay leaks its wl_display
1313         https://bugs.webkit.org/show_bug.cgi?id=184406
1314
1315         Reviewed by Carlos Garcia Campos.
1316
1317         Since we allocate our own wl_display here, need to chain up to the parent constructor
1318         passing NativeDisplayOwned::Yes, or it won't ever be released. Move the initialize call to
1319         the create function to ensure it's called after the constructor completes.
1320
1321         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
1322         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
1323         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay):
1324
1325 2018-04-11  Youenn Fablet  <youenn@apple.com>
1326
1327         Use more r-values in NetworkResourceLoader
1328         https://bugs.webkit.org/show_bug.cgi?id=184478
1329
1330         Reviewed by Chris Dumez.
1331
1332         Pass load parameters as r-values to remove some unneeded copies.
1333         Ditto for ResourceRequest inside NetworkResourceLoader.
1334
1335         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
1336         (WebKit::NetworkConnectionToWebProcess::scheduleResourceLoad):
1337         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
1338         * NetworkProcess/NetworkConnectionToWebProcess.h:
1339         * NetworkProcess/NetworkResourceLoader.cpp:
1340         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
1341         (WebKit::NetworkResourceLoader::start):
1342         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
1343         (WebKit::NetworkResourceLoader::startNetworkLoad):
1344         (WebKit::NetworkResourceLoader::continueWillSendRequest):
1345         (WebKit::NetworkResourceLoader::validateCacheEntry):
1346         * NetworkProcess/NetworkResourceLoader.h:
1347
1348 2018-04-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1349
1350         [Extra zoom mode] Missing label when focusing a <select> with a title attribute but no associated <label>
1351         https://bugs.webkit.org/show_bug.cgi?id=184352
1352         <rdar://problem/39237683>
1353
1354         Reviewed by Andy Estes.
1355
1356         Currently, AssistedNodeInformation only sends the `title` of input elements to the UI process. This means that
1357         any information requested in the UI process that is dependent on the `title` of the focused element is broken
1358         in the case of select elements. An existing example of this is the title of the table view controller used to
1359         present select menus on iPad.
1360
1361         To fix this, we simply send the `title` of the focused element across, as long as the focused element is an
1362         HTMLElement. This ensures that there's label text when focusing unlabeled select elements with titles in extra
1363         zoom mode, and also fixes a currenly broken codepath where we show the title of the select in the presented view
1364         controller's title.
1365
1366         Test: fast/forms/ios/ipad/select-with-title.html
1367
1368         * UIProcess/API/Cocoa/WKWebView.mm:
1369         (-[WKWebView selectFormPopoverTitle]):
1370         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1371
1372         Add new testing SPI to fetch the title of the UITableViewController presented for the currently focused select
1373         element.
1374
1375         * UIProcess/ios/WKContentViewInteraction.h:
1376         * UIProcess/ios/WKContentViewInteraction.mm:
1377         (-[WKContentView selectFormPopoverTitle]):
1378         * UIProcess/ios/forms/WKFormSelectControl.h:
1379         * UIProcess/ios/forms/WKFormSelectControl.mm:
1380         (-[WKFormSelectControl selectFormPopoverTitle]):
1381         * UIProcess/ios/forms/WKFormSelectPopover.h:
1382         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1383         (-[WKSelectPopover initWithView:hasGroups:]):
1384         (-[WKSelectPopover tableViewController]):
1385         * WebProcess/WebPage/ios/WebPageIOS.mm:
1386
1387         Always send the title across if the focused node is an HTMLElement.
1388
1389         (WebKit::WebPage::getAssistedNodeInformation):
1390
1391 2018-04-11  Ryan Haddad  <ryanhaddad@apple.com>
1392
1393         Unreviewed, rolling out r230508.
1394
1395         Breaks internal builds.
1396
1397         Reverted changeset:
1398
1399         "Remove block selection code"
1400         https://bugs.webkit.org/show_bug.cgi?id=184470
1401         https://trac.webkit.org/changeset/230508
1402
1403 2018-04-11  Antoine Quint  <graouts@apple.com>
1404
1405         [Web Animations] Turn Web Animations on by default
1406         https://bugs.webkit.org/show_bug.cgi?id=184491
1407
1408         Reviewed by Simon Fraser.
1409
1410         * Shared/WebPreferences.yaml:
1411
1412 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
1413
1414         Unreviewed test fix after r230468
1415
1416         Roll out an assertion added in r230468 that should not be present
1417         until https://bugs.webkit.org/show_bug.cgi?id=184451 is landed.
1418
1419         * Shared/mac/HangDetectionDisablerMac.mm:
1420         (WebKit::setClientsMayIgnoreEvents):
1421
1422 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
1423
1424         Unreviewed follow-up to r230468.
1425
1426         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
1427
1428         * UIProcess/mac/PageClientImplMac.mm:
1429         (WebKit::PageClientImpl::isViewWindowActive):
1430         (WebKit::PageClientImpl::setCursor):
1431
1432 2018-04-10  Fujii Hironori  <Hironori.Fujii@sony.com>
1433
1434         [Win] Add UserAgentWin.cpp
1435         https://bugs.webkit.org/show_bug.cgi?id=184438
1436
1437         Reviewed by Michael Catanzaro.
1438
1439         * WebProcess/WebPage/win/WebPageWin.cpp:
1440         (WebKit::WebPage::platformUserAgent const):
1441         Use WebCore::standardUserAgentForURL.
1442
1443 2018-04-10  Megan Gardner  <megan_gardner@apple.com>
1444
1445         Remove block selection code
1446         https://bugs.webkit.org/show_bug.cgi?id=184470
1447
1448         Reviewed by Timothy Hatcher.
1449         
1450         Remove block selection code that isn't run and is currently not even used.
1451         Had to put this back in for a bug in the mid-year release, but we're past that
1452         so it's time for this to go away.
1453
1454         * Platform/spi/ios/UIKitSPI.h:
1455         * UIProcess/PageClient.h:
1456         * UIProcess/WebPageProxy.h:
1457         * UIProcess/WebPageProxy.messages.in:
1458         * UIProcess/ios/PageClientImplIOS.h:
1459         * UIProcess/ios/PageClientImplIOS.mm:
1460         (WebKit::PageClientImpl::stopAssistingNode):
1461         (WebKit::PageClientImpl::didUpdateBlockSelectionWithTouch): Deleted.
1462         * UIProcess/ios/WKContentViewInteraction.h:
1463         * UIProcess/ios/WKContentViewInteraction.mm:
1464         (toSelectionHandlePosition): Deleted.
1465         (-[WKContentView _didUpdateBlockSelectionWithTouch:withFlags:growThreshold:shrinkThreshold:]): Deleted.
1466         (-[WKContentView changeSelectionWithTouchAt:withSelectionTouch:baseIsStart:]): Deleted.
1467         (-[WKContentView changeBlockSelectionWithTouchAt:withSelectionTouch:forHandle:]): Deleted.
1468         * UIProcess/ios/WebPageProxyIOS.mm:
1469         (WebKit::WebPageProxy::saveImageToLibrary):
1470         (WebKit::WebPageProxy::updateBlockSelectionWithTouch): Deleted.
1471         (WebKit::WebPageProxy::didUpdateBlockSelectionWithTouch): Deleted.
1472         * WebProcess/WebPage/WebPage.h:
1473         * WebProcess/WebPage/WebPage.messages.in:
1474         * WebProcess/WebPage/ios/WebPageIOS.mm:
1475         (WebKit::rangeAtWordBoundaryForPosition):
1476         (WebKit::distanceBetweenRectsForPosition): Deleted.
1477         (WebKit::rectsEssentiallyTheSame): Deleted.
1478         (WebKit::unionDOMRanges): Deleted.
1479         (WebKit::computeEdgeCenter): Deleted.
1480         (WebKit::WebPage::expandedRangeFromHandle): Deleted.
1481         (WebKit::WebPage::contractedRangeFromHandle): Deleted.
1482         (WebKit::WebPage::computeExpandAndShrinkThresholdsForHandle): Deleted.
1483         (WebKit::WebPage::rangeForBlockAtPoint): Deleted.
1484         (WebKit::shouldExpand): Deleted.
1485         (WebKit::WebPage::changeBlockSelection): Deleted.
1486         (WebKit::WebPage::updateBlockSelectionWithTouch): Deleted.
1487
1488 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1489
1490         [Extra zoom mode] Add a mechanism to zoom to fixed scales when double tapping in extra zoom mode
1491         https://bugs.webkit.org/show_bug.cgi?id=184435
1492         <rdar://problem/38726260>
1493
1494         Reviewed by Dean Jackson.
1495
1496         Adds support for an alternate codepath when computing a zoom rect when double tapping that doesn't take the hit-
1497         tested node into account, and instead cycles the zoom scale between 2 fixed values (in addition to the initial
1498         scale). In the next patch, these fixed scales will be determined by computing zoom scales needed to make most of
1499         the text on the page legible (i.e. the first text legibility zoom scale), and another to make all of the text on
1500         the page legible, with the exception of outliers (this is the second text legibility zoom scale).
1501
1502         See comments below for more detail.
1503
1504         * UIProcess/Cocoa/ViewGestureController.h:
1505         * UIProcess/Cocoa/ViewGestureController.messages.in:
1506         * UIProcess/ios/SmartMagnificationController.h:
1507         * UIProcess/ios/SmartMagnificationController.messages.in:
1508         * UIProcess/ios/SmartMagnificationController.mm:
1509         (WebKit::SmartMagnificationController::didCollectGeometryForSmartMagnificationGesture):
1510         * UIProcess/mac/ViewGestureControllerMac.mm:
1511         (WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
1512         * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
1513         (WebKit::ViewGestureGeometryCollector::dispatchDidCollectGeometryForSmartMagnificationGesture):
1514
1515         Rename the boolean `isReplacedElement` argument to `fitEntireRect` instead. The UI process only uses this on iOS
1516         to determine whether or not to fit the entire element rect to the viewport and add padding. This patch renames
1517         this variable because we are not zooming to a replaced element in the case where text legibility on the page
1518         (rather than element geometry) is being used to figure out the zoom scale, but we still want to fit the entire
1519         target rect to the viewport.
1520
1521         (WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
1522
1523         If text legiblity zoom scaling is preferred, then compute first and second-level text legibility zoom scales to
1524         zoom to upon double tap (where the second zoom scale is greater than the first). To choose a target zoom
1525         scale, choose the lowest target zoom scale that is at least a small amount less than the current scale. If
1526         neither of the two scales fulfill this description, then zoom back out to the initial scale. This has the effect
1527         of consistently cycling between all three zoom scales as the user double taps.
1528
1529         (WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
1530
1531         Introduce a new helper method that computes and caches target scales to zoom to when double tapping to zoom. If
1532         a cached pair of target scales is already present, it skips this computation and immediately returns it.
1533
1534         (WebKit::ViewGestureGeometryCollector::computeZoomInformationForNode):
1535         (WebKit::ViewGestureGeometryCollector::computeMinimumAndMaximumViewportScales const):
1536
1537         Factor out logic to compute min and max zoom scales into a separate helper, and call it from both
1538         computeZoomInformationForNode and computeTextLegibilityScales.
1539
1540         (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
1541
1542         Invalidate cached text legibility scales when layout is triggered.
1543
1544         * WebProcess/WebPage/ViewGestureGeometryCollector.h:
1545         * WebProcess/WebPage/WebPage.cpp:
1546         (WebKit::WebPage::mainFrameDidLayout):
1547         * WebProcess/WebPage/WebPage.h:
1548         (WebKit::WebPage::viewportConfiguration const):
1549
1550         Expose WebPage's ViewportConfiguration as a const reference.
1551
1552         * WebProcess/WebPage/ios/WebPageIOS.mm:
1553         (WebKit::WebPage::platformPrefersTextLegibilityBasedZoomScaling const):
1554
1555         Adds a platform hook for opting into text-legibility-based zoom scaling instead of regular hit-testing-based
1556         zoom scaling heuristics.
1557
1558 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1559
1560         Fix availability annotations for _WKAttachment SPI
1561         https://bugs.webkit.org/show_bug.cgi?id=184473
1562         <rdar://problem/39319732>
1563
1564         Reviewed by Dan Bernstein.
1565
1566         _WKAttachmentInfo is available in WK_MAC_TBA and WK_IOS_TBA, but the SPI method -[_WKAttachment requestInfo:]
1567         is currently available in macOS 10.13.4 and iOS 11.3. Instead, the availability of this SPI should match the
1568         availability of the SPI object it depends on.
1569
1570         * UIProcess/API/Cocoa/_WKAttachment.h:
1571
1572 2018-04-10  Chris Dumez  <cdumez@apple.com>
1573
1574         Avoid constructing a service worker RegistrationStore for private sessions
1575         https://bugs.webkit.org/show_bug.cgi?id=184463
1576         <rdar://problem/36613948>
1577
1578         Reviewed by Youenn Fablet.
1579
1580         Avoid constructing a service worker RegistrationStore for private sessions since there
1581         is no need for persistence and the registrationDatabaseDirectory is the empty string in
1582         such cases.
1583
1584         * StorageProcess/StorageProcess.cpp:
1585         (WebKit::StorageProcess::initializeWebsiteDataStore):
1586
1587 2018-04-10  Andy Estes  <aestes@apple.com>
1588
1589         [iOS] Navigate to URL and page number annotations in WKPDFView
1590         https://bugs.webkit.org/show_bug.cgi?id=184410
1591
1592         Reviewed by Timothy Hatcher.
1593
1594         Implemented navigation to URL and page number (same-document) link annotations in PDFs.
1595
1596         * UIProcess/ios/WKPDFView.mm:
1597         (-[WKPDFView _scrollToURLFragment:]):
1598         (-[WKPDFView web_didSameDocumentNavigation:]):
1599         (-[WKPDFView pdfHostViewController:updatePageCount:]):
1600         (-[WKPDFView pdfHostViewController:goToURL:]):
1601         (-[WKPDFView pdfHostViewController:goToPageIndex:withViewFrustum:]):
1602
1603 2018-04-10  Andy Estes  <aestes@apple.com>
1604
1605         [iOS] WKPDFView should conform to _WKWebViewPrintProvider
1606         https://bugs.webkit.org/show_bug.cgi?id=184471
1607
1608         Reviewed by Dan Bernstein.
1609
1610         * UIProcess/API/Cocoa/WKWebView.mm:
1611         (-[WKWebView _printProvider]):
1612
1613         The print provider will always be either _contentView or _customContentView, but
1614         might not be _currentContentView.
1615
1616         * UIProcess/ios/WKPDFView.mm:
1617         (-[WKPDFView _wk_pageCountForPrintFormatter:]):
1618
1619         Asked _hostViewController for the page count, clamped to 1 if
1620         -[_WKWebViewPrintFormatter snapshotFirstPage] is YES.
1621
1622         (-[WKPDFView _wk_printedDocument]):
1623
1624         Created a CGPDFDocumentRef from _data and returned it.
1625
1626 2018-04-10  Youenn Fablet  <youenn@apple.com>
1627
1628         Beacon redirect responses should be CORS validated
1629         https://bugs.webkit.org/show_bug.cgi?id=184378
1630
1631         Reviewed by Chris Dumez.
1632
1633         Add CORS checks to any redirection response if mode is CORS.
1634         Update response tainting and redirected accordingly.
1635
1636         * NetworkProcess/NetworkLoadChecker.cpp:
1637         (WebKit::NetworkLoadChecker::checkRedirection):
1638         (WebKit::NetworkLoadChecker::validateResponse):
1639         * NetworkProcess/NetworkLoadChecker.h:
1640         * NetworkProcess/PingLoad.cpp:
1641         (WebKit::PingLoad::willPerformHTTPRedirection):
1642
1643 2018-04-10  Sihui Liu  <sihui_liu@apple.com>
1644
1645         Loading of multipart response was cancelled because of content policy set in WebFrameLoaderClient::dispatchDecidePolicyForResponse
1646         https://bugs.webkit.org/show_bug.cgi?id=184268
1647         <rdar://problem/39144446>
1648
1649         Reviewed by Chris Dumez.
1650
1651         Webpage for multipart stream responses failed to refresh because content policy was set to 
1652         be ignore when provisonalDocumentLoader was null and navigation ID could not be retrieved. 
1653         As loading should not stop in this case, we set navigation ID 0 and still ask for content 
1654         policy.
1655
1656         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1657         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1658
1659 2018-04-10  Andy Estes  <aestes@apple.com>
1660
1661         [iOS] Use PDFKit to render PDFs in WKWebView
1662         https://bugs.webkit.org/show_bug.cgi?id=184387
1663
1664         Reviewed by Beth Dakin.
1665
1666         Adopted PDFHostViewController for rendering PDFs in WKWebView.
1667
1668         This patch implements rendering the PDF document and page number indicator. Link
1669         navigation, find-in-page, and printing will be implemented in follow-up patches.
1670
1671         WKLegacyPDFView is still the default PDF view.
1672
1673         * Configurations/WebKit.xcconfig:
1674
1675         Linked WebKit with PDFKit on iOS.
1676
1677         * UIProcess/API/Cocoa/WKWebView.mm:
1678         (-[WKWebView _currentContentView]):
1679         (-[WKWebView viewForZoomingInScrollView:]):
1680
1681         When WKPDFView loads a PDF document, it replaces itself with a view vended by
1682         PDFHostViewController as the WKScrollView's content view. Abstracted WKWebView's
1683         concept of the "current content view" to be either the WKContentView or a view of
1684         the custom content view's choosing (-web_contentView).
1685
1686         (-[WKWebView scrollViewWillBeginZooming:withView:]):
1687         (-[WKWebView scrollViewDidZoom:]):
1688         (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
1689
1690         Forwarded these calls to _customContentView if it responds to the equivalent
1691         WKWebViewContentProvider selectors.
1692
1693         * UIProcess/Cocoa/WKWebViewContentProvider.h:
1694
1695         Defined new protocol selectors.
1696
1697         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
1698         (-[WKWebViewContentProviderRegistry init]):
1699         * UIProcess/ios/WKLegacyPDFView.h:
1700         * UIProcess/ios/WKLegacyPDFView.mm:
1701
1702         Changed ENABLE(WKPDFVIEW) to ENABLE(WKLEGACYPDFVIEW).
1703
1704         (-[WKLegacyPDFView web_contentView]):
1705
1706         Added. Returns self as the content view.
1707
1708         * UIProcess/ios/WKPDFView.h: Added.
1709         * UIProcess/ios/WKPDFView.mm: Added.
1710         (-[WKPDFView dealloc]):
1711
1712         Removed the host view and page number indicator from their superviews.
1713
1714         (-[WKPDFView gestureRecognizerShouldBegin:]):
1715
1716         Forwarded to _hostViewController.
1717
1718         (-[WKPDFView web_initWithFrame:webView:]):
1719
1720         Set ours and the scroll view's background color to UIColor.grayColor to match
1721         WKLegacyPDFView.
1722
1723         (-[WKPDFView web_setContentProviderData:suggestedFilename:]):
1724
1725         Created a PDFHostViewController and set its root view as the scroll view's content
1726         view after removing the WKPDFView itself. This allows WKPDFView to act as a
1727         placeholder content view until the PDF is loaded. Added the host view controller's
1728         page number indicator to the fixed overlay view. Finally, loaded the PDF document
1729         by calling -[PDFHostViewController setDocumentData:withScrollView:].
1730
1731         (-[WKPDFView _offsetForPageNumberIndicator]):
1732
1733         Computed an offset for the page number indicator like WKLegacyPDFView did, taking
1734         into account the overlaid accessory views inset, computed unobscured safe area
1735         inset, and computed obscured inset.
1736
1737         (-[WKPDFView _movePageNumberIndicatorToPoint:animated:]):
1738
1739         Moved the page number indicator using the margin and animation duration from
1740         WKLegacyPDFView.
1741
1742         (-[WKPDFView _updateLayoutAnimated:]):
1743
1744         Added a convenience method to update the PDF view layout and position the page
1745         number indicator.
1746
1747         (-[WKPDFView web_setMinimumSize:]):
1748
1749         Updated our own frame in case we are still the placeholder content view.
1750         Called -_updateLayoutAnimated:.
1751
1752         (-[WKPDFView web_setOverlaidAccessoryViewsInset:]):
1753
1754         Stored the inset and called -_updateLayoutAnimated:.
1755
1756         (-[WKPDFView web_computedContentInsetDidChange]):
1757
1758         Called -_updateLayoutAnimated:.
1759
1760         (-[WKPDFView web_setFixedOverlayView:]):
1761
1762         Stored the fixed overlay view.
1763
1764         (-[WKPDFView web_didSameDocumentNavigation:]):
1765         (-[WKPDFView web_countStringMatches:options:maxCount:]):
1766         (-[WKPDFView web_findString:options:maxCount:]):
1767         (-[WKPDFView web_hideFindUI]):
1768
1769         Added FIXMEs.
1770
1771         (-[WKPDFView web_contentView]):
1772
1773         If there is a host view controller, return its root view. Otherwise, return self.
1774
1775         (-[WKPDFView web_scrollViewDidScroll:]):
1776         (-[WKPDFView web_scrollViewWillBeginZooming:withView:]):
1777         (-[WKPDFView web_scrollViewDidEndZooming:withView:atScale:]):
1778         (-[WKPDFView web_scrollViewDidZoom:]):
1779
1780         Called -[PDFHostViewController updatePDFViewLayout].
1781
1782         (-[WKPDFView web_dataRepresentation]):
1783
1784         Returned _data.
1785
1786         (-[WKPDFView web_suggestedFilename]):
1787
1788         Returned _suggestedFilename.
1789
1790         (-[WKPDFView web_isBackground]):
1791
1792         Returned self.isBackground.
1793
1794         * UIProcess/ios/WKSystemPreviewView.mm:
1795         (-[WKSystemPreviewView web_contentView]):
1796
1797         Added. Returns self as the content view.
1798
1799         * WebKit.xcodeproj/project.pbxproj:
1800
1801 2018-04-10  Miguel Gomez  <magomez@igalia.com>
1802
1803         [GTK][WPE] Race condition when destroying webprocesses
1804         https://bugs.webkit.org/show_bug.cgi?id=184445
1805
1806         Reviewed by Carlos Garcia Campos.
1807
1808         Ensure that the WebProcess is properly closing its pages when it's exiting because
1809         the UIProcess has invalidated the IPC connection.
1810
1811         * WebProcess/WebProcess.cpp:
1812         (WebKit::WebProcess::didClose):
1813
1814 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1815
1816         Add missing availability macros after r230462
1817         https://bugs.webkit.org/show_bug.cgi?id=184426
1818
1819         Reviewed by Timothy Hatcher.
1820
1821         Annotate new SPI added in r230462 with the appropriate availability macros.
1822
1823         * UIProcess/API/Cocoa/WKViewPrivate.h:
1824         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1825
1826 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
1827
1828         Add ProcessPrivilege assertions to places that access NSApp
1829         https://bugs.webkit.org/show_bug.cgi?id=184322
1830         <rdar://problem/39194560>
1831
1832         Reviewed by Per Arne Vollan.
1833
1834         Add ProcessPrivilege assertions to places where we interact with NSApp so
1835         that we can prevent accidentally using them in the WebContent process.
1836
1837         * Shared/mac/ChildProcessMac.mm:
1838         (WebKit::ChildProcess::stopNSAppRunLoop):
1839         * Shared/mac/HangDetectionDisablerMac.mm:
1840         (WebKit::setClientsMayIgnoreEvents):
1841         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
1842         (WebKit::WebProcessPool::platformInitializeWebProcess):
1843         * UIProcess/Cocoa/WebViewImpl.mm:
1844         (WebKit::WebViewImpl::WebViewImpl):
1845         (WebKit::WebViewImpl::becomeFirstResponder):
1846         (WebKit::WebViewImpl::pluginFocusOrWindowFocusChanged):
1847         (WebKit::WebViewImpl::validateUserInterfaceItem):
1848         (WebKit::WebViewImpl::startSpeaking):
1849         (WebKit::WebViewImpl::stopSpeaking):
1850         (WebKit::applicationFlagsForDrag):
1851         (WebKit::WebViewImpl::doneWithKeyEvent):
1852         * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm:
1853         (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
1854         * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
1855         (WebKit::PluginProcessProxy::enterFullscreen):
1856         (WebKit::PluginProcessProxy::beginModal):
1857         (WebKit::PluginProcessProxy::endModal):
1858         * UIProcess/mac/DisplayLink.cpp:
1859         (WebKit::DisplayLink::DisplayLink):
1860         (WebKit::DisplayLink::~DisplayLink):
1861         * UIProcess/mac/PageClientImplMac.mm:
1862         (WebKit::PageClientImpl::isViewWindowActive):
1863         (WebKit::PageClientImpl::setCursor):
1864         * UIProcess/mac/WebPageProxyMac.mm:
1865         (WebKit::WebPageProxy::getIsSpeaking):
1866         (WebKit::WebPageProxy::speak):
1867         (WebKit::WebPageProxy::stopSpeaking):
1868         (WebKit::WebPageProxy::startDisplayLink):
1869         * UIProcess/mac/WebPopupMenuProxyMac.mm:
1870         (WebKit::WebPopupMenuProxyMac::showPopupMenu):
1871
1872 2018-04-09  John Wilander  <wilander@apple.com>
1873
1874         Refactor Ignore HSTS code
1875         https://bugs.webkit.org/show_bug.cgi?id=184433
1876         <rdar://problem/39298238>
1877
1878         Reviewed by Darin Adler.
1879
1880         This patch refactors our ignore HSTS code. The convenience functions are moved
1881         out of CFNetwork SPI in PAL, and into where they are used. It also switches
1882         from performSelector: calls to straight function calls, after checking that
1883         there is a responder.
1884
1885         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
1886         (schemeWasUpgradedDueToDynamicHSTS):
1887         (setIgnoreHSTS):
1888         (ignoreHSTS):
1889             Add convenience functions here since they were moved out of
1890             CFNetworkSPI.h.
1891
1892 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1893
1894         Rename UNUSED to BUNUSED
1895         https://bugs.webkit.org/show_bug.cgi?id=184093
1896
1897         Reviewed by Yusuke Suzuki.
1898
1899         * UIProcess/API/Cocoa/WKWebView.mm:
1900         (-[WKWebView _getApplicationManifestWithCompletionHandler:]):
1901
1902 2018-04-09  Timothy Hatcher  <timothy@apple.com>
1903
1904         Add support for setting a background color on WKWebView and WKView
1905         https://bugs.webkit.org/show_bug.cgi?id=184426
1906
1907         Reviewed by Wenson Hsieh.
1908
1909         * UIProcess/API/Cocoa/WKViewPrivate.h: Added _backgroundColor property.
1910         * UIProcess/API/Cocoa/WKWebView.mm:
1911         (-[WKWebView _backgroundColor]): Added. Call through to WebViewImpl.
1912         (-[WKWebView _setBackgroundColor:]): Added. Call through to WebViewImpl.
1913         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Added _backgroundColor property.
1914         * UIProcess/API/mac/WKView.mm:
1915         (-[WKView _backgroundColor]): Added. Call through to WebViewImpl.
1916         (-[WKView _setBackgroundColor:]): Added. Call through to WebViewImpl.
1917         * UIProcess/Cocoa/WebViewImpl.h:
1918         * UIProcess/Cocoa/WebViewImpl.mm:
1919         (WebKit::WebViewImpl::setBackgroundColor): Added.
1920         (WebKit::WebViewImpl::backgroundColor const): Added.
1921         (WebKit::WebViewImpl::updateLayer): Use m_backgroundColor when set.
1922
1923 2018-04-09  Yousuke Kimoto <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
1924
1925         [WinCairo] Add WebKit Shared/win event files for wincairo webkit
1926         https://bugs.webkit.org/show_bug.cgi?id=183043
1927
1928         Reviewed by Brent Fulgham.
1929
1930         * Shared/NativeWebKeyboardEvent.h:
1931         (WebKit::NativeWebKeyboardEvent::nativeEvent const):
1932         * Shared/NativeWebMouseEvent.h:
1933         (WebKit::NativeWebMouseEvent::nativeEvent const):
1934         * Shared/NativeWebTouchEvent.h:
1935         * Shared/NativeWebWheelEvent.h:
1936         (WebKit::NativeWebWheelEvent::nativeEvent const):
1937         * Shared/win/NativeWebKeyboardEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
1938         (WebKit::NativeWebKeyboardEvent::NativeWebKeyboardEvent):
1939         * Shared/win/NativeWebMouseEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
1940         (WebKit::NativeWebMouseEvent::NativeWebMouseEvent):
1941         * Shared/win/NativeWebTouchEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebTouchEvent.h.
1942         (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
1943         * Shared/win/NativeWebWheelEventWin.cpp: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
1944         (WebKit::NativeWebWheelEvent::NativeWebWheelEvent):
1945         * Shared/win/WebEventFactory.cpp: Added.
1946         (WebKit::relativeCursorPosition):
1947         (WebKit::point):
1948         (WebKit::horizontalScrollChars):
1949         (WebKit::verticalScrollLines):
1950         (WebKit::clickCount):
1951         (WebKit::IsKeyInDownState):
1952         (WebKit::modifiersForEvent):
1953         (WebKit::modifiersForCurrentKeyState):
1954         (WebKit::keyboardEventTypeForEvent):
1955         (WebKit::isSystemKeyEvent):
1956         (WebKit::isKeypadEvent):
1957         (WebKit::textFromEvent):
1958         (WebKit::unmodifiedTextFromEvent):
1959         (WebKit::keyIdentifierFromEvent):
1960         (WebKit::WebEventFactory::createWebMouseEvent):
1961         (WebKit::WebEventFactory::createWebWheelEvent):
1962         (WebKit::WebEventFactory::createWebKeyboardEvent):
1963         (WebKit::WebEventFactory::createWebTouchEvent):
1964         * Shared/win/WebEventFactory.h: Copied from Source/WebKit/Shared/NativeWebMouseEvent.h.
1965         (WebKit::createNativeEvent):
1966
1967 2018-04-09  Brent Fulgham  <bfulgham@apple.com>
1968
1969         WebCore::EventHandler::targetPositionInWindowForSelectionAutoscroll is directly accessing NSScreen
1970         https://bugs.webkit.org/show_bug.cgi?id=184344
1971         <rdar://problem/39224969>
1972
1973         Reviewed by Per Arne Vollan.
1974
1975         The implementation of targetPositionInWindowForSelectionAutoscroll uses the display ID to get the
1976         screen boundaries of the current display. This causes a bunch of interaction with NSScreen that
1977         we do not want to allow in the WebContent process.
1978
1979         Instead, we should just use the cached screen information the WebContent process already possesses.
1980
1981         This patch makes the following changes:
1982         1. We now retrieve the screen rect of the page's display from the cache, rather than interacting with
1983            the WindowServer directly.
1984         2. Add a new 'toUserSpaceForPrimaryScreen' so we don't have to deal with a nil NSWindow when computing
1985            the user space version of the coordinates. A nil Window just means we want to get coordinates in
1986            terms of the primary display.
1987         3. Keep track of the primary display so we can refer to it later.
1988         4. Modify the IPC messages to include the primary display's ID so we can easily access it later.
1989         5. Modify the PlatformScreen methods to actually use the primary display when appropriate, rather
1990            than whichever screen happened to hash to the lowest value.
1991
1992         Reviewed by Per Arne Vollan.
1993
1994         * UIProcess/WebProcessPool.cpp:
1995         (WebKit::displayReconfigurationCallBack): Update for new getScreenProperties implementation.
1996         (WebKit::WebProcessPool::initializeNewWebProcess): Ditto.
1997         * WebProcess/WebProcess.cpp:
1998         (WebKit::WebProcess::setScreenProperties): Ditto.
1999         * WebProcess/WebProcess.h:
2000         * WebProcess/WebProcess.messages.in: Ditto.
2001
2002 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2003
2004         [WPE] Add API version to library soname and pkg-config files
2005         https://bugs.webkit.org/show_bug.cgi?id=180608
2006
2007         Reviewed by Žan Doberšek.
2008
2009         * PlatformWPE.cmake:
2010         * wpe/wpe-webkit.pc.in:
2011
2012 2018-04-09  Jer Noble  <jer.noble@apple.com>
2013
2014         Fix the selection assistant selectionView build
2015         https://bugs.webkit.org/show_bug.cgi?id=184423
2016         <rdar://problem/39288235>
2017
2018         Reviewed by Wenson Hsieh.
2019
2020         * Platform/spi/ios/UIKitSPI.h:
2021         * UIProcess/ios/WKContentView.mm:
2022         (-[WKContentView _didExitStableState]):
2023         * UIProcess/ios/WKContentViewInteraction.mm:
2024         (-[WKContentView _updateChangedSelection:]):
2025
2026 2018-04-09  Megan Gardner  <megan_gardner@apple.com>
2027
2028         Switch to UIWKTextInteractionAssistant for non-editable text
2029         https://bugs.webkit.org/show_bug.cgi?id=182834
2030
2031         Switch to only using one assistant for text selection.
2032
2033         Reviewed by Timothy Hatcher and Andy Estes.
2034
2035         * UIProcess/ios/WKContentViewInteraction.mm:
2036         (-[WKContentView useSelectionAssistantWithGranularity:]):
2037
2038 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2039
2040         Unreviewed, move 'using namespace' back to the right place after r230429
2041
2042         * Shared/glib/ProcessExecutablePathGLib.cpp:
2043
2044 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2045
2046         Unreviewed, rolling out r230390.
2047
2048         Broke accelerated compositing
2049
2050         Reverted changeset:
2051
2052         "[GTK] WaylandCompositorDisplay leaks its wl_display"
2053         https://bugs.webkit.org/show_bug.cgi?id=184406
2054         https://trac.webkit.org/changeset/230390
2055
2056 2018-04-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2057
2058         [Extra zoom mode] Disable fast clicking by default in extra zoom mode
2059         https://bugs.webkit.org/show_bug.cgi?id=184411
2060         <rdar://problem/38726867>
2061
2062         Reviewed by Andy Estes.
2063
2064         As it turns out, existing fast-clicking heuristics don't work so well in extra zoom mode. Even at device-width,
2065         since the page is scaled to fit within the viewport, having single taps take precedence over double taps leads
2066         to a confusing experience when trying to double tap to zoom further on content that contains links and other
2067         click targets. Revert to legacy behavior here by disabling these heuristics.
2068
2069         * UIProcess/API/Cocoa/WKWebView.mm:
2070         (-[WKWebView _initializeWithConfiguration:]):
2071
2072 2018-04-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2073
2074         [Extra zoom mode] Add an SPI hook for clients to opt in to focus overlay UI
2075         https://bugs.webkit.org/show_bug.cgi?id=184370
2076         <rdar://problem/39250494>
2077
2078         Reviewed by Timothy Hatcher and Andy Estes.
2079
2080         Add a new SPI hook for internal clients to opt in to showing the focused form control overlay. By default, the
2081         overlay is not shown.
2082
2083         * UIProcess/API/Cocoa/_WKInputDelegate.h:
2084
2085 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2086
2087         [WPE] Use GNU install directories
2088         https://bugs.webkit.org/show_bug.cgi?id=184377
2089
2090         Reviewed by Carlos Garcia Campos.
2091
2092         Merge ProcessExecutablePathGtk and ProcessExecutablePathWPE into ProcessExecutablePathGLib.
2093         WPE will now load its secondary processes from PKGLIBEXECDIR, like WebKitGTK+.
2094
2095         * PlatformWPE.cmake:
2096         * Shared/glib/ProcessExecutablePathGLib.cpp: Renamed from Source/WebKit/Shared/gtk/ProcessExecutablePathGtk.cpp.
2097         (WebKit::getExecutablePath):
2098         (WebKit::findWebKitProcess):
2099         (WebKit::executablePathOfWebProcess):
2100         (WebKit::executablePathOfPluginProcess):
2101         (WebKit::executablePathOfNetworkProcess):
2102         (WebKit::executablePathOfStorageProcess):
2103         * Shared/wpe/ProcessExecutablePathWPE.cpp: Removed.
2104         * SourcesGTK.txt:
2105         * SourcesWPE.txt:
2106
2107 2018-04-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2108
2109         [GTK] WaylandCompositorDisplay leaks its wl_display
2110         https://bugs.webkit.org/show_bug.cgi?id=184406
2111
2112         Reviewed by Carlos Garcia Campos.
2113
2114         * WebProcess/gtk/WaylandCompositorDisplay.cpp:
2115         (WebKit::WaylandCompositorDisplay::create): Fix a log message (drive-by).
2116         (WebKit::WaylandCompositorDisplay::WaylandCompositorDisplay): Fix the leak.
2117
2118 2018-04-08  Zan Dobersek  <zdobersek@igalia.com>
2119
2120         Non-Cocoa ports use default directory for ServiceWorker data during testing
2121         https://bugs.webkit.org/show_bug.cgi?id=183784
2122
2123         Reviewed by Youenn Fablet.
2124
2125         Add API to WKWebsiteDataStore that enables setting and retrieving the
2126         service worker registration directory for a given data store object.
2127         This enables setting the temporary directory for testing purposes in
2128         WebKitTestRunner.
2129
2130         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2131         (WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory):
2132         (WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory):
2133         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2134
2135 2018-04-08  Fujii Hironori  <Hironori.Fujii@sony.com>
2136
2137         [CMake] WebKit should link to WebCore as a PRIVATE library if WebCore is a static library
2138         https://bugs.webkit.org/show_bug.cgi?id=184127
2139
2140         Reviewed by Konstantin Tokarev.
2141
2142         * CMakeLists.txt: Link with WebCore as private,
2143         WebCoreHeaderInterface as public to WebKit if WebCore is a static
2144         library.
2145         * CMakeLists.txt:
2146         * PlatformGTK.cmake: Added PRIVATE keyword for WebKit_LIBRARIES.
2147         * PlatformWPE.cmake: Ditto.
2148         * PlatformWin.cmake: Ditto.
2149
2150 2018-04-08  Andy Estes  <aestes@apple.com>
2151
2152         [iOS] WKContentView and WKLegacyPDFView should share application state tracking logic
2153         https://bugs.webkit.org/show_bug.cgi?id=184402
2154
2155         Reviewed by Dan Bernstein.
2156
2157         WKContentView and WKLegacyPDFView have nearly identical logic for tracking
2158         application foreground state. Let's share it so we can more easily create new
2159         content views with proper application state tracking.
2160
2161         * UIProcess/ios/WKApplicationStateTrackingView.h: Added.
2162         * UIProcess/ios/WKApplicationStateTrackingView.mm: Added.
2163         (-[WKApplicationStateTrackingView initWithFrame:webView:]):
2164         (-[WKApplicationStateTrackingView willMoveToWindow:]):
2165         (-[WKApplicationStateTrackingView didMoveToWindow]):
2166         (-[WKApplicationStateTrackingView _applicationDidEnterBackground]):
2167         (-[WKApplicationStateTrackingView _applicationDidCreateWindowContext]):
2168         (-[WKApplicationStateTrackingView _applicationDidFinishSnapshottingAfterEnteringBackground]):
2169         (-[WKApplicationStateTrackingView _applicationWillEnterForeground]):
2170         (-[WKApplicationStateTrackingView isBackground]):
2171
2172         Moved common logic from WKContentView and WKLegacyPDFView into
2173         WKApplicationStateTrackingView.
2174
2175         * UIProcess/ios/WKContentView.h:
2176         * UIProcess/ios/WKContentView.mm:
2177         (-[WKContentView initWithFrame:processPool:configuration:webView:]):
2178         (-[WKContentView willMoveToWindow:]):
2179         (-[WKContentView _applicationDidCreateWindowContext]):
2180         (-[WKContentView didMoveToWindow]): Deleted.
2181         (-[WKContentView isBackground]): Deleted.
2182         (-[WKContentView _applicationDidEnterBackground]): Deleted.
2183         (-[WKContentView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
2184         (-[WKContentView _applicationWillEnterForeground]): Deleted.
2185
2186         Made WKContentView a subclass of WKApplicationStateTrackingView.
2187
2188         * UIProcess/ios/WKLegacyPDFView.h:
2189         * UIProcess/ios/WKLegacyPDFView.mm:
2190         (-[WKLegacyPDFView web_initWithFrame:webView:]):
2191         (-[WKLegacyPDFView web_isBackground]):
2192         (-[WKLegacyPDFView _applicationWillEnterForeground]):
2193         (-[WKLegacyPDFView willMoveToWindow:]): Deleted.
2194         (-[WKLegacyPDFView didMoveToWindow]): Deleted.
2195         (-[WKLegacyPDFView _applicationDidEnterBackground]): Deleted.
2196         (-[WKLegacyPDFView _applicationDidCreateWindowContext]): Deleted.
2197         (-[WKLegacyPDFView _applicationDidFinishSnapshottingAfterEnteringBackground]): Deleted.
2198
2199         Made WKLegacyPDFView a subclass of WKApplicationStateTrackingView.
2200
2201         * WebKit.xcodeproj/project.pbxproj:
2202
2203 2018-04-08  Dan Bernstein  <mitz@apple.com>
2204
2205         [Cocoa] Keep library validation disabled for WebContent.Development
2206         https://bugs.webkit.org/show_bug.cgi?id=184393
2207
2208         Reviewed by Anders Carlsson.
2209
2210         * Configurations/WebContent.Development.entitlements: Added. Includes the
2211           com.apple.security.cs.disable-library-validation entitlement set to true.
2212         * Configurations/WebContentService.Development.xcconfig: Set CODE_SIGN_ENTITLEMENTS to the
2213           above.
2214         * WebKit.xcodeproj/project.pbxproj: Added reference to new file.
2215
2216 2018-04-06  Brian Burg  <bburg@apple.com>
2217
2218         REGRESSION(r228371): WebAutomationSession::deleteAllCookies doesn't delete some cookies
2219         https://bugs.webkit.org/show_bug.cgi?id=184334
2220         <rdar://problem/39212863>
2221
2222         Reviewed by Timothy Hatcher.
2223
2224         When WebDriver adds a cookie for 'localhost', it actually uses the domain '.localhost' per RFC.
2225         When deleting cookies, we first fetch all cookies matching the document's hostname, and
2226         then delete them one by one. However, this code path does not add the dot prefix. This causes
2227         no cookies to match the requested domain, and thus none of them are deleted.
2228
2229         * UIProcess/Automation/WebAutomationSession.cpp:
2230         (WebKit::domainByAddingDotPrefixIfNeeded): Extract this helper method.
2231         (WebKit::WebAutomationSession::addSingleCookie): Use helper method.
2232         (WebKit::WebAutomationSession::deleteAllCookies): Add a dot prefix when
2233         requesting to delete all cookies for a hostname.
2234
2235 2018-04-06  Youenn Fablet  <youenn@apple.com>
2236
2237         Response headers should be filtered when sent from NetworkProcess to WebProcess
2238         https://bugs.webkit.org/show_bug.cgi?id=184310
2239
2240         Reviewed by Ryosuke Niwa.
2241
2242         Pass destination parameter to NetworkResourceLoader.
2243         Use new sanitization routine to filter response headers as needed:
2244         - Cross-origin routines are filtered by removing any non CORS allowed headers.
2245         - Same-origin responses are filtered by removing non used headers, except when filtering would be visible by JS (XHR, fetch).
2246         In all cases, Set-Cookie/Set-Cookie2 headers are filtered out.
2247
2248         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2249         (WebKit::NetworkResourceLoadParameters::encode const):
2250         (WebKit::NetworkResourceLoadParameters::decode):
2251         * NetworkProcess/NetworkResourceLoadParameters.h:
2252         * NetworkProcess/NetworkResourceLoader.cpp:
2253         (WebKit::NetworkResourceLoader::didReceiveResponse):
2254         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2255         (WebKit::NetworkResourceLoader::sanitizeResponseIfPossible):
2256         (WebKit::NetworkResourceLoader::didRetrieveCacheEntry):
2257         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
2258         * NetworkProcess/NetworkResourceLoader.h:
2259         * WebProcess/Network/WebLoaderStrategy.cpp:
2260         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2261         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2262         (WebKit::WebSWContextManagerConnection::updatePreferencesStore):
2263
2264 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
2265
2266         Make all sync IPCs during ScriptDisallowedScope set DoNotProcessIncomingMessagesWhenWaitingForSyncReply
2267         https://bugs.webkit.org/show_bug.cgi?id=182449
2268         <rdar://problem/39222541>
2269
2270         Reviewed by Chris Dumez.
2271
2272         Release assert that a sync IPC inside ScriptDisallowedScope sets DoNotProcessIncomingMessagesWhenWaitingForSyncReply
2273         to avoid executing arbitrary scripts as a result of processing incoming sync IPCs.
2274
2275         * Platform/IPC/Connection.h:
2276         (IPC::Connection::sendSync): Added the release assertion.
2277
2278 2018-04-05  Youenn Fablet  <youenn@apple.com>
2279
2280         REGRESSION (r230223): LayoutTest http/tests/contentextensions/css-display-none-overflows-rule-data-1.html is crashing
2281         https://bugs.webkit.org/show_bug.cgi?id=184306
2282
2283         Reviewed by Ryosuke Niwa.
2284
2285         * NetworkProcess/NetworkContentRuleListManager.cpp:
2286         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
2287
2288 2018-04-05  Brent Fulgham  <bfulgham@apple.com>
2289
2290         WebContent process is calling CGDisplayUsesInvertedPolarity
2291         https://bugs.webkit.org/show_bug.cgi?id=184337
2292         <rdar://problem/39215702>
2293
2294         Reviewed by Zalan Bujtas.
2295
2296         The PlatformScreenMac code is still calling display-related routines directly, specifically
2297         CGDisplayUsesInvertedPolarity and CGDisplayUsesForceToGray. These should be brokered from
2298         the UIProcess.
2299         
2300         There's also no reason to avoid the brokering behavior on current WebKit builds. Remove
2301         the compile guards so all macOS builds use this behavior.
2302         
2303         Finally, add some ProcessPrivilege assertions to guard against accidentally calling these
2304         routines in the future.
2305
2306         * UIProcess/WebProcessPool.cpp:
2307         (WebKit::WebProcessPool::initializeNewWebProcess): Activate screen brokering code for all builds.
2308         * WebProcess/WebProcess.cpp: Ditto.
2309         * WebProcess/WebProcess.h: Ditto.
2310         * WebProcess/WebProcess.messages.in: Ditto.
2311
2312 2018-04-05  Brady Eidson  <beidson@apple.com>
2313
2314         Process Swap on Navigation causes many webpages to hang due to attempted process swap for iframe navigations.
2315         <rdar://problem/39162236> and https://bugs.webkit.org/show_bug.cgi?id=184318
2316
2317         Reviewed by Andy Estes.
2318
2319         * UIProcess/WebPageProxy.cpp:
2320         (WebKit::WebPageProxy::receivedPolicyDecision): Don't consider a swap if the navigation is not in the main frame.
2321
2322 2018-04-05  Ryosuke Niwa  <rniwa@webkit.org>
2323
2324         WebContent process sometimes hangs in WebProcess::ensureNetworkProcessConnection
2325         https://bugs.webkit.org/show_bug.cgi?id=184326
2326
2327         Reviewed by Chris Dumez.
2328
2329         The hang was caused by UI process never sending the reply back to GetNetworkProcessConnection
2330         due to m_pendingOutgoingMachMessage being set and the event handler for DISPATCH_MACH_SEND_POSSIBLE
2331         never getting called. This is because the event handler registration happens asynchronously,
2332         and may not have completed by the time we send the first IPC to the web content process
2333         in which case it can timeout and we may never get the callback.
2334
2335         Fixed the hang by waiting for the event handler registration to be completed using
2336         dispatch_source_set_registration_handler. To do this, this patch adds a new boolean instance variable,
2337         m_isInitializingSendSource, to Connection which is set to true between the time mach port is created
2338         and until the event handler registration has been completed. platformCanSendOutgoingMessages returns
2339         false while m_isInitializingSendSource is set to prevent the attempt to send messages like we do when
2340         m_pendingOutgoingMachMessage is set to true.
2341
2342         * Platform/IPC/Connection.h:
2343         (IPC::Connection::m_isInitializingSendSource): Added.
2344         * Platform/IPC/mac/ConnectionMac.mm:
2345         (IPC::Connection::platformInvalidate): Set m_isInitializingSendSource to false.
2346         (IPC::Connection::sendMessage): Assert that m_isInitializingSendSource is false.
2347         (IPC::Connection::platformCanSendOutgoingMessages const): Return false if m_isInitializingSendSource
2348         is set to true.
2349         (IPC::Connection::sendOutgoingMessage): Assert that m_isInitializingSendSource is false.
2350         (IPC::Connection::initializeSendSource): Set m_isInitializingSendSource to true temporarily until
2351         dispatch_source_set_registration_handler's callback is called. Resume and send any pending outgoing
2352         messages.
2353         (IPC::Connection::resumeSendSource): Extracted from initializeSendSource.
2354
2355 2018-04-05  Youenn Fablet  <youenn@apple.com>
2356
2357         WebRTC data channel only applications require capture permissions for direct connections
2358         https://bugs.webkit.org/show_bug.cgi?id=174500
2359         <rdar://problem/34134281>
2360
2361         Unreviewed.
2362         Changed the code to suppress: "error: unused variable 'error' [-Werror,-Wunused-variable]"
2363         Added some logging to this error case as a side bonus.
2364
2365         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp:
2366         (WebKit::NetworkMDNSRegister::registerMDNSName):
2367
2368 2018-04-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2369
2370         REGRESSION(r229831): Test WebKit2.ProvisionalURLAfterWillSendRequestCallback times out since r229831
2371         https://bugs.webkit.org/show_bug.cgi?id=184293
2372
2373         Reviewed by Alex Christensen.
2374
2375         The problem is that after willSendRequest callback changes the request, the load is cancelled while
2376         transitioning to committed state. This happens because the load is not waiting for the response policy check, so
2377         it continues and when transitioning to committed, FrameLoader::closeURL() invalidates the current policy check
2378         that causes a load failure. The new request returned by the API doesn't have any requester, so it's no longer
2379         considered a main resource load. In the network process the resource load task doesn't wait for the response
2380         policy and continues the load, sending the data to the web process. Once the first data is received, the load
2381         transitions to commit, but the response policy check is still ongoing. This can only happen when using the C API
2382         (I don't know about the Cocoa API), but not with the GLib API because it doesn't allow to create a new request,
2383         only to modify the passed in one. With the C API we loss other internal things of the request like the priority,
2384         but I guess the most important one is the requester.
2385
2386         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2387         (WebKit::WebFrameLoaderClient::dispatchWillSendRequest):
2388
2389 2018-04-04  Ryan Haddad  <ryanhaddad@apple.com>
2390
2391         Unreviewed, rolling out r230283.
2392
2393         Caused webkitpy test failures.
2394
2395         Reverted changeset:
2396
2397         "Use CompletionHandlers for DelayedReplies"
2398         https://bugs.webkit.org/show_bug.cgi?id=182269
2399         https://trac.webkit.org/changeset/230283
2400
2401 2018-04-04  Youenn Fablet  <youenn@apple.com>
2402
2403         webrtc/video-update-often.html is flakily crashing on iOS simulator Debug
2404         https://bugs.webkit.org/show_bug.cgi?id=184022
2405
2406         Reviewed by Jer Noble.
2407
2408         Remove client context once the new context identifier is set.
2409         Covered by test no longer crashing locally.
2410
2411         * WebProcess/cocoa/PlaybackSessionManager.mm:
2412         (WebKit::PlaybackSessionManager::setUpPlaybackControlsManager):
2413
2414 2018-04-04  Youenn Fablet  <youenn@apple.com>
2415
2416         WebRTC data channel only applications require capture permissions for direct connections
2417         https://bugs.webkit.org/show_bug.cgi?id=174500
2418         <rdar://problem/34134281>
2419
2420         Reviewed by Eric Carlson.
2421
2422         Add support for MDNS registration and resolution by NetworkProcess.
2423         WebProcess gives instruction to do the actual registrations/resolutions.
2424
2425         * CMakeLists.txt:
2426         * DerivedSources.make:
2427         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2428         (WebKit::NetworkConnectionToWebProcess::NetworkConnectionToWebProcess):
2429         (WebKit::NetworkConnectionToWebProcess::didReceiveMessage):
2430         * NetworkProcess/NetworkConnectionToWebProcess.h:
2431         (WebKit::NetworkConnectionToWebProcess::mdnsRegister):
2432         * NetworkProcess/webrtc/NetworkMDNSRegister.cpp: Added.
2433         (WebKit::NetworkMDNSRegister::NetworkMDNSRegister):
2434         (WebKit::NetworkMDNSRegister::~NetworkMDNSRegister):
2435         (WebKit::NetworkMDNSRegister::unregisterMDNSNames):
2436         (WebKit::PendingRegistrationRequest::PendingRegistrationRequest):
2437         (WebKit::registerMDNSNameCallback):
2438         (WebKit::NetworkMDNSRegister::registerMDNSName):
2439         (WebKit::PendingResolutionRequest::PendingResolutionRequest):
2440         (WebKit::PendingResolutionRequest::~PendingResolutionRequest):
2441         (WebKit::PendingResolutionRequest::timeout):
2442         (WebKit::resolveMDNSNameCallback):
2443         (WebKit::NetworkMDNSRegister::resolveMDNSName):
2444         * NetworkProcess/webrtc/NetworkMDNSRegister.h: Added.
2445         * NetworkProcess/webrtc/NetworkMDNSRegister.messages.in: Added.
2446         * Shared/WebPreferences.yaml:
2447         * UIProcess/API/C/WKPreferences.cpp:
2448         (WKPreferencesSetWebRTCMDNSICECandidatesEnabled):
2449         (WKPreferencesGetWebRTCMDNSICECandidatesEnabled):
2450         * UIProcess/API/C/WKPreferencesRef.h:
2451         * WebKit.xcodeproj/project.pbxproj:
2452         * WebProcess/InjectedBundle/InjectedBundle.cpp:
2453         (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
2454         * WebProcess/Network/NetworkProcessConnection.cpp:
2455         (WebKit::NetworkProcessConnection::didReceiveMessage):
2456         * WebProcess/Network/webrtc/LibWebRTCNetwork.h:
2457         (WebKit::LibWebRTCNetwork::mdnsRegister):
2458         * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
2459         (WebKit::LibWebRTCProvider::unregisterMDNSNames):
2460         (WebKit::LibWebRTCProvider::registerMDNSName):
2461         (WebKit::LibWebRTCProvider::resolveMDNSName):
2462         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
2463         * WebProcess/Network/webrtc/WebMDNSRegister.cpp: Added.
2464         (WebKit::WebMDNSRegister::finishedRegisteringMDNSName):
2465         (WebKit::WebMDNSRegister::finishedResolvingMDNSName):
2466         (WebKit::WebMDNSRegister::unregisterMDNSNames):
2467         (WebKit::WebMDNSRegister::registerMDNSName):
2468         (WebKit::WebMDNSRegister::resolveMDNSName):
2469         * WebProcess/Network/webrtc/WebMDNSRegister.h: Added.
2470         * WebProcess/Network/webrtc/WebMDNSRegister.messages.in: Added.
2471
2472 2018-04-04  Alex Christensen  <achristensen@webkit.org>
2473
2474         Use CompletionHandlers for DelayedReplies
2475         https://bugs.webkit.org/show_bug.cgi?id=182269
2476
2477         Reviewed by Youenn Fablet.
2478
2479         DelayedReplies should be a noncopyable, non-refcountable type.  They should be
2480         called once and only once.  This is what CompletionHandlers are for.
2481
2482         No change in behavior.  Just cleaner code.
2483
2484         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2485         (WebKit::NetworkConnectionToWebProcess::performSynchronousLoad):
2486         * NetworkProcess/NetworkConnectionToWebProcess.h:
2487         * NetworkProcess/NetworkResourceLoader.cpp:
2488         (WebKit::NetworkResourceLoader::SynchronousLoadData::SynchronousLoadData):
2489         (WebKit::sendReplyToSynchronousRequest):
2490         (WebKit::NetworkResourceLoader::NetworkResourceLoader):
2491         * NetworkProcess/NetworkResourceLoader.h:
2492         * Platform/IPC/Connection.h:
2493         * Platform/IPC/HandleMessage.h:
2494         (IPC::callMemberFunctionImpl):
2495         (IPC::callMemberFunction):
2496         (IPC::handleMessageDelayed):
2497         * PluginProcess/PluginControllerProxy.cpp:
2498         (WebKit::PluginControllerProxy::setInitializationReply):
2499         (WebKit::PluginControllerProxy::takeInitializationReply):
2500         * PluginProcess/PluginControllerProxy.h:
2501         * PluginProcess/WebProcessConnection.cpp:
2502         (WebKit::WebProcessConnection::destroyPlugin):
2503         (WebKit::WebProcessConnection::createPlugin):
2504         (WebKit::WebProcessConnection::createPluginAsynchronously):
2505         * PluginProcess/WebProcessConnection.h:
2506         * Scripts/webkit/messages.py:
2507         (message_to_struct_declaration):
2508         (generate_message_handler):
2509         * UIProcess/Network/NetworkProcessProxy.cpp:
2510         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2511         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2512         (WebKit::NetworkProcessProxy::networkProcessFailedToLaunch):
2513         (WebKit::NetworkProcessProxy::didCreateNetworkConnectionToWebProcess):
2514         * UIProcess/Network/NetworkProcessProxy.h:
2515         * UIProcess/Plugins/PluginProcessManager.cpp:
2516         (WebKit::PluginProcessManager::getPluginProcessConnection):
2517         * UIProcess/Plugins/PluginProcessManager.h:
2518         * UIProcess/Plugins/PluginProcessProxy.cpp:
2519         (WebKit::PluginProcessProxy::getPluginProcessConnection):
2520         (WebKit::PluginProcessProxy::pluginProcessCrashedOrFailedToLaunch):
2521         (WebKit::PluginProcessProxy::didCreateWebProcessConnection):
2522         * UIProcess/Plugins/PluginProcessProxy.h:
2523         * UIProcess/Storage/StorageProcessProxy.cpp:
2524         (WebKit::StorageProcessProxy::getStorageProcessConnection):
2525         (WebKit::StorageProcessProxy::didClose):
2526         (WebKit::StorageProcessProxy::didCreateStorageToWebProcessConnection):
2527         * UIProcess/Storage/StorageProcessProxy.h:
2528         * UIProcess/WebPageProxy.cpp:
2529         (WebKit::ExceededDatabaseQuotaRecords::createRecord):
2530         (WebKit::WebPageProxy::createNewPage):
2531         (WebKit::WebPageProxy::runJavaScriptAlert):
2532         (WebKit::WebPageProxy::runJavaScriptConfirm):
2533         (WebKit::WebPageProxy::runJavaScriptPrompt):
2534         (WebKit::WebPageProxy::webGLPolicyForURL):
2535         (WebKit::WebPageProxy::resolveWebGLPolicyForURL):
2536         (WebKit::WebPageProxy::getToolbarsAreVisible):
2537         (WebKit::WebPageProxy::getMenuBarIsVisible):
2538         (WebKit::WebPageProxy::getStatusBarIsVisible):
2539         (WebKit::WebPageProxy::getWindowFrame):
2540         (WebKit::WebPageProxy::screenToRootView):
2541         (WebKit::WebPageProxy::rootViewToScreen):
2542         (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
2543         (WebKit::WebPageProxy::exceededDatabaseQuota):
2544         (WebKit::WebPageProxy::reachedApplicationCacheOriginQuota):
2545         * UIProcess/WebPageProxy.h:
2546         * UIProcess/WebProcessPool.cpp:
2547         (WebKit::WebProcessPool::networkProcessCrashed):
2548         (WebKit::WebProcessPool::getNetworkProcessConnection):
2549         (WebKit::WebProcessPool::getStorageProcessConnection):
2550         * UIProcess/WebProcessPool.h:
2551         * UIProcess/WebProcessProxy.cpp:
2552         (WebKit::WebProcessProxy::getPluginProcessConnection):
2553         (WebKit::WebProcessProxy::getNetworkProcessConnection):
2554         (WebKit::WebProcessProxy::getStorageProcessConnection):
2555         * UIProcess/WebProcessProxy.h:
2556         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
2557         (WebKit::WebSWContextManagerConnection::syncTerminateWorker):
2558         * WebProcess/Storage/WebSWContextManagerConnection.h:
2559         * WebProcess/WebPage/WebPage.h:
2560         * WebProcess/WebPage/ios/WebPageIOS.mm:
2561         (WebKit::WebPage::computePagesForPrintingAndDrawToPDF):
2562
2563 2018-04-04  Alex Christensen  <achristensen@webkit.org>
2564
2565         Remove legacyCustomProtocolManager from NetworkSessionCreationParameters
2566         https://bugs.webkit.org/show_bug.cgi?id=182178
2567
2568         Reviewed by Youenn Fablet.
2569
2570         Now that we only make NetworkSessions in the NetworkProcess, we don't need to pass this parameter around.
2571
2572         * NetworkProcess/NetworkProcess.cpp:
2573         (WebKit::NetworkProcess::initializeNetworkProcess):
2574         * NetworkProcess/NetworkSessionCreationParameters.h:
2575         (WebKit::NetworkSessionCreationParameters::decode):
2576         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2577         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2578         * NetworkProcess/mac/RemoteNetworkingContext.mm:
2579         (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
2580         * Shared/WebsiteDataStoreParameters.cpp:
2581         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
2582         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2583         (WebKit::WebsiteDataStore::parameters):
2584
2585 2018-04-04  Alex Christensen  <achristensen@webkit.org>
2586
2587         Move PingHandle to WebKitLegacy
2588         https://bugs.webkit.org/show_bug.cgi?id=184145
2589
2590         Reviewed by Youenn Fablet.
2591
2592         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2593
2594 2018-04-04  Brent Fulgham  <bfulgham@apple.com>
2595
2596         Failures from mach port reference handling should be fatal
2597         https://bugs.webkit.org/show_bug.cgi?id=184202
2598         <rdar://problem/37771114>
2599
2600         Reviewed by Anders Carlsson.
2601
2602         Update for new location of MachSendRight.h. Switch to
2603         #pragma once in a few places.
2604
2605         * Platform/IPC/mac/ConnectionMac.mm:
2606         (IPC::Connection::platformInvalidate): Adopt new 'safe mach_port_t deallocation' function.
2607         (IPC::Connection::initializeSendSource): Ditto.
2608         (IPC::Connection::receiveSourceEventHandler): Ditto.
2609         * Platform/SharedMemory.h:
2610         * Platform/cocoa/SharedMemoryCocoa.cpp:
2611         (WebKit::SharedMemory::Handle::clear): Ditto.
2612         (WebKit::makeMemoryEntry): Ditto.
2613         (WebKit::SharedMemory::createSendRight const): Ditto.
2614         * Platform/mac/LayerHostingContext.h:
2615         * Platform/mac/LayerHostingContext.mm:
2616         * PluginProcess/PluginControllerProxy.h:
2617         * PluginProcess/PluginProcess.h:
2618         (WebKit::PluginProcess::compositingRenderServerPort const):
2619         * Scripts/messages.py:
2620         (headers_for_type): Update for new location of MachSendRight.
2621         * Shared/Plugins/PluginProcessCreationParameters.h:
2622         * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
2623         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
2624         (WebKit::RemoteLayerBackingStore::encode const):
2625         * Shared/WebCoreArgumentCoders.h:
2626         * Shared/WebProcessCreationParameters.h:
2627         * Shared/mac/WebCoreArgumentCodersMac.mm:
2628         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
2629         * UIProcess/DrawingAreaProxy.cpp:
2630         * UIProcess/DrawingAreaProxy.h:
2631         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2632         (WebKit::ProcessLauncher::launchProcess): Ditto. Remove uneeded mach_port_dealloc called after
2633         xpc_dictionary_set_mach_send. While '..._set_mach_send' retains the send right, it gets automatically
2634         released when the message is handled. We only want to manually deallocate the send right if
2635         the message failed to send.
2636         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
2637         * UIProcess/WebPageProxy.cpp:
2638         * UIProcess/WebPageProxy.h:
2639         * UIProcess/WebPageProxy.messages.in:
2640         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
2641         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
2642         * UIProcess/mac/WKViewLayoutStrategy.mm:
2643         * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
2644         * WebProcess/Plugins/Netscape/NetscapePlugin.h:
2645         * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
2646         * WebProcess/Plugins/PluginController.h:
2647         * WebProcess/Plugins/PluginView.h:
2648         * WebProcess/WebPage/DrawingArea.h:
2649         (WebKit::DrawingArea::addFence):
2650         (WebKit::DrawingArea::updateGeometry):
2651         * WebProcess/WebPage/DrawingArea.messages.in:
2652         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
2653         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
2654         (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
2655         * WebProcess/WebPage/WebPage.cpp:
2656         (WebKit::WebPage::setTopContentInsetFenced):
2657         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
2658         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2659         (WebKit::TiledCoreAnimationDrawingArea::updateGeometry):
2660         * WebProcess/WebProcess.h:
2661         (WebKit::WebProcess::compositingRenderServerPort const):
2662         * WebProcess/cocoa/VideoFullscreenManager.mm:
2663         (WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
2664
2665 2018-04-04  Beth Dakin  <bdakin@apple.com>
2666
2667         Fix the print formatter build
2668         https://bugs.webkit.org/show_bug.cgi?id=184289
2669         -and corresponding-
2670         rdar://problem/39164641
2671
2672         Reviewed by Dan Bernstein.
2673
2674         * UIProcess/API/Cocoa/WKWebView.mm:
2675         (-[WKWebView _webViewPrintFormatter]):
2676         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2677         * UIProcess/_WKWebViewPrintFormatter.h:
2678         * UIProcess/_WKWebViewPrintFormatter.mm:
2679         * UIProcess/_WKWebViewPrintFormatterInternal.h:
2680         * UIProcess/ios/WKContentView.mm:
2681         * UIProcess/ios/WKPDFView.mm:
2682
2683 2018-04-04  Andy Estes  <aestes@apple.com>
2684
2685         [iOS] Rename WKPDFView to WKLegacyPDFView
2686         https://bugs.webkit.org/show_bug.cgi?id=184286
2687
2688         Rubber-stamped by Wenson Hsieh.
2689
2690         A series of upcoming patches will implement a new WKPDFView based on PDFKit.
2691
2692         * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
2693         (-[WKWebViewContentProviderRegistry init]):
2694         * UIProcess/ios/WKLegacyPDFView.h: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.h.
2695         * UIProcess/ios/WKLegacyPDFView.mm: Renamed from Source/WebKit/UIProcess/ios/WKPDFView.mm.
2696         (-[WKLegacyPDFView _computeMatchesForString:options:maxCount:completionHandler:]):
2697         * WebKit.xcodeproj/project.pbxproj:
2698
2699 2018-04-04  Yousuke Kimoto  <yousuke.kimoto@sony.com> and Fujii Hironori  <Hironori.Fujii@sony.com>
2700
2701         [WinCairo] Add WebKit Shared/win files for wincairo webkit
2702         https://bugs.webkit.org/show_bug.cgi?id=183044
2703
2704         Reviewed by Alex Christensen.
2705
2706         * Shared/win/ChildProcessMainWin.cpp: Added.
2707
2708 2018-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2709
2710         [Extra zoom mode] Remove effective font size constraints when determining focus zoom scale
2711         https://bugs.webkit.org/show_bug.cgi?id=184287
2712         <rdar://problem/39063886>
2713
2714         Reviewed by Timothy Hatcher.
2715
2716         As it turns out, form controls on some important websites can be very wide, with a small font size, which
2717         renders the approach taken in <https://trac.webkit.org/r230171> moot, since we'll just end up zooming to a scale
2718         that is too large anyways. To mitigate this for now, remove the minimum font scaling threshold while we think of
2719         more clever ways to account for this scenario.
2720
2721         * UIProcess/API/Cocoa/WKWebView.mm:
2722         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2723
2724 2018-04-04  Fujii Hironori  <Hironori.Fujii@sony.com>
2725
2726         [Win] WebFrameLoaderClient: 'getpid': identifier not found
2727         https://bugs.webkit.org/show_bug.cgi?id=184291
2728
2729         Reviewed by Konstantin Tokarev.
2730
2731         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2732         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
2733         Use WTF::getCurrentProcessID() instead of getpid().
2734         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
2735
2736 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2737
2738         ASSERTION FAILED: !m_mainFrame->coreFrame()->loader().frameHasLoaded() || !m_pendingNavigationID when reloading page while a page is loading
2739         https://bugs.webkit.org/show_bug.cgi?id=153210
2740
2741         Reviewed by Alex Christensen.
2742
2743         The assert happens when WebPage::reload() is called twice and the first time the reload is ignored by
2744         FrameLoader because the document URL is empty. In that case the pending navigation is not reset, because
2745         FrameLoader::reload() returns before creating the document loader.
2746
2747         * WebProcess/WebPage/WebPage.cpp:
2748         (WebKit::WebPage::reload): Check if the pending navigation has been reset after calling FrameLoader::reload()
2749         and reset it otherwise.
2750
2751 2018-04-03  Youenn Fablet  <youenn@apple.com>
2752
2753         Make NetworkProcess get ContentBlocker information from UIProcess
2754         https://bugs.webkit.org/show_bug.cgi?id=184205
2755         <rdar://problem/39146551>
2756
2757         Unreviewed.
2758         Updated decode/encode methods to not hit null identifier assertion.
2759
2760         * Shared/WebPageCreationParameters.cpp:
2761         (WebKit::WebPageCreationParameters::encode const):
2762         (WebKit::WebPageCreationParameters::decode):
2763         * Shared/WebPageGroupData.cpp:
2764         (WebKit::WebPageGroupData::encode const):
2765         (WebKit::WebPageGroupData::decode):
2766
2767 2018-04-03  Andy Estes  <aestes@apple.com>
2768
2769         [iOS] WKWebView shouldn't know about WKPDFView
2770         https://bugs.webkit.org/show_bug.cgi?id=184283
2771
2772         Reviewed by Timothy Hatcher.
2773
2774         WKWebView shouldn't be checking if _customContentView is a particular kind of
2775         class (e.g., WKPDFView). Instead, it should interact with the _customContentView
2776         using the WKWebViewContentProvider protocol.
2777
2778         Reimplement -_isBackground, -_isDisplayingPDF, -_dataForDisplayedPDF, and
2779         -_suggestedFilenameForDisplayedPDF using new WKWebViewContentProvider protocol
2780         methods that WKPDFView implements.
2781
2782         * UIProcess/API/Cocoa/WKWebView.mm:
2783         (-[WKWebView _isBackground]):
2784         (-[WKWebView _isDisplayingPDF]):
2785         (-[WKWebView _dataForDisplayedPDF]):
2786         (-[WKWebView _suggestedFilenameForDisplayedPDF]):
2787         * UIProcess/Cocoa/WKWebViewContentProvider.h:
2788         * UIProcess/ios/WKPDFView.h:
2789         * UIProcess/ios/WKPDFView.mm:
2790         (-[WKPDFView web_dataRepresentation]):
2791         (-[WKPDFView web_suggestedFilename]):
2792         (-[WKPDFView web_isBackground]):
2793         (-[WKPDFView suggestedFilename]): Deleted.
2794         (-[WKPDFView pdfDocument]): Deleted.
2795         (-[WKPDFView isBackground]): Deleted.
2796
2797 2018-04-03  Brent Fulgham  <bfulgham@apple.com>
2798
2799         Guard against keychain/certificate access outside the network process
2800         https://bugs.webkit.org/show_bug.cgi?id=184214
2801         <rdar://problem/38734795>
2802
2803         Reviewed by Youenn Fablet.
2804
2805         Use the ProcessPrivilege assertions to guard against accessing the Keychain from
2806         a non-Networking process.
2807
2808         * Shared/cf/ArgumentCodersCF.cpp:
2809         (IPC::encode): Assert if we access the keychain from a proces other than the Network or UI process.
2810         (IPC::decode): Ditto.
2811
2812 2018-04-03  Youenn Fablet  <youenn@apple.com>
2813
2814         NetworkResourceLoader does not need to expose all redirect response headers
2815         https://bugs.webkit.org/show_bug.cgi?id=184114
2816         <rdar://problem/39010557>
2817
2818         Reviewed by Ryosuke Niwa.
2819
2820         WebProcess instructs NetworkProcess whether to sanitize response headers based on a runtime flag.
2821         We sanitize redirection response headers in case this is not related to a navigation load.
2822         Navigation loads may currently require the full response for content blockers.
2823
2824         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2825         (WebKit::NetworkResourceLoadParameters::encode const):
2826         (WebKit::NetworkResourceLoadParameters::decode):
2827         * NetworkProcess/NetworkResourceLoadParameters.h:
2828         * NetworkProcess/NetworkResourceLoader.cpp:
2829         (WebKit::NetworkResourceLoader::willSendRedirectedRequest):
2830         (WebKit::NetworkResourceLoader::sanitizeRedirectResponseIfPossible):
2831         (WebKit::NetworkResourceLoader::dispatchWillSendRequestForCacheEntry):
2832         * NetworkProcess/NetworkResourceLoader.h:
2833         * Shared/WebPreferences.yaml:
2834         * UIProcess/API/C/WKPreferences.cpp:
2835         (WKPreferencesSetRestrictedHTTPResponseAccess):
2836         (WKPreferencesGetRestrictedHTTPResponseAccess):
2837         * UIProcess/API/C/WKPreferencesRef.h:
2838         * WebProcess/Network/WebLoaderStrategy.cpp:
2839         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
2840         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
2841         (WebKit::WebLoaderStrategy::startPingLoad):
2842         (WebKit::WebLoaderStrategy::preconnectTo):
2843
2844 2018-04-03  Youenn Fablet  <youenn@apple.com>
2845
2846         Make NetworkProcess get ContentBlocker information from UIProcess
2847         https://bugs.webkit.org/show_bug.cgi?id=184205
2848
2849         Reviewed by Alex Christensen.
2850
2851         Make NetworkProcess get content blockers from UIProcess directly.
2852         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
2853         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
2854
2855         This is both more efficient than passing them for each PingLoad and safer in the sense
2856         that a compromised WebProcess will not be able to bypass any of these.
2857         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
2858
2859         Covered by existing beacon+content blocker tests.
2860
2861         Did some refactoring to add a typed content blocker identifier.
2862         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
2863         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
2864
2865         * CMakeLists.txt:
2866         * DerivedSources.make:
2867         * NetworkProcess/NetworkLoadChecker.cpp:
2868         (WebKit::NetworkLoadChecker::checkRequest):
2869         (WebKit::NetworkLoadChecker::continueCheckingRequest):
2870         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
2871         * NetworkProcess/NetworkLoadChecker.h:
2872         (WebKit::NetworkLoadChecker::setContentExtensionController):
2873         * NetworkProcess/NetworkProcess.cpp:
2874         (WebKit::NetworkProcess::didReceiveMessage):
2875         * NetworkProcess/NetworkProcess.h:
2876         (WebKit::NetworkProcess::networkUserContentController):
2877         * NetworkProcess/NetworkResourceLoadParameters.cpp:
2878         (WebKit::NetworkResourceLoadParameters::encode const):
2879         (WebKit::NetworkResourceLoadParameters::decode):
2880         * NetworkProcess/NetworkResourceLoadParameters.h:
2881         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
2882         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
2883         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
2884         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
2885         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
2886         (WebKit::NetworkContentRuleListManager::remove):
2887         * NetworkProcess/NetworkContentRuleListManager.h: Added.
2888         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
2889         * NetworkProcess/PingLoad.cpp:
2890         * Scripts/webkit/messages.py:
2891         * Shared/UserContentControllerIdentifier.h: Added.
2892         * Shared/WebPageCreationParameters.cpp:
2893         (WebKit::WebPageCreationParameters::decode):
2894         * Shared/WebPageCreationParameters.h:
2895         * Shared/WebPageGroupData.cpp:
2896         (WebKit::WebPageGroupData::decode):
2897         * Shared/WebPageGroupData.h:
2898         * UIProcess/Network/NetworkProcessProxy.cpp:
2899         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2900         (WebKit::NetworkProcessProxy::contentExtensionRules):
2901         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
2902         * UIProcess/Network/NetworkProcessProxy.h:
2903         * UIProcess/Network/NetworkProcessProxy.messages.in:
2904         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
2905         (WebKit::WebUserContentControllerProxy::get):
2906         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
2907         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
2908         (WebKit::WebUserContentControllerProxy::addProcess):
2909         (WebKit::WebUserContentControllerProxy::removeProcess):
2910         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
2911         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
2912         (WebKit::WebUserContentControllerProxy::addUserScript):
2913         (WebKit::WebUserContentControllerProxy::removeUserScript):
2914         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
2915         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
2916         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
2917         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
2918         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
2919         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
2920         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
2921         (WebKit::WebUserContentControllerProxy::addContentRuleList):
2922         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
2923         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
2924         * UIProcess/UserContent/WebUserContentControllerProxy.h:
2925         (WebKit::WebUserContentControllerProxy::create):
2926         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
2927         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
2928         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
2929         (WebKit::WebUserContentControllerProxy::identifier const):
2930         * WebKit.xcodeproj/project.pbxproj:
2931         * WebProcess/Network/WebLoaderStrategy.cpp:
2932         (WebKit::WebLoaderStrategy::startPingLoad):
2933         * WebProcess/UserContent/WebUserContentController.cpp:
2934         (WebKit::WebUserContentController::getOrCreate):
2935         (WebKit::WebUserContentController::WebUserContentController):
2936         (WebKit::WebUserContentController::~WebUserContentController):
2937         * WebProcess/UserContent/WebUserContentController.h:
2938         * WebProcess/WebPage/WebPage.h:
2939         (WebKit::WebPage::userContentControllerIdentifier const):
2940
2941 2018-04-03  Andy Estes  <aestes@apple.com>
2942
2943         [Mac] Prioritize file promises over filenames during drag and drop
2944         https://bugs.webkit.org/show_bug.cgi?id=184237
2945         <rdar://problem/38278076>
2946
2947         Reviewed by Wenson Hsieh.
2948
2949         * UIProcess/Cocoa/WebViewImpl.mm:
2950         (WebKit::WebViewImpl::performDragOperation):
2951
2952 2018-04-03  Brady Eidson  <beidson@apple.com>
2953
2954         Make SessionStorage work with process swapping.
2955         https://bugs.webkit.org/show_bug.cgi?id=184270
2956
2957         Reviewed by Andy Estes.
2958
2959         Due to a minor process accounting error, WebPageProxys weren't always being reconnected with their
2960         WebsiteDataStore's StorageManager when doing process swaps.
2961
2962         Fix that error, and SessionStorage "just works."
2963
2964         * UIProcess/WebPageProxy.cpp:
2965         (WebKit::WebPageProxy::webProcessWillShutDown):
2966         (WebKit::WebPageProxy::processDidTerminate): For NavigationSwap termination, make sure to tell the 
2967           process lifetime tracker that this page was removed.
2968
2969         * UIProcess/WebProcessLifetimeObserver.h:
2970         (WebKit::WebProcessLifetimeObserver::webPageWasInvalidated): Renamed from "webPageWasRemoved"
2971         (WebKit::WebProcessLifetimeObserver::webPageWasRemoved): Deleted.
2972
2973         * UIProcess/WebProcessLifetimeTracker.cpp:
2974         (WebKit::WebProcessLifetimeTracker::webPageLeavingWebProcess): Renamed from "webProcessWillShutDown"
2975         (WebKit::WebProcessLifetimeTracker::pageWasInvalidated):
2976         (WebKit::WebProcessLifetimeTracker::webProcessWillShutDown): Deleted.
2977         * UIProcess/WebProcessLifetimeTracker.h:
2978
2979         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
2980         (WebKit::WebsiteDataStore::webPageWasInvalidated):
2981         (WebKit::WebsiteDataStore::webPageWasRemoved): Deleted.
2982         * UIProcess/WebsiteData/WebsiteDataStore.h:
2983
2984 2018-04-03  Commit Queue  <commit-queue@webkit.org>
2985
2986         Unreviewed, rolling out r230210.
2987         https://bugs.webkit.org/show_bug.cgi?id=184277
2988
2989         it is breaking internal bots (Requested by youenn on #webkit).
2990
2991         Reverted changeset:
2992
2993         "Make NetworkProcess get ContentBlocker information from
2994         UIProcess"
2995         https://bugs.webkit.org/show_bug.cgi?id=184205
2996         https://trac.webkit.org/changeset/230210
2997
2998 2018-04-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2999
3000         [Extra zoom mode] Update time picker to use platform view controller
3001         https://bugs.webkit.org/show_bug.cgi?id=184252
3002         <rdar://problem/38804795>
3003
3004         Reviewed by Andy Estes.
3005
3006         Adjust for some small WKTimePickerViewController changes, and remove some files that we no longer need.
3007
3008         * UIProcess/ios/WKContentViewInteraction.mm:
3009         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3010         (-[WKContentView textInputController:didCommitText:]): Deleted.
3011         (-[WKContentView textInputController:didCommitText:withSuggestion:]): Deleted.
3012         (-[WKContentView textInputControllerDidRequestDismissal:]): Deleted.
3013         * UIProcess/ios/forms/WKTextFormControlViewController.h: Removed.
3014         * UIProcess/ios/forms/WKTextFormControlViewController.mm: Removed.
3015         * UIProcess/ios/forms/WKTextSuggestionButton.h: Removed.
3016         * UIProcess/ios/forms/WKTextSuggestionButton.mm: Removed.
3017         * WebKit.xcodeproj/project.pbxproj:
3018
3019 2018-04-03  Ross Kirsling  <ross.kirsling@sony.com>
3020
3021         Xcode prepends line comments from WTF/Compiler.h to *.sb files
3022         https://bugs.webkit.org/show_bug.cgi?id=184166
3023
3024         Reviewed by Brent Fulgham.
3025
3026         * DerivedSources.make:
3027         Strip ;-comments from *.sb.in files before preprocessing so we can stop treating Platform.h/Compiler.h as C89.
3028
3029 2018-04-03  Chris Dumez  <cdumez@apple.com>
3030
3031         Drop MainFrame class
3032         https://bugs.webkit.org/show_bug.cgi?id=184191
3033
3034         Reviewed by Darin Adler.
3035
3036         Drop MainFrame class and move contents into Page / Frame since there is a 1:1
3037         relationship between the Page and the MainFrame.
3038
3039         This is ground work for introducing LocalFrame / RemoteFrame concepts.
3040
3041         * Shared/WebRenderLayer.cpp:
3042         * Shared/WebRenderObject.cpp:
3043         * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
3044         (WebKit::WebPaymentCoordinator::paymentCoordinator):
3045         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3046         * WebProcess/FullScreen/WebFullScreenManager.cpp:
3047         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
3048         (WKBundlePageInstallPageOverlay):
3049         (WKBundlePageUninstallPageOverlay):
3050         (WKBundlePageInstallPageOverlayWithAnimation):
3051         (WKBundlePageUninstallPageOverlayWithAnimation):
3052         * WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:
3053         * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm:
3054         * WebProcess/InjectedBundle/InjectedBundle.cpp:
3055         * WebProcess/Plugins/PDF/PDFPlugin.mm:
3056         * WebProcess/Plugins/PluginView.cpp:
3057         * WebProcess/Plugins/WebPluginInfoProvider.cpp:
3058         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3059         * WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
3060         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3061         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
3062         (WebKit::WebInspectorClient::~WebInspectorClient):
3063         (WebKit::WebInspectorClient::highlight):
3064         (WebKit::WebInspectorClient::hideHighlight):
3065         (WebKit::WebInspectorClient::showPaintRect):
3066         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
3067         * WebProcess/WebCoreSupport/WebProgressTrackerClient.cpp:
3068         * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
3069         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
3070         * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
3071         * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
3072         * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
3073         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
3074         * WebProcess/WebPage/FindController.cpp:
3075         (WebKit::FindController::updateFindUIAfterPageScroll):
3076         (WebKit::FindController::hideFindUI):
3077         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3078         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
3079         (WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
3080         * WebProcess/WebPage/WKAccessibilityWebPageObjectIOS.mm:
3081         * WebProcess/WebPage/WebBackForwardListProxy.cpp:
3082         * WebProcess/WebPage/WebFrame.cpp:
3083         * WebProcess/WebPage/WebInspector.cpp:
3084         * WebProcess/WebPage/WebInspectorFrontendAPIDispatcher.cpp:
3085         * WebProcess/WebPage/WebPage.cpp:
3086         (WebKit::WebPage::mainFrame const):
3087         (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
3088         (WebKit::WebPage::plugInIntersectsSearchRect):
3089         * WebProcess/WebPage/WebPage.h:
3090         * WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp:
3091         * WebProcess/WebPage/ios/FindControllerIOS.mm:
3092         * WebProcess/WebPage/ios/WebPageIOS.mm:
3093         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3094         (WebKit::TiledCoreAnimationDrawingArea::updatePreferences):
3095         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
3096         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3097         (-[WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames]):
3098         (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]):
3099         * WebProcess/WebPage/mac/WebPageMac.mm:
3100         (WebKit::WebPage::performImmediateActionHitTestAtLocation):
3101         (WebKit::WebPage::dataDetectorsDidPresentUI):
3102         (WebKit::WebPage::dataDetectorsDidChangeUI):
3103         (WebKit::WebPage::dataDetectorsDidHideUI):
3104         * WebProcess/WebProcess.cpp:
3105         * WebProcess/WebStorage/StorageAreaMap.cpp:
3106
3107 2018-04-03  Youenn Fablet  <youenn@apple.com>
3108
3109         Make NetworkProcess get ContentBlocker information from UIProcess
3110         https://bugs.webkit.org/show_bug.cgi?id=184205
3111
3112         Reviewed by Alex Christensen.
3113
3114         Make NetworkProcess get content blockers from UIProcess directly.
3115         Before that patch, WebProcess sent content blockers to NetworkProcess for each PingLoad.
3116         Instead, WebProcess sends the content blocker identifier for each PingLoad and NetworkProcess fetches the content blocker once.
3117
3118         This is both more efficient than passing them for each PingLoad and safer in the sense
3119         that a compromised WebProcess will not be able to bypass any of these.
3120         In the future, NetworkProcess should get the content blocker identifier directly from the WebPageID attached to the request.
3121
3122         Covered by existing beacon+content blocker tests.
3123
3124         Did some refactoring to add a typed content blocker identifier.
3125         Once NetworkProcess fetches a given content blocker, the content blocker will send any modification to NetworkProcess.
3126         Introduced NetworkContentRuleListManager to handle the content blockers in NetworkProcess.
3127
3128         * CMakeLists.txt:
3129         * DerivedSources.make:
3130         * NetworkProcess/NetworkLoadChecker.cpp:
3131         (WebKit::NetworkLoadChecker::checkRequest):
3132         (WebKit::NetworkLoadChecker::continueCheckingRequest):
3133         (WebKit::NetworkLoadChecker::processContentExtensionRulesForLoad):
3134         * NetworkProcess/NetworkLoadChecker.h:
3135         (WebKit::NetworkLoadChecker::setContentExtensionController):
3136         * NetworkProcess/NetworkProcess.cpp:
3137         (WebKit::NetworkProcess::didReceiveMessage):
3138         * NetworkProcess/NetworkProcess.h:
3139         (WebKit::NetworkProcess::networkUserContentController):
3140         * NetworkProcess/NetworkResourceLoadParameters.cpp:
3141         (WebKit::NetworkResourceLoadParameters::encode const):
3142         (WebKit::NetworkResourceLoadParameters::decode):
3143         * NetworkProcess/NetworkResourceLoadParameters.h:
3144         * NetworkProcess/NetworkContentRuleListManager.cpp: Added.
3145         (WebKit::NetworkContentRuleListManager::contentExtensionsBackend):
3146         (WebKit::NetworkContentRuleListManager::addContentRuleLists):
3147         (WebKit::NetworkContentRuleListManager::removeContentRuleList):
3148         (WebKit::NetworkContentRuleListManager::removeAllContentRuleLists):
3149         (WebKit::NetworkContentRuleListManager::remove):
3150         * NetworkProcess/NetworkContentRuleListManager.h: Added.
3151         * NetworkProcess/NetworkContentRuleListManager.messages.in: Added.
3152         * NetworkProcess/PingLoad.cpp:
3153         * Scripts/webkit/messages.py:
3154         * Shared/UserContentControllerIdentifier.h: Added.
3155         * Shared/WebPageCreationParameters.cpp:
3156         (WebKit::WebPageCreationParameters::decode):
3157         * Shared/WebPageCreationParameters.h:
3158         * Shared/WebPageGroupData.cpp:
3159         (WebKit::WebPageGroupData::decode):
3160         * Shared/WebPageGroupData.h:
3161         * UIProcess/Network/NetworkProcessProxy.cpp:
3162         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
3163         (WebKit::NetworkProcessProxy::contentExtensionRules):
3164         (WebKit::NetworkProcessProxy::didDestroyWebUserContentControllerProxy):
3165         * UIProcess/Network/NetworkProcessProxy.h:
3166         * UIProcess/Network/NetworkProcessProxy.messages.in:
3167         * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
3168         (WebKit::WebUserContentControllerProxy::get):
3169         (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
3170         (WebKit::WebUserContentControllerProxy::~WebUserContentControllerProxy):
3171         (WebKit::WebUserContentControllerProxy::addProcess):
3172         (WebKit::WebUserContentControllerProxy::removeProcess):
3173         (WebKit::WebUserContentControllerProxy::addUserContentWorldUse):
3174         (WebKit::WebUserContentControllerProxy::removeUserContentWorldUses):
3175         (WebKit::WebUserContentControllerProxy::addUserScript):
3176         (WebKit::WebUserContentControllerProxy::removeUserScript):
3177         (WebKit::WebUserContentControllerProxy::removeAllUserScripts):
3178         (WebKit::WebUserContentControllerProxy::addUserStyleSheet):
3179         (WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
3180         (WebKit::WebUserContentControllerProxy::removeAllUserStyleSheets):
3181         (WebKit::WebUserContentControllerProxy::addUserScriptMessageHandler):
3182         (WebKit::WebUserContentControllerProxy::removeUserMessageHandlerForName):
3183         (WebKit::WebUserContentControllerProxy::removeAllUserMessageHandlers):
3184         (WebKit::WebUserContentControllerProxy::addContentRuleList):
3185         (WebKit::WebUserContentControllerProxy::removeContentRuleList):
3186         (WebKit::WebUserContentControllerProxy::removeAllContentRuleLists):
3187         * UIProcess/UserContent/WebUserContentControllerProxy.h:
3188         (WebKit::WebUserContentControllerProxy::create):
3189         (WebKit::WebUserContentControllerProxy::addNetworkProcess):
3190         (WebKit::WebUserContentControllerProxy::removeNetworkProcess):
3191         (WebKit::WebUserContentControllerProxy::contentExtensionRules):
3192         (WebKit::WebUserContentControllerProxy::identifier const):
3193         * WebKit.xcodeproj/project.pbxproj:
3194         * WebProcess/Network/WebLoaderStrategy.cpp:
3195         (WebKit::WebLoaderStrategy::startPingLoad):
3196         * WebProcess/UserContent/WebUserContentController.cpp:
3197         (WebKit::WebUserContentController::getOrCreate):
3198         (WebKit::WebUserContentController::WebUserContentController):
3199         (WebKit::WebUserContentController::~WebUserContentController):
3200         * WebProcess/UserContent/WebUserContentController.h:
3201         * WebProcess/WebPage/WebPage.h:
3202         (WebKit::WebPage::userContentControllerIdentifier const):
3203
3204 2018-04-02  Beth Dakin  <bdakin@apple.com>
3205
3206         Fix the managed configurations build
3207         https://bugs.webkit.org/show_bug.cgi?id=184253
3208         -and corresponding-
3209         rdar://problem/39078586
3210
3211         Reviewed by Dan Bernstein.
3212
3213         * UIProcess/ios/WKContentViewInteraction.mm:
3214         (-[WKContentView canPerformActionForWebView:withSender:]):
3215         (-[WKContentView _defineForWebView:]):
3216
3217 2018-04-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3218
3219         [Enchant] Clean up TextCheckerEnchant
3220         https://bugs.webkit.org/show_bug.cgi?id=184233
3221
3222         Reviewed by Michael Catanzaro.
3223
3224         Use TextCheckerEnchant as a singleton now, instead of implementing the singleton here.
3225
3226         * UIProcess/gtk/TextCheckerGtk.cpp:
3227         (WebKit::TextChecker::checkSpellingOfString):
3228         (WebKit::TextChecker::getGuessesForWord):
3229         (WebKit::TextChecker::learnWord):
3230         (WebKit::TextChecker::ignoreWord):
3231         (WebKit::TextChecker::setSpellCheckingLanguages):
3232         (WebKit::TextChecker::loadedSpellCheckingLanguages):
3233         (WebKit::enchantTextChecker): Deleted.
3234
3235 2018-04-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3236
3237         [GTK] NetworkProcess from WebKitGtk+ 2.19.9x SIGSEVs in NetworkStorageSession (secret search callback)
3238         https://bugs.webkit.org/show_bug.cgi?id=183346
3239
3240         Reviewed by Michael Catanzaro.
3241
3242         Pass the request cancellable to NetworkStorageSession::getCredentialFromPersistentStorage().
3243
3244         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
3245         (WebKit::NetworkDataTaskSoup::authenticate):
3246
3247 2018-04-02  Brady Eidson  <beidson@apple.com>
3248
3249         Process swapping on navigation needs to handle server redirects.
3250         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
3251
3252         Reviewed by Alex Christensen.
3253
3254         The same rules we apply to process swapping for basic navigations need to apply
3255         to server redirects as well.
3256
3257         There's three interesting cases we need to support that are covered by new API tests:
3258         1 - The initial load in a WKWebView redirects cross-origin.
3259         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
3260         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
3261
3262         Supporting all 3 of these brought their own little challenges.
3263
3264         By teaching Navigation objects more about redirects I was able to support all 3 cases.
3265
3266         * UIProcess/API/APINavigation.cpp:
3267         (API::Navigation::Navigation):
3268         (API::Navigation::setCurrentRequest):
3269         (API::Navigation::appendRedirectionURL):
3270         (API::Navigation::loggingString const):
3271         (API::Navigation::loggingURL const): Deleted.
3272         * UIProcess/API/APINavigation.h:
3273         (API::Navigation::originalRequest const):
3274         (API::Navigation::currentRequest const):
3275         (API::Navigation::currentRequestProcessIdentifier const):
3276         (API::Navigation::setCurrentRequestIsRedirect):
3277         (API::Navigation::currentRequestIsRedirect const):
3278         (API::Navigation::request const): Deleted.
3279
3280         * UIProcess/API/Cocoa/WKNavigation.mm:
3281         (-[WKNavigation _request]):
3282
3283         * UIProcess/WebPageProxy.cpp:
3284         (WebKit::WebPageProxy::receivedPolicyDecision):
3285         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
3286           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
3287         (WebKit::WebPageProxy::didCreateMainFrame):
3288         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
3289           cross-origin redirect that is just starting back up in a new WebProcess.
3290         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3291         (WebKit::WebPageProxy::didCommitLoadForFrame):
3292         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3293         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
3294           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
3295         * UIProcess/WebPageProxy.h:
3296         * UIProcess/WebPageProxy.messages.in:
3297
3298         * UIProcess/WebProcessPool.cpp:
3299         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
3300           be used to continue a navigation.
3301         * UIProcess/WebProcessPool.h:
3302
3303         * UIProcess/WebProcessProxy.h:
3304         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
3305         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
3306
3307         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3308         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
3309         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3310
3311 2018-04-02  Eric Carlson  <eric.carlson@apple.com>
3312
3313         [Extra zoom mode] Replace video with a placeholder image during fullscreen transition
3314         https://bugs.webkit.org/show_bug.cgi?id=184188
3315         <rdar://problem/38940307>
3316
3317         Reviewed by Youenn Fablet.
3318
3319         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
3320         * UIProcess/Cocoa/VideoFullscreenManagerProxy.messages.in:
3321         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
3322         (WebKit::VideoFullscreenModelContext::willExitFullscreen):
3323         (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen):
3324         (WebKit::VideoFullscreenManagerProxy::willExitFullscreen):
3325         * WebProcess/cocoa/VideoFullscreenManager.h:
3326         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
3327         * WebProcess/cocoa/VideoFullscreenManager.mm:
3328         (WebKit::VideoFullscreenManager::willExitFullscreen):
3329
3330 2018-04-02  Brian Burg  <bburg@apple.com>
3331
3332         [Cocoa] Fix some internal builds that consume WebDriver atoms
3333         https://bugs.webkit.org/show_bug.cgi?id=184197
3334
3335         Reviewed by Dan Bernstein.
3336
3337         * WebKit.xcodeproj/project.pbxproj:
3338         Use a Run Script phase to copy WebDriver atoms to WebKit.framework
3339         private headers during the installhdrs phase.
3340
3341 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
3342
3343         Unreviewed, rolling out r230174.
3344
3345         Caused LayoutTests to exit early with assertion failures.
3346
3347         Reverted changeset:
3348
3349         "Process swapping on navigation needs to handle server
3350         redirects."
3351         https://bugs.webkit.org/show_bug.cgi?id=184142
3352         https://trac.webkit.org/changeset/230174
3353
3354 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3355
3356         [Extra zoom mode] Update date picker UI to latest specifications
3357         https://bugs.webkit.org/show_bug.cgi?id=184234
3358         <rdar://problem/38804760>
3359
3360         Reviewed by Timothy Hatcher.
3361
3362         Rename WKTextFormControlListViewControllerDelegate to WKTextInputListViewControllerDelegate and adjust for the
3363         new initializer of WKDatePickerViewController.
3364
3365         * UIProcess/ios/WKContentViewInteraction.mm:
3366         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3367
3368 2018-04-02  Brady Eidson  <beidson@apple.com>
3369
3370         Process swapping on navigation needs to handle server redirects.
3371         <rdar://problem/38690465> and https://bugs.webkit.org/show_bug.cgi?id=184142
3372
3373         Reviewed by Alex Christensen.
3374
3375         The same rules we apply to process swapping for basic navigations need to apply
3376         to server redirects as well.
3377
3378         There's three interesting cases we need to support that are covered by new API tests:
3379         1 - The initial load in a WKWebView redirects cross-origin.
3380         2 - A WKWebView is showing content from a.com, we start a load to b.com, and that redirects to c.com
3381         3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com.
3382
3383         Supporting all 3 of these brought their own little challenges.
3384
3385         By teaching Navigation objects more about redirects I was able to support all 3 cases.
3386
3387         * UIProcess/API/APINavigation.cpp:
3388         (API::Navigation::Navigation):
3389         (API::Navigation::setCurrentRequest):
3390         (API::Navigation::appendRedirectionURL):
3391         (API::Navigation::loggingString const):
3392         (API::Navigation::loggingURL const): Deleted.
3393         * UIProcess/API/APINavigation.h:
3394         (API::Navigation::originalRequest const):
3395         (API::Navigation::currentRequest const):
3396         (API::Navigation::currentRequestProcessIdentifier const):
3397         (API::Navigation::setCurrentRequestIsRedirect):
3398         (API::Navigation::currentRequestIsRedirect const):
3399         (API::Navigation::request const): Deleted.
3400
3401         * UIProcess/API/Cocoa/WKNavigation.mm:
3402         (-[WKNavigation _request]):
3403
3404         * UIProcess/WebPageProxy.cpp:
3405         (WebKit::WebPageProxy::receivedPolicyDecision):
3406         (WebKit::WebPageProxy::continueNavigationInNewProcess): If this continued navigation is currently in a server
3407           redirect, save off a lambda to synthesize a "did receive server redirect" callback once the new WebProcess is running.
3408         (WebKit::WebPageProxy::didCreateMainFrame):
3409         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): Possibly ignore this notification if it is really a
3410           cross-origin redirect that is just starting back up in a new WebProcess.
3411         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
3412         (WebKit::WebPageProxy::didCommitLoadForFrame):
3413         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3414         (WebKit::WebPageProxy::resetStateAfterProcessExited): Do not clear pageLoadState if the process is exitting for
3415           a navigation swap, as we will need to pick up where we left off when the load continues in a new WebProcess.
3416         * UIProcess/WebPageProxy.h:
3417         * UIProcess/WebPageProxy.messages.in:
3418
3419         * UIProcess/WebProcessPool.cpp:
3420         (WebKit::WebProcessPool::processForNavigation): If a process has never committed any provisional load, it can always
3421           be used to continue a navigation.
3422         * UIProcess/WebProcessPool.h:
3423
3424         * UIProcess/WebProcessProxy.h:
3425         (WebKit::WebProcessProxy::didCommitProvisionalLoad):
3426         (WebKit::WebProcessProxy::hasCommittedAnyProvisionalLoads const):
3427
3428         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3429         (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
3430         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3431
3432 2018-04-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3433
3434         [Extra zoom mode] Zoom level is sometimes excessive when zooming to focused form controls
3435         https://bugs.webkit.org/show_bug.cgi?id=184222
3436         <rdar://problem/39063886>
3437
3438         Reviewed by Timothy Hatcher.
3439
3440         Upon interactively focusing an element, we zoom and scroll to reveal that element. The heuristics introduced in
3441         <https://trac.webkit.org/r168744> work by computing a target scale, and then a point to zoom to given that
3442         scale. Currently, this scale is dependent on the computed font size of the form control, such that the form
3443         control would be scaled to have an effective font size of 16.
3444
3445         However, in extra zoom mode, applying these same heuristics (ironically) results in excessive zoom levels, since
3446         scaling the font up to 16 would cause most form controls to zoom so far in that we lose context of surrounding
3447         elements such as labels and other form controls; the fact that the element is highlighted by the focused form
3448         control overlay makes this even more confusing, since part of the focus overlay highlight rect often ends up
3449         outside the viewport.
3450
3451         To fix this, we make a couple of tweaks to focus rect zooming in extra zoom mode. (1) Instead of computing
3452         target zoom level based on font size, try to zoom such that the focused element rect fills up most of the
3453         viewport (similar to double-tap zooming). This ensures that the focused form control overlay's highlight rect
3454         makes sense in most cases, with few exceptions (e.g. the element frame is larger than the viewport). (2)
3455         Introduce a minimum legible font size of 11, and compute the minimium scale needed such that the form control
3456         font would appear to be at least this legible font size. Then, clamp the target scale chosen by (1) to this
3457         minimum scale.
3458
3459         One additional consideration for (1) is that naively scaling to fit the element rect to the viewport (with some
3460         fixed margins) would cause the viewport scale to always change when moving focus between form controls of
3461         different dimensions, even if the current scale is more or less appropriate for all the focusable elements. To
3462         address this, instead of computing a single target zoom scale for an element rect, compute a range of possible
3463         target zoom scales (where the minimum and maximum values depend on the margin we add around the element rect).
3464         If the current scale already falls within this target scale range, then we won't bother adjusting the scale at
3465         all (unless the font size is too small — see (2)). If the current scale falls outside the target scale range, we
3466         then make the minimal adjustment needed to ensure that the element rect fits well within the viewport without
3467         being too small.
3468
3469         * UIProcess/API/Cocoa/WKWebView.mm:
3470         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
3471
3472         Move some logic around so that the target scale is computed after computing the visible size. Also renames some
3473         constants local to this function (WKWebViewStandardFontSize, kMinimumHeightToShowContentAboveKeyboard,
3474         UIWebFormAnimationDuration, CaretOffsetFromWindowEdge) such that they now share a consistent naming style.
3475
3476 2018-04-02  Jer Noble  <jer.noble@apple.com>
3477
3478         Enable Legacy EME for all WebKit & WebKitLegacy clients
3479         https://bugs.webkit.org/show_bug.cgi?id=184018
3480         <rdar://problem/34887387>
3481
3482         Reviewed by Eric Carlson.
3483
3484         * Shared/WebPreferences.yaml:
3485         * Shared/WebPreferencesDefaultValues.h:
3486
3487 2018-04-02  Jer Noble  <jer.noble@apple.com>
3488
3489         REGRESSION (229680): Fullscreen video does not work (youtube, netflix)
3490         https://bugs.webkit.org/show_bug.cgi?id=184235
3491
3492         Reviewed by Eric Carlson.
3493
3494         Enable the Fullscreen API by default.
3495
3496         * Shared/WebPreferences.yaml:
3497         * Shared/WebPreferencesDefaultValues.h:
3498
3499 2018-04-02  Fujii Hironori  <Hironori.Fujii@sony.com>
3500
3501         [Win] MSVC can't compile WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent
3502         https://bugs.webkit.org/show_bug.cgi?id=184120
3503
3504         Reviewed by Alex Christensen.
3505
3506         It seems that MSVC can't compile the code using `this` in a
3507         generalized lambda capture in another lambda.
3508
3509         In this case, there is no need to copy `protectedThis` for the
3510         inner lambda. Move `protectedThis` of the outer lambda to the
3511         inner as well as `callback`.
3512
3513         * UIProcess/WebResourceLoadStatisticsStore.cpp:
3514         (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
3515         Moved `protectedThis` from the outer lambda to the inner.
3516
3517 2018-04-02  Dan Bernstein  <mitz@apple.com>
3518
3519         Build fix after r230121
3520
3521         * Configurations/WebKit.xcconfig: Disabled framework header postprocessing when building for
3522           iOS 11.*
3523         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Reverted r230159.
3524
3525 2018-04-02  Dan Bernstein  <mitz@apple.com>
3526
3527         Fixed the build when BOOL is not bool.
3528         <rdar://problem/39094484>
3529
3530         Reviewed by Jer Noble.
3531
3532         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
3533         (-[WKFullScreenViewController videoControlsManagerDidChange]): Removed the write-only ivar
3534           _hasControlsManager, the assignment to which was causing the compiler error.
3535
3536 2018-04-02  Ryan Haddad  <ryanhaddad@apple.com>
3537
3538         Unreviewed build fix.
3539
3540         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h: Update availability annotation.
3541
3542 2018-04-02  Michael Catanzaro  <mcatanzaro@igalia.com>
3543
3544         [GTK] DragAndDropHandler.cpp should include GUniquePtrGtk.h
3545         https://bugs.webkit.org/show_bug.cgi?id=184119
3546
3547         Reviewed by Daniel Bates.
3548
3549         * UIProcess/gtk/DragAndDropHandler.cpp:
3550
3551 2018-04-02  Frederic Wang  <fwang@igalia.com>
3552
3553         Fix warnings for unused lambda captures in Source/WebKit
3554         https://bugs.webkit.org/show_bug.cgi?id=173555
3555
3556         Reviewed by Konstantin Tokarev.
3557
3558         When release logs are disabled, several lambda captures are unused, causing compilation
3559         failures with -Wunused-lambda-capture. This patch marks the corresponding variables as unused
3560         in order to fix these warnings.
3561
3562         Based on initial patch by: Konstantin Tokarev  <annulen@yandex.ru>
3563
3564         * NetworkProcess/NetworkResourceLoader.cpp:
3565         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3566         * UIProcess/Network/NetworkProcessProxy.cpp:
3567         (WebKit::NetworkProcessProxy::fetchWebsiteData):
3568         (WebKit::NetworkProcessProxy::deleteWebsiteData):
3569         (WebKit::NetworkProcessProxy::deleteWebsiteDataForOrigins):
3570         * UIProcess/WebProcessProxy.cpp:
3571         (WebKit::WebProcessProxy::fetchWebsiteData):
3572         (WebKit::WebProcessProxy::deleteWebsiteData):
3573         (WebKit::WebProcessProxy::deleteWebsiteDataForOrigins):
3574         * UIProcess/ios/WKContentViewInteraction.mm:
3575         (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
3576
3577 2018-04-02  Alejandro G. Castro  <alex@igalia.com>
3578
3579         [GTK] Make libwebrtc backend buildable for GTK  port
3580         https://bugs.webkit.org/show_bug.cgi?id=178860
3581
3582         Reviewed by Youenn Fablet.
3583
3584         * CMakeLists.txt: Add RTC network classes to the compilation and
3585         the libwebrtc includes.
3586         * PlatformGTK.cmake: Add the libwebrtc directory.
3587         * SourcesGTK.txt: Add RTC files to the compilation.
3588
3589 2018-03-30  Chris Dumez  <cdumez@apple.com>
3590
3591         REGRESSION (r229828): Facebook login popup is blank
3592         https://bugs.webkit.org/show_bug.cgi?id=184206
3593         <rdar://problem/39057006>
3594
3595         Reviewed by Wenson Hsieh.
3596
3597         Add assertion to make sure we never try to do a policy check to
3598         a resource response while a policy check for a navigation is
3599         pending. This assertion was being hit by several of our redirection
3600         tests without my fix.
3601
3602         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3603         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3604
3605 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
3606
3607         Unreviewed, rolling out r230125.
3608
3609         Build fix broke more builds.
3610
3611         Reverted changeset:
3612
3613         "Unreviewed build fix, remove unused lambda capture."
3614         https://trac.webkit.org/changeset/230125
3615
3616 2018-03-30  Ryan Haddad  <ryanhaddad@apple.com>
3617
3618         Unreviewed build fix, remove unused lambda capture.
3619
3620         * NetworkProcess/NetworkResourceLoader.cpp:
3621         (WebKit::NetworkResourceLoader::retrieveCacheEntry):
3622
3623 2018-03-30  Wenson Hsieh  <wenson_hsieh@apple.com>
3624
3625         [Extra zoom mode] Adopt list view controller UI for numeric input types
3626         https://bugs.webkit.org/show_bug.cgi?id=184184
3627         <rdar://problem/37238916>
3628
3629         Reviewed by Timothy Hatcher.
3630
3631         Remove existing logic for presenting a number pad view controller, since number pads will now be handled as a
3632         special case of general text form controls in extra zoom mode.
3633
3634         * UIProcess/ios/WKContentViewInteraction.h:
3635         * UIProcess/ios/WKContentViewInteraction.mm:
3636         (-[WKContentView presentViewControllerForCurrentAssistedNode]):
3637         (-[WKContentView dismissAllInputViewControllers]):
3638         (-[WKContentView _wheelChangedWithEvent:]):
3639
3640 2018-03-30  Dan Bernstein  <mitz@apple.com>
3641
3642         Update availability annotations to match the macOS 10.13.4 and iOS 11.3 GM SDKs
3643         https://bugs.webkit.org/show_bug.cgi?id=184173
3644
3645         Reviewed by Alex Christensen.
3646
3647         Changed WK_MAC_TBA and WK_IOS_TBA to 10.13.4 and 11.3, respectively, in all declarations that
3648         appear in the GM SDKs.
3649
3650         * Shared/API/Cocoa/_WKNSWindowExtras.h:
3651         * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
3652         * UIProcess/API/Cocoa/WKOpenPanelParameters.h:
3653         * UIProcess/API/Cocoa/WKOpenPanelParametersPrivate.h:
3654         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3655         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
3656         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3657         * UIProcess/API/Cocoa/WKViewPrivate.h:
3658         * UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
3659         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3660         * UIProcess/API/Cocoa/WKWebsiteDataRecord.h:
3661         * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
3662         * UIProcess/API/Cocoa/_WKApplicationManifest.h:
3663         * UIProcess/API/Cocoa/_WKAttachment.h:
3664         * UIProcess/API/Cocoa/_WKAutomationSession.h:
3665         * UIProcess/API/Cocoa/_WKAutomationSessionConfiguration.h:
3666         * UIProcess/API/Cocoa/_WKDownload.h:
3667         * UIProcess/API/Cocoa/_WKDownloadDelegate.h:
3668         * UIProcess/API/Cocoa/_WKFocusedElementInfo.h:
3669         * UIProcess/API/Cocoa/_WKFullscreenDelegate.h:
3670         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
3671         * UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
3672         * UIProcess/API/Cocoa/_WKVisitedLinkStore.h:
3673         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
3674         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
3675         * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h:
3676         * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h:
3677
3678 2018-03-30  Youenn Fablet  <youenn@apple.com>
3679
3680         NetworkLoadChecker should upgrade redirects if needed
3681         https://bugs.webkit.org/show_bug.cgi?id=184098
3682
3683         Reviewed by Chris Dumez.
3684
3685         In case of redirections, upgrade URL according CSP.
3686
3687         * NetworkProcess/NetworkLoadChecker.cpp:
3688         (WebKit::NetworkLoadChecker::checkRequest):
3689         (WebKit::NetworkLoadChecker::contentSecurityPolicy const):
3690
3691 2018-03-30  JF Bastien  <jfbastien@apple.com>
3692
3693         Update messages.py codegen for String, fix tests
3694         https://bugs.webkit.org/show_bug.cgi?id=184179
3695         <rdar://problem/39041352>
3696
3697         Reviewed by Mark Lam.
3698
3699         I updated some of the code in
3700         https://trac.webkit.org/changeset/230097 and auto-magically used a
3701         script to update copyright headers... and that broke the tests
3702         which checked for a particular date. Update all of the headers.
3703
3704         Part of this change updates the code generated by messages.py
3705
3706         * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
3707         * Scripts/webkit/MessageReceiver-expected.cpp:
3708         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
3709         * Scripts/webkit/MessagesSuperclass-expected.h:
3710         * Scripts/webkit/messages.py:
3711         * Scripts/webkit/messages_unittest.py:
3712         (GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
3713         generate a better error message
3714
3715 2018-03-29  JF Bastien  <jfbastien@apple.com>
3716
3717         Use Forward.h instead of forward-declaring WTF::String
3718         https://bugs.webkit.org/show_bug.cgi?id=184172
3719         <rdar://problem/39026146>
3720
3721         Reviewed by Yusuke Suzuki.
3722
3723         As part of #184164 I'm changing WTF::String, and the forward
3724         declarations are just wrong because I'm making it templated. We
3725         should use Forward.h anyways, so do that instead.
3726
3727         * Scripts/webkit/LegacyMessages-expected.h:
3728         * Scripts/webkit/Messages-expected.h:
3729         * Scripts/webkit/MessagesSuperclass-expected.h:
3730         * UIProcess/WebOpenPanelResultListenerProxy.h:
3731
3732 2018-03-29  Brian Burg  <bburg@apple.com>
3733
3734         Web Automation: clipToViewport is ignored for element screenshots
3735         https://bugs.webkit.org/show_bug.cgi?id=184158
3736         <rdar://problem/39014307>
3737
3738         Reviewed by Timothy Hatcher.
3739
3740         In §19.2 Take Element Screenshot, step 5.2 says that we should clip
3741         the element screenshot rect with the visible viewport rect. We don't
3742         do that right now even though we pass over clipToViewport.
3743
3744         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
3745         (WebKit::snapshotRectForScreenshot):
3746         Clip the rect to viewport if needed.
3747
3748         (WebKit::WebAutomationSessionProxy::takeScreenshot):
3749         This scrollIntoView is misplaced; by this point we have already done
3750         the math to figure out the screenshot rect. Move it before computing the rect.
3751
3752 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
3753
3754         REGRESSION(r230035): ASSERT(MACH_PORT_VALID(m_sendPort)) hit in IPC::Connection::initializeSendSource()
3755         https://bugs.webkit.org/show_bug.cgi?id=184122
3756         <rdar://problem/39003606>
3757
3758         Reviewed by Chris Dumez.
3759
3760         One of the new assertions added in r230035 begin firing while running tests locally. This was happening
3761         because the WebInspector was attempting to open a new connection to a web process that had already
3762         terminated its mach port connection (a dead port).
3763         
3764         We should avoid opening new connections when the port we were given is already dead.
3765
3766         * Platform/IPC/Connection.h:
3767         (IPC::Connection::identifierIsValid): Added.
3768         * Platform/IPC/mac/ConnectionMac.mm:
3769         (IPC::Connection::platformInitialize): Do not perform initialization on a dead (or null) port.
3770         (IPC::Connection::open): Add some assertions that ports are in a valid state.
3771         (IPC::Connection::sendOutgoingMessage): Assert that the send port is not dead.
3772         (IPC::Connection::receiveSourceEventHandler): Assert that the receive port is valid.
3773         * UIProcess/ChildProcessProxy.cpp:
3774         (WebKit::ChildProcessProxy::didFinishLaunching): Treat a dead port as a signal that the
3775         child process failed to launch.
3776         * UIProcess/Network/NetworkProcessProxy.cpp:
3777         (WebKit::NetworkProcessProxy::didFinishLaunching): Ditto.
3778         * UIProcess/Plugins/PluginProcessProxy.cpp:
3779         (WebKit::PluginProcessProxy::didFinishLaunching): Ditto.
3780         * UIProcess/Storage/StorageProcessProxy.cpp:
3781         (WebKit::StorageProcessProxy::didFinishLaunching): Ditto.
3782         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
3783         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection): Ditto.
3784         * WebProcess/WebPage/WebInspectorUI.cpp:
3785         (WebKit::WebInspectorUI::establishConnection): Ditto.
3786         * WebProcess/WebProcess.cpp:
3787         (WebKit::WebProcess::ensureNetworkProcessConnection): Ditto.
3788         (WebKit::WebProcess::ensureWebToStorageProcessConnection): Ditto.
3789
3790 2018-03-29  Youenn Fablet  <youenn@apple.com>
3791
3792         Synchronize SecurityOrigin related scheme registries with NetworkProcess
3793         https://bugs.webkit.org/show_bug.cgi?id=184140
3794
3795         Reviewed by Chris Dumez.
3796
3797         Add syncing of scheme registries that are used by SecurityOrigin and ContentSecurityPolicy
3798         so that we can properly use them in NetworkProcess as we do in WebProcess.
3799         The registries that are not synced are:
3800         - URLSchemeAsEmptyDocument
3801         - URLSchemeDomainRelaxationForbidden
3802         - URLSchemeAsCachePartitioned
3803         - URLSchemeAsCanDisplayOnlyIfCanRequest
3804
3805         * NetworkProcess/NetworkProcess.cpp:
3806         (WebKit::NetworkProcess::initializeNetworkProcess):
3807         (WebKit::NetworkProcess::registerURLSchemeAsSecure const):
3808         (WebKit::NetworkProcess::registerURLSchemeAsBypassingContentSecurityPolicy const):
3809         (WebKit::NetworkProcess::registerURLSchemeAsLocal const):
3810         (WebKit::NetworkProcess::registerURLSchemeAsNoAccess const):
3811         (WebKit::NetworkProcess::registerURLSchemeAsDisplayIsolated const):
3812         (WebKit::NetworkProcess::registerURLSchemeAsCORSEnabled const):
3813         (WebKit::NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest const):
3814         * NetworkProcess/NetworkProcess.h:
3815         * NetworkProcess/NetworkProcess.messages.in:
3816         * NetworkProcess/NetworkProcessCreationParameters.cpp:
3817         (WebKit::NetworkProcessCreationParameters::encode const):
3818         (WebKit::NetworkProcessCreationParameters::decode):
3819         * NetworkProcess/NetworkProcessCreationParameters.h:
3820         * UIProcess/WebProcessPool.cpp:
3821         (WebKit::WebProcessPool::ensureNetworkProcess):
3822         (WebKit::WebProcessPool::registerURLSchemeAsSecure):
3823         (WebKit::WebProcessPool::registerURLSchemeAsBypassingContentSecurityPolicy):
3824         (WebKit::WebProcessPool::registerURLSchemeAsLocal):
3825         (WebKit::WebProcessPool::registerURLSchemeAsNoAccess):
3826         (WebKit::WebProcessPool::registerURLSchemeAsDisplayIsolated):
3827         (WebKit::WebProcessPool::registerURLSchemeAsCORSEnabled):
3828         (WebKit::WebProcessPool::registerURLSchemeAsCanDisplayOnlyIfCanRequest):
3829
3830 2018-03-29  Brent Fulgham  <bfulgham@apple.com>
3831
3832         REGRESSION(r229480): ERROR: Unhandled web process message 'WebCookieManager:SetHTTPCookieAcceptPolicy'
3833         https://bugs.webkit.org/show_bug.cgi?id=184124
3834         <rdar://problem/38998971>
3835
3836         Reviewed by Chris Dumez.
3837
3838         Cookie accept policy messages were still being sent to the WebContent process after
3839         I removed cookie access in r229480. The WebContent process no longer recognizes these
3840         messages, and generates logging to that effect.
3841         
3842         This patch stops sending these unnecessary messages to the WebContent process. Only the
3843         Network process needs to receive this information.
3844
3845         * UIProcess/WebCookieManagerProxy.cpp:
3846         (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
3847
3848 2018-03-29  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
3849
3850         [WPE] Floating point exception in WebEventFactory::createWebWheelEvent
3851         https://bugs.webkit.org/show_bug.cgi?id=184037
3852
3853         Reviewed by Žan Doberšek.
3854
3855         * Shared/wpe/WebEventFactory.cpp:
3856         (WebKit::WebEventFactory::createWebWheelEvent): Use std::copysign() to avoid division by 0.
3857
3858 2018-03-28  Zalan Bujtas  <zalan@apple.com>
3859
3860         Make it possible to override the screen size
3861         https://bugs.webkit.org/show_bug.cgi?id=184111
3862         <rdar://problem/38972181>
3863
3864         Reviewed by Tim Horton.
3865
3866         * Shared/WebPageCreationParameters.cpp:
3867         (WebKit::WebPageCreationParameters::encode const):
3868         (WebKit::WebPageCreationParameters::decode):
3869         * Shared/WebPageCreationParameters.h:
3870         * UIProcess/WebPageProxy.cpp:
3871         (WebKit::WebPageProxy::creationParameters):
3872         * UIProcess/WebPageProxy.h:
3873         * UIProcess/ios/WebPageProxyIOS.mm:
3874         (WebKit::WebPageProxy::overrideScreenSize):
3875         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
3876         (WebKit::WebChromeClient::overrideScreenSize const):
3877         * WebProcess/WebCoreSupport/WebChromeClient.h:
3878         * WebProcess/WebPage/WebPage.cpp:
3879         * WebProcess/WebPage/WebPage.h:
3880         * WebProcess/WebPage/ios/WebPageIOS.mm:
3881         (WebKit::WebPage::overrideScreenSize const):
3882
3883 2018-03-28  Chris Dumez  <cdumez@apple.com>
3884
3885         Do process swap when opening a cross-origin URL via window.open(url, '_blank', 'noopener')
3886         https://bugs.webkit.org/show_bug.cgi?id=183962
3887         <rdar://problem/38817833>
3888
3889         Reviewed by Brady Eidson.
3890
3891         Swap WebProcess on for the initial navigation in a new Window that was opened
3892         via window.open(), when the new URL is cross-origin compared to the opener's
3893         origin. For now, we only swap process if 'noopener' property is set when calling
3894         window.open(). This is because we do not support the remote DOMWindows yet.
3895
3896         * Shared/NavigationActionData.cpp:
3897         (WebKit::NavigationActionData::encode const):
3898         (WebKit::NavigationActionData::decode):
3899         * Shared/NavigationActionData.h:
3900         * UIProcess/API/APINavigation.h:
3901         (API::Navigation::setIsCrossOriginWindowOpenNavigation):
3902         (API::Navigation::isCrossOriginWindowOpenNavigation const):
3903         (API::Navigation::setOpener):
3904         (API::Navigation::opener const):
3905         * UIProcess/WebPageProxy.cpp:
3906         (WebKit::WebPageProxy::receivedPolicyDecision):
3907         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3908         * UIProcess/WebProcessPool.cpp:
3909         (WebKit::WebProcessPool::processForNavigation):
3910         * UIProcess/WebProcessPool.h:
3911         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3912         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3913
3914 2018-03-28  Per Arne Vollan  <pvollan@apple.com>
3915
3916         Adopt WEBPROCESS_WINDOWSERVER_BLOCKING compiler guard in WebProcess.
3917         https://bugs.webkit.org/show_bug.cgi?id=183959
3918         <rdar://problem/38965719>
3919
3920         Reviewed by Brent Fulgham.
3921
3922         Use the compile guard to guard the call to CGSSetDenyWindowServerConnections.
3923
3924         * WebProcess/WebProcess.cpp:
3925         (WebKit::WebProcess::initializeProcess):
3926
3927 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
3928
3929         Unreviewed build fix after r230045.
3930
3931         * UIProcess/Launcher/mac/ProcessLauncherMac.mm: Add missing include (breaks iOS).
3932
3933 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
3934
3935         Protect against invalid mach ports returned by mach_port_request_notification
3936         https://bugs.webkit.org/show_bug.cgi?id=184106
3937         <rdar://problem/37865316>
3938
3939         Reviewed by Chris Dumez.
3940
3941         * Platform/IPC/Connection.h:
3942         (IPC::Connection::Identifier::Identifier): Use default initializer syntax.
3943         * Platform/IPC/mac/ConnectionMac.mm:
3944         (IPC::Connection::open): Drive-by-fix: Include formatted mach error message in logging.
3945         (IPC::Connection::receiveSourceEventHandler): Check return value from 'mach_port_request_notification'
3946         and clean up if it experienced an error.
3947         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
3948         (WebKit::ProcessLauncher::launchProcess): Ditto.
3949
3950 2018-03-28  Dean Jackson  <dino@apple.com>
3951
3952         WKWebViewContentProvider shouldn't be a UIScrollViewDelegate
3953         https://bugs.webkit.org/show_bug.cgi?id=184107
3954         <rdar://problem/38967492>
3955
3956         Reviewed by Tim Horton.
3957
3958         There is no need for this class to be a UIScrollViewDelegate. Instead
3959         the protocol should have an optional method that is effectively
3960         scrollViewDidScroll.
3961
3962         * UIProcess/API/Cocoa/WKWebView.mm:
3963         (-[WKWebView scrollViewDidScroll:]): Call web_scrollViewDidScroll
3964         if it exists.
3965         * UIProcess/Cocoa/WKWebViewContentProvider.h: Remove UIScrollViewDelegate
3966         and add an optional web_scrollViewDidScroll.
3967         * UIProcess/ios/WKPDFView.mm:
3968         (-[WKPDFView web_scrollViewDidScroll:]): Renamed from scrollViewDidScroll.
3969         (-[WKPDFView scrollViewDidScroll:]): Deleted.
3970         * UIProcess/ios/WKSystemPreviewView.mm:
3971         (-[WKSystemPreviewView scrollViewDidScroll:]): Deleted.
3972
3973 2018-03-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3974
3975         [Extra zoom mode] Make boosted text autosizing values switchable at runtime
3976         https://bugs.webkit.org/show_bug.cgi?id=184092
3977         <rdar://problem/38939917>
3978
3979         Reviewed by Tim Horton.
3980
3981         Add a private web view preference to switch between normal and boosted text autosizing mode. By default, we use
3982         normal text autosizing values.
3983
3984         * Shared/WebPreferences.yaml:
3985         * UIProcess/API/Cocoa/WKPreferences.mm:
3986         (-[WKPreferences _setShouldEnableTextAutosizingBoost:]):
3987         (-[WKPreferences _shouldEnableTextAutosizingBoost]):
3988         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
3989
3990 2018-03-28  Brent Fulgham  <bfulgham@apple.com>
3991
3992         Avoid uninitialized mach ports
3993         https://bugs.webkit.org/show_bug.cgi?id=184090
3994         <rdar://problem/37261129>
3995
3996         Reviewed by Chris Dumez.
3997
3998         It is possible for mach_port_allocate to return an error, but we rarely check its return value. The value
3999         of the argument passed to mach_port_allocate is not guaranteed to be valid when it returns an error, so
4000         there is a potential for us to try to use invalid ports.
4001
4002         We should always check return values, and ensure that the mach port variables we seek to initialize are
4003         kept in a valid state.
4004
4005         Reviewed by Chris Dumez.
4006