Add support for RegExp "dotAll" flag
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-24  Michael Saboff  <msaboff@apple.com>
2
3         Add support for RegExp "dotAll" flag
4         https://bugs.webkit.org/show_bug.cgi?id=175924
5
6         Reviewed by Keith Miller.
7
8         Changed due to refactoring NewlineClassID to DotClassID.
9
10         No new tests. No change in behavior.
11
12         * contentextensions/URLFilterParser.cpp:
13         (WebCore::ContentExtensions::PatternParser::atomBuiltInCharacterClass):
14
15 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
16
17         Unreviewed, revert part of r221152 to fix internal builds.
18
19         * crypto/mac/CryptoKeyRSAMac.cpp:
20         (WebCore::CryptoKeyRSA::create):
21
22 2017-08-24  Kirill Ovchinnikov  <kirill.ovchinn@gmail.com>
23
24         HTMLTrackElement behavior violates the standard
25         https://bugs.webkit.org/show_bug.cgi?id=175888
26
27         Reviewed by Eric Carlson.
28
29         Test: media/track/text-track-src-change.html: added asserts
30
31         * html/HTMLTrackElement.cpp:
32         (WebCore::HTMLTrackElement::parseAttribute):
33         (WebCore::HTMLTrackElement::loadTimerFired):
34         * html/track/LoadableTextTrack.cpp:
35         (WebCore::LoadableTextTrack::scheduleLoad):
36         * html/track/TextTrack.cpp:
37         (WebCore::TextTrack::removeAllCues):
38         * html/track/TextTrackCueList.cpp:
39         (WebCore::TextTrackCueList::removeAll):
40         * html/track/TextTrackCueList.h:
41
42 2017-08-24  David Kilzer  <ddkilzer@apple.com>
43
44         Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
45         <https://webkit.org/b/175910>
46         <rdar://problem/33667497>
47
48         Reviewed by Alex Christensen.
49
50         Fix -Wunused-lambda-capture warnings:
51
52         * Modules/fetch/FetchResponse.cpp:
53         (WebCore::FetchResponse::setBodyData): Remove unused lambda
54         capture of 'this'.
55         * style/RenderTreeUpdater.cpp:
56         (WebCore::RenderTreeUpdater::createRenderer): Add
57         UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
58
59         Fix -Wcast-qual warnings:
60
61         * crypto/mac/CryptoKeyRSAMac.cpp:
62         (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
63         reinterpret_cast with const keyword.  This better matches the
64         argument types used in CCRSACryptorCreateFromData().
65         * platform/audio/mac/FFTFrameMac.cpp:
66         (WebCore::FFTFrame::doFFT): Switch from C-style cast to
67         reinterpret_cast with const keyword.  This better matches the
68         argument type used in vDSP_ctoz().
69         * platform/graphics/FontPlatformData.h: Only define
70         WebCore::toCTFont() and WebCore::toNSFont() when building for
71         Objective-C++.
72         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
73         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
74         Switch from C-style cast to reinterpret_cast with const keyword.
75         This better matches the argument type used in
76         Uint8Array::setRange().
77         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
78         (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
79         const_cast to avoid warning.
80         * platform/mac/SSLKeyGeneratorMac.mm:
81         (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
82         avoid warning, and switch C-style cast to reinterpret_cast.
83         * xml/XSLTProcessorLibxslt.cpp:
84         (WebCore::XSLTProcessor::transformToString):
85         - Use const_cast to avoid warning, and switch C-style cast to
86           reinterpret_cast.
87         - Switch C-style cast to reinterpret_cast and add const keyword.
88         * xml/parser/XMLDocumentParserLibxml2.cpp:
89         (WebCore::XMLParserContext::createMemoryParser): Use const_cast
90         to avoid warning, and switch C-style cast to reinterpret_cast.
91
92 2017-08-22  Dave Hyatt  <hyatt@apple.com>
93
94         [Repaint Outside Layout] Add a pref for repainting outside of layout
95         https://bugs.webkit.org/show_bug.cgi?id=175729
96
97         Reviewed by Daniel Bates.
98
99         * page/Settings.in:
100         * rendering/RenderElement.cpp:
101         (WebCore::RenderElement::checkForRepaintDuringLayout):
102
103 2017-08-22  Darin Adler  <darin@apple.com>
104
105         REGRESSION (r220052): ASSERTION FAILED: !frame().isMainFrame() || !needsStyleRecalcOrLayout()  in WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive()
106         https://bugs.webkit.org/show_bug.cgi?id=175270
107
108         Reviewed by Simon Fraser.
109
110         * dom/Document.cpp:
111         (WebCore::Document::Document): Initialize m_styleRecalcTimer with a lamdba so it can work
112         with a function that returns a bool and ignore the return value.
113         (WebCore::Document::updateStyleIfNeeded): Added a boolean return value indicating if the
114         function did any work or not.
115         * dom/Document.h: Updated for above change.
116
117         * page/FrameView.cpp:
118         (WebCore::appendRenderedChildren): Added helper that will later replace the
119         FrameView::renderedChildFrameViews function and is used below.
120         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive): Instead of always doing two
121         passes of style and layout update do up to four passes, but stop as soon as a pass does
122         no work. This is slightly more efficient in cases where no layout and style update is
123         needed, and works correctly when a third pass is needed, which is what happens in the
124         test that was failing. We can eventually improve this further, but this resolves the
125         immediate problem we are seeing in the test.
126
127 2017-08-24  Don Olmstead  <don.olmstead@sony.com>
128
129         [CMake] Use find_package for SQLite
130         https://bugs.webkit.org/show_bug.cgi?id=175803
131
132         Reviewed by Konstantin Tokarev.
133
134         No new tests. No change in behavior.
135
136         * CMakeLists.txt:
137         * PlatformGTK.cmake:
138         * PlatformMac.cmake:
139         * PlatformWPE.cmake:
140         * PlatformWinCairo.cmake:
141
142 2017-08-23  Adrian Perez de Castro  <aperez@igalia.com>
143
144         Geoclue2 based backend should provide the right desktop ID
145         https://bugs.webkit.org/show_bug.cgi?id=129879
146
147         Reviewed by Michael Catanzaro.
148
149         * platform/geoclue/GeolocationProviderGeoclue.cpp:
150         (GeolocationProviderGeoclue::createGeoclueClientProxyCallback): Try first obtaining the application
151         identifier using GApplication first, keeping a fallback to the value returned by g_get_prgname().
152
153 2017-08-24  Zan Dobersek  <zdobersek@igalia.com>
154
155         [EME] Implement HTMLMediaElement dispatch of the onencrypted event
156         https://bugs.webkit.org/show_bug.cgi?id=175927
157
158         Reviewed by Xabier Rodriguez-Calvar.
159
160         Add the MediaPlayerClient::mediaPlayerInitializationDataEncountered()
161         method that the platform-layer media pipeline can invoke when it hits
162         encrypted content in the media data. The initialization data and its type
163         are passed by the caller, allowing the HTMLMediaElement override to
164         process it further.
165
166         This is done in the mediaPlayerInitializationDataEncountered() override
167         in the HTMLMediaElement class. Partially implementing the 'Initialization
168         Data Encountered' algorithm, the 'encrypted' event is dispatched, with the
169         MediaEncryptedEvent interface being leveraged to embed init data and init
170         data type information. CORS and mixed-content validation of the media data
171         is skipped for now.
172
173         MediaPlayer::initializationDataEncountered() method should be used to
174         dispatch the corresponding method on the client, passing on the given init
175         data and init data type values.
176
177         * html/HTMLMediaElement.cpp:
178         (WebCore::HTMLMediaElement::mediaPlayerInitializationDataEncountered):
179         * html/HTMLMediaElement.h:
180         * platform/graphics/MediaPlayer.cpp:
181         (WebCore::MediaPlayer::initializationDataEncountered):
182         * platform/graphics/MediaPlayer.h:
183         (WebCore::MediaPlayerClient::mediaPlayerInitializationDataEncountered):
184
185 2017-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
186
187         DeleteSelectionCommand should be robust when starting and ending editable positions cannot be found
188         https://bugs.webkit.org/show_bug.cgi?id=175914
189         <rdar://problem/29792688>
190
191         Reviewed by Ryosuke Niwa.
192
193         DeleteSelectionCommand can cause a null dereference if editable start and end positions are not found. This can
194         happen when attempting to delete after selecting the contents within a canvas or output element with `read-write`
195         `-webkit-user-modify` style. To fix this, we make the initialization step of the DeleteSelectionCommand robust
196         when editable start and end positions are missing.
197
198         Test: editing/execCommand/forward-delete-read-write-canvas.html
199
200         * editing/DeleteSelectionCommand.cpp:
201         (WebCore::DeleteSelectionCommand::initializePositionData):
202
203         Make this initialization helper indicate failure via a bool return value. DeleteSelectionCommand::doApply bails
204         early if initializePositionData returned false.
205
206         (WebCore::DeleteSelectionCommand::doApply):
207         * editing/DeleteSelectionCommand.h:
208
209 2017-08-23  Youenn Fablet  <youenn@apple.com>
210
211         [Cache API] Unify WebCore and WebKit error handling
212         https://bugs.webkit.org/show_bug.cgi?id=175902
213         <rdar://problem/34045933>
214
215         Unreviewed.
216
217         * Modules/cache/DOMCache.h: Fixing Windows build.
218
219 2017-08-23  Ryan Haddad  <ryanhaddad@apple.com>
220
221         Unreviewed, rolling out r221109.
222
223         This change caused assertion failures on iOS and macOS debug
224         bots.
225
226         Reverted changeset:
227
228         "Stop using PolicyCallback for new window policies"
229         https://bugs.webkit.org/show_bug.cgi?id=175907
230         http://trac.webkit.org/changeset/221109
231
232 2017-08-23  Jer Noble  <jer.noble@apple.com>
233
234         [EME] WebCoreDecompressionSession should only report having an available frame if it has one for the current time.
235         https://bugs.webkit.org/show_bug.cgi?id=175901
236
237         Reviewed by Eric Carlson.
238
239         The WebCoreDecompressionSession will trigger the hasAvailableFrame callback whenever a frame is decoded,
240         regardless of its presentation time. For formats which have out-of-order decoding, the newly decoded frame could
241         have a presentation time far in the future. Instead, only fire the callback if the decoded frame's presentation
242         times contains the timebase's current time.
243
244         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
245         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
246
247 2017-08-23  Youenn Fablet  <youenn@apple.com>
248
249         [Cache API] Unify WebCore and WebKit error handling
250         https://bugs.webkit.org/show_bug.cgi?id=175902
251
252         Reviewed by Alex Christensen.
253
254         No change of behavior.
255
256         Introducing a DOMCache namespace enclosing structures, callbacks and function definitions
257         previously found in either WebCore::CacheStorageConnection or WebKit::CacheStorage.
258
259         Some previously used callbacks had no way to pass errors in WebCore while they had in WebKit.
260         Updated Cache, CacheStorage, CacheStorageConnection and WorkerCacheStorageConnection to deal with these potential errors.
261
262         * CMakeLists.txt:
263         * Modules/cache/Cache.cpp:
264         (WebCore::FetchTasksHandler::FetchTasksHandler):
265         (WebCore::FetchTasksHandler::records const):
266         (WebCore::FetchTasksHandler::addRecord):
267         (WebCore::Cache::addAll):
268         (WebCore::Cache::put):
269         (WebCore::Cache::retrieveRecords):
270         (WebCore::queryCacheMatch):
271         (WebCore::Cache::batchDeleteOperation):
272         (WebCore::toConnectionRecord):
273         (WebCore::Cache::batchPutOperation):
274         (WebCore::Cache::updateRecords):
275         * Modules/cache/Cache.h:
276         * Modules/cache/CacheStorage.cpp:
277         (WebCore::CacheStorage::retrieveCaches):
278         (WebCore::CacheStorage::open):
279         (WebCore::CacheStorage::remove):
280         * Modules/cache/CacheStorage.h:
281         * Modules/cache/CacheStorageConnection.cpp:
282         (WebCore::CacheStorageConnection::open):
283         (WebCore::CacheStorageConnection::remove):
284         (WebCore::CacheStorageConnection::retrieveCaches):
285         (WebCore::CacheStorageConnection::batchDeleteOperation):
286         (WebCore::CacheStorageConnection::batchPutOperation):
287         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
288         (WebCore::CacheStorageConnection::updateCaches):
289         (WebCore::CacheStorageConnection::updateRecords):
290         (WebCore::CacheStorageConnection::deleteRecordsCompleted):
291         (WebCore::CacheStorageConnection::putRecordsCompleted):
292         * Modules/cache/CacheStorageConnection.h:
293         (WebCore::CacheStorageConnection::openCompleted):
294         (WebCore::CacheStorageConnection::removeCompleted):
295         (WebCore::CacheStorageConnection::doOpen):
296         (WebCore::CacheStorageConnection::doRemove):
297         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
298         (WebCore::CacheStorageConnection::doBatchPutOperation):
299         * Modules/cache/WorkerCacheStorageConnection.cpp:
300         (WebCore::toCrossThreadRecordData):
301         (WebCore::fromCrossThreadRecordData):
302         (WebCore::WorkerCacheStorageConnection::doOpen):
303         (WebCore::WorkerCacheStorageConnection::doRemove):
304         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
305         (WebCore::recordsDataFromRecords):
306         (WebCore::recordsDataOrErrorFromRecords):
307         (WebCore::recordsFromRecordsData):
308         (WebCore::recordsOrErrorFromRecordsData):
309         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
310         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
311         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
312         * Modules/cache/DOMCache.cpp: Added.
313         * Modules/cache/DOMCache.h: Added.
314         * Modules/cache/WorkerCacheStorageConnection.h:
315         * WebCore.xcodeproj/project.pbxproj:
316
317 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
318
319         [JSC] Optimize Map iteration with intrinsic
320         https://bugs.webkit.org/show_bug.cgi?id=174355
321
322         Reviewed by Saam Barati.
323
324         * bindings/js/SerializedScriptValue.cpp:
325         (WebCore::CloneSerializer::serialize):
326
327 2017-08-23  Alex Christensen  <achristensen@webkit.org>
328
329         Stop using PolicyCallback for new window policies
330         https://bugs.webkit.org/show_bug.cgi?id=175907
331
332         Reviewed by Andy Estes.
333
334         PolicyCallback is an artifact from the days before C++11.  Let's use lambdas instead!
335         No change in behaviour.
336
337         * loader/PolicyCallback.cpp:
338         (WebCore::PolicyCallback::set):
339         (WebCore::PolicyCallback::call):
340         (WebCore::PolicyCallback::cancel):
341         * loader/PolicyCallback.h:
342         * loader/PolicyChecker.cpp:
343         (WebCore::PolicyChecker::checkNewWindowPolicy):
344         (WebCore::PolicyChecker::continueAfterNewWindowPolicy): Deleted.
345         * loader/PolicyChecker.h:
346
347 2017-08-23  Alex Christensen  <achristensen@webkit.org>
348
349         Stop using PolicyChecker for ContentPolicy
350         https://bugs.webkit.org/show_bug.cgi?id=175904
351
352         Reviewed by Tim Horton.
353
354         PolicyChecker is an artifact from the days before C++11.  Now we have lambdas which
355         have a cleaner flow than one class that exists to be effectively one of three lambda types.
356         Let's remove them one at a time, starting with ContentPolicy checks.
357         
358         No change in behaviour.
359
360         * loader/DocumentLoader.cpp:
361         (WebCore::DocumentLoader::responseReceived):
362         * loader/FrameLoader.cpp:
363         (WebCore::FrameLoader::checkContentPolicy):
364         * loader/FrameLoader.h:
365         * loader/PolicyCallback.cpp:
366         (WebCore::PolicyCallback::set):
367         (WebCore::PolicyCallback::call):
368         (WebCore::PolicyCallback::cancel):
369         * loader/PolicyCallback.h:
370         * loader/PolicyChecker.cpp:
371         (WebCore::PolicyChecker::checkContentPolicy): Deleted.
372         (WebCore::PolicyChecker::continueAfterContentPolicy): Deleted.
373         * loader/PolicyChecker.h:
374
375 2017-08-23  Jer Noble  <jer.noble@apple.com>
376
377         Build fix for 32-bit Mac after r221098. Make sure constant used in WebCoreDecompressionSession is SoftLinked.
378
379         * platform/cf/CoreMediaSoftLink.cpp:
380         * platform/cf/CoreMediaSoftLink.h:
381
382 2017-08-23  Jer Noble  <jer.noble@apple.com>
383
384         Track VideoPlaybackQuality metrics when using WebCoreDecompressionSession.
385         https://bugs.webkit.org/show_bug.cgi?id=175835
386         <rdar://problem/34022234>
387
388         Reviewed by Eric Carlson.
389
390         Test: platform/mac/media/media-source/videoplaybackquality-decompressionsession.html
391
392         Track the total number of frames decoded, dropped, & corrupted, as well as the total
393         delay imposed by decoding in the WebCoreDecompressionSession.
394
395         Drive-by fix: implement frame dropping by skipping frames whose presentation times are
396         before the video's current time and which aren't depended upon by other frames.
397
398         * platform/cf/CoreMediaSoftLink.cpp:
399         * platform/cf/CoreMediaSoftLink.h:
400         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
401         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
402         * platform/graphics/cocoa/WebCoreDecompressionSession.h:
403         (WebCore::WebCoreDecompressionSession::totalVideoFrames):
404         (WebCore::WebCoreDecompressionSession::droppedVideoFrames):
405         (WebCore::WebCoreDecompressionSession::corruptedVideoFrames):
406         (WebCore::WebCoreDecompressionSession::totalFrameDelay):
407         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
408         (WebCore::WebCoreDecompressionSession::shouldDecodeSample):
409         (WebCore::WebCoreDecompressionSession::decodeSample):
410         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
411
412 2017-08-23  Andy Estes  <aestes@apple.com>
413
414         [Payment Request] Update to "In Development" in features.json
415         https://bugs.webkit.org/show_bug.cgi?id=175897
416
417         Reviewed by Sam Weinig.
418
419         * features.json:
420
421 2017-08-22  Dean Jackson  <dino@apple.com>
422
423         Default passive touch event listeners on the root
424         https://bugs.webkit.org/show_bug.cgi?id=175346
425         <rdar://problem/33164597>
426
427         Reviewed by Sam Weinig.
428
429         Make any touchstart or touchmove event listeners passive by default
430         if they are on the document, window, body or document element targets.
431         This follows the "intervention" first implemented by Chrome/Blink:
432
433         https://github.com/WICG/interventions/issues/35
434         https://docs.google.com/document/d/1II7oSIpd8pK91V5kEM3tDLKcIj398jOJn8Niqy6_loI/edit
435         https://github.com/whatwg/dom/issues/365
436
437         If the event listener explicitly defines "passive" to false in their
438         options dictionary, then they'll still get a non-passive listener.
439
440         NOTE: Any fallout from this bug should be collected in:
441         https://bugs.webkit.org/show_bug.cgi?id=175869
442         Please do not revert this change just because a site is broken. We'll
443         gather the issues and see if we can evangelise or detect via code.
444
445         Tests: fast/events/touch/ios/passive-by-default-on-document-and-window.html
446                fast/events/touch/ios/passive-by-default-overridden-on-document-and-window.html
447
448         * dom/EventNames.h:
449         (WebCore::EventNames::isTouchScrollBlockingEventType const): Added this helper
450         to identify the types of touches we want to check for.
451         * dom/EventTarget.cpp:
452         (WebCore::EventTarget::addEventListener): Check for the event being one of the touch-types
453         that we care about, and the target being one of the Node/Window types we care about. If
454         so, tell the event listener to be passive.
455         * dom/EventTarget.h: Use an optional for the passive member.
456         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
457         * dom/EventTarget.idl: Change "passive" to not have a default value, so we
458         can detect if it was explicitly set to false.
459
460 2017-08-23  Tim Horton  <timothy_horton@apple.com>
461
462         Try to fix the WinCairo build after r221068
463
464         * platform/win/PlatformScreenWin.cpp:
465
466 2017-08-23  Youenn Fablet  <youenn@apple.com>
467
468         [Cache API] Enable persistent coder to encode FetchOptions
469         https://bugs.webkit.org/show_bug.cgi?id=175883
470
471         Reviewed by Alex Christensen.
472
473         No change of behavior.
474         Adding encode/decode routines for FetchOptions.
475
476         * loader/FetchOptions.h:
477         (WebCore::FetchOptions::encode const):
478         (WebCore::FetchOptions::decode):
479         * platform/ReferrerPolicy.h:
480
481 2017-08-23  Yusuke Suzuki  <utatane.tea@gmail.com>
482
483         Race condition in StartWebThread causing crash
484         https://bugs.webkit.org/show_bug.cgi?id=175852
485
486         Reviewed by Mark Lam.
487
488         When starting web thread, the main thread waits for completion of web thread initialization
489         by using pthread_cond_t. However, the main thread may be woken up due to the existence of
490         the spurious wake up of pthread_cond_t.
491
492         Instead, we should use WTF::Lock and WTF::Condition. Since our StartWebThread already calls
493         WTF::initializeThreading, it is safe to use WTF::Lock and WTF::Condition. And our WTF::Condition
494         does not have the spurious wake up problem as described in Condition.h.
495
496         * platform/ios/wak/WebCoreThread.mm:
497         (RunWebThread):
498         (StartWebThread):
499
500 2017-08-23  Brent Fulgham  <bfulgham@apple.com>
501
502         Ensure media controls host exists before using it
503         https://bugs.webkit.org/show_bug.cgi?id=175833
504         <rdar://problem/34001219>
505
506         Reviewed by Jer Noble.
507
508         Although we ensure that the media controls shadow root exists before updating the text track
509         container, we don't check that the media controls host has been created yet. We do check
510         and create in other places in HTMLMediaElement.
511
512         * html/HTMLMediaElement.cpp:
513         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
514
515 2017-08-23  Carlos Alberto Lopez Perez  <clopez@igalia.com>
516
517         [WPE] Some event handlers not working.
518         https://bugs.webkit.org/show_bug.cgi?id=175864
519
520         Reviewed by Michael Catanzaro.
521
522         Share the EventHandler implementation with the GTK port and add ifdefs where needed.
523
524         Covered by existing tests.
525
526         * PlatformGTK.cmake:
527         * PlatformWPE.cmake:
528         * page/wpe/EventHandlerWPE.cpp: Removed.
529         * platform/glib/EventHandlerGlib.cpp: Renamed from Source/WebCore/page/gtk/EventHandlerGtk.cpp.
530         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const):
531
532 2017-08-22  Tim Horton  <timothy_horton@apple.com>
533
534         _WKThumbnailView should use the screen color space instead of sRGB
535         https://bugs.webkit.org/show_bug.cgi?id=175858
536         <rdar://problem/33925559>
537
538         Reviewed by Dean Jackson.
539
540         * platform/PlatformScreen.h:
541         * platform/ios/PlatformScreenIOS.mm:
542         (WebCore::screenColorSpace):
543         * platform/mac/PlatformScreenMac.mm:
544         (WebCore::screenColorSpace):
545         (WebCore::screenSupportsExtendedColor):
546         * platform/win/PlatformScreenWin.cpp:
547         (WebCore::screenColorSpace):
548         Add screenColorSpace, which returns the active color space for the
549         given Widget's screen. On Windows, just fall back to sRGB like we usually do.
550
551 2017-08-22  Ryosuke Niwa  <rniwa@webkit.org>
552
553         Consolidate the code to normalize MIME type in DataTransfer
554         https://bugs.webkit.org/show_bug.cgi?id=175810
555
556         Rubber-stamped by Wenson Hsieh.
557
558         Address the forgotten review comment by Wenson.
559
560         Tests: editing/pasteboard/datatransfer-getdata-plaintext.html
561
562         * dom/DataTransfer.cpp:
563         (WebCore::DataTransfer::clearData):
564
565 2017-08-20  Wenson Hsieh  <wenson_hsieh@apple.com>
566
567         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div
568         https://bugs.webkit.org/show_bug.cgi?id=175116
569         <rdar://problem/28279301>
570
571         Reviewed by Darin Adler and Ryosuke Niwa.
572
573         WebCore support for WebPage::editorState refactoring. See WebKit ChangeLogs for more detail.
574
575         Tests: EditorStateTests.TypingAttributesBold
576                EditorStateTests.TypingAttributesItalic
577                EditorStateTests.TypingAttributesUnderline
578                EditorStateTests.TypingAttributesTextAlignmentAbsoluteAlignmentOptions
579                EditorStateTests.TypingAttributesTextAlignmentStartEnd
580                EditorStateTests.TypingAttributesTextAlignmentDirectionalText
581                EditorStateTests.TypingAttributesTextColor
582                EditorStateTests.TypingAttributesMixedStyles
583                EditorStateTests.TypingAttributesLinkColor
584
585         * css/StyleProperties.cpp:
586         (WebCore::StyleProperties::propertyAsColor const):
587         (WebCore::StyleProperties::propertyAsValueID const):
588
589         Introduces some helper functions in StyleProperties to convert CSS property values to Color or a CSSValueID.
590
591         * css/StyleProperties.h:
592         * editing/EditingStyle.cpp:
593         (WebCore::EditingStyle::hasStyle):
594
595         Pull out logic in selectionStartHasStyle that asks for a style TriState into EditingStyle::hasStyle. This is
596         because WebPage::editorState will now query for multiple styles at the selection start, but
597         selectionStartHasStyle currently recomputes styleAtSelectionStart every time it is called. To prevent extra work
598         from being done, we can just call selectionStartHasStyle once and use ask for EditingStyle::hasStyle on the
599         computed EditingStyle at selection start.
600
601         * editing/EditingStyle.h:
602         * editing/Editor.cpp:
603         (WebCore::Editor::selectionStartHasStyle const):
604
605 2017-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
606
607         [WK2] EditorState updates should be rolled into the layer update lifecycle when possible
608         https://bugs.webkit.org/show_bug.cgi?id=175370
609         <rdar://problem/33799806>
610
611         Reviewed by Ryosuke Niwa.
612
613         Remove didChangeSelectionAndUpdateLayout -- EditorState updates that are scheduled due to missing post-layout
614         data will now be scheduled for the next presentation update. Additionally, add editor client hooks to notify the
615         WebKit layer when we've updated the current composition. See WebKit ChangeLog for more details. This patch
616         adjusts and rebaselines existing layout tests.
617
618         * editing/Editor.cpp:
619         (WebCore::SetCompositionScope::SetCompositionScope):
620         (WebCore::SetCompositionScope::~SetCompositionScope):
621
622         Introduce a helper RAII class to ensure that we ignore selection changes during the scope of
623         Editor::setComposition and call out to the client with WebEditorClient::didUpdateComposition afterwards. This
624         also maintains a UserTypingGestureIndicator over its lifetime, so we don't additionally need to create a
625         UserTypingGestureIndicator in Editor::setComposition.
626
627         (WebCore::Editor::setComposition):
628         * editing/FrameSelection.cpp:
629         (WebCore::FrameSelection::setSelection):
630         (WebCore::FrameSelection::updateAndRevealSelection):
631         (WebCore::FrameSelection::setSelectedRange):
632         * editing/FrameSelection.h:
633         (WebCore::FrameSelection::defaultSetSelectionOptions):
634
635         Plumb state about whether or not the selection change was triggered by the user to FrameSelection::setSelection,
636         and if so, notify the editing client. A separate SetSelectionOptions flag is used here instead of
637         RevealSelection to avoid calling out to the client in places where we want to reveal the selection regardless of
638         whether or not the selection is user triggered.
639
640         * loader/EmptyClients.cpp:
641         * page/EditorClient.h:
642
643 2017-08-21  Ryosuke Niwa  <rniwa@webkit.org>
644
645         Consolidate the code to normalize MIME type in DataTransfer
646         https://bugs.webkit.org/show_bug.cgi?id=175810
647
648         Reviewed by Wenson Hsieh.
649
650         Factored out the code to convert MIME type to lowercase after stripping whitespace,
651         and treat "text" as "text/plain" and "url" as "text/uri-list".
652
653         Specifications:
654         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata-2
655         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata-2
656         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata-2
657
658         Stripping of whitespace only happens in WebKit/Blink but it's probably required for compatbility.
659         Spec bug: https://github.com/whatwg/html/issues/2946
660
661         Test: editing/pasteboard/datatransfer-getdata-plaintext.html
662
663         * dom/DataTransfer.cpp:
664         (WebCore::normalizeType):
665         (WebCore::DataTransfer::clearData):
666         (WebCore::DataTransfer::getData const):
667         (WebCore::DataTransfer::setData):
668         * platform/gtk/PasteboardGtk.cpp:
669         (WebCore::selectionDataTypeFromHTMLClipboardType):
670         * platform/ios/PasteboardIOS.mm:
671         (WebCore::cocoaTypeFromHTMLClipboardType):
672         * platform/mac/PasteboardMac.mm:
673         (WebCore::cocoaTypeFromHTMLClipboardType):
674         * platform/win/PasteboardWin.cpp:
675         (WebCore::clipboardTypeFromMIMEType):
676
677 2017-08-22  Matt Lewis  <jlewis3@apple.com>
678
679         Unreviewed, rolling out r221033.
680
681         This revision caused assertion failures on all Open Source
682         Debug testers. See Radar for more information.
683
684         Reverted changeset:
685
686         "Ensure media controls host exists before using it"
687         https://bugs.webkit.org/show_bug.cgi?id=175833
688         http://trac.webkit.org/changeset/221033
689
690 2017-08-22  Per Arne Vollan  <pvollan@apple.com>
691
692         [Win] Fix compile errors.
693         https://bugs.webkit.org/show_bug.cgi?id=175860
694
695         Reviewed by Brent Fulgham.
696
697         Add required header files. 
698
699         * platform/network/cf/CookieJarCFNet.cpp:
700
701 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
702
703         Correct SOUP builds after r221017 and r221050.
704         https://bugs.webkit.org/show_bug.cgi?id=175846
705
706         Reviewed by Michael Catanzaro.
707
708         * platform/network/soup/CookieJarSoup.cpp:
709         (WebCore::cookiesForDOM): Revise return type.
710
711 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
712
713         Correct SOUP and cURL builds after r221017.
714         https://bugs.webkit.org/show_bug.cgi?id=175846
715
716         Reviewed by Michael Catanzaro.
717
718         Correct the method signatures for 'cookiesForDOM' on the SOUP and cURL backends.
719         Note that these ports will need to add specific logic to find/filter secure cookies
720         if requested by the caller.
721
722         * platform/network/curl/CookieJarCurl.cpp:
723         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
724         (WebCore::cookiesForDOM):
725         * platform/network/curl/CookieJarCurl.h:
726         * platform/network/soup/CookieJarSoup.cpp:
727         (WebCore::cookiesForDOM):
728
729 2017-08-22  Chris Dumez  <cdumez@apple.com>
730
731         [EnabledBySetting] in WebIDL uses Document but does not include Document.h
732         https://bugs.webkit.org/show_bug.cgi?id=175843
733
734         Reviewed by Sam Weinig.
735
736         * bindings/scripts/CodeGeneratorJS.pm:
737         (GenerateImplementation):
738
739 2017-08-22  Jer Noble  <jer.noble@apple.com>
740
741         Refactor videoPerformanceQuality() MediaPlayer methods into single call.
742         https://bugs.webkit.org/show_bug.cgi?id=175830
743
744         Reviewed by Eric Carlson.
745
746         Allow MediaPlayerPrivate subclasses to return all the metrics required for VideoPerformanceQuality in
747         a single call. For clients which incur significant overhead to request this data, this reduces the cost
748         of requesting data by the number of calls removed.
749
750         * html/HTMLMediaElement.cpp:
751         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
752         * platform/graphics/MediaPlayer.cpp:
753         (WebCore::MediaPlayer::videoPlaybackQualityMetrics):
754         (WebCore::MediaPlayer::totalVideoFrames): Deleted.
755         (WebCore::MediaPlayer::droppedVideoFrames): Deleted.
756         (WebCore::MediaPlayer::corruptedVideoFrames): Deleted.
757         (WebCore::MediaPlayer::totalFrameDelay): Deleted.
758         * platform/graphics/MediaPlayer.h:
759         (WebCore::PlatformVideoPlaybackQualityMetrics::PlatformVideoPlaybackQualityMetrics):
760         * platform/graphics/MediaPlayerPrivate.h:
761         (WebCore::MediaPlayerPrivateInterface::videoPlaybackQualityMetrics):
762         (WebCore::MediaPlayerPrivateInterface::totalVideoFrames): Deleted.
763         (WebCore::MediaPlayerPrivateInterface::droppedVideoFrames): Deleted.
764         (WebCore::MediaPlayerPrivateInterface::corruptedVideoFrames): Deleted.
765         (WebCore::MediaPlayerPrivateInterface::totalFrameDelay): Deleted.
766         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
767         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
768         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
769         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalVideoFrames): Deleted.
770         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::droppedVideoFrames): Deleted.
771         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::corruptedVideoFrames): Deleted.
772         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::totalFrameDelay): Deleted.
773         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
774         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
775         (WebCore::MockMediaPlayerMediaSource::videoPlaybackQualityMetrics):
776         (WebCore::MockMediaPlayerMediaSource::totalVideoFrames): Deleted.
777         (WebCore::MockMediaPlayerMediaSource::droppedVideoFrames): Deleted.
778         (WebCore::MockMediaPlayerMediaSource::corruptedVideoFrames): Deleted.
779         (WebCore::MockMediaPlayerMediaSource::totalFrameDelay): Deleted.
780         * platform/mock/mediasource/MockMediaPlayerMediaSource.h:
781         * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
782         (WebCore::MockMediaSourcePrivate::videoPlaybackQualityMetrics):
783         * platform/mock/mediasource/MockMediaSourcePrivate.h:
784
785 2017-08-22  Brent Fulgham  <bfulgham@apple.com>
786
787         Ensure media controls host exists before using it
788         https://bugs.webkit.org/show_bug.cgi?id=175833
789         <rdar://problem/34001219>
790
791         Reviewed by Jer Noble.
792
793         Although we ensure that the media controls shadow root exists before updating the text track
794         container, we don't check that the media controls host has been created yet. We do check
795         and create in other places in HTMLMediaElement.
796
797         Tests: media/track/track-display-before-controls-crash.html
798
799         * html/HTMLMediaElement.cpp:
800         (WebCore::HTMLMediaElement::updateTextTrackDisplay): 
801
802 2017-08-22  Youenn Fablet  <youenn@apple.com>
803
804         [Cache API] Optimize whitespace trimming in Vary header values
805         https://bugs.webkit.org/show_bug.cgi?id=175837
806
807         Reviewed by Alex Christensen.
808
809         No change of behavior.
810
811         Introducing a StringView version of stripLeadingAndTrailingHTTPSpaces.
812
813         * Modules/cache/Cache.cpp:
814         (WebCore::hasResponseVaryStarHeaderValue):
815         * platform/network/HTTPParsers.h:
816         (WebCore::stripLeadingAndTrailingHTTPSpaces):
817
818 2017-08-22  Alex Christensen  <achristensen@webkit.org>
819
820         Remove ChromeClient::scrollbarsModeDidChange
821         https://bugs.webkit.org/show_bug.cgi?id=175805
822
823         Reviewed by Daniel Bates.
824
825         No change in behavior.  It was never called, and no implementations did anything.
826
827         * loader/EmptyClients.h:
828         * page/Chrome.cpp:
829         (WebCore::Chrome::scrollbarsModeDidChange const): Deleted.
830         * page/Chrome.h:
831         * page/ChromeClient.h:
832         * platform/HostWindow.h:
833
834 2017-08-22  Devin Rousso  <webkit@devinrousso.com>
835
836         Web Inspector: provide way for ShaderPrograms to be enabled/disabled
837         https://bugs.webkit.org/show_bug.cgi?id=175400
838
839         Reviewed by Matt Baker.
840
841         Test: inspector/canvas/setShaderProgramDisabled.html
842
843         * inspector/InspectorShaderProgram.h:
844         (WebCore::InspectorShaderProgram::disabled):
845         (WebCore::InspectorShaderProgram::setDisabled):
846
847         * html/canvas/WebGLRenderingContextBase.cpp:
848         (WebCore::WebGLRenderingContextBase::drawArrays):
849         (WebCore::WebGLRenderingContextBase::drawElements):
850         If the current program is disabled, return early. This will prevent the current shader
851         program from drawing anything to the canvas.
852
853         * inspector/InspectorCanvasAgent.h:
854         * inspector/InspectorCanvasAgent.cpp:
855         (WebCore::InspectorCanvasAgent::setShaderProgramDisabled):
856         (WebCore::InspectorCanvasAgent::isShaderProgramDisabled):
857         * inspector/InspectorInstrumentation.h:
858         * inspector/InspectorInstrumentation.cpp:
859         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
860         (WebCore::InspectorInstrumentation::isShaderProgramDisabledImpl):
861
862 2017-08-22  Youenn Fablet  <youenn@apple.com>
863
864         [Cache API] Add support for overwriting responses with put on an existing record
865         https://bugs.webkit.org/show_bug.cgi?id=175825
866
867         Reviewed by Geoffrey Garen.
868
869         Tests: http/wpt/cache-storage/cache-put-keys.https.any.html
870                http/wpt/cache-storage/cache-put-keys.https.any.worker.html
871
872         Adding support for the new response update counter.
873         Overwriting local cached response with new retrieved response when the counter is different.
874         Adding support for passing this value from/to workers.
875
876         * Modules/cache/Cache.cpp:
877         (WebCore::Cache::queryCacheWithTargetStorage):
878         (WebCore::toConnectionRecord):
879         (WebCore::Cache::updateRecords):
880         * Modules/cache/CacheStorageConnection.cpp:
881         (WebCore::CacheStorageConnection::Record::copy const):
882         * Modules/cache/CacheStorageConnection.h:
883         * Modules/cache/CacheStorageRecord.h:
884         * Modules/cache/WorkerCacheStorageConnection.cpp:
885         (WebCore::toCrossThreadRecordData):
886         (WebCore::fromCrossThreadRecordData):
887
888 2017-08-22  Alex Christensen  <achristensen@webkit.org>
889
890         Remove ChromeClient::hasOpenedPopup
891         https://bugs.webkit.org/show_bug.cgi?id=175804
892
893         Reviewed by Sam Weinig.
894
895         No change in behavior.  All implementations just returned false.
896
897         * loader/EmptyClients.h:
898         * page/Chrome.cpp:
899         (WebCore::Chrome::hasOpenedPopup const): Deleted.
900         * page/Chrome.h:
901         * page/ChromeClient.h:
902         * rendering/RenderMenuList.cpp:
903         (RenderMenuList::showPopup):
904
905 2017-08-22  Andy Estes  <aestes@apple.com>
906
907         [Payment Request] Implement error checking for show(), abort(), and canMakePayment()
908         https://bugs.webkit.org/show_bug.cgi?id=175789
909
910         Reviewed by Brady Eidson.
911
912         Implement many of the exceptions and promise rejections specified for PaymentRequest's
913         show(), abort(), and canMakePayment() methods. Also implement basic state tracking.
914
915         * Modules/paymentrequest/PaymentRequest.cpp:
916         (WebCore::PaymentRequest::create): Changed serializedMethodData from a
917         HashMap<String, String> to a Vector<PaymentRequest::Method>.
918         (WebCore::PaymentRequest::PaymentRequest):
919         (WebCore::PaymentRequest::show): Added promise rejection for invalid state, updated the
920         state to Interactive, stored the promise in m_showPromise, and dispatched finishShowing().
921         (WebCore::PaymentRequest::finishShowing): Added JSON parsing of payment method serialized
922         data and exception propagation. If there are no exceptions, rejected m_showPromise with
923         NotSupportedError since we don't yet support any payment methods.
924         (WebCore::PaymentRequest::abort): Added promise rejection for invalid state and stored the
925         promise in m_abortPromise. Dispatched a lambda to update the state to Closed, reject
926         m_showPromise, and resolve m_abortPromise.
927         (WebCore::PaymentRequest::canMakePayment): Added promise rejection for invalid state and
928         stored the promise in m_canMakePaymentPromise. Dispatched a lambda to resolve
929         m_canMakePaymentPromise with false since we don't yet support any payment methods.
930         * Modules/paymentrequest/PaymentRequest.h:
931         * Modules/paymentrequest/PaymentRequest.idl: Annotated abort() with MayThrowException.
932
933 2017-08-22  Brent Fulgham  <bfulgham@apple.com> and Pranjal Jumde  <pjumde@apple.com>
934
935         Disable access to secure cookies if an HTTPS site loads mixed content
936         https://bugs.webkit.org/show_bug.cgi?id=157053
937         <rdar://problem/11290808>
938
939         Reviewed by Dan Bates.
940
941         Tests: http/tests/security/mixedContent/insecure-css-with-secure-cookies.html
942                http/tests/security/mixedContent/insecure-image-with-securecookie-block.html
943                http/tests/security/mixedContent/insecure-image-with-securecookie.html
944                http/tests/security/mixedContent/insecure-script-with-secure-cookies.html
945                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies-block.html
946                http/tests/security/mixedContent/redirect-https-to-http-image-secure-cookies.html
947
948         * dom/SecurityContext.h: 
949         (WebCore::SecurityContext::secureCookiesAccessed): Added.
950         (WebCore::SecurityContext::setSecureCookiesAccessed): Added.
951         * loader/CookieJar.cpp:
952         (WebCore::cookies): Pass Document as non-const so we can call 'setSecureCookiesAccessed' if necessary.
953         * loader/CookieJar.h:
954         * loader/MixedContentChecker.cpp:
955         (WebCore::MixedContentChecker::canRunInsecureContent): Updated checks to avoid running insecure content
956         if secure cookies were accessed. 
957         * platform/CookiesStrategy.h:
958         (WebCore::CookiesStrategy::cookiesForDOM): Pass new argument indicating whether secure cookies should be included in the response.
959         * platform/network/PlatformCookieJar.h:
960         * platform/network/cf/CookieJarCFNet.cpp:
961         (copyCookiesForURLWithFirstPartyURL): Revise to accept new 'IncludeSecureCookiesOrNot' argument.
962         (WebCore::cookiesForSession): Updated to accept new 'IncludeSecureCookiesOrNot' argument. Also determine if secure cookies were
963         included in the response, and return this to the caller.
964         (WebCore::cookieRequestHeaderFieldValue): Revise for new 'copyCookiesForURLWithFirstPartyURL' signature.
965         (WebCore::getRawCookies): Ditto.
966         * platform/network/mac/CookieJarMac.mm:
967         (WebCore::cookiesForSession): Updated checks to keep track of secure cookies and filter out secure cookies if insecure content
968         was accessed.
969         (WebCore::cookiesForDOM): Update for new arguments and to return a pair.
970         (WebCore::cookieRequestHeaderFieldValue): Ditto.
971
972 2017-08-22  Jer Noble  <jer.noble@apple.com>
973
974         Autoplay Muted Videos Don't Play When Outside Viewport
975         https://bugs.webkit.org/show_bug.cgi?id=175748
976         <rdar://problem/33974383>
977
978         Reviewed by Eric Carlson.
979
980         Test: media/video-restricted-invisible-autoplay-not-allowed-source.html
981
982         The media session is notified that its client (the media element) will begin autoplaying inside
983         prepareForLoad(), where the m_autoplaying flag is also set. But loading via <source> elements does not go
984         through prepareForLoad(); the HTML standard states that the <source> element loading path does not trigger the
985         "media element load algorithm" which is implemented in prepareForLoad(). Since the m_autoplaying flag is
986         initially set to true, notify the media session that the element will begin autoplaying inside the element's
987         constructor.
988
989         Drive-by fix: Doing the above causes other tests to crash, as purturbing play state during style change can cause
990         re-entrancy in the native controls code, or fail, since we will transition from autoplay -> play even if there's
991         not yet a src or source to the media element. Add a task queue for updating the autoplay state and check the ready
992         state before allowing autoplay to transition to play.
993
994         * html/HTMLMediaElement.cpp:
995         (WebCore::HTMLMediaElement::HTMLMediaElement):
996         (WebCore::HTMLMediaElement::~HTMLMediaElement):
997         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
998         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
999
1000 2017-08-21  Matt Rajca  <mrajca@apple.com>
1001
1002         Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
1003         https://bugs.webkit.org/show_bug.cgi?id=175796
1004
1005         Reviewed by Eric Carlson.
1006
1007         Test: media/video-user-gesture-tracking.html
1008
1009         The page media state depends on m_userHasInteractedWithMediaElement, so force it to update
1010         as soon as m_userHasInteractedWithMediaElement changes. This fixes an issue where the media
1011         state would not reflect the user interaction flag until a call to updateIsPlayingMedia was made.
1012
1013         * dom/Document.cpp:
1014         (WebCore::Document::noteUserInteractionWithMediaElement):
1015         * dom/Document.h:
1016         (WebCore::Document::noteUserInteractionWithMediaElement): Deleted.
1017         * testing/Internals.cpp:
1018         (WebCore::Internals::pageMediaState):
1019
1020 2017-08-22  Zan Dobersek  <zdobersek@igalia.com>
1021
1022         GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
1023         https://bugs.webkit.org/show_bug.cgi?id=175819
1024
1025         Reviewed by Xabier Rodriguez-Calvar.
1026
1027         * platform/graphics/GLContext.cpp: The ThreadGlobalGLContext object is
1028         allocated on heap, so the embedded GLContext pointer can contain a
1029         non-null value that can cause problems when e.g. checking for a current
1030         GLContext on some specific thread on which a GLContext hasn't yet been
1031         made current. Zero-initializing this pointer will avoid false positives
1032         that can occur in these circumstances.
1033
1034 2017-08-21  Youenn Fablet  <youenn@apple.com>
1035
1036         [Cache API] Add support for Cache.add/addAll
1037         https://bugs.webkit.org/show_bug.cgi?id=175677
1038
1039         Reviewed by Alex Christensen.
1040
1041         Covered by rebased tests.
1042
1043         Cache.addAll implementation is then as follow:
1044         - Fetch the resources in parallel.
1045         - Wait for all them to complete using FetchTaskCounter.
1046         - If an error happens in any load or if the response is not as expected for Cache API, reject the promise.
1047         - Call the batch put operation with all received FetchResponse objects.
1048
1049         FetchTaskCounter is responsible to wait for each response to arrive.
1050         It then checks whether the response is fine,
1051         If not, the addAll promise is rejected.
1052         Otherwise, it waits for the body to be received.
1053
1054         Introducing a helper routine to create a FetchRequest from a given RequestInfo.
1055         Introducing a helper routine to check for Vary Header '*' value in response headers.
1056
1057         * Modules/cache/Cache.cpp:
1058         (WebCore::Cache::doMatch):
1059         (WebCore::Cache::add):
1060         (WebCore::queryCacheMatch):
1061         (WebCore::hasResponseVaryStarHeaderValue):
1062         (WebCore::FetchTaskCounter::FetchTaskCounter):
1063         (WebCore::FetchTaskCounter::~FetchTaskCounter):
1064         (WebCore::FetchTaskCounter::addRecord):
1065         (WebCore::FetchTaskCounter::isDone const):
1066         (WebCore::FetchTaskCounter::reject):
1067         (WebCore::Cache::requestFromInfo):
1068         (WebCore::Cache::addAll):
1069         (WebCore::Cache::put):
1070         (WebCore::Cache::remove):
1071         (WebCore::Cache::keys):
1072         (WebCore::toConnectionRecord):
1073         (WebCore::Cache::batchPutOperation):
1074         * Modules/cache/Cache.h:
1075
1076 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
1077
1078         DataInteractionTests.ExternalSourceAttributedStringToContentEditable hits a debug assertion
1079         https://bugs.webkit.org/show_bug.cgi?id=175787
1080         <rdar://problem/33996612>
1081
1082         Reviewed by Wenson Hsieh.
1083
1084         The variation axis values of San Francisco changed from the GX-style scale to the CSS-style
1085         scale. Previously, we were normalizing the values we got from Core Text to fit the CSS scale;
1086         however, this is no longer necessary since the font now does this itself.
1087
1088         The assertion was getting hit because the normalized values were huge and were overflowing
1089         a single FontSelectionValue (and going negative). This patch adds handling for this
1090         situation.
1091
1092         Test: DataInteractionTests.ExternalSourceBoldSystemAttributedStringToContentEditable
1093
1094         * platform/graphics/FontSelectionAlgorithm.h: Typedef the backing type for a FontSelectionValue.
1095         (WebCore::FontSelectionValue::rawValue const):
1096         (WebCore::FontSelectionValue::maximumValue):
1097         (WebCore::FontSelectionValue::minimumValue):
1098         (WebCore::FontSelectionValue::FontSelectionValue):
1099         * platform/graphics/cocoa/FontCacheCoreText.cpp: Opt-out of normalization for San Francisco.
1100         (WebCore::variationCapabilitiesForFontDescriptor):
1101         (WebCore::capabilitiesForFontDescriptor):
1102
1103 2017-08-21  Chris Dumez  <cdumez@apple.com>
1104
1105         [Beacon] Content extensions should be able to intercept Beacon / Ping redirects
1106         https://bugs.webkit.org/show_bug.cgi?id=175746
1107         <rdar://problem/33946050>
1108
1109         Reviewed by Alex Christensen.
1110
1111         Update PingLoad to process content extension rules upon redirect. This allows content
1112         extensions to block and upgrade to HTTPS beacon / ping loads.
1113
1114         Because ping loads can outlive the WebProcess, the content extensions rules are passed
1115         to the NetworkProcess when starting the Ping load. The PingLoad can then consult those
1116         rules upon redirect, on the NetworkProcess side.
1117
1118         Tests: http/wpt/beacon/contentextensions/beacon-blocked.html
1119                http/wpt/beacon/contentextensions/beacon-redirect-blocked.html
1120
1121         * contentextensions/ContentExtensionActions.h:
1122         * contentextensions/ContentExtensionsBackend.cpp:
1123         (WebCore::ContentExtensions::ContentExtensionsBackend::forEach):
1124         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForPingLoad):
1125         * contentextensions/ContentExtensionsBackend.h:
1126         * page/Page.h:
1127         * page/UserContentProvider.cpp:
1128         (WebCore::UserContentProvider::forEachContentExtension):
1129         * page/UserContentProvider.h:
1130
1131 2017-08-21  Brady Eidson  <beidson@apple.com>
1132
1133         ASSERTION FAILED: !m_connections.contains(&connection) in WebCore::SWServer::unregisterConnection(WebCore::SWServer::Connection&).
1134         https://bugs.webkit.org/show_bug.cgi?id=175795
1135
1136         Rubber-stamped by Andy Estes.
1137
1138         * workers/service/server/SWServer.cpp:
1139         (WebCore::SWServer::unregisterConnection): Flip the ASSERT to be... correct.
1140
1141 2017-08-21  Daniel Bates  <dabates@apple.com>
1142
1143         Cleanup TextPainter
1144         https://bugs.webkit.org/show_bug.cgi?id=175782
1145
1146         Reviewed by Myles C. Maxfield.
1147
1148         Remove redundant mention of "text" in the name of TextPainter member functions, add separate
1149         setters for selection and non-selection shadows, and do some other minor cleanups.
1150
1151         * rendering/InlineTextBox.cpp:
1152         (WebCore::InlineTextBox::paint): Update code for renamed functions.
1153         * rendering/SimpleLineLayoutFunctions.cpp:
1154         (WebCore::SimpleLineLayout::paintFlow): Ditto.
1155         * rendering/TextPainter.cpp: Include ShadowData.h.
1156         (WebCore::ShadowApplier::ShadowApplier): Use C++11 brace-initialization syntax.
1157         (WebCore::ShadowApplier::isLastShadowIteration): Moved from TextPainter.h.
1158         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
1159         (WebCore::TextPainter::paintTextOrEmphasisMarks): Renamed; formerly named drawTextOrEmphasisMarks.
1160         (WebCore::TextPainter::paintTextWithShadows): Update code for renamed functions.
1161         (WebCore::TextPainter::paintRange): Renamed; formerly named paintTextInRange.
1162         (WebCore::TextPainter::paint): Renamed; formerly named paintText.
1163         (WebCore::TextPainter::drawTextOrEmphasisMarks): Renamed to paintTextOrEmphasisMarks() to match
1164         the naming convention of all the other paint functions in this class.
1165         (WebCore::TextPainter::paintTextInRange): Renamed to paintRange.
1166         (WebCore::TextPainter::paintText): Renamed to paint.
1167         * rendering/TextPainter.h: Forward declare ShadowData.
1168         (WebCore::TextPainter::setStyle): Renamed; formerly named setTextPaintStyle.
1169         (WebCore::TextPainter::setSelectionStyle): Renamed; formerly named setSelectionPaintStyle.
1170         (WebCore::TextPainter::setShadow): Added.
1171         (WebCore::TextPainter::setSelectionShadow): Added.
1172         (WebCore::TextPainter::setEmphasisMark): Renamed; formerly named addEmphasis. 
1173         (WebCore::TextPainter::setTextPaintStyle): Renamed to setStyle.
1174         (WebCore::TextPainter::setSelectionPaintStyle): Renamed to setSelectionStyle.
1175         (WebCore::TextPainter::addEmphasis): Renamed to setEmphasisMark.
1176         (WebCore::TextPainter::addTextShadow): Split functionality into setShadow and setSelectionShadow.
1177         (WebCore::ShadowApplier::isLastShadowIteration): Moved to TextPainter.cpp.
1178         (WebCore::ShadowApplier::shadowIsCompletelyCoveredByText): Ditto.
1179
1180 2017-08-21  Myles C. Maxfield  <mmaxfield@apple.com>
1181
1182         Addressing post-review comments after r220725
1183         https://bugs.webkit.org/show_bug.cgi?id=175382
1184
1185         Reviewed by Darin Adler.
1186
1187         * css/CSSFontFace.cpp:
1188         (WebCore::CSSFontFace::setUnicodeRange):
1189
1190 2017-08-21  Youenn Fablet  <youenn@apple.com>
1191
1192         [Cache API] Add support for CacheStorage.match
1193         https://bugs.webkit.org/show_bug.cgi?id=175747
1194
1195         Reviewed by Chris Dumez.
1196
1197         Covered by rebased tests.
1198
1199         Introducing Cache::doMatch so that CacheStorage can use it.
1200         Make Cache::match use Cache::doMatch as well.
1201
1202         Implementing CacheStorage.match as per spec:
1203         - If name is provided, query only the cache with the given name.
1204         - Otherwise pick the first matching response in the caches.
1205         The sequential asynchronous search is done in doSequentialMatch.
1206
1207         Making sure that response with a status code are returning false to isNull.
1208         This allows passing more tests.
1209
1210         * Modules/cache/Cache.cpp:
1211         (WebCore::Cache::match):
1212         (WebCore::Cache::doMatch):
1213         (WebCore::Cache::matchAll):
1214         (WebCore::toConnectionRecord):
1215         * Modules/cache/Cache.h:
1216         * Modules/cache/CacheStorage.cpp:
1217         (WebCore::doSequentialMatch):
1218         (WebCore::copyCaches):
1219         (WebCore::CacheStorage::match):
1220         * platform/network/ResourceResponseBase.cpp:
1221         (WebCore::ResourceResponseBase::setHTTPStatusCode):
1222
1223 2017-08-21  Dean Jackson  <dino@apple.com>
1224
1225         Persistent WebGL Warning "vertex WARNING: 0:1: extension 'GL_ARB_gpu_shader5' is not supported" in Safari 10.1.2
1226         https://bugs.webkit.org/show_bug.cgi?id=175783
1227         <rdar://problem/33623867>
1228
1229         Reviewed by Alex Christensen.
1230
1231         The version of ANGLE we use inserts this line into each shader:
1232         #extension GL_ARB_gpu_shader5 : enable
1233         It causes our lower-level GLSL compiler to give a warning, which is
1234         confusing to developers because they didn't write this code.
1235
1236         Until we upgrade our OpenGL support to version 4.1, we should remove
1237         this error message from the log returned to the developer.
1238         See https://bugs.webkit.org/show_bug.cgi?id=175785
1239
1240         Test: fast/canvas/webgl/no-info-log-for-simple-shaders.html
1241
1242         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1243         (WebCore::GraphicsContext3D::getUnmangledInfoLog): Search for and remove
1244         this warning.
1245
1246 2017-08-21  Andy Estes  <aestes@apple.com>
1247
1248         [Payment Request] Use ExistingExceptionError to propagate JS exceptions thrown during JSON stringification
1249         https://bugs.webkit.org/show_bug.cgi?id=175776
1250
1251         Reviewed by Darin Adler.
1252
1253         * Modules/paymentrequest/PaymentRequest.cpp:
1254         (WebCore::PaymentRequest::create):
1255         * Modules/paymentrequest/PaymentRequest.h:
1256
1257 2017-08-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1258
1259         [PAL] Move spi/mac directory into PAL
1260         https://bugs.webkit.org/show_bug.cgi?id=175649
1261
1262         Reviewed by Myles C. Maxfield.
1263
1264         * WebCore.xcodeproj/project.pbxproj:
1265         * editing/cocoa/DataDetection.mm:
1266         * editing/mac/DictionaryLookup.h:
1267         * editing/mac/DictionaryLookup.mm:
1268         * page/mac/ServicesOverlayController.mm:
1269         * page/mac/WheelEventDeltaFilterMac.mm:
1270         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
1271         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1272         * platform/graphics/avfoundation/MediaPlaybackTargetMac.mm:
1273         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
1274         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1275         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1276         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1277         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1278         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1279         * platform/graphics/mac/FontCacheMac.mm:
1280         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1281         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1282         * platform/graphics/mac/MediaTimeQTKit.h:
1283         * platform/mac/MediaRemoteSoftLink.cpp:
1284         * platform/mac/MediaRemoteSoftLink.h:
1285         * platform/mac/PasteboardWriter.mm:
1286         * platform/mac/PlatformEventFactoryMac.mm:
1287         * platform/mac/ScrollAnimatorMac.mm:
1288         * platform/mac/ScrollbarThemeMac.mm:
1289         * platform/mac/VideoFullscreenInterfaceMac.mm:
1290         * platform/mac/WebVideoFullscreenController.mm:
1291         * rendering/RenderThemeMac.mm:
1292
1293 2017-08-21  Adrian Perez de Castro  <aperez@igalia.com>
1294
1295         [GTK][WPE][GSTREAMER_GL] Overriden virtual function not marked “override” in MediaPlayerPrivateGStreamerBase.h
1296         https://bugs.webkit.org/show_bug.cgi?id=175780
1297
1298         Reviewed by Konstantin Tokarev.
1299
1300         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: Add missing "override" qualifier.
1301
1302 2017-08-21  Brady Eidson  <beidson@apple.com>
1303
1304         Split the one SWServer::Connection into SWClientConnection and SWServer::Connection.
1305         https://bugs.webkit.org/show_bug.cgi?id=175745
1306
1307         Reviewed by Andy Estes.
1308
1309         No new tests (No behavior change).
1310
1311         Each of these has a much different environment that it lives in, so being the same object
1312         hinders clean development.
1313         
1314         This split will also make it easier for the WebCore objects to directly handle WK2 messages.
1315         
1316         * CMakeLists.txt:
1317         * WebCore.xcodeproj/project.pbxproj:
1318         
1319         * platform/Logging.h:
1320
1321         * workers/service/ServiceWorkerContainer.cpp:
1322         (WebCore::ServiceWorkerContainer::addRegistration):
1323         (WebCore::ServiceWorkerContainer::scheduleJob):
1324         * workers/service/ServiceWorkerContainer.h:
1325
1326         * workers/service/ServiceWorkerProvider.h:
1327
1328         * workers/service/server/SWClientConnection.cpp: Copied from Source/WebCore/workers/service/server/SWServer.cpp.
1329         (WebCore::SWClientConnection::SWClientConnection):
1330         (WebCore::SWClientConnection::~SWClientConnection):
1331         (WebCore::SWClientConnection::scheduleJob):
1332         (WebCore::SWClientConnection::jobRejectedInServer):
1333         * workers/service/server/SWClientConnection.h: Copied from Source/WebCore/workers/service/server/SWServer.h.
1334
1335         * workers/service/server/SWServer.cpp:
1336         (WebCore::SWServer::Connection::Connection):
1337         (WebCore::SWServer::Connection::~Connection):
1338         (WebCore::SWServer::~SWServer):
1339         (WebCore::SWServer::Connection::scheduleJobInServer):
1340         (WebCore::SWServer::scheduleJob):
1341         (WebCore::SWServer::registerConnection):
1342         (WebCore::SWServer::unregisterConnection):
1343         (WebCore::SWServer::Connection::scheduleJob): Deleted.
1344         (WebCore::SWServer::Connection::jobRejected): Deleted.
1345         * workers/service/server/SWServer.h:
1346         (WebCore::SWServer::Connection::server):
1347         (WebCore::SWServer::Connection::~Connection): Deleted.
1348
1349 2017-08-21  Andy Estes  <aestes@apple.com>
1350
1351         [Payment Request] Implement the PaymentRequest constructor
1352         https://bugs.webkit.org/show_bug.cgi?id=175755
1353
1354         Reviewed by Darin Adler.
1355
1356         * Modules/paymentrequest/PaymentDetailsModifier.h: Changed total to an std::optional<PaymentItem>.
1357         * Modules/paymentrequest/PaymentRequest.cpp:
1358         (WebCore::isWellFormedCurrencyCode): Implements the IsWellFormedCurrencyCode abstract operation from ECMA 402.
1359         (WebCore::isValidDecimalMonetaryValue): Implements the "valid decimal monetary value" validity checker.
1360         (WebCore::checkAndCanonicalizeAmount): Implements the "check and canonicalize amount" validity checker.
1361         (WebCore::checkAndCanonicalizeTotal): Implements the "check and canonicalize total" validity checker.
1362         (WebCore::PaymentRequest::create): Implements the PaymentRequest Constructor
1363         (WebCore::PaymentRequest::PaymentRequest):
1364         (WebCore::PaymentRequest::id const): Implements the PaymentRequest id attribute.
1365         (WebCore::PaymentRequest::shippingType const): Implements the PaymentRequest shippingType attribute.
1366         * Modules/paymentrequest/PaymentRequest.h:
1367         * Modules/paymentrequest/PaymentRequest.idl: Annotated PaymentRequest with ConstructorMayThrowException.
1368         * WebCore.xcodeproj/project.pbxproj:
1369
1370 2017-08-21  Per Arne Vollan  <pvollan@apple.com>
1371
1372         [Win] DRT should only allow any https certificate for localhost.
1373         https://bugs.webkit.org/show_bug.cgi?id=175147
1374
1375         Reviewed by Brent Fulgham.
1376
1377         Disabling validation of certificate chains, breaks SSL on Windows. In order
1378         for SSL tests to succeed on Windows, we should avoid disabling it.
1379
1380         No new tests, covered by existing tests.
1381
1382         * platform/network/cf/ResourceHandleCFNet.cpp:
1383         (WebCore::ResourceHandle::createCFURLConnection):
1384
1385 2017-08-21  Zan Dobersek  <zdobersek@igalia.com>
1386
1387         [EME] HTMLMediaElement: basic implementations of 'Attempt to Decrypt', 'Attempt to Resume Playback If Necessary'
1388         https://bugs.webkit.org/show_bug.cgi?id=175761
1389
1390         Reviewed by Xabier Rodriguez-Calvar.
1391
1392         Add initial and incomplete implementations of the 'Attempt to Decrypt' and
1393         'Attempt to Resume Playback If Necessary' algorithms.  The implementations
1394         are interleaved with the specification text for clarity.
1395
1396         'Attempt to Decrypt' implementation doesn't yet address the encrypted block
1397         queue or the 'decryption blocked waiting for key' flag since it's not yet
1398         clear whether it would make more sense for this state to reside lower, in
1399         the platform layer. The gist of the algorithm is to invoke the decryption
1400         attempt through the MediaPlayer object, passing along the CDMInstance object
1401         retrieved from the MediaKeys object that is associated with this media
1402         element.
1403
1404         'Attempt to Resume Playback if Necessary' implementation similarly for now
1405         omits the various state flag operations. The main task at this point is to
1406         dispatch the 'Attempt to Decrypt' algorithm.
1407
1408         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() method now
1409         invokes the attemptToResumePlaybackIfNecessary() method.
1410
1411         MediaKeys::hasOpenSessions() is introduced, returning true if any session
1412         that was created through this MediaKeys instance is still open. This allows
1413         the 'Attempt to Decrypt' algorithm to proceed with the decryption attempt
1414         dispatch into the MediaPlayer hierarchy.
1415
1416         For that, the MediaPlayer::attemptToDecryptWithInstance() method is added,
1417         which simply dispatches the mirror method on MediaPlayerPrivate interface.
1418         This will enable the platform-layer implementations to use the passed-in
1419         CDMInstance object for decryption purposes.
1420
1421         * Modules/encryptedmedia/MediaKeySession.h:
1422         * Modules/encryptedmedia/MediaKeys.cpp:
1423         (WebCore::MediaKeys::hasOpenSessions const):
1424         * Modules/encryptedmedia/MediaKeys.h:
1425         * html/HTMLMediaElement.cpp:
1426         (WebCore::HTMLMediaElement::attemptToDecrypt):
1427         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
1428         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
1429         * html/HTMLMediaElement.h: Mark cdmClientAttemptToResumePlaybackIfNecessary() as final.
1430         * platform/graphics/MediaPlayer.cpp:
1431         (WebCore::MediaPlayer::attemptToDecryptWithInstance):
1432         * platform/graphics/MediaPlayer.h:
1433         * platform/graphics/MediaPlayerPrivate.h:
1434         (WebCore::MediaPlayerPrivateInterface::attemptToDecryptWithInstance):
1435
1436 2017-08-20  Zan Dobersek  <zdobersek@igalia.com>
1437
1438         [EME] Add basic implementation of HTMLMediaElement::setMediaKeys()
1439         https://bugs.webkit.org/show_bug.cgi?id=175717
1440
1441         Reviewed by Xabier Rodriguez-Calvar.
1442
1443         Add an initial and incomplete implementation of HTMLMediaElement::setMediaKeys(),
1444         interleaved with the specification wording of how this operation should behave.
1445         The implementation still doesn't cover cases of CDM instances being already
1446         associated with a different HTMLMediaElement, of CDM instances that can't be
1447         disassociated from the current HTMLMediaElement, and of failures during both
1448         association and disassociation of MediaKeys with the HTMLMediaElement.
1449
1450         The HTMLMediaElement (as a CDMClient inheritor) has to be attached or detached
1451         from the MediaKeys object as appropriate. This attachment allows MediaKeys to
1452         initiate an attempt to resume playback whenever the key statuses of the
1453         associated MediaKeys object are updated.
1454
1455         Upon association and disassociation with MediaKeys, the CDMInstance object of
1456         that specific MediaKeys instance is attached to or detached from the MediaPlayer
1457         instance. This allows the platform layer to gather information about the
1458         CDMInstance that will be used for decryption of media content for this specific
1459         media element.
1460
1461         Additionally, the detachment from both MediaKeys and MediaPlayer is done upon
1462         HTMLMediaElement destruction.
1463
1464         Upon setting the MediaKeys object, a task is queued that launches the 'Attempt to
1465         Resume Playback If Necessary' algorithm. A placeholder method is added that will
1466         implement the algorithm in the future.
1467
1468         The HTMLMediaElement::mediaKeys() getter is also implemented, returning pointer
1469         held in m_mediaKeys.
1470
1471         Covered to a degree by existing imported W3C tests, with a setMediaKeys()-oriented
1472         test having WPE-specific baseline update.
1473
1474         * Modules/encryptedmedia/MediaKeys.h:
1475         (WebCore::MediaKeys::cdmInstance const):
1476         * html/HTMLMediaElement.cpp:
1477         (WebCore::HTMLMediaElement::~HTMLMediaElement):
1478         (WebCore::HTMLMediaElement::mediaKeys const):
1479         (WebCore::HTMLMediaElement::setMediaKeys):
1480         (WebCore::HTMLMediaElement::attemptToResumePlaybackIfNecessary):
1481         (WebCore::HTMLMediaElement::contextDestroyed):
1482         * html/HTMLMediaElement.h:
1483         * platform/graphics/MediaPlayer.cpp:
1484         (WebCore::MediaPlayer::cdmInstanceAttached):
1485         (WebCore::MediaPlayer::cdmInstanceDetached):
1486         * platform/graphics/MediaPlayer.h:
1487         * platform/graphics/MediaPlayerPrivate.h:
1488         (WebCore::MediaPlayerPrivateInterface::cdmInstanceAttached):
1489         (WebCore::MediaPlayerPrivateInterface::cdmInstanceDetached):
1490
1491 2017-08-20  Chris Dumez  <cdumez@apple.com>
1492
1493         Simplify calls to LoaderStrategy::startPingLoad()
1494         https://bugs.webkit.org/show_bug.cgi?id=175756
1495
1496         Reviewed by Sam Weinig.
1497
1498         Simplify calls to LoaderStrategy::startPingLoad() by passing the Frame to it
1499         and let its implementation gets what it needs from the frame. This reduces
1500         the number of parameters to startPingLoad() and is more easily extensible.
1501
1502         * dom/Document.h:
1503         * loader/LoaderStrategy.h:
1504         * loader/PingLoader.cpp:
1505         (WebCore::PingLoader::loadImage):
1506         (WebCore::PingLoader::sendPing):
1507         (WebCore::PingLoader::sendViolationReport):
1508         (WebCore::PingLoader::startPingLoad):
1509         * loader/PingLoader.h:
1510         * loader/cache/CachedResource.cpp:
1511         (WebCore::CachedResource::load):
1512
1513 2017-08-20  Antti Koivisto  <antti@apple.com>
1514
1515         Factor :before/:after render tree mutations into a RenderTreeUpdater helper class
1516         https://bugs.webkit.org/show_bug.cgi?id=175752
1517
1518         Reviewed by Andreas Kling.
1519
1520         Move code that constructs generated content renderers out from PseudoElement.
1521         Also refactor the related code from RenderTreeUpdater main class into
1522         RenderTreeUpdater::GeneratedContent helper class.
1523
1524         * WebCore.xcodeproj/project.pbxproj:
1525         * dom/PseudoElement.cpp:
1526         (WebCore::PseudoElement::resolveCustomStyle): Deleted.
1527
1528             Not needed anymore.
1529
1530         (WebCore::PseudoElement::didAttachRenderers): Deleted.
1531
1532             Moves to createContentRenderers in GeneratedContent.
1533
1534         (WebCore::PseudoElement::didRecalcStyle): Deleted.
1535
1536             Moves to updateStyleForContentRenderers in GeneratedContent.
1537
1538         * dom/PseudoElement.h:
1539         * style/RenderTreeUpdater.cpp:
1540         (WebCore::RenderTreeUpdater::RenderTreeUpdater):
1541         (WebCore::RenderTreeUpdater::~RenderTreeUpdater):
1542         (WebCore::RenderTreeUpdater::commit):
1543         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
1544         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1545         (WebCore::needsPseudoElement): Deleted.
1546         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement): Deleted.
1547         (WebCore::RenderTreeUpdater::updateQuotesUpTo): Deleted.
1548
1549             Quotes and other :before/:after support moves to GeneratedContent helpwe.
1550
1551         * style/RenderTreeUpdater.h:
1552         (WebCore::RenderTreeUpdater::generatedContent):
1553         * style/RenderTreeUpdaterGeneratedContent.cpp: Added.
1554         (WebCore::RenderTreeUpdater::GeneratedContent::GeneratedContent):
1555         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement):
1556         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement):
1557         (WebCore::RenderTreeUpdater::GeneratedContent::updateRemainingQuotes):
1558         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
1559         (WebCore::createContentRenderers):
1560         (WebCore::updateStyleForContentRenderers):
1561         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1562         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
1563         * style/RenderTreeUpdaterGeneratedContent.h: Added.
1564
1565 2017-08-19  Andy Estes  <aestes@apple.com>
1566
1567         [Payment Request] Add interface stubs
1568         https://bugs.webkit.org/show_bug.cgi?id=175730
1569
1570         Reviewed by Youenn Fablet.
1571
1572         * DerivedSources.make:
1573         * Modules/paymentrequest/PaymentAddress.h: Added.
1574         * Modules/paymentrequest/PaymentAddress.idl: Added.
1575         * Modules/paymentrequest/PaymentComplete.h: Added.
1576         * Modules/paymentrequest/PaymentComplete.idl: Added.
1577         * Modules/paymentrequest/PaymentCurrencyAmount.h: Added.
1578         * Modules/paymentrequest/PaymentCurrencyAmount.idl: Added.
1579         * Modules/paymentrequest/PaymentDetailsBase.h: Added.
1580         * Modules/paymentrequest/PaymentDetailsBase.idl: Added.
1581         * Modules/paymentrequest/PaymentDetailsInit.h: Added.
1582         * Modules/paymentrequest/PaymentDetailsInit.idl: Added.
1583         * Modules/paymentrequest/PaymentDetailsModifier.h: Added.
1584         * Modules/paymentrequest/PaymentDetailsModifier.idl: Added.
1585         * Modules/paymentrequest/PaymentDetailsUpdate.h: Added.
1586         * Modules/paymentrequest/PaymentDetailsUpdate.idl: Added.
1587         * Modules/paymentrequest/PaymentItem.h: Added.
1588         * Modules/paymentrequest/PaymentItem.idl: Added.
1589         * Modules/paymentrequest/PaymentMethodData.h: Added.
1590         * Modules/paymentrequest/PaymentMethodData.idl: Added.
1591         * Modules/paymentrequest/PaymentOptions.h: Added.
1592         * Modules/paymentrequest/PaymentOptions.idl: Added.
1593         * Modules/paymentrequest/PaymentRequest.cpp: Added.
1594         (WebCore::PaymentRequest::create):
1595         (WebCore::PaymentRequest::PaymentRequest):
1596         (WebCore::PaymentRequest::~PaymentRequest):
1597         (WebCore::PaymentRequest::show):
1598         (WebCore::PaymentRequest::abort):
1599         (WebCore::PaymentRequest::canMakePayment):
1600         * Modules/paymentrequest/PaymentRequest.h: Added.
1601         * Modules/paymentrequest/PaymentRequest.idl: Added.
1602         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp: Added.
1603         (WebCore::PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent):
1604         (WebCore::PaymentRequestUpdateEvent::updateWith):
1605         * Modules/paymentrequest/PaymentRequestUpdateEvent.h: Added.
1606         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl: Added.
1607         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h: Added.
1608         * Modules/paymentrequest/PaymentRequestUpdateEventInit.idl: Added.
1609         * Modules/paymentrequest/PaymentResponse.cpp: Added.
1610         (WebCore::PaymentResponse::complete):
1611         * Modules/paymentrequest/PaymentResponse.h: Added.
1612         * Modules/paymentrequest/PaymentResponse.idl: Added.
1613         * Modules/paymentrequest/PaymentShippingOption.h: Added.
1614         * Modules/paymentrequest/PaymentShippingOption.idl: Added.
1615         * Modules/paymentrequest/PaymentShippingType.h: Added.
1616         * Modules/paymentrequest/PaymentShippingType.idl: Added.
1617         * WebCore.xcodeproj/project.pbxproj:
1618         * dom/EventNames.h:
1619         * dom/EventNames.in:
1620         * dom/EventTargetFactory.in:
1621
1622 2017-08-19  Sam Weinig  <sam@webkit.org>
1623
1624         [WebCrypto] Remove the KeyAlgorithm type hierarchy
1625         https://bugs.webkit.org/show_bug.cgi?id=175750
1626
1627         Reviewed by Chris Dumez.
1628
1629         Removes the unnecessary indirection that existed to generate a
1630         KeyAlgorithm dictionary (or rather, one of its derived dictionaries)
1631         for a CryptoKey. We were calling the virtual buildAlgorithm(), which
1632         return a std::unique_ptr<KeyAlgorithm>, which we then casted to the 
1633         correct derived class and called dictionary() on. This can now be
1634         simplified by making each CryptoKey derived class override a function
1635         that returns the KeyAlgorithm variant.
1636
1637         * crypto/CryptoKey.cpp:
1638         (WebCore::CryptoKey::algorithm const): Deleted.
1639         * crypto/CryptoKey.h:
1640         (WebCore::CryptoKey::extractable const):
1641         (WebCore::KeyAlgorithm::~KeyAlgorithm): Deleted.
1642         (WebCore::KeyAlgorithm::name const): Deleted.
1643         (WebCore::KeyAlgorithm::KeyAlgorithm): Deleted.
1644         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1645         (WebCore::CryptoKeyRSA::algorithm const):
1646         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
1647         * crypto/keys/CryptoKeyAES.cpp:
1648         (WebCore::CryptoKeyAES::algorithm const):
1649         (WebCore::AesKeyAlgorithm::dictionary const): Deleted.
1650         (WebCore::CryptoKeyAES::buildAlgorithm const): Deleted.
1651         * crypto/keys/CryptoKeyAES.h:
1652         * crypto/keys/CryptoKeyEC.cpp:
1653         (WebCore::CryptoKeyEC::algorithm const):
1654         (WebCore::EcKeyAlgorithm::dictionary const): Deleted.
1655         (WebCore::CryptoKeyEC::buildAlgorithm const): Deleted.
1656         * crypto/keys/CryptoKeyEC.h:
1657         (WebCore::EcKeyAlgorithm::EcKeyAlgorithm): Deleted.
1658         (WebCore::EcKeyAlgorithm::namedCurve const): Deleted.
1659         * crypto/keys/CryptoKeyHMAC.cpp:
1660         (WebCore::CryptoKeyHMAC::algorithm const):
1661         (WebCore::HmacKeyAlgorithm::dictionary const): Deleted.
1662         (WebCore::CryptoKeyHMAC::buildAlgorithm const): Deleted.
1663         * crypto/keys/CryptoKeyHMAC.h:
1664         * crypto/keys/CryptoKeyRSA.cpp:
1665         (WebCore::RsaKeyAlgorithm::dictionary const): Deleted.
1666         (WebCore::RsaHashedKeyAlgorithm::dictionary const): Deleted.
1667         * crypto/keys/CryptoKeyRSA.h:
1668         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm): Deleted.
1669         (WebCore::RsaKeyAlgorithm::modulusLength const): Deleted.
1670         (WebCore::RsaKeyAlgorithm::publicExponent const): Deleted.
1671         * crypto/keys/CryptoKeyRaw.cpp:
1672         (WebCore::CryptoKeyRaw::algorithm const):
1673         (WebCore::RawKeyAlgorithm::dictionary const): Deleted.
1674         (WebCore::CryptoKeyRaw::buildAlgorithm const): Deleted.
1675         * crypto/keys/CryptoKeyRaw.h:
1676         (WebCore::RawKeyAlgorithm::RawKeyAlgorithm): Deleted.
1677         * crypto/mac/CryptoKeyRSAMac.cpp:
1678         (WebCore::CryptoKeyRSA::algorithm const):
1679         (WebCore::CryptoKeyRSA::buildAlgorithm const): Deleted.
1680
1681 2017-08-19  Sam Weinig  <sam@webkit.org>
1682
1683         [Mac] Change uint8_t* to Vector<uint8_t> type in all crypto algorithm implementation
1684         https://bugs.webkit.org/show_bug.cgi?id=164939
1685
1686         Reviewed by Chris Dumez.
1687
1688         Address FIXMEs, replacing uint8_t*/size_t parameters with Vector<uint8_t>&.
1689
1690         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1691         (WebCore::transformAES_CBC):
1692         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
1693         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
1694         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1695         (WebCore::wrapKeyAES_KW):
1696         (WebCore::unwrapKeyAES_KW):
1697         (WebCore::CryptoAlgorithmAES_KW::platformWrapKey):
1698         (WebCore::CryptoAlgorithmAES_KW::platformUnwrapKey):
1699         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1700         (WebCore::calculateSignature):
1701         (WebCore::CryptoAlgorithmHMAC::platformSign):
1702         (WebCore::CryptoAlgorithmHMAC::platformVerify):
1703         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1704         (WebCore::encryptRSAES_PKCS1_v1_5):
1705         (WebCore::decryptRSAES_PKCS1_v1_5):
1706         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1707         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
1708         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1709         (WebCore::signRSASSA_PKCS1_v1_5):
1710         (WebCore::verifyRSASSA_PKCS1_v1_5):
1711         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
1712         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify):
1713         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1714         (WebCore::encryptRSA_OAEP):
1715         (WebCore::decryptRSA_OAEP):
1716         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1717         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
1718
1719 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
1720
1721         Forbid setDragImage after dragstart
1722         https://bugs.webkit.org/show_bug.cgi?id=175751
1723
1724         Reviewed by Wenson Hsieh.
1725
1726         Removed the code to allow setting the drag mage after dragstart had happened.
1727
1728         The feature was apparently used in Mac WebKit1 port but using it today causes the drag image
1729         to disapepar while the user is moving the mouse cursor and being drawn once it's stopped
1730         and results in the contionus flickering of the drag image.
1731
1732         The feaure was never supported in WebKit2 and doesn't match the HTML5 specification:
1733         https://html.spec.whatwg.org/multipage/dnd.html#concept-dnd-rw
1734         https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage
1735         or the behaviors of other browsers such as Chrome and Firefox.
1736
1737         No new tests. This patch simply removes code.
1738
1739         * dom/DataTransfer.cpp:
1740         (WebCore::DataTransfer::setDragImage):
1741         (WebCore::DataTransfer::canSetDragImage const): Deleted.
1742         * dom/DataTransfer.h:
1743         (WebCore::DataTransfer::makeDragImageWritable): Deleted.
1744         * page/EventHandler.cpp:
1745         (WebCore::EventHandler::handleDrag):
1746
1747 2017-08-18  Sam Weinig  <sam@webkit.org>
1748
1749         [WebCrypto] Get rid of CryptoKeyData class and all its subclasses
1750         https://bugs.webkit.org/show_bug.cgi?id=169806
1751
1752         Reviewed by Chris Dumez.
1753
1754         - Replaces the CryptoKeyData type hierarchy 
1755
1756             CryptoKeyData
1757               - CryptoKeyDataOctetSequence
1758               - CryptoKeyDataRSAComponents
1759
1760           with the renamed CryptoKeyRSAComponents.
1761
1762         - Removes pure virtual exportData function on CryptoKey, and all
1763           the implementations except the one on CryptoKeyRSA, which now is
1764           non-virtual, and returns a CryptoKeyRSAComponents. Update the one
1765           external caller, SerializedScriptValue, to handle this.
1766
1767         * CMakeLists.txt:
1768         * WebCore.xcodeproj/project.pbxproj:
1769         * bindings/js/SerializedScriptValue.cpp:
1770         * crypto/CryptoAlgorithm.h:
1771         * crypto/CryptoKey.h:
1772         * crypto/CryptoKeyData.h: Removed.
1773         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1774         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1775         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1776         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1777         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1778         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1779         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1780         (WebCore::CryptoKeyRSA::create):
1781         (WebCore::CryptoKeyRSA::exportData const):
1782         * crypto/keys/CryptoKeyAES.cpp:
1783         (WebCore::CryptoKeyAES::exportData const): Deleted.
1784         * crypto/keys/CryptoKeyAES.h:
1785         * crypto/keys/CryptoKeyDataOctetSequence.cpp: Removed.
1786         * crypto/keys/CryptoKeyDataOctetSequence.h: Removed.
1787         * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
1788         * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
1789         * crypto/keys/CryptoKeyEC.cpp:
1790         (WebCore::CryptoKeyEC::exportData const): Deleted.
1791         * crypto/keys/CryptoKeyEC.h:
1792         * crypto/keys/CryptoKeyHMAC.cpp:
1793         (WebCore::CryptoKeyHMAC::exportData const): Deleted.
1794         * crypto/keys/CryptoKeyHMAC.h:
1795         * crypto/keys/CryptoKeyRSA.cpp:
1796         (WebCore::CryptoKeyRSA::importJwk):
1797         (WebCore::CryptoKeyRSA::exportJwk const):
1798         * crypto/keys/CryptoKeyRSA.h:
1799         * crypto/keys/CryptoKeyRSAComponents.cpp: Copied from crypto/keys/CryptoKeyDataRSAComponents.cpp.
1800         (WebCore::CryptoKeyRSAComponents::CryptoKeyRSAComponents):
1801         (WebCore::CryptoKeyRSAComponents::~CryptoKeyRSAComponents):
1802         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents): Deleted.
1803         (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents): Deleted.
1804         * crypto/keys/CryptoKeyRSAComponents.h: Copied from crypto/keys/CryptoKeyDataRSAComponents.h.
1805         (WebCore::CryptoKeyRSAComponents::createPublic):
1806         (WebCore::CryptoKeyRSAComponents::createPrivate):
1807         (WebCore::CryptoKeyRSAComponents::createPrivateWithAdditionalData):
1808         * crypto/keys/CryptoKeyRaw.cpp:
1809         (WebCore::CryptoKeyRaw::exportData const): Deleted.
1810         * crypto/keys/CryptoKeyRaw.h:
1811         * crypto/mac/CryptoKeyRSAMac.cpp:
1812         (WebCore::getPrivateKeyComponents):
1813         (WebCore::CryptoKeyRSA::create):
1814         (WebCore::CryptoKeyRSA::exportData const):
1815
1816 2017-08-18  Youenn Fablet  <youenn@apple.com>
1817
1818         [Cache API] Add support for being loaded responses
1819         https://bugs.webkit.org/show_bug.cgi?id=175732
1820
1821         Reviewed by Chris Dumez.
1822
1823         Covered by existing and rebased tests.
1824
1825         Introducing a callback-based method to consume the body when the load is finished.
1826         Using that new method in Cache::put and calling batchPutOperation when the load is finished.
1827
1828         Fixing the case of a fetch response being cloned, in which case its body should be marked as ReadableStream.
1829
1830         * Modules/cache/Cache.cpp:
1831         (WebCore::Cache::put): Changing order of checks to reduce test flakiness risks as there is not yet support for putting responses with ReadableStream.
1832         (WebCore::toConnectionRecord):
1833         (WebCore::Cache::batchPutOperation):
1834         * Modules/cache/Cache.h:
1835         * Modules/fetch/FetchBody.cpp:
1836         (WebCore::FetchBody::readableStreamBody): Deleted.
1837         * Modules/fetch/FetchBody.h:
1838         (WebCore::FetchBody::loadingBody):
1839         (WebCore::FetchBody::setAsReadableStream):
1840         * Modules/fetch/FetchResponse.cpp:
1841         (WebCore::FetchResponse::BodyLoader::didSucceed):
1842         (WebCore::FetchResponse::BodyLoader::didFail):
1843         (WebCore::FetchResponse::consumeBody):
1844         (WebCore::FetchResponse::consumeBodyWhenLoaded):
1845         * Modules/fetch/FetchResponse.h:
1846
1847 2017-08-18  Chris Dumez  <cdumez@apple.com>
1848
1849         [Beacon] Improve error reporting
1850         https://bugs.webkit.org/show_bug.cgi?id=175723
1851
1852         Reviewed by Darin Adler.
1853
1854         Have Ping loads such as beacons report errors via their completion handler.
1855         The Beacon API is using this error to log a console message when beacon loads
1856         fail, provided that the page is still alive.
1857
1858         Test: http/wpt/beacon/beacon-async-error-logging.html
1859
1860         * Modules/beacon/NavigatorBeacon.cpp:
1861         (WebCore::NavigatorBeacon::NavigatorBeacon):
1862         (WebCore::NavigatorBeacon::~NavigatorBeacon):
1863         (WebCore::NavigatorBeacon::from):
1864         (WebCore::NavigatorBeacon::supplementName):
1865         (WebCore::NavigatorBeacon::notifyFinished):
1866         (WebCore::NavigatorBeacon::logError):
1867         (WebCore::NavigatorBeacon::sendBeacon):
1868         * Modules/beacon/NavigatorBeacon.h:
1869         * loader/LoaderStrategy.h:
1870         * loader/cache/CachedResource.cpp:
1871         (WebCore::CachedResource::load):
1872         * loader/cache/CachedResourceLoader.cpp:
1873         (WebCore::CachedResourceLoader::requestBeaconResource):
1874         * loader/cache/CachedResourceLoader.h:
1875         * platform/network/PingHandle.h:
1876
1877 2017-08-18  Sam Weinig  <sam@webkit.org>
1878
1879         Remove the deprecated WebKitSubtleCrypto interface
1880         https://bugs.webkit.org/show_bug.cgi?id=164938
1881         <rdar://problem/29894563>
1882
1883         Reviewed by Chris Dumez.
1884
1885         Remove WebKitSubtleCrypto and all of its helper classes / functionality.
1886
1887         * CMakeLists.txt:
1888         * DerivedSources.cpp:
1889         * DerivedSources.make:
1890         * WebCore.xcodeproj/project.pbxproj:
1891         * bindings/js/JSCryptoAlgorithmDictionary.cpp: Removed.
1892         * bindings/js/JSCryptoAlgorithmDictionary.h: Removed.
1893         * bindings/js/JSCryptoKeySerializationJWK.cpp: Removed.
1894         * bindings/js/JSCryptoKeySerializationJWK.h: Removed.
1895         * bindings/js/JSCryptoOperationData.cpp: Removed.
1896         * bindings/js/JSCryptoOperationData.h: Removed.
1897         * bindings/js/JSWebKitSubtleCryptoCustom.cpp: Removed.
1898         * crypto/CryptoAlgorithm.cpp:
1899         (WebCore::CryptoAlgorithm::deriveKey): Deleted.
1900         (WebCore::CryptoAlgorithm::encryptForWrapKey): Deleted.
1901         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Deleted.
1902         * crypto/CryptoAlgorithm.h:
1903         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed.
1904         * crypto/CryptoKeySerialization.h: Removed.
1905         * crypto/WebKitSubtleCrypto.cpp: Removed.
1906         * crypto/WebKitSubtleCrypto.h: Removed.
1907         * crypto/WebKitSubtleCrypto.idl: Removed.
1908         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1909         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches const): Deleted.
1910         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1911         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1912         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Deleted.
1913         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Deleted.
1914         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1915         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1916         (WebCore::CryptoAlgorithmHMAC::keyAlgorithmMatches const): Deleted.
1917         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1918         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1919         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1920         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1921         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::keyAlgorithmMatches const): Deleted.
1922         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1923         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1924         (WebCore::CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches const): Deleted.
1925         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1926         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1927         * crypto/algorithms/CryptoAlgorithmSHA1.h:
1928         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1929         * crypto/algorithms/CryptoAlgorithmSHA224.h:
1930         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1931         * crypto/algorithms/CryptoAlgorithmSHA256.h:
1932         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1933         * crypto/algorithms/CryptoAlgorithmSHA384.h:
1934         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1935         * crypto/algorithms/CryptoAlgorithmSHA512.h:
1936         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
1937         * crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:
1938         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
1939         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
1940         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
1941         * crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp:
1942         * crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp:
1943         * crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp:
1944         * crypto/keys/CryptoKeySerializationRaw.cpp: Removed.
1945         * crypto/keys/CryptoKeySerializationRaw.h: Removed.
1946         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1947         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
1948         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Deleted.
1949         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Deleted.
1950         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1951         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1952         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1953         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1954         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Removed.
1955         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Removed.
1956         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Removed.
1957         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Removed.
1958         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Removed.
1959         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Removed.
1960         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Removed.
1961         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Removed.
1962         * features.json:
1963         * page/Crypto.cpp:
1964         * page/Crypto.h:
1965         * page/Crypto.idl:
1966
1967 2017-08-18  Tim Horton  <timothy_horton@apple.com>
1968
1969         Remove classic mode screen scale clamping
1970         https://bugs.webkit.org/show_bug.cgi?id=175739
1971         <rdar://problem/33894531>
1972
1973         Reviewed by Andy Estes.
1974
1975         * platform/ios/PlatformScreenIOS.mm:
1976         (WebCore::screenScaleFactor):
1977         This code is no longer needed.
1978
1979 2017-08-18  Daewoong Jang  <daewoong.jang@navercorp.com>
1980
1981         [Curl] Improve multi-threaded networking
1982         https://bugs.webkit.org/show_bug.cgi?id=175713
1983
1984         Reviewed by Alex Christensen.
1985
1986         * platform/Curl.cmake:
1987         * platform/network/ResourceHandleInternal.h:
1988         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1989         (WebCore::ResourceHandleInternal::m_failureTimer): Deleted.
1990         * platform/network/curl/CurlCacheManager.cpp:
1991         (WebCore::CurlCacheManager::didReceiveResponse):
1992         * platform/network/curl/CurlDownload.cpp:
1993         (WebCore::CurlDownload::init):
1994         (WebCore::CurlDownload::start):
1995         (WebCore::CurlDownload::cancel):
1996         (WebCore::CurlDownload::retain):
1997         (WebCore::CurlDownload::release):
1998         (WebCore::CurlDownload::setupRequest):
1999         (WebCore::CurlDownload::notifyFinish):
2000         (WebCore::CurlDownload::notifyFail):
2001         * platform/network/curl/CurlDownload.h:
2002         * platform/network/curl/CurlJobManager.cpp:
2003         (WebCore::CurlJobList::isEmpty const):
2004         (WebCore::CurlJobList::startJobs):
2005         (WebCore::CurlJobList::finishJobs):
2006         (WebCore::CurlJobList::notifyResult):
2007         (WebCore::CurlJobManager::add):
2008         (WebCore::CurlJobManager::cancel):
2009         (WebCore::CurlJobManager::callOnJobThread):
2010         (WebCore::CurlJobManager::startThreadIfNeeded):
2011         (WebCore::CurlJobManager::updateJobList):
2012         (WebCore::CurlJobManager::workerThread):
2013         (WebCore::CurlJobList::append): Deleted.
2014         (WebCore::CurlJobList::cancel): Deleted.
2015         (WebCore::CurlJobList::complete): Deleted.
2016         (WebCore::CurlJobList::withJob): Deleted.
2017         (WebCore::CurlJobList::withCurlHandle): Deleted.
2018         (WebCore::CurlJob::invoke): Deleted.
2019         (WebCore::CurlJobManager::updateJobs): Deleted.
2020         * platform/network/curl/CurlJobManager.h:
2021         (WebCore::CurlJob::CurlJob): Deleted.
2022         (WebCore::CurlJob::~CurlJob): Deleted.
2023         (WebCore::CurlJob::operator=): Deleted.
2024         (WebCore::CurlJob::curlHandle const): Deleted.
2025         (WebCore::CurlJob::ticket const): Deleted.
2026         (WebCore::CurlJob::finished): Deleted.
2027         (WebCore::CurlJob::error): Deleted.
2028         (WebCore::CurlJob::cancel): Deleted.
2029         (WebCore::CurlJobManager::isActiveJob const): Deleted.
2030         * platform/network/curl/MultipartHandle.cpp:
2031         (WebCore::MultipartHandle::didReceiveData):
2032         * platform/network/curl/ResourceHandleCurl.cpp:
2033         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
2034         (WebCore::ResourceHandle::start):
2035         (WebCore::ResourceHandle::cancel):
2036         (WebCore::ResourceHandle::platformSetDefersLoading):
2037         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2038         (WebCore::ResourceHandle::receivedCredential):
2039         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
2040         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2041         (WebCore::ResourceHandleInternal::initialize): Deleted.
2042         (WebCore::ResourceHandleInternal::applyAuthentication): Deleted.
2043         (WebCore::getFormElementsCount): Deleted.
2044         (WebCore::ResourceHandleInternal::setupPUT): Deleted.
2045         (WebCore::ResourceHandleInternal::setupPOST): Deleted.
2046         (WebCore::ResourceHandleInternal::setupFormData): Deleted.
2047         (WebCore::ResourceHandleInternal::didFinish): Deleted.
2048         (WebCore::ResourceHandleInternal::didFail): Deleted.
2049         (WebCore::ResourceHandleInternal::calculateWebTimingInformations): Deleted.
2050         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse): Deleted.
2051         (WebCore::isHttpInfo): Deleted.
2052         (WebCore::isHttpRedirect): Deleted.
2053         (WebCore::isHttpAuthentication): Deleted.
2054         (WebCore::isHttpNotModified): Deleted.
2055         (WebCore::isAppendableHeader): Deleted.
2056         (WebCore::removeLeadingAndTrailingQuotes): Deleted.
2057         (WebCore::getProtectionSpace): Deleted.
2058         (WebCore::ResourceHandleInternal::willPrepareSendData): Deleted.
2059         (WebCore::ResourceHandleInternal::didReceiveHeaderLine): Deleted.
2060         (WebCore::ResourceHandleInternal::didReceiveAllHeaders): Deleted.
2061         (WebCore::ResourceHandleInternal::didReceiveContentData): Deleted.
2062         (WebCore::ResourceHandleInternal::readCallback): Deleted.
2063         (WebCore::ResourceHandleInternal::headerCallback): Deleted.
2064         (WebCore::ResourceHandleInternal::writeCallback): Deleted.
2065         (WebCore::ResourceHandleInternal::dispatchSynchronousJob): Deleted.
2066         (WebCore::ResourceHandleInternal::handleDataURL): Deleted.
2067         * platform/network/curl/ResourceHandleCurlDelegate.cpp: Added.
2068         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
2069         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
2070         (WebCore::ResourceHandleCurlDelegate::hasHandle const):
2071         (WebCore::ResourceHandleCurlDelegate::releaseHandle):
2072         (WebCore::ResourceHandleCurlDelegate::start):
2073         (WebCore::ResourceHandleCurlDelegate::cancel):
2074         (WebCore::ResourceHandleCurlDelegate::setDefersLoading):
2075         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
2076         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
2077         (WebCore::ResourceHandleCurlDelegate::retain):
2078         (WebCore::ResourceHandleCurlDelegate::release):
2079         (WebCore::ResourceHandleCurlDelegate::setupRequest):
2080         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
2081         (WebCore::ResourceHandleCurlDelegate::notifyFail):
2082         (WebCore::ResourceHandleCurlDelegate::response):
2083         (WebCore::ResourceHandleCurlDelegate::setupAuthentication):
2084         (WebCore::removeLeadingAndTrailingQuotes):
2085         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
2086         (WebCore::isHttpInfo):
2087         (WebCore::isHttpRedirect):
2088         (WebCore::isHttpAuthentication):
2089         (WebCore::isHttpNotModified):
2090         (WebCore::isAppendableHeader):
2091         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine):
2092         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
2093         (WebCore::ResourceHandleCurlDelegate::didReceiveContentData):
2094         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
2095         (WebCore::ResourceHandleCurlDelegate::prepareSendData):
2096         (WebCore::ResourceHandleCurlDelegate::didFinish):
2097         (WebCore::ResourceHandleCurlDelegate::didFail):
2098         (WebCore::ResourceHandleCurlDelegate::handleDataURL):
2099         (WebCore::ResourceHandleCurlDelegate::setupPOST):
2100         (WebCore::ResourceHandleCurlDelegate::setupPUT):
2101         (WebCore::ResourceHandleCurlDelegate::getFormElementsCount):
2102         (WebCore::ResourceHandleCurlDelegate::setupFormData):
2103         (WebCore::ResourceHandleCurlDelegate::applyAuthentication):
2104         (WebCore::ResourceHandleCurlDelegate::setWebTimings):
2105         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
2106         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
2107         (WebCore::ResourceHandleCurlDelegate::willSendData):
2108         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderCallback):
2109         (WebCore::ResourceHandleCurlDelegate::didReceiveDataCallback):
2110         (WebCore::ResourceHandleCurlDelegate::willSendDataCallback):
2111         * platform/network/curl/ResourceHandleCurlDelegate.h: Added.
2112
2113 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
2114
2115         iOS 10 debug build fix.
2116
2117         * dom/DataTransfer.cpp:
2118         (WebCore::DataTransfer::DataTransfer):
2119
2120 2017-08-18  Ryosuke Niwa  <rniwa@webkit.org>
2121
2122         Rename DataTransferAccessPolicy to match spec and refactor related node
2123         https://bugs.webkit.org/show_bug.cgi?id=175704
2124
2125         Reviewed by Wenson Hsieh.
2126
2127         Renamed DataTransferAccessPolicy to DataTransfer::StoreMode to match the drag data store mode concept
2128         in the HTML5 specification:
2129         https://html.spec.whatwg.org/multipage/dnd.html#drag-data-store-mode
2130
2131         DataTransfer in addition to those states can be disassociated from the drag data store when it becomes
2132         no longer valid. We also support a special mode which allows only updating the drag image.
2133         These two states, Invalid and DragImageWritable, are added in addition to the three states in the spec.
2134
2135         Also split DragAndDrop type of DataTransfer into DragAndDropData and DragAndDropFiles, and refactored
2136         the related code.
2137
2138         No new tests since there should be no behavioral change.
2139
2140         * WebCore.xcodeproj/project.pbxproj:
2141         * dom/DataTransfer.cpp:
2142         (WebCore::DataTransfer::DataTransfer): No longer takes forFileDrag boolean since it's folded into type.
2143         (WebCore::DataTransfer::createForCopyAndPaste):
2144         (WebCore::DataTransfer::~DataTransfer):
2145         (WebCore::DataTransfer::setAccessPolicy): Deleted.
2146         (WebCore::DataTransfer::canReadTypes const):
2147         (WebCore::DataTransfer::canReadData const):
2148         (WebCore::DataTransfer::canWriteData const):
2149         (WebCore::DataTransfer::createForInputEvent):
2150         (WebCore::DataTransfer::createForDrag):
2151         (WebCore::DataTransfer::createForDrop):
2152         (WebCore::DataTransfer::canSetDragImage const):
2153         * dom/DataTransfer.h:
2154         (WebCore::DataTransfer::makeInvalidForSecurity): Added.
2155         (WebCore::DataTransfer::makeDragImageWritable): Added.
2156         * dom/DataTransferAccessPolicy.h: Removed.
2157         * editing/Editor.cpp:
2158         (WebCore::dispatchClipboardEvent): Moved and renamed from dispatchCPPEvent. Now computes the store mode
2159         inside the function to match the spec: https://w3c.github.io/clipboard-apis/#fire-a-clipboard-event
2160         (WebCore::Editor::canDHTMLCut):
2161         (WebCore::Editor::canDHTMLCopy):
2162         (WebCore::Editor::canDHTMLPaste):
2163         (WebCore::Editor::tryDHTMLCopy):
2164         (WebCore::Editor::tryDHTMLCut):
2165         (WebCore::Editor::tryDHTMLPaste):
2166         (WebCore::Editor::dispatchCPPEvent): Deleted.
2167         * editing/Editor.h:
2168         * page/DragController.cpp:
2169         (WebCore::createDataTransferToUpdateDrag): Extracted to share code.
2170         (WebCore::DragController::dragExited):
2171         (WebCore::DragController::performDragOperation):
2172         (WebCore::DragController::tryDHTMLDrag):
2173         * page/EventHandler.cpp:
2174         (WebCore::EventHandler::invalidateDataTransfer):
2175         (WebCore::EventHandler::handleDrag):
2176
2177 2017-08-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
2178
2179         Followup (r220289): RenderImageResourceStyleImage code clean up
2180         https://bugs.webkit.org/show_bug.cgi?id=175444
2181
2182         Reviewed by Darin Adler.
2183
2184         RenderImageResourceStyleImage may be created with a StyleImage of type
2185         StyleGeneratedImage. It may also be associated with a CachedImage which 
2186         is loaded through a source URL. In this case, adding and removing m_renderer
2187         as a client of the CachedImage will be done through 
2188         RenderImageResource::setCachedImage().
2189
2190         RenderImageResource::setCachedImage() is already called from 
2191         ImageLoader::updateRenderer() when the CachedImage finishes loading. This
2192         call adds m_renderer to the clients of the CachedImage. 
2193         RenderImageResource::setCachedImage() will also be called from 
2194         RenderImageResourceStyleImage::shutdown() via RenderImageResource::shutdown()
2195         to remove m_renderer from the clients of CachedImage by passing a null pointer.
2196
2197         * rendering/RenderImage.cpp:
2198         (WebCore::RenderImage::styleWillChange):
2199         * rendering/RenderImageResource.cpp:
2200         (WebCore::RenderImageResource::initialize):
2201         (WebCore::RenderImageResource::shutdown):
2202         (WebCore::RenderImageResource::setCachedImage):
2203         (WebCore::RenderImageResource::resetAnimation):
2204         (WebCore::RenderImageResource::image const):
2205         (WebCore::RenderImageResource::setContainerSizeForRenderer):
2206         (WebCore::RenderImageResource::imageSize const):
2207         (WebCore::RenderImageResource::~RenderImageResource): Deleted.
2208         (WebCore::RenderImageResource::errorOccurred const): Deleted.
2209         (WebCore::RenderImageResource::imageHasRelativeWidth const): Deleted.
2210         (WebCore::RenderImageResource::imageHasRelativeHeight const): Deleted.
2211         (WebCore::RenderImageResource::intrinsicSize const): Deleted.
2212         (WebCore::RenderImageResource::getImageSize const): Deleted.
2213         * rendering/RenderImageResource.h:
2214         (WebCore::RenderImageResource::initialize):
2215         (WebCore::RenderImageResource::renderer const):
2216         (WebCore::RenderImageResource::errorOccurred const):
2217         (WebCore::RenderImageResource::imageHasRelativeWidth const):
2218         (WebCore::RenderImageResource::imageHasRelativeHeight const):
2219         (WebCore::RenderImageResource::imageSize const):
2220         (WebCore::RenderImageResource::intrinsicSize const):
2221         (WebCore::RenderImageResource::imagePtr const):
2222         * rendering/RenderImageResourceStyleImage.cpp:
2223         (WebCore::RenderImageResourceStyleImage::initialize):
2224         (WebCore::RenderImageResourceStyleImage::shutdown):
2225         (WebCore::RenderImageResourceStyleImage::image const):
2226         (WebCore::RenderImageResourceStyleImage::setContainerSizeForRenderer):
2227         (WebCore::RenderImageResourceStyleImage::~RenderImageResourceStyleImage): Deleted.
2228         * rendering/RenderImageResourceStyleImage.h:
2229         * rendering/RenderSnapshottedPlugIn.cpp:
2230         (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn):
2231         * rendering/svg/RenderSVGImage.cpp:
2232         (WebCore::RenderSVGImage::RenderSVGImage):
2233
2234 2017-08-18  Jiewen Tan  <jiewen_tan@apple.com>
2235
2236         [WebCrypto][Mac] Replace CCECCryptorGetKeyComponents with CCECCryptorExportKey for exporting ECC JWKs
2237         https://bugs.webkit.org/show_bug.cgi?id=175657
2238         <rdar://problem/33797150>
2239
2240         Reviewed by Brent Fulgham.
2241
2242         CCECCryptorGetKeyComponents returns components in unpadded formats. In some minor cases, the ECC components
2243         do need padding. Therefore, we occasionally see some corrupted outputs in JWKs. To overcome that, this patch
2244         replaces CCECCryptorGetKeyComponents with CCECCryptorExportKey which does padding all the time.
2245
2246         In the meantime, this patch also makes export* methods return OperationError if any error occur in the
2247         underlying operations though very unlikely.
2248
2249         Test: crypto/subtle/ecdsa-generate-export-import-jwk-sign-verify.html
2250
2251         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2252         (WebCore::CryptoAlgorithmECDH::exportKey):
2253         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
2254         (WebCore::CryptoAlgorithmECDSA::exportKey):
2255         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2256         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2257         * crypto/keys/CryptoKeyEC.cpp:
2258         (WebCore::CryptoKeyEC::exportRaw const):
2259         (WebCore::CryptoKeyEC::exportJwk const):
2260         (WebCore::CryptoKeyEC::exportSpki const):
2261         (WebCore::CryptoKeyEC::exportPkcs8 const):
2262         * crypto/keys/CryptoKeyEC.h:
2263         * crypto/mac/CryptoKeyECMac.cpp:
2264         (WebCore::CryptoKeyEC::platformExportRaw const):
2265         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2266         (WebCore::CryptoKeyEC::platformExportSpki const):
2267         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2268
2269 2017-08-18  Per Arne Vollan  <pvollan@apple.com>
2270
2271         [Win] accessibility/heading-crash-after-hidden.html is a flaky crash.
2272         https://bugs.webkit.org/show_bug.cgi?id=173536
2273
2274         Reviewed by Brent Fulgham.
2275
2276         If the tree state is dirty, accessible objects are deleted while iterating over children
2277         under AccessibilityNodeObject::textUnderElement when the style is updated. Make sure the
2278         style is updated before this method is called.
2279
2280         No new tests, covered by existing tests.
2281
2282         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
2283         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
2284
2285 2017-08-18  Youenn Fablet  <youenn@apple.com>
2286
2287         [Cache API] Add response body storage
2288         https://bugs.webkit.org/show_bug.cgi?id=175658
2289
2290         Reviewed by Alex Christensen.
2291
2292         Covered by rebased tests.
2293         Tests are still flaky until waiting for end of fetch load is implemented.
2294
2295         Adding a response body within CacheStorageConnection::Record.
2296         Adding ability to pass this body from/to the main thread.
2297
2298         Adding response body consumption into a CacheStorageConnection::Record.
2299         Adding response body setting from a CacheStorageConnection::Record.
2300
2301         * Modules/beacon/NavigatorBeacon.cpp:
2302         (WebCore::NavigatorBeacon::sendBeacon):
2303         * Modules/cache/Cache.cpp:
2304         (WebCore::Cache::put):
2305         (WebCore::toConnectionRecord):
2306         (WebCore::Cache::updateRecords):
2307         * Modules/cache/CacheStorageConnection.cpp:
2308         (WebCore::CacheStorageConnection::copyResponseBody):
2309         (WebCore::CacheStorageConnection::isolatedResponseBody):
2310         (WebCore::CacheStorageConnection::Record::copy const):
2311         * Modules/cache/CacheStorageConnection.h:
2312         * Modules/cache/WorkerCacheStorageConnection.cpp:
2313         (WebCore::toCrossThreadRecordData):
2314         (WebCore::fromCrossThreadRecordData):
2315         * Modules/fetch/FetchBody.cpp:
2316         (WebCore::FetchBody::bodyAsFormData const):
2317         (WebCore::FetchBody::take):
2318         (WebCore::FetchBody::bodyForInternalRequest const): Deleted.
2319         * Modules/fetch/FetchBody.h:
2320         (WebCore::FetchBody::setAsFormData):
2321         * Modules/fetch/FetchBodyConsumer.h:
2322         (WebCore::FetchBodyConsumer::setData):
2323         * Modules/fetch/FetchRequest.cpp:
2324         (WebCore::FetchRequest::resourceRequest const):
2325         * Modules/fetch/FetchResponse.cpp:
2326         (WebCore::FetchResponse::consumeBody):
2327         (WebCore::FetchResponse::setBodyData):
2328         * Modules/fetch/FetchResponse.h:
2329
2330 2017-08-18  Youenn Fablet  <youenn@apple.com>
2331
2332         [Fetch API] Add support for a callback-based fetch
2333         https://bugs.webkit.org/show_bug.cgi?id=175710
2334
2335         Reviewed by Alex Christensen.
2336
2337         No change of behavior.
2338
2339         Moving from a DOMPromise to a Callback taking an ExceptionOr<FetchResponse&>.
2340         Updating window and worker call sites.
2341
2342         * Modules/fetch/DOMWindowFetch.cpp:
2343         (WebCore::DOMWindowFetch::fetch):
2344         * Modules/fetch/FetchResponse.cpp:
2345         (WebCore::FetchResponse::fetch):
2346         (WebCore::FetchResponse::BodyLoader::didFail):
2347         (WebCore::FetchResponse::BodyLoader::BodyLoader):
2348         (WebCore::FetchResponse::BodyLoader::didReceiveResponse):
2349         (WebCore::FetchResponse::BodyLoader::stop):
2350         * Modules/fetch/FetchResponse.h:
2351         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
2352         (WebCore::WorkerGlobalScopeFetch::fetch):
2353
2354 2017-08-18  Brady Eidson  <beidson@apple.com>
2355
2356         Bounce ServiceWorker jobs to the Storage Process.
2357         https://bugs.webkit.org/show_bug.cgi?id=175650
2358
2359         Reviewed by Andy Estes.
2360
2361         No new tests (Covered by both changes and consistencies in existing tests)
2362
2363         This lays the groundwork for the SW job queue being in the StorageProcess by actually
2364         setting up some objects for IPC communication and actually sending things over the wire.
2365
2366         The main point of IPC is the WebCore abstract base class "SWServer::Connection"
2367
2368         A collection of them will soon be managed by the SWServer itself in the StorageProcess.
2369
2370         That object will be the stand-in for IPC on both the WebProcess and StorageProcess side.
2371
2372         Currently, any job that we try to schedule still immediately rejects (though now it does
2373         so asynchronously instead of synchronously).
2374
2375         * CMakeLists.txt:
2376         * WebCore.xcodeproj/project.pbxproj:
2377
2378         * dom/ExceptionData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2379         (WebCore::ExceptionData::toException const):
2380         (WebCore::ExceptionData::encode const):
2381         (WebCore::ExceptionData::decode):
2382
2383         * workers/service/ServiceWorkerContainer.cpp:
2384         (WebCore::ServiceWorkerContainer::addRegistration):
2385         (WebCore::ServiceWorkerContainer::scheduleJob):
2386         * workers/service/ServiceWorkerContainer.h:
2387
2388         * workers/service/ServiceWorkerJob.cpp:
2389         (WebCore::ServiceWorkerJob::failedWithException):
2390         (WebCore::ServiceWorkerJob::data const):
2391         * workers/service/ServiceWorkerJob.h:
2392
2393         * workers/service/ServiceWorkerJobData.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2394         (WebCore::ServiceWorkerJobData::encode const):
2395         (WebCore::ServiceWorkerJobData::decode):
2396
2397         * workers/service/ServiceWorkerJobType.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2398
2399         * workers/service/ServiceWorkerProvider.h:
2400
2401         * workers/service/ServiceWorkerRegistrationParameters.h:
2402
2403         * workers/service/server/SWServer.cpp: Copied from Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp.
2404         (WebCore::SWServer::Connection::scheduleJob):
2405         (WebCore::SWServer::Connection::jobRejected):
2406         * workers/service/server/SWServer.h: Copied from Source/WebCore/workers/service/ServiceWorkerProvider.h.
2407         (WebCore::SWServer::Connection::~Connection):
2408
2409 2017-08-18  Chris Dumez  <cdumez@apple.com>
2410
2411         [Beacon] Add support for quota limitation
2412         https://bugs.webkit.org/show_bug.cgi?id=175443
2413         <rdar://problem/33729002>
2414
2415         Reviewed by Youenn Fablet.
2416
2417         LoaderStrategy::startPingLoad() now takes a completion handler parameter, allowing CachedResource::load()
2418         to know when a Beacon load is complete. This was needed in order for the fetch in-flight keepalive request
2419         quota limit to work properly for beacon loads as well. We need to know when the beacon load completes in
2420         order to know if the beacon is in-flight or not and only free up its allocated quota once it is no longer
2421         in-flight.
2422
2423         No new tests, updated existing test.
2424
2425         * loader/LoaderStrategy.h:
2426         * loader/PingLoader.cpp:
2427         (WebCore::PingLoader::startPingLoad):
2428         * loader/cache/CachedResource.cpp:
2429         (WebCore::CachedResource::load):
2430         * platform/network/PingHandle.h:
2431
2432 2017-08-18  Youenn Fablet  <youenn@apple.com>
2433
2434         [Cache API] Add a WK2 implementation of CacheStorageConnection
2435         https://bugs.webkit.org/show_bug.cgi?id=175640
2436
2437         Reviewed by Alex Christensen & Chris Dumez.
2438
2439         * Modules/cache/CacheStorageConnection.cpp: Adding Internal error.
2440         * Modules/cache/CacheStorageConnection.h: Ditto.
2441         * WebCore.xcodeproj/project.pbxproj: Exporting CacheQueryOptions.h header.
2442
2443 2017-08-18  Antti Koivisto  <antti@apple.com>
2444
2445         Factor render tree mutation code from RenderListItem to RenderTreeUpdater
2446         https://bugs.webkit.org/show_bug.cgi?id=175718
2447
2448         Reviewed by Andreas Kling.
2449
2450         We already stopped doing layout time mutations. We can now move the code out too.
2451
2452         * WebCore.xcodeproj/project.pbxproj:
2453         * rendering/RenderListItem.cpp:
2454         (WebCore::isHTMLListElement):
2455         (WebCore::getParentOfFirstLineBox): Deleted.
2456         (WebCore::firstNonMarkerChild): Deleted.
2457         (WebCore::RenderListItem::updateMarkerRenderer): Deleted.
2458
2459             Moved to RenderTreeUpdater::ListItem.
2460
2461         * rendering/RenderListItem.h:
2462         * rendering/RenderListMarker.cpp:
2463         (WebCore::RenderListMarker::willBeDestroyed):
2464         * rendering/TextAutoSizing.cpp:
2465         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2466         * style/RenderTreeUpdater.cpp:
2467         (WebCore::RenderTreeUpdater::pushParent):
2468         (WebCore::RenderTreeUpdater::popParent):
2469         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
2470         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2471
2472             Factor pre/post update into functions.
2473
2474         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
2475         * style/RenderTreeUpdater.h:
2476         * style/RenderTreeUpdaterListItem.cpp: Added.
2477
2478             Mutation functions move here.
2479
2480         (WebCore::getParentOfFirstLineBox):
2481         (WebCore::firstNonMarkerChild):
2482         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2483         * style/RenderTreeUpdaterListItem.h: Added.
2484
2485 2017-08-18  Ms2ger  <Ms2ger@gmail.com>
2486
2487         [GTK] Show controls if a video element isn't allowed to play inline.
2488         https://bugs.webkit.org/show_bug.cgi?id=141705
2489
2490         Reviewed by Xabier Rodriguez-Calvar.
2491
2492         Test: covered by media/video-fullscreeen-only-controls.html [sic].
2493
2494         * Modules/mediacontrols/mediaControlsGtk.js:
2495         (ControllerGtk.prototype.shouldHaveControls):
2496
2497 2017-08-18  Zan Dobersek  <zdobersek@igalia.com>
2498
2499         [EME] MediaKeySession has to initiate playback resume on HTMLMediaElement
2500         https://bugs.webkit.org/show_bug.cgi?id=175671
2501
2502         Reviewed by Xabier Rodriguez-Calvar.
2503
2504         In MediaKeySession::updateKeyStatuses(), HTMLMediaElement objects that are
2505         associated with the MediaKeys instance that created this session have to
2506         be notified in order to run the 'Attempt to Resume Playback If Necessary'
2507         algorithm.
2508
2509         MediaKeys object now tracks the sessions that were created through it.
2510         MediaKeySession object is passed a MediaKeys reference, and has that
2511         reference invalidated if/when the MediaKeys object is destroyed.
2512
2513         In MediaKeySession::updateKeyStatuses(), a task is now queued, notifying
2514         the MediaKeys object, if any, that the associated HTMLMediaElement
2515         instances have to run the mentioned algorithm. The associated media
2516         elements are stored through CDMClient pointers, with HTMLMediaElement
2517         class inheriting from the newly-introduced CDMClient interface.
2518
2519         HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary() is left
2520         unimplemented for now. The object will attach itself to and detach from
2521         the associated MediaKeys object in setMediaKeys() and the destructor,
2522         enabling the MediaKeys object to properly dispatch the playback resume
2523         requests for the attached clients.
2524
2525         * Modules/encryptedmedia/CDMClient.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
2526         (WebCore::CDMClient::~CDMClient):
2527         * Modules/encryptedmedia/MediaKeySession.cpp:
2528         (WebCore::MediaKeySession::create):
2529         (WebCore::MediaKeySession::MediaKeySession):
2530         (WebCore::MediaKeySession::detachKeys):
2531         (WebCore::MediaKeySession::updateKeyStatuses):
2532         * Modules/encryptedmedia/MediaKeySession.h:
2533         * Modules/encryptedmedia/MediaKeys.cpp:
2534         (WebCore::MediaKeys::~MediaKeys):
2535         (WebCore::MediaKeys::createSession):
2536         (WebCore::MediaKeys::attachCDMClient):
2537         (WebCore::MediaKeys::detachCDMClient):
2538         (WebCore::MediaKeys::attemptToResumePlaybackOnClients):
2539         * Modules/encryptedmedia/MediaKeys.h:
2540         * html/HTMLMediaElement.cpp:
2541         (WebCore::HTMLMediaElement::cdmClientAttemptToResumePlaybackIfNecessary):
2542         * html/HTMLMediaElement.h:
2543
2544 2017-08-18  Commit Queue  <commit-queue@webkit.org>
2545
2546         Unreviewed, rolling out r220854.
2547         https://bugs.webkit.org/show_bug.cgi?id=175716
2548
2549         I'm not sure we really need this (Requested by KaL on
2550         #webkit).
2551
2552         Reverted changeset:
2553
2554         "[GTK][WPE] Add NTLM authentication enabled API"
2555         https://bugs.webkit.org/show_bug.cgi?id=122952
2556         http://trac.webkit.org/changeset/220854
2557
2558 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2559
2560         [Input Events] Rename inputType "formatForeColor" to "formatFontColor"
2561         https://bugs.webkit.org/show_bug.cgi?id=175703
2562
2563         Reviewed by Ryosuke Niwa.
2564
2565         Renames an inputType value to match the spec. There is no other change in behavior.
2566         Rebaselines fast/events/input-events-selection-forecolor-data.html and fast/events/input-events-forecolor-data.html.
2567
2568         * editing/EditCommand.cpp:
2569         (WebCore::inputTypeNameForEditingAction):
2570
2571 2017-08-17  Daewoong Jang  <daewoong.jang@navercorp.com>
2572
2573         [Curl] Improve multi-threaded networking
2574         https://bugs.webkit.org/show_bug.cgi?id=175253
2575
2576         Reviewed by Alex Christensen.
2577
2578         * platform/network/curl/CurlContext.cpp:
2579         (WebCore::CurlMultiHandle::CurlMultiHandle):
2580         (WebCore::CurlHandle::CurlHandle):
2581         (WebCore::CurlHandle::initialize):
2582         (WebCore::CurlHandle::setSslKeyPassword):
2583         (WebCore::CurlHandle::setSslErrors):
2584         (WebCore::CurlHandle::getSslErrors):
2585         * platform/network/curl/CurlContext.h:
2586         * platform/network/curl/CurlDownload.cpp:
2587         (WebCore::CurlDownload::init):
2588         (WebCore::CurlDownload::getResponse const):
2589         (WebCore::CurlDownload::setupRequest):
2590         (WebCore::CurlDownload::didReceiveHeader):
2591         (WebCore::CurlDownload::didReceiveData):
2592         (WebCore::CurlDownload::headerCallback):
2593         (WebCore::CurlDownload::getTempPath const): Deleted.
2594         (WebCore::CurlDownload::getUrl const): Deleted.
2595         (WebCore::CurlDownload::downloadFinishedCallback): Deleted.
2596         (WebCore::CurlDownload::downloadFailedCallback): Deleted.
2597         (WebCore::CurlDownload::receivedDataCallback): Deleted.
2598         (WebCore::CurlDownload::receivedResponseCallback): Deleted.
2599         * platform/network/curl/CurlDownload.h:
2600         * platform/network/curl/ResourceError.h:
2601         (WebCore::ResourceError::ResourceError):
2602         (WebCore::ResourceError::sslErrors const):
2603         (WebCore::ResourceError::setSSLErrors): Deleted.
2604         * platform/network/curl/ResourceHandleCurl.cpp:
2605         (WebCore::ResourceHandleInternal::initialize):
2606         (WebCore::ResourceHandleInternal::didFail):
2607         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
2608         * platform/network/curl/SSLHandle.cpp:
2609         (WebCore::allowedClientHosts):
2610         (WebCore::addAllowedClientCertificate):
2611         (WebCore::getSSLClientCertificate):
2612         (WebCore::certVerifyCallback):
2613         (WebCore::setSSLVerifyOptions):
2614         (WebCore::setSSLClientCertificate): Deleted.
2615         * platform/network/curl/SSLHandle.h:
2616
2617 2017-08-17  Chris Dumez  <cdumez@apple.com>
2618
2619         Regression(r220817): We should only copy the original request headers for Ping loads
2620         https://bugs.webkit.org/show_bug.cgi?id=175679
2621
2622         Reviewed by Youenn Fablet.
2623
2624         For performance reason, we should only copy the original request headers for Ping loads
2625         (Beacon at the moment), not for all CachedResourceRequests.
2626
2627         * loader/LoaderStrategy.h:
2628         * loader/cache/CachedResource.cpp:
2629         (WebCore::CachedResource::CachedResource):
2630         (WebCore::CachedResource::load):
2631         * loader/cache/CachedResource.h:
2632         (WebCore::CachedResource::shouldUsePingLoad):
2633         (WebCore::CachedResource::setOriginalRequestHeaders):
2634         * loader/cache/CachedResourceLoader.cpp:
2635         (WebCore::CachedResourceLoader::requestResource):
2636         * loader/cache/CachedResourceRequest.cpp:
2637         (WebCore::CachedResourceRequest::CachedResourceRequest):
2638         * loader/cache/CachedResourceRequest.h:
2639         (WebCore::CachedResourceRequest::releaseResourceRequest):
2640         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders): Deleted.
2641
2642 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
2643
2644         [PAL] Relocate SessionID to root
2645         https://bugs.webkit.org/show_bug.cgi?id=175684
2646
2647         Reviewed by Alex Christensen.
2648
2649         No new tests. No change in functionality.
2650
2651         * dom/Document.h:
2652         * html/HTMLMediaElement.cpp:
2653         * loader/cache/CachedResource.h:
2654         * loader/cache/CachedResourceLoader.cpp:
2655         * loader/cache/MemoryCache.h:
2656         * loader/cocoa/DiskCacheMonitorCocoa.h:
2657         * page/CacheStorageProvider.h:
2658         * page/Page.h:
2659         * page/PlugInClient.h:
2660         * page/SocketProvider.h:
2661         * platform/CookiesStrategy.h:
2662         * platform/WebCoreCrossThreadCopier.cpp:
2663         * platform/network/CacheValidation.h:
2664         * platform/network/NetworkStorageSession.cpp:
2665         * platform/network/NetworkStorageSession.h:
2666         * platform/network/cf/SocketStreamHandleImpl.h:
2667         * platform/network/curl/SocketStreamHandleImpl.h:
2668         * platform/network/soup/SocketStreamHandleImpl.h:
2669         * workers/WorkerGlobalScope.h:
2670         * workers/service/ServiceWorkerContainer.h:
2671         * workers/service/ServiceWorkerRegistrationParameters.h:
2672
2673 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2674
2675         Fix the build on other platforms after r220865
2676         https://bugs.webkit.org/show_bug.cgi?id=175683
2677
2678         Reviewed by Tim Horton.
2679
2680         Instead of special casing iOS 10 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED < 110000, revert to special
2681         casing iOS 11 behavior with __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000. This is because other targets that are
2682         neither iOS 10 nor 11 will fail the "before iOS 11" compile-time check, and subsequently assume that item
2683         providers exist. To fix this, flip the compiler-time checks and the order of codeblocks in the
2684         PlatformPasteboard::write methods.
2685
2686         There is no change in behavior.
2687
2688         * platform/ios/PlatformPasteboardIOS.mm:
2689         (WebCore::registerItemToPasteboard):
2690         (WebCore::PlatformPasteboard::write):
2691
2692 2017-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2693
2694         -Wreturn-type warnings in CryptoKey.cpp and SubtleCrypto.cpp
2695         https://bugs.webkit.org/show_bug.cgi?id=175675
2696
2697         Reviewed by Jiewen Tan.
2698
2699         * crypto/CryptoKey.cpp:
2700         (WebCore::CryptoKey::algorithm const):
2701         * crypto/SubtleCrypto.cpp:
2702         (WebCore::toCryptoKeyUsageBitmap):
2703         (WebCore::toKeyData):
2704
2705 2017-08-17  Andreas Kling  <akling@apple.com>
2706
2707         Disable CSS regions at compile time
2708         https://bugs.webkit.org/show_bug.cgi?id=175630
2709
2710         Reviewed by Antti Koivisto.
2711
2712         * Configurations/FeatureDefines.xcconfig:
2713
2714 2017-08-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2715
2716         [iOS] Respect type fidelities when copying image elements to the pasteboard
2717         https://bugs.webkit.org/show_bug.cgi?id=175638
2718         <rdar://problem/26556043>
2719
2720         Reviewed by Ryosuke Niwa.
2721
2722         Ensures that we respect type fidelities when copying on iOS, by unifying pasteboard writing codepaths across
2723         dragging and copying. When dragging and copying, we now generate and set UIItemProviders on the UIPasteboard.
2724
2725         Tests: ActionSheetTests.CopyImageElementWithHREF
2726                ActionSheetTests.CopyImageElementWithoutHREF
2727
2728         * platform/PlatformPasteboard.h:
2729
2730         Remove all variants of the writeObjectRepresentations helper method. Now that both paths for writing to the
2731         pasteboard are unified, it's no longer useful to separate out item-provider-based pasteboard logic.
2732
2733         * platform/ios/AbstractPasteboard.h:
2734         * platform/ios/PlatformPasteboardIOS.mm:
2735
2736         Replaces -setItemsUsingRegistrationInfoLists: with -setRegistrationInfoLists:. Rather than have a helper that
2737         both sets up item providers and item registration lists, split this functionality out into two setters. This is
2738         because UIPasteboard does not need to know about the registration info lists used to set up the item providers
2739         in the first place, but internal drag-and-drop clients require this information immediately when starting a drag
2740         in order to construct custom drag previews.
2741
2742         (WebCore::richTextRepresentationsForPasteboardWebContent):
2743         (WebCore::registerItemToPasteboard):
2744
2745         Add a new helper to register item providers to the pasteboard, given an WebItemProviderRegistrationInfoList.
2746
2747         (WebCore::PlatformPasteboard::write):
2748         (WebCore::PlatformPasteboard::writeObjectRepresentations): Deleted.
2749
2750         Refactors PlatformPasteboard::write to always generate and set item providers, unless we're building for an SDK
2751         prior to iOS 11. For images, strings and URLs, we can simply transition to using the new item-provider-based
2752         codepaths used for drag and drop. For web content, we add two additional UTIs that were present when copying,
2753         but not when dragging: flat RTFD and a string constant used to indicate to UIKit that the pasteboard contains
2754         rich text.
2755
2756         * platform/ios/WebItemProviderPasteboard.h:
2757         * platform/ios/WebItemProviderPasteboard.mm:
2758         (-[WebItemProviderRegistrationInfoList init]):
2759         (-[WebItemProviderRegistrationInfoList addData:forType:]):
2760         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
2761         (-[WebItemProviderRegistrationInfoList numberOfItems]):
2762         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
2763         (-[WebItemProviderRegistrationInfoList itemProvider]):
2764         (-[WebItemProviderRegistrationInfoList description]):
2765
2766         Make some small tweaks in WebItemProviderPasteboard (and related classes):
2767         1. Transition to preferredPresentationSize from estimatedDisplayedSize, which is now deprecated.
2768         2. Remove calls to -initWithItemProviderData:typeIdentifier:error:, which is deprecated.
2769         3. Rename _items to _representations to better reflect the role of WebItemProviderRegistrationInfo.
2770         4. Implement -description for WebItemProviderRegistrationInfoList for debugging purposes.
2771
2772         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
2773         (-[WebItemProviderPasteboard setRegistrationInfoLists:]):
2774         (-[WebItemProviderPasteboard setItemsUsingRegistrationInfoLists:]): Deleted.
2775
2776 2017-08-17  Youenn Fablet  <youenn@apple.com>
2777
2778         Add a DOMPromiseDeferred method to handle ExceptionOr<> results
2779         https://bugs.webkit.org/show_bug.cgi?id=175603
2780
2781         Reviewed by Darin Adler.
2782
2783         No change of behavior.
2784
2785         Introduce DOMPromiseDeferred::settle to reject/resolve a promise with an ExceptionOr<>.
2786         Making batchPutOperation/batchDeleteOperation take a Function with an ExceptionOr<>.
2787         Using DOMPromiseDeferred::settle in Cache put/remove.
2788         Updated CacheStorageConnection to create ExceptionOr<> from CacheStorageConnection::Error.
2789
2790         * Modules/cache/Cache.cpp:
2791         (WebCore::Cache::put):
2792         (WebCore::Cache::remove):
2793         (WebCore::Cache::batchDeleteOperation):
2794         (WebCore::Cache::batchPutOperation):
2795         * Modules/cache/Cache.h:
2796         * Modules/cache/CacheStorage.cpp:
2797         (WebCore::CacheStorage::open):
2798         (WebCore::CacheStorage::remove):
2799         * Modules/cache/CacheStorageConnection.cpp:
2800         (WebCore::CacheStorageConnection::errorToException):
2801         * Modules/cache/CacheStorageConnection.h:
2802         (WebCore::CacheStorageConnection::errorToException):
2803         (WebCore::CacheStorageConnection::exceptionOrResult):
2804         * bindings/js/JSDOMPromiseDeferred.h:
2805         (WebCore::DOMPromiseDeferred::settle):
2806         (WebCore::DOMPromiseDeferred<void>::settle):
2807
2808 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
2809
2810         [GStreamer] AppendPipeline: support dispatch of decryption-specific GstStructure into the pipeline
2811         https://bugs.webkit.org/show_bug.cgi?id=175668
2812
2813         Reviewed by Xabier Rodriguez-Calvar.
2814
2815         Add the AppendPipeline::dispatchDecryptionStructure() method. Callers can
2816         pass in a GstStructure object that contains all the information the
2817         decryption elements in the pipeline will require to properly decrypt the
2818         content. In case the decryptor element isn't available yet, the
2819         GstStructure is stored and dispatched when that element becomes available.
2820
2821         The dispatch itself simply creates a new custom GstEvent that adopts the
2822         given GstStructure object, sends that into the pipeline element, and
2823         shifts the state to 'ongoing'.
2824
2825         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2826         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2827         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure):
2828         (WebCore::AppendPipeline::dispatchDecryptionStructure):
2829         * platform/graphics/gstreamer/mse/AppendPipeline.h: Remove a redundant private: label.
2830
2831 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
2832
2833         [GStreamer] GstStructure shouldn't be handled through GRefPtr
2834         https://bugs.webkit.org/show_bug.cgi?id=175673
2835
2836         Reviewed by Xabier Rodriguez-Calvar.
2837
2838         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2839         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
2840         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
2841         smart pointer.
2842
2843 2017-08-17  Youenn Fablet  <youenn@apple.com>
2844
2845         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
2846         https://bugs.webkit.org/show_bug.cgi?id=175631
2847
2848         Reviewed by Eric Carlson.
2849
2850         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2851         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
2852
2853 2017-08-17  Antti Koivisto  <antti@apple.com>
2854
2855         RenderListItem - Avoid render tree mutation during layout
2856         https://bugs.webkit.org/show_bug.cgi?id=175666
2857
2858         Reviewed by Andreas Kling.
2859
2860         Mutations should be done by RenderTreeUpdater only.
2861
2862         * rendering/RenderListItem.cpp:
2863         (WebCore::RenderListItem::updateMarkerRenderer):
2864
2865             This is now called by RenderTreeUpdater only.
2866             Remove code dealing with this being called at layout time.
2867             Merged marker construction code from styleDidChange here and renamed for clarity.
2868
2869         (WebCore::RenderListItem::layout):
2870         (WebCore::RenderListItem::computePreferredLogicalWidths):
2871
2872             Remove mutating calls.
2873
2874         (WebCore::RenderListItem::styleDidChange): Deleted.
2875         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
2876         * rendering/RenderListItem.h:
2877         * rendering/TextAutoSizing.cpp:
2878         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2879
2880             Call updateMarkerRenderer.
2881
2882         * style/RenderTreeUpdater.cpp:
2883         (WebCore::RenderTreeUpdater::popParent):
2884         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
2885
2886             Call updateMarkerRenderer.
2887
2888 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
2889
2890         [PAL] Move SessionID into PAL
2891         https://bugs.webkit.org/show_bug.cgi?id=174192
2892
2893         Reviewed by Antti Koivisto.
2894
2895         No new tests. No change in behavior.
2896
2897         * CMakeLists.txt:
2898         * Modules/websockets/WebSocketChannel.cpp:
2899         (WebCore::WebSocketChannel::connect):
2900         * WebCore.xcodeproj/project.pbxproj:
2901         * dom/Document.cpp:
2902         (WebCore::Document::sessionID const):
2903         * dom/Document.h:
2904         * dom/ScriptExecutionContext.h:
2905         * html/HTMLMediaElement.cpp:
2906         (WebCore::HTMLMediaElement::elementWithID):
2907         (WebCore::HTMLMediaElement::finishParsingChildren):
2908         (WebCore::HTMLMediaElement::scheduleEvent):
2909         (WebCore::HTMLMediaElement::canPlayType const):
2910         (WebCore::HTMLMediaElement::load):
2911         (WebCore::HTMLMediaElement::loadResource):
2912         (WebCore::HTMLMediaElement::textTracksAreReady const):
2913         (WebCore::HTMLMediaElement::textTrackModeChanged):
2914         (WebCore::HTMLMediaElement::noneSupported):
2915         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
2916         (WebCore::HTMLMediaElement::mediaLoadingFailed):
2917         (WebCore::HTMLMediaElement::setReadyState):
2918         (WebCore::HTMLMediaElement::addPlayedRange):
2919         (WebCore::HTMLMediaElement::seekTask):
2920         (WebCore::HTMLMediaElement::refreshCachedTime const):
2921         (WebCore::HTMLMediaElement::currentMediaTime const):
2922         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
2923         (WebCore::HTMLMediaElement::ended const):
2924         (WebCore::HTMLMediaElement::playInternal):
2925         (WebCore::HTMLMediaElement::pause):
2926         (WebCore::HTMLMediaElement::togglePlayState):
2927         (WebCore::HTMLMediaElement::beginScrubbing):
2928         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
2929         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
2930         (WebCore::HTMLMediaElement::didAddTextTrack):
2931         (WebCore::HTMLMediaElement::didRemoveTextTrack):
2932         (WebCore::controllerJSValue):
2933         (WebCore::HTMLMediaElement::configureTextTracks):
2934         (WebCore::HTMLMediaElement::selectNextSourceChild):
2935         (WebCore::HTMLMediaElement::sourceWasAdded):
2936         (WebCore::HTMLMediaElement::sourceWasRemoved):
2937         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2938         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2939         (WebCore::HTMLMediaElement::potentiallyPlaying const):
2940         (WebCore::HTMLMediaElement::endedPlayback const):
2941         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
2942         (WebCore::HTMLMediaElement::updatePlayState):
2943         (WebCore::HTMLMediaElement::userCancelledLoad):
2944         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
2945         (WebCore::HTMLMediaElement::addEventListener):
2946         (WebCore::HTMLMediaElement::isFullscreen const):
2947         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
2948         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
2949         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2950         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
2951         (WebCore::HTMLMediaElement::mediaControls const):
2952         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
2953         (WebCore::HTMLMediaElement::setMediaGroup):
2954         (WebCore::HTMLMediaElement::setControllerForBindings):
2955         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
2956         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
2957         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
2958         (WebCore::HTMLMediaElement::fileSize const):
2959         (WebCore::HTMLMediaElement::mediaSessionTitle const):
2960         (WebCore::needsSeekingSupportQuirk):
2961         (WebCore::HTMLMediaElement::supportsSeeking const):
2962         (WebCore::HTMLMediaElement::doesHaveAttribute const):
2963         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
2964         * loader/DocumentLoader.cpp:
2965         (WebCore::DocumentLoader::continueAfterContentPolicy):
2966         * loader/EmptyClients.cpp:
2967         * loader/FrameLoaderClient.h:
2968         * loader/cache/CachedCSSStyleSheet.cpp:
2969         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
2970         * loader/cache/CachedCSSStyleSheet.h:
2971         * loader/cache/CachedFont.cpp:
2972         (WebCore::CachedFont::CachedFont):
2973         * loader/cache/CachedFont.h:
2974         * loader/cache/CachedImage.cpp:
2975         (WebCore::CachedImage::CachedImage):
2976         * loader/cache/CachedImage.h:
2977         * loader/cache/CachedRawResource.cpp:
2978         (WebCore::CachedRawResource::CachedRawResource):
2979         * loader/cache/CachedRawResource.h:
2980         * loader/cache/CachedResource.cpp:
2981         (WebCore::CachedResource::CachedResource):
2982         * loader/cache/CachedResource.h:
2983         (WebCore::CachedResource::sessionID const):
2984         * loader/cache/CachedResourceLoader.cpp:
2985         (WebCore::createResource):
2986         (WebCore::CachedResourceLoader::sessionID const):
2987         * loader/cache/CachedResourceLoader.h:
2988         * loader/cache/CachedSVGDocument.cpp:
2989         (WebCore::CachedSVGDocument::CachedSVGDocument):
2990         * loader/cache/CachedSVGDocument.h:
2991         * loader/cache/CachedSVGFont.cpp:
2992         (WebCore::CachedSVGFont::CachedSVGFont):
2993         * loader/cache/CachedSVGFont.h:
2994         * loader/cache/CachedScript.cpp:
2995         (WebCore::CachedScript::CachedScript):
2996         * loader/cache/CachedScript.h:
2997         * loader/cache/CachedTextTrack.cpp:
2998         (WebCore::CachedTextTrack::CachedTextTrack):
2999         * loader/cache/CachedTextTrack.h:
3000         * loader/cache/CachedXSLStyleSheet.cpp:
3001         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
3002         * loader/cache/CachedXSLStyleSheet.h:
3003         * loader/cache/MemoryCache.cpp:
3004         (WebCore::MemoryCache::sessionResourceMap const):
3005         (WebCore::MemoryCache::ensureSessionResourceMap):
3006         (WebCore::MemoryCache::resourceForRequest):
3007         (WebCore::MemoryCache::addImageToCache):
3008         (WebCore::MemoryCache::removeImageFromCache):
3009         (WebCore::MemoryCache::forEachSessionResource):
3010         (WebCore::MemoryCache::removeResourcesWithOrigins):
3011         (WebCore::MemoryCache::originsWithCache const):
3012         (WebCore::MemoryCache::evictResources):
3013         * loader/cache/MemoryCache.h:
3014         * loader/cocoa/DiskCacheMonitorCocoa.h:
3015         (WebCore::DiskCacheMonitor::sessionID const):
3016         * loader/cocoa/DiskCacheMonitorCocoa.mm:
3017         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
3018         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
3019         * page/CacheStorageProvider.h:
3020         * page/DatabaseProvider.h:
3021         * page/Page.cpp:
3022         (WebCore::Page::Page):
3023         (WebCore::Page::enableLegacyPrivateBrowsing):
3024         (WebCore::Page::sessionID const):
3025         (WebCore::Page::setSessionID):
3026         * page/Page.h:
3027         * page/PlugInClient.h:
3028         * page/SocketProvider.cpp:
3029         (WebCore::SocketProvider::createSocketStreamHandle):
3030         * page/SocketProvider.h:
3031         * platform/CookiesStrategy.h:
3032         * platform/WebCoreCrossThreadCopier.cpp:
3033         (WTF::PAL::SessionID>::copy):
3034         (WTF::WebCore::SessionID>::copy): Deleted.
3035         * platform/WebCoreCrossThreadCopier.h:
3036         * platform/network/CacheValidation.cpp:
3037         (WebCore::headerValueForVary):
3038         (WebCore::collectVaryingRequestHeaders):
3039         (WebCore::verifyVaryingRequestHeaders):
3040         * platform/network/CacheValidation.h:
3041         * platform/network/NetworkStorageSession.cpp:
3042         (WebCore::NetworkStorageSession::globalSessionMap):
3043         (WebCore::NetworkStorageSession::storageSession):
3044         (WebCore::NetworkStorageSession::destroySession):
3045         * platform/network/NetworkStorageSession.h:
3046         (WebCore::NetworkStorageSession::sessionID const):
3047         * platform/network/NetworkStorageSessionStub.cpp:
3048         (WebCore::NetworkStorageSession::NetworkStorageSession):
3049         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3050         (WebCore::NetworkStorageSession::ensureSession):
3051         (WebCore::NetworkStorageSession::defaultStorageSession):
3052         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3053         (WebCore::NetworkStorageSession::NetworkStorageSession):
3054         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3055         (WebCore::NetworkStorageSession::defaultStorageSession):
3056         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3057         (WebCore::NetworkStorageSession::ensureSession):
3058         * platform/network/cf/SocketStreamHandleImpl.h:
3059         (WebCore::SocketStreamHandleImpl::create):
3060         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3061         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
3062         * platform/network/curl/SocketStreamHandleImpl.h:
3063         (WebCore::SocketStreamHandleImpl::create):
3064         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3065         (WebCore::NetworkStorageSession::NetworkStorageSession):
3066         (WebCore::NetworkStorageSession::defaultStorageSession):
3067         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
3068         (WebCore::NetworkStorageSession::ensureSession):
3069         (WebCore::NetworkStorageSession::switchToNewTestingSession):
3070         * platform/network/soup/SocketStreamHandleImpl.h:
3071         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
3072         (WebCore::SocketStreamHandleImpl::create):
3073         * workers/DedicatedWorkerGlobalScope.cpp:
3074         (WebCore::DedicatedWorkerGlobalScope::create):
3075         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3076         * workers/DedicatedWorkerGlobalScope.h:
3077         * workers/DedicatedWorkerThread.cpp:
3078         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3079         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3080         * workers/DedicatedWorkerThread.h:
3081         * workers/Worker.cpp:
3082         (WebCore::Worker::notifyFinished):
3083         * workers/WorkerGlobalScope.cpp:
3084         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3085         * workers/WorkerGlobalScope.h:
3086         * workers/WorkerGlobalScopeProxy.h:
3087         * workers/WorkerMessagingProxy.cpp:
3088         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3089         * workers/WorkerMessagingProxy.h:
3090         * workers/WorkerThread.cpp:
3091         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3092         (WebCore::WorkerThread::WorkerThread):
3093         * workers/WorkerThread.h:
3094         * workers/service/ServiceWorkerContainer.h:
3095         * workers/service/ServiceWorkerRegistrationParameters.h:
3096
3097 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
3098
3099         [GTK][WPE] Add NTLM authentication enabled API
3100         https://bugs.webkit.org/show_bug.cgi?id=122952
3101
3102         Reviewed by Michael Catanzaro.
3103
3104         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
3105
3106         * platform/network/soup/SoupNetworkSession.cpp:
3107         (WebCore::SoupNetworkSession::SoupNetworkSession):
3108         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
3109         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
3110         * platform/network/soup/SoupNetworkSession.h:
3111
3112 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
3113
3114         Add the support for mutating clipboard data via DataTransferItemList
3115         https://bugs.webkit.org/show_bug.cgi?id=175639
3116
3117         Reviewed by Wenson Hsieh.
3118
3119         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
3120         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
3121         we must put into the disabled mode.
3122
3123         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
3124         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
3125         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
3126
3127         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
3128         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
3129         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
3130         methods such as setData and clearData.
3131
3132         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
3133
3134         * dom/DataTransfer.cpp:
3135         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
3136         (WebCore::DataTransfer::setData): Ditto.
3137         (WebCore::DataTransfer::createForInputEvent):
3138         (WebCore::DataTransfer::createForDrag):
3139         (WebCore::DataTransfer::createForDrop):
3140         * dom/DataTransferItem.cpp:
3141         (WebCore::DataTransferItem::create):
3142         (WebCore::DataTransferItem::DataTransferItem):
3143         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
3144         (WebCore::DataTransferItem::type const): Moved from the header.
3145         (WebCore::DataTransferItem::getAsString const):
3146         (WebCore::DataTransferItem::getAsFile const):
3147         * dom/DataTransferItem.h:
3148         (WebCore::DataTransferItem::ref): Deleted.
3149         (WebCore::DataTransferItem::deref): Deleted.
3150         (WebCore::DataTransferItem::isFile const): Added.
3151         (WebCore::DataTransferItem::type const): Move to the cpp file.
3152         * dom/DataTransferItemList.cpp:
3153         (WebCore::isSupportedType): Moved.
3154         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
3155         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
3156         (WebCore::DataTransferItemList::item):
3157         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
3158         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
3159         a file since a writable dataTransfer never contains a File object.
3160         (WebCore::DataTransferItemList::clear): Implemented.
3161         (WebCore::DataTransferItemList::ensureItems const):
3162         (WebCore::removeStringItemOfLowercasedType): Added.
3163         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
3164         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
3165         * dom/DataTransferItemList.h:
3166         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
3167         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
3168         (WebCore::DataTransferItemList::dataTransfer): Added.
3169         * dom/DataTransferItemList.idl:
3170
3171 2017-08-16  Andy Estes  <aestes@apple.com>
3172
3173         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
3174         https://bugs.webkit.org/show_bug.cgi?id=175648
3175
3176         Reviewed by Tim Horton.
3177
3178         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
3179         an existing Apple Pay class. This patch renames PaymentRequest to
3180         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
3181         W3C API.
3182
3183         * Modules/applepay/ApplePayError.h:
3184         * Modules/applepay/ApplePayLineItem.h:
3185         * Modules/applepay/ApplePayPaymentRequest.h:
3186         * Modules/applepay/ApplePaySession.cpp:
3187         (WebCore::convertAndValidateTotal):
3188         (WebCore::convertAndValidate):
3189         (WebCore::ApplePaySession::ApplePaySession):
3190         (WebCore::ApplePaySession::didSelectShippingMethod):
3191         * Modules/applepay/ApplePaySession.h:
3192         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
3193         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
3194         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
3195         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
3196         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
3197         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
3198         (WebCore::convert):
3199         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
3200         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
3201         * Modules/applepay/PaymentCoordinator.cpp:
3202         (WebCore::PaymentCoordinator::beginPaymentSession):
3203         (WebCore::PaymentCoordinator::didSelectShippingMethod):
3204         * Modules/applepay/PaymentCoordinator.h:
3205         * Modules/applepay/PaymentCoordinatorClient.h:
3206         * Modules/applepay/PaymentHeaders.h:
3207         * Modules/applepay/PaymentRequestValidator.cpp:
3208         (WebCore::PaymentRequestValidator::validate):
3209         (WebCore::PaymentRequestValidator::validateTotal):
3210         (WebCore::validateMerchantCapabilities):
3211         (WebCore::validateShippingMethod):
3212         (WebCore::validateShippingMethods):
3213         * Modules/applepay/PaymentRequestValidator.h:
3214         * WebCore.xcodeproj/project.pbxproj:
3215         * loader/EmptyClients.cpp:
3216
3217 2017-08-16  Chris Dumez  <cdumez@apple.com>
3218
3219         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
3220         https://bugs.webkit.org/show_bug.cgi?id=175628
3221         <rdar://problem/33919278>
3222
3223         Reviewed by Geoffrey Garen.
3224
3225         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
3226         To achieve this, the following changes were made:
3227         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
3228         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
3229            preflight merely because the fetch mode is set to "cors").
3230
3231         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
3232
3233         * Modules/fetch/FetchBody.cpp:
3234         (WebCore::FetchBody::extract):
3235         * loader/CrossOriginAccessControl.h:
3236         * loader/LoaderStrategy.h:
3237         * loader/PingLoader.cpp:
3238         (WebCore::PingLoader::loadImage):
3239         (WebCore::PingLoader::sendPing):
3240         (WebCore::PingLoader::sendViolationReport):
3241         (WebCore::PingLoader::startPingLoad):
3242         * loader/PingLoader.h:
3243         * loader/cache/CachedResource.cpp:
3244         (WebCore::CachedResource::CachedResource):
3245         (WebCore::CachedResource::load):
3246         * loader/cache/CachedResource.h:
3247         * loader/cache/CachedResourceRequest.cpp:
3248         (WebCore::CachedResourceRequest::CachedResourceRequest):
3249         * loader/cache/CachedResourceRequest.h:
3250         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
3251         * platform/network/HTTPHeaderValues.cpp:
3252         * platform/network/HTTPHeaderValues.h:
3253
3254 2017-08-16  Matt Baker  <mattbaker@apple.com>
3255
3256         Web Inspector: capture async stack trace when workers/main context posts a message
3257         https://bugs.webkit.org/show_bug.cgi?id=167084
3258         <rdar://problem/30033673>
3259
3260         Reviewed by Brian Burg.
3261
3262         Add instrumentation to DOMWindow to support showing asynchronous
3263         stack traces when the debugger pauses in a MessageEvent handler.
3264
3265         Test: inspector/debugger/async-stack-trace.html
3266
3267         * inspector/InspectorInstrumentation.cpp:
3268         (WebCore::InspectorInstrumentation::didPostMessageImpl):
3269         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
3270         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
3271         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
3272
3273         * inspector/InspectorInstrumentation.h:
3274         (WebCore::InspectorInstrumentation::didPostMessage):
3275         (WebCore::InspectorInstrumentation::didFailPostMessage):
3276         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
3277         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
3278
3279         * inspector/PageDebuggerAgent.cpp:
3280         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
3281         (WebCore::PageDebuggerAgent::didPostMessage):
3282         (WebCore::PageDebuggerAgent::didFailPostMessage):
3283         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
3284         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
3285         * inspector/PageDebuggerAgent.h:
3286
3287         * page/DOMWindow.cpp:
3288         (WebCore::DOMWindow::postMessage):
3289         (WebCore::DOMWindow::postMessageTimerFired):
3290
3291 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
3292
3293         Try to fix the build
3294
3295         * platform/ios/PlatformPasteboardIOS.mm:
3296
3297 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
3298
3299         Build fix after r220812
3300
3301         Fix builds where LOG_DISABLED is defined.
3302
3303         * css/MediaQueryEvaluator.cpp:
3304
3305 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
3306
3307         Add a log channel for media queries
3308         https://bugs.webkit.org/show_bug.cgi?id=175591
3309
3310         Reviewed by Zalan Bujtas.
3311
3312         Add a "MediaQueries" log channel which logs data about media query evaluation.
3313
3314         * css/MediaList.cpp:
3315         (WebCore::MediaQuerySet::MediaQuerySet):
3316         (WebCore::operator<<):
3317         * css/MediaList.h:
3318         * css/MediaQuery.cpp:
3319         (WebCore::operator<<):
3320         * css/MediaQuery.h:
3321         * css/MediaQueryEvaluator.cpp:
3322         (WebCore::operator<<):
3323         (WebCore::MediaQueryEvaluator::evaluate const):
3324         (WebCore::aspectRatioValueAsString):
3325         (WebCore::orientationEvaluate):
3326         (WebCore::aspectRatioEvaluate):
3327         (WebCore::deviceAspectRatioEvaluate):
3328         (WebCore::evaluateResolution):
3329         (WebCore::deviceHeightEvaluate):
3330         (WebCore::deviceWidthEvaluate):
3331         (WebCore::heightEvaluate):
3332         (WebCore::widthEvaluate):
3333         * css/MediaQueryExpression.cpp:
3334         (WebCore::operator<<):
3335         * css/MediaQueryExpression.h:
3336         * css/MediaQueryMatcher.cpp:
3337         (WebCore::MediaQueryMatcher::styleResolverChanged):
3338         * css/StyleResolver.cpp:
3339         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
3340         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
3341         * dom/InlineStyleSheetOwner.cpp:
3342         (WebCore::InlineStyleSheetOwner::createSheet):
3343         * html/HTMLImageElement.cpp:
3344         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
3345         * html/HTMLLinkElement.cpp:
3346         (WebCore::HTMLLinkElement::process):
3347         * html/HTMLMediaElement.cpp:
3348         (WebCore::HTMLMediaElement::selectNextSourceChild):
3349         * html/HTMLPictureElement.cpp:
3350         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
3351         * html/parser/HTMLPreloadScanner.cpp:
3352         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3353         * page/FrameView.cpp:
3354         (WebCore::FrameView::layout):
3355         * platform/Logging.cpp:
3356         (WebCore::initializeLogChannelsIfNecessary):
3357         * platform/Logging.h:
3358         * platform/URL.cpp:
3359         (WebCore::isSchemeFirstChar):
3360         (WebCore::operator<<):
3361         * platform/URL.h:
3362
3363 2017-08-16  Sam Weinig  <sam@webkit.org>
3364
3365         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
3366         https://bugs.webkit.org/show_bug.cgi?id=175526
3367
3368         Reviewed by Chris Dumez.
3369
3370         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
3371           which is defined in the WebCrypto spec to happen after normal IDL operations.
3372         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
3373           edge cases remain).
3374
3375         * CMakeLists.txt:
3376         * WebCore.xcodeproj/project.pbxproj:
3377         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
3378
3379             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
3380
3381         * bindings/js/JSDOMConvertObject.h:
3382
3383             Add needed, when included in generated code, #include of StrongInlines.h
3384
3385         * bindings/js/JSDOMConvertUnion.h:
3386         
3387             Add initial support for object (needed for AlgorithmIdentifier which is 
3388             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
3389
3390             Also add remaining spec comments while in the area.
3391
3392         * bindings/js/JSDOMPromiseDeferred.cpp:
3393         (WebCore::DeferredPromise::reject):
3394
3395             Add support for the special ExistingExceptionError error code. Capturing
3396             the current exception and using it as the rejection value.
3397
3398         * crypto/SubtleCrypto.cpp:
3399         (WebCore::SubtleCrypto::~SubtleCrypto):
3400         (WebCore::toHashIdentifier):
3401         (WebCore::normalizeCryptoAlgorithmParameters):
3402         (WebCore::toCryptoKeyUsageBitmap):
3403         (WebCore::rejectWithException):
3404         (WebCore::normalizeJsonWebKey):
3405         (WebCore::toKeyData):
3406         (WebCore::copyToVector):
3407         (WebCore::isSupportedExportKey):
3408         (WebCore::SubtleCrypto::encrypt):
3409         (WebCore::SubtleCrypto::decrypt):
3410         (WebCore::SubtleCrypto::sign):
3411         (WebCore::SubtleCrypto::verify):
3412         (WebCore::SubtleCrypto::digest):
3413         (WebCore::SubtleCrypto::generateKey):
3414         (WebCore::SubtleCrypto::deriveKey):
3415         (WebCore::SubtleCrypto::deriveBits):
3416         (WebCore::SubtleCrypto::importKey):
3417         (WebCore::SubtleCrypto::exportKey):
3418         (WebCore::SubtleCrypto::wrapKey):
3419         (WebCore::SubtleCrypto::unwrapKey):
3420         * crypto/SubtleCrypto.h:
3421         * crypto/SubtleCrypto.idl:
3422
3423             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
3424             with that are:
3425             - All parameters are now converted / type checked for us.
3426             - Rather than throwing exceptions and expecting the bindings layer to convert