Diff
Modified: trunk/LayoutTests/ChangeLog (277410 => 277411)
--- trunk/LayoutTests/ChangeLog 2021-05-13 00:03:52 UTC (rev 277410)
+++ trunk/LayoutTests/ChangeLog 2021-05-13 00:09:38 UTC (rev 277411)
@@ -1,3 +1,16 @@
+2021-05-12 Chris Dumez <[email protected]>
+
+ ASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated(JSC::JSGlobalObject *, WebCore::JSDOMGlobalObject *, Ref<WebCore::AudioNode> &&)
+ https://bugs.webkit.org/show_bug.cgi?id=225719
+ <rdar://77828031>
+
+ Reviewed by Geoffrey Garen.
+
+ Add layout test coverage. This test was reliably crashing before the fix.
+
+ * webaudio/event-relatedTarget-audionode-expected.txt: Added.
+ * webaudio/event-relatedTarget-audionode.html: Added.
+
2021-05-12 Robert Jenner <[email protected]>
[ BigSur Release wk2 arm64 ] http/tests/appcache/fail-on-update-2.html (layout-test) is a flaky timeout
Added: trunk/LayoutTests/webaudio/event-relatedTarget-audionode-expected.txt (0 => 277411)
--- trunk/LayoutTests/webaudio/event-relatedTarget-audionode-expected.txt (rev 0)
+++ trunk/LayoutTests/webaudio/event-relatedTarget-audionode-expected.txt 2021-05-13 00:09:38 UTC (rev 277411)
@@ -0,0 +1,13 @@
+Tests that we do not crash when trying to access an Event's relatedTarget when the target is an AudioNode and we have GC'd.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS focusEvent.relatedTarget.delayTime.value is 0
+PASS focusEvent.relatedTarget.__proto__ is DelayNode.prototype
+PASS focusEvent.relatedTarget.channelCount is 2
+PASS focusEvent.relatedTarget.context.sampleRate is 3000
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/webaudio/event-relatedTarget-audionode.html (0 => 277411)
--- trunk/LayoutTests/webaudio/event-relatedTarget-audionode.html (rev 0)
+++ trunk/LayoutTests/webaudio/event-relatedTarget-audionode.html 2021-05-13 00:09:38 UTC (rev 277411)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+ description("Tests that we do not crash when trying to access an Event's relatedTarget when the target is an AudioNode and we have GC'd.");
+
+ let focusEvent = new FocusEvent('', {relatedTarget: new DelayNode(new AudioContext({sampleRate: 3000}))});
+ gc();
+ shouldBe("focusEvent.relatedTarget.delayTime.value", "0");
+ shouldBe("focusEvent.relatedTarget.__proto__", "DelayNode.prototype");
+ shouldBe("focusEvent.relatedTarget.channelCount", "2");
+ shouldBe("focusEvent.relatedTarget.context.sampleRate", "3000");
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (277410 => 277411)
--- trunk/Source/WebCore/ChangeLog 2021-05-13 00:03:52 UTC (rev 277410)
+++ trunk/Source/WebCore/ChangeLog 2021-05-13 00:09:38 UTC (rev 277411)
@@ -1,3 +1,24 @@
+2021-05-12 Chris Dumez <[email protected]>
+
+ ASSERTION FAILED: actualVTablePointer == expectedVTablePointer in toJSNewlyCreated(JSC::JSGlobalObject *, WebCore::JSDOMGlobalObject *, Ref<WebCore::AudioNode> &&)
+ https://bugs.webkit.org/show_bug.cgi?id=225719
+ <rdar://77828031>
+
+ Reviewed by Geoffrey Garen.
+
+ AudioNode has (a lot of) subclasses that are exposed to JS (for which we call toJS() for).
+ As a result, AudioNode needs a custom toJS() implementation which returns the correct subclass
+ wrapper, instead of a generic JSAudioNode.
+
+ Test: webaudio/event-relatedTarget-audionode.html
+
+ * Modules/webaudio/AudioNode.idl:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSAudioNodeCustom.cpp: Added.
+ (WebCore::toJSNewlyCreated):
+ (WebCore::toJS):
+
2021-05-12 Ziran Sun <[email protected]>
Wrong position for orthogonal positioned element with writing-mode: vertical-rl
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.idl (277410 => 277411)
--- trunk/Source/WebCore/Modules/webaudio/AudioNode.idl 2021-05-13 00:03:52 UTC (rev 277410)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.idl 2021-05-13 00:09:38 UTC (rev 277411)
@@ -24,6 +24,7 @@
[
Conditional=WEB_AUDIO,
+ CustomToJSObject,
Exposed=Window
] interface AudioNode : EventTarget {
[ImplementedAs=contextForBindings] readonly attribute (BaseAudioContext or WebKitAudioContext) context;
Modified: trunk/Source/WebCore/Sources.txt (277410 => 277411)
--- trunk/Source/WebCore/Sources.txt 2021-05-13 00:03:52 UTC (rev 277410)
+++ trunk/Source/WebCore/Sources.txt 2021-05-13 00:09:38 UTC (rev 277411)
@@ -511,6 +511,7 @@
bindings/js/JSAnimationTimelineCustom.cpp
bindings/js/JSAttrCustom.cpp
bindings/js/JSAudioBufferCustom.cpp
+bindings/js/JSAudioNodeCustom.cpp
bindings/js/JSAudioTrackCustom.cpp
bindings/js/JSAudioTrackListCustom.cpp
bindings/js/JSAudioWorkletProcessorCustom.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (277410 => 277411)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-13 00:03:52 UTC (rev 277410)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-13 00:09:38 UTC (rev 277411)
@@ -8305,6 +8305,7 @@
465EDDA0222F4EC400B46E16 /* DeviceOrientationOrMotionPermissionState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceOrientationOrMotionPermissionState.idl; sourceTree = "<group>"; };
466172E923A2ABFA003AB309 /* PostMessageOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PostMessageOptions.idl; sourceTree = "<group>"; };
466172EB23A2ABFA003AB309 /* PostMessageOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostMessageOptions.h; sourceTree = "<group>"; };
+ 466536FA264C8DD100AAD1D7 /* JSAudioNodeCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioNodeCustom.cpp; sourceTree = "<group>"; };
466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectList.cpp; sourceTree = "<group>"; };
466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMRectList.h; sourceTree = "<group>"; };
4671E0631D67A57B00C6B497 /* CanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPath.cpp; sourceTree = "<group>"; };
@@ -23003,6 +23004,7 @@
71025ED51F99F147004A250C /* JSAnimationTimelineCustom.cpp */,
BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
46C3A8D32548D4B700C8C53A /* JSAudioBufferCustom.cpp */,
+ 466536FA264C8DD100AAD1D7 /* JSAudioNodeCustom.cpp */,
BE6DF70E171CA2DA00DD52B8 /* JSAudioTrackCustom.cpp */,
BE6DF710171CA2DA00DD52B8 /* JSAudioTrackListCustom.cpp */,
83F37A672536B21B00FF5F3B /* JSAudioWorkletProcessorCustom.cpp */,
Added: trunk/Source/WebCore/bindings/js/JSAudioNodeCustom.cpp (0 => 277411)
--- trunk/Source/WebCore/bindings/js/JSAudioNodeCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSAudioNodeCustom.cpp 2021-05-13 00:09:38 UTC (rev 277411)
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2021 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. ``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
+ * 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+#include "JSAudioNode.h"
+
+#include "AnalyserNode.h"
+#include "AudioBufferSourceNode.h"
+#include "AudioDestinationNode.h"
+#include "AudioNode.h"
+#include "AudioWorkletNode.h"
+#include "BiquadFilterNode.h"
+#include "ChannelMergerNode.h"
+#include "ChannelSplitterNode.h"
+#include "ConstantSourceNode.h"
+#include "ConvolverNode.h"
+#include "DelayNode.h"
+#include "DynamicsCompressorNode.h"
+#include "GainNode.h"
+#include "IIRFilterNode.h"
+#include "JSAnalyserNode.h"
+#include "JSAudioBufferSourceNode.h"
+#include "JSAudioDestinationNode.h"
+#include "JSAudioWorkletNode.h"
+#include "JSBiquadFilterNode.h"
+#include "JSChannelMergerNode.h"
+#include "JSChannelSplitterNode.h"
+#include "JSConstantSourceNode.h"
+#include "JSConvolverNode.h"
+#include "JSDelayNode.h"
+#include "JSDynamicsCompressorNode.h"
+#include "JSGainNode.h"
+#include "JSIIRFilterNode.h"
+#include "JSMediaElementAudioSourceNode.h"
+#include "JSMediaStreamAudioDestinationNode.h"
+#include "JSMediaStreamAudioSourceNode.h"
+#include "JSOscillatorNode.h"
+#include "JSPannerNode.h"
+#include "JSScriptProcessorNode.h"
+#include "JSStereoPannerNode.h"
+#include "JSWaveShaperNode.h"
+#include "MediaElementAudioSourceNode.h"
+#include "MediaStreamAudioDestinationNode.h"
+#include "MediaStreamAudioSourceNode.h"
+#include "OscillatorNode.h"
+#include "PannerNode.h"
+#include "ScriptProcessorNode.h"
+#include "StereoPannerNode.h"
+#include "WaveShaperNode.h"
+
+namespace WebCore {
+using namespace JSC;
+
+JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<AudioNode>&& node)
+{
+ switch (node->nodeType()) {
+ case AudioNode::NodeTypeDestination:
+ return createWrapper<AudioDestinationNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeOscillator:
+ return createWrapper<OscillatorNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeAudioBufferSource:
+ return createWrapper<AudioBufferSourceNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeMediaElementAudioSource:
+#if ENABLE(VIDEO)
+ return createWrapper<MediaElementAudioSourceNode>(globalObject, WTFMove(node));
+#else
+ return createWrapper<AudioNode>(globalObject, WTFMove(node));
+#endif
+#if ENABLE(MEDIA_STREAM)
+ case AudioNode::NodeTypeMediaStreamAudioDestination:
+ return createWrapper<MediaStreamAudioDestinationNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeMediaStreamAudioSource:
+ return createWrapper<MediaStreamAudioSourceNode>(globalObject, WTFMove(node));
+#else
+ case AudioNode::NodeTypeMediaStreamAudioDestination:
+ case AudioNode::NodeTypeMediaStreamAudioSource:
+ return createWrapper<AudioNode>(globalObject, WTFMove(node));
+#endif
+ case AudioNode::NodeTypeJavaScript:
+ return createWrapper<ScriptProcessorNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeBiquadFilter:
+ return createWrapper<BiquadFilterNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypePanner:
+ return createWrapper<PannerNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeConvolver:
+ return createWrapper<ConvolverNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeDelay:
+ return createWrapper<DelayNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeGain:
+ return createWrapper<GainNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeChannelSplitter:
+ return createWrapper<ChannelSplitterNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeChannelMerger:
+ return createWrapper<ChannelMergerNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeAnalyser:
+ return createWrapper<AnalyserNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeDynamicsCompressor:
+ return createWrapper<DynamicsCompressorNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeWaveShaper:
+ return createWrapper<WaveShaperNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeConstant:
+ return createWrapper<ConstantSourceNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeStereoPanner:
+ return createWrapper<StereoPannerNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeIIRFilter:
+ return createWrapper<IIRFilterNode>(globalObject, WTFMove(node));
+ case AudioNode::NodeTypeWorklet:
+ return createWrapper<AudioWorkletNode>(globalObject, WTFMove(node));
+ }
+}
+
+JSValue toJS(JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, AudioNode& node)
+{
+ return wrap(lexicalGlobalObject, globalObject, node);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)