5420fd30161e73f4804c271f55e06c65f01ac65c
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         [DOMJIT] Implement Node accessors in DOMJIT
4         https://bugs.webkit.org/show_bug.cgi?id=163005
5
6         Reviewed by Filip Pizlo.
7
8         This patch implements DOMJIT accessors in WebCore. We plan to offer 2 things in DOMJIT.
9
10             1. Hand written DOM inlining.
11
12             We inject DOMJIT::Patchpoint compiler into JSC. And JSC uses this to inline DOM operation,
13             and drop type checks. Since the operation is fully inlined, potentially it has large
14             performance boost. Note that CSS Selector JIT compiler already does the similar things:
15             accessing parentNode etc. directly by using offsets.
16
17             2. Exposing signature information.
18
19             We will offer function type signature by some representation and pass it to JSC.
20             JSC will use to drop type checks. Since IDL code generator already knows this,
21             we can automatically generate such a information. Since we don't perform any inlining,
22             the performance boost may be limited. But it's worth doing.
23
24         This patch implements the first one, hand written DOM inlining facility. We add a new IDL attribute,
25         "DOMJIT". This means that "This readonly attribute have a DOMJIT patchpoint compiler".
26         We annotate several accessors at first. "firstChild", "lastChild", "nextSibling", "previousSibling",
27         and "parentNode". And we implement DOMJIT::Patchpoint for that in JSNodeDOMJIT.cpp.
28
29         This patchpoint will be integrated into JSC's DFG and FTL. And these tiers can drop type checks and
30         inline the entire code of these accessors. JSC compiler still does not know much about DOM. And WebCore
31         does not know much about each tier of JSC. WebCore just offers the generic patchpoints and they are
32         used in both DFG and FTL tiers. The layer separation is still kept.
33
34         While very small microbenchmark[1] shows performance benefit, still we cannot improve DOM
35         benchmarks due to the lack of following implementations. Once the following implementations
36         are implemented, we will get performance boost.
37
38         1. Super polymorphic sites.
39
40             This inlining is super effective if we run some microbenchmarks. However, Dromaeo does not
41             show so much performance benefit. This is because Dromaeo's dom-traverse.html is super
42             polymorphic call site where JSC gives up optimization. For example, in the following
43             dromaeo's benchmark, we can see so various DOM nodes at the `cur.firstChild` site, like,
44             HTMLDivElement, HTMLAnchorElement, Text, Comment etc. JSC gives up optimization since we
45             encounter so many Structures. This should be optimized since they share the large part of
46             prototype-chain and they hit the exactly same CustomGetter, Node.prototype.firstChild.
47             We will handle this and when we optimize it, this DOMJIT works well on Dromaeo.
48
49                 test( "firstChild", function(){
50                     var nodes = document.body.childNodes, nl = nodes.length;
51
52                     for ( var i = 0; i < num; i++ ) {
53                         for ( var j = 0; j < nl; j++ ) {
54                             var cur = nodes[j];
55                             while ( cur )
56                                 cur = cur.firstChild;
57                             ret = cur;
58                         }
59                     }
60                 });
61
62         2. Emit code in IC.
63
64             Currently, we only optimize DOMJIT accessors in DFG and FTL. However, we should leverage
65             this DOMJIT::Patchpoint to emit inlined code even in Inline Caching (IC). We will emit
66             CheckDOM's code for IC's guard phase, and emit CallDOM's code for IC's get phase. This
67             offers performance benefit even if we live in baseline JIT code. And this should be easy.
68
69         [1]: With the following one, we can see 3x improvement (26ms v.s. 80ms).
70
71             var element = document.getElementsByTagName('div')[3];
72             var before = Date.now();
73             for (var i = 0; i < 1e7; ++i)
74                 element.firstChild;
75             console.log(Date.now() - before);
76
77         * CMakeLists.txt:
78         * ForwardingHeaders/domjit/DOMJITGetterSetter.h:
79         * ForwardingHeaders/domjit/DOMJITPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
80         * ForwardingHeaders/domjit/DOMJITPatchpointParams.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
81         * WebCore.xcodeproj/project.pbxproj:
82         * bindings/js/JSDOMGlobalObject.h:
83         * bindings/js/JSDOMWrapper.h:
84         (WebCore::JSDOMWrapper::offsetOfWrapped):
85         (WebCore::JSDOMWrapper::wrapped): Deleted.
86         * bindings/js/ScriptWrappable.h:
87         (WebCore::ScriptWrappable::offsetOfWrapper):
88         * bindings/scripts/CodeGeneratorJS.pm:
89         (GetJSCAttributesForAttribute):
90         (GenerateHeader):
91         (GeneratePropertiesHashTable):
92         (GenerateImplementation):
93         (GenerateHashTableValueArray):
94         * bindings/scripts/IDLAttributes.txt:
95         * dom/ContainerNode.h:
96         (WebCore::ContainerNode::lastChildMemoryOffset):
97         (WebCore::ContainerNode::lastChild): Deleted.
98         * dom/Node.h:
99         (WebCore::Node::flagIsContainer):
100         (WebCore::Node::flagIsText): Deleted.
101         * dom/Node.idl:
102         * domjit/DOMJITHelpers.h: Added.
103         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal):
104         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive):
105         (WebCore::DOMJITHelpers::tryLookUpWrapperCache):
106         (WebCore::DOMJITHelpers::toWrapper):
107         (WebCore::DOMJITHelpers::branchIfDOMWrapper):
108         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper):
109         (WebCore::DOMJITHelpers::branchIfNode):
110         (WebCore::DOMJITHelpers::branchIfNotNode):
111         (WebCore::DOMJITHelpers::branchIfElement):
112         (WebCore::DOMJITHelpers::branchIfNotElement):
113         (WebCore::DOMJITHelpers::branchIfDocumentWrapper):
114         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper):
115         * domjit/JSNodeDOMJIT.cpp: Added.
116         (WebCore::toWrapperSlow):
117         (WebCore::createCallDOMForOffsetAccess):
118         (WebCore::checkNode):
119         (WebCore::NodeFirstChildDOMJIT::checkDOM):
120         (WebCore::NodeFirstChildDOMJIT::callDOM):
121         (WebCore::NodeLastChildDOMJIT::checkDOM):
122         (WebCore::NodeLastChildDOMJIT::callDOM):
123         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
124         (WebCore::NodeNextSiblingDOMJIT::callDOM):
125         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
126         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
127         (WebCore::NodeParentNodeDOMJIT::checkDOM):
128         (WebCore::NodeParentNodeDOMJIT::callDOM):
129
130 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
131
132         Support InputEvent.data for the new InputEvent spec
133         https://bugs.webkit.org/show_bug.cgi?id=163113
134         <rdar://problem/28681935>
135
136         Reviewed by Darin Adler.
137
138         Introduces InputEvent.data, a string attribute that, if non-null, indicates the text to be inserted by an input
139         event. For text areas and text inputs, the 'insertText', 'insertFromPaste', 'insertFromDrop', and
140         'insertReplacementText' input types should cause subsequent `input` and `beforeinput` events to have non-null
141         data. However, for contenteditable areas, only 'insertText' leads to having data in resulting InputEvents.
142
143         To implement this, we introduce a new virtual method, CompositeEditCommand::inputEventData, which gives
144         composite editing commands the chance to vend a data string for input events they might fire (by default, this
145         is null).
146
147         Tests: fast/events/input-events-paste-data.html
148                fast/events/input-events-typing-data.html
149
150         * dom/InputEvent.cpp:
151         (WebCore::InputEvent::InputEvent):
152         * dom/InputEvent.h:
153         * dom/InputEvent.idl:
154
155         Currently, our InputEventInit struct is wrong. According to the UI-Events spec at www.w3.org/TR/uievents/, the
156         init struct for an InputEvent should contain a data string (added in this patch) as well as an isComposing flag
157         (to be added in a future patch along with composition support). While adding support for the data attribute, we
158         tweak the InputEvent IDL and headers slightly to adjust for this.
159
160         * dom/Node.cpp:
161         (WebCore::Node::dispatchInputEvent):
162         * dom/Node.h:
163         * editing/CompositeEditCommand.h:
164         (WebCore::CompositeEditCommand::inputEventData):
165         * editing/EditCommand.cpp:
166         (WebCore::EditCommand::isEditingTextAreaOrTextInput):
167         * editing/EditCommand.h:
168         * editing/Editor.cpp:
169         (WebCore::dispatchBeforeInputEvent):
170         (WebCore::dispatchInputEvent):
171         (WebCore::dispatchBeforeInputEvents):
172         (WebCore::dispatchInputEvents):
173         (WebCore::Editor::willApplyEditing):
174         (WebCore::Editor::appliedEditing):
175         (WebCore::Editor::setBaseWritingDirection):
176         (WebCore::Editor::computeAndSetTypingStyle):
177         * editing/ReplaceRangeWithTextCommand.cpp:
178         (WebCore::ReplaceRangeWithTextCommand::inputEventData):
179         * editing/ReplaceRangeWithTextCommand.h:
180         * editing/ReplaceSelectionCommand.cpp:
181         (WebCore::ReplaceSelectionCommand::inputEventData):
182         * editing/ReplaceSelectionCommand.h:
183         * editing/SpellingCorrectionCommand.cpp:
184         (WebCore::SpellingCorrectionCommand::inputEventData):
185         * editing/SpellingCorrectionCommand.h:
186         * editing/TypingCommand.cpp:
187         (WebCore::TypingCommand::TypingCommand):
188         (WebCore::TypingCommand::inputEventData):
189         (WebCore::TypingCommand::willAddTypingToOpenCommand):
190         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
191         * editing/TypingCommand.h:
192         * html/HTMLFormControlElement.cpp:
193         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
194         * html/HTMLInputElement.cpp:
195         (WebCore::HTMLInputElement::setEditingValue):
196         (WebCore::HTMLInputElement::setValueFromRenderer):
197         * html/HTMLSelectElement.cpp:
198         (WebCore::HTMLSelectElement::listBoxOnChange):
199         (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
200
201 2016-10-10  Commit Queue  <commit-queue@webkit.org>
202
203         Unreviewed, rolling out r206972.
204         https://bugs.webkit.org/show_bug.cgi?id=163227
205
206         Making EWS flaky (Requested by bfulgham_ on #webkit).
207
208         Reverted changeset:
209
210         "[CMake] CMake does not support the dep files for implicit
211         dependency"
212         https://bugs.webkit.org/show_bug.cgi?id=161433
213         http://trac.webkit.org/changeset/206972
214
215 2016-10-10  Darin Adler  <darin@apple.com>
216
217         Move media source from legacy to new DOM exceptions
218         https://bugs.webkit.org/show_bug.cgi?id=163201
219
220         Reviewed by Chris Dumez.
221
222         * Modules/mediasource/MediaSource.cpp: Removed unneeded includes.
223         (WebCore::MediaSource::create): Use auto.
224         (WebCore::MediaSource::MediaSource): Initialize m_mediaElement in class definition.
225         (WebCore::MediaSource::setLiveSeekableRange): Use ExceptionOr.
226         (WebCore::MediaSource::clearLiveSeekableRange): Ditto.
227         (WebCore::MediaSource::setDuration): Ditto.
228         (WebCore::MediaSource::setDurationInternal): Ditto.
229         (WebCore::MediaSource::endOfStream): Ditto.
230         (WebCore::MediaSource::streamEndedWithError): Use bufferedInternal.
231         (WebCore::MediaSource::addSourceBuffer): Use ExceptionOr.
232         (WebCore::MediaSource::removeSourceBuffer): Ditto.
233         (WebCore::MediaSource::detachFromElement): Use removeSourceBuffer
234         without IGNORE_EXCEPTION since that is now the default behavior.
235         (WebCore::MediaSource::activeRanges): Use bufferedInternal.
236         (WebCore::MediaSource::createSourceBufferPrivate): Use ExceptionOr.
237
238         * Modules/mediasource/MediaSource.h: Removed unneeded includes.
239         Made more things private and also private rather than protected.
240
241         * Modules/mediasource/MediaSource.idl: Use non-legacy exceptions.
242
243         * Modules/mediasource/SourceBuffer.cpp:
244         (WebCore::SourceBuffer::buffered): Use ExceptionOr.
245         (WebCore::SourceBuffer::setTimestampOffset): Ditto.
246         (WebCore::SourceBuffer::setAppendWindowStart): Ditto.
247         (WebCore::SourceBuffer::setAppendWindowEnd): Ditto.
248         (WebCore::SourceBuffer::appendBuffer): Ditto.
249         (WebCore::SourceBuffer::abort): Ditto.
250         (WebCore::SourceBuffer::remove): Ditto.
251         (WebCore::SourceBuffer::appendBufferInternal): Ditto.
252         (WebCore::SourceBuffer::setMode): Ditto.
253
254         * Modules/mediasource/SourceBuffer.h: Removed unneeded includes.
255         Updated for above changes. Made more things private.
256
257         * Modules/mediasource/SourceBuffer.idl: Use non-legacy exceptions.
258
259         * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h:
260         Added now-needed include of MediaSourcePrivate.h.
261
262 2016-10-10  Jer Noble  <jer.noble@apple.com>
263
264         Address flaky airplay-* LayouTests
265         https://bugs.webkit.org/show_bug.cgi?id=163044
266
267         Reviewed by Brent Fulgham.
268
269         Two separate problems conspired to make airplay tests a bit flaky:
270
271         For one, when the HTMLMediaElement clears its MediaPlayer, it won't necessarily notify
272         clients that it has stopped playing to a wireless target. The WebMediaSessionManager may
273         eventually cause this value to reset, but it's asynchronous, and may fire after the next
274         test starts. Reset this state explicitly.
275
276         For two, the state of the mock playback target picker was not being reset between test
277         invocations.
278
279         * html/HTMLMediaElement.cpp:
280         (WebCore::HTMLMediaElement::clearMediaPlayer):
281         * testing/Internals.cpp:
282         (WebCore::Internals::resetToConsistentState):
283
284 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
285
286         Correct typo in comment (patining -> painting).
287
288         * platform/graphics/GraphicsContext.cpp:
289         (WebCore::GraphicsContext::centerLineAndCutOffCorners):
290
291 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
292
293         Reduce code duplication between CG, Cairo, and Direct2D
294         https://bugs.webkit.org/show_bug.cgi?id=163157
295
296         Reviewed by Darin Adler.
297
298         Move a number of routines that have been copied-and-pasted to different
299         platform files into the main GraphicsContext.cpp file.
300
301         No new tests because there is no change in behavior.
302
303         * platform/graphics/GraphicsContext.cpp:
304         (WebCore::GraphicsContext::dashedLineCornerWidthForStrokeWidth): Added.
305         (WebCore::GraphicsContext::dashedLinePatternWidthForStrokeWidth): Added.
306         (WebCore::GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth): Added.
307         (WebCore::GraphicsContext::centerLineAndCutOffCorners): Added.
308         * platform/graphics/GraphicsContext.h:
309         * platform/graphics/cairo/GraphicsContextCairo.cpp:
310         (WebCore::GraphicsContext::drawLine): Call new helper function.
311         * platform/graphics/cg/GraphicsContextCG.cpp:
312         (WebCore::GraphicsContext::drawLine): Ditto.
313         * platform/graphics/win/GraphicsContextDirect2D.cpp:
314         (WebCore::GraphicsContext::drawLine): Ditto.
315
316 2016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
317
318         REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
319         https://bugs.webkit.org/show_bug.cgi?id=163170
320
321         Reviewed by Michael Catanzaro.
322
323         Do not assume NetworkingContext is non-null and valid before using it.
324
325         * platform/network/soup/ResourceHandleSoup.cpp:
326         (WebCore::gotHeadersCallback):
327         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
328
329 2016-10-10  Youenn Fablet  <youenn@apple.com>
330
331         Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin
332         https://bugs.webkit.org/show_bug.cgi?id=162390
333
334         Reviewed by Darin Adler.
335
336         No observable change of behavior.
337
338         Renaming CachedResource::isClean to isCORSSameOrigin to match html spec terminology.
339         Making use of it to check whether images taint canvas and whether script errors should be sanitized.
340
341         Some asserts are added to ensure that a resource fetched using one origin is not reused for another origin.
342
343         * dom/ScriptExecutionContext.cpp:
344         (WebCore::ScriptExecutionContext::sanitizeScriptError):
345         * html/HTMLLinkElement.cpp:
346         (WebCore::HTMLLinkElement::initializeStyleSheet):
347         * html/canvas/CanvasRenderingContext.cpp:
348         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
349         * loader/cache/CachedImage.cpp:
350         (WebCore::CachedImage::isOriginClean):
351         * loader/cache/CachedResource.cpp:
352         (WebCore::CachedResource::isCORSSameOrigin):
353         * loader/cache/CachedResource.h:
354
355 2016-10-10  Youenn Fablet  <youenn@apple.com>
356
357         [Fetch API] Memory cache should not bypass redirect mode
358         https://bugs.webkit.org/show_bug.cgi?id=162959
359
360         Reviewed by Darin Adler.
361
362         Test: http/tests/fetch/redirectmode-and-preload.html
363
364         Ensure reloading of resources if the redirect modes are different between request and cached resource, and
365         cached resource has redirections.
366
367         As a temporary workaround, we activate resource update for raw resources in
368         shouldUpdateCachedResourceWithCurrentRequest but disable it in canUpdateFromResource.
369         This allows handling reloading of resources with different redirection mode in canUpdateFromResource.
370
371         A future patch should allow loading cached raw resources from other cached raw resources.
372
373         * loader/cache/CachedResource.h:
374         (WebCore::CachedResource::hasRedirections):
375         * loader/cache/CachedResourceLoader.cpp:
376         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
377         (WebCore::canUpdateFromResource):
378         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
379
380 2016-10-10  Youenn Fablet  <youenn@apple.com>
381
382         Attribute getter binding generated code should use more references
383         https://bugs.webkit.org/show_bug.cgi?id=163179
384
385         Reviewed by Darin Adler.
386
387         No change of behavior.
388
389         Using more references in attribute getter generated code since BindingCaller::attribute can do the
390         pointer-to-references checks once for all.
391
392         Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or
393         pointers (methods and attribute setters) are to be used.
394         Future refactoring should allign methods/attribute setters to attribute getters.
395
396         * bindings/js/JSDOMBinding.h:
397         (WebCore::BindingCaller::attribute):
398         * bindings/scripts/CodeGeneratorJS.pm:
399         (GenerateImplementation):
400         (GenerateCallWith):
401         (NativeToJSValue):
402         (JSValueToNative):
403         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
404         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
405         * bindings/scripts/test/JS/JSTestException.cpp:
406         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
407         * bindings/scripts/test/JS/JSTestInterface.cpp:
408         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
409         * bindings/scripts/test/JS/JSTestNode.cpp:
410         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
411         * bindings/scripts/test/JS/JSTestObj.cpp:
412         * bindings/scripts/test/JS/JSattribute.cpp:
413
414 2016-10-10  Youenn Fablet  <youenn@apple.com>
415
416         Fix Mac Win build after https://trac.webkit.org/changeset/206966
417         https://bugs.webkit.org/show_bug.cgi?id=163199
418
419         Unreviewed.
420
421         * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT.
422
423 2016-10-09  Antti Koivisto  <antti@apple.com>
424
425         Enable optimized stylesheet updates in shadow trees
426         https://bugs.webkit.org/show_bug.cgi?id=163180
427
428         Reviewed by Darin Adler.
429
430         When we get a new stylesheet (for example when load completes) we invalidate only
431         those elements in DOM that are affected by the new sheet. This patch makes the
432         optimization also work in shadow trees.
433
434         Test: fast/shadow-dom/scoped-style-invalidation.html
435
436         * css/StyleInvalidationAnalysis.cpp:
437         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
438         * css/StyleInvalidationAnalysis.h:
439         * dom/Document.cpp:
440         (WebCore::Document::didRemoveAllPendingStylesheet):
441         * style/StyleScope.cpp:
442         (WebCore::Style::Scope::removePendingSheet):
443         (WebCore::Style::Scope::analyzeStyleSheetChange):
444         (WebCore::Style::Scope::updateActiveStyleSheets):
445
446 2016-10-10  Youenn Fablet  <youenn@apple.com>
447
448         Refactor binding generated casted-this checks for attribute setters
449         https://bugs.webkit.org/show_bug.cgi?id=163181
450
451         Reviewed by Darin Adler.
452
453         No change of behavior.
454         Covered by existing tests and binding expectations.
455
456         Adding support for attribute setter in BindingCaller.
457         Updating binding generator to make use of it.
458         Future refactoring should use more reference and rename castedThis to thisObject, like for getters.
459
460         * bindings/js/JSDOMBinding.h:
461         (WebCore::BindingCaller::setAttribute):
462         * bindings/scripts/CodeGeneratorJS.pm:
463         (GenerateImplementation):
464         * bindings/scripts/test/JS/JSTestInterface.cpp:
465         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
466         * bindings/scripts/test/JS/JSTestNode.cpp:
467         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
468         * bindings/scripts/test/JS/JSTestObj.cpp:
469         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
470         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
471
472 2016-10-09  Darin Adler  <darin@apple.com>
473
474         Move encrypted media from legacy to new DOM exceptions
475         https://bugs.webkit.org/show_bug.cgi?id=163194
476
477         Reviewed by Youenn Fablet.
478
479         * Modules/encryptedmedia/CDM.cpp:
480         (WebCore::CDM::createSession): Take a reference instead of a pointer.
481         * Modules/encryptedmedia/CDM.h: Updated for above change.
482
483         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
484         (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
485         (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
486         (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
487         sets m_session to null.
488         (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
489         (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
490         (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
491         of calling the keys function.
492         (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
493         calling the setError function.
494         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
495         (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
496         instead of writing !isClosed.
497         (WebCore::WebKitMediaKeySession::setError): Deleted.
498
499         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
500         unneeded includes. Changed create to take a reference instead of a pointer.
501         Made most members and base classes private instead of public. Also removed
502         a few now-unneeded functions. Made everything that was formerly protected
503         private instead, since the two are the same in a final class.
504
505         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
506         Moved from MayThrowLegacyException to MayThrowException.
507
508         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
509         (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
510         (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
511         Also initialize m_mediaElement in the class definition.
512         (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
513         (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
514         insteead of pointer to create. Also removed unneeded separate checks for null
515         strings in code that already calls isEmpty.
516         (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
517         in code that already calls isEmpty.
518         (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
519         (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
520
521         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
522         Changed cdm() function to return a reference. Initialize m_mediaElement.
523         Use private instead of protected.
524
525         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
526         and MayThrowException instead of the legacy versions.
527
528 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
529
530         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
531         https://bugs.webkit.org/show_bug.cgi?id=162982
532
533         Reviewed by Jer Noble.
534
535         Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use
536         the WebKit prefix in the implementations. This will prevent conflicts between
537         interfaces with same names in both the legacy API and the future EME API.
538
539         Most of the interfaces in this legacy API already used the WebKit prefix when
540         exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets
541         prefixed in this patch.
542
543         The interface implementations for this legacy API are also moved under the
544         Modules/encryptedmedia/legacy/ directory.
545
546         No new tests -- covered by existing tests (with the relevant changes reflected
547         in the updated baselines).
548
549         * CMakeLists.txt:
550         * DerivedSources.cpp:
551         * DerivedSources.make:
552         * Modules/encryptedmedia/CDM.cpp:
553         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
554         (WebCore::CDMSessionClearKey::generateKeyRequest):
555         (WebCore::CDMSessionClearKey::update):
556         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
557         (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
558         (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent):
559         (WebCore::WebKitMediaKeyMessageEvent::eventInterface):
560         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h.
561         (WebCore::WebKitMediaKeyMessageEvent::create):
562         (WebCore::WebKitMediaKeyMessageEvent::createForBindings):
563         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl.
564         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp.
565         (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
566         (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent):
567         (WebCore::WebKitMediaKeyNeededEvent::eventInterface):
568         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h.
569         (WebCore::WebKitMediaKeyNeededEvent::create):
570         (WebCore::WebKitMediaKeyNeededEvent::createForBindings):
571         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl.
572         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp.
573         (WebCore::WebKitMediaKeySession::create):
574         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
575         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
576         (WebCore::WebKitMediaKeySession::setError):
577         (WebCore::WebKitMediaKeySession::close):
578         (WebCore::WebKitMediaKeySession::cachedKeyForKeyId):
579         (WebCore::WebKitMediaKeySession::sessionId):
580         (WebCore::WebKitMediaKeySession::generateKeyRequest):
581         (WebCore::WebKitMediaKeySession::keyRequestTimerFired):
582         (WebCore::WebKitMediaKeySession::update):
583         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
584         (WebCore::WebKitMediaKeySession::sendMessage):
585         (WebCore::WebKitMediaKeySession::sendError):
586         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
587         (WebCore::WebKitMediaKeySession::hasPendingActivity):
588         (WebCore::WebKitMediaKeySession::stop):
589         (WebCore::WebKitMediaKeySession::activeDOMObjectName):
590         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension):
591         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h.
592         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl.
593         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp.
594         (WebCore::WebKitMediaKeys::create):
595         (WebCore::WebKitMediaKeys::WebKitMediaKeys):
596         (WebCore::WebKitMediaKeys::~WebKitMediaKeys):
597         (WebCore::WebKitMediaKeys::createSession):
598         (WebCore::WebKitMediaKeys::isTypeSupported):
599         (WebCore::WebKitMediaKeys::setMediaElement):
600         (WebCore::WebKitMediaKeys::cdmMediaPlayer):
601         (WebCore::WebKitMediaKeys::keyAdded):
602         (WebCore::WebKitMediaKeys::cachedKeyForKeyId):
603         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
604         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl.
605         * bindings/js/JSDictionary.cpp:
606         (WebCore::JSDictionary::convertValue):
607         * bindings/js/JSDictionary.h:
608         * dom/EventNames.in:
609         * dom/EventTargetFactory.in:
610         * html/HTMLMediaElement.cpp:
611         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
612         (WebCore::HTMLMediaElement::setMediaKeys):
613         * html/HTMLMediaElement.h:
614         (WebCore::HTMLMediaElement::keys):
615         * html/HTMLMediaElement.idl:
616         * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h.
617         (WebCore::WebKitMediaKeyError::create):
618         (WebCore::WebKitMediaKeyError::WebKitMediaKeyError):
619         * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl.
620         * testing/MockCDM.cpp:
621         (WebCore::MockCDMSession::generateKeyRequest):
622         (WebCore::MockCDMSession::update):
623
624 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
625
626         Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement
627         https://bugs.webkit.org/show_bug.cgi?id=163111
628
629         Reviewed by Alex Christensen.
630
631         Remove three method implementations in HTMLMediaElement which had their
632         declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA
633         purge in r206440.
634
635         No new tests -- no changes in behavior.
636
637         * html/HTMLMediaElement.cpp:
638         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted.
639         (WebCore::HTMLMediaElement::webkitAddKey): Deleted.
640         (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted.
641
642 2016-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
643
644         Support InputEvent.inputType for the new InputEvent spec
645         https://bugs.webkit.org/show_bug.cgi?id=163025
646         <rdar://problem/28658092>
647
648         Reviewed by Darin Adler.
649
650         Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
651         map EditActions to inputType names, and also split out ambiguous EditActions (such as
652         EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
653         EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
654
655         In places where we create CompositeEditCommands, we now pass in these specific EditActions
656         where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
657         CompositeEditCommand for its input type name, which it derives from its editingAction.
658
659         Tests: fast/events/before-input-prevent-biu.html
660                fast/events/before-input-prevent-cut.html
661                fast/events/before-input-prevent-paste.html
662                fast/events/before-input-prevent-typing.html
663                fast/events/before-input-prevent-undo.html
664
665         * dom/InputEvent.h:
666         * dom/Node.cpp:
667         (WebCore::Node::dispatchInputEvent):
668         * dom/Node.h:
669         * editing/CompositeEditCommand.cpp:
670         (WebCore::CompositeEditCommand::apply):
671         (WebCore::CompositeEditCommand::inputEventTypeName):
672
673         Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
674         should have.
675
676         * editing/CompositeEditCommand.h:
677         (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
678         * editing/EditAction.h:
679         * editing/EditCommand.cpp:
680         (WebCore::inputTypeNameForEditingAction):
681         * editing/EditCommand.h:
682         * editing/Editor.cpp:
683         (WebCore::Editor::willApplyEditing):
684         (WebCore::Editor::appliedEditing):
685         (WebCore::Editor::willUnapplyEditing):
686         (WebCore::Editor::unappliedEditing):
687         (WebCore::Editor::willReapplyEditing):
688         (WebCore::Editor::reappliedEditing):
689         (WebCore::Editor::computeAndSetTypingStyle):
690         * editing/InsertListCommand.cpp:
691         (WebCore::InsertListCommand::editingAction):
692         * editing/InsertListCommand.h:
693         (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
694         (WebCore::InsertListCommand::editingAction): Deleted.
695         * editing/ReplaceRangeWithTextCommand.cpp:
696         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
697         * editing/SpellingCorrectionCommand.cpp:
698         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
699         * editing/TypingCommand.cpp:
700         (WebCore::editActionForTypingCommand):
701         (WebCore::TypingCommand::TypingCommand):
702         (WebCore::TypingCommand::inputEventTypeName):
703
704         The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
705         Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
706         use the last updated editing action rather than the default (initial) editing action.
707
708         (WebCore::TypingCommand::willAddTypingToOpenCommand):
709         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
710         (WebCore::TypingCommand::insertParagraphSeparator):
711         * editing/TypingCommand.h:
712
713 2016-10-09  Darin Adler  <darin@apple.com>
714
715         Move ApplePaySession from legacy to new DOM exceptions
716         https://bugs.webkit.org/show_bug.cgi?id=163191
717
718         Reviewed by Sam Weinig.
719
720         * Modules/applepay/ApplePaySession.cpp:
721         (WebCore::ApplePaySession::create): Use ExceptionOr.
722         (WebCore::ApplePaySession::ApplePaySession): Moved initialization
723         of two of the data members to class definition.
724         (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr.
725         (WebCore::ApplePaySession::canMakePayments): Ditto.
726         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto.
727         (WebCore::ApplePaySession::openPaymentSetup): Ditto.
728         (WebCore::ApplePaySession::begin): Ditto.
729         (WebCore::ApplePaySession::abort): Ditto.
730         (WebCore::ApplePaySession::completeMerchantValidation): Ditto.
731         (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto.
732         (WebCore::ApplePaySession::completeShippingContactSelection): Ditto.
733         (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto.
734         (WebCore::ApplePaySession::completePayment): Ditto.
735         (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of
736         using a RefPtr type and * for event dispatching.
737         (WebCore::ApplePaySession::didAuthorizePayment): Ditto.
738         (WebCore::ApplePaySession::didSelectShippingMethod): Ditto.
739         (WebCore::ApplePaySession::didSelectShippingContact): Ditto.
740         (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto.
741         (WebCore::ApplePaySession::didCancelPayment): Ditto.
742         (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing
743         inside the downcast.
744
745         * Modules/applepay/ApplePaySession.h: Updated for changes above.
746
747         * Modules/applepay/ApplePaySession.idl: Use MayThrowException.
748
749         * bindings/js/JSApplePaySessionCustom.cpp:
750         (WebCore::JSApplePaySession::completeShippingMethodSelection):
751         Use propagateException.
752         (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto.
753         (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto.
754
755         * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean.
756
757         * bindings/scripts/CodeGeneratorJS.pm:
758         (GenerateConstructorDefinition): Generate the different arguments for
759         toJSNewlyCreated when ConstructorMayThrowException is specified that
760         activate the version of that function that handles exceptions.
761
762         * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException.
763
764 2016-10-09  Darin Adler  <darin@apple.com>
765
766         Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
767         https://bugs.webkit.org/show_bug.cgi?id=163178
768
769         Reviewed by Sam Weinig.
770
771         * Modules/indexeddb/IDBCursor.cpp:
772         (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
773         using an ExceptionCode out argument, since this function just needs to
774         indicate failure, not actually throw an exception.
775         (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
776         ExceptionCodeWithMessage out argument.
777         (WebCore::IDBCursor::advance): Ditto.
778         (WebCore::IDBCursor::continueFunction): Ditto.
779         (WebCore::IDBCursor::deleteFunction): Ditto.
780         * Modules/indexeddb/IDBCursor.h: Updated for above changes.
781
782         * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
783         Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
784
785         * Modules/indexeddb/IDBDatabase.cpp:
786         (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
787         using an ExceptionCodeWithMessage out argument.
788         (WebCore::IDBDatabase::transaction): Ditto.
789         (WebCore::IDBDatabase::deleteObjectStore): Ditto.
790         * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
791
792         * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
793         MayThrowLegacyExceptionWithMessage.
794
795         * Modules/indexeddb/IDBFactory.cpp:
796         (WebCore::IDBFactory::open): Return ExceptionOr instead of
797         using an ExceptionCodeWithMessage out argument.
798         (WebCore::IDBFactory::openInternal): Ditto.
799         (WebCore::IDBFactory::deleteDatabase): Ditto.
800         (WebCore::IDBFactory::cmp): Ditto.
801         * Modules/indexeddb/IDBFactory.h: Updated for above changes.
802
803         * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
804         MayThrowLegacyExceptionWithMessage.
805
806         * Modules/indexeddb/IDBIndex.cpp:
807         (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
808         using an ExceptionCodeWithMessage out argument.
809         (WebCore::IDBIndex::count): Ditto.
810         (WebCore::IDBIndex::doCount): Ditto.
811         (WebCore::IDBIndex::openKeyCursor): Ditto.
812         (WebCore::IDBIndex::get): Ditto.
813         (WebCore::IDBIndex::doGet): Ditto.
814         (WebCore::IDBIndex::getKey): Ditto.
815         (WebCore::IDBIndex::doGetKey): Ditto.
816         * Modules/indexeddb/IDBIndex.h: Updated for above changes.
817
818         * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
819         MayThrowLegacyExceptionWithMessage.
820
821         * Modules/indexeddb/IDBKeyRange.cpp:
822         (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
823         using an ExceptionCode out argument.
824         (WebCore::IDBKeyRange::lowerBound): Ditto.
825         (WebCore::IDBKeyRange::upperBound): Ditto.
826         (WebCore::IDBKeyRange::bound): Ditto.
827         * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
828         * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
829         MayThrowLegacyException.
830
831         * Modules/indexeddb/IDBObjectStore.cpp:
832         (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
833         using an ExceptionCodeWithMessage out argument.
834         (WebCore::IDBObjectStore::get): Ditto.
835         (WebCore::IDBObjectStore::add): Ditto.
836         (WebCore::IDBObjectStore::put): Ditto.
837         (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
838         (WebCore::IDBObjectStore::putOrAdd): Ditto.
839         (WebCore::IDBObjectStore::deleteFunction): Ditto.
840         (WebCore::IDBObjectStore::doDelete): Ditto.
841         (WebCore::IDBObjectStore::clear): Ditto.
842         (WebCore::IDBObjectStore::createIndex): Ditto.
843         (WebCore::IDBObjectStore::index): Ditto.
844         (WebCore::IDBObjectStore::deleteIndex): Ditto.
845         (WebCore::IDBObjectStore::count): Ditto.
846         (WebCore::IDBObjectStore::doCount): Ditto.
847         * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
848
849         * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
850         MayThrowLegacyExceptionWithMessage.
851
852         * Modules/indexeddb/IDBRequest.cpp:
853         (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
854         (WebCore::IDBRequest::error): Return ExceptionOr instead of
855         using an ExceptionCodeWithMessage out argument.
856         * Modules/indexeddb/IDBRequest.h: Updated for above changes.
857
858         * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
859         GetterMayThrowLegacyExceptionWithMessage.
860
861         * Modules/indexeddb/IDBTransaction.cpp:
862         (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
863         using an ExceptionCode out argument, since this function just needs to
864         indicate failure, not actually throw an exception.
865         (WebCore::IDBTransaction::db): Tweaked code a bit.
866         (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
867         (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
868         using an ExceptionCodeWithMessage out argument.
869         (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
870         (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
871         using an ExceptionCodeWithMessage out argument.
872         (WebCore::IDBTransaction::internalAbort): Added a version that asserts
873         instead of throwing an exception for internal use.
874         (WebCore::IDBTransaction::stop): Call internalAbort.
875         * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
876
877         * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
878         MayThrowLegacyExceptionWithMessage.
879
880         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
881         (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
882         a Ref instead of a RefPtr, since the function can never return null.
883         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
884         * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
885
886         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
887         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
888         exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
889         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
890         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
891         (WebCore::MediaEndpointSessionDescription::create): Ditto.
892         * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
893
894         * bindings/js/JSDOMBinding.cpp:
895         (WebCore::createDOMException): Added overload for Exception.
896         (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
897         Updated code to call the new createDOMException function.
898         (WebCore::setDOMExceptionSlow): Ditto.
899         (WebCore::setDOMException): Ditto.
900
901         * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
902         an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
903         interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
904
905         * bindings/js/JSDOMPromise.cpp:
906         (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
907         * bindings/js/JSDOMPromise.h: Updated for above change.
908
909         * bindings/js/JSHistoryCustom.cpp:
910         (WebCore::JSHistory::pushState): Use propagateException to deal with
911         ExceptionOr instead of ExceptionCodeWithMessage.
912         (WebCore::JSHistory::replaceState): Ditto.
913
914         * bindings/js/JSIDBDatabaseCustom.cpp:
915         (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
916         to deal with ExceptionOr rather than setDOMException to deal
917         with ExceptionCodeWithMessage.
918
919         * bindings/js/JSIDBRequestCustom.cpp:
920         (WebCore::JSIDBRequest::result): Use propagateException and
921         Exception rather than setDOMException and ExceptionCodeWithMessage.
922
923         * bindings/scripts/CodeGeneratorJS.pm:
924         (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
925         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
926         (GenerateReturnParameters): Ditto.
927         (GenerateImplementationFunctionCall): Ditto.
928         (GenerateConstructorDefinition): Ditto.
929
930         * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
931         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
932
933         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
934         * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
935
936         * dom/CustomElementRegistry.idl: Use MayThrowException instead of
937         MayThrowLegacyExceptionWithMessage.
938
939         * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
940         once, removed include of WTFString.h and switched to using instead of typedef.
941
942         * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
943         to cut down a little on unnecessary reference count churn.
944
945         * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
946         classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
947
948         * page/DOMWindow.cpp:
949         (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
950
951         * page/History.cpp:
952         (WebCore::History::History): Take a reference instead of a pointer.
953         (WebCore::History::length): Tweaked to use a local variable.
954         (WebCore::History::state): Return a pointer instead of a PassRefPtr.
955         (WebCore::History::stateInternal): Ditto. Also use early return consistently.
956         (WebCore::History::isSameAsCurrentState): Updated for above change.
957         (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
958         ExceptionCodeWithMessage out argument.
959
960         * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
961         Updated for changes above.
962
963         * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
964
965 2016-10-07  Ryosuke Niwa  <rniwa@webkit.org>
966
967         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
968         https://bugs.webkit.org/show_bug.cgi?id=163145
969
970         Reviewed by Darin Adler.
971
972         The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless
973         of whether they have been invalidated or not.
974
975         Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache.
976
977         Test: fast/dom/NodeList/form-labels-length.html
978
979         * dom/Document.cpp:
980         (WebCore::Document::Document):
981         (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to
982         happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches.
983         * dom/Document.h:
984         * dom/Node.cpp:
985         (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via
986         LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all.
987         We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it
988         is not a safe operation.
989
990 2016-10-09  Chris Dumez  <cdumez@apple.com>
991
992         Update generated bindings code so that dictionary structures no longer need explicit constructors
993         https://bugs.webkit.org/show_bug.cgi?id=163188
994
995         Reviewed by Darin Adler.
996
997         Update generated bindings code so that dictionary structures no longer
998         need explicit constructors. We now call the default constructor and
999         then initialize the members one by one.
1000
1001         * bindings/scripts/CodeGeneratorJS.pm:
1002         (GenerateDictionaryImplementationContent):
1003         * bindings/scripts/test/JS/JSTestObj.cpp:
1004         (WebCore::convertDictionary<TestObj::Dictionary>):
1005         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1006         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1007         (WebCore::convertDictionary<AlternateDictionaryName>):
1008         (WebCore::convertDictionary<TestObj::ParentDictionary>):
1009         (WebCore::convertDictionary<TestObj::ChildDictionary>):
1010         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1011         (WebCore::convertDictionary<TestStandaloneDictionary>):
1012         * dom/ClipboardEvent.h:
1013         * dom/CustomEvent.h:
1014         * dom/EventInit.h:
1015         (WebCore::EventInit::EventInit): Deleted.
1016         * dom/EventModifierInit.h:
1017         (WebCore::EventModifierInit::EventModifierInit): Deleted.
1018         * dom/KeyboardEvent.cpp:
1019         (WebCore::KeyboardEvent::KeyboardEvent):
1020         * dom/KeyboardEvent.h:
1021         * dom/KeyboardEvent.idl:
1022         * dom/UIEventInit.h:
1023         (WebCore::UIEventInit::UIEventInit): Deleted.
1024         * editing/Editor.cpp:
1025         (WebCore::Editor::dispatchCPPEvent):
1026
1027 2016-10-09  Fujii Hironori  <Hironori.Fujii@sony.com>
1028
1029         [CMake] CMake does not support the dep files for implicit dependency
1030         https://bugs.webkit.org/show_bug.cgi?id=161433
1031
1032         Reviewed by Brent Fulgham.
1033
1034         Created a Perl script to generate all IDL bindings for CMake.
1035         This script can regenerate outdated bindings by based on the
1036         supplemental dependency and dep files created by
1037         '--write-dependencies' switch of generate-bindings.pl.
1038
1039         add_custom_target is used to invoke the script instead of
1040         add_custom_command because Ninja deletes all output files before
1041         executing the command in case of add_custom_command.
1042
1043         USES_TERMINAL option of add_custom_target has two effects:
1044         1) Not buffering output of the command
1045         2) Invoking the command in the special Ninja pool which inhibits parallel build
1046         One needs to use CMake 3.2 or later to enable this feature.
1047
1048         * CMakeLists.txt: Specified target names for
1049         GENERATE_BINDINGS. Added dependency for the targets.
1050         * bindings/scripts/generate-bindings-all.pl: Added.
1051
1052 2016-10-09  Chris Dumez  <cdumez@apple.com>
1053
1054         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
1055         https://bugs.webkit.org/show_bug.cgi?id=163176
1056
1057         Reviewed by Darin Adler.
1058
1059         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
1060         and use a proper constructor instead, like in the specification:
1061         - https://www.w3.org/TR/uievents/#interface-keyboardevent
1062
1063         Also add support for passing modifierAltGraph / modifierCapsLock
1064         in the inialization dictionary as we support those modifiers via
1065         getModifierState().
1066
1067         No new tests, extended existing test.
1068
1069         * CMakeLists.txt:
1070         * DerivedSources.cpp:
1071         * DerivedSources.make:
1072         * WebCore.xcodeproj/project.pbxproj:
1073         * dom/EventModifierInit.h: Added.
1074         (WebCore::EventModifierInit::EventModifierInit):
1075         * dom/EventModifierInit.idl: Added.
1076         * dom/KeyboardEvent.cpp:
1077         (WebCore::KeyboardEvent::KeyboardEvent):
1078         (WebCore::KeyboardEvent::getModifierState):
1079         * dom/KeyboardEvent.h:
1080         * dom/KeyboardEvent.idl:
1081         * dom/MouseRelatedEvent.cpp:
1082         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1083         * dom/MouseRelatedEvent.h:
1084         * dom/UIEvent.cpp:
1085         (WebCore::UIEvent::UIEvent):
1086         * dom/UIEvent.h:
1087         (WebCore::UIEvent::create): Deleted.
1088         * dom/UIEventInit.h: Added.
1089         (WebCore::UIEventInit::UIEventInit):
1090         * dom/UIEventInit.idl: Added.
1091         * dom/UIEventWithKeyState.h:
1092         (WebCore::UIEventWithKeyState::altGraphKey):
1093         (WebCore::UIEventWithKeyState::capsLockKey):
1094         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1095         (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
1096         (WebCore::UIEventWithKeyState::shiftKey): Deleted.
1097         (WebCore::UIEventWithKeyState::altKey): Deleted.
1098         (WebCore::UIEventWithKeyState::metaKey): Deleted.
1099
1100 2016-10-09  Youenn Fablet  <youenn@apple.com>
1101
1102         Promise attribute getters should reject promises in case of casted-this errors
1103         https://bugs.webkit.org/show_bug.cgi?id=163167
1104
1105         Reviewed by Darin Adler.
1106
1107         Covered by updated test and binding test.
1108
1109         * bindings/js/JSDOMBinding.cpp:
1110         (WebCore::throwGetterTypeError):
1111         (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters
1112         * bindings/js/JSDOMBinding.h:
1113         (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors.
1114         * bindings/scripts/CodeGeneratorJS.pm:
1115         (GenerateImplementation):
1116         * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported.
1117         (WebCore::jsTestObjTestReadOnlyPromiseAttribute):
1118         (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter):
1119         * bindings/scripts/test/TestObj.idl:
1120
1121 2016-10-08  Chris Dumez  <cdumez@apple.com>
1122
1123         [Mac] Write WebArchive to the pasteboard when copying image in WebKit
1124         https://bugs.webkit.org/show_bug.cgi?id=163100
1125
1126         Reviewed by Darin Adler.
1127
1128         Write WebArchive to the pasteboard when copying image in WebKit. This
1129         fixes pasting such images to a content editable field in WebKit because
1130         Web archives take priority over RTFD when reading from the pasteboard
1131         in WebKit.
1132
1133         Using RTFD when pasting the image in WebKit was causing issues because:
1134         1. The pasted image would not be displayed because our RTFD import code
1135            is buggy.
1136         2. The pasted image URL was a webkit-fake-url://
1137         3. Formatting associated to the image (e.g. inline style) would be lost
1138
1139         No new tests, unskipped existing test on WebKit2.
1140
1141         * editing/Editor.h:
1142         * editing/mac/EditorMac.mm:
1143         (WebCore::Editor::imageInWebArchiveFormat):
1144         (WebCore::Editor::writeImageToPasteboard):
1145         * platform/Pasteboard.h:
1146         * platform/mac/PasteboardMac.mm:
1147         (WebCore::writableTypesForImage):
1148         (WebCore::Pasteboard::write):
1149         (WebCore::Pasteboard::Pasteboard): Deleted.
1150         (WebCore::Pasteboard::createForCopyAndPaste): Deleted.
1151
1152 2016-10-08  Chris Dumez  <cdumez@apple.com>
1153
1154         Update CustomEvent to stop using legacy [ConstructorTemplate=Event]
1155         https://bugs.webkit.org/show_bug.cgi?id=163174
1156
1157         Reviewed by Darin Adler.
1158
1159         Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and
1160         use an actual constructor instead, like in the specification:
1161         - https://dom.spec.whatwg.org/#interface-customevent
1162
1163         There is a very minor behavior change when explictly passing undefined
1164         as detail value in CustomEventInit. We used to initialize detail to
1165         undefined but we now initialize it to null instead, which is its default
1166         value. The new behavior matches the one of Chrome and Firefox.
1167
1168         * bindings/scripts/CodeGeneratorJS.pm:
1169         (GenerateDefaultValue):
1170         (GenerateDictionaryImplementationContent):
1171         * bindings/scripts/test/JS/JSTestObj.cpp:
1172         (WebCore::convertDictionary<TestObj::Dictionary>):
1173         * bindings/scripts/test/TestObj.idl:
1174         * dom/CustomEvent.cpp:
1175         (WebCore::CustomEvent::CustomEvent):
1176         * dom/CustomEvent.h:
1177         * dom/CustomEvent.idl:
1178         * dom/Document.cpp:
1179         (WebCore::Document::createEvent):
1180         * dom/Event.cpp:
1181         (WebCore::Event::Event):
1182         * dom/Event.h:
1183
1184 2016-10-08  Chris Dumez  <cdumez@apple.com>
1185
1186         Add support for ClipboardEvent
1187         https://bugs.webkit.org/show_bug.cgi?id=163164
1188
1189         Reviewed by Darin Adler.
1190
1191         Add support for ClipboardEvent:
1192         - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces
1193
1194         Firefox and Chrome both already support this.
1195
1196         This gives us 5 more points on html5test.com.
1197
1198         Tests: editing/pasteboard/clipboard-event.html
1199                fast/events/clipboard-event-constructor.html
1200
1201         * CMakeLists.txt:
1202         * DerivedSources.cpp:
1203         * DerivedSources.make:
1204         * WebCore.xcodeproj/project.pbxproj:
1205         * bindings/js/JSEventCustom.cpp:
1206         (WebCore::toJSNewlyCreated): Deleted.
1207
1208         * bindings/scripts/CodeGeneratorJS.pm:
1209         (WillConvertUndefinedToDefaultParameterValue):
1210         We use [] as implicit default value for dictionary parameters. This change
1211         is so we call convertDictionary<>() even if the parameter is undefined
1212         because we want to pass a struct to the implementation initialized with
1213         the default member values defined in the IDL.
1214
1215         * dom/ClipboardEvent.cpp:
1216         (WebCore::ClipboardEvent::ClipboardEvent):
1217         (WebCore::ClipboardEvent::eventInterface):
1218         * dom/ClipboardEvent.h:
1219         * dom/ClipboardEvent.idl: Added.
1220         * dom/Event.cpp:
1221         (WebCore::Event::Event):
1222         * dom/Event.h:
1223         * dom/Event.idl:
1224         * dom/EventInit.h: Added.
1225         * dom/EventInit.idl: Added.
1226         * dom/EventNames.in:
1227         * dom/MouseEvent.h:
1228         (WebCore::MouseEvent::dataTransfer):
1229         * editing/Editor.cpp:
1230         (WebCore::Editor::dispatchCPPEvent):
1231
1232 2016-10-06  Darin Adler  <darin@apple.com>
1233
1234         Next step on moving to modern way to return DOM exceptions
1235         https://bugs.webkit.org/show_bug.cgi?id=163016
1236
1237         Reviewed by Ryosuke Niwa.
1238
1239         * Modules/fetch/FetchRequest.idl:
1240         Added MayThrowException to initializeWith since it throws an exception.
1241
1242         * bindings/js/JSCallbackData.cpp:
1243         (WebCore::JSCallbackData::invokeCallback):
1244         * bindings/js/JSCustomElementInterface.cpp:
1245         (WebCore::JSCustomElementInterface::invokeCallback):
1246         * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
1247         (WebCore::JSSQLStatementErrorCallback::handleEvent):
1248         * bindings/js/JSCustomXPathNSResolver.cpp:
1249         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
1250         * bindings/js/JSDOMBinding.cpp:
1251         (WebCore::reportException):
1252         (WebCore::reportCurrentException):
1253         * bindings/js/JSErrorHandler.cpp:
1254         (WebCore::JSErrorHandler::handleEvent):
1255         * bindings/js/JSEventListener.cpp:
1256         (WebCore::JSEventListener::handleEvent):
1257         * bindings/js/JSMutationCallback.cpp:
1258         (WebCore::JSMutationCallback::call):
1259         * bindings/js/JSNodeFilterCustom.cpp:
1260         (WebCore::JSNodeFilter::acceptNode):
1261         * bindings/js/ScheduledAction.cpp:
1262         (WebCore::ScheduledAction::executeFunctionInContext):
1263         * bindings/js/ScriptController.cpp:
1264         (WebCore::ScriptController::evaluateInWorld):
1265         * bindings/js/WorkerScriptController.cpp:
1266         (WebCore::WorkerScriptController::evaluate):
1267         * inspector/PageScriptDebugServer.cpp:
1268         (WebCore::PageScriptDebugServer::reportException):
1269         Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
1270         or in some cases use auto instead.
1271
1272         * bindings/js/JSDOMBinding.cpp:
1273         (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
1274         for clarity.
1275         (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
1276         (WebCore::propagateExceptionSlowPath): Added.
1277         (WebCore::propagateException): Added.
1278         (WebCore::setDOMException): Removed overload that takes an exception code and message
1279         string separately; no longer needed.
1280
1281         * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
1282         rather than forward declaring. Added more of the ExceptionOr handling
1283         functions; some just declared and not yet defined. Updated for changes
1284         to ExceptionOr interface. Removed the createDOMException function that takes
1285         only an exception code; not needed outside JSDOMBinding.cpp.
1286
1287         * bindings/js/JSXMLHttpRequestCustom.cpp:
1288         (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
1289         of ExceptionCode. Added some FIXMEs as well.
1290         (WebCore::JSXMLHttpRequest::responseText): Ditto.
1291         (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
1292
1293         * bindings/scripts/CodeGeneratorJS.pm:
1294         (GenerateImplementation): Fixed if statements to follow WebKit coding style
1295         rather than using extra braces. Added call to propagateException for SetterMayThrowException.
1296         (GenerateSerializerFunction): Fixed if statements as above.
1297         (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
1298         void return type and MayThrowException.
1299         (GenerateReturnParameters): Tweaked coding style a bit.
1300         (addIterableProperties): Fixed if statements as above.
1301         (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
1302         and MayThrowException.
1303         (GenerateConstructorDefinition): Used encodedJSValue() instead of
1304         JSValue::encode(JSValue()), a longer way to say the same thing.
1305
1306         * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
1307         MayThrowException, and SetterMayThrowException.
1308
1309         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1310         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1311         * bindings/scripts/test/JS/JSTestException.cpp:
1312         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1313         * bindings/scripts/test/JS/JSTestInterface.cpp:
1314         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1315         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1316         * bindings/scripts/test/JS/JSTestNode.cpp:
1317         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1318         * bindings/scripts/test/JS/JSTestObj.cpp:
1319         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1320         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1321         * bindings/scripts/test/JS/JSattribute.cpp:
1322         Regenerated results.
1323
1324         * bindings/scripts/test/TestObj.idl: Added some test cases.
1325
1326         * dom/DOMImplementation.cpp:
1327         (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
1328         (WebCore::DOMImplementation::createDocument): Ditto.
1329
1330         * dom/DOMImplementation.idl: Added MayThrowException to two functions since
1331         I am abandoning, for now, the ability to throw exceptions without any extended
1332         attribute in the IDL file. This feature may return at some point if we figure
1333         out a way to do it for functions without return values as well as functions with.
1334
1335         * dom/Document.cpp:
1336         (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
1337         (WebCore::Document::pointerLockElement): Ditto.
1338         (WebCore::Document::inputCursor): Added. No need for this to be inlined.
1339         (WebCore::Document::setInputCursor): Changed to take Ref&&.
1340         (WebCore::Document::getSelection): Added. Moved here from TreeScope.
1341
1342         * dom/Document.h: Updated for above changes.
1343
1344         * dom/Document.idl: Tweaked formatting.
1345
1346         * dom/Exception.h: Merged the two constructors into one with a default
1347         argument value, which should be equally efficient. Added releaseMessage function.
1348         Added assertion that this is only created for actual exceptions with non-zero
1349         ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
1350         exception, we do not create an Exception if there is no exception.
1351
1352         * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
1353         exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void>
1354         specialization.
1355
1356         * dom/TreeScope.cpp:
1357         (WebCore::TreeScope::~TreeScope): Removed code dealing with
1358         m_selection, which is now in Document.
1359         (WebCore::TreeScope::getSelection): Deleted.
1360
1361         * dom/TreeScope.h: Removed DOMSelection.
1362
1363         * page/DOMSelection.cpp:
1364         (WebCore::selectionShadowAncestor): Changed to take a reference rather than
1365         a guaranteed-non-null pointer.
1366         (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of
1367         of a TreeScope*.
1368         (WebCore::DOMSelection::clearTreeScope): Deleted.
1369         (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
1370         (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
1371         of case where this returns a null string. Use ASCIILiteral.
1372         (WebCore::DOMSelection::rangeCount): Streamlined code.
1373         (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
1374         null which is already handled by the isValidForPosition function.
1375         Removed non-helpful FIXME.
1376         (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
1377         ExceptionCode.
1378         (WebCore::DOMSelection::collapseToStart): Ditto.
1379         (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
1380         for null which is already handled by the isValidForPosition function. Removed
1381         non-helpful FIXME.
1382         (WebCore::DOMSelection::setPosition): Ditto.
1383         (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
1384         ExceptionCode.
1385         (WebCore::DOMSelection::getRangeAt): Ditto.
1386         (WebCore::DOMSelection::isValidForPosition): Changed to return false when
1387         m_frame is null rather than asserting is is non-null and having every caller
1388         check m_frame before calling this.
1389
1390         * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
1391         comments. Use ExceptionOr rather than ExceptionCode.
1392
1393         * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
1394
1395         * page/DOMWindow.cpp:
1396         (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
1397         to make it more obvious if any are accidentally omitted or listed twice.
1398         (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
1399         the selection like all the other objects, rather than having it be owned by the
1400         document instead.
1401
1402         * page/DOMWindow.h: Added m_selection, sorted all the other related properties
1403         alphabetically so it's easy to compare the list here with elsewhere.
1404
1405         * replay/ReplayController.cpp:
1406         (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
1407         with a reference rather than a pointer.
1408
1409         * xml/XMLHttpRequest.cpp:
1410         (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
1411         (WebCore::XMLHttpRequest::responseXML): Ditto.
1412         (WebCore::XMLHttpRequest::setTimeout): Ditto.
1413         (WebCore::XMLHttpRequest::setResponseType): Ditto.
1414         (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
1415         (WebCore::XMLHttpRequest::open): Ditto.
1416         (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
1417         Optional<ExceptionOr> to reflect the three different states: an exception,
1418         a value to return without sending, or "continue with the send algorithm".
1419         The old code did this with a boolean plus an exception code. This sounds
1420         confusing but is easy to read at the call sites, so probably OK to keep.
1421         (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
1422         (WebCore::XMLHttpRequest::sendBytesData): Ditto.
1423         (WebCore::XMLHttpRequest::createRequest): Ditto.
1424         (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
1425         (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
1426
1427         * xml/XMLHttpRequest.h: Updated for changes above.
1428
1429         * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
1430         Changed from MayThrowLegacyException to MayThrowException.
1431
1432 2016-10-06  Sam Weinig  <sam@webkit.org>
1433
1434         Autogenerate passing union types as part of a functions variadic arguments
1435         https://bugs.webkit.org/show_bug.cgi?id=162919
1436
1437         Reviewed by Darin Adler.
1438
1439         * CMakeLists.txt:
1440         * WebCore.xcodeproj/project.pbxproj:
1441         * bindings/js/JSBindingsAllInOne.cpp:
1442         Remove deleted files.
1443
1444         * bindings/generic/IDLTypes.h:
1445         Switch to use std::reference_wrapper as it's implementation type. We may need more
1446         granularity here in the future, but this will work for now.
1447
1448         * bindings/js/JSCharacterDataCustom.cpp: Removed.
1449         * bindings/js/JSDocumentTypeCustom.cpp: Removed.
1450         * bindings/js/JSNodeOrString.cpp: Removed.
1451         * bindings/js/JSNodeOrString.h: Removed.
1452
1453         * bindings/js/JSDOMBinding.h:
1454         (WebCore::VariadicHelperBase::convert): Deleted.
1455         (WebCore::toArguments): Deleted.
1456         Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
1457         it work in terms of IDLTypes.
1458
1459         * bindings/js/JSDOMConvert.h:
1460         (WebCore::Converter<IDLInterface<T>>::convert):
1461         (WebCore::VariadicConverterBase::convert):
1462         (WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
1463         (WebCore::convertVariadicArguments):
1464
1465         * bindings/js/JSDocumentCustom.cpp:
1466         (WebCore::JSDocument::prepend): Deleted.
1467         (WebCore::JSDocument::append): Deleted.
1468         * bindings/js/JSDocumentFragmentCustom.cpp:
1469         (WebCore::JSDocumentFragment::prepend): Deleted.
1470         (WebCore::JSDocumentFragment::append): Deleted.
1471         * bindings/js/JSElementCustom.cpp:
1472         (WebCore::JSElement::before): Deleted.
1473         (WebCore::JSElement::after): Deleted.
1474         (WebCore::JSElement::replaceWith): Deleted.
1475         (WebCore::JSElement::prepend): Deleted.
1476         (WebCore::JSElement::append): Deleted.
1477         Remove now generated functions.
1478
1479         * bindings/scripts/CodeGenerator.pm:
1480         (assert):
1481         Add assert to help debugging.
1482
1483         (ParseInterface):
1484         Don't treat union types as interfaces.
1485
1486         (GetFlattenedMemberTypes):
1487         (GetNumberOfNullableMemberTypes):
1488         (GetIDLUnionMemberTypes):
1489         Implement WebIDL algorithms for getting the flattened member list of union, and use it
1490         to construct the c++ IDLType.
1491
1492         (GetBaseIDLType):
1493         (GetIDLType):
1494         Add helper to convert an parsed idlType to a c++ IDLType.
1495
1496         (IsWrapperType):
1497         Don't treat union types as wrappers.
1498         
1499         * bindings/scripts/CodeGeneratorJS.pm:
1500         (AddToImplIncludesForIDLType):
1501         Add helper for adding #includes based on a parsed idlType. It recursively handles union types.
1502
1503         (GenerateParametersCheck):
1504         Use the new convertVariadicArguments function to handle all variadic arguments, including
1505         union types.
1506
1507         * bindings/scripts/IDLParser.pm:
1508         (parseDictionaryMember):
1509         (parseAttributeRest):
1510         (parseOptionalOrRequiredArgument):
1511         (parseExceptionField):
1512         Add an idlType to domSignature and populate it.
1513
1514         * bindings/scripts/test/JS/JSTestObj.cpp:
1515         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
1516         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1517         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1518         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1519         (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
1520         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1521         (WebCore::constructJSTestOverloadedConstructors5):
1522         * bindings/scripts/test/TestObj.idl:
1523         Add and update tests.
1524
1525         * dom/ChildNode.idl:
1526         * dom/ParentNode.idl:
1527         Remove Custom extended attribute.
1528
1529         * dom/ContainerNode.cpp:
1530         * dom/ContainerNode.h:
1531         * dom/Node.cpp:
1532         * dom/Node.h:
1533         Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.
1534
1535 2016-10-08  Youenn Fablet  <youenn@apple.com>
1536
1537         [Fetch API] Request constructor should provide exception messages
1538         https://bugs.webkit.org/show_bug.cgi?id=162382
1539
1540         Reviewed by Darin Adler.
1541
1542         No change of behavior, except that exceptions now have error messages.
1543
1544         Added support of exception messages to ExceptionOr.
1545         Making use of ExceptionOr for Request constructor parameter checking.
1546
1547         * Modules/fetch/FetchRequest.cpp:
1548         (WebCore::setReferrerPolicy):
1549         (WebCore::setMode):
1550         (WebCore::setCredentials):
1551         (WebCore::setCache):
1552         (WebCore::setRedirect):
1553         (WebCore::setMethod):
1554         (WebCore::setReferrer):
1555         (WebCore::buildOptions):
1556         (WebCore::FetchRequest::initializeOptions):
1557         (WebCore::FetchRequest::initializeWith):
1558         * Modules/fetch/FetchRequest.h:
1559         * Modules/fetch/FetchRequest.idl:
1560         * bindings/js/JSDOMBinding.cpp:
1561         (WebCore::setDOMException):
1562         * bindings/js/JSDOMBinding.h:
1563         (WebCore::toJS):
1564         (WebCore::toJSNewlyCreated):
1565         * dom/Exception.h:
1566         (WebCore::Exception::code):
1567         (WebCore::Exception::message):
1568         (WebCore::Exception::Exception):
1569         * dom/ExceptionOr.h:
1570         (WebCore::ExceptionOr<ReturnType>::exceptionMessage):
1571
1572 2016-10-08  Youenn Fablet  <youenn@apple.com>
1573
1574         Refactor binding generated casted-this checks
1575         https://bugs.webkit.org/show_bug.cgi?id=162677
1576
1577         Reviewed by Darin Adler.
1578
1579         No change of behavior.
1580
1581         Split the attribute getter function in two, one with the signature expected by JSCore and one used after casted-this checks.
1582
1583         The second function takes directly a JSXX object and returns a JSValue instead of an EncodedJSValue.
1584         In the future, the second function should only take references.
1585
1586         Introducing BindingCaller as a way to templatize binding code used to cast thisValue with the desired JSXX value.
1587         This allows implementing the first function using the second function as template parameter.
1588
1589         Introducing JSClass::castForAttribute as a way to encapsulate differences in the way to handle thisValue access.
1590
1591         * bindings/js/JSDOMBinding.h:
1592         (WebCore::BindingCaller::attribute):
1593         * bindings/scripts/CodeGeneratorJS.pm:
1594         (GenerateHeader):
1595         (GenerateImplementation):
1596         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1597         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1598         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1599         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1600         * bindings/scripts/test/JS/JSTestException.cpp:
1601         * bindings/scripts/test/JS/JSTestException.h:
1602         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1603         * bindings/scripts/test/JS/JSTestInterface.cpp:
1604         * bindings/scripts/test/JS/JSTestInterface.h:
1605         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1606         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
1607         * bindings/scripts/test/JS/JSTestNode.cpp:
1608         * bindings/scripts/test/JS/JSTestNode.h:
1609         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1610         * bindings/scripts/test/JS/JSTestNondeterministic.h:
1611         * bindings/scripts/test/JS/JSTestObj.cpp:
1612         * bindings/scripts/test/JS/JSTestObj.h:
1613         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1614         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1615         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1616         * bindings/scripts/test/JS/JSTestTypedefs.h:
1617         * bindings/scripts/test/JS/JSattribute.cpp:
1618         * bindings/scripts/test/JS/JSattribute.h:
1619
1620 2016-10-08  Enrique Ocaña González  <eocanha@igalia.com>
1621
1622         Missing include in MediaDescription
1623         https://bugs.webkit.org/show_bug.cgi?id=162873
1624
1625         Reviewed by Xabier Rodriguez-Calvar.
1626
1627         Added missing header.
1628
1629         * platform/MediaDescription.h:
1630
1631 2016-10-08  Antti Koivisto  <antti@apple.com>
1632
1633         Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
1634         https://bugs.webkit.org/show_bug.cgi?id=163148
1635
1636         Reviewed by Andreas Kling.
1637
1638         Reduce duplication between Document and ShadowRoot.
1639
1640         * css/CSSComputedStyleDeclaration.cpp:
1641         (WebCore::ComputedStyleExtractor::propertyValue):
1642         * css/CSSStyleSheet.cpp:
1643         (WebCore::CSSStyleSheet::didMutateRules):
1644         * css/ElementRuleCollector.cpp:
1645         (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
1646         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
1647         * css/MediaQueryMatcher.cpp:
1648         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
1649         * css/StyleMedia.cpp:
1650         (WebCore::StyleMedia::matchMedium):
1651         * css/parser/SizesAttributeParser.cpp:
1652         (WebCore::SizesAttributeParser::mediaConditionMatches):
1653         * dom/Document.cpp:
1654         (WebCore::Document::~Document):
1655         (WebCore::Document::childrenChanged):
1656         (WebCore::Document::isPageBoxVisible):
1657         (WebCore::Document::pageSizeAndMarginsInPixels):
1658         (WebCore::Document::userAgentShadowTreeStyleResolver):
1659         (WebCore::Document::fontsNeedUpdate):
1660         (WebCore::Document::didClearStyleResolver):
1661         (WebCore::Document::updateViewportUnitsOnResize):
1662         (WebCore::Document::createStyleResolver): Deleted.
1663         (WebCore::Document::clearStyleResolver): Deleted.
1664         * dom/Document.h:
1665         (WebCore::Document::styleResolverIfExists): Deleted.
1666         (WebCore::Document::ensureStyleResolver): Deleted.
1667         * dom/Element.cpp:
1668         (WebCore::Element::styleResolver):
1669         * dom/ShadowRoot.cpp:
1670         (WebCore::ShadowRoot::styleResolver): Deleted.
1671         (WebCore::ShadowRoot::styleResolverIfExists): Deleted.
1672         (WebCore::ShadowRoot::resetStyleResolver): Deleted.
1673         * dom/ShadowRoot.h:
1674         * page/DOMWindow.cpp:
1675         (WebCore::DOMWindow::getMatchedCSSRules):
1676         * page/FrameView.cpp:
1677         (WebCore::FrameView::layout):
1678         * page/Page.cpp:
1679         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
1680         * page/PrintContext.cpp:
1681         (WebCore::PrintContext::pageProperty):
1682         * platform/MemoryPressureHandler.cpp:
1683         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
1684         * style/AttributeChangeInvalidation.cpp:
1685         (WebCore::Style::mayBeAffectedByHostStyle):
1686         * style/ClassChangeInvalidation.cpp:
1687         (WebCore::Style::mayBeAffectedByHostStyle):
1688         * style/IdChangeInvalidation.cpp:
1689         (WebCore::Style::mayBeAffectedByHostStyle):
1690         * style/StyleScope.cpp:
1691         (WebCore::Style::Scope::resolver):
1692         (WebCore::Style::Scope::resolverIfExists):
1693         (WebCore::Style::Scope::clearResolver):
1694         (WebCore::Style::Scope::analyzeStyleSheetChange):
1695         (WebCore::Style::Scope::updateActiveStyleSheets):
1696         (WebCore::Style::Scope::updateStyleResolver):
1697         (WebCore::Style::Scope::styleResolver): Deleted.
1698         (WebCore::Style::Scope::styleResolverIfExists): Deleted.
1699         * style/StyleScope.h:
1700         * style/StyleSharingResolver.cpp:
1701         (WebCore::Style::SharingResolver::resolve):
1702         (WebCore::Style::SharingResolver::canShareStyleWithElement):
1703         * style/StyleTreeResolver.cpp:
1704         (WebCore::Style::TreeResolver::Scope::Scope):
1705         (WebCore::Style::TreeResolver::resolve):
1706
1707 2016-10-07  Chris Dumez  <cdumez@apple.com>
1708
1709         window.navigator.language incorrectly returns all lowercase string
1710         https://bugs.webkit.org/show_bug.cgi?id=163096
1711
1712         Reviewed by Darin Adler.
1713
1714         Update navigator.language so that it no longer returns an all lowercase
1715         string (e.g. 'en-us' -> 'en-US'). This matches the behavior of other
1716         browsers and the specification which indicate we should return a
1717         BCP 47 language tag:
1718         - https://html.spec.whatwg.org/#dom-navigator-language
1719         - https://tools.ietf.org/html/bcp47
1720
1721         The other call sites relying on userPreferredLanguages() use case
1722         insensitive comparison so they will not break.
1723
1724         No new tests, updated existing test.
1725
1726         * platform/Language.h:
1727
1728 2016-10-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1729
1730         Support onbeforeinput event handling for the new InputEvent spec
1731         https://bugs.webkit.org/show_bug.cgi?id=163021
1732         <rdar://problem/28658073>
1733
1734         Reviewed by Darin Adler.
1735
1736         Adds support for parsing the onbeforeinput attribute, and for sending default-preventable
1737         `beforeinput` InputEvents to the page. To do this, we introduce two new virtual methods:
1738         willApplyCommand and didApplyCommand on the CompositeEditCommand that are called before and
1739         after CompositeEditCommand::doApply, respectively. willApplyCommand indicates whether or not
1740         the composite editor command should proceed with applying the command.
1741
1742         Tweaks existing layout tests and adds new tests.
1743
1744         Tests: fast/events/before-input-events-different-start-end-elements.html
1745                fast/events/before-input-events-prevent-default-in-textfield.html
1746                fast/events/before-input-events-prevent-default.html
1747
1748         * dom/Document.idl:
1749         * dom/Element.idl:
1750         * dom/EventNames.h:
1751         * dom/Node.cpp:
1752         (WebCore::Node::dispatchInputEvent):
1753         (WebCore::Node::defaultEventHandler):
1754
1755         Currently, we fire input events in Node in response to dispatching a webkitEditableContentChangedEvent. After
1756         some discussion, Ryosuke and I believe that it will be ok to instead directly dispatch the input event where we
1757         would normally dispatch a webkitEditableContentChangedEvent.
1758
1759         * editing/CompositeEditCommand.cpp:
1760         (WebCore::EditCommandComposition::unapply):
1761         (WebCore::EditCommandComposition::reapply):
1762
1763         Added calls to Editor::willUnapplyEditing and Editor::willReapplyEditing.
1764
1765         (WebCore::CompositeEditCommand::willApplyCommand):
1766         (WebCore::CompositeEditCommand::apply):
1767         (WebCore::CompositeEditCommand::didApplyCommand):
1768
1769         Added new virtual functions, willApplyCommand and didApplyCommand, that surround a call to
1770         CompositeEditCommand::doApply. By default, they call willApplyEditing and appliedEditing on the editor, but may
1771         be overridden in special cases, such as in TypingCommand, where we invoke appliedEditing after adding a new
1772         typing command to the last open command.
1773
1774         If willApplyCommand returns false, CompositeEditCommand::apply will bail and not proceed with the command.
1775
1776         * editing/CompositeEditCommand.h:
1777         * editing/Editor.cpp:
1778         (WebCore::dispatchBeforeInputEvent):
1779         (WebCore::dispatchBeforeInputEvents):
1780         (WebCore::dispatchInputEvents):
1781         (WebCore::Editor::willApplyEditing):
1782         (WebCore::Editor::appliedEditing):
1783         (WebCore::Editor::willUnapplyEditing):
1784         (WebCore::Editor::unappliedEditing):
1785         (WebCore::Editor::willReapplyEditing):
1786         (WebCore::Editor::reappliedEditing):
1787         (WebCore::Editor::computeAndSetTypingStyle):
1788         (WebCore::dispatchEditableContentChangedEvents): Deleted.
1789         * editing/Editor.h:
1790         * editing/TypingCommand.cpp:
1791         (WebCore::TypingCommand::willApplyCommand):
1792         (WebCore::TypingCommand::didApplyCommand):
1793         (WebCore::TypingCommand::willAddTypingToOpenCommand):
1794         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1795         (WebCore::TypingCommand::insertLineBreak):
1796         (WebCore::TypingCommand::insertParagraphSeparator):
1797         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
1798         (WebCore::TypingCommand::deleteKeyPressed):
1799         (WebCore::TypingCommand::forwardDeleteKeyPressed):
1800         (WebCore::TypingCommand::deleteSelection):
1801
1802         These now invoke willAddTypingToOpenCommand before proceeding with creating the command and applying it. The
1803         flow is now:
1804             - willAddTypingToOpenCommand
1805             - create and apply a new command
1806             - typingAddedToOpenCommand
1807
1808         * editing/TypingCommand.h:
1809         (WebCore::TypingCommand::preservesTypingStyle): Deleted.
1810         (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator): Deleted.
1811         (WebCore::TypingCommand::setShouldRetainAutocorrectionIndicator): Deleted.
1812         (WebCore::TypingCommand::shouldStopCaretBlinking): Deleted.
1813         * html/HTMLAttributeNames.in:
1814         * html/HTMLElement.cpp:
1815         (WebCore::HTMLElement::createEventHandlerNameMap):
1816
1817 2016-10-07  Nan Wang  <n_wang@apple.com>
1818
1819         AX: <figcaption> should be AXTitleUIElement for other content inside the <figure>
1820         https://bugs.webkit.org/show_bug.cgi?id=108996
1821
1822         Reviewed by Chris Fleizach.
1823
1824         Exposed the figcaption element to be the AXTitleUIElement for the figure element. And used
1825         the figcaption's content as the accessible name of the figure. Also, updated the figure element's
1826         role description on Mac.
1827         Accessible name and description calculation for figure elements: 
1828         https://w3c.github.io/html-aam/#figure-and-figcaption-elements
1829
1830         Test: accessibility/mac/figure-element.html
1831
1832         * English.lproj/Localizable.strings:
1833         * accessibility/AccessibilityNodeObject.cpp:
1834         (WebCore::AccessibilityNodeObject::captionForFigure):
1835         (WebCore::AccessibilityNodeObject::alternativeText):
1836         * accessibility/AccessibilityNodeObject.h:
1837         * accessibility/AccessibilityObject.cpp:
1838         (WebCore::AccessibilityObject::isFigure):
1839         (WebCore::AccessibilityObject::isSuperscriptStyleGroup): Deleted.
1840         * accessibility/AccessibilityObject.h:
1841         * accessibility/AccessibilityRenderObject.cpp:
1842         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
1843         (WebCore::AccessibilityRenderObject::titleUIElement):
1844         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1845         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1846         (-[WebAccessibilityObjectWrapper roleDescription]):
1847         * platform/LocalizedStrings.cpp:
1848         (WebCore::AXFigureText):
1849         * platform/LocalizedStrings.h:
1850         * platform/efl/LocalizedStringsEfl.cpp:
1851         (WebCore::AXFigureText):
1852         * platform/gtk/LocalizedStringsGtk.cpp:
1853         (WebCore::AXFigureText):
1854
1855 2016-10-07  Alex Christensen  <achristensen@webkit.org>
1856
1857         Non-special URL fragments should percent-encode non-ASCII characters
1858         https://bugs.webkit.org/show_bug.cgi?id=163153
1859
1860         Reviewed by Tim Horton.
1861
1862         This is needed to keep compatibility with data URLs with non-ASCII characters after a '#'
1863         which works in Chrome, Firefox, and Safari, while maintaining compatibility with Chrome, IE, and Edge
1864         which keep non-ASCII characters in the fragments of special URLs.
1865         This was proposed to the spec in https://github.com/whatwg/url/issues/150
1866
1867         Covered by new API tests.
1868
1869         * platform/URLParser.cpp:
1870         (WebCore::URLParser::syntaxViolation):
1871         Removed assertion because we now have fragments that need percent encoding but are all ASCII.
1872         (WebCore::URLParser::fragmentSyntaxViolation):
1873         (WebCore::URLParser::parse):
1874
1875 2016-10-07  Brent Fulgham  <bfulgham@apple.com>
1876
1877         EventHandler functions that need to guarantee event handler lifetime need to use Ref<Frame>
1878         https://bugs.webkit.org/show_bug.cgi?id=98617
1879         <rdar://problem/12778649>
1880
1881         Reviewed by Daniel Bates.
1882
1883         Improve stability by ensuring that the Frame holding an active EventHandler is kept
1884         alive while in the process of handling events and executing JavaScript.
1885
1886         No new tests since there is no change in behavior.
1887
1888         * page/EventHandler.cpp:
1889         (WebCore::EventHandler::handleMousePressEventSingleClick): Protect the Frame with a Ref<>.
1890         (WebCore::EventHandler::handleMousePressEvent): Ditto.
1891         (WebCore::EventHandler::handleMouseDraggedEvent): Ditto.
1892         (WebCore::EventHandler::eventMayStartDrag): Ditto.
1893         (WebCore::EventHandler::handleMouseReleaseEvent): Ditto.
1894         (WebCore::EventHandler::hitTestResultAtPoint): Ditto.
1895         (WebCore::EventHandler::scrollRecursively): Ditto.
1896         (WebCore::EventHandler::logicalScrollRecursively): Ditto.
1897         (WebCore::EventHandler::selectCursor): Ditto.
1898         (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto.
1899         (WebCore::EventHandler::mouseMoved): Ditto.
1900         (WebCore::EventHandler::handleMouseMoveEvent): Ditto.
1901         (WebCore::EventHandler::handleMouseForceEvent): Ditto.
1902         (WebCore::EventHandler::dispatchDragEvent): Ditto.
1903         (WebCore::EventHandler::updateDragAndDrop): Ditto.
1904         (WebCore::EventHandler::cancelDragAndDrop): Ditto.
1905         (WebCore::EventHandler::performDragAndDrop): Ditto.
1906         (WebCore::EventHandler::prepareMouseEvent): Ditto.
1907         (WebCore::EventHandler::updateMouseEventTargetNode): Ditto.
1908         (WebCore::EventHandler::dispatchMouseEvent): Ditto.
1909         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
1910         (WebCore::EventHandler::handleWheelEvent): Ditto.
1911         (WebCore::EventHandler::defaultWheelEventHandler): Ditto.
1912         (WebCore::EventHandler::sendContextMenuEvent): Ditto.
1913         (WebCore::EventHandler::sendContextMenuEventForKey): Ditto.
1914         (WebCore::EventHandler::hoverTimerFired): Ditto.
1915         (WebCore::EventHandler::keyEvent): Ditto.
1916         (WebCore::EventHandler::defaultKeyboardEventHandler): Ditto.
1917         (WebCore::EventHandler::handleDrag): Ditto.
1918         (WebCore::EventHandler::handleTextInputEvent): Ditto.
1919         (WebCore::EventHandler::defaultSpaceEventHandler): Ditto.
1920         (WebCore::EventHandler::defaultTabEventHandler): Ditto.
1921         (WebCore::EventHandler::sendScrollEvent): Ditto.
1922         (WebCore::EventHandler::handleTouchEvent): Ditto.
1923         * page/ios/EventHandlerIOS.mm:
1924         (WebCore::EventHandler::focusDocumentView): Ditto.
1925         * page/mac/EventHandlerMac.mm:
1926         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
1927
1928 2016-10-07  Chris Dumez  <cdumez@apple.com>
1929
1930         Regression(r201970): productSub / vendor / vendorSub should not be exposed on WorkerNavigator
1931         https://bugs.webkit.org/show_bug.cgi?id=163124
1932
1933         Reviewed by Ryosuke Niwa.
1934
1935         productSub / vendor / vendorSub should not be exposed on WorkerNavigator:
1936         - https://html.spec.whatwg.org/#navigatorid
1937
1938         Test case:
1939         - http://w3c-test.org/submissions/3881/html/webappapis/system-state-and-capabilities/the-navigator-object/NavigatorID.worker
1940
1941         Note that the specification also restricts NavigatorID's appCodeName and
1942         product attributes to Window. However, it seems the HTML specification is
1943         about to get updated so that these get exposed to workers:
1944         - https://github.com/whatwg/html/pull/1870
1945
1946         No new tests, updated existing test.
1947
1948         * bindings/scripts/generate-bindings.pl:
1949         (shouldPropertyBeExposed):
1950         * page/NavigatorID.idl:
1951
1952 2016-10-07  Alex Christensen  <achristensen@webkit.org>
1953
1954         Disable URLParser logs by default in all builds
1955         https://bugs.webkit.org/show_bug.cgi?id=163135
1956
1957         Reviewed by Brady Eidson.
1958
1959         In debug builds with the URLParser enabled, some tests time out because
1960         parameters to generate log strings are being evaluated for each character of each URL
1961         and then not being used if URLParser logs are disabled.  Generating these unused parameters
1962         is too slow even for debug builds.  Let's only generate them if they are to be used.
1963
1964         No change in behaviour.
1965
1966         * platform/URLParser.cpp:
1967         (WebCore::URLParser::parse):
1968         (WebCore::URLParser::allValuesEqual):
1969
1970 2016-10-07  Andreas Kling  <akling@apple.com>
1971
1972         [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
1973         <https://webkit.org/b/163098>
1974         <rdar://problem/28663488>
1975
1976         Reviewed by Antti Koivisto.
1977
1978         Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting
1979         kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from
1980         its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired.
1981         Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks.
1982
1983         The fix is just to switch the order of those two lines.
1984
1985         This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that
1986         were relying on didRemoveFrameFromHierarchy to release their isolated worlds.
1987
1988         Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache
1989
1990         * history/CachedFrame.cpp:
1991         (WebCore::CachedFrame::destroy):
1992
1993 2016-10-07  Nan Wang  <n_wang@apple.com>
1994
1995         AX: AXRoleDescription for details and summary elements
1996         https://bugs.webkit.org/show_bug.cgi?id=163094
1997
1998         Reviewed by Chris Fleizach.
1999
2000         details and summary elements should have AXRoleDescription that is consistent with other
2001         elements that have custom AXSubRole.
2002
2003         Test: accessibility/mac/details-summary-role-description.html
2004
2005         * English.lproj/Localizable.strings:
2006         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2007         (-[WebAccessibilityObjectWrapper roleDescription]):
2008         * platform/LocalizedStrings.cpp:
2009         (WebCore::AXDetailsText):
2010         (WebCore::AXSummaryText):
2011         * platform/LocalizedStrings.h:
2012         * platform/efl/LocalizedStringsEfl.cpp:
2013         (WebCore::AXDetailsText):
2014         (WebCore::AXSummaryText):
2015         * platform/gtk/LocalizedStringsGtk.cpp:
2016         (WebCore::AXDetailsText):
2017         (WebCore::AXSummaryText):
2018
2019 2016-10-07  Ryan Haddad  <ryanhaddad@apple.com>
2020
2021         Fix the Windows build after r206917.
2022
2023         Unreviewed build fix.
2024
2025         * dom/DOMAllInOne.cpp:
2026
2027 2016-10-07  Antti Koivisto  <antti@apple.com>
2028
2029         Rename AuthorStyleSheets to Style::Scope
2030         https://bugs.webkit.org/show_bug.cgi?id=163108
2031
2032         Reviewed by Andreas Kling.
2033
2034         It represents the style scope in DOM.
2035         Also move the file under style/.
2036
2037         * CMakeLists.txt:
2038         * WebCore.xcodeproj/project.pbxproj:
2039         * css/CSSStyleSheet.cpp:
2040         (WebCore::CSSStyleSheet::styleSheetScope):
2041         * css/CSSStyleSheet.h:
2042         * css/InspectorCSSOMWrappers.cpp:
2043         (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
2044         * css/InspectorCSSOMWrappers.h:
2045         * css/StyleSheetList.cpp:
2046         (WebCore::StyleSheetList::styleSheets):
2047         (WebCore::StyleSheetList::detachFromDocument):
2048         * dom/AuthorStyleSheets.cpp: Removed.
2049         * dom/AuthorStyleSheets.h: Removed.
2050         * dom/Document.cpp:
2051         (WebCore::Document::Document):
2052         (WebCore::Document::setContentLanguage):
2053         (WebCore::Document::recalcStyle):
2054         (WebCore::Document::needsStyleRecalc):
2055         (WebCore::Document::updateStyleIfNeeded):
2056         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2057         (WebCore::Document::createStyleResolver):
2058         (WebCore::Document::didRemoveAllPendingStylesheet):
2059         (WebCore::Document::usesStyleBasedEditability):
2060         (WebCore::Document::processHttpEquiv):
2061         (WebCore::Document::preferredStylesheetSet):
2062         (WebCore::Document::selectedStylesheetSet):
2063         (WebCore::Document::setSelectedStylesheetSet):
2064         (WebCore::Document::haveStylesheetsLoaded):
2065         * dom/Document.h:
2066         (WebCore::Document::styleScope):
2067         (WebCore::Document::authorStyleSheets): Deleted.
2068         * dom/ExtensionStyleSheets.cpp:
2069         (WebCore::ExtensionStyleSheets::clearPageUserSheet):
2070         (WebCore::ExtensionStyleSheets::updatePageUserSheet):
2071         (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
2072         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2073         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2074         (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
2075         * dom/InlineStyleSheetOwner.cpp:
2076         (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
2077         (WebCore::InlineStyleSheetOwner::removedFromDocument):
2078         (WebCore::InlineStyleSheetOwner::clearDocumentData):
2079         (WebCore::InlineStyleSheetOwner::createSheet):
2080         (WebCore::InlineStyleSheetOwner::sheetLoaded):
2081         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
2082         * dom/InlineStyleSheetOwner.h:
2083         (WebCore::InlineStyleSheetOwner::styleScope):
2084         (WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted.
2085         * dom/ProcessingInstruction.cpp:
2086         (WebCore::ProcessingInstruction::~ProcessingInstruction):
2087         (WebCore::ProcessingInstruction::checkStyleSheet):
2088         (WebCore::ProcessingInstruction::sheetLoaded):
2089         (WebCore::ProcessingInstruction::insertedInto):
2090         (WebCore::ProcessingInstruction::removedFrom):
2091         * dom/ShadowRoot.cpp:
2092         (WebCore::ShadowRoot::styleResolver):
2093         (WebCore::ShadowRoot::styleScope):
2094         (WebCore::ShadowRoot::updateStyle):
2095         (WebCore::ShadowRoot::authorStyleSheets): Deleted.
2096         * dom/ShadowRoot.h:
2097         * html/HTMLLinkElement.cpp:
2098         (WebCore::HTMLLinkElement::~HTMLLinkElement):
2099         (WebCore::HTMLLinkElement::setDisabledState):
2100         (WebCore::HTMLLinkElement::parseAttribute):
2101         (WebCore::HTMLLinkElement::process):
2102         (WebCore::HTMLLinkElement::insertedInto):
2103         (WebCore::HTMLLinkElement::removedFrom):
2104         (WebCore::HTMLLinkElement::addPendingSheet):
2105         (WebCore::HTMLLinkElement::removePendingSheet):
2106         * html/HTMLStyleElement.cpp:
2107         * inspector/InspectorCSSAgent.cpp:
2108         (WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
2109         (WebCore::InspectorCSSAgent::forcePseudoState):
2110         (WebCore::InspectorCSSAgent::buildObjectForRule):
2111         (WebCore::InspectorCSSAgent::resetPseudoStates):
2112         * inspector/InspectorPageAgent.cpp:
2113         (WebCore::InspectorPageAgent::setEmulatedMedia):
2114         * page/DOMWindow.cpp:
2115         (WebCore::DOMWindow::getMatchedCSSRules):
2116         * page/Frame.cpp:
2117         (WebCore::Frame::setPrinting):
2118         * page/FrameView.cpp:
2119         (WebCore::FrameView::layout):
2120         (WebCore::FrameView::setPagination):
2121         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
2122         * page/Page.cpp:
2123         (WebCore::Page::setViewMode):
2124         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
2125         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
2126         * style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp.
2127         (WebCore::Style::Scope::Scope):
2128         (WebCore::Style::Scope::styleResolver):
2129         (WebCore::Style::Scope::styleResolverIfExists):
2130         (WebCore::Style::Scope::forNode):
2131         (WebCore::Style::Scope::removePendingSheet):
2132         (WebCore::Style::Scope::addStyleSheetCandidateNode):
2133         (WebCore::Style::Scope::removeStyleSheetCandidateNode):
2134         (WebCore::Style::Scope::collectActiveStyleSheets):
2135         (WebCore::Style::Scope::analyzeStyleSheetChange):
2136         (WebCore::Style::Scope::updateActiveStyleSheets):
2137         (WebCore::Style::Scope::updateStyleResolver):
2138         (WebCore::Style::Scope::activeStyleSheetsForInspector):
2139         (WebCore::Style::Scope::activeStyleSheetsContains):
2140         (WebCore::Style::Scope::flushPendingUpdate):
2141         (WebCore::Style::Scope::clearPendingUpdate):
2142         (WebCore::Style::Scope::scheduleActiveSetUpdate):
2143         (WebCore::Style::Scope::didChangeCandidatesForActiveSet):
2144         (WebCore::Style::Scope::didChangeContentsOrInterpretation):
2145         (WebCore::Style::Scope::pendingUpdateTimerFired):
2146         (WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted.
2147         (WebCore::AuthorStyleSheets::styleResolver): Deleted.
2148         (WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted.
2149         (WebCore::AuthorStyleSheets::forNode): Deleted.
2150         (WebCore::AuthorStyleSheets::removePendingSheet): Deleted.
2151         (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted.
2152         (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted.
2153         (WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted.
2154         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted.
2155         (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted.
2156         (WebCore::AuthorStyleSheets::updateStyleResolver): Deleted.
2157         (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted.
2158         (WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted.
2159         (WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted.
2160         (WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted.
2161         (WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted.
2162         (WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted.
2163         (WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted.
2164         (WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted.
2165         * style/StyleScope.h: Copied from dom/AuthorStyleSheets.h.
2166         * style/StyleTreeResolver.cpp:
2167         * svg/SVGFontFaceElement.cpp:
2168         (WebCore::SVGFontFaceElement::rebuildFontFace):
2169         (WebCore::SVGFontFaceElement::removedFrom):
2170         * xml/XMLTreeViewer.cpp:
2171         (WebCore::XMLTreeViewer::transformDocumentToTreeView):
2172         * xml/parser/XMLDocumentParser.cpp:
2173         (WebCore::XMLDocumentParser::end):
2174         * xml/parser/XMLDocumentParserLibxml2.cpp:
2175         (WebCore::XMLDocumentParser::doEnd):
2176
2177 2016-10-07  Zalan Bujtas  <zalan@apple.com>
2178
2179         https://vuldb.com/?cvssv3.2012 takes long time to load.
2180         https://bugs.webkit.org/show_bug.cgi?id=162994
2181         <rdar://problem/28593746>
2182
2183         Reviewed by Darin Adler.
2184
2185         Stop visiting cousins when we hit the style sharing search threshold.
2186
2187         In addition to mistakenly ignoring the threshold at SharingResolver::findSibling(), we
2188         continued on searching for cousin elements. 
2189
2190         Test: fast/selectors/slow-style-sharing-with-long-cousin-list.html
2191
2192         * style/StyleSharingResolver.cpp:
2193         (WebCore::Style::SharingResolver::resolve):
2194         (WebCore::Style::SharingResolver::findSibling):
2195         (WebCore::Style::SharingResolver::locateCousinList):
2196
2197 2016-10-07  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2198
2199         [Readable Streams API] Implement generic reader functions
2200         https://bugs.webkit.org/show_bug.cgi?id=163003
2201
2202         Reviewed by Darin Adler.
2203
2204         Implements reader generic functions defined by spec in order to prepare BYOBReader integration.
2205         Generic functions factorize some code that is used by both DefaultReader and BYOBReader.
2206
2207         No change in behaviour.
2208
2209         * Modules/streams/ReadableStreamDefaultReader.js:
2210         (cancel): Rely on readableStreamReaderGenericCancel.
2211         (releaseLock): Rely on readableStreamReaderGenericRelease.
2212         * Modules/streams/ReadableStreamInternals.js:
2213         (privateInitializeReadableStreamDefaultReader): Rely on readableStreamReaderGenericInitialize.
2214         (readableStreamReaderGenericInitialize): Added.
2215         (readableStreamReaderGenericCancel): Added.
2216         (readableStreamReaderGenericRelease): Added.
2217
2218 2016-10-07  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2219
2220         WebRTC: Misc gardening: Use typedefs consistently and remove unused code
2221         https://bugs.webkit.org/show_bug.cgi?id=163104
2222
2223         Reviewed by Philippe Normand.
2224
2225         Miscellaneous WebRTC gardening. See file list below for details.
2226
2227         Testing: No change in behavior.
2228
2229         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2230         * Modules/mediastream/MediaEndpointPeerConnection.h:
2231         Move NotImplemented include to cpp-file.
2232         * platform/mediastream/MediaEndpoint.h:
2233         Use MediaPayloadVector typedef (instead of Vector<RefPtr<MediaPayload>>).
2234         * platform/mediastream/PeerMediaDescription.h:
2235         (WebCore::PeerMediaDescription::source): Deleted.
2236         (WebCore::PeerMediaDescription::setSource): Deleted.
2237         Sources are passed to updateSendConfiguration() via a source map and not added to each
2238         PeerMediaDescription anymore. Remove unused code.
2239         * platform/mock/MockMediaEndpoint.cpp:
2240         (WebCore::MockMediaEndpoint::getDefaultAudioPayloads):
2241         (WebCore::MockMediaEndpoint::getDefaultVideoPayloads):
2242         Use MediaPayloadVector typedef.
2243         * platform/mock/MockMediaEndpoint.h:
2244         Use MediaPayloadVector typedef.
2245
2246 2016-10-07  Gwang Yoon Hwang  <yoon@igalia.com>
2247
2248         [GTK] Remove unneeded creation of TextureMapperPlatformLayerProxy
2249         https://bugs.webkit.org/show_bug.cgi?id=163101
2250
2251         Reviewed by Žan Doberšek.
2252
2253         Covered by existing tests.
2254
2255         * platform/graphics/cairo/ImageBufferCairo.cpp:
2256         (WebCore::ImageBufferData::ImageBufferData): Modified not to create
2257         TextureMapperPlatformLayerProxy if it is not created for the
2258         accelerated 2d canvas.
2259
2260 2016-10-07  Fujii Hironori  <Hironori.Fujii@sony.com>
2261
2262         Use 'use lib $FindBin::Bin' to append Perl module include path
2263         https://bugs.webkit.org/show_bug.cgi?id=162256
2264
2265         Reviewed by Carlos Garcia Campos.
2266
2267         Some Perl  scripts are needed to  be executed with '-I'  switch to
2268         explicitly append Perl module include path.  Use 'use lib' as well
2269         as other Perl scripts do.
2270
2271         * CMakeLists.txt: Removed '-I' options from invocation of Perl.
2272         * DerivedSources.make: Ditto.
2273         * bindings/scripts/generate-bindings.pl: Use 'use lib'.
2274         * bindings/scripts/preprocess-idls.pl: Ditto.
2275         * css/make-css-file-arrays.pl: Ditto.
2276         * css/makegrammar.pl: Ditto.
2277         * css/makeprop.pl: Ditto.
2278         * css/makevalues.pl: Ditto.
2279         * dom/make_dom_exceptions.pl: Ditto.
2280         * dom/make_event_factory.pl: Ditto.
2281         * dom/make_names.pl: Ditto.
2282         * page/make_settings.pl: Ditto.
2283
2284 2016-10-07  Youenn Fablet  <youenn@apple.com>
2285
2286         Refactor CachedResourceClient::notifyFinished
2287         https://bugs.webkit.org/show_bug.cgi?id=162060
2288
2289         Reviewed by Darin Adler.
2290
2291         No change of behavior.
2292
2293         Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers.
2294         In most cases, the CachedResource parameter is only used for assertions.
2295         Removing that parameter might be contemplated in the future.
2296         The only real case is in RenderImage.
2297
2298         Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values.
2299
2300         * dom/LoadableClassicScript.cpp:
2301         (WebCore::LoadableClassicScript::notifyFinished):
2302         * dom/LoadableClassicScript.h:
2303         * html/HTMLImageLoader.cpp:
2304         (WebCore::HTMLImageLoader::notifyFinished):
2305         * html/HTMLImageLoader.h:
2306         * loader/ContentFilter.cpp:
2307         (WebCore::ContentFilter::continueAfterResponseReceived):
2308         (WebCore::ContentFilter::continueAfterDataReceived):
2309         (WebCore::ContentFilter::continueAfterNotifyFinished):
2310         (WebCore::ContentFilter::deliverResourceData):
2311         * loader/ContentFilter.h:
2312         * loader/CrossOriginPreflightChecker.cpp:
2313         (WebCore::CrossOriginPreflightChecker::notifyFinished):
2314         * loader/CrossOriginPreflightChecker.h:
2315         * loader/DocumentLoader.cpp:
2316         (WebCore::DocumentLoader::notifyFinished):
2317         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
2318         (WebCore::DocumentLoader::redirectReceived):
2319         (WebCore::DocumentLoader::responseReceived):
2320         (WebCore::DocumentLoader::continueAfterContentPolicy):
2321         (WebCore::DocumentLoader::dataReceived):
2322         * loader/DocumentLoader.h:
2323         * loader/DocumentThreadableLoader.cpp:
2324         (WebCore::DocumentThreadableLoader::redirectReceived):
2325         (WebCore::DocumentThreadableLoader::dataSent):
2326         (WebCore::DocumentThreadableLoader::responseReceived):
2327         (WebCore::DocumentThreadableLoader::dataReceived):
2328         (WebCore::DocumentThreadableLoader::notifyFinished):
2329         * loader/DocumentThreadableLoader.h:
2330         * loader/ImageLoader.cpp:
2331         (WebCore::ImageLoader::notifyFinished):
2332         * loader/ImageLoader.h:
2333         * loader/LinkLoader.cpp:
2334         (WebCore::LinkLoader::triggerEvents):
2335         (WebCore::LinkLoader::notifyFinished):
2336         * loader/LinkLoader.h:
2337         * loader/LinkPreloadResourceClients.cpp:
2338         (WebCore::LinkPreloadResourceClient::triggerEvents):
2339         * loader/LinkPreloadResourceClients.h:
2340         * loader/MediaResourceLoader.cpp:
2341         (WebCore::MediaResource::responseReceived):
2342         (WebCore::MediaResource::shouldCacheResponse):
2343         (WebCore::MediaResource::redirectReceived):
2344         (WebCore::MediaResource::dataSent):
2345         (WebCore::MediaResource::dataReceived):
2346         (WebCore::MediaResource::notifyFinished):
2347         (WebCore::MediaResource::getOrCreateReadBuffer):
2348         * loader/MediaResourceLoader.h:
2349         * loader/TextTrackLoader.cpp:
2350         (WebCore::TextTrackLoader::processNewCueData):
2351         (WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource):
2352         (WebCore::TextTrackLoader::notifyFinished):
2353         * loader/TextTrackLoader.h:
2354         * loader/cache/CachedRawResource.cpp:
2355         (WebCore::CachedRawResource::notifyClientsDataWasReceived):
2356         (WebCore::CachedRawResource::didAddClient):
2357         (WebCore::CachedRawResource::redirectReceived):
2358         (WebCore::CachedRawResource::responseReceived):
2359         (WebCore::CachedRawResource::shouldCacheResponse):
2360         (WebCore::CachedRawResource::didSendData):
2361         * loader/cache/CachedRawResourceClient.h:
2362         (WebCore::CachedRawResourceClient::dataSent):
2363         (WebCore::CachedRawResourceClient::responseReceived):
2364         (WebCore::CachedRawResourceClient::shouldCacheResponse):
2365         (WebCore::CachedRawResourceClient::dataReceived):
2366         (WebCore::CachedRawResourceClient::redirectReceived):
2367         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer):
2368         * loader/cache/CachedResource.cpp:
2369         (WebCore::CachedResource::checkNotify):
2370         (WebCore::CachedResource::didAddClient):
2371         * loader/cache/CachedResourceClient.h:
2372         (WebCore::CachedResourceClient::notifyFinished):
2373         (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):
2374         * loader/cache/CachedTextTrack.cpp:
2375         (WebCore::CachedTextTrack::updateData):
2376         * loader/icon/IconLoader.cpp:
2377         (WebCore::IconLoader::notifyFinished):
2378         * loader/icon/IconLoader.h:
2379         * loader/soup/CachedRawResourceSoup.cpp:
2380         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2381         (WebCore::WebCoreAVCFResourceLoader::responseReceived):
2382         (WebCore::WebCoreAVCFResourceLoader::dataReceived):
2383         (WebCore::WebCoreAVCFResourceLoader::notifyFinished):
2384         (WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource):
2385         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
2386         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2387         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2388         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2389         (WebCore::WebCoreAVFResourceLoader::dataReceived):
2390         (WebCore::WebCoreAVFResourceLoader::notifyFinished):
2391         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
2392         * rendering/RenderImage.cpp:
2393         (WebCore::RenderImage::notifyFinished):
2394         * rendering/RenderImage.h:
2395         * rendering/RenderLayerFilterInfo.cpp:
2396         (WebCore::RenderLayer::FilterInfo::setRenderer):
2397         (WebCore::RenderLayer::FilterInfo::notifyFinished):
2398         * rendering/RenderLayerFilterInfo.h:
2399         * svg/SVGFEImageElement.cpp:
2400         (WebCore::SVGFEImageElement::notifyFinished):
2401         * svg/SVGFEImageElement.h:
2402         * svg/SVGUseElement.cpp:
2403         (WebCore::SVGUseElement::notifyFinished):
2404         * svg/SVGUseElement.h:
2405         * xml/parser/XMLDocumentParser.cpp:
2406         (WebCore::XMLDocumentParser::notifyFinished):
2407         * xml/parser/XMLDocumentParser.h:
2408
2409 2016-10-06  Youenn Fablet  <youenn@apple.com>
2410
2411         CachedXSLStylesheet does not need to be updated according Origin/Fetch mode
2412         https://bugs.webkit.org/show_bug.cgi?id=162389
2413
2414         Reviewed by Darin Adler.
2415
2416         No change of behavior.
2417
2418         Making clear that there is no reason to update cached XSLT resources according the origin, given that CORS is never checked and loading is always same-origin.
2419
2420         Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology.
2421         Updating HTMLLinkElement accordingly.
2422
2423         * html/HTMLLinkElement.cpp:
2424         (WebCore::HTMLLinkElement::initializeStyleSheet):
2425         * loader/cache/CachedResource.cpp:
2426         (WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used.
2427         (WebCore::CachedResource::isClean): Deleted.
2428         * loader/cache/CachedResource.h:
2429         * loader/cache/CachedResourceLoader.cpp:
2430         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2431
2432 2016-10-06  Youenn Fablet  <youenn@apple.com>
2433
2434         Add a place for common HTTP Header values
2435         https://bugs.webkit.org/show_bug.cgi?id=163002
2436
2437         Reviewed by Alex Christensen.
2438
2439         No change of behavior.
2440
2441         Introducing HTTPHeaderValues with two Content-Type values.
2442
2443         * CMakeLists.txt:
2444         * Modules/fetch/FetchBody.cpp:
2445         (WebCore::FetchBody::extract):
2446         * WebCore.xcodeproj/project.pbxproj:
2447         * platform/network/HTTPHeaderValues.cpp: Added.
2448         (WebCore::HTTPHeaderValues::TextPlainContentType):
2449         (WebCore::HTTPHeaderValues::FormURLEncodedContentType):
2450         * platform/network/HTTPHeaderValues.h: Added.
2451         * xml/XMLHttpRequest.cpp:
2452         (WebCore::XMLHttpRequest::send):
2453
2454 2016-10-06  Youenn Fablet  <youenn@apple.com>
2455
2456         CachedResourceRequest should not need to store defer and preload options
2457         https://bugs.webkit.org/show_bug.cgi?id=163004
2458
2459         Reviewed by Alex Christensen.
2460
2461         No change of behavior.
2462
2463         Removing CachedResourceRequest defer and preload fields.
2464         These fields are computed inside CachedResourceLoader instead.
2465
2466         Updated setting of priority from CachedResourceRequest to CachedResource.
2467         Priority is set for any new resource (this covers all cases where no cached resource can be reused from the memory cache).
2468         Priority is set for a cached resource if the request is not a preload request.
2469
2470         * loader/LinkLoader.cpp:
2471         (WebCore::LinkLoader::preloadIfNeeded):
2472         * loader/cache/CachedResource.cpp:
2473         (WebCore::CachedResource::CachedResource):
2474         * loader/cache/CachedResourceLoader.cpp:
2475         (WebCore::CachedResourceLoader::requestImage):
2476         (WebCore::CachedResourceLoader::canRequest):
2477         (WebCore::CachedResourceLoader::requestResource):
2478         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2479         (WebCore::CachedResourceLoader::requestPreload):
2480         * loader/cache/CachedResourceLoader.h:
2481         * loader/cache/CachedResourceRequest.cpp:
2482         (WebCore::CachedResourceRequest::CachedResourceRequest):
2483         * loader/cache/CachedResourceRequest.h:
2484         (WebCore::CachedResourceRequest::priority):
2485         (WebCore::CachedResourceRequest::forPreload): Deleted.
2486         (WebCore::CachedResourceRequest::setForPreload): Deleted.
2487         (WebCore::CachedResourceRequest::defer): Deleted.
2488         (WebCore::CachedResourceRequest::setDefer): Deleted.
2489
2490 2016-10-06  Myles C. Maxfield  <mmaxfield@apple.com>
2491
2492         Variation fonts don't affect glyph advances
2493         https://bugs.webkit.org/show_bug.cgi?id=163093
2494
2495         Reviewed by Darin Adler.
2496
2497         Work around known bug <rdar://problem/28662086>. For variation fonts,
2498         CTFontGetAdvancesForGlyphs() gives correct answers but
2499         CTFontGetUnsummedAdvancesForGlyphsAndStyle() doesn't.
2500
2501         Test: fast/text/variations/advances.html
2502
2503         * platform/graphics/FontPlatformData.h:
2504         (WebCore::FontPlatformData::hasVariations):
2505         * platform/graphics/cocoa/FontCocoa.mm:
2506         (WebCore::Font::platformWidthForGlyph):
2507         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2508         (WebCore::FontPlatformData::FontPlatformData):
2509
2510 2016-10-06  Commit Queue  <commit-queue@webkit.org>
2511
2512         Unreviewed, rolling out r206713.
2513         https://bugs.webkit.org/show_bug.cgi?id=163097
2514
2515         triggers apparent codegen bug on ARM 32-bit (Requested by smfr
2516         on #webkit).
2517
2518         Reverted changeset:
2519
2520         "Support transitions/animations of background-position with
2521         right/bottom-relative values"
2522         https://bugs.webkit.org/show_bug.cgi?id=162048
2523         http://trac.webkit.org/changeset/206713
2524
2525 2016-10-06  Daniel Bates  <dabates@apple.com>
2526
2527         Remove unused WebCore::contentDispositionType()
2528         https://bugs.webkit.org/show_bug.cgi?id=163095
2529
2530         Reviewed by Alex Christensen.
2531
2532         The function WebCore::contentDispositionType() was only used by the Chromium and Qt ports
2533         to parse the Content-Disposition HTTP header. Both of these ports have long since been
2534         removed from the repository. We should remove WebCore::contentDispositionType().
2535
2536         * platform/network/HTTPParsers.cpp:
2537         (WebCore::contentDispositionType): Deleted.
2538         * platform/network/HTTPParsers.h:
2539
2540 2016-10-06  Ryosuke Niwa  <rniwa@webkit.org>
2541
2542         Upgrading and constructing element should always report exception instead of rethrowing
2543         https://bugs.webkit.org/show_bug.cgi?id=162996
2544
2545         Reviewed by Darin Adler.
2546
2547         The latest HTML specification specifies that we must report exceptions thrown during element upgrades:
2548         https://html.spec.whatwg.org/#upgrades
2549
2550         In addition, F2F during 2016 TPAC had a consensus that we should do the same for document.createElement:
2551         https://github.com/w3c/webcomponents/issues/569
2552
2553         Since the HTML parser already reports the exception thrown during custom element construction as it does
2554         not have any JS stack, these changes make exceptions thrown during upgrades and constructions.
2555
2556         In our implementation, this only reduces the code complexity as now we can push the logic to fallback
2557         to HTMLUnknownElement into JSCustomElementInterface's constructElement, which has been renamed
2558         to constructElementWithFallback, and eliminate ShouldClearException enum class entirely. Moreover,
2559         constructElementWithFallback can now return Ref instead of RefPtr.
2560
2561         No new tests. Existing tests have been updated.
2562
2563         * bindings/js/JSCustomElementInterface.cpp:
2564         (WebCore::JSCustomElementInterface::constructElementWithFallback): Create a HTMLUnknownElement if
2565         an attempt to construct a custom element had failed in lieu of returning nullptr.
2566         (WebCore::JSCustomElementInterface::tryToConstructCustomElement): Renamed from constructElement.
2567         Always report exceptions (the same behavior as ShouldClearException::Clear).
2568         (WebCore::JSCustomElementInterface::upgradeElement): Report exceptions instead of rethrowing.
2569         * bindings/js/JSCustomElementInterface.h:
2570         * dom/Document.cpp:
2571         (WebCore::createHTMLElementWithNameValidation):
2572         * html/parser/HTMLDocumentParser.cpp:
2573         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
2574
2575 2016-10-06  Chris Dumez  <cdumez@apple.com>
2576
2577         Overwriting an attribute event listener can lead to wrong event listener firing order
2578         https://bugs.webkit.org/show_bug.cgi?id=163083
2579
2580         Reviewed by Darin Adler.
2581
2582         Overwriting an attribute event listener could lead to wrong event listener
2583         firing order in WebKit. This is because we were removing the old event
2584         listener and then appending the new one instead of actually *replacing*
2585         the old one.
2586
2587         No new tests, rebaselined existing tests.
2588
2589         * dom/EventListenerMap.cpp:
2590         (WebCore::EventListenerMap::replace):
2591         * dom/EventListenerMap.h:
2592         * dom/EventTarget.cpp:
2593         (WebCore::EventTarget::setAttributeEventListener):
2594         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
2595         (WebCore::EventTarget::dispatchEventForBindings): Deleted.
2596         * dom/EventTarget.h:
2597
2598 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2599
2600         URLParser: Non-ASCII characters in Non-UTF-8 encoded queries of relative URLs with ws, wss, or nonspecial schemes should be UTF-8 encoded
2601         https://bugs.webkit.org/show_bug.cgi?id=163089
2602
2603         Reviewed by Tim Horton.
2604
2605         This is a change similar to r206818 but with relative URLs.
2606         This matches the spec, URL::parse, and other browsers' behavior.
2607         Covered by new API tests for URLParser.
2608         This also fixes tests like http/tests/misc/url-in-utf32le.html when URLParser is enabled.
2609
2610         * platform/URL.cpp:
2611         (WebCore::URL::URL):
2612         Use the same encoding for the URL constructor whether or not the URLParser is enabled.
2613         * platform/URLParser.cpp:
2614         (WebCore::URLParser::copyURLPartsUntil):
2615         (WebCore::URLParser::parse):
2616         (WebCore::isSpecial): Deleted.
2617         * platform/URLParser.h:
2618         Use UTF-8 for non-special, ws, or wss schemes.
2619
2620 2016-10-06  Zalan Bujtas  <zalan@apple.com>
2621
2622         Add back ASSERT(!needsLayout) to RenderTableSection which is now valid
2623         https://bugs.webkit.org/show_bug.cgi?id=92954
2624         <rdar://problem/12147973>
2625
2626         Reviewed by Dan Bernstein.
2627
2628         LayoutTests pass fine now with this assert on.
2629
2630         Covered by existing tests.
2631
2632         * rendering/RenderTableSection.cpp:
2633         (WebCore::RenderTableSection::paint):
2634
2635 2016-10-06  Jiewen Tan  <jiewen_tan@apple.com>
2636
2637         Add a dummy SubtleCrypto interface
2638         https://bugs.webkit.org/show_bug.cgi?id=162992
2639         <rdar://problem/28643573>
2640
2641         Reviewed by Brent Fulgham.
2642
2643         Add a dummy SubtleCrypto interface and rename KeyPair to CryptoKeyPair.
2644
2645         Tests: crypto/subtle/gc-2.html
2646                crypto/subtle/gc-3.html
2647                crypto/subtle/gc.html
2648                crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html
2649                crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html
2650                crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html
2651                crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html
2652                crypto/webkitSubtle/aes-cbc-generate-key.html
2653                crypto/webkitSubtle/aes-cbc-import-jwk.html
2654                crypto/webkitSubtle/aes-cbc-invalid-length.html
2655                crypto/webkitSubtle/aes-cbc-unwrap-failure.html
2656                crypto/webkitSubtle/aes-cbc-unwrap-rsa.html
2657                crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html
2658                crypto/webkitSubtle/aes-cbc-wrap-rsa.html
2659                crypto/webkitSubtle/aes-cbc-wrong-key-class.html
2660                crypto/webkitSubtle/aes-export-key.html
2661                crypto/webkitSubtle/aes-kw-key-manipulation.html
2662                crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html
2663                crypto/webkitSubtle/aes-postMessage.html
2664                crypto/webkitSubtle/argument-conversion.html
2665                crypto/webkitSubtle/array-buffer-view-offset.html
2666                crypto/webkitSubtle/crypto-key-algorithm-gc.html
2667                crypto/webkitSubtle/crypto-key-usages-gc.html
2668                crypto/webkitSubtle/hmac-check-algorithm.html
2669                crypto/webkitSubtle/hmac-export-key.html
2670                crypto/webkitSubtle/hmac-generate-key.html
2671                crypto/webkitSubtle/hmac-import-jwk.html
2672                crypto/webkitSubtle/hmac-postMessage.html
2673                crypto/webkitSubtle/hmac-sign-verify-empty-key.html
2674                crypto/webkitSubtle/hmac-sign-verify.html
2675                crypto/webkitSubtle/import-jwk.html
2676                crypto/webkitSubtle/jwk-export-use-values.html
2677                crypto/webkitSubtle/jwk-import-use-values.html
2678                crypto/webkitSubtle/rsa-export-generated-keys.html
2679                crypto/webkitSubtle/rsa-export-key.html
2680                crypto/webkitSubtle/rsa-export-private-key.html
2681                crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html
2682                crypto/webkitSubtle/rsa-indexeddb-non-exportable.html
2683                crypto/webkitSubtle/rsa-indexeddb-private.html
2684                crypto/webkitSubtle/rsa-indexeddb.html
2685                crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html
2686                crypto/webkitSubtle/rsa-oaep-key-manipulation.html
2687                crypto/webkitSubtle/rsa-oaep-plaintext-length.html
2688                crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html
2689                crypto/webkitSubtle/rsa-postMessage.html
2690                crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html
2691                crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html
2692                crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
2693                crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html
2694                crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html
2695                crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html
2696                crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html
2697                crypto/webkitSubtle/sha-1.html
2698                crypto/webkitSubtle/sha-224.html
2699                crypto/webkitSubtle/sha-256.html
2700                crypto/webkitSubtle/sha-384.html
2701                crypto/webkitSubtle/sha-512.html
2702                crypto/webkitSubtle/unimplemented-unwrap-crash.html
2703                crypto/webkitSubtle/unwrapKey-check-usage.html
2704                crypto/webkitSubtle/wrapKey-check-usage.html
2705                crypto/workers/subtle/aes-postMessage-worker.html
2706                crypto/workers/subtle/gc-worker.html
2707                crypto/workers/subtle/hmac-postMessage-worker.html
2708                crypto/workers/subtle/hrsa-postMessage-worker.html
2709                crypto/workers/subtle/multiple-postMessage-worker.html
2710                crypto/workers/subtle/rsa-postMessage-worker.html
2711
2712         * CMakeLists.txt:
2713         * DerivedSources.cpp:
2714         * DerivedSources.make:
2715         * PlatformEfl.cmake:
2716         * PlatformGTK.cmake:
2717         * PlatformMac.cmake:
2718         * WebCore.xcodeproj/project.pbxproj:
2719         * crypto/CryptoKeyPair.idl:
2720         * crypto/SubtleCrypto.cpp:
2721         (WebCore::SubtleCrypto::SubtleCrypto):
2722         * crypto/SubtleCrypto.h:
2723         (WebCore::SubtleCrypto::create):
2724         * crypto/SubtleCrypto.idl: Added.
2725         * page/Crypto.cpp:
2726         (WebCore::Crypto::Crypto):
2727         (WebCore::Crypto::subtle):
2728         * page/Crypto.h:
2729         * page/Crypto.idl:
2730
2731 2016-10-06  Anders Carlsson  <andersca@apple.com>
2732
2733         Crash when ApplePaySession.completeMerchantValidation is not passed a dictionary
2734         https://bugs.webkit.org/show_bug.cgi?id=163074
2735         rdar://problem/27824842
2736
2737         Reviewed by Tim Horton.
2738
2739         Raise a type error on a null initializer object.
2740
2741         * Modules/applepay/ApplePaySession.cpp:
2742         (WebCore::ApplePaySession::completeMerchantValidation):
2743
2744 2016-10-06  Antti Koivisto  <antti@apple.com>
2745
2746         Mutating styleSheet in shadow tree doesn't update the style
2747         https://bugs.webkit.org/show_bug.cgi?id=162744
2748         <rdar://problem/28550588>
2749
2750         Reviewed by Ryosuke Niwa.
2751
2752         We weren't always invalidating the right AuthorStyleSheets (to be renamed) instance
2753         for the scope after mutations.
2754
2755         Test: fast/shadow-dom/mutating-stylesheet-in-shadow-tree.html
2756
2757         * css/CSSStyleSheet.cpp:
2758         (WebCore::CSSStyleSheet::didMutateRules):
2759         (WebCore::CSSStyleSheet::didMutate):
2760         (WebCore::CSSStyleSheet::clearOwnerNode):
2761         (WebCore::CSSStyleSheet::rootStyleSheet):
2762         (WebCore::CSSStyleSheet::ownerDocument):
2763         (WebCore::CSSStyleSheet::styleSheetScope):
2764
2765             Invalidate the right scope after stylesheet mutations.
2766
2767         * css/CSSStyleSheet.h:
2768         * dom/AuthorStyleSheets.cpp:
2769         (WebCore::AuthorStyleSheets::styleResolver):
2770         (WebCore::AuthorStyleSheets::styleResolverIfExists):
2771
2772             Take care to update the right style resolver.
2773
2774         (WebCore::AuthorStyleSheets::forNode):
2775         (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode):
2776
2777             Start the update timer so clients don't need to request update separately.
2778
2779         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
2780         (WebCore::AuthorStyleSheets::updateActiveStyleSheets):
2781         (WebCore::AuthorStyleSheets::updateStyleResolver):
2782         * dom/AuthorStyleSheets.h:
2783         * dom/InlineStyleSheetOwner.cpp:
2784         (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
2785
2786             Save the scope we were inserted into so removals can be done reliably.
2787
2788         (WebCore::InlineStyleSheetOwner::removedFromDocument):
2789
2790             Use and clear the saved scope.
2791             Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call.
2792
2793         (WebCore::InlineStyleSheetOwner::clearDocumentData):
2794         (WebCore::InlineStyleSheetOwner::createSheet):
2795         (WebCore::InlineStyleSheetOwner::sheetLoaded):
2796         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
2797         (WebCore::authorStyleSheetsForElement): Deleted.
2798         * dom/InlineStyleSheetOwner.h:
2799         (WebCore::InlineStyleSheetOwner::styleSheetScope):
2800         * dom/ShadowRoot.cpp:
2801         (WebCore::ShadowRoot::styleResolverIfExists):
2802         * dom/ShadowRoot.h:
2803         * html/HTMLLinkElement.cpp:
2804         (WebCore::HTMLLinkElement::removedFrom):
2805
2806             Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call.
2807
2808         * html/HTMLStyleElement.cpp:
2809         (WebCore::HTMLStyleElement::~HTMLStyleElement):
2810         (WebCore::HTMLStyleElement::parseAttribute):
2811
2812             Fix a bug where we wouldn't create stylesheet if a style element was activated by removing a media attribute.
2813
2814         (WebCore::HTMLStyleElement::insertedInto):
2815         (WebCore::HTMLStyleElement::removedFrom):
2816         * page/DOMWindow.cpp:
2817         (WebCore::DOMWindow::getMatchedCSSRules):
2818         * svg/SVGStyleElement.cpp:
2819         (WebCore::SVGStyleElement::~SVGStyleElement):
2820         (WebCore::SVGStyleElement::insertedInto):
2821         (WebCore::SVGStyleElement::removedFrom):
2822
2823 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2824
2825         Skip tabs and newlines between end of query and beginning of fragment in non-UTF-8-encoded URLs
2826         https://bugs.webkit.org/show_bug.cgi?id=163071
2827
2828         Reviewed by Tim Horton.
2829
2830         Covered by a new API test that would have asserted before this change.
2831
2832         * platform/URLParser.cpp:
2833         (WebCore::URLParser::encodeQuery):
2834         Skip tabs and newlines before asserting that we are at the end.
2835
2836 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2837
2838         URLParser should parse file URLs with ports consistently
2839         https://bugs.webkit.org/show_bug.cgi?id=163075
2840
2841         Reviewed by Brady Eidson.
2842
2843         Covered by API tests.  We used to assert when parsing the newly tested URLs.
2844
2845         * platform/URLParser.cpp:
2846         (WebCore::URLParser::parse):
2847
2848 2016-10-06  Chris Dumez  <cdumez@apple.com>
2849
2850         [WebIDL] Add support for having dictionaries in their own IDL file
2851         https://bugs.webkit.org/show_bug.cgi?id=162912
2852
2853         Reviewed by Darin Adler.
2854
2855         Add support for having dictionaries in their own IDL file so that they
2856         can be shared by multiple interfaces.
2857
2858         Leverage this new support to merge Element::ScrollToOptions and
2859         DOMWindow::ScrollToOptions.
2860
2861         No new tests, extended bindings tests.
2862
2863         * CMakeLists.txt:
2864         * DerivedSources.cpp:
2865         * DerivedSources.make:
2866         * WebCore.xcodeproj/project.pbxproj:
2867         * bindings/scripts/CodeGenerator.pm:
2868         (ProcessDocument):
2869         (IDLFileForInterface):
2870         (GetDictionaryByName):
2871         (IsDictionaryType):
2872         (HasEnumImplementationNameOverride): Deleted.
2873         (GetEnumImplementationNameOverride): Deleted.
2874         * bindings/scripts/CodeGeneratorJS.pm:
2875         (GenerateDictionary):
2876         (GetEnumerationClassName):
2877         (GenerateEnumerationImplementationContent):
2878         (GenerateEnumerationHeaderContent):
2879         (GetDictionaryClassName):
2880         (GenerateDefaultValue):
2881         (GenerateDictionaryHeaderContent):
2882         (GenerateDictionariesHeaderContent):
2883         (GenerateDictionaryImplementationContent):
2884         (GenerateDictionariesImplementationContent):
2885         (GenerateHeader):
2886         (GenerateImplementation):
2887         (GenerateParametersCheck):
2888         (GenerateDictionaryHeader):
2889         (GenerateDictionaryImplementation):
2890         (GenerateCallbackHeader):
2891         (GenerateCallbackImplementation):
2892         (GetNativeType):
2893         (JSValueToNative):
2894         (GetNestedClassName): Deleted.
2895         (GenerateConversionRuleWithLeadingComma): Deleted.
2896         (addIterableProperties): Deleted.
2897         * bindings/scripts/preprocess-idls.pl:
2898         (containsInterfaceOrExceptionFromIDL):
2899         * bindings/scripts/test/JS/JSTestObj.cpp:
2900         (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter):
2901         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot): Deleted.
2902         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: Added.
2903         (WebCore::convertDictionary<TestStandaloneDictionary>):
2904         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: Added.
2905         * bindings/scripts/test/TestObj.idl:
2906         * bindings/scripts/test/TestStandaloneDictionary.idl: Added.
2907         * dom/Element.h:
2908         * dom/Element.idl:
2909         * html/HTMLBodyElement.cpp:
2910         (WebCore::HTMLBodyElement::scrollTo):
2911         * page/DOMWindow.h:
2912         * page/DOMWindow.idl:
2913         * page/ScrollToOptions.h: Added.
2914         * page/ScrollToOptions.idl: Added.
2915
2916 2016-10-06  Brent Fulgham  <bfulgham@apple.com>
2917
2918         Unreviewed build fix.
2919
2920         * platform/graphics/Image.cpp: Add missing include
2921         for 'NotImplemented' when building under Direct2D.
2922
2923 2016-10-06  Brent Fulgham  <bfulgham@apple.com>
2924
2925         [Win][Direct2D] Add Direct2D CMake rules
2926         https://bugs.webkit.org/show_bug.cgi?id=162925
2927
2928         Reviewed by Brent Fulgham.
2929
2930         Modify PlatformAppleWin.cmake to conditionally build the CoreGraphics
2931         and CoreAnimation implementation, or the Direct2D files, depending
2932         on whether the USE_DIRECT2D macro is set in the CMake build options.
2933         By default it builds the normal CA/CG way.
2934
2935         Add a stub GraphicsLayer implementation for Direct2D.
2936
2937         No new tests because there is no change in our active ports.
2938
2939         * PlatformAppleWin.cmake: Conditionalize the build for CA/CG or
2940         Direct2D.
2941         * config.h: Make sure CA is turned of for Direct2D builds.
2942         * page/win/FrameWinDirect2D.cpp: Add missing include file.
2943         * platform/graphics/win/GraphicsLayerDirect2D.cpp: Added.
2944         * platform/graphics/win/GraphicsLayerDirect2D.h: Added.
2945
2946 2016-10-06  Yusuke Suzuki  <utatane.tea@gmail.com>
2947
2948         [WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics
2949         https://bugs.webkit.org/show_bug.cgi?id=163001
2950
2951         Reviewed by Keith Miller.
2952
2953         Replace `throw new @XXXError(...)` to @throwXXXError intrinsic.
2954         It reduces the size of bytecode sequence and facilitate inlining.
2955
2956         No behavior change.
2957
2958         * Modules/fetch/FetchHeaders.js:
2959         (initializeFetchHeaders):
2960         * Modules/fetch/FetchInternals.js:
2961         (fillFetchHeaders):
2962         * Modules/fetch/FetchRequest.js:
2963         (initializeFetchRequest):
2964         * Modules/fetch/FetchResponse.js:
2965         (initializeFetchResponse):
2966         (clone):
2967         * Modules/mediastream/NavigatorUserMedia.js:
2968         (webkitGetUserMedia):
2969         * Modules/mediastream/RTCPeerConnection.js:
2970         (initializeRTCPeerConnection):
2971         (getLocalStreams):
2972         (getStreamById):
2973         (addStream):
2974         * Modules/streams/ReadableStream.js:
2975         (initializeReadableStream):
2976         (getReader):
2977         * Modules/streams/ReadableStreamDefaultController.js:
2978         (enqueue):
2979         (error):
2980         (close):
2981         * Modules/streams/ReadableStreamDefaultReader.js:
2982         (releaseLock):
2983         * Modules/streams/ReadableStreamInternals.js:
2984         (privateInitializeReadableStreamDefaultReader):
2985         (privateInitializeReadableStreamDefaultController):
2986         (doStructuredClone):
2987         (readableStreamError):
2988         * Modules/streams/StreamInternals.js:
2989         (validateAndNormalizeQueuingStrategy):
2990         (enqueueValueWithSize):
2991         * Modules/streams/WritableStream.js:
2992         (initializeWritableStream):
2993         (state):
2994         * xml/XMLHttpRequest.js:
2995         (response):
2996
2997 2016-10-06  John Wilander  <wilander@apple.com>
2998
2999         Update Resource Load Statistics
3000         https://bugs.webkit.org/show_bug.cgi?id=162811
3001
3002         Reviewed by Alex Christensen.
3003
3004         No new tests. The counting is based on top privately owned domains
3005         which currently is not supported by layout tests nor API tests.
3006
3007         * Modules/websockets/WebSocket.cpp:
3008         (WebCore::WebSocket::connect):
3009             Now captures statistics for web sockets too.
3010         * loader/FrameLoader.cpp:
3011         (WebCore::FrameLoader::loadResourceSynchronously):
3012         * loader/ResourceLoadObserver.cpp:
3013             Now captures statistics for synchronous XHR too.
3014         (WebCore::is3xxRedirect):
3015             Convenience function.
3016         (WebCore::ResourceLoadObserver::shouldLog):
3017             Convenience function.
3018         (WebCore::ResourceLoadObserver::logFrameNavigation):
3019             Updated to make use of new convenience functions.
3020         (WebCore::ResourceLoadObserver::logSubresourceLoading):
3021             Updated to make use of new convenience functions.
3022         (WebCore::ResourceLoadObserver::logWebSocketLoading):
3023             Added.
3024         (WebCore::ResourceLoadObserver::logUserInteraction):
3025             Updated to make use of new convenience functions.
3026         (WebCore::ResourceLoadObserver::primaryDomain):
3027             Now makes use of the Public Suffix list.
3028             Removed old custom parsing of primary domain.
3029         * loader/ResourceLoadObserver.h:
3030         * loader/ResourceLoadStatisticsStore.cpp:
3031         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
3032             Convenience function.
3033         (WebCore::ResourceLoadStatisticsStore::processStatistics): Deleted.
3034         * loader/ResourceLoadStatisticsStore.h:
3035         * loader/SubresourceLoader.cpp:
3036         (WebCore::SubresourceLoader::willSendRequestInternal):
3037             Moved logging call higher up and added a check for whether we
3038             are loading the main resource. The reason for moving it up is
3039             to capture the request before some data may be cleared out in
3040             redirect handling. We also want to capture failed CORS requests
3041             since they are sent and then cancelled on the way back.
3042
3043 2016-10-06  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3044
3045         WebRTC: Add support for the iceconnectionstatechange event in MediaEndpointPeerConnection
3046         https://bugs.webkit.org/show_bug.cgi?id=162961
3047
3048         Reviewed by Eric Carlson.
3049
3050         Implement MediaEndpointPeerConnection's iceTransportStateChanged callback. When called, it
3051         updates the ICE transport state of the corresponding transceiver and determines if the
3052         RTCPeerConnection's aggregated iceConnectionState needs to be updated.
3053
3054         Update MediaEndpointMock's emulatePlatformEvent feature to support a new action:
3055         "step-ice-transport-states". When initiated, this action replays a predefined set of ICE
3056         transport state changes on a set of transceivers which can be observed via the
3057         iceTransportStateChanged (mentioned above).
3058
3059         Test: fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html
3060
3061         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3062         (WebCore::deriveAggregatedIceConnectionState):
3063         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
3064         * Modules/mediastream/MediaEndpointPeerConnection.h:
3065         * platform/mediastream/MediaEndpoint.h:
3066         (WebCore::MediaEndpointClient::~MediaEndpointClient):
3067         * platform/mock/MockMediaEndpoint.cpp:
3068         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
3069         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
3070         (WebCore::MockMediaEndpoint::stepIceTransportStates):
3071         (WebCore::MockMediaEndpoint::iceTransportTimerFired):
3072         * platform/mock/MockMediaEndpoint.h:
3073
3074 2016-10-06  Youenn Fablet  <youenn@apple.com>
3075
3076         CachedResource client handling methods should take reference
3077         https://bugs.webkit.org/show_bug.cgi?id=163014
3078
3079         Reviewed by Alex Christensen.
3080
3081         No change of behavior.
3082
3083         * bindings/js/CachedScriptSourceProvider.h:
3084         (WebCore::CachedScriptSourceProvider::~CachedScriptSourceProvider):
3085         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
3086         * css/CSSCrossfadeValue.cpp:
3087         (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue):
3088         (WebCore::CSSCrossfadeValue::loadSubimages):
3089         * css/CSSFilterImageValue.cpp:
3090         (WebCore::CSSFilterImageValue::~CSSFilterImageValue):
3091         (WebCore::CSSFilterImageValue::loadSubimages):
3092         * css/CSSFontFaceSource.cpp:
3093         (WebCore::CSSFontFaceSource::CSSFontFaceSource):
3094         (WebCore::CSSFontFaceSource::~CSSFontFaceSource):
3095         * css/StyleRuleImport.cpp:
3096         (WebCore::StyleRuleImport::~StyleRuleImport):
3097         (WebCore::StyleRuleImport::requestStyleSheet):
3098         * dom/DataTransfer.cpp:
3099         (WebCore::DragImageLoader::startLoading):
3100         (WebCore::DragImageLoader::stopLoading):
3101         * dom/LoadableClassicScript.cpp:
3102         (WebCore::LoadableClassicScript::create):
3103         (WebCore::LoadableClassicScript::~LoadableClassicScript):
3104         * dom/ProcessingInstruction.cpp:
3105         (WebCore::ProcessingInstruction::~ProcessingInstruction):
3106         (WebCore::ProcessingInstruction::checkStyleSheet):
3107         (WebCore::ProcessingInstruction::parseStyleSheet):
3108         * html/HTMLLinkElement.cpp:
3109         (WebCore::HTMLLinkElement::~HTMLLinkElement):
3110         (WebCore::HTMLLinkElement::process):
3111         * loader/CrossOriginPreflightChecker.cpp:
3112         (WebCore::CrossOriginPreflightChecker::~CrossOriginPreflightChecker):
3113         (WebCore::CrossOriginPreflightChecker::startPreflight):
3114         * loader/DocumentLoader.cpp:
3115         (WebCore::DocumentLoader::detachFromFrame):
3116         (WebCore::DocumentLoader::clearMainResource):
3117         (WebCore::DocumentLoader::becomeMainResourceClient):
3118         * loader/DocumentThreadableLoader.cpp:
3119         (WebCore::DocumentThreadableLoader::~DocumentThreadableLoader):
3120         (WebCore::DocumentThreadableLoader::clearResource):
3121         (WebCore::DocumentThreadableLoader::loadRequest):
3122         * loader/ImageLoader.cpp:
3123         (WebCore::ImageLoader::~ImageLoader):
3124         (WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent):
3125         (WebCore::ImageLoader::updateFromElement):
3126         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
3127         * loader/LinkLoader.cpp:
3128         (WebCore::LinkLoader::~LinkLoader):
3129         (WebCore::LinkLoader::notifyFinished):
3130         (WebCore::LinkLoader::loadLink):
3131         * loader/LinkPreloadResourceClients.h:
3132         (WebCore::LinkPreloadResourceClient::addResource):
3133         (WebCore::LinkPreloadResourceClient::clearResource):
3134         * loader/MediaResourceLoader.cpp:
3135         (WebCore::MediaResource::MediaResource):
3136         (WebCore::MediaResource::stop):
3137         * loader/TextTrackLoader.cpp:
3138         (WebCore::TextTrackLoader::~TextTrackLoader):
3139         (WebCore::TextTrackLoader::cancelLoad):
3140         (WebCore::TextTrackLoader::load):
3141         * loader/cache/CachedCSSStyleSheet.cpp:
3142         (WebCore::CachedCSSStyleSheet::didAddClient):
3143         * loader/cache/CachedCSSStyleSheet.h:
3144         * loader/cache/CachedFont.cpp:
3145         (WebCore::CachedFont::didAddClient):
3146         * loader/cache/CachedFont.h:
3147         * loader/cache/CachedImage.cpp:
3148         (WebCore::CachedImage::didAddClient):
3149         (WebCore::CachedImage::didRemoveClient):
3150         * loader/cache/CachedImage.h:
3151         * loader/cache/CachedRawResource.cpp:
3152         (WebCore::CachedRawResource::didAddClient):
3153         * loader/cache/CachedRawResource.h:
3154         * loader/cache/CachedResource.cpp:
3155         (WebCore::CachedResource::addClient):
3156         (WebCore::CachedResource::didAddClient):
3157         (WebCore::CachedResource::addClientToSet):
3158         (WebCore::CachedResource::removeClient):
3159         (WebCore::CachedResource::switchClientsToRevalidatedResource):
3160         (WebCore::CachedResource::Callback::timerFired):
3161         * loader/cache/CachedResource.h:
3162         (WebCore::CachedResource::hasClient):
3163         (WebCore::CachedResource::didRemoveClient):
3164         * loader/cache/CachedSVGDocumentReference.cpp:
3165         (WebCore::CachedSVGDocumentReference::~CachedSVGDocumentReference):
3166         (WebCore::CachedSVGDocumentReference::load):
3167         * loader/cache/CachedXSLStyleSheet.cpp:
3168         (WebCore::CachedXSLStyleSheet::didAddClient):
3169         * loader/cache/CachedXSLStyleSheet.h:
3170         * loader/cache/MemoryCache.cpp:
3171         (WebCore::MemoryCache::addImageToCache):
3172         (WebCore::MemoryCache::removeImageFromCache):
3173         * loader/icon/IconLoader.cpp:
3174         (WebCore::IconLoader::startLoading):
3175         (WebCore::IconLoader::stopLoading):
3176         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
3177         (WebCore::WebCoreAVCFResourceLoader::startLoading):
3178         (WebCore::WebCoreAVCFResourceLoader::stopLoading):
3179         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3180         (WebCore::WebCoreAVFResourceLoader::startLoading):
3181         (WebCore::WebCoreAVFResourceLoader::stopLoading):
3182         * rendering/RenderImageResource.cpp:
3183         (WebCore::RenderImageResource::shutdown):
3184         (WebCore::RenderImageResource::setCachedImage):
3185         * rendering/RenderLayerFilterInfo.cpp:
3186         (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients):
3187         (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients):
3188         * rendering/style/StyleCachedImage.cpp:
3189         (WebCore::StyleCachedImage::addClient):
3190         (WebCore::StyleCachedImage::removeClient):
3191         * svg/SVGFEImageElement.cpp:
3192         (WebCore::SVGFEImageElement::clearResourceReferences):
3193         (WebCore::SVGFEImageElement::requestImageResource):
3194         * svg/SVGFontFaceUriElement.cpp:
3195         (WebCore::SVGFontFaceUriElement::~SVGFontFaceUriElement):
3196         (WebCore::SVGFontFaceUriElement::loadFont):
3197         * svg/SVGUseElement.cpp:
3198         (WebCore::SVGUseElement::~SVGUseElement):
3199         (WebCore::SVGUseElement::updateExternalDocument):
3200         * xml/XSLImportRule.cpp:
3201         (WebCore::XSLImportRule::~XSLImportRule):
3202         (WebCore::XSLImportRule::setXSLStyleSheet):
3203         (WebCore::XSLImportRule::loadSheet):
3204         * xml/parser/XMLDocumentParser.cpp:
3205         (WebCore::XMLDocumentParser::notifyFinished):
3206         * xml/parser/XMLDocumentParserLibxml2.cpp:
3207         (WebCore::XMLDocumentParser::~XMLDocumentParser):
3208         (WebCore::XMLDocumentParser::endElementNs):
3209
3210 2016-10-05  Philippe Normand  <pnormand@igalia.com>
3211
3212         [GStreamer][OWR] GL rendering support
3213         https://bugs.webkit.org/show_bug.cgi?id=162972
3214
3215         Reviewed by Žan Doberšek.
3216
3217         When GStreamer-GL is enabled the GL context needs to be properly passed
3218         to the GStreamer pipeline running within the OpenWebRTC video renderer.
3219         This is now supported using a new OpenWebRTC API that allows the
3220         renderer to request the context from the application using a callback
3221         registered within the renderer.
3222
3223         The player's GL context/display set-up was refactored to a new
3224         method, requestGLContext, which is used as callback for the
3225         OpenWebRTC request_context handler.
3226
3227         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3228         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
3229         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext):
3230         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3231         (WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext):
3232         (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
3233         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
3234         (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink):
3235
3236 2016-10-06  Antoine Quint  <graouts@apple.com>
3237
3238         [Modern Media Controls] Icon service and the IconButton class
3239         https://bugs.webkit.org/show_bug.cgi?id=162970
3240         <rdar://problem/28631803>
3241
3242         Reviewed by Dean Jackson.
3243
3244         We introduce the new IconButton class to display buttons that show an icon
3245         in modern media controls. An IconButton uses a CSS mask-image to display the icon
3246         such that we may set the actual button color to any value by setting the element's
3247         background-color property.
3248
3249         Icons are obtained through the `iconService` singleton which knows how to load the
3250         right icon for the current layout traits and resolution. Icons loaded through the
3251         icon service are cached. In a later patch, we will be introducing functionality,
3252         through the MediaControlsHost, to load the icon from the WebCore bundle.
3253
3254         Tests: media/modern-media-controls/icon-button/icon-button-active-state.html
3255                media/modern-media-controls/icon-button/icon-button.html
3256                media/modern-media-controls/icon-service/icon-service.html
3257
3258         * Modules/modern-media-controls/controls/button.css:
3259         (button):
3260         * Modules/modern-media-controls/controls/icon-button.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/button.css.
3261         (button.icon):
3262         (button.icon:active):
3263         * Modules/modern-media-controls/controls/icon-button.js: Added.
3264         (IconButton):
3265         (IconButton.prototype.get iconName):
3266         (IconButton.prototype.set iconName):
3267         (IconButton.prototype.handleEvent):
3268         (IconButton.prototype.layout):
3269         (IconButton.prototype._imageDidLoad):
3270         (IconButton.prototype._updateImage):
3271         * Modules/modern-media-controls/controls/icon-service.js: Copied from Source/WebCore/Modules/modern-media-controls/controls/layout-item.js.
3272         (const.iconService.new.IconService):
3273         (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits):
3274         (const.iconService.new.IconService.prototype.urlForIconNameAndLayoutTraits):
3275         * Modules/modern-media-controls/controls/layout-item.js:
3276         * Modules/modern-media-controls/images/iOS/pause@2x.png: Added.
3277         * Modules/modern-media-controls/images/iOS/pause@3x.png: Added.
3278         * Modules/modern-media-controls/images/iOS/start@2x.png: Added.
3279         * Modules/modern-media-controls/images/iOS/start@3x.png: Added.
3280         * Modules/modern-media-controls/images/macOS/pause-fullscreen@1x.png: Added.
3281         * Modules/modern-media-controls/images/macOS/pause-fullscreen@2x.png: Added.
3282         * Modules/modern-media-controls/images/macOS/pause@1x.png: Added.
3283         * Modules/modern-media-controls/images/macOS/pause@2x.png: Added.
3284         * Modules/modern-media-controls/images/macOS/start@1x.png: Added.
3285         * Modules/modern-media-controls/images/macOS/start@2x.png: Added.
3286
3287 2016-10-06  Miguel Gomez  <magomez@igalia.com>
3288
3289         [GTK] Fix build with GSTREAMER_GL enabled and ACCELERATED_2D_CANVAS disabled
3290         https://bugs.webkit.org/show_bug.cgi?id=163008
3291
3292         Reviewed by Carlos Garcia Campos.
3293
3294         Put functions using cairo-gl behind appropriate guards.
3295
3296         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3297         (WebCore::MediaPlayerPrivateGStreamerBase::paintToCairoSurface): Deleted.
3298         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3299
3300 2016-10-06  Miguel Gomez  <magomez@igalia.com>
3301
3302         [GTK] Copying video textures to webgl should not depend on cairo-gl
3303         https://bugs.webkit.org/show_bug.cgi?id=162904
3304
3305         Reviewed by Žan Doberšek.
3306
3307         Perform the texture copy without using cairo-gl.
3308
3309         Covered by existent tests.
3310
3311         * platform/GStreamer.cmake:
3312         Add the new VideoTextureCopierGStreamer class to the build.
3313         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3314         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
3315         Use VideoTextureCopierGStreamer to perform the copy.
3316         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3317         Add a VideoTextureCopierGStreamer as a class attribute.
3318         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp: Added.
3319         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
3320         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
3321         (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
3322         Recalculates the matrix used as the texture coordinates transformation.
3323         (WebCore::VideoTextureCopierGStreamer::updateTransformationMatrix):
3324         Recalculates the matrices used as the vertices coordinates transformation.
3325         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
3326         Performs the texture copy by using a shader that applies the rotation needed to follow
3327         the video orientation.
3328         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: Added.
3329
3330 2016-10-06  Gwang Yoon Hwang  <yoon@igalia.com>
3331
3332         [GTK] Build fix for X11 and GStreamerGL after r183731
3333         https://bugs.webkit.org/show_bug.cgi?id=163000
3334
3335         Reviewed by Philippe Normand.
3336
3337         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3338         Include gstgldisplay_egl.h if platform uses EGL.
3339
3340 2016-10-06  Mario Sanchez Prada  <mario@endlessm.com>
3341
3342         [GStreamer] Can't play any video with GSTREAMER_GL enabled
3343         https://bugs.webkit.org/show_bug.cgi?id=162669
3344
3345         Reviewed by Philippe Normand.
3346
3347         Make sure an EGLDisplay type is passed when creating the GstGlDisplay
3348         for the EGL code path, instead of a native X11 display type, so
3349         that we get a valid GstGlDisplay as a result, not a dummy one.
3350
3351         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3352         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
3353
3354 2016-10-06  Youenn Fablet  <youenn@apple.com>
3355
3356         [Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode.
3357         https://bugs.webkit.org/show_bug.cgi?id=162785
3358
3359         Reviewed by Alex Christensen.
3360
3361         Covered by rebased and existing tests.
3362
3363         Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only.
3364         This should be applied to all clients at some point, but there is still some uncertainty for data URLs.
3365
3366         Did some refactoring to better separate the case of security checks in case of regular request or redirected request.
3367         This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests.
3368         But they are not allowed for same-origin redirected requests.
3369
3370         * WebCore.xcodeproj/project.pbxproj:
3371         * loader/DocumentThreadableLoader.cpp:
3372         (WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error.
3373         (WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API.
3374         * loader/SubresourceLoader.cpp:
3375         (WebCore::SubresourceLoader::willSendRequestInternal):
3376         * loader/cache/CachedResourceLoader.cpp:
3377         (WebCore::CachedResourceLoader::requestImage):
3378         (WebCore::CachedResourceLoader::checkInsecureContent):
3379         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
3380         (WebCore::isSameOriginDataURL):
3381         (WebCore::CachedResourceLoader::canRequest):
3382         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
3383         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox):
3384         (WebCore::CachedResourceLoader::requestResource):
3385         * loader/cache/CachedResourceLoader.h:
3386
3387 2016-10-06  Youenn Fablet  <youenn@apple.com>
3388
3389         [Fetch API] Use ReadableStream pull to transfer binary data to stream when application needs it
3390         https://bugs.webkit.org/show_bug.cgi?id=162892
3391
3392         Reviewed by Alex Christensen.
3393
3394         Covered by existing tests.
3395
3396         Before this patch, FetchResponse was never resolving the start promise.
3397         This way, it could enqueue data, error or close the stream whenever desired.
3398
3399         With this patch, FetchResponse will feed the stream when being asked to.
3400         This allows keeping the data in WebCore until the application needs it.
3401         This is only implemented for network data.
3402         For other data owned by response (blob, text...), data will be enqueued like previously as fast as possible.
3403
3404     &