Cleanup WK2 platform gamepad handling.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-08-16  Brady Eidson  <beidson@apple.com>
2
3         Cleanup WK2 platform gamepad handling.
4         https://bugs.webkit.org/show_bug.cgi?id=160871
5
6         Reviewed by Alex Christensen.
7
8         No new tests (No currently testable change in behavior).
9
10         This patch does a few things:
11         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
12         2 - Uses this new concept to much more cleanly handle the case where we are not currently
13             monitoring gamepad inputs because an interested WKWebView is not front and center.
14         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
15
16         * platform/gamepad/GamepadProviderClient.h:
17         (WebCore::GamepadProviderClient::setInitialConnectedGamepads):
18
19         * platform/gamepad/mac/HIDGamepadProvider.cpp:
20         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
21         (WebCore::HIDGamepadProvider::stopMonitoringInput):
22         (WebCore::HIDGamepadProvider::startMonitoringInput):
23         (WebCore::HIDGamepadProvider::connectionDelayTimerFired):
24         * platform/gamepad/mac/HIDGamepadProvider.h:
25
26 2016-08-16  Chris Dumez  <cdumez@apple.com>
27
28         querySelector() / querySelectorAll() should always throw a SyntaxError when failing to parse selector string
29         https://bugs.webkit.org/show_bug.cgi?id=160906
30
31         Reviewed by Ryosuke Niwa.
32
33         querySelector() / querySelectorAll() should always throw a SyntaxError
34         when failing to parse selector string:
35         - https://dom.spec.whatwg.org/#dom-parentnode-queryselector
36         - https://dom.spec.whatwg.org/#scope-match-a-selectors-string
37
38         In some cases, WebKit was throwing a NamespaceError instead.
39
40         No new tests, rebaselined existing tests.
41
42         * dom/SelectorQuery.cpp:
43         (WebCore::SelectorQueryCache::add):
44
45 2016-08-16  Brent Fulgham  <bfulgham@apple.com>
46
47         Upgrade-Insecure-Request state is improperly retained between navigations
48         https://bugs.webkit.org/show_bug.cgi?id=160905
49         <rdar://problem/27075526>
50
51         Reviewed by Andy Estes.
52
53         Correct the handling of Upgrade-Insecure-Request state to match the specification, so that
54         performing top-level navigation to sites that do not have the Upgrade-Insecure-Request header
55         does not automatically upgrade insecure loads. The same loads performed in an iframe should
56         be upgraded.
57
58         The iframe case was already handled in our tests, but a new test is added that models the top-level
59         navigation and confirms that an upgrade is not performed.
60
61         Tests: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-uir-on-navigation.html
62
63         * dom/Document.cpp:
64         (WebCore::Document::initContentSecurityPolicy): Properly inherit Upgrade-Insecure-Request state for children
65         of existing frames.
66         * loader/DocumentWriter.cpp:
67         (WebCore::DocumentWriter::begin): Retain the history of upgraded resources (per the specification) so that
68         we continue to upgrade resources that were upgraded during earlier navigations. Note that we do NOT want to
69         retain the state of the Upgrade-Insecure-Requests header itself.
70         * page/csp/ContentSecurityPolicy.cpp:
71         (WebCore::ContentSecurityPolicy::copyStateFrom): Update to use new helper function.
72         (WebCore::ContentSecurityPolicy::copyUpgradeInsecureRequestStateFrom): New helper function.
73         * page/csp/ContentSecurityPolicy.h:
74
75 2016-08-16  Chris Dumez  <cdumez@apple.com>
76
77         ctx.drawImage should clip source rect if it is outside the source image
78         https://bugs.webkit.org/show_bug.cgi?id=160804
79
80         Reviewed by Simon Fraser.
81
82         According to the specification [1]"
83         "When the source rectangle is outside the source image, the source rectangle
84         must be clipped to the source image and the destination rectangle must be
85         clipped in the same proportion."
86
87         Firefox and Chrome behave according to the specification. This patch aligns
88         our behavior.
89
90         [1] https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage
91
92         Test: fast/canvas/drawImage-srcRect-clipping.html
93
94         * html/canvas/CanvasRenderingContext2D.cpp:
95         (WebCore::CanvasRenderingContext2D::drawImage):
96
97 2016-08-16  George Ruan  <gruan@apple.com>
98
99         ⛱ : Implement parsing of Media Constraints for getUserMedia algorithm in Media Capture and Streaming Spec
100         https://bugs.webkit.org/show_bug.cgi?id=160533
101         <rdar://problem/27688483>
102
103         Reviewed by Chris Dumez.
104
105         Two getUserMedia tests have been updated to reflect changes and cover limited
106         testing of the parsing of media constraints when given to getUserMedia().
107         Current testing infrastructure doesn't support full testing of the parsing
108         of media constraints. Either a mock needs to be created or the selectSettings()
109         algorithm will need to be implemented so we can see the constraints reflected
110         by the settings of media stream tracks. See https://bugs.webkit.org/show_bug.cgi?id=160791.
111
112         The specification on media constraints and how they are provided to getUserMedia() and 
113         applyConstraints() has changed. These constraints are parsed in the bindings and are
114         stored in a new class MediaConstraint with derived classes LongConstraint, DoubleConstraint,
115         BooleanConstraint, and StringConstraint, each holding their respective type of constraint
116         value.
117
118         * CMakeLists.txt: Add JSMediaDevicesCustom.cpp and MediaConstraints.cpp.
119         * Modules/mediastream/CaptureDeviceManager.cpp:
120         (CaptureDeviceManager::verifyConstraintsForMediaType): Make changes according
121         to how format of MediaConstraint was changed.
122         (CaptureDeviceManager::sessionSupportsConstraint): Ditto.
123         (CaptureDeviceManager::isSupportedFrameRate): Ditto. Also for the time being
124         support constraint validation with a static acceptable frame rate range of 0-60.
125         See relevant https://bugs.webkit.org/show_bug.cgi?id=160794 for supporting
126         constraint validation of frame rate dynamically.
127         * Modules/mediastream/CaptureDeviceManager.h: Make changes according to how
128         format of MediaConstraint was changed.
129         * Modules/mediastream/MediaConstraintsImpl.cpp: Remove code for parsing media
130         constraints in the legacy format with keys 'mandatory' and 'optional'. Removal
131         of legacy code is fine since MEDIA_STREAM feature flag is not enabled for any port.
132         (WebCore::MediaConstraintsImpl::create): Ditto
133         (WebCore::MediaConstraintsImpl::initialize): Still used by applyConstraints().
134         Added FIXME to remove after applyConstraints implementation is changed according
135         to w3c spec changes.
136         (WebCore::MediaConstraintsImpl::mandatoryConstraints): Make changes according to
137         how media constraint data is now stored.
138         (WebCore::MediaConstraintsImpl::advancedConstraints): Ditto.
139         (WebCore::MediaConstraintsImpl::getMandatoryConstraints): Deleted.
140         (WebCore::MediaConstraintsImpl::getOptionalConstraints): Deleted.
141         (WebCore::MediaConstraintsImpl::getMandatoryConstraintValue): Deleted.
142         (WebCore::MediaConstraintsImpl::getOptionalConstraintValue): Deleted.
143         * Modules/mediastream/MediaConstraintsImpl.h:
144         (WebCore::MediaConstraintsImpl::MediaConstraintsImpl): Add a constructor to allow
145         construction of MediaConstraintsImpl object based on how the custom binding code
146         for MediaDevices would parse the media constraints given to getUserMedia().
147         * Modules/mediastream/MediaDevices.cpp:
148         (WebCore::MediaDevices::getUserMedia): Make changes according to how media constraint
149         data is now stored.
150         * Modules/mediastream/MediaDevices.h: Ditto.
151         * Modules/mediastream/MediaDevices.idl: Add custom binding to parse media constraints,
152         since we do not have support for automatic binding generation of sequence of dictionaries,
153         dictionary inheritance, dictionaries inside of dictionaries, disjunctions, or dictionaries
154         without an interface.
155         * Modules/mediastream/MediaStreamTrack.cpp: Add FIXME with related bug.
156         (WebCore::MediaStreamTrack::applyConstraints): Ditto.
157         * Modules/mediastream/UserMediaRequest.cpp: Make changes according to how media constraint
158         data is now parsed and stored.
159         (WebCore::UserMediaRequest::start): Ditto.
160         (WebCore::UserMediaRequest::UserMediaRequest): Ditto.
161         (WebCore::UserMediaRequest::didCreateStream): Ditto.
162         (WebCore::parseOptions): Deleted.
163         * Modules/mediastream/UserMediaRequest.h: Ditto.
164         * WebCore.xcodeproj/project.pbxproj:
165         * bindings/js/JSBindingsAllInOne.cpp: Added JSMediaDevicesCustom.cpp.
166         * bindings/js/JSMediaDevicesCustom.cpp: Added. Custom bindings to parse media constraints.
167         (WebCore::initializeStringConstraintWithList): Initialize string constraint 'exact' or 'ideal'
168         value according to an ArrayValue.
169         (WebCore::createStringConstraint): Given a dictionary acting as a 'MediaTrackConstraintSet'
170         and a string constraint key (e.g for facingMode), creates a native StringConstraint class to hold
171         the data.
172         (WebCore::createBooleanConstraint): Ditto but for constraints of type boolean.
173         (WebCore::createDoubleConstraint): Ditto but for constraints of type double.
174         (WebCore::createIntConstraint): Ditto but for constraints of type long.
175         (WebCore::parseMediaTrackConstraintSetForKey): Parses a given dictionary acting as a
176         'MediaTrackConstraintSet' for a constraint as the key and creates the correct native object to hold
177         the data.
178         (WebCore::parseAdvancedConstraints): Parses the advanced constraints.
179         (WebCore::parseConstraints): Parses the constraints of a Dictionary acting as a
180         'MediaTrackConstraints'.
181         (WebCore::JSMediaDevices::getUserMedia): Parses the constraint input to getUserMedia.
182         * platform/mediastream/MediaConstraints.cpp: Added. Add MediaConstraint classes with derived
183         classes IntConstraint, DoubleConstraint, BooleanConstraint, and StringConstraint to act as
184         containers for the parsed data from getUserMedia().
185         (WebCore::MediaConstraint::create): Factory that creates the correct derived class based on the
186         name of a media constraint.
187         (WebCore::MediaConstraint::getMin): Interface for getting the min value for a constraint.
188         ASSERT checks are in place to prevent calling getMin with the incorrect constraint type.
189         (WebCore::MediaConstraint::getMax): Ditto but for max value of constraint.
190         (WebCore::MediaConstraint::getExact): Ditto but for exact value of constraint.
191         (WebCore::MediaConstraint::getIdeal): Ditto but for ideal value of constraint.
192         (WebCore::IntConstraint::create): Creates a long constraint.
193         (WebCore::IntConstraint::setMin): Sets min value of constraint.
194         (WebCore::IntConstraint::setMax): Sets max value of constraint.
195         (WebCore::IntConstraint::setExact): Sets exact value of constraint.
196         (WebCore::IntConstraint::setIdeal): Sets ideal value of constraint.
197         (WebCore::IntConstraint::getMin): Overrides interface function and gets min value of constraint.
198         (WebCore::IntConstraint::getMax): Ditto but for max value of constraint.
199         (WebCore::IntConstraint::getExact): Ditto but for exact value of constraint.
200         (WebCore::IntConstraint::getIdeal): Ditto but for ideal value of constraint.
201         (WebCore::DoubleConstraint::create): Ditto, DoubleConstraint instead of IntConstraint.
202         (WebCore::DoubleConstraint::setMin): Ditto.
203         (WebCore::DoubleConstraint::setMax): Ditto.
204         (WebCore::DoubleConstraint::setExact): Ditto.
205         (WebCore::DoubleConstraint::setIdeal): Ditto.
206         (WebCore::DoubleConstraint::getMin): Ditto.
207         (WebCore::DoubleConstraint::getMax): Ditto.
208         (WebCore::DoubleConstraint::getExact): Ditto.
209         (WebCore::DoubleConstraint::getIdeal): Ditto.
210         (WebCore::BooleanConstraint::create): Ditto, BooleanConstraint instead of IntConstraint.
211         (WebCore::BooleanConstraint::setExact): Ditto.
212         (WebCore::BooleanConstraint::setIdeal): Ditto.
213         (WebCore::BooleanConstraint::getExact): Ditto.
214         (WebCore::BooleanConstraint::getIdeal): Ditto.
215         (WebCore::StringConstraint::create): Ditto, StringConstraint instead of IntConstraint.
216         (WebCore::StringConstraint::setExact): Ditto.
217         (WebCore::StringConstraint::appendExact): Appends string to 'exact' value of StringConstraint.
218         (WebCore::StringConstraint::setIdeal): Ditto.
219         (WebCore::StringConstraint::appendIdeal): Appends string to 'ideal' value of StringConstraint.
220         (WebCore::StringConstraint::getExact): Ditto.
221         (WebCore::StringConstraint::getIdeal): Ditto.
222         * platform/mediastream/MediaConstraints.h: Add MediaConstraint classes with derived
223         classes IntConstraint, DoubleConstraint, BooleanConstraint, and StringConstraint to act as
224         containers for the parsed data from getUserMedia().
225         (WebCore::MediaConstraint::~MediaConstraint):
226         (WebCore::MediaConstraint::name): Get name of constraint.
227         (WebCore::MediaConstraint::MediaConstraint): Constructor.
228         (WebCore::NumericConstraint::NumericConstraint): Base class of DoubleConstraint and IntConstraint.
229         (WebCore::NumericConstraint::setHasMin): Sets whether object has min vlaue.
230         (WebCore::NumericConstraint::setHasMax): Ditto but for max.
231         (WebCore::NumericConstraint::setHasExact): Ditto but for exact.
232         (WebCore::NumericConstraint::setHasIdeal): Ditto but for ideal.
233         (WebCore::NumericConstraint::hasMin): Gets whether object has min value.
234         (WebCore::NumericConstraint::hasMax): Ditto but for max.
235         (WebCore::NumericConstraint::hasExact): Ditto but for exact.
236         (WebCore::NumericConstraint::hasIdeal): Ditto but for ideal.
237         * platform/mediastream/RealtimeMediaSourceCenter.h: Parameters can be reference since
238         lifetime is guaranteed and ownership is not taken.
239         * platform/mediastream/mac/AVCaptureDeviceManager.h: Ditto.
240         * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto.
241         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Ditto.
242         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Make changes according to
243         how media constraint data is stored.
244         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
245         Ditto.
246         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Ditto.
247         * platform/mediastream/mac/AVVideoCaptureSource.h: Change frame rate from 'float' to 'double'.
248         * platform/mediastream/mac/AVVideoCaptureSource.mm:
249         (WebCore::AVVideoCaptureSource::setFrameRateConstraint): Ditto.
250         (WebCore::AVVideoCaptureSource::applyConstraints): Make changes according to how media constraint
251         data is stored. The implementation of applyConstraints has also drastically changed, and a FIXME
252         is associated.
253         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
254         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
255         The bindings will always pass a non-null MediaConstraints object to
256         getUserMedia() so a pointer MediaConstraints parameter is not necessary.
257         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream): Ditto.
258         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Change 'override' to 'final'
259         since RealtimeMediaSourceCenterMac is a 'final' class.
260         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp: Ditto to
261         RealtimeMediaSourceCenterMac.
262         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Ditto.
263         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
264         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h: Ditto.
265         * platform/mock/MediaConstraintsMock.cpp: Change how constraint validation is mocked.
266         (WebCore::isLongMediaConstraintSatisfiable): Sets arbitrary min and max supported value to be 0 and 10,
267         respectively. Then checks if constraint is satisfiable.
268         (WebCore::isDoubleMediaConstraintSatisfiable): Ditto but with double.
269         (WebCore::isBooleanMediaConstraintSatisfiable): Mock a boolean constraint to only be satisfiable if the
270         'exact' value is true.
271         (WebCore::isStringMediaConstraintSatisfiable): Mock a string constraint to only be satisfiable if the
272         'exact' value has the string 'valid'
273         (WebCore::isSatisfiable): Checks if a certain constraint is satisfiable.
274         (WebCore::MediaConstraintsMock::verifyConstraints): Verifies if the constraints are satisfiable.
275         (WebCore::isSupported): Deleted.
276         (WebCore::isValid): Deleted.
277         * platform/mock/MediaConstraintsMock.h: Change argument of MediaConstraints to raw pointer.
278         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Change arguments of MediaConstraints to a raw pointer
279         and make changes according to how the MediaConstraint was changed.
280         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
281         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
282         * platform/mock/MockRealtimeMediaSourceCenter.h: Change argument of MediaConstraints to raw pointer.
283
284 2016-08-16  Alex Christensen  <achristensen@webkit.org>
285
286         Fix WinCairo build after r204512.
287
288         * platform/network/curl/SocketStreamHandleImpl.h:
289         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
290         (WebCore::createCopy):
291         (WebCore::SocketStreamHandleImpl::createCopy): Deleted.
292
293 2016-08-16  Alex Christensen  <achristensen@webkit.org>
294
295         Clean up WebSockets
296         https://bugs.webkit.org/show_bug.cgi?id=160889
297
298         Reviewed by Darin Adler.
299
300         We should use size_t's instead of ints for data lengths.
301         SocketStreamHandleClient is now purely virtual.
302         A few places that will need SocketStreamHandleImpls instead of SocketStreamHandles now have them.
303         This patch doesn't change behavior.
304
305         * Modules/websockets/WebSocketChannel.cpp:
306         (WebCore::WebSocketChannel::didCloseSocketStream):
307         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
308         * Modules/websockets/WebSocketChannel.h:
309         * platform/network/SocketStreamHandle.cpp:
310         (WebCore::SocketStreamHandle::state):
311         (WebCore::SocketStreamHandle::send):
312         * platform/network/SocketStreamHandle.h:
313         (WebCore::SocketStreamHandle::~SocketStreamHandle):
314         (WebCore::SocketStreamHandle::bufferedAmount):
315         (WebCore::SocketStreamHandle::client): Deleted.
316         * platform/network/SocketStreamHandleClient.h:
317         (WebCore::SocketStreamHandleClient::~SocketStreamHandleClient):
318         (WebCore::SocketStreamHandleClient::didOpenSocketStream): Deleted.
319         (WebCore::SocketStreamHandleClient::didCloseSocketStream): Deleted.
320         (WebCore::SocketStreamHandleClient::didReceiveSocketStreamData): Deleted.
321         (WebCore::SocketStreamHandleClient::didUpdateBufferedAmount): Deleted.
322         (WebCore::SocketStreamHandleClient::didFailSocketStream): Deleted.
323         * platform/network/cf/SocketStreamHandleImpl.h:
324         (WebCore::SocketStreamHandleImpl::create):
325         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
326         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
327         (WebCore::SocketStreamHandleImpl::platformSend):
328         (WebCore::SocketStreamHandleImpl::platformClose):
329         * platform/network/curl/SocketStreamHandleImpl.h:
330         (WebCore::SocketStreamHandleImpl::create):
331         * platform/network/soup/SocketStreamHandleImpl.h:
332         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
333         (WebCore::SocketStreamHandleImpl::create):
334
335 2016-08-16  Chris Dumez  <cdumez@apple.com>
336
337         Unreviewed, rolling out r204506.
338
339         Broke the build
340
341         Reverted changeset:
342
343         "Cleanup WK2 platform gamepad handling."
344         https://bugs.webkit.org/show_bug.cgi?id=160871
345         http://trac.webkit.org/changeset/204506
346
347 2016-08-16  Darin Adler  <darin@apple.com>
348
349         [Cocoa] Remove dependency on Objective-C bindings in WebKit2 editing code
350         https://bugs.webkit.org/show_bug.cgi?id=160891
351
352         Reviewed by Anders Carlsson.
353
354         * WebCore.xcodeproj/project.pbxproj: Removed EditorCocoa.h.
355
356         * editing/Editor.cpp: Removed member initialization for members now
357         initialized in the class definition.
358
359         * editing/Editor.h: Added FragmentAndResources struct, createFragment
360         member function, and _WebCreateFragment function. Also initialize all the
361         scalar data members here instead of in the constructor.
362
363         * editing/cocoa/EditorCocoa.h: Removed. This was unused.
364
365         * editing/cocoa/EditorCocoa.mm:
366         (WebCore::Editor::createFragment): Added. Calls through to WebKitLegacy
367         using soft linking for now, but later should be implemented here in WebCore.
368
369         * editing/ios/EditorIOS.mm:
370         (WebCore::Editor::createFragmentAndAddResources): Call createFragment.
371
372         * editing/mac/EditorMac.mm:
373         (WebCore::Editor::createFragmentAndAddResources): Call createFragment.
374
375         * loader/EmptyClients.h: Removed documentFragmentFromAttributedString
376         implementation.
377
378         * page/EditorClient.h: Removed documentFragmentFromAttributedString.
379         Two reasons: The first is that this is now implemented in WebCore. While
380         there is a call through to WebKitLegacy, it's a temporary thing and done
381         with soft linking. The second reason is that this returned a raw pointer,
382         which is not safe in general. Was safe here because it was returning a
383         pointer owned by an autoreleased Objective-C object.
384
385 2016-08-16  Brady Eidson  <beidson@apple.com>
386
387         Cleanup WK2 platform gamepad handling.
388         https://bugs.webkit.org/show_bug.cgi?id=160871
389
390         Reviewed by Alex Christensen.
391
392         No new tests (No currently testable change in behavior).
393
394         This patch does a few things:
395         1 - Separates the concepts of "monitoring gamepads" and "monitoring gamepad inputs"
396         2 - Uses this new concept to much more cleanly handle the case where we are not currently
397             monitoring gamepad inputs because an interested WKWebView is not front and center.
398         3 - Pre-populates the "initial set of gamepads" in WebProcesses that start listening for gamepads.
399
400         * platform/gamepad/GamepadProviderClient.h:
401         (WebCore::GamepadProviderClient::setInitialConnectedGamepads):
402
403         * platform/gamepad/mac/HIDGamepadProvider.cpp:
404         (WebCore::HIDGamepadProvider::HIDGamepadProvider):
405         (WebCore::HIDGamepadProvider::stopMonitoringInput):
406         (WebCore::HIDGamepadProvider::startMonitoringInput):
407         (WebCore::HIDGamepadProvider::connectionDelayTimerFired):
408         * platform/gamepad/mac/HIDGamepadProvider.h:
409
410 2016-08-16  Commit Queue  <commit-queue@webkit.org>
411
412         Unreviewed, rolling out r204494.
413         https://bugs.webkit.org/show_bug.cgi?id=160901
414
415         Broke the iOS build (Requested by cdumez on #webkit).
416
417         Reverted changeset:
418
419         "Drop unused EventTarget::hasActiveEventListeners()"
420         https://bugs.webkit.org/show_bug.cgi?id=160869
421         http://trac.webkit.org/changeset/204494
422
423 2016-08-16  Darin Adler  <darin@apple.com>
424
425         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
426         Regenerated results, which were affected by the sequence<T> change last night.
427
428 2016-08-16  Per Arne Vollan  <pvollan@apple.com>
429
430         [Win] Hardening of getLinkedFonts function.
431         https://bugs.webkit.org/show_bug.cgi?id=160850
432
433         The SUCCEEDED macro should only be used for functions returning a HRESULT type.
434         Also, make sure a string array index will not exceed the string length.
435
436         * platform/graphics/win/FontCacheWin.cpp:
437         (WebCore::getLinkedFonts):
438
439 2016-08-16  Alex Christensen  <achristensen@webkit.org>
440
441         Simplify SocketStreamError
442         https://bugs.webkit.org/show_bug.cgi?id=160888
443
444         Reviewed by Darin Adler.
445
446         SocketStreamErrorBase and platform-specific SocketStreamError were overly complicated.
447         They had many functions that were never used.  There's no reason to have two separate classes.
448
449         * WebCore.xcodeproj/project.pbxproj:
450         * platform/network/SocketStreamError.h: Copied from Source/WebCore/platform/network/SocketStreamErrorBase.h.
451         (WebCore::SocketStreamError::SocketStreamError):
452         (WebCore::SocketStreamError::isNull):
453         (WebCore::SocketStreamError::errorCode):
454         (WebCore::SocketStreamError::failingURL):
455         (WebCore::SocketStreamError::localizedDescription):
456         (WebCore::SocketStreamErrorBase::isNull): Deleted.
457         (WebCore::SocketStreamErrorBase::errorCode): Deleted.
458         (WebCore::SocketStreamErrorBase::failingURL): Deleted.
459         (WebCore::SocketStreamErrorBase::localizedDescription): Deleted.
460         (WebCore::SocketStreamErrorBase::SocketStreamErrorBase): Deleted.
461         (WebCore::operator==): Deleted.
462         (WebCore::operator!=): Deleted.
463         * platform/network/SocketStreamErrorBase.cpp: Removed.
464         * platform/network/SocketStreamErrorBase.h: Removed.
465         * platform/network/cf/SocketStreamError.h: Removed.
466         * platform/network/curl/SocketStreamError.h: Removed.
467         * platform/network/soup/SocketStreamError.h: Removed.
468
469 2016-08-15  Ryosuke Niwa  <rniwa@webkit.org>
470
471         Conversion to sequence<T> is broken for iterable objects
472         https://bugs.webkit.org/show_bug.cgi?id=160801
473
474         Reviewed by Darin Adler.
475
476         Added the proper iterator support for sequence<T> with one caveat that we don't check for RegExp object
477         per https://github.com/heycam/webidl/issues/145.
478
479         See http://heycam.github.io/webidl/#es-sequence and http://heycam.github.io/webidl/#es-overloads
480
481         Tests: bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl
482
483         * bindings/js/JSDOMBinding.cpp:
484         (WebCore::hasIteratorMethod): Added. A helper function for checking whether a JSValue is iterable or not.
485         * bindings/js/JSDOMBinding.h:
486         (WebCore::NativeValueTraits<unsigned>::nativeValue): Removed the check for isNumber to match the spec'ed
487         behavior at http://heycam.github.io/webidl/#es-unsigned-long which calls ToNumber first without checking
488         whether the value is a number or not.
489         (WebCore::toRefPtrNativeArray): Replaced isJSArray check by isObject check and throw a TypeError. Deployed
490         forEachInIterable to support non-JSArray iterable objects. Also removed the function pointer from the third
491         argument since we were always calling JSCT::toWrapped.
492         (WebCore::toNativeArray): Ditto.
493         * bindings/js/JSDOMConvert.h:
494         (WebCore::Converter<Vector<T>>::convert): Removed the comment about toNativeArray not throwing when value
495         is not an object.
496         * bindings/scripts/CodeGeneratorJS.pm:
497         (GenerateOverloadedFunctionOrConstructor): Removed the check for isJSArray for sequence<T> as an iterable
498         object is not necessary a JSArray.
499         (WillConvertUndefinedToDefaultParameterValue): Don't return 1 for all sequences since toNativeArray and
500         toRefPtrNativeArray now throws on undefined due to isObject check.
501         (JSValueToNative): Removed the third argument from toRefPtrNativeArray.
502
503         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.cpp: Added.
504         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequence.h: Added.
505         * bindings/scripts/test/GObject/WebKitDOMTestOverloadedConstructorsWithSequencePrivate.h: Added.
506         * bindings/scripts/test/JS/JSTestObj.cpp:
507         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalSequenceIsEmpty):
508         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: Added.
509         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h: Added.
510         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
511         (WebCore::jsTestTypedefsPrototypeFunctionFunc):
512         * bindings/scripts/test/TestOverloadedConstructorsWithSequence.idl: Added.
513
514 2016-08-15  Chris Dumez  <cdumez@apple.com>
515
516         Rename RegisteredEventListener::listener() to callback() for clarity
517         https://bugs.webkit.org/show_bug.cgi?id=160873
518
519         Reviewed by Darin Adler.
520
521         Rename RegisteredEventListener::listener() to callback() for clarity
522         and to match the specification:
523         - https://dom.spec.whatwg.org/#concept-event-listener
524
525         Always calling listener->listener() seems wrong.
526
527         * bindings/js/JSCommandLineAPIHostCustom.cpp:
528         (WebCore::getJSListenerFunctions):
529         * dom/EventListenerMap.cpp:
530         (WebCore::findListener):
531         (WebCore::removeFirstListenerCreatedFromMarkup):
532         (WebCore::copyListenersNotCreatedFromMarkupToTarget):
533         (WebCore::EventListenerIterator::nextListener):
534         * dom/EventTarget.cpp:
535         (WebCore::EventTarget::getAttributeEventListener):
536         (WebCore::EventTarget::fireEventListeners):
537         * dom/RegisteredEventListener.h:
538         (WebCore::RegisteredEventListener::callback):
539         (WebCore::RegisteredEventListener::RegisteredEventListener):
540         (WebCore::RegisteredEventListener::listener): Deleted.
541         * inspector/InspectorDOMAgent.cpp:
542         (WebCore::InspectorDOMAgent::getEventListeners):
543         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
544
545 2016-08-15  Chris Dumez  <cdumez@apple.com>
546
547         Add support for dictionary members of non nullable wrapper types
548         https://bugs.webkit.org/show_bug.cgi?id=160876
549
550         Reviewed by Darin Adler.
551
552         Add support for dictionary members of non nullable wrapper types. We
553         only supported nullable wrapper types as dictionary members so far.
554
555         No new tests, updated bindings tests.
556
557         * bindings/js/JSDOMConvert.h:
558         * bindings/scripts/CodeGeneratorJS.pm:
559         (GenerateDictionaryImplementationContent):
560         (GenerateParametersCheck):
561         (JSValueToNative):
562         (GenerateConstructorDefinition):
563         * bindings/scripts/test/JS/JSTestInterface.cpp:
564         (WebCore::JSTestInterfaceConstructor::construct):
565         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
566         (WebCore::JSTestNamedConstructorNamedConstructor::construct):
567         * bindings/scripts/test/JS/JSTestObj.cpp:
568         (WebCore::convertDictionary<TestObj::Dictionary>):
569         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
570         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
571         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot):
572         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
573         (WebCore::constructJSTestOverloadedConstructors4):
574         (WebCore::constructJSTestOverloadedConstructors5):
575         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
576         (WebCore::JSTestTypedefsConstructor::construct):
577         * bindings/scripts/test/TestObj.idl:
578
579 2016-08-15  Chris Dumez  <cdumez@apple.com>
580
581         Drop unused EventTarget::hasActiveEventListeners()
582         https://bugs.webkit.org/show_bug.cgi?id=160869
583
584         Reviewed by Alex Christensen.
585
586         * dom/EventListenerMap.cpp:
587         (WebCore::EventListenerMap::containsActive): Deleted.
588         * dom/EventListenerMap.h:
589         * dom/EventTarget.cpp:
590         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
591         * dom/EventTarget.h:
592
593 2016-08-15  Sam Weinig  <sam@webkit.org>
594
595         Speed up compile times by not including wtf/Variant.h so much
596         https://bugs.webkit.org/show_bug.cgi?id=160847
597
598         Reviewed by Alex Christensen and Saam Barati.
599
600         "using std::experimental::variant" caused internal compiler errors in MSVC2015, 
601         so we are just writing std::experimental where we use it for now.
602         We should move variant into the std::experimental namespace.
603
604         * bindings/js/JSNodeOrString.cpp:
605         (WebCore::toNodeOrStringVector):
606         * bindings/js/JSNodeOrString.h:
607         * dom/ContainerNode.cpp:
608         (WebCore::ContainerNode::childElementCount):
609         (WebCore::ContainerNode::append):
610         (WebCore::ContainerNode::prepend):
611         * dom/ContainerNode.h:
612         * dom/Node.cpp:
613         (WebCore::Node::appendChild):
614         (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
615         (WebCore::firstFollowingSiblingNotInNodeSet):
616         (WebCore::Node::convertNodesOrStringsIntoNode):
617         (WebCore::Node::before):
618         (WebCore::Node::after):
619         (WebCore::Node::replaceWith):
620         * dom/Node.h:
621         (WebCore::Node::setStyleChange):
622         (WebCore::Node::customPseudoId):
623
624 2016-08-15  Daniel Bates  <dabates@apple.com>
625
626         ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
627         https://bugs.webkit.org/show_bug.cgi?id=160433
628
629         Reviewed by Eric Carlson.
630
631         Early return from WebAVPlayerLayerView_videoView() if the PiP layer does not have a non-nil delegate view.
632
633         Test: media/controls/close-page-with-picture-in-picture-video-assertion-failure.html
634
635         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
636         (WebAVPlayerLayerView_videoView):
637
638 2016-08-15  Alex Christensen  <achristensen@webkit.org>
639
640         Rename SocketStreamHandleBase to SocketStreamHandle and SocketStreamHandle to SocketStreamHandleImpl
641         https://bugs.webkit.org/show_bug.cgi?id=160858
642
643         Reviewed by Brady Eidson.
644
645         No new tests.  No change in behavior, except GTK's SocketStreamHandleImpl is now safely ThreadSafeRefCounted.
646         This is preparation for making a new kind of SocketStreamHandle which is a proxy that communicates with the NetworkProcess in WebKit2.
647
648         * CMakeLists.txt:
649         * PlatformAppleWin.cmake:
650         * PlatformEfl.cmake:
651         * PlatformGTK.cmake:
652         * PlatformMac.cmake:
653         * PlatformWinCairo.cmake:
654         * WebCore.xcodeproj/project.pbxproj:
655         * page/SocketProvider.cpp:
656         (WebCore::SocketProvider::createSocketStreamHandle):
657         * platform/network/SocketStreamHandle.cpp: Copied from Source/WebCore/platform/network/SocketStreamHandleBase.cpp.
658         (WebCore::SocketStreamHandle::SocketStreamHandle):
659         (WebCore::SocketStreamHandle::state):
660         (WebCore::SocketStreamHandle::send):
661         (WebCore::SocketStreamHandle::close):
662         (WebCore::SocketStreamHandle::disconnect):
663         (WebCore::SocketStreamHandle::sendPendingData):
664         (WebCore::SocketStreamHandleBase::SocketStreamHandleBase): Deleted.
665         (WebCore::SocketStreamHandleBase::state): Deleted.
666         (WebCore::SocketStreamHandleBase::send): Deleted.
667         (WebCore::SocketStreamHandleBase::close): Deleted.
668         (WebCore::SocketStreamHandleBase::disconnect): Deleted.
669         (WebCore::SocketStreamHandleBase::sendPendingData): Deleted.
670         * platform/network/SocketStreamHandle.h: Copied from Source/WebCore/platform/network/SocketStreamHandleBase.h.
671         (WebCore::SocketStreamHandle::~SocketStreamHandle):
672         (WebCore::SocketStreamHandle::client):
673         (WebCore::SocketStreamHandleBase::~SocketStreamHandleBase): Deleted.
674         (WebCore::SocketStreamHandleBase::client): Deleted.
675         * platform/network/SocketStreamHandleBase.cpp: Removed.
676         * platform/network/SocketStreamHandleBase.h: Removed.
677         * platform/network/cf/SocketStreamHandle.h: Removed.
678         * platform/network/cf/SocketStreamHandleCFNet.cpp: Removed.
679         * platform/network/cf/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/cf/SocketStreamHandle.h.
680         (WebCore::SocketStreamHandleImpl::create):
681         (WebCore::SocketStreamHandle::create): Deleted.
682         * platform/network/cf/SocketStreamHandleImplCFNet.cpp: Copied from Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp.
683         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
684         (WebCore::SocketStreamHandleImpl::scheduleStreams):
685         (WebCore::SocketStreamHandleImpl::retainSocketStreamHandle):
686         (WebCore::SocketStreamHandleImpl::releaseSocketStreamHandle):
687         (WebCore::SocketStreamHandleImpl::copyPACExecutionDescription):
688         (WebCore::SocketStreamHandleImpl::pacExecutionCallback):
689         (WebCore::SocketStreamHandleImpl::executePACFileURL):
690         (WebCore::SocketStreamHandleImpl::removePACRunLoopSource):
691         (WebCore::SocketStreamHandleImpl::chooseProxy):
692         (WebCore::SocketStreamHandleImpl::chooseProxyFromArray):
693         (WebCore::SocketStreamHandleImpl::createStreams):
694         (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials):
695         (WebCore::authenticationSchemeFromAuthenticationMethod):
696         (WebCore::SocketStreamHandleImpl::addCONNECTCredentials):
697         (WebCore::SocketStreamHandleImpl::copyCFStreamDescription):
698         (WebCore::SocketStreamHandleImpl::readStreamCallback):
699         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
700         (WebCore::SocketStreamHandleImpl::reportErrorToClient):
701         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
702         (WebCore::SocketStreamHandleImpl::platformSend):
703         (WebCore::SocketStreamHandleImpl::platformClose):
704         (WebCore::SocketStreamHandleImpl::port):
705         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
706         (WebCore::SocketStreamHandle::scheduleStreams): Deleted.
707         (WebCore::SocketStreamHandle::retainSocketStreamHandle): Deleted.
708         (WebCore::SocketStreamHandle::releaseSocketStreamHandle): Deleted.
709         (WebCore::SocketStreamHandle::copyPACExecutionDescription): Deleted.
710         (WebCore::SocketStreamHandle::pacExecutionCallback): Deleted.
711         (WebCore::SocketStreamHandle::executePACFileURL): Deleted.
712         (WebCore::SocketStreamHandle::removePACRunLoopSource): Deleted.
713         (WebCore::SocketStreamHandle::chooseProxy): Deleted.
714         (WebCore::SocketStreamHandle::chooseProxyFromArray): Deleted.
715         (WebCore::SocketStreamHandle::createStreams): Deleted.
716         (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials): Deleted.
717         (WebCore::SocketStreamHandle::addCONNECTCredentials): Deleted.
718         (WebCore::SocketStreamHandle::copyCFStreamDescription): Deleted.
719         (WebCore::SocketStreamHandle::readStreamCallback): Deleted.
720         (WebCore::SocketStreamHandle::writeStreamCallback): Deleted.
721         (WebCore::SocketStreamHandle::reportErrorToClient): Deleted.
722         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
723         (WebCore::SocketStreamHandle::platformSend): Deleted.
724         (WebCore::SocketStreamHandle::platformClose): Deleted.
725         (WebCore::SocketStreamHandle::port): Deleted.
726         * platform/network/curl/SocketStreamHandle.h: Removed.
727         * platform/network/curl/SocketStreamHandleCurl.cpp: Removed.
728         * platform/network/curl/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/curl/SocketStreamHandle.h.
729         (WebCore::SocketStreamHandleImpl::create):
730         (WebCore::SocketStreamHandle::create): Deleted.
731         * platform/network/curl/SocketStreamHandleImplCurl.cpp: Copied from Source/WebCore/platform/network/curl/SocketStreamHandleCurl.cpp.
732         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
733         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
734         (WebCore::SocketStreamHandleImpl::platformSend):
735         (WebCore::SocketStreamHandleImpl::platformClose):
736         (WebCore::SocketStreamHandleImpl::readData):
737         (WebCore::SocketStreamHandleImpl::sendData):
738         (WebCore::SocketStreamHandleImpl::waitForAvailableData):
739         (WebCore::SocketStreamHandleImpl::startThread):
740         (WebCore::SocketStreamHandleImpl::stopThread):
741         (WebCore::SocketStreamHandleImpl::didReceiveData):
742         (WebCore::SocketStreamHandleImpl::didOpenSocket):
743         (WebCore::SocketStreamHandleImpl::createCopy):
744         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
745         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
746         (WebCore::SocketStreamHandle::platformSend): Deleted.
747         (WebCore::SocketStreamHandle::platformClose): Deleted.
748         (WebCore::SocketStreamHandle::readData): Deleted.
749         (WebCore::SocketStreamHandle::sendData): Deleted.
750         (WebCore::SocketStreamHandle::waitForAvailableData): Deleted.
751         (WebCore::SocketStreamHandle::startThread): Deleted.
752         (WebCore::SocketStreamHandle::stopThread): Deleted.
753         (WebCore::SocketStreamHandle::didReceiveData): Deleted.
754         (WebCore::SocketStreamHandle::didOpenSocket): Deleted.
755         (WebCore::SocketStreamHandle::createCopy): Deleted.
756         * platform/network/soup/SocketStreamHandle.h: Removed.
757         * platform/network/soup/SocketStreamHandleImpl.h: Copied from Source/WebCore/platform/network/soup/SocketStreamHandle.h.
758         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Copied from Source/WebCore/platform/network/soup/SocketStreamHandleSoup.cpp.
759         (WebCore::SocketStreamHandleImpl::create):
760         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
761         (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
762         (WebCore::SocketStreamHandleImpl::connected):
763         (WebCore::SocketStreamHandleImpl::connectedCallback):
764         (WebCore::SocketStreamHandleImpl::readBytes):
765         (WebCore::SocketStreamHandleImpl::readReadyCallback):
766         (WebCore::SocketStreamHandleImpl::didFail):
767         (WebCore::SocketStreamHandleImpl::writeReady):
768         (WebCore::SocketStreamHandleImpl::platformSend):
769         (WebCore::SocketStreamHandleImpl::platformClose):
770         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
771         (WebCore::SocketStreamHandleImpl::stopWaitingForSocketWritability):
772         (WebCore::SocketStreamHandleImpl::writeReadyCallback):
773         (WebCore::SocketStreamHandle::create): Deleted.
774         (WebCore::SocketStreamHandle::SocketStreamHandle): Deleted.
775         (WebCore::SocketStreamHandle::~SocketStreamHandle): Deleted.
776         (WebCore::SocketStreamHandle::connected): Deleted.
777         (WebCore::SocketStreamHandle::connectedCallback): Deleted.
778         (WebCore::SocketStreamHandle::readBytes): Deleted.
779         (WebCore::SocketStreamHandle::readReadyCallback): Deleted.
780         (WebCore::SocketStreamHandle::didFail): Deleted.
781         (WebCore::SocketStreamHandle::writeReady): Deleted.
782         (WebCore::SocketStreamHandle::platformSend): Deleted.
783         (WebCore::SocketStreamHandle::platformClose): Deleted.
784         (WebCore::SocketStreamHandle::beginWaitingForSocketWritability): Deleted.
785         (WebCore::SocketStreamHandle::stopWaitingForSocketWritability): Deleted.
786         (WebCore::SocketStreamHandle::writeReadyCallback): Deleted.
787         * platform/network/soup/SocketStreamHandleSoup.cpp: Removed.
788
789 2016-08-15  Jiewen Tan  <jiewen_tan@apple.com>
790
791         Expose crypto.getRandomValues to Web Workers
792         https://bugs.webkit.org/show_bug.cgi?id=104851
793         <rdar://problem/27285714>
794
795         Reviewed by Darin Adler.
796
797         Tests: crypto/webkitSubtle/disallowed-in-worker.html
798                crypto/workers/crypto-gc-worker.html
799                crypto/workers/crypto-random-values-limits-worker.html
800                crypto/workers/crypto-random-values-types-worker.html
801                crypto/workers/crypto-random-values-worker.html
802
803         Expose both crypto and crypto.getRandomValues to Web Workers. However, webkitSubtle is
804         disabled in Web Workers. This change also refactors a bit on IDLs related to Crypto
805         interface.
806
807         * CMakeLists.txt:
808         * DerivedSources.cpp:
809         * DerivedSources.make:
810         * WebCore.xcodeproj/project.pbxproj:
811         Introduce GlobalCrypto Interface which is used to repalace the partial IDL in both
812         DOMWindow and WorkerGlobalScope with sub-implememtations.
813         * bindings/js/JSDocumentCustom.cpp:
814         (WebCore::JSDocument::visitAdditionalChildren):
815         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
816         (WebCore::JSWorkerGlobalScope::visitAdditionalChildren):
817         * bindings/scripts/CodeGeneratorJS.pm:
818         (GenerateImplementation):
819         * bindings/scripts/IDLAttributes.txt:
820         * dom/Document.idl:
821         Add support of GenerateIsReachable=ImplScriptExecutionContext, which allow registered
822         JS Objects to live as long as ScriptExecutionContext lives, i.e. Document and
823         WorkerGlobalScope.
824         * page/Crypto.cpp:
825         (WebCore::Crypto::Crypto):
826         (WebCore::Crypto::webkitSubtle):
827         (WebCore::Crypto::document): Deleted.
828         * page/Crypto.h:
829         (WebCore::Crypto::create):
830         * page/Crypto.idl:
831         Change the opaque root of Crypto to ScriptExecutionContext such that it perserves
832         the same live time in both Window and Web Worker. And disable WebKitSubtle in Web
833         Workers.
834         * page/DOMWindow.idl:
835         * page/GlobalCrypto.idl: Added.
836         Replace partial IDL to sub-implementation of crypto attribute.
837         * workers/WorkerGlobalScope.cpp:
838         (WebCore::WorkerGlobalScope::crypto):
839         * workers/WorkerGlobalScope.h:
840         * workers/WorkerGlobalScope.idl:
841         Introduce crypto attribute to Web Workers.
842
843 2016-08-15  Joseph Pecoraro  <pecoraro@apple.com>
844
845         Use #pragma once in inspector headers
846         https://bugs.webkit.org/show_bug.cgi?id=160861
847
848         Reviewed by Mark Lam.
849
850         * inspector/*.h:
851
852 2016-08-15  Keith Rollin  <krollin@apple.com>
853
854         Rename LOG_ALWAYS
855         https://bugs.webkit.org/show_bug.cgi?id=160768
856
857         Rename LOG_ALWAYS and friends, given that the first parameter to it is
858         a boolean expression that determines whether or not logging should be
859         performed.
860
861         Reviewed by Chris Dumez.
862
863         No new tests. No new functionality is added. Only some macro names
864         have been changed.
865
866         * loader/FrameLoader.cpp:
867         (WebCore::FrameLoader::prepareForLoadStart):
868         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
869         * platform/MemoryPressureHandler.cpp:
870         (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange):
871         * platform/graphics/cocoa/IOSurface.mm:
872         (WebCore::IOSurface::IOSurface):
873
874 2016-08-15  Daniel Bates  <dabates@apple.com>
875
876         Cannot build WebKit for iOS device using Xcode 7.3/iOS 9.3 public SDK due to missing
877         private frameworks and libraries
878         https://bugs.webkit.org/show_bug.cgi?id=155931
879         <rdar://problem/25807989>
880
881         Reviewed by Dan Bernstein.
882
883         Add directory WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/X to the framework search path
884         where X is the major version of the active iOS SDK.
885
886         * Configurations/WebCore.xcconfig:
887
888 2016-08-15  Simon Fraser  <simon.fraser@apple.com>
889
890         Add a setting and preferences to enable visual viewport mode
891         https://bugs.webkit.org/show_bug.cgi?id=160843
892
893         Reviewed by Sam Weinig.
894
895         Add a visualViewportEnabled setting, in the start of a group at the bottom
896         of the file which is intended as the future home for all runtime-enabled
897         settings.
898
899         * page/Settings.in:
900
901 2016-08-15  Alex Christensen  <achristensen@webkit.org>
902
903         Fix WinCairo build after r204466.
904
905         * platform/network/curl/SocketStreamHandleCurl.cpp:
906
907 2016-08-15  Alex Christensen  <achristensen@webkit.org>
908
909         Fix GTK build after r204466.
910
911         * platform/gtk/DataObjectGtk.h:
912
913 2016-08-15  Joseph Pecoraro  <pecoraro@apple.com>
914
915         Remove unused includes of wtf headers
916         https://bugs.webkit.org/show_bug.cgi?id=160839
917
918         Reviewed by Alex Christensen.
919
920         * Lots of files.
921
922 2016-08-15  Alex Christensen  <achristensen@webkit.org>
923
924         Remove unused WebSocketChannel::willOpenSocketStream
925         https://bugs.webkit.org/show_bug.cgi?id=160851
926
927         Reviewed by Daniel Bates.
928
929         * Modules/websockets/WebSocketChannel.cpp:
930         (WebCore::WebSocketChannel::willOpenSocketStream): Deleted.
931         * Modules/websockets/WebSocketChannel.h:
932         * platform/network/SocketStreamHandleClient.h:
933         (WebCore::SocketStreamHandleClient::willOpenSocketStream): Deleted.
934
935 2016-08-12  Anders Carlsson  <andersca@apple.com>
936
937         Move the plug-in and WebGL blacklist code to WebCore
938         https://bugs.webkit.org/show_bug.cgi?id=160831
939
940         Reviewed by Sam Weinig.
941
942         * WebCore.xcodeproj/project.pbxproj:
943         * platform/mac/BlacklistUpdater.h: Added.
944         (WebCore::BlacklistUpdater::queue):
945         (WebCore::BlacklistUpdater::pluginBlacklist):
946         (WebCore::BlacklistUpdater::webGLBlacklist):
947         * platform/mac/BlacklistUpdater.mm: Added.
948         (WebCore::BlacklistUpdater::readBlacklistData):
949         (WebCore::BlacklistUpdater::reloadIfNecessary):
950         (WebCore::BlacklistUpdater::initializeQueue):
951         * platform/mac/PluginBlacklist.h: Added.
952         * platform/mac/PluginBlacklist.mm: Added.
953         (WebCore::PluginBlacklist::loadPolicyForPluginVersion):
954         (WebCore::PluginBlacklist::isPluginUpdateAvailable):
955         (WebCore::PluginBlacklist::create):
956         (WebCore::PluginBlacklist::~PluginBlacklist):
957         (WebCore::PluginBlacklist::splitOSVersion):
958         (WebCore::PluginBlacklist::loadPolicyForPlugin):
959         (WebCore::PluginBlacklist::isUpdateAvailable):
960         (WebCore::PluginBlacklist::PluginBlacklist):
961         * platform/mac/WebGLBlacklist.h: Added.
962         * platform/mac/WebGLBlacklist.mm: Added.
963         (WebCore::OSBuildInfo::OSBuildInfo):
964         (WebCore::OSBuildInfo::operator==):
965         (WebCore::OSBuildInfo::operator>):
966         (WebCore::OSBuildInfo::operator<=):
967         (WebCore::OSBuildInfo::operator<):
968         (WebCore::buildInfoFromOSBuildString):
969         (WebCore::WebGLBlacklist::shouldBlockWebGL):
970         (WebCore::WebGLBlacklist::shouldSuggestBlockingWebGL):
971         (WebCore::matchesGPU):
972         (WebCore::gpuMaskFromString):
973         (WebCore::matchesBuildInfo):
974         (WebCore::WebGLBlacklist::create):
975         (WebCore::WebGLBlacklist::shouldBlock):
976         (WebCore::WebGLBlacklist::shouldSuggestBlocking):
977         (WebCore::WebGLBlacklist::WebGLBlacklist):
978         (WebCore::WebGLBlacklist::~WebGLBlacklist):
979         * platform/spi/cf/CFUtilitiesSPI.h: Added.
980
981 2016-08-14  Chris Dumez  <cdumez@apple.com>
982
983         Align the event listener firing code with the latest DOM Specification and simplify it
984         https://bugs.webkit.org/show_bug.cgi?id=160828
985
986         Reviewed by Darin Adler.
987
988         Align the event listener firing code with the latest DOM specification:
989         - https://dom.spec.whatwg.org/#concept-event-listener-invoke
990         - https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke
991         - https://dom.spec.whatwg.org/#concept-event-listener
992
993         The following changes were made:
994         1. RegisteredEventListener (equivalent to "event listener" in the spec)
995            is now RefCounted
996         2. RegisteredEventListener now has a wasRemoved flag as in specification.
997         3. fireEventListeners() is now iterating over a copy of the event
998            listeners, as in the specification. We rely on the wasRemoved removed
999            flag to avoid executing event listeners that were removed while we
1000            iterate.
1001
1002         Previously, the code was modifying the event listeners vector we were
1003         iterating on. Doing so safely lead to complicated and error prone code.
1004         The new code is much simpler and easier to reason about.
1005
1006         This change seems to be perf-neutral on Speedometer.
1007
1008         No new tests, no web-exposed behavior change.
1009
1010         * CMakeLists.txt:
1011         * WebCore.xcodeproj/project.pbxproj:
1012         * bindings/js/JSCommandLineAPIHostCustom.cpp:
1013         (WebCore::getJSListenerFunctions):
1014         * dom/DOMAllInOne.cpp:
1015         * dom/EventListenerMap.cpp:
1016         (WebCore::EventListenerMap::assertNoActiveIterators):
1017         (WebCore::EventListenerMap::containsCapturing):
1018         (WebCore::EventListenerMap::containsActive):
1019         (WebCore::findListener):
1020         (WebCore::EventListenerMap::add):
1021         (WebCore::removeListenerFromVector):
1022         (WebCore::EventListenerMap::remove):
1023         (WebCore::EventListenerMap::find):
1024         (WebCore::removeFirstListenerCreatedFromMarkup):
1025         (WebCore::copyListenersNotCreatedFromMarkupToTarget):
1026         (WebCore::EventListenerMap::copyEventListenersNotCreatedFromMarkupToTarget):
1027         (WebCore::EventListenerIterator::nextListener):
1028         (WebCore::EventListenerMap::clear): Deleted.
1029         * dom/EventListenerMap.h:
1030         (WebCore::EventListenerMap::contains):
1031         (WebCore::EventListenerMap::assertNoActiveIterators):
1032         * dom/EventTarget.cpp:
1033         (WebCore::EventTarget::removeEventListener):
1034         (WebCore::EventTarget::getAttributeEventListener):
1035         (WebCore::FiringEventListenersScope::FiringEventListenersScope):
1036         (WebCore::FiringEventListenersScope::~FiringEventListenersScope):
1037         (WebCore::EventTarget::fireEventListeners):
1038         (WebCore::EventTarget::setAttributeEventListener): Deleted.
1039         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
1040         (WebCore::EventTarget::dispatchEventForBindings): Deleted.
1041         (WebCore::EventTarget::getEventListeners): Deleted.
1042         * dom/EventTarget.h:
1043         (WebCore::EventTarget::isFiringEventListeners):
1044         * dom/RegisteredEventListener.cpp: Removed.
1045         * dom/RegisteredEventListener.h:
1046         (WebCore::RegisteredEventListener::Options::Options):
1047         (WebCore::RegisteredEventListener::create):
1048         (WebCore::RegisteredEventListener::listener):
1049         (WebCore::RegisteredEventListener::useCapture):
1050         (WebCore::RegisteredEventListener::isPassive):
1051         (WebCore::RegisteredEventListener::isOnce):
1052         (WebCore::RegisteredEventListener::wasRemoved):
1053         (WebCore::RegisteredEventListener::markAsRemoved):
1054         (WebCore::RegisteredEventListener::RegisteredEventListener):
1055         * inspector/InspectorDOMAgent.cpp:
1056         (WebCore::InspectorDOMAgent::getEventListenersForNode):
1057         (WebCore::InspectorDOMAgent::getEventListeners):
1058         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1059         * inspector/InspectorDOMAgent.h:
1060         (WebCore::EventListenerInfo::EventListenerInfo):
1061         * svg/SVGElement.cpp:
1062         (WebCore::hasLoadListener):
1063
1064 2016-08-14  Daniel Bates  <dabates@apple.com>
1065
1066         Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
1067         https://bugs.webkit.org/show_bug.cgi?id=160725
1068
1069         Reviewed by Sam Weinig.
1070
1071         * platform/cocoa/ThemeCocoa.mm: Unconditionally include header dlfcn.h as it
1072         exists in both the public iOS 9.3 SDK and iOS 10 beta SDK.
1073         * platform/spi/cocoa/CoreTextSPI.h: Add SPI declarations for constants that were
1074         used in r204107.
1075         * platform/spi/cocoa/PassKitSPI.h: Remove unnecessary #import statements when
1076         building with the Apple Internal SDK. Include header PassKit/PassKit.h when
1077         building for iOS.
1078         * platform/spi/cocoa/QuartzCoreSPI.h: No need to define CLayer.contentsFormat
1079         when building with the iOS 10 beta SDK as it is now part of the public API.
1080
1081 2016-08-14  Jonathan Bedard  <jbedard@apple.com>
1082
1083         Dereferenced NULL pointer in StyleResolver
1084         https://bugs.webkit.org/show_bug.cgi?id=160823
1085
1086         Reviewed by Darin Adler.
1087
1088         No behavior changed, new tests unneeded.
1089
1090         This change was initiated by a NULL pointer dereference to provide this unused argument.
1091
1092         * css/StyleResolver.cpp:
1093         (WebCore::StyleResolver::CascadedProperties::addStyleProperties): Removed unused function argument.
1094         (WebCore::StyleResolver::CascadedProperties::addMatch): Ditto.
1095         * css/StyleResolver.h: Ditto.
1096
1097 2016-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
1098
1099         Fix GTK Debug bots after r204400
1100         https://bugs.webkit.org/show_bug.cgi?id=160818
1101
1102         Reviewed by Carlos Garcia Campos.
1103
1104         Because the GTK EWS bot doesn't run tests, I missed this.
1105
1106         No new tests because there is no behavior change.
1107
1108         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1109         (WebCore::HarfBuzzShaper::selectionRect):
1110
1111 2016-08-13  Chris Dumez  <cdumez@apple.com>
1112
1113         'compatMode' property should be on Document, not HTMLDocument
1114         https://bugs.webkit.org/show_bug.cgi?id=160819
1115
1116         Reviewed by Sam Weinig.
1117
1118         'compatMode' property should be on Document, not HTMLDocument:
1119         - https://dom.spec.whatwg.org/#dom-document-compatmode
1120
1121         WebKit had it on both. Firefox and Chrome have it on Document only.
1122
1123         Test: fast/dom/Document/compatMode-location.html
1124
1125         * html/HTMLDocument.idl:
1126
1127 2016-08-13  Chris Dumez  <cdumez@apple.com>
1128
1129         Move 'embeds' / 'plugins'/ 'scripts' attributes from HTMLDocument to Document
1130         https://bugs.webkit.org/show_bug.cgi?id=160829
1131
1132         Reviewed by Sam Weinig.
1133
1134         Move 'embeds' / 'plugins'/ 'scripts' attributes from HTMLDocument to Document
1135         to match the latest specification:
1136         - https://html.spec.whatwg.org/multipage/dom.html#the-document-object
1137
1138         This also matches Chrome.
1139
1140         No new tests, rebaselined existing test.
1141
1142         * dom/Document.idl:
1143         * html/HTMLDocument.idl:
1144
1145 2016-08-13  Chris Dumez  <cdumez@apple.com>
1146
1147         Move designMode attribute from HTMLDocument to Document
1148         https://bugs.webkit.org/show_bug.cgi?id=160838
1149
1150         Reviewed by Sam Weinig.
1151
1152         Move designMode attribute from HTMLDocument to Document to match the
1153         latest HTML specification:
1154         - https://html.spec.whatwg.org/multipage/interaction.html#designMode
1155
1156         This also matches Chrome.
1157
1158         No new tests, rebaselined existing test.
1159
1160         * dom/Document.cpp:
1161         (WebCore::Document::designMode):
1162         (WebCore::Document::setDesignMode):
1163         * dom/Document.h:
1164         * dom/Document.idl:
1165         * html/HTMLDocument.cpp:
1166         (WebCore::HTMLDocument::bgColor): Deleted.
1167         (WebCore::HTMLDocument::setBgColor): Deleted.
1168         (WebCore::HTMLDocument::fgColor): Deleted.
1169         * html/HTMLDocument.h:
1170         * html/HTMLDocument.idl:
1171
1172 2016-08-12  Chris Dumez  <cdumez@apple.com>
1173
1174         getElementsByTagName() should take a qualifiedName in parameter
1175         https://bugs.webkit.org/show_bug.cgi?id=160682
1176
1177         Reviewed by Ryosuke Niwa.
1178
1179         getElementsByTagName() should take a qualifiedName in parameter, not a
1180         localName, according to the latest DOM specification:
1181         - https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
1182         - https://dom.spec.whatwg.org/#concept-getelementsbytagname
1183
1184         The new behavior matches Firefox and Edge. There is a slight
1185         compatiblity risk but we should give it a try.
1186
1187         No new tests, rebaselined existing tests.
1188
1189         * WebCore.xcodeproj/project.pbxproj:
1190         * dom/AllDescendantsCollection.h: Added.
1191         * dom/ContainerNode.cpp:
1192         (WebCore::ContainerNode::getElementsByTagName):
1193         (WebCore::ContainerNode::getElementsByTagNameNS):
1194         * dom/Node.cpp:
1195         (WebCore::NodeListsNodeData::invalidateCaches):
1196         * dom/NodeRareData.h:
1197         (WebCore::NodeListsNodeData::addCachedTagCollectionNS):
1198         (WebCore::NodeListsNodeData::removeCachedTagCollectionNS):
1199         (WebCore::NodeListsNodeData::adoptDocument):
1200         (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList):
1201         * dom/TagCollection.cpp:
1202         (WebCore::makeQualifiedName):
1203         (WebCore::splitQualifiedName):
1204         (WebCore::TagCollectionNS::TagCollectionNS):
1205         (WebCore::TagCollectionNS::~TagCollectionNS):
1206         (WebCore::TagCollection::TagCollection):
1207         (WebCore::TagCollection::~TagCollection):
1208         (WebCore::HTMLTagCollection::HTMLTagCollection):
1209         (WebCore::HTMLTagCollection::~HTMLTagCollection):
1210         * dom/TagCollection.h:
1211         (WebCore::TagCollection::elementMatches):
1212         (WebCore::TagCollectionNS::elementMatches):
1213         (WebCore::HTMLTagCollection::elementMatches):
1214         * html/CollectionType.h:
1215         * html/GenericCachedHTMLCollection.cpp:
1216         (WebCore::GenericCachedHTMLCollection<traversalType>::elementMatches):
1217         * html/HTMLCollection.cpp:
1218         (WebCore::invalidationTypeExcludingIdAndNameAttributes):
1219
1220 2016-08-12  Alex Christensen  <achristensen@webkit.org>
1221
1222         Make URLParser work with URLs missing URL parts
1223         https://bugs.webkit.org/show_bug.cgi?id=160824
1224
1225         Reviewed by Brady Eidson.
1226
1227         My initial implementation of URLParser didn't work correctly with URLs missing parts,
1228         like a URL with no fragment, or a URL with no query.  This fixes and tests parsing such URLS.
1229         Covered by new API tests.
1230
1231         * platform/URLParser.cpp:
1232         (WebCore::URLParser::parse):
1233         (WebCore::URLParser::allValuesEqual):
1234         * platform/URLParser.h:
1235         (WebCore::URLParser::parse):
1236
1237 2016-08-12  Johan K. Jensen  <johan_jensen@apple.com>
1238
1239         Rename DocumentLoadTiming and ResourceLoadTiming
1240         https://bugs.webkit.org/show_bug.cgi?id=160821
1241
1242         Reviewed by Alex Christensen.
1243
1244         Renames ResourceLoadTiming to NetworkLoadTiming.
1245         Renames DocumentLoadTiming to LoadTiming as well as
1246         navigationStart() to startTime(), so it's generic for
1247         both the main resource and subresources.
1248
1249         * CMakeLists.txt:
1250         * Modules/gamepad/NavigatorGamepad.cpp:
1251         (WebCore::NavigatorGamepad::from):
1252         * PlatformMac.cmake:
1253         * WebCore.xcodeproj/project.pbxproj:
1254         * inspector/InspectorNetworkAgent.cpp:
1255         (WebCore::buildObjectForTiming):
1256         (WebCore::buildObjectForResourceResponse):
1257         * loader/DocumentLoader.cpp:
1258         (WebCore::DocumentLoader::startLoadingMainResource):
1259         * loader/DocumentLoader.h:
1260         (WebCore::DocumentLoader::timing):
1261         (WebCore::DocumentLoader::resetTiming):
1262         * loader/FrameLoader.cpp:
1263         (WebCore::FrameLoader::dispatchUnloadEvents):
1264         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
1265         * loader/LoadTiming.cpp: Renamed from Source/WebCore/loader/DocumentLoadTiming.cpp.
1266         (WebCore::LoadTiming::LoadTiming):
1267         (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime):
1268         (WebCore::LoadTiming::monotonicTimeToPseudoWallTime):
1269         (WebCore::LoadTiming::markStartTime):
1270         (WebCore::LoadTiming::addRedirect):
1271         * loader/LoadTiming.h: Renamed from Source/WebCore/loader/DocumentLoadTiming.h.
1272         (WebCore::LoadTiming::markUnloadEventStart):
1273         (WebCore::LoadTiming::markUnloadEventEnd):
1274         (WebCore::LoadTiming::markRedirectStart):
1275         (WebCore::LoadTiming::markRedirectEnd):
1276         (WebCore::LoadTiming::markFetchStart):
1277         (WebCore::LoadTiming::setResponseEnd):
1278         (WebCore::LoadTiming::markLoadEventStart):
1279         (WebCore::LoadTiming::markLoadEventEnd):
1280         (WebCore::LoadTiming::setHasSameOriginAsPreviousDocument):
1281         (WebCore::LoadTiming::startTime):
1282         (WebCore::LoadTiming::unloadEventStart):
1283         (WebCore::LoadTiming::unloadEventEnd):
1284         (WebCore::LoadTiming::redirectStart):
1285         (WebCore::LoadTiming::redirectEnd):
1286         (WebCore::LoadTiming::redirectCount):
1287         (WebCore::LoadTiming::fetchStart):
1288         (WebCore::LoadTiming::responseEnd):
1289         (WebCore::LoadTiming::loadEventStart):
1290         (WebCore::LoadTiming::loadEventEnd):
1291         (WebCore::LoadTiming::hasCrossOriginRedirect):
1292         (WebCore::LoadTiming::hasSameOriginAsPreviousDocument):
1293         (WebCore::LoadTiming::referenceMonotonicTime):
1294         (WebCore::LoadTiming::referenceWallTime):
1295         * page/DOMWindow.cpp:
1296         (WebCore::DOMWindow::dispatchLoadEvent):
1297         * page/PerformanceNavigation.cpp:
1298         (WebCore::PerformanceNavigation::redirectCount):
1299         * page/PerformanceResourceTiming.cpp:
1300         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1301         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds):
1302         * page/PerformanceResourceTiming.h:
1303         * page/PerformanceTiming.cpp:
1304         (WebCore::PerformanceTiming::navigationStart):
1305         (WebCore::PerformanceTiming::unloadEventStart):
1306         (WebCore::PerformanceTiming::unloadEventEnd):
1307         (WebCore::PerformanceTiming::redirectStart):
1308         (WebCore::PerformanceTiming::redirectEnd):
1309         (WebCore::PerformanceTiming::fetchStart):
1310         (WebCore::PerformanceTiming::domainLookupStart):
1311         (WebCore::PerformanceTiming::domainLookupEnd):
1312         (WebCore::PerformanceTiming::connectStart):
1313         (WebCore::PerformanceTiming::connectEnd):
1314         (WebCore::PerformanceTiming::secureConnectionStart):
1315         (WebCore::PerformanceTiming::requestStart):
1316         (WebCore::PerformanceTiming::responseStart):
1317         (WebCore::PerformanceTiming::responseEnd):
1318         (WebCore::PerformanceTiming::loadEventStart):
1319         (WebCore::PerformanceTiming::loadEventEnd):
1320         (WebCore::PerformanceTiming::loadTiming):
1321         (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds):
1322         * page/PerformanceTiming.h:
1323         * platform/network/NetworkLoadTiming.h: Renamed from Source/WebCore/platform/network/ResourceLoadTiming.h.
1324         (WebCore::NetworkLoadTiming::NetworkLoadTiming):
1325         (WebCore::NetworkLoadTiming::operator=):
1326         (WebCore::NetworkLoadTiming::isolatedCopy):
1327         (WebCore::NetworkLoadTiming::operator==):
1328         (WebCore::NetworkLoadTiming::operator!=):
1329         (WebCore::NetworkLoadTiming::encode):
1330         (WebCore::NetworkLoadTiming::decode):
1331         * platform/network/ResourceHandle.h:
1332         * platform/network/ResourceResponseBase.cpp:
1333         (WebCore::ResourceResponseBase::crossThreadData):
1334         (WebCore::ResourceResponseBase::fromCrossThreadData):
1335         (WebCore::ResourceResponseBase::compare):
1336         * platform/network/ResourceResponseBase.h:
1337         (WebCore::ResourceResponseBase::networkLoadTiming):
1338         (WebCore::ResourceResponseBase::encode):
1339         (WebCore::ResourceResponseBase::decode):
1340         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1341         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1342         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1343         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1344         * platform/network/cocoa/NetworkLoadTiming.mm: Renamed from Source/WebCore/platform/network/cocoa/ResourceLoadTiming.mm.
1345         (WebCore::timingValue):
1346         (WebCore::copyTimingData):
1347         (WebCore::setCollectsTimingData):
1348         * platform/network/curl/ResourceHandleManager.cpp:
1349         (WebCore::calculateWebTimingInformations):
1350         * platform/network/mac/ResourceHandleMac.mm:
1351         (WebCore::ResourceHandle::getConnectionTimingData):
1352         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1353         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1354         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1355         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1356         * platform/network/soup/ResourceHandleSoup.cpp:
1357         (WebCore::sendRequestCallback):
1358         (WebCore::ResourceHandle::didStartRequest):
1359         (WebCore::networkEventCallback):
1360
1361 2016-08-12  Joseph Pecoraro  <pecoraro@apple.com>
1362
1363         Remove unused includes of RefCountedLeakCounter.h
1364         https://bugs.webkit.org/show_bug.cgi?id=160817
1365
1366         Reviewed by Mark Lam.
1367
1368         * bindings/js/JSEventListener.cpp:
1369         * rendering/RenderBlockLineLayout.cpp:
1370
1371 2016-08-12  Alex Christensen  <achristensen@webkit.org>
1372
1373         Initial URLParser implementation
1374         https://bugs.webkit.org/show_bug.cgi?id=160811
1375
1376         Reviewed by Brady Eidson.
1377
1378         There are a lot of missing parts, but it works in one case, so I test that one case.
1379
1380         * platform/URLParser.cpp:
1381         (WebCore::isC0Control):
1382         (WebCore::isC0ControlOrSpace):
1383         (WebCore::isTabOrNewline):
1384         (WebCore::isASCIIDigit):
1385         (WebCore::isASCIIAlpha):
1386         (WebCore::isASCIIAlphanumeric):
1387         (WebCore::isSpecialScheme):
1388         (WebCore::URLParser::parse):
1389
1390 2016-08-12  Commit Queue  <commit-queue@webkit.org>
1391
1392         Unreviewed, rolling out r204404.
1393         https://bugs.webkit.org/show_bug.cgi?id=160805
1394
1395         "Broke the build for some Apple Internal projects" (Requested
1396         by bradee-oh on #webkit).
1397
1398         Reverted changeset:
1399
1400         "Support WebIDL unions (Part 1)"
1401         https://bugs.webkit.org/show_bug.cgi?id=160769
1402         http://trac.webkit.org/changeset/204404
1403
1404 2016-08-12  Philippe Normand  <pnormand@igalia.com>
1405
1406         [GStreamer] Performance problems with bigger video resolution in the webrtc media player
1407         https://bugs.webkit.org/show_bug.cgi?id=153826
1408
1409         Reviewed by Alejandro G. Castro.
1410
1411         Keep the OpenWebRTC video renderer size synchronized with the Media element size.
1412
1413         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
1414         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize):
1415         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
1416
1417 2016-08-12  Philippe Normand  <pnormand@igalia.com>
1418
1419         [GStreamer][OWR] Video rendering fixes
1420         https://bugs.webkit.org/show_bug.cgi?id=160764
1421
1422         Reviewed by Xabier Rodriguez-Calvar.
1423
1424         The video renderer of OpenWebRTC now uses OpenGL so we have two
1425         options to correctly handle this in WebKit:
1426
1427         - if USE_GSTREAMER_GL is enabled then we simply pass our GL
1428           appsink to the renderer and there is no need to create glupload
1429           and glcolorconvert element on WebKit side because those elements
1430           are already created on OpenWebRTC side.
1431         - if USE_GSTREAMER_GL is disabled then we need our sink to download
1432           frames from the GPU so that rendering can be done with the WebKit
1433           video sink in main memory.
1434
1435         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1436         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Split out GL appsink management
1437         to a separate method that can be used by sub-classes.
1438         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Use new createGLAppSink method.
1439         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1440         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
1441         (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink): handle GStreamer-GL configurations
1442         and pass a different element to the renderer depending on the configuration.
1443
1444 2016-08-11  Sam Weinig  <sam@webkit.org>
1445
1446         Support WebIDL unions (Part 1)
1447         https://bugs.webkit.org/show_bug.cgi?id=160769
1448
1449         Reviewed by Chris Dumez.
1450
1451         This is the first part of an effort to add support for union types
1452         in our code generators. This change:
1453         - Adds a domType struct to hold the parsed type information. For now, we only
1454           use it temporarily while parsing, and don't expose it to the code generators,
1455           but that will change in a later patch.
1456         - Remove support for scoped identifiers for types. They are not supported by WebIDL.
1457         - Make debugging the parser easier by providing backtraces when asserting.
1458
1459         There should be no observable changes.
1460
1461         * bindings/scripts/IDLParser.pm:
1462
1463 2016-08-11  Myles C. Maxfield  <mmaxfield@apple.com>
1464
1465         Migrate from ints to unsigneds when referring to indices into strings
1466         https://bugs.webkit.org/show_bug.cgi?id=160735
1467
1468         Reviewed by Simon Fraser.
1469
1470         There are a few cases where we use ints to refer to indices into strings:
1471         - A simple historical accident. These were migrated to unsigneds directly.
1472         - Where we use -1 as a sentinal value. These were migrated to Optional<unsigned>.
1473
1474         This patch only modifies rendering code (rather than DOM code). There are a few
1475         places in DOM code (such as Position and Node::maxCharacterOffset()) which also
1476         erroneously use ints; however, I didn't want this change to be observable from
1477         script and I wanted to keep this patch to a reasonable size.
1478
1479         No new tests because there is no behavior change.
1480
1481         * editing/FrameSelection.cpp:
1482         (WebCore::FrameSelection::updateAppearance):
1483         (WebCore::FrameSelection::setCaretVisibility):
1484         * platform/DragImage.cpp:
1485         (WebCore::createDragImageForRange):
1486         * platform/graphics/FontCascade.cpp:
1487         (WebCore::FontCascade::glyphBufferForTextRun):
1488         (WebCore::FontCascade::drawText):
1489         (WebCore::FontCascade::drawEmphasisMarks):
1490         (WebCore::FontCascade::adjustSelectionRectForText):
1491         (WebCore::computeUnderlineType):
1492         (WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
1493         (WebCore::FontCascade::drawEmphasisMarksForSimpleText):
1494         (WebCore::FontCascade::drawGlyphBuffer):
1495         (WebCore::offsetToMiddleOfGlyphAtIndex):
1496         (WebCore::FontCascade::adjustSelectionRectForSimpleText):
1497         * platform/graphics/FontCascade.h:
1498         * platform/graphics/GlyphBuffer.h:
1499         (WebCore::GlyphBuffer::size):
1500         (WebCore::GlyphBuffer::glyphs):
1501         (WebCore::GlyphBuffer::advances):
1502         (WebCore::GlyphBuffer::fontAt):
1503         (WebCore::GlyphBuffer::glyphAt):
1504         (WebCore::GlyphBuffer::advanceAt):
1505         (WebCore::GlyphBuffer::offsetAt):
1506         (WebCore::GlyphBuffer::reverse):
1507         (WebCore::GlyphBuffer::offsetInString):
1508         (WebCore::GlyphBuffer::shrink):
1509         (WebCore::GlyphBuffer::swap):
1510         * platform/graphics/GraphicsContext.cpp:
1511         (WebCore::GraphicsContext::drawText):
1512         (WebCore::GraphicsContext::drawGlyphs):
1513         (WebCore::GraphicsContext::drawEmphasisMarks):
1514         * platform/graphics/GraphicsContext.h:
1515         * platform/graphics/Latin1TextIterator.h:
1516         (WebCore::Latin1TextIterator::Latin1TextIterator):
1517         (WebCore::Latin1TextIterator::currentCharacter):
1518         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
1519         (WebCore::SurrogatePairAwareTextIterator::SurrogatePairAwareTextIterator):
1520         * platform/graphics/SurrogatePairAwareTextIterator.h:
1521         (WebCore::SurrogatePairAwareTextIterator::currentCharacter):
1522         * platform/graphics/WidthIterator.cpp:
1523         (WebCore::WidthIterator::applyFontTransforms):
1524         (WebCore::WidthIterator::advanceInternal):
1525         (WebCore::WidthIterator::advance):
1526         (WebCore::WidthIterator::advanceOneCharacter):
1527         * platform/graphics/WidthIterator.h:
1528         * platform/graphics/cairo/FontCairo.cpp:
1529         (WebCore::drawGlyphsToContext):
1530         (WebCore::drawGlyphsShadow):
1531         (WebCore::FontCascade::drawGlyphs):
1532         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1533         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1534         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
1535         (WebCore::FontCascade::adjustSelectionRectForComplexText):
1536         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1537         (WebCore::fillVectorWithHorizontalGlyphPositions):
1538         (WebCore::showLetterpressedGlyphsWithAdvances):
1539         (WebCore::showGlyphsWithAdvances):
1540         (WebCore::FontCascade::drawGlyphs):
1541         (WebCore::FontCascade::dashesForIntersectionsWithRect):
1542         (WebCore::FontCascade::adjustSelectionRectForComplexText):
1543         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1544         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
1545         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1546         (WebCore::DisplayList::Recorder::drawGlyphs):
1547         * platform/graphics/displaylists/DisplayListRecorder.h:
1548         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1549         (WebCore::HarfBuzzShaper::selectionRect):
1550         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
1551         * platform/graphics/mac/ComplexTextController.h:
1552         * platform/graphics/win/FontCGWin.cpp:
1553         (WebCore::FontCascade::drawGlyphs):
1554         * platform/graphics/win/FontWin.cpp:
1555         (WebCore::FontCascade::adjustSelectionRectForComplexText):
1556         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
1557         (WebCore::FontCascade::drawEmphasisMarksForComplexText):
1558         * rendering/EllipsisBox.cpp:
1559         (WebCore::EllipsisBox::paintSelection):
1560         * rendering/InlineTextBox.cpp:
1561         (WebCore::InlineTextBox::isSelected):
1562         (WebCore::InlineTextBox::selectionState):
1563         (WebCore::InlineTextBox::localSelectionRect):
1564         (WebCore::InlineTextBox::paint):
1565         (WebCore::InlineTextBox::clampedOffset):
1566         (WebCore::InlineTextBox::selectionStartEnd):
1567         (WebCore::InlineTextBox::paintSelection):
1568         (WebCore::InlineTextBox::paintCompositionBackground):
1569         (WebCore::InlineTextBox::paintDocumentMarker):
1570         (WebCore::InlineTextBox::paintTextMatchMarker):
1571         (WebCore::InlineTextBox::positionForOffset):
1572         * rendering/InlineTextBox.h:
1573         (WebCore::InlineTextBox::offsetRun):
1574         (WebCore::InlineTextBox::InlineTextBox): Deleted.
1575         * rendering/RenderBlock.cpp:
1576         (WebCore::RenderBlock::localCaretRect):
1577         * rendering/RenderBlock.h:
1578         * rendering/RenderBox.cpp:
1579         (WebCore::RenderBox::localCaretRect):
1580         * rendering/RenderBox.h:
1581         * rendering/RenderInline.cpp:
1582         (WebCore::RenderInline::localCaretRect):
1583         * rendering/RenderInline.h:
1584         * rendering/RenderLineBreak.cpp:
1585         (WebCore::RenderLineBreak::localCaretRect):
1586         * rendering/RenderLineBreak.h:
1587         * rendering/RenderObject.cpp:
1588         (WebCore::RenderObject::selectionStartEnd):
1589         (WebCore::RenderObject::localCaretRect):
1590         * rendering/RenderObject.h:
1591         * rendering/RenderReplaced.cpp:
1592         (WebCore::RenderReplaced::isSelected):
1593         * rendering/RenderText.cpp:
1594         (WebCore::RenderText::localCaretRect):
1595         (WebCore::RenderText::collectSelectionRectsForLineBoxes):
1596         * rendering/RenderText.h:
1597         * rendering/RenderTextLineBoxes.cpp:
1598         (WebCore::RenderTextLineBoxes::setSelectionState):
1599         * rendering/RenderView.cpp:
1600         (WebCore::RenderView::subtreeSelectionBounds):
1601         (WebCore::RenderView::repaintSubtreeSelection):
1602         (WebCore::RenderView::setSelection):
1603         (WebCore::RenderView::splitSelectionBetweenSubtrees):
1604         (WebCore::RenderView::clearSubtreeSelection):
1605         (WebCore::RenderView::applySubtreeSelection):
1606         (WebCore::RenderView::getSelection):
1607         (WebCore::RenderView::clearSelection):
1608         (WebCore::RenderView::RenderView): Deleted.
1609         * rendering/RenderView.h:
1610         * rendering/SelectionSubtreeRoot.cpp:
1611         (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
1612         (WebCore::SelectionSubtreeRoot::SelectionSubtreeRoot): Deleted.
1613         * rendering/SelectionSubtreeRoot.h:
1614         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::SelectionSubtreeData):
1615         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartPos):
1616         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionEndPos):
1617         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionClear):
1618         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::selectionStartEndPositions):
1619         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionStartPos):
1620         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::setSelectionEndPos):
1621         (WebCore::SelectionSubtreeRoot::SelectionSubtreeData::clearSelection):
1622         (WebCore::SelectionSubtreeRoot::OldSelectionData::OldSelectionData): Deleted.
1623         * rendering/TextPainter.cpp:
1624         (WebCore::TextPainter::drawTextOrEmphasisMarks):
1625         (WebCore::TextPainter::paintTextWithShadows):
1626         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
1627         (WebCore::TextPainter::paintText):
1628         * rendering/TextPainter.h:
1629         (WebCore::TextPainter::addEmphasis):
1630         * rendering/svg/RenderSVGInlineText.cpp:
1631         (WebCore::RenderSVGInlineText::localCaretRect):
1632         * rendering/svg/RenderSVGInlineText.h:
1633         * rendering/svg/SVGInlineTextBox.cpp:
1634         (WebCore::SVGInlineTextBox::positionForOffset):
1635         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
1636         (WebCore::SVGInlineTextBox::localSelectionRect):
1637         (WebCore::SVGInlineTextBox::paintSelectionBackground):
1638         (WebCore::SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates):
1639         (WebCore::SVGInlineTextBox::paintTextWithShadows):
1640         (WebCore::SVGInlineTextBox::paintText):
1641         * rendering/svg/SVGInlineTextBox.h:
1642         * rendering/svg/SVGTextQuery.cpp:
1643         (WebCore::SVGTextQuery::mapStartEndPositionsIntoFragmentCoordinates):
1644         (WebCore::SVGTextQuery::modifyStartEndPositionsRespectingLigatures):
1645         (WebCore::SVGTextQuery::subStringLengthCallback):
1646         (WebCore::SVGTextQuery::startPositionOfCharacterCallback):
1647         (WebCore::SVGTextQuery::endPositionOfCharacterCallback):
1648         (WebCore::SVGTextQuery::rotationOfCharacterCallback):
1649         (WebCore::calculateGlyphBoundaries):
1650         (WebCore::SVGTextQuery::extentOfCharacterCallback):
1651         (WebCore::SVGTextQuery::characterNumberAtPositionCallback):
1652         * rendering/svg/SVGTextQuery.h:
1653
1654 2016-08-11  Alex Christensen  <achristensen@webkit.org>
1655
1656         Don't use a NetworkingContext when creating SocketStreamHandles
1657         https://bugs.webkit.org/show_bug.cgi?id=160732
1658
1659         Reviewed by Brady Eidson.
1660
1661         No change in behavior.  After r204327 a SessionID is all we need to get the NetworkStorageSession,
1662         and we pass the SessionID to the SocketStreamHandle constructor, so use that instead.
1663         SessionIDs can be serialized and sent over IPC.  NetworkingContexts can't.
1664
1665         * Modules/websockets/WebSocketChannel.cpp:
1666         (WebCore::WebSocketChannel::connect):
1667         * page/SocketProvider.cpp:
1668         (WebCore::SocketProvider::createSocketStreamHandle):
1669         * page/SocketProvider.h:
1670         * platform/network/cf/SocketStreamHandle.h:
1671         (WebCore::SocketStreamHandle::create):
1672         * platform/network/cf/SocketStreamHandleCFNet.cpp:
1673         (WebCore::SocketStreamHandle::SocketStreamHandle):
1674         (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials):
1675         * platform/network/curl/SocketStreamHandle.h:
1676         (WebCore::SocketStreamHandle::create):
1677         * platform/network/soup/SocketStreamHandle.h:
1678         * platform/network/soup/SocketStreamHandleSoup.cpp:
1679         (WebCore::SocketStreamHandle::create):
1680
1681 2016-08-11  Alex Christensen  <achristensen@webkit.org>
1682
1683         Use StringBuilder::appendLiteral when possible don't append result of makeString
1684         https://bugs.webkit.org/show_bug.cgi?id=160772
1685
1686         Reviewed by Sam Weinig.
1687
1688         StringBuilder::append does an unnecessary strlen call.
1689         append(makeString(...)) always does unnecessary allocations and copies.
1690         It's currently only used in debug logging, but we shouldn't have this pattern in WebKit.
1691
1692         * Modules/indexeddb/server/IndexValueStore.cpp:
1693         (WebCore::IDBServer::IndexValueStore::loggingString):
1694         * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
1695         (WebCore::IDBDatabaseInfo::loggingString):
1696         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
1697         (WebCore::IDBObjectStoreInfo::loggingString):
1698         * contentextensions/CombinedURLFilters.cpp:
1699         (WebCore::ContentExtensions::prefixTreeVertexToString):
1700         (WebCore::ContentExtensions::recursivePrint):
1701         * html/HTMLMediaElement.cpp:
1702         (WebCore::actionName):
1703         * html/MediaElementSession.cpp:
1704         (WebCore::restrictionName):
1705         * loader/ResourceLoadStatistics.cpp:
1706         (WebCore::appendBoolean):
1707         (WebCore::appendHashCountedSet):
1708         (WebCore::ResourceLoadStatistics::toString):
1709         * platform/PODInterval.h:
1710         (WebCore::PODInterval::toString):
1711         * platform/URL.cpp:
1712         (WebCore::URL::setHost):
1713         (WebCore::URL::setHostAndPort):
1714         (WebCore::URL::serialize):
1715         * testing/Internals.cpp:
1716         (WebCore::appendOffsets):
1717         (WebCore::Internals::scrollSnapOffsets):
1718
1719 2016-08-11  Chris Dumez  <cdumez@apple.com>
1720
1721         Align Range.surroundContents() with the latest DOM specification
1722         https://bugs.webkit.org/show_bug.cgi?id=160777
1723
1724         Reviewed by Ryosuke Niwa.
1725
1726         Align Range.surroundContents() with the latest DOM specification:
1727         - https://dom.spec.whatwg.org/#dom-range-surroundcontents
1728
1729         In particular, the following changes were made:
1730         1. Drop early check to see if startContainer() accepts children like
1731            newParent. This check is not in the specification. Let the later
1732            call to Range.insertNode() take care of doing the check and
1733            throwing.
1734         2. Drop early check to see if newParent contains the range's start
1735            node, for the same reasons as above.
1736         3. Move extractContents() call *before* removing newParent's children
1737            to match the order in the specification (steps 3 & 4).
1738
1739         This makes our behavior much closer to Firefox's as well.
1740
1741         No new tests, rebaselined existing W3C test.
1742
1743         * dom/Range.cpp:
1744         (WebCore::Range::surroundContents):
1745
1746 2016-08-11  Alex Christensen  <achristensen@webkit.org>
1747
1748         Add URLParser stub
1749         https://bugs.webkit.org/show_bug.cgi?id=160770
1750
1751         Reviewed by Sam Weinig.
1752
1753         Added API test stub.
1754
1755         * CMakeLists.txt:
1756         * WebCore.xcodeproj/project.pbxproj:
1757         * platform/URL.h:
1758         * platform/URLParser.cpp: Added.
1759         (WebCore::URLParser::parse):
1760         * platform/URLParser.h: Added.
1761         (WebCore::URLParser::parse):
1762
1763 2016-08-11  Chris Dumez  <cdumez@apple.com>
1764
1765         Move dataset attribute from Element to HTMLElement / SVGElement
1766         https://bugs.webkit.org/show_bug.cgi?id=160766
1767
1768         Reviewed by Alex Christensen.
1769
1770         Move dataset attribute from Element to HTMLElement / SVGElement as per
1771         the specifications:
1772         - https://html.spec.whatwg.org/multipage/dom.html#htmlelement
1773         - https://svgwg.org/svg2-draft/types.html#InterfaceSVGElement
1774
1775         Firefox and Chrome seem to have dataset on HTMLElement but not on
1776         SVGElement (yet).
1777
1778         No new tests, rebaselined existing test.
1779
1780         * dom/Element.idl:
1781         * html/HTMLElement.idl:
1782         * svg/SVGElement.idl:
1783
1784 2016-08-11  Eric Carlson  <eric.carlson@apple.com>
1785
1786         Unreviewed, update MediaRemoteSPI.h after r204082.
1787
1788         * platform/spi/mac/MediaRemoteSPI.h:
1789
1790 2016-08-10  Joseph Pecoraro  <pecoraro@apple.com>
1791
1792         Web Inspector: Should be able to Edit Node Attributes and Styles for non-UserAgent Shadow DOM nodes
1793         https://bugs.webkit.org/show_bug.cgi?id=160762
1794         <rdar://problem/27798271>
1795
1796         Reviewed by Ryosuke Niwa.
1797
1798         * inspector/InspectorDOMAgent.cpp:
1799         (WebCore::InspectorDOMAgent::assertEditableNode):
1800         (WebCore::InspectorDOMAgent::assertEditableElement):
1801         * inspector/PageConsoleAgent.cpp:
1802         (WebCore::PageConsoleAgent::addInspectedNode):
1803         Allow editing shadow DOM nodes as long as they are not in a UserAgent shadow tree.
1804
1805 2016-08-10  Chris Dumez  <cdumez@apple.com>
1806
1807         Optimization in Node.insertBefore() is not spec-compliant
1808         https://bugs.webkit.org/show_bug.cgi?id=160746
1809
1810         Reviewed by Ryosuke Niwa.
1811
1812         We have an optimization in Node.insertBefore(newNode, refChild) to avoid
1813         doing any work when newNode == refChild or newNode.nextSibling == refChild.
1814
1815         This optimization is not in the specification:
1816         - https://dom.spec.whatwg.org/#concept-node-replace
1817
1818         The issue is that this optimization is observable with DOM mutation
1819         observers / listeners or DOM ranges.
1820
1821         This patch addresses the issue by dropping the optimization. This case
1822         does not seem common enough to be worth optimizing for. However, if it
1823         turns out to regress the performance of things we care about, we could
1824         fallback to doing the optimization only when it is not observable.
1825
1826         Test: fast/dom/Node/insertBefore-no-op-mutationobserver.html
1827
1828         * dom/ContainerNode.cpp:
1829         (WebCore::checkAcceptChild):
1830         Move refChild->parent() == parent check from insertBefore() to our
1831         pre-insertion check function, right after checking if newNode contains
1832         parent. This was done in order to match more closely the specification
1833         and to make sure that exception are thrown in the correct order:
1834         - https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity (steps 2 and 3)
1835
1836         (WebCore::ContainerNode::insertBefore):
1837         1. Drop the (refChild->previousSibling() == &newChild || refChild == &newChild)
1838            optimization as it is not spc-compliant.
1839         2. If refChild is newNode, then set refChild to newChild.nextSibling as per:
1840            - https://dom.spec.whatwg.org/#concept-node-pre-insert (step 3)
1841
1842 2016-08-10  Ryosuke Niwa  <rniwa@webkit.org>
1843
1844         Move document.defineElement to customElements.define
1845         https://bugs.webkit.org/show_bug.cgi?id=160731
1846
1847         Reviewed by Chris Dumez.
1848
1849         Replaced Document.prototype.defineElement by CustomElementsRegistry.prototype.define to match
1850         the latest HTML specification: https://html.spec.whatwg.org/#custom-elements-api 
1851
1852         This patch renames the existing CustomElementDefinitions to CustomElementsRegistry and exposes
1853         it on window.customElements. CustomElementDefinitions is now owned by DOMWindow instead of
1854         Document to match the spec's new semantics.
1855
1856         No new tests. The existing tests have been updated to reflect the change.
1857
1858         * DerivedSources.cpp:
1859         * DerivedSources.make:
1860         * WebCore.xcodeproj/project.pbxproj:
1861         * bindings/js/JSCustomElementsRegistryCustom.cpp: Added.
1862         (WebCore::JSCustomElementsRegistry::define): Moved from JSDocumentCustom. Removed the check for
1863         the existence of DOMWindow since CustomElementsRegistry is an attribute on DOMWindow itself.
1864         * bindings/js/JSDocumentCustom.cpp:
1865         (WebCore::JSDocument::defineElement): Deleted.
1866         * bindings/js/JSHTMLElementCustom.cpp: Added the code to check the existence of DOMWindow since
1867         the registry is associated with DOMWindow, not Document.
1868         (WebCore::constructJSHTMLElement):
1869         * dom/CustomElementsRegistry.cpp: Renamed from Source/WebCore/dom/CustomElementDefinitions.cpp.
1870         (WebCore::CustomElementsRegistry::create): Added.
1871         (WebCore::CustomElementsRegistry::CustomElementsRegistry): Added.
1872         (WebCore::CustomElementsRegistry::~CustomElementsRegistry): Added.
1873         (WebCore::CustomElementsRegistry::addElementDefinition): Moved from CustomElementDefinitions.
1874         (WebCore::CustomElementsRegistry::addUpgradeCandidate): Ditto.
1875         (WebCore::CustomElementsRegistry::findInterface): Ditto.
1876         (WebCore::CustomElementsRegistry::containsConstructor): Ditto.
1877         * dom/CustomElementsRegistry.h: Renamed from Source/WebCore/dom/CustomElementDefinitions.h.
1878         * dom/CustomElementsRegistry.idl: Added.
1879         * dom/Document.cpp:
1880         (WebCore::createUpgradeCandidateElement): Extracted out of createHTMLElementWithNameValidation
1881         and createFallbackHTMLElement to share code.
1882         (WebCore::createHTMLElementWithNameValidation):
1883         (WebCore::createFallbackHTMLElement): This function was missing a check for the runtime flag.
1884         Sharing code with createHTMLElementWithNameValidation via createUpgradeCandidateElement fixes it.
1885         (WebCore::Document::ensureCustomElementDefinitions): Deleted.
1886         * dom/Document.h:
1887         (WebCore::Document::customElementDefinitions): Deleted.
1888         * dom/Document.idl:
1889         * dom/Element.cpp:
1890         (WebCore::Element::attributeChanged):
1891         * html/parser/HTMLConstructionSite.cpp:
1892         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
1893         * page/DOMWindow.cpp:
1894         (WebCore::DOMWindow::ensureCustomElementsRegistry): Added. Moved from Document.
1895         * page/DOMWindow.h:
1896         * page/DOMWindow.idl: Added customElements on DOMWindow.
1897
1898 2016-08-10  Alex Christensen  <achristensen@webkit.org>
1899
1900         Fix WinCairo build after r204327.
1901
1902         * platform/network/NetworkStorageSessionStub.cpp:
1903         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Renamed from create...
1904         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
1905
1906 2016-08-10  Nan Wang  <n_wang@apple.com>
1907
1908         AX: Media controls timeline should have percentage value description
1909         https://bugs.webkit.org/show_bug.cgi?id=160619
1910
1911         Reviewed by Eric Carlson.
1912
1913         Added aria-valuetext attribute to the timeline slider and set its value to
1914         the percentage format. Also formatted the elapsed/remaining timer's description
1915         so that it's more human readable.
1916
1917         Test: http/tests/media/hls/video-duration-accessibility.html
1918
1919         * English.lproj/mediaControlsLocalizedStrings.js:
1920         * Modules/mediacontrols/mediaControlsApple.js:
1921         (Controller.prototype.drawVolumeBackground):
1922         (Controller.prototype.formatTimeDescription):
1923         (Controller.prototype.formatTime):
1924         (Controller.prototype.updateTime):
1925         (Controller.prototype.updateControlsWhileScrubbing):
1926
1927 2016-08-10  Anders Carlsson  <andersca@apple.com>
1928
1929         Revert back to the old style member function state machine for callbacks
1930         https://bugs.webkit.org/show_bug.cgi?id=160756
1931
1932         Reviewed by Tim Horton.
1933
1934         This is another step towards merging SQLTransactionBackend and SQLTransaction,
1935         and using a single state machine for both sides.
1936
1937         * Modules/webdatabase/SQLTransaction.cpp:
1938         (WebCore::SQLTransaction::SQLTransaction):
1939         (WebCore::SQLTransaction::performPendingCallback):
1940         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
1941         (WebCore::SQLTransaction::scheduleCallback):
1942         (WebCore::SQLTransaction::openTransactionAndPreflight):
1943         (WebCore::SQLTransaction::runCurrentStatement):
1944         (WebCore::SQLTransaction::handleCurrentStatementError):
1945         (WebCore::SQLTransaction::handleTransactionError):
1946         (WebCore::SQLTransaction::postflightAndCommit):
1947         (WebCore::SQLTransaction::debugStepName):
1948         * Modules/webdatabase/SQLTransaction.h:
1949
1950 2016-08-09  Skachkov Oleksandr  <gskachkov@gmail.com>
1951
1952         [ES2016] Implement Object.values
1953         https://bugs.webkit.org/show_bug.cgi?id=160410
1954
1955         Reviewed by Saam Barati, Yusuke Suzuki.
1956
1957         No new tests because all tests are implemented in JavaScriptCore 
1958         and there is no behavior change.
1959
1960         * ForwardingHeaders/runtime/IterationKind.h: Added.
1961         * bindings/js/SerializedScriptValue.cpp:
1962         (WebCore::CloneSerializer::serialize):
1963
1964 2016-08-10  Anders Carlsson  <andersca@apple.com>
1965
1966         Move more functions to from SQLTransactionBackend to SQLTransaction
1967         https://bugs.webkit.org/show_bug.cgi?id=160752
1968
1969         Reviewed by Tim Horton.
1970
1971         * Modules/webdatabase/SQLTransaction.cpp:
1972         (WebCore::SQLTransaction::acquireLock):
1973         (WebCore::SQLTransaction::openTransactionAndPreflight):
1974         (WebCore::SQLTransaction::runStatements):
1975         (WebCore::SQLTransaction::cleanupAndTerminate):
1976         (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback):
1977         * Modules/webdatabase/SQLTransaction.h:
1978         * Modules/webdatabase/SQLTransactionBackend.cpp:
1979         (WebCore::SQLTransactionBackend::acquireLock):
1980         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
1981         (WebCore::SQLTransactionBackend::runStatements):
1982         (WebCore::SQLTransactionBackend::cleanupAndTerminate):
1983         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
1984
1985 2016-08-10  Anders Carlsson  <andersca@apple.com>
1986
1987         Begin moving member functions from SQLTransactionBackend to SQLTransaction
1988         https://bugs.webkit.org/show_bug.cgi?id=160747
1989
1990         Reviewed by Tim Horton.
1991
1992         * Modules/webdatabase/Database.cpp:
1993         (WebCore::Database::performClose):
1994         * Modules/webdatabase/DatabaseTask.cpp:
1995         (WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
1996         (WebCore::DatabaseTransactionTask::doPerformTask):
1997         * Modules/webdatabase/SQLTransaction.cpp:
1998         (WebCore::SQLTransaction::executeSQL):
1999         (WebCore::SQLTransaction::lockAcquired):
2000         (WebCore::SQLTransaction::performNextStep):
2001         (WebCore::SQLTransaction::performPendingCallback):
2002         (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown):
2003         (WebCore::SQLTransaction::enqueueStatement):
2004         (WebCore::SQLTransaction::getNextStatement):
2005         (WebCore::SQLTransaction::runCurrentStatement):
2006         (WebCore::SQLTransaction::handleCurrentStatementError):
2007         (WebCore::SQLTransaction::handleTransactionError):
2008         (WebCore::SQLTransaction::postflightAndCommit):
2009         (WebCore::SQLTransaction::acquireOriginLock):
2010         (WebCore::SQLTransaction::releaseOriginLockIfNeeded):
2011         * Modules/webdatabase/SQLTransaction.h:
2012         (WebCore::SQLTransaction::backend): Deleted.
2013         * Modules/webdatabase/SQLTransactionBackend.cpp:
2014         (WebCore::SQLTransactionBackend::doCleanup):
2015         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
2016         (WebCore::SQLTransactionBackend::runStatements):
2017         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
2018         (WebCore::SQLTransactionBackend::enqueueStatement): Deleted.
2019         (WebCore::SQLTransactionBackend::performNextStep): Deleted.
2020         (WebCore::SQLTransactionBackend::executeSQL): Deleted.
2021         (WebCore::SQLTransactionBackend::lockAcquired): Deleted.
2022         (WebCore::SQLTransactionBackend::getNextStatement): Deleted.
2023         (WebCore::SQLTransactionBackend::runCurrentStatement): Deleted.
2024         (WebCore::SQLTransactionBackend::handleCurrentStatementError): Deleted.
2025         (WebCore::SQLTransactionBackend::handleTransactionError): Deleted.
2026         (WebCore::SQLTransactionBackend::postflightAndCommit): Deleted.
2027         (WebCore::SQLTransactionBackend::acquireOriginLock): Deleted.
2028         (WebCore::SQLTransactionBackend::releaseOriginLockIfNeeded): Deleted.
2029         * Modules/webdatabase/SQLTransactionBackend.h:
2030         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
2031         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
2032         (WebCore::SQLTransactionCoordinator::shutdown):
2033
2034 2016-08-10  Anders Carlsson  <andersca@apple.com>
2035
2036         Move all SQLTransactionBackend member variables to SQLTransaction
2037         https://bugs.webkit.org/show_bug.cgi?id=160745
2038
2039         Reviewed by Tim Horton.
2040
2041         * Modules/webdatabase/ChangeVersionWrapper.cpp:
2042         (WebCore::ChangeVersionWrapper::performPreflight):
2043         (WebCore::ChangeVersionWrapper::performPostflight):
2044         (WebCore::ChangeVersionWrapper::handleCommitFailedAfterPostflight):
2045         * Modules/webdatabase/ChangeVersionWrapper.h:
2046         (WebCore::ChangeVersionWrapper::sqlError): Deleted.
2047         * Modules/webdatabase/SQLTransaction.cpp:
2048         (WebCore::SQLTransaction::SQLTransaction):
2049         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
2050         (WebCore::SQLTransaction::deliverStatementCallback):
2051         (WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
2052         (WebCore::SQLTransaction::hasCallback): Deleted.
2053         (WebCore::SQLTransaction::hasSuccessCallback): Deleted.
2054         (WebCore::SQLTransaction::hasErrorCallback): Deleted.
2055         * Modules/webdatabase/SQLTransaction.h:
2056         (WebCore::SQLTransaction::isReadOnly):
2057         * Modules/webdatabase/SQLTransactionBackend.cpp:
2058         (WebCore::SQLTransactionBackend::SQLTransactionBackend):
2059         (WebCore::SQLTransactionBackend::~SQLTransactionBackend):
2060         (WebCore::SQLTransactionBackend::doCleanup):
2061         (WebCore::SQLTransactionBackend::enqueueStatement):
2062         (WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
2063         (WebCore::SQLTransactionBackend::executeSQL):
2064         (WebCore::SQLTransactionBackend::notifyDatabaseThreadIsShuttingDown):
2065         (WebCore::SQLTransactionBackend::acquireLock):
2066         (WebCore::SQLTransactionBackend::lockAcquired):
2067         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
2068         (WebCore::SQLTransactionBackend::runStatements):
2069         (WebCore::SQLTransactionBackend::getNextStatement):
2070         (WebCore::SQLTransactionBackend::runCurrentStatement):
2071         (WebCore::SQLTransactionBackend::handleCurrentStatementError):
2072         (WebCore::SQLTransactionBackend::handleTransactionError):
2073         (WebCore::SQLTransactionBackend::postflightAndCommit):
2074         (WebCore::SQLTransactionBackend::cleanupAndTerminate):
2075         (WebCore::SQLTransactionBackend::cleanupAfterTransactionErrorCallback):
2076         (WebCore::SQLTransactionBackend::requestTransitToState):
2077         (WebCore::SQLTransactionBackend::acquireOriginLock):
2078         (WebCore::SQLTransactionBackend::releaseOriginLockIfNeeded):
2079         (WebCore::SQLTransactionBackend::currentStatement): Deleted.
2080         (WebCore::SQLTransactionBackend::transactionError): Deleted.
2081         (WebCore::SQLTransactionBackend::setShouldRetryCurrentStatement): Deleted.
2082         (WebCore::SQLTransactionBackend::enqueueStatementBackend): Deleted.
2083         * Modules/webdatabase/SQLTransactionBackend.h:
2084         (WebCore::SQLTransactionBackend::database): Deleted.
2085         (WebCore::SQLTransactionBackend::isReadOnly): Deleted.
2086         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
2087         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
2088         (WebCore::SQLTransactionCoordinator::releaseLock):
2089
2090 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
2091
2092         Sort the project file.
2093
2094         * WebCore.xcodeproj/project.pbxproj:
2095
2096 2016-08-10  Simon Fraser  <simon.fraser@apple.com>
2097
2098         Sort the feature flags in the FEATURE_DEFINES lines
2099         https://bugs.webkit.org/show_bug.cgi?id=160742
2100
2101         Reviewed by Anders Carlsson.
2102
2103         * Configurations/FeatureDefines.xcconfig:
2104
2105 2016-08-10  Anders Carlsson  <andersca@apple.com>
2106
2107         Make SQLTransactionBackend a member of SQLTransaction
2108         https://bugs.webkit.org/show_bug.cgi?id=160741
2109
2110         Reviewed by Tim Horton.
2111
2112         This is another step towards merging SQLTransaction and SQLTransactionBackend.
2113
2114         * Modules/webdatabase/Database.cpp:
2115         (WebCore::Database::performClose):
2116         (WebCore::Database::scheduleTransaction):
2117         (WebCore::Database::scheduleTransactionStep):
2118         (WebCore::Database::runTransaction):
2119         * Modules/webdatabase/Database.h:
2120         * Modules/webdatabase/DatabaseTask.cpp:
2121         (WebCore::DatabaseTransactionTask::DatabaseTransactionTask):
2122         (WebCore::DatabaseTransactionTask::~DatabaseTransactionTask):
2123         (WebCore::DatabaseTransactionTask::doPerformTask):
2124         * Modules/webdatabase/DatabaseTask.h:
2125         (WebCore::DatabaseTransactionTask::transaction):
2126         * Modules/webdatabase/DatabaseThread.cpp:
2127         * Modules/webdatabase/SQLTransaction.cpp:
2128         (WebCore::SQLTransaction::SQLTransaction):
2129         (WebCore::SQLTransaction::deliverTransactionCallback):
2130         (WebCore::SQLTransaction::deliverTransactionErrorCallback):
2131         (WebCore::SQLTransaction::deliverStatementCallback):
2132         (WebCore::SQLTransaction::deliverQuotaIncreaseCallback):
2133         (WebCore::SQLTransaction::deliverSuccessCallback):
2134         (WebCore::SQLTransaction::executeSQL):
2135         (WebCore::SQLTransaction::computeNextStateAndCleanupIfNeeded):
2136         (WebCore::SQLTransaction::setBackend): Deleted.
2137         * Modules/webdatabase/SQLTransaction.h:
2138         (WebCore::SQLTransaction::backend):
2139         * Modules/webdatabase/SQLTransactionBackend.cpp:
2140         (WebCore::SQLTransactionBackend::SQLTransactionBackend):
2141         (WebCore::SQLTransactionBackend::doCleanup):
2142         (WebCore::SQLTransactionBackend::computeNextStateAndCleanupIfNeeded):
2143         (WebCore::SQLTransactionBackend::acquireLock):
2144         (WebCore::SQLTransactionBackend::lockAcquired):
2145         (WebCore::SQLTransactionBackend::openTransactionAndPreflight):
2146         (WebCore::SQLTransactionBackend::runCurrentStatement):
2147         (WebCore::SQLTransactionBackend::handleCurrentStatementError):
2148         (WebCore::SQLTransactionBackend::handleTransactionError):
2149         (WebCore::SQLTransactionBackend::postflightAndCommit):
2150         (WebCore::SQLTransactionBackend::requestTransitToState):
2151         (WebCore::SQLTransactionBackend::create): Deleted.
2152         * Modules/webdatabase/SQLTransactionBackend.h:
2153         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
2154         (WebCore::getDatabaseIdentifier):
2155         (WebCore::SQLTransactionCoordinator::processPendingTransactions):
2156         (WebCore::SQLTransactionCoordinator::acquireLock):
2157         (WebCore::SQLTransactionCoordinator::releaseLock):
2158         (WebCore::SQLTransactionCoordinator::shutdown):
2159         * Modules/webdatabase/SQLTransactionCoordinator.h:
2160
2161 2016-08-08  Simon Fraser  <simon.fraser@apple.com>
2162
2163         child-transform-with-anchor-point-expected.html renders incorrectly
2164         https://bugs.webkit.org/show_bug.cgi?id=160616
2165
2166         Reviewed by Zalan Bujtas.
2167         
2168         If a layer has perspective, we need to ensure that its bounds don't collapse to 0x0 when clipped out,
2169         otherwise the sublayerTransform geometry gets messed up.
2170
2171         Test: compositing/geometry/clipped-out-perspective.html
2172
2173         * rendering/RenderLayerBacking.cpp:
2174         (WebCore::RenderLayerBacking::updateCompositedBounds):
2175
2176 2016-08-09  Sam Weinig  <sam@webkit.org>
2177
2178         Remove support for array types in IDLs
2179         https://bugs.webkit.org/show_bug.cgi?id=160729
2180
2181         Reviewed by Anders Carlsson.
2182
2183         Array types have been removed from WebIDL in favor of sequence<> and FrozenArray<>.
2184
2185         - Replace all current uses of Array types with sequences. This causes
2186           no functional change.
2187
2188         * bindings/scripts/CodeGenerator.pm:
2189         * bindings/scripts/CodeGeneratorGObject.pm:
2190         * bindings/scripts/CodeGeneratorJS.pm:
2191         * bindings/scripts/IDLParser.pm:
2192         Remove array support from the generators.
2193
2194         * Modules/gamepad/Gamepad.idl:
2195         * Modules/gamepad/NavigatorGamepad.idl:
2196         * Modules/gamepad/deprecated/Gamepad.idl:
2197         * Modules/mediacontrols/MediaControlsHost.idl:
2198         * Modules/mediastream/MediaStream.idl:
2199         * Modules/mediastream/MediaTrackConstraints.idl:
2200         * Modules/mediastream/RTCConfiguration.idl:
2201         * Modules/mediastream/RTCIceServer.idl:
2202         * Modules/mediastream/RTCTrackEvent.idl:
2203         * crypto/CryptoKey.idl:
2204         * dom/MessageEvent.idl:
2205         * testing/Internals.idl:
2206         Switch from array to sequence.
2207
2208 2016-08-10  Alex Christensen  <achristensen@webkit.org>
2209
2210         Use unsigned for locations in URL
2211         https://bugs.webkit.org/show_bug.cgi?id=160706
2212
2213         Reviewed by Sam Weinig.
2214
2215         No change in behavior.
2216
2217         * platform/URL.cpp:
2218         (WebCore::isSchemeFirstChar):
2219         (WebCore::findFirstOf):
2220         (WebCore::checkEncodedString):
2221         (WebCore::URL::host):
2222         (WebCore::URL::protocolIs):
2223         (WebCore::URL::setPort):
2224         (WebCore::URL::setUser):
2225         (WebCore::URL::setPass):
2226         (WebCore::escapeAndAppendNonHierarchicalPart):
2227         (WebCore::copyPathRemovingDots):
2228         (WebCore::URL::serialize):
2229         (WebCore::isDefaultPortForScheme):
2230         (WebCore::hostPortIsEmptyButCredentialsArePresent):
2231         (WebCore::URL::parse):
2232         (WebCore::protocolHostAndPortAreEqual):
2233         (WebCore::hostsAreEqual):
2234         (WebCore::protocolIs):
2235         (WebCore::findHostnamesInMailToURL):
2236         (WebCore::findHostnameInHierarchicalURL):
2237         (WebCore::encodeHostnames):
2238         (WebCore::encodeRelativeString):
2239         * platform/URL.h:
2240
2241 2016-08-09  Anders Carlsson  <andersca@apple.com>
2242
2243         Move SQLTransactionBackend construction inside SQLTransaction
2244         https://bugs.webkit.org/show_bug.cgi?id=160726
2245
2246         Reviewed by Tim Horton.
2247
2248         This is the first step towards re-merging SQLTransactionBackend and SQLTransaction and clean up the code.
2249
2250         * Modules/webdatabase/ChangeVersionWrapper.cpp:
2251         * Modules/webdatabase/ChangeVersionWrapper.h:
2252         * Modules/webdatabase/Database.cpp:
2253         (WebCore::Database::performClose):
2254         (WebCore::Database::scheduleTransactionStep):
2255         (WebCore::Database::changeVersion):
2256         (WebCore::Database::transaction):
2257         (WebCore::Database::readTransaction):
2258         (WebCore::Database::runTransaction):
2259         * Modules/webdatabase/Database.h:
2260         * Modules/webdatabase/DatabaseTask.cpp:
2261         * Modules/webdatabase/SQLTransaction.cpp:
2262         (WebCore::SQLTransaction::create):
2263         (WebCore::SQLTransaction::SQLTransaction):
2264         * Modules/webdatabase/SQLTransaction.h:
2265         (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper):
2266         (WebCore::SQLTransaction::backend):
2267         * Modules/webdatabase/SQLTransactionBackend.cpp:
2268         (WebCore::SQLTransactionBackend::lockAcquired):
2269         (WebCore::SQLTransactionBackend::requestTransitToState):
2270         * Modules/webdatabase/SQLTransactionBackend.h:
2271         (WebCore::SQLTransactionWrapper::~SQLTransactionWrapper): Deleted.
2272
2273 2016-08-10  Chris Dumez  <cdumez@apple.com>
2274
2275         It should be possible to re-initialize a MutationEvent after it's been dispatched
2276         https://bugs.webkit.org/show_bug.cgi?id=160703
2277
2278         Reviewed by Sam Weinig.
2279
2280         It should be possible to re-initialize a MutationEvent after it's been dispatched,
2281         similarly to Event:
2282         - https://www.w3.org/TR/2015/WD-uievents-20151215/#widl-MutationEvent-initMutationEvent
2283
2284         Test: fast/events/initMutationEvent-after-dispatch.html
2285
2286         * dom/MutationEvent.cpp:
2287         (WebCore::MutationEvent::initMutationEvent):
2288
2289 2016-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2290
2291         [ES6] Add ModuleLoaderPrototype and move methods to it
2292         https://bugs.webkit.org/show_bug.cgi?id=160633
2293
2294         Reviewed by Saam Barati.
2295
2296         No behavior change.
2297
2298         * ForwardingHeaders/runtime/JSModuleLoader.h: Added.
2299         * bindings/js/JSDOMWindowBase.cpp:
2300         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
2301         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
2302         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
2303         * bindings/js/JSDOMWindowBase.h:
2304         * bindings/js/JSModuleLoader.cpp:
2305         (WebCore::JSModuleLoader::resolve):
2306         (WebCore::JSModuleLoader::fetch):
2307         (WebCore::JSModuleLoader::evaluate):
2308         * bindings/js/JSModuleLoader.h:
2309
2310 2016-08-10  Per Arne Vollan  <pvollan@apple.com>
2311
2312         [Win] Warning fix.
2313         https://bugs.webkit.org/show_bug.cgi?id=160687
2314
2315         Reviewed by Sam Weinig.
2316
2317         Avoid forward declarations with different dll linkage.
2318
2319         * platform/spi/cf/CFNetworkSPI.h:
2320
2321 2016-08-10  Per Arne Vollan  <pvollan@apple.com>
2322
2323         [Win] Warning fix.
2324         https://bugs.webkit.org/show_bug.cgi?id=160690
2325
2326         Reviewed by Sam Weinig.
2327
2328         Use static cast to convert from enum to unsigned.
2329
2330         * platform/network/ProtectionSpaceHash.h:
2331         (WebCore::ProtectionSpaceHash::hash):
2332
2333 2016-08-09  Alex Christensen  <achristensen@webkit.org>
2334
2335         Move NetworkStorageSession management to WebCore
2336         https://bugs.webkit.org/show_bug.cgi?id=160173
2337
2338         Reviewed by Brady Eidson.
2339
2340         No new tests.  No change in behaviour.
2341         Just moving the mapping from SessionID to NetworkStorageSession so we can use it from WebCore.
2342         I need this so we can get to the NetworkStorageSession from SocketStreamHandle without requiring a NetworkingContext.
2343
2344         * CMakeLists.txt:
2345         * WebCore.xcodeproj/project.pbxproj:
2346         * loader/CookieJar.cpp:
2347         * platform/network/NetworkStorageSession.cpp: Added.
2348         (WebCore::globalSessionMap):
2349         (WebCore::NetworkStorageSession::storageSession):
2350         (WebCore::NetworkStorageSession::destroySession):
2351         (WebCore::NetworkStorageSession::forEach):
2352         Moved from forEachNetworkStorageSession and fixed the FIXME.  This function now includes the default NetworkStorageSession.
2353         * platform/network/NetworkStorageSession.h:
2354         * platform/network/NetworkingContext.h:
2355         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2356         (WebCore::NetworkStorageSession::defaultStorageSession):
2357         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2358         (WebCore::NetworkStorageSession::cookieStorage):
2359         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
2360         * platform/network/cf/SocketStreamHandleCFNet.cpp:
2361         * platform/network/soup/CookieJarSoup.cpp:
2362         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2363         (WebCore::NetworkStorageSession::defaultStorageSession):
2364         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
2365         (WebCore::NetworkStorageSession::switchToNewTestingSession):
2366         (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
2367         * platform/network/soup/ResourceHandleSoup.cpp:
2368
2369 2016-08-09  Chris Dumez  <cdumez@apple.com>
2370
2371         Optimization in Node.replaceChild() is not spec-compliant
2372         https://bugs.webkit.org/show_bug.cgi?id=160730
2373
2374         Reviewed by Ryosuke Niwa.
2375
2376         We have an optimization in Node.replaceChild() to avoid doing any work
2377         when the reference child and the new child are the same node. This
2378         optimization is not spec-compliant:
2379         - https://dom.spec.whatwg.org/#concept-node-replace
2380
2381         This is an issue because it is observable via Mutation observers /
2382         listeners or DOM ranges.
2383
2384         To address the issue, this patch drops the optimization. This is
2385         probably not common enough to be worth optimizing for. However,
2386         if it turns out to regress performance of things we care about,
2387         we can fall back to do the optimization only in cases where it
2388         is not observable.
2389
2390         No new tests, rebaselined existing tests.
2391
2392         * dom/ContainerNode.cpp:
2393         (WebCore::ContainerNode::replaceChild):
2394         1. Drop the oldChild == newChild optimization which is not in the
2395            specification.
2396         2. Add a null check for oldChild.parentNode() before trying to
2397            remove it from its parent, as per step 12 of the specification.
2398            oldChild.parentNode() is null when oldChild is newChild.
2399         3. Make sure we enqueue separate mutation records for the adoption
2400            of newNode into parent's node document and for the removal of
2401            oldChild / insertion of newChild. This is mandated by the
2402            specification (steps 10 and 15). Without this change, the
2403            following test would still not pass after dropping the
2404            optimization:
2405            imported/w3c/web-platform-tests/dom/nodes/MutationObserver-childList.html
2406
2407 2016-08-09  Chris Dumez  <cdumez@apple.com>
2408
2409         Optimization in Node::appendChild() is not spec-compliant
2410         https://bugs.webkit.org/show_bug.cgi?id=160728
2411
2412         Reviewed by Ryosuke Niwa.
2413
2414         We have an optimization in Node::appendChild() that avoid doing any work
2415         if the node to be appended is already the last child. This optimization
2416         is not spec-compliant:
2417         - https://dom.spec.whatwg.org/#dom-node-appendchild
2418
2419         The issue is that this is observable via DOM Mutation observers / listeners
2420         or DOM ranges.
2421
2422         To address the issue, this patch drops the optimization in appendChild().
2423         This seems like an odd case to optimize for as I am not convinced it is
2424         common to call parent.appendChild(parent.lastChild). If it turns out to
2425         regress the performance of things we care about though, we could fall
2426         back to do the optimization only when it is not observable.
2427
2428         Test: fast/dom/Node/appendChild-no-op-mutationobserver.html
2429
2430         * dom/ContainerNode.cpp:
2431         (WebCore::ContainerNode::appendChild): Deleted.
2432
2433 2016-08-09  Anders Carlsson  <andersca@apple.com>
2434
2435         Instantiate WebKit plug-ins at layout time, instead of at style resolution time
2436         https://bugs.webkit.org/show_bug.cgi?id=160715
2437
2438         Reviewed by Tim Horton.
2439
2440         This gets rid of the differentiation of WebKit plug-ins and Netscape plug-ins, and
2441         always instantiates plug-ins at layout time.
2442         
2443         Initially, plug-ins were always instantiated after style recalc, but that lead to bugs
2444         where plug-ins wouldn't be instantiated with their correct size. Fixing that bug lead
2445         to a regression in the Web Clip widget which is why the special casing was introduced.
2446         
2447         The Web Clip widget has now been fixed, so we can get rid of the special case.
2448
2449         * html/HTMLAppletElement.cpp:
2450         (WebCore::HTMLAppletElement::updateWidget):
2451         * html/HTMLAppletElement.h:
2452         * html/HTMLEmbedElement.cpp:
2453         (WebCore::HTMLEmbedElement::updateWidget):
2454         * html/HTMLEmbedElement.h:
2455         * html/HTMLObjectElement.cpp:
2456         (WebCore::HTMLObjectElement::updateWidget):
2457         * html/HTMLObjectElement.h:
2458         * html/HTMLPlugInImageElement.cpp:
2459         (WebCore::HTMLPlugInImageElement::isImageType):
2460         (WebCore::HTMLPlugInImageElement::wouldLoadAsPlugIn):
2461         (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
2462         (WebCore::HTMLPlugInImageElement::wouldLoadAsNetscapePlugin): Deleted.
2463         * html/HTMLPlugInImageElement.h:
2464         * loader/EmptyClients.h:
2465         * loader/FrameLoaderTypes.h:
2466         * loader/SubframeLoader.cpp:
2467         (WebCore::SubframeLoader::shouldUsePlugin):
2468         * page/FrameView.cpp:
2469         (WebCore::FrameView::updateEmbeddedObject):
2470
2471 2016-08-09  Chris Dumez  <cdumez@apple.com>
2472
2473         Unreviewed, fix assertions after r204311.
2474
2475         Range::textNodeSplit() can now get called with a node that
2476         does not have a nextSibling(), in the case where this node
2477         does not have a parent.
2478
2479         * dom/Range.cpp:
2480         (WebCore::Range::textNodeSplit):
2481
2482 2016-08-09  Chris Dumez  <cdumez@apple.com>
2483
2484         CharacterData.data setter optimization is not spec-compliant and is observable
2485         https://bugs.webkit.org/show_bug.cgi?id=160712
2486
2487         Reviewed by Ryosuke Niwa.
2488
2489         We have an optimization in CharacterData.setData() that avoid doing any
2490         work if the new data is identical to the old data. However, this
2491         optimization is not spec-compliant:
2492         - https://dom.spec.whatwg.org/#dom-characterdata-data
2493
2494         This is an issue because this is observable using DOM mutation observer
2495         or ranges.
2496
2497         To address the issue, we now:
2498         1. Only use the optimization if there are not DOM mutation observers /
2499            listeners on the page.
2500         2. We now update the associated range when we use the fast path as well.
2501
2502         Test: fast/dom/Text/setData-no-op-mutation.html
2503
2504         * dom/CharacterData.cpp:
2505         (WebCore::canUseSetDataOptimization):
2506         (WebCore::CharacterData::setData):
2507
2508 2016-08-09  George Ruan  <gruan@apple.com>
2509
2510         Implement functionality of media capture on iOS
2511         https://bugs.webkit.org/show_bug.cgi?id=158945
2512         <rdar://problem/26893343>
2513
2514         Reviewed by Tim Horton.
2515
2516         No new tests, feature requires user gesture which we are unable to
2517         test currently.
2518
2519         * Configurations/FeatureDefines.xcconfig: Enable Media Capture feature
2520         for iOS.
2521         * html/FileInputType.cpp:
2522         (WebCore::FileInputType::handleDOMActivateEvent): Modified call for
2523         mediaCaptureType property.
2524         * html/HTMLInputElement.cpp:
2525         (WebCore::HTMLInputElement::mediaCaptureType): Returns
2526         MediaCaptureType according to the value of the capture attribute on
2527         the HTMLInputElement.
2528         (WebCore::HTMLInputElement::shouldUseMediaCapture): Deleted.
2529         * html/HTMLInputElement.h:
2530         * html/HTMLInputElement.idl: As the capture attribute is specified as
2531         a boolean attribute in the Media Capture spec, this is a non-standard
2532         web-facing change with accordance to the proposal #1102. We would like
2533         to be able to specify a capture device to pull up upon interaction
2534         with the input type file element. In favor of not introducing a new
2535         attribute to specify the capture device, we reuse the capture
2536         attribute with a set of enumerated values (user, environment, none) to
2537         specify the desired media capture behavior.
2538         * platform/FileChooser.h: Created enum MediaCaptureType representing
2539         whether the front or rear camera shoul dbe shown when the capture
2540         attribute is specified.
2541
2542 2016-08-09  Chris Dumez  <cdumez@apple.com>
2543
2544         Calling splitText() on a parent-less Text node should update associated ranges
2545         https://bugs.webkit.org/show_bug.cgi?id=160710
2546
2547         Reviewed by Ryosuke Niwa.
2548
2549         Calling splitText() on a parent-less Text node should update associated ranges:
2550         - https://dom.spec.whatwg.org/#concept-text-split (Step 9)
2551
2552         Previously, we would only update ranges for Text nodes that have a parent.
2553
2554         No new tests, rebaselined existing test.
2555
2556         * dom/Range.cpp:
2557         (WebCore::boundaryTextNodesSplit):
2558         (WebCore::Range::textNodeSplit): Deleted.
2559         * dom/Text.cpp:
2560         (WebCore::Text::splitText):
2561
2562 2016-08-09  Chris Dumez  <cdumez@apple.com>
2563
2564         Drop unused NodeListsNodeData::isEmpty()
2565         https://bugs.webkit.org/show_bug.cgi?id=160704
2566
2567         Reviewed by Ryosuke Niwa.
2568
2569         Drop unused NodeListsNodeData::isEmpty(). Its implementation is incorrect
2570         anyway because it fails to check if the m_childNodeList / m_emptyChildNodeList
2571         members are null.
2572
2573         * dom/NodeRareData.h:
2574         (WebCore::NodeListsNodeData::isEmpty): Deleted.
2575
2576 2016-08-06  Sam Weinig  <sam@webkit.org>
2577
2578         Replace NodeOrString with std::variant<Ref<Node>, String>
2579         https://bugs.webkit.org/show_bug.cgi?id=160638
2580
2581         Reviewed by Anders Carlsson.
2582
2583         * WebCore.xcodeproj/project.pbxproj:
2584         Remove NodeOrString.h/cpp
2585
2586         * bindings/js/JSNodeOrString.cpp:
2587         * bindings/js/JSNodeOrString.h:
2588         * dom/ContainerNode.cpp:
2589         (WebCore::ContainerNode::append):
2590         (WebCore::ContainerNode::prepend):
2591         * dom/ContainerNode.h:
2592         * dom/Node.cpp:
2593         (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
2594         (WebCore::firstFollowingSiblingNotInNodeSet):
2595         (WebCore::Node::convertNodesOrStringsIntoNode):
2596         (WebCore::Node::before):
2597         (WebCore::Node::after):
2598         (WebCore::Node::replaceWith):
2599         * dom/Node.h:
2600         Replace NodeOrString with std::variant<Ref<Node>, String> and move convertNodesOrStringsIntoNode
2601         into Node.
2602
2603         * dom/NodeOrString.cpp: Removed.
2604         * dom/NodeOrString.h: Removed.
2605
2606 2016-08-09  Chris Dumez  <cdumez@apple.com>
2607
2608         It should be possible to re-initialize a CustomEvent after it's been dispatched
2609         https://bugs.webkit.org/show_bug.cgi?id=160664
2610
2611         Reviewed by Darin Adler.
2612
2613         It should be possible to re-initialize a CustomEvent after it's been dispatched:
2614         - https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
2615
2616         Test: fast/events/initCustomEvent-after-dispatch.html
2617
2618         * dom/CustomEvent.cpp:
2619         (WebCore::CustomEvent::initCustomEvent):
2620
2621 2016-08-09  Anders Carlsson  <andersca@apple.com>
2622
2623         Get rid of PluginStrategy
2624         https://bugs.webkit.org/show_bug.cgi?id=160696
2625
2626         Reviewed by Dan Bernstein.
2627
2628         * WebCore.xcodeproj/project.pbxproj:
2629         * loader/EmptyClients.cpp:
2630         * platform/PlatformStrategies.h:
2631         (WebCore::PlatformStrategies::pluginStrategy): Deleted.
2632         * plugins/PluginInfoProvider.h:
2633         * plugins/PluginStrategy.h: Removed.
2634         (WebCore::PluginStrategy::~PluginStrategy): Deleted.
2635
2636 2016-08-08  Myles C. Maxfield  <mmaxfield@apple.com>
2637
2638         Ensure StringView lifetime is correct inside InlineTextBox
2639         https://bugs.webkit.org/show_bug.cgi?id=160584
2640
2641         Reviewed by Darin Adler.
2642
2643         A TextRun contains a StringView. Previously, we had a helper function which
2644         could possibly create a new string, and then create a TextRun whose StringView
2645         pointed inside this new string. Then, the string would be destroyed because it
2646         was on the stack.
2647
2648         Luckily, this is benign because this new string would always share a
2649         StringImpl with the string passed into the function (and the StringView
2650         would point into this StringImpl). However, relying on this is dangerous
2651         and we are trying to enforce StringView lifetime checks in
2652         https://bugs.webkit.org/show_bug.cgi?id=160384.
2653
2654         The solution is to make a helper function which returns this built string
2655         so that the caller can own this built string, thereby extending its lifetime.
2656         Unfortunately, this built string can't be a StringView because the same
2657         mechanism must be used for text-combine, which returns originalText(), which
2658         may return a built string if it is a RenderCounter. Perhaps it would be
2659         valuable to migrate RenderCounter::originalText() to something else, or to
2660         divorce text-combine from originalText(), but that is out of scope for this
2661         patch. Similarly, hyphenation uses this same mechanism, but because the
2662         hyphenated string needs to be created, we must own the string storage (so
2663         StringView is incorrect here).
2664
2665         Another reason is for performance: StringView::substring() is faster to use
2666         than String::substringSharingImpl(), since it does not allocate and destroy a
2667         StringImpl on the heap. This patch migrates away from
2668         String::substringSharingImpl() and onto StringView::substring().
2669
2670         No new tests because there is no behavior change.
2671
2672         * rendering/InlineTextBox.cpp:
2673         (WebCore::InlineTextBox::localSelectionRect):
2674         (WebCore::InlineTextBox::paint):
2675         (WebCore::InlineTextBox::selectionStartEnd):
2676         (WebCore::InlineTextBox::paintSelection):
2677         (WebCore::InlineTextBox::hyphenatedStringForTextRun):
2678         (WebCore::InlineTextBox::constructTextRun):
2679         * rendering/InlineTextBox.h:
2680         * rendering/RenderCombineText.cpp:
2681         (WebCore::RenderCombineText::maybeGetCombinedStringForRendering):
2682         (WebCore::RenderCombineText::getStringToRender): Deleted.
2683         * rendering/RenderCombineText.h:
2684
2685 2016-08-08  Jeremy Jones  <jeremyj@apple.com>
2686
2687         Clear fullscreen mode state after exiting fullscreen mode to keep state in sync.
2688         https://bugs.webkit.org/show_bug.cgi?id=160668
2689
2690         Reviewed by Jon Lee.
2691
2692         When exiting fullscreen while in auto picture in picture mode, fullscreen mode gets
2693         out of sync, causing exit fullscreen to fail. This change updates the state 
2694         to keep it correct.
2695
2696         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2697         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
2698
2699 2016-08-08  Chris Dumez  <cdumez@apple.com>
2700
2701         [Web IDL] We should resolve typedefs for dictionary members
2702         https://bugs.webkit.org/show_bug.cgi?id=160675
2703
2704         Reviewed by Sam Weinig.
2705
2706         Resolve typedefs for dictionary member types.
2707
2708         Added bindings test coverage.
2709
2710         * bindings/scripts/IDLParser.pm:
2711         (applyTypedefs):
2712         * bindings/scripts/test/JS/JSTestObj.cpp:
2713         (WebCore::convert<TestObj::Dictionary>):
2714         * bindings/scripts/test/TestObj.idl:
2715
2716 2016-08-08  Anders Carlsson  <andersca@apple.com>
2717
2718         Fix the Windows build.
2719
2720         * plugins/PluginInfoProvider.h:
2721
2722 2016-08-08  Anders Carlsson  <andersca@apple.com>
2723
2724         Add a new PluginInfoProvider class, to replace PluginStrategy
2725         https://bugs.webkit.org/show_bug.cgi?id=160670
2726
2727         Reviewed by Sam Weinig.
2728
2729         Add a per page PluginInfoProvider class that's going to ultimately replace the plug-in strategy.
2730
2731         * WebCore.xcodeproj/project.pbxproj:
2732         * loader/EmptyClients.cpp:
2733         (WebCore::fillWithEmptyClients):
2734         * page/Page.cpp:
2735         (WebCore::Page::Page):
2736         (WebCore::Page::~Page):
2737         (WebCore::Page::refreshPlugins):
2738         (WebCore::Page::pluginData):
2739         (WebCore::Page::pluginInfoProvider):
2740         * page/Page.h:
2741         * page/PageConfiguration.cpp:
2742         * page/PageConfiguration.h:
2743         * plugins/DOMPluginArray.cpp:
2744         (WebCore::DOMPluginArray::refresh):
2745         * plugins/DOMPluginArray.h:
2746         * plugins/PluginData.cpp:
2747         (WebCore::PluginData::PluginData):
2748         (WebCore::PluginData::webVisiblePlugins):
2749         (WebCore::PluginData::publiclyVisiblePlugins):
2750         (WebCore::PluginData::initPlugins):
2751         (WebCore::PluginData::refresh): Deleted.
2752         * plugins/PluginData.h:
2753         (WebCore::PluginData::create):
2754         (WebCore::PluginData::PluginData): Deleted.
2755         * plugins/PluginInfoProvider.cpp: Added.
2756         (WebCore::PluginInfoProvider::~PluginInfoProvider):
2757         (WebCore::PluginInfoProvider::addPage):
2758         (WebCore::PluginInfoProvider::removePage):
2759         * plugins/PluginInfoProvider.h: Added.
2760         * replay/SerializationMethods.cpp:
2761         (JSC::EncodingTraits<PluginData>::decodeValue):
2762         (JSC::DeserializedPluginData::DeserializedPluginData): Deleted.
2763
2764 2016-08-08  John Wilander  <wilander@apple.com>
2765
2766         Popups opened from a sandboxed iframe should themselves be sandboxed
2767         https://bugs.webkit.org/show_bug.cgi?id=134850
2768         <rdar://problem/27375388>
2769
2770         Reviewed by Brent Fulgham.
2771
2772         Test: http/tests/security/window-opened-from-sandboxed-iframe-should-inherit-sandbox.html
2773
2774         * loader/FrameLoader.cpp:
2775         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2776             Now copies the opener's frame loader effective sandbox flags to the
2777             new frame loader.
2778
2779 2016-08-08  Chris Dumez  <cdumez@apple.com>
2780
2781         Align Selection API with the specification
2782         https://bugs.webkit.org/show_bug.cgi?id=160663
2783
2784         Reviewed by Ryosuke Niwa.
2785
2786         Align Selection API with the specification:
2787         - https://www.w3.org/TR/selection-api/#idl-def-Selection
2788
2789         In particular, the following changes were made:
2790         - Mark parameters as non-nullable when they should be.
2791         - Mark parameters as mandatory when they should be.
2792         - Use "unsigned long" type for offsets instead of "long".
2793
2794         This aligns our behavior with Firefox and Chrome.
2795
2796         Note that the Node parameters to setBaseAndExtent() operation were kept
2797         nullable, which does not match the specification. This is intentional
2798         as I worry about compatibility risk, especially considering they are
2799         still nullable in Chrome. Only Firefox marks them as non-nullable.
2800
2801         Test: editing/selection/bad-input.html
2802
2803         * dom/Position.h:
2804         (WebCore::Position::LegacyEditingOffset::value):
2805         (WebCore::Position::LegacyEditingOffset::LegacyEditingOffset):
2806         (WebCore::createLegacyEditingPosition):
2807         * page/DOMSelection.cpp:
2808         (WebCore::DOMSelection::anchorOffset):
2809         (WebCore::DOMSelection::focusOffset):
2810         (WebCore::DOMSelection::baseOffset):
2811         (WebCore::DOMSelection::extentOffset):
2812         (WebCore::DOMSelection::rangeCount):
2813         (WebCore::DOMSelection::collapse):
2814         (WebCore::DOMSelection::setBaseAndExtent):
2815         (WebCore::DOMSelection::setPosition):
2816         (WebCore::DOMSelection::extend):
2817         (WebCore::DOMSelection::getRangeAt):
2818         (WebCore::DOMSelection::addRange):
2819         (WebCore::DOMSelection::deleteFromDocument):
2820         (WebCore::DOMSelection::containsNode):
2821         (WebCore::DOMSelection::selectAllChildren):
2822         (WebCore::DOMSelection::shadowAdjustedOffset):
2823         (WebCore::DOMSelection::modify): Deleted.
2824         (WebCore::DOMSelection::shadowAdjustedNode): Deleted.
2825         (WebCore::DOMSelection::isValidForPosition): Deleted.
2826         * page/DOMSelection.h:
2827         * page/DOMSelection.idl:
2828
2829 2016-08-08  Chris Dumez  <cdumez@apple.com>
2830
2831         Regression(r204239): Caused flaky crashes under ~Database()
2832         https://bugs.webkit.org/show_bug.cgi?id=160665
2833         <rdar://problem/27748065>
2834
2835         Reviewed by Brady Eidson.
2836
2837         Make sure the scriptExecution context only gets ref'd / deref'd
2838         on the context thread. Document / WorkerGlobalScope are not
2839         ThreadSafeRefCounted.
2840
2841         No new tests, already covered by:
2842         storage/websql/open-database-creation-callback.html
2843
2844         * Modules/webdatabase/Database.cpp:
2845         (WebCore::Database::~Database):
2846
2847 2016-08-08  John Wilander  <wilander@apple.com>
2848
2849         Don't set document.domain to an IP address fragment
2850         https://bugs.webkit.org/show_bug.cgi?id=126045
2851         <rdar://problem/27331794>
2852
2853         Reviewed by Daniel Bates.
2854
2855         This patch matches the following Blink one:
2856         https://chromium.googlesource.com/chromium/blink//b19a57fdb323d5a80d3a1cb0a6b343558c4237b0
2857
2858         IP address octets should not be treated as subdomains when setting
2859         document.domain. The specs say:
2860         'The domain attribute's setter must run these steps: ...
2861         7. If host is not equal to effectiveDomain, then run these substeps:
2862             1. If host or effectiveDomain is not a domain, then throw a
2863             "SecurityError" DOMException.'
2864         https://html.spec.whatwg.org/multipage/browsers.html#relaxing-the-same-origin-restriction
2865         Last Updated 5 August 2016
2866
2867         'A host is a domain, an IPv4 address, or an IPv6 address.'
2868         https://url.spec.whatwg.org/#concept-domain
2869         Last Updated 28 July 2016
2870
2871         Test: http/tests/security/set-domain-remove-subdomain-for-ip-address.html
2872
2873         * dom/Document.cpp:
2874         (WebCore::Document::setDomain):
2875             Now checks whether the security origin is allowed to remove
2876             subdomains. If not, it throws a security error.
2877         * page/OriginAccessEntry.cpp:
2878         (WebCore::OriginAccessEntry::OriginAccessEntry):
2879             Constructor now expects an IP address setting.
2880         (WebCore::OriginAccessEntry::matchesOrigin):
2881             Now also checks whether the host in an IP address and returns
2882             false if IP addresses aren't configured to be treated as domains.
2883         * page/OriginAccessEntry.h:
2884             Introduced new enum for IP address setting.
2885             Constructor now expects an IP address setting.
2886         (WebCore::OriginAccessEntry::ipAddressSettings):
2887             New getter.
2888         (WebCore::operator==):
2889             Now also requires IP address settings to match.
2890         * page/SecurityPolicy.cpp:
2891         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
2892             Changes to match OriginAccessEntry's new constructor.
2893         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
2894             Changes to match OriginAccessEntry's new constructor.
2895         * page/Settings.in:
2896             Added a setting to allow IP address octets to be treated as
2897             subdomains. This way our existing tests setting document.domain
2898             still work.
2899
2900 2016-08-04  Anders Carlsson  <andersca@apple.com>
2901
2902         Remove more unused bindings code
2903         https://bugs.webkit.org/show_bug.cgi?id=160568
2904
2905         Reviewed by Sam Weinig.
2906
2907         * CMakeLists.txt:
2908         * DerivedSources.make:
2909         * WebCore.xcodeproj/project.pbxproj:
2910         * bindings/objc/DOMDocument.mm:
2911         (-[DOMDocument execCommand:userInterface:]):
2912         (-[DOMDocument execCommand:]):
2913         (-[DOMDocument getMatchedCSSRules:pseudoElement:]):
2914         * bindings/objc/DOMHTMLBaseFontElement.mm:
2915         * bindings/objc/DOMHTMLCollection.mm:
2916         (-[DOMHTMLCollection tags:]):
2917         * bindings/objc/DOMWheelEvent.mm:
2918         (-[DOMWheelEvent isHorizontal]):
2919         * css/RGBColor.idl:
2920         * dom/Attr.idl:
2921         * dom/DOMImplementation.idl:
2922         * dom/Document.h:
2923         * dom/Document.idl:
2924         * dom/Element.idl:
2925         * dom/EventException.h: Removed.
2926         (WebCore::EventException::EventException): Deleted.
2927         * dom/EventException.idl: Removed.
2928         * dom/KeyboardEvent.idl:
2929         * dom/MessageEvent.cpp:
2930         (WebCore::MessageEvent::messagePort): Deleted.
2931         (WebCore::MessageEvent::initMessageEvent): Deleted.
2932         * dom/MessageEvent.h:
2933         * dom/MessagePort.cpp:
2934         (WebCore::MessagePort::postMessage): Deleted.
2935         * dom/MessagePort.h:
2936         * dom/Node.idl:
2937         * dom/NodeFilter.idl:
2938         * dom/OverflowEvent.idl:
2939         * dom/WheelEvent.h:
2940         * dom/WheelEvent.idl:
2941         * html/HTMLAllCollection.cpp:
2942         (WebCore::HTMLAllCollection::tags):
2943         * html/HTMLAllCollection.h:
2944         * html/HTMLAnchorElement.idl:
2945         * html/HTMLAreaElement.idl:
2946         * html/HTMLBaseFontElement.cpp: Removed.
2947         (WebCore::HTMLBaseFontElement::HTMLBaseFontElement): Deleted.
2948         * html/HTMLBaseFontElement.h: Removed.
2949         * html/HTMLBaseFontElement.idl: Removed.
2950         * html/HTMLButtonElement.idl:
2951         * html/HTMLCanvasElement.idl:
2952         * html/HTMLCollection.cpp:
2953         (WebCore::HTMLCollection::tags): Deleted.
2954         * html/HTMLCollection.h:
2955         * html/HTMLCollection.idl:
2956         * html/HTMLElement.idl:
2957         * html/HTMLFieldSetElement.idl:
2958         * html/HTMLFormElement.idl:
2959         * html/HTMLHyperlinkElementUtils.idl:
2960         * html/HTMLIFrameElement.idl:
2961         * html/HTMLImageElement.idl:
2962         * html/HTMLInputElement.idl:
2963         * html/HTMLLabelElement.idl:
2964         * html/HTMLLegendElement.idl:
2965         * html/HTMLLinkElement.idl:
2966         * html/HTMLMediaElement.idl:
2967         * html/HTMLObjectElement.idl:
2968         * html/HTMLOptionsCollection.idl:
2969         * html/HTMLSelectElement.idl:
2970         * html/HTMLTableCellElement.idl:
2971         * html/HTMLTextAreaElement.idl:
2972         * page/DOMWindow.cpp:
2973         (WebCore::DOMWindow::postMessage): Deleted.
2974         * page/DOMWindow.h:
2975         * workers/DedicatedWorkerGlobalScope.cpp:
2976         (WebCore::DedicatedWorkerGlobalScope::postMessage): Deleted.
2977         * workers/DedicatedWorkerGlobalScope.h:
2978         * workers/Worker.cpp:
2979         (WebCore::Worker::postMessage): Deleted.
2980         * workers/Worker.h:
2981
2982 2016-08-08  Brady Eidson  <beidson@apple.com>
2983
2984         Addressing late review feedback in bug 160605
2985         https://bugs.webkit.org/show_bug.cgi?id=160605
2986
2987         Reviewed by Darin's suggestions.
2988
2989         * Modules/gamepad/GamepadManager.cpp:
2990         (WebCore::GamepadManager::maybeStartMonitoringGamepads):
2991         (WebCore::GamepadManager::maybeStopMonitoringGamepads):
2992         
2993         * platform/gamepad/EmptyGamepadProvider.cpp:
2994         (WebCore::EmptyGamepadProvider::startMonitoringGamepads):
2995         (WebCore::EmptyGamepadProvider::stopMonitoringGamepads):
2996         * platform/gamepad/EmptyGamepadProvider.h:
2997         
2998         * platform/gamepad/GamepadProvider.h:
2999         
3000         * platform/gamepad/mac/HIDGamepadProvider.cpp:
3001         (WebCore::HIDGamepadProvider::startMonitoringGamepads):
3002         (WebCore::HIDGamepadProvider::stopMonitoringGamepads):
3003         * platform/gamepad/mac/HIDGamepadProvider.h:
3004         (WebCore::HIDGamepadProvider::platformGamepads): Deleted.
3005
3006 2016-08-08  Chris Dumez  <cdumez@apple.com>
3007
3008         It should be possible to re-initialize an Event after it's been dispatched
3009         https://bugs.webkit.org/show_bug.cgi?id=160651
3010
3011         Reviewed by Darin Adler.
3012
3013         Allow re-initialization of an Event that's already been dispatched, as
3014         per the latest DOM specification:
3015         - https://dom.spec.whatwg.org/#dom-event-initevent
3016
3017         Firefox already follows the specification here.
3018
3019         No new tests, rebaselined existing test.
3020
3021         Test: fast/events/initEvent-after-dispatch.html
3022
3023         * dom/Event.cpp:
3024         (WebCore::Event::initEvent):
3025         - Replace dispatched() check with isBeingDispatched() in order to
3026           allow initialization of an already dispatched event but prevent
3027           initialization of an event that is currently being dispatched
3028           as per:
3029           https://dom.spec.whatwg.org/#dom-event-initevent (step 1)
3030         - Reset target to null as per:
3031           https://dom.spec.whatwg.org/#concept-event-initialize (step 4)
3032
3033 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3034
3035         Unreviewed. Fix GObject DOM bindings API break after r204236.
3036
3037         Text.replaceWholeText was removed from DOM API.
3038
3039         * bindings/gobject/WebKitDOMDeprecated.cpp:
3040         (webkit_dom_text_replace_whole_text):
3041         * bindings/gobject/WebKitDOMDeprecated.h:
3042         * bindings/gobject/WebKitDOMDeprecated.symbols:
3043
3044 2016-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
3045
3046         Unreviewed. Fix GObject DOM bindings API break after r204113.
3047
3048         Document.defaultCharset was removed from DOM API.
3049
3050         * bindings/gobject/WebKitDOMDeprecated.cpp:
3051         (webkit_dom_document_get_default_charset):
3052         * bindings/gobject/WebKitDOMDeprecated.h:
3053         * bindings/gobject/WebKitDOMDeprecated.symbols:
3054
3055 2016-08-07  Chris Dumez  <cdumez@apple.com>
3056
3057         Node.baseURI should not be nullable
3058         https://bugs.webkit.org/show_bug.cgi?id=160649
3059
3060         Reviewed by Darin Adler.
3061
3062         Node.baseURI should not be nullable as per the latest DOM specification:
3063         - https://dom.spec.whatwg.org/#dom-node-baseuri
3064
3065         It is not nullable in Firefox. It is supposed to fallback to using the
3066         document's URL. The document's URL is "about:blank" by default so
3067         baseURI() now returns "about:blank" in the internal URL is null,
3068         similarly to what we do for Document.URL (c.g. urlForBindings()).
3069
3070         No new tests, rebaselined existing test.
3071
3072         * dom/Node.cpp:
3073         (WebCore::Node::baseURI):
3074         * dom/Node.h:
3075         * dom/Node.idl:
3076
3077 2016-08-07  Chris Dumez  <cdumez@apple.com>
3078
3079         Drop SVGDocument as per the SVG2 specification
3080         https://bugs.webkit.org/show_bug.cgi?id=160361
3081
3082         Reviewed by Darin Adler.
3083
3084         Drop SVGDocument as per the SVG2 specification:
3085         - https://www.w3.org/TR/SVG2/struct.html#InterfaceDocumentExtensions
3086
3087         SVGDocument has been merged into Document.
3088
3089         Chrome and Edge have dropped SVGDocument already, Firefox has not.
3090
3091         No new tests, rebaselined existing test.
3092
3093         * accessibility/AccessibilityRenderObject.cpp:
3094         (WebCore::AccessibilityRenderObject::remoteSVGRootElement):
3095         * bindings/js/JSDocumentCustom.cpp:
3096         (WebCore::createNewDocumentWrapper): Deleted.
3097         * bindings/js/JSXMLDocumentCustom.cpp:
3098         (WebCore::toJSNewlyCreated):
3099         (WebCore::toJS): Deleted.
3100         * page/DOMWindow.idl:
3101         * page/FrameView.cpp:
3102         (WebCore::FrameView::scrollToAnchor):
3103         * svg/SVGDocument.cpp:
3104         (WebCore::SVGDocument::rootElement):
3105         (WebCore::SVGDocument::zoomAndPanEnabled):
3106         (WebCore::SVGDocument::startPan):
3107         (WebCore::SVGDocument::updatePan):
3108         * svg/SVGDocument.h:
3109         * svg/SVGDocument.idl:
3110         * svg/graphics/SVGImage.cpp:
3111         (WebCore::SVGImage::rootElement):
3112
3113 2016-08-07  Chris Dumez  <cdumez@apple.com>
3114
3115         Un-expose DOMSettableTokenList
3116         https://bugs.webkit.org/show_bug.cgi?id=160643
3117
3118         Reviewed by Darin Adler.
3119
3120         Un-expose DOMSettableTokenList. We merged DOMSettableTokenList into
3121         DOMTokenList a while back, as per the specification. At the time, we
3122         kept DOMSettableTokenList on Window, as an alias to DOMTokenList.
3123         However, Firefox and Chrome dropped DOMSettableTokenList completely.
3124         We now do the same as other browsers.
3125
3126         No new tests, rebaselined existing test.
3127
3128         * page/DOMWindow.idl:
3129
3130 2016-08-07  Andreas Kling  <akling@apple.com>
3131
3132         DocumentRuleSets::collectFeatures() should shrink-to-fit.
3133         <https://webkit.org/b/160646>
3134
3135         Reviewed by Darin Adler.
3136
3137         We forgot to shrink-wrap the RuleFeatureSet in DocumentRuleSets
3138         after collecting the document-wide features.
3139
3140         * css/DocumentRuleSets.cpp:
3141         (WebCore::DocumentRuleSets::collectFeatures):
3142
3143 2016-08-06  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3144
3145         Purge all uses of PassRefPtr in WebCore/Modules
3146         https://bugs.webkit.org/show_bug.cgi?id=159965
3147
3148         Reviewed by Chris Dumez.
3149
3150         Final clean up in Modules directory.
3151
3152         No new tests, no behavior changes.
3153
3154         * Modules/gamepad/deprecated/GamepadList.cpp:
3155         (WebCore::GamepadList::set):
3156         * Modules/gamepad/deprecated/GamepadList.h:
3157         * Modules/indexeddb/IDBGetResult.h:
3158         (WebCore::IDBGetResult::IDBGetResult):
3159         * Modules/indieui/UIRequestEvent.cpp:
3160         (WebCore::UIRequestEvent::create):
3161         (WebCore::UIRequestEvent::UIRequestEvent):
3162         * Modules/indieui/UIRequestEvent.h:
3163         (WebCore::UIRequestEvent::receiver):
3164         * Modules/mediasource/MediaSourceRegistry.h:
3165         * Modules/mediasource/SampleMap.cpp:
3166         (WebCore::SampleMap::addSample):
3167         * Modules/mediasource/SampleMap.h:
3168         (WebCore::SampleMap::addRange):
3169         * Modules/mediasource/SourceBuffer.cpp:
3170         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3171         (WebCore::SourceBuffer::textTrackAddCue):
3172         (WebCore::SourceBuffer::textTrackRemoveCue):
3173         * Modules/mediasource/SourceBuffer.h:
3174         * Modules/mediastream/CaptureDeviceManager.cpp:
3175         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
3176         * Modules/mediastream/CaptureDeviceManager.h:
3177         * Modules/mediastream/MediaDevicesRequest.h:
3178         * Modules/mediastream/MediaStream.cpp:
3179         (WebCore::MediaStream::internalAddTrack):
3180         (WebCore::MediaStream::internalRemoveTrack):
3181         * Modules/mediastream/MediaStreamRegistry.h:
3182         * Modules/mediastream/MediaStreamTrackEvent.cpp:
3183         (WebCore::MediaStreamTrackEvent::create):
3184         (WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
3185         (WebCore::MediaStreamTrackEvent::track):
3186         * Modules/mediastream/MediaStreamTrackEvent.h:
3187         * Modules/mediastream/MediaTrackConstraints.cpp:
3188         (WebCore::MediaTrackConstraints::create):
3189         (WebCore::MediaTrackConstraints::MediaTrackConstraints):
3190         (WebCore::MediaTrackConstraints::optional):
3191         * Modules/mediastream/MediaTrackConstraints.h:
3192         * Modules/mediastream/RTCDTMFSender.cpp:
3193         (WebCore::RTCDTMFSender::create):
3194         (WebCore::RTCDTMFSender::RTCDTMFSender):
3195         * Modules/mediastream/RTCDTMFSender.h:
3196         * Modules/mediastream/RTCDataChannelEvent.cpp:
3197         (WebCore::RTCDataChannelEvent::create):
3198         (WebCore::RTCDataChannelEvent::RTCDataChannelEvent):
3199         (WebCore::RTCDataChannelEvent::channel):
3200         * Modules/mediastream/RTCDataChannelEvent.h:
3201         * Modules/mediastream/RTCIceServer.h:
3202         * Modules/mediastream/RTCStatsReport.h:
3203         * Modules/mediastream/SourceInfo.cpp:
3204         (WebCore::SourceInfo::create):
3205         (WebCore::SourceInfo::SourceInfo):
3206         * Modules/mediastream/SourceInfo.h:
3207         * Modules/mediastream/UserMediaClient.h:
3208         * Modules/mediastream/UserMediaRequest.cpp:
3209         (WebCore::UserMediaRequest::UserMediaRequest):
3210         (WebCore::UserMediaRequest::didCreateStream):
3211         * Modules/mediastream/UserMediaRequest.h:
3212         * Modules/webdatabase/Database.cpp:
3213         (WebCore::Database::~Database):
3214         * html/HTMLMediaElement.cpp:
3215         (WebCore::HTMLMediaElement::textTrackAddCue):
3216         (WebCore::HTMLMediaElement::textTrackRemoveCue):
3217         * html/HTMLMediaElement.h:
3218         * html/HTMLTrackElement.cpp:
3219         (WebCore::HTMLTrackElement::textTrackAddCue):
3220         (WebCore::HTMLTrackElement::textTrackRemoveCue):
3221         * html/HTMLTrackElement.h:
3222         * html/track/TextTrack.h:
3223         * platform/graphics/SourceBufferPrivateClient.h:
3224         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3225         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame):
3226         * platform/mediastream/MediaStreamCreationClient.h:
3227         * platform/mediastream/mac/AVCaptureDeviceManager.h:
3228         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3229         (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints):
3230         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3231         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
3232         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
3233         (WebCore::MockSourceBufferPrivate::didReceiveSample):
3234
3235 2016-08-06  Chris Dumez  <cdumez@apple.com>
3236
3237         a.replaceChild(a, a) should throw a HierarchyRequestError
3238         https://bugs.webkit.org/show_bug.cgi?id=160640
3239
3240         Reviewed by Darin Adler.
3241
3242         a.replaceChild(a, a) should throw a HierarchyRequestError, because 'a'
3243         is a host-including inclusive ancestor of 'a':
3244         - https://dom.spec.whatwg.org/#concept-node-replace
3245
3246         However, the call is merely ignored in WebKit.
3247
3248         No new tests, rebaselined existing test.
3249
3250         * dom/ContainerNode.cpp:
3251         (WebCore::ContainerNode::replaceChild):
3252
3253 2016-08-06  Chris Dumez  <cdumez@apple.com>
3254
3255         Drop legacy Text.replaceWholeText() API
3256         https://bugs.webkit.org/show_bug.cgi?id=160641
3257
3258         Reviewed by Darin Adler.
3259
3260         Drop legacy Text.replaceWholeText() API, which is no longer in the
3261         specification:
3262         - https://dom.spec.whatwg.org/#interface-text
3263
3264         Firefox and Chrome already dropped support for it.
3265
3266         No new tests, rebaselined existing test.
3267
3268         * dom/Text.idl:
3269
3270 2016-08-06  Chris Dumez  <cdumez@apple.com>
3271
3272         Align Range.createContextualFragment() input validation with the specification
3273         https://bugs.webkit.org/show_bug.cgi?id=160634
3274
3275         Reviewed by Darin Adler.
3276
3277         Align Range.createContextualFragment() input validation with the specification:
3278         - https://w3c.github.io/DOM-Parsing/#idl-def-range-createcontextualfragment(domstring) (Step 2)
3279
3280         In particular, we were throwing a NOT_SUPPORTED_ERR when element had localname
3281         "html" but was not in the HTML namespace. We should not throw in this case.
3282
3283         Firefox complies with the specification here.
3284
3285         No new tests, rebaselined existing test.
3286
3287         * dom/Range.cpp:
3288         (WebCore::Range::createContextualFragment): Deleted.
3289
3290 2016-08-06  Chris Dumez  <cdumez@apple.com>
3291
3292         [Web IDL] Add support for [Unscopable] extended attribute
3293         https://bugs.webkit.org/show_bug.cgi?id=160637
3294
3295         Reviewed by Darin Adler.
3296
3297         Add support for [Unscopable] extended attribute:
3298         - http://heycam.github.io/webidl/#Unscopable
3299
3300         No new tests, rebaselined existing test.
3301
3302         * bindings/scripts/CodeGeneratorJS.pm:
3303         (addUnscopableProperties):
3304         (GenerateImplementation):
3305         * bindings/scripts/IDLAttributes.txt:
3306         * bindings/scripts/test/JS/JSTestObj.cpp:
3307         (WebCore::JSTestObjPrototype::finishCreation):
3308         * bindings/scripts/test/TestObj.idl:
3309         * dom/ChildNode.idl:
3310         * dom/ParentNode.idl:
3311
3312 2016-08-06  Darin Adler  <darin@apple.com>
3313
3314         Simplify valueToUSVString
3315         https://bugs.webkit.org/show_bug.cgi?id=160628
3316
3317         Reviewed by Sam Weinig.
3318
3319         * bindings/js/JSDOMBinding.cpp:
3320         (WebCore::isUnmatchedSurrogatePair): Deleted. This function was incorrectly named,
3321         since it actually returned true if any surrogate code unit was passed.
3322         (WebCore::valueToUSVString): Added a fast path for 8-bit characters that doesn't
3323         bother iterating the string at all. Changed the fast path to actually check for
3324         surrogate pairs. Use StringView::codePoints rather than writing our own loop that
3325         does the same thing. In the slow path, use StringView::codePoints to make the logic
3326         clear rather than writing out exactly what the specification says. This gets rid of
3327         all the many constants the old version of the function contained.
3328
3329 2016-08-06  Youenn Fablet  <youenn@apple.com>
3330
3331         [Fetch API] Fetching with a FormData body should reject until it is implemented
3332         https://bugs.webkit.org/show_bug.cgi?id=160595
3333
3334         Reviewed by Alex Christensen.
3335
3336         Covered by updated tests.
3337
3338         This patch ensures that fetch will throw if trying to upload something that is not supported.
3339         This is the case of BufferSource (FetchBody does not yet extract it) and FormData (no upload support yet).
3340
3341         * Modules/fetch/FetchBody.cpp:
3342         (WebCore::FetchBody::extract): Added a FIXME.
3343         * Modules/fetch/FetchBodyOwner.h:
3344         (WebCore::FetchBodyOwner::bodyType): Getter used by FetchResponse.
3345         * Modules/fetch/FetchRequest.cpp:
3346         (WebCore::FetchRequest::setBody): Throwing if given body parameter cannot be extracted by FetchBody.
3347         This ensures that a fetch with a body that cannot be uploaded will fail.
3348         This is the case of BufferSource which is not yet supported.
3349         * Modules/fetch/FetchResponse.cpp:
3350         (WebCore::FetchResponse::fetch): Rejecting fetch promise if trying to upload a FormData as it is not implemented.
3351
3352 2016-08-06  Youenn Fablet  <youenn@apple.com>
3353
3354         [Fetch API] Fetch API should strip fragment and credentials from URLs used as referrer
3355         https://bugs.webkit.org/show_bug.cgi?id=160593
3356
3357         Reviewed by Alex Christensen.
3358
3359         Covered by updated tests.
3360
3361         Stripping of referrer value before sending a load request.
3362
3363         Fixing bug in workers as referrer value was overwritten by WorkerThreadableLoader.
3364         The current handling of referrer values as HTTP header is not great as this may trigger unnecessary preflighting.
3365         Refactoring should allow passing it as a separate parameter and setting it after preflighting as per
3366         https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
3367
3368         Also a newly added test is failing, as SubresourceLoader is removing the referer header in case of a cross-origin redirection.
3369         But none is added back.
3370
3371         * Modules/fetch/FetchRequest.cpp:
3372         (WebCore::FetchRequest::internalRequest): Stripping referrer value.
3373         * loader/WorkerThreadableLoader.cpp:
3374         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Do not override referrer value if one is defined.
3375         * page/SecurityPolicy.cpp:
3376         (WebCore::SecurityPolicy::generateReferrerHeader): Adding assertion to ensure referrer value does not contain
3377         credentials and/or fragment identifiers.
3378
3379 2016-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
3380
3381         [ES6] Add ScriptElement::determineScriptType
3382         https://bugs.webkit.org/show_bug.cgi?id=149576
3383
3384         Reviewed by Ryosuke Niwa.
3385
3386         Change ScriptElement::isScriptTypeSupported to ScriptElement::determineScriptType.
3387         And introduce ScriptType, which is either "classic" or "module".
3388         And support "module" type in ScriptElement[1, 2].
3389         But this patch does not contain any module tag support code.
3390         This will be implemented in the subsequent patch.
3391
3392         [1]: https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system
3393         [2]: https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type
3394
3395         * dom/ScriptElement.cpp:
3396         (WebCore::ScriptElement::determineScriptType):
3397         (WebCore::ScriptElement::prepareScript):
3398         (WebCore::ScriptElement::isScriptTypeSupported): Deleted.
3399         * dom/ScriptElement.h:
3400
3401 2016-08-05  Jonathan Bedard  <jbedard@apple.com>
3402
3403         NULL Reference Error in ElementRuleCollector
3404         https://bugs.webkit.org/show_bug.cgi?id=160362
3405
3406         Reviewed by Darin Adler.
3407
3408         No new tests, existing CSS tests cover this change.
3409
3410         Undefined behavior sanitizer found a reference bound to a NULL pointer.
3411         The root cause of this issue was a discrepancy between whether an author style needed to be defined.  In some logic, an undefined author style was considered acceptable, but in other logic, author style was always assumed to be defined.  To fix this, a variable was added so that while author style is always defined, there is a flag indicating if this definition occurred in the constructor for use by functions which allow an undefined author style.
3412
3413         * css/DocumentRuleSets.cpp:
3414         (WebCore::DocumentRuleSets::DocumentRuleSets): Define author style by default.
3415         (WebCore::DocumentRuleSets::resetAuthorStyle): Switch author style flag.
3416         * css/DocumentRuleSets.h: Added author style flag, changed authorStyle accessor to reference from pointer.
3417         * css/ElementRuleCollector.cpp:
3418         (WebCore::ElementRuleCollector::ElementRuleCollector): Original location of undefined behavior.
3419         (WebCore::ElementRuleCollector::matchHostPseudoClassRules): Changed pointer to reference.
3420         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules): Changed pointer to reference.
3421         * css/PageRuleCollector.cpp:
3422         (WebCore::PageRuleCollector::matchAllPageRules): Check new flag, changed pointer to reference.
3423
3424         * css/StyleResolver.cpp: Changed pointer to reference.
3425         * dom/Document.cpp: Dito.
3426         * style/AttributeChangeInvalidation.cpp: Dito.
3427         * style/ClassChangeInvalidation.cpp: Dito.
3428         * style/IdChangeInvalidation.cpp: Dito.