MediaResourceLoader::requestResource should take a ResourceRequest&& as input
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-11  Youenn Fablet  <youenn@apple.com>
2
3         MediaResourceLoader::requestResource should take a ResourceRequest&& as input
4         https://bugs.webkit.org/show_bug.cgi?id=160397
5
6         Reviewed by Alex Christensen.
7
8         No change in behavior.
9
10         * loader/MediaResourceLoader.cpp:
11         (WebCore::MediaResourceLoader::requestResource): Passing a ResourceRequest&& as input parameter.
12         * loader/MediaResourceLoader.h:
13         * platform/graphics/PlatformMediaResourceLoader.h: Ditto.
14         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
15         (webKitWebSrcStart): Creating an extra copy since MediaResourceLoader::requestResource expects a Resourcerequest&&.
16
17 2016-10-11  Chris Dumez  <cdumez@apple.com>
18
19         Update AnimationEvent to stop using legacy [ConstructorTemplate=Event]
20         https://bugs.webkit.org/show_bug.cgi?id=163312
21
22         Reviewed by Ryosuke Niwa.
23
24         Update AnimationEvent to stop using legacy [ConstructorTemplate=Event]
25         and use a regular constructor as in the specification:
26         - https://drafts.csswg.org/css-animations/#interface-animationevent
27
28         * dom/AnimationEvent.cpp:
29         (WebCore::AnimationEvent::AnimationEvent):
30         * dom/AnimationEvent.h:
31         * dom/AnimationEvent.idl:
32
33 2016-10-11  Chris Dumez  <cdumez@apple.com>
34
35         Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
36         https://bugs.webkit.org/show_bug.cgi?id=163311
37
38         Reviewed by Ryosuke Niwa.
39
40         Update DeviceProximityEvent to stop using legacy [ConstructorTemplate=Event]
41         and use a regular constructor instead, as in the specification:
42         - https://www.w3.org/TR/2015/WD-proximity-20150903/#deviceproximityevent-interface
43
44         * Modules/proximity/DeviceProximityEvent.cpp:
45         (WebCore::DeviceProximityEvent::DeviceProximityEvent):
46         * Modules/proximity/DeviceProximityEvent.h:
47         (WebCore::DeviceProximityEvent::create):
48         (WebCore::DeviceProximityEventInit::DeviceProximityEventInit): Deleted.
49         * Modules/proximity/DeviceProximityEvent.idl:
50
51 2016-10-11  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
52
53         Unreviewed, EFL build fix because of r207173.
54
55         * testing/InternalSettings.cpp:
56         (WebCore::InternalSettings::forcedPrefersReducedMotionValue):
57
58 2016-10-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
59
60         [CG] Add the option to immediately decode an image frame and control its memory caching
61         https://bugs.webkit.org/show_bug.cgi?id=163298
62
63         Reviewed by Simon Fraser.
64
65         This patch fixes two things. (1) An option is added to immediately decode an
66         image frame. This can be done by adding kCGImageSourceShouldCacheImmediately
67         to the ImageSource options dictionary. (2) BitmapImage should also control
68         when the image frame is actually deleted from memory. This can be done by
69         calling CGImageSourceCreateThumbnailAtIndex(). CG does not keep a reference
70         to the returned CGImageRef.
71
72         * platform/graphics/ImageFrame.h: Adding the DecodingMode enum class.
73         Ideally this should be a member of ImageDecoder class. But since we
74         have three header files for ImageDecoder, this can be added here till
75         the three files combined in one header file.
76
77         * platform/graphics/ImageFrameCache.cpp:
78         (WebCore::ImageFrameCache::setRenderTarget): Deleted.
79         * platform/graphics/ImageFrameCache.h:
80         * platform/graphics/ImageSource.cpp:
81         (WebCore::ImageSource::setRenderTarget):
82         * platform/graphics/ImageSource.h:
83         (WebCore::ImageSource::setRenderTarget): Deleted.
84         Unrelated change. The native image decoder is available from the ImageSource.
85         ImageSource::setTarget() does not need not to get it through ImageFrameCache.
86         
87         * platform/graphics/cg/ImageDecoderCG.cpp:
88         (WebCore::createImageSourceOptions): Clean this function by using CFMutableDictionary.
89         (WebCore::imageSourceOptions): Cache two default ImageSource options and create new
90         ones for the non default cases.
91
92         (WebCore::ImageDecoder::createFrameImageAtIndex): Use the appropriate ImageSource function
93
94         * platform/graphics/cg/ImageDecoderCG.h:
95         * platform/graphics/win/ImageDecoderDirect2D.cpp:
96         (WebCore::ImageDecoder::createFrameImageAtIndex):
97         * platform/graphics/win/ImageDecoderDirect2D.h:
98         * platform/image-decoders/ImageDecoder.cpp:
99         (WebCore::ImageDecoder::createFrameImageAtIndex):
100         * platform/image-decoders/ImageDecoder.h:
101          Change functions' signature to include a DecodingMode argument.
102
103 2016-10-11  Chris Dumez  <cdumez@apple.com>
104
105         select.options may return too many option elements
106         https://bugs.webkit.org/show_bug.cgi?id=163296
107
108         Reviewed by Ryosuke Niwa.
109
110         select.options may return too many option elements. We're only supposed
111         to return the option element children of the select element, and the
112         option element children of all the optgroup element children of the
113         select element, in tree order:
114         - https://html.spec.whatwg.org/#dom-select-options
115         - https://html.spec.whatwg.org/#concept-select-option-list
116
117         Firefox and Chrome agrees with the specification. However, WebKit was
118         returning all the option elements that are descendants of the select
119         element.
120
121         Test: imported/w3c/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html
122
123         * html/HTMLOptionsCollection.h:
124
125 2016-10-11  Alex Christensen  <achristensen@webkit.org>
126
127         Fix assertion when creating first WebCore::URL from non-main thread after r207162
128         https://bugs.webkit.org/show_bug.cgi?id=163304
129
130         Reviewed by Filip Pizlo.
131
132         This fixes assertions when running UserContentWorld.NormalWorld API tests.
133
134         * platform/text/TextEncodingRegistry.cpp:
135         (WebCore::buildBaseTextCodecMaps):
136         (WebCore::atomicCanonicalTextEncodingName):
137         The new URLParser requires a TextEncoding& in its constructor, which defaults to UTF8Encoding.
138         When creating the first TextEncoding in a process, it calls buildBaseTextCodecMaps which asserts
139         it's on the main thread because it initializes static variables.  Since we are getting a lock right 
140         after this call anyway, just put this function call inside the lock.
141
142 2016-10-11  Dean Jackson  <dino@apple.com>
143
144         color-gamut media query shouldn't ASSERT on invalid values
145         https://bugs.webkit.org/show_bug.cgi?id=163303
146         <rdar://problem/28724566>
147
148         Reviewed by Simon Fraser.
149
150         Remove the ASSERT_NOT_REACHED in the evaluation, since it
151         can be hit when there is a valid CSS keyword that is not
152         expected in the query.
153
154         Updated fast/media/mq-color-gamut.html
155
156         * css/MediaQueryEvaluator.cpp:
157         (WebCore::colorGamutEvaluate):
158
159 2016-10-11  Chris Dumez  <cdumez@apple.com>
160
161         Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
162         https://bugs.webkit.org/show_bug.cgi?id=163289
163
164         Reviewed by Sam Weinig.
165
166         Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
167         and use regular constructors instead.
168
169         * Modules/mediastream/MediaStreamEvent.cpp:
170         (WebCore::MediaStreamEvent::create):
171         (WebCore::MediaStreamEvent::MediaStreamEvent):
172         * Modules/mediastream/MediaStreamEvent.h:
173         * Modules/mediastream/MediaStreamEvent.idl:
174         * Modules/mediastream/MediaStreamTrackEvent.cpp:
175         (WebCore::MediaStreamTrackEvent::create):
176         (WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
177         * Modules/mediastream/MediaStreamTrackEvent.h:
178         * Modules/mediastream/MediaStreamTrackEvent.idl:
179         * Modules/mediastream/OverconstrainedErrorEvent.h:
180         (WebCore::OverconstrainedErrorEvent::create):
181         (WebCore::OverconstrainedErrorEvent::OverconstrainedErrorEvent):
182         (WebCore::OverconstrainedErrorEvent::~OverconstrainedErrorEvent): Deleted.
183         * Modules/mediastream/OverconstrainedErrorEvent.idl:
184         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
185         (WebCore::RTCDTMFToneChangeEvent::create):
186         (WebCore::RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent):
187         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
188         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
189         * Modules/mediastream/RTCTrackEvent.cpp:
190         (WebCore::RTCTrackEvent::create):
191         (WebCore::RTCTrackEvent::RTCTrackEvent):
192         * Modules/mediastream/RTCTrackEvent.h:
193         * Modules/mediastream/RTCTrackEvent.idl:
194
195 2016-10-11  Chris Dumez  <cdumez@apple.com>
196
197         Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
198         https://bugs.webkit.org/show_bug.cgi?id=163288
199
200         Reviewed by Darin Adler.
201
202         Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
203         and use a constructor as in the specification:
204         - https://dvcs.w3.org/hg/IndieUI/raw-file/default/src/indie-ui-events.html#UIRequestEvent
205
206         * Modules/indieui/UIRequestEvent.cpp:
207         (WebCore::UIRequestEvent::create):
208         (WebCore::UIRequestEvent::UIRequestEvent):
209         (WebCore::UIRequestEvent::createForBindings): Deleted.
210         * Modules/indieui/UIRequestEvent.h:
211         * Modules/indieui/UIRequestEvent.idl:
212
213 2016-10-11  Dean Jackson  <dino@apple.com>
214
215         Implement prefers-reduced-motion media query
216         https://bugs.webkit.org/show_bug.cgi?id=163250
217         <rdar://problem/28704129>
218
219         Reviewed by Simon Fraser.
220
221         Implement the prefers-reduced-motion media query, as
222         described in https://github.com/w3c/csswg-drafts/issues/442.
223
224         Tests: fast/media/mq-prefers-reduced-motion-forced-value.html
225                fast/media/mq-prefers-reduced-motion.html
226
227         * Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit.
228
229         * css/CSSValueKeywords.in: New keyword for "reduce".
230
231         * css/MediaFeatureNames.h: Add prefers-reduced-motion.
232         * css/MediaQueryEvaluator.cpp:
233         (WebCore::prefersReducedMotionEvaluate):
234         * css/MediaQueryExp.cpp:
235         (WebCore::featureWithValidIdent):
236         (WebCore::isFeatureValidWithoutValue):
237
238         * platform/Theme.h: New API to detect the system accessibility settings.
239         (WebCore::Theme::userPrefersReducedMotion):
240         * platform/ios/ThemeIOS.h:
241         * platform/ios/ThemeIOS.mm:
242         (WebCore::ThemeIOS::userPrefersReducedMotion):
243         * platform/mac/ThemeMac.h:
244         * platform/mac/ThemeMac.mm:
245         (WebCore::ThemeMac::userPrefersReducedMotion):
246
247         * testing/Internals.cpp: Expose the same API to internals, so that
248         a test can examine the value too.
249         (WebCore::Internals::userPrefersReducedMotion):
250         * testing/Internals.h:
251         * testing/Internals.idl:
252         * testing/Internals.mm:
253         (WebCore::Internals::userPrefersReducedMotion):
254
255         * page/Settings.h: New setting to override the system value...
256         * page/Settings.in:
257
258         * testing/InternalSettings.cpp: ... plumbed through internals.
259         (WebCore::InternalSettings::Backup::Backup):
260         (WebCore::InternalSettings::Backup::restoreTo):
261         (WebCore::InternalSettings::forcedPrefersReducedMotionValue):
262         (WebCore::InternalSettings::setForcedPrefersReducedMotionValue):
263         * testing/InternalSettings.h:
264         * testing/InternalSettings.idl:
265         * testing/Internals.cpp:
266         (WebCore::Internals::userPrefersReducedMotion):
267         * testing/Internals.h:
268         * testing/Internals.idl:
269         * testing/Internals.mm:
270         (WebCore::Internals::userPrefersReducedMotion):
271
272
273 2016-10-10  Ryosuke Niwa  <rniwa@webkit.org>
274
275         Annotate DOM API with CEReactions
276         https://bugs.webkit.org/show_bug.cgi?id=163268
277
278         Reviewed by Darin Adler.
279
280         Added CEReactions IDL attribute to APIs defined in https://dom.spec.whatwg.org.
281
282         No new tests since existing tests cover the code change.
283         Added a dedicated code generation test: JSTestCEReactions.idl and TestCEReactionsStringifier.idl.
284
285         * bindings/scripts/CodeGeneratorJS.pm:
286         (GenerateImplementation): Generate CustomElementReactionStack in attribute setters. In the case of PutForwards,
287         check the extended attributes of the target attribute's stringifier.
288         * bindings/scripts/test/JS/JSTestCEReactions.cpp: Added.
289         * bindings/scripts/test/JS/JSTestCEReactions.h: Added.
290         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: Added.
291         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: Added.
292         * bindings/scripts/test/JS/JSTestObj.cpp:
293         (WebCore::jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack): Deleted.
294         * bindings/scripts/test/TestCEReactions.idl: Added.
295         * bindings/scripts/test/TestCEReactionsStringifier.idl: Added.
296         * bindings/scripts/test/TestObj.idl:
297         * dom/Attr.idl:
298         * dom/ChildNode.idl:
299         * dom/Document.idl:
300         * dom/Element.idl:
301         * dom/NamedNodeMap.idl:
302         * dom/Node.idl:
303         * dom/ParentNode.idl:
304         * dom/Range.idl:
305         * html/DOMTokenList.idl:
306
307 2016-10-11  Chris Dumez  <cdumez@apple.com>
308
309         Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
310         https://bugs.webkit.org/show_bug.cgi?id=163293
311
312         Reviewed by Darin Adler.
313
314         Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and
315         use a regular constructor as in the specification:
316         - https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces
317
318         No new tests, updated existing test.
319
320         * Modules/websockets/CloseEvent.h:
321         (WebCore::CloseEvent::create):
322         (WebCore::CloseEvent::CloseEvent):
323         * Modules/websockets/CloseEvent.idl:
324
325 2016-10-11  Yusuke Suzuki  <utatane.tea@gmail.com>
326
327         [DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments
328         https://bugs.webkit.org/show_bug.cgi?id=163224
329
330         Reviewed by Filip Pizlo.
331
332         * domjit/DOMJITHelpers.h:
333         (WebCore::DOMJITHelpers::toWrapper):
334         * domjit/JSNodeDOMJIT.cpp:
335         (WebCore::createCallDOMForOffsetAccess):
336
337 2016-10-11  Alex Christensen  <achristensen@webkit.org>
338
339         Enable URLParser by default
340         https://bugs.webkit.org/show_bug.cgi?id=162660
341         <rdar://28601706>
342
343         Reviewed by Sam Weinig.
344
345         Covered by updates to many LayoutTests.
346
347         * platform/URLParser.cpp:
348         Make the default value true for URLParser::enabled.
349         This is the most impactful and well-documented one-line change I've ever written.
350
351 2016-10-11  Daniel Bates  <dabates@apple.com>
352
353         [iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps
354         https://bugs.webkit.org/show_bug.cgi?id=163244
355         <rdar://problem/27250015>
356
357         Reviewed by Jer Noble.
358
359         Adds a new setting to toggle requiring a user gesture to load a video (enabled by default).
360         Disable this setting for apps built against iOS 9 or earlier.
361
362         Tests: media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false.html
363                media/require-user-gesture-to-load-video.html
364
365         * html/HTMLMediaElement.cpp:
366         (WebCore::HTMLMediaElement::HTMLMediaElement): Only require a user gesture to load a video
367         when Settings::requiresUserGestureToLoadVideo() is true.
368         * page/Settings.cpp: Enable setting requiresUserGestureToLoadVideo by default.
369         * page/Settings.in: Add setting, requiresUserGestureToLoadVideo.
370
371 2016-10-11  Sam Weinig  <sam@webkit.org>
372
373         Fix the iOS build.
374
375         * bindings/js/JSDOMConvert.h:
376
377 2016-10-11  Daniel Bates  <dabates@apple.com>
378
379         [iOS] Sandbox QuickLook previews
380         https://bugs.webkit.org/show_bug.cgi?id=163240
381         <rdar://problem/25961633>
382
383         Fix bad merge following r207151.
384
385         * platform/network/cf/ResourceResponse.h: Define m_isQuickLook.
386
387 2016-10-11  Daniel Bates  <dabates@apple.com>
388
389         [iOS] Sandbox QuickLook previews
390         https://bugs.webkit.org/show_bug.cgi?id=163240
391         <rdar://problem/25961633>
392
393         Reviewed by Brent Fulgham.
394
395         Use a unique origin for- and limit the capabilities of- QuickLook previews.
396
397         Tests: http/tests/quicklook/at-import-stylesheet-blocked.html
398                http/tests/quicklook/base-url-blocked.html
399                http/tests/quicklook/cross-origin-iframe-blocked.html
400                http/tests/quicklook/csp-header-ignored.html
401                http/tests/quicklook/document-domain-is-empty-string.html
402                http/tests/quicklook/external-stylesheet-blocked.html
403                http/tests/quicklook/hide-referer-on-navigation.html
404                http/tests/quicklook/submit-form-blocked.html
405                http/tests/quicklook/top-navigation-blocked.html
406
407         * dom/Document.cpp:
408         (WebCore::Document::processHttpEquiv): Call ContentSecurityPolicy::didReceiveHeader().
409         (WebCore::Document::processReferrerPolicy): Do not process referrer policy for QuickLook previews.
410         (WebCore::Document::initSecurityContext): Apply sandbox for QuickLook previews.
411         (WebCore::Document::shouldEnforceQuickLookSandbox): Added.
412         (WebCore::Document::applyQuickLookSandbox): Added.
413         * dom/Document.h:
414         * page/csp/ContentSecurityPolicy.h: Change accessibility of didReceiveHeader() from private to public.
415         (WebCore::ContentSecurityPolicy::processHTTPEquiv): Deleted.
416         * platform/network/cf/ResourceResponse.h:
417         (WebCore::ResourceResponse::isQuickLook): Added.
418         (WebCore::ResourceResponse::setIsQuickLook): Added.
419         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
420         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Modified to mark
421         resource response as a QuickLook preview, if appropriate. Also remove the name of the first argument
422         and the need to use UNUSED_PARAM(connection) as we no longer make use of the first argument
423         following r207151.
424         * platform/network/ios/QuickLook.mm:
425         (-[WebResourceLoaderQuickLookDelegate _sendDidReceiveResponseIfNecessary]): Ditto.
426         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
427         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto. Fix style nits,
428         including renaming the function argument "r" to "resource" to better describe its purpose.
429
430 2016-10-11  Alex Christensen  <achristensen@webkit.org>
431
432         Fix bindings tests after r207150.
433
434         * bindings/scripts/test/JS/JSTestObj.cpp:
435         (WebCore::convertDictionary<TestObj::Dictionary>):
436
437 2016-10-11  Alex Christensen  <achristensen@webkit.org>
438
439         URLParser should percent-encode non-ASCII and non-printable characters in fragment
440         https://bugs.webkit.org/show_bug.cgi?id=163287
441
442         Reviewed by Brady Eidson.
443
444         Based on discussion in https://github.com/whatwg/url/issues/150
445         If that discussion decides to keep the spec as-is (which keeps non-ASCII characters in the fragment
446         to match IE and Edge's behavior, which Chrome has followed for special schemes) then we can revert
447         this change later after enabling the URL parser.  Making this change keeps behavior matching Safari
448         and Firefox, as well as Chrome's handling of non-special schemes, such as data URLs.
449
450         Covered by updated API tests.
451
452         * platform/URLParser.cpp:
453         (WebCore::URLParser::appendToASCIIBuffer):
454         (WebCore::URLParser::copyURLPartsUntil):
455         (WebCore::URLParser::syntaxViolation):
456         (WebCore::URLParser::currentPosition):
457         (WebCore::URLParser::parse):
458         (WebCore::URLParser::fragmentSyntaxViolation): Deleted.
459         * platform/URLParser.h:
460         No more non-ASCII characters in canonicalized URLs.
461
462 2016-10-11  Alex Christensen  <achristensen@webkit.org>
463
464         Remove dead networking code
465         https://bugs.webkit.org/show_bug.cgi?id=163263
466
467         Reviewed by Daniel Bates.
468
469         There are no more Cocoa platforms using CFURLConnection.
470         USE(CFNETWORK) is being replaced by USE(CFURLCONNECTION) and it is only used on the AppleWin port.
471
472         No change in behavior.
473
474         * WebCore.xcodeproj/project.pbxproj:
475         * WebCorePrefix.h:
476         * loader/DocumentLoader.h:
477         * loader/EmptyClients.h:
478         * loader/FrameLoaderClient.h:
479         * loader/ResourceLoader.cpp:
480         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
481         * loader/ResourceLoader.h:
482         * loader/SubresourceLoader.h:
483         * loader/cf/ResourceLoaderCFNet.cpp:
484         * loader/cocoa/SubresourceLoaderCocoa.mm:
485         (WebCore::SubresourceLoader::willCacheResponse): Deleted.
486         * loader/mac/DocumentLoaderMac.cpp:
487         * loader/mac/ResourceLoaderMac.mm:
488         (WebCore::ResourceLoader::willCacheResponse): Deleted.
489         * page/mac/PageMac.mm:
490         (WebCore::Page::platformInitialize):
491         (WebCore::Page::addSchedulePair):
492         (WebCore::Page::removeSchedulePair):
493         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
494         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
495         (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted.
496         (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted.
497         * platform/mac/WebCoreSystemInterface.h:
498         * platform/network/NetworkStorageSession.h:
499         * platform/network/ProtectionSpace.h:
500         * platform/network/ProtectionSpaceBase.cpp:
501         * platform/network/ResourceHandle.cpp:
502         * platform/network/ResourceHandle.h:
503         * platform/network/ResourceHandleClient.cpp:
504         * platform/network/ResourceHandleClient.h:
505         (WebCore::ResourceHandleClient::willCacheResponse):
506         (WebCore::ResourceHandleClient::shouldCacheResponse):
507         * platform/network/ResourceHandleInternal.h:
508         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
509         * platform/network/ResourceRequestBase.cpp:
510         * platform/network/cf/AuthenticationCF.cpp:
511         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
512         (WebCore::createCF):
513         (WebCore::core):
514         * platform/network/cf/AuthenticationCF.h:
515         * platform/network/cf/AuthenticationChallenge.h:
516         * platform/network/cf/CookieJarCFNet.cpp:
517         * platform/network/cf/CredentialStorageCFNet.cpp:
518         (WebCore::CredentialStorage::getFromPersistentStorage):
519         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
520         * platform/network/cf/LoaderRunLoopCF.cpp:
521         * platform/network/cf/LoaderRunLoopCF.h:
522         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
523         (WebCore::NetworkStorageSession::cookieStorage):
524         * platform/network/cf/ProtectionSpaceCFNet.cpp:
525         * platform/network/cf/ProtectionSpaceCFNet.h:
526         * platform/network/cf/ResourceError.h:
527         * platform/network/cf/ResourceErrorCF.cpp:
528         * platform/network/cf/ResourceHandleCFNet.cpp:
529         (WebCore::shouldSniffConnectionProperty):
530         (WebCore::ResourceHandle::createCFURLConnection):
531         (WebCore::ResourceHandle::start):
532         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
533         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
534         (WebCore::ResourceHandle::receivedCredential):
535         (WebCore::ResourceHandle::schedule): Deleted.
536         (WebCore::ResourceHandle::unschedule): Deleted.
537         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
538         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
539         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
540         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
541         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
542         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
543         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
544         * platform/network/cf/ResourceRequest.h:
545         (WebCore::ResourceRequest::encodingRequiresPlatformData):
546         * platform/network/cf/ResourceRequestCFNet.cpp:
547         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
548         (WebCore::ResourceRequest::doUpdatePlatformRequest):
549         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
550         (WebCore::ResourceRequest::doUpdateResourceRequest):
551         (WebCore::ResourceRequest::setStorageSession):
552         (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction): Deleted.
553         * platform/network/cf/ResourceRequestCFNet.h:
554         * platform/network/cf/ResourceResponse.h:
555         (WebCore::ResourceResponse::ResourceResponse):
556         * platform/network/cf/ResourceResponseCFNet.cpp:
557         (WebCore::ResourceResponse::cfURLResponse):
558         (WebCore::ResourceResponse::platformCertificateInfo):
559         * platform/network/cf/SynchronousLoaderClientCFNet.cpp:
560         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
561         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
562         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
563         (WebCore::adjustMIMETypeIfNecessary):
564         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
565         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
566         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
567         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
568         * platform/network/cocoa/CredentialCocoa.h:
569         * platform/network/cocoa/CredentialCocoa.mm:
570         (WebCore::Credential::Credential): Deleted.
571         (WebCore::Credential::cfCredential): Deleted.
572         * platform/network/cocoa/ProtectionSpaceCocoa.h:
573         * platform/network/cocoa/ProtectionSpaceCocoa.mm:
574         (WebCore::ProtectionSpace::ProtectionSpace): Deleted.
575         (WebCore::ProtectionSpace::cfSpace): Deleted.
576         * platform/network/cocoa/ResourceRequestCocoa.mm:
577         (WebCore::ResourceRequest::nsURLRequest):
578         * platform/network/cocoa/ResourceResponseCocoa.mm:
579         (WebCore::ResourceResponse::platformCertificateInfo):
580         (WebCore::ResourceResponse::nsURLResponse): Deleted.
581         (WebCore::ResourceResponse::ResourceResponse): Deleted.
582         * platform/network/ios/QuickLook.h:
583         * platform/network/ios/QuickLook.mm:
584         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
585         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
586         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
587         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
588         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
589         (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
590         (WebCore::QuickLookHandle::create): Deleted.
591         (WebCore::QuickLookHandle::cfResponse): Deleted.
592         * platform/network/ios/ResourceHandleIOS.mm: Removed.
593         * platform/network/ios/ResourceRequestIOS.mm: Removed.
594         * platform/network/mac/AuthenticationMac.mm:
595         (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted.
596         (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted.
597         (WebCore::core): Deleted.
598         (WebCore::mac): Deleted.
599         * platform/network/mac/CookieJarMac.mm:
600         (WebCore::setCookiesFromDOM):
601         (WebCore::cookieStorage):
602         (WebCore::addCookie):
603         * platform/network/mac/CredentialStorageMac.mm:
604         * platform/network/mac/FormDataStreamMac.h:
605         * platform/network/mac/FormDataStreamMac.mm:
606         * platform/network/mac/ResourceErrorMac.mm:
607         (NSErrorFromCFError): Deleted.
608         (WebCore::ResourceError::ResourceError): Deleted.
609         (WebCore::ResourceError::nsError): Deleted.
610         (WebCore::ResourceError::operator NSError *): Deleted.
611         * platform/network/mac/ResourceHandleMac.mm:
612         (WebCore::ResourceHandle::continueWillCacheResponse):
613         (WebCore::ResourceHandle::getConnectionTimingData): Deleted.
614         * platform/network/mac/ResourceRequestMac.mm: Removed.
615         * platform/network/mac/SynchronousLoaderClient.mm:
616         (WebCore::SynchronousLoaderClient::platformBadResponseError):
617         * platform/network/mac/WebCoreResourceHandleAsDelegate.h:
618         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
619         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
620         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
621         * platform/network/mac/WebCoreURLResponse.mm:
622         (WebCore::synthesizeRedirectResponseIfNecessary):
623         * platform/win/TemporaryLinkStubs.cpp:
624         * testing/js/WebCoreTestSupportPrefix.h:
625
626 2016-10-10  Sam Weinig  <sam@webkit.org>
627
628         Use IDLTypes in more places
629         https://bugs.webkit.org/show_bug.cgi?id=163247
630
631         Reviewed by Darin Adler.
632
633         Switch JS -> Native type conversions to use convert<IDLType>(...) rather
634         than convert<NativeType>(...). This allows us to differentiate things like
635         conversion from JSValue to DOMString vs. JSValue to USVString which have different
636         rules.
637
638         * bindings/generic/IDLTypes.h:
639         Add predicate for integer types.
640
641         * bindings/js/IDBBindingUtilities.cpp:
642         (WebCore::idbKeyPathFromValue):
643         * bindings/js/JSApplePaySessionCustom.cpp:
644         (WebCore::JSApplePaySession::completeShippingMethodSelection):
645         (WebCore::JSApplePaySession::completeShippingContactSelection):
646         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
647         (WebCore::createAesKeyGenParams):
648         (WebCore::createRsaKeyGenParams):
649         * bindings/js/JSCustomElementRegistryCustom.cpp:
650         (WebCore::JSCustomElementRegistry::define):
651         * bindings/js/JSDocumentCustom.cpp:
652         (WebCore::JSDocument::getCSSCanvasContext):
653         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
654         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
655         (WebCore::toDecision):
656         * bindings/js/JSNodeFilterCustom.cpp:
657         (WebCore::JSNodeFilter::acceptNode):
658         Switch to new convert<IDLType> style.
659
660         * bindings/js/JSDOMBinding.h:
661         (WebCore::toRefPtrNativeArray): Deleted.
662         (WebCore::toNativeArray): Deleted.
663         These can now be called as convert<IDLSequence<IDLInterface<T>>> and convert<IDLType> respectively.
664
665         * bindings/js/JSDOMConvert.h:
666         (WebCore::Converter<IDLNullable<T>>::convert):
667         (WebCore::Converter<IDLBoolean>::convert):
668         (WebCore::Converter<IDLInterface<T>>::convert):
669         (WebCore::Converter<IDLByte>::convert):
670         (WebCore::Converter<IDLOctet>::convert):
671         (WebCore::Converter<IDLShort>::convert):
672         (WebCore::Converter<IDLUnsignedShort>::convert):
673         (WebCore::Converter<IDLLong>::convert):
674         (WebCore::Converter<IDLUnsignedLong>::convert):
675         (WebCore::Converter<IDLLongLong>::convert):
676         (WebCore::Converter<IDLUnsignedLongLong>::convert):
677         (WebCore::Converter<IDLFloat>::convert):
678         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
679         (WebCore::Converter<IDLDouble>::convert):
680         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
681         (WebCore::Converter<IDLDOMString>::convert):
682         (WebCore::Converter<IDLUSVString>::convert):
683         (WebCore::Detail::ArrayConverter::convert):
684         (WebCore::Converter<IDLSequence<T>>::convert):
685         (WebCore::Converter<IDLFrozenArray<T>>::convert):
686         (WebCore::Converter<IDLDictionary<T>>::convert):
687         (WebCore::Converter<IDLEnumeration<T>>::convert):
688         (WebCore::Detail::VariadicConverterBase::convert):
689         (WebCore::Detail::VariadicConverterBase<IDLInterface<T>>::convert):
690         (WebCore::convertVariadicArguments):
691         (WebCore::convertWrapperType): Deleted.
692         (WebCore::convertWrapperTypeSequence): Deleted.
693         (WebCore::Converter<bool>::convert): Deleted.
694         (WebCore::Converter<String>::convert): Deleted.
695         (WebCore::Converter<Vector<T>>::convert): Deleted.
696         (WebCore::Converter<int8_t>::convert): Deleted.
697         (WebCore::Converter<uint8_t>::convert): Deleted.
698         (WebCore::Converter<int16_t>::convert): Deleted.
699         (WebCore::Converter<uint16_t>::convert): Deleted.
700         (WebCore::Converter<int32_t>::convert): Deleted.
701         (WebCore::Converter<uint32_t>::convert): Deleted.
702         (WebCore::Converter<int64_t>::convert): Deleted.
703         (WebCore::Converter<uint64_t>::convert): Deleted.
704         Switch Converter to be specialized on IDLTypes. Add support for IDLNullable, IDLSequence, and IDLFrozenArray.
705
706         * bindings/scripts/CodeGenerator.pm:
707         (GetFlattenedMemberTypes): Deleted.
708         (GetNumberOfNullableMemberTypes): Deleted.
709         (GetIDLUnionMemberTypes): Deleted.
710         (GetBaseIDLType): Deleted.
711         (GetIDLType): Deleted.
712         Move IDLType conversion logic to CodeGeneratorJS so it can use GetEnumerationClassName and GetDictionaryClassName.
713
714         * bindings/scripts/CodeGeneratorJS.pm:
715         (AddToImplIncludesForIDLType):
716         Add support for sequences, FrozenArrays and external dictionaries.
717
718         (GenerateEnumerationsImplementationContent):
719         (GenerateEnumerationsHeaderContent):
720         Change the name of parse<enum> and convert<enum> to parseEnumeration<enum> and convertEnumeration<enum>
721         to make them more consistent with dictionary conversion specialization and not interfere with the convert
722         function specialization.
723
724         (GenerateDictionaryImplementationContent):
725         Simplify by using convert<IDLType>.
726
727         (GetFlattenedMemberTypes):
728         (GetNumberOfNullableMemberTypes):
729         (GetIDLUnionMemberTypes):
730         (GetBaseIDLType):
731         (GetIDLType):
732         Moved from CodeGenerator.pm
733
734         (IsHandledByDOMConvert):
735         (JSValueToNative):
736         Start switching JSValueToNative over to using convert<IDLType>. Use IsHandledByDOMConvert as a predicate
737         for what is supported.
738
739         * bindings/scripts/IDLParser.pm:
740         (applyTypedefs):
741         (cloneType):
742         (applyTypedefsForSignature):
743         (parseTypedef):
744         (parseOperationOrIterator):
745         (parseSpecialOperation):
746         Make typedefs work with aggregate types (unions, sequences and FrozenArrays).
747
748         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
749         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
750         * bindings/scripts/test/JS/JSTestObj.cpp:
751         * bindings/scripts/test/JS/JSTestObj.h:
752         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
753         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
754         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
755         Update test results.
756
757         * bindings/scripts/test/TestTypedefs.idl:
758         Add additional tests for typedefs that use unions and sequences.
759
760         * testing/InternalSettings.idl:
761         Change the name of a parameter to avoid a name collision.
762
763 2016-10-11  Konstantin Tokarev  <annulen@yandex.ru>
764
765         Fixed compilation with !ENABLE(SVG_FONTS)
766         https://bugs.webkit.org/show_bug.cgi?id=163281
767
768         Reviewed by Csaba Osztrogon√°c.
769
770         No new tests needed.
771
772         * loader/cache/CachedResourceLoader.cpp:
773         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
774
775 2016-10-11  Brent Fulgham  <bfulgham@apple.com>
776
777         Unreviewed build fix after r207140.
778
779         * PlatformAppleWin.cmake: Add missing compile file.
780
781 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
782
783         [Win][Direct2D] Add initial Pattern handling implementation
784         https://bugs.webkit.org/show_bug.cgi?id=163270
785
786         Reviewed by Simon Fraser.
787
788         Provide an implemenation of Patterns for Direct2D.
789
790         No new tests. Covered by fast/borders/border-image-01.html and others.
791
792         * platform/graphics/GraphicsContext.h:
793         * platform/graphics/Pattern.h: Add D2D definitions.
794         * platform/graphics/win/GraphicsContextDirect2D.cpp:
795         (WebCore::GraphicsContext::solidStrokeBrush): Use a more generic return type.
796         (WebCore::GraphicsContext::solidFillBrush): Ditto.
797         (WebCore::GraphicsContext::patternStrokeBrush): Added.
798         (WebCore::GraphicsContext::patternFillBrush): Added.
799         (WebCore::GraphicsContext::drawPattern): Provide D2D implementation.
800         (WebCore::GraphicsContext::applyStrokePattern): Ditto.
801         (WebCore::GraphicsContext::applyFillPattern): Ditto.
802         (WebCore::GraphicsContext::drawPath): Use stroke pattern if available.
803         (WebCore::GraphicsContext::fillPath): Use fill pattern if available.
804         (WebCore::GraphicsContext::strokePath): Use stroke pattern if available.
805         (WebCore::GraphicsContext::fillRect): Use fill pattern if available.
806         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
807         * platform/graphics/win/PatternDirect2D.cpp: Added.
808
809 2016-10-11  Per Arne Vollan  <pvollan@apple.com>
810
811         [Win] Compile fix.
812         https://bugs.webkit.org/show_bug.cgi?id=163272
813
814         Reviewed by Brent Fulgham.
815
816         When compiling with older SDKs, some CoreText symbols are redefined.
817         This patch checks if the relevant CoreText header file has been
818         included before defining the symbol.
819
820         * platform/spi/win/CoreTextSPIWin.h:
821
822 2016-10-11  Antoine Quint  <graouts@apple.com>
823
824         [Modern Media Controls] Buttons container
825         https://bugs.webkit.org/show_bug.cgi?id=163238
826         <rdar://problem/28701864>
827
828         Reviewed by Dean Jackson.
829
830         We add a new ButtonsContainer class which contains a group of Button objects
831         and positions them based on the provided padding and margin between buttons.
832         Buttons that aren't enabled or marked as dropped are not added to the tree of
833         LayoutNodes, and thus the DOM.
834
835         Additionally, we fix a few issues we found while working on tests for ButtonsContainer
836         where LayoutNodes would schedule layout callbacks even when they would not do any work
837         during the layout callback due to not resetting the `needsLayout` flag to false and
838         removing any scheduled tasks when a layout was completed.
839
840         Finally, we fix a few style issues that had not been caught so far and an unused
841         `size` property on IconButton.
842
843         Tests: media/modern-media-controls/buttons-container/buttons-container-buttons-property.html
844                media/modern-media-controls/buttons-container/buttons-container-constructor.html
845                media/modern-media-controls/buttons-container/buttons-container-layout.html
846
847         * Modules/modern-media-controls/controls/airplay-button.js:
848         (AirplayButton.prototype.set on):
849         (AirplayButton):
850         * Modules/modern-media-controls/controls/buttons-container.css:
851         (.buttons-container):
852         * Modules/modern-media-controls/controls/buttons-container.js:
853         (ButtonsContainer.prototype.get buttons):
854         (ButtonsContainer.prototype.set buttons):
855         (ButtonsContainer.prototype.layout):
856         * Modules/modern-media-controls/controls/icon-button.js:
857         * Modules/modern-media-controls/controls/layout-node.js:
858         (LayoutNode.prototype.set needsLayout):
859         (LayoutNode.prototype.markDirtyProperty):
860         (LayoutNode.prototype._markNodeManipulation):
861         (LayoutNode.prototype._updateDirtyState):
862         (performScheduledLayout):
863         (elementFromString):
864         * Modules/modern-media-controls/controls/scheduler.js:
865         (const.scheduler.new.prototype.unscheduleLayout):
866
867 2016-10-11  Youenn Fablet  <youenn@apple.com>
868
869         [Fetch API] Support Request cache mode
870         https://bugs.webkit.org/show_bug.cgi?id=162281
871
872         Reviewed by Alex Christensen.
873
874         Covered by updated test.
875
876         Added support for only-if-cached mode at Request level.
877
878         Added support for cache mode at CachedResourceLoader, by setting HTTP headers and ResourceRequest cache policy
879         based on https://fetch.spec.whatwg.org/#concept-request-cache-mode and https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
880
881         Disabled default cache policy computation (done in FrameLoader) when cache mode is different from the default.
882         Activated no-store cache mode for EventSource as per https://html.spec.whatwg.org/#the-eventsource-interface.
883
884         * Modules/fetch/FetchRequest.cpp:
885         (WebCore::setCache): Adding support for only-if-cached.
886         (WebCore::buildOptions): Throw if only-if-cached and fetch mode is not same-origin.
887         * loader/FetchOptions.h: Adding support for only-if-cached.
888         * loader/FrameLoader.cpp:
889         (WebCore::FrameLoader::defaultRequestCachingPolicy): Introduced to ease readability.
890         (WebCore::FrameLoader::addExtraFieldsToRequest): Updating cache policy only if request has the default cache policy.
891         This allows bypassing the default behavior for fetch cache mode different from "default".
892         * loader/FrameLoader.h:
893         * loader/cache/CachedResourceLoader.cpp:
894         (WebCore::updateRequestAccordingCacheMode): Introduced to set headers and request cache policy according fetch cache mode.
895         (WebCore::CachedResourceLoader::requestResource):
896         (WebCore::CachedResourceLoader::loadResource):
897         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Ensure bypassing the memory cache in no-store and reload cases.
898         We reload in case of cache mode=reload to refresh the meory cache entry.
899         * loader/cache/CachedResourceRequest.h:
900         (WebCore::CachedResourceRequest::setCacheModeToNoStore):
901         * page/EventSource.cpp:
902         (WebCore::EventSource::connect): Use no-store cache mode as per https://html.spec.whatwg.org/#the-eventsource-interface.
903         * platform/network/HTTPHeaderMap.cpp:
904         (WebCore::HTTPHeaderMap::addIfNotPresent): Helper routine.
905         * platform/network/HTTPHeaderMap.h:
906         * platform/network/HTTPHeaderValues.cpp:
907         * platform/network/HTTPHeaderValues.h:
908         * platform/network/ResourceRequestBase.cpp:
909         (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent):
910         (WebCore::ResourceRequestBase::addHTTPHeaderField):
911         (WebCore::ResourceRequestBase::hasHTTPHeaderField):
912         * platform/network/ResourceRequestBase.h:
913
914 2016-10-10  Antti Koivisto  <antti@apple.com>
915
916         Stop copying author shadow pseudo rules into shadow tree style resolver
917         https://bugs.webkit.org/show_bug.cgi?id=163232
918
919         Reviewed by Darin Adler.
920
921         * css/ElementRuleCollector.cpp:
922         (WebCore::ElementRuleCollector::collectMatchingRules):
923         (WebCore::ElementRuleCollector::matchAuthorRules):
924         (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
925
926             If we are resolving a user agent shadow tree also look up pseudo element rules from the host scope author sheet.
927             This is needed to keep web exposed ::-webkit-foo pseudo elements working.
928
929         (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
930
931             Factor to a function.
932
933         * css/ElementRuleCollector.h:
934         * css/RuleSet.cpp:
935         (WebCore::RuleSet::copyShadowPseudoElementRulesFrom): Deleted.
936         * css/RuleSet.h:
937         * dom/Document.cpp:
938         (WebCore::Document::userAgentShadowTreeStyleResolver):
939         * style/StyleScope.cpp:
940         (WebCore::Style::Scope::updateStyleResolver):
941
942             No need to awkwardly copy these rules anymore.
943
944 2016-10-11  Chris Dumez  <cdumez@apple.com>
945
946         Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
947         https://bugs.webkit.org/show_bug.cgi?id=163266
948
949         Reviewed by Darin Adler.
950
951         Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
952         and use a regular constructor instead, as in the specification:
953         - http://w3c.github.io/IndexedDB/#request-idbversionchangeevent
954
955         This patch also fixes a bug where the IDBVersionChangeEvent was ignoring the
956         EventInit dictionary members passed by the JavaScript (e.g. bubbles).
957
958         No new tests, updated existing test.
959
960         * Modules/indexeddb/IDBVersionChangeEvent.cpp:
961         (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
962         * Modules/indexeddb/IDBVersionChangeEvent.h:
963         * Modules/indexeddb/IDBVersionChangeEvent.idl:
964         * bindings/js/JSDOMConvert.h:
965         (WebCore::convertNullable):
966         (WebCore::convert): Deleted.
967         * bindings/scripts/CodeGeneratorJS.pm:
968         (GenerateDefaultValue):
969         (GenerateDictionaryImplementationContent):
970         * bindings/scripts/test/JS/JSTestObj.cpp:
971         (WebCore::convertDictionary<TestObj::Dictionary>):
972         * bindings/scripts/test/TestObj.idl:
973
974 2016-10-11  Chris Dumez  <cdumez@apple.com>
975
976         Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy [ConstructorTemplate=Event]
977         https://bugs.webkit.org/show_bug.cgi?id=163265
978
979         Reviewed by Darin Adler.
980
981         Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy
982         [ConstructorTemplate=Event] and use a regular constructor instead.
983
984         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp:
985         (WebCore::WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent):
986         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h:
987         (WebCore::WebKitPlaybackTargetAvailabilityEvent::createForBindings):
988         (WebCore::WebKitPlaybackTargetAvailabilityEvent::~WebKitPlaybackTargetAvailabilityEvent): Deleted.
989         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl:
990
991 2016-10-10  Zan Dobersek  <zdobersek@igalia.com>
992
993         Add ENABLE_ENCRYPTED_MEDIA configuration option
994         https://bugs.webkit.org/show_bug.cgi?id=163219
995
996         Reviewed by Darin Adler.
997
998         * Configurations/FeatureDefines.xcconfig:
999         Add the ENABLE_ENCRYPTED_MEDIA configuration option. It will be used
1000         to enable or disable the new EME implementation at build-time.
1001         * DerivedSources.make: Group the legacy option and the new option together.
1002
1003 2016-10-10  Youenn Fablet  <youenn@apple.com>
1004
1005         CachedResourceRequest constructor should be made more efficient
1006         https://bugs.webkit.org/show_bug.cgi?id=163210
1007
1008         Reviewed by Alex Christensen.
1009
1010         No change of behavior.
1011
1012         Refactoring to use one CachedResourceRequest constructor that will move its request and charset to improve efficiency.
1013
1014         * css/StyleRuleImport.cpp:
1015         (WebCore::StyleRuleImport::requestStyleSheet):
1016         * dom/ProcessingInstruction.cpp:
1017         (WebCore::ProcessingInstruction::checkStyleSheet):
1018         * html/HTMLLinkElement.cpp:
1019         (WebCore::HTMLLinkElement::process):
1020         * html/parser/HTMLResourcePreloader.cpp:
1021         (WebCore::PreloadRequest::resourceRequest):
1022         * loader/cache/CachedResourceRequest.cpp:
1023         (WebCore::CachedResourceRequest::CachedResourceRequest):
1024         * loader/cache/CachedResourceRequest.h:
1025
1026 2016-10-10  Adam Bergkvist  <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com>
1027
1028         WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
1029         https://bugs.webkit.org/show_bug.cgi?id=163202
1030
1031         Reviewed by Eric Carlson.
1032
1033         An RTCRtpTransceiver has a null mid until it's been associated with a
1034         media description (with a mid) [1]. During that time, it's identified by
1035         a provisional mid that might become its real mid, but the transceiver
1036         can also get its mid assigned by a remote media description. In the
1037         second case, the mid value is initially unknown. A transceiver's
1038         RTCRtpSender must directly (synchronously in the script) provide a muted
1039         remote source that is playable by, for example, a media element. This
1040         source is initially registered in the MediaEndpoint (WebRTC backend)
1041         with the transceiver's provisional mid. So, if the real mid is set by a
1042         remote description, the registered mid must be updated to preserve the
1043         association between the registered source and the transceiver.
1044
1045         [1] https://w3c.github.io/webrtc-pc/archives/20160913/webrtc.html#dom-rtcrtptransceiver-mid
1046
1047         Test: fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html
1048
1049         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1050         Don't break after finding the first transceiver in the loop that builds the send source map.
1051         Update the mid used to register the muted remote source if the a transceiver's mid gets
1052         assigned by a remote media description.
1053         (WebCore::createSourceMap):
1054         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
1055         * platform/mediastream/MediaEndpoint.cpp:
1056         * platform/mediastream/MediaEndpoint.h:
1057         * platform/mock/MockMediaEndpoint.cpp:
1058         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
1059         (WebCore::MockMediaEndpoint::updateReceiveConfiguration):
1060         (WebCore::MockMediaEndpoint::updateSendConfiguration):
1061         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
1062         (WebCore::MockMediaEndpoint::replaceMutedRemoteSourceMid):
1063         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
1064         Add "unmute-remote-sources-by-mid" action that emulates data arriving on media descriptions
1065         which unmutes the remote sources.
1066         (WebCore::MockMediaEndpoint::updateConfigurationMids):
1067         (WebCore::MockMediaEndpoint::unmuteRemoteSourcesByMid):
1068         (WebCore::MockMediaEndpoint::unmuteTimerFired):
1069         * platform/mock/MockMediaEndpoint.h:
1070
1071 2016-10-10  Darin Adler  <darin@apple.com>
1072
1073         Move audio module off of legacy exceptions
1074         https://bugs.webkit.org/show_bug.cgi?id=163269
1075
1076         Reviewed by Alex Christensen.
1077
1078         * Modules/webaudio/AnalyserNode.cpp:
1079         (WebCore::AnalyserNode::setFftSize): Use ExceptionOr.
1080         (WebCore::AnalyserNode::setMinDecibels): Ditto.
1081         (WebCore::AnalyserNode::setMaxDecibels): Ditto.
1082         (WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto.
1083         * Modules/webaudio/AnalyserNode.h: Update for above.
1084         * Modules/webaudio/AnalyserNode.idl: Ditto.
1085
1086         * Modules/webaudio/AudioBasicInspectorNode.cpp:
1087         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
1088         Initialize m_needAutomaticPull in class definition.
1089         (WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr.
1090         (WebCore::AudioBasicInspectorNode::disconnect): Ditto.
1091         * Modules/webaudio/AudioBasicInspectorNode.h: Updated for above.
1092
1093         * Modules/webaudio/AudioBuffer.cpp:
1094         (WebCore::AudioBuffer::createFromAudioFileData): Use reference.
1095         (WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition.
1096         (WebCore::AudioBuffer::getChannelData): Use ExceptionOr.
1097         (WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData.
1098         (WebCore::AudioBuffer::zero): Use modern for loop.
1099         * Modules/webaudio/AudioBuffer.h: Update for above.
1100         * Modules/webaudio/AudioBuffer.idl: Ditto.
1101
1102         * Modules/webaudio/AudioBufferSourceNode.cpp:
1103         (WebCore::AudioBufferSourceNode::process): Use reference.
1104         (WebCore::AudioBufferSourceNode::setBuffer): Use channelData.
1105         (WebCore::AudioBufferSourceNode::start): Use ExceptionOr.
1106         (WebCore::AudioBufferSourceNode::startPlaying): Ditto.
1107         * Modules/webaudio/AudioBufferSourceNode.h: Update for above.
1108         * Modules/webaudio/AudioBufferSourceNode.idl: Ditto.
1109
1110         * Modules/webaudio/AudioContext.cpp:
1111         (WebCore::AudioContext::createBuffer): Use ExceptionOr.
1112         (WebCore::AudioContext::createMediaElementSource): Ditto.
1113         (WebCore::AudioContext::createMediaStreamSource): Ditto.
1114         (WebCore::AudioContext::createScriptProcessor): Ditto.
1115         (WebCore::AudioContext::createDelay): Ditto.
1116         (WebCore::AudioContext::createChannelSplitter): Ditto.
1117         (WebCore::AudioContext::createChannelMerger): Ditto.
1118         (WebCore::AudioContext::createPeriodicWave): Ditto.
1119         * Modules/webaudio/AudioContext.h: Update for above.
1120         * Modules/webaudio/AudioContext.idl: Ditto.
1121
1122         * Modules/webaudio/AudioDestinationNode.h: Use unsigned instead
1123         of unsigned long for maxChannelCount.
1124
1125         * Modules/webaudio/AudioNode.cpp:
1126         (WebCore::AudioNode::connect): Use ExceptionOr.
1127         (WebCore::AudioNode::disconnect): Ditto.
1128         (WebCore::AudioNode::channelCount): Use unsigned.
1129         (WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned.
1130         (WebCore::AudioNode::setChannelCountMode): Ditto.
1131         (WebCore::AudioNode::setChannelInterpretation): Ditto.
1132         * Modules/webaudio/AudioNode.h: Update for above.
1133         * Modules/webaudio/AudioNode.idl: Ditto.
1134
1135         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1136         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
1137         Initialize data members in class definition.
1138         (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take
1139         a reference instead of a pointer to the audio bus.
1140         (WebCore::AudioScheduledSourceNode::start): Use ExceptionOr.
1141         (WebCore::AudioScheduledSourceNode::stop): Ditto.
1142         * Modules/webaudio/AudioScheduledSourceNode.h: Update for above.
1143
1144         * Modules/webaudio/ConvolverNode.cpp:
1145         (WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize
1146         in class definition.
1147         (WebCore::ConvolverNode::setBuffer): Use ExceptionOr.
1148         * Modules/webaudio/ConvolverNode.h: Update for above.
1149         * Modules/webaudio/ConvolverNode.idl: Ditto.
1150
1151         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1152         (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
1153         Initialize m_numberOfInputChannels in class definition.
1154         (WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned.
1155         (WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr.
1156         * Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above.
1157
1158         * Modules/webaudio/DelayNode.cpp:
1159         (WebCore::DelayNode::DelayNode): Moved exception logic out of constructor.
1160         (WebCore::DelayNode::create): Added. Moved exception logic in here.
1161         (WebCore::DelayNode::delayTime): Moved typecast here from header.
1162         * Modules/webaudio/DelayNode.h: Update for above.
1163
1164         * Modules/webaudio/OfflineAudioContext.cpp:
1165         (WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline.
1166         (WebCore::OfflineAudioContext::create): Use ExceptionOr.
1167         (WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded.
1168         * Modules/webaudio/OfflineAudioContext.h: Update for above.
1169         * Modules/webaudio/OfflineAudioContext.idl: Ditto.
1170
1171         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
1172         (WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData.
1173
1174         * Modules/webaudio/OscillatorNode.cpp:
1175         (WebCore::OscillatorNode::OscillatorNode): Updated for change to setType.
1176         (WebCore::OscillatorNode::setType): Use ExceptionOr.
1177         (WebCore::OscillatorNode::process): Use a reference.
1178         * Modules/webaudio/OscillatorNode.h: Update for above.
1179         * Modules/webaudio/OscillatorNode.idl: Ditto.
1180
1181         * Modules/webaudio/ScriptProcessorNode.cpp:
1182         (WebCore::ScriptProcessorNode::process): Use channelData.
1183
1184         * bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on
1185         references to array buffers and array buffer views, not just pointers.
1186
1187 2016-10-10  Youenn Fablet  <youenn@apple.com>
1188
1189         Change HTTPHeaderValues from a struct to a namespace
1190         https://bugs.webkit.org/show_bug.cgi?id=163203
1191
1192         Reviewed by Alex Christensen.
1193
1194         No change of behavior.
1195
1196         * Modules/fetch/FetchBody.cpp:
1197         (WebCore::FetchBody::extract):
1198         * platform/network/HTTPHeaderValues.cpp:
1199         (WebCore::HTTPHeaderValues::textPlainContentType):
1200         (WebCore::HTTPHeaderValues::formURLEncodedContentType):
1201         (WebCore::HTTPHeaderValues::TextPlainContentType): Deleted.
1202         (WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted.
1203         * platform/network/HTTPHeaderValues.h:
1204         * xml/XMLHttpRequest.cpp:
1205         (WebCore::XMLHttpRequest::send):
1206
1207 2016-10-10  Chris Dumez  <cdumez@apple.com>
1208
1209         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
1210         https://bugs.webkit.org/show_bug.cgi?id=163254
1211
1212         Reviewed by Darin Adler.
1213
1214         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
1215         and use a regular constructor instead, as in the specification:
1216         - https://www.w3.org/TR/uievents/#interface-mouseevent
1217         - https://www.w3.org/TR/uievents/#interface-wheelevent
1218
1219         * CMakeLists.txt:
1220         * DerivedSources.cpp:
1221         * DerivedSources.make:
1222         * WebCore.xcodeproj/project.pbxproj:
1223
1224         * bindings/scripts/CodeGeneratorJS.pm:
1225         (GenerateHeader):
1226         (GenerateDictionaryHeader):
1227         Fix our broken dependency tracking when it comes to dictionaries.
1228
1229         * dom/MouseEvent.cpp:
1230         (WebCore::MouseEvent::create):
1231         (WebCore::MouseEvent::MouseEvent):
1232         * dom/MouseEvent.h:
1233         * dom/MouseEvent.idl:
1234         * dom/MouseEventInit.h: Added.
1235         * dom/MouseEventInit.idl: Added.
1236         * dom/MouseRelatedEvent.cpp:
1237         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1238         * dom/MouseRelatedEvent.h:
1239         * dom/UIEventWithKeyState.h:
1240         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1241         * dom/WheelEvent.cpp:
1242         (WebCore::WheelEvent::WheelEvent):
1243         * dom/WheelEvent.h:
1244         * dom/WheelEvent.idl:
1245
1246 2016-10-10  Chris Dumez  <cdumez@apple.com>
1247
1248         Add support for languagechange event
1249         https://bugs.webkit.org/show_bug.cgi?id=163222
1250
1251         Reviewed by Ryosuke Niwa.
1252
1253         Add support for languagechange event:
1254         - https://html.spec.whatwg.org/#dom-navigator-languages
1255
1256         Firefox and Chrome already support this.
1257
1258         Test: fast/dom/window-languagechange-event.html
1259
1260         * dom/EventNames.h:
1261         * html/HTMLAttributeNames.in:
1262         * html/HTMLBodyElement.cpp:
1263         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
1264         * page/DOMWindow.cpp:
1265         (WebCore::languagesChangedCallback):
1266         (WebCore::DOMWindow::DOMWindow):
1267         (WebCore::DOMWindow::~DOMWindow):
1268         (WebCore::DOMWindow::languagesChanged):
1269         (WebCore::DOMWindow::canShowModalDialog): Deleted.
1270         (WebCore::DOMWindow::removeEventListener): Deleted.
1271         * page/DOMWindow.h:
1272         * page/WindowEventHandlers.idl:
1273
1274 2016-10-10  Chris Dumez  <cdumez@apple.com>
1275
1276         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
1277         https://bugs.webkit.org/show_bug.cgi?id=163243
1278
1279         Reviewed by Darin Adler.
1280
1281         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
1282         and use a proper constructor as in the specification:
1283         - https://w3c.github.io/gamepad/#gamepadevent-interface
1284
1285         * Modules/gamepad/GamepadEvent.cpp:
1286         (WebCore::GamepadEvent::GamepadEvent):
1287         * Modules/gamepad/GamepadEvent.h:
1288         (WebCore::GamepadEvent::create):
1289         (WebCore::GamepadEvent::~GamepadEvent): Deleted.
1290         * Modules/gamepad/GamepadEvent.idl:
1291
1292 2016-10-10  Darin Adler  <darin@apple.com>
1293
1294         Move Fetch from legacy to new DOM exceptions
1295         https://bugs.webkit.org/show_bug.cgi?id=163195
1296
1297         Reviewed by Chris Dumez.
1298
1299         * Modules/fetch/FetchHeaders.cpp:
1300         (WebCore::canWriteHeader): Use ExceptionOr.
1301         (WebCore::FetchHeaders::append): Ditto.
1302         (WebCore::FetchHeaders::remove): Ditto.
1303         (WebCore::FetchHeaders::get): Ditto.
1304         (WebCore::FetchHeaders::has): Ditto.
1305         (WebCore::FetchHeaders::set): Ditto.
1306         (WebCore::FetchHeaders::filterAndFill): Ditto.
1307         (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to
1308         clear out m_keys after the last call to next, since it will be deleted
1309         as soon as the iterator is deleted.
1310
1311         * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr.
1312
1313         * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions.
1314
1315         * Modules/fetch/FetchRequest.cpp:
1316         (WebCore::FetchRequest::setBody): Use ExceptionOr.
1317         (WebCore::FetchRequest::clone): Ditto.
1318
1319         * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr.
1320
1321         * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions.
1322
1323         * Modules/fetch/FetchResponse.cpp:
1324         (WebCore::FetchResponse::redirect): Use ExceptionOr.
1325         (WebCore::FetchResponse::setStatus): Ditto.
1326
1327         * Modules/fetch/FetchResponse.h: Use ExceptionOr.
1328
1329         * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions.
1330
1331         * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString.
1332
1333         * bindings/scripts/CodeGeneratorJS.pm:
1334         (NativeToJSValue): Call toJSNullableString and toJSString for
1335         functions that return ExceptionOr<String>.
1336
1337 2016-10-10  Nan Wang  <n_wang@apple.com>
1338
1339         AX: Expose invalid status for input types with that information
1340         https://bugs.webkit.org/show_bug.cgi?id=163252
1341         <rdar://problem/28704409>
1342
1343         Reviewed by Chris Fleizach.
1344
1345         For input types with invalid input value, we should expose the invalid 
1346         status to the assitive technology.
1347
1348         Test: accessibility/mac/invalid-status-for-input-types.html
1349
1350         * accessibility/AccessibilityObject.cpp:
1351         (WebCore::AccessibilityObject::invalidStatus):
1352
1353 2016-10-10  Konstantin Tokarev  <annulen@yandex.ru>
1354
1355         Added override specifier to PluginViewBase::isPluginViewBase()
1356         https://bugs.webkit.org/show_bug.cgi?id=163218
1357
1358         Reviewed by Alex Christensen.
1359
1360         No new tests needed.
1361
1362         * plugins/PluginViewBase.h:
1363
1364 2016-10-10  Alex Christensen  <achristensen@webkit.org>
1365
1366         Don't run SecurityOrigin's port through URLParser
1367         https://bugs.webkit.org/show_bug.cgi?id=163253
1368
1369         Reviewed by Brady Eidson.
1370
1371         No change in behavior.
1372
1373         * page/SecurityOrigin.cpp:
1374         (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier):
1375         (WebCore::SecurityOrigin::create):
1376         We used to parse URLs like "file://:0/" which are valid when using URL::parse
1377         but aren't valid when we start using the URLParser, which matches other browsers' failure
1378         to parse URLs with a port but no host. There is no reason to write and parse the port.
1379         Setting m_port directly accomplishes the same thing.
1380  
1381 2016-10-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1382
1383         <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero
1384         https://bugs.webkit.org/show_bug.cgi?id=138555
1385
1386         Reviewed by Simon Fraser.
1387
1388         Ensure the dashArray has at least one non-zero element before calling
1389         GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle()
1390         instead, if the dashArray does not have one.
1391
1392         * rendering/svg/SVGRenderSupport.cpp:
1393         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
1394
1395 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1396
1397         [Win][Direct2D] Correct Radial Graident Bug
1398         https://bugs.webkit.org/show_bug.cgi?id=163241
1399
1400         Reviewed by Darin Adler.
1401
1402         Radial gradients were not working correctly under Direct2D because the
1403         points and radius values used were incorrect. D2D wants a center point and
1404         an offset, not a start and end point. It wants an X and Y radius (for an
1405         ellipse), not a radius at the start point, and a radius at the end point.
1406
1407         Covered by existing fast/gradients/css-radial-gradients.html (and others).
1408
1409         * platform/graphics/Image.cpp:
1410         (WebCore::Image::drawTiled): Remove 'notImplemented' code path.
1411         * platform/graphics/win/GradientDirect2D.cpp:
1412         (WebCore::Gradient::generateGradient): Use correct input values to
1413         the Radial Gradient constructor.
1414         (WebCore::Gradient::fill): Generate a gradient if we have no active
1415         one to use.
1416
1417 2016-10-10  Jiewen Tan  <jiewen_tan@apple.com>
1418
1419         Rename CryptoAlgorithmParameters to CryptoAlgorithmParametersDeprecated
1420         https://bugs.webkit.org/show_bug.cgi?id=163163
1421         <rdar://problem/28681544>
1422
1423         Reviewed by Brent Fulgham.
1424
1425         Replace all uses of 'CryptoAlgorithmParameters' with 'CryptoAlgorithmParametersDeprecated' in preparation for a new CryptoAlgorithmParameters type.
1426
1427         No changes of behaviors. No new tests.
1428
1429         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1430         * WebCore.xcodeproj/project.pbxproj:
1431         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1432         * bindings/js/JSCryptoAlgorithmDictionary.h:
1433         * bindings/js/JSCryptoKeySerializationJWK.cpp:
1434         * bindings/js/JSCryptoKeySerializationJWK.h:
1435         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1436         * crypto/CryptoAlgorithm.cpp:
1437         * crypto/CryptoAlgorithm.h:
1438         * crypto/CryptoAlgorithmParametersDeprecated.h: Renamed from Source/WebCore/crypto/CryptoAlgorithmParameters.h.
1439         * crypto/CryptoKeySerialization.h:
1440         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1441         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1442         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1443         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1444         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1445         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1446         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1447         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1448         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1449         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1450         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1451         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1452         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1453         * crypto/algorithms/CryptoAlgorithmSHA1.h:
1454         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1455         * crypto/algorithms/CryptoAlgorithmSHA224.h:
1456         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1457         * crypto/algorithms/CryptoAlgorithmSHA256.h:
1458         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1459         * crypto/algorithms/CryptoAlgorithmSHA384.h:
1460         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1461         * crypto/algorithms/CryptoAlgorithmSHA512.h:
1462         * crypto/keys/CryptoKeySerializationRaw.cpp:
1463         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
1464         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
1465         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
1466         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
1467         * crypto/keys/CryptoKeySerializationRaw.h:
1468         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1469         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1470         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1471         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1472         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
1473         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
1474         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h.
1475         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacParams.h.
1476         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h.
1477         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHash.h.
1478         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h.
1479         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaSsaParams.h.
1480
1481 2016-10-10  Darin Adler  <darin@apple.com>
1482
1483         Move NotificationCenter from legacy to new DOM exceptions
1484         https://bugs.webkit.org/show_bug.cgi?id=163217
1485
1486         Reviewed by Chris Dumez.
1487
1488         * Modules/notifications/DOMWindowNotifications.cpp:
1489         (WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to
1490         document instead of pointer. Also use auto and early return.
1491
1492         * Modules/notifications/Notification.cpp:
1493         (WebCore::Notification::Notification): Move checks that can lead to
1494         throwing an exception out of the constructor into the create function.
1495         (WebCore::Notification::create): Changed to use ExceptionOr. Also moved
1496         checks that can lead to throwing an exception here.
1497         (WebCore::Notification::show): Update since NotificationController::client
1498         now returns a reference.
1499         (WebCore::Notification::permission): Ditto.
1500         (WebCore::Notification::requestPermission): Ditto.
1501
1502         * Modules/notifications/Notification.h: Updated for above changes.
1503
1504         * Modules/notifications/NotificationCenter.cpp:
1505         (WebCore::NotificationCenter::create): Take a reference to the script execution
1506         context instead of a pointer.
1507         (WebCore::NotificationCenter::NotificationCenter): Ditto.
1508         (WebCore::NotificationCenter::createNotification): Use ExceptionOr.
1509         (WebCore::NotificationCenter::requestPermission): Take an rvalue reference.
1510
1511         * Modules/notifications/NotificationCenter.h: Use pragma once.
1512         Marked the class final. Updated for changes above.
1513
1514         * Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions.
1515
1516         * Modules/notifications/NotificationController.cpp:
1517         (WebCore::NotificationController::NotificationController): Use a reference rather
1518         than a pointer for m_client, since it is never null.
1519         (WebCore::NotificationController::~NotificationController): Ditto.
1520         (WebCore::NotificationController::clientFrom): Updated for the change above.
1521
1522         * Modules/notifications/NotificationController.h: Updated for the change above.
1523
1524         * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
1525         (WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to
1526         pass a reference for the script execution context. Also added FIXME about the
1527         fact that the client is always null.
1528
1529 2016-10-10  Antoine Quint  <graouts@apple.com>
1530
1531         [Modern Media Controls] Placards
1532         https://bugs.webkit.org/show_bug.cgi?id=163110
1533         <rdar://problem/28669342>
1534
1535         Reviewed by Dean Jackson.
1536
1537         Inline media controls need to display placards when the video is no longer playing inline,
1538         such as when the video is playing fullscreen or via AirPlay. To that end, we introduce a
1539         new Placard class and two subclasses for display during fullscreen or AirPlay playback.
1540         Note that localization will be done in a later patch.
1541
1542         Tests: media/modern-media-controls/airplay-placard/airplay-placard.html
1543                media/modern-media-controls/pip-placard/pip-placard.html
1544                media/modern-media-controls/placard/placard.html
1545
1546         * Modules/modern-media-controls/controls/airplay-placard.js:
1547         (AirplayPlacard):
1548         * Modules/modern-media-controls/controls/icon-service.js:
1549         * Modules/modern-media-controls/controls/pip-placard.js:
1550         (PiPPlacard):
1551         * Modules/modern-media-controls/controls/placard.css:
1552         (.placard):
1553         (.placard .container):
1554         (.placard .icon):
1555         (.placard .title,):
1556         (.placard .title):
1557         (.placard .description):
1558         * Modules/modern-media-controls/controls/placard.js:
1559         (Placard.):
1560         * Modules/modern-media-controls/images/iOS/airplay-placard@1x.png: Added.
1561         * Modules/modern-media-controls/images/iOS/airplay-placard@2x.png: Added.
1562         * Modules/modern-media-controls/images/iOS/airplay-placard@3x.png: Added.
1563         * Modules/modern-media-controls/images/iOS/pip-placard@1x.png: Added.
1564         * Modules/modern-media-controls/images/iOS/pip-placard@2x.png: Added.
1565         * Modules/modern-media-controls/images/iOS/pip-placard@3x.png: Added.
1566         * Modules/modern-media-controls/images/macOS/airplay-placard@1x.png: Added.
1567         * Modules/modern-media-controls/images/macOS/airplay-placard@2x.png: Added.
1568         * Modules/modern-media-controls/images/macOS/pip-placard@1x.png: Added.
1569         * Modules/modern-media-controls/images/macOS/pip-placard@2x.png: Added.
1570
1571 2016-10-10  Chris Dumez  <cdumez@apple.com>
1572
1573         Add support for Navigator.languages attribute
1574         https://bugs.webkit.org/show_bug.cgi?id=163220
1575
1576         Reviewed by Darin Adler.
1577
1578         Add support for Navigator.languages attribute:
1579         - https://html.spec.whatwg.org/#navigatorlanguage
1580
1581         Firefox and Chrome already support this.
1582
1583         Currently, we always return a single language for privacy reasons so
1584         this API does not actually bring anything new besides interoperability
1585         with other browsers and compliance with the HTML specification.
1586
1587         No new tests, rebaselined existing tests.
1588
1589         * page/NavigatorBase.cpp:
1590         (WebCore::NavigatorBase::languages):
1591         * page/NavigatorBase.h:
1592         * page/NavigatorLanguage.idl:
1593
1594 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1595
1596         [Win][Direct2D] Implement dashed and dotted border line drawing
1597         https://bugs.webkit.org/show_bug.cgi?id=163235
1598
1599         Reviewed by Alex Christensen.
1600
1601         Covered by existing fast/border tests.
1602
1603         * platform/graphics/GraphicsContext.cpp: Use custom 'setPlatformStrokeStyle' for D2D.
1604         * platform/graphics/Path.cpp:
1605         (WebCore::Path::length): Don't use default implementation for Direct2D.
1606         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1607         (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Initialize pointer to nullptr.
1608         (WebCore::GraphicsContext::drawRect): Use proper stroke style.
1609         (WebCore::GraphicsContextPlatformPrivate::setLineCap): Added.
1610         (WebCore::GraphicsContextPlatformPrivate::setLineJoin): Added.
1611         (WebCore::GraphicsContextPlatformPrivate::setStrokeStyle): Added.
1612         (WebCore::GraphicsContextPlatformPrivate::setMiterLimit): Added.
1613         (WebCore::GraphicsContextPlatformPrivate::setDashOffset): Added.
1614         (WebCore::GraphicsContextPlatformPrivate::setPatternWidth): Added.
1615         (WebCore::GraphicsContextPlatformPrivate::setPatternOffset): Added.
1616         (WebCore::GraphicsContextPlatformPrivate::setStrokeThickness): Added.
1617         (WebCore::GraphicsContextPlatformPrivate::setDashes): Added.
1618         (WebCore::GraphicsContextPlatformPrivate::recomputeStrokeStyle): Added.
1619         (WebCore::GraphicsContextPlatformPrivate::strokeStyle): Added.
1620         (WebCore::GraphicsContext::drawLine): Use proper stroke style.
1621         (WebCore::GraphicsContext::drawEllipse): Ditto.
1622         (WebCore::GraphicsContext::drawPath): Ditto.
1623         (WebCore::GraphicsContext::strokePath): Ditto.
1624         (WebCore::GraphicsContext::setPlatformStrokeStyle): Added.
1625         (WebCore::GraphicsContext::setMiterLimit): Tell D2D context about miter limit.
1626         (WebCore::GraphicsContext::setLineCap): Ditto for line cap.
1627         (WebCore::GraphicsContext::setLineDash): Ditto for dashes.
1628         (WebCore::GraphicsContext::setLineJoin): Ditto for join style.
1629         (WebCore::GraphicsContext::setPlatformStrokeThickness): Ditto for stroke thickness.
1630         (WebCore::GraphicsContext::platformStrokeEllipse): Use proper stroke style.
1631         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
1632         * platform/graphics/win/PathDirect2D.cpp:
1633         (WebCore::Path::currentPoint): Zero-initialize a value.
1634         (WebCore::Path::length): Added.
1635
1636 2016-10-10  Chris Dumez  <cdumez@apple.com>
1637
1638         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
1639         https://bugs.webkit.org/show_bug.cgi?id=163221
1640
1641         Reviewed by Darin Adler.
1642
1643         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
1644         and use a regular constructor as in the specification:
1645         - https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
1646
1647         * dom/ProgressEvent.cpp:
1648         (WebCore::ProgressEvent::ProgressEvent):
1649         * dom/ProgressEvent.h:
1650         (WebCore::ProgressEvent::create):
1651         * dom/ProgressEvent.idl:
1652
1653 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1654
1655         Address some review feedback from r206979 and r207010
1656         https://bugs.webkit.org/show_bug.cgi?id=163236
1657
1658         Reviewed by Tim Horton.
1659
1660         In TypingCommand.h, some methods on TypingCommand should be marked as final to reflect the fact that they
1661         override methods in CompositeEditCommand. Also, HTMLFormControlElement::dispatchFormControlInputEvent does not
1662         need to specify HTMLElement::dispatchInputEvent() when calling dispatchInputEvent().
1663
1664         No new tests, since there is no behavior change.
1665
1666         * editing/TypingCommand.h:
1667         * html/HTMLFormControlElement.cpp:
1668         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
1669
1670 2016-10-10  Chris Dumez  <cdumez@apple.com>
1671
1672         Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
1673         https://bugs.webkit.org/show_bug.cgi?id=163187
1674
1675         Reviewed by Darin Adler.
1676
1677         Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and
1678         use a regular constructor as in the specification:
1679         - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
1680
1681         No new tests, updated existing test.
1682
1683         * bindings/js/JSDOMBinding.h:
1684         (WebCore::toRefPtrNativeArray):
1685         * bindings/js/JSDOMConvert.h:
1686         (WebCore::convertWrapperTypeSequence):
1687         (WebCore::convertWrapperType): Deleted.
1688         * bindings/scripts/CodeGeneratorJS.pm:
1689         (GenerateDefaultValue):
1690         (GenerateDictionaryImplementationContent):
1691         (GetNativeType):
1692         * dom/MessageEvent.cpp:
1693         (WebCore::MessageEvent::MessageEvent):
1694         (WebCore::MessageEvent::create):
1695         (WebCore::MessageEvent::trySerializeData):
1696         (WebCore::MessageEvent::createForBindings): Deleted.
1697         (WebCore::MessageEvent::initMessageEvent): Deleted.
1698         * dom/MessageEvent.h:
1699         * dom/MessageEvent.idl:
1700
1701 2016-10-10  Antoine Quint  <graouts@apple.com>
1702
1703         [Modern Media Controls] Buttons
1704         https://bugs.webkit.org/show_bug.cgi?id=163109
1705         <rdar://problem/28668954>
1706
1707         Reviewed by Dean Jackson.
1708
1709         We introduce specific IconButton subclasses for the various buttons we will be using
1710         in media controls on macOS (inline and fullscreen) and iOS. One class, StartButton, is
1711         a subclass of Button and not IconButton because we're only interested in having it display
1712         an <img> element rather than use a mask and requires additional DOM structure.
1713
1714         Tests: media/modern-media-controls/airplay-button/airplay-button-on.html
1715                media/modern-media-controls/airplay-button/airplay-button.html
1716                media/modern-media-controls/aspect-ratio-button/aspect-ratio-button.html
1717                media/modern-media-controls/forward-button/forward-button.html
1718                media/modern-media-controls/fullscreen-button/fullscreen-button.html
1719                media/modern-media-controls/mute-button/mute-button.html
1720                media/modern-media-controls/pip-button/pip-button.html
1721                media/modern-media-controls/play-pause-button/play-pause-button.html
1722                media/modern-media-controls/rewind-button/rewind-button.html
1723                media/modern-media-controls/skip-back-button/skip-back-button.html
1724                media/modern-media-controls/start-button/start-button.html
1725                media/modern-media-controls/tracks-button/tracks-button.html
1726
1727         * Modules/modern-media-controls/controls/airplay-button.css:
1728         (button.airplay.on):
1729         * Modules/modern-media-controls/controls/airplay-button.js:
1730         (AirplayButton):
1731         (AirplayButton.prototype.set on):
1732         * Modules/modern-media-controls/controls/aspect-ratio-button.js:
1733         (AspectRatioButton):
1734         (AspectRatioButton.prototype.get scalesToFill):
1735         (AspectRatioButton.prototype.set scalesToFill):
1736         * Modules/modern-media-controls/controls/forward-button.js:
1737         (ForwardButton):
1738         * Modules/modern-media-controls/controls/fullscreen-button.js:
1739         (FullscreenButton):
1740         * Modules/modern-media-controls/controls/icon-button.js:
1741         * Modules/modern-media-controls/controls/icon-service.js:
1742         * Modules/modern-media-controls/controls/mute-button.js:
1743         (MuteButton):
1744         (MuteButton.prototype.get muted):
1745         (MuteButton.prototype.set muted):
1746         * Modules/modern-media-controls/controls/pip-button.js:
1747         (PiPButton):
1748         * Modules/modern-media-controls/controls/play-pause-button.js:
1749         (PlayPauseButton):
1750         (PlayPauseButton.prototype.get playing):
1751         (PlayPauseButton.prototype.set playing):
1752         * Modules/modern-media-controls/controls/rewind-button.js:
1753         (RewindButton):
1754         * Modules/modern-media-controls/controls/skip-back-button.js:
1755         (SkipBackButton):
1756         * Modules/modern-media-controls/controls/start-button.js:
1757         (StartButton):
1758         * Modules/modern-media-controls/controls/tracks-button.js:
1759         (TracksButton):
1760         * Modules/modern-media-controls/images/iOS/airplay@1x.png: Added.
1761         * Modules/modern-media-controls/images/iOS/airplay@2x.png: Added.
1762         * Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png: Added.
1763         * Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png: Added.
1764         * Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png: Added.
1765         * Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png: Added.
1766         * Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png: Added.
1767         * Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png: Added.
1768         * Modules/modern-media-controls/images/iOS/pause@1x.png: Added.
1769         * Modules/modern-media-controls/images/iOS/pip-in@1x.png: Added.
1770         * Modules/modern-media-controls/images/iOS/pip-in@2x.png: Added.
1771         * Modules/modern-media-controls/images/iOS/pip-in@3x.png: Added.
1772         * Modules/modern-media-controls/images/iOS/play@1x.png: Added.
1773         * Modules/modern-media-controls/images/iOS/play@2x.png: Added.
1774         * Modules/modern-media-controls/images/iOS/play@3x.png: Added.
1775         * Modules/modern-media-controls/images/iOS/start@1x.png: Added.
1776         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png: Added.
1777         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png: Added.
1778         * Modules/modern-media-controls/images/macOS/airplay@1x.png: Added.
1779         * Modules/modern-media-controls/images/macOS/airplay@2x.png: Added.
1780         * Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png: Added.
1781         * Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png: Added.
1782         * Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png: Added.
1783         * Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png: Added.
1784         * Modules/modern-media-controls/images/macOS/forward@1x.png: Added.
1785         * Modules/modern-media-controls/images/macOS/forward@2x.png: Added.
1786         * Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png: Added.
1787         * Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png: Added.
1788         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png: Added.
1789         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png: Added.
1790         * Modules/modern-media-controls/images/macOS/media-selection@1x.png: Added.
1791         * Modules/modern-media-controls/images/macOS/media-selection@2x.png: Added.
1792         * Modules/modern-media-controls/images/macOS/pip-in@1x.png: Added.
1793         * Modules/modern-media-controls/images/macOS/pip-in@2x.png: Added.
1794         * Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png: Added.
1795         * Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png: Added.
1796         * Modules/modern-media-controls/images/macOS/play@1x.png: Added.
1797         * Modules/modern-media-controls/images/macOS/play@2x.png: Added.
1798         * Modules/modern-media-controls/images/macOS/rewind@1x.png: Added.
1799         * Modules/modern-media-controls/images/macOS/rewind@2x.png: Added.
1800         * Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png: Added.
1801         * Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png: Added.
1802         * Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png: Added.
1803         * Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png: Added.
1804         * Modules/modern-media-controls/images/macOS/volume-mute@1x.png: Added.
1805         * Modules/modern-media-controls/images/macOS/volume-mute@2x.png: Added.
1806         * Modules/modern-media-controls/images/macOS/volume@1x.png: Added.
1807         * Modules/modern-media-controls/images/macOS/volume@2x.png: Added.
1808
1809 2016-10-10  Nan Wang  <n_wang@apple.com>
1810
1811         AX: Update AXPlaceHolder algorithm
1812         https://bugs.webkit.org/show_bug.cgi?id=163229
1813
1814         Reviewed by Chris Fleizach.
1815
1816         From https://w3c.github.io/html-aam/
1817         When the placeholder and aria-placeholder attributes are both present, we
1818         should expose the value of the placeholder attribute. Updated the algorithm
1819         for that.
1820
1821         Changes are covered in the modified test.
1822
1823         * accessibility/AccessibilityObject.cpp:
1824         (WebCore::AccessibilityObject::placeholderValue):
1825
1826 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1827
1828         [DOMJIT] Implement Node accessors in DOMJIT
1829         https://bugs.webkit.org/show_bug.cgi?id=163005
1830
1831         Reviewed by Filip Pizlo.
1832
1833         This patch implements DOMJIT accessors in WebCore. We plan to offer 2 things in DOMJIT.
1834
1835             1. Hand written DOM inlining.
1836
1837             We inject DOMJIT::Patchpoint compiler into JSC. And JSC uses this to inline DOM operation,
1838             and drop type checks. Since the operation is fully inlined, potentially it has large
1839             performance boost. Note that CSS Selector JIT compiler already does the similar things:
1840             accessing parentNode etc. directly by using offsets.
1841
1842             2. Exposing signature information.
1843
1844             We will offer function type signature by some representation and pass it to JSC.
1845             JSC will use to drop type checks. Since IDL code generator already knows this,
1846             we can automatically generate such a information. Since we don't perform any inlining,
1847             the performance boost may be limited. But it's worth doing.
1848
1849         This patch implements the first one, hand written DOM inlining facility. We add a new IDL attribute,
1850         "DOMJIT". This means that "This readonly attribute have a DOMJIT patchpoint compiler".
1851         We annotate several accessors at first. "firstChild", "lastChild", "nextSibling", "previousSibling",
1852         and "parentNode". And we implement DOMJIT::Patchpoint for that in JSNodeDOMJIT.cpp.
1853
1854         This patchpoint will be integrated into JSC's DFG and FTL. And these tiers can drop type checks and
1855         inline the entire code of these accessors. JSC compiler still does not know much about DOM. And WebCore
1856         does not know much about each tier of JSC. WebCore just offers the generic patchpoints and they are
1857         used in both DFG and FTL tiers. The layer separation is still kept.
1858
1859         While very small microbenchmark[1] shows performance benefit, still we cannot improve DOM
1860         benchmarks due to the lack of following implementations. Once the following implementations
1861         are implemented, we will get performance boost.
1862
1863         1. Super polymorphic sites.
1864
1865             This inlining is super effective if we run some microbenchmarks. However, Dromaeo does not
1866             show so much performance benefit. This is because Dromaeo's dom-traverse.html is super
1867             polymorphic call site where JSC gives up optimization. For example, in the following
1868             dromaeo's benchmark, we can see so various DOM nodes at the `cur.firstChild` site, like,
1869             HTMLDivElement, HTMLAnchorElement, Text, Comment etc. JSC gives up optimization since we
1870             encounter so many Structures. This should be optimized since they share the large part of
1871             prototype-chain and they hit the exactly same CustomGetter, Node.prototype.firstChild.
1872             We will handle this and when we optimize it, this DOMJIT works well on Dromaeo.
1873
1874                 test( "firstChild", function(){
1875                     var nodes = document.body.childNodes, nl = nodes.length;
1876
1877                     for ( var i = 0; i < num; i++ ) {
1878                         for ( var j = 0; j < nl; j++ ) {
1879                             var cur = nodes[j];
1880                             while ( cur )
1881                                 cur = cur.firstChild;
1882                             ret = cur;
1883                         }
1884                     }
1885                 });
1886
1887         2. Emit code in IC.
1888
1889             Currently, we only optimize DOMJIT accessors in DFG and FTL. However, we should leverage
1890             this DOMJIT::Patchpoint to emit inlined code even in Inline Caching (IC). We will emit
1891             CheckDOM's code for IC's guard phase, and emit CallDOM's code for IC's get phase. This
1892             offers performance benefit even if we live in baseline JIT code. And this should be easy.
1893
1894         [1]: With the following one, we can see 3x improvement (26ms v.s. 80ms).
1895
1896             var element = document.getElementsByTagName('div')[3];
1897             var before = Date.now();
1898             for (var i = 0; i < 1e7; ++i)
1899                 element.firstChild;
1900             console.log(Date.now() - before);
1901
1902         * CMakeLists.txt:
1903         * ForwardingHeaders/domjit/DOMJITGetterSetter.h:
1904         * ForwardingHeaders/domjit/DOMJITPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
1905         * ForwardingHeaders/domjit/DOMJITPatchpointParams.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
1906         * WebCore.xcodeproj/project.pbxproj:
1907         * bindings/js/JSDOMGlobalObject.h:
1908         * bindings/js/JSDOMWrapper.h:
1909         (WebCore::JSDOMWrapper::offsetOfWrapped):
1910         (WebCore::JSDOMWrapper::wrapped): Deleted.
1911         * bindings/js/ScriptWrappable.h:
1912         (WebCore::ScriptWrappable::offsetOfWrapper):
1913         * bindings/scripts/CodeGeneratorJS.pm:
1914         (GetJSCAttributesForAttribute):
1915         (GenerateHeader):
1916         (GeneratePropertiesHashTable):
1917         (GenerateImplementation):
1918         (GenerateHashTableValueArray):
1919         * bindings/scripts/IDLAttributes.txt:
1920         * dom/ContainerNode.h:
1921         (WebCore::ContainerNode::lastChildMemoryOffset):
1922         (WebCore::ContainerNode::lastChild): Deleted.
1923         * dom/Node.h:
1924         (WebCore::Node::flagIsContainer):
1925         (WebCore::Node::flagIsText): Deleted.
1926         * dom/Node.idl:
1927         * domjit/DOMJITHelpers.h: Added.
1928         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal):
1929         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive):
1930         (WebCore::DOMJITHelpers::tryLookUpWrapperCache):
1931         (WebCore::DOMJITHelpers::toWrapper):
1932         (WebCore::DOMJITHelpers::branchIfDOMWrapper):
1933         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper):
1934         (WebCore::DOMJITHelpers::branchIfNode):
1935         (WebCore::DOMJITHelpers::branchIfNotNode):
1936         (WebCore::DOMJITHelpers::branchIfElement):
1937         (WebCore::DOMJITHelpers::branchIfNotElement):
1938         (WebCore::DOMJITHelpers::branchIfDocumentWrapper):
1939         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper):
1940         * domjit/JSNodeDOMJIT.cpp: Added.
1941         (WebCore::toWrapperSlow):
1942         (WebCore::createCallDOMForOffsetAccess):
1943         (WebCore::checkNode):
1944         (WebCore::NodeFirstChildDOMJIT::checkDOM):
1945         (WebCore::NodeFirstChildDOMJIT::callDOM):
1946         (WebCore::NodeLastChildDOMJIT::checkDOM):
1947         (WebCore::NodeLastChildDOMJIT::callDOM):
1948         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
1949         (WebCore::NodeNextSiblingDOMJIT::callDOM):
1950         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
1951         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
1952         (WebCore::NodeParentNodeDOMJIT::checkDOM):
1953         (WebCore::NodeParentNodeDOMJIT::callDOM):
1954
1955 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1956
1957         Support InputEvent.data for the new InputEvent spec
1958         https://bugs.webkit.org/show_bug.cgi?id=163113
1959         <rdar://problem/28681935>
1960
1961         Reviewed by Darin Adler.
1962
1963         Introduces InputEvent.data, a string attribute that, if non-null, indicates the text to be inserted by an input
1964         event. For text areas and text inputs, the 'insertText', 'insertFromPaste', 'insertFromDrop', and
1965         'insertReplacementText' input types should cause subsequent `input` and `beforeinput` events to have non-null
1966         data. However, for contenteditable areas, only 'insertText' leads to having data in resulting InputEvents.
1967
1968         To implement this, we introduce a new virtual method, CompositeEditCommand::inputEventData, which gives
1969         composite editing commands the chance to vend a data string for input events they might fire (by default, this
1970         is null).
1971
1972         Tests: fast/events/input-events-paste-data.html
1973                fast/events/input-events-typing-data.html
1974
1975         * dom/InputEvent.cpp:
1976         (WebCore::InputEvent::InputEvent):
1977         * dom/InputEvent.h:
1978         * dom/InputEvent.idl:
1979
1980         Currently, our InputEventInit struct is wrong. According to the UI-Events spec at www.w3.org/TR/uievents/, the
1981         init struct for an InputEvent should contain a data string (added in this patch) as well as an isComposing flag
1982         (to be added in a future patch along with composition support). While adding support for the data attribute, we
1983         tweak the InputEvent IDL and headers slightly to adjust for this.
1984
1985         * dom/Node.cpp:
1986         (WebCore::Node::dispatchInputEvent):
1987         * dom/Node.h:
1988         * editing/CompositeEditCommand.h:
1989         (WebCore::CompositeEditCommand::inputEventData):
1990         * editing/EditCommand.cpp:
1991         (WebCore::EditCommand::isEditingTextAreaOrTextInput):
1992         * editing/EditCommand.h:
1993         * editing/Editor.cpp:
1994         (WebCore::dispatchBeforeInputEvent):
1995         (WebCore::dispatchInputEvent):
1996         (WebCore::dispatchBeforeInputEvents):
1997         (WebCore::dispatchInputEvents):
1998         (WebCore::Editor::willApplyEditing):
1999         (WebCore::Editor::appliedEditing):
2000         (WebCore::Editor::setBaseWritingDirection):
2001         (WebCore::Editor::computeAndSetTypingStyle):
2002         * editing/ReplaceRangeWithTextCommand.cpp:
2003         (WebCore::ReplaceRangeWithTextCommand::inputEventData):
2004         * editing/ReplaceRangeWithTextCommand.h:
2005         * editing/ReplaceSelectionCommand.cpp:
2006         (WebCore::ReplaceSelectionCommand::inputEventData):
2007         * editing/ReplaceSelectionCommand.h:
2008         * editing/SpellingCorrectionCommand.cpp:
2009         (WebCore::SpellingCorrectionCommand::inputEventData):
2010         * editing/SpellingCorrectionCommand.h:
2011         * editing/TypingCommand.cpp:
2012         (WebCore::TypingCommand::TypingCommand):
2013         (WebCore::TypingCommand::inputEventData):
2014         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2015         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2016         * editing/TypingCommand.h:
2017         * html/HTMLFormControlElement.cpp:
2018         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
2019         * html/HTMLInputElement.cpp:
2020         (WebCore::HTMLInputElement::setEditingValue):
2021         (WebCore::HTMLInputElement::setValueFromRenderer):
2022         * html/HTMLSelectElement.cpp:
2023         (WebCore::HTMLSelectElement::listBoxOnChange):
2024         (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
2025
2026 2016-10-10  Commit Queue  <commit-queue@webkit.org>
2027
2028         Unreviewed, rolling out r206972.
2029         https://bugs.webkit.org/show_bug.cgi?id=163227
2030
2031         Making EWS flaky (Requested by bfulgham_ on #webkit).
2032
2033         Reverted changeset:
2034
2035         "[CMake] CMake does not support the dep files for implicit
2036         dependency"
2037         https://bugs.webkit.org/show_bug.cgi?id=161433
2038         http://trac.webkit.org/changeset/206972
2039
2040 2016-10-10  Darin Adler  <darin@apple.com>
2041
2042         Move media source from legacy to new DOM exceptions
2043         https://bugs.webkit.org/show_bug.cgi?id=163201
2044
2045         Reviewed by Chris Dumez.
2046
2047         * Modules/mediasource/MediaSource.cpp: Removed unneeded includes.
2048         (WebCore::MediaSource::create): Use auto.
2049         (WebCore::MediaSource::MediaSource): Initialize m_mediaElement in class definition.
2050         (WebCore::MediaSource::setLiveSeekableRange): Use ExceptionOr.
2051         (WebCore::MediaSource::clearLiveSeekableRange): Ditto.
2052         (WebCore::MediaSource::setDuration): Ditto.
2053         (WebCore::MediaSource::setDurationInternal): Ditto.
2054         (WebCore::MediaSource::endOfStream): Ditto.
2055         (WebCore::MediaSource::streamEndedWithError): Use bufferedInternal.
2056         (WebCore::MediaSource::addSourceBuffer): Use ExceptionOr.
2057         (WebCore::MediaSource::removeSourceBuffer): Ditto.
2058         (WebCore::MediaSource::detachFromElement): Use removeSourceBuffer
2059         without IGNORE_EXCEPTION since that is now the default behavior.
2060         (WebCore::MediaSource::activeRanges): Use bufferedInternal.
2061         (WebCore::MediaSource::createSourceBufferPrivate): Use ExceptionOr.
2062
2063         * Modules/mediasource/MediaSource.h: Removed unneeded includes.
2064         Made more things private and also private rather than protected.
2065
2066         * Modules/mediasource/MediaSource.idl: Use non-legacy exceptions.
2067
2068         * Modules/mediasource/SourceBuffer.cpp:
2069         (WebCore::SourceBuffer::buffered): Use ExceptionOr.
2070         (WebCore::SourceBuffer::setTimestampOffset): Ditto.
2071         (WebCore::SourceBuffer::setAppendWindowStart): Ditto.
2072         (WebCore::SourceBuffer::setAppendWindowEnd): Ditto.
2073         (WebCore::SourceBuffer::appendBuffer): Ditto.
2074         (WebCore::SourceBuffer::abort): Ditto.
2075         (WebCore::SourceBuffer::remove): Ditto.
2076         (WebCore::SourceBuffer::appendBufferInternal): Ditto.
2077         (WebCore::SourceBuffer::setMode): Ditto.
2078
2079         * Modules/mediasource/SourceBuffer.h: Removed unneeded includes.
2080         Updated for above changes. Made more things private.
2081
2082         * Modules/mediasource/SourceBuffer.idl: Use non-legacy exceptions.
2083
2084         * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h:
2085         Added now-needed include of MediaSourcePrivate.h.
2086
2087 2016-10-10  Jer Noble  <jer.noble@apple.com>
2088
2089         Address flaky airplay-* LayouTests
2090         https://bugs.webkit.org/show_bug.cgi?id=163044
2091
2092         Reviewed by Brent Fulgham.
2093
2094         Two separate problems conspired to make airplay tests a bit flaky:
2095
2096         For one, when the HTMLMediaElement clears its MediaPlayer, it won't necessarily notify
2097         clients that it has stopped playing to a wireless target. The WebMediaSessionManager may
2098         eventually cause this value to reset, but it's asynchronous, and may fire after the next
2099         test starts. Reset this state explicitly.
2100
2101         For two, the state of the mock playback target picker was not being reset between test
2102         invocations.
2103
2104         * html/HTMLMediaElement.cpp:
2105         (WebCore::HTMLMediaElement::clearMediaPlayer):
2106         * testing/Internals.cpp:
2107         (WebCore::Internals::resetToConsistentState):
2108
2109 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
2110
2111         Correct typo in comment (patining -> painting).
2112
2113         * platform/graphics/GraphicsContext.cpp:
2114         (WebCore::GraphicsContext::centerLineAndCutOffCorners):
2115
2116 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
2117
2118         Reduce code duplication between CG, Cairo, and Direct2D
2119         https://bugs.webkit.org/show_bug.cgi?id=163157
2120
2121         Reviewed by Darin Adler.
2122
2123         Move a number of routines that have been copied-and-pasted to different
2124         platform files into the main GraphicsContext.cpp file.
2125
2126         No new tests because there is no change in behavior.
2127
2128         * platform/graphics/GraphicsContext.cpp:
2129         (WebCore::GraphicsContext::dashedLineCornerWidthForStrokeWidth): Added.
2130         (WebCore::GraphicsContext::dashedLinePatternWidthForStrokeWidth): Added.
2131         (WebCore::GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth): Added.
2132         (WebCore::GraphicsContext::centerLineAndCutOffCorners): Added.
2133         * platform/graphics/GraphicsContext.h:
2134         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2135         (WebCore::GraphicsContext::drawLine): Call new helper function.
2136         * platform/graphics/cg/GraphicsContextCG.cpp:
2137         (WebCore::GraphicsContext::drawLine): Ditto.
2138         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2139         (WebCore::GraphicsContext::drawLine): Ditto.
2140
2141 2016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2142
2143         REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
2144         https://bugs.webkit.org/show_bug.cgi?id=163170
2145
2146         Reviewed by Michael Catanzaro.
2147
2148         Do not assume NetworkingContext is non-null and valid before using it.
2149
2150         * platform/network/soup/ResourceHandleSoup.cpp:
2151         (WebCore::gotHeadersCallback):
2152         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2153
2154 2016-10-10  Youenn Fablet  <youenn@apple.com>
2155
2156         Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin
2157         https://bugs.webkit.org/show_bug.cgi?id=162390
2158
2159         Reviewed by Darin Adler.
2160
2161         No observable change of behavior.
2162
2163         Renaming CachedResource::isClean to isCORSSameOrigin to match html spec terminology.
2164         Making use of it to check whether images taint canvas and whether script errors should be sanitized.
2165
2166         Some asserts are added to ensure that a resource fetched using one origin is not reused for another origin.
2167
2168         * dom/ScriptExecutionContext.cpp:
2169         (WebCore::ScriptExecutionContext::sanitizeScriptError):
2170         * html/HTMLLinkElement.cpp:
2171         (WebCore::HTMLLinkElement::initializeStyleSheet):
2172         * html/canvas/CanvasRenderingContext.cpp:
2173         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2174         * loader/cache/CachedImage.cpp:
2175         (WebCore::CachedImage::isOriginClean):
2176         * loader/cache/CachedResource.cpp:
2177         (WebCore::CachedResource::isCORSSameOrigin):
2178         * loader/cache/CachedResource.h:
2179
2180 2016-10-10  Youenn Fablet  <youenn@apple.com>
2181
2182         [Fetch API] Memory cache should not bypass redirect mode
2183         https://bugs.webkit.org/show_bug.cgi?id=162959
2184
2185         Reviewed by Darin Adler.
2186
2187         Test: http/tests/fetch/redirectmode-and-preload.html
2188
2189         Ensure reloading of resources if the redirect modes are different between request and cached resource, and
2190         cached resource has redirections.
2191
2192         As a temporary workaround, we activate resource update for raw resources in
2193         shouldUpdateCachedResourceWithCurrentRequest but disable it in canUpdateFromResource.
2194         This allows handling reloading of resources with different redirection mode in canUpdateFromResource.
2195
2196         A future patch should allow loading cached raw resources from other cached raw resources.
2197
2198         * loader/cache/CachedResource.h:
2199         (WebCore::CachedResource::hasRedirections):
2200         * loader/cache/CachedResourceLoader.cpp:
2201         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2202         (WebCore::canUpdateFromResource):
2203         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
2204
2205 2016-10-10  Youenn Fablet  <youenn@apple.com>
2206
2207         Attribute getter binding generated code should use more references
2208         https://bugs.webkit.org/show_bug.cgi?id=163179
2209
2210         Reviewed by Darin Adler.
2211
2212         No change of behavior.
2213
2214         Using more references in attribute getter generated code since BindingCaller::attribute can do the
2215         pointer-to-references checks once for all.
2216
2217         Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or
2218         pointers (methods and attribute setters) are to be used.
2219         Future refactoring should allign methods/attribute setters to attribute getters.
2220
2221         * bindings/js/JSDOMBinding.h:
2222         (WebCore::BindingCaller::attribute):
2223         * bindings/scripts/CodeGeneratorJS.pm:
2224         (GenerateImplementation):
2225         (GenerateCallWith):
2226         (NativeToJSValue):
2227         (JSValueToNative):
2228         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2229         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2230         * bindings/scripts/test/JS/JSTestException.cpp:
2231         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2232         * bindings/scripts/test/JS/JSTestInterface.cpp:
2233         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2234         * bindings/scripts/test/JS/JSTestNode.cpp:
2235         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2236         * bindings/scripts/test/JS/JSTestObj.cpp:
2237         * bindings/scripts/test/JS/JSattribute.cpp:
2238
2239 2016-10-10  Youenn Fablet  <youenn@apple.com>
2240
2241         Fix Mac Win build after https://trac.webkit.org/changeset/206966
2242         https://bugs.webkit.org/show_bug.cgi?id=163199
2243
2244         Unreviewed.
2245
2246         * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT.
2247
2248 2016-10-09  Antti Koivisto  <antti@apple.com>
2249
2250         Enable optimized stylesheet updates in shadow trees
2251         https://bugs.webkit.org/show_bug.cgi?id=163180
2252
2253         Reviewed by Darin Adler.
2254
2255         When we get a new stylesheet (for example when load completes) we invalidate only
2256         those elements in DOM that are affected by the new sheet. This patch makes the
2257         optimization also work in shadow trees.
2258
2259         Test: fast/shadow-dom/scoped-style-invalidation.html
2260
2261         * css/StyleInvalidationAnalysis.cpp:
2262         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
2263         * css/StyleInvalidationAnalysis.h:
2264         * dom/Document.cpp:
2265         (WebCore::Document::didRemoveAllPendingStylesheet):
2266         * style/StyleScope.cpp:
2267         (WebCore::Style::Scope::removePendingSheet):
2268         (WebCore::Style::Scope::analyzeStyleSheetChange):
2269         (WebCore::Style::Scope::updateActiveStyleSheets):
2270
2271 2016-10-10  Youenn Fablet  <youenn@apple.com>
2272
2273         Refactor binding generated casted-this checks for attribute setters
2274         https://bugs.webkit.org/show_bug.cgi?id=163181
2275
2276         Reviewed by Darin Adler.
2277
2278         No change of behavior.
2279         Covered by existing tests and binding expectations.
2280
2281         Adding support for attribute setter in BindingCaller.
2282         Updating binding generator to make use of it.
2283         Future refactoring should use more reference and rename castedThis to thisObject, like for getters.
2284
2285         * bindings/js/JSDOMBinding.h:
2286         (WebCore::BindingCaller::setAttribute):
2287         * bindings/scripts/CodeGeneratorJS.pm:
2288         (GenerateImplementation):
2289         * bindings/scripts/test/JS/JSTestInterface.cpp:
2290         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2291         * bindings/scripts/test/JS/JSTestNode.cpp:
2292         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2293         * bindings/scripts/test/JS/JSTestObj.cpp:
2294         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2295         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2296
2297 2016-10-09  Darin Adler  <darin@apple.com>
2298
2299         Move encrypted media from legacy to new DOM exceptions
2300         https://bugs.webkit.org/show_bug.cgi?id=163194
2301
2302         Reviewed by Youenn Fablet.
2303
2304         * Modules/encryptedmedia/CDM.cpp:
2305         (WebCore::CDM::createSession): Take a reference instead of a pointer.
2306         * Modules/encryptedmedia/CDM.h: Updated for above change.
2307
2308         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2309         (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
2310         (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
2311         (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
2312         sets m_session to null.
2313         (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
2314         (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
2315         (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
2316         of calling the keys function.
2317         (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
2318         calling the setError function.
2319         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
2320         (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
2321         instead of writing !isClosed.
2322         (WebCore::WebKitMediaKeySession::setError): Deleted.
2323
2324         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
2325         unneeded includes. Changed create to take a reference instead of a pointer.
2326         Made most members and base classes private instead of public. Also removed
2327         a few now-unneeded functions. Made everything that was formerly protected
2328         private instead, since the two are the same in a final class.
2329
2330         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
2331         Moved from MayThrowLegacyException to MayThrowException.
2332
2333         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
2334         (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
2335         (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
2336         Also initialize m_mediaElement in the class definition.
2337         (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
2338         (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
2339         insteead of pointer to create. Also removed unneeded separate checks for null
2340         strings in code that already calls isEmpty.
2341         (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
2342         in code that already calls isEmpty.
2343         (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
2344         (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
2345
2346         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
2347         Changed cdm() function to return a reference. Initialize m_mediaElement.
2348         Use private instead of protected.
2349
2350         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
2351         and MayThrowException instead of the legacy versions.
2352
2353 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
2354
2355         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
2356         https://bugs.webkit.org/show_bug.cgi?id=162982
2357
2358         Reviewed by Jer Noble.
2359
2360         Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use
2361         the WebKit prefix in the implementations. This will prevent conflicts between
2362         interfaces with same names in both the legacy API and the future EME API.
2363
2364         Most of the interfaces in this legacy API already used the WebKit prefix when
2365         exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets
2366         prefixed in this patch.
2367
2368         The interface implementations for this legacy API are also moved under the
2369         Modules/encryptedmedia/legacy/ directory.
2370
2371         No new tests -- covered by existing tests (with the relevant changes reflected
2372         in the updated baselines).
2373
2374         * CMakeLists.txt:
2375         * DerivedSources.cpp:
2376         * DerivedSources.make:
2377         * Modules/encryptedmedia/CDM.cpp:
2378         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
2379         (WebCore::CDMSessionClearKey::generateKeyRequest):
2380         (WebCore::CDMSessionClearKey::update):
2381         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
2382         (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
2383         (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent):
2384         (WebCore::WebKitMediaKeyMessageEvent::eventInterface):
2385         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h.
2386         (WebCore::WebKitMediaKeyMessageEvent::create):
2387         (WebCore::WebKitMediaKeyMessageEvent::createForBindings):
2388         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl.
2389         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp.
2390         (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
2391         (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent):
2392         (WebCore::WebKitMediaKeyNeededEvent::eventInterface):
2393         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h.
2394         (WebCore::WebKitMediaKeyNeededEvent::create):
2395         (WebCore::WebKitMediaKeyNeededEvent::createForBindings):
2396         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl.
2397         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp.
2398         (WebCore::WebKitMediaKeySession::create):
2399         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
2400         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
2401         (WebCore::WebKitMediaKeySession::setError):
2402         (WebCore::WebKitMediaKeySession::close):
2403         (WebCore::WebKitMediaKeySession::cachedKeyForKeyId):
2404         (WebCore::WebKitMediaKeySession::sessionId):
2405         (WebCore::WebKitMediaKeySession::generateKeyRequest):
2406         (WebCore::WebKitMediaKeySession::keyRequestTimerFired):
2407         (WebCore::WebKitMediaKeySession::update):
2408         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
2409         (WebCore::WebKitMediaKeySession::sendMessage):
2410         (WebCore::WebKitMediaKeySession::sendError):
2411         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2412         (WebCore::WebKitMediaKeySession::hasPendingActivity):
2413         (WebCore::WebKitMediaKeySession::stop):
2414         (WebCore::WebKitMediaKeySession::activeDOMObjectName):
2415         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension):
2416         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h.
2417         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl.
2418         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp.
2419         (WebCore::WebKitMediaKeys::create):
2420         (WebCore::WebKitMediaKeys::WebKitMediaKeys):
2421         (WebCore::WebKitMediaKeys::~WebKitMediaKeys):
2422         (WebCore::WebKitMediaKeys::createSession):
2423         (WebCore::WebKitMediaKeys::isTypeSupported):
2424         (WebCore::WebKitMediaKeys::setMediaElement):
2425         (WebCore::WebKitMediaKeys::cdmMediaPlayer):
2426         (WebCore::WebKitMediaKeys::keyAdded):
2427         (WebCore::WebKitMediaKeys::cachedKeyForKeyId):
2428         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
2429         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl.
2430         * bindings/js/JSDictionary.cpp:
2431         (WebCore::JSDictionary::convertValue):
2432         * bindings/js/JSDictionary.h:
2433         * dom/EventNames.in:
2434         * dom/EventTargetFactory.in:
2435         * html/HTMLMediaElement.cpp:
2436         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
2437         (WebCore::HTMLMediaElement::setMediaKeys):
2438         * html/HTMLMediaElement.h:
2439         (WebCore::HTMLMediaElement::keys):
2440         * html/HTMLMediaElement.idl:
2441         * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h.
2442         (WebCore::WebKitMediaKeyError::create):
2443         (WebCore::WebKitMediaKeyError::WebKitMediaKeyError):
2444         * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl.
2445         * testing/MockCDM.cpp:
2446         (WebCore::MockCDMSession::generateKeyRequest):
2447         (WebCore::MockCDMSession::update):
2448
2449 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
2450
2451         Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement
2452         https://bugs.webkit.org/show_bug.cgi?id=163111
2453
2454         Reviewed by Alex Christensen.
2455
2456         Remove three method implementations in HTMLMediaElement which had their
2457         declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA
2458         purge in r206440.
2459
2460         No new tests -- no changes in behavior.
2461
2462         * html/HTMLMediaElement.cpp:
2463         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted.
2464         (WebCore::HTMLMediaElement::webkitAddKey): Deleted.
2465         (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted.
2466
2467 2016-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2468
2469         Support InputEvent.inputType for the new InputEvent spec
2470         https://bugs.webkit.org/show_bug.cgi?id=163025
2471         <rdar://problem/28658092>
2472
2473         Reviewed by Darin Adler.
2474
2475         Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
2476         map EditActions to inputType names, and also split out ambiguous EditActions (such as
2477         EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
2478         EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
2479
2480         In places where we create CompositeEditCommands, we now pass in these specific EditActions
2481         where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
2482         CompositeEditCommand for its input type name, which it derives from its editingAction.
2483
2484         Tests: fast/events/before-input-prevent-biu.html
2485                fast/events/before-input-prevent-cut.html
2486                fast/events/before-input-prevent-paste.html
2487                fast/events/before-input-prevent-typing.html
2488                fast/events/before-input-prevent-undo.html
2489
2490         * dom/InputEvent.h:
2491         * dom/Node.cpp:
2492         (WebCore::Node::dispatchInputEvent):
2493         * dom/Node.h:
2494         * editing/CompositeEditCommand.cpp:
2495         (WebCore::CompositeEditCommand::apply):
2496         (WebCore::CompositeEditCommand::inputEventTypeName):
2497
2498         Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
2499         should have.
2500
2501         * editing/CompositeEditCommand.h:
2502         (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
2503         * editing/EditAction.h:
2504         * editing/EditCommand.cpp:
2505         (WebCore::inputTypeNameForEditingAction):
2506         * editing/EditCommand.h:
2507         * editing/Editor.cpp:
2508         (WebCore::Editor::willApplyEditing):
2509         (WebCore::Editor::appliedEditing):
2510         (WebCore::Editor::willUnapplyEditing):
2511         (WebCore::Editor::unappliedEditing):
2512         (WebCore::Editor::willReapplyEditing):
2513         (WebCore::Editor::reappliedEditing):
2514         (WebCore::Editor::computeAndSetTypingStyle):
2515         * editing/InsertListCommand.cpp:
2516         (WebCore::InsertListCommand::editingAction):
2517         * editing/InsertListCommand.h:
2518         (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
2519         (WebCore::InsertListCommand::editingAction): Deleted.
2520         * editing/ReplaceRangeWithTextCommand.cpp:
2521         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
2522         * editing/SpellingCorrectionCommand.cpp:
2523         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
2524         * editing/TypingCommand.cpp:
2525         (WebCore::editActionForTypingCommand):
2526         (WebCore::TypingCommand::TypingCommand):
2527         (WebCore::TypingCommand::inputEventTypeName):
2528
2529         The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
2530         Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
2531         use the last updated editing action rather than the default (initial) editing action.
2532
2533         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2534         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2535         (WebCore::TypingCommand::insertParagraphSeparator):
2536         * editing/TypingCommand.h:
2537
2538 2016-10-09  Darin Adler  <darin@apple.com>
2539
2540         Move ApplePaySession from legacy to new DOM exceptions
2541         https://bugs.webkit.org/show_bug.cgi?id=163191
2542
2543         Reviewed by Sam Weinig.
2544
2545         * Modules/applepay/ApplePaySession.cpp:
2546         (WebCore::ApplePaySession::create): Use ExceptionOr.
2547         (WebCore::ApplePaySession::ApplePaySession): Moved initialization
2548         of two of the data members to class definition.
2549         (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr.
2550         (WebCore::ApplePaySession::canMakePayments): Ditto.
2551         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto.
2552         (WebCore::ApplePaySession::openPaymentSetup): Ditto.
2553         (WebCore::ApplePaySession::begin): Ditto.
2554         (WebCore::ApplePaySession::abort): Ditto.
2555         (WebCore::ApplePaySession::completeMerchantValidation): Ditto.
2556         (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto.
2557         (WebCore::ApplePaySession::completeShippingContactSelection): Ditto.
2558         (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto.
2559         (WebCore::ApplePaySession::completePayment): Ditto.
2560         (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of
2561         using a RefPtr type and * for event dispatching.
2562         (WebCore::ApplePaySession::didAuthorizePayment): Ditto.
2563         (WebCore::ApplePaySession::didSelectShippingMethod): Ditto.
2564         (WebCore::ApplePaySession::didSelectShippingContact): Ditto.
2565         (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto.
2566         (WebCore::ApplePaySession::didCancelPayment): Ditto.
2567         (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing
2568         inside the downcast.
2569
2570         * Modules/applepay/ApplePaySession.h: Updated for changes above.
2571
2572         * Modules/applepay/ApplePaySession.idl: Use MayThrowException.
2573
2574         * bindings/js/JSApplePaySessionCustom.cpp:
2575         (WebCore::JSApplePaySession::completeShippingMethodSelection):
2576         Use propagateException.
2577         (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto.
2578         (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto.
2579
2580         * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean.
2581
2582         * bindings/scripts/CodeGeneratorJS.pm:
2583         (GenerateConstructorDefinition): Generate the different arguments for
2584         toJSNewlyCreated when ConstructorMayThrowException is specified that
2585         activate the version of that function that handles exceptions.
2586
2587         * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException.
2588
2589 2016-10-09  Darin Adler  <darin@apple.com>
2590
2591         Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
2592         https://bugs.webkit.org/show_bug.cgi?id=163178
2593
2594         Reviewed by Sam Weinig.
2595
2596         * Modules/indexeddb/IDBCursor.cpp:
2597         (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
2598         using an ExceptionCode out argument, since this function just needs to
2599         indicate failure, not actually throw an exception.
2600         (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
2601         ExceptionCodeWithMessage out argument.
2602         (WebCore::IDBCursor::advance): Ditto.
2603         (WebCore::IDBCursor::continueFunction): Ditto.
2604         (WebCore::IDBCursor::deleteFunction): Ditto.
2605         * Modules/indexeddb/IDBCursor.h: Updated for above changes.
2606
2607         * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
2608         Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
2609
2610         * Modules/indexeddb/IDBDatabase.cpp:
2611         (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
2612         using an ExceptionCodeWithMessage out argument.
2613         (WebCore::IDBDatabase::transaction): Ditto.
2614         (WebCore::IDBDatabase::deleteObjectStore): Ditto.
2615         * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
2616
2617         * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
2618         MayThrowLegacyExceptionWithMessage.
2619
2620         * Modules/indexeddb/IDBFactory.cpp:
2621         (WebCore::IDBFactory::open): Return ExceptionOr instead of
2622         using an ExceptionCodeWithMessage out argument.
2623         (WebCore::IDBFactory::openInternal): Ditto.
2624         (WebCore::IDBFactory::deleteDatabase): Ditto.
2625         (WebCore::IDBFactory::cmp): Ditto.
2626         * Modules/indexeddb/IDBFactory.h: Updated for above changes.
2627
2628         * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
2629         MayThrowLegacyExceptionWithMessage.
2630
2631         * Modules/indexeddb/IDBIndex.cpp:
2632         (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
2633         using an ExceptionCodeWithMessage out argument.
2634         (WebCore::IDBIndex::count): Ditto.
2635         (WebCore::IDBIndex::doCount): Ditto.
2636         (WebCore::IDBIndex::openKeyCursor): Ditto.
2637         (WebCore::IDBIndex::get): Ditto.
2638         (WebCore::IDBIndex::doGet): Ditto.
2639         (WebCore::IDBIndex::getKey): Ditto.
2640         (WebCore::IDBIndex::doGetKey): Ditto.
2641         * Modules/indexeddb/IDBIndex.h: Updated for above changes.
2642
2643         * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
2644         MayThrowLegacyExceptionWithMessage.
2645
2646         * Modules/indexeddb/IDBKeyRange.cpp:
2647         (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
2648         using an ExceptionCode out argument.
2649         (WebCore::IDBKeyRange::lowerBound): Ditto.
2650         (WebCore::IDBKeyRange::upperBound): Ditto.
2651         (WebCore::IDBKeyRange::bound): Ditto.
2652         * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
2653         * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
2654         MayThrowLegacyException.
2655
2656         * Modules/indexeddb/IDBObjectStore.cpp:
2657         (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
2658         using an ExceptionCodeWithMessage out argument.
2659         (WebCore::IDBObjectStore::get): Ditto.
2660         (WebCore::IDBObjectStore::add): Ditto.
2661         (WebCore::IDBObjectStore::put): Ditto.
2662         (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
2663         (WebCore::IDBObjectStore::putOrAdd): Ditto.
2664         (WebCore::IDBObjectStore::deleteFunction): Ditto.
2665         (WebCore::IDBObjectStore::doDelete): Ditto.
2666         (WebCore::IDBObjectStore::clear): Ditto.
2667         (WebCore::IDBObjectStore::createIndex): Ditto.
2668         (WebCore::IDBObjectStore::index): Ditto.
2669         (WebCore::IDBObjectStore::deleteIndex): Ditto.
2670         (WebCore::IDBObjectStore::count): Ditto.
2671         (WebCore::IDBObjectStore::doCount): Ditto.
2672         * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
2673
2674         * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
2675         MayThrowLegacyExceptionWithMessage.
2676
2677         * Modules/indexeddb/IDBRequest.cpp:
2678         (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
2679         (WebCore::IDBRequest::error): Return ExceptionOr instead of
2680         using an ExceptionCodeWithMessage out argument.
2681         * Modules/indexeddb/IDBRequest.h: Updated for above changes.
2682
2683         * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
2684         GetterMayThrowLegacyExceptionWithMessage.
2685
2686         * Modules/indexeddb/IDBTransaction.cpp:
2687         (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
2688         using an ExceptionCode out argument, since this function just needs to
2689         indicate failure, not actually throw an exception.
2690         (WebCore::IDBTransaction::db): Tweaked code a bit.
2691         (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
2692         (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
2693         using an ExceptionCodeWithMessage out argument.
2694         (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
2695         (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
2696         using an ExceptionCodeWithMessage out argument.
2697         (WebCore::IDBTransaction::internalAbort): Added a version that asserts
2698         instead of throwing an exception for internal use.
2699         (WebCore::IDBTransaction::stop): Call internalAbort.
2700         * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
2701
2702         * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
2703         MayThrowLegacyExceptionWithMessage.
2704
2705         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2706         (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
2707         a Ref instead of a RefPtr, since the function can never return null.
2708         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
2709         * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
2710
2711         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2712         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
2713         exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
2714         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
2715         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
2716         (WebCore::MediaEndpointSessionDescription::create): Ditto.
2717         * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
2718
2719         * bindings/js/JSDOMBinding.cpp:
2720         (WebCore::createDOMException): Added overload for Exception.
2721         (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
2722         Updated code to call the new createDOMException function.
2723         (WebCore::setDOMExceptionSlow): Ditto.
2724         (WebCore::setDOMException): Ditto.
2725
2726         * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
2727         an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
2728         interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
2729
2730         * bindings/js/JSDOMPromise.cpp:
2731         (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
2732         * bindings/js/JSDOMPromise.h: Updated for above change.
2733
2734         * bindings/js/JSHistoryCustom.cpp:
2735         (WebCore::JSHistory::pushState): Use propagateException to deal with
2736         ExceptionOr instead of ExceptionCodeWithMessage.
2737         (WebCore::JSHistory::replaceState): Ditto.
2738
2739         * bindings/js/JSIDBDatabaseCustom.cpp:
2740         (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
2741         to deal with ExceptionOr rather than setDOMException to deal
2742         with ExceptionCodeWithMessage.
2743
2744         * bindings/js/JSIDBRequestCustom.cpp:
2745         (WebCore::JSIDBRequest::result): Use propagateException and
2746         Exception rather than setDOMException and ExceptionCodeWithMessage.
2747
2748         * bindings/scripts/CodeGeneratorJS.pm:
2749         (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
2750         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
2751         (GenerateReturnParameters): Ditto.
2752         (GenerateImplementationFunctionCall): Ditto.
2753         (GenerateConstructorDefinition): Ditto.
2754
2755         * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
2756         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
2757
2758         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
2759         * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
2760
2761         * dom/CustomElementRegistry.idl: Use MayThrowException instead of
2762         MayThrowLegacyExceptionWithMessage.
2763
2764         * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
2765         once, removed include of WTFString.h and switched to using instead of typedef.
2766
2767         * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
2768         to cut down a little on unnecessary reference count churn.
2769
2770         * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
2771         classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
2772
2773         * page/DOMWindow.cpp:
2774         (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
2775
2776         * page/History.cpp:
2777         (WebCore::History::History): Take a reference instead of a pointer.
2778         (WebCore::History::length): Tweaked to use a local variable.
2779         (WebCore::History::state): Return a pointer instead of a PassRefPtr.
2780         (WebCore::History::stateInternal): Ditto. Also use early return consistently.
2781         (WebCore::History::isSameAsCurrentState): Updated for above change.
2782         (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
2783         ExceptionCodeWithMessage out argument.
2784
2785         * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
2786         Updated for changes above.
2787
2788         * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
2789
2790 2016-10-07  Ryosuke Niwa  <rniwa@webkit.org>
2791
2792         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
2793         https://bugs.webkit.org/show_bug.cgi?id=163145
2794
2795         Reviewed by Darin Adler.
2796
2797         The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless
2798         of whether they have been invalidated or not.
2799
2800         Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache.
2801
2802         Test: fast/dom/NodeList/form-labels-length.html
2803
2804         * dom/Document.cpp:
2805         (WebCore::Document::Document):
2806         (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to
2807         happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches.
2808         * dom/Document.h:
2809         * dom/Node.cpp:
2810         (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via
2811         LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all.
2812         We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it
2813         is not a safe operation.
2814
2815 2016-10-09  Chris Dumez  <cdumez@apple.com>
2816
2817         Update generated bindings code so that dictionary structures no longer need explicit constructors
2818         https://bugs.webkit.org/show_bug.cgi?id=163188
2819
2820         Reviewed by Darin Adler.
2821
2822         Update generated bindings code so that dictionary structures no longer
2823         need explicit constructors. We now call the default constructor and
2824         then initialize the members one by one.
2825
2826         * bindings/scripts/CodeGeneratorJS.pm:
2827         (GenerateDictionaryImplementationContent):
2828         * bindings/scripts/test/JS/JSTestObj.cpp:
2829         (WebCore::convertDictionary<TestObj::Dictionary>):
2830         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
2831         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
2832         (WebCore::convertDictionary<AlternateDictionaryName>):
2833         (WebCore::convertDictionary<TestObj::ParentDictionary>):
2834         (WebCore::convertDictionary<TestObj::ChildDictionary>):
2835         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2836         (WebCore::convertDictionary<TestStandaloneDictionary>):
2837         * dom/ClipboardEvent.h:
2838         * dom/CustomEvent.h:
2839         * dom/EventInit.h:
2840         (WebCore::EventInit::EventInit): Deleted.
2841         * dom/EventModifierInit.h:
2842         (WebCore::EventModifierInit::EventModifierInit): Deleted.
2843         * dom/KeyboardEvent.cpp:
2844         (WebCore::KeyboardEvent::KeyboardEvent):
2845         * dom/KeyboardEvent.h:
2846         * dom/KeyboardEvent.idl:
2847         * dom/UIEventInit.h:
2848         (WebCore::UIEventInit::UIEventInit): Deleted.
2849         * editing/Editor.cpp:
2850         (WebCore::Editor::dispatchCPPEvent):
2851
2852 2016-10-09  Fujii Hironori  <Hironori.Fujii@sony.com>
2853
2854         [CMake] CMake does not support the dep files for implicit dependency
2855         https://bugs.webkit.org/show_bug.cgi?id=161433
2856
2857         Reviewed by Brent Fulgham.
2858
2859         Created a Perl script to generate all IDL bindings for CMake.
2860         This script can regenerate outdated bindings by based on the
2861         supplemental dependency and dep files created by
2862         '--write-dependencies' switch of generate-bindings.pl.
2863
2864         add_custom_target is used to invoke the script instead of
2865         add_custom_command because Ninja deletes all output files before
2866         executing the command in case of add_custom_command.
2867
2868         USES_TERMINAL option of add_custom_target has two effects:
2869         1) Not buffering output of the command
2870         2) Invoking the command in the special Ninja pool which inhibits parallel build
2871         One needs to use CMake 3.2 or later to enable this feature.
2872
2873         * CMakeLists.txt: Specified target names for
2874         GENERATE_BINDINGS. Added dependency for the targets.
2875         * bindings/scripts/generate-bindings-all.pl: Added.
2876
2877 2016-10-09  Chris Dumez  <cdumez@apple.com>
2878
2879         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
2880         https://bugs.webkit.org/show_bug.cgi?id=163176
2881
2882         Reviewed by Darin Adler.
2883
2884         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
2885         and use a proper constructor instead, like in the specification:
2886         - https://www.w3.org/TR/uievents/#interface-keyboardevent
2887
2888         Also add support for passing modifierAltGraph / modifierCapsLock
2889         in the inialization dictionary as we support those modifiers via
2890         getModifierState().
2891
2892         No new tests, extended existing test.
2893
2894         * CMakeLists.txt:
2895         * DerivedSources.cpp:
2896         * DerivedSources.make:
2897         * WebCore.xcodeproj/project.pbxproj:
2898         * dom/EventModifierInit.h: Added.
2899         (WebCore::EventModifierInit::EventModifierInit):
2900         * dom/EventModifierInit.idl: Added.
2901         * dom/KeyboardEvent.cpp:
2902         (WebCore::KeyboardEvent::KeyboardEvent):
2903         (WebCore::KeyboardEvent::getModifierState):
2904         * dom/KeyboardEvent.h:
2905         * dom/KeyboardEvent.idl:
2906         * dom/MouseRelatedEvent.cpp:
2907         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
2908         * dom/MouseRelatedEvent.h:
2909         * dom/UIEvent.cpp:
2910         (WebCore::UIEvent::UIEvent):
2911         * dom/UIEvent.h:
2912         (WebCore::UIEvent::create): Deleted.
2913         * dom/UIEventInit.h: Added.
2914         (WebCore::UIEventInit::UIEventInit):
2915         * dom/UIEventInit.idl: Added.
2916         * dom/UIEventWithKeyState.h:
2917         (WebCore::UIEventWithKeyState::altGraphKey):
2918         (WebCore::UIEventWithKeyState::capsLockKey):
2919         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
2920         (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
2921         (WebCore::UIEventWithKeyState::shiftKey): Deleted.
2922         (WebCore::UIEventWithKeyState::altKey): Deleted.
2923         (WebCore::UIEventWithKeyState::metaKey): Deleted.
2924
2925 2016-10-09  Youenn Fablet  <youenn@apple.com>
2926
2927         Promise attribute getters should reject promises in case of casted-this errors
2928         https://bugs.webkit.org/show_bug.cgi?id=163167
2929
2930         Reviewed by Darin Adler.
2931
2932         Covered by updated test and binding test.
2933
2934         * bindings/js/JSDOMBinding.cpp:
2935         (WebCore::throwGetterTypeError):
2936         (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters
2937         * bindings/js/JSDOMBinding.h:
2938         (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors.
2939         * bindings/scripts/CodeGeneratorJS.pm:
2940         (GenerateImplementation):
2941         * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported.
2942         (WebCore::jsTestObjTestReadOnlyPromiseAttribute):
2943         (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter):
2944         * bindings/scripts/test/TestObj.idl:
2945
2946 2016-10-08  Chris Dumez  <cdumez@apple.com>
2947
2948         [Mac] Write WebArchive to the pasteboard when copying image in WebKit
2949         https://bugs.webkit.org/show_bug.cgi?id=163100
2950
2951         Reviewed by Darin Adler.
2952
2953         Write WebArchive to the pasteboard when copying image in WebKit. This
2954         fixes pasting such images to a content editable field in WebKit because
2955         Web archives take priority over RTFD when reading from the pasteboard
2956         in WebKit.
2957
2958         Using RTFD when pasting the image in WebKit was causing issues because:
2959         1. The pasted image would not be displayed because our RTFD import code
2960            is buggy.
2961         2. The pasted image URL was a webkit-fake-url://
2962         3. Formatting associated to the image (e.g. inline style) would be lost
2963
2964         No new tests, unskipped existing test on WebKit2.
2965
2966         * editing/Editor.h:
2967         * editing/mac/EditorMac.mm:
2968         (WebCore::Editor::imageInWebArchiveFormat):
2969         (WebCore::Editor::writeImageToPasteboard):
2970         * platform/Pasteboard.h:
2971         * platform/mac/PasteboardMac.mm:
2972         (WebCore::writableTypesForImage):
2973         (WebCore::Pasteboard::write):
2974         (WebCore::Pasteboard::Pasteboard): Deleted.
2975         (WebCore::Pasteboard::createForCopyAndPaste): Deleted.
2976
2977 2016-10-08  Chris Dumez  <cdumez@apple.com>
2978
2979         Update CustomEvent to stop using legacy [ConstructorTemplate=Event]
2980         https://bugs.webkit.org/show_bug.cgi?id=163174
2981
2982         Reviewed by Darin Adler.
2983
2984         Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and
2985         use an actual constructor instead, like in the specification:
2986         - https://dom.spec.whatwg.org/#interface-customevent
2987
2988         There is a very minor behavior change when explictly passing undefined
2989         as detail value in CustomEventInit. We used to initialize detail to
2990         undefined but we now initialize it to null instead, which is its default
2991         value. The new behavior matches the one of Chrome and Firefox.
2992
2993         * bindings/scripts/CodeGeneratorJS.pm:
2994         (GenerateDefaultValue):
2995         (GenerateDictionaryImplementationContent):
2996         * bindings/scripts/test/JS/JSTestObj.cpp:
2997         (WebCore::convertDictionary<TestObj::Dictionary>):
2998         * bindings/scripts/test/TestObj.idl:
2999         * dom/CustomEvent.cpp:
3000         (WebCore::CustomEvent::CustomEvent):
3001         * dom/CustomEvent.h:
3002         * dom/CustomEvent.idl:
3003         * dom/Document.cpp:
3004         (WebCore::Document::createEvent):
3005         * dom/Event.cpp:
3006         (WebCore::Event::Event):
3007         * dom/Event.h:
3008
3009 2016-10-08  Chris Dumez  <cdumez@apple.com>
3010
3011         Add support for ClipboardEvent
3012         https://bugs.webkit.org/show_bug.cgi?id=163164
3013
3014         Reviewed by Darin Adler.
3015
3016         Add support for ClipboardEvent:
3017         - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces
3018
3019         Firefox and Chrome both already support this.
3020
3021         This gives us 5 more points on html5test.com.
3022
3023         Tests: editing/pasteboard/clipboard-event.html
3024                fast/events/clipboard-event-constructor.html
3025
3026         * CMakeLists.txt:
3027         * DerivedSources.cpp:
3028         * DerivedSources.make:
3029         * WebCore.xcodeproj/project.pbxproj:
3030         * bindings/js/JSEventCustom.cpp:
3031         (WebCore::toJSNewlyCreated): Deleted.
3032
3033         * bindings/scripts/CodeGeneratorJS.pm:
3034         (WillConvertUndefinedToDefaultParameterValue):
3035         We use [] as implicit default value for dictionary parameters. This change
3036         is so we call convertDictionary<>() even if the parameter is undefined
3037         because we want to pass a struct to the implementation initialized with
3038         the default member values defined in the IDL.
3039
3040         * dom/ClipboardEvent.cpp:
3041         (WebCore::ClipboardEvent::ClipboardEvent):
3042         (WebCore::ClipboardEvent::eventInterface):
3043         * dom/ClipboardEvent.h:
3044         * dom/ClipboardEvent.idl: Added.
3045         * dom/Event.cpp:
3046         (WebCore::Event::Event):
3047         * dom/Event.h:
3048         * dom/Event.idl:
3049         * dom/EventInit.h: Added.
3050         * dom/EventInit.idl: Added.
3051         * dom/EventNames.in:
3052         * dom/MouseEvent.h:
3053         (WebCore::MouseEvent::dataTransfer):
3054         * editing/Editor.cpp:
3055         (WebCore::Editor::dispatchCPPEvent):
3056
3057 2016-10-06  Darin Adler  <darin@apple.com>
3058
3059         Next step on moving to modern way to return DOM exceptions
3060         https://bugs.webkit.org/show_bug.cgi?id=163016
3061
3062         Reviewed by Ryosuke Niwa.
3063
3064         * Modules/fetch/FetchRequest.idl:
3065         Added MayThrowException to initializeWith since it throws an exception.
3066
3067         * bindings/js/JSCallbackData.cpp:
3068         (WebCore::JSCallbackData::invokeCallback):
3069         * bindings/js/JSCustomElementInterface.cpp:
3070         (WebCore::JSCustomElementInterface::invokeCallback):
3071         * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
3072         (WebCore::JSSQLStatementErrorCallback::handleEvent):
3073         * bindings/js/JSCustomXPathNSResolver.cpp:
3074         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
3075         * bindings/js/JSDOMBinding.cpp:
3076         (WebCore::reportException):
3077         (WebCore::reportCurrentException):
3078         * bindings/js/JSErrorHandler.cpp:
3079         (WebCore::JSErrorHandler::handleEvent):
3080         * bindings/js/JSEventListener.cpp:
3081         (WebCore::JSEventListener::handleEvent):
3082         * bindings/js/JSMutationCallback.cpp:
3083         (WebCore::JSMutationCallback::call):
3084         * bindings/js/JSNodeFilterCustom.cpp:
3085         (WebCore::JSNodeFilter::acceptNode):
3086         * bindings/js/ScheduledAction.cpp:
3087         (WebCore::ScheduledAction::executeFunctionInContext):
3088         * bindings/js/ScriptController.cpp:
3089         (WebCore::ScriptController::evaluateInWorld):
3090         * bindings/js/WorkerScriptController.cpp:
3091         (WebCore::WorkerScriptController::evaluate):
3092         * inspector/PageScriptDebugServer.cpp:
3093         (WebCore::PageScriptDebugServer::reportException):
3094         Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
3095         or in some cases use auto instead.
3096
3097         * bindings/js/JSDOMBinding.cpp:
3098         (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
3099         for clarity.
3100         (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
3101         (WebCore::propagateExceptionSlowPath): Added.
3102         (WebCore::propagateException): Added.
3103         (WebCore::setDOMException): Removed overload that takes an exception code and message
3104         string separately; no longer needed.
3105
3106         * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
3107         rather than forward declaring. Added more of the ExceptionOr handling
3108         functions; some just declared and not yet defined. Updated for changes
3109         to ExceptionOr interface. Removed the createDOMException function that takes
3110         only an exception code; not needed outside JSDOMBinding.cpp.
3111
3112         * bindings/js/JSXMLHttpRequestCustom.cpp:
3113         (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
3114         of ExceptionCode. Added some FIXMEs as well.
3115         (WebCore::JSXMLHttpRequest::responseText): Ditto.
3116         (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
3117
3118         * bindings/scripts/CodeGeneratorJS.pm:
3119         (GenerateImplementation): Fixed if statements to follow WebKit coding style
3120         rather than using extra braces. Added call to propagateException for SetterMayThrowException.
3121         (GenerateSerializerFunction): Fixed if statements as above.
3122         (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
3123         void return type and MayThrowException.
3124         (GenerateReturnParameters): Tweaked coding style a bit.
3125         (addIterableProperties): Fixed if statements as above.
3126         (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
3127         and MayThrowException.
3128         (GenerateConstructorDefinition): Used encodedJSValue() instead of
3129         JSValue::encode(JSValue()), a longer way to say the same thing.
3130
3131         * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
3132         MayThrowException, and SetterMayThrowException.
3133
3134         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3135         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3136         * bindings/scripts/test/JS/JSTestException.cpp:
3137         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3138         * bindings/scripts/test/JS/JSTestInterface.cpp:
3139         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3140         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3141         * bindings/scripts/test/JS/JSTestNode.cpp:
3142         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
3143         * bindings/scripts/test/JS/JSTestObj.cpp:
3144         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3145         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3146         * bindings/scripts/test/JS/JSattribute.cpp:
3147         Regenerated results.
3148
3149         * bindings/scripts/test/TestObj.idl: Added some test cases.
3150
3151         * dom/DOMImplementation.cpp:
3152         (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
3153         (WebCore::DOMImplementation::createDocument): Ditto.
3154
3155         * dom/DOMImplementation.idl: Added MayThrowException to two functions since
3156         I am abandoning, for now, the ability to throw exceptions without any extended
3157         attribute in the IDL file. This feature may return at some point if we figure
3158         out a way to do it for functions without return values as well as functions with.
3159
3160         * dom/Document.cpp:
3161         (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
3162         (WebCore::Document::pointerLockElement): Ditto.
3163         (WebCore::Document::inputCursor): Added. No need for this to be inlined.
3164         (WebCore::Document::setInputCursor): Changed to take Ref&&.
3165         (WebCore::Document::getSelection): Added. Moved here from TreeScope.
3166
3167         * dom/Document.h: Updated for above changes.
3168
3169         * dom/Document.idl: Tweaked formatting.
3170
3171         * dom/Exception.h: Merged the two constructors into one with a default
3172         argument value, which should be equally efficient. Added releaseMessage function.
3173         Added assertion that this is only created for actual exceptions with non-zero
3174         ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
3175         exception, we do not create an Exception if there is no exception.
3176
3177         * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
3178         exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void>
3179         specialization.
3180
3181         * dom/TreeScope.cpp:
3182         (WebCore::TreeScope::~TreeScope): Removed code dealing with
3183         m_selection, which is now in Document.
3184         (WebCore::TreeScope::getSelection): Deleted.
3185
3186         * dom/TreeScope.h: Removed DOMSelection.
3187
3188         * page/DOMSelection.cpp:
3189         (WebCore::selectionShadowAncestor): Changed to take a reference rather than
3190         a guaranteed-non-null pointer.
3191         (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of
3192         of a TreeScope*.
3193         (WebCore::DOMSelection::clearTreeScope): Deleted.
3194         (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
3195         (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
3196         of case where this returns a null string. Use ASCIILiteral.
3197         (WebCore::DOMSelection::rangeCount): Streamlined code.
3198         (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
3199         null which is already handled by the isValidForPosition function.
3200         Removed non-helpful FIXME.
3201         (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
3202         ExceptionCode.
3203         (WebCore::DOMSelection::collapseToStart): Ditto.
3204         (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
3205         for null which is already handled by the isValidForPosition function. Removed
3206         non-helpful FIXME.
3207         (WebCore::DOMSelection::setPosition): Ditto.
3208         (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
3209         ExceptionCode.
3210         (WebCore::DOMSelection::getRangeAt): Ditto.
3211         (WebCore::DOMSelection::isValidForPosition): Changed to return false when
3212         m_frame is null rather than asserting is is non-null and having every caller
3213         check m_frame before calling this.
3214
3215         * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
3216         comments. Use ExceptionOr rather than ExceptionCode.
3217
3218         * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
3219
3220         * page/DOMWindow.cpp:
3221         (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
3222         to make it more obvious if any are accidentally omitted or listed twice.
3223         (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
3224         the selection like all the other objects, rather than having it be owned by the
3225         document instead.
3226
3227         * page/DOMWindow.h: Added m_selection, sorted all the other related properties
3228         alphabetically so it's easy to compare the list here with elsewhere.
3229
3230         * replay/ReplayController.cpp:
3231         (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
3232         with a reference rather than a pointer.
3233
3234         * xml/XMLHttpRequest.cpp:
3235         (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
3236         (WebCore::XMLHttpRequest::responseXML): Ditto.
3237         (WebCore::XMLHttpRequest::setTimeout): Ditto.
3238         (WebCore::XMLHttpRequest::setResponseType): Ditto.
3239         (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
3240         (WebCore::XMLHttpRequest::open): Ditto.
3241         (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
3242         Optional<ExceptionOr> to reflect the three different states: an exception,
3243         a value to return without sending, or "continue with the send algorithm".
3244         The old code did this with a boolean plus an exception code. This sounds
3245         confusing but is easy to read at the call sites, so probably OK to keep.
3246         (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
3247         (WebCore::XMLHttpRequest::sendBytesData): Ditto.
3248         (WebCore::XMLHttpRequest::createRequest): Ditto.
3249         (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
3250         (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
3251
3252         * xml/XMLHttpRequest.h: Updated for changes above.
3253
3254         * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
3255         Changed from MayThrowLegacyException to MayThrowException.
3256
3257 2016-10-06  Sam Weinig  <sam@webkit.org>
3258
3259         Autogenerate passing union types as part of a functions variadic arguments
3260         https://bugs.webkit.org/show_bug.cgi?id=162919
3261
3262         Reviewed by Darin Adler.
3263
3264         * CMakeLists.txt:
3265         * WebCore.xcodeproj/project.pbxproj:
3266         * bindings/js/JSBindingsAllInOne.cpp:
3267         Remove deleted files.
3268
3269         * bindings/generic/IDLTypes.h:
3270         Switch to use std::reference_wrapper as it's implementation type. We may need more
3271         granularity here in the future, but this will work for now.
3272
3273         * bindings/js/JSCharacterDataCustom.cpp: Removed.
3274         * bindings/js/JSDocumentTypeCustom.cpp: Removed.
3275         * bindings/js/JSNodeOrString.cpp: Removed.
3276         * bindings/js/JSNodeOrString.h: Removed.
3277
3278         * bindings/js/JSDOMBinding.h:
3279         (WebCore::VariadicHelperBase::convert): Deleted.
3280         (WebCore::toArguments): Deleted.
3281         Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
3282         it work in terms of IDLTypes.
3283
3284         * bindings/js/JSDOMConvert.h:
3285         (WebCore::Converter<IDLInterface<T>>::convert):
3286         (WebCore::VariadicConverterBase::convert):
3287         (WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
3288         (WebCore::convertVariadicArguments):
3289
3290         * bindings/js/JSDocumentCustom.cpp:
3291         (WebCore::JSDocument::prepend): Deleted.
3292         (WebCore::JSDocument::append): Deleted.
3293         * bindings/js/JSDocumentFragmentCustom.cpp:
3294         (WebCore::JSDocumentFragment::prepend): Deleted.
3295         (WebCore::JSDocumentFragment::append): Deleted.
3296         * bindings/js/JSElementCustom.cpp:
3297         (WebCore::JSElement::before): Deleted.
3298         (WebCore::JSElement::after): Deleted.
3299         (WebCore::JSElement::replaceWith): Deleted.
3300         (WebCore::JSElement::prepend): Deleted.
3301         (WebCore::JSElement::append): Deleted.
3302         Remove now generated functions.
3303
3304         * bindings/scripts/CodeGenerator.pm:
3305         (assert):
3306         Add assert to help debugging.
3307
3308         (ParseInterface):
3309         Don't treat union types as interfaces.
3310
3311         (GetFlattenedMemberTypes):
3312         (GetNumberOfNullableMemberTypes):
3313         (GetIDLUnionMemberTypes):
3314         Implement WebIDL algorithms for getting the flattened member list of union, and use it
3315         to construct the c++ IDLType.
3316
3317         (GetBaseIDLType):
3318         (GetIDLType):
3319         Add helper to convert an parsed idlType to a c++ IDLType.
3320
3321         (IsWrapperType):
3322         Don't treat union types as wrappers.
3323         
3324         * bindings/scripts/CodeGeneratorJS.pm:
3325         (AddToImplIncludesForIDLType):
3326         Add helper for adding #includes based on a parsed idlType. It recursively handles union types.
3327
3328         (GenerateParametersCheck):
3329         Use the new convertVariadicArguments function to handle all variadic arguments, including
3330         union types.
3331
3332         * bindings/scripts/IDLParser.pm:
3333         (parseDictionaryMember):
3334         (parseAttributeRest):
3335         (parseOptionalOrRequiredArgument):
3336         (parseExceptionField):
3337         Add an idlType to domSignature and populate it.
3338
3339         * bindings/scripts/test/JS/JSTestObj.cpp:
3340         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
3341         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
3342         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
3343         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
3344         (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
3345         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3346         (WebCore::constructJSTestOverloadedConstructors5):
3347         * bindings/scripts/test/TestObj.idl:
3348         Add and update tests.
3349
3350         * dom/ChildNode.idl:
3351         * dom/ParentNode.idl:
3352         Remove Custom extended attribute.
3353
3354         * dom/ContainerNode.cpp:
3355         * dom/ContainerNode.h:
3356         * dom/Node.cpp:
3357         * dom/Node.h:
3358         Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.
3359
3360 2016-10-08  Youenn Fablet  <youenn@apple.com>
3361
3362         [Fetch API] Request constructor should provide exception messages
3363         https://bugs.webkit.org/show_bug.cgi?id=162382
3364
3365         Reviewed by Darin Adler.
3366
3367         No change of behavior, except that exceptions now have error messages.
3368
3369         Added support of exception messages to ExceptionOr.
3370         Making use of ExceptionOr for Request constructor parameter checking.
3371
3372         * Modules/fetch/FetchRequest.cpp:
3373         (WebCore::setReferrerPolicy):
3374         (WebCore::setMode):
3375         (WebCore::setCredentials):
3376         (WebCore::setCache):
3377         (WebCore::setRedirect):
3378         (WebCore::setMethod):
3379         (WebCore::setReferrer):
3380         (WebCore::buildOptions):
3381         (WebCore::FetchRequest::initializeOptions):
3382         (WebCore::FetchRequest::initializeWith):
3383         * Modules/fetch/FetchRequest.h:
3384         * Modules/fetch/FetchRequest.idl:
3385         * bindings/js/JSDOMBinding.cpp:
3386         (WebCore::setDOMException):
3387         * bindings/js/JSDOMBinding.h:
3388         (WebCore::toJS):
3389         (WebCore::toJSNewlyCreated):
3390         * dom/Exception.h:
3391         (WebCore::Exception::code):
3392         (WebCore::Exception::message):
3393         (WebCore::Exception::Exception):
3394         * dom/ExceptionOr.h: