18faca8121f6cbf6b8b3570289c3a4ea4431aa85
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-13  Darin Adler  <darin@apple.com>
2
3         Remove many includes of ExceptionCode.h
4         https://bugs.webkit.org/show_bug.cgi?id=164706
5
6         Reviewed by Alex Christensen.
7
8         * Modules/encryptedmedia/CDMPrivateClearKey.cpp: Removed include of ExceptionCode.h.
9         * Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp: Ditto.
10         * Modules/fetch/FetchBodyOwner.cpp: Ditto.
11
12         * Modules/indexeddb/IDBDatabase.cpp: Added include of ExceptionCode.h.
13
14         * Modules/indexeddb/IDBDatabase.h: Removed include of ExceptionCode.h.
15         * Modules/indexeddb/IDBDatabaseException.cpp: Ditto.
16
17         * Modules/indexeddb/IDBIndex.cpp: Added include of ExceptionCode.h.
18         * Modules/indexeddb/IDBObjectStore.cpp: Ditto.
19
20         * Modules/mediastream/MediaConstraintsImpl.cpp: Removed include of ExceptionCode.h.
21         * Modules/mediastream/MediaDevicesEnumerationRequest.cpp: Ditto.
22         * Modules/mediastream/MediaDevicesRequest.cpp: Ditto.
23         * Modules/mediastream/MediaStream.cpp: Ditto.
24         * Modules/mediastream/MediaStreamTrack.cpp: Ditto.
25         * Modules/mediastream/RTCDTMFSender.cpp: Ditto.
26         * Modules/mediastream/RTCDataChannel.cpp: Ditto.
27         * Modules/mediastream/RTCPeerConnection.cpp: Ditto.
28
29         * Modules/notifications/Notification.h: Removed definition of ExceptionCode.
30         * Modules/streams/ReadableStreamSource.h: Ditto.
31         * Modules/webaudio/BiquadFilterNode.cpp: Ditto.
32
33         * Modules/webaudio/PannerNode.cpp: Removed inclde of ExceptionCode.h.
34         * Modules/webaudio/WaveShaperNode.cpp: Ditto.
35
36         * Modules/webdatabase/Database.cpp:
37         (WebCore::guidForOriginAndName): Reimplemented using HashMap::ensure.
38         * Modules/webdatabase/Database.h: Renamed DatabaseGuid to DatabaseGUID and defined
39         it here instead of a in DatabaseBasicTypes.h; removed that include.
40
41         * Modules/webdatabase/DatabaseBasicTypes.h: Removed.
42
43         * Modules/webdatabase/DatabaseManager.h: Removed include of DatabaseBasicTypes.h.
44         * Modules/webdatabase/DatabaseTask.h: Ditto.
45
46         * Modules/webdatabase/SQLTransactionBackend.cpp: Removed include of ExceptionCode.h.
47
48         * Modules/webdatabase/SQLTransactionBackend.h: Removed include of DatabaseBasicTypes.h.
49
50         * WebCore.xcodeproj/project.pbxproj: Removed DatabaseBasicTypes.h, also let Xcode
51         edit the file.
52
53         * bindings/js/ScriptModuleLoader.cpp: Removed include of ExceptionCode.h.
54         * bindings/js/SerializedScriptValue.cpp: Ditto.
55         * bindings/js/StructuredClone.cpp: Ditto.
56
57         * bindings/scripts/CodeGeneratorJS.pm:
58         (GenerateParametersCheck): Removed unnecessary include of ExceptionCode.h.
59
60         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
61         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
62         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
63         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
64         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
65         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
66         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
67         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
68         * bindings/scripts/test/JS/JSTestInterface.cpp:
69         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
70         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
71         * bindings/scripts/test/JS/JSTestNode.cpp:
72         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
73         * bindings/scripts/test/JS/JSTestObj.cpp:
74         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
75         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
76         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
77         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
78         Updated.
79
80         * css/CSSMediaRule.cpp: Removed include of ExceptionCode.h.
81         * css/CSSSupportsRule.cpp: Ditto.
82         * dom/ClientRectList.cpp: Ditto.
83
84         * dom/DOMCoreException.cpp: Added include of ExceptionCode.h.
85
86         * dom/DOMImplementation.cpp: Removed include of ExceptionCode.h.
87         * dom/ExceptionBase.h: Ditto.
88
89         * dom/Node.cpp: Added include of ExceptionCode.h.
90
91         * dom/NodeIterator.cpp: Removed include of ExceptionCode.h.
92         (WebCore::NodeIterator::NodePointer::NodePointer): Marked this inline.
93         (WebCore::NodeIterator::NodePointer::clear): Ditto.
94         (WebCore::NodeIterator::NodePointer::moveToNext): Ditto.
95         (WebCore::NodeIterator::NodePointer::moveToPrevious): Ditto.
96         (WebCore::NodeIterator::NodeIterator): Ditto.
97         (WebCore::NodeIterator::create): Moved this here from the header.
98         Now the constructor is inlined instead of this function.
99         (WebCore::NodeIterator::detach): Deleted. Moved to header.
100         * dom/NodeIterator.h: Removed definition of ExceptionCode, fixed indentation
101         of this file and made a few changes as mentioned above.
102
103         * dom/ProcessingInstruction.cpp: Removed include of ExceptionCode.h.
104
105         * dom/Text.cpp: Added include of ExceptionCode.h.
106
107         * dom/TreeWalker.cpp: Removed include of ExceptionCode.h.
108         * editing/FrameSelection.cpp: Ditto.
109         * fileapi/WebKitBlobBuilder.cpp: Ditto.
110         * history/CachedFrame.cpp: Ditto.
111         * html/HTMLDocument.cpp: Ditto.
112         * html/HTMLMeterElement.cpp: Ditto.
113         * html/HTMLObjectElement.cpp: Ditto.
114         * html/HTMLOptionElement.cpp: Ditto.
115
116         * html/HTMLOptionsCollection.cpp: Removed include of ExceptionCode.h.
117         (WebCore::HTMLOptionsCollection::add): Changed argument to const& to avoid a
118         little bit of reference count churn.
119         * html/HTMLOptionsCollection.h: Updated for above.
120
121         * html/HTMLProgressElement.cpp: Removed include of ExceptionCode.h.
122
123         * html/HTMLSelectElement.cpp:
124         (WebCore::HTMLSelectElement::add): Changed argument to const& to avoid a
125         little bit of reference count churn.
126         * html/HTMLSelectElement.h: Updated for above.
127
128         * html/HTMLTextAreaElement.cpp: Removed include of ExceptionCode.h.
129         * html/canvas/CanvasPattern.cpp: Ditto.
130
131         * html/canvas/WebGLContextGroup.h: Removed definition of ExceptionCode.
132
133         * html/track/AudioTrack.h: Removed include of ExceptionCode.h.
134         * html/track/TextTrack.h: Ditto.
135
136         * html/track/VTTCue.cpp: Added include of ExceptionCode.h.
137         * html/track/VTTRegion.cpp: Ditto.
138
139         * html/track/VideoTrack.h: Removed include of ExceptionCode.h.
140         * inspector/DOMEditor.cpp: Ditto.
141
142         * inspector/InspectorDatabaseAgent.cpp: Removed include of ExceptionCode.h.
143         Tweaked the code in the file a bit, marking more things final and making them
144         private. ALso simplified a couple of the functions a bit.
145         (WebCore::InspectorDatabaseAgent::didOpenDatabase):
146         (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
147         (WebCore::InspectorDatabaseAgent::executeSQL):
148         (WebCore::InspectorDatabaseAgent::databaseForId):
149
150         * inspector/InspectorIndexedDBAgent.cpp: Removed include of ExceptionCode.h.
151
152         * inspector/InspectorStyleSheet.cpp: Added include of ExceptionCode.h.
153
154         * page/FocusController.cpp: Removed include of ExceptionCode.h.
155
156         * page/Location.h: Removed definition of ExceptionCode.
157
158         * page/Page.cpp: Removed include of ExceptionCode.h.
159         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: Ditto.
160         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: Ditto.
161         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: Ditto.
162         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: Ditto.
163
164         * storage/StorageArea.h: Removed definition of ExceptionCode.
165
166         * svg/SVGCircleElement.cpp: Removed include of ExceptionCode.h.
167
168         * svg/SVGColor.cpp: Added include of ExceptionCode.h.
169         * svg/SVGPaint.cpp: Ditto.
170
171         * svg/SVGStyleElement.cpp: Removed include of ExceptionCode.h.
172
173         * svg/properties/SVGListProperty.h: Added include of ExceptionCode.h.
174
175         * workers/Worker.cpp: Removed include of ExceptionCode.h.
176         * workers/WorkerMessagingProxy.cpp: Ditto.
177
178         * xml/XMLSerializer.cpp: Removed unneeded includes.
179         (WebCore::XMLSerializer::serializeToString): Use nullptr.
180         * xml/XMLSerializer.h: Removed definition of ExceptionCode, fixed indentation
181         of this file, and made a couple tweaks.
182
183 2016-11-14  Youenn Fablet  <youenn@apple.com>
184
185         MediaStreamPrivate::create should take vectors of Ref
186         https://bugs.webkit.org/show_bug.cgi?id=164670
187
188         Reviewed by Sam Weinig.
189
190         No change of behavior.
191
192         * Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
193         (WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode):
194         * platform/mediastream/MediaStreamPrivate.cpp:
195         (WebCore::MediaStreamPrivate::create):
196         * platform/mediastream/MediaStreamPrivate.h:
197         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
198         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
199         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
200         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
201         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
202         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
203
204 2016-11-14  Joanmarie Diggs  <jdiggs@igalia.com>
205
206         AX: [ATK] Expose STATE_SINGLE_LINE and STATE_MULTI_LINE for ARIA searchbox role
207         https://bugs.webkit.org/show_bug.cgi?id=164712
208
209         Reviewed by Chris Fleizach.
210
211         Include SearchFieldRole when adding STATE_SINGLE_LINE and STATE_MULTI_LINE
212         to AtkStateSet.
213
214         Test: accessibility/gtk/singleline-and-multiline.html
215
216         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
217         (setAtkStateSetFromCoreObject):
218
219 2016-11-14  Youenn Fablet  <youennf@gmail.com>
220
221         RTCRtpTransceiver should have Ref of sender and receiver
222         https://bugs.webkit.org/show_bug.cgi?id=164665
223
224         Reviewed by Darin Adler.
225
226         No change of behavior.
227
228         Making RTCRptTransceiver have Ref<RTCRtpSender> and Ref<RTCRtpReceiver>.
229         Transforming transceiver set list of senders and receivers as vectors of references to reduce count churning.
230         Also making RTCRptTransceiver have a Ref<RTCIceTransport> instead of a RefPtr.
231
232         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
233         (WebCore::MediaEndpointPeerConnection::createOfferTask):
234         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
235         (WebCore::createSourceMap):
236         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
237         (WebCore::MediaEndpointPeerConnection::createReceiver):
238         (WebCore::MediaEndpointPeerConnection::replaceTrack):
239         * Modules/mediastream/MediaEndpointPeerConnection.h:
240         * Modules/mediastream/PeerConnectionBackend.h:
241         * Modules/mediastream/RTCPeerConnection.cpp:
242         (WebCore::RTCPeerConnection::addTrack):
243         (WebCore::RTCPeerConnection::removeTrack):
244         (WebCore::RTCPeerConnection::close):
245         * Modules/mediastream/RTCPeerConnection.h:
246         * Modules/mediastream/RTCRtpTransceiver.cpp:
247         (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
248         * Modules/mediastream/RTCRtpTransceiver.h:
249         (WebCore::RTCRtpTransceiver::create):
250         (WebCore::RTCRtpTransceiver::sender):
251         (WebCore::RTCRtpTransceiver::receiver):
252         (WebCore::RTCRtpTransceiver::iceTransport):
253         (WebCore::RtpTransceiverSet::senders):
254         (WebCore::RtpTransceiverSet::receivers):
255
256 2016-11-14  Csaba Osztrogonác  <ossy@webkit.org>
257
258         Fix various --minimal build issue
259         https://bugs.webkit.org/show_bug.cgi?id=164479
260
261         Reviewed by Darin Adler.
262
263         * dom/Node.cpp:
264         * platform/audio/PlatformMediaSessionManager.cpp:
265         * testing/Internals.cpp:
266         (WebCore::Internals::captionsStyleSheetOverride):
267
268 2016-11-14  Csaba Osztrogonác  <ossy@webkit.org>
269
270         Fix the !ENABLE(VIDEO_TRACK) build
271         https://bugs.webkit.org/show_bug.cgi?id=164476
272
273         Reviewed by Darin Adler.
274
275         * css/RuleSet.cpp:
276         (WebCore::RuleSet::addRule):
277         * css/parser/CSSParserValues.h:
278         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
279         * css/parser/CSSSelectorParser.cpp:
280         (WebCore::isPseudoElementFunction):
281         (WebCore::CSSSelectorParser::consumePseudo):
282
283 2016-11-14  Miguel Gomez  <magomez@igalia.com>
284
285         [GTK] Do not use gstreamer-gl when accelerated compositing is disabled
286         https://bugs.webkit.org/show_bug.cgi?id=164481
287
288         Reviewed by Žan Doberšek.
289
290         Check whether accelerated compositing is enabled before creating the gstreamer-gl video sink.
291
292         No new tests (Covered by existing tests).
293
294         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
295         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
296
297 2016-11-14  Csaba Osztrogonác  <ossy@webkit.org>
298
299         Fix the !ENABLE(CSS_BOX_DECORATION_BREAK) build
300         https://bugs.webkit.org/show_bug.cgi?id=164478
301
302         Reviewed by Darin Adler.
303
304         * css/parser/CSSParserFastPaths.cpp:
305         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
306
307 2016-11-14  Csaba Osztrogonác  <ossy@webkit.org>
308
309         Fix the !ENABLE(CSS_GRID_LAYOUT) build
310         https://bugs.webkit.org/show_bug.cgi?id=164477
311
312         Reviewed by Darin Adler.
313
314         * css/parser/CSSParserFastPaths.cpp:
315         (WebCore::isSimpleLengthPropertyID):
316         * css/parser/CSSPropertyParser.cpp:
317         (WebCore::CSSPropertyParser::parseSingleValue):
318         (WebCore::CSSPropertyParser::parseShorthand):
319
320 2016-11-14  Csaba Osztrogonác  <ossy@webkit.org>
321
322         [EFL] Suppress build warning in generated Geoclue2Interface.c
323         https://bugs.webkit.org/show_bug.cgi?id=164475
324
325         Reviewed by Darin Adler.
326
327         * PlatformEfl.cmake:
328
329 2016-11-10  Philippe Normand  <pnormand@igalia.com>
330
331         [GStreamer][OWR] poor video rendering in apprtc
332         https://bugs.webkit.org/show_bug.cgi?id=164585
333
334         Reviewed by Xabier Rodriguez-Calvar.
335
336         The apprtc service uses 3 video elements in total, one for local, one
337         for remote and one called preview. During a call only remote and
338         preview are displayed, preview being linked to the same mediastream as
339         local. The consequence is that 2 OWR video renderers of the same
340         source are created. When gst-gl is enabled this isn't a problem but
341         when it is disabled a performance issue appears and the webkit video
342         sink starts dropping frames.
343
344         The solution is to have the video renderer shared between the 2
345         media players in this scenario.
346
347         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
348         (WebCore::MediaPlayerPrivateGStreamerBase::videoSink): Add video sink getter.
349         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
350         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Make sure the m_streamPrivate is
351         set before creating the video sink.
352         (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): Re-use video renderer
353         and sink if they have previously been created for another media player.
354         * platform/mediastream/MediaStreamPrivate.h: Store GStreamer sink and renderer so
355         they can be potentially used by multiple media players.
356         (WebCore::MediaStreamPrivate::setVideoRenderer):
357         (WebCore::MediaStreamPrivate::getVideoSinkElement):
358         (WebCore::MediaStreamPrivate::getVideoRenderer):
359
360 2016-11-13  Fujii Hironori  <Hironori.Fujii@sony.com>
361
362         [HarfBuzz] HarfBuzzShaper should not assume numGlyphs is greater than 0
363         https://bugs.webkit.org/show_bug.cgi?id=164500
364
365         Reviewed by Myles C. Maxfield.
366
367         Test: fast/text/international/harfbuzz-runs-with-no-glyph.html
368
369         HarfBuzzShaper assumes numGlyphs of HarfBuzzRun is greater than
370         zero. But this is not necessarily true. If a font does not have a
371         glyph of SPACE (U+0020), HarfBuzz removes ignorable glyphs. In
372         this case, HarfBuzzRun can have no glyphs.
373
374         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
375         (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Resize
376         m_offsets to one if m_numGlyphs is zero.
377         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
378         (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Use Vector::data()
379         instread of operator[0].
380         (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto.
381         (WebCore::HarfBuzzShaper::HarfBuzzRun::offsets): Ditto.
382         (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphToCharacterIndexes): Ditto.
383
384 2016-11-13  Chris Dumez  <cdumez@apple.com>
385
386         REGRESSION (204441): newsplex.com map does not load
387         https://bugs.webkit.org/show_bug.cgi?id=164705
388         <rdar://problem/28753438>
389
390         Reviewed by Darin Adler.
391
392         Update getElementsByTagName(qualifiedName) implementation to match more closely
393         the specification at:
394         - https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
395         - https://dom.spec.whatwg.org/#concept-getelementsbytagname
396         - https://dom.spec.whatwg.org/#concept-element-qualified-name
397
398         In particular, we no longer split the input qualifiedName into a prefix and a
399         localName in order to compare those to element.prefix() / element.localName().
400         Instead, we keep the input qualifiedName as is and compare it to the element's
401         qualifiedName. This matters for HTML elements inside an HTML document that have
402         a semicolon in their localname (e.g. 'wx:map'). For this example, the element's
403         localName and its qualified name are both 'wx:map'. Calling
404         getElementsByTagName('wx:map') should return it. However, if you split the input
405         qualifiedName into a prefix and a localName, you end up checking:
406         'wx' == null && 'map' == 'wx:map'
407         which does not match.
408
409         Test: fast/dom/getElementsByTagName-HTMLElement-prefix.html
410
411         * dom/TagCollection.cpp:
412         (WebCore::TagCollection::TagCollection):
413         (WebCore::TagCollection::~TagCollection):
414         (WebCore::HTMLTagCollection::HTMLTagCollection):
415         (WebCore::HTMLTagCollection::~HTMLTagCollection):
416         (WebCore::makeQualifiedName): Deleted.
417         (WebCore::splitQualifiedName): Deleted.
418         * dom/TagCollection.h:
419         (WebCore::TagCollection::elementMatches):
420         (WebCore::HTMLTagCollection::elementMatches):
421
422 2016-11-13  Darin Adler  <darin@apple.com>
423
424         Remove ExceptionCodePlaceholder
425         https://bugs.webkit.org/show_bug.cgi?id=164703
426
427         Reviewed by Sam Weinig.
428
429         * CMakeLists.txt: Removed ExceptionCodePlaceholder.cpp.
430         * WebCore.xcodeproj/project.pbxproj: Removed ExceptionCodePlaceholder.h/cpp.
431         Also let Xcode make a change to the file, I think removing an unreferenced
432         dead entry for a file that is already listed under a different ID.
433         * dom/DOMAllInOne.cpp: Removed ExceptionCodePlaceholder.cpp.
434         * dom/ExceptionCodePlaceholder.cpp: Removed.
435         * dom/ExceptionCodePlaceholder.h: Removed.
436         * inspector/InspectorDatabaseAgent.cpp: Removed include of ExceptionCodePlaceholder.h.
437
438 2016-11-13  Darin Adler  <darin@apple.com>
439
440         Fix exception handling in SQL database code, streamline and update code
441         https://bugs.webkit.org/show_bug.cgi?id=164685
442
443         Reviewed by Sam Weinig.
444
445         Removed some old abstraction layers that were no longer in use. For example,
446         i n many cases, calls were going through DatabaseManager, which called through
447         an abstract class AbstractDatabaseServer to a concrete class DatabaseServer,
448         which then called through to DatabaseTracker. Clients now mostly just call
449         DatabaseTracker directly.
450
451         * CMakeLists.txt: Removed DatabaseServer.cpp and SQLTransactionClient.cpp.
452
453         * Modules/webdatabase/AbstractDatabaseServer.h: Removed.
454
455         * Modules/webdatabase/DOMWindowWebDatabase.cpp:
456         (WebCore::DOMWindowWebDatabase::openDatabase): Use ExceptionOr instead of
457         DatabaseError to communicate DOM exceptions from DatabaseManager.
458
459         * Modules/webdatabase/Database.cpp:
460         (WebCore::Database::Database): Use a reference instead of a RefPtr&& for database
461         context. Use unsigned instead of unsigned long. Modernize code to use more
462         initialization rather than assignment, to initialize scalar data members in the
463         class definition, and to use HashMap::ensure.
464         (WebCore::Database::databaseThread): Added. This class asserts that there is a
465         thread in the constructor, and so it is useful to have a helper for all the other
466         functions that assumes the thread is present and returns a reference rather than
467         a pointer.
468         (WebCore::Database::~Database): Updated since m_scriptExecutionContext is now
469         a Ref instead of a RefPtr.
470         (WebCore::Database::openAndVerifyVersion): Use ExceptionOr and databaseThread.
471         (WebCore::Database::close): Use databaseThread.
472         (WebCore::Database::performClose): Ditto.
473         (WebCore::DoneCreatingDatabaseOnExitCaller::DoneCreatingDatabaseOnExitCaller):
474         Use a reference. Removed unused m_openSuccceeded.
475         (WebCore::DoneCreatingDatabaseOnExitCaller::~DoneCreatingDatabaseOnExitCaller):
476         Use DatabaseTracker::singleton by its new name.
477         (WebCore::DoneCreatingDatabaseOnExitCaller::setOpenSucceeded): Deleted.
478         (WebCore::Database::performOpenAndVerify): Use ExceptionOr and update for above.
479         (WebCore::Database::closeDatabase): Updated for name change.
480         (WebCore::Database::scheduleTransaction): Updated for above, simplified and
481         streamlined.
482         (WebCore::Database::scheduleTransactionStep): Use databaseThread.
483         (WebCore::Database::transactionClient): Deleted. This object is no longer needed.
484         (WebCore::Database::transactionCoordinator): Use databaseThread.
485         (WebCore::Database::markAsDeletedAndClose): Removed unnecessary null check for
486         databaseThread, which can never be null.
487         (WebCore::Database::estimatedSize): Use unsigned, not unsigned long.
488         (WebCore::Database::disableAuthorizer): Removed assertion about RefPtr that is
489         now a Ref and never could have been null.
490         (WebCore::Database::enableAuthorizer): Ditto.
491         (WebCore::Database::setAuthorizerPermissions): Ditto.
492         (WebCore::Database::lastActionChangedDatabase): Ditto.
493         (WebCore::Database::lastActionWasInsert): Ditto.
494         (WebCore::Database::resetDeletes): Ditto.
495         (WebCore::Database::hadDeletes): Ditto.
496         (WebCore::Database::resetAuthorizer): Removed null check for a RefPtr that is now
497         a Ref and never could have been null.
498         (WebCore::Database::runTransaction): Simplified a bit.
499         (WebCore::Database::tableNames): Use databaseThread.
500         (WebCore::Database::securityOrigin): Changed to return a reference instead of a
501         pointer because all the callers need it to do that. If called on the wrong thread,
502         this will now do a RELEASE_ASSERT_NOT_REACHED. In the old code it would return a
503         null pointer and then the caller would dereference it a moment later, so it would
504         still be a crash.
505         (WebCore::Database::maximumSize): Removed const since it's not really needed and
506         the DatabaseTracker wants a non-const reference to this database.
507         (WebCore::Database::didCommitWriteTransaction): Added. Moved this code here from
508         SQLTransactionClient. There is no abstraction layer, so no reason to not have
509         this code, quite comparable to the rest of the code in the class, here. I am
510         assuming this served some more useful purpose back when we had a different back end
511         for Chromium?
512         (WebCore::Database::didExceedQuota): Ditto.
513         * Modules/webdatabase/Database.h: Updated for above changes. Made some functions
514         return references instead of pointers. Use Ref instead of RefPtr for some things that
515         can never be null.
516         * Modules/webdatabase/Database.idl: Added ImplementationLacksVTable because the
517         Database class is not polymorphic.
518
519         * Modules/webdatabase/DatabaseContext.cpp:
520         (WebCore::DatabaseContext::DatabaseContext): Take a reference instead of a pointer.
521         Moved data member initialization into class definition. Remove code that tries to do
522         debug accounting and databasecontext registration and instead just make sure to keep
523         the ScriptExecutionContext pointing at the DatabaseContext.
524         (WebCore::DatabaseContext::~DatabaseContext): Ditto.
525         (WebCore::DatabaseContext::stopDatabases): Ditto.
526         * Modules/webdatabase/DatabaseContext.h: Updated for the above. Also used the
527         scriptExecutionContext function inherited from the base class intead of adding our
528         own, and added a existingDatabaseThread() function, letting us get at the database
529         thread efficiently without creating a new one.
530
531         * Modules/webdatabase/DatabaseError.h: Removed. We now use DOM exceptions directly
532         instead of our own error enumeration that has to be translated to a DOM exception.
533
534         * Modules/webdatabase/DatabaseManager.cpp: Moved the ProposedDatabase class here
535         from the header file, and had it use references instead of pointers.
536         (WebCore::DatabaseManager::DatabaseManager): Deleted. There was nothing left to
537         initialize once the refactoring was done.
538         (WebCore::DatabaseManager::initialize): Call DatabaseTracker directly instead of
539         calling through m_server.
540         (WebCore::DatabaseManager::setClient): Ditto.
541         (WebCore::DatabaseManager::databaseDirectoryPath): Deleted. Callers will use the
542         function in DatabaseTracker directly.
543         (WebCore::DatabaseManager::setDatabaseDirectoryPath): Ditto.
544         (WebCore::DatabaseManager::existingDatabaseContextFor): Deleted. Callers will use
545         the ScriptExecutionContext::databaseContext function instead.
546         (WebCore::DatabaseManager::databaseContext): Renamed from databaseContextFor.
547         (WebCore::DatabaseManager::registerDatabaseContext): Deleted.
548         (WebCore::DatabaseManager::unregisterDatabaseContext): Deleted.
549         (WebCore::DatabaseManager::didConstructDatabaseContext): Deleted.
550         (WebCore::DatabaseManager::didDestructDatabaseContext): Deleted.
551         (WebCore::DatabaseManager::exceptionCodeForDatabaseError): Deleted.
552         (WebCore::logOpenDatabaseError): Tweaked conditionals a bit.
553         (WebCore::DatabaseManager::openDatabaseBackend): Use ExceptionOr. Changed to call
554         tryToOpenDatabaseBackend function here in this class rather than using m_server.
555         (WebCore::DatabaseManager::tryToOpenDatabaseBackend): Added. Moved here from the
556         DatabaseServer class.
557         (WebCore::DatabaseManager::addProposedDatabase): Take a reference.
558         (WebCore::DatabaseManager::removeProposedDatabase): Ditto.
559         (WebCore::DatabaseManager::openDatabase): Use ExceptionOr.
560         (WebCore::DatabaseManager::hasOpenDatabases): Use ScriptContext::databaseContext
561         directly instead of using helper functions in this class.
562         (WebCore::DatabaseManager::stopDatabases): Ditto.
563         (WebCore::DatabaseManager::fullPathForDatabase): Take a reference and also call
564         DatabaseTracker directly instead of calling through m_server.
565         (WebCore::DatabaseManager::hasEntryForOrigin): Deleted. Callers will use the
566         function in DatabaseTracker directly.
567         (WebCore::DatabaseManager::origins): Ditto.
568         (WebCore::DatabaseManager::databaseNamesForOrigin): Ditto.
569         (WebCore::DatabaseManager::detailsForNameAndOrigin): Call DatabaseTracker directly
570         instead of calling through m_server.
571         (WebCore::DatabaseManager::usageForOrigin): Deleted. Callers will use the
572         function in DatabaseTracker directly.
573         (WebCore::DatabaseManager::quotaForOrigin): Ditto.
574         (WebCore::DatabaseManager::setQuota): Ditto.
575         (WebCore::DatabaseManager::deleteAllDatabasesImmediately): Ditto.
576         (WebCore::DatabaseManager::deleteOrigin): Ditto.
577         (WebCore::DatabaseManager::deleteDatabase): Ditto.
578         (WebCore::DatabaseManager::closeAllDatabases): Ditto.
579         (WebCore::DatabaseManager::logErrorMessage): Take a reference.
580         * Modules/webdatabase/DatabaseManager.h: Updated for changes above.
581
582         * Modules/webdatabase/DatabaseManagerClient.h: Use references for security origins.
583         Also changed #if for iOS so that other platforms can call the iOS-specific functions
584         and they have inline empty bodies; lets us clean up call sites to not need conditionals.
585
586         * Modules/webdatabase/DatabaseServer.cpp: Removed.
587         * Modules/webdatabase/DatabaseServer.h: Removed.
588
589         * Modules/webdatabase/DatabaseTask.cpp:
590         (WebCore::isolatedCopy): Added. Helper functions for making isolated copies of
591         exceptions, which can contain strings.
592         (WebCore::DatabaseOpenTask::DatabaseOpenTask): Use ExceptionOr<void> instead of
593         a DatabaseError, a String, and a success boolean.
594         (WebCore::DatabaseOpenTask::doPerformTask): Updated to use ExceptoinOr.
595         (WebCore::DatabaseTableNamesTask::DatabaseTableNamesTask): Renamed.
596         (WebCore::DatabaseTableNamesTask::doPerformTask): Added a comment.
597         * Modules/webdatabase/DatabaseTask.h: Updated for above changes.
598
599         * Modules/webdatabase/DatabaseThread.cpp:
600         (WebCore::DatabaseThread::DatabaseThread): Initialized data members in the class
601         definition. Removed m_transactionClient.
602         (WebCore::DatabaseThread::recordDatabaseOpen): Take a reference.
603         (WebCore::DatabaseThread::recordDatabaseClosed): Ditto.
604         (WebCore::DatabaseThread::scheduleTask): Use an rvalue reference.
605         (WebCore::DatabaseThread::scheduleImmediateTask): Ditto.
606         (WebCore::DatabaseThread::unscheduleDatabaseTasks): Use a lambda instead of a
607         class for the same-database predicate.
608         * Modules/webdatabase/DatabaseThread.h: Updated for above.
609
610         * Modules/webdatabase/DatabaseTracker.cpp:
611         (WebCore::isolatedCopy): Added. Helper for making an isolated copy of a vector
612         of strings.
613         (WebCore::DatabaseTracker::singleton): Renamed from tracker.
614         (WebCore::DatabaseTracker::DatabaseTracker): Moved the code from
615         setDatabaseDirectoryPath in here.
616         (WebCore::DatabaseTracker::setDatabaseDirectoryPath): Deleted.
617         (WebCore::DatabaseTracker::databaseDirectoryPath): Deleted.
618         (WebCore::DatabaseTracker::hasAdequateQuotaForOrigin): Use ExceptionOr.
619         (WebCore::DatabaseTracker::canEstablishDatabase): Ditto.
620         (WebCore::DatabaseTracker::retryCanEstablishDatabase): Ditto.
621         (WebCore::DatabaseTracker::hasEntryForOriginNoLock): Take a reference.
622         (WebCore::DatabaseTracker::hasEntryForOrigin): Deleted.
623         (WebCore::DatabaseTracker::hasEntryForDatabase): Take a reference.
624         (WebCore::DatabaseTracker::maximumSize): Renamed from getMaxSizeForDatabase
625         and changed to take a reference.
626         (WebCore::DatabaseTracker::originPath): Take a reference.
627         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock): Ditto.
628         (WebCore::DatabaseTracker::fullPathForDatabase): Ditto.
629         (WebCore::DatabaseTracker::origins): Changed to use a return value instead
630         of using an out argument.
631         (WebCore::DatabaseTracker::databaseNamesNoLock): Ditto. Also renamed from
632         databaseNamesForOriginNoLock.
633         (WebCore::DatabaseTracker::databaseNames): Ditto. Also renamed from
634         databaseNamesForOrigin.
635         (WebCore::DatabaseTracker::detailsForNameAndOrigin): Take a reference.
636         (WebCore::DatabaseTracker::setDatabaseDetails): Ditto.
637         (WebCore::DatabaseTracker::doneCreatingDatabase): Ditto.
638         (WebCore::DatabaseTracker::addOpenDatabase): Ditto.
639         (WebCore::DatabaseTracker::removeOpenDatabase): Ditto.
640         (WebCore::DatabaseTracker::getOpenDatabases): Deleted.
641         (WebCore::DatabaseTracker::originLockFor): Take a reference.
642         (WebCore::DatabaseTracker::deleteOriginLockFor): Take a reference.
643         (WebCore::DatabaseTracker::usage): Renamed from usageForOrigin. Take a reference.
644         (WebCore::DatabaseTracker::quotaNoLock): Renamed from quotaForOriginNoLock.
645         Take a reference.
646         (WebCore::DatabaseTracker::quota): Renamed from quatoForOrigin. Take a reference.
647         (WebCore::DatabaseTracker::setQuota): Take a reference.
648         (WebCore::DatabaseTracker::addDatabase): Ditto.
649         (WebCore::DatabaseTracker::deleteAllDatabasesImmediately): Updated now that
650         origins has a return value.
651         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince): Ditto.
652         (WebCore::DatabaseTracker::deleteOrigin): Take a reference.
653         (WebCore::DatabaseTracker::isDeletingDatabaseOrOriginFor): Ditto.
654         (WebCore::DatabaseTracker::recordCreatingDatabase): Updated to take a reference,
655         use unique_ptr, and use HashCountedSet.
656         (WebCore::DatabaseTracker::doneCreatingDatabase): Ditto.
657         (WebCore::DatabaseTracker::creatingDatabase): Ditto.
658         (WebCore::DatabaseTracker::canDeleteDatabase): Take a reference.
659         (WebCore::DatabaseTracker::recordDeletingDatabase): Updated to take a reference,
660         and use unique_ptr.
661         (WebCore::DatabaseTracker::doneDeletingDatabase): Ditto.
662         (WebCore::DatabaseTracker::isDeletingDatabase): Ditto.
663         (WebCore::DatabaseTracker::canDeleteOrigin): Take a reference.
664         (WebCore::DatabaseTracker::isDeletingOrigin): Ditto.
665         (WebCore::DatabaseTracker::recordDeletingOrigin): Ditto.
666         (WebCore::DatabaseTracker::doneDeletingOrigin): Ditto.
667         (WebCore::DatabaseTracker::deleteDatabase): Ditto.
668         (WebCore::DatabaseTracker::deleteDatabaseFile): Ditto.
669         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases): Ditto.
670         (WebCore::DatabaseTracker::scheduleNotifyDatabaseChanged): Ditto.
671         (WebCore::DatabaseTracker::notifyDatabasesChanged): Ditto.
672         * Modules/webdatabase/DatabaseTracker.h: Updated for above changes.
673
674         * Modules/webdatabase/SQLStatement.cpp:
675         (WebCore::SQLStatement::SQLStatement): Updated since Database::scriptExecutionContext
676         now returns a reference.
677
678         * Modules/webdatabase/SQLTransaction.cpp:
679         (WebCore::SQLTransaction::SQLTransaction): Moved data member initialization to
680         the calss definition. Also updated since Database::scriptExecutionContext now
681         returns a reference.
682         (WebCore::SQLTransaction::executeSQL): Use ExceptionOr.
683         (WebCore::SQLTransaction::checkAndHandleClosedDatabase): Updated since
684         databaseContext now returns a reference.
685         (WebCore::SQLTransaction::deliverQuotaIncreaseCallback): Updated to call
686         didExceedQuota on the database instead of the transaction client.
687         (WebCore::SQLTransaction::postflightAndCommit): Updated to call
688         didCommitWriteTransaction on the database instead of the transaction client.
689         (WebCore::SQLTransaction::acquireOriginLock): Updated for name change of
690         DatabaseTracker::tracker to DatbaseTracker::singleton.
691         * Modules/webdatabase/SQLTransaction.h: Updated for above.
692         * Modules/webdatabase/SQLTransaction.idl: Added MayThrowException to
693         executeSql. Not technically needed since it's a custom binding.
694
695         * Modules/webdatabase/SQLTransactionBackend.cpp:
696         (WebCore::SQLTransactionBackend::doCleanup): Updated assertion to use
697         Database::databaseThread.
698         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown): Ditto.
699
700         * Modules/webdatabase/SQLTransactionClient.cpp: Removed.
701         * Modules/webdatabase/SQLTransactionClient.h: Removed.
702
703         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
704         (WebCore::getDatabaseIdentifier): Updated to pass a reference.
705
706         * WebCore.xcodeproj/project.pbxproj: Removed various deleted files.
707         Also let Xcode change the whitespace on some lines.
708
709         * bindings/js/JSSQLTransactionCustom.cpp:
710         (WebCore::JSSQLTransaction::executeSql): Use ExceptionOr, specifically by
711         using the propagateException function.
712
713         * dom/ScriptExecutionContext.h: Added databaseContext function. Before, we
714         had setDatabaseContext, but no way to inspect the pointer that was stored.
715
716         * inspector/InspectorDatabaseAgent.cpp: Removed IGNORE_EXCEPTION in a call
717         to executeSQL, which no longer has an ExceptionCode out argument.
718
719         * loader/FrameLoader.cpp:
720         (WebCore::FrameLoader::stopLoading): Pass a reference in the call to
721         DatabaseManager::stopDatabases.
722
723 2016-11-13  Dan Bernstein  <mitz@apple.com>
724
725         Try to fix building with newer versions of clang.
726
727         * page/FrameView.h: Don’t export an inline function.
728
729 2016-11-13  Darin Adler  <darin@apple.com>
730
731         Move crypto code from ExceptionCode to ExceptionOr
732         https://bugs.webkit.org/show_bug.cgi?id=164698
733
734         Reviewed by Sam Weinig.
735
736         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
737         (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
738         Use the new identifier function instead of getIdentifierForName.
739         * bindings/js/JSSubtleCryptoCustom.cpp:
740         (WebCore::normalizeCryptoAlgorithmParameters): Ditto.
741         (WebCore::toCryptoKeyUsageBitmap): Removed a stray meaningless const.
742         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Pass
743         ScriptExecutionContext as a reference instead of a pointer.
744
745         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
746         (WebCore::createAlgorithmFromJSValue): Use the more efficient version
747         of setDOMException that uses scope.
748         (WebCore::JSWebKitSubtleCrypto::encrypt): Ditto. Also updated to use
749         ExceptionOr instead of ExceptionCode.
750         (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
751         (WebCore::JSWebKitSubtleCrypto::sign): Ditto.
752         (WebCore::JSWebKitSubtleCrypto::verify): Ditto.
753         (WebCore::JSWebKitSubtleCrypto::digest): Ditto.
754         (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
755         (WebCore::importKey): Ditto.
756         (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
757         (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.
758
759         * crypto/CryptoAlgorithm.cpp:
760         (WebCore::CryptoAlgorithm::CryptoAlgorithm): Deleted.
761         (WebCore::CryptoAlgorithm::~CryptoAlgorithm): Deleted.
762         (WebCore::CryptoAlgorithm::generateKey): Use ExceptionOr.
763         (WebCore::CryptoAlgorithm::encrypt): Ditto.
764         (WebCore::CryptoAlgorithm::decrypt): Ditto.
765         (WebCore::CryptoAlgorithm::sign): Ditto.
766         (WebCore::CryptoAlgorithm::verify): Ditto.
767         (WebCore::CryptoAlgorithm::digest): Ditto.
768         (WebCore::CryptoAlgorithm::deriveKey): Ditto.
769         (WebCore::CryptoAlgorithm::deriveBits): Ditto.
770         (WebCore::CryptoAlgorithm::importKey): Ditto.
771         (WebCore::CryptoAlgorithm::encryptForWrapKey): Ditto.
772         (WebCore::CryptoAlgorithm::decryptForUnwrapKey): Ditto.
773         * crypto/CryptoAlgorithm.h: Use ExceptionOr.
774         Moved the destructor into the header since it's more efficient for
775         derived classes to have it inlined. Removed the protected constructor
776         because since there are pure virtual functions in the class, there is
777         no risk of anyone misusing the public constructor.
778
779         * crypto/CryptoAlgorithmRegistry.cpp:
780         (WebCore::CryptoAlgorithmRegistry::identifier): Renamed from
781         getIdentifierForName and changed to use an Optional rather than
782         using a boolean plus an out argument.
783         (WebCore::CryptoAlgorithmRegistry::name): Renamed to name from
784         nameForIdentifier. Also updated to share a single map containing
785         both names and constructors.
786         (WebCore::CryptoAlgorithmRegistry::create): Share single map as above.
787         (WebCore::CryptoAlgorithmRegistry::registerAlgorithm): Updated assertions
788         to a mroe straightforward style. Share single map for names and constructors.
789         * crypto/CryptoAlgorithmRegistry.h: Updated for above.
790
791         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
792         (WebCore::CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC): Deleted.
793         (WebCore::CryptoAlgorithmAES_CBC::~CryptoAlgorithmAES_CBC): Deleted.
794         (WebCore::CryptoAlgorithmAES_CBC::keyAlgorithmMatches): Use references, ExceptionOr.
795         (WebCore::CryptoAlgorithmAES_CBC::generateKey): Ditto.
796         (WebCore::CryptoAlgorithmAES_CBC::encrypt): Ditto.
797         (WebCore::CryptoAlgorithmAES_CBC::decrypt): Ditto.
798         (WebCore::CryptoAlgorithmAES_CBC::importKey): Ditto.
799         * crypto/algorithms/CryptoAlgorithmAES_CBC.h: Updated for above.
800         Also use constexpr for s_name and s_identifier.
801
802         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
803         (WebCore::CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW): Deleted.
804         (WebCore::CryptoAlgorithmAES_KW::~CryptoAlgorithmAES_KW): Deleted.
805         (WebCore::CryptoAlgorithmAES_KW::keyAlgorithmMatches): Use references, ExceptionOr.
806         (WebCore::CryptoAlgorithmAES_KW::generateKey): Ditto.
807         (WebCore::CryptoAlgorithmAES_KW::importKey): Ditto.
808         (WebCore::CryptoAlgorithmAES_KW::encryptForWrapKey): Ditto.
809         (WebCore::CryptoAlgorithmAES_KW::decryptForUnwrapKey): Ditto.
810         * crypto/algorithms/CryptoAlgorithmAES_KW.h: Updated for above.
811         Also use constexpr for s_name and s_identifier.
812
813         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
814         (WebCore::CryptoAlgorithmHMAC::CryptoAlgorithmHMAC): Deleted.
815         (WebCore::CryptoAlgorithmHMAC::~CryptoAlgorithmHMAC): Deleted.
816         (WebCore::CryptoAlgorithmHMAC::generateKey): Use references, ExceptionOr.
817         (WebCore::CryptoAlgorithmHMAC::sign): Ditto.
818         (WebCore::CryptoAlgorithmHMAC::verify): Ditto.
819         (WebCore::CryptoAlgorithmHMAC::importKey): Ditto.
820         * crypto/algorithms/CryptoAlgorithmHMAC.h: Updated for above.
821         Also use constexpr for s_name and s_identifier.
822
823         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
824         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
825         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::~CryptoAlgorithmRSAES_PKCS1_v1_5): Deleted.
826         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
827         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt): Ditto.
828         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt): Ditto.
829         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey): Ditto.
830         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h: Updated for above.
831         Also use constexpr for s_name and s_identifier.
832
833         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
834         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
835         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::~CryptoAlgorithmRSASSA_PKCS1_v1_5): Deleted.
836         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey): Use references, ExceptionOr.
837         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign): Ditto.
838         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify): Ditto.
839         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): Ditto.
840         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Updated for above.
841         Also use constexpr for s_name and s_identifier.
842
843         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
844         (WebCore::CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP): Deleted.
845         (WebCore::CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP): Deleted.
846         (WebCore::CryptoAlgorithmRSA_OAEP::generateKey): Use references, ExceptionOr.
847         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt): Ditto.
848         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt): Ditto.
849         (WebCore::CryptoAlgorithmRSA_OAEP::importKey): Ditto.
850         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Updated for above.
851         Also use constexpr for s_name and s_identifier.
852
853         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
854         (WebCore::CryptoAlgorithmSHA1::CryptoAlgorithmSHA1): Deleted.
855         (WebCore::CryptoAlgorithmSHA1::~CryptoAlgorithmSHA1): Deleted.
856         (WebCore::CryptoAlgorithmSHA1::digest): Use ExceptionOr.
857         * crypto/algorithms/CryptoAlgorithmSHA1.h: Updated for above.
858         Also use constexpr for s_name and s_identifier.
859
860         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
861         (WebCore::CryptoAlgorithmSHA224::CryptoAlgorithmSHA224): Deleted.
862         (WebCore::CryptoAlgorithmSHA224::~CryptoAlgorithmSHA224): Deleted.
863         (WebCore::CryptoAlgorithmSHA224::digest): Use ExceptionOr.
864         * crypto/algorithms/CryptoAlgorithmSHA224.h: Updated for above.
865         Also use constexpr for s_name and s_identifier.
866
867         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
868         (WebCore::CryptoAlgorithmSHA256::CryptoAlgorithmSHA256): Deleted.
869         (WebCore::CryptoAlgorithmSHA256::~CryptoAlgorithmSHA256): Deleted.
870         (WebCore::CryptoAlgorithmSHA256::digest): Use ExceptionOr.
871         * crypto/algorithms/CryptoAlgorithmSHA256.h: Updated for above.
872         Also use constexpr for s_name and s_identifier.
873
874         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
875         (WebCore::CryptoAlgorithmSHA384::CryptoAlgorithmSHA384): Deleted.
876         (WebCore::CryptoAlgorithmSHA384::~CryptoAlgorithmSHA384): Deleted.
877         (WebCore::CryptoAlgorithmSHA384::digest): Use ExceptionOr.
878         * crypto/algorithms/CryptoAlgorithmSHA384.h: Updated for above.
879         Also use constexpr for s_name and s_identifier.
880
881         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
882         (WebCore::CryptoAlgorithmSHA512::CryptoAlgorithmSHA512): Deleted.
883         (WebCore::CryptoAlgorithmSHA512::~CryptoAlgorithmSHA512): Deleted.
884         (WebCore::CryptoAlgorithmSHA512::digest): Use ExceptionOr.
885         * crypto/algorithms/CryptoAlgorithmSHA512.h: Updated for above.
886         Also use constexpr for s_name and s_identifier.
887
888         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
889         (WebCore::calculateSignature): Use Optional instead of a boolean
890         return value and an out argument.
891         (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
892         (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
893         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
894         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Ditto.
895         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
896         * crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp:
897         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
898         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
899         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
900         (WebCore::CryptoAlgorithmHMAC::platformSign): Ditto.
901         (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
902         * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
903         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
904         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
905         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
906         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Ditto.
907         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
908         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
909         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
910         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.
911
912         * crypto/keys/CryptoKeyAES.cpp:
913         (WebCore::CryptoKeyAES::buildAlgorithm): Updated to use name instead
914         of nameForIdentifier.
915         * crypto/keys/CryptoKeyHMAC.cpp: Ditto.
916         (WebCore::CryptoKeyHMAC::buildAlgorithm):
917
918         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
919         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt): Use ExceptionOr.
920         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt): Ditto.
921         * crypto/mac/CryptoAlgorithmAES_KWMac.cpp:
922         (WebCore::CryptoAlgorithmAES_KW::platformEncrypt): Ditto.
923         (WebCore::CryptoAlgorithmAES_KW::platformDecrypt): Ditto.
924         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
925         (WebCore::commonCryptoHMACAlgorithm): Renamed from
926         getCommonCryptoHMACAlgorithm and changed to use Optional instead of
927         a boolean return value and an out argument.
928         (WebCore::CryptoAlgorithmHMAC::platformSign): Use ExceptionOr.
929         (WebCore::CryptoAlgorithmHMAC::platformVerify): Ditto.
930         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
931         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt): Ditto.
932         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt): Ditto.
933         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
934         (WebCore::cryptoDigestAlgorithm): Renamed from
935         getCryptoDigestAlgorithm and changed to use Optional instead of
936         a boolean return value and an out argument.
937         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign): Use ExceptionOr.
938         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformVerify): Ditto.
939         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
940         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt): Ditto.
941         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt): Ditto.
942
943         * crypto/mac/CryptoKeyRSAMac.cpp:
944         (WebCore::CryptoKeyRSA::buildAlgorithm): Updated to use name instead
945         of nameForIdentifier.
946
947 2016-11-13  Joseph Pecoraro  <pecoraro@apple.com>
948
949         Use #pragma once in WebCore
950         https://bugs.webkit.org/show_bug.cgi?id=164686
951
952         Reviewed by Michael Catanzaro.
953
954         * css/*.h:
955         * plugins/*.h:
956         * rendering/*.h:
957         * style/*.h:
958         * svg/*.h:
959         * testing/*.h:
960
961 2016-11-12  Dan Bernstein  <mitz@apple.com>
962
963         Tried to fix the iOS build after r208666.
964
965         * platform/SuddenTermination.h:
966
967 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
968
969         Add a way to get the UI-side scrolling tree as text via UIScriptController
970         https://bugs.webkit.org/show_bug.cgi?id=164697
971
972         Reviewed by Zalan Bujtas.
973
974         Add dumping to ScrollingTreeNode and subclasses (previously, we could only dump
975         the scrolling state tree). This re-uses the flags used for state tree dumping.
976
977         NodeIDs are not dumped by default because they can depend on earlier tests.
978
979         Test: scrollingcoordinator/ios/ui-scrolling-tree.html
980
981         * page/scrolling/ScrollingStateNode.h:
982         * page/scrolling/ScrollingTree.cpp:
983         (WebCore::ScrollingTree::scrollingTreeAsText):
984         * page/scrolling/ScrollingTree.h:
985         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
986         (WebCore::ScrollingTreeFrameScrollingNode::dumpProperties):
987         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
988         * page/scrolling/ScrollingTreeNode.cpp:
989         (WebCore::ScrollingTreeNode::dumpProperties):
990         (WebCore::ScrollingTreeNode::dump):
991         * page/scrolling/ScrollingTreeNode.h:
992         * page/scrolling/ScrollingTreeScrollingNode.cpp:
993         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
994         * page/scrolling/ScrollingTreeScrollingNode.h:
995         * page/scrolling/mac/ScrollingTreeFixedNode.h:
996         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
997         (WebCore::ScrollingTreeFixedNode::dumpProperties):
998         * page/scrolling/mac/ScrollingTreeStickyNode.h:
999         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
1000         (WebCore::ScrollingTreeStickyNode::dumpProperties):
1001
1002 2016-11-12  Darin Adler  <darin@apple.com>
1003
1004         Remove some use of ExceptionCode in MediaStream
1005         https://bugs.webkit.org/show_bug.cgi?id=164690
1006
1007         Reviewed by Sam Weinig.
1008
1009         * Modules/mediastream/MediaDevices.cpp:
1010         (WebCore::MediaDevices::MediaDevices): Take a Document&.
1011         (WebCore::MediaDevices::create): Ditto.
1012         (WebCore::MediaDevices::~MediaDevices): Deleted.
1013         (WebCore::MediaDevices::getUserMedia): Check document for null and
1014         pass a reference to UserMediaRequest::start. Removed unused ExceptionCode
1015         argument to UserMediaRequest::start, since the only exception was for
1016         a null document.
1017         (WebCore::MediaDevices::enumerateDevices): Check document for null and
1018         pass a reference to MediaDevicesRequest::create. Removed exception
1019         handling entirely because MediaDevicesRequest::create was not ever
1020         raising an exception before.
1021         * Modules/mediastream/MediaDevices.h: Updated for above changes.
1022         * Modules/mediastream/MediaDevices.idl: Removed MayThrowException from
1023         enumerateDevices, because it never throws an exception.
1024
1025         * Modules/mediastream/MediaDevicesRequest.cpp:
1026         (WebCore::MediaDevicesRequest::MediaDevicesRequest): Take a Document&.
1027         Removed unused ExceptionCode& argument.
1028         (WebCore::MediaDevicesRequest::create): Ditto.
1029         * Modules/mediastream/MediaDevicesRequest.h: Updated for above changes.
1030
1031         * Modules/mediastream/NavigatorMediaDevices.cpp:
1032         (WebCore::NavigatorMediaDevices::mediaDevices): Pass a reference.
1033
1034         * Modules/mediastream/UserMediaRequest.cpp:
1035         (WebCore::UserMediaRequest::start): Use ExceptionOr.
1036         (WebCore::UserMediaRequest::UserMediaRequest): Take a Document& and
1037         a UserMediaController&.
1038         * Modules/mediastream/UserMediaRequest.h: Updated for above changes.
1039
1040 2016-11-12  Simon Fraser  <simon.fraser@apple.com>
1041
1042         [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
1043         https://bugs.webkit.org/show_bug.cgi?id=164694
1044
1045         Reviewed by Zalan Bujtas.
1046
1047         When an async scroll notifications get back to the main thread in
1048         AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(), we call 
1049         syncViewportConstrainedLayerPositions() to poke the new layer positions on the
1050         GraphicsLayers to match the changes made on the scrolling thread.
1051
1052         However, this was not done on iOS, which will be problematic for a future patch
1053         where we require GraphicsLayer positions and the current fixedPositionViewport rect
1054         to have been computed when in a consistent state.
1055
1056         Fix by factoring some code into reconcileScrollingState(), which is called on iOS/WK2
1057         from WebPage::updateVisibleContentRects() rather than setting the FrameView's scroll offset
1058         directly.
1059
1060         Test: scrollingcoordinator/ios/sync-layer-positions-after-scroll.html
1061
1062         * page/WheelEventDeltaFilter.cpp:
1063         (WebCore::WheelEventDeltaFilter::filteredDelta):
1064         * page/scrolling/AsyncScrollingCoordinator.cpp:
1065         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1066         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
1067         (WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions):
1068         (WebCore::AsyncScrollingCoordinator::syncChildPositions): Deleted.
1069         * page/scrolling/AsyncScrollingCoordinator.h:
1070         * page/scrolling/ScrollingCoordinator.h:
1071         (WebCore::ScrollingCoordinator::reconcileScrollingState):
1072         (WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions):
1073         (WebCore::ScrollingCoordinator::syncChildPositions): Deleted.
1074         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1075         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
1076         * platform/Logging.h:
1077         * platform/ScrollView.cpp:
1078         (WebCore::ScrollView::setScrollOffset):
1079         * platform/graphics/ca/TileController.cpp:
1080         (WebCore::TileController::adjustTileCoverageRect):
1081         * rendering/RenderLayer.cpp:
1082         (WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):
1083
1084 2016-11-12  Zalan Bujtas  <zalan@apple.com>
1085
1086         RenderObject::flowThreadState should follow containing block instead of parent.
1087         https://bugs.webkit.org/show_bug.cgi?id=164629
1088
1089         Reviewed by Simon Fraser.
1090
1091         Currently every descendant of a region/multicolumn container is considered to be part of the
1092         flowthread including out-of-flow renderers. They all have the InsideFlowThread flag set.
1093         However since out-of-flow renderers are not really part of the flowthread layout context,
1094         whenever the layout code actually checks for their flowthread containers, we return nullptr and
1095         try to handle this seemingly defective state gracefully (that is, flag indicates "inside the flow thread" state,
1096         but there's no flow tread container).
1097  
1098         This patch fixes this confused state by setting the RenderObject::flowThreadState flag based on
1099         the containing block's state instead of the parent's.
1100
1101         Not testable, since we seem to manage out-of-flow elements just fine even
1102         when they have the InsideFlowThread flag set. 
1103
1104         * rendering/RenderBlock.cpp:
1105         (WebCore::RenderBlock::styleDidChange):
1106         * rendering/RenderElement.cpp:
1107         (WebCore::RenderElement::setStyle):
1108         (WebCore::RenderElement::adjustFlowThreadStateIncludingDescendants): This is an iterative DFS pre-order traversal so
1109         we set the flow state first on containers.
1110         * rendering/RenderElement.h:
1111         * rendering/RenderObject.cpp:
1112         (WebCore::RenderObject::computedFlowThreadState):
1113         (WebCore::RenderObject::initializeFlowThreadStateOnInsertion):
1114         * rendering/RenderObject.h:
1115
1116 2016-11-12  Ryosuke Niwa  <rniwa@webkit.org>
1117
1118         document.currentScript should be null when running a script inside a shadow tree
1119         https://bugs.webkit.org/show_bug.cgi?id=164693
1120
1121         Reviewed by Yusuke Suzuki.
1122
1123         Fixed the bug that we were returning the old or outer script element in document.currentScript
1124         while executing a script element inside a shadow tree. Return null instead.
1125
1126         New behavior matches the latest HTML5 specification:
1127         https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
1128         where it says for the classic script type, "if the script element's root is not a shadow root, then set
1129         the script element's node document's currentScript attribute to the script element. Otherwise, set it to null."
1130
1131         No new tests. imported/w3c/web-platform-tests/shadow-dom/Document-prototype-currentScript.html covers it.
1132
1133         * dom/CurrentScriptIncrementer.h:
1134         (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer): Push nullptr when the script element
1135         is inside a shadow tree.
1136         (WebCore::CurrentScriptIncrementer::~CurrentScriptIncrementer): Changed to use an early exit.
1137         * dom/Document.cpp:
1138         (WebCore::Document::pushCurrentScript): Removed the assertion since the argument can now be nullptr.
1139
1140 2016-11-12  Darin Adler  <darin@apple.com>
1141
1142         Remove a few assorted uses of ExceptionCode
1143         https://bugs.webkit.org/show_bug.cgi?id=164683
1144
1145         Reviewed by Chris Dumez.
1146
1147         * Modules/applepay/PaymentContact.h: Removed include of ExceptionCode.h.
1148         Also tidied up the constructor and destructor.
1149
1150         * Modules/indexeddb/IDBFactory.h: Removed typedef of ExceptionCode.
1151         * Modules/indexeddb/IDBKeyRange.h: Ditto.
1152
1153         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1154         (WebCore::getObjectParameter): Removed local ExceptionCode variable that
1155         was always 0.
1156         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Ditto.
1157         (WebCore::dataFunctionf): Ditto.
1158         (WebCore::dataFunctioni): Ditto.
1159         (WebCore::dataFunctionMatrix): Ditto.
1160         * dom/ContainerNode.cpp:
1161         (WebCore::ContainerNode::cloneChildNodes): Ditto.
1162
1163         * dom/Document.h: Removed typedef of ExceptionCode.
1164         * dom/TreeWalker.h: Ditto.
1165         * editing/markup.h: Ditto.
1166         * html/ImageData.h: Ditto.
1167         * html/InputType.h: Ditto.
1168         * html/canvas/CanvasRenderingContext2D.h: Ditto.
1169         * html/canvas/WebGLDebugShaders.h: Ditto.
1170
1171         * page/DOMWindow.cpp:
1172         (WebCore::DOMWindow::setTimeout): Fixed typo where this was using
1173         ExceptionCode instead of Exception. The code would return an integer
1174         instead of an exception in this case. I could not produce a test that
1175         exercises this code path; I suspect it is an unreachable error condition.
1176         (WebCore::DOMWindow::setInterval): Ditto.
1177
1178         * replay/MemoizedDOMResult.h: Changed typedef of ExceptionCode into
1179         a using statement. Not sure what the longer term fix is.
1180
1181         * xml/parser/XMLDocumentParserLibxml2.cpp:
1182         (WebCore::PendingCallbacks::appendStartElementNSCallback): Renamed to use
1183         WebKit-style "numXXX" rather than "nb_xxx".
1184         (WebCore::PendingCallbacks::PendingStartElementNSCallback::~PendingStartElementNSCallback):
1185         Ditto.
1186         (WebCore::handleNamespaceAttributes): Ditto. Replaced ExceptionCode out
1187         argument with a boolean return value.
1188         (WebCore::handleElementAttributes): Ditto.
1189         (WebCore::XMLDocumentParser::startElementNs): Ditto. Updated for changes
1190         to the handle functions above.
1191         (WebCore::startElementNsHandler): More of the same.
1192         (WebCore::attributesStartElementNsHandler): Ditto.
1193
1194 2016-11-11  Darin Adler  <darin@apple.com>
1195
1196         Remove LegacyException support from bindings script
1197         https://bugs.webkit.org/show_bug.cgi?id=164516
1198
1199         Reviewed by Youenn Fablet.
1200
1201         Besides removing LegacyException support from the bindings script, this patch
1202         also removes most uses of ExceptionCodePlaceholder.h. Also, some call sites of
1203         createElement were using ASSERT_NO_EXCEPTION on an argument that was not even an
1204         ExceptionCode&, so to fix that, this changes most call sites to use specific create
1205         functions for specific element classes, rather than using Document::createElement.
1206
1207         * Modules/mediasource/SourceBuffer.cpp: Removed include of
1208         ExceptionCodePlaceholder.h.
1209         * Modules/mediastream/MediaStreamTrack.cpp: Ditto.
1210         * Modules/websockets/WebSocketChannel.cpp: Ditto.
1211         * bindings/js/JSBlobCustom.cpp: Ditto.
1212
1213         * bindings/scripts/CodeGeneratorJS.pm:
1214         (GenerateImplementation): Removed support for GetterMayThrowLegacyException,
1215         SetterMayThrowLegacyException, and MayThrowLegacyException.
1216         (GenerateParametersCheck): Ditto.
1217         (GenerateImplementationFunctionCall): Ditto.
1218         (GenerateConstructorDefinition): Ditto.
1219
1220         * bindings/scripts/IDLAttributes.txt: Removed ConstructorMayThrowLegacyException,
1221         GetterMayThrowLegacyException, MayThrowLegacyException, and SetterMayThrowLegacyException.
1222
1223         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1224         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1225         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1226         * bindings/scripts/test/JS/JSTestInterface.cpp:
1227         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1228         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1229         * bindings/scripts/test/JS/JSTestObj.cpp:
1230         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1231         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1232         Updated exepected results.
1233
1234         * bindings/scripts/test/TestImplements.idl: Use non-legacy exceptions.
1235         * bindings/scripts/test/TestInterface.idl: Ditto.
1236         * bindings/scripts/test/TestNamedConstructor.idl: Ditto.
1237         * bindings/scripts/test/TestObj.idl: Ditto.
1238         * bindings/scripts/test/TestSupplemental.idl: Ditto.
1239         * bindings/scripts/test/TestTypedefs.idl: Ditto.
1240
1241         * dom/ContainerNode.h: Removed include of ExceptionCodePlaceholder.h.
1242         * editing/AlternativeTextController.cpp: Ditto.
1243         * editing/AppendNodeCommand.cpp: Ditto.
1244
1245         * editing/CompositeEditCommand.cpp:
1246         (WebCore::CompositeEditCommand::moveParagraphs): Use specific create function
1247         instead of Document::createElement.
1248
1249         * editing/DeleteFromTextNodeCommand.cpp: Removed include of
1250         ExceptionCodePlaceholder.h.
1251         * editing/Editor.cpp: Ditto.
1252         * editing/EditorCommand.cpp: Ditto.
1253         * editing/FormatBlockCommand.cpp: Ditto.
1254
1255         * editing/IndentOutdentCommand.cpp:
1256         (WebCore::IndentOutdentCommand::tryIndentingAsListItem): Use specific create
1257         function instead of Document::createElement.
1258
1259         * editing/InsertListCommand.cpp: Removed include of ExceptionCodePlaceholder.h.
1260         * editing/InsertNodeBeforeCommand.cpp: Ditto.
1261         * editing/RemoveNodeCommand.cpp: Ditto.
1262         * editing/ReplaceSelectionCommand.cpp: Ditto.
1263         * editing/TextIterator.cpp: Ditto.
1264         * editing/WrapContentsInDummySpanCommand.cpp: Ditto.
1265
1266         * editing/cocoa/EditorCocoa.mm:
1267         (WebCore::Editor::styleForSelectionStart): Use specific create function instead
1268         of Document::createElement.
1269         * editing/htmlediting.cpp:
1270         (WebCore::createTabSpanElement): Ditto.
1271         * editing/ios/EditorIOS.mm:
1272         (WebCore::Editor::WebContentReader::readURL): Ditto.
1273         * editing/mac/EditorMac.mm:
1274         (WebCore::Editor::WebContentReader::readURL): Ditto.
1275
1276         * editing/markup.cpp: Removed include of ExceptionCodePlaceholder.h.
1277
1278         * html/FTPDirectoryDocument.cpp:
1279         (WebCore::FTPDirectoryDocumentParser::appendEntry): Use specific create function
1280         instead of Document::createElement.
1281         (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
1282         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
1283         (WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
1284
1285         * html/HTMLEmbedElement.cpp:
1286         (WebCore::HTMLEmbedElement::create): Added overload that just takes a Document.
1287         * html/HTMLEmbedElement.h: Updated for above.
1288
1289         * html/HTMLMediaElement.cpp: Removed include of ExceptionCodePlaceholder.h.
1290
1291         * html/HTMLMetaElement.cpp:
1292         (WebCore::HTMLMetaElement::create): Added overload that just takes a Document.
1293         * html/HTMLMetaElement.h: Updated for above.
1294
1295         * html/HTMLOutputElement.cpp: Removed include of ExceptionCodePlaceholder.h.
1296
1297         * html/HTMLSelectElement.cpp: Ditto.
1298         (WebCore::HTMLSelectElement::setLength): Use specific create function
1299         instead of Document::createElement.
1300
1301         * html/HTMLSourceElement.cpp:
1302         (WebCore::HTMLSourceElement::create): Added overload that just takes a Document.
1303         * html/HTMLSourceElement.h: Updated for above.
1304
1305         * html/HTMLStyleElement.cpp:
1306         (WebCore::HTMLStyleElement::HTMLStyleElement): Moved data member initialization
1307         to class definition.
1308         (WebCore::HTMLStyleElement::create): Added overload that just takes a Document.
1309         * html/HTMLStyleElement.h: Updated for above. Also made finishParsingChildren public.
1310
1311         * html/HTMLTableElement.cpp: Removed include of ExceptionCodePlaceholder.h.
1312         * html/HTMLTextAreaElement.cpp: Ditto.
1313
1314         * html/HTMLVideoElement.cpp:
1315         (WebCore::HTMLVideoElement::create): Added overload that just takes a Document.
1316         * html/HTMLVideoElement.h: Updated for above.
1317
1318         * html/ImageDocument.cpp:
1319         (WebCore::ImageDocument::createDocumentStructure): Use specific create function
1320         instead of Document::createElement.
1321
1322         * html/InputType.cpp: Removed include of ExceptionCodePlaceholder.h.
1323
1324         * html/MediaDocument.cpp:
1325         (WebCore::MediaDocumentParser::createDocumentStructure): Use specific create
1326         function instead of Document::createElement.
1327         (WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
1328         * html/PluginDocument.cpp:
1329         (WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
1330
1331         * html/RangeInputType.cpp: Removed include of ExceptionCodePlaceholder.h.
1332
1333         * html/RubyElement.cpp:
1334         (WebCore::RubyElement::create): Added overload that just takes a Document.
1335         * html/RubyElement.h: Updated for above.
1336
1337         * html/RubyTextElement.cpp:
1338         (WebCore::RubyTextElement::create): Added overload that just takes a Document.
1339         * html/RubyTextElement.h: Updated for above.
1340
1341         * html/ValidationMessage.cpp: Removed include of ExceptionCodePlaceholder.h.
1342         * html/canvas/CanvasRenderingContext2D.cpp: Ditto.
1343         * html/shadow/MediaControlElementTypes.cpp: Ditto.
1344
1345         * html/shadow/MediaControlElements.cpp:
1346         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
1347         Use specific create function instead of Document::createElement.
1348
1349         * html/shadow/MediaControls.cpp: Removed include of ExceptionCodePlaceholder.h.
1350         * html/shadow/MediaControlsApple.cpp: Ditto.
1351         * html/track/InbandDataTextTrack.cpp: Ditto.
1352         * html/track/InbandGenericTextTrack.cpp: Ditto.
1353         * html/track/InbandTextTrack.cpp: Ditto.
1354         * html/track/VTTRegion.cpp: Ditto.
1355
1356         * html/track/WebVTTElement.cpp:
1357         (WebCore::WebVTTElement::createEquivalentHTMLElement): Use specific create
1358         function instead of Document::createElement.
1359         * inspector/InspectorCSSAgent.cpp:
1360         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
1361
1362         * page/ContextMenuController.cpp: Removed include of ExceptionCodePlaceholder.h.
1363         * page/DOMWindow.cpp: Ditto.
1364         * page/DragController.cpp: Ditto.
1365         * page/EventHandler.cpp: Ditto.
1366         * page/Page.cpp: Ditto.
1367         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
1368         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm: Ditto.
1369         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Ditto.
1370         * platform/mac/PasteboardMac.mm: Ditto.
1371         * platform/mac/WebVideoFullscreenHUDWindowController.mm: Ditto.
1372         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: Ditto.
1373         * platform/mock/mediasource/MockMediaSourcePrivate.cpp: Ditto.
1374         * rendering/RenderNamedFlowThread.cpp: Ditto.
1375         * rendering/RenderThemeEfl.cpp: Ditto.
1376         * rendering/RenderThemeMac.mm: Ditto.
1377         * rendering/style/SVGRenderStyle.h: Ditto.
1378         * svg/SVGTRefElement.cpp: Ditto.
1379
1380         * xml/XMLErrors.cpp:
1381         (WebCore::XMLErrors::XMLErrors): Take a reference and initialize data member
1382         in class definition.
1383         (WebCore::createXHTMLParserErrorHeader): Take a reference, and mostly use
1384         specific create functions instead of createElement.
1385         (WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
1386         * xml/XMLErrors.h: Updated for above.
1387
1388         * xml/XMLTreeViewer.cpp: Removed include of ExceptionCodePlaceholder.h.
1389
1390         * xml/parser/XMLDocumentParser.cpp:
1391         (WebCore::XMLDocumentParser::handleError): Pass a reference.
1392
1393         * xml/parser/XMLDocumentParserLibxml2.cpp: Removed include of
1394         ExceptionCodePlaceholder.h.
1395
1396 2016-11-12  Dan Bernstein  <mitz@apple.com>
1397
1398         Clean up a couple of macOS *SPI headers
1399         https://bugs.webkit.org/show_bug.cgi?id=164687
1400
1401         Reviewed by Sam Weinig.
1402
1403         * platform/spi/cocoa/NSTouchBarSPI.h: Replaced hardcoded strings with global declarations.
1404         * platform/spi/mac/NSSpellCheckerSPI.h: Addressed FIXME by importing private header, and removed declarations
1405           that already appear in the SDK.
1406
1407 2016-11-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1408
1409         The main content heuristic should be robust when handling large media elements
1410         https://bugs.webkit.org/show_bug.cgi?id=164676
1411         <rdar://problem/29211503>
1412
1413         Reviewed by Eric Carlson.
1414
1415         Handles integer overflow gracefully when performing the main content check for very large media elements. If the
1416         heuristic comes across such an element, it will now bail early and reject the video as main content. Also adds a
1417         new API test: VideoControlsManager.VideoControlsManagerPageWithEnormousVideo.
1418
1419         * html/MediaElementSession.cpp:
1420         (WebCore::isElementRectMostlyInMainFrame):
1421
1422 2016-11-12  Chris Dumez  <cdumez@apple.com>
1423
1424         Speed up setting attributes of input elements of type 'text'
1425         https://bugs.webkit.org/show_bug.cgi?id=164674
1426
1427         Reviewed by Ryosuke Niwa.
1428
1429         Speed up setting attributes of input elements of type 'text' by calling
1430         updateInnerTextValue() only when needed. It was previously called
1431         whenever an attribute was set, no matter it could impact its text value
1432         or not.
1433
1434         No new tests, no Web-exposed behavior change.
1435
1436         * html/HTMLInputElement.cpp:
1437         (WebCore::HTMLInputElement::parseAttribute):
1438         * html/InputType.cpp:
1439         (WebCore::InputType::attributeChanged):
1440         * html/InputType.h:
1441         * html/TextFieldInputType.cpp:
1442         (WebCore::TextFieldInputType::attributeChanged):
1443         * html/TextFieldInputType.h:
1444
1445 2016-11-12  Dan Bernstein  <mitz@apple.com>
1446
1447         Tried to fix the 32-bit build.
1448
1449         * platform/mac/WebPlaybackControlsManager.mm:
1450
1451 2016-11-12  Dan Bernstein  <mitz@apple.com>
1452
1453         Tried to fix the 32-bit build.
1454
1455         * platform/mac/WebPlaybackControlsManager.h:
1456
1457 2016-11-12  Dan Bernstein  <mitz@apple.com>
1458
1459         Tried to fix the build.
1460
1461         * platform/mac/WebPlaybackControlsManager.h: Declared conformance to
1462           AVFunctionBarPlaybackControlsControlling, which is expected in WebKit::WebViewImpl.
1463           Added ivar.
1464         * platform/mac/WebPlaybackControlsManager.mm:
1465           Synthesize seekToTime property needed for AVFunctionBarPlaybackControlsControlling
1466           conformance.
1467         (-[WebPlaybackControlsManager isSeeking]): Implement this
1468           AVFunctionBarPlaybackControlsControlling method.
1469         (-[WebPlaybackControlsManager seekToTime:toleranceBefore:toleranceAfter:]): Ditto.
1470
1471 2016-11-12  Dan Bernstein  <mitz@apple.com>
1472
1473         Tried to fix the build.
1474
1475         * platform/spi/cocoa/NSTouchBarSPI.h: Removed duplicate @interface declarations.
1476
1477 2016-11-12  Frederic Wang  <fwang@igalia.com>
1478
1479         Ensure MathML render tree are clean by the end of FrameView::layout().
1480         https://bugs.webkit.org/show_bug.cgi?id=162824
1481
1482         Reviewed by Darin Adler.
1483
1484         clearNeedsLayout is not called during the layout of invalid MathML markup. We introduce a new
1485         helper function to perform proper layout of such markup and we now call it from the various
1486         MathML layoutBlock functions. Additionally, we ensure that the preferred width is dirty after
1487         computation in RenderMathMLScripts::computePreferredLogicalWidths.
1488
1489         Test: mathml/invalid-markup.html
1490
1491         * rendering/mathml/RenderMathMLBlock.cpp:
1492         (WebCore::RenderMathMLBlock::layoutInvalidMarkup): Helper function to layout invalid markup.
1493         * rendering/mathml/RenderMathMLBlock.h: Declare layoutInvalidMarkup.
1494         * rendering/mathml/RenderMathMLFraction.cpp:
1495         (WebCore::RenderMathMLFraction::layoutBlock): Call layoutInvalidMarkup.
1496         * rendering/mathml/RenderMathMLRoot.cpp:
1497         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
1498         * rendering/mathml/RenderMathMLScripts.cpp:
1499         (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Set the preferred width dirty
1500         after computation to avoid that it is computed again and again.
1501         (WebCore::RenderMathMLScripts::layoutBlock): Call layoutInvalidMarkup.
1502         * rendering/mathml/RenderMathMLUnderOver.cpp:
1503         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
1504
1505 2016-11-12  Frederic Wang  <fwang@igalia.com>
1506
1507         Remove RenderMathMLOperator::shouldAllowStretching
1508         https://bugs.webkit.org/show_bug.cgi?id=164313
1509
1510         Reviewed by Darin Adler.
1511
1512         RenderMathMLOperator::shouldAllowStretching is an old function from early implementations of
1513         MathML. Its name is now confusing since it also includes non-stretchy large operators.
1514         Moreover, it is not really useful and is actually only used by two functions: useMathOperator
1515         and updateMathOperator. The former is almost equivalent and is used as a replacement of
1516         shouldAllowStretching everywhere else. We rewrite the two remaining calls with the finer
1517         test functions isStretchy() and isLargeOperatorInDisplayStyle().
1518
1519         No new tests, behavior unchanged.
1520
1521         * rendering/mathml/RenderMathMLOperator.cpp:
1522         (WebCore::RenderMathMLOperator::updateMathOperator): Reorder the conditionals to avoid the
1523         use of RenderMathMLOperator::shouldAllowStretching and match useMathOperator.
1524         (WebCore::RenderMathMLOperator::useMathOperator): Rewrite shouldAllowStretching() using
1525         isStretchy() and isLargeOperatorInDisplayStyle().
1526         (WebCore::RenderMathMLOperator::shouldAllowStretching): Deleted.
1527         * rendering/mathml/RenderMathMLOperator.h: Remove declaration of shouldAllowStretching.
1528
1529 2016-11-12  Joseph Pecoraro  <pecoraro@apple.com>
1530
1531         Use #pragma once in WebCore
1532         https://bugs.webkit.org/show_bug.cgi?id=164373
1533
1534         Reviewed by Darin Adler.
1535
1536         * Modules/*.h:
1537         * crypto/*.h:
1538         * cssjit/*.h:
1539         * editing/*.h:
1540         * fileapi/*.h:
1541         * history/*.h:
1542         * loader/*.h:
1543         * mathml/*.h:
1544         * page/*.h:
1545         * replay/*.h:
1546         * storage/*.h:
1547         * xml/*.h:
1548
1549         * editing/FrameSelection.cpp:
1550         * loader/ResourceLoadStatisticsStore.cpp:
1551         Remove unused LOG and DEBUG defines.
1552
1553 2016-11-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1554
1555         Follow-up: fix the OpenSource build on Mac after r208642
1556         https://bugs.webkit.org/show_bug.cgi?id=164677
1557
1558         Reviewed by Ryosuke Niwa.
1559
1560         The playbackControlsController property should also be `assign`.
1561
1562         * platform/spi/cocoa/AVKitSPI.h:
1563
1564 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1565
1566         SPI imports in AVKitSPI.h should be guarded by USE(APPLE_INTERNAL_SDK)
1567         https://bugs.webkit.org/show_bug.cgi?id=164672
1568
1569         Reviewed by Dan Bernstein.
1570
1571         Fixes the OpenSource build when ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER) is on.
1572
1573         * platform/spi/cocoa/AVKitSPI.h: Add USE(APPLE_INTERNAL_SDK) guards around AVKit function bar SPI headers.
1574         Additionally, define AVFunctionBarPlaybackControlsProvider in the case where AVKit SPI is unavailable.
1575
1576 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
1577
1578         event.composedPath() does not include window
1579         https://bugs.webkit.org/show_bug.cgi?id=164609
1580         <rdar://problem/29210383>
1581
1582         Reviewed by Antti Koivisto.
1583
1584         Fixed the bug by including WindowContext be a part of the regular EventPath. This also simplifies
1585         dispatchEventInDOM which used to had a special logic for dispatching an event on the window.
1586
1587         Also fixed a bug in EventDispatcher::dispatchEvent that event.target would be nullptr when an event was
1588         dispatched inside a disconnected shadow tree or prevented from propagating to the document tree.
1589         Preserve the final target by simply saving event.target() prior to invoking the default event handler instead.
1590
1591         Test: fast/shadow-dom/event-path-with-window.html
1592
1593         * dom/EventDispatcher.cpp:
1594         (WebCore::WindowEventContext): Deleted. Moved to EventPath.cpp.
1595         (WebCore::dispatchEventInDOM): Removed the code for WindowContext. The generic event dispatching logic
1596         will do the same work now.
1597         (WebCore::EventDispatcher::dispatchEvent): Restore the original target instead of using that of WindowContext.
1598         * dom/EventPath.cpp:
1599         (WebCore::WindowEventContext): Moved from EventDispatcher.cpp. Also made it a subclass of EventContext.
1600         (WebCore::WindowEventContext::handleLocalEvents): Added.
1601         (WebCore::EventPath::EventPath): When the parent's nullptr, check if the current node is Document. If it is,
1602         follow https://dom.spec.whatwg.org/#interface-document where it says:
1603         "A document’s get the parent algorithm, given an event, returns null if event’s type attribute value is 'load'
1604          or document does not have a browsing context, and the document’s associated Window object otherwise."
1605         (WebCore::EventPath::setRelatedTarget): Skip over WindowContext.
1606         (WebCore::EventPath::retargetTouch): Ditto.
1607         (WebCore::EventPath::computePathUnclosedToTarget): When the target is DOMWindow, use its document as the target.
1608         Also, include any event target that is not a node in the event path.
1609
1610 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1611
1612         [CSS Parser] Support all the correct blend modes
1613         https://bugs.webkit.org/show_bug.cgi?id=164669
1614
1615         Reviewed by Dean Jackson.
1616
1617         * css/parser/CSSParserFastPaths.cpp:
1618         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1619
1620 2016-11-11  Alex Christensen  <achristensen@webkit.org>
1621
1622         Use SecurityOriginData as keys in StorageManager
1623         https://bugs.webkit.org/show_bug.cgi?id=159834
1624         <rdar://problem/27346948>
1625
1626         Reviewed by Brady Eidson.
1627
1628         No change in behavior.
1629
1630         * page/SecurityOriginData.h:
1631         (WebCore::SecurityOriginData::SecurityOriginData):
1632         (WebCore::SecurityOriginData::isEmpty):
1633         (WebCore::SecurityOriginData::isHashTableDeletedValue):
1634         (WebCore::SecurityOriginDataHashTraits::isEmptyValue):
1635         (WebCore::SecurityOriginDataHash::hash):
1636         (WebCore::SecurityOriginDataHash::equal):
1637         Add some hash functions so a SecurityOriginData can be used as a key in a HashMap.
1638
1639 2016-11-11  Ryosuke Niwa  <rniwa@webkit.org>
1640
1641         Hovering over a slotted Text node clears hover state
1642         https://bugs.webkit.org/show_bug.cgi?id=164002
1643         <rdar://problem/29040471>
1644
1645         Reviewed by Simon Fraser.
1646
1647         The bug was caused by HitTestResult::innerElement returning the parent element of a Text node without
1648         taking the shadow root or slots into account. For hit testing, we always want to use the "flat tree"
1649         or "composed tree" (imprecisely but close enough in this case).
1650
1651         Fixed the bug by making HitTestResult::innerElement use parentNodeInComposedTree. Also renamed it to
1652         HitTestResult::targetElement to be consistent with HitTestResult::targetNode.
1653
1654         Tests: fast/shadow-dom/activate-over-slotted-content.html
1655                fast/shadow-dom/hover-over-slotted-content.html
1656
1657         * dom/Document.cpp:
1658         (WebCore::Document::prepareMouseEvent):
1659         * html/MediaElementSession.cpp:
1660         (WebCore::isMainContentForPurposesOfAutoplay):
1661         * page/EventHandler.cpp:
1662         (WebCore::EventHandler::eventMayStartDrag):
1663         (WebCore::EventHandler::hitTestResultAtPoint):
1664         (WebCore::EventHandler::handleWheelEvent):
1665         (WebCore::EventHandler::sendContextMenuEventForKey):
1666         (WebCore::EventHandler::hoverTimerFired):
1667         (WebCore::EventHandler::handleDrag):
1668         (WebCore::EventHandler::handleTouchEvent):
1669         * rendering/HitTestResult.cpp:
1670         (WebCore::HitTestResult::targetElement): Renamed from innerElement.
1671         Now finds the parent element in the composed tree.
1672         * rendering/HitTestResult.h:
1673         (WebCore::HitTestResult::innerNode):
1674
1675 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
1676
1677         Unreviewed build fix after r208628
1678
1679         * bindings/js/SerializedScriptValue.cpp:
1680         (WebCore::CloneDeserializer::readTerminal): Cast pointer arithmetic to
1681         uint32_t to avoid warning.
1682
1683 2016-11-11  Brent Fulgham  <bfulgham@apple.com>
1684
1685         Neutered ArrayBuffers are not properly serialized
1686         https://bugs.webkit.org/show_bug.cgi?id=164647
1687         <rdar://problem/29213490>
1688
1689         Reviewed by David Kilzer.
1690
1691         Correct binding logic to handle ImageBuffers being deserialized from neutered ArrayBuffers.
1692
1693         Test: fast/canvas/neutered-imagedata.html
1694
1695         * bindings/js/SerializedScriptValue.cpp:
1696         (WebCore::CloneDeserializer::readTerminal):
1697
1698 2016-11-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1699
1700         [WK2] autocorrect and autocapitalize attributes do not work in contenteditable elements
1701         https://bugs.webkit.org/show_bug.cgi?id=164538
1702         <rdar://problem/8418711>
1703
1704         Reviewed by Ryosuke Niwa.
1705
1706         Adds autocorrect and autocapitalize getters and setters to HTMLElements. These check the `autocorrect` and
1707         `autocapitalize` attributes and return whether or not the element supports autocorrect, and the
1708         autocapitalization type, respectively. By default, autocorrection is enabled and autocapitalization is enabled
1709         on the sentence level for elements. Also refactors/renames WebAutocapitalizeType so that in WebCore, we deal
1710         solely with AutocapitalizeTypes and WebKit1 converts from AutocapitalizeType to WebAutocapitalizeType as needed
1711         for UIKit.
1712
1713         Tests: fast/events/ios/contenteditable-autocapitalize.html
1714                fast/events/ios/contenteditable-autocorrect.html
1715
1716         * WebCore.xcodeproj/project.pbxproj:
1717         * html/Autocapitalize.cpp:
1718         (WebCore::autocapitalizeTypeForAttributeValue):
1719         (WebCore::stringForAutocapitalizeType):
1720         * html/Autocapitalize.h:
1721         * html/AutocapitalizeTypes.h: Renamed from Source/WebCore/html/WebAutocapitalize.h.
1722
1723         Move WebAutocapitalizeType into AutocapitalizeTypes.h as simply AutocapitalizeType.
1724
1725         * html/HTMLElement.cpp:
1726         (WebCore::HTMLElement::autocapitalize):
1727         (WebCore::HTMLElement::autocapitalizeType):
1728         (WebCore::HTMLElement::setAutocapitalize):
1729         (WebCore::HTMLElement::shouldAutocorrect):
1730         (WebCore::HTMLElement::setAutocorrect):
1731         * html/HTMLElement.h:
1732         (WebCore::HTMLElement::autocorrect):
1733         * html/HTMLElement.idl:
1734         * html/HTMLFormControlElement.cpp:
1735         (WebCore::HTMLFormControlElement::shouldAutocorrect):
1736         (WebCore::HTMLFormControlElement::autocapitalizeType):
1737         (WebCore::HTMLFormControlElement::autocorrect): Deleted.
1738         (WebCore::HTMLFormControlElement::setAutocorrect): Deleted.
1739         (WebCore::HTMLFormControlElement::autocapitalize): Deleted.
1740         (WebCore::HTMLFormControlElement::setAutocapitalize): Deleted.
1741
1742         Fold autocorrect/autocapitalize member functions into HTMLElement and remove element-specific code in
1743         HTML(FormControl|Form)Element.cpp.
1744
1745         * html/HTMLFormControlElement.h:
1746         * html/HTMLFormElement.cpp:
1747         (WebCore::HTMLFormElement::shouldAutocorrect):
1748         (WebCore::HTMLFormElement::autocorrect): Deleted.
1749         (WebCore::HTMLFormElement::setAutocorrect): Deleted.
1750         (WebCore::HTMLFormElement::autocapitalizeType): Deleted.
1751         (WebCore::HTMLFormElement::autocapitalize): Deleted.
1752         (WebCore::HTMLFormElement::setAutocapitalize): Deleted.
1753         * html/HTMLFormElement.h:
1754         * html/HTMLFormElement.idl:
1755         * html/HTMLInputElement.idl:
1756         * html/HTMLTextAreaElement.idl:
1757
1758 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1759
1760         [CSS Parser] Add support for paths as basic shapes.
1761         https://bugs.webkit.org/show_bug.cgi?id=164661
1762
1763         Reviewed by Dean Jackson.
1764
1765         * css/parser/CSSPropertyParser.cpp:
1766         (WebCore::consumeBasicShapePath):
1767         (WebCore::consumeBasicShape):
1768
1769 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1770
1771         [CSS Parser] Support margin-box in shape parsing.
1772         https://bugs.webkit.org/show_bug.cgi?id=164658
1773
1774         Reviewed by Sam Weinig.
1775
1776         * css/parser/CSSPropertyParser.cpp:
1777         (WebCore::consumeBasicShapeOrBox):
1778
1779 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1780
1781         [CSS Parser] Add support for -webkit-mask-source-type
1782         https://bugs.webkit.org/show_bug.cgi?id=164657
1783
1784         Reviewed by Dean Jackson.
1785
1786         * css/parser/CSSPropertyParser.cpp:
1787         (WebCore::consumeWebkitMaskSourceType):
1788         (WebCore::consumeBackgroundComponent):
1789         (WebCore::CSSPropertyParser::parseSingleValue):
1790
1791 2016-11-11  Antti Koivisto  <antti@apple.com>
1792
1793         Updating class name doesn't update the slotted content's style
1794         https://bugs.webkit.org/show_bug.cgi?id=164577
1795         <rdar://problem/29205873>
1796
1797         Reviewed by Ryosuke Niwa.
1798
1799         Test: fast/shadow-dom/css-scoping-slotted-invalidation.html
1800
1801         Teach style invalidation code for attribute/class/id mutations about slotted rules.
1802
1803         * dom/ShadowRoot.cpp:
1804         (WebCore::assignedShadowRootsIfSlotted):
1805
1806             Helper to find all assigned shadow roots (there may be more than one if slots are assigned to slots).
1807
1808         * dom/ShadowRoot.h:
1809         * style/AttributeChangeInvalidation.cpp:
1810         (WebCore::Style::mayBeAffectedByAttributeChange):
1811         (WebCore::Style::mayBeAffectedByHostRules):
1812         (WebCore::Style::mayBeAffectedBySlottedRules):
1813         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
1814         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
1815         * style/ClassChangeInvalidation.cpp:
1816         (WebCore::Style::mayBeAffectedByHostRules):
1817         (WebCore::Style::mayBeAffectedBySlottedRules):
1818         (WebCore::Style::ClassChangeInvalidation::invalidateStyle):
1819         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
1820         * style/ClassChangeInvalidation.h:
1821         * style/IdChangeInvalidation.cpp:
1822         (WebCore::Style::mayBeAffectedByHostRules):
1823         (WebCore::Style::mayBeAffectedBySlottedRules):
1824         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
1825         (WebCore::Style::mayBeAffectedByHostStyle): Deleted.
1826         * style/StyleSharingResolver.cpp:
1827         (WebCore::Style::SharingResolver::canShareStyleWithElement):
1828
1829             Fix a bug in style sharing where we were checking wrong element for host rules.
1830             Tested by the included test too (the last empty div).
1831
1832 2016-11-11  Dave Hyatt  <hyatt@apple.com>
1833
1834         [CSS Parser] Support the spring animation timing function
1835         https://bugs.webkit.org/show_bug.cgi?id=164654
1836
1837         Reviewed by Dean Jackson.
1838
1839         * css/CSSValueKeywords.in:
1840         * css/parser/CSSPropertyParser.cpp:
1841         (WebCore::consumeSpringFunction):
1842         (WebCore::consumeAnimationTimingFunction):
1843         (WebCore::consumeAnimationValue):
1844
1845 2016-11-11  Chris Dumez  <cdumez@apple.com>
1846
1847         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
1848         https://bugs.webkit.org/show_bug.cgi?id=164644
1849
1850         Reviewed by Brady Eidson.
1851
1852         WorkerGlobalScope's indexedDB property should be on the prototype, not the instance
1853         as per:
1854         - https://heycam.github.io/webidl/#es-attributes
1855
1856         This is because WorkerGlobalScope is not marked as [Global] or [PrimaryGlobal] in
1857         the IDL:
1858         - https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
1859
1860         DedicatedWorkerGlobalScope is the one that is marked as [Global] and that should
1861         have its attributes on the instance:
1862         - https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
1863
1864         We were getting this mostly right, except for runtime-enabled attributes / operations
1865         which would end up on the instance instead of the prototype. This patch adds support
1866         for [PrimaryGlobal] / [Global] IDL extended attributes which determine the location
1867         of properties. It also improves support for runtime-enabled properties so that they
1868         can now be on either the instance or the prototype, exactly as if they were not
1869         runtimed-enabled.
1870
1871         This gives us 100% pass rate on:
1872         - http://w3c-test.org/IndexedDB/interfaces.worker.html
1873
1874         No new tests, updated existing test.
1875
1876         * bindings/scripts/CodeGeneratorJS.pm:
1877         (IsGlobalOrPrimaryGlobalInterface):
1878         (InterfaceRequiresAttributesOnInstance):
1879         (AttributeShouldBeOnInstance):
1880         (OperationShouldBeOnInstance):
1881         (GenerateHeader):
1882         (GeneratePropertiesHashTable):
1883         (GenerateImplementation):
1884         * bindings/scripts/IDLAttributes.txt:
1885         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1886         (WebCore::JSInterfaceName::finishCreation):
1887         * bindings/scripts/test/JS/JSInterfaceName.h:
1888         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1889         (WebCore::JSTestActiveDOMObject::finishCreation):
1890         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1891         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1892         (WebCore::JSTestCEReactions::finishCreation):
1893         * bindings/scripts/test/JS/JSTestCEReactions.h:
1894         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1895         (WebCore::JSTestCEReactionsStringifier::finishCreation):
1896         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
1897         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1898         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
1899         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
1900         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1901         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
1902         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
1903         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
1904         (WebCore::JSTestCustomNamedGetter::finishCreation):
1905         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1906         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1907         (WebCore::JSTestDOMJIT::finishCreation):
1908         * bindings/scripts/test/JS/JSTestDOMJIT.h:
1909         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1910         (WebCore::JSTestEventConstructor::finishCreation):
1911         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1912         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1913         (WebCore::JSTestEventTarget::finishCreation):
1914         * bindings/scripts/test/JS/JSTestEventTarget.h:
1915         * bindings/scripts/test/JS/JSTestException.cpp:
1916         (WebCore::JSTestException::finishCreation):
1917         * bindings/scripts/test/JS/JSTestException.h:
1918         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1919         (WebCore::JSTestGenerateIsReachable::finishCreation):
1920         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
1921         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1922         (WebCore::JSTestGlobalObject::finishCreation):
1923         * bindings/scripts/test/JS/JSTestGlobalObject.h:
1924         * bindings/scripts/test/JS/JSTestInterface.cpp:
1925         (WebCore::JSTestInterface::finishCreation):
1926         * bindings/scripts/test/JS/JSTestInterface.h:
1927         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1928         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
1929         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
1930         * bindings/scripts/test/JS/JSTestIterable.cpp:
1931         (WebCore::JSTestIterable::finishCreation):
1932         * bindings/scripts/test/JS/JSTestIterable.h:
1933         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1934         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
1935         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
1936         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1937         (WebCore::JSTestMediaQueryListListener::finishCreation):
1938         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
1939         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1940         (WebCore::JSTestNamedConstructor::finishCreation):
1941         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
1942         * bindings/scripts/test/JS/JSTestNode.cpp:
1943         (WebCore::JSTestNode::finishCreation):
1944         * bindings/scripts/test/JS/JSTestNode.h:
1945         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1946         (WebCore::JSTestNondeterministic::finishCreation):
1947         * bindings/scripts/test/JS/JSTestNondeterministic.h:
1948         * bindings/scripts/test/JS/JSTestObj.cpp:
1949         (WebCore::JSTestObj::finishCreation):
1950         * bindings/scripts/test/JS/JSTestObj.h:
1951         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1952         (WebCore::JSTestOverloadedConstructors::finishCreation):
1953         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
1954         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1955         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
1956         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
1957         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1958         (WebCore::JSTestOverrideBuiltins::finishCreation):
1959         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1960         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1961         (WebCore::JSTestSerialization::finishCreation):
1962         * bindings/scripts/test/JS/JSTestSerialization.h:
1963         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1964         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
1965         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1966         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1967         (WebCore::JSTestTypedefs::finishCreation):
1968         * bindings/scripts/test/JS/JSTestTypedefs.h:
1969         * bindings/scripts/test/TestGlobalObject.idl:
1970         * page/DOMWindow.idl:
1971         * workers/DedicatedWorkerGlobalScope.idl:
1972
1973 2016-11-11  Antti Koivisto  <antti@apple.com>
1974
1975         Shadow DOM: Toggling class in `.class ::slotted(*)` does not trigger style recalc
1976         https://bugs.webkit.org/show_bug.cgi?id=160864
1977
1978         Reviewed by Ryosuke Niwa.
1979
1980         Also fix similar issue with ::host
1981
1982         Test: fast/shadow-dom/css-scoping-host-and-slotted-context-invalidation.html
1983
1984         * css/StyleInvalidationAnalysis.cpp:
1985         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):
1986
1987             If we have ::slotted rules and encounter a <slot>, invalidate the slotted host children.
1988
1989         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
1990
1991             Invalidate the shadow host if we have ::host rules.
1992
1993         * css/StyleInvalidationAnalysis.h:
1994         * dom/InlineStyleSheetOwner.cpp:
1995         (WebCore::InlineStyleSheetOwner::createSheet):
1996
1997             Fix a bug where it was possible to mutate stylesheets in the inline stylesheet cache.
1998             The included test covers this.
1999
2000         * style/StyleScope.cpp:
2001         (WebCore::Style::Scope::updateActiveStyleSheets):
2002
2003             Handle the full invalidation case.
2004
2005 2016-11-11  Brady Eidson  <beidson@apple.com>
2006
2007         IndexedDB 2.0: "close pending flag" and firing blocked events all need fixing.
2008         https://bugs.webkit.org/show_bug.cgi?id=164641
2009
2010         Reviewed by Alex Christensen.
2011
2012         No new tests (Covered by at least 3 existing tests).
2013
2014         * Modules/indexeddb/IDBDatabase.cpp:
2015         (WebCore::IDBDatabase::close):
2016         (WebCore::IDBDatabase::maybeCloseInServer):
2017
2018         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2019         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionPendingClose):
2020         * Modules/indexeddb/client/IDBConnectionProxy.h:
2021
2022         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2023         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
2024         * Modules/indexeddb/client/IDBConnectionToServer.h:
2025         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2026
2027         * Modules/indexeddb/server/IDBServer.cpp:
2028         (WebCore::IDBServer::IDBServer::databaseConnectionPendingClose):
2029         * Modules/indexeddb/server/IDBServer.h:
2030
2031         * Modules/indexeddb/server/ServerOpenDBRequest.cpp:
2032         (WebCore::IDBServer::ServerOpenDBRequest::maybeNotifyRequestBlocked):
2033         (WebCore::IDBServer::ServerOpenDBRequest::notifyRequestBlocked): Deleted.
2034         * Modules/indexeddb/server/ServerOpenDBRequest.h:
2035         (WebCore::IDBServer::ServerOpenDBRequest::hasNotifiedBlocked): Deleted.
2036
2037         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2038         (WebCore::IDBServer::UniqueIDBDatabase::allConnectionsAreClosedOrClosing):
2039         (WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange):
2040         (WebCore::IDBServer::UniqueIDBDatabase::notifyCurrentRequestConnectionClosedOrFiredVersionChangeEvent):
2041         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2042
2043         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
2044         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionPendingCloseFromClient):
2045         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
2046         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionIsClosing):
2047         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
2048
2049         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2050         (WebCore::InProcessIDBServer::databaseConnectionPendingClose):
2051         * Modules/indexeddb/shared/InProcessIDBServer.h:
2052
2053 2016-11-11  Dave Hyatt  <hyatt@apple.com>
2054
2055         [CSS Parser] Fix time unit parsing
2056         https://bugs.webkit.org/show_bug.cgi?id=164649
2057
2058         Reviewed by Dean Jackson.
2059         
2060         Make sure that a unitless value gets changed to milliseconds properly.
2061
2062         * css/parser/CSSPropertyParserHelpers.cpp:
2063         (WebCore::CSSPropertyParserHelpers::consumeTime):
2064
2065 2016-11-11  Keith Rollin  <krollin@apple.com>
2066
2067         Reduce number of platformMemoryUsage calls
2068         https://bugs.webkit.org/show_bug.cgi?id=164375
2069
2070         Reviewed by Andreas Kling.
2071
2072         platformMemoryUsage was being called all the time while logging the
2073         results of various memory-purging operations. This logging is
2074         subordinate to the needs of performance and so can be removed.
2075         Behavior is now as follows:
2076
2077         - If memory-pressure relief logging is enabled, logging includes
2078         memory usage information. On Cocoa, this logging is disabled by
2079         default but can be enabled by setting LogMemoryJetsamDetails in
2080         `defaults`.
2081         - Otherwise, if release-logging is enabled (as it is on Cocoa),
2082         abbreviated memory pressure relief logging is performed: the logging
2083         lines are printed but without any memory usage information.
2084         - Otherwise, no logging is performed.
2085
2086         No new tests -- no tests for logging.
2087
2088         * platform/MemoryPressureHandler.cpp:
2089         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
2090         * platform/MemoryPressureHandler.h:
2091         (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger):
2092         (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger):
2093
2094 2016-11-11  Eric Carlson  <eric.carlson@apple.com>
2095
2096         [MediaStream] defer resolution of getUserMedia promise made in a background tab
2097         https://bugs.webkit.org/show_bug.cgi?id=164643
2098         <rdar://problem/29048317>
2099
2100         Reviewed by Brady Eidson.
2101
2102         Test: fast/mediastream/get-user-media-background-tab.html
2103
2104         Do not start producing data when the document does not allow media
2105         to start playing. Instead, register with the document for a callback 
2106         when playback is allowed and start then.
2107         * Modules/mediastream/MediaStream.cpp:
2108         (WebCore::MediaStream::~MediaStream):
2109         (WebCore::MediaStream::mediaCanStart):
2110         (WebCore::MediaStream::startProducingData):
2111         (WebCore::MediaStream::stopProducingData):
2112         (WebCore::MediaStream::pageMutedStateDidChange):
2113         * Modules/mediastream/MediaStream.h:
2114
2115         * Modules/webaudio/AudioContext.cpp:
2116         (WebCore::AudioContext::mediaCanStart): Deal with API change.
2117         * Modules/webaudio/AudioContext.h:
2118
2119         * html/HTMLMediaElement.cpp:
2120         (WebCore::HTMLMediaElement::mediaCanStart): Ditto.
2121         * html/HTMLMediaElement.h:
2122         * page/MediaCanStartListener.h:
2123
2124         * page/Page.cpp:
2125         (WebCore::Page::takeAnyMediaCanStartListener): Return the listener and document.
2126         (WebCore::Page::setCanStartMedia): Pass the document to the listener.
2127         * page/Page.h:
2128
2129 2016-11-11  Zalan Bujtas  <zalan@apple.com>
2130
2131         RenderFlowThread's containing block cache should be invalidated before calling styleDidChange.
2132         https://bugs.webkit.org/show_bug.cgi?id=164646
2133
2134         Reviewed by Simon Fraser.
2135
2136         We have to invalidate the containing block cache for RenderFlowThreads soon after the containing block context
2137         changes. Invalidating it in RenderBlock::styleDidChange is too late since we might run some code in some
2138         of the subclasses that use this stale containing block cache.  
2139
2140         No known behaviour change.
2141
2142         * rendering/RenderBlock.cpp:
2143         (WebCore::RenderBlock::styleDidChange): This change could trigger double invalidation.
2144         However running this code twice shouldn't impact performance greatly.
2145         (WebCore::RenderBlock::resetFlowThreadContainingBlockAndChildInfoIncludingDescendants):
2146         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
2147         * rendering/RenderBlock.h:
2148         * rendering/RenderElement.cpp:
2149         (WebCore::RenderElement::setStyle): We don't need to call the invalidation from initializeStyle(), since
2150         we don't yet have cache at that point.
2151         * rendering/RenderInline.cpp:
2152         (WebCore::RenderInline::splitInlines):
2153
2154 2016-11-11  Darin Adler  <darin@apple.com>
2155
2156         Move Node from ExceptionCode to ExceptionOr
2157         https://bugs.webkit.org/show_bug.cgi?id=164515
2158
2159         Reviewed by Sam Weinig.
2160
2161         * bindings/js/JSHTMLSelectElementCustom.cpp:
2162         (WebCore::selectElementIndexSetter): Call remove instead of removeByIndex.
2163         Was renamed now that there is no conflict.
2164
2165         * bindings/js/JSNodeCustom.cpp:
2166         (WebCore::JSNode::insertBefore): Use ExceptionOr.
2167         (WebCore::JSNode::replaceChild): Ditto.
2168         (WebCore::JSNode::removeChild): Ditto.
2169         (WebCore::JSNode::appendChild): Ditto.
2170
2171         * dom/Attr.cpp:
2172         (WebCore::Attr::Attr): Take a reference.
2173         (WebCore::Attr::create): Ditto.
2174         (WebCore::Attr::createTextChild): Use a Ref.
2175         (WebCore::Attr::setPrefix): Use ExceptionOr.
2176         (WebCore::Attr::setNodeValue): Ditto.
2177         (WebCore::Attr::attachToElement): Take a reference.
2178         * dom/Attr.h: Updated for above. Also made setPrefix private.
2179
2180         * dom/CharacterData.cpp:
2181         (WebCore::CharacterData::setNodeValue): Use ExceptionOr.
2182         * dom/CharacterData.h: Updated for the above.
2183
2184         * dom/ContainerNode.cpp:
2185         (WebCore::collectChildrenAndRemoveFromOldParent): Use ExceptionOr.
2186         (WebCore::checkAcceptChild): Ditto.
2187         (WebCore::checkAcceptChildGuaranteedNodeTypes): Ditto.
2188         (WebCore::ContainerNode::ensurePreInsertionValidity): Ditto.
2189         (WebCore::checkPreReplacementValidity): Ditto.
2190         (WebCore::ContainerNode::insertBefore): Ditto.
2191         (WebCore::ContainerNode::replaceChild): Ditto.
2192         (WebCore::ContainerNode::removeChild): Ditto.
2193         (WebCore::ContainerNode::appendChild): Ditto.
2194         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
2195         (WebCore::ContainerNode::cloneChildNodes): Ditto.
2196         (WebCore::ContainerNode::append): Ditto.
2197         (WebCore::ContainerNode::prepend): Ditto.
2198         * dom/ContainerNode.h: Updated for above changes.
2199
2200         * dom/Document.cpp:
2201         (WebCore::Document::setTitle): Removed unneeded ASSERT_NO_EXCEPTION.
2202         (WebCore::Document::setBodyOrFrameset): Removed unneeded ignored
2203         exception code.
2204
2205         * dom/Element.cpp:
2206         (WebCore::Element::setPrefix): Use ExceptionOr.
2207         (WebCore::Element::setAttributeNode): Updated for changes to Attr.
2208         (WebCore::Element::setAttributeNodeNS): Ditto.
2209         (WebCore::Element::setOuterHTML): Use ExceptionOr.
2210         (WebCore::Element::ensureAttr): Updated for changes to Attr.
2211         (WebCore::Element::insertAdjacent): Use ExceptionOr.
2212         * dom/Element.h: Updated for above.
2213
2214         * dom/Node.cpp:
2215         (WebCore::Node::setNodeValue): Use ExceptionOr.
2216         (WebCore::Node::insertBefore): Ditto.
2217         (WebCore::Node::replaceChild): Ditto.
2218         (WebCore::Node::removeChild): Ditto.
2219         (WebCore::Node::appendChild): Ditto.
2220         (WebCore::Node::convertNodesOrStringsIntoNode): Ditto.
2221         (WebCore::Node::before): Ditto.
2222         (WebCore::Node::after): Ditto.
2223         (WebCore::Node::replaceWith): Ditto.
2224         (WebCore::Node::remove): Ditto.
2225         (WebCore::Node::cloneNodeForBindings): Ditto.
2226         (WebCore::Node::setPrefix): Ditto.
2227         (WebCore::Node::checkSetPrefix): Ditto.
2228         (WebCore::Node::setTextContent): Ditto.
2229         * dom/Node.h: Updated for above.
2230         * dom/Node.idl: Use non-legacy exceptions.
2231
2232         * dom/Range.cpp:
2233         (WebCore::Range::processContents): Use ExceptionOr.
2234         (WebCore::processContentsBetweenOffsets): Ditto.
2235         (WebCore::processNodes): Ditto.
2236         (WebCore::processAncestorsAndTheirSiblings): Ditto.
2237         (WebCore::Range::insertNode): Ditto.
2238         (WebCore::Range::surroundContents): Ditto.
2239
2240         * dom/Text.cpp:
2241         (WebCore::Text::splitText): Use ExceptionOr.
2242         (WebCore::Text::replaceWholeText): Removed unneeded IGNORE_EXCEPTION.
2243
2244         * editing/AppendNodeCommand.cpp:
2245         (WebCore::AppendNodeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
2246         * editing/CompositeEditCommand.cpp:
2247         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.
2248
2249         * editing/EditorCommand.cpp:
2250         (WebCore::executeInsertNode): Use ExceptionOr.
2251
2252         * editing/InsertNodeBeforeCommand.cpp:
2253         (WebCore::InsertNodeBeforeCommand::doApply): Removed unneeded IGNORE_EXCEPTION.
2254         * editing/MergeIdenticalElementsCommand.cpp:
2255         (WebCore::MergeIdenticalElementsCommand::doApply): Ditto.
2256         (WebCore::MergeIdenticalElementsCommand::doUnapply): Use ExceptionOr.
2257
2258         * editing/RemoveNodeCommand.cpp:
2259         (WebCore::RemoveNodeCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
2260         * editing/ReplaceNodeWithSpanCommand.cpp:
2261         (WebCore::swapInNodePreservingAttributesAndChildren): Removed unneeded
2262         ASSERT_NO_EXCEPTION.
2263         * editing/ReplaceSelectionCommand.cpp:
2264         (WebCore::ReplacementFragment::removeNode): Ditto.
2265         (WebCore::ReplacementFragment::insertNodeBefore): Ditto.
2266         (WebCore::ReplacementFragment::insertFragmentForTestRendering): Ditto.
2267         (WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment): Ditto.
2268         (WebCore::ReplaceSelectionCommand::insertAsListItems): Ditto.
2269
2270         * editing/SplitElementCommand.cpp:
2271         (WebCore::SplitElementCommand::executeApply): Use ExceptionOr.
2272         (WebCore::SplitElementCommand::doUnapply): Removed unneeded IGNORE_EXCEPTION.
2273
2274         * editing/SplitTextNodeCommand.cpp:
2275         (WebCore::SplitTextNodeCommand::insertText1AndTrimText2): Use ExceptionOr.
2276
2277         * editing/WrapContentsInDummySpanCommand.cpp:
2278         (WebCore::WrapContentsInDummySpanCommand::executeApply): Removed unneeded
2279         IGNORE_EXCEPTION.
2280         (WebCore::WrapContentsInDummySpanCommand::doUnapply): Ditto.
2281
2282         * editing/cocoa/EditorCocoa.mm:
2283         (WebCore::Editor::styleForSelectionStart): Removed unneeded ASSERT_NO_EXCEPTION
2284         and IGNORE_EXCEPTION.
2285         * editing/htmlediting.cpp:
2286         (WebCore::createTabSpanElement): Ditto.
2287         * editing/markup.cpp:
2288         (WebCore::fillContainerFromString): Ditto.
2289         (WebCore::createFragmentFromText): Ditto.
2290         (WebCore::removeElementFromFragmentPreservingChildren): Ditto.
2291         (WebCore::replaceChildrenWithFragment): Use ExceptionOr.
2292         (WebCore::replaceChildrenWithText): Ditto.
2293
2294         * editing/ios/EditorIOS.mm:
2295         (WebCore::Editor::WebContentReader::addFragment): Removed unneeded exception
2296         ignoring code.
2297         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
2298         (WebCore::Editor::setTextAsChildOfElement): Ditto.
2299
2300         * html/ColorInputType.cpp:
2301         (WebCore::ColorInputType::createShadowSubtree): Removed unneeded
2302         ASSERT_NO_EXCEPTION.
2303
2304         * html/FTPDirectoryDocument.cpp:
2305         (WebCore::FTPDirectoryDocumentParser::appendEntry): Removed unneeded
2306         IGNORE_EXCEPTION.
2307         (WebCore::FTPDirectoryDocumentParser::createTDForFilename): Ditto.
2308         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate): Ditto.
2309         (WebCore::FTPDirectoryDocumentParser::createBasicDocument): Ditto.
2310         * html/FileInputType.cpp:
2311         (WebCore::FileInputType::createShadowSubtree): Ditto.
2312
2313         * html/HTMLAnchorElement.cpp:
2314         (WebCore::HTMLAnchorElement::setText): Removed unneeded ASSERT_NO_EXCEPTION.
2315         * html/HTMLDetailsElement.cpp:
2316         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot): Ditto.
2317
2318         * html/HTMLElement.cpp:
2319         (WebCore::HTMLElement::textToFragment): Use ExceptionOr.
2320         (WebCore::HTMLElement::setOuterText): Ditto.
2321
2322         * html/HTMLKeygenElement.cpp:
2323         (WebCore::HTMLKeygenElement::HTMLKeygenElement): Removed unneeded
2324         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2325         * html/HTMLMediaElement.cpp:
2326         (WebCore::HTMLMediaElement::createMediaControls): Ditto.
2327         * html/HTMLMeterElement.cpp:
2328         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot): Ditto.
2329         * html/HTMLOptionElement.cpp:
2330         (WebCore::HTMLOptionElement::createForJSConstructor): Use ExceptionOr.
2331         (WebCore::HTMLOptionElement::setText): Removed unneeded
2332         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2333
2334         * html/HTMLOptionsCollection.cpp:
2335         (WebCore::HTMLOptionsCollection::remove): Call remove, not removeByIndex,
2336         since we were able to change the name.
2337
2338         * html/HTMLOutputElement.cpp:
2339         (WebCore::HTMLOutputElement::setTextContentInternal): Removed unneeded
2340         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2341         * html/HTMLProgressElement.cpp:
2342         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot): Ditto.
2343         * html/HTMLScriptElement.cpp:
2344         (WebCore::HTMLScriptElement::setText): Ditto.
2345
2346         * html/HTMLSelectElement.cpp:
2347         (WebCore::HTMLSelectElement::add): Use ExceptionOr.
2348         (WebCore::HTMLSelectElement::remove): Renamed from removeByIndex since
2349         there is no conflict with remove any more.
2350         (WebCore::HTMLSelectElement::setOption): Call remove.
2351         * html/HTMLSelectElement.h: Updated for above.
2352         * html/HTMLSelectElement.idl: Got rid of ImplementedAs=removeByIndex.
2353
2354         * html/HTMLSummaryElement.cpp:
2355         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot): Removed unneeded
2356         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2357         * html/HTMLTableElement.cpp:
2358         (WebCore::HTMLTableElement::HTMLTableElement): Initialize data members in
2359         class definition instead of here.
2360         (WebCore::HTMLTableElement::caption): Simplified using childrenOfType.
2361         (WebCore::HTMLTableElement::setCaption): Use ExceptionOr.
2362         (WebCore::HTMLTableElement::setTHead): Ditto.
2363         (WebCore::HTMLTableElement::setTFoot): Ditto.
2364         (WebCore::HTMLTableElement::deleteTFoot): Removed unneeded ASSERT_NO_EXCEPTION
2365         and IGNORE_EXCEPTION.
2366         (WebCore::HTMLTableElement::createTBody): Ditto.
2367         (WebCore::HTMLTableElement::deleteCaption): Ditto.
2368         (WebCore::HTMLTableElement::insertRow): Use ExceptionOr.
2369         * html/HTMLTableElement.h: Updated for above.
2370
2371         * html/HTMLTableRowElement.cpp:
2372         (WebCore::HTMLTableRowElement::insertCell): Use ExceptionOr.
2373         (WebCore::HTMLTableRowElement::deleteCell): Ditto.
2374         * html/HTMLTableSectionElement.cpp:
2375         (WebCore::HTMLTableSectionElement::insertRow): Ditto.
2376         (WebCore::HTMLTableSectionElement::deleteRow): Ditto.
2377
2378         * html/HTMLTextAreaElement.cpp:
2379         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Removed unneeded
2380         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2381         (WebCore::HTMLTextAreaElement::setDefaultValue): Ditto.
2382         (WebCore::HTMLTextAreaElement::updatePlaceholderText): Ditto.
2383         * html/HTMLTextFormControlElement.cpp:
2384         (WebCore::HTMLTextFormControlElement::setInnerTextValue): Ditto.
2385         * html/HTMLTitleElement.cpp:
2386         (WebCore::HTMLTitleElement::setText): Ditto.
2387         * html/MediaDocument.cpp:
2388         (WebCore::MediaDocumentParser::createDocumentStructure): Ditto.
2389         (WebCore::MediaDocument::replaceMediaElementTimerFired): Ditto.
2390         * html/PluginDocument.cpp:
2391         (WebCore::PluginDocumentParser::createDocumentStructure): Ditto.
2392         * html/RangeInputType.cpp:
2393         (WebCore::RangeInputType::createShadowSubtree): Ditto.
2394         * html/SearchInputType.cpp:
2395         (WebCore::SearchInputType::createShadowSubtree): Ditto.
2396         * html/TextFieldInputType.cpp:
2397         (WebCore::TextFieldInputType::createShadowSubtree): Ditto.
2398         (WebCore::TextFieldInputType::updatePlaceholderText): Ditto.
2399         (WebCore::TextFieldInputType::createContainer): Ditto.
2400         (WebCore::TextFieldInputType::createAutoFillButton): Ditto.
2401         * html/ValidationMessage.cpp:
2402         (WebCore::ValidationMessage::setMessageDOMAndStartTimer): Ditto.
2403         (WebCore::ValidationMessage::buildBubbleTree): Ditto.
2404         (WebCore::ValidationMessage::deleteBubbleTree): Ditto.
2405         * html/shadow/MediaControlElements.cpp:
2406         (WebCore::MediaControlTextTrackContainerElement::updateDisplay): Ditto.
2407         * html/shadow/MediaControls.cpp:
2408         (WebCore::MediaControls::createTextTrackDisplay): Ditto.
2409
2410         * html/shadow/MediaControlsApple.cpp:
2411         (WebCore::MediaControlsApple::MediaControlsApple): Initialize data members
2412         in class definition instead of here.
2413         (WebCore::MediaControlsApple::tryCreateControls): Use ExceptionOr.
2414         * html/shadow/MediaControlsApple.h: Updated for above.
2415
2416         * html/track/VTTCue.cpp:
2417         (WebCore::VTTCue::copyWebVTTNodeToDOMTree): Removed unneeded ASSERT_NO_EXCEPTION
2418         and IGNORE_EXCEPTION.
2419         (WebCore::VTTCue::getDisplayTree): Ditto.
2420         * html/track/VTTRegion.cpp:
2421         (WebCore::VTTRegion::appendTextTrackCueBox): Ditto.
2422
2423         * inspector/DOMEditor.cpp: Use ExceptionOr in action classes.
2424         (WebCore::DOMEditor::DOMEditor): Take a reference.
2425         (WebCore::DOMEditor::insertBefore): Use ExceptionOr.
2426         (WebCore::DOMEditor::removeChild): Ditto.
2427         (WebCore::DOMEditor::setAttribute): Ditto.
2428         (WebCore::DOMEditor::removeAttribute): Ditto.
2429         (WebCore::DOMEditor::setOuterHTML): Ditto.
2430         (WebCore::DOMEditor::replaceWholeText): Ditto.
2431         (WebCore::DOMEditor::replaceChild): Ditto.
2432         (WebCore::DOMEditor::setNodeValue): Ditto.
2433         (WebCore::populateErrorString): Ditto.
2434         * inspector/DOMEditor.h: Updated for above changes.
2435
2436         * inspector/DOMPatchSupport.cpp:
2437         (WebCore::DOMPatchSupport::patchDocument): Updated to use references,
2438         to use ExceptionOr, and to use a struct without a constructor for Digest.
2439         (WebCore::DOMPatchSupport::DOMPatchSupport): Ditto.
2440         (WebCore::DOMPatchSupport::patchNode): Ditto.
2441         (WebCore::DOMPatchSupport::innerPatchNode): Ditto.
2442         (WebCore::DOMPatchSupport::diff): Ditto.
2443         (WebCore::DOMPatchSupport::innerPatchChildren): Ditto.
2444         (WebCore::DOMPatchSupport::createDigest): Ditto.
2445         (WebCore::DOMPatchSupport::insertBeforeAndMarkAsUsed): Ditto.
2446         (WebCore::DOMPatchSupport::removeChildAndMoveToNew): Ditto.
2447         (WebCore::DOMPatchSupport::markNodeAsUsed): Ditto.
2448         * inspector/DOMPatchSupport.h: Updated for above.
2449
2450         * inspector/InspectorCSSAgent.cpp: Use ExceptionOr in the action classes.
2451         (WebCore::InspectorCSSAgent::getStyleSheetText): Use ExceptionOr.
2452         (WebCore::InspectorCSSAgent::setStyleSheetText): Ditto.
2453         (WebCore::InspectorCSSAgent::setStyleText): Ditto.
2454         (WebCore::InspectorCSSAgent::setRuleSelector): Ditto.
2455         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument): Ditto.
2456         (WebCore::InspectorCSSAgent::addRule): Ditto.
2457         * inspector/InspectorDOMAgent.cpp:
2458         (WebCore::InspectorDOMAgent::didCreateFrontendAndBackend): Ditto.
2459         (WebCore::InspectorDOMAgent::setAttributeValue): Ditto.
2460         (WebCore::InspectorDOMAgent::setAttributesAsText): Ditto.
2461         (WebCore::InspectorDOMAgent::removeAttribute): Ditto.
2462         (WebCore::InspectorDOMAgent::setOuterHTML): Ditto.
2463         (WebCore::InspectorDOMAgent::setNodeValue): Ditto.
2464         (WebCore::InspectorDOMAgent::undo): Ditto.
2465         (WebCore::InspectorDOMAgent::redo): Ditto.
2466
2467         * inspector/InspectorHistory.cpp:
2468         (WebCore::InspectorHistory::Action::Action): Moved to header.
2469         (WebCore::InspectorHistory::Action::~Action): Ditto.
2470         (WebCore::InspectorHistory::Action::toString): Ditto.
2471         (WebCore::InspectorHistory::Action::isUndoableStateMark): Ditto.
2472         (WebCore::InspectorHistory::Action::mergeId): Ditto.
2473         (WebCore::InspectorHistory::Action::merge): Ditto.
2474         (WebCore::InspectorHistory::InspectorHistory): Deleted.
2475         (WebCore::InspectorHistory::~InspectorHistory): Deleted.
2476         (WebCore::InspectorHistory::perform): Updated exception handling.
2477         (WebCore::InspectorHistory::markUndoableState): Ditto.
2478         (WebCore::InspectorHistory::undo): Ditto.
2479         (WebCore::InspectorHistory::redo): Ditto.
2480         * inspector/InspectorHistory.h: Updated for above.
2481
2482         * inspector/InspectorPageAgent.cpp:
2483         (WebCore::InspectorPageAgent::setDocumentContent): Use reference.
2484
2485         * inspector/InspectorStyleSheet.cpp:
2486         (WebCore::InspectorStyle::text): Use ExceptionOr and renamed from
2487         getText since this now has a return value.
2488         (WebCore::InspectorStyle::populateAllProperties): Updated for above.
2489         (WebCore::InspectorStyle::setText): Use ExceptionOr.
2490         (WebCore::InspectorStyleSheet::setText): Ditto.
2491         (WebCore::InspectorStyleSheet::ruleSelector): Ditto.
2492         (WebCore::InspectorStyleSheet::setRuleSelector): Ditto.
2493         (WebCore::InspectorStyleSheet::addRule): Ditto.
2494         (WebCore::InspectorStyleSheet::deleteRule): Ditto.
2495         (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): Ditto.
2496         (WebCore::InspectorStyleSheet::buildObjectForStyle): Ditto.
2497         (WebCore::InspectorStyleSheet::setStyleText): Ditto.
2498         (WebCore::InspectorStyleSheet::text): Use ExceptionOr and renamed.
2499         (WebCore::InspectorStyleSheet::checkPageStyleSheet): Deleted.
2500         Just wrote this code inline in each place this was called since it's
2501         just a single null check.
2502         (WebCore::InspectorStyleSheetForInlineStyle::text): Use ExceptionOr
2503         and renamed.
2504         (WebCore::InspectorStyleSheetForInlineStyle::setStyleText): Ditto.
2505         (WebCore::InspectorStyle::getText): Deleted.
2506         * inspector/InspectorStyleSheet.h: Updated for above changes.
2507
2508         * page/DragController.cpp:
2509         (WebCore::documentFragmentFromDragData): Removed unneeded
2510         ASSERT_NO_EXCEPTION and IGNORE_EXCEPTION.
2511         * page/ios/FrameIOS.mm:
2512         (WebCore::Frame::initWithSimpleHTMLDocument): Ditto.
2513         * svg/SVGTRefElement.cpp:
2514         (WebCore::SVGTRefElement::updateReferencedText): Ditto.
2515         (WebCore::SVGTRefElement::detachTarget): Ditto.
2516         * xml/XMLTreeViewer.cpp:
2517         (WebCore::XMLTreeViewer::transformDocumentToTreeView): Ditto.
2518
2519 2016-11-10  Jiewen Tan  <jiewen_tan@apple.com>
2520
2521         Rename CryptoKeyUsage to CryptoKeyUsageBitmap and CryptoKey::Usage to CryptoKeyUsage
2522         https://bugs.webkit.org/show_bug.cgi?id=164624
2523         <rdar://problem/29210140>
2524
2525         Reviewed by Brent Fulgham.
2526
2527         This patch allows IDLType CryptoKeyUsage to be shared among different IDLs, i.e. CryptoKey.idl,
2528         SubtleCrypto.idl and JsonWebKey.idl such that it can simplify the customized binding codes.
2529
2530         Covered by existing tests.
2531
2532         * CMakeLists.txt:
2533         * DerivedSources.make:
2534         * WebCore.xcodeproj/project.pbxproj:
2535         * bindings/js/JSCryptoKeySerializationJWK.cpp:
2536         * bindings/js/JSCryptoKeySerializationJWK.h:
2537         * bindings/js/JSSubtleCryptoCustom.cpp:
2538         (WebCore::toCryptoKeyUsageBitmap):
2539         (WebCore::cryptoKeyUsageBitmapFromJSValue):
2540         (WebCore::toKeyData):
2541         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
2542         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
2543         (WebCore::cryptoKeyUsageFromString): Deleted.
2544         (WebCore::cryptoKeyUsagesFromJSValue): Deleted.
2545         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2546         * bindings/js/SerializedScriptValue.cpp:
2547         * crypto/CryptoAlgorithm.cpp:
2548         * crypto/CryptoAlgorithm.h:
2549         * crypto/CryptoKey.cpp:
2550         * crypto/CryptoKey.h:
2551         * crypto/CryptoKey.idl:
2552         * crypto/CryptoKeySerialization.h:
2553         * crypto/CryptoKeyUsage.h:
2554         * crypto/CryptoKeyUsage.idl: Added.
2555         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
2556         * crypto/JsonWebKey.h:
2557         * crypto/JsonWebKey.idl:
2558         * crypto/SubtleCrypto.idl:
2559         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2560         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
2561         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2562         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
2563         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2564         * crypto/algorithms/CryptoAlgorithmHMAC.h:
2565         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2566         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
2567         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2568         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
2569         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2570         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
2571         * crypto/keys/CryptoKeyAES.cpp:
2572         * crypto/keys/CryptoKeyAES.h:
2573         * crypto/keys/CryptoKeyHMAC.cpp:
2574         * crypto/keys/CryptoKeyHMAC.h:
2575         * crypto/keys/CryptoKeyRSA.cpp:
2576         * crypto/keys/CryptoKeyRSA.h:
2577         * crypto/keys/CryptoKeySerializationRaw.cpp:
2578         * crypto/keys/CryptoKeySerializationRaw.h:
2579         * crypto/mac/CryptoKeyRSAMac.cpp:
2580
2581 2016-11-11  Dave Hyatt  <hyatt@apple.com>
2582
2583         [CSS Parser] Fix basic shape parsing
2584         https://bugs.webkit.org/show_bug.cgi?id=164645
2585
2586         Reviewed by Dean Jackson.
2587
2588         * css/parser/CSSPropertyParser.cpp:
2589         (WebCore::consumeBasicShape):
2590
2591 2016-11-11  Zalan Bujtas  <zalan@apple.com>
2592
2593         RenderFlowThread::removeLineRegionInfo shouldn't call HashMap::contains before HashMap::remove
2594         https://bugs.webkit.org/show_bug.cgi?id=164639
2595
2596         Reviewed by Simon Fraser.
2597
2598         Also instead of asserting that the incoming renderer is not nullptr, we could just pass a reference in. 
2599
2600         No change in functionality.
2601
2602         * rendering/RenderBlock.cpp:
2603         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
2604         (WebCore::canComputeRegionRangeForBox):
2605         (WebCore::RenderBlock::computeRegionRangeForBoxChild):
2606         (WebCore::RenderBlock::estimateRegionRangeForBoxChild):
2607         (WebCore::RenderBlock::updateRegionRangeForBoxChild):
2608         * rendering/RenderBox.cpp:
2609         (WebCore::RenderBox::hasRegionRangeInFlowThread):
2610         * rendering/RenderElement.cpp:
2611         (WebCore::RenderElement::removeFromRenderFlowThreadIncludingDescendants):
2612         * rendering/RenderFlowThread.cpp:
2613         (WebCore::RenderFlowThread::removeFlowChildInfo):
2614         (WebCore::RenderFlowThread::validateRegions):
2615         (WebCore::RenderFlowThread::removeRenderBoxRegionInfo):
2616         (WebCore::RenderFlowThread::removeLineRegionInfo):
2617         (WebCore::RenderFlowThread::clearRenderBoxRegionInfoAndCustomStyle):
2618         (WebCore::RenderFlowThread::setRegionRangeForBox):
2619         (WebCore::RenderFlowThread::hasCachedRegionRangeForBox):
2620         (WebCore::RenderFlowThread::computedRegionRangeForBox):
2621         (WebCore::RenderFlowThread::checkLinesConsistency):
2622         * rendering/RenderFlowThread.h:
2623         * rendering/RenderMultiColumnFlowThread.cpp:
2624         (WebCore::RenderMultiColumnFlowThread::setRegionRangeForBox):
2625         * rendering/RenderMultiColumnFlowThread.h:
2626         * rendering/RenderNamedFlowFragment.cpp:
2627         (WebCore::RenderNamedFlowFragment::clearObjectStyleInRegion):
2628         * rendering/RenderNamedFlowFragment.h:
2629         * rendering/RenderNamedFlowThread.cpp:
2630         (WebCore::RenderNamedFlowThread::clearRenderObjectCustomStyle):
2631         (WebCore::RenderNamedFlowThread::removeFlowChildInfo):
2632         * rendering/RenderNamedFlowThread.h:
2633         * rendering/RenderRegion.cpp:
2634         (WebCore::RenderRegion::removeRenderBoxRegionInfo):
2635         * rendering/RenderRegion.h:
2636
2637 2016-11-11  Megan Gardner  <megan_gardner@apple.com>
2638
2639         [Cocoa] Support wide gamut for Drag Image UI
2640         https://bugs.webkit.org/show_bug.cgi?id=164490
2641
2642         Reviewed by Tim Horton.
2643
2644         Fixed an error in the support define for wide gamut on Mac.
2645
2646         The testing infrastructure to test this does not exist, and will be landing in another patch.
2647
2648         * platform/graphics/cg/GraphicsContextCG.cpp:
2649         (WebCore::extendedSRGBColorSpaceRef):
2650
2651 2016-11-11  Beth Dakin  <bdakin@apple.com>
2652
2653         Get touch bar code building for open source builds
2654         https://bugs.webkit.org/show_bug.cgi?id=164610
2655
2656         Reviewed by Wenson Hsieh.
2657
2658         * config.h:
2659
2660 2016-11-11  Dave Hyatt  <hyatt@apple.com>
2661
2662         [CSS Parser] Fix SVG markers and colors
2663         https://bugs.webkit.org/show_bug.cgi?id=164640
2664
2665         Reviewed by Dean Jackson.
2666
2667         * css/StyleBuilderConverter.h:
2668         (WebCore::StyleBuilderConverter::convertSVGColor):
2669         * css/parser/CSSPropertyParser.cpp:
2670         (WebCore::CSSPropertyParser::parseShorthand):
2671
2672 2016-11-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2673
2674         Composition state should be cleared when changing focus to a non-editable element
2675         https://bugs.webkit.org/show_bug.cgi?id=164595
2676         <rdar://problem/26412551>
2677
2678         Reviewed by Enrica Casucci.
2679
2680         When canceling or confirming a composition, always ensure that the composition node and composition underlines
2681         being tracked are reset, even when there is no current selection. This prevents us from getting into a bad state
2682         where focus has already changed from an element with a pending composition to a different element and the
2683         composition is canceled, but the Editor still maintains its composition node.
2684
2685         Test: editing/input/focus-change-with-marked-text.html
2686
2687         * editing/Editor.cpp:
2688         (WebCore::Editor::setComposition):
2689
2690 2016-11-11  Dave Hyatt  <hyatt@apple.com>
2691
2692         [CSS Parser] Support -webkit-svg-shadow
2693         https://bugs.webkit.org/show_bug.cgi?id=164637
2694
2695         Reviewed by Zalan Bujtas.
2696
2697         * css/parser/CSSPropertyParser.cpp:
2698         (WebCore::CSSPropertyParser::parseSingleValue):
2699
2700 2016-11-11  Alejandro G. Castro  <alex@igalia.com>
2701
2702         [WebRTC][OpenWebRTC] Implement device permissions handling solution for owr backend in the UI process
2703         https://bugs.webkit.org/show_bug.cgi?id=164010
2704
2705         Reviewed by Philippe Normand.
2706
2707         Move the capture of the sources for the OWR backend to the
2708         WebProcess. In the UI we continue checking if the user allows
2709         access to the audio and video capture. When device handling is
2710         added in the future we will need some persistent ID and API to
2711         pass from the UI process to the Web process.
2712
2713         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
2714         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
2715         Add the proper audio and video sources to allow the UI message to
2716         be properly rendered. We are adding the specific devices, even
2717         though the dialog just asks for general audio and video. There was
2718         already a FIXME about improving this.
2719         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): We are
2720         capturing the devices here when the allowed message arrived from
2721         the UI process. We store the completion handler to use it later
2722         when the aync owr API finishes capture devices process.
2723         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable): We
2724         now call the completion handler in this callback called when the
2725         owr library finishes the capture of the devices. Now this happens
2726         in the WebProcess for OWR port.
2727         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
2728         Add an attribute to store the completion handler.
2729
2730 2016-11-11  Manuel Rego Casasnovas  <rego@igalia.com>
2731
2732         [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
2733         https://bugs.webkit.org/show_bug.cgi?id=163450
2734
2735         Reviewed by Darin Adler.
2736
2737         The issue is that in the test case a simplifiedLayout() is performed.
2738         So in RenderGrid::layoutBlock() we early return and the grid is not populated,
2739         so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
2740         in RenderGrid::layoutPositionedObject().
2741
2742         We should avoid to do a simplified layout if we have to layout
2743         some positioned grid items and the grid is dirty.
2744
2745         The problem was not only the ASSERT, but the current behavior was wrong too.
2746         As we didn't do a proper layout of the grid container, the positioned item
2747         won't be placed on the expected position. Added tests verifying this.
2748
2749         Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
2750                fast/css-grid-layout/grid-simplified-layout-positioned.html
2751
2752         * rendering/RenderBlock.cpp:
2753         (WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
2754         a simplified layout.
2755         (WebCore::RenderBlock::simplifiedLayout): Extract initial check
2756         into canPerformSimplifiedLayout().
2757         * rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
2758         * rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
2759         to verify that the grid is not dirty if we have to layout some positioned items.
2760         (WebCore::RenderGrid::canPerformSimplifiedLayout):
2761         * rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.
2762
2763 2016-11-11  Antoine Quint  <graouts@apple.com>
2764
2765         [Modern Media Controls] Media Controller: media tracks control support
2766         https://bugs.webkit.org/show_bug.cgi?id=164618
2767         <rdar://problem/27989483>
2768
2769         Reviewed by Dean Jackson.
2770
2771         We introduce the TracksSupport class to only enable the media tracks button
2772         in the media controls when text tracks and/or multiple audio tracks are available.
2773
2774         Tests: media/modern-media-controls/tracks-support/tracks-support-audio-tracks.html
2775                media/modern-media-controls/tracks-support/tracks-support-no-tracks.html
2776                media/modern-media-controls/tracks-support/tracks-support-text-tracks.html
2777
2778         * Modules/modern-media-controls/js-files:
2779         * Modules/modern-media-controls/media/media-controller.js:
2780         (MediaController.prototype._updateControlsIfNeeded):
2781         * Modules/modern-media-controls/media/tracks-support.js: Added.
2782         (TracksSupport):
2783         (TracksSupport.prototype.destroy):
2784         (TracksSupport.prototype.get control):
2785         (TracksSupport.prototype.get mediaEvents):
2786         (TracksSupport.prototype.buttonWasClicked):
2787         (TracksSupport.prototype.syncControl):
2788         * WebCore.xcodeproj/project.pbxproj:
2789
2790 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2791
2792         [DOMJIT] DOMJIT accessor attribute in IDL should say like DOMJIT=Getter
2793         https://bugs.webkit.org/show_bug.cgi?id=164632
2794
2795         Reviewed by Sam Weinig.
2796
2797         Currently, DOMJIT patchpoint is only allowed for getter in attributes.
2798         To make it explicit, we use IDL attribute DOMJIT=Getter instead of
2799         DOMJIT.
2800
2801         * bindings/scripts/CodeGeneratorJS.pm:
2802         (GenerateHeader):
2803         (GenerateImplementation):
2804         * bindings/scripts/IDLAttributes.txt:
2805         * bindings/scripts/test/TestDOMJIT.idl:
2806         * dom/Document.idl:
2807         * dom/Node.idl:
2808
2809 2016-11-10  Sam Weinig  <sam@webkit.org>
2810
2811         [SVG] Start moving special casing of SVG out of the bindings - SVGPreserveAspectRatio
2812         https://bugs.webkit.org/show_bug.cgi?id=164622
2813
2814         Reviewed by Darin Adler.
2815
2816         Part 2 of moving special casing of SVG out of the bindings.
2817
2818         * CMakeLists.txt:
2819         * WebCore.xcodeproj/project.pbxproj:
2820         Add new files.
2821
2822         * bindings/scripts/CodeGenerator.pm:
2823         (GenerateCompileTimeCheckForEnumsIfNeeded):
2824         * bindings/scripts/IDLAttributes.txt:
2825         Allow specifying a different scope for the constants to be declared in.
2826         This allows us to have only one copy of the constants in the implementation
2827         of SVGAngle/SVGAngleValue and SVGPreserveAspectRatio/SVGPreserveAspectRatioValue.
2828
2829         * loader/FrameLoader.cpp:
2830         * rendering/svg/RenderSVGImage.h:
2831         Remove unnecessary #include.
2832
2833         * svg/SVGAngle.h:
2834         Remove redundant enum declaration.
2835
2836         * svg/SVGAngle.idl:
2837         Specify a ConstantsScope of SVGAngleValue.
2838
2839         * rendering/svg/RenderSVGImage.cpp:
2840         (WebCore::RenderSVGImage::updateImageViewport):
2841         * svg/PatternAttributes.h:
2842         (WebCore::PatternAttributes::preserveAspectRatio):
2843         (WebCore::PatternAttributes::setPreserveAspectRatio):
2844         * svg/SVGAnimatedPreserveAspectRatio.cpp:
2845         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
2846         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
2847         * svg/SVGAnimatedPreserveAspectRatio.h:
2848         * svg/SVGAnimatedType.cpp:
2849         (WebCore::SVGAnimatedType::createPreserveAspectRatio):
2850         * svg/SVGAnimatedType.h:
2851         (WebCore::SVGAnimatedType::preserveAspectRatio):
2852         * svg/SVGFEImageElement.cpp:
2853         (WebCore::SVGFEImageElement::parseAttribute):
2854         * svg/SVGFitToViewBox.cpp:
2855         (WebCore::SVGFitToViewBox::viewBoxToViewTransform):
2856         * svg/SVGFitToViewBox.h:
2857         (WebCore::SVGFitToViewBox::parseAttribute):
2858         * svg/SVGImageElement.cpp:
2859         (WebCore::SVGImageElement::parseAttribute):
2860         * svg/SVGViewSpec.cpp:
2861         (WebCore::SVGViewSpec::preserveAspectRatioString):
2862         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
2863         (WebCore::SVGViewSpec::reset):
2864         (WebCore::SVGViewSpec::parseViewSpec):
2865         * svg/SVGViewSpec.h:
2866         * svg/graphics/SVGImage.cpp:
2867         (WebCore::SVGImage::computeIntrinsicDimensions):
2868         * svg/graphics/filters/SVGFEImage.cpp:
2869         (WebCore::FEImage::FEImage):
2870         (WebCore::FEImage::createWithImage):
2871         (WebCore::FEImage::createWithIRIReference):
2872         * svg/graphics/filters/SVGFEImage.h:
2873         Replace SVGPreserveAspectRatio usage with SVGPreserveAspectRatioValue.
2874
2875         * svg/SVGPreserveAspectRatio.cpp: Removed.
2876         * svg/SVGPreserveAspectRatio.h: Replaced.
2877         * svg/SVGPreserveAspectRatio.idl:
2878         * svg/SVGPreserveAspectRatioValue.cpp: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.cpp.
2879         * svg/SVGPreserveAspectRatioValue.h: Copied from Source/WebCore/svg/SVGPreserveAspectRatio.h.
2880         Rename SVGPreserveAspectRatio to SVGPreserveAspectRatioValue and add a new SVGPreserveAspectRatio
2881         that acts as the binding object. 
2882
2883 2016-11-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2884
2885         [DOMJIT] Document#body should have DOMJIT patchpoint
2886         https://bugs.webkit.org/show_bug.cgi?id=164627
2887
2888         Reviewed by Darin Adler.
2889
2890         This patch implements document.body accessor. To implement it, we need,
2891
2892         1. DOM traversing ability from ASM.
2893         2. Checking HTMLElement.
2894         3. Checking HTMLElement's localName.
2895
2896         The above features are already implemented in CSSJIT.
2897         We extract some of utilities from CSSJIT to share them with DOMJIT.
2898
2899         Test: js/dom/domjit-accessor-document-body.html
2900
2901         * cssjit/SelectorCompiler.cpp:
2902         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToParentElement):
2903         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToNextAdjacentElement):
2904         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateWalkToPreviousAdjacentElement):
2905         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeMatching):
2906         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeValueExactMatching):
2907         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
2908         (WebCore::SelectorCompiler::jumpIfElementIsNotEmpty):
2909         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasTagName):
2910         (WebCore::SelectorCompiler::testIsElementFlagOnNode): Deleted.
2911         (WebCore::SelectorCompiler::testIsHTMLFlagOnNode): Deleted.
2912         * dom/Document.idl:
2913         * dom/Element.h:
2914         * dom/QualifiedName.h:
2915         * domjit/DOMJITAbstractHeapRepository.yaml:
2916         * domjit/DOMJITHelpers.h:
2917         (WebCore::DOMJIT::branchTestIsElementFlagOnNode):
2918         (WebCore::DOMJIT::branchTestIsHTMLFlagOnNode):
2919         * domjit/JSDocumentDOMJIT.cpp:
2920         (WebCore::DocumentBodyDOMJIT::checkDOM):
2921         (WebCore::loadLocalName):
2922         (WebCore::DocumentBodyDOMJIT::callDOMGetter):
2923
2924 2016-11-10  John Wilander  <wilander@apple.com>
2925
2926         Remove unused parameter name to fix build error on iOS
2927         https://bugs.webkit.org/show_bug.cgi?id=163468
2928
2929         No review.
2930
2931         No new tests.
2932
2933         * platform/ios/PasteboardIOS.mm:
2934         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2935             Removed parameter name 'pasteboardURL' in unimplemented function.
2936
2937 2016-11-10  Chris Dumez  <cdumez@apple.com>
2938
2939         Speed up HTMLInputElement validation
2940         https://bugs.webkit.org/show_bug.cgi?id=164603
2941
2942         Reviewed by Ryosuke Niwa.
2943
2944         Speed up HTMLInputElement validation by doing 1 virtual function call
2945         instead of 9 and calling HTMLInputElement::value() only once per
2946         validation instead of 9 times. Calling value() is expensive because
2947         of sanitization.
2948
2949         No new tests, no Web-exposed behavior change.
2950
2951         * html/BaseCheckableInputType.cpp:
2952         (WebCore::BaseCheckableInputType::fallbackValue):
2953         * html/FormAssociatedElement.cpp:
2954         (WebCore::FormAssociatedElement::isValid):
2955         * html/FormAssociatedElement.h:
2956         * html/HTMLFormControlElement.cpp:
2957         (WebCore::HTMLFormControlElement::isValidFormControlElement):
2958         (WebCore::HTMLFormControlElement::updateValidity):
2959         * html/HTMLInputElement.cpp:
2960         (WebCore::HTMLInputElement::isValid):
2961         (WebCore::HTMLInputElement::value):
2962         * html/HTMLInputElement.h:
2963         * html/TextFieldInputType.cpp:
2964         (WebCore::limitLength):
2965         * html/ValidityState.idl:
2966
2967 2016-11-10  John Wilander  <wilander@apple.com>
2968
2969         Add link information to data transfer pasteboard for drag and drop links
2970         https://bugs.webkit.org/show_bug.cgi?id=163468
2971         <rdar://problem/20634630>
2972
2973         Reviewed by Brent Fulgham.
2974
2975         Test: editing/pasteboard/drag-link-with-data-transfer-adds-trusted-link-to-pasteboard.html
2976         This test ensures data transfers still work for types 'text' and 'url', i.e. that we don't
2977         regress in-page use of the drag pasteboard.
2978
2979         * page/DragController.cpp:
2980         (WebCore::DragController::startDrag):
2981             Now adds trustworthy link information to the drag pasteboard.
2982         * platform/Pasteboard.h:
2983             New function declaration Pasteboard::writeTrustworthyWebURLsPboardType.
2984         * platform/efl/PasteboardEfl.cpp:
2985         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2986             Empty, i.e. not implemented.
2987         * platform/gtk/PasteboardGtk.cpp:
2988         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2989             Empty, i.e. not implemented.
2990         * platform/ios/PasteboardIOS.mm:
2991         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2992             Calls ASSERT_NOT_REACHED() to make sure we don't use this function before we have
2993             decided on a trustrworthy URL pasteboard type on iOS. Currently not used since we
2994             don't support drag & drop on iOS.
2995         * platform/mac/PasteboardMac.mm:
2996         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
2997             Writes the given URL to the WebURLsWithTitlesPboardType. This pasteboard type
2998             serves as a trusted drop source.
2999         * platform/win/PasteboardWin.cpp:
3000         (WebCore::Pasteboard::writeTrustworthyWebURLsPboardType):
3001             Empty, i.e. not implemented.
3002
3003 2016-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
3004
3005         REGRESSION(r207182): [iOS] Crash because of passing freed CFDictionaryRef to CG when decoding a sub-sampled large image
3006         https://bugs.webkit.org/show_bug.cgi?id=164617
3007
3008         Reviewed by Tim Horton.
3009
3010         This covered by the test fast/images/image-subsampling.html but it should
3011         run with --guard-malloc --repeat-each=10 to show the bug or to verify the
3012         fix.
3013
3014         imageSourceOptions() returns a non static RetainPtr<CFDictionaryRef> if
3015         the subsamplingLevel is not zero. Because we are assigning the raw pointer
3016         to a local variable in ImageDecoder::createFrameImageAtIndex(), CFRelease()
3017         is called for the CFDictionaryRef immediately after this assignment. This
3018         causes its memory to be freed in this case even before calling CG.
3019
3020         This bug does not happen if the subsamplingLevel is zero because we cache
3021         the returned value in a static NeverDestroyed<RetainPtr<CFDictionaryRef> in
3022         imageSourceOptions(). This cache prevents the CFDictionaryRef from being
3023         freed in ImageDecoder::createFrameImageAtIndex() no matter where CFRelease()
3024         is called.
3025
3026         The fix is hold the returned value in a RetainPtr<CFDictionaryRef>. This
3027         will ensure the CFDictionaryRef raw pointer is valid till the end of
3028         ImageDecoder::createFrameImageAtIndex().
3029
3030         * platform/graphics/cg/ImageDecoderCG.cpp:
3031         (WebCore::ImageDecoder::createFrameImageAtIndex): Ensure the pointer is retained.
3032
3033 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
3034
3035         [Win][Direct2D] Add transparency layer support
3036         https://bugs.webkit.org/show_bug.cgi?id=164614
3037
3038         Reviewed by Dean Jackson.
3039
3040         Provide a stackable implementation of transparency layers so that
3041         multiple layers with opacity draw propery.
3042
3043         Tested by fast/layers/opacity-stacking.html and others.
3044
3045         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3046         (WebCore::GraphicsContext::platformContext): Remove unneeded assertion.
3047         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Return current context taking
3048         into account the presence of transparency layers.
3049         (WebCore::GraphicsContextPlatformPrivate::setAlpha): Added.
3050         (WebCore::GraphicsContextPlatformPrivate::currentGlobalAlpha): Get current global
3051         alpha for current layer.
3052         (WebCore::GraphicsContext::colorWithGlobalAlpha): Compute proper color taking into
3053         account the current layer.
3054         (WebCore::drawWithShadowHelper): Helper function to share code.
3055         (WebCore::GraphicsContext::drawWithShadow): Use new helper function.
3056         (WebCore::GraphicsContextPlatformPrivate::beginTransparencyLayer): Added.
3057         (WebCore::GraphicsContext::beginPlatformTransparencyLayer): Call new implementation.
3058         (WebCore::GraphicsContextPlatformPrivate::endTransparencyLayer): Added.
3059         (WebCore::GraphicsContext::endPlatformTransparencyLayer): Call new implementation.
3060         (WebCore::GraphicsContext::clearRect): Clear to transparent color.
3061         (WebCore::GraphicsContext::setPlatformAlpha): Pass new alpha on to any active
3062         transparency layer.
3063         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
3064         (WebCore::GraphicsContextPlatformPrivate::renderTarget): Deleted.
3065
3066 2016-11-10  Dean Jackson  <dino@apple.com>
3067
3068         Add CSS Color Level 4 to features.
3069
3070         * features.json:
3071
3072 2016-11-10  Zalan Bujtas  <zalan@apple.com>
3073
3074         Move update image calls to RenderElement::styleDidChange.
3075         https://bugs.webkit.org/show_bug.cgi?id=164623
3076
3077         Reviewed by Simon Fraser.
3078
3079         There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.
3080
3081         Covered by existing tests.
3082
3083         * rendering/RenderElement.cpp:
3084         (WebCore::RenderElement::initializeStyle):
3085         (WebCore::RenderElement::setStyle):
3086         (WebCore::RenderElement::styleDidChange):
3087
3088 2016-11-10  Joseph Pecoraro  <pecoraro@apple.com>
3089
3090         After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
3091         https://bugs.webkit.org/show_bug.cgi?id=164621
3092
3093         Reviewed by Youenn Fablet.
3094
3095         * inspector/InspectorPageAgent.cpp:
3096         (WebCore::InspectorPageAgent::cachedResource):
3097         CachedResourceLoader expects a sanitized URL.
3098
3099 2016-11-10  Brady Eidson  <beidson@apple.com>
3100
3101         IndexedDB 2.0 Support the IDBDatabase.onclose event.
3102         https://bugs.webkit.org/show_bug.cgi?id=164602
3103
3104         Reviewed by Alex Christensen.
3105
3106         No new tests (Covered by existing tests).
3107
3108         * Modules/indexeddb/IDBDatabase.cpp:
3109         (WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
3110         * Modules/indexeddb/IDBDatabase.idl:
3111
3112 2016-11-10  Ryosuke Niwa  <rniwa@webkit.org>
3113
3114         Copied text would contain text inside CDATA sections and comments
3115         https://bugs.webkit.org/show_bug.cgi?id=164578
3116         <rdar://problem/19834542>
3117
3118         Reviewed by Darin Adler.
3119
3120         The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
3121         Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.
3122
3123         In the long term, we should check the visibility of the text as done in MarkupAccumulator.
3124
3125         Test: editing/mac/attributed-string/comment-cdata-section.html
3126
3127         * editing/cocoa/HTMLConverter.mm:
3128         (HTMLConverter::_traverseNode):
3129
3130 2016-11-10  Eric Carlson  <eric.carlson@apple.com>
3131
3132         [MediaStream] apply constraints passed to getUserMedia()
3133         https://bugs.webkit.org/show_bug.cgi?id=164561
3134
3135         Reviewed by Youenn Fablet.
3136         <rdar://problem/29191384>
3137
3138         No new tests, updated existing tests.
3139
3140         * Modules/mediastream/UserMediaRequest.cpp:
3141         (WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying
3142           them after the stream has been created.
3143
3144         * WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h.
3145
3146         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3147         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert.
3148         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream
3149           that is receiving media data is as ready as it will ever be so it's readyState should be
3150           at HAVE_ENOUGH_DATA.
3151
3152         Simplify CaptureDeviceManager by removing all code for constraint validation because some
3153         constraints can't be validated without a live capture device. Ports that are able to resolve
3154         constraints without creating a live source can do so in a derived capture device class.
3155         * platform/mediastream/CaptureDeviceManager.cpp:
3156         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list
3157           of live sources, because that is all the caller will use. This will allows ports to avoid
3158           source creation in some cases.
3159         (CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid
3160           constraint.
3161         (CaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
3162         (CaptureDeviceManager::bestDeviceForFacingMode): Deleted.
3163         (facingModeFromString): Deleted.
3164         (CaptureDeviceManager::sessionSupportsConstraint): Deleted.
3165         (CaptureDeviceManager::isSupportedFrameRate): Deleted.
3166         * platform/mediastream/CaptureDeviceManager.h:
3167         (WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted.
3168
3169         * platform/mediastream/MediaConstraints.cpp:
3170         (WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints.
3171         * platform/mediastream/MediaConstraints.h:
3172         (WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints.
3173         (WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a 
3174           capability range.
3175         (WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map.
3176         (WebCore::MediaTrackConstraintSetMap::height):
3177         (WebCore::MediaTrackConstraintSetMap::sampleRate):
3178         (WebCore::MediaTrackConstraintSetMap::sampleSize):
3179         (WebCore::MediaTrackConstraintSetMap::aspectRatio):
3180         (WebCore::MediaTrackConstraintSetMap::frameRate):
3181         (WebCore::MediaTrackConstraintSetMap::volume):
3182         (WebCore::MediaTrackConstraintSetMap::echoCancellation):
3183         (WebCore::MediaTrackConstraintSetMap::facingMode):
3184         (WebCore::MediaTrackConstraintSetMap::deviceId):
3185         (WebCore::MediaTrackConstraintSetMap::groupId):
3186
3187         Resolve and apply width, height, and frameRate all at once because the ability to support
3188         one may depend on the value of another.
3189         * platform/mediastream/RealtimeMediaSource.cpp:
3190         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 
3191         (WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange.
3192         (WebCore::RealtimeMediaSource::applySizeAndFrameRate):
3193         (WebCore::RealtimeMediaSource::selectSettings):
3194         (WebCore::RealtimeMediaSource::supportsConstraints):
3195         (WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas.
3196         * platform/mediastream/RealtimeMediaSource.h:
3197
3198         * platform/mediastream/RealtimeMediaSourceCenter.h:
3199         * platform/mediastream/mac/AVAudioCaptureSource.h:
3200         * platform/mediastream/mac/AVAudioCaptureSource.mm:
3201         (WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints.
3202         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto.
3203
3204         Remove all constraint validation code, it is done by the audio and video capture sources. Add
3205         support for stream creation constraints.
3206         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3207         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3208         (WebCore::AVCaptureDeviceManager::captureDeviceList):
3209         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
3210         (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
3211         (WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted.
3212         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
3213         (WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted.
3214         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted.
3215         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted.
3216         (WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted.
3217
3218         * platform/mediastream/mac/AVMediaCaptureSource.h:
3219         (WebCore::AVMediaCaptureSource::constraints): Deleted.
3220         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3221         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
3222         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource):
3223         (WebCore::AVMediaCaptureSource::startProducingData):
3224         (WebCore::AVMediaCaptureSource::stopProducingData):
3225         (WebCore::AVMediaCaptureSource::beginConfiguration):
3226         (WebCore::AVMediaCaptureSource::commitConfiguration):
3227         (WebCore::AVMediaCaptureSource::capabilities):
3228         (WebCore::AVMediaCaptureSource::setupSession):
3229         (WebCore::AVMediaCaptureSource::reset):
3230
3231         Validate and apply constraints, support source creation constraints, initialize capabilities
3232         and supported constraints by examining device capabilities.
3233         * platform/mediastream/mac/AVVideoCaptureSource.h:
3234         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3235         (WebCore::AVVideoCaptureSource::create):
3236         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
3237         (WebCore::updateSizeMinMax):
3238         (WebCore::updateAspectRatioMinMax):
3239         (WebCore::AVVideoCaptureSource::initializeCapabilities):
3240         (WebCore::AVVideoCaptureSource::initializeSupportedConstraints):
3241         (WebCore::AVVideoCaptureSource::applySize):
3242         (WebCore::AVVideoCaptureSource::setPreset):
3243         (WebCore::AVVideoCaptureSource::applyFrameRate):
3244         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
3245         (WebCore::AVVideoCaptureSource::setupCaptureSession):
3246         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
3247         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
3248         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate):
3249
3250         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
3251         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3252         (WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they
3253           can not be applied successfully.
3254         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
3255         (WebCore::MockRealtimeVideoSource::createMuted):
3256
3257         Update RealtimeMediaSourceCenters for API changes.
3258         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3259         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
3260         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
3261         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3262         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
3263         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
3264         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
3265         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
3266         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
3267
3268         Mock media sources support constraint validation and application directly so "mock constraints"
3269         are no longer necessary.
3270         * platform/mock/MediaConstraintsMock.cpp: Removed.
3271         * platform/mock/MediaConstraintsMock.h: Removed.
3272         * platform/mock/MockRealtimeAudioSource.cpp:
3273         (WebCore::MockRealtimeAudioSource::create):
3274         (WebCore::MockRealtimeAudioSource::createMuted):
3275         (WebCore::MockRealtimeAudioSource::updateSettings):
3276         (WebCore::MockRealtimeAudioSource::initializeCapabilities):
3277         (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints):
3278         * platform/mock/MockRealtimeAudioSource.h:
3279         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
3280         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
3281         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
3282         * platform/mock/MockRealtimeMediaSourceCenter.h:
3283         * platform/mock/MockRealtimeVideoSource.cpp:
3284         (WebCore::MockRealtimeVideoSource::create):
3285         (WebCore::MockRealtimeVideoSource::createMuted):
3286         * platform/mock/MockRealtimeVideoSource.h:
3287         * platform/mock/RTCPeerConnectionHandlerMock.cpp:
3288
3289 2016-11-10  Alex Christensen  <achristensen@webkit.org>
3290
3291         Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
3292         https://bugs.webkit.org/show_bug.cgi?id=164573
3293
3294         Reviewed by Brady Eidson.
3295
3296         No change in behavior.
3297
3298         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3299         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
3300         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
3301         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
3302         * Modules/indexeddb/server/IDBServer.cpp:
3303         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
3304         * Modules/webdatabase/DatabaseTracker.cpp:
3305         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
3306         (WebCore::DatabaseTracker::hasEntryForDatabase):
3307         (WebCore::DatabaseTracker::originPath):
3308         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
3309         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
3310         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
3311         (WebCore::DatabaseTracker::setDatabaseDetails):
3312         (WebCore::DatabaseTracker::originLockFor):
3313         (WebCore::DatabaseTracker::deleteOriginLockFor):
3314         (WebCore::DatabaseTracker::quotaForOriginNoLock):
3315         (WebCore::DatabaseTracker::setQuota):
3316         (WebCore::DatabaseTracker::addDatabase):
3317         (WebCore::DatabaseTracker::deleteOrigin):
3318         (WebCore::DatabaseTracker::deleteDatabase):
3319         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
3320         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
3321         (WebCore::getDatabaseIdentifier):
3322         * dom/Document.cpp:
3323         (WebCore::Document::origin):
3324         * html/HTMLMediaElement.cpp:
3325         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
3326         * loader/appcache/ApplicationCacheStorage.cpp:
3327         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
3328         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
3329         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
3330         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
3331         (WebCore::ApplicationCacheStorage::store):
3332         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
3333         * page/SecurityOrigin.cpp:
3334         (WebCore::SecurityOrigin::databaseIdentifier): Deleted.
3335         * page/SecurityOrigin.h:
3336         * page/SecurityOriginData.cpp:
3337         (WebCore::SecurityOriginData::databaseIdentifier):
3338         * page/SecurityOriginData.h:
3339
3340 2016-11-10  Zalan Bujtas  <zalan@apple.com>
3341
3342         RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock.
3343         https://bugs.webkit.org/show_bug.cgi?id=164601
3344
3345         Reviewed by Simon Fraser.
3346
3347         FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement.
3348         Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock.
3349
3350         No change in functionality.
3351
3352         * rendering/RenderBlock.cpp:
3353         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
3354         * rendering/RenderBlock.h:
3355         * rendering/RenderElement.cpp:
3356         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
3357         * rendering/RenderElement.h:
3358         * rendering/RenderInline.cpp:
3359         (WebCore::RenderInline::splitInlines):
3360
3361 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
3362
3363         Local file restrictions should not block sessionStorage access.
3364         https://bugs.webkit.org/show_bug.cgi?id=155609
3365         <rdar://problem/25229461> 
3366
3367         Reviewed by Andy Estes.
3368
3369         Re-landing this fix that was lost when the localStorage change was rolled out.
3370
3371         Use of 'sessionStorage' is governed by SecurityOrigin with third party access
3372         set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not
3373         reject local files for this combination of arguments.
3374
3375         Tested by storage/domstorage/sessionstorage/blocked-file-access.html.
3376
3377         * page/SecurityOrigin.cpp:
3378         (WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage,
3379         allow local file access.
3380
3381 2016-11-10  Daniel Bates  <dabates@apple.com>
3382
3383         REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
3384         process after receiving HTTP 0.9 response
3385         https://bugs.webkit.org/show_bug.cgi?id=164387
3386         <rdar://problem/28987537>
3387
3388         Reviewed by Brent Fulgham.
3389
3390         Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same
3391         WebContent process.
3392
3393         Currently when an HTTP 0.9 response is received for a request made to a default port
3394         (e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that
3395         disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore,
3396         the sandbox policy applied to one site may be applied to another site. Moreover the
3397         sandbox policy was applied to the FrameLoader of the main resource regardless of whether
3398         the HTTP response was for a subresource. Instead we should apply the sandbox on a per-
3399         Document basis and only if we receive an HTTP 0.9 response for the document when the
3400         corresponding HTTP request was made to a default port.
3401
3402         As a side benefit of this change, we emit exactly one console message to Web Inspector
3403         when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages.
3404         Moreover, we only emit this console message when the document load is not blocked.
3405
3406         Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html
3407
3408         * dom/Document.cpp:
3409         (WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9
3410         response was received for this document. Note that if this function is called for a
3411         document associated with an HTTP 0.9 response then the corresponding HTTP request was
3412         made to a default port. DocumentLoader::responseReceived() blocks the load for a document
3413         with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port.
3414         This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html.
3415         (WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response
3416         was received for this document.
3417         * dom/Document.h:
3418         * loader/DocumentLoader.cpp:
3419         (WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the
3420         FrameLoader associated with the main resource. We will apply the sandbox during initialization
3421         of the document.
3422         * loader/ResourceLoader.cpp:
3423         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
3424         * loader/SubresourceLoader.cpp:
3425         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
3426
3427 2016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
3428
3429         Update SubtleCrypto::importKey to match the latest spec
3430         https://bugs.webkit.org/show_bug.cgi?id=164446
3431         <rdar://problem/29123621>
3432
3433         Reviewed by Brent Fulgham.
3434
3435         This patch does following few things:
3436         1. It updates the SubtleCrypto::importKey method to match the latest spec:
3437            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
3438            It also refers to the latest Editor's Draft at a certain degree:
3439            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
3440         2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
3441            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
3442         3. It fixes some minor problems of SubtleCrypto::generateKey.
3443         4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
3444            CryptoKeyDataRSAComponents.
3445         5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
3446            HmacKeyGenParams and HmacImportParams which are essentially the same.
3447         6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
3448         7. It also fixes the following bugs:
3449            https://bugs.webkit.org/show_bug.cgi?id=126033,
3450            https://bugs.webkit.org/show_bug.cgi?id=126034,
3451            https://bugs.webkit.org/show_bug.cgi?id=151308.
3452         P.S. We currently only support Raw and Jwk key format.
3453
3454         Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
3455                crypto/subtle/aes-cbc-import-jwk-key-length-192.html
3456                crypto/subtle/aes-cbc-import-jwk-key-length-256.html
3457                crypto/subtle/aes-cbc-import-jwk-key-minimum.html
3458                crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
3459                crypto/subtle/aes-cbc-import-raw-key-length-128.html
3460                crypto/subtle/aes-cbc-import-raw-key-length-192.html
3461                crypto/subtle/aes-cbc-import-raw-key-length-256.html
3462                crypto/subtle/aes-import-key-malformed-parameters.html
3463                crypto/subtle/aes-kw-import-jwk-key-length-128.html
3464                crypto/subtle/aes-kw-import-jwk-key-length-192.html
3465                crypto/subtle/aes-kw-import-jwk-key-length-256.html
3466                crypto/subtle/aes-kw-import-raw-key.html
3467                crypto/subtle/generate-key-malformed-parameters.html
3468                crypto/subtle/hmac-import-jwk-key-minimum.html
3469                crypto/subtle/hmac-import-jwk-key-non-extractable.html
3470                crypto/subtle/hmac-import-jwk-key-sha1.html
3471                crypto/subtle/hmac-import-jwk-key-sha224.html
3472                crypto/subtle/hmac-import-jwk-key-sha256.html
3473                crypto/subtle/hmac-import-jwk-key-sha384.html
3474                crypto/subtle/hmac-import-jwk-key-sha512.html
3475                crypto/subtle/hmac-import-malformed-parameters.html
3476                crypto/subtle/hmac-import-raw-key-customized-length.html
3477                crypto/subtle/hmac-import-raw-key.html
3478                crypto/subtle/import-key-malformed-parameters.html
3479                crypto/subtle/rsa-import-key-malformed-parameters.html
3480                crypto/subtle/rsa-oaep-import-jwk-private-key.html
3481                crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
3482                crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
3483                crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
3484                crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
3485                crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
3486                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
3487                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
3488                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
3489                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
3490                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
3491                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
3492                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
3493                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
3494                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
3495                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
3496                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
3497                crypto/workers/subtle/aes-import-jwk-key.html
3498                crypto/workers/subtle/aes-import-raw-key.html
3499                crypto/workers/subtle/hmac-import-jwk-key.html
3500                crypto/workers/subtle/hmac-import-raw-key.html
3501                crypto/workers/subtle/rsa-import-jwk-private-key.html
3502                crypto/workers/subtle/rsa-import-jwk-public-key.html
3503
3504         * CMakeLists.txt:
3505         * DerivedSources.make:
3506         * PlatformEfl.cmake:
3507         * PlatformGTK.cmake:
3508         * PlatformMac.cmake:
3509         * WebCore.xcodeproj/project.pbxproj:
3510         * bindings/js/JSSubtleCryptoCustom.cpp:
3511         (WebCore::normalizeCryptoAlgorithmParameters):
3512         (WebCore::cryptoKeyUsageFromString):
3513         (WebCore::cryptoKeyUsagesFromJSValue):
3514         (WebCore::toKeyData):
3515         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
3516         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
3517         (WebCore::JSSubtleCrypto::importKey):
3518         * crypto/CryptoAlgorithm.cpp:
3519         (WebCore::CryptoAlgorithm::importKey):
3520         * crypto/CryptoAlgorithm.h:
3521         * crypto/CryptoAlgorithmParameters.h:
3522         * crypto/JsonWebKey.h: Added.
3523         * crypto/JsonWebKey.idl: Added.
3524         * crypto/RsaOtherPrimesInfo.h: Added.
3525         * crypto/RsaOtherPrimesInfo.idl: Added.
3526         * crypto/SubtleCrypto.h:
3527         * crypto/SubtleCrypto.idl:
3528         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
3529         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
3530         (WebCore::CryptoAlgorithmAES_CBC::importKey):
3531         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
3532         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
3533         (WebCore::CryptoAlgorithmAES_KW::generateKey):
3534         (WebCore::CryptoAlgorithmAES_KW::importKey):
3535         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
3536         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
3537         (WebCore::CryptoAlgorithmHMAC::generateKey):
3538         (WebCore::CryptoAlgorithmHMAC::importKey):
3539         * crypto/algorithms/CryptoAlgorithmHMAC.h:
3540         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
3541         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
3542         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
3543         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
3544         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
3545         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
3546         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
3547         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
3548         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
3549         * crypto/keys/CryptoKeyAES.cpp:
3550         (WebCore::CryptoKeyAES::CryptoKeyAES):
3551         (WebCore::CryptoKeyAES::generate):
3552         (WebCore::CryptoKeyAES::importRaw):
3553         (WebCore::CryptoKeyAES::importJwk):
3554         * crypto/keys/CryptoKeyAES.h:
3555         * crypto/keys/CryptoKeyDataRSAComponents.cpp:
3556         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
3557         * crypto/keys/CryptoKeyDataRSAComponents.h:
3558         * crypto/keys/CryptoKeyHMAC.cpp:
3559         (WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
3560         (WebCore::CryptoKeyHMAC::generate):
3561         (WebCore::CryptoKeyHMAC::importRaw):
3562         (WebCore::CryptoKeyHMAC::importJwk):
3563         (WebCore::CryptoKeyHMAC::buildAlgorithm):
3564         * crypto/keys/CryptoKeyHMAC.h:
3565         * crypto/keys/CryptoKeyRSA.cpp: Added.
3566         (WebCore::CryptoKeyRSA::importJwk):
3567         * crypto/keys/CryptoKeyRSA.h:
3568         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
3569         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
3570         * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
3571         * crypto/parameters/RsaHashedImportParams.idl: Added.
3572
3573 2016-11-10  Brady Eidson  <beidson@apple.com>
3574
3575         IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
3576         https://bugs.webkit.org/show_bug.cgi?id=164596
3577
3578         Reviewed by Eric Carlson.
3579
3580         No new tests (Covered by existing tests).
3581
3582         We can't just WTFMove the pointers from the deleted-IDBObject maps...
3583         We need to remove the entries, too.
3584
3585         * Modules/indexeddb/IDBObjectStore.cpp:
3586         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3587
3588         * Modules/indexeddb/IDBTransaction.cpp:
3589         (WebCore::IDBTransaction::internalAbort):
3590
3591 2016-11-10  Youenn Fablet  <youennf@gmail.com>
3592
3593         MediaStreamTrack should use more Ref<> and less RefPtr<>
3594         https://bugs.webkit.org/show_bug.cgi?id=164560
3595
3596         Reviewed by Eric Carlson.
3597
3598         No change of behavior.
3599
3600         Make MediaStreamTrack take a Ref<>& instead of a reference.
3601         Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate.
3602         Updating constness of some methods accordingly.
3603
3604         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3605         (WebCore::MediaEndpointPeerConnection::createReceiver):
3606         * Modules/mediastream/MediaStreamTrack.cpp:
3607         (WebCore::MediaStreamTrack::create):
3608         (WebCore::MediaStreamTrack::MediaStreamTrack):
3609         (WebCore::MediaStreamTrack::clone):
3610         * Modules/mediastream/MediaStreamTrack.h:
3611         * Modules/webaudio/MediaStreamAudioSource.cpp:
3612         (WebCore::MediaStreamAudioSource::capabilities):
3613         (WebCore::MediaStreamAudioSource::settings):
3614         * Modules/webaudio/MediaStreamAudioSource.h:
3615         * platform/mediastream/MediaEndpoint.cpp:
3616         * platform/mediastream/MediaStreamPrivate.cpp:
3617         (WebCore::MediaStreamPrivate::create):
3618         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3619         (WebCore::MediaStreamTrackPrivate::create):
3620         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
3621         (WebCore::MediaStreamTrackPrivate::clone):
3622         * platform/mediastream/MediaStreamTrackPrivate.h:
3623         (WebCore::MediaStreamTrackPrivate::setMuted):
3624         (WebCore::MediaStreamTrackPrivate::source):
3625         * platform/mediastream/RealtimeMediaSource.h:
3626         * platform/mediastream/mac/AVMediaCaptureSource.h:
3627         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3628         (WebCore::AVMediaCaptureSource::initializeSettings):
3629         (WebCore::AVMediaCaptureSource::settings):
3630         (WebCore::AVMediaCaptureSource::initializeCapabilities):
3631         (WebCore::AVMediaCaptureSource::capabilities):
3632         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3633         (WebCore::RealtimeMediaSourceOwr::capabilities):
3634         (WebCore::RealtimeMediaSourceOwr::settings):
3635         * platform/mock/MockRealtimeMediaSource.cpp:
3636         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
3637         (WebCore::MockRealtimeMediaSource::capabilities):
3638         (WebCore::MockRealtimeMediaSource::initializeSettings):
3639         (WebCore::MockRealtimeMediaSource::settings):
3640         * platform/mock/MockRealtimeMediaSource.h:
3641
3642 2016-11-10  Per Arne Vollan  <pvollan@apple.com>
3643
3644         [Win32] Crash in layout tests.
3645         https://bugs.webkit.org/show_bug.cgi?id=164411
3646
3647         Reviewed by Mark Lam.
3648
3649         Use the calling convention expected by the callers of the generated functions.
3650
3651         * bindings/scripts/CodeGeneratorJS.pm:
3652         (GenerateImplementation):
3653         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3654         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
3655         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
3656         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
3657         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
3658         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):
3659
3660 2016-11-10  Aaron Chu  <aaron_chu@apple.com>
3661
3662         Web Inspector: AXI: clarify button roles (e.g. toggle or popup button)
3663         https://bugs.webkit.org/show_bug.cgi?id=130726
3664         <rdar://problem/16420420>
3665
3666         Reviewed by Brian Burg.
3667
3668         Test: accessibility/ax-differentiate-button-types.html
3669
3670         Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role.
3671         Added an "isPopUpButton" property to be exposed to the Inspector's use.
3672
3673         * accessibility/AccessibilityObject.cpp:
3674         (WebCore::AccessibilityObject::computedRoleString):
3675         * inspector/InspectorDOMAgent.cpp:
3676         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3677
3678 2016-11-10  Zan Dobersek  <zdobersek@igalia.com>
3679
3680         [EME] Add no-op Web-facing APIs
3681         https://bugs.webkit.org/show_bug.cgi?id=164028
3682
3683         Reviewed by Jer Noble.
3684
3685         Add no-op implementation of the Web-facing APIs as defined in
3686         the EME specification. This will be the basis for implementing
3687         the various algorithms the same specification defines, and for
3688         implementing the relevant platform abstractions.
3689
3690         Dictionaries and enumerations defined by the specification are
3691         defined in separate headers, and not in the implementation files
3692         for the class where they are used. This will ease their use
3693         across different implementation files.
3694
3695         BufferSource now exposes the Variant object it holds. This is
3696         needed to support the iterable property on the MediaKeyStatusMap
3697         class.
3698
3699         CodeGeneratorJS is fixed to support JS-to-native conversion of
3700         sequences of dictionaries.
3701
3702         * CMakeLists.txt:
3703         * DerivedSources.cpp:
3704         * DerivedSources.make:
3705         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added.
3706         (WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent):
3707         (WebCore::MediaKeyMessageEvent::eventInterface):
3708         * Modules/encryptedmedia/MediaKeyMessageEvent.h: Added.
3709         * Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added.
3710         * Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added.
3711         (WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit):
3712         * Modules/encryptedmedia/MediaKeyMessageType.h: Added.
3713         * Modules/encryptedmedia/MediaKeySession.cpp: Added.
3714         (WebCore::MediaKeySession::create):
3715         (WebCore::MediaKeySession::MediaKeySession):
3716         (WebCore::MediaKeySession::sessionId):
3717         (WebCore::MediaKeySession::expiration):
3718         (WebCore::MediaKeySession::keyStatuses):
3719         (WebCore::MediaKeySession::generateRequest):
3720         (WebCore::MediaKeySession::load):
3721         (WebCore::MediaKeySession::update):
3722         (WebCore::MediaKeySession::close):
3723         (WebCore::MediaKeySession::remove):
3724         (WebCore::MediaKeySession::hasPendingActivity):
3725         (WebCore::MediaKeySession::activeDOMObjectName):
3726         (WebCore::MediaKeySession::canSuspendForDocumentSuspension):
3727         (WebCore::MediaKeySession::stop):
3728         * Modules/encryptedmedia/MediaKeySession.h: Added.
3729         * Modules/encryptedmedia/MediaKeySession.idl: Added.
3730         * Modules/encryptedmedia/MediaKeySessionType.h: Added.
3731         * Modules/encryptedmedia/MediaKeyStatus.h: Added.
3732         * Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added.
3733         (WebCore::MediaKeyStatusMap::size):
3734         (WebCore::MediaKeyStatusMap::has):
3735         (WebCore::MediaKeyStatusMap::get):
3736         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
3737         (WebCore::MediaKeyStatusMap::Iterator::next):
3738         * Modules/encryptedmedia/MediaKeyStatusMap.h: Added.
3739         (WebCore::MediaKeyStatusMap::create):
3740         (WebCore::MediaKeyStatusMap::createIterator):
3741         * Modules/encryptedmedia/MediaKeyStatusMap.idl: Added.
3742         * Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added.
3743         (WebCore::MediaKeySystemAccess::keySystem):
3744         (WebCore::MediaKeySystemAccess::getConfiguration):
3745         (WebCore::MediaKeySystemAccess::createMediaKeys):
3746         * Modules/encryptedmedia/MediaKeySystemAccess.h: Added.
3747         (WebCore::MediaKeySystemAccess::create):
3748         * Modules/encryptedmedia/MediaKeySystemAccess.idl: Added.
3749         * Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added.
3750         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added.
3751         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added.
3752         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added.
3753         * Modules/encryptedmedia/MediaKeys.cpp: Added.
3754         (WebCore::MediaKeys::createSession):
3755         (WebCore::MediaKeys::setServerCertificate):
3756         * Modules/encryptedmedia/MediaKeys.h: Added.
3757         (WebCore::MediaKeys::create):
3758         * Modules/encryptedmedia/MediaKeys.idl: Added.
3759         * Modules/encryptedmedia/MediaKeysRequirement.h: Added.
3760         * Modules/encryptedmedia/NavigatorEME.cpp: Added.
3761         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
3762         * Modules/encryptedmedia/NavigatorEME.h: Added.
3763         * Modules/encryptedmedia/NavigatorEME.idl: Added.
3764         * WebCore.xcodeproj/project.pbxproj:
3765         * bindings/js/BufferSource.h:
3766         (WebCore::BufferSource::BufferSource):
3767         (WebCore::BufferSource::variant):
3768         * bindings/js/JSMediaKeySessionCustom.cpp: Added.
3769         (WebCore::JSMediaKeySession::closed):
3770         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Added.
3771         (WebCore::JSMediaKeySystemAccess::getConfiguration):
3772         * bindings/scripts/CodeGeneratorJS.pm:
3773         (GetNativeVectorInnerType):
3774         * dom/EventNames.h:
3775         * dom/EventNames.in:
3776         * dom/EventTargetFactory.in:
3777         * html/HTMLMediaElement.cpp:
3778         (WebCore::HTMLMediaElement::mediaKeys):
3779         (WebCore::HTMLMediaElement::setMediaKeys):
3780         * html/HTMLMediaElement.h:
3781         * html/HTMLMediaElement.idl:
3782         * html/MediaEncryptedEvent.cpp: Added.
3783         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
3784         (WebCore::MediaEncryptedEvent::eventInterface):
3785         (WebCore::MediaEncryptedEvent::initDataType):
3786         (WebCore::MediaEncryptedEvent::initData):
3787         * html/MediaEncryptedEvent.h: Added.
3788         * html/MediaEncryptedEvent.idl: Added.
3789         * html/MediaEncryptedEventInit.h: Added.
3790         (WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit):
3791
3792 2016-11-10  Antoine Quint  <graouts@apple.com>
3793
3794         [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
3795         https://bugs.webkit.org/show_bug.cgi?id=164554
3796         <rdar://problem/29183439>
3797
3798         Reviewed by Dean Jackson.
3799
3800         When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
3801         To facilitate this, support objects are created and destroyed when changing the controls in order for the
3802         right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
3803         subclasses can be overridden to remove event listeners added by support objects in their constructor.
3804
3805         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html
3806
3807         * Modules/modern-media-controls/media/fullscreen-support.js:
3808         (FullscreenSupport.prototype.destroy):
3809         * Modules/modern-media-controls/media/media-controller-support.js:
3810         (MediaControllerSupport.prototype.destroy):
3811         * Modules/modern-media-controls/media/media-controller.js:
3812         (MediaController):
3813         (MediaController.prototype.get layoutTraits):
3814         (MediaController.prototype.handleEvent):
3815         (MediaController.prototype._updateControlsIfNeeded):
3816         (MediaController.prototype._controlsClass):
3817
3818 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
3819
3820         [Linux] Memory values shown by memory pressure handler logger are not useful
3821         https://bugs.webkit.org/show_bug.cgi?id=164589
3822
3823         Reviewed by Michael Catanzaro.
3824
3825         We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
3826         and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
3827         time we see that there's no changes in memory usage in the logs.
3828         We should use the actual memory used by the process, memory that the process can release and then it's relevant
3829         for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
3830         (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
3831         different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
3832         multiply by the size of the page.
3833         This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
3834         memory sampler that is incorrectly parsing /proc/self/statm.
3835
3836         * platform/Linux.cmake: Add new files to compilation.
3837         * platform/linux/CurrentProcessMemoryStatus.cpp: Added.
3838         (WebCore::systemPageSize): Return the page size.
3839         (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
3840         * platform/linux/CurrentProcessMemoryStatus.h: Added.
3841         * platform/linux/MemoryPressureHandlerLinux.cpp:
3842         (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
3843         in bytes.
3844         (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().
3845
3846 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
3847
3848         MemoryPressureHandler shouldn't know how to release WebCore memory
3849         https://bugs.webkit.org/show_bug.cgi?id=160497
3850
3851         Reviewed by Michael Catanzaro.
3852
3853         All processes should set their own low memory handler, instead of leaving the web process using the default one
3854         that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
3855         MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
3856         WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.
3857
3858         * CMakeLists.txt: Add new files to compilation.
3859         * PlatformMac.cmake: Ditto.
3860         * WebCore.xcodeproj/project.pbxproj: Ditto.
3861         * loader/FrameLoader.cpp:
3862         (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
3863         * page/MemoryRelease.cpp: Added.
3864         (WebCore::releaseNoncriticalMemory):
3865         (WebCore::releaseCriticalMemory):
3866         (WebCore::releaseMemory):
3867         (WebCore::platformReleaseMemory):
3868         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
3869         (WebCore::registerMemoryReleaseNotifyCallbacks):
3870         * page/MemoryRelease.h: Added.
3871         * page/cocoa/MemoryReleaseCocoa.mm: Added.
3872         (WebCore::platformReleaseMemory):
3873         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
3874         (WebCore::registerMemoryReleaseNotifyCallbacks):
3875         * platform/MemoryPressureHandler.cpp:
3876         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
3877         (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
3878         (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
3879         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
3880         * platform/MemoryPressureHandler.h:
3881         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
3882         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
3883         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
3884         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
3885         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
3886         * platform/linux/MemoryPressureHandlerLinux.cpp:
3887         * platform/win/MemoryPressureHandlerWin.cpp:
3888         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
3889
3890 2016-11-08  Sergio Villar Senin  <svillar@igalia.com>
3891
3892         [css-grid] Fix fr tracks sizing under min|max-size constraints
3893         https://bugs.webkit.org/show_bug.cgi?id=150674
3894
3895         Reviewed by Darin Adler.
3896
3897         The min|max-sizes must be used to compute the flex fraction for indefinite free
3898         spaces. According to the spec "If using this flex fraction would cause the grid to be
3899         smaller than the grid container’s min-width/height (or larger than the grid container’s
3900         max-width/height), then redo this step, treating the free space as definite and the
3901         available grid space as equal to the grid container’s content box size when it’s sized to
3902         its min-width/height (max-width/height)."
3903
3904         This only affects indefinite heights because during layout both definite sizes and any kind
3905         of widths are properly constrained by min|max-width restrictions.
3906
3907         Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
3908                fast/css-grid-layout/flex-sizing-rows-min-max-height.html
3909
3910         * rendering/RenderGrid.cpp:
3911         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
3912         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
3913         * rendering/RenderGrid.h:
3914
3915 2016-11-10  Alejandro G. Castro  <alex@igalia.com>
3916
3917         [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
3918         https://bugs.webkit.org/show_bug.cgi?id=164541
3919
3920         Reviewed by Philippe Normand.
3921
3922         Fixed typo in refactoring.
3923
3924         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
3925         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
3926
3927 2016-11-08  Philippe Normand  <pnormand@igalia.com>
3928
3929         [WebRTC] white-list turns urls from the RTCConfiguration
3930         https://bugs.webkit.org/show_bug.cgi?id=164506
3931
3932         Reviewed by Alejandro G. Castro.
3933
3934         * Modules/mediastream/RTCConfiguration.cpp:
3935         (WebCore::validateIceServerURL): Add the turns URL scheme to the
3936         list of supported relay and signaling server protocols.
3937
3938 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
3939
3940         Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
3941         https://bugs.webkit.org/show_bug.cgi?id=161951
3942         <rdar://problem/28295767>