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