[WebKitLegacy] Media playback pauses on scroll
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2019-01-04  Jer Noble  <jer.noble@apple.com>
2
3         [WebKitLegacy] Media playback pauses on scroll
4         https://bugs.webkit.org/show_bug.cgi?id=192829
5
6         Reviewed by Eric Carlson.
7
8         Add a new WebPage, WebPageProxy, & WKWebView SPI to stop, suspend, and resume all
9         existing media playback in the page.
10
11         * UIProcess/API/Cocoa/WKWebView.mm:
12         (-[WKWebView _stopAllMediaPlayback]):
13         (-[WKWebView _suspendAllMediaPlayback]):
14         (-[WKWebView _resumeAllMediaPlayback]):
15         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
16         * UIProcess/WebPageProxy.cpp:
17         (WebKit::WebPageProxy::stopAllMediaPlayback):
18         (WebKit::WebPageProxy::suspendAllMediaPlayback):
19         (WebKit::WebPageProxy::resumeAllMediaPlayback):
20         * UIProcess/WebPageProxy.h:
21         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
22         (-[WKFullScreenViewController _showPhishingAlert]):
23         * WebProcess/WebPage/WebPage.cpp:
24         (WebKit::WebPage::stopAllMediaPlayback):
25         (WebKit::WebPage::suspendAllMediaPlayback):
26         (WebKit::WebPage::resumeAllMediaPlayback):
27         * WebProcess/WebPage/WebPage.h:
28         * WebProcess/WebPage/WebPage.messages.in:
29
30 2019-01-04  Chris Dumez  <cdumez@apple.com>
31
32         Add support for toggling device orientation API support per site
33         https://bugs.webkit.org/show_bug.cgi?id=193143
34         <rdar://problem/46605724>
35
36         Reviewed by Alex Christensen.
37
38         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
39
40         * Shared/WebsitePoliciesData.cpp:
41         (WebKit::WebsitePoliciesData::encode const):
42         (WebKit::WebsitePoliciesData::decode):
43         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
44         * Shared/WebsitePoliciesData.h:
45         * UIProcess/API/APIWebsitePolicies.cpp:
46         (API::WebsitePolicies::data):
47         * UIProcess/API/APIWebsitePolicies.h:
48         * UIProcess/API/Cocoa/WKWebView.mm:
49         (-[WKWebView _simulateDeviceOrientationChangeWithAlpha:beta:gamma:]):
50         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
51         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
52         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
53         (-[_WKWebsitePolicies setDeviceOrientationEventEnabled:]):
54         (-[_WKWebsitePolicies deviceOrientationEventEnabled]):
55         * UIProcess/WebPageProxy.cpp:
56         (WebKit::WebPageProxy::simulateDeviceOrientationChange):
57         * UIProcess/WebPageProxy.h:
58         * WebProcess/WebPage/WebPage.cpp:
59         (WebKit::WebPage::simulateDeviceOrientationChange):
60         * WebProcess/WebPage/WebPage.h:
61         * WebProcess/WebPage/WebPage.messages.in:
62
63 2019-01-04  Chris Dumez  <cdumez@apple.com>
64
65         Crash under WebPageProxy::continueNavigationInNewProcess()
66         https://bugs.webkit.org/show_bug.cgi?id=193113
67         <rdar://problem/46938686>
68
69         Reviewed by Brady Eidson.
70
71         The crash was happening in continueNavigationInNewProcess() when dereferencing
72         the Optional<> value returned by API::Navigation::backForwardFrameLoadType(), after verifying
73         that API::Navigation::targetItem() is not null.
74
75         When constructing an API::Navigation object with a targetItem, you HAVE to pass
76         in a backForwardFrameLoadType as well so this normally is not possible. However,
77         it can happen because API::Navigation::setTargetItem() can get called later on and
78         set a target item on a Navigation object which potentially does not have a
79         backForwardFrameLoadType. This setter was only called in one place in
80         decidePolicyForNavigationAction() to update an existing Navigation object using
81         the targetItem provided by a NavigationAction. This logic was added with PSON
82         support.
83
84         Because I was unable to write a test case reproducing this and because I do not know
85         how it can happen in practice that we'd have a NavigationAction with a targetItem
86         even though the Navigation object itself is not for a back/forward navigation, I have
87         chosen to drop the unsafe API::Navigation::setTargetItem() setter and the call site.
88         When the call site was added, with ProcessSwap.NavigateToDataURLThenBack API test,
89         the intention was to create a back/forward navigation object instead of a standard load
90         navigation one if there is currently no existing Navigation object in the UIProcess.
91         This can happen when the back/forward navigation is triggered by the WebProcess via
92         JS (e.g. history.back()) and this is what the API test covers. The part of the logic
93         that updates an existing Navigation object with a targetItem coming from the
94         NavigationAction is untested and I have no evidence it does anything useful. However,
95         we DO have evidence that it can cause crashes.
96
97         * UIProcess/API/APINavigation.h:
98         * UIProcess/WebPageProxy.cpp:
99         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
100
101 2019-01-04  Tim Horton  <timothy_horton@apple.com>
102
103         Remove some nonexistent files from the WebKit Xcode project
104
105         * WebKit.xcodeproj/project.pbxproj:
106         r238468 and r237205 forgot to remove some files from the project.
107
108 2019-01-04  Youenn Fablet  <youenn@apple.com>
109
110         CSP violation reports should bypass CSP checks
111         https://bugs.webkit.org/show_bug.cgi?id=192857
112         <rdar://problem/46887236>
113
114         Reviewed by Chris Dumez.
115
116         * WebProcess/Network/WebLoaderStrategy.cpp:
117         (WebKit::WebLoaderStrategy::startPingLoad):
118         * WebProcess/Network/WebLoaderStrategy.h:
119
120 2019-01-04  Alex Christensen  <achristensen@webkit.org>
121
122         Use WebsiteDataStoreParameters instead of NetworkProcessCreationParameters for IndexedDB directories
123         https://bugs.webkit.org/show_bug.cgi?id=193114
124
125         Reviewed by Brady Eidson.
126
127         * NetworkProcess/NetworkProcess.cpp:
128         (WebKit::NetworkProcess::initializeNetworkProcess):
129         * NetworkProcess/NetworkProcessCreationParameters.cpp:
130         (WebKit::NetworkProcessCreationParameters::encode const):
131         (WebKit::NetworkProcessCreationParameters::decode):
132         * NetworkProcess/NetworkProcessCreationParameters.h:
133         * UIProcess/WebProcessPool.cpp:
134         (WebKit::WebProcessPool::ensureNetworkProcess):
135
136 2019-01-04  Alex Christensen  <achristensen@webkit.org>
137
138         Deprecate WKContextCreate
139         https://bugs.webkit.org/show_bug.cgi?id=193118
140
141         Reviewed by Brady Eidson.
142
143         It has only one use that is being removed in rdar://problem/47030792
144         This is a step towards removing ProcessPoolConfiguration::createWithLegacyOptions.
145         Also make WKContextCreateWithConfiguration accept a null configuration to make it easier to use.
146
147         * UIProcess/API/C/WKContext.cpp:
148         (WKContextCreateWithConfiguration):
149         * UIProcess/API/C/WKContext.h:
150
151 2019-01-04  Tim Horton  <timothy_horton@apple.com>
152
153         Fix the build
154
155         * UIProcess/ios/WKContentViewInteraction.mm:
156         (-[WKContentView cleanupInteraction]):
157
158 2019-01-04  Tim Horton  <timothy_horton@apple.com>
159
160         Share ink choice and ruler between all editable images
161         https://bugs.webkit.org/show_bug.cgi?id=193130
162         <rdar://problem/46826491>
163
164         Reviewed by Wenson Hsieh.
165
166         * SourcesCocoa.txt:
167         Add WKDrawingCoordinator, which maintains WKWebView-wide drawing state,
168         and manages a single shared ink picker.
169
170         * UIProcess/PageClient.h:
171         (WebKit::PageClient::createDrawingView):
172         * UIProcess/ios/EditableImageController.mm:
173         (WebKit::EditableImageController::ensureEditableImage):
174         * UIProcess/ios/PageClientImplIOS.h:
175         * UIProcess/ios/PageClientImplIOS.mm:
176         (WebKit::PageClientImpl::createDrawingView):
177         Plumb WKDrawingView creation through PageClient, so that it can be instantiated
178         with knowledge of its owning WKContentView.
179
180         * UIProcess/ios/WKContentViewInteraction.h:
181         * UIProcess/ios/WKContentViewInteraction.mm:
182         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
183         (-[WKContentView _elementDidBlur]):
184         (-[WKContentView _drawingCoordinator]):
185         (-[WKContentView _installInkPickerForDrawingViewWithID:]): Deleted.
186         (-[WKContentView _uninstallInkPicker]): Deleted.
187         Move ink picker management into WKDrawingCoordinator.
188
189         * UIProcess/ios/WKDrawingView.h:
190         * UIProcess/ios/WKDrawingView.mm:
191         (-[WKDrawingView initWithEmbeddedViewID:contentView:]):
192         (-[WKDrawingView _canvasViewWillBeginDrawing:]):
193         (-[WKDrawingView invalidateAttachment]):
194         (-[WKDrawingView didChangeRulerState:]):
195         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]): Deleted.
196         (-[WKDrawingView canvasView]): Deleted.
197         Use a shared ruler, owned by WKDrawingCoordinator.
198         Update the editable image's ink when drawing begins. This way, we don't have
199         to push ink changes to all drawings as they happen.
200
201         * UIProcess/ios/WKInkPickerView.h:
202         * UIProcess/ios/WKInkPickerView.mm:
203         (-[WKInkPickerView initWithContentView:]):
204         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
205         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
206         (-[WKInkPickerView setInk:]):
207         (-[WKInkPickerView ink]):
208         (-[WKInkPickerView initWithDrawingView:]): Deleted.
209         (-[WKInkPickerView didPickInk]): Deleted.
210         (-[WKInkPickerView inlineInkPicker:didSelectTool:]): Deleted.
211         (-[WKInkPickerView inlineInkPicker:didSelectColor:]): Deleted.
212         * WebKit.xcodeproj/project.pbxproj:
213
214 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
215
216         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
217         https://bugs.webkit.org/show_bug.cgi?id=193129
218
219         Reviewed by Tim Horton.
220
221         Remove WebEditCommandProxy::nameForEditAction and use WebCore::nameForUndoRedo instead.
222
223         * UIProcess/Cocoa/WebViewImpl.mm:
224         (WebKit::WebViewImpl::registerEditCommand):
225         * UIProcess/WebEditCommandProxy.cpp:
226         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
227         (WebKit::WebEditCommandProxy::~WebEditCommandProxy):
228         (WebKit::WebEditCommandProxy::nameForEditAction): Deleted.
229         * UIProcess/WebEditCommandProxy.h:
230         * UIProcess/WebPageProxy.cpp:
231         (WebKit::WebPageProxy::addEditCommand):
232         (WebKit::WebPageProxy::removeEditCommand):
233         (WebKit::WebPageProxy::isValidEditCommand): Deleted.
234
235         Bit of drive-by refactoring: remove an unused function, and make addEditCommand and removeEditCommand take
236         references instead of pointers, since these are assumed to be nonnull.
237
238         * UIProcess/WebPageProxy.h:
239         * UIProcess/ios/PageClientImplIOS.mm:
240         (WebKit::PageClientImpl::registerEditCommand):
241
242 2019-01-03  Matt Rajca  <mrajca@apple.com>
243
244         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
245         https://bugs.webkit.org/show_bug.cgi?id=193128
246         rdar://34554231
247
248         Reviewed by Jer Noble.
249
250         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
251         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
252         event along with a flag that indicates whether or not autoplay was actually prevented.
253
254         Tests: existing API tests were updated to reflect the new names. New API tests
255         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
256
257         * Shared/WebCoreArgumentCoders.h: Take into account new flags.
258         * UIProcess/API/C/WKPage.cpp: Ditto.
259         (WKPageSetPageUIClient):
260         * UIProcess/API/C/WKPageUIClient.h: Ditto.
261         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Ditto.
262         * UIProcess/Cocoa/UIDelegate.mm: Ditto.
263         (WebKit::toWKAutoplayEventFlags):
264         (WebKit::toWKAutoplayEvent):
265
266 2019-01-04  Fujii Hironori  <Hironori.Fujii@sony.com>
267
268         [curl] Move cookiePersistentStorageFile from NetworkProcessCreationParameters to NetworkSessionCreationParameters
269         https://bugs.webkit.org/show_bug.cgi?id=192970
270
271         Reviewed by Alex Christensen.
272
273         * NetworkProcess/NetworkProcessCreationParameters.cpp:
274         (WebKit::NetworkProcessCreationParameters::encode const): Removed code for cookiePersistentStorageFile.
275         (WebKit::NetworkProcessCreationParameters::decode): Ditto.
276         * NetworkProcess/NetworkProcessCreationParameters.h: Ditto.
277         * NetworkProcess/curl/NetworkProcessCurl.cpp:
278         (WebKit::NetworkProcess::platformInitializeNetworkProcess): Ditto.
279
280         * NetworkProcess/NetworkSessionCreationParameters.cpp:
281         (WebKit::NetworkSessionCreationParameters::privateSessionParameters): Added code for cookiePersistentStorageFile.
282         (WebKit::NetworkSessionCreationParameters::encode const): Ditto.
283         (WebKit::NetworkSessionCreationParameters::decode): Ditto.
284         * NetworkProcess/NetworkSessionCreationParameters.h: Ditto.
285         * NetworkProcess/curl/NetworkSessionCurl.cpp:
286         (WebKit::NetworkSessionCurl::NetworkSessionCurl): Ditto.
287
288         * NetworkProcess/Cookies/WebCookieManager.h: Removed setCookiePersistentStorage method of curl port extension.
289         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
290         (WebKit::WebCookieManager::setCookiePersistentStorage): Deleted.
291
292 2019-01-04  Chris Dumez  <cdumez@apple.com>
293
294         [PSON] Calling history.back() from inside the load event handler prevents process-swapping
295         https://bugs.webkit.org/show_bug.cgi?id=193120
296
297         Reviewed by Alex Christensen.
298
299         A HistoryItem is created only *after* we've fired the load event. As a result, if you call
300         history.back() in JS from inside the load event handler, the current HistoryItem and and
301         the target HistoryItem will be the same. This is normally not an issue. However, there was
302         logic inside of WebProcessPool::processForNavigationInternal() which would compare the
303         processID of the source and destination BackForwardListItems and which would force a process
304         reuse if both BackForwardListItems came from the same WebContent process. So even though
305         we swapped when doing a standard load from site A to site B, we would fail to swap if site
306         B called history.back() from inside its load event handler.
307
308         To address the issue, stop relying on the source backforward item's processID. Instead, just
309         use the WebContent process matching the destination backforward item's processID if it still
310         exists.
311
312         * UIProcess/WebProcessPool.cpp:
313         (WebKit::WebProcessPool::processForNavigationInternal):
314
315 2019-01-04  Keith Rollin  <krollin@apple.com>
316
317         Bring back parent processID for logging
318         https://bugs.webkit.org/show_bug.cgi?id=193121
319         <rdar://problem/47031634>
320
321         Reviewed by Alex Christensen.
322
323         Bug 192961 removes presentingApplicationPID from
324         NetworkProcessCreationParameters because it was (a) stored in some
325         global state, the use of which is being minimized, and (b) it was
326         largely unused. However, it was actually still being used in some
327         useful logging in order to tie together child processes with their
328         parent process. Re-introduce this value in NetworkLoadParameters so
329         that we can log it.
330
331         * NetworkProcess/NetworkLoadParameters.h:
332         * NetworkProcess/NetworkResourceLoadParameters.cpp:
333         (WebKit::NetworkResourceLoadParameters::encode const):
334         (WebKit::NetworkResourceLoadParameters::decode):
335         * NetworkProcess/NetworkResourceLoader.cpp:
336         (WebKit::NetworkResourceLoader::start):
337         * WebProcess/Network/WebLoaderStrategy.cpp:
338         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
339         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
340         (WebKit::WebLoaderStrategy::startPingLoad):
341         (WebKit::WebLoaderStrategy::preconnectTo):
342
343 2019-01-04  Youenn Fablet  <youenn@apple.com>
344
345         Make RestrictedHTTPResponseAccess an internal flag
346         https://bugs.webkit.org/show_bug.cgi?id=193145
347
348         Reviewed by Chris Dumez.
349
350         * Shared/WebPreferences.yaml: This will ease debugging.
351
352 2019-01-04  Per Arne Vollan  <pvollan@apple.com>
353
354         [iOS] Enable logging for services in sandbox
355         https://bugs.webkit.org/show_bug.cgi?id=192705
356
357         Reviewed by Brent Fulgham.
358
359         When running layout tests, we didn’t see 107 services being looked up through launchd. We should
360         add logging to these services to determine which services we actually need in the sandbox.
361
362         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
363
364 2019-01-04  Commit Queue  <commit-queue@webkit.org>
365
366         Unreviewed, rolling out r239603.
367         https://bugs.webkit.org/show_bug.cgi?id=193146
368
369         Breaks shipping tests (Requested by bfulgha__ on #webkit).
370
371         Reverted changeset:
372
373         "[iOS] Update sandbox profile to use iconservices instead of
374         lsdiconservice"
375         https://bugs.webkit.org/show_bug.cgi?id=193115
376         https://trac.webkit.org/changeset/239603
377
378 2019-01-04  Chris Dumez  <cdumez@apple.com>
379
380         Crash under WebProcessPool::addSuspendedPage()
381         https://bugs.webkit.org/show_bug.cgi?id=193110
382
383         Reviewed by Youenn Fablet.
384
385         When PageCache is disabled, WebProcessPool::m_maxSuspendedPageCount is 0 and WebProcessPool::addSuspendedPage()
386         would call m_suspendedPages.removeFirst() even though m_suspendedPages is empty, causing a crash.
387         Do an early return when m_maxSuspendedPageCount is 0 since we do not want to add any suspended page in this
388         case.
389
390         * UIProcess/WebProcessPool.cpp:
391         (WebKit::WebProcessPool::addSuspendedPage):
392
393 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
394
395         [iOS] Silently deny access to mail settings triggered by MessageUI framework
396         https://bugs.webkit.org/show_bug.cgi?id=193123
397         <rdar://problem/42485581>
398
399         Reviewed by Alexey Proskuryakov.
400
401         Remove unhelpful logging generated when we block access to non-WebKit preferences. These
402         invalid checks are done by an system framework that we cannot modify.
403
404         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
405
406 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
407
408         [iOS] Update sandbox profile to use iconservices instead of lsdiconservice
409         https://bugs.webkit.org/show_bug.cgi?id=193115
410         <rdar://problem/44867379>
411
412         Reviewed by Eric Carlson.
413
414         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
415
416 2019-01-03  Brent Fulgham  <bfulgham@apple.com>
417
418         Remove logic handling DNT header during redirects
419         https://bugs.webkit.org/show_bug.cgi?id=193082
420         <rdar://problem/45555965>
421
422         Reviewed by Chris Dumez.
423
424         Test: http/wpt/fetch/dnt-header-after-redirection.html.
425
426         Don't bother looking for (or passing along) DNT headers during redirects.
427
428         * NetworkProcess/NetworkLoadChecker.cpp:
429         (WebKit::NetworkLoadChecker::check):
430         (WebKit::NetworkLoadChecker::prepareRedirectedRequest): Deleted.
431         * NetworkProcess/NetworkLoadChecker.h:
432         * NetworkProcess/NetworkResourceLoader.cpp:
433         (WebKit::NetworkResourceLoader::restartNetworkLoad):
434         (WebKit::NetworkResourceLoader::continueWillSendRequest):
435         * NetworkProcess/PingLoad.cpp:
436         (WebKit::PingLoad::willPerformHTTPRedirection):
437
438 2019-01-03  Chris Dumez  <cdumez@apple.com>
439
440         Add release logging to help debug HTTPS upgrade issues
441         https://bugs.webkit.org/show_bug.cgi?id=193075
442
443         Reviewed by Alex Christensen.
444
445         Add release logging to help debug HTTPS upgrade issues like Bug 193026.
446
447         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
448         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
449         (WebKit::NetworkHTTPSUpgradeChecker::query):
450
451 2019-01-03  Alex Christensen  <achristensen@webkit.org>
452
453         NetworkProcess should initialize its default NetworkSession with parameters from the UIProcess
454         https://bugs.webkit.org/show_bug.cgi?id=192967
455
456         Reviewed by Brent Fulgham.
457
458         I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters.
459         More will be moved in the near future, like indexedDatabaseDirectory.
460
461         * NetworkProcess/NetworkProcess.cpp:
462         (WebKit::NetworkProcess::initializeNetworkProcess):
463         * NetworkProcess/NetworkProcessCreationParameters.cpp:
464         (WebKit::NetworkProcessCreationParameters::encode const):
465         (WebKit::NetworkProcessCreationParameters::decode):
466         * NetworkProcess/NetworkProcessCreationParameters.h:
467         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
468         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
469         * UIProcess/WebProcessPool.cpp:
470         (WebKit::WebProcessPool::ensureNetworkProcess):
471
472 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
473
474         [iOS] REGRESSION (r239441): Tab cycling to offscreen <select> may not scroll it into view
475         https://bugs.webkit.org/show_bug.cgi?id=193084
476         <rdar://problem/47006882>
477
478         Reviewed by Simon Fraser.
479
480         In `WKWebView.mm`, `-_zoomToFocusRect:` will ignore the given selection rect if it is of size `{ 0, 0 }` and at
481         the origin. Prior to r239441, when using the tab key to move focus between non-editable form controls (or any
482         other method that doesn't involve tapping on the focused select element, with the exception of the next and
483         previous buttons in the input accessory view), we would compute a selection rect of `{{ 0, 0 }, { 0, 0 }}`, and
484         subsequently try to scroll the focused element to the center of the visible area, without taking the selection
485         rect into account.
486
487         However, after r239441, the web process sends the element interaction location to the UI process, which then
488         computes the selection rect by taking this location and adding a size of `{ 1, 1 }` (before r239441, this was
489         done in `WebPage::getAssistedNodeInformation`). However, our new implementation doesn't take into account the
490         case where the element interaction rect is null, which happens when the last interaction location is outside of
491         the bounding rect of the element. In this case, we set the element interaction location to { 0, 0 } and end up
492         computing a selection rect of `{{ 0, 0 }, { 1, 1 }}` instead of `{{ 0, 0 }, { 0, 0 }}` as we would have
493         previously done. This causes us to scroll up to the origin, instead of revealing the focused element.
494
495         To fix this, we restore the pre-r239441 behavior. See additional comments below for details.
496
497         Test: fast/forms/ios/scroll-to-reveal-focused-select.html
498
499         * Shared/FocusedElementInformation.cpp:
500         (WebKit::FocusedElementInformation::encode const):
501         (WebKit::FocusedElementInformation::decode):
502         * Shared/FocusedElementInformation.h:
503
504         Rename `elementInteractionLocation` to `lastInteractionLocation`. This was previously
505         `elementInteractionLocation` due to existing logic that tries to move the interaction location into the bounding
506         rect of the element in the case where visual viewports are disabled; however, since this feature has long been
507         enabled by default for all modern WebKit clients (internal and external), it's simpler to just use always send
508         the last interaction location over to the UI process, and have the UI process use `{{ 0, 0 }, { 0, 0 }}` if
509         the interaction location is outside of the element rect.
510
511         In the very unlikely event that any modern WebKit client disables visual viewports, this will still behave
512         reasonably, since we'll just use `{{ 0, 0 }, { 0, 0 }}` as the target rect and scroll to reveal the entire
513         element rather than the top left corner of the element.
514
515         * UIProcess/ios/WKContentViewInteraction.mm:
516         (rectToRevealWhenZoomingToFocusedElement):
517         * WebProcess/WebPage/ios/WebPageIOS.mm:
518
519         Move the check for whether the interaction location is inside the element's bounding rect from the web process
520         to the UI process. This relocates the logic to determine whether the selection rect should be a 1 by 1 fallback
521         interaction rect or the zero rect (`{{ 0, 0 }, { 0, 0 }}`) closer to the code that actually uses this rect.
522
523         (WebKit::WebPage::getFocusedElementInformation):
524
525 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
526
527         WebUndoStep's monotonically increasing identifier should be a WebUndoStepID instead of uint64_t
528         https://bugs.webkit.org/show_bug.cgi?id=193100
529
530         Reviewed by Simon Fraser.
531
532         Add a type alias, WebUndoStepID, to represent the monotonically increasing undo step ID for each undoable
533         editing command, and use this type alias in lieu of `uint64_t`. No change in behavior.
534
535         * UIProcess/WebEditCommandProxy.cpp:
536         (WebKit::WebEditCommandProxy::WebEditCommandProxy):
537         * UIProcess/WebEditCommandProxy.h:
538         (WebKit::WebEditCommandProxy::create):
539         (WebKit::WebEditCommandProxy::commandID const):
540         * UIProcess/WebPageProxy.cpp:
541         (WebKit::WebPageProxy::registerEditCommandForUndo):
542         * UIProcess/WebPageProxy.h:
543         * WebKit.xcodeproj/project.pbxproj:
544         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
545         (WebKit::WebEditorClient::registerUndoStep):
546
547         Store the step ID in a temporary variable, since `webUndoStep` is now moved when calling `addWebUndoStep`.
548
549         * WebProcess/WebPage/WebPage.cpp:
550         (WebKit::WebPage::webUndoStep):
551         (WebKit::WebPage::addWebUndoStep):
552
553         Make this take a `Ref<WebUndoStep>&&` instead of a `WebUndoStep*`, and use move semantics to transfer the
554         given `Ref` to the table.
555
556         (WebKit::WebPage::removeWebEditCommand):
557         (WebKit::WebPage::unapplyEditCommand):
558         (WebKit::WebPage::reapplyEditCommand):
559
560         Use `auto*` in a couple of places.
561
562         (WebKit::WebPage::didRemoveEditCommand):
563         * WebProcess/WebPage/WebPage.h:
564         * WebProcess/WebPage/WebUndoStep.cpp:
565         (WebKit::generateUndoStep):
566         * WebProcess/WebPage/WebUndoStep.h:
567         (WebKit::WebUndoStep::stepID const):
568         (WebKit::WebUndoStep::WebUndoStep):
569         * WebProcess/WebPage/WebUndoStepID.h: Copied from Source/WebKit/WebProcess/WebPage/WebUndoStep.cpp.
570
571 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
572
573         Add support for using the current text selection as the find string on iOS
574         https://bugs.webkit.org/show_bug.cgi?id=193034
575         <rdar://problem/45138739>
576
577         Reviewed by Tim Horton.
578
579         * SourcesCocoa.txt:
580         * UIProcess/API/Cocoa/WKWebView.mm:
581         (-[WKWebView _takeFindStringFromSelection:]):
582
583         Provides a way to set the find string on iOS and macOS (an aside: takeFindStringFromSelection: already exists on
584         macOS, but there is no equivalent protocol method on iOS, so this new SPI acts as a cross-platform way for
585         WebKit clients to take the find string from the selection across all Cocoa platforms).
586
587         (+[WKWebView _stringForFind]):
588         (+[WKWebView _setStringForFind:]):
589
590         Call into find-in-page helper functions.
591
592         (-[WKWebView _findString:options:maxCount:]):
593
594         On iOS, additionally update the find-in-page string when exercising the _findString:options:maxCount: SPI. This
595         mirrors macOS behavior of updating the find pasteboard every time the find string changes; however, on macOS,
596         this is implemented by the platform (in AppKit), whereas there's no platform find pasteboard on iOS, let alone
597         logic to update it in UIKit. As such, we directly drive updates to the find string within WebKit.
598
599         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
600
601         Add some new cross-platform find-in-page SPI. See above for more details.
602
603         * UIProcess/Cocoa/GlobalFindInPageState.h: Added.
604         * UIProcess/Cocoa/GlobalFindInPageState.mm: Added.
605         (WebKit::findPasteboard):
606         (WebKit::globalStringForFind):
607
608         Fetch the string to use when finding text in the page. On macOS, this accesses the AppKit find pasteboard; on
609         iOS, this instead returns the current global find string.
610
611         (WebKit::updateStringForFind):
612
613         Sets the global find string. Uses the find pasteboard on macOS, and sets the global find string on iOS.
614
615         (WebKit::stringForFind):
616         * UIProcess/WebPageProxy.h:
617         * UIProcess/WebPageProxy.messages.in:
618
619         Add plumbing to allow WebEditorClient to deliver the update the global find string in the UI process.
620
621         * UIProcess/ios/WebPageProxyIOS.mm:
622         (WebKit::WebPageProxy::updateStringForFind):
623         * WebKit.xcodeproj/project.pbxproj:
624         * WebProcess/WebCoreSupport/WebEditorClient.h:
625         * WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
626         (WebKit::WebEditorClient::updateStringForFind):
627         * WebProcess/WebPage/WebPage.h:
628         * WebProcess/WebPage/ios/WebPageIOS.mm:
629         (WebKit::WebPage::updateStringForFind):
630
631 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
632
633         Allow WebContent process access to some drawing-related IOKit properties
634         https://bugs.webkit.org/show_bug.cgi?id=193086
635         <rdar://problem/46568088>
636
637         Reviewed by Eric Carlson.
638
639         Update the iOS WebContent process sandbox to allow access to some IOKit properties
640         that are needed for drawing and media playback operations.
641
642         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
643         * WebProcess/com.apple.WebKit.WebContent.sb.in:
644
645 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
646
647         Remove unused logging service 
648         https://bugs.webkit.org/show_bug.cgi?id=193081
649         <rdar://problem/40414815>
650
651         Reviewed by Alexey Proskuryakov.
652
653         We don't use this logging service, so don't open an exception for it.
654
655         * Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:
656
657 2019-01-02  Brent Fulgham  <bfulgham@apple.com>
658
659         Remove temporary workaround for CVMS code signing objects
660         https://bugs.webkit.org/show_bug.cgi?id=193079
661         <rdar://problem/40139202>
662
663         Reviewed by Alexey Proskuryakov.
664
665         * WebProcess/com.apple.WebProcess.sb.in:
666
667 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
668
669         REGRESSION (r239441): [iOS] Selection UI sometimes doesn't change after tapping "select all" in the callout bar
670         https://bugs.webkit.org/show_bug.cgi?id=193070
671         <rdar://problem/46921508>
672
673         Reviewed by Tim Horton.
674
675         r239441 added logic to include an EditorState in the next layer tree commit when refocusing an element; this was
676         done to ensure that after tapping an element that has already been programmatically focused, we still send up-
677         to-date editor information to the UI process for the purposes of zooming to the selection rect, even if the
678         selection in the DOM is unchanged, since other aspects of the editor state may have changed since the element
679         was initially focused.
680
681         We currently try to flag the next layer tree commit by setting `m_hasPendingEditorStateUpdate` to `true`.
682         However, this is problematic since we aren't guaranteed in all cases that a compositing flush has been
683         scheduled. In the case where it hasn't, we'll end up in a state where the editor state update flag has been set,
684         yet the update will not make it over to the UI process until something happens that forces a layer tree commit
685         (e.g. scrolling, pinch zooming). Worse still, if the selection is then programmatically changed from the web
686         process, we will bail from sending a subsequent editor state update to the UI process because `WebPage` thinks
687         that a pending editor state has already been scheduled. This manifests in selection UI not updating after
688         tapping "Select All" in the callout bar, if the callout bar was brought up by tapping near the selection (since
689         this refocuses the element).
690
691         To fix this, we adjust this logic in `WebPage::elementDidRefocus` so that it sets the flag and then schedules a
692         compositing flush, but only if the user is actually interacting with the focused element (i.e., if the page
693         calls `focus` repeatedly, we won't continue to schedule compositing flushes).
694
695         Test: editing/selection/ios/change-selection-after-tapping-focused-element.html
696
697         * WebProcess/WebPage/WebPage.cpp:
698         (WebKit::WebPage::elementDidRefocus):
699         (WebKit::WebPage::sendEditorStateUpdate):
700         (WebKit::WebPage::scheduleFullEditorStateUpdate):
701
702         Add a private helper method to schedule an editor state update by setting `m_hasPendingEditorStateUpdate` to
703         `true` and then scheduling a compositing layer flush. Also, add a FIXME aluding to the fact that scheduling an
704         entire compositing layer flush to send an editor state update is somewhat wasteful, and should be replaced by
705         just scheduling this work to be done before the next frame (see: <rdar://problem/36523583> for more detail).
706
707         We also use this helper method in a few places where we currently turn on the editor state flag and schedule a
708         subsequent compositing flush.
709
710         (WebKit::WebPage::sendPartialEditorStateAndSchedulePostLayoutUpdate):
711         * WebProcess/WebPage/WebPage.h:
712
713 2019-01-02  Commit Queue  <commit-queue@webkit.org>
714
715         Unreviewed, rolling out r239524.
716         https://bugs.webkit.org/show_bug.cgi?id=193083
717
718         basic browsing seems not to work (Requested by thorton on
719         #webkit).
720
721         Reverted changeset:
722
723         "Expand use of sourceApplicationAuditData"
724         https://bugs.webkit.org/show_bug.cgi?id=192995
725         https://trac.webkit.org/changeset/239524
726
727 2019-01-01  Jeff Miller  <jeffm@apple.com>
728
729         Update user-visible copyright strings to include 2019
730         https://bugs.webkit.org/show_bug.cgi?id=192811
731
732         Reviewed by Mark Lam.
733
734         * Info.plist:
735         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-OSX.plist:
736         * NetworkProcess/EntryPoint/mac/XPCService/NetworkService/Info-iOS.plist:
737         * PluginProcess/EntryPoint/mac/XPCService/PluginService.32-64.Info.plist:
738         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-OSX.plist:
739         * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist:
740
741 2018-12-28  Wenson Hsieh  <wenson_hsieh@apple.com>
742
743         Move WKEditCommandObjC and WKEditorUndoTargetObjC into a separate file
744         https://bugs.webkit.org/show_bug.cgi?id=193049
745
746         Reviewed by Sam Weinig.
747
748         Pull common code (WKEditCommandObjC and WKEditorUndoTargetObjC) on iOS and macOS out into a separate file. No
749         change in behavior.
750
751         * SourcesCocoa.txt:
752         * UIProcess/Cocoa/WKEditCommand.h: Added.
753         * UIProcess/Cocoa/WKEditCommand.mm: Added.
754
755         Rename WKEditCommandObjC to WKEditCommand, and WKEditorUndoTargetObjC to WKEditorUndoTarget. The ObjC suffix in
756         the name seems to diverge from the common naming scheme in other parts of WebKit, where most WK- and _WK-
757         prefixed names already refer to Objective-C objects. Additionally, mark -[WKEditCommand init] as unavailable.
758
759         (-[WKEditCommand initWithWebEditCommandProxy:]):
760
761         Make the return type instancetype instead of id, and also make this take a Ref<WebEditCommandProxy>&& instead
762         of a RefPtr.
763
764         (-[WKEditCommand command]):
765
766         Make this return a reference to the WebEditCommandProxy, rather than a pointer, since the WebEditCommandProxy
767         should always be non-null.
768
769         (-[WKEditorUndoTarget undoEditing:]):
770         (-[WKEditorUndoTarget redoEditing:]):
771         * UIProcess/Cocoa/WebViewImpl.h:
772         * UIProcess/Cocoa/WebViewImpl.mm:
773         (WebKit::WebViewImpl::WebViewImpl):
774         (WebKit::WebViewImpl::registerEditCommand):
775
776         Use WTFMove instead of copying the Ref when creating a WKEditCommand.
777
778         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
779         (-[WKEditCommandObjC command]): Deleted.
780         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
781         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
782         * UIProcess/ios/PageClientImplIOS.h:
783         * UIProcess/ios/PageClientImplIOS.mm:
784         (WebKit::PageClientImpl::PageClientImpl):
785         (WebKit::PageClientImpl::registerEditCommand):
786
787         Use WTFMove instead of creating a new RefPtr when creating a WKEditCommand.
788
789         (-[WKEditCommandObjC initWithWebEditCommandProxy:]): Deleted.
790         (-[WKEditCommandObjC command]): Deleted.
791         (-[WKEditorUndoTargetObjC undoEditing:]): Deleted.
792         (-[WKEditorUndoTargetObjC redoEditing:]): Deleted.
793         * UIProcess/mac/PageClientImplMac.h:
794         * WebKit.xcodeproj/project.pbxproj:
795
796 2018-12-27  Alex Christensen  <achristensen@webkit.org>
797
798         Resurrect Mac CMake build
799         https://bugs.webkit.org/show_bug.cgi?id=192658
800
801         Reviewed by Yusuke Suzuki.
802
803         * PlatformMac.cmake:
804
805 2018-12-26  Fujii Hironori  <Hironori.Fujii@sony.com>
806
807         [MSVC] error C2381: 'WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker': redefinition; '__declspec(noreturn)' or '[[noreturn]]' differs
808         https://bugs.webkit.org/show_bug.cgi?id=193030
809
810         Reviewed by Ross Kirsling.
811
812         Windows Debug builds are failing to compile due to
813         NO_RETURN_DUE_TO_ASSERT inconsistency of
814         NetworkHTTPSUpgradeChecker destructor's definition and
815         declaration.
816
817         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added
818         NO_RETURN_DUE_TO_ASSERT to NetworkHTTPSUpgradeChecker destructor
819         declaration.
820         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Removed
821         NO_RETURN_DUE_TO_ASSERT from the definition.
822
823 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
824
825         [WebKit][Win] Remove using namespace in the global scope
826         https://bugs.webkit.org/show_bug.cgi?id=192968
827
828         Reviewed by Alex Christensen.
829
830         Moved using namespace statements in the global scope to inside
831         namespaces.
832         <https://webkit.org/code-style-guidelines/#using-position>
833
834         * NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp:
835         * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
836         * NetworkProcess/curl/NetworkProcessCurl.cpp:
837         * NetworkProcess/curl/NetworkSessionCurl.cpp:
838         * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp:
839         * Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp:
840         * Shared/WebWheelEvent.cpp:
841         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
842         * Shared/win/NativeWebKeyboardEventWin.cpp:
843         * Shared/win/WebEventFactory.cpp:
844         * UIProcess/Automation/WebAutomationSession.cpp:
845
846 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
847
848         Remove "using namespace std;"
849         https://bugs.webkit.org/show_bug.cgi?id=192973
850
851         Reviewed by Alex Christensen.
852
853         * Platform/IPC/win/ConnectionWin.cpp:
854
855 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
856
857         Change ScrollingNodeType to an enum class
858         https://bugs.webkit.org/show_bug.cgi?id=193009
859
860         Reviewed by Zalan Bujtas.
861
862         Change the ScrollingNodeType enum to an enum class.
863         
864         No behavior change.
865
866         * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
867         (WebKit::encodeNodeAndDescendants):
868         (WebKit::RemoteScrollingCoordinatorTransaction::decode):
869         (WebKit::dump):
870         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
871         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
872         * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
873         (WebKit::RemoteScrollingTree::createScrollingTreeNode):
874         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
875         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
876         * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
877         (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
878
879 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
880
881         [iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546>
882         https://bugs.webkit.org/show_bug.cgi?id=193019
883
884         Reviewed by Dan Bernstein.
885
886         Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
887         of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
888         we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
889         through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
890         changes to WKWebViewPrivate.h.
891
892         * UIProcess/API/Cocoa/WKWebView.mm:
893         (-[WKWebView canPerformAction:withSender:]):
894         (-[WKWebView targetForAction:withSender:]):
895         (-[WKWebView _setFont:sender:]):
896         (-[WKWebView _setFontSize:sender:]):
897         (-[WKWebView _setTextColor:sender:]):
898         (-[WKWebView setFont:sender:]): Deleted.
899         (-[WKWebView setTextColor:sender:]): Deleted.
900         (-[WKWebView setFontSize:sender:]): Deleted.
901         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
902         * UIProcess/ios/WKContentViewInteraction.h:
903         * UIProcess/ios/WKContentViewInteraction.mm:
904         (-[WKContentView canPerformActionForWebView:withSender:]):
905         (-[WKContentView setFontForWebView:sender:]): Deleted.
906         (-[WKContentView setFontSizeForWebView:sender:]): Deleted.
907         (-[WKContentView setTextColorForWebView:sender:]): Deleted.
908
909 2018-12-23  Wenson Hsieh  <wenson_hsieh@apple.com>
910
911         Fix fast/ruby/ruby-base-merge-block-children-crash-2.html after r239543
912         https://bugs.webkit.org/show_bug.cgi?id=193015
913         <rdar://problem/46583527>
914
915         Reviewed by Tim Horton.
916
917         Fix the crash by gracefully handling integer overflow when computing the area of a very large editable element.
918
919         * UIProcess/ios/WKContentViewInteraction.mm:
920         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
921         (-[WKContentView _updateChangedSelection:]):
922
923 2018-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
924
925         [iOS] Suppress native selection behaviors when focusing a very small editable element
926         https://bugs.webkit.org/show_bug.cgi?id=193005
927         <rdar://problem/46583527>
928
929         Reviewed by Tim Horton.
930
931         In r238146, I added a mechanism to detect when the selection is hidden within transparent editable elements, and
932         used this to suppress native selection on iOS (such as selection handles, highlight, callout bar, etc.) to avoid
933         conflicts between the page's editing UI and the platform.
934
935         However, one additional technique observed on some websites involves hiding the selection by moving it into a
936         tiny (1x1) editable element. Here, we currently still present a callout bar with editing actions, as well as
937         show a selection caret or handles on iOS. To fix this, we extend the mechanism added in r238146 by also
938         suppressing the selection assistant in the case where the editable element's area is beneath a tiny minimum
939         threshold.
940
941         Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html
942
943         * Shared/EditorState.cpp:
944         (WebKit::EditorState::PostLayoutData::encode const):
945         (WebKit::EditorState::PostLayoutData::decode):
946         (WebKit::operator<<):
947         * Shared/EditorState.h:
948
949         Rename selectionClipRect to focusedElementRect. We currently propagate the bounds of the focused element to the
950         UI process through EditorState updates, but only for the purpose of returning it in the computed selection clip
951         rect; instead, rename this member to something more general-purpose, so we can also use it when determining
952         whether to suppress the selection assistant.
953
954         * UIProcess/API/Cocoa/WKWebView.mm:
955         (-[WKWebView _candidateRect]):
956         * UIProcess/Cocoa/WebViewImpl.mm:
957         (WebKit::WebViewImpl::handleRequestedCandidates):
958         * UIProcess/ios/WKContentViewInteraction.h:
959
960         Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny editable elements.
961
962         * UIProcess/ios/WKContentViewInteraction.mm:
963         (-[WKContentView _zoomToRevealFocusedElement]):
964         (-[WKContentView _selectionClipRect]):
965         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
966         (-[WKContentView _updateChangedSelection:]):
967
968         Check the size of the focused element, and begin or stop suppressing the selection assistant accordingly.
969
970         * WebProcess/WebPage/ios/WebPageIOS.mm:
971         (WebKit::WebPage::platformEditorState const):
972         * WebProcess/WebPage/mac/WebPageMac.mm:
973         (WebKit::WebPage::platformEditorState const):
974
975 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
976
977         Use Ref<> as much as possible
978         https://bugs.webkit.org/show_bug.cgi?id=192808
979
980         Reviewed by Alex Christensen.
981
982         * PluginProcess/WebProcessConnection.cpp:
983         (WebKit::WebProcessConnection::create):
984         * PluginProcess/WebProcessConnection.h:
985         * UIProcess/API/Cocoa/WKConnection.mm:
986         (-[WKConnection sendMessageWithName:body:]):
987         * UIProcess/API/Cocoa/WKWebView.mm:
988         (-[WKWebView takeSnapshotWithConfiguration:completionHandler:]):
989         (-[WKWebView _takeViewSnapshot]):
990         (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]):
991         * UIProcess/API/glib/WebKitGeolocationProvider.cpp:
992         (WebKit::WebKitGeolocationProvider::notifyPositionChanged):
993         * UIProcess/API/glib/WebKitWebContext.cpp:
994         (webkit_web_context_allow_tls_certificate_for_host):
995         * UIProcess/Automation/cairo/WebAutomationSessionCairo.cpp:
996         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
997         * UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
998         (WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
999         * UIProcess/BackingStore.cpp:
1000         (WebKit::BackingStore::incorporateUpdate):
1001         * UIProcess/Cocoa/NavigationState.mm:
1002         (WebKit::createErrorWithRecoveryAttempter):
1003         * UIProcess/Cocoa/PlaybackSessionManagerProxy.h:
1004         * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm:
1005         (WebKit::PlaybackSessionManagerProxy::create):
1006         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
1007         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1008         (WebKit::VideoFullscreenManagerProxy::create):
1009         * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
1010         (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
1011         * UIProcess/Cocoa/WebViewImpl.mm:
1012         (WebKit::WebViewImpl::takeViewSnapshot):
1013         * UIProcess/Downloads/DownloadProxyMap.cpp:
1014         (WebKit::DownloadProxyMap::createDownloadProxy):
1015         * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
1016         (WebKit::WebNotificationManagerProxy::show):
1017         * UIProcess/WebPageProxy.cpp:
1018         (WebKit::WebPageProxy::didCreateSubframe):
1019         * UIProcess/WebProcessPool.cpp:
1020         (WebKit::WebProcessPool::getStatistics):
1021         (WebKit::WebProcessPool::requestWebContentStatistics):
1022         (WebKit::WebProcessPool::requestNetworkingStatistics):
1023         * UIProcess/WebProcessPool.h:
1024         * UIProcess/gstreamer/WebPageProxyGStreamer.cpp:
1025         (WebKit::WebPageProxy::requestInstallMissingMediaPlugins):
1026         * UIProcess/gtk/RemoteWebInspectorProxyGtk.cpp:
1027         (WebKit::RemoteWebInspectorProxy::platformCreateFrontendPageAndWindow):
1028         * UIProcess/gtk/WebInspectorProxyGtk.cpp:
1029         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1030         * UIProcess/ios/WKGeolocationProviderIOS.mm:
1031         (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]):
1032         * UIProcess/mac/PageClientImplMac.mm:
1033         (WebKit::PageClientImpl::setPromisedDataForImage):
1034         * UIProcess/win/WebInspectorProxyWin.cpp:
1035         (WebKit::WebInspectorProxy::platformCreateFrontendPage):
1036         * WebProcess/InjectedBundle/API/mac/WKDOMRange.mm:
1037         (-[WKDOMRange initWithDocument:]):
1038         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
1039         (WebKit::InjectedBundleRangeHandle::renderedImage):
1040         * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp:
1041         (WebKit::InjectedBundlePageEditorClient::getPasteboardDataForRange):
1042         * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
1043         (WebKit::InjectedBundlePageUIClient::mouseDidMoveOverElement):
1044         * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
1045         (WebKit::NetscapePlugin::snapshot):
1046         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1047         (WebKit::PDFPlugin::addArchiveResource):
1048         (WebKit::PDFPlugin::snapshot):
1049         (WebKit::PDFPlugin::writeItemsToPasteboard):
1050         * WebProcess/Plugins/PluginProcessConnectionManager.cpp:
1051         (WebKit::PluginProcessConnectionManager::getPluginProcessConnection):
1052         * WebProcess/Plugins/PluginProxy.cpp:
1053         (WebKit::PluginProxy::snapshot):
1054         * WebProcess/Plugins/PluginView.cpp:
1055         (WebKit::PluginView::performURLRequest):
1056         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1057         (WebKit::WebChromeClient::exceededDatabaseQuota):
1058         (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
1059         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1060         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
1061         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1062         (WebKit::WebPlatformStrategies::getPathnamesForType):
1063         * WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
1064         (WebKit::convertCairoSurfaceToShareableBitmap):
1065         * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
1066         (WebKit::WebDragClient::declareAndWriteDragImage):
1067         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
1068         (WebKit::WebPage::dictionaryPopupInfoForRange):
1069         * WebProcess/WebPage/DrawingAreaImpl.cpp:
1070         (WebKit::DrawingAreaImpl::display):
1071         * WebProcess/WebPage/FindController.cpp:
1072         (WebKit::FindController::updateFindIndicator):
1073         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
1074         (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
1075         * WebProcess/WebPage/WebFrame.cpp:
1076         (WebKit::WebFrame::webArchiveData):
1077         * WebProcess/WebPage/WebPage.cpp:
1078         (WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
1079         (WebKit::WebPage::performDragControllerAction):
1080         * WebProcess/WebPage/ios/FindControllerIOS.mm:
1081         (WebKit::FindController::updateFindIndicator):
1082         * WebProcess/WebPage/ios/WebPageIOS.mm:
1083         (WebKit::WebPage::replaceDictatedText):
1084         (WebKit::WebPage::getPositionInformation):
1085         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1086         (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
1087         * WebProcess/WebStorage/StorageNamespaceImpl.cpp:
1088         (WebKit::StorageNamespaceImpl::createSessionStorageNamespace):
1089         (WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
1090         (WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
1091         (WebKit::StorageNamespaceImpl::createTransientLocalStorageNamespace):
1092         (WebKit::StorageNamespaceImpl::storageArea):
1093         (WebKit::StorageNamespaceImpl::ephemeralLocalStorageArea):
1094         (WebKit::StorageNamespaceImpl::copy):
1095         * WebProcess/WebStorage/StorageNamespaceImpl.h:
1096         * WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
1097         (WebKit::WebStorageNamespaceProvider::getOrCreate):
1098         (WebKit::WebStorageNamespaceProvider::createSessionStorageNamespace):
1099         (WebKit::WebStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
1100         (WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):
1101         (WebKit::WebStorageNamespaceProvider::createTransientLocalStorageNamespace):
1102         * WebProcess/WebStorage/WebStorageNamespaceProvider.h:
1103         * WebProcess/cocoa/PlaybackSessionManager.mm:
1104         (WebKit::PlaybackSessionManager::createModelAndInterface):
1105         * WebProcess/cocoa/VideoFullscreenManager.mm:
1106         (WebKit::VideoFullscreenManager::createModelAndInterface):
1107
1108 2018-12-21  Chris Dumez  <cdumez@apple.com>
1109
1110         navigator.userAgent in service workers does not reflect customUserAgent set by client
1111         https://bugs.webkit.org/show_bug.cgi?id=192951
1112
1113         Reviewed by Youenn Fablet.
1114
1115         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
1116         (WebKit::WebSWServerConnection::registerServiceWorkerClient):
1117         * NetworkProcess/ServiceWorker/WebSWServerConnection.h:
1118         * NetworkProcess/ServiceWorker/WebSWServerConnection.messages.in:
1119         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
1120         (WebKit::WebSWServerToContextConnection::installServiceWorkerContext):
1121         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
1122         * WebProcess/Storage/WebSWClientConnection.cpp:
1123         (WebKit::WebSWClientConnection::registerServiceWorkerClient):
1124         * WebProcess/Storage/WebSWClientConnection.h:
1125         * WebProcess/Storage/WebSWContextManagerConnection.cpp:
1126         (WebKit::WebSWContextManagerConnection::installServiceWorker):
1127         * WebProcess/Storage/WebSWContextManagerConnection.h:
1128         * WebProcess/Storage/WebSWContextManagerConnection.messages.in:
1129
1130 2018-12-21  Alex Christensen  <achristensen@webkit.org>
1131
1132         Expand use of sourceApplicationAuditData
1133         https://bugs.webkit.org/show_bug.cgi?id=192995
1134         <rdar://problem/46627875>
1135
1136         Reviewed by Brady Eidson.
1137
1138         sourceApplicationAuditData has been used for a long time on iOS, but it's needed on more platforms.
1139         I also made it return an Optional instead of a bool and returning by reference. Ahhh. So much nicer.
1140
1141         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
1142         (WebKit::NetworkProcess::sourceApplicationAuditData const):
1143         * Platform/IPC/Connection.h:
1144         * Platform/IPC/mac/ConnectionMac.mm:
1145         (IPC::Connection::getAuditToken):
1146         * WebProcess/WebProcess.cpp:
1147         (WebKit::WebProcess::initializeWebProcess):
1148         * WebProcess/cocoa/WebProcessCocoa.mm:
1149         (WebKit::WebProcess::sourceApplicationAuditData const):
1150
1151 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
1152
1153         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
1154         https://bugs.webkit.org/show_bug.cgi?id=192061
1155
1156         Reviewed by Dewei Zhu.
1157
1158         Part 5.
1159
1160         Add some additional temporary logging info to determine if the time out value passed to the timer is respected.
1161         Once the bug is determined and fixed, we should remove all logging added in this patch.
1162
1163         Reviewed by Dewei Zhu.
1164
1165         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1166         (WebKit::AuthenticatorManager::initTimeOutTimer):
1167         (WebKit::AuthenticatorManager::timeOutTimerFired):
1168
1169 2018-12-21  Keith Rollin  <krollin@apple.com>
1170
1171         Crash in com.apple.WebKit: WebKit::WebResourceLoader::willSendRequest + 223
1172         https://bugs.webkit.org/show_bug.cgi?id=192989
1173
1174         Reviewed by Chris Dumez.
1175
1176         willSendRequest is calling maybeLoadFallbackForRedirect, which can
1177         delete “this”. After that, some new logging code tries to access
1178         “this” and causes the crash. Fix this by adjusting the scope of a
1179         "protectedThis".
1180
1181         * WebProcess/Network/WebResourceLoader.cpp:
1182         (WebKit::WebResourceLoader::willSendRequest):
1183
1184 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
1185
1186         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
1187         https://bugs.webkit.org/show_bug.cgi?id=190466
1188
1189         Reviewed by Youenn Fablet.
1190
1191         Added persistency to the DeviceIdHashSaltStorage. Implemented a
1192         decoder and an encoder for the HashSaltForOrigin struct to store
1193         it in a file, this allows us to save the lastTimeUsed, the origin
1194         and the hash salt. It uses a new directory where it creates a file
1195         per hash salt, the name of the file is the hash salt to avoid
1196         leaking information in the system. The last time used and the
1197         origin are stored inside the file, it also adds a version
1198         directory used to change the structure of the file in the future,
1199         if we need to do it. In the DeviceIdHashSaltStorage class the disk
1200         operations happen in a WorkQueue, but all interactions go in the
1201         main thread. We added code to handle the operations when the load
1202         still did not finish.
1203
1204         * Platform/Logging.h:
1205         Added channel DiskPersistency..
1206         * Sources.txt: Added new files.
1207         * UIProcess/API/APIProcessPoolConfiguration.cpp: Added code to set
1208         the directory for the deviceIdHashSalts. That way we can use the
1209         configuration when creating the DeviceIdHashSaltStorage.
1210         (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
1211         (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
1212         (API::ProcessPoolConfiguration::copy):
1213         * UIProcess/API/APIProcessPoolConfiguration.h:
1214         * UIProcess/API/APIWebsiteDataStore.cpp:
1215         (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration):
1216         Added code to set the directory in the disk used to store the
1217         information.
1218         * UIProcess/API/APIWebsiteDataStore.h: Ditto.
1219         * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: Added dummy
1220         implementation to get the directory in cocoa.
1221         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1222         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1223         * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: Defined the
1224         default directories used to store the information in the disk.
1225         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1226         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1227         (API::WebsiteDataStore::defaultDataStoreConfiguration):
1228         * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
1229         (webkitWebsiteDataManagerGetDataStore): Added the directory used
1230         to store the information.
1231         (webkit_website_data_manager_remove): Modified the way we use to
1232         make sure when we remove the cookies we also remove the hash salts.
1233         * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: Added dummy
1234         implementations to get the directory in windows platform.
1235         (API::WebsiteDataStore::defaultDeviceIdHashSaltsStorageDirectory):
1236         (API::WebsiteDataStore::legacyDefaultDeviceIdHashSaltsStorageDirectory):
1237         * UIProcess/API/C/WKBackForwardListItemRef.cpp: Add namespace, it
1238         seems some unified build compilation issue.
1239         * UIProcess/DeviceIdHashSaltStorage.cpp:
1240         (WebKit::DeviceIdHashSaltStorage::create): Added a create method
1241         used to pass the directory and the persistency status of the websitedatastore.
1242         (WebKit::DeviceIdHashSaltStorage::completeHandler): Added to share
1243         the code copying the origins to complete the get handler.
1244         (WebKit::DeviceIdHashSaltStorage::completeDeviceIdHashSaltForOriginCall):
1245         Added to share the code when completing the task of getting a new
1246         hash salt.
1247         (WebKit::DeviceIdHashSaltStorage::DeviceIdHashSaltStorage): Added
1248         a new constructor for the create method.
1249         (WebKit::getSecurityOriginData): Added to get the
1250         SecurityOriginData from a field in the decoder and do all the
1251         checks.
1252         (WebKit::DeviceIdHashSaltStorage::loadStorageFromDisk): Open the
1253         directory and restore all the hash salts from disk to the memory
1254         structure.
1255         (WebKit::DeviceIdHashSaltStorage::createEncoderFromData const):
1256         Creates the decoder to store the HashSaltForOrigin structure.
1257         (WebKit::DeviceIdHashSaltStorage::storeHashSaltToDisk): Write to
1258         disk a decoder object created from a HashSaltForOrigin
1259         structure. It uses the writeEncoderToDisk function.
1260         (WebKit::DeviceIdHashSaltStorage::deviceIdHashSaltForOrigin): Make
1261         sure we store in disk a new hash salt when it is generated and the
1262         WebsiteDataStore is persistent. Add a completionHandler to return
1263         the value found or generated, this way we can control if the
1264         HashMap is already loaded from disk.
1265         (WebKit::DeviceIdHashSaltStorage::getDeviceIdHashSaltOrigins):
1266         Make sure we run the get in a queue now that we store information
1267         in disk.
1268         (WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDiskIfNeeded):
1269         Added code to make sure we remove the files in disk.
1270         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltForOrigins):
1271         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
1272         (WebKit::DeviceIdHashSaltStorage::deleteDeviceIdHashSaltOriginsModifiedSince):
1273         Added code to use the deleteHashSaltFromDiskIfNeeded and remove the files in disk.
1274         * UIProcess/DeviceIdHashSaltStorage.h: Ditto.
1275         * UIProcess/PersistencyUtils.cpp: Added file to share the
1276         persistency code with the ResourceLoadStatisticsPersistentStorage class.
1277         (WebKit::createDecoderForFile): Ditto.
1278         (WebKit::writeEncoderToDisk): Ditto.
1279         * UIProcess/PersistencyUtils.h: Ditto.
1280         * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp: Use the
1281         new PersistencyUtils functions shared with the
1282         DeviceIdHashSaltStorage class.
1283         (WebKit::ResourceLoadStatisticsPersistentStorage::refreshMemoryStoreFromDisk):
1284         (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
1285         (WebKit::ResourceLoadStatisticsPersistentStorage::writeMemoryStoreToDisk):
1286         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: After
1287         changing the API of the deviceIdHashSaltForOrigin we now use a
1288         completionHandler because it could happen the HashMap is not still
1289         loaded and we would have to wait for it. We refactored the calls
1290         to the method to use this new completionHandler.
1291         (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
1292         (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
1293         (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
1294         * UIProcess/WebsiteData/WebsiteDataStore.cpp:
1295         (WebKit::WebsiteDataStore::WebsiteDataStore): Create the
1296         DeviceIdHashSaltStorage class with the persistency information.
1297         (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): Make
1298         sure we have the directory to store the information.
1299         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: Add get
1300         and set functions for the deviceHashSaltStorageDirectory.
1301         * WebKit.xcodeproj/project.pbxproj: Added PersistencyUtils file to
1302         the xcode compilation.
1303
1304 2018-12-20  Alex Christensen  <achristensen@webkit.org>
1305
1306         Remove unused NetworkProcessCreationParameters
1307         https://bugs.webkit.org/show_bug.cgi?id=192961
1308
1309         Reviewed by Andy Estes.
1310
1311         loadThrottleLatency isn't used since I replaced it with NetworkSessionCreationParameters.loadThrottleLatency in r238654
1312         presentingApplicationPID has no effect because that value is only used in the WebProcess in NetworkExtensionContentFilter::initialize
1313
1314         * NetworkProcess/NetworkProcess.cpp:
1315         (WebKit::NetworkProcess::initializeNetworkProcess):
1316         * NetworkProcess/NetworkProcessCreationParameters.cpp:
1317         (WebKit::NetworkProcessCreationParameters::encode const):
1318         (WebKit::NetworkProcessCreationParameters::decode):
1319         * NetworkProcess/NetworkProcessCreationParameters.h:
1320         * UIProcess/WebProcessPool.cpp:
1321         (WebKit::WebProcessPool::ensureNetworkProcess):
1322
1323 2018-12-20  Chris Dumez  <cdumez@apple.com>
1324
1325         Use Optional::hasValue() instead of Optional::has_value()
1326         https://bugs.webkit.org/show_bug.cgi?id=192948
1327
1328         Reviewed by Tim Horton.
1329
1330         * UIProcess/Automation/WebAutomationSession.cpp:
1331         (WebKit::AutomationCommandError::toProtocolString):
1332         (WebKit::WebAutomationSession::willClosePage):
1333         * WebProcess/Automation/WebAutomationSessionProxy.cpp:
1334         (WebKit::WebAutomationSessionProxy::computeElementLayout):
1335
1336 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
1337
1338         Flicker when exiting element fullscreen.
1339         https://bugs.webkit.org/show_bug.cgi?id=192774
1340         rdar://problem/33088878
1341
1342         Reviewed by Jer Noble.
1343
1344         Fixes an issue where the web page would flicker upon exiting element fullscreen.
1345
1346         Replace WebView with a snapshot while the WebView is restyled and resized for inline.
1347
1348         * UIProcess/mac/WKFullScreenWindowController.h:
1349         * UIProcess/mac/WKFullScreenWindowController.mm:
1350         (-[WKFullScreenWindowController initWithWindow:webView:page:]):
1351         (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
1352         (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
1353
1354 2018-12-20  Chris Dumez  <cdumez@apple.com>
1355
1356         Move HTTPS_UPGRADE code behind a runtime flag, off by default
1357         https://bugs.webkit.org/show_bug.cgi?id=192937
1358
1359         Reviewed by Youenn Fablet.
1360
1361         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
1362
1363         * Configurations/WebKit.xcconfig:
1364         * DerivedSources.make:
1365         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp:
1366         * NetworkProcess/NetworkHTTPSUpgradeChecker.h:
1367         * NetworkProcess/NetworkLoadChecker.cpp:
1368         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
1369         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
1370         (WebKit::NetworkLoadChecker::checkRequest):
1371         * NetworkProcess/NetworkLoadChecker.h:
1372         * NetworkProcess/NetworkProcess.h:
1373         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
1374         * NetworkProcess/NetworkResourceLoadParameters.cpp:
1375         (WebKit::NetworkResourceLoadParameters::encode const):
1376         (WebKit::NetworkResourceLoadParameters::decode):
1377         * NetworkProcess/NetworkResourceLoadParameters.h:
1378         * NetworkProcess/NetworkResourceLoader.cpp:
1379         * NetworkProcess/PingLoad.cpp:
1380         (WebKit::PingLoad::PingLoad):
1381         * Shared/WebPreferences.yaml:
1382         * WebProcess/Network/WebLoaderStrategy.cpp:
1383         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1384         * config.h:
1385
1386 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
1387
1388         [WebAuthN] Add a runtime flag for local authenticator
1389         https://bugs.webkit.org/show_bug.cgi?id=192792
1390         <rdar://problem/46798738>
1391
1392         Reviewed by Brent Fulgham.
1393
1394         * Shared/WebPreferences.yaml:
1395         * UIProcess/API/C/WKPreferences.cpp:
1396         (WKPreferencesSetWebAuthenticationLocalAuthenticatorEnabled):
1397         (WKPreferencesGetWebAuthenticationLocalAuthenticatorEnabled):
1398         * UIProcess/API/C/WKPreferencesRefPrivate.h:
1399         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
1400         (WebKit::LocalService::isAvailable):
1401
1402 2018-12-20  Chris Dumez  <cdumez@apple.com>
1403
1404         Use Optional::valueOr() instead of Optional::value_or()
1405         https://bugs.webkit.org/show_bug.cgi?id=192933
1406
1407         Reviewed by Geoffrey Garen.
1408
1409         * Shared/API/c/WKSecurityOriginRef.cpp:
1410         (WKSecurityOriginGetPort):
1411         * UIProcess/API/APIProcessPoolConfiguration.h:
1412         * UIProcess/API/Cocoa/WKSecurityOrigin.mm:
1413         (-[WKSecurityOrigin port]):
1414         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1415         (-[WKWebViewConfiguration _cpuLimit]):
1416         * UIProcess/API/glib/WebKitSecurityOrigin.cpp:
1417         (webkit_security_origin_get_port):
1418         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1419         (webkitWebViewBaseHandleWheelEvent):
1420         * UIProcess/Automation/SimulatedInputDispatcher.cpp:
1421         (WebKit::SimulatedInputKeyFrame::maximumDuration const):
1422         (WebKit::SimulatedInputDispatcher::transitionInputSourceToState):
1423         * UIProcess/Automation/WebAutomationSession.cpp:
1424         (WebKit::WebAutomationSession::setWindowFrameOfBrowsingContext):
1425         (WebKit::WebAutomationSession::performInteractionSequence):
1426         * UIProcess/Automation/WebAutomationSessionMacros.h:
1427         * UIProcess/ServiceWorkerProcessProxy.cpp:
1428         (WebKit::ServiceWorkerProcessProxy::start):
1429         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
1430         (WebKit::AuthenticatorManager::initTimeOutTimer):
1431         * UIProcess/WebPageProxy.cpp:
1432         (WebKit::WebPageProxy::deviceScaleFactor const):
1433         * UIProcess/WebPageProxy.h:
1434         (WebKit::WebPageProxy::viewportSizeForCSSViewportUnits const):
1435         * UIProcess/gtk/WebPopupMenuProxyGtk.cpp:
1436         (WebKit::WebPopupMenuProxyGtk::activateItem):
1437         * UIProcess/mac/LegacySessionStateCoding.cpp:
1438         (WebKit::encodeFormDataElement):
1439         * WebProcess/Network/WebLoaderStrategy.cpp:
1440         (WebKit::WebLoaderStrategy::scheduleLoad):
1441         * WebProcess/Plugins/PDF/PDFPlugin.mm:
1442         (WebKit::PDFPlugin::convertFromPDFViewToRootView const):
1443         (WebKit::PDFPlugin::boundsOnScreen const):
1444         (WebKit::PDFPlugin::geometryDidChange):
1445         * WebProcess/WebCoreSupport/SessionStateConversion.cpp:
1446         (WebKit::toFormData):
1447         * WebProcess/WebPage/ios/WebPageIOS.mm:
1448         (WebKit::WebPage::updateVisibleContentRects):
1449         * WebProcess/WebPage/wpe/CompositingManager.cpp:
1450         (WebKit::CompositingManager::releaseConnectionFd):
1451
1452 2018-12-20  Keith Rollin  <krollin@apple.com>
1453
1454         Improve release-level page-load logging
1455         https://bugs.webkit.org/show_bug.cgi?id=192872
1456         <rdar://problem/46850309>
1457
1458         Reviewed by Chris Dumez.
1459
1460         There are a number of reported bugs that are difficult or impossible
1461         to track down with our current level of logging. Additionally, some
1462         software groups lower in the page-loading stack have requested logging
1463         sufficient for tracking a user-visible error message down to the
1464         requested resource that caused the message. Add more-comprehensive
1465         logging to address these issues/requests.
1466
1467         * UIProcess/WebPageProxy.cpp:
1468         (WebKit::m_editableImageController):
1469         (WebKit::WebPageProxy::~WebPageProxy):
1470         (WebKit::WebPageProxy::reattachToWebProcess):
1471         (WebKit::WebPageProxy::swapToWebProcess):
1472         (WebKit::WebPageProxy::reattachToWebProcessForReload):
1473         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
1474         (WebKit::WebPageProxy::close):
1475         (WebKit::WebPageProxy::tryClose):
1476         (WebKit::WebPageProxy::loadRequest):
1477         (WebKit::WebPageProxy::loadRequestWithNavigation):
1478         (WebKit::WebPageProxy::loadFile):
1479         (WebKit::WebPageProxy::loadData):
1480         (WebKit::WebPageProxy::loadDataWithNavigation):
1481         (WebKit::WebPageProxy::loadAlternateHTML):
1482         (WebKit::WebPageProxy::loadWebArchiveData):
1483         (WebKit::WebPageProxy::navigateToPDFLinkWithSimulatedClick):
1484         (WebKit::WebPageProxy::stopLoading):
1485         (WebKit::WebPageProxy::reload):
1486         (WebKit::WebPageProxy::goToBackForwardItem):
1487         (WebKit::WebPageProxy::tryRestoreScrollPosition):
1488         (WebKit::WebPageProxy::updateThrottleState):
1489         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
1490         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1491         (WebKit::WebPageProxy::restoreFromSessionState):
1492         (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
1493         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
1494         (WebKit::WebPageProxy::willPerformClientRedirectForFrame):
1495         (WebKit::WebPageProxy::didCancelClientRedirectForFrame):
1496         (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
1497         (WebKit::WebPageProxy::didCommitLoadForFrame):
1498         (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
1499         (WebKit::WebPageProxy::didFinishLoadForFrame):
1500         (WebKit::WebPageProxy::didFailLoadForFrame):
1501         (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
1502         (WebKit::WebPageProxy::didNavigateWithNavigationData):
1503         (WebKit::WebPageProxy::didPerformClientRedirect):
1504         (WebKit::WebPageProxy::didPerformServerRedirect):
1505         (WebKit::WebPageProxy::processDidBecomeUnresponsive):
1506         (WebKit::WebPageProxy::processDidBecomeResponsive):
1507         (WebKit::WebPageProxy::processDidTerminate):
1508         (WebKit::WebPageProxy::dispatchProcessDidTerminate):
1509         (WebKit::WebPageProxy::tryReloadAfterProcessTermination):
1510         (WebKit::WebPageProxy::didExceedInactiveMemoryLimitWhileActive):
1511         (WebKit::WebPageProxy::didExceedBackgroundCPULimitWhileInForeground):
1512         * WebProcess/Network/WebLoaderStrategy.cpp:
1513         (WebKit::WebLoaderStrategy::scheduleLoad):
1514         (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess):
1515         (WebKit::WebLoaderStrategy::loadResourceSynchronously):
1516         * WebProcess/Network/WebResourceLoader.cpp:
1517         (WebKit::WebResourceLoader::willSendRequest):
1518         (WebKit::WebResourceLoader::didReceiveResponse):
1519         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1520         (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
1521         (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
1522
1523 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1524
1525         [iOS] Replace "node assistance" terminology in WebKit with "focused element"
1526         https://bugs.webkit.org/show_bug.cgi?id=192936
1527
1528         Reviewed by Tim Horton.
1529
1530         Renames a few methods and data structures in WebKit, to refer to "focused elements" rather than "assisted nodes";
1531         see below for more details. No new tests, because there should be no change in behavior.
1532
1533         * Shared/FocusedElementInformation.cpp: Renamed from Source/WebKit/Shared/AssistedNodeInformation.cpp.
1534         (WebKit::OptionItem::encode const):
1535         (WebKit::OptionItem::decode):
1536         (WebKit::FocusedElementInformation::encode const):
1537         (WebKit::FocusedElementInformation::decode):
1538         * Shared/FocusedElementInformation.h: Renamed from Source/WebKit/Shared/AssistedNodeInformation.h.
1539
1540         Rename AssistedNodeInformation to FocusedElementInformation. Additionally, introduce a named type for the
1541         focusedElementIdentifier (which is currently just a `uint64_t`).
1542
1543         (WebKit::OptionItem::OptionItem):
1544         * Shared/ios/InteractionInformationAtPosition.h:
1545         * Shared/ios/InteractionInformationAtPosition.mm:
1546         (WebKit::InteractionInformationAtPosition::encode const):
1547         (WebKit::InteractionInformationAtPosition::decode):
1548         * SourcesCocoa.txt:
1549         * UIProcess/API/Cocoa/WKWebView.mm:
1550         (-[WKWebView _shouldUpdateKeyboardWithInfo:]):
1551         * UIProcess/PageClient.h:
1552         * UIProcess/WebPageProxy.cpp:
1553         (WebKit::WebPageProxy::resetStateAfterProcessExited):
1554         * UIProcess/WebPageProxy.h:
1555
1556         Rename NodeAssistanceArguments to ElementDidFocusArguments (and also add a FIXME for removing this mechanism
1557         eventually).
1558
1559         (WebKit::WebPageProxy::focusNextFocusedElement):
1560         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
1561         * UIProcess/WebPageProxy.messages.in:
1562
1563         Rename StartAssistingNode to ElementDidFocus, and StopAssistingNode to ElementDidBlur.
1564
1565         * UIProcess/ios/PageClientImplIOS.h:
1566         * UIProcess/ios/PageClientImplIOS.mm:
1567         (WebKit::PageClientImpl::elementDidFocus):
1568         (WebKit::PageClientImpl::isFocusingElement):
1569         (WebKit::PageClientImpl::elementDidBlur):
1570         (WebKit::PageClientImpl::startAssistingNode): Deleted.
1571         (WebKit::PageClientImpl::isAssistingNode): Deleted.
1572         (WebKit::PageClientImpl::stopAssistingNode): Deleted.
1573         * UIProcess/ios/WKContentView.h:
1574         * UIProcess/ios/WKContentView.mm:
1575         (-[WKContentView isFocusingElement]):
1576         (-[WKContentView _didCommitLoadForMainFrame]):
1577         (-[WKContentView isAssistingNode]): Deleted.
1578         * UIProcess/ios/WKContentViewInteraction.h:
1579         * UIProcess/ios/WKContentViewInteraction.mm:
1580         (-[WKFocusedElementInfo initWithFocusedElementInformation:isUserInitiated:userObject:]):
1581         (hasFocusedElement):
1582         (-[WKContentView cleanupInteraction]):
1583         (-[WKContentView shouldHideSelectionWhenScrolling]):
1584         (-[WKContentView resignFirstResponderForWebView]):
1585         (-[WKContentView _didGetTapHighlightForRequest:color:quads:topLeftRadius:topRightRadius:bottomLeftRadius:bottomRightRadius:]):
1586         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
1587         (-[WKContentView _zoomToRevealFocusedElement]):
1588         (-[WKContentView inputView]):
1589         (-[WKContentView _selectionClipRect]):
1590         (-[WKContentView gestureRecognizerShouldBegin:]):
1591         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
1592         (-[WKContentView clearSelection]):
1593         (-[WKContentView requiresAccessoryView]):
1594         (-[WKContentView canPerformActionForWebView:withSender:]):
1595         (-[WKContentView _isInteractingWithFocusedElement]):
1596         (-[WKContentView changeSelectionWithGestureAt:withGesture:withState:withFlags:]):
1597         (-[WKContentView selectPositionAtPoint:completionHandler:]):
1598         (-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
1599         (-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
1600         (-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
1601         (-[WKContentView updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
1602         (-[WKContentView accessoryTab:]):
1603         (-[WKContentView _becomeFirstResponderWithSelectionMovingForward:completionHandler:]):
1604         (-[WKContentView accessoryClear]):
1605         (-[WKContentView _updateAccessory]):
1606         (-[WKContentView insertTextSuggestion:]):
1607         (-[WKContentView setSelectedTextRange:]):
1608         (-[WKContentView textInputTraits]):
1609         (-[WKContentView isScrollableForKeyboardScrollViewAnimator:]):
1610         (-[WKContentView focusedElementInformation]):
1611         (-[WKContentView focusedSelectElementOptions]):
1612         (rectToRevealWhenZoomingToFocusedElement):
1613         (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1614         (-[WKContentView _elementDidBlur]):
1615         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
1616         (-[WKContentView updateCurrentFocusedElementInformation:]):
1617         (-[WKContentView presentViewControllerForCurrentFocusedElement]):
1618         (-[WKContentView focusedFormControlViewDidSubmit:]):
1619         (-[WKContentView focusedFormControlViewDidCancel:]):
1620         (-[WKContentView focusedFormControlViewDidBeginEditing:]):
1621         (-[WKContentView rectForFocusedFormControlView:]):
1622         (-[WKContentView nextRectForFocusedFormControlView:]):
1623         (-[WKContentView previousRectForFocusedFormControlView:]):
1624         (-[WKContentView actionNameForFocusedFormControlView:]):
1625         (-[WKContentView focusedFormControlViewDidRequestNextNode:]):
1626         (-[WKContentView focusedFormControlViewDidRequestPreviousNode:]):
1627         (-[WKContentView hasNextNodeForFocusedFormControlView:]):
1628         (-[WKContentView hasPreviousNodeForFocusedFormControlView:]):
1629         (-[WKContentView selectMenu:didSelectItemAtIndex:]):
1630         (-[WKContentView numberOfItemsInSelectMenu:]):
1631         (-[WKContentView selectMenu:displayTextForItemAtIndex:]):
1632         (-[WKContentView selectMenu:didCheckItemAtIndex:checked:]):
1633         (-[WKContentView selectMenuUsesMultipleSelection:]):
1634         (-[WKContentView selectMenu:hasSelectedOptionAtIndex:]):
1635         (-[WKContentView _updateChangedSelection:]):
1636         (-[WKContentView _autofillContext]):
1637         (-[WKContentView dismissQuickboardViewControllerAndRevealFocusedFormOverlayIfNecessary:]):
1638         (-[WKContentView allowsLanguageSelectionMenuForListViewController:]):
1639         (-[WKContentView inputLabelTextForViewController:]):
1640         (-[WKContentView initialValueForViewController:]):
1641         (-[WKContentView shouldDisplayInputContextViewForListViewController:]):
1642         (-[WKContentView numericInputModeForListViewController:]):
1643         (-[WKContentView textContentTypeForListViewController:]):
1644         (-[WKContentView allowsDictationInputForListViewController:]):
1645         (-[WKFocusedElementInfo initWithAssistedNodeInformation:isUserInitiated:userObject:]): Deleted.
1646         (hasAssistedNode): Deleted.
1647
1648         Replaced with hasFocusedElement.
1649
1650         (-[WKContentView _isInteractingWithAssistedNode]): Deleted.
1651         (-[WKContentView assistedNodeInformation]): Deleted.
1652         (-[WKContentView assistedNodeSelectOptions]): Deleted.
1653         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): Deleted.
1654         (-[WKContentView _stopAssistingNode]): Deleted.
1655         (-[WKContentView updateCurrentAssistedNodeInformation:]): Deleted.
1656         (-[WKContentView presentViewControllerForCurrentAssistedNode]): Deleted.
1657         * UIProcess/ios/WebDataListSuggestionsDropdownIOS.mm:
1658         (-[WKDataListSuggestionsControl textAlignment]):
1659         * UIProcess/ios/WebPageProxyIOS.mm:
1660         (WebKit::WebPageProxy::focusedElementInformationCallback):
1661         (WebKit::WebPageProxy::requestFocusedElementInformation):
1662         (WebKit::WebPageProxy::computeCustomFixedPositionRect const):
1663         (WebKit::WebPageProxy::didCommitLayerTree):
1664         (WebKit::WebPageProxy::selectWithGesture):
1665         (WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
1666         (WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
1667         (WebKit::WebPageProxy::selectPositionAtPoint):
1668         (WebKit::WebPageProxy::updateSelectionWithExtentPoint):
1669         (WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
1670         (WebKit::WebPageProxy::blurFocusedElement):
1671         (WebKit::WebPageProxy::elementDidFocus):
1672         (WebKit::WebPageProxy::elementDidBlur):
1673         (WebKit::WebPageProxy::focusNextFocusedElement):
1674         (WebKit::WebPageProxy::setFocusedElementValue):
1675         (WebKit::WebPageProxy::setFocusedElementValueAsNumber):
1676         (WebKit::WebPageProxy::setFocusedElementSelectedIndex):
1677         (WebKit::WebPageProxy::assistedNodeInformationCallback): Deleted.
1678         (WebKit::WebPageProxy::requestAssistedNodeInformation): Deleted.
1679         (WebKit::WebPageProxy::blurAssistedNode): Deleted.
1680         (WebKit::WebPageProxy::startAssistingNode): Deleted.
1681         (WebKit::WebPageProxy::stopAssistingNode): Deleted.
1682         (WebKit::WebPageProxy::focusNextAssistedNode): Deleted.
1683         (WebKit::WebPageProxy::setAssistedNodeValue): Deleted.
1684         (WebKit::WebPageProxy::setAssistedNodeValueAsNumber): Deleted.
1685         (WebKit::WebPageProxy::setAssistedNodeSelectedIndex): Deleted.
1686         * UIProcess/ios/forms/WKFormColorPicker.mm:
1687         (-[WKColorPicker initWithView:]):
1688         (-[WKColorPicker setControlValueFromUIColor:]):
1689         * UIProcess/ios/forms/WKFormInputControl.mm:
1690         (-[WKDateTimePicker initWithView:datePickerMode:]):
1691         (-[WKDateTimePicker shouldPresentGregorianCalendar:]):
1692         (-[WKDateTimePicker _dateChangedSetAsNumber]):
1693         (-[WKDateTimePicker _dateChangedSetAsString]):
1694         (-[WKDateTimePicker controlBeginEditing]):
1695         (-[WKFormInputControl initWithView:]):
1696         (-[WKDateTimePopover clear:]):
1697         (-[WKDateTimePopover initWithView:datePickerMode:]):
1698         * UIProcess/ios/forms/WKFormPopover.mm:
1699         (-[WKRotatingPopover presentPopoverAnimated:]):
1700         * UIProcess/ios/forms/WKFormSelectControl.h:
1701         * UIProcess/ios/forms/WKFormSelectControl.mm:
1702         (-[WKFormSelectControl initWithView:]):
1703         * UIProcess/ios/forms/WKFormSelectPicker.mm:
1704         (-[WKMultipleSelectPicker initWithView:]):
1705         (-[WKMultipleSelectPicker pickerView:viewForRow:forComponent:reusingView:]):
1706         (-[WKMultipleSelectPicker pickerView:numberOfRowsInComponent:]):
1707         (-[WKMultipleSelectPicker findItemIndexAt:]):
1708         (-[WKMultipleSelectPicker pickerView:row:column:checked:]):
1709         (-[WKSelectSinglePicker initWithView:]):
1710         (-[WKSelectSinglePicker controlEndEditing]):
1711         (-[WKSelectSinglePicker pickerView:numberOfRowsInComponent:]):
1712         (-[WKSelectSinglePicker pickerView:attributedTitleForRow:forComponent:]):
1713         (-[WKSelectSinglePicker pickerView:didSelectRow:inComponent:]):
1714         * UIProcess/ios/forms/WKFormSelectPopover.mm:
1715         (-[WKSelectTableViewController initWithView:hasGroups:]):
1716         (-[WKSelectTableViewController tableView:numberOfRowsInSection:]):
1717         (-[WKSelectTableViewController tableView:titleForHeaderInSection:]):
1718         (-[WKSelectTableViewController findItemIndexAt:]):
1719         (-[WKSelectTableViewController findItemAt:]):
1720         (-[WKSelectTableViewController tableView:cellForRowAtIndexPath:]):
1721         (-[WKSelectTableViewController tableView:didSelectRowAtIndexPath:]):
1722         (-[WKSelectPopover initWithView:hasGroups:]):
1723         * WebKit.xcodeproj/project.pbxproj:
1724         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1725         (WebKit::WebChromeClient::elementDidFocus):
1726         (WebKit::WebChromeClient::elementDidRefocus):
1727         (WebKit::WebChromeClient::elementDidBlur):
1728         * WebProcess/WebPage/WebPage.cpp:
1729         (WebKit::WebPage::didStartPageTransition):
1730         (WebKit::WebPage::setTextAsync):
1731         (WebKit::WebPage::resetFocusedElementForFrame):
1732         (WebKit::WebPage::elementDidRefocus):
1733         (WebKit::WebPage::elementDidFocus):
1734         (WebKit::WebPage::elementDidBlur):
1735         (WebKit::WebPage::didCommitLoad):
1736         (WebKit::WebPage::resetAssistedNodeForFrame): Deleted.
1737         * WebProcess/WebPage/WebPage.h:
1738
1739         Refactor elementDid{Refocus|Focus|Blur} to take `Element&` rather than `Node*`.
1740
1741         * WebProcess/WebPage/WebPage.messages.in:
1742         * WebProcess/WebPage/ios/WebPageIOS.mm:
1743
1744         Replace m_assistedNode (a `RefPtr<Node>`) with m_focusedElement (a `RefPtr<Element>`).
1745
1746         (WebKit::WebPage::platformEditorState const):
1747         (WebKit::WebPage::completeSyntheticClick):
1748         (WebKit::WebPage::requestFocusedElementInformation):
1749         (WebKit::WebPage::blurFocusedElement):
1750         (WebKit::WebPage::setFocusedElementValue):
1751         (WebKit::WebPage::setFocusedElementValueAsNumber):
1752         (WebKit::WebPage::setFocusedElementSelectedIndex):
1753         (WebKit::innerFrameQuad):
1754         (WebKit::constrainPoint):
1755         (WebKit::WebPage::selectWithGesture):
1756         (WebKit::WebPage::startAutoscrollAtPosition):
1757         (WebKit::WebPage::visiblePositionInFocusedNodeForPoint):
1758         (WebKit::WebPage::selectPositionAtPoint):
1759         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1760         (WebKit::WebPage::rangeForGranularityAtPoint):
1761         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1762         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1763         (WebKit::WebPage::updateSelectionWithExtentPoint):
1764         (WebKit::WebPage::getPositionInformation):
1765         (WebKit::WebPage::focusNextFocusedElement):
1766         (WebKit::WebPage::getFocusedElementInformation):
1767         (WebKit::WebPage::autofillLoginCredentials):
1768         (WebKit::WebPage::requestAssistedNodeInformation): Deleted.
1769         (WebKit::WebPage::blurAssistedNode): Deleted.
1770         (WebKit::WebPage::setAssistedNodeValue): Deleted.
1771         (WebKit::WebPage::setAssistedNodeValueAsNumber): Deleted.
1772         (WebKit::WebPage::setAssistedNodeSelectedIndex): Deleted.
1773         (WebKit::WebPage::focusNextAssistedNode): Deleted.
1774         (WebKit::WebPage::getAssistedNodeInformation): Deleted.
1775
1776 2018-12-20  Brent Fulgham  <bfulgham@apple.com>
1777
1778         WKWebView default UA doesn't freeze the build number
1779         https://bugs.webkit.org/show_bug.cgi?id=192809
1780         <rdar://problem/44687185>
1781
1782         Reviewed by Andy Estes.
1783
1784         Always reports the frozen build number.
1785
1786         * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
1787         (defaultApplicationNameForUserAgent): Do not expose the actual build number through this API.
1788
1789 2018-12-20  Jer Noble  <jer.noble@apple.com>
1790
1791         Enable MediaCapabilities by default.
1792         https://bugs.webkit.org/show_bug.cgi?id=192340
1793         <rdar://problem/46435149>
1794
1795         Reviewed by Dean Jackson.
1796
1797         * Shared/WebPreferences.yaml:
1798
1799 2018-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1800
1801         [GTK] WebDriver: tests in imported/w3c/webdriver/tests/element_clear/user_prompts.py are failing
1802         https://bugs.webkit.org/show_bug.cgi?id=192927
1803
1804         Reviewed by Michael Catanzaro.
1805
1806         Give the focus back to the web view when a dialog is dismissed.
1807
1808         * UIProcess/API/gtk/WebKitWebViewBase.cpp:
1809         (webkitWebViewBaseContainerRemove):
1810
1811 2018-12-20  Tim Horton  <timothy_horton@apple.com>
1812
1813         Unparented WKWebView can't retrieve main resource data for a main frame plugin
1814         https://bugs.webkit.org/show_bug.cgi?id=192923
1815         <rdar://problem/46859068>
1816
1817         Reviewed by Wenson Hsieh.
1818
1819         * WebProcess/Plugins/PluginView.cpp:
1820         (WebKit::PluginView::liveResourceData const):
1821         If the WKWebView is unparented, we may not immediately initialize the plugin.
1822         In that case, PluginView holds on to the backing data until the plugin
1823         is initialized. If a WKWebView API client asks for the backing data
1824         for the plugin during this time, we should return it, instead of bailing.
1825
1826 2018-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1827
1828         [iOS] Focusing an editable element should scroll to reveal the selection
1829         https://bugs.webkit.org/show_bug.cgi?id=192802
1830         <rdar://problem/46781759>
1831
1832         Reviewed by Tim Horton.
1833
1834         Currently, when tapping on an editable element, logic in -[WKWebView _zoomToFocusRect:…:] attempts to adjust the
1835         visible viewport such that the rect containing the selection is visible. However, AssistedNodeInformation's
1836         selectionRect is used here, which (as the FIXME in WebPage::getAssistedNodeInformation notes) is either the last
1837         touch location, or the top left of the element if the touch location is outside of the element's bounding rect.
1838         This leads to confusing and undesirable behavior when tapping near the bottom of a large contenteditable element
1839         to focus it, since the actual selection will end up near the top of the element, yet we'll try to scroll to
1840         reveal the bottom of the element, which causes the visible selection to scroll offscreen. Notably, this affects
1841         scenarios involving editable web views embedded in apps, such as Mail compose.
1842
1843         Right now, we use the last touch location as an approximation for the selection rect because the selection may
1844         have not yet been updated at the moment when focus moves into an editable element. To fix this, we defer the
1845         process of zooming to the focused element rect until after the selection changes and the UI process is updated
1846         with information about the new selection rects.
1847
1848         Test: editing/selection/ios/selection-is-visible-after-focusing-editable-area.html
1849
1850         * Shared/AssistedNodeInformation.cpp:
1851         (WebKit::AssistedNodeInformation::encode const):
1852         (WebKit::AssistedNodeInformation::decode):
1853         * Shared/AssistedNodeInformation.h:
1854
1855         Rename selectionRect to elementInteractionLocation, to more accurately reflect its value and purpose. This isn't
1856         strictly always the last touch location, since we may default to the focused element location instead if the
1857         last touch location is outside of the element rect.
1858
1859         * UIProcess/API/Cocoa/WKWebView.mm:
1860         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
1861
1862         Tweak a constant that determines the minimum amount of margin to leave between the selection rect and the edge
1863         of the window when scrolling to reveal the focused element. Previously, this was larger than necessary to
1864         accomodate for the fact that the "selection rect" used when zooming to the focused element did not take the
1865         actual selection into account at all, and was simply a 1 by 1 rect; this meant that the margin needed to be
1866         large enough to exceed the usual height of a text caret in editable content. Since we now use the real selection
1867         rect, we can be much less generous with this margin.
1868
1869         * UIProcess/ios/WKContentViewInteraction.h:
1870         * UIProcess/ios/WKContentViewInteraction.mm:
1871         (-[WKContentView cleanupInteraction]):
1872         (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
1873
1874         Don't additionally update the selection in the middle of triggering zooming to the focused element; on
1875         particular versions of iOS, this now attempts to scroll the selection rect on-screen, which then conflicts with
1876         zooming to reveal the focused element.
1877
1878         (-[WKContentView _zoomToRevealFocusedElement]):
1879
1880         Renamed from _displayFormNodeInputView to _zoomToRevealFocusedElement, to make the purpose of this function more
1881         clear. Additionally, pull logic to update the accessory view out of this method, so that it's strictly concerned
1882         with zooming to the focused element.
1883
1884         (-[WKContentView inputView]):
1885
1886         Add a FIXME describing the implications of zooming to the focused element in the implementation of -inputView.
1887         See also: <https://bugs.webkit.org/show_bug.cgi?id=192878>.
1888
1889         (-[WKContentView accessoryTab:]):
1890
1891         Fix a subtle issue when keeping track of _didAccessoryTabInitiateFocus. Currently, this is set to YES in
1892         -accessoryTab: and unset in _displayFormNodeInputView, but since _displayFormNodeInputView may be invoked
1893         multiple times for the same focused element (see: -inputView), we might end up zooming to the focused element
1894         with _didAccessoryTabInitiateFocus set to NO, even though we initiated focus with the previous/next buttons.
1895
1896         Instead, temporarily set a different ivar, _isChangingFocusUsingAccessoryTab, to YES in -accessoryTab:, and
1897         unset it in the completion handler after the focused element has changed. Then, when we _startAssistingNode:,
1898         set _didAccessoryTabInitiateFocus to _isChangingFocusUsingAccessoryTab. This ensures that the correctness of
1899         _didAccessoryTabInitiateFocus isn't tied to the number of times -[WKContentView inputView] is invoked when
1900         focusing an element.
1901
1902         (shouldZoomToRevealSelectionRect):
1903         (rectToRevealWhenZoomingToFocusedElement):
1904
1905         Add a helper method to determine the selection rect to use when zooming to reveal the focused element. ASSERTs
1906         that we have post-layout data in the EditorState.
1907
1908         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
1909
1910         When "assisting" a focused element, immediately zoom to it if we don't need selection information to compute the
1911         rect to zoom to; otherwise, defer zooming until we receive the first editor state update in the UI process that
1912         contains information about our selection rects.
1913
1914         (-[WKContentView _stopAssistingNode]):
1915         (-[WKContentView _didReceiveEditorStateUpdateAfterFocus]):
1916
1917         If necessary, reveal the focused element by zooming.
1918
1919         (-[WKContentView _updateInitialWritingDirectionIfNecessary]):
1920
1921         Pull this initial writing direction update logic out into a separate helper method.
1922
1923         (-[WKContentView _displayFormNodeInputView]): Deleted.
1924
1925         Replaced by _zoomToRevealFocusedElement.
1926
1927         * WebProcess/WebCoreSupport/WebChromeClient.cpp:
1928         (WebKit::WebChromeClient::elementDidRefocus):
1929
1930         This currently calls WebChromeClient::elementDidFocus; instead, call the new WebPage::elementDidRefocus;
1931         additionally, make this available on all PLATFORM(COCOA), rather than just IOS_FAMILY.
1932
1933         * WebProcess/WebCoreSupport/WebChromeClient.h:
1934         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
1935         (WebKit::WebChromeClient::elementDidRefocus): Deleted.
1936
1937         Replaced by the PLATFORM(COCOA) version.
1938
1939         * WebProcess/WebPage/WebPage.cpp:
1940         (WebKit::WebPage::elementDidRefocus):
1941
1942         When refocusing an element, ensure that post-layout editor state data is sent to the UI process by including a
1943         full EditorState in the next layer tree transaction.
1944
1945         * WebProcess/WebPage/WebPage.h:
1946         * WebProcess/WebPage/ios/WebPageIOS.mm:
1947         (WebKit::WebPage::completeSyntheticClick):
1948
1949         Call elementDidRefocus instead of elementDidFocus, in the case where the existing focused element is clicked.
1950
1951         (WebKit::WebPage::getAssistedNodeInformation):
1952
1953         Adjust for the change from selectionRect to elementInteractionLocation.
1954
1955 2018-12-20  Patrick Griffis  <pgriffis@igalia.com>
1956
1957         [GTK][WPE] Grant the sandbox read access to XDG_DATA_HOME/prgname
1958         https://bugs.webkit.org/show_bug.cgi?id=192929
1959
1960         Reviewed by Michael Catanzaro.
1961
1962         * UIProcess/API/glib/WebKitWebContext.cpp:
1963         * UIProcess/Launcher/glib/BubblewrapLauncher.cpp:
1964         (WebKit::bubblewrapSpawn):
1965
1966 2018-12-20  Chris Dumez  <cdumez@apple.com>
1967
1968         [PSON] SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache
1969         https://bugs.webkit.org/show_bug.cgi?id=192873
1970
1971         Reviewed by Antti Koivisto.
1972
1973         SuspendedPageProxy fails to release its process assertion if the WebPage fails to enter PageCache, preventing
1974         the process from suspending on iOS.
1975
1976         * UIProcess/SuspendedPageProxy.cpp:
1977         (WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
1978         (WebKit::SuspendedPageProxy::didReceiveMessage):
1979         (WebKit::SuspendedPageProxy::didSuspend): Deleted.
1980         (WebKit::SuspendedPageProxy::didFailToSuspend): Deleted.
1981         * UIProcess/SuspendedPageProxy.h:
1982
1983 2018-12-19  Chris Dumez  <cdumez@apple.com>
1984
1985         wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from
1986         https://bugs.webkit.org/show_bug.cgi?id=192728
1987         <rdar://problem/46746779>
1988
1989         Reviewed by Geoff Garen.
1990
1991         * NetworkProcess/*:
1992         * Platform/*:
1993         * Scripts/*:
1994         * Shared/*:
1995         * UIProcess/*:
1996         * WebProcess/*:
1997
1998 2018-12-19  Michael Catanzaro  <mcatanzaro@igalia.com>
1999
2000         Unreviewed, silence -Wpragmas warning
2001
2002         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h:
2003
2004 2018-12-19  Vivek Seth  <v_seth@apple.com>
2005
2006         HTTPS Upgrade: Use full sqlite upgrade list
2007         https://bugs.webkit.org/show_bug.cgi?id=192736
2008         <rdar://problem/45851427>
2009
2010         Reviewed by Chris Dumez.
2011
2012         * NetworkProcess/NetworkHTTPSUpgradeChecker.cpp: Added.
2013         (WebKit::NetworkHTTPSUpgradeCheckerDatabasePath):
2014         (WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker):
2015         (WebKit::NetworkHTTPSUpgradeChecker::~NetworkHTTPSUpgradeChecker):
2016         (WebKit::NetworkHTTPSUpgradeChecker::query):
2017         (WebKit::NetworkHTTPSUpgradeChecker::isAlwaysOnLoggingAllowed const):
2018         * NetworkProcess/NetworkHTTPSUpgradeChecker.h: Added.
2019         (WebKit::NetworkHTTPSUpgradeChecker::didSetupCompleteSuccessfully const):
2020         * NetworkProcess/NetworkLoadChecker.cpp:
2021         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
2022         (WebKit::NetworkLoadChecker::checkRequest):
2023         * NetworkProcess/NetworkLoadChecker.h:
2024         * NetworkProcess/NetworkProcess.h:
2025         (WebKit::NetworkProcess::networkHTTPSUpgradeChecker):
2026         * Sources.txt:
2027         * WebKit.xcodeproj/project.pbxproj:
2028
2029 2018-12-19  Tim Horton  <timothy_horton@apple.com>
2030
2031         Use delegate instead of drawingDelegate in WKDrawingView
2032         https://bugs.webkit.org/show_bug.cgi?id=192899
2033         <rdar://problem/46733339>
2034
2035         Reviewed by Wenson Hsieh.
2036
2037         * UIProcess/ios/WKDrawingView.mm:
2038         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2039         Do the dance.
2040
2041 2018-12-19  Alex Christensen  <achristensen@webkit.org>
2042
2043         Navigations away from the SafeBrowsing interstitial show a flash of old content
2044         https://bugs.webkit.org/show_bug.cgi?id=192676
2045
2046         Reviewed by Chris Dumez.
2047
2048         When a user clicks through a safe browsing warning, do not remove the warning until content is drawn for the destination.
2049         Otherwise, the user will confusingly see the page before the warning while the navigation happens.
2050         We can only do this for warnings caused by main frame navigations, though.  Other warnings (such as those caused by iframes)
2051         need to be cleared immediately, and we still need to clear the warning immediately if the user has said to go back.
2052
2053         This change is reflected in an updated API test.
2054
2055         * UIProcess/API/Cocoa/WKWebView.mm:
2056         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
2057         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
2058         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
2059         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
2060         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2061         (-[WKSafeBrowsingWarning forMainFrameNavigation]):
2062         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
2063         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2064         * UIProcess/Cocoa/WebViewImpl.h:
2065         * UIProcess/Cocoa/WebViewImpl.mm:
2066         (WebKit::WebViewImpl::showSafeBrowsingWarning):
2067         (WebKit::WebViewImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
2068         * UIProcess/PageClient.h:
2069         (WebKit::PageClient::clearSafeBrowsingWarningIfForMainFrameNavigation):
2070         * UIProcess/SafeBrowsingWarning.h:
2071         (WebKit::SafeBrowsingWarning::create):
2072         (WebKit::SafeBrowsingWarning::forMainFrameNavigation const):
2073         * UIProcess/WebPageProxy.cpp:
2074         (WebKit::WebPageProxy::didReachLayoutMilestone):
2075         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
2076         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2077         * UIProcess/WebPageProxy.h:
2078         * UIProcess/ios/PageClientImplIOS.h:
2079         * UIProcess/mac/PageClientImplMac.h:
2080         * UIProcess/mac/PageClientImplMac.mm:
2081         (WebKit::PageClientImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
2082
2083 2018-12-19  Tim Horton  <timothy_horton@apple.com>
2084
2085         UI process crash when focusing an editable image
2086         https://bugs.webkit.org/show_bug.cgi?id=192839
2087         <rdar://problem/46786670>
2088
2089         Reviewed by Wenson Hsieh.
2090
2091         * SourcesCocoa.txt:
2092         * UIProcess/ios/WKContentViewInteraction.h:
2093         * UIProcess/ios/WKContentViewInteraction.mm:
2094         (-[WKContentView _requiresKeyboardWhenFirstResponder]):
2095         (-[WKContentView inputView]):
2096         (-[WKContentView requiresAccessoryView]):
2097         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
2098         (-[WKContentView _stopAssistingNode]):
2099         (-[WKContentView _installInkPickerForDrawingViewWithID:]):
2100         (-[WKContentView _uninstallInkPicker]):
2101         * UIProcess/ios/WKInkPickerView.h: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.h.
2102         * UIProcess/ios/WKInkPickerView.mm: Renamed from Source/WebKit/UIProcess/ios/WKInkPickerControl.mm.
2103         (-[WKInkPickerView initWithDrawingView:]):
2104         (-[WKInkPickerView didPickInk]):
2105         (-[WKInkPickerView inlineInkPickerDidToggleRuler:]):
2106         (-[WKInkPickerView inlineInkPicker:didSelectTool:]):
2107         (-[WKInkPickerView inlineInkPicker:didSelectColor:]):
2108         (-[WKInkPickerView inkPickerSize]):
2109         (-[WKInkPickerView layoutSubviews]):
2110         (-[WKInkPickerView sizeThatFits:]):
2111         (-[WKInkPickerView viewControllerForPopoverPresentationFromInlineInkPicker:]):
2112         * WebKit.xcodeproj/project.pbxproj:
2113         Make WKInkPickerView a WKWebView subview instead of an inputView.
2114         Also, don't force the keyboard to be visible when an editable image is focused.
2115
2116 2018-12-19  Eric Carlson  <eric.carlson@apple.com>
2117
2118         [MediaStream] Force system camera/microphone TCC prompt if necessary
2119         https://bugs.webkit.org/show_bug.cgi?id=192820
2120         <rdar://problem/42680098>
2121
2122         Reviewed by Jer Noble.
2123
2124         * UIProcess/Cocoa/UIDelegate.mm:
2125         (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): Enable TCC check 
2126         and prompt on Mojave.
2127
2128 2018-12-19  Megan Gardner  <megan_gardner@apple.com>
2129
2130         Allow clients to set the navigator platform
2131         https://bugs.webkit.org/show_bug.cgi?id=192735
2132
2133         Reviewed by Tim Horton.
2134
2135         Add private API to allow clients to override the default navigator
2136         platform. Some websites check for the platform, which 
2137         interfears with our request desktop site feature. This should
2138         help more sites function as expected.
2139
2140         * Shared/WebsitePoliciesData.cpp:
2141         (WebKit::WebsitePoliciesData::encode const):
2142         (WebKit::WebsitePoliciesData::decode):
2143         (WebKit::WebsitePoliciesData::applyToDocumentLoader):
2144         * Shared/WebsitePoliciesData.h:
2145         * UIProcess/API/APIWebsitePolicies.cpp:
2146         (API::WebsitePolicies::data):
2147         * UIProcess/API/APIWebsitePolicies.h:
2148         * UIProcess/API/Cocoa/_WKWebsitePolicies.h:
2149         * UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
2150         (-[_WKWebsitePolicies setCustomNavigatorPlatform:]):
2151         (-[_WKWebsitePolicies customNavigatorPlatform]):
2152         * UIProcess/Cocoa/NavigationState.mm:
2153         (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
2154
2155 2018-12-19  Truitt Savell  <tsavell@apple.com>
2156
2157         Unreviewed, rolling out r239358.
2158
2159         Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
2160         crash on Debug bots
2161
2162         Reverted changeset:
2163
2164         "Clean up IndexedDB files between tests"
2165         https://bugs.webkit.org/show_bug.cgi?id=192796
2166         https://trac.webkit.org/changeset/239358
2167
2168 2018-12-18  Alex Christensen  <achristensen@webkit.org>
2169
2170         REGRESSION(r239134) iOS safe browsing warning unable to show details
2171         https://bugs.webkit.org/show_bug.cgi?id=192837
2172
2173         Reviewed by Tim Horton.
2174
2175         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2176         (-[WKSafeBrowsingWarning addContent]):
2177         I had a fragile design that relied on the internal view heirarchy structure of UIScrollView,
2178         which I changed in r239134 by introducing a layout which changed where its scrollbars were in the view heirarchy.
2179         I now have a more robust design that saves a WeakObjCPtr to the view I need to traverse to.
2180         Testing is problematic because this had to do with scrollbars and UIScrollView internals which seem to behave
2181         differently in TestWebKitAPI, but I verified manually that this fixes the issue.
2182
2183 2018-12-18  Fujii Hironori  <Hironori.Fujii@sony.com>
2184
2185         [Win][Clang] Fix compilation warnings under Source/WebKit directory
2186         https://bugs.webkit.org/show_bug.cgi?id=192695
2187
2188         Reviewed by Alex Christensen.
2189
2190         * NetworkProcess/cache/NetworkCacheData.cpp:
2191         (makeSalt): Enclosed by #if !OS(WINDOWS).
2192         * NetworkProcess/cache/NetworkCacheFileSystem.cpp:
2193         (WebKit::NetworkCache::directoryEntryType): Ditto.
2194         * Platform/win/ModuleWin.cpp:
2195         (WebKit::Module::platformFunctionPointer const): Cast a function pointer with reinterpret_cast<void*>().
2196         * UIProcess/DrawingAreaProxyImpl.cpp:
2197         (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
2198         Moved the initializer of m_webPage in order to be encluded by #if PLATFORM(GTK).
2199         * UIProcess/DrawingAreaProxyImpl.h: Ditto.
2200         * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
2201         (WebKit::processName): Removed the duplicated 'const' type qualifier.
2202         * UIProcess/win/WebInspectorProxyWin.cpp:
2203         (WebKit::WebInspectorProxy::platformAttach): Removed an unused variable.
2204         (WebKit::WebInspectorProxy::platformDetach): Ditto.
2205         * UIProcess/win/WebPopupMenuProxyWin.cpp: Ditto.
2206         * UIProcess/win/WebView.cpp:
2207         (WebKit::WebView::paint): Ditto.
2208         (WebKit::WebPopupMenu::setUpPlatformData): Ditto.
2209         * UIProcess/win/WebPopupMenuProxyWin.h: Marked override methods with 'override'.
2210         * WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h: Ditto.
2211         * WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp: Removed an unused variable.
2212
2213 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2214
2215         [macOS] fast/forms/datalist/datalist-textinput-suggestions-order.html sometimes crashes after r239337
2216         https://bugs.webkit.org/show_bug.cgi?id=192836
2217         <rdar://problem/45321184>
2218
2219         Reviewed by Tim Horton.
2220
2221         r239337 exposed a subtle issue in the implementation of `-[WKDataListSuggestionsView updateWithInformation:]`,
2222         wherein we might end up recomputing information for table view cells at rows that no longer exist. This currently
2223         happens because we first set the datalist's `_suggestions`, then change the table view's frame, and then finally
2224         reload the table view; however, in the case where the number of suggestions decreased and the frame changed
2225         (which prompts AppKit to ask us again for table cell views), we'll attempt to access an out-of-bounds index in
2226         the `_suggestions` vector.
2227
2228         To address this, we change our suggestions and immediately reload the table view before updating `NSTableView`'s
2229         frame, so that we only provide table view cells for rows that actually correspond to items in `_suggestions`.
2230
2231         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
2232         (-[WKDataListSuggestionsView updateWithInformation:]):
2233
2234 2018-12-18  Jiewen Tan  <jiewen_tan@apple.com>
2235
2236         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2237         https://bugs.webkit.org/show_bug.cgi?id=192061
2238
2239         Reviewed by Dewei Zhu.
2240
2241         Part 4.
2242
2243         Add some additional temporary logging info to determine if the time out value passed to the timer is right.
2244         Once the bug is determined and fixed, we should remove all logging added in this patch.
2245
2246         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2247         (WebKit::AuthenticatorManager::initTimeOutTimer):
2248
2249 2018-12-18  Sihui Liu  <sihui_liu@apple.com>
2250
2251         Clean up IndexedDB files between tests
2252         https://bugs.webkit.org/show_bug.cgi?id=192796
2253
2254         Reviewed by Geoffrey Garen.
2255
2256         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2257         (WKWebsiteDataStoreRemoveAllIndexedDatabasesSync):
2258         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
2259
2260 2018-12-18  Vivek Seth  <v_seth@apple.com>
2261
2262         HTTPS Upgrade: Scripts / preprocessing necessary to create new database in future
2263         https://bugs.webkit.org/show_bug.cgi?id=192612
2264         <rdar://problem/46651207>
2265
2266         Reviewed by Andy Estes.
2267
2268         * Configurations/WebKit.xcconfig:
2269         * DerivedSources.make:
2270         * Scripts/generate-https-upgrade-database.sh: Added.
2271         * WebKit.xcodeproj/project.pbxproj:
2272
2273 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2274
2275         Unreviewed, fix the 32-bit watchOS build after r239314
2276
2277         * UIProcess/API/Cocoa/WKWebView.mm:
2278         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2279
2280 2018-12-18  Alex Christensen  <achristensen@webkit.org>
2281
2282         WKWebView has old URL while displaying SafeBrowsing interstitial, for link-click navigations
2283         https://bugs.webkit.org/show_bug.cgi?id=192675
2284
2285         Reviewed by Geoffrey Garen.
2286
2287         When a safe browsing warning is being shown, WKWebView.URL should be the unsafe website, not the safe website before it.
2288
2289         * UIProcess/API/Cocoa/WKWebView.mm:
2290         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
2291         (-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:details:completionHandler:]):
2292         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2293         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
2294         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
2295         * UIProcess/SafeBrowsingWarning.h:
2296         (WebKit::SafeBrowsingWarning::create):
2297         (WebKit::SafeBrowsingWarning::url const):
2298         * UIProcess/WebPageProxy.cpp:
2299         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2300
2301 2018-12-18  Chris Dumez  <cdumez@apple.com>
2302
2303         Regression(r239182) SuspendedPage's process reuse for link navigation optimization sometimes broken
2304         https://bugs.webkit.org/show_bug.cgi?id=192772
2305
2306         Reviewed by Antti Koivisto.
2307
2308         With r239182, if the page in the previous process would fail to enter PageCache, we would destroy
2309         the corresponding SuspendedPageProxy, which would potentially terminate the process. This would
2310         regress performance when trying to navigate back in history to that page. This would also regress
2311         performance when link-navigating to the same domain as we would have previously reused the suspended
2312         page's process for such navigation.
2313
2314         Address the issue by keeping the SuspendedPageProxy alive even if the WebPage fails to suspend.
2315         When trying to reuse a SuspendedPageProxy, if the page failed to suspend, reuse its process but
2316         not the suspended page itself.
2317
2318         * UIProcess/SuspendedPageProxy.cpp:
2319         (WebKit::SuspendedPageProxy::~SuspendedPageProxy):
2320         (WebKit::SuspendedPageProxy::waitUntilReadyToUnsuspend):
2321         (WebKit::SuspendedPageProxy::unsuspend):
2322         (WebKit::SuspendedPageProxy::didSuspend):
2323         (WebKit::SuspendedPageProxy::didFailToSuspend):
2324         (WebKit::SuspendedPageProxy::loggingString const):
2325         * UIProcess/SuspendedPageProxy.h:
2326         * UIProcess/WebPageProxy.cpp:
2327         (WebKit::WebPageProxy::swapToWebProcess):
2328         * UIProcess/WebProcessPool.cpp:
2329         (WebKit::WebProcessPool::processForNavigationInternal):
2330
2331 2018-12-17  Jiewen Tan  <jiewen_tan@apple.com>
2332
2333         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2334         https://bugs.webkit.org/show_bug.cgi?id=192061
2335
2336         Reviewed by Dewei Zhu.
2337
2338         Part 3.
2339
2340         Add some additional temporary logging info to determine if the timer is working as expected.
2341         Once the bug is determined and fixed, we should remove all logging added in this patch.
2342
2343         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2344         (WebKit::AuthenticatorManager::respondReceived):
2345         (WebKit::AuthenticatorManager::initTimeOutTimer):
2346         (WebKit::AuthenticatorManager::timeOutTimerFired):
2347         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
2348         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
2349
2350 2018-12-17  Saam barati  <sbarati@apple.com>
2351
2352         Enable HTTP and HTTPS proxies on iOS and make it a property of the NSURLSession
2353         https://bugs.webkit.org/show_bug.cgi?id=192374
2354         <rdar://problem/46506286>
2355
2356         Reviewed by Alex Christensen.
2357
2358         This patch makes it so that we can use HTTP/HTTPS proxies on iOS as well.
2359         To enable on iOS, you can do something like:
2360         $ defaults write -g WebKit2HTTPProxy -string "http://localhost:8080"
2361         $ defaults write -g WebKit2HTTPSProxy -string "http://localhost:8080"
2362         
2363         This patch also changes the Proxy to be enabled on a per NSURLSession
2364         basis instead of a per process basis.
2365
2366         * NetworkProcess/NetworkProcess.cpp:
2367         (WebKit::NetworkProcess::initializeNetworkProcess):
2368         * NetworkProcess/NetworkSessionCreationParameters.cpp:
2369         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
2370         (WebKit::NetworkSessionCreationParameters::encode const):
2371         (WebKit::NetworkSessionCreationParameters::decode):
2372         * NetworkProcess/NetworkSessionCreationParameters.h:
2373         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
2374         (WebKit::proxyDictionary):
2375         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
2376         * NetworkProcess/mac/NetworkProcessMac.mm:
2377         (WebKit::NetworkProcess::platformInitializeNetworkProcess):
2378         (WebKit::overrideSystemProxies): Deleted.
2379         * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
2380         (-[WKWebsiteDataStore _initWithConfiguration:]):
2381         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h:
2382         * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm:
2383         (-[_WKWebsiteDataStoreConfiguration httpProxy]):
2384         (-[_WKWebsiteDataStoreConfiguration setHTTPProxy:]):
2385         (-[_WKWebsiteDataStoreConfiguration httpsProxy]):
2386         (-[_WKWebsiteDataStoreConfiguration setHTTPSProxy:]):
2387         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
2388         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
2389         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
2390         (WebKit::WebsiteDataStore::parameters):
2391         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
2392         (WebKit::WebsiteDataStoreConfiguration::copy):
2393         * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
2394         (WebKit::WebsiteDataStoreConfiguration::httpProxy const):
2395         (WebKit::WebsiteDataStoreConfiguration::setHTTPProxy):
2396         (WebKit::WebsiteDataStoreConfiguration::httpsProxy const):
2397         (WebKit::WebsiteDataStoreConfiguration::setHTTPSProxy):
2398
2399 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2400
2401         Tap highlights should not be shown on iOSMac
2402         https://bugs.webkit.org/show_bug.cgi?id=192797
2403         <rdar://problem/46793995>
2404
2405         Reviewed by Tim Horton.
2406
2407         WKWebViews in iOSMac should avoid painting tap highlights, since tap highlights are not present in the rest of
2408         the macOS platform. Simply disable this functionality by bailing in `-[WKContentView _showTapHighlight]`.
2409
2410         * UIProcess/ios/WKContentViewInteraction.mm:
2411         (-[WKContentView _showTapHighlight]):
2412
2413 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2414
2415         Unreviewed, fix the iOSMac engineering build again
2416
2417         After r239311, `WebProcessProxy::fullKeyboardAccessEnabled` in `WebProcessProxyIOS.mm` attempts to use
2418         `WKFullKeyboardAccessWatcher`, which is guarded by `ENABLE(FULL_KEYBOARD_ACCESS)`. However, on iOSMac,
2419         `ENABLE(FULL_KEYBOARD_ACCESS)` is 0. Fix the build by putting access to `WKFullKeyboardAccessWatcher` behind
2420         `ENABLE(FULL_KEYBOARD_ACCESS)`.
2421
2422         * UIProcess/ios/WebProcessProxyIOS.mm:
2423         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
2424
2425 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2426
2427         Unreviewed, fix the iOSMac engineering build
2428
2429         `generateRequestID()` is only invoked from code under `ENABLE(MEDIA_STREAM)`; move it under this guard to avoid
2430         an unused function warning.
2431
2432         * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
2433
2434 2018-12-17  David Kilzer  <ddkilzer@apple.com>
2435
2436         clang-tidy: Fix unnecessary object copy in CPUMonitor::setCPULimit()
2437         <https://webkit.org/b/192707>
2438         <rdar://problem/46734926>
2439
2440         Reviewed by Daniel Bates.
2441
2442         * WebProcess/cocoa/WebProcessCocoa.mm:
2443         (WebKit::WebProcess::updateCPUMonitorState):
2444         - Pass m_cpuLimit directly since getting its value causes an
2445           identical std::optional<double> to be created unnecessarily.
2446
2447 2018-12-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2448
2449         [iOS] Focusing a large editable element always scrolls to the top of the element
2450         https://bugs.webkit.org/show_bug.cgi?id=192745
2451         <rdar://problem/46758445>
2452
2453         Reviewed by Tim Horton.
2454
2455         Currently, when focusing form controls or editable elements, we try to scroll such that the focused element rect
2456         is centered within the visible area. In the case of very large focusable elements whose dimensions exceed the
2457         width or height of the visible area, we instead scroll such that the top left point of the element is at the top
2458         left corner of the visible area.
2459
2460         However, this results in unnecessary scrolling if the top of the element is already near the top of the visible
2461         area. For WebKit2-based rich text editors that have an editable body element with a top content inset that
2462         contains additional content, this means we will always scroll the additional content away when focusing the
2463         editable body.
2464
2465         To avoid this behavior, adjust focused element zooming logic for editable elements that are too large to be
2466         centered in the visible area, such that we only scroll the top left position of the focused element to the top
2467         half or top right of the visible area, respectively. This reduces the amount of scrolling when focusing large
2468         editable elements, while still making it clear which element is being focused.
2469
2470         * Platform/spi/ios/UIKitSPI.h:
2471         * UIProcess/API/Cocoa/WKWebView.mm:
2472         (-[WKWebView _zoomToFocusRect:selectionRect:insideFixed:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
2473
2474         Make some small adjustments to improve the readability of this method by using `clampTo` instead of clamping
2475         values by comparing and setting values.
2476
2477         Also, fix an existing bug wherein focusable elements that are meant to be centered within the visible area are
2478         currently offset by half the difference between the bottom inset amount and the top inset amount, in the case
2479         where the `_obscuredInsets` SPI is used to specify content insets for the web view (i.e., MobileSafari).
2480
2481         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2482
2483         Make a couple of arguments `const FloatRect&` instead of just `FloatRect`.
2484
2485 2018-12-17  Ryosuke Niwa  <rniwa@webkit.org>
2486
2487         offsetLeft and offsetParent should adjust across shadow boundaries
2488         https://bugs.webkit.org/show_bug.cgi?id=157437
2489         <rdar://problem/26154021>
2490
2491         Reviewed by Simon Fraser.
2492
2493         Use *forBindings variants of offsetLeft, offsetTop, and offsetParent.
2494
2495         * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp:
2496         (webkit_dom_element_get_offset_left):
2497         (webkit_dom_element_get_offset_top):
2498         (webkit_dom_element_get_offset_parent):
2499
2500 2018-12-17  Chris Fleizach  <cfleizach@apple.com>
2501
2502         Some builds are broken after r239262
2503         https://bugs.webkit.org/show_bug.cgi?id=192777
2504
2505         Reviewed by Simon Fraser.
2506
2507         * Platform/spi/ios/AccessibilitySupportSPI.h:
2508         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h:
2509         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
2510         (platformIsFullKeyboardAccessEnabled):
2511         (-[WKFullKeyboardAccessWatcher init]):
2512         Fix the build by being more clear about when it's OK to use AccessibilitySupport.
2513
2514 2018-12-17  Chris Dumez  <cdumez@apple.com>
2515
2516         Allow passing nil as session state to [WKWebView _restoreSessionState:]
2517         https://bugs.webkit.org/show_bug.cgi?id=192789
2518         <rdar://problem/46755277>
2519
2520         Reviewed by Alex Christensen.
2521
2522         Allow passing nil as session state to [WKWebView _restoreSessionState:] instead of crashing.
2523
2524         * UIProcess/API/Cocoa/WKWebView.mm:
2525         (-[WKWebView _restoreSessionState:andNavigate:]):
2526
2527 2018-12-17  Alex Christensen  <achristensen@webkit.org>
2528
2529         Fix occasional null-dereference crash in WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame
2530         https://bugs.webkit.org/show_bug.cgi?id=192744
2531         <rdar://problem/45842668>
2532
2533         Reviewed by Chris Dumez.
2534
2535         * UIProcess/WebPageProxy.cpp:
2536         (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
2537         Things happen.  Navigations can be null.  If they are, we shouldn't dereference pointers to them.
2538
2539 2018-12-17  Chris Dumez  <cdumez@apple.com>
2540
2541         Unreviewed, revert recent CrashReporterClient build fixes as they are no longer needed.
2542
2543         * Platform/cocoa/WKCrashReporter.mm:
2544
2545 2018-12-17  Suresh Koppisetty  <skoppisettyt@apple.com>
2546
2547         Rollout r235411
2548         https://bugs.webkit.org/show_bug.cgi?id=192778
2549         <rdar://46789485>
2550
2551         Disabling access to CoreServices is causing a performance
2552         regression in process launch time.  See <rdar://46141878>
2553
2554         Reviewed by Alex Christensen.
2555
2556         * WebProcess/com.apple.WebProcess.sb.in:
2557
2558 2018-12-17  Zan Dobersek  <zdobersek@igalia.com>
2559
2560         Unreviewed WPE build fix after r239277.
2561
2562         * UIProcess/API/C/WKContext.cpp:
2563         (WKContextClearCurrentModifierStateForTesting):
2564         Use the WebKit:: namespace specifier as it is used across this file.
2565
2566 2018-12-17  Commit Queue  <commit-queue@webkit.org>
2567
2568         Unreviewed, rolling out r239265 and r239274.
2569         https://bugs.webkit.org/show_bug.cgi?id=192765
2570
2571         unorm_normalize is deprecated, and broke an internal build
2572         (Requested by Truitt on #webkit).
2573
2574         Reverted changesets:
2575
2576         "[GTK][WPE] Need a function to convert internal URI to display
2577         ("pretty") URI"
2578         https://bugs.webkit.org/show_bug.cgi?id=174816
2579         https://trac.webkit.org/changeset/239265
2580
2581         "Fix the Apple Internal Mac build with a newer SDK"
2582         https://trac.webkit.org/changeset/239274
2583
2584 2018-12-17  Daniel Bates  <dabates@apple.com>
2585
2586         Implement UIScriptController::toggleCapsLock() for iOS
2587         https://bugs.webkit.org/show_bug.cgi?id=191815
2588
2589         Reviewed by Andy Estes.
2590
2591         Add test infrastructure to clear the current modifier state. We will use this to ensure that
2592         the caps lock state does not persist between tests.
2593
2594         * UIProcess/API/C/WKContext.cpp:
2595         (WKContextClearCurrentModifierStateForTesting): Added.
2596         * UIProcess/API/C/WKContextPrivate.h:
2597         * UIProcess/WebProcessPool.cpp:
2598         (WebKit::WebProcessPool::clearCurrentModifierStateForTesting): Added.
2599         * UIProcess/WebProcessPool.h:
2600         * WebProcess/WebProcess.cpp:
2601         (WebKit::WebProcess::clearCurrentModifierStateForTesting): Added.
2602         * WebProcess/WebProcess.h:
2603         * WebProcess/WebProcess.messages.in:
2604
2605 2018-12-17  David Kilzer  <ddkilzer@apple.com>
2606
2607         REGRESSION (r239262): Fix broken builds prior to Mojave
2608         <https://bugs.webkit.org/show_bug.cgi?id=192373>
2609         <rdar://problem/46462670>
2610
2611         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm:
2612         Wrap header in ENABLE(ACCESSIBILITY_EVENTS) to fix the build.
2613
2614 2018-12-17  Daniel Bates  <dabates@apple.com>
2615
2616         [iOS] Remove -[WebEvent initWithKeyEventType:...:characterSet:]
2617         https://bugs.webkit.org/show_bug.cgi?id=192633
2618
2619         Reviewed by Wenson Hsieh.
2620
2621         Update code to use the modern initializer.
2622
2623         * UIProcess/ios/WKWebEvent.mm:
2624         (-[WKWebEvent initWithEvent:]):
2625
2626 2018-12-17  Matt Lewis  <jlewis3@apple.com>
2627
2628         Unreviewed, rolling out r239254.
2629
2630         This broke the Windows 10 Debug build
2631
2632         Reverted changeset:
2633
2634         "Replace many uses of String::format with more type-safe
2635         alternatives"
2636         https://bugs.webkit.org/show_bug.cgi?id=192742
2637         https://trac.webkit.org/changeset/239254
2638
2639 2018-12-17  David Kilzer  <ddkilzer@apple.com>
2640
2641         clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
2642         <https://webkit.org/b/192751>
2643         <rdar://problem/46771623>
2644
2645         Reviewed by Daniel Bates.
2646
2647         Change loop variables to const references to avoid unnecessary
2648         copies.
2649
2650         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
2651         (WebKit::WebSWServerConnection::~WebSWServerConnection):
2652         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
2653         (WebKit::RemoteLayerTreeTransaction::encode const):
2654         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
2655         (WebKit::toNSErrors):
2656         * UIProcess/Automation/WebAutomationSession.cpp:
2657         (WebKit::WebAutomationSession::setFilesToSelectForFileUpload):
2658         (WebKit::WebAutomationSession::performKeyboardInteractions):
2659         (WebKit::WebAutomationSession::performInteractionSequence):
2660         * UIProcess/Plugins/PluginProcessManager.cpp:
2661         (WebKit::PluginProcessManager::getPluginProcess):
2662         * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
2663         (WebKit::ResourceLoadStatisticsMemoryStore::removeDataRecords):
2664         (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords const):
2665         * UIProcess/WebPageProxy.cpp:
2666         (WebKit::WebPageProxy::serializedAttachmentDataForIdentifiers):
2667         * UIProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
2668         (WebKit::LocalStorageDatabaseTracker::deleteAllDatabases):
2669         (WebKit::LocalStorageDatabaseTracker::origins const):
2670         (WebKit::LocalStorageDatabaseTracker::originDetails):
2671         * WebProcess/WebPage/WebPage.cpp:
2672         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
2673         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
2674         (WebKit::TiledCoreAnimationDrawingArea::didUpdateActivityStateTimerFired):
2675
2676 2018-12-17  Ms2ger  <Ms2ger@igalia.com>
2677
2678         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
2679         https://bugs.webkit.org/show_bug.cgi?id=174816
2680
2681         Reviewed by Michael Catanzaro.
2682
2683         Add webkit_uri_for_display for GTK and WPE.
2684
2685         * PlatformGTK.cmake:
2686         * PlatformWPE.cmake:
2687         * SourcesGTK.txt:
2688         * SourcesWPE.txt:
2689         * UIProcess/API/glib/WebKitURIUtilities.cpp: Added.
2690         (webkit_uri_for_display):
2691         * UIProcess/API/gtk/WebKitURIUtilities.h: Added.
2692         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2693         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
2694         * UIProcess/API/gtk/webkit2.h:
2695         * UIProcess/API/wpe/WebKitURIUtilities.h: Added.
2696         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2697         * UIProcess/API/wpe/docs/wpe-docs.sgml:
2698         * UIProcess/API/wpe/webkit.h:
2699
2700 2018-12-17  Carlos Garcia Campos  <cgarcia@igalia.com>
2701
2702         [WPE] Add API to notify about frame displayed view backend callback
2703         https://bugs.webkit.org/show_bug.cgi?id=192224
2704
2705         Reviewed by Michael Catanzaro.
2706
2707         Add API to add a callback to the view to be called when the view backend notifies that a frame has been
2708         displayed.
2709
2710         * UIProcess/API/glib/WebKitWebView.cpp:
2711         (FrameDisplayedCallback::FrameDisplayedCallback):
2712         (FrameDisplayedCallback::~FrameDisplayedCallback):
2713         (webkit_web_view_add_frame_displayed_callback):
2714         (webkit_web_view_remove_frame_displayed_callback):
2715         * UIProcess/API/wpe/WebKitWebView.h:
2716         * UIProcess/API/wpe/docs/wpe-0.1-sections.txt:
2717
2718 2018-12-16  Chris Fleizach  <cfleizach@apple.com>
2719
2720         AX: Support keyboard access preference for iOS in WebKit
2721         https://bugs.webkit.org/show_bug.cgi?id=192373
2722         <rdar://problem/46462670>
2723
2724         Reviewed by Tim Horton.
2725
2726         * Platform/spi/ios/AccessibilitySupportSPI.h:
2727         * PlatformMac.cmake:
2728         * SourcesCocoa.txt:
2729         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.h: Added.
2730         * UIProcess/Cocoa/WKFullKeyboardAccessWatcher.mm: Added.
2731         (platformIsFullKeyboardAccessEnabled):
2732         (-[WKFullKeyboardAccessWatcher notifyAllProcessPools]):
2733         (-[WKFullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
2734         (-[WKFullKeyboardAccessWatcher init]):
2735         (+[WKFullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
2736         * UIProcess/ios/WebProcessProxyIOS.mm:
2737         (WebKit::WebProcessProxy::fullKeyboardAccessEnabled):
2738         * UIProcess/mac/WKFullKeyboardAccessWatcher.h: Removed.
2739         * UIProcess/mac/WKFullKeyboardAccessWatcher.mm: Removed.
2740         * WebKit.xcodeproj/project.pbxproj:
2741
2742 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
2743
2744         Unreviewed follow up after r239260
2745         https://bugs.webkit.org/show_bug.cgi?id=192714
2746         <rdar://problem/46762407>
2747
2748         * Platform/win/SharedMemoryWin.cpp:
2749         (WebKit::SharedMemory::allocate): Use PAGE_READWRITE directly instead
2750         of going through the protectAttribute() function, which is removed
2751         because it is now unused.
2752
2753 2018-12-16  Adrian Perez de Castro  <aperez@igalia.com>
2754
2755         Unify SharedMemory factory functions
2756         https://bugs.webkit.org/show_bug.cgi?id=192714
2757
2758         Reviewed by Darin Adler.
2759
2760         This unifies SharedMemory so in the following way, across platforms:
2761
2762         - SharedMemory::create() is removed, to avoid ambiguity.
2763         - SharedMemory::allocate() always allocates a new block of shared memory.
2764         - SharedMemory::wrapMap() always creates a SharedMemory object which refers to an
2765           existing region of memory resulting from memory-mapping a file.
2766
2767         * NetworkProcess/cache/NetworkCacheDataCocoa.mm:
2768         (WebKit::NetworkCache::Data::tryCreateSharedMemory const): Use SharedMemory::wrapMap().
2769         * Platform/SharedMemory.h: Remove the definition of SharedMemory::create(), and make
2770         SharedMemory::wrapMap() available on OS(DARWIN) as well.
2771         * Platform/cocoa/SharedMemoryCocoa.cpp:
2772         (WebKit::SharedMemory::wrapMap): Renamed from ::create().
2773         * Platform/unix/SharedMemoryUnix.cpp:
2774         (WebKit::SharedMemory::allocate): Renamed from ::create().
2775         * Platform/win/SharedMemoryWin.cpp:
2776         (WebKit::SharedMemory::allocate): Renamed from ::create()
2777         * UIProcess/API/APIContentRuleListStore.cpp:
2778         (API::createExtension): Use NetworkCache::Data::tryCreateSharedMemory() instead of
2779         SharedMemory::create().
2780
2781 2018-12-15  Chris Fleizach  <cfleizach@apple.com>
2782
2783         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
2784         https://bugs.webkit.org/show_bug.cgi?id=192449
2785         <rdar://problem/46595508>
2786
2787         Reviewed by Darin Adler.
2788
2789         Part 7: Files in UIProcess/API
2790
2791         * UIProcess/API/APIContentRuleListStore.cpp:
2792         * UIProcess/API/APIHitTestResult.cpp:
2793         * UIProcess/API/APINavigation.cpp:
2794         * UIProcess/API/APIOpenPanelParameters.cpp:
2795         * UIProcess/API/APIPageConfiguration.cpp:
2796         * UIProcess/API/C/WKApplicationCacheManager.cpp:
2797         (WKApplicationCacheManagerGetTypeID):
2798         (WKApplicationCacheManagerGetApplicationCacheOrigins):
2799         (WKApplicationCacheManagerDeleteEntriesForOrigin):
2800         (WKApplicationCacheManagerDeleteAllEntries):
2801         * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
2802         (WKAuthenticationDecisionListenerGetTypeID):
2803         (WKAuthenticationDecisionListenerUseCredential):
2804         (WKAuthenticationDecisionListenerCancel):
2805         (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue):
2806         * UIProcess/API/C/WKBackForwardListItemRef.cpp:
2807         (WKBackForwardListItemGetTypeID):
2808         (WKBackForwardListItemCopyURL):
2809         (WKBackForwardListItemCopyTitle):
2810         (WKBackForwardListItemCopyOriginalURL):
2811         * UIProcess/API/C/WKContext.cpp:
2812         (WKContextGetTypeID):
2813         (WKContextCreate):
2814         (WKContextCreateWithInjectedBundlePath):
2815         (WKContextCreateWithConfiguration):
2816         (WKContextSetClient):
2817         (WKContextSetInjectedBundleClient):
2818         (WKContextSetHistoryClient):
2819         (WKContextSetDownloadClient):
2820         (WKContextSetConnectionClient):
2821         (WKContextDownloadURLRequest):
2822         (WKContextResumeDownload):
2823         (WKContextSetInitializationUserDataForInjectedBundle):
2824         (WKContextPostMessageToInjectedBundle):
2825         (WKContextGetGlobalStatistics):
2826         (WKContextAddVisitedLink):
2827         (WKContextClearVisitedLinks):
2828         (WKContextSetCacheModel):
2829         (WKContextGetCacheModel):
2830         (WKContextSetMaximumNumberOfProcesses):
2831         (WKContextGetMaximumNumberOfProcesses):
2832         (WKContextSetAlwaysUsesComplexTextCodePath):
2833         (WKContextSetShouldUseFontSmoothing):
2834         (WKContextSetAdditionalPluginsDirectory):
2835         (WKContextRefreshPlugIns):
2836         (WKContextRegisterURLSchemeAsEmptyDocument):
2837         (WKContextRegisterURLSchemeAsSecure):
2838         (WKContextRegisterURLSchemeAsBypassingContentSecurityPolicy):
2839         (WKContextRegisterURLSchemeAsCachePartitioned):
2840         (WKContextRegisterURLSchemeAsCanDisplayOnlyIfCanRequest):
2841         (WKContextSetDomainRelaxationForbiddenForURLScheme):
2842         (WKContextSetCanHandleHTTPSServerTrustEvaluation):
2843         (WKContextSetPrewarmsProcessesAutomatically):
2844         (WKContextSetCustomWebContentServiceBundleIdentifier):
2845         (WKContextSetDiskCacheSpeculativeValidationEnabled):
2846         (WKContextPreconnectToServer):
2847         (WKContextGetCookieManager):
2848         (WKContextGetWebsiteDataStore):
2849         (WKContextGetGeolocationManager):
2850         (WKContextGetMediaSessionFocusManager):
2851         (WKContextGetNotificationManager):
2852         (WKContextStartMemorySampler):
2853         (WKContextStopMemorySampler):
2854         (WKContextAllowSpecificHTTPSCertificateForHost):
2855         (WKContextDisableProcessTermination):
2856         (WKContextEnableProcessTermination):
2857         (WKContextSetHTTPPipeliningEnabled):
2858         (WKContextWarmInitialProcess):
2859         (WKContextGetStatistics):
2860         (WKContextGetStatisticsWithOptions):
2861         (WKContextJavaScriptConfigurationFileEnabled):
2862         (WKContextSetJavaScriptConfigurationFileEnabled):
2863         (WKContextGarbageCollectJavaScriptObjects):
2864         (WKContextSetJavaScriptGarbageCollectorTimerEnabled):
2865         (WKContextUseTestingNetworkSession):
2866         (WKContextSetAllowsAnySSLCertificateForWebSocketTesting):
2867         (WKContextSetAllowsAnySSLCertificateForServiceWorkerTesting):
2868         (WKContextClearCachedCredentials):
2869         (WKContextCopyPlugInAutoStartOriginHashes):
2870         (WKContextSetPlugInAutoStartOriginHashes):
2871         (WKContextSetPlugInAutoStartOriginsFilteringOutEntriesAddedAfterTime):
2872         (WKContextSetPlugInAutoStartOrigins):
2873         (WKContextSetInvalidMessageFunction):
2874         (WKContextSetMemoryCacheDisabled):
2875         (WKContextSetFontWhitelist):
2876         (WKContextTerminateNetworkProcess):
2877         (WKContextTerminateServiceWorkerProcess):
2878         (WKContextGetNetworkProcessIdentifier):
2879         (WKContextAddSupportedPlugin):
2880         (WKContextClearSupportedPlugins):
2881         (WKContextSetIDBPerOriginQuota):
2882         * UIProcess/API/C/WKPage.cpp:
2883         (WKPageLoadURLWithShouldOpenExternalURLsPolicy):
2884         (WKPageLoadURLWithUserData):
2885         (WKPageLoadURLRequestWithUserData):
2886         (WKPageSetPaginationMode):
2887         (WKPageGetPaginationMode):
2888         (WKPageSetPageLoaderClient):
2889         (WKPageSetPagePolicyClient):
2890         * UIProcess/API/C/cg/WKIconDatabaseCG.cpp:
2891
2892 2018-12-15  Darin Adler  <darin@apple.com>
2893
2894         Use warning-ignoring macros more consistently and simply
2895         https://bugs.webkit.org/show_bug.cgi?id=192743
2896
2897         Reviewed by Mark Lam.
2898
2899         * UIProcess/ios/WKDrawingView.mm:
2900         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2901         Use ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
2902         * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
2903         (-[WKFullScreenWindowController _EVOrganizationName]): Ditto.
2904
2905         * WebProcess/WebCoreSupport/WebAlternativeTextClient.h: Use
2906         IGNORE_WARNINGS_BEGIN/END instead of IGNORE_CLANG_WARNINGS_BEGIN/END
2907         because there is no need to accomodate non-clang compilers here.
2908         Also use #pragma once, add a missing "explicit", and fix conditionals.
2909
2910 2018-12-15  Darin Adler  <darin@apple.com>
2911
2912         Replace many uses of String::format with more type-safe alternatives
2913         https://bugs.webkit.org/show_bug.cgi?id=192742
2914
2915         Reviewed by Mark Lam.
2916
2917         * Shared/WebMemorySampler.cpp:
2918         (WebKit::WebMemorySampler::writeHeaders): Use makeString.
2919
2920         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm:
2921         (WebKit::LocalAuthenticator::makeCredential): Use string concatentation.
2922
2923         * UIProcess/WebInspectorUtilities.cpp:
2924         (WebKit::inspectorPageGroupIdentifierForPage): Use makeString.
2925         * UIProcess/WebProcessPool.cpp:
2926         (WebKit::WebProcessPool::processDidFinishLaunching): Ditto.
2927         (WebKit::WebProcessPool::startMemorySampler): Ditto.
2928
2929 2018-12-14  Ryan Haddad  <ryanhaddad@apple.com>
2930
2931         Unreviewed, fix the build with recent SDKs.
2932
2933         * UIProcess/ios/WKDrawingView.mm:
2934         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
2935
2936 2018-12-14  Jiewen Tan  <jiewen_tan@apple.com>
2937
2938         [Mac] Layout Test http/wpt/webauthn/public-key-credential-create-success-hid.https.html and http/wpt/webauthn/public-key-credential-get-success-hid.https.html are flaky
2939         https://bugs.webkit.org/show_bug.cgi?id=192061
2940
2941         Reviewed by Dewei Zhu.
2942
2943         Part 2.
2944
2945         Add some additional temporary logging info. Since the failure cannot be reproduced easily by human, we have to
2946         rely on the test infrastructure to reporoduce it. Once the bug is determined and fixed, we should remove all
2947         logging added in this patch.
2948
2949         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
2950         (WebKit::HidService::deviceAdded):
2951         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp:
2952         (WebKit::CtapHidAuthenticator::makeCredential):
2953         (WebKit::CtapHidAuthenticator::getAssertion):
2954         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2955         (WebKit::CtapHidDriver::Worker::write):
2956         (WebKit::CtapHidDriver::Worker::read):
2957         (WebKit::CtapHidDriver::Worker::returnMessage):
2958         (WebKit::CtapHidDriver::transact):
2959         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2960         (WebKit::CtapHidDriver::continueAfterResponseReceived):
2961
2962 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
2963
2964         [GTK] Unreviewed build fix.
2965
2966         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Add missing WebPolicyAction.h include.
2967
2968 2018-12-14  Chris Dumez  <cdumez@apple.com>
2969
2970         Unreviewed, fix assertion failure in API test after r239210.
2971
2972         * WebProcess/WebPage/WebPage.cpp:
2973         (WebKit::WebPage::createDocumentLoader):
2974
2975 2018-12-14  Adrian Perez de Castro  <aperez@igalia.com>
2976
2977         [SOUP] Unreviewed build fix after r239219
2978
2979         * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
2980         (WebKit::NetworkDataTaskSoup::dispatchDidReceiveResponse): Remove
2981         handling of PolicyAction::Suspend, which is no longer available.
2982
2983 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
2984
2985         Unreviewed, apply post-landing review comments after r239221.
2986
2987         * UIProcess/WebPageDebuggable.cpp:
2988         (WebKit::WebPageDebuggable::url const):
2989         Switch to WTF::blankURL() instead of using "about:blank" directly.
2990
2991 2018-12-14  Chris Dumez  <cdumez@apple.com>
2992
2993         [PSON] Process-swapping on a loadHTMLString causes duplicate decidePolicyForNavigationAction delegate calls
2994         https://bugs.webkit.org/show_bug.cgi?id=192704
2995
2996         Reviewed by Geoffrey Garen.
2997
2998         Process-swapping on a loadHTMLString causes duplicate decidePolicyForNavigationAction delegate calls. This
2999         is because we were failing to pass the ShouldTreatAsContinuingLoad flag to the WebContent process when
3000         doing a LoadData.
3001
3002         * UIProcess/WebPageProxy.cpp:
3003         (WebKit::WebPageProxy::loadData):
3004         (WebKit::WebPageProxy::loadDataWithNavigation):
3005         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3006         * UIProcess/WebPageProxy.h:
3007         * WebProcess/WebPage/WebPage.cpp:
3008         (WebKit::WebPage::loadDataImpl):
3009         (WebKit::WebPage::loadData):
3010         (WebKit::WebPage::loadAlternateHTML):
3011         * WebProcess/WebPage/WebPage.h:
3012
3013 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
3014
3015         Web Inspector: Prefer "about:blank" instead of an empty string for WebPageDebuggable url
3016         https://bugs.webkit.org/show_bug.cgi?id=192691
3017         <rdar://problem/46719798>
3018
3019         Reviewed by Darin Adler.
3020
3021         * UIProcess/WebPageDebuggable.cpp:
3022         (WebKit::WebPageDebuggable::url const):
3023         Instead of an empty string, return "about:blank" in bail cases.
3024         When inspecting the page that matches the contents.
3025
3026 2018-12-14  Chris Dumez  <cdumez@apple.com>
3027
3028         [PSON] Stop exposing PolicyAction::Suspend to WebCore
3029         https://bugs.webkit.org/show_bug.cgi?id=192701
3030
3031         Reviewed by Brady Eidson.
3032
3033         Introduce a new WebPolicyAction enum that is used at WebKit2 layer and augments
3034         WebCore::PolicyAction with a "Suspend" value.
3035
3036         * NetworkProcess/NetworkDataTaskBlob.cpp:
3037         (WebKit::NetworkDataTaskBlob::dispatchDidReceiveResponse):
3038         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
3039         (toNSURLSessionResponseDisposition):
3040         * Shared/WebPolicyAction.h: Added.
3041         * UIProcess/WebFramePolicyListenerProxy.cpp:
3042         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
3043         (WebKit::WebFramePolicyListenerProxy::use):
3044         (WebKit::WebFramePolicyListenerProxy::download):
3045         (WebKit::WebFramePolicyListenerProxy::ignore):
3046         * UIProcess/WebFramePolicyListenerProxy.h:
3047         * UIProcess/WebFrameProxy.cpp:
3048         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3049         * UIProcess/WebFrameProxy.h:
3050         * UIProcess/WebPageProxy.cpp:
3051         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3052         (WebKit::WebPageProxy::receivedPolicyDecision):
3053         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3054         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
3055         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3056         (WebKit::WebPageProxy::decidePolicyForResponse):
3057         * UIProcess/WebPageProxy.h:
3058         * UIProcess/WebPageProxy.messages.in:
3059         * WebKit.xcodeproj/project.pbxproj:
3060         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3061         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3062         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3063         * WebProcess/WebPage/WebFrame.cpp:
3064         (WebKit::toPolicyAction):
3065         (WebKit::WebFrame::didReceivePolicyDecision):
3066         * WebProcess/WebPage/WebFrame.h:
3067         * WebProcess/WebPage/WebPage.cpp:
3068         (WebKit::WebPage::didReceivePolicyDecision):
3069         * WebProcess/WebPage/WebPage.h:
3070         * WebProcess/WebPage/WebPage.messages.in:
3071
3072 2018-12-14  David Quesada  <david_quesada@apple.com>
3073
3074         Remove a global 'using namespace WebKit' in WebViewImpl.mm
3075         https://bugs.webkit.org/show_bug.cgi?id=192690
3076
3077         Reviewed by Tim Horton.
3078
3079         * UIProcess/Cocoa/WebViewImpl.mm:
3080         (-[WKTextListTouchBarViewController initWithWebViewImpl:]):
3081         (-[WKTextListTouchBarViewController _selectList:]):
3082         (-[WKTextListTouchBarViewController setCurrentListType:]):
3083         (-[WKTextTouchBarItemController initWithWebViewImpl:]):
3084
3085 2018-12-14  Chris Dumez  <cdumez@apple.com>
3086
3087         [PSON] WebsitePolicies are lost on process-swap
3088         https://bugs.webkit.org/show_bug.cgi?id=192694
3089         <rdar://problem/46715748>
3090
3091         Reviewed by Brady Eidson.
3092
3093         In case of process-swap on navigation, instead of sending the websitePolicies to the old
3094         process, send them to the new process as we trigger the navigation. We tell the new process
3095         that it is continuing a load and it will therefore not re-trigger a decidePolicyForNavigationAction.
3096
3097         * Shared/LoadParameters.cpp:
3098         (WebKit::LoadParameters::encode const):
3099         (WebKit::LoadParameters::decode):
3100         * Shared/LoadParameters.h:
3101         * UIProcess/WebPageProxy.cpp:
3102         (WebKit::WebPageProxy::reattachToWebProcessForReload):
3103         (WebKit::WebPageProxy::reattachToWebProcessWithItem):
3104         (WebKit::WebPageProxy::loadRequestWithNavigation):
3105         (WebKit::WebPageProxy::loadDataWithNavigation):
3106         (WebKit::WebPageProxy::goToBackForwardItem):
3107         (WebKit::WebPageProxy::receivedNavigationPolicyDecision):
3108         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3109         * UIProcess/WebPageProxy.h:
3110         * WebProcess/WebPage/WebPage.cpp:
3111         (WebKit::WebPage::loadRequest):
3112         (WebKit::WebPage::loadDataImpl):
3113         (WebKit::WebPage::loadData):
3114         (WebKit::WebPage::loadAlternateHTML):
3115         (WebKit::WebPage::goToBackForwardItem):
3116         (WebKit::WebPage::createDocumentLoader):
3117         * WebProcess/WebPage/WebPage.h:
3118         * WebProcess/WebPage/WebPage.messages.in:
3119
3120 2018-12-14  Patrick Griffis  <pgriffis@igalia.com>
3121
3122         [GTK][WPE] Fix forwarding webkit socket to flatpak sandbox
3123         https://bugs.webkit.org/show_bug.cgi?id=192622
3124
3125         Reviewed by Michael Catanzaro.
3126
3127         This fixes running with the sandbox enabled in Flatpak.
3128
3129         * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
3130         (WebKit::flatpakSpawn):
3131         * UIProcess/Launcher/glib/FlatpakLauncher.h:
3132         * UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:
3133         (WebKit::ProcessLauncher::launchProcess):
3134
3135 2018-12-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3136
3137         [WPE] Use new view state API from libwpe
3138         https://bugs.webkit.org/show_bug.cgi?id=191906
3139
3140         Reviewed by Žan Doberšek.
3141
3142         Remove WKViewSetViewState from the C API.
3143
3144         * UIProcess/API/C/wpe/WKAPICastWPE.h:
3145         * UIProcess/API/C/wpe/WKView.cpp:
3146         * UIProcess/API/C/wpe/WKView.h:
3147         * UIProcess/API/wpe/WPEView.cpp:
3148         (WKWPE::View::View): Add implementation for activity_state_changed vfunc of the view backend client.):
3149         (WKWPE::View::setViewState): Remove the default flags.
3150         * UIProcess/API/wpe/WPEView.h:
3151         (WKWPE::View::setViewState const): Make it private.
3152
3153 2018-12-13  Joseph Pecoraro  <pecoraro@apple.com>
3154
3155         [iOS] Web Inspector: Occasional UIProcess crashes under WebPageProxy::showInspectorIndication
3156         https://bugs.webkit.org/show_bug.cgi?id=192689
3157         <rdar://problem/46323610>
3158
3159         Reviewed by Simon Fraser.
3160
3161         * UIProcess/WebPageProxy.cpp:
3162         (WebKit::WebPageProxy::close):
3163         * UIProcess/WebPageProxy.h:
3164         Don't wait until ~WebPageProxy to destroy the WebPageProxyDebuggable
3165         which broadcasts it as a remote inspector target. Terminate this
3166         as soon as the WebPageProxy closes and becomes invalid.
3167
3168 2018-12-13  Chris Dumez  <cdumez@apple.com>
3169
3170         Unreviewed build fix for tvOS.
3171
3172         * Platform/cocoa/WKCrashReporter.mm:
3173
3174 2018-12-13  Chris Dumez  <cdumez@apple.com>
3175
3176         Unreviewed build fix for tvOS.
3177
3178         * Platform/cocoa/WKCrashReporter.mm:
3179
3180 2018-12-13  Chris Dumez  <cdumez@apple.com>
3181
3182         [PSON] We should not need to navigate to 'about:blank' to suspend pages
3183         https://bugs.webkit.org/show_bug.cgi?id=192668
3184         <rdar://problem/46701466>
3185
3186         Reviewed by Alex Christensen.
3187
3188         To support PageCache when process-swap on cross-site navigation is enabled,
3189         we've been navigating the previous process to 'about:blank' when swapping.
3190         This would trigger PageCaching of the page in the old process. While
3191         convenient, this design has led to a lot of bugs because we did not really
3192         want a navigation to happen in the old process.
3193
3194         To address the issue, when a WebPage is asked to suspend (for process-swap),
3195         we now attempt to add it to PageCache and save it on the current HistoryItem,
3196         *without* triggering any navigation. Any pending navigation gets cancelled
3197         and we just suspend in place.
3198
3199         Later on, when we want to go back to this HistoryItem, we simply leverage the
3200         existing WebPage::goToBackForwardItem() code path. The only subtlety is that
3201         we're actually asking the WebPage to load a HistoryItem that is the current
3202         one in the History. I had to tweak a some logic / assertions to support this
3203         as this is not something we usually do. However, it actually works with very
3204         little changes and successfully restores the PageCache entry on the current
3205         HistoryItem.
3206
3207         There is no expected overall behavior change and ProcessSwap API tests (which
3208         cover PageCache) still pass. This is merely a simpler design because it avoids
3209         navigating to about:blank.
3210
3211         * UIProcess/SuspendedPageProxy.cpp:
3212         (WebKit::SuspendedPageProxy::didSuspend):
3213         (WebKit::SuspendedPageProxy::didReceiveMessage):
3214         * UIProcess/SuspendedPageProxy.h:
3215         * UIProcess/WebPageProxy.cpp:
3216         (WebKit::WebPageProxy::didSuspendAfterProcessSwap):
3217         * UIProcess/WebPageProxy.h:
3218         * UIProcess/WebPageProxy.messages.in:
3219         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
3220         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
3221         * WebProcess/WebPage/WebDocumentLoader.cpp:
3222         (WebKit::WebDocumentLoader::setNavigationID):
3223         * WebProcess/WebPage/WebFrame.cpp:
3224         (WebKit::WebFrame::didReceivePolicyDecision):
3225         * WebProcess/WebPage/WebPage.cpp:
3226         (WebKit::WebPage::suspendForProcessSwap):
3227         * WebProcess/WebPage/WebPage.h:
3228         * WebProcess/cocoa/WebProcessCocoa.mm:
3229         (WebKit::origin):
3230
3231 2018-12-13  Per Arne Vollan  <pvollan@apple.com>
3232
3233         [macOS] Remove with-report from 3 services that are currently needed on macOS
3234         https://bugs.webkit.org/show_bug.cgi?id=192593
3235         <rdar://problem/46604752>
3236
3237         Reviewed by Brent Fulgham.
3238
3239         * WebProcess/com.apple.WebProcess.sb.in:
3240
3241 2018-12-13  Youenn Fablet  <youenn@apple.com>
3242
3243         On page close, WebPage::m_userMediaPermissionRequestManager is nullified too early
3244         https://bugs.webkit.org/show_bug.cgi?id=192657
3245
3246         Reviewed by Eric Carlson.
3247
3248         Instead of nullifying the manager, make it a UniqueRef and clear it on closing the page.
3249         This ensures we revoke the sandbox extensions as early as possible and keep the manager lifetime simple.
3250
3251         * WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
3252         (WebKit::UserMediaPermissionRequestManager::~UserMediaPermissionRequestManager):
3253         (WebKit::UserMediaPermissionRequestManager::clear):
3254         * WebProcess/MediaStream/UserMediaPermissionRequestManager.h:
3255         * WebProcess/WebPage/WebPage.cpp:
3256         (WebKit::WebPage::close):
3257         * WebProcess/WebPage/WebPage.h:
3258         (WebKit::WebPage::userMediaPermissionRequestManager):
3259
3260 2018-12-13  Chris Fleizach  <cfleizach@apple.com>
3261
3262         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3263         https://bugs.webkit.org/show_bug.cgi?id=192449
3264         <rdar://problem/46595508>
3265
3266         Reviewed by Darin Adler.
3267
3268         Part 6: Files in plugin process and UI process.
3269
3270         * PluginProcess/PluginControllerProxy.cpp:
3271         * PluginProcess/PluginProcess.cpp:
3272         * PluginProcess/WebProcessConnection.cpp:
3273         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
3274         * UIProcess/WebStorage/LocalStorageDatabase.cpp:
3275         * UIProcess/mac/WebPageProxyMac.mm:
3276
3277 2018-12-13  Eric Carlson  <eric.carlson@apple.com>
3278
3279         [MediaStream] Calculate width or height when constraints contain only the other
3280         https://bugs.webkit.org/show_bug.cgi?id=192632
3281         <rdar://problem/46665734>
3282
3283         Reviewed by Youenn Fablet.
3284
3285         * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
3286         (WebKit::UserMediaCaptureManagerProxy::SourceProxy::remoteVideoSampleAvailable): Deleted,
3287         replaced with videoSampleAvailable.
3288
3289         * WebProcess/cocoa/UserMediaCaptureManager.cpp:
3290         (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Use original frame
3291         size if necessary when calculating new frame size.
3292
3293 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
3294
3295         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3296         https://bugs.webkit.org/show_bug.cgi?id=192449
3297         <rdar://problem/46595508>
3298
3299         Reviewed by Darin Adler.
3300
3301         Part 5: Files in WebProcess folder.
3302
3303         * WebProcess/Cache/WebCacheStorageConnection.cpp:
3304         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
3305         (mediaTimeToCurrentTime):
3306         (-[WKAnimationDelegate initWithLayerID:layerTreeHost:]):
3307         * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:
3308         (-[WKAccessibilityWebPageObject accessibilityHitTest:]):
3309
3310 2018-12-12  Ross Kirsling  <ross.kirsling@sony.com>
3311
3312         [MSVC] Unreviewed build fix for r239080.
3313
3314         * UIProcess/WebPageProxy.cpp:
3315         (WebKit::WebPageProxy::didFailToSuspendAfterProcessSwap):
3316
3317 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
3318
3319         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3320         https://bugs.webkit.org/show_bug.cgi?id=192449
3321         <rdar://problem/46595508>
3322
3323         Reviewed by Darin Adler.
3324
3325         Part 4: Handling NetworkProcess folder.
3326
3327         * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
3328         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
3329         * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
3330         * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
3331         * NetworkProcess/ios/NetworkProcessIOS.mm:
3332         * NetworkProcess/mac/NetworkProcessMac.mm:
3333         * NetworkProcess/mac/RemoteNetworkingContext.mm:
3334
3335 2018-12-12  Chris Fleizach  <cfleizach@apple.com>
3336
3337         [meta][WebKit] Remove using namespace WebCore and WebKit in the global scope for unified source builds
3338         https://bugs.webkit.org/show_bug.cgi?id=192449
3339         <rdar://problem/46595508>
3340
3341         Reviewed by Tim Horton.
3342
3343         Fix iosmac build.
3344
3345         * UIProcess/ios/WKContentViewInteraction.mm:
3346         (-[WKContentView _hoverGestureRecognizerChanged:]):
3347
3348 2018-12-12  Alex Christensen  <achristensen@webkit.org>
3349
3350         Implement safe browsing in WebKit on WatchOS
3351         https://bugs.webkit.org/show_bug.cgi?id=192641
3352         <rdar://problem/46376188>
3353
3354         Reviewed by Geoff Garen.
3355
3356         WatchOS has a few special requirements:
3357         1. The margin size needs to be smaller and the title font smaller to fit on the screen.
3358         2. The exclamation point cannot be beside the title or it won't fit on the screen.  I put it above the title.
3359         3. The application must be told when the safe browsing warning has been shown.  I added a new delegate callback.
3360         4. The UIScrollView's contentSize must be set even before the details are shown to be able to scroll down to the buttons.
3361            This was already an issue on small WKWebViews on iOS, so this fixes both operating systems.
3362
3363         * Configurations/WebKit.xcconfig:
3364         * UIProcess/API/APIUIClient.h:
3365         (API::UIClient::didShowSafeBrowsingWarning):
3366         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
3367         * UIProcess/Cocoa/UIDelegate.h:
3368         * UIProcess/Cocoa/UIDelegate.mm:
3369         (WebKit::UIDelegate::setDelegate):
3370         (WebKit::UIDelegate::UIClient::didShowSafeBrowsingWarning):
3371         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3372         (fontOfSize):
3373         (buttonSize):
3374         (-[WKSafeBrowsingWarning addContent]):
3375         (-[WKSafeBrowsingWarning showDetailsClicked]):
3376         (-[WKSafeBrowsingWarning updateContentSize]):
3377         (buttonWidth): Deleted.
3378         * UIProcess/WebPageProxy.cpp:
3379         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3380
3381 2018-12-12  Commit Queue  <commit-queue@webkit.org>
3382
3383         Unreviewed, rolling out r239129 and r239131.
3384         https://bugs.webkit.org/show_bug.cgi?id=192646
3385
3386         Casued macOS and iOS Debug testing to fail early (Requested by
3387         Truitt on #webkit).
3388
3389         Reverted changesets:
3390
3391         "Unreviewed build fix for WinCairo Debug after r239080(?)."
3392         https://trac.webkit.org/changeset/239129
3393
3394         "Unreviewed fix for Cocoa Debug test instability following
3395         r239129."
3396         https://trac.webkit.org/changeset/239131
3397
3398 2018-12-12  Vivek Seth  <v_seth@apple.com>
3399
3400         HTTPS Upgrade: Figure out if/how to tell clients that the HTTPS upgrade happened
3401         https://bugs.webkit.org/show_bug.cgi?id=192375
3402         <rdar://problem/45851159>
3403
3404         Reviewed by Chris Dumez.
3405
3406         Use simulated redirect to tell clients that HTTPS Upgrade happened.
3407
3408         * NetworkProcess/NetworkLoadChecker.cpp:
3409         (WebKit::NetworkLoadChecker::NetworkLoadChecker):
3410         (WebKit::NetworkLoadChecker::checkRedirection):
3411         (WebKit::NetworkLoadChecker::accessControlErrorForValidationHandler):
3412         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded const):
3413         (WebKit::NetworkLoadChecker::checkRequest):
3414         (WebKit::NetworkLoadChecker::continueCheckingRequestOrDoSyntheticRedirect):
3415         (WebKit::NetworkLoadChecker::checkCORSRequestWithPreflight):
3416         (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded): Deleted.
3417         * NetworkProcess/NetworkLoadChecker.h:
3418         * NetworkProcess/NetworkResourceLoader.cpp:
3419         (WebKit::NetworkResourceLoader::start):
3420         * NetworkProcess/PingLoad.cpp:
3421
3422 2018-12-12  Ross Kirsling  <ross.kirsling@sony.com>
3423
3424         Unreviewed fix for Cocoa Debug test instability following r239129.
3425
3426         * UIProcess/WebPageProxy.cpp: