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