[CMake] Use find_package for zlib
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
2
3         [CMake] Use find_package for zlib
4         https://bugs.webkit.org/show_bug.cgi?id=176075
5
6         Reviewed by Alex Christensen.
7
8         No new tests. No change in behavior.
9
10         * CMakeLists.txt:
11         * PlatformAppleWin.cmake:
12         * PlatformMac.cmake:
13         * PlatformWinCairo.cmake:
14
15 2017-08-29  Devin Rousso  <webkit@devinrousso.com>
16
17         CallTracingCallback should ignore `readonly attribute`
18         https://bugs.webkit.org/show_bug.cgi?id=176070
19
20         Reviewed by Matt Baker.
21
22         Update existing tests to remove calls to existing readonly attributes.
23
24         * bindings/scripts/CodeGeneratorJS.pm:
25         (GenerateAttributeGetterBodyDefinition):
26         If the attribute is marked `readonly` do not add logic for the `CallTracingCallback`.
27
28         * bindings/scripts/test/TestCallTracer.idl:
29         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
30         (WebCore::JSTestCallTracerConstructor::initializeProperties):
31         (WebCore::jsTestCallTracerTestReadonlyAttributeGetter):
32         (WebCore::jsTestCallTracerTestReadonlyAttribute):
33
34 2017-08-29  Said Abou-Hallawa  <sabouhallawa@apple.com>
35
36         Assertion failure when opening a file with a missing tag closing bracket
37         https://bugs.webkit.org/show_bug.cgi?id=176061
38
39         Reviewed by Darin Adler.
40
41         If a tag is missing its closing bracket, the tokenizer just needs to advance()
42         the character position without checking m_currentCharacter != '\n'. Newline
43         character is a valid ending for partially closed tags.
44
45         Test: fast/tokenizer/missing-script-tag-closing-bracket.html
46
47         * html/parser/HTMLTokenizer.cpp:
48         (WebCore::HTMLTokenizer::commitToPartialEndTag):
49
50 2017-08-29  Brady Eidson  <beidson@apple.com>
51
52         Rename "potentionally trustworthy" to "potentially trustworthy"
53         https://bugs.webkit.org/show_bug.cgi?id=176081
54
55         Reviewed by Daniel Bates.
56
57         The Secure Context spec refers to this as "potentially trustworthy"
58         
59         It's possible that this was done potentionally, but we should follow the spec to alleviate confusion.
60
61         * dom/Document.cpp:
62         (WebCore::Document::isSecureContext const):
63         * page/SecurityOrigin.cpp:
64         (WebCore::shouldTreatAsPotentiallyTrustworthy):
65         (WebCore::shouldTreatAsPotentionallyTrustworthy): Deleted.
66         * page/SecurityOrigin.h:
67         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
68         (WebCore::SecurityOrigin::isPotentionallyTrustworthy const): Deleted.
69         * workers/WorkerGlobalScope.cpp:
70         (WebCore::WorkerGlobalScope::isSecureContext const):
71
72 2017-08-29  Youenn Fablet  <youenn@apple.com>
73
74         Add support for FetchRequest.body
75         https://bugs.webkit.org/show_bug.cgi?id=176066
76
77         Reviewed by Alex Christensen.
78
79         Covered by existing tests.
80
81         Adding support for body attribute getter for FetchRequest.
82         To do so, FetchRequest will need to create a ReadableStream.
83         Adding support for DOM based creation of ReadableStream and conversion to JS values.
84         Small refactoring to make names more consistent.
85
86         * CMakeLists.txt:
87         * Modules/beacon/NavigatorBeacon.cpp:
88         (WebCore::NavigatorBeacon::sendBeacon):
89         * Modules/cache/Cache.cpp:
90         (WebCore::Cache::put):
91         * Modules/fetch/FetchBody.cpp:
92         (WebCore::FetchBody::extract):
93         * Modules/fetch/FetchBody.h:
94         (WebCore::FetchBody::hasReadableStream const):
95         (WebCore::FetchBody::readableStream):
96         (WebCore::FetchBody::setReadableStream):
97         (WebCore::FetchBody::FetchBody):
98         (WebCore::FetchBody::isReadableStream const): Deleted.
99         (WebCore::FetchBody::setAsReadableStream): Deleted.
100         * Modules/fetch/FetchBody.idl:
101         * Modules/fetch/FetchBodyOwner.cpp:
102         (WebCore::FetchBodyOwner::readableStream):
103         * Modules/fetch/FetchBodyOwner.h:
104         (WebCore::FetchBodyOwner::hasReadableStreamBody const):
105         (WebCore::FetchBodyOwner::isReadableStreamBody const): Deleted.
106         * Modules/fetch/FetchRequest.cpp:
107         (WebCore::FetchRequest::setBody):
108         * Modules/fetch/FetchRequest.h:
109         * Modules/fetch/FetchResponse.cpp:
110         (WebCore::FetchResponse::setBodyAsReadableStream):
111         (WebCore::FetchResponse::fetch):
112         * Modules/fetch/FetchResponse.h:
113         * WebCore.xcodeproj/project.pbxproj:
114         * bindings/js/ReadableStream.h:
115         (WebCore::JSConverter<IDLInterface<ReadableStream>>::convert):
116
117 2017-08-29  Yusuke Suzuki  <utatane.tea@gmail.com>
118
119         [JSC] Use reifying system for "name" property of builtin JSFunction
120         https://bugs.webkit.org/show_bug.cgi?id=175260
121
122         Reviewed by Saam Barati.
123
124         Use @getter for JSBuiltin getters.
125
126         * Modules/fetch/FetchResponse.js:
127         (bodyUsed): Deleted.
128         (body): Deleted.
129         * Modules/streams/ReadableByteStreamController.js:
130         (byobRequest): Deleted.
131         (desiredSize): Deleted.
132         * Modules/streams/ReadableStream.js:
133         (locked): Deleted.
134         * Modules/streams/ReadableStreamBYOBReader.js:
135         (closed): Deleted.
136         * Modules/streams/ReadableStreamBYOBRequest.js:
137         (view): Deleted.
138         * Modules/streams/ReadableStreamDefaultController.js:
139         (desiredSize): Deleted.
140         * Modules/streams/ReadableStreamDefaultReader.js:
141         (closed): Deleted.
142         * Modules/streams/WritableStream.js:
143         (closed): Deleted.
144         (ready): Deleted.
145         (state): Deleted.
146         * bindings/js/JSDOMBuiltinConstructor.h:
147         (WebCore::JSDOMBuiltinConstructor<JSClass>::finishCreation):
148
149 2017-08-29  Andy Estes  <aestes@apple.com>
150
151         REGRESSION (r215290): "Where From" metadata is empty when dragging an image out of Safari
152         https://bugs.webkit.org/show_bug.cgi?id=176068
153
154         Reviewed by Wenson Hsieh.
155
156         If you drag an image out of Safari, drop it on the Desktop, and open "Get Info", there is a
157         "Where from:" field under "More Info" that should list the image's URL. After r215290, this
158         field is blank due to a mixup with the string passed to URLWithUserTypedString().
159
160         Fix this by passing metadataURLString to URLWithUserTypedString() instead of urlString.
161
162         Not possible to reliably test this since WebKit adds metadata on a global concurrent queue.
163
164         * platform/mac/FileSystemMac.mm:
165         (WebCore::setMetadataURL):
166
167 2017-08-29  Youenn Fablet  <youenn@apple.com>
168
169         CacheStorage does not need to sort its caches
170         https://bugs.webkit.org/show_bug.cgi?id=176059
171
172         Reviewed by Chris Dumez.
173
174         Covered by existing tests.
175
176         * Modules/cache/CacheStorage.cpp:
177         (WebCore::CacheStorage::retrieveCaches):
178
179 2017-08-29  Youenn Fablet  <youenn@apple.com>
180
181         Setting the cache storage engine root path according the session WebsiteDataStore
182         https://bugs.webkit.org/show_bug.cgi?id=176055
183
184         Reviewed by Alex Christensen.
185
186         No test right now as the engine is not making any read/write operations.
187
188         * platform/network/NetworkStorageSession.h:
189         (WebCore::NetworkStorageSession::cacheStorageDirectory const):
190         (WebCore::NetworkStorageSession::setCacheStorageDirectory):
191
192 2017-08-29  Don Olmstead  <don.olmstead@sony.com>
193
194         [CMake] Use find_package for libxml2 and libxstl
195         https://bugs.webkit.org/show_bug.cgi?id=176042
196
197         Reviewed by Konstantin Tokarev.
198
199         No new tests. No change in behavior.
200
201         * CMakeLists.txt:
202         * PlatformGTK.cmake:
203         * PlatformWPE.cmake:
204         * PlatformWinCairo.cmake:
205
206 2017-08-29  Daniel Bates  <dabates@apple.com>
207
208         CacheQueryOptions::isolatedCopy() copies the cache name twice
209         https://bugs.webkit.org/show_bug.cgi?id=175974
210
211         Reviewed by Youenn Fablet.
212
213         Currently CacheQueryOptions has a user-defined constructor that calls String.isolatedCopy()
214         on the passed cache name. CacheQueryOptions::isolatedCopy() also calls String.isolatedCopy()
215         on the cache name before passing the result to the user-defined constructor; => we malloc
216         and copy the cache name twice. Ideally we would remove the user-defined constructors and
217         have callers use aggregate initializer syntax to instantiate a CacheQueryOptions. Unfortunately
218         we cannot do this until we upgrade from Visual Studio 2015 to Visual Studio 2017 as the former
219         does not support non-static data member initializers (NSDMI) for aggregates and CacheQueryOptions
220         has some. Therefore we modify the user-defined, non-default, constructor to take a String&&
221         and conditionally compile the the constructors when building with compilers that do not
222         support NSDMI for aggregates.
223
224         * Modules/cache/CacheQueryOptions.h:
225         (WebCore::CacheQueryOptions::CacheQueryOptions):
226
227 2017-08-29  Youenn Fablet  <youenn@apple.com>
228
229         CanvasCaptureMediaStreamTrack clone is not a CanvasCaptureMediaStreamTrack
230         https://bugs.webkit.org/show_bug.cgi?id=176036
231
232         Reviewed by Eric Carlson.
233
234         Covered by existing tests.
235
236         Instead of creating a MediaStreamTrack clone when cloning a CanvasCaptureMediaStreamTrack,
237         we are now creating a CanvasCaptureMediaStreamTrack.
238         This allows exposing the expected methods and having the expected functionality.
239
240         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
241         (WebCore::CanvasCaptureMediaStreamTrack::clone):
242         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
243         * Modules/mediastream/MediaStreamTrack.cpp:
244         (WebCore::MediaStreamTrack::clone):
245         * Modules/mediastream/MediaStreamTrack.h:
246
247 2017-08-29  Chris Dumez  <cdumez@apple.com>
248
249         Add initial support for dataTransferItem.webkitGetAsEntry()
250         https://bugs.webkit.org/show_bug.cgi?id=176038
251         <rdar://problem/34121095>
252
253         Reviewed by Wenson Hsieh.
254
255         Add initial support for dataTransferItem.webkitGetAsEntry() as per:
256         - https://wicg.github.io/entries-api/#html-data
257
258         The method works as expected and returns a FileSystemEntry. The entry
259         can be either a file or a directory. All of the attributes exposed on
260         the FileSystemEntry return correct values.
261
262         What remains to be implemented for this new API to actually be useful:
263         - directory.getFile() / directory.getDirectory()
264         - file.file()
265         - entry.getParent()
266         - directoryReader.readEntries()
267
268         Test: editing/pasteboard/datatransfer-items-drop-getAsEntry.html
269
270         * CMakeLists.txt:
271         * DerivedSources.make:
272         * WebCore.xcodeproj/project.pbxproj:
273         * bindings/js/JSBindingsAllInOne.cpp:
274         Add new files to projects.
275
276         * Modules/entriesapi/DOMFileSystem.cpp:
277         (WebCore::DOMFileSystem::DOMFileSystem):
278         * Modules/entriesapi/DOMFileSystem.h:
279         (WebCore::DOMFileSystem::create):
280         DOMFileSystem factory now takes a name parameter. This name is a UUID, as suggested in
281         the specification and implemented by Firefox.
282
283         * Modules/entriesapi/ErrorCallback.cpp: Added.
284         * Modules/entriesapi/ErrorCallback.h:
285         Add scheduleCallback() convenience method as we often need to call this callback
286         asynchronously.
287
288         * Modules/entriesapi/FileSystemDirectoryEntry.cpp:
289         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
290         (WebCore::FileSystemDirectoryEntry::createReader):
291         (WebCore::FileSystemDirectoryEntry::getFile):
292         (WebCore::FileSystemDirectoryEntry::getDirectory):
293         * Modules/entriesapi/FileSystemDirectoryEntry.h:
294         - Add implementation for createReader().
295         - Update getFile() / getDirectory() to call the error callback for now as they are
296           unimplemented.
297         - Have the factory take the virtual path of the entry so that it can be
298           exposed via the fullPath attribute in IDL.
299
300         * Modules/entriesapi/FileSystemDirectoryEntry.idl:
301         Expose createReader() now that we have stubs for FileSystemDirectoryReader.
302
303         * Modules/entriesapi/FileSystemDirectoryReader.cpp: Added.
304         * Modules/entriesapi/FileSystemDirectoryReader.h: Added.
305         * Modules/entriesapi/FileSystemDirectoryReader.idl: Added.
306         * Modules/entriesapi/FileSystemEntriesCallback.cpp: Added.
307         * Modules/entriesapi/FileSystemEntriesCallback.h: Added.
308         * Modules/entriesapi/FileSystemEntriesCallback.idl: Added.
309         Land stubs for FileSystemDirectoryReader and its FileSystemEntriesCallback.
310
311         * Modules/entriesapi/FileSystemEntry.cpp:
312         (WebCore::FileSystemEntry::FileSystemEntry):
313         * Modules/entriesapi/FileSystemEntry.h:
314         (WebCore::FileSystemEntry::virtualPath const):
315         * Modules/entriesapi/FileSystemEntry.idl:
316         Update constructor to take a virtual path, which is exposed via fullPath
317         attribute in IDL.
318
319         * Modules/entriesapi/FileSystemFileEntry.cpp:
320         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
321         (WebCore::FileSystemFileEntry::file):
322         * Modules/entriesapi/FileSystemFileEntry.h:
323         (isType):
324         * Modules/entriesapi/FileSystemFileEntry.idl:
325         - Update file() to call the error callback for now as they are
326           unimplemented.
327         - Have the factory take the virtual path of the entry so that it can be
328           exposed via the fullPath attribute in IDL.
329
330         * bindings/js/JSFileSystemEntryCustom.cpp: Added.
331         (WebCore::toJSNewlyCreated):
332         (WebCore::toJS):
333         Add custom implementation of FileSystemEntry's toJS() function. This is
334         needed because FileSystemEntry has 2 subclasses and we need to type check
335         at runtime to construct the right wrapper.
336
337         * dom/DataTransferItem.cpp:
338         (WebCore::DataTransferItem::getAsEntry const):
339         * dom/DataTransferItem.h:
340         * dom/DataTransferItem.idl:
341         Add initial implementation for getAsEntry(), currently exposed as
342         webkitGetAsEntry().
343
344         * dom/DataTransferItemList.cpp:
345         (WebCore::DataTransferItemList::ensureItems const):
346         Construct a DataTransferItem if the file is a directory now that we
347         support getAsEntry().
348
349         * fileapi/File.cpp:
350         (WebCore::File::isDirectory const):
351         * fileapi/File.h:
352         Add convenience method to query if a File is a directory.
353
354 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
355
356         [WebCrypto] Push WorkQueue dispatches for HKDF, HMAC, PBKDF2 algorithms into shared code
357         https://bugs.webkit.org/show_bug.cgi?id=175620
358
359         Reviewed by Jiewen Tan.
360
361         Push the WorkQueue dispatch code and other code duplicated between the
362         Mac and libgcrypt implementations of Web Crypto into the shared layer.
363         This patch focuses on the HKDF, HMAC and PBKDF2 algorithms.
364
365         Functions with platform-specific implementations that are invoked from
366         these asynchronous dispatches are made static and return an ExceptionOr
367         value. CryptoAlgorithmParameters objects are passed through non-const
368         references because data getters could lazily construct the underlying
369         Vector objects. CryptoKey objects are passed through const references.
370         Implementations can then manually retrieve and further validate any key
371         or parameter data, as required for that specific implementation. Input
372         data is passed through const references to the original Vector objects.
373
374         No new tests -- no changes in behavior that's covered by existing tests.
375
376         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
377         (WebCore::CryptoAlgorithmHKDF::deriveBits):
378         * crypto/algorithms/CryptoAlgorithmHKDF.h:
379         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
380         (WebCore::CryptoAlgorithmHMAC::sign):
381         (WebCore::CryptoAlgorithmHMAC::verify):
382         * crypto/algorithms/CryptoAlgorithmHMAC.h:
383         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
384         (WebCore::CryptoAlgorithmPBKDF2::deriveBits):
385         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
386         * crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp:
387         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
388         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
389         (WebCore::CryptoAlgorithmHMAC::platformSign):
390         (WebCore::CryptoAlgorithmHMAC::platformVerify):
391         * crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp:
392         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
393         * crypto/mac/CryptoAlgorithmHKDFMac.cpp:
394         (WebCore::CryptoAlgorithmHKDF::platformDeriveBits):
395         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
396         (WebCore::CryptoAlgorithmHMAC::platformSign):
397         (WebCore::CryptoAlgorithmHMAC::platformVerify):
398         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
399         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
400
401 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
402
403         [WebCrypto] Push WorkQueue dispatches for EC algorithms into shared code
404         https://bugs.webkit.org/show_bug.cgi?id=175619
405
406         Reviewed by Jiewen Tan.
407
408         Push the WorkQueue dispatch code duplicated between the Mac and libgcrypt
409         implementations of Web Crypto into the shared layer. This patch focuses on
410         the EC-based algorithms.
411
412         Functions with platform-specific implementations that are invoked from
413         these asynchronous dispatches are made static and return an ExceptionOr or
414         std::optional value. CryptoKey and CryptoAlgorithmParameters objects are
415         passed to those through const references. Input data is passed through
416         const references to the original Vector objects.
417
418         No new tests -- no changes in behavior that's covered by existing tests.
419
420         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
421         (WebCore::CryptoAlgorithmECDH::deriveBits):
422         * crypto/algorithms/CryptoAlgorithmECDH.h:
423         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
424         (WebCore::CryptoAlgorithmECDSA::sign):
425         (WebCore::CryptoAlgorithmECDSA::verify):
426         * crypto/algorithms/CryptoAlgorithmECDSA.h:
427         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
428         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
429         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
430         (WebCore::CryptoAlgorithmECDSA::platformSign):
431         (WebCore::CryptoAlgorithmECDSA::platformVerify):
432         * crypto/keys/CryptoKeyEC.h:
433         * crypto/mac/CryptoAlgorithmECDHMac.cpp:
434         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
435         * crypto/mac/CryptoAlgorithmECDSAMac.cpp:
436         (WebCore::CryptoAlgorithmECDSA::platformSign):
437         (WebCore::CryptoAlgorithmECDSA::platformVerify):
438
439 2017-08-19  Sergio Villar Senin  <svillar@igalia.com>
440
441         [SVG] Leak in SVGAnimatedListPropertyTearOff
442         https://bugs.webkit.org/show_bug.cgi?id=172545
443
444         Reviewed by Darin Adler.
445
446         SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
447         SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
448         reference to SVGAnimatedProperty.
449
450         When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
451         SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
452         SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
453         is going to be added to. This effectively creates a reference cycle between the
454         SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.
455
456         In order to effectively break the cycle without freeing too many wrappers we should take two
457         measures:
458         1) Break the reference cycle by storing raw pointers in the m_wrappers Vector
459         2) Remove the ListItemTearOff which is being deleted (it notifies the animated property by
460         calling propertyWillBeDeleted) from the m_wrappers Vector.
461
462         This is a re-land of r219334 which caused early releases of custom data attribute objects
463         added to SVG elements (wkb.ug/175023).
464
465         Tests: svg/animations/animation-leak-list-property-instances.html
466                svg/dom/SVGAnimatedListPropertyTearOff-crash-2.html
467                svg/dom/SVGAnimatedListPropertyTearOff-crash.html
468                svg/dom/SVGAnimatedListPropertyTearOff-leak.html
469
470         * svg/properties/SVGAnimatedListPropertyTearOff.h:
471         * svg/properties/SVGListProperty.h:
472         (WebCore::SVGListProperty::getItemValuesAndWrappers):
473         * svg/properties/SVGListPropertyTearOff.h:
474         (WebCore::SVGListPropertyTearOff::removeItemFromList):
475
476 2017-08-29  Andy Estes  <aestes@apple.com>
477
478         [Mac] Upstream WKSetMetadataURL() from WebKitSystemInterface
479         https://bugs.webkit.org/show_bug.cgi?id=176046
480
481         Reviewed by Alex Christensen.
482
483         * platform/FileSystem.cpp:
484         (WebCore::setMetadataURL):
485         * platform/FileSystem.h:
486         (WebCore::setMetadataURL):
487         * platform/mac/FileSystemMac.mm:
488         (WebCore::setMetadataURL):
489         * platform/mac/WebCoreSystemInterface.h:
490         * platform/mac/WebCoreSystemInterface.mm:
491
492 2017-08-29  Zan Dobersek  <zdobersek@igalia.com>
493
494         Unreviewed WPE debug build fix.
495
496         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
497         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
498         AppendState is an enum class, enum values have to be accessed
499         using scope resolution.
500
501 2017-08-28  Andy Estes  <aestes@apple.com>
502
503         [Cocoa] Upstream WKGetWebDefaultCFStringEncoding()
504         https://bugs.webkit.org/show_bug.cgi?id=176039
505
506         Reviewed by Alex Christensen.
507
508         * PlatformMac.cmake:
509         * WebCore.xcodeproj/project.pbxproj:
510         * platform/ios/WebCoreSystemInterfaceIOS.mm:
511         * platform/mac/WebCoreSystemInterface.h:
512         * platform/mac/WebCoreSystemInterface.mm:
513         * platform/text/TextEncodingRegistry.cpp:
514         (WebCore::defaultTextEncodingNameForSystemLanguage):
515         * platform/text/TextEncodingRegistry.h:
516         * platform/text/ios/TextEncodingRegistryIOS.mm: Added.
517         (WebCore::webDefaultCFStringEncoding):
518         * platform/text/mac/TextEncodingRegistryMac.mm: Added.
519         (WebCore::webDefaultCFStringEncoding):
520
521 2017-08-28  Joseph Pecoraro  <pecoraro@apple.com>
522
523         REGRESSION(r220278): Web Inspector: ContextMenu items are not getting triggered
524         https://bugs.webkit.org/show_bug.cgi?id=176034
525
526         Reviewed by Devin Rousso.
527
528         * inspector/InspectorFrontendHost.cpp:
529         (WebCore::InspectorFrontendHost::showContextMenu):
530         Responses go through InspectorFrontendAPI not InspectorFrontendHost.
531
532 2017-08-28  Youenn Fablet  <youenn@apple.com>
533
534         WebRTC MediaStream created without tracks does not update active state after tracks are added
535         https://bugs.webkit.org/show_bug.cgi?id=175434
536
537         Reviewed by Eric Carlson.
538
539         Covered by updated test.
540
541         Removing active/inactive events.
542         active attribute is still kept and is updated synchronously on every track change.
543
544         * Modules/mediastream/MediaStream.cpp:
545         (WebCore::MediaStream::MediaStream):
546         (WebCore::MediaStream::activeStatusChanged):
547         (WebCore::MediaStream::internalAddTrack):
548         (WebCore::MediaStream::updateActiveState):
549         (WebCore::MediaStream::hasPendingActivity const):
550         (WebCore::MediaStream::scheduleActiveStateChange): Deleted.
551         (WebCore::MediaStream::activityEventTimerFired): Deleted.
552         * Modules/mediastream/MediaStream.h:
553         * Modules/mediastream/MediaStream.idl:
554
555 2017-08-28  Andy Estes  <aestes@apple.com>
556
557         [Cocoa] Upstream CFNetwork-related WebKitSystemInterface functions
558         https://bugs.webkit.org/show_bug.cgi?id=176032
559
560         Reviewed by Alex Christensen.
561
562         * platform/ios/WebCoreSystemInterfaceIOS.mm:
563         * platform/mac/WebCoreSystemInterface.h:
564         * platform/mac/WebCoreSystemInterface.mm:
565         * platform/network/NetworkStorageSession.h:
566         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
567         (WebCore::NetworkStorageSession::switchToNewTestingSession):
568         (WebCore::NetworkStorageSession::ensureSession):
569         * platform/network/cf/ResourceRequest.h:
570         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
571         (WebCore::createPrivateStorageSession):
572         * platform/network/cocoa/ResourceRequestCocoa.mm:
573         (WebCore::ResourceRequest::setStorageSession):
574         (WebCore::copyRequestWithStorageSession):
575         (WebCore::cachedResponseForRequest):
576         * platform/network/mac/CookieJarMac.mm:
577         (WebCore::httpCookies):
578         (WebCore::setHTTPCookiesForURL):
579         (WebCore::deleteHTTPCookie):
580         (WebCore::deleteAllHTTPCookies):
581         (WebCore::setCookiesFromDOM):
582         (WebCore::httpCookieAcceptPolicy):
583         (WebCore::cookiesEnabled):
584         (WebCore::deleteCookie):
585         (WebCore::getHostnamesWithCookies):
586         (WebCore::deleteAllCookies):
587         (WebCore::deleteCookiesForHostnames):
588         * platform/network/mac/ResourceHandleMac.mm:
589         (WebCore::ResourceHandle::createNSURLConnection):
590
591 2017-08-28  Brent Fulgham  <bfulgham@apple.com>
592
593         Disable access to secure cookies if an HTTPS site loads mixed content (Part 2: Header Requests)
594         https://bugs.webkit.org/show_bug.cgi?id=175992
595         <rdar://problem/34086613>
596
597         Reviewed by Daniel Bates.
598
599         The original work in Bug 157053 did not properly handle the case of websockets. This patch completes
600         the changes to secure cookie handling to make sure websockets are also protected.
601
602         Tests: http/tests/websocket/tests/hybi/secure-cookie-insecure-connection.pl
603                http/tests/websocket/tests/hybi/secure-cookie-secure-connection.pl
604
605         * Modules/websockets/WebSocketChannel.cpp:
606         (WebCore::WebSocketChannel::clientHandshakeRequest): Remove 'const' declaration so we can work with
607         a mutable Document object. This allows us to mark the Document as having accessed secure cookies.
608         (WebCore::WebSocketChannel::clientHandshakeRequest const): Deleted.
609         * Modules/websockets/WebSocketChannel.h:
610         * Modules/websockets/WebSocketHandshake.cpp:
611         (WebCore::WebSocketHandshake::clientHandshakeMessage): Ditto.
612         (WebCore::WebSocketHandshake::clientHandshakeRequest): Ditto.
613         (WebCore::WebSocketHandshake::clientHandshakeMessage const): Deleted.
614         (WebCore::WebSocketHandshake::clientHandshakeRequest const): Deleted.
615         * Modules/websockets/WebSocketHandshake.h:
616         * loader/CookieJar.cpp:
617         (WebCore::cookies): Small naming cleanup.
618         (WebCore::cookieRequestHeaderFieldValue): Pass a flag indicating whether secure cookies should be
619         included in the result or not. Set the document flag indicating secure cookies were accessed (if
620         they were), and return the resulting cookie string.
621         * loader/CookieJar.h:
622         * platform/CookiesStrategy.h:
623         * platform/network/CacheValidation.cpp:
624         (WebCore::headerValueForVary): Revise to pass a flag indicating whether secure cookies should be included
625         or not.
626         * platform/network/PlatformCookieJar.h:
627         * platform/network/cf/CookieJarCFNet.cpp:
628         (WebCore::doesContainSecureCookies): Added helper method.
629         (WebCore::cookiesForDOM): Revise to use new helper function.
630         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
631         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
632         secure cookies were accessed or not.
633         * platform/network/curl/CookieJarCurl.cpp:
634         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue): Ditto.
635         (WebCore::cookieRequestHeaderFieldValue): Ditto.
636         * platform/network/curl/CookieJarCurl.h:
637         * platform/network/mac/CookieJarMac.mm:
638         (WebCore::cookiesForSession): Ditto.
639         (WebCore::cookiesForDOM): Update for new 'cookiesForSession' signature.
640         (WebCore::cookieRequestHeaderFieldValue): Ditto.
641         * platform/network/soup/CookieJarSoup.cpp:
642         (WebCore::cookieRequestHeaderFieldValue): Revise to accept a flag indicating if secure cookies should
643         be included in the result. Return a pair consisting of the cookie string, and a flag indicating whether
644         secure cookies were accessed or not.
645
646 2017-08-28  Carlos Alberto Lopez Perez  <clopez@igalia.com>
647
648         [GTK] [WPE] Rename EventHandlerGlib to EventHandlerGLib
649         https://bugs.webkit.org/show_bug.cgi?id=175864
650
651         Unreviewed cosmetic follow-up patch after r221075.
652
653         No new tests. No change in behavior.
654
655         * PlatformGTK.cmake:
656         * PlatformWPE.cmake:
657         * platform/glib/EventHandlerGLib.cpp: Renamed from Source/WebCore/platform/glib/EventHandlerGlib.cpp.
658         (WebCore::EventHandler::tabsToAllFormControls const):
659         (WebCore::EventHandler::focusDocumentView):
660         (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
661         (WebCore::EventHandler::passMouseDownEventToWidget):
662         (WebCore::EventHandler::eventActivatedView const):
663         (WebCore::EventHandler::widgetDidHandleWheelEvent):
664         (WebCore::EventHandler::createDraggingDataTransfer const):
665         (WebCore::EventHandler::passMousePressEventToSubframe):
666         (WebCore::EventHandler::passMouseMoveEventToSubframe):
667         (WebCore::EventHandler::passMouseReleaseEventToSubframe):
668         (WebCore::EventHandler::accessKeyModifiers):
669         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
670
671 2017-08-28  Zan Dobersek  <zdobersek@igalia.com>
672
673         [WebCrypto] Push WorkQueue dispatches for AES algorithms into shared code
674         https://bugs.webkit.org/show_bug.cgi?id=175539
675
676         Reviewed by Sam Weinig.
677
678         Push the WorkQueue dispatch code and other code duplicated between the
679         Mac and libgcrypt implementations of Web Crypto into the shared layer.
680         This patch focuses on the AES-based algorithms.
681
682         Functions with platform-specific implementations that are invoked from
683         these asynchronous dispatches are made static and return an ExceptionOr
684         value. CryptoAlgorithmParameters objects are passed through non-const
685         references because data getters could lazily construct the underlying
686         Vector objects. CryptoKey objects are passed through const references.
687         Implementations can then manually retrieve and further validate any key
688         or parameter data, as required for that specific implementation. Input
689         data is passed through const references to the original Vector objects.
690
691         No new tests -- no changes in behavior that's covered by existing tests.
692
693         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
694         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
695         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
696         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
697         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
698         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
699         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
700         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
701         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
702         (WebCore::CryptoAlgorithmAES_CTR::encrypt):
703         (WebCore::CryptoAlgorithmAES_CTR::decrypt):
704         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
705         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
706         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
707         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
708         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
709         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
710         (WebCore::CryptoAlgorithmAES_KW::wrapKey):
711         (WebCore::CryptoAlgorithmAES_KW::unwrapKey):
712         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
713         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
714         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
715         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
716         * crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp:
717         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
718         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
719         * crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp:
720         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
721         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
722         * crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp:
723         (WebCore::gcryptEncrypt):
724         (WebCore::gcryptDecrypt):
725         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
726         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
727         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
728         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
729         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
730         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
731         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
732         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
733         * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp:
734         (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
735         (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
736         * crypto/mac/CryptoAlgorithmAES_CTRMac.cpp:
737         (WebCore::CryptoAlgorithmAES_CTR::platformEncrypt):
738         (WebCore::CryptoAlgorithmAES_CTR::platformDecrypt):
739         * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:
740         (WebCore::CryptoAlgorithmAES_GCM::platformEncrypt):
741         (WebCore::CryptoAlgorithmAES_GCM::platformDecrypt):
742         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
743         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
744         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
745
746 2017-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
747
748         [iOS WK2] Web process crashes after changing selection to the end of the document when speaking a selection
749         https://bugs.webkit.org/show_bug.cgi?id=176011
750         <rdar://problem/32614095>
751
752         Reviewed by Ryosuke Niwa.
753
754         Adds a null check to visiblePositionForPositionWithOffset. This is a crash point for accessibility codepaths,
755         since indexForVisiblePosition is not guaranteed to set the given `root` outparam to a non-null value, yet
756         visiblePositionForIndex requires root to be non-null. This causes a crash when selecting some text, hitting
757         'Speak', and then changing the selection to somewhere near the end of the document, since accessibility code
758         will attempt to speak words at an offset past the end of the document. While this is a bug in and of itself, the
759         web process should still handle this case gracefully and not crash. To fix this, we simply bail and return a
760         null VisiblePosition if a root container node was not found.
761
762         Currently, visiblePositionForPositionWithOffset is implemented twice, in WebCore (AXObjectCache.cpp) and also in
763         WebKit (WebPageIOS.mm), as identical static functions. This patch moves this helper into Editing.cpp and removes
764         it from AXObjectCache and WebPageIOS.
765
766         Tests: AccessibilityTests.RectsForSpeakingSelectionBasic
767                AccessibilityTests.RectsForSpeakingSelectionWithLineWrapping
768                AccessibilityTests.RectsForSpeakingSelectionDoNotCrashWhenChangingSelection
769
770         * accessibility/AXObjectCache.cpp:
771         (WebCore::visiblePositionForPositionWithOffset): Deleted.
772         * editing/Editing.cpp:
773         (WebCore::visiblePositionForPositionWithOffset):
774         * editing/Editing.h:
775
776 2017-08-27  Devin Rousso  <webkit@devinrousso.com>
777
778         Web Inspector: Record actions performed on WebGLRenderingContext
779         https://bugs.webkit.org/show_bug.cgi?id=174483
780         <rdar://problem/34040722>
781
782         Reviewed by Matt Baker.
783
784         Tests: inspector/canvas/recording-webgl.html
785                inspector/canvas/recording-webgl-snapshots.html
786
787         * bindings/js/CallTracerTypes.h:
788         Add types for WebGL parameters.
789
790         * bindings/scripts/CodeGeneratorJS.pm:
791         (GenerateAttributeSetterBodyDefinition):
792         (GenerateImplementationFunctionCall):
793         (GenerateCallTracerParameter):
794         Modify the generated code for `CallTracingCallback` so that optional/nullable types are only
795         dereferenced if they have a value.
796
797         * html/canvas/WebGLRenderingContext.idl:
798         Add `CallTracingCallback` to interface to record all API calls.
799
800         * inspector/InspectorCanvas.h:
801         * inspector/InspectorCanvas.cpp:
802         (WebCore::InspectorCanvas::resetRecordingData):
803         (WebCore::shouldSnapshotWebGLAction):
804         (WebCore::InspectorCanvas::recordAction):
805         (WebCore::InspectorCanvas::releaseInitialState):
806         (WebCore::InspectorCanvas::releaseFrames):
807         (WebCore::InspectorCanvas::appendActionSnapshotIfNeeded):
808         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
809         (WebCore::InspectorCanvas::buildInitialState):
810         (WebCore::InspectorCanvas::buildAction):
811         For all non-primitive WebGL objects, send a string corresponding to the object's name. The
812         value isn't needed since the preview will be generated by the `toDataURL` snapshots taken
813         after every visual action.
814
815         * inspector/InspectorCanvasAgent.cpp:
816         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
817
818         * bindings/scripts/test/TestCallTracer.idl:
819         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
820         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody):
821         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody):
822         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument):
823         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody):
824         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument):
825         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody):
826         (WebCore::jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument):
827
828 2017-08-26  Dan Bernstein  <mitz@apple.com>
829
830         REGRESSION (r220105): Storage service appears in macOS Activity Monitor as “localized string not found”
831         https://bugs.webkit.org/show_bug.cgi?id=176007
832
833         Reviewed by Tim Horton.
834
835         * English.lproj/Localizable.strings: Updated using update-webkit-localizable-strings.
836
837 2017-08-26  Alex Christensen  <achristensen@webkit.org>
838
839         Remove PolicyChecker::cancelCheck
840         https://bugs.webkit.org/show_bug.cgi?id=176002
841
842         Reviewed by Darin Adler.
843
844         cancelCheck is conceptually equivalent to not calling a completion handler.
845         stopCheck is conceptually equivalent to calling a completion handler with PolicyIgnore just before cleaning up everything,
846         which is semantically cleaner and necessary when I replace the last use of PolicyCallback with a CompletionHandler.
847         Before this change, we were probably causing some loading objects to hang right before deleting them, and this cleans them up better.
848
849         * loader/DocumentLoader.cpp:
850         (WebCore::DocumentLoader::cancelPolicyCheckIfNeeded):
851         * loader/PolicyChecker.cpp:
852         (WebCore::PolicyChecker::cancelCheck): Deleted.
853         * loader/PolicyChecker.h:
854
855 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
856
857         Unreviewed, tighten up scope of variable in previous commit
858
859         * platform/network/soup/CookieJarSoup.cpp:
860         (WebCore::cookiesForSession):
861
862 2017-08-26  Michael Catanzaro  <mcatanzaro@igalia.com>
863
864         [SOUP] Update cookie jar implementation to filter out secure cookies
865         https://bugs.webkit.org/show_bug.cgi?id=175850
866
867         Reviewed by Brent Fulgham.
868
869         Filter out secure cookies when indicated.
870
871         * platform/network/soup/CookieJarSoup.cpp:
872         (WebCore::cookiesForSession):
873         (WebCore::cookiesForDOM):
874         (WebCore::cookieRequestHeaderFieldValue):
875         (WebCore::getRawCookies):
876
877 2017-08-26  Xabier Rodriguez Calvar  <calvaris@igalia.com>
878
879         [EME][GStreamer] Connect CDM to GStreamer
880         https://bugs.webkit.org/show_bug.cgi?id=175983
881
882         Reviewed by Žan Doberšek.
883
884         This is still a version that will need some changes for some other
885         use cases but it should be enough to begin with some passes in the
886         tests and some basic use cases.
887
888         We use the attach CDMInstance interface in the private player to
889         get the instance in time for the initializationDataEncountered
890         event, which is handled when the demuxer reports synchronously the
891         events even before configuring the decryptors. We wait there in
892         case we don't have the CDMInstance attached (which contains info
893         about the key system now) and when we get it we report it back to
894         the demuxer and continue sending the event.
895
896         We also handled the events when handled by the decryptors but for
897         now this will remain a FIXME. The events handled by the
898         AppendPipeline will end up here too for now.
899
900         The CDM instance is created with the key system because some CDMs
901         can handle more than one, not ClearKey yet but others in the
902         (near) future.
903
904         MockCDMFactory is adapted to the changes as expected.
905
906         * Modules/encryptedmedia/CDM.cpp:
907         (WebCore::CDM::CDM):
908         * platform/encryptedmedia/CDMFactory.h:
909         * platform/encryptedmedia/CDMInstance.h:
910         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
911         (WebCore::CDMFactoryClearKey::createCDM):
912         (WebCore::CDMInstanceClearKey::keySystem const):
913         * platform/encryptedmedia/clearkey/CDMClearKey.h:
914         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
915         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
916         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
917         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
918         (WebCore::extractEventsAndSystemsFromMessage):
919         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
920         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
921         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
922         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithInstance):
923         (WebCore::MediaPlayerPrivateGStreamerBase::attemptToDecryptWithLocalInstance):
924         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchDecryptionKey):
925         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
926         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
927         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
928         (WebCore::appendPipelineElementMessageCallback):
929         (WebCore::AppendPipeline::AppendPipeline):
930         (WebCore::AppendPipeline::~AppendPipeline):
931         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
932         (WebCore::AppendPipeline::handleElementMessage):
933         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
934         (WebCore::AppendPipeline::appsinkNewSample):
935         * platform/graphics/gstreamer/mse/AppendPipeline.h:
936         * testing/MockCDMFactory.cpp:
937         (WebCore::MockCDMFactory::createCDM):
938         (WebCore::MockCDMInstance::keySystem const):
939         * testing/MockCDMFactory.h:
940
941 2017-08-26  Zan Dobersek  <zdobersek@igalia.com>
942
943         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
944         https://bugs.webkit.org/show_bug.cgi?id=175621
945
946         Reviewed by Darin Adler.
947
948         Push the WorkQueue dispatch code and other code duplicated between the
949         Mac and libgcrypt implementations of Web Crypto into the shared layer.
950         This patch focuses on the RSA-based algorithms.
951
952         The WorkQueue dispatch code is condensed into two static functions on
953         the CryptoAlgorithm class, the first variation handling VectorCallback
954         as the callback type and the other handling BoolCallback. The operation
955         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
956         embedding either a Vector<uint8_t> object or a boolean value, as
957         appropriate for the callback type.
958
959         Functions with platform-specific implementations that are invoked from
960         these asynchronous dispatches are made static and return an ExceptionOr
961         value. CryptoAlgorithmParameters objects are passed through non-const
962         references because data getters could lazily construct the underlying
963         Vector objects. CryptoKey objects are passed through const references.
964         Implementations can then manually retrieve and further validate any key
965         or parameter data, as required for that specific implementation. Input
966         data is passed through const references to the original Vector objects.
967
968         No new tests -- no changes in behavior that's covered by existing tests.
969
970         * crypto/CryptoAlgorithm.cpp:
971         (WebCore::dispatchOperationImpl):
972         (WebCore::CryptoAlgorithm::dispatchOperation):
973         * crypto/CryptoAlgorithm.h:
974         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
975         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
976         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
977         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
978         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
979         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
980         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
981         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
982         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
983         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
984         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
985         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
986         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
987         (WebCore::CryptoAlgorithmRSA_PSS::sign):
988         (WebCore::CryptoAlgorithmRSA_PSS::verify):
989         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
990         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
991         (WebCore::gcryptEncrypt):
992         (WebCore::gcryptDecrypt):
993         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
994         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
995         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
996         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
997         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
998         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
999         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1000         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1001         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
1002         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1003         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1004         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1005         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1006         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1007         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1008         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1009         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1010         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1011         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1012         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1013         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
1014         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1015         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1016
1017 2017-08-25  Daniel Bates  <dabates@apple.com>
1018
1019         Demarcate code added due to lack of NSDMI for aggregates
1020         https://bugs.webkit.org/show_bug.cgi?id=175990
1021
1022         Reviewed by Andy Estes.
1023
1024         * html/canvas/CanvasStyle.h:
1025         * platform/mediastream/IceCandidate.h:
1026         (WebCore::IceCandidate::IceCandidate):
1027         * platform/text/StringWithDirection.h: Replace const String& and String&& constructor
1028         overloads with a single user-defined constructor that takes a String by value to handle
1029         both cases.
1030         (WebCore::StringWithDirection::StringWithDirection):
1031         (WebCore::truncateFromEnd):
1032         * style/StyleUpdate.h:
1033         (WebCore::Style::ElementUpdate::ElementUpdate):
1034         (WebCore::Style::TextUpdate::TextUpdate):
1035
1036 2017-08-25  Daniel Bates  <dabates@apple.com>
1037
1038         InlineTextBox::paintDocumentMarker() does not need to special case painting of grammar and
1039         dictation alternatives
1040         https://bugs.webkit.org/show_bug.cgi?id=175966
1041
1042         Reviewed by Tim Horton.
1043
1044         Remove code that forced computing the marker rect for grammar and dictation alternative
1045         regardless of whether the marker spans the entire width of the line box. InlineTextBox::paintDocumentMarker()
1046         has performance optimizations to avoid computing the marker rect if it spans the entire line box.
1047         Prior to r190363 we had to opt out of these optimizations for grammar and dictation alternative
1048         markers so that we could store their computed marker rect. In r190363 we removed the logic in
1049         InlineTextBox::paintDocumentMarker() to store the computed marker rect and hence no longer
1050         needed to opt out of the optimization for these marker types, but inadvertently left in the
1051         conditional code that opts them out.
1052
1053         No functionality changed. So no new tests.
1054
1055         * rendering/InlineTextBox.cpp:
1056         (WebCore::InlineTextBox::paintDocumentMarker): Remove unnecessary argument grammar and
1057         code that special cased handling of grammar an dictation alternative markers.
1058         (WebCore::InlineTextBox::paintDocumentMarkers): Update as necessary.
1059         * rendering/InlineTextBox.h:
1060
1061 2017-08-25  Chris Dumez  <cdumez@apple.com>
1062
1063         Land stubs for File and Directory Entries API interfaces
1064         https://bugs.webkit.org/show_bug.cgi?id=175993
1065         <rdar://problem/34087477>
1066
1067         Reviewed by Ryosuke Niwa.
1068
1069         Land stubs for File and Directory Entries API interfaces:
1070         - https://wicg.github.io/entries-api/#idl-index
1071
1072         Those will be needed to support drag and drop.
1073
1074         Test: http/wpt/entries-api/interfaces.html
1075
1076         * CMakeLists.txt:
1077         * DerivedSources.cpp:
1078         * DerivedSources.make:
1079         * Modules/entriesapi/DOMFileSystem.cpp: Added.
1080         (WebCore::DOMFileSystem::DOMFileSystem):
1081         (WebCore::DOMFileSystem::~DOMFileSystem):
1082         * Modules/entriesapi/DOMFileSystem.h: Added.
1083         (WebCore::DOMFileSystem::create):
1084         (WebCore::DOMFileSystem::name const):
1085         (WebCore::DOMFileSystem::root const):
1086         * Modules/entriesapi/DOMFileSystem.idl: Added.
1087         * Modules/entriesapi/ErrorCallback.h: Added.
1088         * Modules/entriesapi/ErrorCallback.idl: Added.
1089         * Modules/entriesapi/FileCallback.h: Added.
1090         * Modules/entriesapi/FileCallback.idl: Added.
1091         * Modules/entriesapi/FileSystemDirectoryEntry.cpp: Added.
1092         (WebCore::FileSystemDirectoryEntry::FileSystemDirectoryEntry):
1093         (WebCore::FileSystemDirectoryEntry::getFile):
1094         (WebCore::FileSystemDirectoryEntry::getDirectory):
1095         * Modules/entriesapi/FileSystemDirectoryEntry.h: Added.
1096         * Modules/entriesapi/FileSystemDirectoryEntry.idl: Added.
1097         * Modules/entriesapi/FileSystemEntry.cpp: Added.
1098         (WebCore::FileSystemEntry::FileSystemEntry):
1099         * Modules/entriesapi/FileSystemEntry.h: Added.
1100         (WebCore::FileSystemEntry::~FileSystemEntry):
1101         (WebCore::FileSystemEntry::isFile const):
1102         (WebCore::FileSystemEntry::isDirectory const):
1103         (WebCore::FileSystemEntry::name const):
1104         (WebCore::FileSystemEntry::fullPath const):
1105         (WebCore::FileSystemEntry::filesystem const):
1106         * Modules/entriesapi/FileSystemEntry.idl: Added.
1107         * Modules/entriesapi/FileSystemEntryCallback.h: Added.
1108         * Modules/entriesapi/FileSystemEntryCallback.idl: Added.
1109         * Modules/entriesapi/FileSystemFileEntry.cpp: Added.
1110         (WebCore::FileSystemFileEntry::FileSystemFileEntry):
1111         (WebCore::FileSystemFileEntry::file):
1112         * Modules/entriesapi/FileSystemFileEntry.h: Added.
1113         * Modules/entriesapi/FileSystemFileEntry.idl: Added.
1114         * WebCore.xcodeproj/project.pbxproj:
1115
1116 2017-08-25  Brent Fulgham  <bfulgham@apple.com>
1117
1118         REGRESSION(r221017): Quip stuck in a perpetual loading loop
1119         https://bugs.webkit.org/show_bug.cgi?id=175991
1120         <rdar://problem/34044445>
1121
1122         Reviewed by Daniel Bates.
1123
1124         This is a quick fix to return proper function to WebKit. I'll relate a follow-up fix that
1125         addresses WebSockets more completely.
1126
1127         * platform/network/mac/CookieJarMac.mm:
1128         (WebCore::cookieRequestHeaderFieldValue): Don't hard code a value of 'No' for returning secure
1129         cookies. HTTPS connection should get secure cookies.
1130
1131 2017-08-25  Youenn Fablet  <youenn@apple.com>
1132
1133         Add support for ReadableStream storage in FetchBody
1134         https://bugs.webkit.org/show_bug.cgi?id=175866
1135
1136         Reviewed by Sam Weinig.
1137
1138         Test: http/wpt/beacon/beacon-readablestream.html
1139
1140         Add support for IDLInterface<ReadableStream>, in particular to handle union conversions.
1141         Adding a ReadableStream that guards JSReadableStream from being collected.
1142         With this object, FetchBody will be able to store and manipulate ReadableStream.
1143
1144         Ensure conversion of BodyInit union with ReadableStream is working by adding support for beacon rejection in case of request body streams. 
1145
1146         * Modules/beacon/NavigatorBeacon.cpp:
1147         (WebCore::NavigatorBeacon::sendBeacon):
1148         * Modules/beacon/NavigatorBeacon.idl:
1149         * Modules/fetch/FetchBody.cpp:
1150         (WebCore::FetchBody::extract):
1151         * Modules/fetch/FetchBody.h:
1152         * Modules/fetch/FetchRequest.idl:
1153         * Modules/fetch/FetchRequestInit.idl:
1154         * Modules/fetch/FetchResponse.idl:
1155         * WebCore.xcodeproj/project.pbxproj:
1156         * bindings/js/JSDOMConvertInterface.h:
1157         (WebCore::JSToWrappedOverloader::toWrapped):
1158         (WebCore::Converter<IDLInterface<T>>::convert):
1159         * bindings/js/JSDOMConvertUnion.h:
1160         * bindings/js/ReadableStream.h: Added.
1161         (WebCore::JSReadableStreamWrapperConverter::toWrapped):
1162
1163 2017-08-25  Wenson Hsieh  <wenson_hsieh@apple.com>
1164
1165         Using the touchbar, both align left and align justify send a beforeinput event with the 'formatJustifyLeft' inputType.
1166         https://bugs.webkit.org/show_bug.cgi?id=168669
1167         <rdar://problem/30639155>
1168
1169         Reviewed by Beth Dakin.
1170
1171         Small tweak to add a "formatJustifyFull" inputType when justifying text using the touch bar's rich text
1172         formatting controls. Currently, the EditActionJustify edit command incorrectly maps to "formatJustifyLeft".
1173
1174         Test: fast/events/input-events-text-alignment.html
1175
1176         * editing/EditCommand.cpp:
1177         (WebCore::inputTypeNameForEditingAction):
1178
1179 2017-08-25  Brady Eidson  <beidson@apple.com>
1180
1181         Introduce ServerWorkerRegistration task queues.
1182         https://bugs.webkit.org/show_bug.cgi?id=175851
1183
1184         Reviewed by Andy Estes.
1185
1186         Test: http/tests/workers/service/registration-task-queue-scheduling-1.html
1187
1188         This change introduces:
1189         - A task thread/queue owned by each SWServer object.
1190         - The SWServerRegistration object, which is the in-server representation of a
1191           service worker registration scope.
1192         - A registration job queue per SWServerRegistration object which actually runs the
1193           jobs as tasks on the owning SWServer's thread.
1194
1195         With that infrastructure in place, it moves the "register" job to something that is
1196         scheduled and rejected asynchronously, as opposed to synchronously rejected.
1197
1198         The test verifies that two different registration scopes (localhost and 127.0.0.1) 
1199         can both spam the SWServer with registration requests, but neither of their queues
1200         starve the other.
1201
1202         The rest of this change is a lot of support and plumbing for making the above happen.
1203
1204         * CMakeLists.txt:
1205         * WebCore.xcodeproj/project.pbxproj:
1206         
1207         * dom/ExceptionData.cpp:
1208         (WebCore::ExceptionData::isolatedCopy const):
1209         * dom/ExceptionData.h:
1210         
1211         * workers/service/ServiceWorkerContainer.cpp:
1212         (WebCore::ServiceWorkerContainer::addRegistration):
1213         (WebCore::ServiceWorkerContainer::connectionIdentifier):
1214         * workers/service/ServiceWorkerContainer.h:
1215         
1216         * workers/service/ServiceWorkerJob.cpp:
1217         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
1218         (WebCore::ServiceWorkerJob::data const): Deleted.
1219         * workers/service/ServiceWorkerJob.h:
1220         (WebCore::ServiceWorkerJob::create):
1221         (WebCore::ServiceWorkerJob::data const):
1222         (WebCore::ServiceWorkerJob::createRegisterJob): Deleted.
1223         
1224         * workers/service/ServiceWorkerJobClient.h:
1225         
1226         * workers/service/ServiceWorkerJobData.cpp:
1227         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
1228         (WebCore::ServiceWorkerJobData::registrationKey const):
1229         (WebCore::ServiceWorkerJobData::isolatedCopy const):
1230         * workers/service/ServiceWorkerJobData.h:
1231         (WebCore::ServiceWorkerJobData::jobIdentifier const):
1232         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
1233         (WebCore::ServiceWorkerJobData::encode const):
1234         (WebCore::ServiceWorkerJobData::decode):
1235
1236         * workers/service/ServiceWorkerRegistrationKey.cpp:
1237         (WebCore::ServiceWorkerRegistrationKey::emptyKey):
1238         (WebCore::ServiceWorkerRegistrationKey::hash const):
1239         (WebCore::ServiceWorkerRegistrationKey::operator== const):
1240         * workers/service/ServiceWorkerRegistrationKey.h:
1241         (WTF::ServiceWorkerRegistrationKeyHash::hash):
1242         (WTF::ServiceWorkerRegistrationKeyHash::equal):
1243         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::emptyValue):
1244         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
1245         (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
1246
1247         * workers/service/ServiceWorkerRegistrationOptions.cpp:
1248         (WebCore::RegistrationOptions::isolatedCopy const):
1249         * workers/service/ServiceWorkerRegistrationOptions.h:
1250         (WebCore::RegistrationOptions::encode const):
1251         (WebCore::RegistrationOptions::decode):
1252
1253         * workers/service/server/SWClientConnection.h:
1254
1255         * workers/service/server/SWServer.cpp:
1256         (WebCore::SWServer::Connection::Connection):
1257         (WebCore::SWServer::~SWServer):
1258         (WebCore::SWServer::Connection::scheduleJobInServer):
1259         (WebCore::SWServer::SWServer):
1260         (WebCore::SWServer::scheduleJob):
1261         (WebCore::SWServer::rejectJob):
1262         (WebCore::SWServer::taskThreadEntryPoint):
1263         (WebCore::SWServer::postTask):
1264         (WebCore::SWServer::postTaskReply):
1265         (WebCore::SWServer::handleTaskRepliesOnMainThread):
1266         (WebCore::SWServer::registerConnection):
1267         (WebCore::SWServer::unregisterConnection):
1268         * workers/service/server/SWServer.h:
1269         (WebCore::SWServer::Connection::identifier const):
1270
1271         * workers/service/server/SWServerRegistration.cpp: Added.
1272         (WebCore::SWServerRegistration::SWServerRegistration):
1273         (WebCore::SWServerRegistration::~SWServerRegistration):
1274         (WebCore::SWServerRegistration::enqueueJob):
1275         (WebCore::SWServerRegistration::startNextJob):
1276         (WebCore::SWServerRegistration::performCurrentJob):
1277         (WebCore::SWServerRegistration::rejectCurrentJob):
1278         (WebCore::SWServerRegistration::finishCurrentJob):
1279         * workers/service/server/SWServerRegistration.h:
1280
1281 2017-08-25  Michael Catanzaro  <mcatanzaro@igalia.com>
1282
1283         Unreviewed, add comment warning that some flags have been copied into Epiphany
1284
1285         * platform/URLParser.cpp:
1286         (WebCore::URLParser::internationalDomainNameTranscoder):
1287
1288 2017-07-25  Frederic Wang  <fwang@igalia.com>
1289
1290         Add flag allow-modals to iframe sandbox
1291         https://bugs.webkit.org/show_bug.cgi?id=171321
1292
1293         This patch implements the "allow-modals" value for the iframe sandbox attribute. It changes
1294         the behavior for sandboxed document so that alert, confirm, prompt, print as well as dialogs
1295         generated from a beforeunload event are blocked when allow-modals is not set, as defined in
1296         the specification. For consistency, we do the same for document.execCommand('print', ...).
1297         Users should use the allow-modals flag in order to explictly allow modal dialogs.
1298
1299         See https://html.spec.whatwg.org/multipage/origin.html#sandboxed-modals-flag
1300
1301         Reviewed by Brent Fulgham.
1302
1303         Tests: http/tests/security/sandboxed-iframe-ALLOWED-modals.html
1304                http/tests/security/sandboxed-iframe-DENIED-modals.html
1305
1306         * dom/SecurityContext.cpp: Implement parsing for allow-modals
1307         (WebCore::SecurityContext::isSupportedSandboxPolicy):
1308         (WebCore::SecurityContext::parseSandboxPolicy):
1309         * dom/SecurityContext.h: Introduce flag for allow-modals
1310         * loader/FrameLoader.cpp:
1311         (WebCore::shouldAskForNavigationConfirmation): Prevent confirm dialog from beforeunload when
1312         allow-modals is not set.
1313         * page/Chrome.h: Change the signature of print, so it may return a failure when the
1314         allow-modals flag is not set.
1315         * page/Chrome.cpp:
1316         (WebCore::Chrome::print): Returns false and print a message error when the allow-modals flag
1317         on the frame's document is not set. Otherwise, execute the command and returns true.
1318         * editing/EditorCommand.cpp:
1319         (WebCore::executePrint): Ensure that document.execCommand for 'print' returns false when the
1320         allow-modals flag is not set.
1321         * page/DOMWindow.cpp: Add early exit when alert, confirm or prompt when the allow-modals flag
1322         for that document is not set. Note that print is handled in Chrome.cpp.
1323         (WebCore::DOMWindow::alert): Add early exit.
1324         (WebCore::DOMWindow::confirm): Add early exit with the return value indicated in the spec.
1325         (WebCore::DOMWindow::prompt): Ditto.
1326
1327 2017-08-25  Brady Eidson  <beidson@apple.com>
1328
1329         Unreviewed, rolling out r221181.
1330
1331         Broke builds that use CryptoAlgorithmRSA_PSSMac.cpp
1332
1333         Reverted changeset:
1334
1335         "[WebCrypto] Push WorkQueue dispatches for RSA algorithms into
1336         shared code"
1337         https://bugs.webkit.org/show_bug.cgi?id=175621
1338         http://trac.webkit.org/changeset/221181
1339
1340 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1341
1342         [EME][ClearKey] Fixed warning in CDM compilation
1343         https://bugs.webkit.org/show_bug.cgi?id=175979
1344
1345         Reviewed by Žan Doberšek.
1346
1347         * platform/encryptedmedia/clearkey/CDMClearKey.h: Added a final to
1348         avoid the compiler warning about the missing override keyword.
1349
1350 2017-08-25  Miguel Gomez  <magomez@igalia.com>
1351
1352         [GTK] Completely garbled display in Transifex in accelerated compositing mode
1353         https://bugs.webkit.org/show_bug.cgi?id=174632
1354
1355         Reviewed by Michael Catanzaro.
1356
1357         Remove the copy constructor from PlatformContextCairo::State. This is because it will be used by WTF::Vector
1358         to copy the instances around when allocating new memory, but it doesn't copy the m_imageMaskInformation
1359         attribute, so it will be lost when the Vector reallocates its contents. When this happens, renderings that use
1360         GraphicsContext::clipToImageBuffer() fail to render properly.
1361
1362         Covered by existent tests.
1363
1364         * platform/graphics/cairo/PlatformContextCairo.cpp:
1365         (WebCore::PlatformContextCairo::State::State):
1366         (WebCore::PlatformContextCairo::save):
1367
1368 2017-08-25  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1369
1370         [EME][GStreamer] Move createDescryptor function to GStreamerEMEUtilities
1371         https://bugs.webkit.org/show_bug.cgi?id=175930
1372
1373         Reviewed by Žan Doberšek.
1374
1375         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1376         (WebCore::createGstDecryptor): Deleted.
1377         * platform/graphics/gstreamer/GStreamerUtilities.h:
1378         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
1379         (WebCore::GStreamerEMEUtilities::createDecryptor): Created.
1380         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
1381         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1382         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps): Use
1383         GStreamerEMEUtilities::createDecryptor instead.
1384
1385 2017-08-25  Zan Dobersek  <zdobersek@igalia.com>
1386
1387         [WebCrypto] Push WorkQueue dispatches for RSA algorithms into shared code
1388         https://bugs.webkit.org/show_bug.cgi?id=175621
1389
1390         Reviewed by Darin Adler.
1391
1392         Push the WorkQueue dispatch code and other code duplicated between the
1393         Mac and libgcrypt implementations of Web Crypto into the shared layer.
1394         This patch focuses on the RSA-based algorithms.
1395
1396         The WorkQueue dispatch code is condensed into two static functions on
1397         the CryptoAlgorithm class, the first variation handling VectorCallback
1398         as the callback type and the other handling BoolCallback. The operation
1399         is kept in a WTF::Function<> object that returns an ExceptionOr<> value
1400         embedding either a Vector<uint8_t> object or a boolean value, as
1401         appropriate for the callback type.
1402
1403         Functions with platform-specific implementations that are invoked from
1404         these asynchronous dispatches are made static and return an ExceptionOr
1405         value. CryptoAlgorithmParameters objects are passed through non-const
1406         references because data getters could lazily construct the underlying
1407         Vector objects. CryptoKey objects are passed through const references.
1408         Implementations can then manually retrieve and further validate any key
1409         or parameter data, as required for that specific implementation. Input
1410         data is passed through const references to the original Vector objects.
1411
1412         No new tests -- no changes in behavior that's covered by existing tests.
1413
1414         * crypto/CryptoAlgorithm.cpp:
1415         (WebCore::dispatchOperationImpl):
1416         (WebCore::CryptoAlgorithm::dispatchOperation):
1417         * crypto/CryptoAlgorithm.h:
1418         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1419         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
1420         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
1421         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1422         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1423         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
1424         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
1425         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1426         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1427         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
1428         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
1429         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1430         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
1431         (WebCore::CryptoAlgorithmRSA_PSS::sign):
1432         (WebCore::CryptoAlgorithmRSA_PSS::verify):
1433         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
1434         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1435         (WebCore::gcryptEncrypt):
1436         (WebCore::gcryptDecrypt):
1437         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1438         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1439         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1440         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1441         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1442         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1443         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1444         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1445         * crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp:
1446         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1447         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1448         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1449         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1450         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1451         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1452         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1453         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1454         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1455         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1456         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1457         * crypto/mac/CryptoAlgorithmRSA_PSSMac.cpp:
1458         (WebCore::CryptoAlgorithmRSA_PSS::platformSign):
1459         (WebCore::CryptoAlgorithmRSA_PSS::platformVerify):
1460
1461 2017-08-24  Chris Dumez  <cdumez@apple.com>
1462
1463         Unreviewed, add File and Directory Entries API to status page.
1464
1465         * features.json:
1466
1467 2017-08-24  Chris Dumez  <cdumez@apple.com>
1468
1469         Unreviewed, update status of Beacon API.
1470
1471         It is now supported in Safari Technology Preview.
1472
1473         * features.json:
1474
1475 2017-08-24  Chris Dumez  <cdumez@apple.com>
1476
1477         [Directory Upload] Add basic support for input.webkitdirectory
1478         https://bugs.webkit.org/show_bug.cgi?id=175950
1479         <rdar://problem/33951915>
1480
1481         Reviewed by Geoffrey Garen.
1482
1483         Add basic support for input.webkitdirectory attribute, as per:
1484         - https://wicg.github.io/entries-api/#html-forms
1485
1486         The following is supported:
1487         - input.webkitdirectory IDL and content attributes
1488         - The webkitdirectory content attribute is properly consulted
1489           to communicate to the client that the file picker should
1490           allow selecting directories.
1491         - When WebCore gets the list of selected files from the file picker,
1492           it properly resolves folders in a background thread to properly
1493           initialize input.files before firing the 'change' event at the
1494           input element.
1495         - When resolving files in a directory, we ignore both hidden files and
1496           symbolic links for security reasons. I did not check symlinks but Firefox
1497           and Chrome both seem to upload hidden files (such as .DS_Store files).
1498         - File.webkitRelativePath IDL attribute is properly populated for
1499           files coming from a selected directory.
1500         - Form submission just works because it relies on input.files being
1501           properly populated. No change needed in this area.
1502
1503         What is not supported:
1504         - input.webkitEntries IDL attribute.
1505         - FileSystemEntry / FileSystemDirectoryEntry / FileSystemDirectoryReader
1506           /  FileSystemFileEntry / FileSystem IDL interfaces.
1507         - dataTransferItem.webkitGetAsEntry() for proper drag and drop support.
1508
1509         Those will be taken care of in follow-up patches.
1510
1511         The feature is currently behind an experimental feature flag, disabled by
1512         default.
1513
1514         Tests: fast/forms/file/webkitdirectory-drag-folder.html
1515                fast/forms/file/webkitdirectory-open-panel.html
1516
1517         * CMakeLists.txt:
1518         * WebCore.xcodeproj/project.pbxproj:
1519         * fileapi/File.cpp:
1520         (WebCore::File::createWithRelativePath):
1521         * fileapi/File.h:
1522         * fileapi/File.idl:
1523         * html/FileInputType.cpp:
1524         (WebCore::FileInputType::~FileInputType):
1525         (WebCore::FileInputType::handleDOMActivateEvent):
1526         (WebCore::FileInputType::allowsDirectories const):
1527         (WebCore::FileInputType::filesChosen):
1528         * html/FileInputType.h:
1529         * html/FileListCreator.cpp: Added.
1530         (WebCore::appendDirectoryFiles):
1531         (WebCore::FileListCreator::FileListCreator):
1532         (WebCore::FileListCreator::createFileList):
1533         (WebCore::FileListCreator::cancel):
1534         * html/FileListCreator.h: Copied from Source/WebKit/UIProcess/API/APIOpenPanelParameters.h.
1535         (WebCore::FileListCreator::create):
1536         * html/HTMLAttributeNames.in:
1537         * html/HTMLInputElement.idl:
1538         * page/Settings.in:
1539         * platform/FileChooser.h:
1540         (WebCore::FileChooserFileInfo::isolatedCopy const):
1541         * platform/FileMetadata.h:
1542         * platform/FileSystem.cpp:
1543         (WebCore::fileIsDirectory):
1544         * platform/FileSystem.h:
1545         * platform/glib/FileSystemGlib.cpp:
1546         (WebCore::getFileMetadata):
1547         * platform/posix/FileSystemPOSIX.cpp:
1548         (WebCore::getFileMetadata):
1549         * platform/win/FileSystemWin.cpp:
1550         (WebCore::getFileMetadata):
1551
1552 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
1553
1554         Unreviewed, rolling out r221139.
1555
1556         This change did not resolve the LayoutTest assertion failure.
1557
1558         Reverted changeset:
1559
1560         "REGRESSION (r220052): ASSERTION FAILED:
1561         !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in
1562         WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()"
1563         https://bugs.webkit.org/show_bug.cgi?id=175270
1564         http://trac.webkit.org/changeset/221139
1565
1566 2017-08-24  Jon Lee  <jonlee@apple.com>
1567
1568         Unreviewed.
1569
1570         * Modules/mediastream/MediaStreamTrack.idl: Remove extraneous and confusing comment in IDL.
1571         The 'new' enum was removed via r215198, so we can remove this specific FIXME.
1572
1573 2017-08-24  Alex Christensen  <achristensen@webkit.org>
1574
1575         Stop using PolicyCallback for new window policies
1576         https://bugs.webkit.org/show_bug.cgi?id=175907
1577
1578         Reviewed by Andy Estes.
1579
1580         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
1581         No change in behaviour.
1582
1583         * loader/PolicyCallback.cpp:
1584         (WebCore::PolicyCallback::set):
1585         (WebCore::PolicyCallback::call):
1586         (WebCore::PolicyCallback::cancel):
1587         * loader/PolicyCallback.h:
1588         * loader/PolicyChecker.cpp:
1589         (WebCore::PolicyChecker::checkNewWindowPolicy):
1590         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
1591         * loader/PolicyChecker.h:
1592
1593 2017-08-24  Michael Saboff  <msaboff@apple.com>
1594
1595         Add support for RegExp "dotAll" flag
1596         https://bugs.webkit.org/show_bug.cgi?id=175924
1597
1598         Reviewed by Keith Miller.
1599
1600         Changed due to refactoring NewlineClassID to DotClassID.
1601
1602         No new tests. No change in behavior.
1603
1604         * contentextensions/URLFilterParser.cpp:
1605         (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass):
1606
1607 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
1608
1609         Unreviewed, revert part of r221152 to fix internal builds.
1610
1611         * crypto/mac/CryptoKeyRSAMac.cpp:
1612         (WebCore::CryptoKeyRSA::create):
1613
1614 2017-08-24  Kirill Ovchinnikov  <kirill.ovchinn@gmail.com>
1615
1616         HTMLTrackElement behavior violates the standard
1617         https://bugs.webkit.org/show_bug.cgi?id=175888
1618
1619         Reviewed by Eric Carlson.
1620
1621         Test: media/track/text-track-src-change.html: added asserts
1622
1623         * html/HTMLTrackElement.cpp:
1624         (WebCore::HTMLTrackElement::parseAttribute):
1625         (WebCore::HTMLTrackElement::loadTimerFired):
1626         * html/track/LoadableTextTrack.cpp:
1627         (WebCore::LoadableTextTrack::scheduleLoad):
1628         * html/track/TextTrack.cpp:
1629         (WebCore::TextTrack::removeAllCues):
1630         * html/track/TextTrackCueList.cpp:
1631         (WebCore::TextTrackCueList::removeAll):
1632         * html/track/TextTrackCueList.h:
1633
1634 2017-08-24  David Kilzer  <ddkilzer@apple.com>
1635
1636         Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
1637         <https://webkit.org/b/175910>
1638         <rdar://problem/33667497>
1639
1640         Reviewed by Alex Christensen.
1641
1642         Fix -Wunused-lambda-capture warnings:
1643
1644         * Modules/fetch/FetchResponse.cpp:
1645         (WebCore::FetchResponse::setBodyData): Remove unused lambda
1646         capture of 'this'.
1647         * style/RenderTreeUpdater.cpp:
1648         (WebCore::RenderTreeUpdater::createRenderer): Add
1649         UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
1650
1651         Fix -Wcast-qual warnings:
1652
1653         * crypto/mac/CryptoKeyRSAMac.cpp:
1654         (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
1655         reinterpret_cast with const keyword.  This better matches the
1656         argument types used in CCRSACryptorCreateFromData().
1657         * platform/audio/mac/FFTFrameMac.cpp:
1658         (WebCore::FFTFrame::doFFT): Switch from C-style cast to
1659         reinterpret_cast with const keyword.  This better matches the
1660         argument type used in vDSP_ctoz().
1661         * platform/graphics/FontPlatformData.h: Only define
1662         WebCore::toCTFont() and WebCore::toNSFont() when building for
1663         Objective-C++.
1664         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1665         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
1666         Switch from C-style cast to reinterpret_cast with const keyword.
1667         This better matches the argument type used in
1668         Uint8Array::setRange().
1669         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1670         (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
1671         const_cast to avoid warning.
1672         * platform/mac/SSLKeyGeneratorMac.mm:
1673         (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
1674         avoid warning, and switch C-style cast to reinterpret_cast.
1675         * xml/XSLTProcessorLibxslt.cpp:
1676         (WebCore::XSLTProcessor::transformToString):
1677         - Use const_cast to avoid warning, and switch C-style cast to
1678           reinterpret_cast.
1679         - Switch C-style cast to reinterpret_cast and add const keyword.
1680         * xml/parser/XMLDocumentParserLibxml2.cpp:
1681         (WebCore::XMLParserContext::createMemoryParser): Use const_cast
1682         to avoid warning, and switch C-style cast to reinterpret_cast.
1683
1684 2017-08-22  Dave Hyatt  <hyatt@apple.com>
1685
1686         [Repaint Outside Layout] Add a pref for repainting outside of layout
1687         https://bugs.webkit.org/show_bug.cgi?id=175729
1688
1689         Reviewed by Daniel Bates.
1690
1691         * page/Settings.in:
1692         * rendering/RenderElement.cpp:
1693         (WebCore::RenderElement::checkForRepaintDuringLayout):
1694
1695 2017-08-22  Darin Adler  <darin@apple.com>
1696
1697         REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
1698         https://bugs.webkit.org/show_bug.cgi?id=175270
1699
1700         Reviewed by Simon Fraser.
1701
1702         * dom/Document.cpp:
1703         (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work
1704         with a function that returns a bool and ignore the return value.
1705         (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the
1706         function did any work or not.
1707         * dom/Document.h: Updated for above change.
1708
1709         * page/FrameView.cpp:
1710         (WebCore::appendRenderedChildren): Added helper that will later replace the
1711         FrameView::renderedChildFrameViews function and is used below.
1712         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two
1713         passes of style and layout update do up to four passes, but stop as soon as a pass does
1714         no work. This is slightly more efficient in cases where no layout and style update is
1715         needed, and works correctly when a third pass is needed, which is what happens in the
1716         test that was failing. We can eventually improve this further, but this resolves the
1717         immediate problem we are seeing in the test.
1718
1719 2017-08-24  Don Olmstead  <don.olmstead@sony.com>
1720
1721         [CMake] Use find_package for SQLite
1722         https://bugs.webkit.org/show_bug.cgi?id=175803
1723
1724         Reviewed by Konstantin Tokarev.
1725
1726         No new tests. No change in behavior.
1727
1728         * CMakeLists.txt:
1729         * PlatformGTK.cmake:
1730         * PlatformMac.cmake:
1731         * PlatformWPE.cmake:
1732         * PlatformWinCairo.cmake:
1733
1734 2017-08-23  Adrian Perez de Castro  <aperez@igalia.com>
1735
1736         Geoclue2 based backend should provide the right desktop ID
1737         https://bugs.webkit.org/show_bug.cgi?id=129879
1738
1739         Reviewed by Michael Catanzaro.
1740
1741         * platform/geoclue/GeolocationProviderGeoclue.cpp:
1742         (GeolocationProviderGeoclue::createGeoclueClientProxyCallback): Try first obtaining the application
1743         identifier using GApplication first, keeping a fallback to the value returned by g_get_prgname().
1744
1745 2017-08-24  Zan Dobersek  <zdobersek@igalia.com>
1746
1747         [EME] Implement HTMLMediaElement dispatch of the onencrypted event
1748         https://bugs.webkit.org/show_bug.cgi?id=175927
1749
1750         Reviewed by Xabier Rodriguez-Calvar.
1751
1752         Add the MediaPlayerClient::mediaPlayerInitializationDataEncountered()
1753         method that the platform-layer media pipeline can invoke when it hits
1754         encrypted content in the media data. The initialization data and its type
1755         are passed by the caller, allowing the HTMLMediaElement override to
1756         process it further.
1757
1758         This is done in the mediaPlayerInitializationDataEncountered() override
1759         in the HTMLMediaElement class. Partially implementing the 'Initialization
1760         Data Encountered' algorithm, the 'encrypted' event is dispatched, with the
1761         MediaEncryptedEvent interface being leveraged to embed init data and init
1762         data type information. CORS and mixed-content validation of the media data
1763         is skipped for now.
1764
1765         MediaPlayer::initializationDataEncountered() method should be used to
1766         dispatch the corresponding method on the client, passing on the given init
1767         data and init data type values.
1768
1769         * html/HTMLMediaElement.cpp:
1770         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
1771         * html/HTMLMediaElement.h:
1772         * platform/graphics/MediaPlayer.cpp:
1773         (WebCore::MediaPlayer::initializationDataEncountered):
1774         * platform/graphics/MediaPlayer.h:
1775         (WebCore::MediaPlayerClient::mediaPlayerInitializationDataEncountered):
1776
1777 2017-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1778
1779         DeleteSelectionCommand should be robust when starting and ending editable positions cannot be found
1780         https://bugs.webkit.org/show_bug.cgi?id=175914
1781         <rdar://problem/29792688>
1782
1783         Reviewed by Ryosuke Niwa.
1784
1785         DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can
1786         happen when attempting to delete after selecting the contents within a canvas or output element with `read-write`
1787         `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust
1788         when editable start and end positions are missing.
1789
1790         Test: editing/execCommand/forward-delete-read-write-canvas.html
1791
1792         * editing/DeleteSelectionCommand.cpp:
1793         (WebCore::DeleteSelectionCommand::initializePositionData):
1794
1795         Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails
1796         early if initializePositionData returned false.
1797
1798         (WebCore::DeleteSelectionCommand::doApply):
1799         * editing/DeleteSelectionCommand.h:
1800
1801 2017-08-23  Youenn Fablet  <youenn@apple.com>
1802
1803         [Cache API] Unify WebCore and WebKit error handling
1804         https://bugs.webkit.org/show_bug.cgi?id=175902
1805         <rdar://problem/34045933>
1806
1807         Unreviewed.
1808
1809         * Modules/cache/DOMCache.h: Fixing Windows build.
1810
1811 2017-08-23  Ryan Haddad  <ryanhaddad@apple.com>
1812
1813         Unreviewed, rolling out r221109.
1814
1815         This change caused assertion failures on iOS and macOS debug
1816         bots.
1817
1818         Reverted changeset:
1819
1820         "Stop using PolicyCallback for new window policies"
1821         https://bugs.webkit.org/show_bug.cgi?id=175907
1822         http://trac.webkit.org/changeset/221109
1823
1824 2017-08-23  Jer Noble  <jer.noble@apple.com>
1825
1826         [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
1827         https://bugs.webkit.org/show_bug.cgi?id=175901
1828
1829         Reviewed by Eric Carlson.
1830
1831         The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
1832         regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
1833         have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
1834         times contains the timebase's current time.
1835
1836         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1837         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
1838
1839 2017-08-23  Youenn Fablet  <youenn@apple.com>
1840
1841         [Cache API] Unify WebCore and WebKit error handling
1842         https://bugs.webkit.org/show_bug.cgi?id=175902
1843
1844         Reviewed by Alex Christensen.
1845
1846         No change of behavior.
1847
1848         Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
1849         previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
1850
1851         Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
1852         Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
1853
1854         * CMakeLists.txt:
1855         * Modules/cache/Cache.cpp:
1856         (WebCore::FetchTasksHandler::FetchTasksHandler):
1857         (WebCore::FetchTasksHandler::records const):
1858         (WebCore::FetchTasksHandler::addRecord):
1859         (WebCore::Cache::addAll):
1860         (WebCore::Cache::put):
1861         (WebCore::Cache::retrieveRecords):
1862         (WebCore::queryCacheMatch):
1863         (WebCore::Cache::batchDeleteOperation):
1864         (WebCore::toConnectionRecord):
1865         (WebCore::Cache::batchPutOperation):
1866         (WebCore::Cache::updateRecords):
1867         * Modules/cache/Cache.h:
1868         * Modules/cache/CacheStorage.cpp:
1869         (WebCore::CacheStorage::retrieveCaches):
1870         (WebCore::CacheStorage::open):
1871         (WebCore::CacheStorage::remove):
1872         * Modules/cache/CacheStorage.h:
1873         * Modules/cache/CacheStorageConnection.cpp:
1874         (WebCore::CacheStorageConnection::open):
1875         (WebCore::CacheStorageConnection::remove):
1876         (WebCore::CacheStorageConnection::retrieveCaches):
1877         (WebCore::CacheStorageConnection::batchDeleteOperation):
1878         (WebCore::CacheStorageConnection::batchPutOperation):
1879         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
1880         (WebCore::CacheStorageConnection::updateCaches):
1881         (WebCore::CacheStorageConnection::updateRecords):
1882         (WebCore::CacheStorageConnection::deleteRecordsCompleted):
1883         (WebCore::CacheStorageConnection::putRecordsCompleted):
1884         * Modules/cache/CacheStorageConnection.h:
1885         (WebCore::CacheStorageConnection::openCompleted):
1886         (WebCore::CacheStorageConnection::removeCompleted):
1887         (WebCore::CacheStorageConnection::doOpen):
1888         (WebCore::CacheStorageConnection::doRemove):
1889         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
1890         (WebCore::CacheStorageConnection::doBatchPutOperation):
1891         * Modules/cache/WorkerCacheStorageConnection.cpp:
1892         (WebCore::toCrossThreadRecordData):
1893         (WebCore::fromCrossThreadRecordData):
1894         (WebCore::WorkerCacheStorageConnection::doOpen):
1895         (WebCore::WorkerCacheStorageConnection::doRemove):
1896         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1897         (WebCore::recordsDataFromRecords):
1898         (WebCore::recordsDataOrErrorFromRecords):
1899         (WebCore::recordsFromRecordsData):
1900         (WebCore::recordsOrErrorFromRecordsData):
1901         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
1902         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
1903         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
1904         * Modules/cache/DOMCache.cpp: Added.
1905         * Modules/cache/DOMCache.h: Added.
1906         * Modules/cache/WorkerCacheStorageConnection.h:
1907         * WebCore.xcodeproj/project.pbxproj:
1908
1909 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
1910
1911         [JSC] Optimize Map iteration with intrinsic
1912         https://bugs.webkit.org/show_bug.cgi?id=174355
1913
1914         Reviewed by Saam Barati.
1915
1916         * bindings/js/SerializedScriptValue.cpp:
1917         (WebCore::CloneSerializer::serialize):
1918
1919 2017-08-23  Alex Christensen  <achristensen@webkit.org>
1920
1921         Stop using PolicyCallback for new window policies
1922         https://bugs.webkit.org/show_bug.cgi?id=175907
1923
1924         Reviewed by Andy Estes.
1925
1926         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
1927         No change in behaviour.
1928
1929         * loader/PolicyCallback.cpp:
1930         (WebCore::PolicyCallback::set):
1931         (WebCore::PolicyCallback::call):
1932         (WebCore::PolicyCallback::cancel):
1933         * loader/PolicyCallback.h:
1934         * loader/PolicyChecker.cpp:
1935         (WebCore::PolicyChecker::checkNewWindowPolicy):
1936         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
1937         * loader/PolicyChecker.h:
1938
1939 2017-08-23  Alex Christensen  <achristensen@webkit.org>
1940
1941         Stop using PolicyChecker for ContentPolicy
1942         https://bugs.webkit.org/show_bug.cgi?id=175904
1943
1944         Reviewed by Tim Horton.
1945
1946         PolicyChecker is an artifact from the days before C++11.  Now we have lambdas which
1947         have a cleaner flow than one class that exists to be effectively one of three lambda types.
1948         Let's remove them one at a time, starting with ContentPolicy checks.
1949         
1950         No change in behaviour.
1951
1952         * loader/DocumentLoader.cpp:
1953         (WebCore::DocumentLoader::responseReceived):
1954         * loader/FrameLoader.cpp:
1955         (WebCore::FrameLoader::checkContentPolicy):
1956         * loader/FrameLoader.h:
1957         * loader/PolicyCallback.cpp:
1958         (WebCore::PolicyCallback::set):
1959         (WebCore::PolicyCallback::call):
1960         (WebCore::PolicyCallback::cancel):
1961         * loader/PolicyCallback.h:
1962         * loader/PolicyChecker.cpp:
1963         (WebCore::PolicyChecker::checkContentPolicy): Deleted.
1964         (WebCore::PolicyChecker::continueAfterContentPolicy): Deleted.
1965         * loader/PolicyChecker.h:
1966
1967 2017-08-23  Jer Noble  <jer.noble@apple.com>
1968
1969         Build fix for 32-bit Mac after r221098. Make sure constant used in WebCoreDecompressionSession is SoftLinked.
1970
1971         * platform/cf/CoreMediaSoftLink.cpp:
1972         * platform/cf/CoreMediaSoftLink.h:
1973
1974 2017-08-23  Jer Noble  <jer.noble@apple.com>
1975
1976         Track VideoPlaybackQuality metrics when using WebCoreDecompressionSession.
1977         https://bugs.webkit.org/show_bug.cgi?id=175835
1978         <rdar://problem/34022234>
1979
1980         Reviewed by Eric Carlson.
1981
1982         Test: platform/mac/media/media-source/videoplaybackquality-decompressionsession.html
1983
1984         Track the total number of frames decoded, dropped, & corrupted, as well as the total
1985         delay imposed by decoding in the WebCoreDecompressionSession.
1986
1987         Drive-by fix: implement frame dropping by skipping frames whose presentation times are
1988         before the video's current time and which aren't depended upon by other frames.
1989
1990         * platform/cf/CoreMediaSoftLink.cpp:
1991         * platform/cf/CoreMediaSoftLink.h:
1992         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1993         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
1994         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
1995         (WebCore::WebCoreDecompressionSession::totalVideoFrames):
1996         (WebCore::WebCoreDecompressionSession::droppedVideoFrames):
1997         (WebCore::WebCoreDecompressionSession::corruptedVideoFrames):
1998         (WebCore::WebCoreDecompressionSession::totalFrameDelay):
1999         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2000         (WebCore::WebCoreDecompressionSession::shouldDecodeSample):
2001         (WebCore::WebCoreDecompressionSession::decodeSample):
2002         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
2003
2004 2017-08-23  Andy Estes  <aestes@apple.com>
2005
2006         [Payment Request] Update to "In Development" in features.json
2007         https://bugs.webkit.org/show_bug.cgi?id=175897
2008
2009         Reviewed by Sam Weinig.
2010
2011         * features.json:
2012
2013 2017-08-22  Dean Jackson  <dino@apple.com>
2014
2015         Default passive touch event listeners on the root
2016         https://bugs.webkit.org/show_bug.cgi?id=175346
2017         <rdar://problem/33164597>
2018
2019         Reviewed by Sam Weinig.
2020
2021         Make any touchstart or touchmove event listeners passive by default
2022         if they are on the document, window, body or document element targets.
2023         This follows the "intervention" first implemented by Chrome/Blink:
2024
2025         https://github.com/WICG/interventions/issues/35
2026         https://docs.google.com/document/d/1II7oSIpd8pK91V5kEM3tDLKcIj398jOJn8Niqy6_loI/edit
2027         https://github.com/whatwg/dom/issues/365
2028
2029         If the event listener explicitly defines "passive" to false in their
2030         options dictionary, then they'll still get a non-passive listener.
2031
2032         NOTE: Any fallout from this bug should be collected in:
2033         https://bugs.webkit.org/show_bug.cgi?id=175869
2034         Please do not revert this change just because a site is broken. We'll
2035         gather the issues and see if we can evangelise or detect via code.
2036
2037         Tests: fast/events/touch/ios/passive-by-default-on-document-and-window.html
2038                fast/events/touch/ios/passive-by-default-overridden-on-document-and-window.html
2039
2040         * dom/EventNames.h:
2041         (WebCore::EventNames::isTouchScrollBlockingEventType const): Added this helper
2042         to identify the types of touches we want to check for.
2043         * dom/EventTarget.cpp:
2044         (WebCore::EventTarget::addEventListener): Check for the event being one of the touch-types
2045         that we care about, and the target being one of the Node/Window types we care about. If
2046         so, tell the event listener to be passive.
2047         * dom/EventTarget.h: Use an optional for the passive member.
2048         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
2049         * dom/EventTarget.idl: Change "passive" to not have a default value, so we
2050         can detect if it was explicitly set to false.
2051
2052 2017-08-23  Tim Horton  <timothy_horton@apple.com>
2053
2054         Try to fix the WinCairo build after r221068
2055
2056         * platform/win/PlatformScreenWin.cpp:
2057
2058 2017-08-23  Youenn Fablet  <youenn@apple.com>
2059
2060         [Cache API] Enable persistent coder to encode FetchOptions
2061         https://bugs.webkit.org/show_bug.cgi?id=175883
2062
2063         Reviewed by Alex Christensen.
2064
2065         No change of behavior.
2066         Adding encode/decode routines for FetchOptions.
2067
2068         * loader/FetchOptions.h:
2069         (WebCore::FetchOptions::encode const):
2070         (WebCore::FetchOptions::decode):
2071         * platform/ReferrerPolicy.h:
2072
2073 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
2074
2075         Race condition in StartWebThread causing crash
2076         https://bugs.webkit.org/show_bug.cgi?id=175852
2077
2078         Reviewed by Mark Lam.
2079
2080         When starting web thread, the main thread waits for completion of web thread initialization
2081         by using pthread_cond_t. However, the main thread may be woken up due to the existence of
2082         the spurious wake up of pthread_cond_t.
2083
2084         Instead, we should use WTF::Lock and WTF::Condition. Since our StartWebThread already calls
2085         WTF::initializeThreading, it is safe to use WTF::Lock and WTF::Condition. And our WTF::Condition
2086         does not have the spurious wake up problem as described in Condition.h.
2087
2088         * platform/ios/wak/WebCoreThread.mm:
2089         (RunWebThread):
2090         (StartWebThread):
2091
2092 2017-08-23  Brent Fulgham  <bfulgham@apple.com>
2093
2094         Ensure media controls host exists before using it
2095         https://bugs.webkit.org/show_bug.cgi?id=175833
2096         <rdar://problem/34001219>
2097
2098         Reviewed by Jer Noble.
2099
2100         Although we ensure that the media controls shadow root exists before updating the text track
2101         container, we don't check that the media controls host has been created yet. We do check
2102         and create in other places in HTMLMediaElement.
2103
2104         * html/HTMLMediaElement.cpp:
2105         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
2106
2107 2017-08-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2108
2109         [WPE] Some event handlers not working.
2110         https://bugs.webkit.org/show_bug.cgi?id=175864
2111
2112         Reviewed by Michael Catanzaro.
2113
2114         Share the EventHandler implementation with the GTK port and add ifdefs where needed.
2115
2116         Covered by existing tests.
2117
2118         * PlatformGTK.cmake:
2119         * PlatformWPE.cmake:
2120         * page/wpe/EventHandlerWPE.cpp: Removed.
2121         * platform/glib/EventHandlerGlib.cpp: Renamed from Source/WebCore/page/gtk/EventHandlerGtk.cpp.
2122         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
2123
2124 2017-08-22  Tim Horton  <timothy_horton@apple.com>
2125
2126         _WKThumbnailView should use the screen color space instead of sRGB
2127         https://bugs.webkit.org/show_bug.cgi?id=175858
2128         <rdar://problem/33925559>
2129
2130         Reviewed by Dean Jackson.
2131
2132         * platform/PlatformScreen.h:
2133         * platform/ios/PlatformScreenIOS.mm:
2134         (WebCore::screenColorSpace):
2135         * platform/mac/PlatformScreenMac.mm:
2136         (WebCore::screenColorSpace):
2137         (WebCore::screenSupportsExtendedColor):
2138         * platform/win/PlatformScreenWin.cpp:
2139         (WebCore::screenColorSpace):
2140         Add screenColorSpace, which returns the active color space for the
2141         given Widget's screen. On Windows, just fall back to sRGB like we usually do.
2142
2143 2017-08-22  Ryosuke Niwa  <rniwa@webkit.org>
2144
2145         Consolidate the code to normalize MIME type in DataTransfer
2146         https://bugs.webkit.org/show_bug.cgi?id=175810
2147
2148         Rubber-stamped by Wenson Hsieh.
2149
2150         Address the forgotten review comment by Wenson.
2151
2152         Tests: editing/pasteboard/datatransfer-getdata-plaintext.html
2153
2154         * dom/DataTransfer.cpp:
2155         (WebCore::DataTransfer::clearData):
2156
2157 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
2158
2159         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
2160         https://bugs.webkit.org/show_bug.cgi?id=175116
2161         <rdar://problem/28279301>
2162
2163         Reviewed by Darin Adler and Ryosuke Niwa.
2164
2165         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
2166
2167         Tests: EditorStateTests.TypingAttributesBold
2168                EditorStateTests.TypingAttributesItalic
2169                EditorStateTests.TypingAttributesUnderline
2170                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
2171                EditorStateTests.TypingAttributesTextAlignmentStartEnd
2172                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
2173                EditorStateTests.TypingAttributesTextColor
2174                EditorStateTests.TypingAttributesMixedStyles
2175                EditorStateTests.TypingAttributesLinkColor
2176
2177         * css/StyleProperties.cpp:
2178         (WebCore::StyleProperties::propertyAsColor const):
2179         (WebCore::StyleProperties::propertyAsValueID const):
2180
2181         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
2182
2183         * css/StyleProperties.h:
2184         * editing/EditingStyle.cpp:
2185         (WebCore::EditingStyle::hasStyle):
2186
2187         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
2188         because WebPage::editorState will now query for multiple styles at the selection start, but
2189         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
2190         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
2191         computed EditingStyle at selection start.
2192
2193         * editing/EditingStyle.h:
2194         * editing/Editor.cpp:
2195         (WebCore::Editor::selectionStartHasStyle const):
2196
2197 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2198
2199         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
2200         https://bugs.webkit.org/show_bug.cgi?id=175370
2201         <rdar://problem/33799806>
2202
2203         Reviewed by Ryosuke Niwa.
2204
2205         Remove didChangeSelectionAndUpdateLayout -- EditorState updates that are scheduled due to missing post-layout
2206         data will now be scheduled for the next presentation update. Additionally, add editor client hooks to notify the
2207         WebKit layer when we've updated the current composition. See WebKit ChangeLog for more details. This patch
2208         adjusts and rebaselines existing layout tests.
2209
2210         * editing/Editor.cpp:
2211         (WebCore::SetCompositionScope::SetCompositionScope):
2212         (WebCore::SetCompositionScope::~SetCompositionScope):
2213
2214         Introduce a helper RAII class to ensure that we ignore selection changes during the scope of
2215         Editor::setComposition and call out to the client with WebEditorClient::didUpdateComposition afterwards. This
2216         also maintains a UserTypingGestureIndicator over its lifetime, so we don't additionally need to create a
2217         UserTypingGestureIndicator in Editor::setComposition.
2218
2219         (WebCore::Editor::setComposition):
2220         * editing/FrameSelection.cpp:
2221         (WebCore::FrameSelection::setSelection):
2222         (WebCore::FrameSelection::updateAndRevealSelection):
2223         (WebCore::FrameSelection::setSelectedRange):
2224         * editing/FrameSelection.h:
2225         (WebCore::FrameSelection::defaultSetSelectionOptions):
2226
2227         Plumb state about whether or not the selection change was triggered by the user to FrameSelection::setSelection,
2228         and if so, notify the editing client. A separate SetSelectionOptions flag is used here instead of
2229         RevealSelection to avoid calling out to the client in places where we want to reveal the selection regardless of
2230         whether or not the selection is user triggered.
2231
2232         * loader/EmptyClients.cpp:
2233         * page/EditorClient.h:
2234
2235 2017-08-21  Ryosuke Niwa  <rniwa@webkit.org>
2236
2237         Consolidate the code to normalize MIME type in DataTransfer
2238         https://bugs.webkit.org/show_bug.cgi?id=175810
2239
2240         Reviewed by Wenson Hsieh.
2241
2242         Factored out the code to convert MIME type to lowercase after stripping whitespace,
2243         and treat "text" as "text/plain" and "url" as "text/uri-list".
2244
2245         Specifications:
2246         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata-2
2247         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata-2
2248         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata-2
2249
2250         Stripping of whitespace only happens in WebKit/Blink but it's probably required for compatbility.
2251         Spec bug: https://github.com/whatwg/html/issues/2946
2252
2253         Test: editing/pasteboard/datatransfer-getdata-plaintext.html
2254
2255         * dom/DataTransfer.cpp:
2256         (WebCore::normalizeType):
2257         (WebCore::DataTransfer::clearData):
2258         (WebCore::DataTransfer::getData const):
2259         (WebCore::DataTransfer::setData):
2260         * platform/gtk/PasteboardGtk.cpp:
2261         (WebCore::selectionDataTypeFromHTMLClipboardType):
2262         * platform/ios/PasteboardIOS.mm:
2263         (WebCore::cocoaTypeFromHTMLClipboardType):
2264         * platform/mac/PasteboardMac.mm:
2265         (WebCore::cocoaTypeFromHTMLClipboardType):
2266         * platform/win/PasteboardWin.cpp:
2267         (WebCore::clipboardTypeFromMIMEType):
2268
2269 2017-08-22  Matt Lewis  <jlewis3@apple.com>
2270
2271         Unreviewed, rolling out r221033.
2272
2273         This revision caused assertion failures on all Open Source
2274         Debug testers. See Radar for more information.
2275
2276         Reverted changeset:
2277
2278         "Ensure media controls host exists before using it"
2279         https://bugs.webkit.org/show_bug.cgi?id=175833
2280         http://trac.webkit.org/changeset/221033
2281
2282 2017-08-22  Per Arne Vollan  <pvollan@apple.com>
2283
2284         [Win] Fix compile errors.
2285         https://bugs.webkit.org/show_bug.cgi?id=175860
2286
2287         Reviewed by Brent Fulgham.
2288
2289         Add required header files. 
2290
2291         * platform/network/cf/CookieJarCFNet.cpp:
2292
2293 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2294
2295         Correct SOUP builds after r221017 and r221050.
2296         https://bugs.webkit.org/show_bug.cgi?id=175846
2297
2298         Reviewed by Michael Catanzaro.
2299
2300         * platform/network/soup/CookieJarSoup.cpp:
2301         (WebCore::cookiesForDOM): Revise return type.
2302
2303 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2304
2305         Correct SOUP and cURL builds after r221017.
2306         https://bugs.webkit.org/show_bug.cgi?id=175846
2307
2308         Reviewed by Michael Catanzaro.
2309
2310         Correct the method signatures for 'cookiesForDOM' on the SOUP and cURL backends.
2311         Note that these ports will need to add specific logic to find/filter secure cookies
2312         if requested by the caller.
2313
2314         * platform/network/curl/CookieJarCurl.cpp:
2315         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
2316         (WebCore::cookiesForDOM):
2317         * platform/network/curl/CookieJarCurl.h:
2318         * platform/network/soup/CookieJarSoup.cpp:
2319         (WebCore::cookiesForDOM):
2320
2321 2017-08-22  Chris Dumez  <cdumez@apple.com>
2322
2323         [EnabledBySetting] in WebIDL uses Document but does not include Document.h
2324         https://bugs.webkit.org/show_bug.cgi?id=175843
2325
2326         Reviewed by Sam Weinig.
2327
2328         * bindings/scripts/CodeGeneratorJS.pm:
2329         (GenerateImplementation):
2330
2331 2017-08-22  Jer Noble  <jer.noble@apple.com>
2332
2333         Refactor videoPerformanceQuality() MediaPlayer methods into single call.
2334         https://bugs.webkit.org/show_bug.cgi?id=175830
2335
2336         Reviewed by Eric Carlson.
2337
2338         Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in
2339         a single call. For clients which incur significant overhead to request this data, this reduces the cost
2340         of requesting data by the number of calls removed.
2341
2342         * html/HTMLMediaElement.cpp:
2343         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
2344         * platform/graphics/MediaPlayer.cpp:
2345         (WebCore::MediaPlayer::videoPlaybackQualityMetrics):
2346         (WebCore::MediaPlayer::totalVideoFrames): Deleted.
2347         (WebCore::MediaPlayer::droppedVideoFrames): Deleted.
2348         (WebCore::MediaPlayer::corruptedVideoFrames): Deleted.
2349         (WebCore::MediaPlayer::totalFrameDelay): Deleted.
2350         * platform/graphics/MediaPlayer.h:
2351         (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics):
2352         * platform/graphics/MediaPlayerPrivate.h:
2353         (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics):
2354         (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted.
2355         (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted.
2356         (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted.
2357         (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted.
2358         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2359         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2360         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
2361         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted.
2362         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted.
2363         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted.
2364         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted.
2365         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2366         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2367         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
2368         (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted.
2369         (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted.
2370         (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted.
2371         (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted.
2372         * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
2373         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
2374         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
2375         * platform/mock/mediasource/MockMediaSourcePrivate.h:
2376
2377 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
2378
2379         Ensure media controls host exists before using it
2380         https://bugs.webkit.org/show_bug.cgi?id=175833
2381         <rdar://problem/34001219>
2382
2383         Reviewed by Jer Noble.
2384
2385         Although we ensure that the media controls shadow root exists before updating the text track
2386         container, we don't check that the media controls host has been created yet. We do check
2387         and create in other places in HTMLMediaElement.
2388
2389         Tests: media/track/track-display-before-controls-crash.html
2390
2391         * html/HTMLMediaElement.cpp:
2392         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
2393
2394 2017-08-22  Youenn Fablet  <youenn@apple.com>
2395
2396         [Cache API] Optimize whitespace trimming in Vary header values
2397         https://bugs.webkit.org/show_bug.cgi?id=175837
2398
2399         Reviewed by Alex Christensen.
2400
2401         No change of behavior.
2402
2403         Introducing a StringView version of stripLeadingAndTrailingHTTPSpaces.
2404
2405         * Modules/cache/Cache.cpp:
2406         (WebCore::hasResponseVaryStarHeaderValue):
2407         * platform/network/HTTPParsers.h:
2408         (WebCore::stripLeadingAndTrailingHTTPSpaces):
2409
2410 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2411
2412         Remove ChromeClient::scrollbarsModeDidChange
2413         https://bugs.webkit.org/show_bug.cgi?id=175805
2414
2415         Reviewed by Daniel Bates.
2416
2417         No change in behavior.  It was never called, and no implementations did anything.
2418
2419         * loader/EmptyClients.h:
2420         * page/Chrome.cpp:
2421         (WebCore::Chrome::scrollbarsModeDidChange const): Deleted.
2422         * page/Chrome.h:
2423         * page/ChromeClient.h:
2424         * platform/HostWindow.h:
2425
2426 2017-08-22  Devin Rousso  <webkit@devinrousso.com>
2427
2428         Web Inspector: provide way for ShaderPrograms to be enabled/disabled
2429         https://bugs.webkit.org/show_bug.cgi?id=175400
2430
2431         Reviewed by Matt Baker.
2432
2433         Test: inspector/canvas/setShaderProgramDisabled.html
2434
2435         * inspector/InspectorShaderProgram.h:
2436         (WebCore::InspectorShaderProgram::disabled):
2437         (WebCore::InspectorShaderProgram::setDisabled):
2438
2439         * html/canvas/WebGLRenderingContextBase.cpp:
2440         (WebCore::WebGLRenderingContextBase::drawArrays):
2441         (WebCore::WebGLRenderingContextBase::drawElements):
2442         If the current program is disabled, return early. This will prevent the current shader
2443         program from drawing anything to the canvas.
2444
2445         * inspector/InspectorCanvasAgent.h:
2446         * inspector/InspectorCanvasAgent.cpp:
2447         (WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
2448         (WebCore::InspectorCanvasAgent::isShaderProgramDisabled):
2449         * inspector/InspectorInstrumentation.h:
2450         * inspector/InspectorInstrumentation.cpp:
2451         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
2452         (WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl):
2453
2454 2017-08-22  Youenn Fablet  <youenn@apple.com>
2455
2456         [Cache API] Add support for overwriting responses with put on an existing record
2457         https://bugs.webkit.org/show_bug.cgi?id=175825
2458
2459         Reviewed by Geoffrey Garen.
2460
2461         Tests: http/wpt/cache-storage/cache-put-keys.https.any.html
2462                http/wpt/cache-storage/cache-put-keys.https.any.worker.html
2463
2464         Adding support for the new response update counter.
2465         Overwriting local cached response with new retrieved response when the counter is different.
2466         Adding support for passing this value from/to workers.
2467
2468         * Modules/cache/Cache.cpp:
2469         (WebCore::Cache::queryCacheWithTargetStorage):
2470         (WebCore::toConnectionRecord):
2471         (WebCore::Cache::updateRecords):
2472         * Modules/cache/CacheStorageConnection.cpp:
2473         (WebCore::CacheStorageConnection::Record::copy const):
2474         * Modules/cache/CacheStorageConnection.h:
2475         * Modules/cache/CacheStorageRecord.h:
2476         * Modules/cache/WorkerCacheStorageConnection.cpp:
2477         (WebCore::toCrossThreadRecordData):
2478         (WebCore::fromCrossThreadRecordData):
2479
2480 2017-08-22  Alex Christensen  <achristensen@webkit.org>
2481
2482         Remove ChromeClient::hasOpenedPopup
2483         https://bugs.webkit.org/show_bug.cgi?id=175804
2484
2485         Reviewed by Sam Weinig.
2486
2487         No change in behavior.  All implementations just returned false.
2488
2489         * loader/EmptyClients.h:
2490         * page/Chrome.cpp:
2491         (WebCore::Chrome::hasOpenedPopup const): Deleted.
2492         * page/Chrome.h:
2493         * page/ChromeClient.h:
2494         * rendering/RenderMenuList.cpp:
2495         (RenderMenuList::showPopup):
2496
2497 2017-08-22  Andy Estes  <aestes@apple.com>
2498
2499         [Payment Request] Implement error checking for show(), abort(), and canMakePayment()
2500         https://bugs.webkit.org/show_bug.cgi?id=175789
2501
2502         Reviewed by Brady Eidson.
2503
2504         Implement many of the exceptions and promise rejections specified for PaymentRequest's
2505         show(), abort(), and canMakePayment() methods. Also implement basic state tracking.
2506
2507         * Modules/paymentrequest/PaymentRequest.cpp:
2508         (WebCore::PaymentRequest::create): Changed serializedMethodData from a
2509         HashMap<String, String> to a Vector<PaymentRequest::Method>.
2510         (WebCore::PaymentRequest::PaymentRequest):
2511         (WebCore::PaymentRequest::show): Added promise rejection for invalid state, updated the
2512         state to Interactive, stored the promise in m_showPromise, and dispatched finishShowing().
2513         (WebCore::PaymentRequest::finishShowing): Added JSON parsing of payment method serialized
2514         data and exception propagation. If there are no exceptions, rejected m_showPromise with
2515         NotSupportedError since we don't yet support any payment methods.
2516         (WebCore::PaymentRequest::abort): Added promise rejection for invalid state and stored the
2517         promise in m_abortPromise. Dispatched a lambda to update the state to Closed, reject
2518         m_showPromise, and resolve m_abortPromise.
2519         (WebCore::PaymentRequest::canMakePayment): Added promise rejection for invalid state and
2520         stored the promise in m_canMakePaymentPromise. Dispatched a lambda to resolve
2521         m_canMakePaymentPromise with false since we don't yet support any payment methods.
2522         * Modules/paymentrequest/PaymentRequest.h:
2523         * Modules/paymentrequest/PaymentRequest.idl: Annotated abort() with MayThrowException.
2524
2525 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
2526
2527         Disable access to secure cookies if an HTTPS site loads mixed content
2528         https://bugs.webkit.org/show_bug.cgi?id=157053
2529         <rdar://problem/11290808>
2530
2531         Reviewed by Dan Bates.
2532
2533         Tests: http/tests/security/mixedContent/insecure-css-with-secure-cookies.html
2534                http/tests/security/mixedContent/insecure-image-with-securecookie-block.html
2535                http/tests/security/mixedContent/insecure-image-with-securecookie.html
2536                http/tests/security/mixedContent/insecure-script-with-secure-cookies.html
2537                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies-block.html
2538                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies.html
2539
2540         * dom/SecurityContext.h: 
2541         (WebCore::SecurityContext::secureCookiesAccessed): Added.
2542         (WebCore::SecurityContext::setSecureCookiesAccessed): Added.
2543         * loader/CookieJar.cpp:
2544         (WebCore::cookies): Pass Document as non-const so we can call 'setSecureCookiesAccessed' if necessary.
2545         * loader/CookieJar.h:
2546         * loader/MixedContentChecker.cpp:
2547         (WebCore::MixedContentChecker::canRunInsecureContent): Updated checks to avoid running insecure content
2548         if secure cookies were accessed. 
2549         * platform/CookiesStrategy.h:
2550         (WebCore::CookiesStrategy::cookiesForDOM): Pass new argument indicating whether secure cookies should be included in the response.
2551         * platform/network/PlatformCookieJar.h:
2552         * platform/network/cf/CookieJarCFNet.cpp:
2553         (copyCookiesForURLWithFirstPartyURL): Revise to accept new 'IncludeSecureCookiesOrNot' argument.
2554         (WebCore::cookiesForSession): Updated to accept new 'IncludeSecureCookiesOrNot' argument. Also determine if secure cookies were
2555         included in the response, and return this to the caller.
2556         (WebCore::cookieRequestHeaderFieldValue): Revise for new 'copyCookiesForURLWithFirstPartyURL' signature.
2557         (WebCore::getRawCookies): Ditto.
2558         * platform/network/mac/CookieJarMac.mm:
2559         (WebCore::cookiesForSession): Updated checks to keep track of secure cookies and filter out secure cookies if insecure content
2560         was accessed.
2561         (WebCore::cookiesForDOM): Update for new arguments and to return a pair.
2562         (WebCore::cookieRequestHeaderFieldValue): Ditto.
2563
2564 2017-08-22  Jer Noble  <jer.noble@apple.com>
2565
2566         Autoplay Muted Videos Don't Play When Outside Viewport
2567         https://bugs.webkit.org/show_bug.cgi?id=175748
2568         <rdar://problem/33974383>
2569
2570         Reviewed by Eric Carlson.
2571
2572         Test: media/video-restricted-invisible-autoplay-not-allowed-source.html
2573
2574         The media session is notified that its client (the media element) will begin autoplaying inside
2575         prepareForLoad(), where the m_autoplaying flag is also set. But loading via <source> elements does not go
2576         through prepareForLoad(); the HTML standard states that the <source> element loading path does not trigger the
2577         "media element load algorithm" which is implemented in prepareForLoad(). Since the m_autoplaying flag is
2578         initially set to true, notify the media session that the element will begin autoplaying inside the element's
2579         constructor.
2580
2581         Drive-by fix: Doing the above causes other tests to crash, as purturbing play state during style change can cause
2582         re-entrancy in the native controls code, or fail, since we will transition from autoplay -> play even if there's
2583         not yet a src or source to the media element. Add a task queue for updating the autoplay state and check the ready
2584         state before allowing autoplay to transition to play.
2585
2586         * html/HTMLMediaElement.cpp:
2587         (WebCore::HTMLMediaElement::HTMLMediaElement):
2588         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2589         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
2590         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
2591
2592 2017-08-21  Matt Rajca  <mrajca@apple.com>
2593
2594         Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
2595         https://bugs.webkit.org/show_bug.cgi?id=175796
2596
2597         Reviewed by Eric Carlson.
2598
2599         Test: media/video-user-gesture-tracking.html
2600
2601         The page media state depends on m_userHasInteractedWithMediaElement, so force it to update
2602         as soon as m_userHasInteractedWithMediaElement changes. This fixes an issue where the media
2603         state would not reflect the user interaction flag until a call to updateIsPlayingMedia was made.
2604
2605         * dom/Document.cpp:
2606         (WebCore::Document::noteUserInteractionWithMediaElement):
2607         * dom/Document.h:
2608         (WebCore::Document::noteUserInteractionWithMediaElement): Deleted.
2609         * testing/Internals.cpp:
2610         (WebCore::Internals::pageMediaState):
2611
2612 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
2613
2614         GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
2615         https://bugs.webkit.org/show_bug.cgi?id=175819
2616
2617         Reviewed by Xabier Rodriguez-Calvar.
2618
2619         * platform/graphics/GLContext.cpp: The ThreadGlobalGLContext object is
2620         allocated on heap, so the embedded GLContext pointer can contain a
2621         non-null value that can cause problems when e.g. checking for a current
2622         GLContext on some specific thread on which a GLContext hasn't yet been
2623         made current. Zero-initializing this pointer will avoid false positives
2624         that can occur in these circumstances.
2625
2626 2017-08-21  Youenn Fablet  <youenn@apple.com>
2627
2628         [Cache API] Add support for Cache.add/addAll
2629         https://bugs.webkit.org/show_bug.cgi?id=175677
2630
2631         Reviewed by Alex Christensen.
2632
2633         Covered by rebased tests.
2634
2635         Cache.addAll implementation is then as follow:
2636         - Fetch the resources in parallel.
2637         - Wait for all them to complete using FetchTaskCounter.
2638         - If an error happens in any load or if the response is not as expected for Cache API, reject the promise.
2639         - Call the batch put operation with all received FetchResponse objects.
2640
2641         FetchTaskCounter is responsible to wait for each response to arrive.
2642         It then checks whether the response is fine,
2643         If not, the addAll promise is rejected.
2644         Otherwise, it waits for the body to be received.
2645
2646         Introducing a helper routine to create a FetchRequest from a given RequestInfo.
2647         Introducing a helper routine to check for Vary Header '*' value in response headers.
2648
2649         * Modules/cache/Cache.cpp:
2650         (WebCore::Cache::doMatch):
2651         (WebCore::Cache::add):
2652         (WebCore::queryCacheMatch):
2653         (WebCore::hasResponseVaryStarHeaderValue):
2654         (WebCore::FetchTaskCounter::FetchTaskCounter):
2655         (WebCore::FetchTaskCounter::~FetchTaskCounter):
2656         (WebCore::FetchTaskCounter::addRecord):
2657         (WebCore::FetchTaskCounter::isDone const):
2658         (WebCore::FetchTaskCounter::reject):
2659         (WebCore::Cache::requestFromInfo):
2660         (WebCore::Cache::addAll):
2661         (WebCore::Cache::put):
2662         (WebCore::Cache::remove):
2663         (WebCore::Cache::keys):
2664         (WebCore::toConnectionRecord):
2665         (WebCore::Cache::batchPutOperation):
2666         * Modules/cache/Cache.h:
2667
2668 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
2669
2670         DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion
2671         https://bugs.webkit.org/show_bug.cgi?id=175787
2672         <rdar://problem/33996612>
2673
2674         Reviewed by Wenson Hsieh.
2675
2676         The variation axis values of San Francisco changed from the GX-style scale to the CSS-style
2677         scale. Previously, we were normalizing the values we got from Core Text to fit the CSS scale;
2678         however, this is no longer necessary since the font now does this itself.
2679
2680         The assertion was getting hit because the normalized values were huge and were overflowing
2681         a single FontSelectionValue (and going negative). This patch adds handling for this
2682         situation.
2683
2684         Test: DataInteractionTests.ExternalSourceBoldSystemAttributedStringToContentEditable
2685
2686         * platform/graphics/FontSelectionAlgorithm.h: Typedef the backing type for a FontSelectionValue.
2687         (WebCore::FontSelectionValue::rawValue const):
2688         (WebCore::FontSelectionValue::maximumValue):
2689         (WebCore::FontSelectionValue::minimumValue):
2690         (WebCore::FontSelectionValue::FontSelectionValue):
2691         * platform/graphics/cocoa/FontCacheCoreText.cpp: Opt-out of normalization for San Francisco.
2692         (WebCore::variationCapabilitiesForFontDescriptor):
2693         (WebCore::capabilitiesForFontDescriptor):
2694
2695 2017-08-21  Chris Dumez  <cdumez@apple.com>
2696
2697         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
2698         https://bugs.webkit.org/show_bug.cgi?id=175746
2699         <rdar://problem/33946050>
2700
2701         Reviewed by Alex Christensen.
2702
2703         Update PingLoad to process content extension rules upon redirect. This allows content
2704         extensions to block and upgrade to HTTPS beacon / ping loads.
2705
2706         Because ping loads can outlive the WebProcess, the content extensions rules are passed
2707         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
2708         rules upon redirect, on the NetworkProcess side.
2709
2710         Tests: http/wpt/beacon/contentextensions/beacon-blocked.html
2711                http/wpt/beacon/contentextensions/beacon-redirect-blocked.html
2712
2713         * contentextensions/ContentExtensionActions.h:
2714         * contentextensions/ContentExtensionsBackend.cpp:
2715         (WebCore::ContentExtensions::ContentExtensionsBackend::forEach):
2716         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad):
2717         * contentextensions/ContentExtensionsBackend.h:
2718         * page/Page.h:
2719         * page/UserContentProvider.cpp:
2720         (WebCore::UserContentProvider::forEachContentExtension):
2721         * page/UserContentProvider.h:
2722
2723 2017-08-21  Brady Eidson  <beidson@apple.com>
2724
2725         ASSERTION FAILED: !m_connections.contains(&connection) in WebCore::SWServer::unregisterConnection(WebCore::SWServer::Connection&).
2726         https://bugs.webkit.org/show_bug.cgi?id=175795
2727
2728         Rubber-stamped by Andy Estes.
2729
2730         * workers/service/server/SWServer.cpp:
2731         (WebCore::SWServer::unregisterConnection): Flip the ASSERT to be... correct.
2732
2733 2017-08-21  Daniel Bates  <dabates@apple.com>
2734
2735         Cleanup TextPainter
2736         https://bugs.webkit.org/show_bug.cgi?id=175782
2737
2738         Reviewed by Myles C. Maxfield.
2739
2740         Remove redundant mention of "text" in the name of TextPainter member functions, add separate
2741         setters for selection and non-selection shadows, and do some other minor cleanups.
2742
2743         * rendering/InlineTextBox.cpp:
2744         (WebCore::InlineTextBox::paint): Update code for renamed functions.
2745         * rendering/SimpleLineLayoutFunctions.cpp:
2746         (WebCore::SimpleLineLayout::paintFlow): Ditto.
2747         * rendering/TextPainter.cpp: Include ShadowData.h.
2748         (WebCore::ShadowApplier::ShadowApplier): Use C++11 brace-initialization syntax.
2749         (WebCore::ShadowApplier::isLastShadowIteration): Moved from TextPainter.h.
2750         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
2751         (WebCore::TextPainter::paintTextOrEmphasisMarks): Renamed; formerly named drawTextOrEmphasisMarks.
2752         (WebCore::TextPainter::paintTextWithShadows): Update code for renamed functions.
2753         (WebCore::TextPainter::paintRange): Renamed; formerly named paintTextInRange.
2754         (WebCore::TextPainter::paint): Renamed; formerly named paintText.
2755         (WebCore::TextPainter::drawTextOrEmphasisMarks): Renamed to paintTextOrEmphasisMarks() to match
2756         the naming convention of all the other paint functions in this class.
2757         (WebCore::TextPainter::paintTextInRange): Renamed to paintRange.
2758         (WebCore::TextPainter::paintText): Renamed to paint.
2759         * rendering/TextPainter.h: Forward declare ShadowData.
2760         (WebCore::TextPainter::setStyle): Renamed; formerly named setTextPaintStyle.
2761         (WebCore::TextPainter::setSelectionStyle): Renamed; formerly named setSelectionPaintStyle.
2762         (WebCore::TextPainter::setShadow): Added.
2763         (WebCore::TextPainter::setSelectionShadow): Added.
2764         (WebCore::TextPainter::setEmphasisMark): Renamed; formerly named addEmphasis. 
2765         (WebCore::TextPainter::setTextPaintStyle): Renamed to setStyle.
2766         (WebCore::TextPainter::setSelectionPaintStyle): Renamed to setSelectionStyle.
2767         (WebCore::TextPainter::addEmphasis): Renamed to setEmphasisMark.
2768         (WebCore::TextPainter::addTextShadow): Split functionality into setShadow and setSelectionShadow.
2769         (WebCore::ShadowApplier::isLastShadowIteration): Moved to TextPainter.cpp.
2770         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
2771
2772 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
2773
2774         Addressing post-review comments after r220725
2775         https://bugs.webkit.org/show_bug.cgi?id=175382
2776
2777         Reviewed by Darin Adler.
2778
2779         * css/CSSFontFace.cpp:
2780         (WebCore::CSSFontFace::setUnicodeRange):
2781
2782 2017-08-21  Youenn Fablet  <youenn@apple.com>
2783
2784         [Cache API] Add support for CacheStorage.match
2785         https://bugs.webkit.org/show_bug.cgi?id=175747
2786
2787         Reviewed by Chris Dumez.
2788
2789         Covered by rebased tests.
2790
2791         Introducing Cache::doMatch so that CacheStorage can use it.
2792         Make Cache::match use Cache::doMatch as well.
2793
2794         Implementing CacheStorage.match as per spec:
2795         - If name is provided, query only the cache with the given name.
2796         - Otherwise pick the first matching response in the caches.
2797         The sequential asynchronous search is done in doSequentialMatch.
2798
2799         Making sure that response with a status code are returning false to isNull.
2800         This allows passing more tests.
2801
2802         * Modules/cache/Cache.cpp:
2803         (WebCore::Cache::match):
2804         (WebCore::Cache::doMatch):
2805         (WebCore::Cache::matchAll):
2806         (WebCore::toConnectionRecord):
2807         * Modules/cache/Cache.h:
2808         * Modules/cache/CacheStorage.cpp:
2809         (WebCore::doSequentialMatch):
2810         (WebCore::copyCaches):
2811         (WebCore::CacheStorage::match):
2812         * platform/network/ResourceResponseBase.cpp:
2813         (WebCore::ResourceResponseBase::setHTTPStatusCode):
2814
2815 2017-08-21  Dean Jackson  <dino@apple.com>
2816
2817         Persistent WebGL Warning "vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported" in Safari 10.1.2
2818         https://bugs.webkit.org/show_bug.cgi?id=175783
2819         <rdar://problem/33623867>
2820
2821         Reviewed by Alex Christensen.
2822
2823         The version of ANGLE we use inserts this line into each shader:
2824         #extension GL_ARB_gpu_shader5 : enable
2825         It causes our lower-level GLSL compiler to give a warning, which is
2826         confusing to developers because they didn't write this code.
2827
2828         Until we upgrade our OpenGL support to version 4.1, we should remove
2829         this error message from the log returned to the developer.
2830         See https://bugs.webkit.org/show_bug.cgi?id=175785
2831
2832         Test: fast/canvas/webgl/no-info-log-for-simple-shaders.html
2833
2834         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2835         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Search for and remove
2836         this warning.
2837
2838 2017-08-21  Andy Estes  <aestes@apple.com>
2839
2840         [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
2841         https://bugs.webkit.org/show_bug.cgi?id=175776
2842
2843         Reviewed by Darin Adler.
2844
2845         * Modules/paymentrequest/PaymentRequest.cpp:
2846         (WebCore::PaymentRequest::create):
2847         * Modules/paymentrequest/PaymentRequest.h:
2848
2849 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2850
2851         [PAL] Move spi/mac directory into PAL
2852         https://bugs.webkit.org/show_bug.cgi?id=175649
2853
2854         Reviewed by Myles C. Maxfield.
2855
2856         * WebCore.xcodeproj/project.pbxproj:
2857         * editing/cocoa/DataDetection.mm:
2858         * editing/mac/DictionaryLookup.h:
2859         * editing/mac/DictionaryLookup.mm:
2860         * page/mac/ServicesOverlayController.mm:
2861         * page/mac/WheelEventDeltaFilterMac.mm:
2862         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
2863         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2864         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
2865         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
2866         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2867         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2868         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2869         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2870         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2871         * platform/graphics/mac/FontCacheMac.mm:
2872         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
2873         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2874         * platform/graphics/mac/MediaTimeQTKit.h:
2875         * platform/mac/MediaRemoteSoftLink.cpp:
2876         * platform/mac/MediaRemoteSoftLink.h:
2877         * platform/mac/PasteboardWriter.mm:
2878         * platform/mac/PlatformEventFactoryMac.mm:
2879         * platform/mac/ScrollAnimatorMac.mm:
2880         * platform/mac/ScrollbarThemeMac.mm:
2881         * platform/mac/VideoFullscreenInterfaceMac.mm:
2882         * platform/mac/WebVideoFullscreenController.mm:
2883         * rendering/RenderThemeMac.mm:
2884
2885 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
2886
2887         [GTK][WPE][GSTREAMER_GL] Overriden virtual function not marked “override” in MediaPlayerPrivateGStreamerBase.h
2888         https://bugs.webkit.org/show_bug.cgi?id=175780
2889
2890         Reviewed by Konstantin Tokarev.
2891
2892         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Add missing "override" qualifier.
2893
2894 2017-08-21  Brady Eidson  <beidson@apple.com>
2895
2896         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
2897         https://bugs.webkit.org/show_bug.cgi?id=175745
2898
2899         Reviewed by Andy Estes.
2900
2901         No new tests (No behavior change).
2902
2903         Each of these has a much different environment that it lives in, so being the same object
2904         hinders clean development.
2905         
2906         This split will also make it easier for the WebCore objects to directly handle WK2 messages.
2907         
2908         * CMakeLists.txt:
2909         * WebCore.xcodeproj/project.pbxproj:
2910         
2911         * platform/Logging.h:
2912
2913         * workers/service/ServiceWorkerContainer.cpp:
2914         (WebCore::ServiceWorkerContainer::addRegistration):
2915         (WebCore::ServiceWorkerContainer::scheduleJob):
2916         * workers/service/ServiceWorkerContainer.h:
2917
2918         * workers/service/ServiceWorkerProvider.h:
2919
2920         * workers/service/server/SWClientConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServer.cpp.
2921         (WebCore::SWClientConnection::SWClientConnection):
2922         (WebCore::SWClientConnection::~SWClientConnection):
2923         (WebCore::SWClientConnection::scheduleJob):
2924         (WebCore::SWClientConnection::jobRejectedInServer):
2925         * workers/service/server/SWClientConnection.h: Copied from Source/WebCore/workers/service/server/SWServer.h.
2926
2927         * workers/service/server/SWServer.cpp:
2928         (WebCore::SWServer::Connection::Connection):
2929         (WebCore::SWServer::Connection::~Connection):
2930         (WebCore::SWServer::~SWServer):
2931         (WebCore::SWServer::Connection::scheduleJobInServer):
2932         (WebCore::SWServer::scheduleJob):
2933         (WebCore::SWServer::registerConnection):
2934         (WebCore::SWServer::unregisterConnection):
2935         (WebCore::SWServer::Connection::scheduleJob): Deleted.
2936         (WebCore::SWServer::Connection::jobRejected): Deleted.
2937         * workers/service/server/SWServer.h:
2938         (WebCore::SWServer::Connection::server):
2939         (WebCore::SWServer::Connection::~Connection): Deleted.
2940
2941 2017-08-21  Andy Estes  <aestes@apple.com>
2942
2943         [Payment Request] Implement the PaymentRequest constructor
2944         https://bugs.webkit.org/show_bug.cgi?id=175755
2945
2946         Reviewed by Darin Adler.
2947
2948         * Modules/paymentrequest/PaymentDetailsModifier.h: Changed total to an std::optional<PaymentItem>.
2949         * Modules/paymentrequest/PaymentRequest.cpp:
2950         (WebCore::isWellFormedCurrencyCode): Implements the IsWellFormedCurrencyCode abstract operation from ECMA 402.
2951         (WebCore::isValidDecimalMonetaryValue): Implements the "valid decimal monetary value" validity checker.
2952         (WebCore::checkAndCanonicalizeAmount): Implements the "check and canonicalize amount" validity checker.
2953         (WebCore::checkAndCanonicalizeTotal): Implements the "check and canonicalize total" validity checker.
2954         (WebCore::PaymentRequest::create): Implements the PaymentRequest Constructor
2955         (WebCore::PaymentRequest::PaymentRequest):
2956         (WebCore::PaymentRequest::id const): Implements the PaymentRequest id attribute.
2957         (WebCore::PaymentRequest::shippingType const): Implements the PaymentRequest shippingType attribute.
2958         * Modules/paymentrequest/PaymentRequest.h:
2959         * Modules/paymentrequest/PaymentRequest.idl: Annotated PaymentRequest with ConstructorMayThrowException.
2960         * WebCore.xcodeproj/project.pbxproj:
2961
2962 2017-08-21  Per Arne Vollan  <pvollan@apple.com>
2963
2964         [Win] DRT should only allow any https certificate for localhost.
2965         https://bugs.webkit.org/show_bug.cgi?id=175147
2966
2967         Reviewed by Brent Fulgham.
2968
2969         Disabling validation of certificate chains, breaks SSL on Windows. In order
2970         for SSL tests to succeed on Windows, we should avoid disabling it.
2971
2972         No new tests, covered by existing tests.
2973
2974         * platform/network/cf/ResourceHandleCFNet.cpp:
2975         (WebCore::ResourceHandle::createCFURLConnection):
2976
2977 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
2978
2979         [EME] HTMLMediaElement: basic implementations of 'Attempt to Decrypt', 'Attempt to Resume Playback If Necessary'
2980         https://bugs.webkit.org/show_bug.cgi?id=175761
2981
2982         Reviewed by Xabier Rodriguez-Calvar.
2983
2984         Add initial and incomplete implementations of the 'Attempt to Decrypt' and
2985         'Attempt to Resume Playback If Necessary' algorithms.  The implementations
2986         are interleaved with the specification text for clarity.
2987
2988         'Attempt to Decrypt' implementation doesn't yet address the encrypted block
2989         queue or the 'decryption blocked waiting for key' flag since it's not yet
2990         clear whether it would make more sense for this state to reside lower, in
2991         the platform layer. The gist of the algorithm is to invoke the decryption
2992         attempt through the MediaPlayer object, passing along the CDMInstance object
2993         retrieved from the MediaKeys object that is associated with this media
2994         element.
2995
2996         'Attempt to Resume Playback if Necessary' implementation similarly for now
2997         omits the various state flag operations. The main task at this point is to
2998         dispatch the 'Attempt to Decrypt' algorithm.
2999
3000         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() method now
3001         invokes the attemptToResumePlaybackIfNecessary() method.
3002
3003         MediaKeys::hasOpenSessions() is introduced, returning true if any session
3004         that was created through this MediaKeys instance is still open. This allows
3005         the 'Attempt to Decrypt' algorithm to proceed with the decryption attempt
3006         dispatch into the MediaPlayer hierarchy.
3007
3008         For that, the MediaPlayer::attemptToDecryptWithInstance() method is added,
3009         which simply dispatches the mirror method on MediaPlayerPrivate interface.
3010         This will enable the platform-layer implementations to use the passed-in
3011         CDMInstance object for decryption purposes.
3012
3013         * Modules/encryptedmedia/MediaKeySession.h:
3014         * Modules/encryptedmedia/MediaKeys.cpp:
3015         (WebCore::MediaKeys::hasOpenSessions const):
3016         * Modules/encryptedmedia/MediaKeys.h:
3017         * html/HTMLMediaElement.cpp:
3018         (WebCore::HTMLMediaElement::attemptToDecrypt):
3019         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
3020         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
3021         * html/HTMLMediaElement.h: Mark cdmClientAttemptToResumePlaybackIfNecessary() as final.
3022         * platform/graphics/MediaPlayer.cpp:
3023         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
3024         * platform/graphics/MediaPlayer.h:
3025         * platform/graphics/MediaPlayerPrivate.h:
3026         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
3027
3028 2017-08-20  Zan Dobersek  <zdobersek@igalia.com>
3029
3030         [EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
3031         https://bugs.webkit.org/show_bug.cgi?id=175717
3032
3033         Reviewed by Xabier Rodriguez-Calvar.
3034
3035         Add an initial and incomplete implementation of HTMLMediaElement::setMediaKeys(),
3036         interleaved with the specification wording of how this operation should behave.
3037         The implementation still doesn't cover cases of CDM instances being already
3038         associated with a different HTMLMediaElement, of CDM instances that can't be
3039         disassociated from the current HTMLMediaElement, and of failures during both
3040         association and disassociation of MediaKeys with the HTMLMediaElement.
3041
3042         The HTMLMediaElement (as a CDMClient inheritor) has to be attached or detached
3043         from the MediaKeys object as appropriate. This attachment allows MediaKeys to
3044         initiate an attempt to resume playback whenever the key statuses of the
3045         associated MediaKeys object are updated.
3046
3047         Upon association and disassociation with MediaKeys, the CDMInstance object of
3048         that specific MediaKeys instance is attached to or detached from the MediaPlayer
3049         instance. This allows the platform layer to gather information about the
3050         CDMInstance that will be used for decryption of media content for this specific
3051         media element.
3052
3053         Additionally, the detachment from both MediaKeys and MediaPlayer is done upon
3054         HTMLMediaElement destruction.
3055
3056         Upon setting the MediaKeys object, a task is queued that launches the 'Attempt to
3057         Resume Playback If Necessary' algorithm. A placeholder method is added that will
3058         implement the algorithm in the future.
3059
3060         The HTMLMediaElement::mediaKeys() getter is also implemented, returning pointer
3061         held in m_mediaKeys.
3062
3063         Covered to a degree by existing imported W3C tests, with a setMediaKeys()-oriented
3064         test having WPE-specific baseline update.
3065
3066         * Modules/encryptedmedia/MediaKeys.h:
3067         (WebCore::MediaKeys::cdmInstance const):
3068         * html/HTMLMediaElement.cpp:
3069         (WebCore::HTMLMediaElement::~HTMLMediaElement):
3070         (WebCore::HTMLMediaElement::mediaKeys const):
3071         (WebCore::HTMLMediaElement::setMediaKeys):
3072         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
3073         (WebCore::HTMLMediaElement::contextDestroyed):
3074         * html/HTMLMediaElement.h:
3075         * platform/graphics/MediaPlayer.cpp:
3076         (WebCore::MediaPlayer::cdmInstanceAttached):
3077         (WebCore::MediaPlayer::cdmInstanceDetached):
3078         * platform/graphics/MediaPlayer.h:
3079         * platform/graphics/MediaPlayerPrivate.h:
3080         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
3081         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
3082
3083 2017-08-20  Chris Dumez  <cdumez@apple.com>
3084
3085         Simplify calls to LoaderStrategy::startPingLoad()
3086         https://bugs.webkit.org/show_bug.cgi?id=175756
3087
3088         Reviewed by Sam Weinig.
3089
3090         Simplify calls to LoaderStrategy::startPingLoad() by passing the Frame to it
3091         and let its implementation gets what it needs from the frame. This reduces
3092         the number of parameters to startPingLoad() and is more easily extensible.
3093
3094         * dom/Document.h:
3095         * loader/LoaderStrategy.h:
3096         * loader/PingLoader.cpp:
3097         (WebCore::PingLoader::loadImage):
3098         (WebCore::PingLoader::sendPing):
3099         (WebCore::PingLoader::sendViolationReport):
3100         (WebCore::PingLoader::startPingLoad):
3101         * loader/PingLoader.h:
3102         * loader/cache/CachedResource.cpp:
3103         (WebCore::CachedResource::load):
3104
3105 2017-08-20  Antti Koivisto  <antti@apple.com>
3106
3107         Factor :before/:after render tree mutations into a RenderTreeUpdater helper class
3108         https://bugs.webkit.org/show_bug.cgi?id=175752
3109
3110         Reviewed by Andreas Kling.
3111
3112         Move code that constructs generated content renderers out from PseudoElement.
3113         Also refactor the related code from RenderTreeUpdater main class into
3114         RenderTreeUpdater::GeneratedContent helper class.
3115
3116         * WebCore.xcodeproj/project.pbxproj:
3117         * dom/PseudoElement.cpp:
3118         (WebCore::PseudoElement::resolveCustomStyle): Deleted.
3119
3120             Not needed anymore.
3121
3122         (WebCore::PseudoElement::didAttachRenderers): Deleted.
3123
3124             Moves to createContentRenderers in GeneratedContent.
3125
3126         (WebCore::PseudoElement::didRecalcStyle): Deleted.
3127
3128             Moves to updateStyleForContentRenderers in GeneratedContent.
3129
3130         * dom/PseudoElement.h:
3131         * style/RenderTreeUpdater.cpp:
3132         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
3133         (WebCore::RenderTreeUpdater::~RenderTreeUpdater):
3134         (WebCore::RenderTreeUpdater::commit):
3135         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
3136         (WebCore::RenderTreeUpdater::updateAfterDescendants):
3137         (WebCore::needsPseudoElement): Deleted.
3138         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): Deleted.
3139         (WebCore::RenderTreeUpdater::updateQuotesUpTo): Deleted.
3140
3141             Quotes and other :before/:after support moves to GeneratedContent helpwe.
3142
3143         * style/RenderTreeUpdater.h:
3144         (WebCore::RenderTreeUpdater::generatedContent):
3145         * style/RenderTreeUpdaterGeneratedContent.cpp: Added.
3146         (WebCore::RenderTreeUpdater::GeneratedContent::GeneratedContent):
3147         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement):
3148         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement):
3149         (WebCore::RenderTreeUpdater::GeneratedContent::updateRemainingQuotes):
3150         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
3151         (WebCore::createContentRenderers):
3152         (WebCore::updateStyleForContentRenderers):
3153         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3154         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
3155         * style/RenderTreeUpdaterGeneratedContent.h: Added.
3156
3157 2017-08-19  Andy Estes  <aestes@apple.com>
3158
3159         [Payment Request] Add interface stubs
3160         https://bugs.webkit.org/show_bug.cgi?id=175730
3161
3162         Reviewed by Youenn Fablet.
3163
3164         * DerivedSources.make:
3165         * Modules/paymentrequest/PaymentAddress.h: Added.
3166         * Modules/paymentrequest/PaymentAddress.idl: Added.
3167         * Modules/paymentrequest/PaymentComplete.h: Added.
3168         * Modules/paymentrequest/PaymentComplete.idl: Added.
3169         * Modules/paymentrequest/PaymentCurrencyAmount.h: Added.
3170         * Modules/paymentrequest/PaymentCurrencyAmount.idl: Added.
3171         * Modules/paymentrequest/PaymentDetailsBase.h: Added.
3172         * Modules/paymentrequest/PaymentDetailsBase.idl: Added.
3173         * Modules/paymentrequest/PaymentDetailsInit.h: Added.
3174         * Modules/paymentrequest/PaymentDetailsInit.idl: Added.
3175         * Modules/paymentrequest/PaymentDetailsModifier.h: Added.
3176         * Modules/paymentrequest/PaymentDetailsModifier.idl: Added.
3177         * Modules/paymentrequest/PaymentDetailsUpdate.h: Added.
3178         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Added.
3179         * Modules/paymentrequest/PaymentItem.h: Added.
3180         * Modules/paymentrequest/PaymentItem.idl: Added.
3181         * Modules/paymentrequest/PaymentMethodData.h: Added.
3182         * Modules/paymentrequest/PaymentMethodData.idl: Added.
3183         * Modules/paymentrequest/PaymentOptions.h: Added.
3184         * Modules/paymentrequest/PaymentOptions.idl: Added.
3185         * Modules/paymentrequest/PaymentRequest.cpp: Added.
3186         (WebCore::PaymentRequest::create):
3187         (WebCore::PaymentRequest::PaymentRequest):
3188         (WebCore::PaymentRequest::~PaymentRequest):
3189         (WebCore::PaymentRequest::show):
3190         (WebCore::PaymentRequest::abort):
3191         (WebCore::PaymentRequest::canMakePayment):
3192         * Modules/paymentrequest/PaymentRequest.h: Added.
3193         * Modules/paymentrequest/PaymentRequest.idl: Added.
3194         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: Added.
3195         (WebCore::PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent):
3196         (WebCore::PaymentRequestUpdateEvent::updateWith):
3197         * Modules/paymentrequest/PaymentRequestUpdateEvent.h: Added.
3198         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: Added.
3199         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h: Added.
3200         * Modules/paymentrequest/PaymentRequestUpdateEventInit.idl: Added.
3201         * Modules/paymentrequest/PaymentResponse.cpp: Added.
3202         (WebCore::PaymentResponse::complete):
3203         * Modules/paymentrequest/PaymentResponse.h: Added.
3204         * Modules/paymentrequest/PaymentResponse.idl: Added.
3205         * Modules/paymentrequest/PaymentShippingOption.h: Added.
3206         * Modules/paymentrequest/PaymentShippingOption.idl: Added.
3207         * Modules/paymentrequest/PaymentShippingType.h: Added.
3208         * Modules/paymentrequest/PaymentShippingType.idl: Added.
3209         * WebCore.xcodeproj/project.pbxproj:
3210         * dom/EventNames.h:
3211         * dom/EventNames.in:
3212         * dom/EventTargetFactory.in:
3213
3214 2017-08-19  Sam Weinig  <sam@webkit.org>
3215
3216         [WebCrypto] Remove the KeyAlgorithm type hierarchy
3217         https://bugs.webkit.org/show_bug.cgi?id=175750
3218
3219         Reviewed by Chris Dumez.
3220
3221         Removes the unnecessary indirection that existed to generate a
3222         KeyAlgorithm dictionary (or rather, one of its derived dictionaries)
3223         for a CryptoKey. We were calling the virtual buildAlgorithm(), which
3224         return a std::unique_ptr<KeyAlgorithm>, which we then casted to the 
3225         correct derived class and called dictionary() on. This can now be
3226         simplified by making each CryptoKey derived class override a function
3227         that returns the KeyAlgorithm variant.
3228
3229         * crypto/CryptoKey.cpp:
3230         (WebCore::CryptoKey::algorithm const): Deleted.
3231         * crypto/CryptoKey.h:
3232         (WebCore::CryptoKey::extractable const):
3233         (WebCore::KeyAlgorithm::~KeyAlgorithm): Deleted.
3234         (WebCore::KeyAlgorithm::name const): Deleted.
3235         (WebCore::KeyAlgorithm::KeyAlgorithm): Deleted.
3236         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3237         (WebCore::CryptoKeyRSA::algorithm const):
3238         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
3239         * crypto/keys/CryptoKeyAES.cpp:
3240         (WebCore::CryptoKeyAES::algorithm const):
3241         (WebCore::AesKeyAlgorithm::dictionary const): Deleted.
3242         (WebCore::CryptoKeyAES::buildAlgorithm const): Deleted.
3243         * crypto/keys/CryptoKeyAES.h:
3244         * crypto/keys/CryptoKeyEC.cpp:
3245         (WebCore::CryptoKeyEC::algorithm const):
3246         (WebCore::EcKeyAlgorithm::dictionary const): Deleted.
3247         (WebCore::CryptoKeyEC::buildAlgorithm const): Deleted.
3248         * crypto/keys/CryptoKeyEC.h:
3249         (WebCore::EcKeyAlgorithm::EcKeyAlgorithm): Deleted.
3250         (WebCore::EcKeyAlgorithm::namedCurve const): Deleted.
3251         * crypto/keys/CryptoKeyHMAC.cpp:
3252         (WebCore::CryptoKeyHMAC::algorithm const):
3253         (WebCore::HmacKeyAlgorithm::dictionary const): Deleted.
3254         (WebCore::CryptoKeyHMAC::buildAlgorithm const): Deleted.
3255         * crypto/keys/CryptoKeyHMAC.h:
3256         * crypto/keys/CryptoKeyRSA.cpp:
3257         (WebCore::RsaKeyAlgorithm::dictionary const): Deleted.
3258         (WebCore::RsaHashedKeyAlgorithm::dictionary const): Deleted.
3259         * crypto/keys/CryptoKeyRSA.h:
3260         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm): Deleted.
3261         (WebCore::RsaKeyAlgorithm::modulusLength const): Deleted.
3262         (WebCore::RsaKeyAlgorithm::publicExponent const): Deleted.
3263         * crypto/keys/CryptoKeyRaw.cpp:
3264         (WebCore::CryptoKeyRaw::algorithm const):
3265         (WebCore::RawKeyAlgorithm::dictionary const): Deleted.
3266         (WebCore::CryptoKeyRaw::buildAlgorithm const): Deleted.
3267         * crypto/keys/CryptoKeyRaw.h:
3268         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm): Deleted.
3269         * crypto/mac/CryptoKeyRSAMac.cpp:
3270         (WebCore::CryptoKeyRSA::algorithm const):
3271         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
3272
3273 2017-08-19  Sam Weinig  <sam@webkit.org>
3274
3275         [Mac] Change uint8_t* to Vector<uint8_t> type in all crypto algorithm implementation
3276         https://bugs.webkit.org/show_bug.cgi?id=164939
3277
3278         Reviewed by Chris Dumez.
3279
3280         Address FIXMEs, replacing uint8_t*/size_t parameters with Vector<uint8_t>&.
3281
3282         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
3283         (WebCore::transformAES_CBC):
3284         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
3285         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
3286         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
3287         (WebCore::wrapKeyAES_KW):
3288         (WebCore::unwrapKeyAES_KW):
3289         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
3290         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
3291         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
3292         (WebCore::calculateSignature):
3293         (WebCore::CryptoAlgorithmHMAC::platformSign):
3294         (WebCore::CryptoAlgorithmHMAC::platformVerify):
3295         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
3296         (WebCore::encryptRSAES_PKCS1_v1_5):
3297         (WebCore::decryptRSAES_PKCS1_v1_5):
3298         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
3299         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
3300         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
3301         (WebCore::signRSASSA_PKCS1_v1_5):
3302         (WebCore::verifyRSASSA_PKCS1_v1_5):
3303         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
3304         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
3305         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
3306         (WebCore::encryptRSA_OAEP):
3307         (WebCore::decryptRSA_OAEP):
3308         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
3309         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
3310
3311 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
3312
3313         Forbid setDragImage after dragstart
3314         https://bugs.webkit.org/show_bug.cgi?id=175751
3315
3316         Reviewed by Wenson Hsieh.
3317
3318         Removed the code to allow setting the drag mage after dragstart had happened.
3319
3320         The feature was apparently used in Mac WebKit1 port but using it today causes the drag image
3321         to disapepar while the user is moving the mouse cursor and being drawn once it's stopped
3322         and results in the contionus flickering of the drag image.
3323
3324         The feaure was never supported in WebKit2 and doesn't match the HTML5 specification:
3325         https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-rw
3326         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage
3327         or the behaviors of other browsers such as Chrome and Firefox.
3328
3329         No new tests. This patch simply removes code.
3330
3331         * dom/DataTransfer.cpp:
3332         (WebCore::DataTransfer::setDragImage):
3333         (WebCore::DataTransfer::canSetDragImage const): Deleted.
3334         * dom/DataTransfer.h:
3335         (WebCore::DataTransfer::makeDragImageWritable): Deleted.
3336         * page/EventHandler.cpp:
3337         (WebCore::EventHandler::handleDrag):
3338
3339 2017-08-18  Sam Weinig  <sam@webkit.org>
3340
3341         [WebCrypto] Get rid of CryptoKeyData class and all its subclasses
3342         https://bugs.webkit.org/show_bug.cgi?id=169806
3343
3344         Reviewed by Chris Dumez.
3345
3346         - Replaces the CryptoKeyData type hierarchy 
3347
3348             CryptoKeyData
3349               - CryptoKeyDataOctetSequence
3350               - CryptoKeyDataRSAComponents
3351
3352           with the renamed CryptoKeyRSAComponents.
3353
3354         - Removes pure virtual exportData function on CryptoKey, and all
3355           the implementations except the one on CryptoKeyRSA, which now is
3356           non-virtual, and returns a CryptoKeyRSAComponents. Update the one
3357           external caller, SerializedScriptValue, to handle this.
3358
3359         * CMakeLists.txt:
3360         * WebCore.xcodeproj/project.pbxproj:
3361         * bindings/js/SerializedScriptValue.cpp:
3362         * crypto/CryptoAlgorithm.h:
3363         * crypto/CryptoKey.h:
3364         * crypto/CryptoKeyData.h: Removed.
3365         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3366         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3367         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3368         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3369         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3370         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3371         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3372         (WebCore::CryptoKeyRSA::create):
3373         (WebCore::CryptoKeyRSA::exportData const):
3374         * crypto/keys/CryptoKeyAES.cpp:
3375         (WebCore::CryptoKeyAES::exportData const): Deleted.
3376         * crypto/keys/CryptoKeyAES.h:
3377         * crypto/keys/CryptoKeyDataOctetSequence.cpp: Removed.
3378         * crypto/keys/CryptoKeyDataOctetSequence.h: Removed.
3379         * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
3380         * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
3381         * crypto/keys/CryptoKeyEC.cpp:
3382         (WebCore::CryptoKeyEC::exportData const): Deleted.
3383         * crypto/keys/CryptoKeyEC.h:
3384         * crypto/keys/CryptoKeyHMAC.cpp:
3385         (WebCore::CryptoKeyHMAC::exportData const): Deleted.
3386         * crypto/keys/CryptoKeyHMAC.h:
3387         * crypto/keys/CryptoKeyRSA.cpp:
3388         (WebCore::CryptoKeyRSA::importJwk):
3389         (WebCore::CryptoKeyRSA::exportJwk const):
3390         * crypto/keys/CryptoKeyRSA.h:
3391         * crypto/keys/CryptoKeyRSAComponents.cpp: Copied from crypto/keys/CryptoKeyDataRSAComponents.cpp.
3392         (WebCore::CryptoKeyRSAComponents::CryptoKeyRSAComponents):
3393         (WebCore::CryptoKeyRSAComponents::~CryptoKeyRSAComponents):
3394         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): Deleted.
3395         (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): Deleted.
3396         * crypto/keys/CryptoKeyRSAComponents.h: Copied from crypto/keys/CryptoKeyDataRSAComponents.h.
3397         (WebCore::CryptoKeyRSAComponents::createPublic):
3398         (WebCore::CryptoKeyRSAComponents::createPrivate):
3399         (WebCore::CryptoKeyRSAComponents::createPrivateWithAdditionalData):
3400         * crypto/keys/CryptoKeyRaw.cpp:
3401         (WebCore::CryptoKeyRaw::exportData const): Deleted.
3402         * crypto/keys/CryptoKeyRaw.h:
3403         * crypto/mac/CryptoKeyRSAMac.cpp:
3404         (WebCore::getPrivateKeyComponents):
3405         (WebCore::CryptoKeyRSA::create):
3406         (WebCore::CryptoKeyRSA::exportData const):
3407
3408 2017-08-18  Youenn Fablet  <youenn@apple.com>
3409
3410         [Cache API] Add support for being loaded responses
3411         https://bugs.webkit.org/show_bug.cgi?id=175732
3412
3413         Reviewed by Chris Dumez.
3414
3415         Covered by existing and rebased tests.
3416
3417         Introducing a callback-based method to consume the body when the load is finished.
3418         Using that new method in Cache::put and calling batchPutOperation when the load is finished.
3419
3420   &n