Diff
Modified: trunk/LayoutTests/ChangeLog (265329 => 265330)
--- trunk/LayoutTests/ChangeLog 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/LayoutTests/ChangeLog 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,3 +1,15 @@
+2020-08-06 Chris Dumez <cdu...@apple.com>
+
+ MediaElementAudioSourceNode interface should have a constructor
+ https://bugs.webkit.org/show_bug.cgi?id=215200
+
+ Reviewed by Youenn Fablet.
+
+ Add layout test coverage.
+
+ * webaudio/mediaelementaudiosourcenode-constructor-expected.txt: Added.
+ * webaudio/mediaelementaudiosourcenode-constructor.html: Added.
+
2020-08-06 Karl Rackler <rack...@apple.com>
[ iOS wk2 ] editing/pasteboard/paste-without-nesting.html is a flaky failure
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265329 => 265330)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,3 +1,14 @@
+2020-08-06 Chris Dumez <cdu...@apple.com>
+
+ MediaElementAudioSourceNode interface should have a constructor
+ https://bugs.webkit.org/show_bug.cgi?id=215200
+
+ Reviewed by Youenn Fablet.
+
+ Rebaseline WPT test now that more checks are passing.
+
+ * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+
2020-08-05 Chris Dumez <cdu...@apple.com>
Add constructor for DynamicsCompressorNode
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (265329 => 265330)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-08-06 16:18:03 UTC (rev 265330)
@@ -789,38 +789,38 @@
FAIL AudioNode interface: new IIRFilterNode(context, {feedforward: [1], feedback: [1]}) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: IIRFilterNode"
FAIL AudioNode interface: new IIRFilterNode(context, {feedforward: [1], feedback: [1]}) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: IIRFilterNode"
PASS MediaElementAudioSourceNode interface: existence and properties of interface object
-FAIL MediaElementAudioSourceNode interface object length assert_equals: wrong value for MediaElementAudioSourceNode.length expected 2 but got 0
+PASS MediaElementAudioSourceNode interface object length
PASS MediaElementAudioSourceNode interface object name
PASS MediaElementAudioSourceNode interface: existence and properties of interface prototype object
PASS MediaElementAudioSourceNode interface: existence and properties of interface prototype object's "constructor" property
PASS MediaElementAudioSourceNode interface: existence and properties of interface prototype object's @@unscopables property
PASS MediaElementAudioSourceNode interface: attribute mediaElement
-FAIL MediaElementAudioSourceNode must be primary interface of new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL Stringification of new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL MediaElementAudioSourceNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "mediaElement" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "numberOfInputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "numberOfOutputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelCount" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
-FAIL AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new MediaElementAudioSourceNode(context, {mediaElement: new Audio})')"
+PASS MediaElementAudioSourceNode must be primary interface of new MediaElementAudioSourceNode(context, {mediaElement: new Audio})
+PASS Stringification of new MediaElementAudioSourceNode(context, {mediaElement: new Audio})
+PASS MediaElementAudioSourceNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "mediaElement" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect()" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) with too few arguments must throw TypeError
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "context" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "numberOfInputs" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "numberOfOutputs" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelCount" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelCountMode" with the proper type
+PASS AudioNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "channelInterpretation" with the proper type
PASS MediaStreamAudioDestinationNode interface: existence and properties of interface object
FAIL MediaStreamAudioDestinationNode interface object length assert_equals: wrong value for MediaStreamAudioDestinationNode.length expected 1 but got 0
PASS MediaStreamAudioDestinationNode interface object name
Added: trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor-expected.txt (0 => 265330)
--- trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor-expected.txt 2020-08-06 16:18:03 UTC (rev 265330)
@@ -0,0 +1,16 @@
+Tests the MediaElementAudioSourceNode constructor
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new MediaElementAudioSourceNode(); threw exception TypeError: Not enough arguments.
+PASS new MediaElementAudioSourceNode(context); threw exception TypeError: Not enough arguments.
+PASS new MediaElementAudioSourceNode(context, { }); threw exception TypeError: Member MediaElementAudioSourceOptions.mediaElement is required and must be an instance of HTMLMediaElement.
+PASS new MediaElementAudioSourceNode(context, { mediaElement: document.body }); threw exception TypeError: Type error.
+PASS node = new MediaElementAudioSourceNode(context, { mediaElement: audioElement }); did not throw exception.
+PASS node.mediaElement is audioElement
+PASS new MediaElementAudioSourceNode(context, { mediaElement: audioElement }); threw exception InvalidStateError: Media element is already associated with an audio source node.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor.html (0 => 265330)
--- trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor.html (rev 0)
+++ trunk/LayoutTests/webaudio/mediaelementaudiosourcenode-constructor.html 2020-08-06 16:18:03 UTC (rev 265330)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests the MediaElementAudioSourceNode constructor");
+
+context = new AudioContext;
+
+shouldThrowErrorName("new MediaElementAudioSourceNode();", "TypeError");
+shouldThrowErrorName("new MediaElementAudioSourceNode(context);", "TypeError");
+shouldThrowErrorName("new MediaElementAudioSourceNode(context, { });", "TypeError");
+shouldThrowErrorName("new MediaElementAudioSourceNode(context, { mediaElement: document.body });", "TypeError");
+
+audioElement = document.createElement("audio");
+shouldNotThrow("node = new MediaElementAudioSourceNode(context, { mediaElement: audioElement });");
+shouldBe("node.mediaElement", "audioElement");
+
+// audioElement is already associated with a node.
+shouldThrowErrorName("new MediaElementAudioSourceNode(context, { mediaElement: audioElement });", "InvalidStateError");
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/CMakeLists.txt (265329 => 265330)
--- trunk/Source/WebCore/CMakeLists.txt 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-08-06 16:18:03 UTC (rev 265330)
@@ -483,6 +483,7 @@
Modules/webaudio/GainNode.idl
Modules/webaudio/GainOptions.idl
Modules/webaudio/MediaElementAudioSourceNode.idl
+ Modules/webaudio/MediaElementAudioSourceOptions.idl
Modules/webaudio/MediaStreamAudioDestinationNode.idl
Modules/webaudio/MediaStreamAudioSourceNode.idl
Modules/webaudio/OfflineAudioCompletionEvent.idl
Modified: trunk/Source/WebCore/ChangeLog (265329 => 265330)
--- trunk/Source/WebCore/ChangeLog 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/ChangeLog 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,3 +1,34 @@
+2020-08-06 Chris Dumez <cdu...@apple.com>
+
+ MediaElementAudioSourceNode interface should have a constructor
+ https://bugs.webkit.org/show_bug.cgi?id=215200
+
+ Reviewed by Youenn Fablet.
+
+ MediaElementAudioSourceNode interface should have a constructor:
+ - https://webaudio.github.io/web-audio-api/#mediaelementaudiosourcenode
+
+ Test: webaudio/mediaelementaudiosourcenode-constructor.html
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/webaudio/AudioContext.cpp:
+ (WebCore::AudioContext::createMediaElementSource):
+ * Modules/webaudio/AudioContext.idl:
+ * Modules/webaudio/MediaElementAudioSourceNode.cpp:
+ (WebCore::MediaElementAudioSourceNode::create):
+ (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
+ * Modules/webaudio/MediaElementAudioSourceNode.h:
+ * Modules/webaudio/MediaElementAudioSourceNode.idl:
+ * Modules/webaudio/MediaElementAudioSourceOptions.h: Copied from Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl.
+ * Modules/webaudio/MediaElementAudioSourceOptions.idl: Copied from Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl.
+ * Modules/webaudio/WebKitAudioContext.cpp:
+ (WebCore::WebKitAudioContext::createMediaElementSource):
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2020-08-06 Youenn Fablet <you...@apple.com>
Add support for MediaRecorder bitrate options
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (265329 => 265330)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-08-06 16:18:03 UTC (rev 265330)
@@ -332,6 +332,7 @@
$(PROJECT_DIR)/Modules/webaudio/GainNode.idl
$(PROJECT_DIR)/Modules/webaudio/GainOptions.idl
$(PROJECT_DIR)/Modules/webaudio/MediaElementAudioSourceNode.idl
+$(PROJECT_DIR)/Modules/webaudio/MediaElementAudioSourceOptions.idl
$(PROJECT_DIR)/Modules/webaudio/MediaStreamAudioDestinationNode.idl
$(PROJECT_DIR)/Modules/webaudio/MediaStreamAudioSourceNode.idl
$(PROJECT_DIR)/Modules/webaudio/OfflineAudioCompletionEvent.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (265329 => 265330)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1064,6 +1064,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaDevices.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaElementAudioSourceNode.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaElementAudioSourceNode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaElementAudioSourceOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaElementAudioSourceOptions.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaEncodingConfiguration.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaEncodingConfiguration.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaEncodingType.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (265329 => 265330)
--- trunk/Source/WebCore/DerivedSources.make 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/DerivedSources.make 2020-08-06 16:18:03 UTC (rev 265330)
@@ -415,6 +415,7 @@
$(WebCore)/Modules/webaudio/GainNode.idl \
$(WebCore)/Modules/webaudio/GainOptions.idl \
$(WebCore)/Modules/webaudio/MediaElementAudioSourceNode.idl \
+ $(WebCore)/Modules/webaudio/MediaElementAudioSourceOptions.idl \
$(WebCore)/Modules/webaudio/MediaStreamAudioDestinationNode.idl \
$(WebCore)/Modules/webaudio/MediaStreamAudioSourceNode.idl \
$(WebCore)/Modules/webaudio/OfflineAudioCompletionEvent.idl \
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp 2020-08-06 16:18:03 UTC (rev 265330)
@@ -41,6 +41,7 @@
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
#include "MediaElementAudioSourceNode.h"
+#include "MediaElementAudioSourceOptions.h"
#endif
namespace WebCore {
@@ -114,18 +115,7 @@
ALWAYS_LOG(LOGIDENTIFIER);
ASSERT(isMainThread());
-
- if (isStopped() || mediaElement.audioSourceNode())
- return Exception { InvalidStateError };
-
- lazyInitialize();
-
- auto node = MediaElementAudioSourceNode::create(*this, mediaElement);
-
- mediaElement.setAudioSourceNode(node.ptr());
-
- refNode(node.get()); // context keeps reference until node is disconnected
- return node;
+ return MediaElementAudioSourceNode::create(*this, { &mediaElement });
}
#endif
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl 2020-08-06 16:18:03 UTC (rev 265330)
@@ -28,6 +28,7 @@
Conditional=WEB_AUDIO,
EnabledBySetting=WebAudio&ModernUnprefixedWebAudio,
ExportMacro=WEBCORE_EXPORT,
+ JSGenerateToNativeObject,
] interface AudioContext : BaseAudioContext {
[CallWith=Document, MayThrowException] constructor(optional AudioContextOptions contextOptions);
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.cpp 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,6 +32,7 @@
#include "AudioContext.h"
#include "AudioNodeOutput.h"
#include "Logging.h"
+#include "MediaElementAudioSourceOptions.h"
#include "MediaPlayer.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/Locker.h>
@@ -43,16 +45,29 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(MediaElementAudioSourceNode);
-Ref<MediaElementAudioSourceNode> MediaElementAudioSourceNode::create(BaseAudioContext& context, HTMLMediaElement& mediaElement)
+ExceptionOr<Ref<MediaElementAudioSourceNode>> MediaElementAudioSourceNode::create(BaseAudioContext& context, MediaElementAudioSourceOptions&& options)
{
- return adoptRef(*new MediaElementAudioSourceNode(context, mediaElement));
+ RELEASE_ASSERT(options.mediaElement);
+
+ if (context.isStopped())
+ return Exception { InvalidStateError };
+
+ if (options.mediaElement->audioSourceNode())
+ return Exception { InvalidStateError, "Media element is already associated with an audio source node"_s };
+
+ context.lazyInitialize();
+
+ auto node = adoptRef(*new MediaElementAudioSourceNode(context, *options.mediaElement));
+
+ options.mediaElement->setAudioSourceNode(node.ptr());
+ context.refNode(node.get()); // context keeps reference until node is disconnected
+
+ return node;
}
-MediaElementAudioSourceNode::MediaElementAudioSourceNode(BaseAudioContext& context, HTMLMediaElement& mediaElement)
+MediaElementAudioSourceNode::MediaElementAudioSourceNode(BaseAudioContext& context, Ref<HTMLMediaElement>&& mediaElement)
: AudioNode(context, context.sampleRate())
- , m_mediaElement(mediaElement)
- , m_sourceNumberOfChannels(0)
- , m_sourceSampleRate(0)
+ , m_mediaElement(WTFMove(mediaElement))
{
setNodeType(NodeTypeMediaElementAudioSource);
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.h (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.h 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.h 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,11 +37,12 @@
namespace WebCore {
class AudioContext;
+struct MediaElementAudioSourceOptions;
class MediaElementAudioSourceNode final : public AudioNode, public AudioSourceProviderClient {
WTF_MAKE_ISO_ALLOCATED(MediaElementAudioSourceNode);
public:
- static Ref<MediaElementAudioSourceNode> create(BaseAudioContext&, HTMLMediaElement&);
+ static ExceptionOr<Ref<MediaElementAudioSourceNode>> create(BaseAudioContext&, MediaElementAudioSourceOptions&&);
virtual ~MediaElementAudioSourceNode();
@@ -57,7 +59,7 @@
void unlock();
private:
- MediaElementAudioSourceNode(BaseAudioContext&, HTMLMediaElement&);
+ MediaElementAudioSourceNode(BaseAudioContext&, Ref<HTMLMediaElement>&&);
double tailTime() const override { return 0; }
double latencyTime() const override { return 0; }
@@ -70,8 +72,8 @@
Ref<HTMLMediaElement> m_mediaElement;
Lock m_processMutex;
- unsigned m_sourceNumberOfChannels;
- double m_sourceSampleRate;
+ unsigned m_sourceNumberOfChannels { 0 };
+ double m_sourceSampleRate { 0 };
bool m_muted { false };
std::unique_ptr<MultiChannelResampler> m_multiChannelResampler;
Modified: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl 2020-08-06 16:18:03 UTC (rev 265330)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011, Google Inc. All rights reserved.
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,5 +27,7 @@
Conditional=WEB_AUDIO&VIDEO,
JSGenerateToJSObject
] interface MediaElementAudioSourceNode : AudioNode {
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (AudioContext context, MediaElementAudioSourceOptions options);
+
readonly attribute HTMLMediaElement mediaElement;
};
Copied: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.h (from rev 265329, trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl) (0 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.h 2020-08-06 16:18:03 UTC (rev 265330)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUDIO) && ENABLE(VIDEO)
+
+#include "HTMLMediaElement.h"
+
+namespace WebCore {
+
+struct MediaElementAudioSourceOptions {
+ RefPtr<HTMLMediaElement> mediaElement;
+};
+
+} // namespace WebCore
+
+#endif // #if ENABLE(WEB_AUDIO) && ENABLE(VIDEO)
Copied: trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.idl (from rev 265329, trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceNode.idl) (0 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/MediaElementAudioSourceOptions.idl 2020-08-06 16:18:03 UTC (rev 265330)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020, Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=WEB_AUDIO&VIDEO
+] dictionary MediaElementAudioSourceOptions {
+ required HTMLMediaElement mediaElement;
+};
Modified: trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp (265329 => 265330)
--- trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Modules/webaudio/WebKitAudioContext.cpp 2020-08-06 16:18:03 UTC (rev 265330)
@@ -46,6 +46,7 @@
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
#include "MediaElementAudioSourceNode.h"
+#include "MediaElementAudioSourceOptions.h"
#endif
const unsigned MaxPeriodicWaveLength = 4096;
@@ -98,18 +99,7 @@
ALWAYS_LOG(LOGIDENTIFIER);
ASSERT(isMainThread());
-
- if (isStopped() || mediaElement.audioSourceNode())
- return Exception { InvalidStateError };
-
- lazyInitialize();
-
- auto node = MediaElementAudioSourceNode::create(*this, mediaElement);
-
- mediaElement.setAudioSourceNode(node.ptr());
-
- refNode(node.get()); // context keeps reference until node is disconnected
- return node;
+ return MediaElementAudioSourceNode::create(*this, { &mediaElement });
}
#endif
Modified: trunk/Source/WebCore/Sources.txt (265329 => 265330)
--- trunk/Source/WebCore/Sources.txt 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/Sources.txt 2020-08-06 16:18:03 UTC (rev 265330)
@@ -3061,6 +3061,7 @@
JSMediaDeviceInfo.cpp
JSMediaDevices.cpp
JSMediaElementAudioSourceNode.cpp
+JSMediaElementAudioSourceOptions.cpp
JSMediaEncodingConfiguration.cpp
JSMediaEncodingType.cpp
JSMediaEncryptedEvent.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265329 => 265330)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-06 15:47:55 UTC (rev 265329)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-08-06 16:18:03 UTC (rev 265330)
@@ -2430,6 +2430,7 @@
83040283249A7A6200A90D8D /* DistanceModelType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8304027D249A7A5B00A90D8D /* DistanceModelType.h */; };
830519961BB0F11000F3772E /* HTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 830519931BB0F0E700F3772E /* HTMLTimeElement.h */; };
830784B21C52EE2C00104D1D /* XMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 830784B11C52EE1900104D1D /* XMLDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 830A1C7D24DB788B002ECCAD /* MediaElementAudioSourceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A1C7C24DB7870002ECCAD /* MediaElementAudioSourceOptions.h */; };
830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */; };
83102B271F9EADD900E404B9 /* JSExtendableMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 83102B231F9EADC200E404B9 /* JSExtendableMessageEvent.h */; };
8311C0031FAA2E9500E3C8E5 /* SWServerJobQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8311C0021FAA2E8900E3C8E5 /* SWServerJobQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10423,6 +10424,8 @@
8306EFF01B8BCE7C0031D032 /* NativeNodeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeNodeFilter.cpp; sourceTree = "<group>"; };
830784B01C52EE1900104D1D /* XMLDocument.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLDocument.idl; sourceTree = "<group>"; };
830784B11C52EE1900104D1D /* XMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocument.h; sourceTree = "<group>"; };
+ 830A1C7A24DB786F002ECCAD /* MediaElementAudioSourceOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MediaElementAudioSourceOptions.idl; sourceTree = "<group>"; };
+ 830A1C7C24DB7870002ECCAD /* MediaElementAudioSourceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaElementAudioSourceOptions.h; sourceTree = "<group>"; };
830A36BA1DAC5FA7006D7D09 /* JSMouseEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMouseEventInit.cpp; sourceTree = "<group>"; };
830A36BB1DAC5FA7006D7D09 /* JSMouseEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMouseEventInit.h; sourceTree = "<group>"; };
83102B231F9EADC200E404B9 /* JSExtendableMessageEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExtendableMessageEvent.h; sourceTree = "<group>"; };
@@ -29623,6 +29626,8 @@
FD6F252913F5EF0E0065165F /* MediaElementAudioSourceNode.cpp */,
FD6F252A13F5EF0E0065165F /* MediaElementAudioSourceNode.h */,
FD6F252B13F5EF0E0065165F /* MediaElementAudioSourceNode.idl */,
+ 830A1C7C24DB7870002ECCAD /* MediaElementAudioSourceOptions.h */,
+ 830A1C7A24DB786F002ECCAD /* MediaElementAudioSourceOptions.idl */,
078E094817D1709600420AA1 /* MediaStreamAudioDestinationNode.cpp */,
078E094917D1709600420AA1 /* MediaStreamAudioDestinationNode.h */,
078E094A17D1709600420AA1 /* MediaStreamAudioDestinationNode.idl */,
@@ -32529,6 +32534,7 @@
5EA725D31ACABD4700EAD17B /* MediaDevices.h in Headers */,
97205AB81239291000B17380 /* MediaDocument.h in Headers */,
FD6F252D13F5EF0E0065165F /* MediaElementAudioSourceNode.h in Headers */,
+ 830A1C7D24DB788B002ECCAD /* MediaElementAudioSourceOptions.h in Headers */,
07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */,
2D9BF7061DBFBB24007A7D99 /* MediaEncryptedEvent.h in Headers */,
2D9BF7081DBFBB24007A7D99 /* MediaEncryptedEventInit.h in Headers */,