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