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