37bd2ace50abda9fddaa8089e0108e55ea7f941b
[WebKit-https.git] / Source / WebKit / ChangeLog
1 2018-11-28  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r238653 and r238656.
4         https://bugs.webkit.org/show_bug.cgi?id=192130
5
6         Breaks iOS build (Requested by smfr on #webkit).
7
8         Reverted changesets:
9
10         "Move Lookup Code for better cross platform usage"
11         https://bugs.webkit.org/show_bug.cgi?id=191732
12         https://trac.webkit.org/changeset/238653
13
14         "Attempt to fix the iOS build by only including RevealSPI.h
15         when it's needed."
16         https://trac.webkit.org/changeset/238656
17
18 2018-11-28  Alex Christensen  <achristensen@webkit.org>
19
20         Modernize BlobRegistry::writeBlobsToTemporaryFiles
21         https://bugs.webkit.org/show_bug.cgi?id=192117
22
23         Reviewed by Dean Jackson.
24
25         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
26         (WebKit::NetworkBlobRegistry::writeBlobsToTemporaryFiles):
27         (WebKit::NetworkBlobRegistry::writeBlobToFilePath):
28         * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
29         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
30         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
31         * NetworkProcess/NetworkConnectionToWebProcess.h:
32         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
33         * NetworkProcess/NetworkProcess.cpp:
34         (WebKit::NetworkProcess::writeBlobToFilePath):
35         * NetworkProcess/NetworkProcess.h:
36         * NetworkProcess/NetworkProcess.messages.in:
37         * UIProcess/ChildProcessProxy.h:
38         (WebKit::ChildProcessProxy::sendWithAsyncReply):
39         * UIProcess/Network/NetworkProcessProxy.cpp:
40         (WebKit::NetworkProcessProxy::didClose):
41         (WebKit::NetworkProcessProxy::writeBlobToFilePath):
42         (WebKit::NetworkProcessProxy::didWriteBlobToFilePath): Deleted.
43         * UIProcess/Network/NetworkProcessProxy.h:
44         * UIProcess/Network/NetworkProcessProxy.messages.in:
45         * WebProcess/FileAPI/BlobRegistryProxy.cpp:
46         (WebKit::BlobRegistryProxy::writeBlobsToTemporaryFiles):
47         * WebProcess/FileAPI/BlobRegistryProxy.h:
48         * WebProcess/Network/NetworkProcessConnection.cpp:
49         (WebKit::NetworkProcessConnection::didClose):
50         (WebKit::NetworkProcessConnection::writeBlobsToTemporaryFiles):
51         (WebKit::NetworkProcessConnection::didWriteBlobsToTemporaryFiles): Deleted.
52         * WebProcess/Network/NetworkProcessConnection.h:
53         * WebProcess/Network/NetworkProcessConnection.messages.in:
54
55 2018-11-28  Alex Christensen  <achristensen@webkit.org>
56
57         Move loadThrottleLatency from NetworkProcessCreationParameters to NetworkSessionCreationParameters
58         https://bugs.webkit.org/show_bug.cgi?id=192122
59
60         Reviewed by Dean Jackson.
61
62         This is part of an effort to reduce global variables in the NetworkProcess.
63
64         * NetworkProcess/NetworkLoad.cpp:
65         (WebKit::NetworkLoad::NetworkLoad):
66         (WebKit::NetworkLoad::didReceiveResponse):
67         * NetworkProcess/NetworkLoad.h:
68         * NetworkProcess/NetworkProcess.cpp:
69         (WebKit::NetworkProcess::initializeNetworkProcess):
70         * NetworkProcess/NetworkProcess.h:
71         (WebKit::NetworkProcess::loadThrottleLatency const): Deleted.
72         * NetworkProcess/NetworkProcessCreationParameters.cpp:
73         (WebKit::NetworkProcessCreationParameters::encode const):
74         (WebKit::NetworkProcessCreationParameters::decode):
75         * NetworkProcess/NetworkSession.h:
76         (WebKit::NetworkSession::loadThrottleLatency const):
77         * NetworkProcess/NetworkSessionCreationParameters.cpp: Added.
78         (WebKit::NetworkSessionCreationParameters::privateSessionParameters):
79         (WebKit::NetworkSessionCreationParameters::encode const):
80         (WebKit::NetworkSessionCreationParameters::decode):
81         * NetworkProcess/NetworkSessionCreationParameters.h:
82         (WebKit::NetworkSessionCreationParameters::encode const): Deleted.
83         (WebKit::NetworkSessionCreationParameters::decode): Deleted.
84         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
85         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
86         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
87         * Shared/WebsiteDataStoreParameters.cpp:
88         (WebKit::WebsiteDataStoreParameters::privateSessionParameters):
89         * Sources.txt:
90         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
91         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
92         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
93         (WebKit::WebsiteDataStore::parameters):
94         * WebKit.xcodeproj/project.pbxproj:
95
96 2018-11-15  Megan Gardner  <megan_gardner@apple.com>
97
98         Move Lookup Code for better cross platform usage
99         https://bugs.webkit.org/show_bug.cgi?id=191732
100
101         Reviewed by Alex Christensen.
102
103         Lookup is being replaced by Reveal. This framework should work on all platforms.
104         The patch moves the code that we expect will be needed for all platforms to the more
105         general cocoa area. This patch changes no funcationality, and should not change
106         anything currently. This work will be build on later when Reveal is ready to support
107         multiple platforms.
108
109         * Platform/spi/ios/UIKitSPI.h:
110         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
111         (WebKit::WebPageProxy::performDictionaryLookupAtLocation):
112         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection):
113         * UIProcess/ios/WKContentViewInteraction.h:
114         * UIProcess/ios/WKContentViewInteraction.mm:
115         (-[WKContentView setupInteraction]):
116         (-[WKContentView cleanupInteraction]):
117         (-[WKContentView _removeDefaultGestureRecognizers]):
118         (-[WKContentView _addDefaultGestureRecognizers]):
119         (-[WKContentView gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
120         (-[WKContentView _lookupGestureRecognized:]):
121         * UIProcess/ios/WebPageProxyIOS.mm:
122         (WebKit::WebPageProxy::performDictionaryLookupAtLocation): Deleted.
123         * UIProcess/mac/WebPageProxyMac.mm:
124         (WebKit::WebPageProxy::performDictionaryLookupAtLocation): Deleted.
125         (WebKit::WebPageProxy::performDictionaryLookupOfCurrentSelection): Deleted.
126         * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
127         (WebKit::WebPage::performDictionaryLookupAtLocation):
128         (WebKit::WebPage::performDictionaryLookupForSelection):
129         (WebKit::WebPage::performDictionaryLookupOfCurrentSelection):
130         (WebKit::WebPage::performDictionaryLookupForRange):
131         (WebKit::WebPage::dictionaryPopupInfoForRange):
132         * WebProcess/WebPage/WebPage.messages.in:
133         * WebProcess/WebPage/ios/WebPageIOS.mm:
134         (WebKit::WebPage::performDictionaryLookupAtLocation): Deleted.
135         (WebKit::WebPage::performDictionaryLookupForSelection): Deleted.
136         (WebKit::WebPage::performDictionaryLookupForRange): Deleted.
137         * WebProcess/WebPage/mac/WebPageMac.mm:
138         (WebKit::WebPage::performDictionaryLookupAtLocation): Deleted.
139         (WebKit::WebPage::performDictionaryLookupForSelection): Deleted.
140         (WebKit::WebPage::performDictionaryLookupOfCurrentSelection): Deleted.
141         (WebKit::WebPage::dictionaryPopupInfoForRange): Deleted.
142         (WebKit::WebPage::performDictionaryLookupForRange): Deleted.
143
144 2018-11-28  Keith Rollin  <krollin@apple.com>
145
146         Update generate-{derived,unified}-sources scripts to support generating .xcfilelist files
147         https://bugs.webkit.org/show_bug.cgi?id=192031
148         <rdar://problem/46286816>
149
150         Reviewed by Alex Christensen.
151
152         The Generate Derived Sources and Generate Unified Sources build phases
153         in Xcode need to have their inputs and outputs specified. This
154         specification will come in the form of .xcfilelist files that will be
155         attached to these build phases. There is one .xcfilelist file that
156         lists the input file and one that lists the output files. As part of
157         this work, the various generate-{derived,unified}-sources scripts that
158         are executed in these Generate build phases are modified to help in
159         the creation of these .xcfilelist files. In particular, they can now
160         be invoked with command-line parameters. These parameters are then
161         used to alter the normal execution of these scripts, causing them to
162         produce the .xcfilelist files as opposed to actually generating the
163         files that are listed in those files.
164
165         * Scripts/generate-derived-sources.sh:
166         * Scripts/generate-unified-sources.sh:
167
168 2018-11-28  Keith Rollin  <krollin@apple.com>
169
170         Revert print_all_generated_files work in r238008; tighten up target specifications
171         https://bugs.webkit.org/show_bug.cgi?id=192025
172         <rdar://problem/46284301>
173
174         Reviewed by Alex Christensen.
175
176         In r238008, I added a facility for DerivedSources.make makefiles to
177         print out the list of files that they generate. This output was used
178         in the generation of .xcfilelist files used to specify the output of
179         the associated Generate Derived Sources build phases in Xcode. This
180         approach worked, but it meant that people would need to follow a
181         specific convention to keep this mechanism working.
182
183         Instead of continuing this approach, I'm going to implement a new
184         facility based on the output of `make` when passed the -d flag (which
185         prints dependency information). This new mechanism is completely
186         automatic and doesn't need maintainers to follow a convention. To that
187         end, remove most of the work performed in r238008 that supports the
188         print_all_generated_files target.
189
190         At the same time, it's important for the sets of targets and their
191         dependencies to be complete and correct. Therefore, also include
192         changes to bring those up-to-date. As part of that, you'll see
193         prevalent use of a particular technique. Here's an example:
194
195             BYTECODE_FILES = \
196                 Bytecodes.h \
197                 BytecodeIndices.h \
198                 BytecodeStructs.h \
199                 InitBytecodes.asm \
200             #
201             BYTECODE_FILES_PATTERNS = $(subst .,%,$(BYTECODE_FILES))
202
203             all : $(BYTECODE_FILES)
204
205             $(BYTECODE_FILES_PATTERNS): $(wildcard $(JavaScriptCore)/generator/*.rb) $(JavaScriptCore)/bytecode/BytecodeList.rb
206                 ...
207
208         These lines indicate a set of generated files (those specified in
209         BYTECODE_FILES). These files are generated by the BytecodeList.rb
210         tool. But, as opposed to the normal rule where a single foo.output is
211         generated by foo.input plus some additional dependencies, this rule
212         produces multiple output files from a tool whose connection to the
213         output files is not immediately clear. A special approach is needed
214         where a single rule produces multiple output files. The normal way to
215         implement this is to use an .INTERMEDIATE target. However, we used
216         this approach in the past and ran into a problem with it, addressing
217         it with an alternate approach in r210507. The above example shows this
218         approach. The .'s in the list of target files are replaced with %'s,
219         and the result is used as the left side of the dependency rule.
220
221         * DerivedSources.make:
222
223 2018-11-28  Daniel Bates  <dabates@apple.com>
224
225         [iOS] Page not defocused when Find-in-page becomes first responder
226         https://bugs.webkit.org/show_bug.cgi?id=192084
227         <rdar://problem/46146777>
228
229         Reviewed by Tim Horton.
230
231         When -becomeFirstResponder and -resignFirstResponder is called the page should become focused
232         and defocused, respectively. WebKit adjusts it behavior depending on whether it knows it has
233         focus. This includes decisions about whether to allow an element to be focused. We need to
234         ensure that WebKit knows whether the web view is focused for it to make good decisions.
235
236         * UIProcess/ios/PageClientImplIOS.mm:
237         (WebKit::PageClientImpl::isViewFocused): Check if the content view is the first responder and
238         hence is accepting keyboard input. Note that picture-in-picture views do not accept keyboard
239         input.
240         * UIProcess/ios/WKContentViewInteraction.mm:
241         (-[WKContentView becomeFirstResponderForWebView]): Update activity state when the view
242         becomes focused.
243         (-[WKContentView resignFirstResponderForWebView]): Update activity state when the view
244         becomes defocused.
245
246 2018-11-28  Alex Christensen  <achristensen@webkit.org>
247
248         Remove dead code from an earlier attempt at implementing safe browsing
249         https://bugs.webkit.org/show_bug.cgi?id=192067
250
251         Reviewed by Chris Dumez.
252
253         * Shared/LoadParameters.cpp:
254         (WebKit::LoadParameters::encode const):
255         (WebKit::LoadParameters::decode):
256         * Shared/LoadParameters.h:
257         * UIProcess/WebPageProxy.cpp:
258         (WebKit::WebPageProxy::loadAlternateHTML):
259         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
260         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
261         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
262         * UIProcess/WebPageProxy.h:
263         * UIProcess/WebPageProxy.messages.in:
264         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
265         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
266         * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
267
268 2018-11-28  Alex Christensen  <achristensen@webkit.org>
269
270         Move logCookieInformation bool from NetworkProcess to NetworkSession
271         https://bugs.webkit.org/show_bug.cgi?id=192049
272
273         Reviewed by Chris Dumez.
274
275         Part of an effort to remove globals in the NetworkProcess.
276
277         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
278         (WebKit::NetworkConnectionToWebProcess::cookiesForDOM):
279         (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM):
280         * NetworkProcess/NetworkProcess.cpp:
281         (WebKit::NetworkProcess::initializeNetworkProcess):
282         * NetworkProcess/NetworkProcess.h:
283         (WebKit::NetworkProcess::shouldLogCookieInformation const): Deleted.
284         * NetworkProcess/NetworkProcessCreationParameters.cpp:
285         (WebKit::NetworkProcessCreationParameters::encode const):
286         (WebKit::NetworkProcessCreationParameters::decode):
287         * NetworkProcess/NetworkProcessCreationParameters.h:
288         * NetworkProcess/NetworkResourceLoader.cpp:
289         (WebKit::NetworkResourceLoader::didFinishLoading):
290         (WebKit::NetworkResourceLoader::sendResultForCacheEntry):
291         (WebKit::NetworkResourceLoader::shouldLogCookieInformation):
292         (WebKit::NetworkResourceLoader::logCookieInformation const):
293         (WebKit::logBlockedCookieInformation):
294         (WebKit::logCookieInformationInternal):
295         (WebKit::NetworkResourceLoader::logCookieInformation):
296         * NetworkProcess/NetworkResourceLoader.h:
297         * NetworkProcess/NetworkSession.h:
298         (WebKit::NetworkSession::logCookieInformation const):
299         * NetworkProcess/NetworkSessionCreationParameters.h:
300         (WebKit::NetworkSessionCreationParameters::encode const):
301         (WebKit::NetworkSessionCreationParameters::decode):
302         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
303         (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
304         (WebKit::NetworkDataTaskCocoa::willPerformHTTPRedirection):
305         * NetworkProcess/cocoa/NetworkSessionCocoa.h:
306         * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
307         (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
308         * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
309         (WebKit::WebProcessPool::platformInitializeNetworkProcess):
310         * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
311         (WebKit::WebsiteDataStore::parameters):
312
313 2018-11-28  Ryan Haddad  <ryanhaddad@apple.com>
314
315         Unreviewed, rolling out r238620.
316
317         Broke internal builds again.
318
319         Reverted changeset:
320
321         "Remove @no-unify of InjectedBundleRangeHandle.cpp and
322         InjectedBundleNodeHandle.cpp"
323         https://bugs.webkit.org/show_bug.cgi?id=191853
324         https://trac.webkit.org/changeset/238620
325
326 2018-11-28  Yongjun Zhang  <yongjun_zhang@apple.com>
327
328         Allow WebKit clients to specify a minimum effective width for layout.
329         https://bugs.webkit.org/show_bug.cgi?id=191499
330         <rdar://problem/45362678>
331
332         Reviewed by Wenson Hsieh.
333
334         If we ignore the meta viewport (_shouldIgnoreMetaViewport is true), the default layout width will be device
335         width. For clients that wish to lay out the content with a different width value, we would need to add a way
336         to specify the effective width for layout.
337
338         * UIProcess/API/Cocoa/WKWebView.mm: Add an iVar _minimumEffectiveDeviceWidth.
339         (-[WKWebView _dispatchSetViewLayoutSize:]): Call the new setViewportConfigurationViewLayoutSize method.
340         (-[WKWebView _setViewScale:]): Ditto.
341         (-[WKWebView _setMinimumEffectiveWidth:]): The setter for _minimumEffectiveDeviceWidth.
342         (-[WKWebView _minimumEffectiveWidth]): Getter for _minimumEffectiveDeviceWidth
343         * UIProcess/API/Cocoa/WKWebViewPrivate.h: Add a property _minimumEffectiveDeviceWidth to WKWebView.
344         * UIProcess/WebPageProxy.h: Change setViewportConfigurationViewLayoutSize to take another argument minimumEffectiveDeviceWidth.
345         * UIProcess/ios/WebPageProxyIOS.mm:
346         (WebKit::WebPageProxy::setViewportConfigurationViewLayoutSize): Also send effectiveWidth to WebContent process.
347         * WebProcess/WebPage/WebPage.cpp:
348         (WebKit::WebPage::WebPage): Set the initial effective width to 0 when creating a web page, this tells ViewportConfiguration
349              to ignore the minimum effective width value.
350         * WebProcess/WebPage/WebPage.h: Change setViewportConfigurationViewLayoutSize to take another argument effectiveWidth.
351         * WebProcess/WebPage/WebPage.messages.in:
352         * WebProcess/WebPage/ios/WebPageIOS.mm:
353         (WebKit::WebPage::setViewportConfigurationViewLayoutSize): Also pass effectiveWidth value to ViewportConfiguration.
354
355 2018-11-28  Fujii Hironori  <Hironori.Fujii@sony.com>
356
357         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
358         https://bugs.webkit.org/show_bug.cgi?id=191853
359
360         Reviewed by Michael Catanzaro.
361
362         In r235845, I excluded InjectedBundleRangeHandle.cpp and
363         InjectedBundleNodeHandle.cpp from unify source builds in order to
364         work around a MSVC bug.
365
366         Then, I commited a different workaround for the MSVC bug in
367         r238386. Now, we can include InjectedBundleRangeHandle.cpp and
368         InjectedBundleNodeHandle.cpp in unified source builds. Revert
369         r235845.
370
371         * Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
372         and InjectedBundleNodeHandle.cpp
373         * WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
374         not to be compiled by XCode.
375
376 2018-11-28  Joseph Pecoraro  <pecoraro@apple.com>
377
378         Web Inspector: REGRESSION(r238378): reloading WebInspector after a settings change doesn't re-show WebInspector
379         https://bugs.webkit.org/show_bug.cgi?id=191971
380
381         Reviewed by Matt Baker.
382
383         * WebProcess/WebPage/WebInspector.cpp:
384         (WebKit::WebInspector::reopen): Deleted.
385         * WebProcess/WebPage/WebInspector.h:
386         * WebProcess/WebPage/WebInspector.messages.in:
387         Move reopen out of the WebProcess...
388
389         * UIProcess/WebInspectorProxy.cpp:
390         (WebKit::WebInspectorProxy::reopen):
391         * UIProcess/WebInspectorProxy.h:
392         * UIProcess/WebInspectorProxy.messages.in:
393         And into the UIProcess where the order of messages won't
394         be as problematic.
395
396         * WebProcess/WebPage/WebInspectorUI.cpp:
397         (WebKit::WebInspectorUI::reopen):
398         Send a message to the WebInspectorProxy instead.
399
400 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
401
402         Remove another OS version check from NetworkDataTaskCocoa.mm
403         https://bugs.webkit.org/show_bug.cgi?id=192046
404
405         Reviewed by Alex Christensen.
406
407         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
408         (WebKit::NetworkDataTaskCocoa::statelessCookieStorage):
409
410 2018-11-28  Alexey Proskuryakov  <ap@apple.com>
411
412         Modernize version checks for same site cookie support
413         https://bugs.webkit.org/show_bug.cgi?id=192054
414
415         Reviewed by Tim Horton.
416
417         * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: (WebKit::updateTaskWithFirstPartyForSameSiteCookies):
418         Also removed runtime checks, which are no longer relevant.
419
420 2018-11-27  Mark Lam  <mark.lam@apple.com>
421
422         ENABLE_FAST_JIT_PERMISSIONS should be false for iosmac.
423         https://bugs.webkit.org/show_bug.cgi?id=192055
424         <rdar://problem/46288783>
425
426         Reviewed by Saam Barati.
427
428         * Configurations/FeatureDefines.xcconfig:
429
430 2018-11-27  Alex Christensen  <achristensen@webkit.org>
431
432         Make synchronous IPC introduced in r237267 asynchronous
433         https://bugs.webkit.org/show_bug.cgi?id=190757
434
435         Reviewed by Chris Dumez.
436
437         * UIProcess/API/Cocoa/WKProcessPool.mm:
438         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:completionHandler:]):
439         (-[WKProcessPool _getActivePagesOriginsInWebProcessForTesting:]): Deleted.
440         * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
441         * UIProcess/WebProcessPool.cpp:
442         (WebKit::WebProcessPool::activePagesOriginsInWebProcessForTesting):
443         * UIProcess/WebProcessPool.h:
444         * UIProcess/WebProcessProxy.cpp:
445         (WebKit::WebProcessProxy::activePagesDomainsForTesting):
446         * UIProcess/WebProcessProxy.h:
447         * WebProcess/WebProcess.cpp:
448         (WebKit::WebProcess::getActivePagesOriginsForTesting):
449         * WebProcess/WebProcess.messages.in:
450         * WebProcess/cocoa/WebProcessCocoa.mm:
451         (WebKit::WebProcess::getActivePagesOriginsForTesting):
452
453 2018-11-27  Alex Christensen  <achristensen@webkit.org>
454
455         Safe browsing warning text needs to be visible on High Sierra
456         https://bugs.webkit.org/show_bug.cgi?id=192022
457
458         Reviewed by Tim Horton.
459
460         Something about AppKit, autolayout, view insertion order, and NSTextView makes the text lay
461         out with initial size of {0, 0} on High Sierra. Using an NSTextField instead makes the details visible.
462
463         Covered by an API test.
464
465         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
466         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
467         (makeLabel):
468         (-[WKSafeBrowsingWarning addContent]):
469         (-[WKSafeBrowsingWarning showDetailsClicked]):
470         (-[WKSafeBrowsingWarning layoutText]):
471         (makeTitleLabel): Deleted.
472
473 2018-11-27  Tim Horton  <timothy_horton@apple.com>
474
475         WKNavigation.AutomaticViewReloadAfterWebProcessCrash asserts after r238538
476         https://bugs.webkit.org/show_bug.cgi?id=192038
477         <rdar://problem/46288457>
478
479         Reviewed by Wenson Hsieh.
480
481         * UIProcess/WebPageProxy.cpp:
482         (WebKit::m_resetRecentCrashCountTimer):
483         (WebKit::WebPageProxy::finishAttachingToWebProcess):
484         (WebKit::WebPageProxy::resetState):
485         (WebKit::m_editableImageController): Deleted.
486         Properly invalidate m_editableImageController when resetting WebPageProxy.
487         Otherwise, the MessageReceiverMaps get invalidated, then later when
488         EditableImageController goes away we assert trying to remove the receiver.
489
490 2018-11-27  Jiewen Tan  <jiewen_tan@apple.com>
491
492         (r238246) [ MacOS Debug ] Layout Test http/wpt/webauthn/ctap-hid-failure.https.html is Crashing
493         https://bugs.webkit.org/show_bug.cgi?id=191757
494
495         Reviewed by Chris Dumez.
496
497         Wrong nonce error causes retransmission, which then trigger wrong nonce error. This is expected
498         behavior for mock testing. However, the main thread could time out when MockHidConnection::send
499         is excuting the block on another thread. The block will then return without invoking the callback,
500         which triggers this WTFCrash. The solution is always invoking the callback before return in the
501         block.
502
503         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
504         (WebKit::MockHidConnection::send):
505
506 2018-11-27  Keith Rollin  <krollin@apple.com>
507
508         Better parsing of comments in generate-message*.py
509         https://bugs.webkit.org/show_bug.cgi?id=191866
510         <rdar://problem/46189563>
511
512         Reviewed by Chris Dumez.
513
514         The script parsing the *.messages.in files would treat a line starting
515         with '#' as a comment, but not a line starting with '<whitespace>#'.
516         This means that jamming a '#' right in front of the first character of
517         a message definition (as opposed to the beginning of a line) will have
518         no effect and the line will get treated just the same as a
519         non-commented line. Fix this by trimming all white space from the
520         beginning and ending of the line before processing it.
521
522         * Scripts/webkit/parser.py:
523         (parse):
524         * Scripts/webkit/test-messages.in:
525
526 2018-11-27  Thibault Saunier  <tsaunier@igalia.com>
527
528         [GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var
529         https://bugs.webkit.org/show_bug.cgi?id=192024
530
531         Reviewed by Michael Catanzaro.
532
533         * UIProcess/API/glib/WebKitSettings.cpp:
534         (webKitSettingsConstructed):
535
536 2018-11-27  Alexey Proskuryakov  <ap@apple.com>
537
538         Modernize the check for async _saveCookies existence
539         https://bugs.webkit.org/show_bug.cgi?id=191987
540
541         Reviewed by Dean Jackson.
542
543         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
544         (WebKit::NetworkProcess::platformSyncAllCookies):
545
546 2018-11-27  Tim Horton  <timothy_horton@apple.com>
547
548         Serialize and deserialize editable image strokes
549         https://bugs.webkit.org/show_bug.cgi?id=192002
550         <rdar://problem/30900149>
551
552         Reviewed by Dean Jackson.
553
554         * UIProcess/API/APIAttachment.cpp:
555         (API::Attachment::updateAttributes):
556         * UIProcess/WebPageProxy.cpp:
557         (WebKit::WebPageProxy::willUpdateAttachmentAttributes):
558         * UIProcess/WebPageProxy.h:
559         When an attachment would update its DOM attributes, plumb a notification
560         to EditableImageController, and allow it to block the update (because
561         we don't really want to set src for editable image attachments,
562         we just want the UI process to fully own the data).
563
564         * Platform/spi/ios/PencilKitSPI.h:
565         Add some SPI.
566
567         * UIProcess/ios/EditableImageController.h:
568         * UIProcess/ios/EditableImageController.mm:
569         (WebKit::EditableImageController::loadStrokesFromAttachment):
570         Add a helper to load strokes from an attachment.
571
572         (WebKit::EditableImageController::associateWithAttachment):
573         Try to load strokes from the attachment when initially associated.
574         Don't create a file wrapper around a null image, so it will be regenerated later.
575
576         (WebKit::EditableImageController::willUpdateAttachmentAttributes):
577         The aforementioned plumbing at update time.
578
579         * UIProcess/ios/WKDrawingView.h:
580         * UIProcess/ios/WKDrawingView.mm:
581         (-[WKDrawingView layoutSubviews]):
582         Invalidate the attachment (so it will be regenerated upon request) if the
583         canvas size changes.
584
585         (-[WKDrawingView PNGRepresentation]):
586         Serialize strokes into the EXIF User Comment field.
587         We will find a different field to use (ideally a custom vendor-specific
588         field that nobody else will use for anything), but this works for now.
589
590         Don't try to render an image if we don't have a size or scale;
591         PKImageRenderer will just fail anyway, so bail early.
592
593         In the iOS Simulator, PKImageRenderer currently returns an unusable image.
594         Instead, so that we have a image on which to serialize the strokes,
595         create a transparent 1x1 image. This makes it possible to serialize strokes
596         even though we don't have a usable rendered image, so that we can still test
597         this change (and future changes).
598
599         (-[WKDrawingView loadDrawingFromPNGRepresentation:]):
600         If available, deserialize strokes from the EXIF User Comment field.
601
602         (-[WKDrawingView drawingDidChange:]):
603         (-[WKDrawingView invalidateAttachment]):
604         Factor invalidateAttachment out of drawingDidChange so we can call
605         it from layoutSubviews too!
606
607 2018-11-27  Chris Dumez  <cdumez@apple.com>
608
609         Regression(PSON) crash under WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame()
610         https://bugs.webkit.org/show_bug.cgi?id=191983
611         <rdar://problem/46246863>
612
613         Reviewed by Geoffrey Garen.
614
615         * UIProcess/WebPageProxy.cpp:
616         (WebKit::WebPageProxy::continueNavigationInNewProcess):
617         Make sure the navigation still exists in m_mainFrameCreationHandler and return early if it
618         does not.
619
620         (WebKit::WebPageProxy::resetState):
621         Clear out m_mainFrameCreationHandler / m_mainFrameWindowCreationHandler if we resetting the state
622         after a crash. At this point, there is no chance the WebProcess will send us the IPC that will
623         cause these to get called and we do not want old state to remain for future navigations.
624
625 2018-11-16  Jiewen Tan  <jiewen_tan@apple.com>
626
627         Disallow loading webarchives as iframes
628         https://bugs.webkit.org/show_bug.cgi?id=191728
629         <rdar://problem/45524528>
630
631         Reviewed by Youenn Fablet.
632
633         * UIProcess/WebPageProxy.cpp:
634         (WebKit::WebPageProxy::unableToImplementPolicy):
635         Add a check to prevent null pointer dereference.
636
637 2018-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
638
639         WebKit.AddAndRemoveDataDetectors hits a debug assertion after r238515
640         https://bugs.webkit.org/show_bug.cgi?id=191996
641
642         Reviewed by Tim Horton.
643
644         This assertion is hit because `decode(Decoder& decoder, NSArray<Class> *allowedClasses)` expects the decoded
645         object (of class `_NSArrayM`) to be equal to `NSArray.class`.
646
647         We fix the crash by relaxing the debug assertion when decoding securely-codable objects over IPC. Instead of
648         checking that the class of the decoded object is equal to one of the allowed classes, check that the object is a
649         kind of any of the allowed classes.
650
651         * Shared/Cocoa/ArgumentCodersCocoa.h:
652         (IPC::isObjectClassAllowed):
653         (IPC::decode):
654
655 2018-11-27  Tomas Popela  <tpopela@redhat.com>
656
657         [GTK][WPE] Remove temporary workaround in Source/WebKit/Platform*.cmake
658         https://bugs.webkit.org/show_bug.cgi?id=192008
659
660         Reviewed by Michael Catanzaro.
661
662         Looks like it's not needed anymore as the code compiles fine without
663         it.
664
665         * PlatformGTK.cmake:
666         * PlatformWPE.cmake:
667
668 2018-11-27  Antti Koivisto  <antti@apple.com>
669
670         Factor mask layer applying in RemoteLayerTreePropertyApplier into a shared function
671         https://bugs.webkit.org/show_bug.cgi?id=192001
672
673         Reviewed by Tim Horton.
674
675         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
676         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
677         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
678         (WebKit::RemoteLayerTreePropertyApplier::updateMask):
679
680         Shared function, with some special tricks for iOS backdrop layers.
681
682         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
683
684 2018-11-27  Antti Koivisto  <antti@apple.com>
685
686         Stop collecting related layers in RemoteLayerTreeHost::updateLayerTree
687         https://bugs.webkit.org/show_bug.cgi?id=192003
688
689         Reviewed by Tim Horton.
690
691         We can pass the node hash directly to RemoteLayerTreePropertyApplier. The collection step doesn't seem
692         to add anything except an extra hash lookup.
693
694         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
695         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
696         (WebKit::RemoteLayerTreeHost::updateLayerTree):
697
698         Pass m_nodes directly.
699         Some random cleanups.
700
701 2018-11-27  Antti Koivisto  <antti@apple.com>
702
703         Remote tile layers shouldn't be UIViews
704         https://bugs.webkit.org/show_bug.cgi?id=191953
705
706         Reviewed by Tim Horton.
707
708         They don't need any UIView functionality, nor do they ever have UIView descendants.
709         We can use lighter weight objects.
710
711         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
712         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
713         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
714         (WebKit::RemoteLayerTreePropertyApplier::updateChildren):
715
716         Factor to a function shared between platforms.
717         Support having both views and plain layers in the same tree.
718         Assert that all siblings are of the same type and that we don't attempt to add views to layers.
719
720         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
721         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
722         (WebKit::RemoteLayerTreeHost::makeNode):
723
724         Use new plain layer on Mac too.
725
726         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
727         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
728         (-[WKPlainRemoteLayer description]):
729
730         Add a CALayer subclass so we can have a description, similar to WKCompositingView and pals.
731
732         (WebKit::RemoteLayerTreeNode::createWithPlainLayer):
733         (WebKit::RemoteLayerTreeNode::detachFromParent):
734
735         Support having null view.
736
737         (WebKit::RemoteLayerTreeNode::appendLayerDescription):
738
739         Helper for layer descriptions.
740
741         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
742         (WebKit::RemoteLayerTreeHost::makeNode):
743
744         Construct plain layers for tiles.
745
746         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
747         (-[WKCompositingView description]):
748         (-[WKUIRemoteView description]):
749         (-[WKBackdropView description]):
750
751 2018-11-27  Fujii Hironori  <Hironori.Fujii@sony.com>
752
753         Remove "using namespace WebCore" under Source/WebKit/WebProcess/InjectedBundle/API
754         https://bugs.webkit.org/show_bug.cgi?id=191995
755
756         Reviewed by Alex Christensen.
757
758         The statement "using namespace WebCore" should be placed inside
759         namespace WebKit for unified source builds. But, source files
760         defining WebKit API can't be enclosed by namespace WebKit { }
761         becuase they are defined in the global scope.
762
763         "using namespace WebCore" in global scope and unified source
764         builds may cause build breaks (Bug 191853).
765
766         Remove "using namespace WebCore" in the global scope. Use
767         "WebCore::" prefix instead.
768
769         * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
770         (WKBundleClearAllDatabases):
771         (WKBundleSetDatabaseQuota):
772         (WKBundleClearResourceLoadStatistics):
773         (WKBundleResourceLoadStatisticsNotifyObserver):
774         * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
775         (WKBundleFrameGetFrameLoadState):
776         (WKBundleFrameClearOpener):
777         (WKBundleFrameCallShouldCloseOnWebView):
778         (WKBundleFrameCopySecurityOrigin):
779         (WKBundleFrameFocus):
780         * WebProcess/InjectedBundle/API/c/WKBundleInspector.cpp:
781         * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
782
783 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
784
785         [Cocoa] No way for clients to tell whether the content view is in the responder chain when the web view is
786         https://bugs.webkit.org/show_bug.cgi?id=169212
787         <rdar://problem/30899656>
788
789         Reviewed by Tim Horton.
790
791         Add an SPI hook to allow internal WKWebView clients to determine whether the WKWebView's content view is the
792         first responder. Intended for use by clients, such as Mail, that embed native text input views and other views
793         that may become first responder within the view hierarchy of the WKWebView.
794
795         * UIProcess/API/Cocoa/WKWebView.mm:
796         (-[WKWebView _contentViewIsFirstResponder]):
797         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
798
799 2018-11-26  Tim Horton  <timothy_horton@apple.com>
800
801         Insert <attachment> elements under editable images to make their backing data accessible
802         https://bugs.webkit.org/show_bug.cgi?id=191844
803         <rdar://problem/30900149>
804
805         Reviewed by Simon Fraser.
806
807         * DerivedSources.make:
808         * SourcesCocoa.txt:
809         * UIProcess/API/APIAttachment.h:
810         fileWrapper() is no longer a trivial getter; it can now construct
811         the file wrapper from a file wrapper generator if necessary.
812
813         Add setFileWrapperGenerator() and invalidateGeneratedFileWrapper().
814
815         Make m_fileWrapper mutable so it can be adjusted inside its own getter.
816
817         * UIProcess/API/Cocoa/APIAttachmentCocoa.mm:
818         (API::Attachment::fileWrapper const):
819         If we have a fileWrapperGenerator and don't have a cached file wrapper,
820         create one before returning it.
821
822         (API::Attachment::invalidateGeneratedFileWrapper):
823         Invalidate the currently-cached file wrapper. The next time a client
824         requests the file wrapper it will be regenerated.
825
826         (API::Attachment::fileName const):
827         (API::Attachment::fileSizeForDisplay const):
828         (API::Attachment::enclosingImageData const):
829         (API::Attachment::isEmpty const):
830         (API::Attachment::createSerializedRepresentation const):
831         Make use of fileWrapper() instead of m_fileWrapper directly, to ensure
832         that it is created lazily if necessary.
833
834         (API::Attachment::setFileWrapperGenerator):
835         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
836         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
837         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.h:
838         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
839         (-[WKEmbeddedView initWithEmbeddedViewID:]):
840         Defer to EditableImageController for creating WKDrawingViews for
841         editable images. This is done primarily so we don't have to pollute
842         Remote Layer Tree and DrawingArea interfaces with editable-image-specific messages.
843
844         * UIProcess/WebPageProxy.cpp:
845         (WebKit::m_editableImageController):
846         (WebKit::m_resetRecentCrashCountTimer): Deleted.
847         * UIProcess/WebPageProxy.h:
848         (WebKit::WebPageProxy::editableImageController):
849         Keep an EditableImageController on the WebPageProxy.
850
851         * UIProcess/ios/EditableImageController.h: Added.
852         * UIProcess/ios/EditableImageController.messages.in: Added.
853         * UIProcess/ios/EditableImageController.mm: Added.
854         (WebKit::EditableImageController::EditableImageController):
855         (WebKit::EditableImageController::~EditableImageController):
856         (WebKit::EditableImageController::ensureEditableImage):
857         (WebKit::EditableImageController::editableImage):
858         (WebKit::EditableImageController::didCreateEditableImage):
859         (WebKit::EditableImageController::didDestroyEditableImage):
860         (WebKit::EditableImageController::associateWithAttachment):
861         (WebKit::EditableImageController::invalidateAttachmentForEditableImage):
862         Add EditableImageController, which keeps track of EditableImages.
863         It can be messaged directly to create or destroy the UI-side state
864         of an editable image, and also to associate a WKDrawingView with
865         a particular attachment.
866
867         * UIProcess/ios/WKDrawingView.h:
868         * UIProcess/ios/WKDrawingView.mm:
869         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
870         Store the WebPageProxy (weakly) so that we can get to the EditableImageController.
871
872         (-[WKDrawingView layoutSubviews]):
873         (-[WKDrawingView PNGRepresentation]):
874         Synchronously render the PKCanvasView to PNG.
875
876         (-[WKDrawingView drawingDidChange:]):
877         If the drawing changes, inform the APIAttachment that it needs
878         to discard its NSFileWrapper; a new one will be generated lazily.
879
880         (-[WKDrawingView init]): Deleted.
881         * WebKit.xcodeproj/project.pbxproj:
882         * WebProcess/WebCoreSupport/WebChromeClient.h:
883         * WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm:
884         (WebKit::WebChromeClient::associateEditableImageWithAttachment):
885         (WebKit::WebChromeClient::didCreateEditableImage):
886         (WebKit::WebChromeClient::didDestroyEditableImage):
887
888 2018-11-26  Jer Noble  <jer.noble@apple.com>
889
890         Adopt -setOverrideRouteSharingPolicy:routingContextUID: SPI
891         https://bugs.webkit.org/show_bug.cgi?id=190951
892         <rdar://problem/45213065>
893
894         Reviewed by Alex Christensen.
895
896         Add an asyncronous reply request to VideoFullscreenManager.
897
898         * Platform/IPC/MessageSender.h:
899         (IPC::MessageSender::sendWithAsyncReply):
900         * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
901         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
902         (WebKit::VideoFullscreenModelContext::requestRouteSharingPolicyAndContextUID):
903         * WebProcess/cocoa/VideoFullscreenManager.h:
904         * WebProcess/cocoa/VideoFullscreenManager.messages.in:
905         * WebProcess/cocoa/VideoFullscreenManager.mm:
906         (WebKit::VideoFullscreenManager::requestRouteSharingPolicyAndContextUID):
907
908 2018-11-26  Alex Christensen  <achristensen@webkit.org>
909
910         Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
911         https://bugs.webkit.org/show_bug.cgi?id=191981
912
913         Reviewed by Tim Horton.
914
915         * UIProcess/API/Cocoa/WKWebView.mm:
916         (-[WKWebView _safeBrowsingWarning]):
917         (-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
918         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
919
920 2018-11-26  Daniel Bates  <dabates@apple.com>
921
922         REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
923         https://bugs.webkit.org/show_bug.cgi?id=191967
924         <rdar://problem/45976390>
925
926         Reviewed by Tim Horton.
927
928         Fixes an issue where pressing Command + Down Arrow does not scroll the view to the end of the page.
929
930         Following r237738 the value of the enumerations used to identify modifier keys (e.g. Shift) changed
931         to match the values of the corresponding enumerations in GraphicsServices, which are the
932         enumerations UIKit uses to computes the modifier flags bitmask when instantiating a WebEvent to
933         pass to WebKit. Before r237738 WebKit was using enumerations whose values matched the values
934         of the corresponding UIKit public API UIKeyModifier* enumerations. For non-content editable elements,
935         WebKit intercepts UIKit events in -_handleKeyUIEvent, synthesizes and dispatches its own WebEvent.
936         However it was creating WebEvents with a modifier flags bitmask built from the UIKeyModifier* enumerations,
937         -_modifierFlags, as opposed to a bitmask from the GraphicsServices enumerations, -_gsModifierFlags.
938         Instead WebKit should call -_gsModifierFlags to compute the GraphicsServices-compatible modifier
939         flags bitmask when instantiating a WebEvent.
940
941         * Platform/spi/ios/UIKitSPI.h: Expose -_gsModifierFlags and remove -_modifierFlags.
942         * UIProcess/ios/WKContentViewInteraction.mm:
943         (-[WKContentView _handleKeyUIEvent:]): Remove unnecessary code to update the current modifier state.
944         This will be done by the WebProcess when it receives the keyboard event.
945         (-[WKContentView _didHandleKeyEvent:eventWasHandled:]): Do not pass modifier flags changed events
946         to the scrolling animator as it does not know how to handle these kinds of events and triggers an
947         assertion failure when it tries to read the input string from the event (calls -charactersIgnoringModifiers).
948         FlagsChanged WebEvents events do not have an input string just like a FlagsChanged NSEvent that
949         they model on Mac.
950         * UIProcess/ios/WKWebEvent.mm:
951         (-[WKWebEvent initWithEvent:]): Pass the value of -_gsModifierFlags for the modifier flags bitmask
952         instead of the value of -_modifierFlags.
953
954 2018-11-26  Chris Dumez  <cdumez@apple.com>
955
956         [PSON] process pre-warming should not be on for everyone
957         https://bugs.webkit.org/show_bug.cgi?id=191966
958         <rdar://problem/46138499>
959
960         Reviewed by Ryosuke Niwa.
961
962         If automatic process-prewarming is not explicitly turned on/off by the client, then we now only
963         turn it on automatically after the first process swap. Previously, it was always enabled if
964         process-swap on cross-site navigation was enabled (which is the case by default for all apps).
965
966         This is important because some apps do not actually browse (only display static content) or never
967         browse cross-site, and thus would not benefit from process prewarming and yet pay a memory cost.
968
969         * UIProcess/API/APIProcessPoolConfiguration.h:
970         Add m_clientWouldBenefitFromAutomaticProcessPrewarming flag which is false by default and is used
971         as a fallback if the client did not call setIsAutomaticProcessWarmingEnabled().
972
973         * UIProcess/API/C/WKContextConfigurationRef.cpp:
974         (WKContextConfigurationPrewarmsProcessesAutomatically):
975         (WKContextConfigurationSetPrewarmsProcessesAutomatically):
976         Add C API to toggle automatic process prewarming. It is needed for Safari to turn on this feature
977         by default for browsing. This way Safari does not have to wait for the first process swap to
978         start prewarming.
979
980         * UIProcess/API/C/WKContextConfigurationRef.h:
981         * UIProcess/WebProcessPool.cpp:
982         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
983         Only do automatic process prewarming if process-swap on cross-site navigation is also enabled.
984         This is needed for clients like Safari that explicitly enable automatic process prewarming but
985         only want to have it enabled if PSON is also enabled via experimental features.
986
987         (WebKit::WebProcessPool::processForNavigation):
988         On first process swap, if the client did not explicitly turn on or off automatic process prewarming
989         then we enable it then. This avoids paying the cost of process prewarming in apps that would not
990         benefit from it.
991
992 2018-11-26  Andy Estes  <aestes@apple.com>
993
994         [Cocoa] Make it easier to encode NSObjects
995         https://bugs.webkit.org/show_bug.cgi?id=191948
996
997         Reviewed by Dean Jackson.
998
999         It should be easier to encode objects that conform to NSSecureCoding for WebKit IPC. Right
1000         now, several argument coders duplicate the logic for encoding and decoding objects using
1001         NSKeyedArchiver and NSKeyedUnarchiver.
1002
1003         This patch adds encodeObject() and decodeObject() primitives for encoding and decoding using
1004         Foundation keyed archiving. It then partially specializes ArgumentCoder for raw pointers and
1005         RetainPtrs whose pointee conforms to NSSecureCoding to call these new primitives.
1006
1007         This allows us to use Encoder::operator<< to encode raw pointers or RetainPtrs and use
1008         Decoder::operator>> to decode to an optional RetainPtr. By default, IPC::decode infers the
1009         allowed class for decoding by calling `[T class]`. We can also specify the allowed classes
1010         explicitly for containers and classes that are loaded at runtime.
1011
1012         * Shared/Cocoa/ArgumentCodersCocoa.h: Added.
1013         * Shared/Cocoa/ArgumentCodersCocoa.mm: Added.
1014         * Shared/Cocoa/DataDetectionResult.mm:
1015         (WebKit::DataDetectionResult::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
1016         (WebKit::DataDetectionResult::decode): Ditto.
1017         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
1018         (IPC::ArgumentCoder<WebCore::Payment>::encode): Ditto.
1019         (IPC::ArgumentCoder<WebCore::Payment>::decode): Ditto.
1020         (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Ditto.
1021         (IPC::ArgumentCoder<WebCore::PaymentContact>::encode): Ditto.
1022         (IPC::ArgumentCoder<WebCore::PaymentContact>::decode): Ditto.
1023         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::encode): Ditto.
1024         (IPC::ArgumentCoder<WebCore::PaymentMerchantSession>::decode): Ditto.
1025         (IPC::ArgumentCoder<WebCore::PaymentMethod>::encode): Ditto.
1026         (IPC::ArgumentCoder<WebCore::PaymentMethod>::decode): Ditto.
1027         (IPC::ArgumentCoder<ApplePaySessionPaymentRequest>::decode): Ditto.
1028         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
1029         (WebKit::RemoteLayerTreeTransaction::description const): Added some needed namespaces due to unified source shuffling.
1030         * Shared/WebCoreArgumentCoders.h: Modernized several decoders.
1031         * Shared/ios/InteractionInformationAtPosition.mm:
1032         (WebKit::InteractionInformationAtPosition::encode const): Removed custom encoding code and used ArgumentCodersCocoa instead.
1033         (WebKit::InteractionInformationAtPosition::decode): Ditto.
1034         * Shared/mac/WebCoreArgumentCodersMac.mm:
1035         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::encodePlatformData): Ditto.
1036         (IPC::ArgumentCoder<WebCore::ProtectionSpace>::decodePlatformData): Ditto.
1037         (IPC::ArgumentCoder<WebCore::Credential>::encodePlatformData): Ditto.
1038         (IPC::ArgumentCoder<WebCore::Credential>::decodePlatformData): Ditto.
1039         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::encodePlatformData): Ditto.
1040         (IPC::ArgumentCoder<WebCore::MediaPlaybackTargetContext>::decodePlatformData): Ditto.
1041         (IPC::deviceContextKey): Deleted.
1042         * Shared/mac/WebHitTestResultData.mm:
1043         (WebKit::WebHitTestResultData::platformEncode const): Ditto.
1044         (WebKit::WebHitTestResultData::platformDecode): Ditto.
1045         * SourcesCocoa.txt: Added ArgumentCodersCocoa.mm.
1046         * WebKit.xcodeproj/project.pbxproj: Ditto.
1047
1048 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1049
1050         CompletionHandler-based async IPC messages only work when the completion handler takes a single argument
1051         https://bugs.webkit.org/show_bug.cgi?id=191965
1052
1053         Reviewed by Tim Horton.
1054
1055         Teach `messages.py` to handle the case where an async IPC completion handler takes no arguments, or takes more
1056         than a single argument. Currently, the generated code attempts to wrap all arguments in a `WTFMove(*~)`, but
1057         this either results in `WTFMove(*)` in the case where there are no arguments, or `WTFMove(*foo, *bar, *baz)` in
1058         the case where there are several arguments. Both of these results fail to compile.
1059
1060         Instead, emit `completionHandler()` when there are no arguments, and
1061         `completionHandler(WTFMove(*foo), WTFMove(*bar), WTFMove(*baz))` when there are multiple arguments.
1062
1063         Tests:  TestAsyncMessageWithNoArguments
1064                 TestAsyncMessageWithMultipleArguments
1065
1066         * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
1067         (Messages::WebPage::TestAsyncMessageWithNoArguments::callReply):
1068         (Messages::WebPage::TestAsyncMessageWithNoArguments::cancelReply):
1069         (Messages::WebPage::TestAsyncMessageWithNoArguments::send):
1070         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::callReply):
1071         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::cancelReply):
1072         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::send):
1073         (WebKit::WebPage::didReceiveMessage):
1074         * Scripts/webkit/MessagesSuperclass-expected.h:
1075         (Messages::WebPage::TestAsyncMessageWithNoArguments::receiverName):
1076         (Messages::WebPage::TestAsyncMessageWithNoArguments::name):
1077         (Messages::WebPage::TestAsyncMessageWithNoArguments::asyncMessageReplyName):
1078         (Messages::WebPage::TestAsyncMessageWithNoArguments::arguments const):
1079         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::receiverName):
1080         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::name):
1081         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::asyncMessageReplyName):
1082         (Messages::WebPage::TestAsyncMessageWithMultipleArguments::arguments const):
1083         * Scripts/webkit/messages.py:
1084         * Scripts/webkit/messages_unittest.py:
1085
1086         Add new `messages.py` unit tests to cover these cases.
1087
1088         * Scripts/webkit/test-superclass-messages.in:
1089
1090 2018-11-26  Jeremy Jones  <jeremyj@apple.com>
1091
1092         Use Full Screen consistently in localizable strings.
1093         https://bugs.webkit.org/show_bug.cgi?id=190363
1094         rdar://problem/43882333
1095
1096         Reviewed by Jon Lee.
1097
1098         Rename "Fullscreen" to "Full Screen" in localizable strings for consistency.
1099
1100         * UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
1101         (-[WKFullScreenViewController _showPhishingAlert]):
1102
1103 2018-11-26  Daniel Bates  <dabates@apple.com>
1104
1105         Wire up ChromeClient::takeFocus() on iOS
1106         https://bugs.webkit.org/show_bug.cgi?id=191763
1107         <rdar://problem/18584508>
1108
1109         Reviewed by Dan Bernstein.
1110
1111         Expose existing Mac SPI for use on iOS. This will allow Safari to be notified when
1112         the engine has cycled through all the tab focusable elements on the page.
1113
1114         * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
1115         * UIProcess/Cocoa/UIDelegate.h:
1116         * UIProcess/Cocoa/UIDelegate.mm:
1117         (WebKit::UIDelegate::setDelegate):
1118
1119 2018-11-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1120
1121         Unreviewed, fix the internal 32-bit macOS 10.13 build after r238471
1122
1123         r238471 added an `#include WebPageMessages.h` in `WebPage.h`, which causes the 32-bit macOS build using an
1124         internal macOS SDK ≤ 10.13 to fail. To address this, move the `#include` back under `PLATFORM(IOS_FAMILY)` by
1125         changing the parameters of `WebPage::removeDataDetectedLinks` and `WebPage::detectDataInAllFrames` to completion
1126         handlers rather than async IPC replies.
1127
1128         * WebProcess/WebPage/WebPage.cpp:
1129         (WebKit::WebPage::removeDataDetectedLinks):
1130         (WebKit::WebPage::detectDataInAllFrames):
1131         * WebProcess/WebPage/WebPage.h:
1132
1133 2018-11-26  Antti Koivisto  <antti@apple.com>
1134
1135         Clean up layer tree freezing logic in WebPage
1136         https://bugs.webkit.org/show_bug.cgi?id=191826
1137
1138         Reviewed by Dean Jackson.
1139
1140         Use OptionSet<LayerTreeFreezeReason> to track various reasons that can cause layer tree to get frozen.
1141
1142         * WebProcess/WebPage/WebPage.cpp:
1143         (WebKit::WebPage::reinitializeWebPage):
1144         (WebKit::WebPage::freezeLayerTree):
1145         (WebKit::WebPage::unfreezeLayerTree):
1146         (WebKit::WebPage::updateDrawingAreaLayerTreeFreezeState):
1147
1148         Layer tree is unfrozen when there there are no reasons to freeze it.
1149
1150         (WebKit::WebPage::didStartPageTransition):
1151         (WebKit::WebPage::didCompletePageTransition):
1152         (WebKit::WebPage::beginPrinting):
1153         (WebKit::WebPage::endPrinting):
1154         (WebKit::WebPage::setIsSuspended):
1155         (WebKit::WebPage::setLayerTreeStateIsFrozen): Deleted.
1156         * WebProcess/WebPage/WebPage.h:
1157         * WebProcess/WebPage/ios/WebPageIOS.mm:
1158         (WebKit::WebPage::applicationDidEnterBackground):
1159         (WebKit::WebPage::applicationWillEnterForeground):
1160         * WebProcess/WebProcess.cpp:
1161         (WebKit::WebProcess::actualPrepareToSuspend):
1162         (WebKit::WebProcess::cancelPrepareToSuspend):
1163         (WebKit::WebProcess::freezeAllLayerTrees):
1164         (WebKit::WebProcess::unfreezeAllLayerTrees):
1165         (WebKit::WebProcess::processDidResume):
1166         (WebKit::WebProcess::setAllLayerTreeStatesFrozen): Deleted.
1167         * WebProcess/WebProcess.h:
1168
1169 2018-11-25  Antti Koivisto  <antti@apple.com>
1170
1171         RemoteLayerTreeNode construction cleanups
1172         https://bugs.webkit.org/show_bug.cgi?id=191951
1173
1174         Reviewed by Tim Horton.
1175
1176         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1177         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1178         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1179
1180             Drop unused LayerProperties argument.
1181
1182         (WebKit::RemoteLayerTreeHost::createLayer):
1183
1184             Split the actual construction out to makeNode.
1185             Map updating is shared between platforms.
1186             Move setting of layerID and clearing default actions to RemoteLayerTreeNode.
1187
1188         (WebKit::RemoteLayerTreeHost::makeNode):
1189
1190             Returns RemoteLayerTreeNode.
1191
1192         (WebKit::RemoteLayerTreeHost::setLayerID): Deleted.
1193         (WebKit::RemoteLayerTreeHost::layerID): Deleted.
1194
1195             Move to RemoteLayerTreeNode.
1196
1197         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
1198         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
1199         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
1200         (WebKit::RemoteLayerTreeNode::setLayerID):
1201         (WebKit::RemoteLayerTreeNode::layerID):
1202         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1203         (WebKit::RemoteLayerTreeHost::makeNode):
1204         (WebKit::RemoteLayerTreeHost::createEmbeddedView):
1205         (WebKit::RemoteLayerTreeHost::createLayer): Deleted.
1206         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
1207         (-[WKCompositingView description]):
1208         (-[WKUIRemoteView description]):
1209         (-[WKBackdropView description]):
1210         * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
1211         (WebKit::addAnimationToLayer):
1212
1213 2018-11-25  Tim Horton  <timothy_horton@apple.com>
1214
1215         Make it possible to insert editable images with a gesture
1216         https://bugs.webkit.org/show_bug.cgi?id=191937
1217
1218         Reviewed by Wenson Hsieh.
1219
1220         * UIProcess/API/Cocoa/WKWebView.mm:
1221         (-[WKWebView _stylusTapGestureShouldCreateEditableImage]):
1222         * UIProcess/API/Cocoa/WKWebViewInternal.h:
1223         Add a internal getter for a WKWebViewConfiguration property.
1224
1225         * UIProcess/WebEditCommandProxy.cpp:
1226         (WebKit::WebEditCommandProxy::nameForEditAction):
1227         Add a undo name.
1228
1229         * UIProcess/WebPageProxy.h:
1230         * UIProcess/ios/WKContentViewInteraction.h:
1231         * UIProcess/ios/WKContentViewInteraction.mm:
1232         (-[WKContentView setupInteraction]):
1233         (-[WKContentView cleanupInteraction]):
1234         (-[WKContentView _removeDefaultGestureRecognizers]):
1235         (-[WKContentView _addDefaultGestureRecognizers]):
1236         Add a single-stylus-tap gesture recognizer.
1237
1238         (-[WKContentView _stylusSingleTapRecognized:]):
1239         If allowed, request to insert an editable image when a stylus tap occurs.
1240
1241         * UIProcess/ios/WebPageProxyIOS.mm:
1242         (WebKit::WebPageProxy::handleStylusSingleTapAtPoint):
1243         * WebProcess/WebPage/WebPage.h:
1244         * WebProcess/WebPage/WebPage.messages.in:
1245         * WebProcess/WebPage/ios/WebPageIOS.mm:
1246         (WebKit::WebPage::handleStylusSingleTapAtPoint):
1247         Do a hit test, select the hit position, insert an editable image, and
1248         then de-assist any assisted node (to make the keyboard go away).
1249         For now, we'll only insert if we hit non-replaced elements,
1250         though this heuristic will need to be enhanced significantly once we
1251         decide on a design.
1252
1253 2018-11-25  Tim Horton  <timothy_horton@apple.com>
1254
1255         Scrolling and drawing compete for incoming gestures
1256         https://bugs.webkit.org/show_bug.cgi?id=191940
1257
1258         Reviewed by Wenson Hsieh.
1259
1260         * Platform/spi/ios/PencilKitSPI.h:
1261         * UIProcess/API/Cocoa/WKWebView.mm:
1262         (-[WKWebView _initializeWithConfiguration:]):
1263         * UIProcess/ios/WKDrawingView.mm:
1264         (-[WKDrawingView initWithEmbeddedViewID:webPageProxy:]):
1265         Make scrolling and drawing mutually exclusive if editable images
1266         are enabled.
1267
1268 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1269
1270         [Cocoa] Fix a few localizable string descriptions in WebEditCommandProxy.cpp and WebEditorClient.mm
1271         https://bugs.webkit.org/show_bug.cgi?id=191945
1272
1273         Reviewed by Anders Carlsson.
1274
1275         Replace some a couple of command undo action name descriptions with "Undo action name", to match all other
1276         edit commands.
1277
1278         * UIProcess/WebEditCommandProxy.cpp:
1279         (WebKit::WebEditCommandProxy::nameForEditAction):
1280
1281 2018-11-24  Wenson Hsieh  <wenson_hsieh@apple.com>
1282
1283         [Cocoa] Add WKWebView SPI to trigger and remove data detection
1284         https://bugs.webkit.org/show_bug.cgi?id=191918
1285         <rdar://problem/36185051>
1286
1287         Reviewed by Tim Horton.
1288
1289         Adds support for two new WKWebView SPI methods, `-_detectDataWithTypes:completionHandler:` and
1290         `-_removeAllDataDetectedLinks:`, to allow internal WebKit clients to run data detection and add links to data
1291         detected content, or remove all data detected links from the document.
1292
1293         Test: WebKit.AddAndRemoveDataDetectors
1294
1295         * Shared/Cocoa/DataDetectionResult.h:
1296         * Shared/Cocoa/DataDetectionResult.mm:
1297         (WebKit::DataDetectionResult::decode):
1298
1299         Modernize DataDetectionResult's IPC decoding, so that it can be used with reply-based async IPC.
1300
1301         * UIProcess/API/Cocoa/WKWebView.mm:
1302         (-[WKWebView _removeDataDetectedLinks:]):
1303         (-[WKWebView _detectDataWithTypes:completionHandler:]):
1304         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1305         * UIProcess/WebPageProxy.cpp:
1306         (WebKit::WebPageProxy::detectDataInAllFrames):
1307         (WebKit::WebPageProxy::removeDataDetectedLinks):
1308
1309         Add or remove data detected links from each frame in the page, and then propagate the new data detector
1310         results of the main frame to the UI process (this matches current behavior, where the results of -[WKWebView
1311         _dataDetectionResults] only reflects data detection results in the main frame of the page).
1312
1313         * UIProcess/WebPageProxy.h:
1314         * WebProcess/WebPage/WebPage.cpp:
1315         (WebKit::WebPage::removeDataDetectedLinks):
1316         (WebKit::WebPage::detectDataInAllFrames):
1317         * WebProcess/WebPage/WebPage.h:
1318         * WebProcess/WebPage/WebPage.messages.in:
1319
1320 2018-11-24  Andy Estes  <aestes@apple.com>
1321
1322         [Cocoa] SOFT_LINK_CLASS_FOR_{HEADER,SOURCE} should generate a more concise getter function
1323         https://bugs.webkit.org/show_bug.cgi?id=191899
1324
1325         Reviewed by Dean Jackson.
1326
1327         * Shared/cocoa/WebCoreArgumentCodersCocoa.mm:
1328         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
1329         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
1330
1331 2018-11-23  Antti Koivisto  <antti@apple.com>
1332
1333         Replace LayerOrView typedef with a class
1334         https://bugs.webkit.org/show_bug.cgi?id=191927
1335
1336         Reviewed by Tim Horton.
1337
1338         This typedef restricts remote layer representation to be either a CA layer or a view. We might want
1339         have more flexibility, for example tiles don't really need to be UIViews. It will also make it easier
1340         to unify Mac and iOS code, and hopefully make it less confusing too.
1341
1342         This patch introduces RemoteLayerTreeNode class that replaces most uses of LayerOrView typedef
1343         (the rest are converted to pure CALayer). It also does a bunch of related cleanup.
1344
1345         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
1346         * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
1347         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
1348         (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
1349         (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToUIView):
1350         (WebKit::applyPropertiesToLayer): Deleted.
1351         * SourcesCocoa.txt:
1352         * UIProcess/API/Cocoa/WKWebView.mm:
1353         (-[WKWebView _propertiesOfLayerWithID:]):
1354         * UIProcess/Cocoa/LayerRepresentation.h: Removed.
1355         * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
1356         (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID):
1357         * UIProcess/PageClient.h:
1358         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
1359         * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
1360         (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
1361         (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
1362         (WebKit::RemoteLayerTreeDrawingAreaProxy::layerWithIDForTesting const):
1363         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
1364         (WebKit::RemoteLayerTreeHost::rootNode const):
1365         (WebKit::RemoteLayerTreeHost::rootLayer const): Deleted.
1366         * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
1367         (WebKit::RemoteLayerTreeHost::updateLayerTree):
1368         (WebKit::RemoteLayerTreeHost::nodeForID const):
1369         (WebKit::RemoteLayerTreeHost::layerWillBeRemoved):
1370         (WebKit::RemoteLayerTreeHost::animationDidStart):
1371         (WebKit::RemoteLayerTreeHost::animationDidEnd):
1372         (WebKit::RemoteLayerTreeHost::clearLayers):
1373         (WebKit::RemoteLayerTreeHost::layerWithIDForTesting const):
1374         (WebKit::RemoteLayerTreeHost::layerForID const):
1375         (WebKit::RemoteLayerTreeHost::rootLayer const):
1376         (WebKit::RemoteLayerTreeHost::createLayer):
1377         (WebKit::RemoteLayerTreeHost::detachRootLayer):
1378         (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore):
1379         (WebKit::RemoteLayerTreeHost::getLayer const): Deleted.
1380         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h: Added.
1381         (WebKit::RemoteLayerTreeNode::layer const):
1382         (WebKit::RemoteLayerTreeNode::uiView const):
1383         * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm: Added.
1384         (WebKit::RemoteLayerTreeNode::RemoteLayerTreeNode):
1385         (WebKit::RemoteLayerTreeNode::detachFromParent):
1386         * UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm:
1387         (WebKit::RemoteLayerTreeScrollingPerformanceData::blankPixelCount const):
1388         * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
1389         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1390         * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
1391         (WebKit::RemoteLayerTreeHost::createLayer):
1392         * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
1393         (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
1394         (WebKit::layerRepresentationFromLayerOrView): Deleted.
1395         * UIProcess/WebAuthentication/Cocoa/HidService.h:
1396         * UIProcess/WebAuthentication/Cocoa/HidService.mm:
1397         * UIProcess/WebPageProxy.h:
1398         * UIProcess/ios/LayerRepresentation.mm: Removed.
1399         * UIProcess/ios/PageClientImplIOS.h:
1400         * UIProcess/ios/PageClientImplIOS.mm:
1401         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1402         (WebKit::PageClientImpl::acceleratedCompositingRootLayer const):
1403         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1404         * UIProcess/ios/WebPageProxyIOS.mm:
1405         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1406         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1407         * UIProcess/mac/PageClientImplMac.h:
1408         * UIProcess/mac/PageClientImplMac.mm:
1409         (WebKit::PageClientImpl::setRemoteLayerTreeRootNode):
1410         (WebKit::PageClientImpl::setAcceleratedCompositingRootLayer): Deleted.
1411         * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
1412         (WebKit::TiledCoreAnimationDrawingAreaProxy::createFence):
1413         * UIProcess/mac/WebPageProxyMac.mm:
1414         (WebKit::WebPageProxy::setRemoteLayerTreeRootNode):
1415         (WebKit::WebPageProxy::acceleratedCompositingRootLayer const):
1416         (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer): Deleted.
1417         * WebKit.xcodeproj/project.pbxproj:
1418         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
1419         (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
1420
1421 2018-11-23  Jiewen Tan  <jiewen_tan@apple.com>
1422
1423         [WebAuthN] Enable Web Authentication as an experimental feature for macOS
1424         https://bugs.webkit.org/show_bug.cgi?id=191932
1425         rdar://problem/46225210
1426
1427         Reviewed by Brent Fulgham.
1428
1429         * Shared/WebPreferences.yaml:
1430
1431 2018-11-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1432
1433         Enable drag and drop support for iOSMac
1434         https://bugs.webkit.org/show_bug.cgi?id=191818
1435         <rdar://problem/43907454>
1436
1437         Reviewed by Dean Jackson.
1438
1439         * Configurations/FeatureDefines.xcconfig:
1440         * Shared/WebPreferencesDefaultValues.cpp:
1441         (defaultCustomPasteboardDataEnabled):
1442
1443         Enable custom pasteboard data by default on iOSMac. While writing and reading custom pasteboard data is
1444         currently broken in iOSMac due to the lack of `teamData` and `preferredPresentationStyle`, opting into custom
1445         pasteboard data at least allows us to avoid writing unsanitized data types to the pasteboard.
1446
1447         * WebProcess/WebPage/ios/WebPageIOS.mm:
1448         (WebKit::WebPage::platformEditorState const):
1449
1450         Fix a regression from <https://trac.webkit.org/r236619> wherein the web process crashes when attempting to edit
1451         a text field. This happens because the call to `-[UIKeyboard isInHardwareKeyboardMode]` on the iOSMac platform
1452         attempts to initialize a `UHASWorkspace` from the web process, which then attempts to connect to the UIKit host
1453         application. Instead, we can skip this call altogether on iOSMac, where the platform never considers a hardware
1454         keyboard to be "connected", even when typing.
1455
1456 2018-11-23  Antti Koivisto  <antti@apple.com>
1457
1458         UI side compositing doesn't paint on Mac
1459         https://bugs.webkit.org/show_bug.cgi?id=191908
1460
1461         Reviewed by Tim Horton.
1462
1463         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
1464         (WebKit::RemoteLayerBackingStore::bytesPerPixel const):
1465         (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const):
1466
1467         These deep color formats are not supported on Mac.
1468
1469 2018-11-22  Chris Dumez  <cdumez@apple.com>
1470
1471         Regression(r238353) Load sometimes hangs when navigating back after a cross-site navigation
1472         https://bugs.webkit.org/show_bug.cgi?id=191914
1473
1474         Reviewed by Ryosuke Niwa.
1475
1476         When process-swapping on a cross-site server-side redirect, we end up doing a decidePolicyForNavigationResponse
1477         policy check for the about:blank suspension load. This policy decision is ignored by the UIProcess because
1478         SuspendedPageProxy does not handle this particular IPC message. To handle the issue, make sure the WebProcess
1479         never sends a DecidePolicyForNavigationResponse IPC to the UIProcess for about:blank suspension loads and let
1480         the load proceed.
1481
1482         The issue was already there before r238353 but it was made obvious by r238353 which caused a hang when trying
1483         to reuse a Suspended page which is hanging while trying to suspend.
1484
1485         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
1486         (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForResponse):
1487
1488 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1489
1490         [Cocoa] clang emits a warning when building WebKit after r238293
1491         https://bugs.webkit.org/show_bug.cgi?id=191917
1492
1493         Reviewed by Dan Bernstein.
1494
1495         Move the implementations of -setSafeBrowsingEnabled: and -isSafeBrowsingEnabled to the main implementation of
1496         WKPreferences to fix the warning.
1497
1498         * UIProcess/API/Cocoa/WKPreferences.mm:
1499         (-[WKPreferences setSafeBrowsingEnabled:]):
1500         (-[WKPreferences isSafeBrowsingEnabled]):
1501
1502 2018-11-22  Wenson Hsieh  <wenson_hsieh@apple.com>
1503
1504         Address post-review feedback after r238438
1505         https://bugs.webkit.org/show_bug.cgi?id=191913
1506
1507         Reviewed by Ryosuke Niwa.
1508
1509         Replace boolean arguments to setSelectedRange, replaceSelectionWithText and replaceSelectionWithFragment with
1510         enum flags, and tweak a couple of functions to take `const Vector&` instead of `Vector&&`.
1511
1512         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1513         (WKBundlePageReplaceStringMatches):
1514         * WebProcess/WebPage/FindController.cpp:
1515         (WebKit::FindController::replaceMatches):
1516         * WebProcess/WebPage/FindController.h:
1517         * WebProcess/WebPage/WebPage.cpp:
1518         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1519         (WebKit::WebPage::replaceMatches):
1520         (WebKit::WebPage::replaceSelectionWithText):
1521         * WebProcess/WebPage/WebPage.h:
1522         * WebProcess/WebPage/ios/WebPageIOS.mm:
1523         (WebKit::WebPage::selectWithGesture):
1524         (WebKit::WebPage::updateSelectionWithTouches):
1525         (WebKit::WebPage::selectWithTwoTouches):
1526         (WebKit::WebPage::extendSelection):
1527         (WebKit::WebPage::selectWordBackward):
1528         (WebKit::WebPage::moveSelectionByOffset):
1529         (WebKit::WebPage::selectPositionAtPoint):
1530         (WebKit::WebPage::selectPositionAtBoundaryWithDirection):
1531         (WebKit::WebPage::moveSelectionAtBoundaryWithDirection):
1532         (WebKit::WebPage::selectTextWithGranularityAtPoint):
1533         (WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
1534         (WebKit::WebPage::updateSelectionWithExtentPoint):
1535         (WebKit::WebPage::replaceSelectedText):
1536         (WebKit::WebPage::replaceDictatedText):
1537         (WebKit::WebPage::syncApplyAutocorrection):
1538
1539 2018-11-22  Mark Lam  <mark.lam@apple.com>
1540
1541         Rollout r238432: Breaks internal Mac builds.
1542         https://bugs.webkit.org/show_bug.cgi?id=191909
1543         <rdar://problem/46214163>
1544
1545         Unreviewed. Rolling out r238432: Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1546
1547         * Sources.txt:
1548         * WebKit.xcodeproj/project.pbxproj:
1549
1550 2018-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
1551
1552         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.1 release.
1553
1554         * gtk/NEWS: Add release notes for 2.23.1.
1555
1556 2018-11-21  Wenson Hsieh  <wenson_hsieh@apple.com>
1557
1558         [Cocoa] [WebKit2] Add support for replacing find-in-page text matches
1559         https://bugs.webkit.org/show_bug.cgi?id=191786
1560         <rdar://problem/45813871>
1561
1562         Reviewed by Ryosuke Niwa.
1563
1564         * UIProcess/API/Cocoa/WKWebView.mm:
1565         (-[WKWebView replaceMatches:withString:inSelectionOnly:resultCollector:]):
1566         * UIProcess/WebPageProxy.cpp:
1567         (WebKit::WebPageProxy::replaceMatches):
1568         * UIProcess/WebPageProxy.h:
1569         * UIProcess/mac/WKTextFinderClient.mm:
1570         (-[WKTextFinderClient replaceMatches:withString:inSelectionOnly:resultCollector:]):
1571
1572         Implement this method to opt in to "Replace…" UI on macOS in the find bar. In this API, we're given a list of
1573         matches to replace. We propagate the indices of each match to the web process, where FindController maps them to
1574         corresponding replacement ranges. Currently, the given list of matches is only ever a list containing the first
1575         match, or a list containing all matches.
1576
1577         * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
1578         (WKBundlePageFindStringMatches):
1579         (WKBundlePageReplaceStringMatches):
1580         * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
1581         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1582         * WebProcess/WebPage/FindController.cpp:
1583         (WebKit::FindController::replaceMatches):
1584
1585         Map match indices to Ranges, and then call into WebCore::Page to do the heavy lifting (see WebCore ChangeLog for
1586         more details). Additionally add a hard find-and-replace limit here to prevent the web process from spinning
1587         indefinitely if there are an enormous number of find matches.
1588
1589         * WebProcess/WebPage/FindController.h:
1590         * WebProcess/WebPage/WebPage.cpp:
1591         (WebKit::WebPage::findStringMatchesFromInjectedBundle):
1592         (WebKit::WebPage::replaceStringMatchesFromInjectedBundle):
1593
1594         Add helpers to exercise find and replace in WebKit2.
1595
1596         (WebKit::WebPage::replaceMatches):
1597         * WebProcess/WebPage/WebPage.h:
1598         * WebProcess/WebPage/WebPage.messages.in:
1599
1600 2018-11-21  Andy Estes  <aestes@apple.com>
1601
1602         [Cocoa] Create a soft-linking file for PassKit
1603         https://bugs.webkit.org/show_bug.cgi?id=191875
1604         <rdar://problem/46203215>
1605
1606         Reviewed by Myles Maxfield.
1607
1608         * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1609         * SourcesCocoa.txt: Removed @no-unify from WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm.
1610         * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: Removed SOFT_LINK macros and included PassKitSoftLink.h instead.
1611         * UIProcess/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: Ditto.
1612         * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: Ditto.
1613         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Included NSAttributedStringSPI.h.
1614         * UIProcess/mac/WebProcessProxyMac.mm: Included ProcessPrivilege.h.
1615         * WebKit.xcodeproj/project.pbxproj: Removed WebPaymentCoordinatorProxyIOS.mm and WebPaymentCoordinatorProxyMac.mm from the WebKit target.
1616
1617 2018-11-21  Fujii Hironori  <Hironori.Fujii@sony.com>
1618
1619         Remove @no-unify of InjectedBundleRangeHandle.cpp and InjectedBundleNodeHandle.cpp
1620         https://bugs.webkit.org/show_bug.cgi?id=191853
1621
1622         Reviewed by Michael Catanzaro.
1623
1624         In r235845, I excluded InjectedBundleRangeHandle.cpp and
1625         InjectedBundleNodeHandle.cpp from unify source builds in order to
1626         work around a MSVC bug.
1627
1628         Then, I commited a different workaround for the MSVC bug in
1629         r238386. Now, we can include InjectedBundleRangeHandle.cpp and
1630         InjectedBundleNodeHandle.cpp in unified source builds. Revert
1631         r235845.
1632
1633         * Sources.txt: Removed @no-unify of InjectedBundleRangeHandle.cpp
1634         and InjectedBundleNodeHandle.cpp
1635         * WebKit.xcodeproj/project.pbxproj: Unchecked Target Membership
1636         not to be compiled by XCode.
1637
1638 2018-11-20  Jeff Miller  <jeffm@apple.com>
1639
1640         Return nullptr immediately if the key doesn't exist in the HashMap.
1641         https://bugs.webkit.org/show_bug.cgi?id=191841
1642
1643         Reviewed by Chris Dumez.
1644
1645         * Shared/API/APIDictionary.h:
1646
1647 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1648
1649         WebPasteboard should USE(LIBWPE)
1650         https://bugs.webkit.org/show_bug.cgi?id=191846
1651
1652         Reviewed by Michael Catanzaro.
1653
1654         Add USE(LIBWPE) for Pasteboard related functionality within WebKit.
1655
1656         * UIProcess/WebPasteboardProxy.h:
1657         * UIProcess/WebPasteboardProxy.messages.in:
1658         * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
1659         * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
1660
1661 2018-11-20  Don Olmstead  <don.olmstead@sony.com>
1662
1663         [WPE] Fix some feature guards in WebKit
1664         https://bugs.webkit.org/show_bug.cgi?id=191847
1665
1666         Reviewed by Michael Catanzaro.
1667
1668         Some feature guards are not present in these files.
1669
1670         * UIProcess/API/wpe/PageClientImpl.cpp:
1671         * UIProcess/API/wpe/PageClientImpl.h:
1672         * UIProcess/wpe/WebProcessPoolWPE.cpp:
1673         (WebKit::WebProcessPool::platformInitializeWebProcess):
1674
1675 2018-11-20  Antti Koivisto  <antti@apple.com>
1676
1677         Avoid potential longer than expected layer flush delays
1678         https://bugs.webkit.org/show_bug.cgi?id=191833
1679
1680         Reviewed by Dean Jackson.
1681
1682         Layer flush throttling also stops style recalcs and layouts. Layouts schedule layer flushes. Especially
1683         on a slow network we can in principle end up in situation where layer flush timer fires but there is no
1684         flush scheduled and so nothing happens. However there is a pending style recalc or layout that would
1685         actually schedule a flush (in practice various things force style recalcs and this doesn't occur
1686         commonly).
1687
1688         To avoid this we should flush unconditionally when the flush timer fires. This performs any pending
1689         style recalc and layout too. If there is nothing to do the flush will be cheap.
1690
1691         PLT doesn't appear to hit cases affected by this patch and there shouldn't be any impact.
1692
1693         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
1694
1695         Remove now unnecessary m_hasPendingFlush bit, simplifying the logic.
1696
1697         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
1698         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
1699
1700         Schedule unconditionally when unfreezing.
1701
1702         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
1703
1704         Remove branch that starts the flush timer. It is not needed as either it was already running
1705         or immediate flush is already scheduled and will start the timer anyway.
1706
1707         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
1708         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
1709         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
1710
1711         Flush unconditionally.
1712
1713 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1714
1715         Simplify platform check in WebEditorClient
1716         https://bugs.webkit.org/show_bug.cgi?id=191848
1717
1718         Reviewed by Fujii Hironori.
1719
1720         !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WPE) can be better
1721         represented as PLATFORM(WIN).
1722
1723         * WebProcess/WebCoreSupport/WebEditorClient.cpp:
1724
1725 2018-11-19  Alex Christensen  <achristensen@webkit.org>
1726
1727         Add SPI to disable JIT in a WKWebView
1728         https://bugs.webkit.org/show_bug.cgi?id=191822
1729         <rdar://problem/28119360>
1730
1731         Reviewed by Geoffrey Garen.
1732
1733         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
1734         (WebKit::XPCServiceInitializer):
1735         * UIProcess/API/APIProcessPoolConfiguration.h:
1736         * UIProcess/API/Cocoa/WKWebView.mm:
1737         (-[WKWebView _canUseJIT:]):
1738         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
1739         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
1740         * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
1741         (-[_WKProcessPoolConfiguration enableJIT]):
1742         (-[_WKProcessPoolConfiguration setEnableJIT:]):
1743         * UIProcess/Launcher/ProcessLauncher.h:
1744         (WebKit::ProcessLauncher::Client::enableJIT const):
1745         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
1746         (WebKit::ProcessLauncher::launchProcess):
1747         * UIProcess/WebPageProxy.cpp:
1748         (WebKit::WebPageProxy::canUseJIT):
1749         * UIProcess/WebPageProxy.h:
1750         * UIProcess/WebProcessProxy.cpp:
1751         (WebKit::WebProcessProxy::enableJIT const):
1752         * UIProcess/WebProcessProxy.h:
1753         (WebKit::WebProcessProxy::processPool const):
1754         (WebKit::WebProcessProxy::processPool): Deleted.
1755         * WebProcess/WebProcess.cpp:
1756         (WebKit::WebProcess::canUseJIT):
1757         * WebProcess/WebProcess.h:
1758         * WebProcess/WebProcess.messages.in:
1759
1760 2018-11-19  Basuke Suzuki  <basuke.suzuki@sony.com>
1761
1762         [Curl] Add API for CertificateInfo.
1763         https://bugs.webkit.org/show_bug.cgi?id=191647
1764
1765         Reviewed by Alex Christensen.
1766
1767         Added API for CertificateInfo to create, fetch contents.
1768
1769         Tests: TestWebKitAPI/Tests/WebKit/curl/Certificates.cpp
1770
1771         * PlatformWin.cmake:
1772         * Shared/API/c/curl/WKCertificateInfoCurl.cpp: Added.
1773         (WKCertificateInfoCreateWithCertficateChain):
1774         (WKCertificateInfoGetVerificationError):
1775         (WKCertificateInfoGetCertificateChainSize):
1776         (WKCertificateInfoCopyCertificateAtIndex):
1777         * Shared/API/c/curl/WKCertificateInfoCurl.h: Copied from Source/WebCore/platform/network/curl/CertificateInfoCurl.cpp.
1778         * Shared/curl/WebCoreArgumentCodersCurl.cpp:
1779         (IPC::ArgumentCoder<CertificateInfo>::encode):
1780         (IPC::ArgumentCoder<CertificateInfo>::decode):
1781
1782 2018-11-19  Don Olmstead  <don.olmstead@sony.com>
1783
1784         Add USE(LIBWPE) for WebKit events
1785         https://bugs.webkit.org/show_bug.cgi?id=191842
1786
1787         Reviewed by Michael Catanzaro.
1788
1789         Moves all WPE events to USE(LIBWPE) instead of PLATFORM(WPE). Updates
1790         filenames to LibWPE.
1791
1792         * PlatformWPE.cmake:
1793         * Shared/NativeWebKeyboardEvent.h:
1794         * Shared/NativeWebMouseEvent.h:
1795         * Shared/NativeWebTouchEvent.h:
1796         * Shared/NativeWebWheelEvent.h:
1797         * Shared/WebCoreArgumentCoders.cpp:
1798         * Shared/WebCoreArgumentCoders.h:
1799         * Shared/WebEvent.h:
1800         * Shared/WebKeyboardEvent.cpp:
1801         (WebKit::WebKeyboardEvent::WebKeyboardEvent):
1802         * Shared/libwpe/NativeWebKeyboardEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebKeyboardEventWPE.cpp.
1803         * Shared/libwpe/NativeWebMouseEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebMouseEventWPE.cpp.
1804         * Shared/libwpe/NativeWebTouchEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebTouchEventWPE.cpp.
1805         * Shared/libwpe/NativeWebWheelEventLibWPE.cpp: Renamed from Source/WebKit/Shared/wpe/NativeWebWheelEventWPE.cpp.
1806         * Shared/libwpe/WebEventFactory.cpp: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.cpp.
1807         * Shared/libwpe/WebEventFactory.h: Renamed from Source/WebKit/Shared/wpe/WebEventFactory.h.
1808         * SourcesWPE.txt:
1809
1810 2018-11-19  David Quesada  <david_quesada@apple.com>
1811
1812         EXC_BAD_ACCESS when invoking a DownloadProxy's destination decision handler after the download has been canceled
1813         https://bugs.webkit.org/show_bug.cgi?id=191762
1814         rdar://problem/46151509
1815
1816         Reviewed by Dean Jackson.
1817
1818         When the DownloadClient calls the decision handler with a destination path, check if
1819         m_processPool is null before trying to access its network process. This can happen
1820         if a download is canceled before the client decides its destination.
1821
1822         * UIProcess/Downloads/DownloadProxy.cpp:
1823         (WebKit::DownloadProxy::decideDestinationWithSuggestedFilenameAsync):
1824
1825 2018-11-19  Tomoki Imai  <Tomoki.Imai@sony.com>
1826
1827         [cairo] BackingStore::incorporateUpdate should use CompositeCopy to support drawsBackground=false in general Cairo ports
1828         https://bugs.webkit.org/show_bug.cgi?id=191577
1829
1830         Reviewed by Carlos Garcia Campos.
1831
1832         We should use CompositeCopy operator to update bitmap to overwrite existing bitmap even if source contains
1833         transparent parts. It enables ports which uses Cairo to set drawsBackground to false.
1834         GTK ports has custom background extension, and in such case, we need to use CompositeSourceOver to retain
1835         custom background.
1836
1837         * UIProcess/cairo/BackingStoreCairo.cpp:
1838         (WebKit::BackingStore::incorporateUpdate): Use CompositeCopy operator to update bitmap.
1839
1840 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1841
1842         Web Inspector: "Reload Web Inspector" button no longer partially works
1843         https://bugs.webkit.org/show_bug.cgi?id=191773
1844         <rdar://problem/46139932>
1845
1846         Reviewed by Devin Rousso.
1847
1848         * UIProcess/RemoteWebInspectorProxy.cpp:
1849         (WebKit::RemoteWebInspectorProxy::load):
1850         (WebKit::RemoteWebInspectorProxy::reopen):
1851         * UIProcess/RemoteWebInspectorProxy.h:
1852         * UIProcess/RemoteWebInspectorProxy.messages.in:
1853         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
1854         (WebKit::RemoteWebInspectorUI::reopen):
1855         * WebProcess/WebPage/RemoteWebInspectorUI.h:
1856         * WebProcess/WebPage/WebInspector.cpp:
1857         (WebKit::WebInspector::reopen):
1858         * WebProcess/WebPage/WebInspector.h:
1859         * WebProcess/WebPage/WebInspector.messages.in:
1860         * WebProcess/WebPage/WebInspectorUI.cpp:
1861         (WebKit::WebInspectorUI::reopen):
1862         * WebProcess/WebPage/WebInspectorUI.h:
1863
1864 2018-11-19  Alejandro G. Castro  <alex@igalia.com>
1865
1866         [GTK][WPE] Solve some issues in the enumerateDevices code
1867         https://bugs.webkit.org/show_bug.cgi?id=191832
1868
1869         Reviewed by Carlos Garcia Campos.
1870
1871         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp:
1872         Increase the version to 2.24.
1873         (webkitDeviceInfoPermissionRequestAllow):
1874         (webkitDeviceInfoPermissionRequestDeny):
1875         * UIProcess/API/glib/WebKitDeviceInfoPermissionRequestPrivate.h:
1876         Replace the forward declaration with the include.
1877         * UIProcess/API/gtk/WebKitDeviceInfoPermissionRequest.h: Typo.
1878         * UIProcess/API/gtk/WebKitWebsiteData.h:
1879         Increase the version to 2.24.
1880         * UIProcess/API/wpe/WebKitDeviceInfoPermissionRequest.h: Typo.
1881         * UIProcess/API/wpe/WebKitWebsiteData.h:
1882         Increase the version to 2.24.
1883
1884 2018-11-19  Carlos Garcia Campos  <cgarcia@igalia.com>
1885
1886         Unreviewed. Fix GTK+ build after r238318.
1887
1888         Add new symbols to API documentation files. They should have been added in r237031, but r238318 revealed it.
1889
1890         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
1891         * UIProcess/API/gtk/docs/webkit2gtk-4.0.types:
1892         * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
1893
1894 2018-11-19  Joseph Pecoraro  <pecoraro@apple.com>
1895
1896         Regression(r238330): A lot of WebInspector tests are crashing on the bots
1897         https://bugs.webkit.org/show_bug.cgi?id=191814
1898
1899         Reviewed by Ryosuke Niwa.
1900
1901         Expose the expected connection type from the UIProcess into the WebProcess.
1902         When there is a local inspector connection to the UIProcess expose it as
1903         a local frontend channel to the inspector controllers in the Page.
1904
1905         * UIProcess/WebPageInspectorTargetAgent.h:
1906         * UIProcess/WebPageInspectorTargetAgent.cpp:
1907         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
1908         An additional FrontendChannel class is not needed, just use self.
1909
1910         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
1911         (WebKit::WebPageInspectorTargetAgent::connectionType const):
1912         (WebKit::WebPageInspectorTargetAgent::sendMessageToFrontend):
1913         Expose the channel to targets as local if there is a local frontend
1914         in the UIProcess.
1915
1916 2018-11-18  Joseph Pecoraro  <pecoraro@apple.com>
1917
1918         Regression(r238330) ProcessSwap.WebInspector API test is a flaky crash in debug
1919         https://bugs.webkit.org/show_bug.cgi?id=191812
1920
1921         Reviewed by Chris Dumez.
1922
1923         * WebProcess/WebPage/WebInspector.cpp:
1924         (WebKit::WebInspector::setFrontendConnection):
1925         It can be possible to receive a frontend connection multiple times
1926         if another WebProcess opened the inspector and this WebProcess got
1927         swapped in before the InspectorProcess notified the WebProcess of
1928         a connection to use. It is always best to use the latest connection
1929         we have received, since any others would have been invalidated.
1930
1931 2018-11-18  Chris Dumez  <cdumez@apple.com>
1932
1933         [PSON] Received an invalid message "WebPageProxy.DidPerformClientRedirect" from the web process
1934         https://bugs.webkit.org/show_bug.cgi?id=191828
1935
1936         Reviewed by Antti Koivisto.
1937
1938         WebPageProxy::didPerformClientRedirect() had a MESSAGE_CHECK_URL() for both the source
1939         and the destination URL. The macro calls WebProcessProxy::checkURLReceivedFromWebProcess()
1940         to make sure that both URLs were actually loaded by this WebContent process.
1941
1942         However, now that we're enabled process-swap on cross-site navigation, these checks are no
1943         longer fully valid. If the client-side redirect is cross-site, then the source and destination
1944         URLs get loaded by 2 different WebContent processes. Since didPerformClientRedirect() gets
1945         called after the redirect and gets set by the new WebContent process, only the destination URL
1946         is guaranteed to have been loaded by this process. The source URL may have been loaded in
1947         another process so this patch drops the message check for the source URL.
1948
1949         * UIProcess/WebPageProxy.cpp:
1950         (WebKit::WebPageProxy::didPerformClientRedirect):
1951
1952 2018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1953
1954         Use Box<BinarySemaphore> instead of dispatch_semaphore_t
1955         https://bugs.webkit.org/show_bug.cgi?id=189691
1956
1957         Reviewed by Ryosuke Niwa.
1958
1959         Use Box<BinarySemaphore> instead, which utilizes our WTF::Lock mechanism.
1960
1961         * NetworkProcess/watchos/NetworkProximityManager.mm:
1962         (WebKit::NetworkProximityManager::updateRecommendation):
1963
1964 2018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1965
1966         [iOS] Remove all usages of UIItemProvider, UIItemProviderReading, and related classes
1967         https://bugs.webkit.org/show_bug.cgi?id=191819
1968
1969         Reviewed by Dan Bernstein.
1970
1971         Replace UIItemProvider (and related classes) with NSItemProvider.
1972
1973         * Platform/spi/ios/UIKitSPI.h:
1974         * UIProcess/ios/WKContentViewInteraction.mm:
1975         (-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
1976         (-[WKContentView dropInteraction:performDrop:]):
1977
1978 2018-11-17  Ross Kirsling  <ross.kirsling@sony.com>
1979
1980         Unreviewed WinCairo build fix for r238353.
1981
1982         * UIProcess/WebPageProxy.cpp:
1983         (WebKit::WebPageProxy::continueNavigationInNewProcess):
1984
1985 2018-11-17  Chris Dumez  <cdumez@apple.com>
1986
1987         ASSERTION FAILED: m_messageReceivers.contains(...) under ViewGestureController removeMessageReceiver
1988         https://bugs.webkit.org/show_bug.cgi?id=191734
1989         <rdar://problem/46151497>
1990
1991         Reviewed by Ryosuke Niwa.
1992
1993         When a WebProcess crashes, we destroy the ViewGestureController and reconstruct it later
1994         after we've relaunched a new WebProcess. The ViewGestureController controller takes care
1995         of adding itself as an IPC message receiver to the WebProcessProxy, and the destructor
1996         takes care of removing itself as an IPC message receiver.
1997
1998         However, when process-swapping on navigation, we do not destroy the ViewGestureController
1999         because doing so would take down the swipe gesture snapshot on cross-site swipe navigation.
2000         This led to hitting this assertion later on because the ViewGestureController is still
2001         registered as an IPC message receiver with the old process after process swapping.
2002
2003         To address the issue, we now make sure the ViewGestureController unregisters itself from
2004         the old process and registers itself with the new process on process-swap.
2005
2006         * UIProcess/Cocoa/ViewGestureController.cpp:
2007         (WebKit::ViewGestureController::ViewGestureController):
2008         (WebKit::ViewGestureController::~ViewGestureController):
2009         (WebKit::ViewGestureController::disconnectFromProcess):
2010         (WebKit::ViewGestureController::connectToProcess):
2011         * UIProcess/Cocoa/ViewGestureController.h:
2012         * UIProcess/Cocoa/WebViewImpl.mm:
2013         (WebKit::WebViewImpl::processWillSwap):
2014         (WebKit::WebViewImpl::didRelaunchProcess):
2015
2016 2018-11-17  Chris Dumez  <cdumez@apple.com>
2017
2018         [PSON] ASSERTION FAILED: m_uncommittedState.state == State::Committed
2019         https://bugs.webkit.org/show_bug.cgi?id=191781
2020
2021         Reviewed by Ryosuke Niwa.
2022
2023         The crash was happening when switching to a suspended page that is not yet done
2024         suspending (e.g. in case of very fast back/forward navigation). The WebPageProxy
2025         would reattach to the suspended process and get load notifications that it did
2026         not expect since it did not schedule any load yet. Those notifications are for
2027         the about:blank load we do for page suspension.
2028
2029         To address the issue, make swapToWebProcess() asynchronous and take a completion
2030         handler. When we try to unsuspend a SuspendedPageProxy, we first make sure it
2031         is actually done suspending. If it is not done suspending, we wait until it is
2032         before telling in to unsuspend and proceeding with the new load.
2033
2034         * UIProcess/SuspendedPageProxy.cpp:
2035         (WebKit::SuspendedPageProxy::unsuspend):
2036         (WebKit::SuspendedPageProxy::didFinishLoad):
2037         * UIProcess/SuspendedPageProxy.h:
2038         * UIProcess/WebPageProxy.cpp:
2039         (WebKit::WebPageProxy::swapToWebProcess):
2040         (WebKit::WebPageProxy::continueNavigationInNewProcess):
2041         * UIProcess/WebPageProxy.h:
2042
2043 2018-11-17  Chris Dumez  <cdumez@apple.com>
2044
2045         Unreviewed follow-up to r238343 to address debug assertions in 2 API tests.
2046
2047         * UIProcess/Network/NetworkProcessProxy.cpp:
2048         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2049
2050 2018-11-17  Devin Rousso  <drousso@apple.com>
2051
2052         Web Inspector: Network: add button to show system certificate dialog
2053         https://bugs.webkit.org/show_bug.cgi?id=191458
2054         <rdar://problem/45977019>
2055
2056         Reviewed by Joseph Pecoraro.
2057
2058         * UIProcess/WebInspectorProxy.messages.in:
2059         * UIProcess/WebInspectorProxy.h:
2060         * UIProcess/WebInspectorProxy.cpp:
2061         (WebKit::WebInspectorProxy::showCertificate): Added.
2062         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
2063         * UIProcess/mac/WebInspectorProxyGtk.cpp:
2064         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
2065         * UIProcess/mac/WebInspectorProxyMac.mm:
2066         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
2067         * UIProcess/mac/WebInspectorProxyWPE.cpp:
2068         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
2069         * UIProcess/mac/WebInspectorProxyWin.cpp:
2070         (WebKit::WebInspectorProxy::platformShowCertificate): Added.
2071         * WebProcess/WebPage/WebInspectorUI.h:
2072         * WebProcess/WebPage/WebInspectorUI.cpp:
2073         (WebKit::WebInspectorUI::showCertificate): Added.
2074
2075         * UIProcess/RemoteWebInspectorProxy.messages.in:
2076         * UIProcess/RemoteWebInspectorProxy.h:
2077         * UIProcess/RemoteWebInspectorProxy.cpp:
2078         (WebKit::RemoteWebInspectorProxy::showCertificate): Added.
2079         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
2080         * UIProcess/mac/RemoteWebInspectorProxyGtk.cpp:
2081         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
2082         * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
2083         (WebKit::RemoteWebInspectorProxy::platformShowCertificate): Added.
2084         * WebProcess/WebPage/RemoteWebInspectorUI.h:
2085         * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
2086         (WebKit::RemoteWebInspectorUI::showCertificate): Added.
2087
2088         * NetworkProcess/cache/NetworkCacheCoders.h:
2089         * NetworkProcess/cache/NetworkCacheCodersCocoa.cpp: Removed.
2090         * NetworkProcess/cache/NetworkCacheCodersCurl.cpp: Removed.
2091         * NetworkProcess/cache/NetworkCacheCodersSoup.cpp: Removed.
2092         Moved `WebCore::CertificateInfo` code for `WTF::Encoder` and `WTF::Decoder` into their
2093         respective platform's CertificateInfo.h file.
2094
2095         * UIProcess/Authentication/mac/WebCredentialMac.mm:
2096
2097         * Configurations/WebKit.xcconfig:
2098         * PlatformMac.cmake:
2099         * PlatformWin.cmake:
2100         * SourcesCocoa.txt:
2101         * SourcesGTK.txt:
2102         * SourcesWPE.txt:
2103         * WebKit.xcodeproj/project.pbxproj:
2104
2105 2018-11-16  Chris Dumez  <cdumez@apple.com>
2106
2107         Regression(ProcessPrewarming) Assertion hit in NetworkProcessProxy destructor
2108         https://bugs.webkit.org/show_bug.cgi?id=191800
2109
2110         Reviewed by Ryosuke Niwa.
2111
2112         Make sure the NetworkProcessProxy destructor calls its remaining m_pendingConnectionReplies
2113         completion handlers to avoid hitting an assertion in the CompletionHandler destructor.
2114
2115         Prewarmed WebProcess do not keep the ProcessPool alive and thus not the NetworkProcessProxy
2116         either. As a result, it is possible for NetworkProcessProxy to have pending connection
2117         requests from those prewarmed processes when it is destroyed. Similar story for the
2118         suspended page processes when they are destroyed.
2119
2120         * UIProcess/Network/NetworkProcessProxy.cpp:
2121         (WebKit::NetworkProcessProxy::~NetworkProcessProxy):
2122
2123 2018-11-16  Alex Christensen  <achristensen@webkit.org>
2124
2125         Tweak _showSafeBrowsingWarningWithTitle SPI
2126         https://bugs.webkit.org/show_bug.cgi?id=191799
2127
2128         Reviewed by Wenson Hsieh.
2129
2130         * UIProcess/API/Cocoa/WKWebView.mm:
2131         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
2132         (+[WKWebView _visitUnsafeWebsiteSentinel]):
2133         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
2134         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
2135         (-[WKSafeBrowsingWarning clickedOnLink:]):
2136         I need to localize "Continue" and "Cancel" so they aren't always in English.
2137
2138 2018-11-16  Chris Dumez  <cdumez@apple.com>
2139
2140         WKWebViewMacEditingTests.DoNotCrashWhenInterpretingKeyEventWhileDeallocatingView API test is crashing in debug
2141         https://bugs.webkit.org/show_bug.cgi?id=191797
2142
2143         Reviewed by Ryosuke Niwa.
2144
2145         We were hitting the assertion because the error handler was first getting called. It would
2146         deallocate the send right, cancel/null out the XPC connection and call
2147         didFinishLaunchingProcess(0, IPC::Connection::Identifier()).
2148
2149         Then the xpc_connection_send_message_with_reply() block would get called later and
2150         would try to deallocate the send right again, and call
2151         didFinishLaunchingProcess(0, IPC::Connection::Identifier()) again because the xpc
2152         connection is null.
2153
2154         Handle this case by having the xpc_connection_send_message_with_reply() block check
2155         that we're still launching (i.e. didFinishLaunchingProcess() has not been called
2156         yet).
2157
2158         * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
2159         (WebKit::ProcessLauncher::launchProcess):
2160
2161 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
2162
2163         Unreviewed follow-up to r238330.
2164
2165         * UIProcess/WebPageProxy.cpp:
2166         (WebKit::WebPageProxy::close):
2167         Don't clear the pointer after invalidating since the pointer is
2168         used later one. We don't mind it being used after invalidation
2169         it will do the right thing, we'd rather have the WebInspectorProxy
2170         lifetime match the WebPageProxy.
2171
2172 2018-11-16  Chris Dumez  <cdumez@apple.com>
2173
2174         ProcessSwap.NavigationWithLockedHistoryWithoutPSON API test is a flaky crash in debug
2175         https://bugs.webkit.org/show_bug.cgi?id=191795
2176
2177         Reviewed by Alex Christensen.
2178
2179         If the WebProcessPool is getting destroyed while there is a prewarmed WebContent process
2180         that is awaiting its connnection to the network process, then we'll hit the
2181         process->hasOneRef() assertion in the WebProcessPool destructor. This is because
2182         NetworkProcessProxy::m_pendingConnectionReplies keeps a RefPtr to the WebProcessProxy
2183         that is awaiting the connection. The NetworkProcessProxy does not really need to keep
2184         the WebProcessProxy alive in this case so this patch switches to using a WeakPtr instead.
2185
2186         * UIProcess/Network/NetworkProcessProxy.cpp:
2187         (WebKit::NetworkProcessProxy::getNetworkProcessConnection):
2188         (WebKit::NetworkProcessProxy::networkProcessCrashed):
2189         * UIProcess/Network/NetworkProcessProxy.h:
2190         * UIProcess/WebProcessProxy.h:
2191
2192 2018-11-16  Chris Dumez  <cdumez@apple.com>
2193
2194         [macOS] Label "prewarmed" WebContent processes in Activity Monitor
2195         https://bugs.webkit.org/show_bug.cgi?id=191765
2196         <rdar://problem/45953463>
2197
2198         Reviewed by Geoffrey Garen.
2199
2200         Label "prewarmed" WebContent processes in Activity Monitor to facilitate debugging.
2201
2202         * Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
2203         (WebKit::XPCServiceInitializerDelegate::getExtraInitializationData):
2204         * UIProcess/WebProcessProxy.cpp:
2205         (WebKit::WebProcessProxy::getLaunchOptions):
2206         (WebKit::WebProcessProxy::markIsNoLongerInPrewarmedPool):
2207         * WebProcess/WebProcess.cpp:
2208         (WebKit::WebProcess::markIsNoLongerPrewarmed):
2209         * WebProcess/WebProcess.h:
2210         * WebProcess/WebProcess.messages.in:
2211         * WebProcess/cocoa/WebProcessCocoa.mm:
2212         (WebKit::WebProcess::initializeProcessName):
2213         (WebKit::WebProcess::updateProcessName):
2214         (WebKit::WebProcess::platformInitializeProcess):
2215
2216 2018-11-16  Joseph Pecoraro  <pecoraro@apple.com>
2217
2218         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Local Inspector)
2219         https://bugs.webkit.org/show_bug.cgi?id=191740
2220         <rdar://problem/45470897>
2221
2222         Reviewed by Timothy Hatcher.
2223
2224         When a web page asks to open a local Web Inspector, that inspector
2225         will now connect in the UIProcess (WebPageProxy / WebPageInspectorController)
2226         instead of the WebContentProcess (WebKit::WebInspector / InspectorController).
2227
2228         Previously a WebInspectorProxy was re-created every time the WebPageProxy's
2229         WebPage / WebProcess was changed, effectively closing the Web Inspector
2230         frontend when the WebPage was swapped or crashed.
2231
2232         This change keeps the WebInspectorProxy alive as long as the WebPageProxy
2233         is alive. During process swaps, or process crashes, the WebInspectorProxy
2234         is reset when the page is reset and updated when the page's WebProcess
2235         changes. Since WebInspectorProxy owns the Web Inspector view / window
2236         the Web Inspector window can be kept alive across (and attached state)
2237         across WebPage / WebProcess changes.
2238
2239         Previously the WebContentProcess's WebKit::WebInspector was the Local
2240         FrontendChannel for the WebCore::InspectorController. This can't
2241         outlive the single WebContentProcess.
2242
2243         This change makes the UIProcesses' WebInspectorProxy the Local FrontendChannel
2244         for the WebKit::WebPageInspectorController. Given the WebInspectorProxy
2245         now stays alive alongside the WebPageProxy this will live across process changes.
2246         This means that the WebInspectorUI process must send its backend messages to
2247         the WebInspectorProxy -> WebPageInspectorController now instead of the
2248         old path WebInspector -> WebCore::InspectorController.
2249
2250         A direct IPC connection is still maintained between the WebContentProcess's
2251         WebKit::WebInspector and the InspectorProcess's WebInspectorUI. Previously
2252         this connection was established by WebKit::WebInspector vending an
2253         IPC::Attachment to the WebInspectorUI process. This patch inverts that
2254         relationship, because the WebInspectorUI process now lives across multiple
2255         WebContentProcess changes. The WebInspectorUI now vends the IPC::Attachment
2256         to the WebContentProcess each time the process changes. This way they can both
2257         still communicate through normal Messages::WebInspector/WebInspectorUI
2258         messages and everything behaves as previously expected.
2259
2260         * Scripts/webkit/messages.py:
2261         Header for Inspector::FrontendChannel::ConnectionType.
2262
2263         * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
2264         (WebKit::WebInspectorClient::openLocalFrontend):
2265         * WebProcess/WebPage/WebInspector.cpp:
2266         (WebKit::WebInspector::openLocalInspectorFrontend):
2267         (WebKit::WebInspector::setFrontendConnection):
2268         (WebKit::WebInspector::closeFrontendConnection):
2269         (WebKit::WebInspector::close):
2270         (WebKit::WebInspector::openFrontendConnection): Deleted.
2271         (WebKit::WebInspector::sendMessageToBackend): Deleted.
2272         (WebKit::WebInspector::sendMessageToFrontend): Deleted.
2273         On the WebProcess side we ask the UIProcess to open a local frontend and now
2274         receive instead of vend an IPC connection to the WebInspectorUI process.
2275
2276         * UIProcess/WebPageProxy.cpp:
2277         (WebKit::WebPageProxy::finishAttachingToWebProcess):
2278         (WebKit::WebPageProxy::close):
2279         (WebKit::WebPageProxy::resetState):
2280         Keep the WebInspectorProxy alive alongside the WebPageProxy.
2281         Update it as processes / states change.
2282
2283         * UIProcess/WebInspectorProxy.h:
2284         * UIProcess/WebInspectorProxy.messages.in:
2285         * UIProcess/WebInspectorProxy.cpp:
2286         (WebKit::WebInspectorProxy::openLocalInspectorFrontend):
2287         (WebKit::WebInspectorProxy::createInspectorPage): Deleted.
2288         (WebKit::WebInspectorProxy::sendMessageToFrontend):
2289         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2290         Open and close a local frontend by being the FrontendChannel on the UIProcess side.
2291
2292         (WebKit::WebInspectorProxy::sendMessageToBackend):
2293         Dispatch WebInspectorUI backend messages to the UIProcess's InspectorController
2294         now that the InspectorController is here instead of in the WebProcess.
2295
2296         (WebKit::WebInspectorProxy::setFrontendConnection):
2297         Transfer the WebProcess <-> InspectorProcess IPC connection through us
2298         because we are the one link between them when processes change.
2299
2300         (WebKit::WebInspectorProxy::invalidate):
2301         (WebKit::WebInspectorProxy::frontendLoaded):
2302         Be safer and handle inspectedPage being potentially null.
2303
2304         * WebProcess/WebPage/WebPageInspectorTargetController.cpp:
2305         (WebKit::WebPageInspectorTargetController::connectInspector):
2306         * WebProcess/WebPage/WebPageInspectorTargetController.h:
2307         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
2308         (WebKit::WebPageInspectorTargetFrontendChannel::create):
2309         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
2310         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
2311         * UIProcess/InspectorTargetProxy.cpp:
2312         (WebKit::InspectorTargetProxy::connect):
2313         Proxy the ConnectionType received on the UIProcess side to the WebProcess side
2314         when connecting to sub-targets.
2315
2316         * WebProcess/WebPage/WebPage.cpp:
2317         (WebKit::WebPage::connectInspector):
2318         (WebKit::WebPage::setHasLocalInspectorFrontend): Deleted.
2319         * WebProcess/WebPage/WebPage.h:
2320         * WebProcess/WebPage/WebPage.messages.in:
2321         * UIProcess/WebPageProxy.h:
2322         (WebKit::WebPageProxy::hasLocalInspectorFrontend const): Deleted.
2323         (WebKit::WebPageProxy::setHasLocalInspectorFrontend): Deleted.
2324         * UIProcess/WebPageProxy.messages.in:
2325         * UIProcess/WebProcessPool.cpp:
2326         (WebKit::WebProcessPool::processForNavigationInternal):
2327         Eliminate the hasLocalInspectorFrontend state that was only used
2328         to disable PSON. PSON no longer needs to be disabled for this reason.
2329
2330         * WebProcess/WebPage/WebInspector.h:
2331         * WebProcess/WebPage/WebInspector.messages.in:
2332         * WebProcess/WebPage/WebInspectorUI.cpp:
2333         (WebKit::WebInspectorUI::establishConnection):
2334         (WebKit::WebInspectorUI::updateConnection):
2335         (WebKit::WebInspectorUI::closeWindow):
2336         (WebKit::WebInspectorUI::sendMessageToBackend):
2337         * WebProcess/WebPage/WebInspectorUI.h:
2338         * WebProcess/WebPage/WebInspectorUI.messages.in:
2339         Vend an IPC connection on demand to the WebProcess side.
2340
2341 2018-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2342
2343         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
2344         https://bugs.webkit.org/show_bug.cgi?id=191744
2345         <rdar://problem/46125461>
2346
2347         Unreviewed, install the file.
2348
2349         * PlatformGTK.cmake:
2350         * PlatformWPE.cmake:
2351
2352 2018-11-16  Zalan Bujtas  <zalan@apple.com>
2353
2354         Add DidFirstMeaningfulPaint milestone.
2355         https://bugs.webkit.org/show_bug.cgi?id=191754
2356
2357         Reviewed by Simon Fraser.
2358
2359         * Shared/API/c/WKPageLoadTypes.h:
2360         * Shared/API/c/WKSharedAPICast.h:
2361         (WebKit::toWKLayoutMilestones):
2362         (WebKit::toLayoutMilestones):
2363         * UIProcess/API/C/WKPageRenderingProgressEvents.h:
2364         * UIProcess/API/C/WKPageRenderingProgressEventsInternal.h:
2365         (pageRenderingProgressEvents):
2366
2367 2018-11-16  Chris Dumez  <cdumez@apple.com>
2368
2369         Automatic process prewarming should be turned on if PSON is enabled via experimental features
2370         https://bugs.webkit.org/show_bug.cgi?id=191761
2371
2372         Reviewed by Ryosuke Niwa.
2373
2374         m_isAutomaticProcessWarmingEnabledByClient is a std::optional and should not be initialized to
2375         true / false until the client calls API to toggle the feature. When m_isAutomaticProcessWarmingEnabledByClient
2376         is std::nullopt then m_processSwapsOnNavigationFromExperimentalFeatures controls automatic
2377         process prewarming.
2378
2379         * UIProcess/API/APIProcessPoolConfiguration.h:
2380
2381 2018-11-16  Alex Christensen  <achristensen@webkit.org>
2382
2383         Add API to disable safe browsing checks
2384         https://bugs.webkit.org/show_bug.cgi?id=191610
2385
2386         Reviewed by Dean Jackson.
2387
2388         * UIProcess/API/Cocoa/WKPreferences.h:
2389         * UIProcess/API/Cocoa/WKPreferences.mm:
2390         (-[WKPreferences setSafeBrowsingEnabled:]):
2391         (-[WKPreferences isSafeBrowsingEnabled]):
2392         (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
2393         (-[WKPreferences _safeBrowsingEnabled]): Deleted.
2394         * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
2395
2396 2018-11-16  Chris Dumez  <cdumez@apple.com>
2397
2398         WebKit.UnavailablePlugIn API test is crashing in debug
2399         https://bugs.webkit.org/show_bug.cgi?id=191753
2400
2401         Reviewed by Alex Christensen.
2402
2403         Add missing early returns. Those were mistakenly dropped in r235200.
2404
2405         * UIProcess/Cocoa/NavigationState.mm:
2406         (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad):
2407
2408 2018-11-16  Chris Dumez  <cdumez@apple.com>
2409
2410         [Mac] Regression: WebContent process's display name is no longer set
2411         https://bugs.webkit.org/show_bug.cgi?id=191722
2412         <rdar://problem/45960550>
2413
2414         Reviewed by Per Arne Vollan.
2415
2416         Make sure The WebContent process calls _RegisterApplication() during initialization and
2417         *before* trying to set its display name. Setting the display name fails otherwise.
2418
2419         * WebProcess/cocoa/WebProcessCocoa.mm:
2420         (WebKit::WebProcess::initializeProcessName):
2421         (WebKit::WebProcess::platformInitializeProcess):
2422
2423 2018-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2424
2425         Enable process swap on cross-site navigation by default on iOS
2426         https://bugs.webkit.org/show_bug.cgi?id=191735
2427
2428         Reviewed by Chris Dumez.
2429
2430         Enabled the feature.
2431
2432         * Shared/WebPreferencesDefaultValues.h:
2433
2434 2018-11-16  Antti Koivisto  <antti@apple.com>
2435
2436         REGRESSION(r237467) [PSON] iOS: Going back to a page sometimes doesn't restore the full page
2437         https://bugs.webkit.org/show_bug.cgi?id=191737
2438
2439         Reviewed by Simon Fraser.
2440
2441         * WebProcess/WebPage/WebPage.cpp:
2442         (WebKit::WebPage::setLayerTreeStateIsFrozen):
2443
2444         Layer tree should stay frozen in m_shouldResetDrawingArea state. Otherwise spurious commit transactions may
2445         mess up state on UI process side.
2446
2447         Specifically WKWebView._needsResetViewStateAfterCommitLoadForMainFrame would get stuck to TRUE and prevent
2448         all viewport updates because WKWebView._firstPaintAfterCommitLoadTransactionID has value greater
2449         than any current transaction IDs.
2450
2451 2018-11-16  Chris Dumez  <cdumez@apple.com>
2452
2453         Unreviewed typo fix in comment added in r238250.
2454
2455         * UIProcess/WebProcessPool.cpp:
2456         (WebKit::WebProcessPool::ensureNetworkProcess):
2457
2458 2018-11-16  Sihui Liu  <sihui_liu@apple.com>
2459
2460         Storing blobs in IDB on iOS: "Error preparing blob/file"
2461         https://bugs.webkit.org/show_bug.cgi?id=188438
2462         <rdar://problem/43097279>
2463
2464         Reviewed by Alex Christensen.
2465
2466         Grant sandbox extension of temp folder to network process, and clean up some code that managed sandbox extension
2467         of IDB temporary blob files in network process.
2468
2469         * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
2470         (WebKit::NetworkBlobRegistry::registerBlobURLOptionallyFileBacked):
2471         * NetworkProcess/IndexedDB/WebIDBConnectionToClient.cpp:
2472         (WebKit::WebIDBConnectionToClient::handleGetResult):
2473         * NetworkProcess/NetworkConnectionToWebProcess.cpp:
2474         (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles):
2475         (WebKit::NetworkConnectionToWebProcess::preregisterSandboxExtensionsForOptionallyFileBackedBlob): Deleted.
2476         (WebKit::NetworkConnectionToWebProcess::getBlobDataFileReferenceForPath): Deleted.
2477         * NetworkProcess/NetworkConnectionToWebProcess.h:
2478         * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
2479         * NetworkProcess/NetworkProcess.cpp:
2480         (WebKit::NetworkProcess::accessToTemporaryFileComplete):
2481         (WebKit::NetworkProcess::getSandboxExtensionsForBlobFiles):
2482         (WebKit::NetworkProcess::prepareForAccessToTemporaryFile): Deleted.
2483         (WebKit::NetworkProcess::updateTemporaryFileSandboxExtensions): Deleted.
2484         * NetworkProcess/NetworkProcess.h:
2485         * NetworkProcess/NetworkProcessCreationParameters.cpp:
2486         (WebKit::NetworkProcessCreationParameters::encode const):
2487         (WebKit::NetworkProcessCreationParameters::decode):
2488         * NetworkProcess/NetworkProcessCreationParameters.h:
2489         * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
2490         (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
2491         * UIProcess/WebProcessPool.cpp:
2492         (WebKit::WebProcessPool::ensureNetworkProcess):
2493         * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
2494         (WebKit::WebIDBConnectionToServer::didGetRecord):
2495         (WebKit::WebIDBConnectionToServer::didGetAllRecords):
2496         (WebKit::WebIDBConnectionToServer::didOpenCursor):
2497         (WebKit::WebIDBConnectionToServer::didIterateCursor):
2498         (WebKit::preregisterSandboxExtensionsIfNecessary): Deleted.
2499
2500 2018-11-16  Don Olmstead  <don.olmstead@sony.com>
2501
2502         Add USE(LIBWPE) to WebCore
2503         https://bugs.webkit.org/show_bug.cgi?id=191401
2504
2505         Reviewed by Michael Catanzaro.
2506
2507         Rename PlatformDisplayWPE to PlatformDisplayLibWPE.
2508
2509         * WebProcess/WebPage/wpe/AcceleratedSurfaceWPE.cpp:
2510         (WebKit::AcceleratedSurfaceWPE::initialize):
2511         * WebProcess/wpe/WebProcessMainWPE.cpp:
2512
2513 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2514
2515         [GStreamer][WebRTC] Add API to enable/disable device mocks
2516         https://bugs.webkit.org/show_bug.cgi?id=191699
2517
2518         This basically us to test MediaStream/WebRTC support without
2519         requiring cameras or microphones and is quite useful.
2520
2521         Also fix the GStreamerAudioMock by:
2522           - Stop setting `leaky-upstream` on the GStreamerCapturer queue,
2523             this was usefull when we were trying to bring the MediaStream
2524             sources inside the main pipeline, it is not the case anymore
2525             (and not doable with latest version of LibWebRTC).
2526           - Use a 'ticks' wave on the gstreamer audiotestsrc so the test
2527             stream is similar to what Apple port does.
2528
2529         Reviewed by Xabier Rodriguez-Calvar.
2530
2531         The mocks are already tested and the API is really simple.
2532
2533         * UIProcess/API/glib/WebKitSettings.cpp:
2534         (webKitSettingsSetProperty):
2535         (webKitSettingsGetProperty):
2536         (webkit_settings_class_init):
2537         (webkit_settings_get_enable_mock_capture_devices):
2538         (webkit_settings_set_enable_mock_capture_devices):
2539         * UIProcess/API/gtk/WebKitSettings.h:
2540         * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
2541
2542 2018-11-16  Thibault Saunier  <tsaunier@igalia.com>
2543
2544         [GTK][WPE] Add "WebKitDeviceInfoPermissionRequest.h" into webkit2.h
2545         https://bugs.webkit.org/show_bug.cgi?id=191744
2546
2547         It should always have been there.
2548
2549         Reviewed by Carlos Garcia Campos.
2550
2551         * UIProcess/API/gtk/webkit2.h:
2552
2553 2018-11-16  Antoine Quint  <graouts@apple.com>
2554
2555         PointerEvents should not require touch event listeners to be registered
2556         https://bugs.webkit.org/show_bug.cgi?id=191333
2557         <rdar://problem/45857523>
2558
2559         Reviewed by Dean Jackson.
2560
2561         * UIProcess/WebPageProxy.cpp:
2562         (WebKit::WebPageProxy::updateTouchEventTracking):
2563         (WebKit::WebPageProxy::touchEventTrackingType const):
2564         (WebKit::WebPageProxy::handleTouchEventSynchronously):
2565         (WebKit::WebPageProxy::handleTouchEventAsynchronously):
2566         (WebKit::WebPageProxy::handleTouchEvent):
2567         (WebKit::WebPageProxy::resetState):
2568         * UIProcess/WebPageProxy.h:
2569
2570 2018-11-15  Myles C. Maxfield  <mmaxfield@apple.com>
2571
2572         WKPreferencesSetFontSmoothingLevel doesn't actually do anything
2573         https://bugs.webkit.org/show_bug.cgi?id=191708
2574
2575         Reviewed by Simon Fraser.
2576
2577         Delete the symbol because no one calls it and it doesn't do anything
2578
2579         * Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb:
2580         * Shared/FontSmoothingLevel.h: Removed.
2581         * Shared/WebPreferences.yaml:
2582         * UIProcess/API/C/WKAPICast.h:
2583         (WebKit::toFontSmoothingLevel): Deleted.
2584         * UIProcess/API/C/WKPreferences.cpp:
2585         (WKPreferencesSetFontSmoothingLevel): Deleted.
2586         (WKPreferencesGetFontSmoothingLevel): Deleted.
2587         * UIProcess/API/C/WKPreferencesRefPrivate.h:
2588         * UIProcess/WebPreferences.h:
2589         * WebKit.xcodeproj/project.pbxproj:
2590         * mac/WebKit2.order:
2591
2592 2018-11-15  Truitt Savell  <tsavell@apple.com>
2593
2594         Unreviewed, rolling out r238244.
2595
2596         Caused High Sierra test runs to fail early with 50 crashes and
2597         casued 25 API failures.
2598
2599         Reverted changeset:
2600
2601         "[css-logical] Implement flow-relative margin, padding and
2602         border shorthands"
2603         https://bugs.webkit.org/show_bug.cgi?id=188697
2604         https://trac.webkit.org/changeset/238244
2605
2606 2018-11-15  Joseph Pecoraro  <pecoraro@apple.com>
2607
2608         Web Inspector: Remove unused WebInspectorProxy code
2609         https://bugs.webkit.org/show_bug.cgi?id=191674
2610
2611         Reviewed by Dean Jackson.
2612
2613         * UIProcess/WebInspectorProxy.cpp:
2614         (WebKit::WebInspectorProxy::createInspectorPage):
2615         (WebKit::WebInspectorProxy::closeFrontendPageAndWindow):
2616         * UIProcess/WebInspectorProxy.h:
2617         * UIProcess/mac/WebInspectorProxyMac.mm:
2618         (WebKit::WebInspectorProxy::setInspectorWindowFrame): Deleted.
2619         (WebKit::WebInspectorProxy::inspectorWindowFrame): Deleted.
2620         * WebProcess/WebPage/WebInspector.h:
2621
2622 2018-11-15  Ryosuke Niwa  <rniwa@webkit.org>
2623
2624         Enable process swap on cross-site navigation by default on macOS
2625         https://bugs.webkit.org/show_bug.cgi?id=191572
2626
2627         Reviewed by Chris Dumez.
2628
2629         Enabled the feature by default on macOS.
2630
2631         * Shared/WebPreferences.yaml:
2632         * Shared/WebPreferencesDefaultValues.h:
2633
2634 2018-11-15  Chris Dumez  <cdumez@apple.com>
2635
2636         IndexedDB.IndexedDBTempFileSize API test times out with process prewarming enabled
2637         https://bugs.webkit.org/show_bug.cgi?id=191671
2638         <rdar://problem/46086062>
2639
2640         Reviewed by Alex Christensen.
2641
2642         Enabling process prewarming caused IndexedDB.IndexedDBTempFileSize API to time out and print
2643         the following line:
2644         "Attempted to create a NetworkLoad with a session (id=2) that does not exist."
2645
2646         This actually identified a pre-existing bug with our handling of non-default data store.
2647         Whenever a page starts using a data store, we call WebProcessPool::pageBeginUsingWebsiteDataStore()
2648         which will call NetworkProcessProxy::addSession() if the network process was already started
2649         to let the network process know about this non-default session. There are several issues with the
2650         current model:
2651         1. If the network process was not created yet when pageBeginUsingWebsiteDataStore() is called,
2652            then the network process will not know about the non-default session when it actually gets
2653            started later on. This is unlikely to happen in practice, except in case of network process
2654            crash because we create the network process as soon as we initialize the first WebProcessProxy.
2655         2. Even if we successfuly managed to register the session with the network process proxy, we get
2656            in trouble if the network process crashes or is terminated later on as we do not re-register
2657            those sessions with the new network process.
2658
2659         To address these 2 issues, WebProcessPool::ensureNetworkProcess() now takes care of registering
2660         all the non-default sessions (that are associated with this process pool) with the new network
2661         process. The WebProcessPool knows about these sessions because it adds them to m_sessionToPagesMap
2662         whenever WebProcessPool::pageBeginUsingWebsiteDataStore() is called, even if the network process
2663         proxy was not created yet.
2664
2665         The reason the IndexedDB.IndexedDBTempFileSize API test was failing was because it did:
2666         1. A load in a WebView V1 with a non-default session
2667         2. Process prewarming kicked in after this load and would create a new WebProcessProxy.
2668         3. Terminate the network process
2669         4. Another load in a WebView V2 with the same non-defaut session, which would reuse the
2670           prewarmed process. Because the network process was terminated, constructing the new
2671           page would not register the session ID with the new network process when
2672           pageBeginUsingWebsiteDataStore() is called.
2673         -> The load would hang because the new network process would not know about the
2674            non-default session when started later on.
2675
2676         The bug was previously hidden without process prewarming because step 4 would create a *new*
2677         WebProcessProxy and WebProcessPool::initializeNewWebProcess() would call ensureNetworkProcess()
2678         so that pageBeginUsingWebsiteDataStore() would successfuly register the session with the
2679         network process later on.
2680
2681         I wrote a second API test (WebKit.DoLoadWithNonDefaultDataStoreAfterTerminatingNetworkProcess)
2682         to demonstrate the pre-existing bug without process prewarming enabled.
2683
2684         * UIProcess/WebProcessPool.cpp:
2685         (WebKit::WebProcessPool::ensureNetworkProcess):
2686
2687 2018-11-15  Vivek Seth  <v_seth@apple.com>
2688
2689         Create feature flag (HTTPS_UPGRADE)
2690         https://bugs.webkit.org/show_bug.cgi?id=191613
2691         <rdar://problem/45851068>
2692
2693         Reviewed by Dean Jackson.
2694
2695         * config.h:
2696
2697 2018-11-15  Chris Dumez  <cdumez@apple.com>
2698
2699         Regression(r238215) WKProcessPool.WarmInitialProcess API test is failing
2700         https://bugs.webkit.org/show_bug.cgi?id=191693
2701
2702         Reviewed by Alex Christensen.
2703
2704         Allow *explicit* process prewarming to construct the default data store if necessary or we would
2705         not be obeying the client's request. Only automatic process prewarming should avoid constructing
2706         the default data store unnecessarily to avoid causing memory regressions.
2707
2708         * UIProcess/API/C/WKContext.cpp:
2709         (WKContextWarmInitialProcess):
2710         * UIProcess/API/Cocoa/WKProcessPool.mm:
2711         (-[WKProcessPool _warmInitialProcess]):
2712         * UIProcess/WebProcessPool.cpp:
2713         (WebKit::WebProcessPool::prewarmProcess):
2714         (WebKit::WebProcessPool::didReachGoodTimeToPrewarm):
2715         * UIProcess/WebProcessPool.h:
2716         (WebKit::WebProcessPool::sendToOneProcess):
2717
2718 2018-11-14  Jiewen Tan  <jiewen_tan@apple.com>
2719
2720         Unreviewed, comment improvement over r238166.
2721
2722         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2723         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2724         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h:
2725
2726 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2727
2728         [WebAuthN] Use a real nonce for CTAPHID_INIT
2729         https://bugs.webkit.org/show_bug.cgi?id=191533
2730         <rdar://problem/46103502>
2731
2732         Reviewed by Brent Fulgham.
2733
2734         Use a real nonce for CTAPHID_INIT request according to:
2735         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid_init-0x06.
2736         The challenge here is the new transaction needs to start in the next runloop otherwise a dead lock will form:
2737         wrong nonce -> new transaction -> new nonce -> write init request -> read init response from last run as it
2738         piped in the run loop -> wrong nonce of course -> ...
2739         To break the above dead lock, we have to start the new transaction in the next run. However, that isn't
2740         sufficient as the arrived init response will be piped in HidConnection::m_inputReports, which is designed
2741         on purpose to store any data packets within (initialized, terminated) time interval to prevent data loss in
2742         the case when HidConnection::registerDataReceivedCallback is called after the first data packet's arrival.
2743         In order to break the dead lock completely, HidConnection::invalidateCache will bnnne called prior to every
2744         send to delete any potential init response from last run. HidConnection::invalidateCache is not necessary
2745         for other protocols though. The above scenario is more or less a design flaw in CTAP HID.
2746
2747         Of course, all above scenarios are covered in our mock tests.
2748
2749         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
2750         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
2751         * UIProcess/WebAuthentication/Cocoa/HidConnection.h:
2752         (WebKit::HidConnection::invalidateCache):
2753         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
2754         (WebKit::MockHidConnection::send):
2755         (WebKit::MockHidConnection::parseRequest):
2756         (WebKit::MockHidConnection::feedReports):
2757         * UIProcess/WebAuthentication/Mock/MockHidConnection.h:
2758         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
2759         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp:
2760         (WebKit::CtapHidDriver::Worker::transact):
2761         (WebKit::CtapHidDriver::CtapHidDriver):
2762         (WebKit::CtapHidDriver::transact):
2763         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
2764         (WebKit::CtapHidDriver::returnResponse):
2765         * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
2766
2767 2018-11-15  Oriol Brufau  <obrufau@igalia.com>
2768
2769         [css-logical] Implement flow-relative margin, padding and border shorthands
2770         https://bugs.webkit.org/show_bug.cgi?id=188697
2771
2772         Reviewed by Simon Fraser and Antti Koivisto.
2773
2774         Add a CSSLogicalEnabled runtime flag.
2775
2776         * Shared/WebPreferences.yaml:
2777
2778 2018-11-15  Jiewen Tan  <jiewen_tan@apple.com>
2779
2780         [WebAuthN] PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::AuthenticatorAttachment should be optional
2781         https://bugs.webkit.org/show_bug.cgi?id=191522
2782
2783         Reviewed by Brent Fulgham.
2784
2785         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
2786         (WebKit::AuthenticatorManagerInternal::collectTransports):
2787
2788 2018-11-15  Michael Catanzaro  <mcatanzaro@igalia.com>
2789
2790         [SOUP] Make Accept-Languages header look more like other browsers
2791         https://bugs.webkit.org/show_bug.cgi?id=191614
2792
2793         Reviewed by Carlos Garcia Campos.
2794
2795         This changes our Accept-Language header to better match other browsers, from something
2796         like this:
2797
2798         Accept-Language: en-us, en;q=0.90, es-es;q=0.80, es;q=0.70
2799
2800         to something like this:
2801
2802         Accept-Language: en-US,en;q=0.90,es-ES;q=0.80,es;q=0.70
2803
2804         There's no particular motivation for this change. I just noticed we were different for no
2805         clear reason.
2806
2807         * NetworkProcess/soup/NetworkProcessSoup.cpp:
2808         (WebKit::buildAcceptLanguages):
2809         * UIProcess/API/glib/WebKitWebContext.cpp:
2810         (webkit_web_context_set_preferred_languages):
2811
2812 2018-11-15  Daniel Bates  <dabates@apple.com>
2813
2814         [iOS] Shift + Tab does not focus previous field
2815         https://bugs.webkit.org/show_bug.cgi?id=191596
2816         <rdar://problem/45892053>
2817
2818         Reviewed by Wenson Hsieh.
2819
2820         Wire up the the tab and shift + tab key commands to the WKWebView/WKContentView's
2821         action forwarding mechanism. Also rename -_prevAccessoryTab to -_previousAccessoryTab.
2822
2823         * Platform/spi/ios/UIKitSPI.h: Add more SPI.
2824         * UIProcess/API/Cocoa/WKWebViewInternal.h:
2825         * UIProcess/ios/WKContentViewInteraction.h:
2826         * UIProcess/ios/WKContentViewInteraction.mm:
2827         (-[WKContentView canPerformActionForWebView:withSender:]):
2828         (-[WKContentView keyCommands]):
2829         (-[WKContentView _nextAccessoryTabForWebView:]): Added.
2830         (-[WKContentView _previousAccessoryTabForWebView:]): Added.
2831         (-[WKContentView _nextAccessoryTab:]): Deleted.
2832         (-[WKContentView _prevAccessoryTab:]): Deleted.
2833
2834 2018-11-15  Keith Rollin  <krollin@apple.com>
2835
2836         Delete old .xcfilelist files
2837         https://bugs.webkit.org/show_bug.cgi?id=191669
2838         <rdar://problem/46081994>
2839
2840         Reviewed by Chris Dumez.
2841
2842         .xcfilelist files were created and added to the Xcode project files in
2843         https://trac.webkit.org/changeset/238008/webkit. However, they caused
2844         build issues and they were removed from the Xcode projects in
2845         https://trac.webkit.org/changeset/238055/webkit. This check-in removes
2846         the files from the repository altogether. They'll ultimately be
2847         replaced with new files with names that indicate whether the
2848         associated files are inputs to the Run Script phase or are files
2849         created by the Run Script phase.
2850
2851         * DerivedSources.xcfilelist: Removed.
2852         * UnifiedSources.xcfilelist: Removed.
2853
2854 2018-11-15  Frederic Wang  <fwang@igalia.com>
2855
2856         [WebAuthN] Make AuthenticatorManager
2857         https://bugs.webkit.org/show_bug.cgi?id=189279
2858
2859         Unreviewed build fix.
2860
2861         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticator.mm: Add missing header.
2862         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: Ditto.
2863         * UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp: Ditto.
2864
2865 2018-11-14  Keith Rollin  <krollin@apple.com>
2866
2867         Move scripts for Derived and Unified Sources to external files
2868         https://bugs.webkit.org/show_bug.cgi?id=191670
2869         <rdar://problem/46082278>
2870
2871         Reviewed by Keith Miller.
2872
2873         Move the scripts in the Generate Derived Sources and Generate Unified
2874         Sources Run Script phases from the Xcode projects to external shell
2875         script files. Then invoke those scripts from the Run Script phases.
2876         This refactoring is being performed to support later work that will
2877         invoke these scripts in other contexts.
2878
2879         The scripts were maintained as-is when making the move. I did a little
2880         reformatting and added 'set -e' to the top of each file, but that's
2881         it.
2882
2883         * Scripts/generate-derived-sources.sh: Added.
2884         * Scripts/generate-unified-sources.sh: Added.
2885         * WebKit.xcodeproj/project.pbxproj:
2886
2887 2018-11-14  Chris Dumez  <cdumez@apple.com>
2888
2889         WebKit.DecidePolicyForNavigationActionForHyperlinkThatRedirects API fails when PSON is enabled
2890         https://bugs.webkit.org/show_bug.cgi?id=191640
2891
2892         Reviewed by Alex Christensen.
2893
2894         The issue was that when process-swapping on a redirect, the parameters provided by the new
2895         WebContent process for navigationActionData / originatingFrameInfoData / frameSecurityOrigin
2896         are not correct because it does not have sufficient information (it does not know a swap
2897         happened).
2898
2899         To address the issue, we now store the navigationActionData / originatingFrameInfoData /
2900         frameSecurityOrigin on the Navigation object whenever decidePolicyForNavigationAction is
2901         called. If the decidePolicyForNavigationAction is for a redirect, use the ones we stored
2902         on the Navigation object instead of the ones provided by the WebContent process. In case
2903         of redirect, those do not change anyway.
2904
2905         This fixes all WebKit.DecidePolicyForNavigationAction* tests with PSON enabled.
2906
2907         * UIProcess/API/APINavigation.h:
2908         (API::Navigation::currentRequestIsRedirect const):
2909         (API::Navigation::wasUserInitiated const):
2910         (API::Navigation::shouldForceDownload const):
2911         (API::Navigation::treatAsSameOriginNavigation const):
2912         (API::Navigation::hasOpenedFrames const):
2913         (API::Navigation::openedViaWindowOpenWithOpener const):
2914         (API::Navigation::opener const):
2915         (API::Navigation::requesterOrigin const):
2916         (API::Navigation::lockHistory const):
2917         (API::Navigation::lockBackForwardList const):
2918         (API::Navigation::clientRedirectSourceForHistory const):
2919         (API::Navigation::setLastNavigationAction):
2920         (API::Navigation::lastNavigationAction const):
2921         (API::Navigation::setOriginatingFrameInfo):
2922         (API::Navigation::originatingFrameInfo const):
2923         (API::Navigation::setDestinationFrameSecurityOrigin):
2924         (API::Navigation::destinationFrameSecurityOrigin const):
2925         * UIProcess/WebPageProxy.cpp:
2926         (WebKit::WebPageProxy::decidePolicyForNavigationActionAsync):
2927         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
2928         (WebKit::WebPageProxy::decidePolicyForNavigationActionSync):
2929         * UIProcess/WebPageProxy.h:
2930
2931 2018-11-14  Chris Dumez  <cdumez@apple.com>
2932
2933         WebKit.WebsiteDataStoreCustomPaths API test is failing when enabling process prewarming
2934         https://bugs.webkit.org/show_bug.cgi?id=191638
2935
2936         Reviewed by Alex Christensen.
2937
2938         WebProcessPool::prewarmProcess() should not create the default WebSite Data Store if it
2939         does not exist yet. This is bad for memory consumption and it is what was causing this
2940         API test to fail.
2941
2942         WebProcessPool::prewarmProcess() now tries to use the following data stores in this
2943         order of preference:
2944         1. WebProcessPool::m_websiteDataStore (aka this process pool's primary data store)
2945         2. The data store of the last WebProcessProxy that was created
2946         3. The default data store if it exists
2947
2948         If no suitable data store is found, we cancel the process prewarming and log a console
2949         message instead.
2950
2951         * UIProcess/WebProcessPool.cpp:
2952         (WebKit::WebProcessPool::prewarmProcess):
2953
2954 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2955
2956         Enabled dark mode CSS support by default.
2957         https://bugs.webkit.org/show_bug.cgi?id=191609
2958         rdar://problem/46046861
2959
2960         Reviewed by Megan Gardner.
2961
2962         * Shared/WebPreferences.yaml: Set DarkModeCSSEnabled's defaultValue to true.
2963
2964 2018-11-14  Timothy Hatcher  <timothy@apple.com>
2965
2966         Default the view background color and text color to different values when in dark mode.
2967         https://bugs.webkit.org/show_bug.cgi?id=191607
2968         rdar://problem/46045854
2969
2970         Reviewed by Dean Jackson.
2971
2972         * UIProcess/Cocoa/WebViewImpl.mm:
2973         (WebKit::WebViewImpl::backgroundColor const): Use controlBackgroundColor.
2974         (WebKit::WebViewImpl::updateLayer): Simplified and use backgroundColor() getter.
2975         * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
2976         (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Drop backgroundColor.
2977         * WebProcess/WebPage/WebPage.cpp:
2978         (WebKit::WebPage::setDrawsBackground): Drop backgroundColor.
2979
2980 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2981
2982         Web Inspector: Pass Inspector::FrontendChannel as a reference connect/disconnect methods
2983         https://bugs.webkit.org/show_bug.cgi?id=191612
2984
2985         Reviewed by Matt Baker.
2986
2987         * UIProcess/Automation/WebAutomationSession.cpp:
2988         (WebKit::WebAutomationSession::connect):
2989         (WebKit::WebAutomationSession::disconnect):
2990         (WebKit::WebAutomationSession::terminate):
2991         * UIProcess/Automation/WebAutomationSession.h:
2992         * UIProcess/WebPageDebuggable.cpp:
2993         (WebKit::WebPageDebuggable::connect):
2994         (WebKit::WebPageDebuggable::disconnect):
2995         * UIProcess/WebPageDebuggable.h:
2996         * UIProcess/WebPageInspectorController.cpp:
2997         (WebKit::WebPageInspectorController::connectFrontend):
2998         (WebKit::WebPageInspectorController::disconnectFrontend):
2999         * UIProcess/WebPageInspectorController.h:
3000         * WebProcess/WebPage/WebInspector.cpp:
3001         (WebKit::WebInspector::close):
3002         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
3003         (WebKit::WebPageInspectorTarget::connect):
3004         (WebKit::WebPageInspectorTarget::disconnect):
3005
3006 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
3007
3008         Unreviewed attempted wincairo build fix after 238192.
3009
3010         * WebProcess/WebPage/WebPageInspectorTargetController.h:
3011         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
3012
3013 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
3014
3015         Web Inspector: Follow-up: Keep Disabling Process Swap for Local Web Inspector
3016         https://bugs.webkit.org/show_bug.cgi?id=191494
3017         <rdar://problem/45469854>
3018
3019         Reviewed by Devin Rousso.
3020
3021         Continue to have the Local Inspector disable PSON while open
3022         until support is added.
3023
3024         * UIProcess/WebPageProxy.cpp:
3025         (WebKit::WebPageProxy::resetState):
3026         * UIProcess/WebPageProxy.h:
3027         (WebKit::WebPageProxy::hasLocalInspectorFrontend const):
3028         (WebKit::WebPageProxy::setHasLocalInspectorFrontend):
3029         * UIProcess/WebPageProxy.messages.in:
3030         * UIProcess/WebProcessPool.cpp:
3031         (WebKit::WebProcessPool::processForNavigationInternal):
3032         * WebProcess/WebPage/WebInspector.cpp:
3033         (WebKit::WebInspector::openFrontendConnection):
3034         (WebKit::WebInspector::closeFrontendConnection):
3035         * WebProcess/WebPage/WebPage.cpp:
3036         (WebKit::WebPage::setHasLocalInspectorFrontend):
3037         * WebProcess/WebPage/WebPage.h:
3038
3039 2018-11-14  Joseph Pecoraro  <pecoraro@apple.com>
3040
3041         Web Inspector: Keep Web Inspector window alive across process swaps (PSON) (Remote Inspector)
3042         https://bugs.webkit.org/show_bug.cgi?id=191494
3043         <rdar://problem/45469854>
3044
3045         Reviewed by Devin Rousso.
3046
3047         To support process swapping a slim Web Inspector backend lives in the UIProcess.
3048         The Web Inspector frontend connects to it and is told about sub-targets, namely
3049         pages, that it can further connect to. When performing a process swap the backend
3050         tells the frontend to destroy existing targets and create new targets.
3051
3052         In the UIProcess the WebPageProxy has a WebPageInspectorController, with a single
3053         TargetAgent holding InspectorTargetProxies to targets it knows about. Inspector
3054         protocol messages go through this inspector controller and are routed to the
3055         WebPage and its WebCore::Page's InspectorController. The WebPageProxy decides
3056         when to close and expose new page targets during process swap, or basically
3057         any time it reconnects to a WebProcess. So this patch also makes Web Inspector
3058         stay alive and reconnect to a page when the inspected page crashes!
3059
3060         In the WebContentProcess the WebPage has a WebPageInspectorTarget. It also
3061         has a WebPageInspectorTargetController in anticipation of further sub-targets
3062         within the page (workers, frames) but none exist at the moment. The WebPage
3063         relies on the WebPageProxy to know when to expose this target as a debuggable.
3064
3065         * Sources.txt:
3066         * WebKit.xcodeproj/project.pbxproj:
3067         New files.
3068
3069         * Shared/WebPageCreationParameters.cpp:
3070         (WebKit::WebPageCreationParameters::encode const):
3071         (WebKit::WebPageCreationParameters::decode):
3072         * Shared/WebPageCreationParameters.h:
3073         Remote inspector state can now stay in the UIProcess and does not need to
3074         be passed down to the WebContentProcess.
3075
3076         * UIProcess/WebPageDebuggable.cpp: Copied from Source/WebCore/page/PageDebuggable.cpp.
3077         (WebKit::WebPageDebuggable::WebPageDebuggable):
3078         (WebKit::WebPageDebuggable::name const):
3079         (WebKit::WebPageDebuggable::url const):
3080         (WebKit::WebPageDebuggable::hasLocalDebugger const):
3081         (WebKit::WebPageDebuggable::connect):
3082         (WebKit::WebPageDebuggable::disconnect):
3083         (WebKit::WebPageDebuggable::dispatchMessageFromRemote):
3084         (WebKit::WebPageDebuggable::setIndicating):
3085         (WebKit::WebPageDebuggable::setNameOverride):
3086         * UIProcess/WebPageDebuggable.h: Copied from Source/WebCore/page/PageDebuggable.h.
3087         Remote debuggable entry point into the UIProcess for a page.
3088         This is pretty much identical to the PageDebuggable in WebCore.
3089
3090         * Scripts/webkit/messages.py:
3091         * UIProcess/WebPageProxy.messages.in:
3092         * UIProcess/WebPageProxy.cpp:
3093         (WebKit::m_resetRecentCrashCountTimer):
3094         (WebKit::WebPageProxy::finishAttachingToWebProcess):
3095         (WebKit::WebPageProxy::close):
3096         (WebKit::WebPageProxy::createInspectorTarget):
3097         (WebKit::WebPageProxy::destroyInspectorTarget):
3098         (WebKit::WebPageProxy::sendMessageToInspectorFrontend):
3099         (WebKit::WebPageProxy::setIndicating):
3100         (WebKit::WebPageProxy::allowsRemoteInspection const):
3101         (WebKit::WebPageProxy::setAllowsRemoteInspection):
3102         (WebKit::WebPageProxy::remoteInspectionNameOverride const):
3103         (WebKit::WebPageProxy::setRemoteInspectionNameOverride):
3104         (WebKit::WebPageProxy::remoteInspectorInformationDidChange):
3105         (WebKit::WebPageProxy::clearInspectorTargets):
3106         (WebKit::WebPageProxy::createInspectorTargets):
3107         (WebKit::WebPageProxy::didCommitLoadForFrame):
3108         (WebKit::WebPageProxy::didReceiveTitleForFrame):
3109         (WebKit::WebPageProxy::creationParameters):
3110         * UIProcess/WebPageProxy.h:
3111         (WebKit::WebPageProxy::inspectorController):
3112         (WebKit::WebPageProxy::allowsRemoteInspection const): Deleted.
3113         (WebKit::WebPageProxy::remoteInspectionNameOverride const): Deleted.
3114         Own more inspector state in the UIProcess including a debuggable and inspector controller.
3115
3116         * UIProcess/WebPageInspectorController.h: Added.
3117         * UIProcess/WebPageInspectorController.cpp: Added.
3118         (WebKit::WebPageInspectorController::WebPageInspectorController):
3119         (WebKit::WebPageInspectorController::pageClosed):
3120         (WebKit::WebPageInspectorController::hasLocalFrontend const):
3121         (WebKit::WebPageInspectorController::hasRemoteFrontend const):
3122         (WebKit::WebPageInspectorController::connectFrontend):
3123         (WebKit::WebPageInspectorController::disconnectFrontend):
3124         (WebKit::WebPageInspectorController::disconnectAllFrontends):
3125         (WebKit::WebPageInspectorController::dispatchMessageFromFrontend):
3126         (WebKit::WebPageInspectorController::setIndicating):
3127         (WebKit::WebPageInspectorController::clearTargets):
3128         (WebKit::WebPageInspectorController::createInspectorTarget):
3129         (WebKit::WebPageInspectorController::destroyInspectorTarget):
3130         (WebKit::WebPageInspectorController::sendMessageToInspectorFrontend):
3131         InspectorController with a single TargetAgent in the UIProcess.
3132
3133         * UIProcess/WebPageInspectorTargetAgent.h:
3134         * UIProcess/WebPageInspectorTargetAgent.cpp:
3135         (WebKit::WebPageInspectorTargetAgent::WebPageInspectorTargetAgent):
3136         (WebKit::WebPageInspectorTargetAgent::frontendChannel):
3137         Target agent implementation.
3138
3139         * UIProcess/InspectorTargetProxy.cpp:
3140         (WebKit::InspectorTargetProxy::create):
3141         (WebKit::InspectorTargetProxy::InspectorTargetProxy):
3142         (WebKit::InspectorTargetProxy::connect):
3143         (WebKit::InspectorTargetProxy::disconnect):
3144         (WebKit::InspectorTargetProxy::sendMessageToTargetBackend):
3145         * UIProcess/InspectorTargetProxy.h:
3146         UIProcess proxy for an InspectorTarget in the WebContentProcess.
3147
3148         * UIProcess/WebProcessPool.cpp:
3149         (WebKit::WebProcessPool::processForNavigationInternal):
3150
3151         * WebProcess/WebPage/WebPage.cpp:
3152         (WebKit::m_shouldAttachDrawingAreaOnPageTransition):
3153         (WebKit::WebPage::connectInspector):
3154         (WebKit::WebPage::disconnectInspector):
3155         (WebKit::WebPage::sendMessageToTargetBackend):
3156         (WebKit::WebPage::setIndicating):
3157         (WebKit::WebPage::setAllowsRemoteInspection): Deleted.
3158         (WebKit::WebPage::setRemoteInspectionNameOverride): Deleted.
3159         * WebProcess/WebPage/WebPage.h:
3160         * WebProcess/WebPage/WebPage.messages.in:
3161
3162         * WebProcess/WebPage/WebPageInspectorTarget.h:
3163         * WebProcess/WebPage/WebPageInspectorTarget.cpp:
3164         (WebKit::WebPageInspectorTarget::WebPageInspectorTarget):
3165         (WebKit::WebPageInspectorTarget::identifier const):
3166         (WebKit::WebPageInspectorTarget::connect):
3167         (WebKit::WebPageInspectorTarget::disconnect):
3168         (WebKit::WebPageInspectorTarget::sendMessageToTargetBackend):
3169         InspectorTarget for this WebPage.
3170
3171         * WebProcess/WebPage/WebPageInspectorTargetController.cpp: Added.
3172         (WebKit::WebPageInspectorTargetController::WebPageInspectorTargetController):
3173         (WebKit::WebPageInspectorTargetController::~WebPageInspectorTargetController):
3174         (WebKit::WebPageInspectorTargetController::addTarget):
3175         (WebKit::WebPageInspectorTargetController::removeTarget):
3176         (WebKit::WebPageInspectorTargetController::connectInspector):
3177         (WebKit::WebPageInspectorTargetController::disconnectInspector):
3178         (WebKit::WebPageInspectorTargetController::sendMessageToTargetBackend):
3179         (WebKit::WebPageInspectorTargetController::sendMessageToTargetFrontend):
3180         * WebProcess/WebPage/WebPageInspectorTargetController.h:
3181         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.h:
3182         * WebProcess/WebPage/WebPageInspectorTargetFrontendChannel.cpp:
3183         (WebKit::WebPageInspectorTargetFrontendChannel::create):
3184         (WebKit::WebPageInspectorTargetFrontendChannel::WebPageInspectorTargetFrontendChannel):
3185         (WebKit::WebPageInspectorTargetFrontendChannel::sendMessageToFrontend):
3186         Preparation for more target managment in the WebContentProcess.
3187
3188 2018-11-14  Alex Christensen  <achristensen@webkit.org>
3189
3190         Add SPI to show a safe browsing warning
3191         https://bugs.webkit.org/show_bug.cgi?id=191604
3192
3193         Reviewed by Andy Estes.
3194
3195         Safari has a case where it shows safe browsing warnings for a reason other than being told to by the SafeBrowsing framework.
3196         Because safe browsing is moving to WebKit, we will have Safari call this WebKit SPI in that case.
3197         The warning looks a little different, so I had to change the structure of a SafeBrowsingResult and the location of the string processing,
3198         but the existing behavior is the same as verified by existing unit tests.  I added a unit test to verify behavior of the new SPI.
3199
3200         * SourcesCocoa.txt:
3201         * UIProcess/API/Cocoa/WKWebView.mm:
3202         (-[WKWebView _showSafeBrowsingWarningWithTitle:warning:details:completionHandler:]):
3203         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3204         (+[WKWebView _confirmMalwareSentinel]):
3205         (+[WKWebView _visitUnsafeWebsiteSentinel]):
3206         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3207         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3208         * UIProcess/Cocoa/SafeBrowsingResultCocoa.mm: Removed.
3209         * UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm: Copied from Source/WebKit/UIProcess/Cocoa/SafeBrowsingResultCocoa.mm.
3210         (WebKit::malwareDetailsBase):
3211         (WebKit::learnMoreURL):
3212         (WebKit::reportAnErrorBase):
3213         (WebKit::localizedProvider):
3214         (WebKit::SafeBrowsingWarning::visitUnsafeWebsiteSentinel):
3215         (WebKit::SafeBrowsingWarning::confirmMalwareSentinel):
3216         (WebKit::replace):
3217         (WebKit::addLinkAndReplace):
3218         (WebKit::reportAnErrorURL):
3219         (WebKit::malwareDetailsURL):
3220         (WebKit::safeBrowsingTitleText):
3221         (WebKit::safeBrowsingWarningText):
3222         (WebKit::safeBrowsingDetailsText):
3223         (WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
3224         (WebKit::learnMore): Deleted.
3225         (WebKit::SafeBrowsingResult::SafeBrowsingResult): Deleted.
3226         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
3227         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3228         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):
3229         (-[WKSafeBrowsingWarning addContent]):
3230         (-[WKSafeBrowsingWarning showDetailsClicked]):
3231         (-[WKSafeBrowsingWarning clickedOnLink:]):
3232         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3233         (confirmMalwareSentinel): Deleted.
3234         (visitUnsafeWebsiteSentinel): Deleted.
3235         (replace): Deleted.
3236         (addLinkAndReplace): Deleted.
3237         (reportAnErrorURL): Deleted.
3238         (malwareDetailsURL): Deleted.
3239         (titleText): Deleted.
3240         (warningText): Deleted.
3241         (detailsText): Deleted.
3242         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]): Deleted.
3243         * UIProcess/Cocoa/WebPageProxyCocoa.mm:
3244         (WebKit::WebPageProxy::beginSafeBrowsingCheck):
3245         * UIProcess/Cocoa/WebViewImpl.h:
3246         * UIProcess/Cocoa/WebViewImpl.mm:
3247         (WebKit::WebViewImpl::showSafeBrowsingWarning):
3248         * UIProcess/PageClient.h:
3249         (WebKit::PageClient::showSafeBrowsingWarning):
3250         * UIProcess/SafeBrowsingResult.h: Removed.
3251         * UIProcess/SafeBrowsingWarning.h: Copied from Source/WebKit/UIProcess/SafeBrowsingResult.h.
3252         (WebKit::SafeBrowsingWarning::create):
3253         (WebKit::SafeBrowsingWarning::title const):
3254         (WebKit::SafeBrowsingWarning::warning const):
3255         (WebKit::SafeBrowsingWarning::details const):
3256         (WebKit::SafeBrowsingResult::create): Deleted.
3257         (WebKit::SafeBrowsingResult::isPhishing const): Deleted.
3258         (WebKit::SafeBrowsingResult::isMalware const): Deleted.
3259         (WebKit::SafeBrowsingResult::isUnwantedSoftware const): Deleted.
3260         (WebKit::SafeBrowsingResult::url const): Deleted.
3261         (WebKit::SafeBrowsingResult::provider const): Deleted.
3262         (WebKit::SafeBrowsingResult::localizedProviderName const): Deleted.
3263         (WebKit::SafeBrowsingResult::malwareDetailsURLBase const): Deleted.
3264         (WebKit::SafeBrowsingResult::reportAnErrorURLBase const): Deleted.
3265         (WebKit::SafeBrowsingResult::learnMoreURL const): Deleted.
3266         (WebKit::SafeBrowsingResult::needsSafeBrowsingWarning const): Deleted.
3267         (): Deleted.
3268         * UIProcess/WebFramePolicyListenerProxy.cpp:
3269         (WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
3270         (WebKit::WebFramePolicyListenerProxy::use):
3271         * UIProcess/WebFramePolicyListenerProxy.h:
3272         * UIProcess/WebFrameProxy.cpp:
3273         (WebKit::WebFrameProxy::WebFrameProxy):
3274         (WebKit::WebFrameProxy::setUpPolicyListenerProxy):
3275         (WebKit::WebFrameProxy::didHandleContentFilterUnblockNavigation):
3276         * UIProcess/WebFrameProxy.h:
3277         (WebKit::WebFrameProxy::create):
3278         (WebKit::WebFrameProxy::page const):
3279         * UIProcess/WebPageProxy.cpp:
3280         (WebKit::WebPageProxy::swapToWebProcess):
3281         (WebKit::WebPageProxy::didCreateMainFrame):
3282         (WebKit::WebPageProxy::didCreateSubframe):
3283         (WebKit::WebPageProxy::decidePolicyForNavigationAction):
3284         (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
3285         (WebKit::WebPageProxy::decidePolicyForResponse):
3286         * UIProcess/ios/PageClientImplIOS.h:
3287         * UIProcess/ios/PageClientImplIOS.mm:
3288         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3289         * UIProcess/mac/PageClientImplMac.h:
3290         * UIProcess/mac/PageClientImplMac.mm:
3291         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3292         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3293         * WebKit.xcodeproj/project.pbxproj:
3294
3295 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3296
3297         [iOS] A few drag and drop tests are crashing after r238146
3298         https://bugs.webkit.org/show_bug.cgi?id=191617
3299
3300         Reviewed by Dean Jackson.
3301
3302         The notion of temporarily suppressing the selection assistant was introduced during iOS drag and drop
3303         development as a way of allowing both the selection view and dropped content snapshot to fade in simultaneously
3304         during a drop in an editable element. r238146 piggy-backs on this mechanism by changing selection suppression
3305         state when an element is focused, when the selection changes, and when an element is blurred, depending on
3306         whether the currently focused element is transparent.
3307
3308         However, in the case where the selection assistant is suppressed due to a running drop animation, if focus moves
3309         to an element that is not fully transparent, we end up prematurely unsuppressing the text selection assistant.
3310         This subsequently causes selection UI to immediately show up after a drop instead of animating in alongside a
3311         snapshot of the inserted document fragment, if the drop moved focus to an editable element.
3312
3313         A number of drag and drop tests on iOS exercised this codepath by dragging content into editable fields and/or
3314         moving content between editable elements in a web view. These tests began to crash due to selection views and
3315         the accompanying callout bar appearing earlier than usual, which triggers an unrelated UIKit assertion in
3316         <https://webkit.org/b/190401>.
3317
3318         This patch fixes the failing tests by refactoring our selection assistant suppression code. Instead of
3319         maintaining a single `BOOL` flag indicating whether the selection is suppressed, we use an `OptionSet` of
3320         `SuppressSelectionAssistantReason`s, which (at the moment) only include (1) a running drop animation, and (2)
3321         focusing a transparent element. The text selection assistant is considered suppressed when either of the reasons
3322         apply. This allows us to correctly handle a drop animation that occurs simultaneously as an element is focused
3323         without unsuppressing the selection assistant early, and also allows us to handle selection assistant
3324         suppression in more nuanced ways, depending on the suppression reason.
3325
3326         * UIProcess/ios/WKContentViewInteraction.h:
3327         * UIProcess/ios/WKContentViewInteraction.mm:
3328         (-[WKContentView cleanupInteraction]):
3329         (-[WKContentView _displayFormNodeInputView]):
3330
3331         Only prevent zooming to the focused element during drop if we're suppressing the selection assistant due to
3332         focusing a transparent element. In the case of a drop, we still want to allow scrolling and zooming.
3333
3334         (-[WKContentView canShowNonEmptySelectionView]):
3335         (-[WKContentView hasSelectablePositionAtPoint:]):
3336         (-[WKContentView pointIsNearMarkedText:]):
3337         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3338         (-[WKContentView _startAssistingKeyboard]):
3339         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3340         (-[WKContentView _stopAssistingNode]):
3341         (-[WKContentView _updateChangedSelection:]):
3342         (-[WKContentView _shouldSuppressSelectionCommands]):
3343         (-[WKContentView _beginSuppressingSelectionAssistantForReason:]):
3344         (-[WKContentView _stopSuppressingSelectionAssistantForReason:]):
3345
3346         Add helper methods for adding or removing selection assistant suppression reasons. When the last selection
3347         assistant suppression reason is removed, we activate the selection assistant, and conversely, when the first
3348         suppression reason is added, we deactivate the selection assistant.
3349
3350         (-[WKContentView _didConcludeEditDataInteraction:]):
3351         (-[WKContentView _didPerformDragOperation:]):
3352         (-[WKContentView dropInteraction:performDrop:]):
3353         (-[WKContentView suppressAssistantSelectionView]): Deleted.
3354         (-[WKContentView setSuppressAssistantSelectionView:]): Deleted.
3355
3356 2018-11-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3357
3358         [Cocoa] [WebKit2] Hook up some more editing actions (-_pasteAndMatchStyle:, -makeTextWritingDirectionNatural:)
3359         https://bugs.webkit.org/show_bug.cgi?id=191605
3360         <rdar://problem/45813991>
3361
3362         Reviewed by Dean Jackson.
3363
3364         Hook up a couple of editing actions on iOS and macOS. The `-pasteAndMatchStyle:` selector is privately declared
3365         in UIKit, but does not exist on macOS; as such, add `-_pasteAndMatchStyle:` as SPI on WKWebView, and
3366         additionally implement the unprefixed version, `-pasteAndMatchStyle:`, on iOS.
3367
3368         Since `-makeTextWritingDirectionNatural:` is already declared on both iOS and macOS (SPI on UIResponder and API
3369         on macOS, respectively) we simply implement the unprefixed variant on both platforms.
3370
3371         * Platform/spi/ios/UIKitSPI.h:
3372         * UIProcess/API/Cocoa/WKWebView.mm:
3373         * UIProcess/API/Cocoa/WKWebViewPrivate.h:
3374         * UIProcess/ios/WKContentViewInteraction.h:
3375         * UIProcess/ios/WKContentViewInteraction.mm:
3376         (-[WKContentView makeTextWritingDirectionNaturalForWebView:]):
3377         (-[WKContentView canPerformActionForWebView:withSender:]):
3378
3379 2018-11-14  Per Arne Vollan  <pvollan@apple.com>
3380
3381         REGRESSION (WEBPROCESS_WINDOWSERVER_BLOCKING): requestAnimationFrame Stops Completing
3382         https://bugs.webkit.org/show_bug.cgi?id=190884
3383
3384         Reviewed by Dean Jackson.
3385
3386         Since the Web page currently owns the display link on the UI process side, the display link will be
3387         deleted in the UI process when a Web page is closed. This is incorrect, since a display link can be
3388         reused between Web pages in the WebContent process. This patch moves the ownership of the UI process
3389         display links to the Web process object to address this issue. Also, the display ID of the display
3390         being updated is included in the message to the WebContent process.
3391
3392         * UIProcess/WebPageProxy.cpp:
3393         (WebKit::WebPageProxy::close):
3394         (WebKit::WebPageProxy::resetStateAfterProcessExited):
3395         * UIProcess/WebPageProxy.h:
3396         * UIProcess/WebPageProxy.messages.in:
3397         * UIProcess/WebProcessProxy.h:
3398         * UIProcess/WebProcessProxy.messages.in:
3399         * UIProcess/mac/DisplayLink.cpp:
3400         (WebKit::DisplayLink::DisplayLink):
3401         (WebKit::DisplayLink::displayLinkCallback):
3402         * UIProcess/mac/DisplayLink.h:
3403         (WebKit::DisplayLink::displayID const):
3404         * UIProcess/mac/WebPageProxyMac.mm:
3405         (WebKit::WebPageProxy::startDisplayLink): Deleted.
3406         (WebKit::WebPageProxy::stopDisplayLink): Deleted.
3407         * UIProcess/mac/WebProcessProxyMac.mm:
3408         (WebKit::WebProcessProxy::startDisplayLink):
3409         (WebKit::WebProcessProxy::stopDisplayLink):
3410         * WebProcess/WebPage/DrawingArea.h:
3411         * WebProcess/WebPage/DrawingArea.messages.in:
3412         * WebProcess/WebPage/mac/DrawingAreaMac.cpp:
3413         (WebKit::DisplayRefreshMonitorMac::create):
3414         (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
3415         (WebKit::DisplayRefreshMonitorMac::~DisplayRefreshMonitorMac):
3416         (WebKit::DisplayRefreshMonitorMac::requestRefreshCallback):
3417         (WebKit::DrawingArea::createDisplayRefreshMonitor):
3418         (WebKit::DrawingArea::displayWasRefreshed): Deleted.
3419         * WebProcess/WebProcess.h:
3420         * WebProcess/WebProcess.messages.in:
3421         * WebProcess/cocoa/WebProcessCocoa.mm:
3422         (WebKit::WebProcess::displayWasRefreshed):
3423
3424 2018-11-14  Chris Dumez  <cdumez@apple.com>
3425
3426         Client should be able to disable PSON even if the experimental feature is on by default
3427         https://bugs.webkit.org/show_bug.cgi?id=191634
3428
3429         Reviewed by Dean Jackson.
3430
3431         Instead of overriding the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag to true
3432         when the experimental is enabled, use a separate flag to store this information. If the client
3433         explicitly sets the APIProcessPoolConfiguration's m_processSwapsOnNavigation flag then we obey
3434         the client's request, otherwise, we fall back to using the state from experimental features.
3435
3436         This allows:
3437         - API tests to explicitely disable PSON / Process prewarming even if those are on by default
3438           in experimental features.
3439         - If the client does not set those flags on the APIProcessPoolConfiguration (Safari for e.g.),
3440           then the experimental feature flag still fully controls the feature.
3441
3442         * UIProcess/API/APIProcessPoolConfiguration.cpp:
3443         (API::ProcessPoolConfiguration::copy):
3444         * UIProcess/API/APIProcessPoolConfiguration.h:
3445         * UIProcess/WebProcessPool.cpp:
3446         (WebKit::WebProcessPool::createWebPage):
3447
3448 2018-11-14  Chris Dumez  <cdumez@apple.com>
3449
3450         WebKit.ApplicationManifestBasic API test is failing when enabling PSON
3451         https://bugs.webkit.org/show_bug.cgi?id=191602
3452
3453         Reviewed by Alex Christensen.
3454
3455         Add support for process swapping for a [WKWebView loadHTML:] load by storing
3456         the necessary data on the API::Navigation and doing a loadData() instead of
3457         a loadRequest() after process swapping when this data is present on the
3458         navigation.
3459
3460         * UIProcess/API/APINavigation.cpp:
3461         (API::Navigation::Navigation):
3462         * UIProcess/API/APINavigation.h:
3463         (API::Navigation::create):
3464         (API::Navigation::substituteData const):
3465         * UIProcess/WebNavigationState.cpp:
3466         (WebKit::WebNavigationState::createLoadDataNavigation):
3467         * UIProcess/WebNavigationState.h:
3468         * UIProcess/WebPageProxy.cpp:
3469         (WebKit::WebPageProxy::loadData):
3470         (WebKit::WebPageProxy::continueNavigationInNewProcess):
3471
3472 2018-11-14  Antti Koivisto  <antti@apple.com>
3473
3474         Align Mac WK2 layer flush throttling with iOS
3475         https://bugs.webkit.org/show_bug.cgi?id=191632
3476
3477         Reviewed by Zalan Bujtas.
3478
3479         Currently Mac WK2 uses WebCore side throttling implementation in RenderLayerCompositor. This code has
3480         throttling timer per-frame while the actual decision making and layer flushes itself are per page. These
3481         timers generate way more flushes than expected in presence of multiple frames. There are also bugs in how
3482         flushing state is updated when frames are created dynamically.
3483
3484         On iOS WK2 throttling is implemented on WebKit side and controlled by a per-page timer. Recent fixes also
3485         make this implementation visually fast. We should align the Mac implementation and eventually unify them.
3486
3487         This patch implements throttling in TiledCoreAnimationDrawingArea mirroring the iOS RemoteLayerTreeDrawingArea
3488         implementation. There are some adjustments for platform differences (local vs remote layers) and we continue
3489         using runloop observer for the actual flushes. Timings are as in the existing Mac code.
3490
3491         The patch appears to be a significant performance progression.
3492
3493         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
3494         * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
3495         (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
3496         (WebKit::TiledCoreAnimationDrawingArea::setLayerTreeStateIsFrozen):
3497
3498         Schedule an immediate flush when layers are unfrozen.
3499
3500         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush):
3501         (WebKit::TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlushImmediately):
3502
3503         Track pending flushes with m_hasPendingFlush bit.
3504         Delay flush if the flush throttling timer is active. Start it if we throttling but it is not active yet.
3505
3506         (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
3507
3508         Clear m_hasPendingFlush if the flush succeeded.
3509         Restart the throttling timer if we are still throttling.
3510         Manage runloop observer invalidation here instead of the caller (and stop returning value).
3511
3512         (WebKit::TiledCoreAnimationDrawingArea::layerFlushRunLoopCallback):
3513         (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
3514
3515         Returning 'true' here disables WebCore side throttling code.
3516
3517         Start or stop the throttling timer on state changes.
3518
3519         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingIsActive const):
3520
3521         This is used to control style and layout timers on WebCore side. Return false on frozen
3522         state since unfreezing depends on style and layout.
3523
3524         (WebKit::TiledCoreAnimationDrawingArea::startLayerFlushThrottlingTimer):
3525         (WebKit::TiledCoreAnimationDrawingArea::layerFlushThrottlingTimerFired):
3526
3527 2018-11-14  Chris Dumez  <cdumez@apple.com>
3528
3529         WebKit.WKHTTPCookieStoreWithoutProcessPool API test is failing with process prewarming is enabled
3530         https://bugs.webkit.org/show_bug.cgi?id=191624
3531
3532         Reviewed by Alex Christensen.
3533
3534         Stop setting the WebProcessPool's primary data store (m_websiteDataStore) to the default one in
3535         WebProcessPool::prewarmProcess(). We did not really need to, we can pass the default data store
3536         to the new WebPageProxy without having to set m_websiteDataStore. m_websiteDataStore only gets
3537         set upon constructor if thr default data store already exists or later on when creating a WebPage
3538         that uses the default data store.
3539
3540         In the case of the API test, the following was happening:
3541         1. Create an ephemeral data store EDS
3542         2. Create a WebView V1 using datastore EDS
3543         3. Do a load in V1
3544         4. Process prewarming would kick in and wrongly associated V1's process pool PP1 with the default data store
3545         5. Create/Get the default datastore and set a few cookies on it
3546         6. Create a WebView V2 using default datastore and a fresh new process pool PP2
3547         7. Do a load in V2 and expect the cookies to be there
3548
3549         In HTTPCookieStore::setCookie() that is called at step 5, we call:
3550         m_owningDataStore->processPoolForCookieStorageOperations()
3551
3552         In this case, m_owningDataStore is the default datastore and this call would previously return null because
3553         there is no WebProcessPool yet associated with the default datastore. However, with the process prewarming
3554         bug at step 4, the process pool PP1 would be returned since it was wrongly associated with the default
3555         data store. As a result, we would call setCookie() on PP1's WebCookieManagerProxy and this would fail
3556         because PP1's network process knows nothing about this session ID (it was only ever used with an ephemeral
3557         session).
3558
3559         * UIProcess/WebProcessPool.cpp:
3560         (WebKit::WebProcessPool::prewarmProcess):
3561
3562 2018-11-13  Jiewen Tan  <jiewen_tan@apple.com>
3563
3564         [WebAuthN] Support CTAP HID authenticators on macOS
3565         https://bugs.webkit.org/show_bug.cgi?id=188623
3566         <rdar://problem/43353777>
3567
3568         Reviewed by Brent Fulgham and Chris Dumez.
3569
3570         This patch introduces a primitive support of CTAP HID authenticators for WebAuthN in macOS.
3571         It involves low level HID device management&communication, high level CTAP HID authenticator
3572         management&communication, and mock testing. The above three aspects will be covered in details:
3573         1) Low level HID device management&communication: HidService&HidConnection
3574         It relies on IOHIDManager to discover appropriate hid devices by passing a matching dictionary:
3575         { PrimaryUsagePage: 0xf1d0, PrimaryUsage: 0x01}. For communication, it utilizes HID reports.
3576         To send a report, it calls IOHIDDeviceSetReport since the async version is not implemented.
3577         To recieve a report, it calls IOHIDDeviceRegisterInputReportCallback to asynchronously wait
3578         for incoming reports.
3579         Here is the corresponding reference:
3580         https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/HID/new_api_10_5/tn2187.html#//apple_ref/doc/uid/TP40000970-CH214-SW2
3581         2) High level CTAP HID authenticator management&communication: HidService&CtapHidDriver
3582         Whenever an appropriate hid device is discovered by IOHIDManager, an AuthenticatorGetInfo command
3583         is sent to the device to determine properties of the authenticator, says, which version of protocol
3584         it supports, i.e. CTAP or U2F. So far, we only support CTAP authenticators. Once the authenticator
3585         is determined to support CTAP, we then instantiate CtapHidAuthenticator which will then take care
3586         of even higher level WebAuthN requests&responses.
3587         Binaries are constructed and packaged according to the CTAP HID porotocol. CtapHidDriver takes care
3588         of concurrency and channels, i.e. allocating channel and establishing the actual request/response
3589         transaction. At the meantime, CtapHidDriver::Worker is then responsible for each single transaction.
3590         Here is the corresponding reference:
3591         https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb.
3592         3) Mock Testing: MockHidService & MockHidConnection
3593         A CTAP hid authenticator is simulated within MockHidConnection with options of specifying specific
3594         error scenarios and of course could take care of successful cases. Four stages are presented in the
3595         simulated authenticator to reflect: a) allocating channel for AuthenticatorGetInfo, b) sending
3596         AuthenticatorGetInfo, c) allocating channel for actual request, and d) sending the actual request.
3597
3598         Besides implementing the above, it also does a few other things:
3599         1) Make AuthenticatorManager::clearState asynchronous to avoid cyclic dependency:
3600         Authenticator::returnResponse => AuthenticatorManager::respondReceived => AuthenticatorManager::clearState
3601         => Authenticator::~Authenticator.
3602         2) Reorganize unified build sources to make it clear that which files are .mm and which are .cpp.
3603         3) Import LocalAuthentication.framework in LocalAuthenticationSoftLink instead of being scattered.
3604
3605         * Sources.txt:
3606         * SourcesCocoa.txt:
3607         * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
3608         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3609         (WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
3610         * UIProcess/WebAuthentication/AuthenticatorManager.cpp:
3611         (WebKit::AuthenticatorManagerInternal::collectTransports):
3612         (WebKit::AuthenticatorManager::clearStateAsync):
3613         (WebKit::AuthenticatorManager::respondReceived):
3614         (WebKit::AuthenticatorManager::initTimeOutTimer):
3615         * UIProcess/WebAuthentication/AuthenticatorManager.h:
3616         * UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
3617         (WebKit::AuthenticatorTransportService::create):
3618         (WebKit::AuthenticatorTransportService::createMock):
3619         (WebKit::AuthenticatorTransportService::startDiscovery):
3620         (WebKit::AuthenticatorTransportService::startDiscovery const): Deleted.
3621         * UIProcess/WebAuthentication/AuthenticatorTransportService.h:
3622         * UIProcess/WebAuthentication/Cocoa/HidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/AuthenticatorTransportService.h.
3623         * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: Added.
3624         (WebKit::reportReceived):
3625         (WebKit::HidConnection::HidConnection):
3626         (WebKit::HidConnection::~HidConnection):
3627         (WebKit::HidConnection::initialize):
3628         (WebKit::HidConnection::terminate):
3629         (WebKit::HidConnection::send):
3630         (WebKit::HidConnection::registerDataReceivedCallback):
3631         (WebKit::HidConnection::unregisterDataReceivedCallback):
3632         (WebKit::HidConnection::receiveReport):
3633         (WebKit::HidConnection::consumeReports):
3634         (WebKit::HidConnection::registerDataReceivedCallbackInternal):
3635         * UIProcess/WebAuthentication/Cocoa/HidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3636         * UIProcess/WebAuthentication/Cocoa/HidService.mm: Added.
3637         (WebKit::deviceAddedCallback):
3638         (WebKit::deviceRemovedCallback):
3639         (WebKit::HidService::HidService):
3640         (WebKit::HidService::~HidService):
3641         (WebKit::HidService::startDiscoveryInternal):
3642         (WebKit::HidService::platformStartDiscovery):
3643         (WebKit::HidService::createHidConnection const):
3644         (WebKit::HidService::deviceAdded):
3645         (WebKit::HidService::continueAddDeviceAfterGetInfo):
3646         * UIProcess/WebAuthentication/Cocoa/LocalAuthenticationSoftLink.h:
3647         * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm:
3648         * UIProcess/WebAuthentication/Cocoa/LocalService.h:
3649         * UIProcess/WebAuthentication/Cocoa/LocalService.mm:
3650         (WebKit::LocalService::startDiscoveryInternal):
3651         (WebKit::LocalService::startDiscoveryInternal const): Deleted.
3652         * UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp:
3653         (WebKit::MockAuthenticatorManager::respondReceivedInternal):
3654         * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: Added.
3655         (WebKit::MockHidConnection::MockHidConnection):
3656         (WebKit::MockHidConnection::initialize):
3657         (WebKit::MockHidConnection::terminate):
3658         (WebKit::MockHidConnection::send):
3659         (WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
3660         (WebKit::MockHidConnection::assembleRequest):
3661         (WebKit::MockHidConnection::parseRequest):
3662         (WebKit::MockHidConnection::feedReports):
3663         (WebKit::MockHidConnection::stagesMatch const):
3664         (WebKit::MockHidConnection::shouldContinueFeedReports):
3665         (WebKit::MockHidConnection::continueFeedReports):
3666         * UIProcess/WebAuthentication/Mock/MockHidConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3667         * UIProcess/WebAuthentication/Mock/MockHidService.cpp: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3668         (WebKit::MockHidService::MockHidService):
3669         (WebKit::MockHidService::platformStartDiscovery):
3670         (WebKit::MockHidService::createHidConnection const):
3671         * UIProcess/WebAuthentication/Mock/MockHidService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalConnection.h.
3672         * UIProcess/WebAuthentication/Mock/MockLocalConnection.h:
3673         * UIProcess/WebAuthentication/Mock/MockLocalConnection.mm:
3674         * UIProcess/WebAuthentication/Mock/MockLocalService.mm: Renamed from Source/WebKit/UIProcess/WebAuthentication/Mock/MockLocalService.cpp.
3675         (WebKit::MockLocalService::MockLocalService):
3676         (WebKit::MockLocalService::platformStartDiscovery const):
3677         (WebKit::MockLocalService::createLocalConnection const):
3678         * UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
3679         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp: Added.
3680         (WebKit::CtapHidAuthenticator::CtapHidAuthenticator):
3681         (WebKit::CtapHidAuthenticator::makeCredential):
3682         (WebKit::CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived const):
3683         (WebKit::CtapHidAuthenticator::getAssertion):
3684         (WebKit::CtapHidAuthenticator::continueGetAssertionAfterResponseReceived const):
3685         * UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalService.h.
3686         * UIProcess/WebAuthentication/fido/CtapHidDriver.cpp: Added.
3687         (WebKit::CtapHidDriver::Worker::Worker):
3688         (WebKit::CtapHidDriver::Worker::~Worker):
3689         (WebKit::CtapHidDriver::Worker::transact):
3690         (WebKit::CtapHidDriver::Worker::write):
3691         (WebKit::CtapHidDriver::Worker::read):
3692         (WebKit::CtapHidDriver::Worker::returnMessage):
3693         (WebKit::CtapHidDriver::CtapHidDriver):
3694         (WebKit::CtapHidDriver::transact):
3695         (WebKit::CtapHidDriver::continueAfterChannelAllocated):
3696         (WebKit::CtapHidDriver::continueAfterResponseReceived):
3697         (WebKit::CtapHidDriver::returnResponse):
3698         * UIProcess/WebAuthentication/fido/CtapHidDriver.h: Added.
3699         * UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:
3700         * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
3701         * WebKit.xcodeproj/project.pbxproj:
3702
3703 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3704
3705         Unreviewed correction to previous build fix to avoid any internal/downstream repercussions.
3706
3707         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3708
3709 2018-11-13  Ross Kirsling  <ross.kirsling@sony.com>
3710
3711         Unreviewed GTK/WPE build fix for r238159. 
3712
3713         * WebProcess/Network/webrtc/LibWebRTCProvider.h:
3714
3715 2018-11-13  Timothy Hatcher  <timothy@apple.com>
3716
3717         Use a light scrollbar for transparent web views in dark mode.
3718         https://bugs.webkit.org/show_bug.cgi?id=191559
3719         rdar://problem/46000489
3720
3721         Reviewed by Dean Jackson.
3722
3723         * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
3724         (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance().
3725         * WebProcess/WebPage/WebPage.cpp:
3726         (WebKit::WebPage::drawRect): Ditto.
3727
3728 2018-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3729
3730         [iOS] Do not show selection UI for editable elements with opacity near zero
3731         https://bugs.webkit.org/show_bug.cgi?id=191442
3732         <rdar://problem/45958625>
3733
3734         Reviewed by Simon Fraser.
3735
3736         Add support for suppressing native selection UI (for instance, selection highlight views, selection handles, and
3737         selection-related gestures) when the selection is inside a transparent editable element. This helps maintain
3738         compatibility with text editors that work by capturing key events and input events hidden contenteditable
3739         elements, and reflect these changes in different document or different part of the document.
3740
3741         Since selection UI is rendered in the UI process on iOS using element geometry propagated from the web process,
3742         selection rendering is entirely decoupled from the process of painting in the web process. This means that if
3743         the editable root has an opacity of 0, we would correctly hide the caret and selection on macOS, but draw over
3744         the transparent element on iOS. When these hidden editable elements are focused, this often results in unwanted
3745         behaviors, such as double caret painting, native and custom selection UI from the page being drawn on top of one
3746         another, and the ability to change selection via tap and loupe gestures within hidden text.
3747
3748         To fix this, we compute whether the focused element is transparent when an element is focused, or when the
3749         selection changes, and send this information over to the UI process via `AssistedNodeInformation` and
3750         `EditorState`. In the UI process, we then respect this information by suppressing the selection assistant if the
3751         focused element is transparent; this disables showing and laying out selection views, as well as gestures
3752         associated with selection overlays. However, this still allows for contextual autocorrection and spell checking.
3753
3754         * Shared/AssistedNodeInformation.cpp:
3755         (WebKit::AssistedNodeInformation::encode const):
3756         (WebKit::AssistedNodeInformation::decode):
3757         * Shared/AssistedNodeInformation.h:
3758         * Shared/EditorState.cpp:
3759         (WebKit::EditorState::PostLayoutData::encode const):
3760         (WebKit::EditorState::PostLayoutData::decode):
3761         * Shared/EditorState.h:
3762
3763         Add `elementIsTransparent` flags, and also add boilerplate IPC code.
3764
3765         * UIProcess/ios/WKContentViewInteraction.mm:
3766         (-[WKContentView _displayFormNodeInputView]):
3767
3768         Prevent zooming to the focused element if the focused element is hidden.
3769
3770         (-[WKContentView hasSelectablePositionAtPoint:]):
3771         (-[WKContentView pointIsNearMarkedText:]):
3772         (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
3773
3774         Don't allow these text interaction gestures to begin while suppressing the selection assistant.
3775
3776         (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
3777
3778         When an element is focused, begin suppressing the selection assistant if the element is fully transparent.
3779
3780         (-[WKContentView _stopAssistingNode]):
3781
3782         When the focused element is blurred, reset state by ending selection assistant suppression (additionally
3783         reactivating the selection assistant if needed). This ensures that selection in non-editable text isn't broken
3784         after focusing a hidden editable element.
3785
3786         (-[WKContentView _updateChangedSelection:]):
3787
3788         If needed, suppress or un-suppress the selection assistant when the selection changes. On certain rich text
3789         editors, a combination of custom selection UI and native selection UI is used. For instance, on Microsoft Office
3790         365, caret selections are rendered using the native caret view, but as soon as the selection becomes ranged, the
3791         editable root becomes fully transparent, and Office's selection UI takes over.
3792
3793         (-[WKContentView _shouldSuppressSelectionCommands]):
3794
3795         Override this UIKit SPI hook to suppress selection commands (e.g. the callout bar) when suppressing the
3796         selection assistant.
3797
3798         * WebProcess/WebPage/ios/WebPageIOS.mm:
3799         (WebKit::WebPage::platformEditorState const):
3800         (WebKit::WebPage::getAssistedNodeInformation):
3801
3802         Compute and set `elementIsTransparent` using the assisted node.
3803
3804 2018-11-13  Ryan Haddad  <ryanhaddad@apple.com>
3805
3806         Unreviewed, rolling out r238137.
3807
3808         Introduced API test failures on macOS.
3809
3810         Reverted changeset:
3811
3812         "Enable process swap on cross-site navigation by default on
3813         macOS"
3814         https://bugs.webkit.org/show_bug.cgi?id=191572
3815         https://trac.webkit.org/changeset/238137
3816
3817 2018-11-13  Ryosuke Niwa  <rniwa@webkit.org>
3818
3819         Enable process swap on cross-site navigation by default on macOS
3820         https://bugs.webkit.org/show_bug.cgi?id=191572
3821
3822         Reviewed by Chris Dumez.
3823
3824         Enabled the feature by default on macOS.
3825
3826         * Shared/WebPreferences.yaml:
3827         * Shared/WebPreferencesDefaultValues.h:
3828
3829 2018-11-13  Daniel Bates  <dabates@apple.com>
3830
3831         Consolidate WebKit UIKitSPI.h and UIKitTestSPI.h
3832         https://bugs.webkit.org/show_bug.cgi?id=173341
3833         <rdar://problem/32752890>
3834
3835         Reviewed by Simon Fraser.
3836
3837         * Platform/spi/ios/UIKitSPI.h:
3838
3839 2018-11-13  Alex Christensen  <achristensen@webkit.org>
3840
3841         Fix internal builds after r238115
3842         https://bugs.webkit.org/show_bug.cgi?id=191441
3843
3844         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3845         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3846         Some iOS-like operating systems don't have safe browsing.  Don't use symbols that don't exist on those systems.
3847
3848 2018-11-13  Ali Juma  <ajuma@chromium.org>
3849
3850         Turn Intersection Observer on by default
3851         https://bugs.webkit.org/show_bug.cgi?id=191569
3852
3853         Reviewed by Simon Fraser.
3854
3855         * Shared/WebPreferences.yaml:
3856
3857 2018-11-12  Darshan Kadu  <darsh7807@gmail.com>
3858
3859         Implement Cache API support for WPE/GTK
3860         https://bugs.webkit.org/show_bug.cgi?id=178316
3861
3862         Reviewed by Michael Catanzaro.
3863
3864         Added a new API function WKWebsiteDataStoreSetCacheStoragePerOriginQuota which sets the
3865         cache limit per origin.
3866
3867         * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
3868         (WKWebsiteDataStoreSetCacheStoragePerOriginQuota):
3869         * UIProcess/API/C/WKWebsiteDataStoreRef.h:
3870
3871 2018-11-12  Alex Christensen  <achristensen@webkit.org>
3872
3873         [iOS] Implement safe browsing in WebKit
3874         https://bugs.webkit.org/show_bug.cgi?id=191441
3875
3876         Reviewed by Tim Horton.
3877
3878         In r237863 I implemented this for Mac.  This refines the UI and implements it for iOS.
3879
3880         * Shared/WebPreferences.yaml:
3881         * Shared/WebPreferencesDefaultValues.h:
3882         * UIProcess/API/C/mac/WKContextPrivateMac.mm:
3883         (WKContextHandlesSafeBrowsing):
3884         * UIProcess/API/Cocoa/WKWebView.mm:
3885         (-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
3886         (-[WKWebView _clearSafeBrowsingWarning]):
3887         (-[WKWebView layoutSubviews]):
3888         (-[WKWebView setFrameSize:]):
3889         (+[WKWebView _handlesSafeBrowsing]):
3890         (-[WKWebView _safeBrowsingWarningForTesting]):
3891         * UIProcess/API/Cocoa/WKWebViewInternal.h:
3892         * UIProcess/Cocoa/PageClientImplCocoa.h:
3893         * UIProcess/Cocoa/PageClientImplCocoa.mm:
3894         (WebKit::PageClientImplCocoa::allocFileWrapperInstance const):
3895         (WebKit::PageClientImplCocoa::serializableFileWrapperClasses const):
3896         * UIProcess/Cocoa/WKSafeBrowsingWarning.h:
3897         * UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
3898         (confirmMalwareSentinel):
3899         (visitUnsafeWebsiteSentinel):
3900         (colorForItem):
3901         (addLinkAndReplace):
3902         (-[WKSafeBrowsingExclamationPoint drawRect:]):
3903         (makeButton):
3904         (makeTitleLabel):
3905         (setBackground):
3906         (-[WKSafeBrowsingWarning initWithFrame:safeBrowsingResult:completionHandler:]):
3907         (-[WKSafeBrowsingWarning addContent]):
3908         (-[WKSafeBrowsingWarning showDetailsClicked]):
3909         (-[WKSafeBrowsingWarning layoutText]):
3910         (-[WKSafeBrowsingWarning textView:clickedOnLink:atIndex:]):
3911         (-[WKSafeBrowsingWarning layout]):
3912         (-[WKSafeBrowsingWarning layoutSubviews]):
3913         (-[WKSafeBrowsingWarning textView:shouldInteractWithURL:inRange:interaction:]):
3914         (-[WKSafeBrowsingWarning didMoveToWindow]):
3915         (-[WKSafeBrowsingWarning clickedOnLink:]):
3916         (-[WKSafeBrowsingTextView initWithAttributedString:forWarning:]):
3917         (-[WKSafeBrowsingTextView intrinsicContentSize]):
3918         (colorNamed): Deleted.
3919         (+[WKSafeBrowsingTextView viewWithAttributedString:linkTarget:]): Deleted.
3920         (+[WKSafeBrowsingTextView viewWithString:]): Deleted.
3921         (-[WKSafeBrowsingTextView clickedOnLink:atIndex:]): Deleted.
3922         * UIProcess/ios/PageClientImplIOS.mm:
3923         (WebKit::PageClientImpl::isViewWindowActive):
3924         (WebKit::PageClientImpl::isViewFocused):
3925         (WebKit::PageClientImpl::isViewVisible):
3926         (WebKit::PageClientImpl::isViewInWindow):
3927         (WebKit::PageClientImpl::decidePolicyForGeolocationPermissionRequest):
3928         (WebKit::PageClientImpl::enterAcceleratedCompositingMode):
3929         (WebKit::PageClientImpl::showSafeBrowsingWarning):
3930         (WebKit::PageClientImpl::clearSafeBrowsingWarning):
3931         (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
3932         (WebKit::PageClientImpl::navigationGestureDidBegin):
3933         (WebKit::PageClientImpl::navigationGestureWillEnd):
3934         (WebKit::PageClientImpl::navigationGestureDidEnd):
3935         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
3936         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
3937         (WebKit::PageClientImpl::requestPasswordForQuickLookDocument):
3938         * UIProcess/mac/PageClientImplMac.mm:
3939         (WebKit::PageClientImpl::showShareSheet):
3940         (WebKit::PageClientImpl::navigationGestureDidBegin):
3941         (WebKit::PageClientImpl::navigationGestureWillEnd):
3942         (WebKit::PageClientImpl::navigationGestureDidEnd):
3943         (WebKit::PageClientImpl::willRecordNavigationSnapshot):
3944         (WebKit::PageClientImpl::didRemoveNavigationGestureSnapshot):
3945
3946 2018-11-12  Tim Horton  <timothy_horton@apple.com>
3947
3948         Make it possible to edit images inline
3949         https://bugs.webkit.org/show_bug.cgi?id=191352
3950         <rdar://problem/30107985>
3951
3952         Reviewed by Dean Jackson.
3953
3954         * Platform/spi/ios/PencilKitSPI.h: Added.
3955         * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
3956         (WebKit::RemoteLayerBackingStore::drawInContext):
3957         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
3958         * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
3959         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::LayerCreationProperties):
3960         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
3961         (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
3962         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
3963         (WebKit::GraphicsLayerCARemote::createPlatformCALayerForEmbeddedView):
3964         * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
3965         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
3966         (WebKit::PlatformCALayerRemote::createForEmbeddedView):
3967         (WebKit::PlatformCALayerRemote::PlatformCALayerRemote):
3968         (WebKit::PlatformCALayerRemote::embeddedViewID const):
3969         * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
3970         * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
3971  &