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