Diff
Modified: trunk/LayoutTests/ChangeLog (138630 => 138631)
--- trunk/LayoutTests/ChangeLog 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/LayoutTests/ChangeLog 2013-01-02 20:27:40 UTC (rev 138631)
@@ -1,3 +1,14 @@
+2013-01-02 Chris Rogers <[email protected]>
+
+ Implement WebIDL-style string constants in WebAudio
+ https://bugs.webkit.org/show_bug.cgi?id=105058
+
+ Reviewed by Kentaro Hara.
+
+ * webaudio/oscillator-basic-expected.txt:
+ * webaudio/oscillator-basic.html:
+ * webaudio/resources/audio-testing.js:
+
2013-01-02 Robert Hogan <[email protected]>
Regression (r132935): WebKit breaks between <nobr> tags
Modified: trunk/LayoutTests/webaudio/oscillator-basic-expected.txt (138630 => 138631)
--- trunk/LayoutTests/webaudio/oscillator-basic-expected.txt 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/LayoutTests/webaudio/oscillator-basic-expected.txt 2013-01-02 20:27:40 UTC (rev 138631)
@@ -6,9 +6,15 @@
PASS Oscillator correctly set to SQUARE type.
PASS Oscillator correctly set to SAWTOOTH type.
PASS Oscillator correctly set to TRIANGLE type.
+PASS Oscillator correctly set to SINE type using legacy integer value.
+PASS Oscillator correctly set to SQUARE type using legacy integer value.
+PASS Oscillator correctly set to SAWTOOTH type using legacy integer value.
+PASS Oscillator correctly set to TRIANGLE type using legacy integer value.
PASS Oscillator correctly set to CUSTOM type using setWaveTable.
PASS Directly setting oscillator type to CUSTOM correctly throws exception.
PASS Setting oscillator to invalid type 5 correctly throws exception.
+PASS Setting .type to illegal string value threw TypeError.
+PASS Setting .type to illegal type of Float32Array threw TypeError.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/webaudio/oscillator-basic.html (138630 => 138631)
--- trunk/LayoutTests/webaudio/oscillator-basic.html 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/LayoutTests/webaudio/oscillator-basic.html 2013-01-02 20:27:40 UTC (rev 138631)
@@ -20,11 +20,11 @@
var sampleRate = 44100;
var renderLengthSeconds = 0.25;
-var oscTypes = [{type: 0, name: "SINE"},
- {type: 1, name: "SQUARE"},
- {type: 2, name: "SAWTOOTH"},
- {type: 3, name: "TRIANGLE"},
- {type: 4, name: "CUSTOM"}];
+var oscTypes = [{type: "sine", integerType: 0, name: "SINE"},
+ {type: "square", integerType: 1, name: "SQUARE"},
+ {type: "sawtooth", integerType: 2, name: "SAWTOOTH"},
+ {type: "triangle", integerType: 3, name: "TRIANGLE"},
+ {type: "custom", integerType: 4, name: "CUSTOM"}];
function runTest()
{
@@ -40,27 +40,38 @@
var osc = context.createOscillator();
// Set each possible oscillator type (except CUSTOM) and verify that the type is correct.
+ // Here we're setting the type using WebIDL enum values which are strings.
for (var k = 0; k < oscTypes.length - 1; ++k) {
- osc.type = oscTypes[k].type
+ osc.type = oscTypes[k].type;
if (osc.type == oscTypes[k].type)
testPassed("Oscillator correctly set to " + oscTypes[k].name + " type.");
else
testFailed("Oscillator set to " + oscTypes[k].name + " type, but returns " + oscTypes[osc.type].name + " type.");
}
+ // For legacy support, verify that we can set the type attribute as an integer value and
+ // verify that this translates correctly to the WebIDL enum value.
+ for (var k = 0; k < oscTypes.length - 1; ++k) {
+ osc.type = oscTypes[k].integerType;
+ if (osc.type == oscTypes[k].type)
+ testPassed("Oscillator correctly set to " + oscTypes[k].name + " type using legacy integer value.");
+ else
+ testFailed("Oscillator set to " + oscTypes[k].name + " type, but returns " + oscTypes[osc.type].name + " type using legacy integer value.");
+ }
+
// Now set a custom oscillator
var coeffA = new Float32Array([0, 1, 0.5]);
var coeffB = new Float32Array([0, 0, 0]);
var wavetable = context.createWaveTable(coeffA, coeffB);
osc.setWaveTable(wavetable);
- if (osc.type == osc.CUSTOM)
+ if (osc.type == "custom")
testPassed("Oscillator correctly set to CUSTOM type using setWaveTable.");
else
testFailed("Oscillator set to CUSTOM type, but returns " + oscTypes[osc.type].name + " type.");
// Try setting some invalid types
try {
- osc.type = osc.CUSTOM;
+ osc.type = "custom";
testFailed("Directly setting oscillator type to CUSTOM did not throw exception.");
} catch (e) {
testPassed("Directly setting oscillator type to CUSTOM correctly throws exception.");
@@ -74,6 +85,10 @@
testPassed("Setting oscillator to invalid type " + oscType + " correctly throws exception.");
}
+ // Check specifically that we throw a TypeError.
+ shouldThrowTypeError(function() { osc.type = "xyz12349jfksd"; }, "Setting .type to illegal string value");
+ shouldThrowTypeError(function() { osc.type = new Float32Array(1); }, "Setting .type to illegal type of Float32Array");
+
finishJSTest();
}
Modified: trunk/LayoutTests/webaudio/resources/audio-testing.js (138630 => 138631)
--- trunk/LayoutTests/webaudio/resources/audio-testing.js 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/LayoutTests/webaudio/resources/audio-testing.js 2013-01-02 20:27:40 UTC (rev 138631)
@@ -174,3 +174,19 @@
function isValidNumber(x) {
return !isNaN(x) && (x != Infinity) && (x != -Infinity);
}
+
+function shouldThrowTypeError(func, text) {
+ var ok = false;
+ try {
+ func();
+ } catch (e) {
+ if (e instanceof TypeError) {
+ ok = true;
+ }
+ }
+ if (ok) {
+ testPassed(text + " threw TypeError.");
+ } else {
+ testFailed(text + " should throw TypeError.");
+ }
+}
Modified: trunk/Source/WebCore/ChangeLog (138630 => 138631)
--- trunk/Source/WebCore/ChangeLog 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/ChangeLog 2013-01-02 20:27:40 UTC (rev 138631)
@@ -1,3 +1,38 @@
+2013-01-02 Chris Rogers <[email protected]>
+
+ Implement WebIDL-style string constants in WebAudio
+ https://bugs.webkit.org/show_bug.cgi?id=105058
+
+ Reviewed by Kentaro Hara.
+
+ See Deprecation Notes for more detail:
+ https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#DeprecationNotes
+
+ PannerNode, BiquadFilterNode, OscillatorNode constants must support WebIDL-style string constants.
+ Legacy support in the setters for the old integer values should be supported.
+
+ This patch handles the changes for OscillatorNode.
+
+ * GNUmakefile.list.am:
+ * Modules/webaudio/OscillatorNode.cpp:
+ (WebCore::OscillatorNode::OscillatorNode):
+ (WebCore::OscillatorNode::type):
+ (WebCore):
+ (WebCore::OscillatorNode::setType):
+ * Modules/webaudio/OscillatorNode.h:
+ * Modules/webaudio/OscillatorNode.idl:
+ * Target.pri:
+ * UseJSC.cmake:
+ * UseV8.cmake:
+ * WebCore.gypi:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSOscillatorNodeCustom.cpp: Copied from Source/WebCore/Modules/webaudio/OscillatorNode.idl.
+ (WebCore):
+ (WebCore::JSOscillatorNode::setType):
+ * bindings/v8/custom/V8OscillatorNodeCustom.cpp: Copied from Source/WebCore/Modules/webaudio/OscillatorNode.idl.
+ (WebCore):
+ (WebCore::V8OscillatorNode::typeAccessorSetter):
+
2013-01-02 Robert Hogan <[email protected]>
Regression (r132935): WebKit breaks between <nobr> tags
Modified: trunk/Source/WebCore/GNUmakefile.list.am (138630 => 138631)
--- trunk/Source/WebCore/GNUmakefile.list.am 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2013-01-02 20:27:40 UTC (rev 138631)
@@ -2382,6 +2382,7 @@
Source/WebCore/bindings/js/JSNodeFilterCustom.cpp \
Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp \
Source/WebCore/bindings/js/JSNodeListCustom.cpp \
+ Source/WebCore/bindings/js/JSOscillatorNodeCustom.cpp \
Source/WebCore/bindings/js/JSPluginElementFunctions.cpp \
Source/WebCore/bindings/js/JSPluginElementFunctions.h \
Source/WebCore/bindings/js/JSPopStateEventCustom.cpp \
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp (138630 => 138631)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2013-01-02 20:27:40 UTC (rev 138631)
@@ -69,8 +69,7 @@
m_detune = AudioParam::create(context, "detune", 0, -4800, 4800);
// Sets up default wavetable.
- ExceptionCode ec;
- setType(m_type, ec);
+ setType(m_type);
// An oscillator is always mono.
addOutput(adoptPtr(new AudioNodeOutput(this, 1)));
@@ -83,8 +82,41 @@
uninitialize();
}
-void OscillatorNode::setType(unsigned short type, ExceptionCode& ec)
+String OscillatorNode::type() const
{
+ switch (m_type) {
+ case SINE:
+ return "sine";
+ case SQUARE:
+ return "square";
+ case SAWTOOTH:
+ return "sawtooth";
+ case TRIANGLE:
+ return "triangle";
+ case CUSTOM:
+ return "custom";
+ default:
+ ASSERT_NOT_REACHED();
+ return "custom";
+ }
+}
+
+void OscillatorNode::setType(const String& type)
+{
+ if (type == "sine")
+ setType(SINE);
+ else if (type == "square")
+ setType(SQUARE);
+ else if (type == "sawtooth")
+ setType(SAWTOOTH);
+ else if (type == "triangle")
+ setType(TRIANGLE);
+ else
+ ASSERT_NOT_REACHED();
+}
+
+bool OscillatorNode::setType(unsigned type)
+{
WaveTable* waveTable = 0;
float sampleRate = this->sampleRate();
@@ -111,14 +143,14 @@
break;
case CUSTOM:
default:
- // Throw exception for invalid types, including CUSTOM since setWaveTable() method must be
+ // Return error for invalid types, including CUSTOM since setWaveTable() method must be
// called explicitly.
- ec = NOT_SUPPORTED_ERR;
- return;
+ return false;
}
setWaveTable(waveTable);
m_type = type;
+ return true;
}
bool OscillatorNode::calculateSampleAccuratePhaseIncrements(size_t framesToProcess)
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h (138630 => 138631)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2013-01-02 20:27:40 UTC (rev 138631)
@@ -60,9 +60,11 @@
virtual void process(size_t framesToProcess);
virtual void reset();
- unsigned short type() const { return m_type; }
- void setType(unsigned short, ExceptionCode&);
+ String type() const;
+ bool setType(unsigned); // Returns true on success.
+ void setType(const String&);
+
AudioParam* frequency() { return m_frequency.get(); }
AudioParam* detune() { return m_detune.get(); }
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl (138630 => 138631)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2013-01-02 20:27:40 UTC (rev 138631)
@@ -35,8 +35,7 @@
const unsigned short TRIANGLE = 3;
const unsigned short CUSTOM = 4;
- attribute unsigned short type
- setter raises(DOMException);
+ [CustomSetter] attribute DOMString type;
// Playback state constants.
const unsigned short UNSCHEDULED_STATE = 0;
Modified: trunk/Source/WebCore/Target.pri (138630 => 138631)
--- trunk/Source/WebCore/Target.pri 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/Target.pri 2013-01-02 20:27:40 UTC (rev 138631)
@@ -3420,6 +3420,7 @@
bindings/js/JSAudioBufferSourceNodeCustom.cpp \
bindings/js/JSAudioContextCustom.cpp \
bindings/js/JSDOMWindowWebAudioCustom.cpp \
+ bindings/js/JSOscillatorNodeCustom.cpp \
bindings/js/JSScriptProcessorNodeCustom.cpp \
Modules/webaudio/AsyncAudioDecoder.cpp \
Modules/webaudio/AudioBasicInspectorNode.cpp \
Modified: trunk/Source/WebCore/UseJSC.cmake (138630 => 138631)
--- trunk/Source/WebCore/UseJSC.cmake 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/UseJSC.cmake 2013-01-02 20:27:40 UTC (rev 138631)
@@ -268,6 +268,7 @@
list(APPEND WebCore_SOURCES
bindings/js/JSAudioBufferSourceNodeCustom.cpp
bindings/js/JSAudioContextCustom.cpp
+ bindings/js/JSOscillatorNodeCustom.cpp
bindings/js/JSScriptProcessorNodeCustom.cpp
)
endif ()
Modified: trunk/Source/WebCore/UseV8.cmake (138630 => 138631)
--- trunk/Source/WebCore/UseV8.cmake 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/UseV8.cmake 2013-01-02 20:27:40 UTC (rev 138631)
@@ -137,6 +137,7 @@
bindings/v8/custom/V8NodeListCustom.cpp
bindings/v8/custom/V8NotificationCustom.cpp
bindings/v8/custom/V8NotificationCenterCustom.cpp
+ bindings/v8/custom/V8OscillatorNodeCustom.cpp
bindings/v8/custom/V8PerformanceEntryCustom.cpp
bindings/v8/custom/V8PopStateEventCustom.cpp
bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
Modified: trunk/Source/WebCore/WebCore.gypi (138630 => 138631)
--- trunk/Source/WebCore/WebCore.gypi 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/WebCore.gypi 2013-01-02 20:27:40 UTC (rev 138631)
@@ -1371,6 +1371,7 @@
'bindings/v8/custom/V8NodeListCustom.cpp',
'bindings/v8/custom/V8NotificationCustom.cpp',
'bindings/v8/custom/V8NotificationCenterCustom.cpp',
+ 'bindings/v8/custom/V8OscillatorNodeCustom.cpp',
'bindings/v8/custom/V8PerformanceEntryCustom.cpp',
'bindings/v8/custom/V8PopStateEventCustom.cpp',
'bindings/v8/custom/V8SQLResultSetRowListCustom.cpp',
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (138630 => 138631)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-01-02 20:18:15 UTC (rev 138630)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-01-02 20:27:40 UTC (rev 138631)
@@ -6641,6 +6641,7 @@
FDB052E01561A42C00B500D6 /* AudioSummingJunction.h in Headers */ = {isa = PBXBuildFile; fileRef = FDB052DE1561A42C00B500D6 /* AudioSummingJunction.h */; };
FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDB1700314A2BAB200A2B5D9 /* MultiChannelResampler.cpp */; };
FDB1700614A2BAB200A2B5D9 /* MultiChannelResampler.h in Headers */ = {isa = PBXBuildFile; fileRef = FDB1700414A2BAB200A2B5D9 /* MultiChannelResampler.h */; };
+ FDBD1DFC167FE27D0051A11E /* JSOscillatorNodeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */; };
FDBD480C159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDBD480A159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp */; };
FDBD480D159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FDBD480B159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h */; };
FDC54F041399B0DA008D9117 /* BiquadFilterNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FDC54F011399B0DA008D9117 /* BiquadFilterNode.cpp */; };
@@ -14218,6 +14219,7 @@
FDB052DE1561A42C00B500D6 /* AudioSummingJunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSummingJunction.h; sourceTree = "<group>"; };
FDB1700314A2BAB200A2B5D9 /* MultiChannelResampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiChannelResampler.cpp; sourceTree = "<group>"; };
FDB1700414A2BAB200A2B5D9 /* MultiChannelResampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiChannelResampler.h; sourceTree = "<group>"; };
+ FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOscillatorNodeCustom.cpp; sourceTree = "<group>"; };
FDBD480A159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaStreamAudioSourceNode.cpp; sourceTree = "<group>"; };
FDBD480B159BC6870093EB4F /* JSMediaStreamAudioSourceNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaStreamAudioSourceNode.h; sourceTree = "<group>"; };
FDC54F011399B0DA008D9117 /* BiquadFilterNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BiquadFilterNode.cpp; sourceTree = "<group>"; };
@@ -20733,6 +20735,7 @@
1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */,
31FE6E6C1501A3BF0004EBC4 /* JSNotificationCustom.cpp */,
+ FDBD1DFB167FE27D0051A11E /* JSOscillatorNodeCustom.cpp */,
A85F22081430377D007CC884 /* JSPopStateEventCustom.cpp */,
E1AD12D51295D0BD00ACA989 /* JSProcessingInstructionCustom.cpp */,
4998AED313FC417F0090B1AA /* JSRequestAnimationFrameCallbackCustom.cpp */,
@@ -29128,6 +29131,7 @@
415071571685067300C3C7B3 /* SelectorFilter.cpp in Sources */,
419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */,
5DA97ECE168E787B000E3676 /* SystemVersionMac.mm in Sources */,
+ FDBD1DFC167FE27D0051A11E /* JSOscillatorNodeCustom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Copied: trunk/Source/WebCore/bindings/js/JSOscillatorNodeCustom.cpp (from rev 138630, trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl) (0 => 138631)
--- trunk/Source/WebCore/bindings/js/JSOscillatorNodeCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSOscillatorNodeCustom.cpp 2013-01-02 20:27:40 UTC (rev 138631)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012, Google 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "JSOscillatorNode.h"
+
+#include "ExceptionCode.h"
+#include "OscillatorNode.h"
+#include <runtime/Error.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+void JSOscillatorNode::setType(ExecState* exec, JSValue value)
+{
+ OscillatorNode* imp = static_cast<OscillatorNode*>(impl());
+
+#if ENABLE(LEGACY_WEB_AUDIO)
+ if (value.isNumber()) {
+ uint32_t type = value.toUInt32(exec);
+ if (!imp->setType(type))
+ throwError(exec, createTypeError(exec, "Illegal OscillatorNode type"));
+ return;
+ }
+#endif
+
+ if (value.isString()) {
+ String type = value.toString(exec)->value(exec);
+ if (type == "sine" || type == "square" || type == "sawtooth" || type == "triangle") {
+ imp->setType(type);
+ return;
+ }
+ }
+
+ throwError(exec, createTypeError(exec, "Illegal OscillatorNode type"));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
Copied: trunk/Source/WebCore/bindings/v8/custom/V8OscillatorNodeCustom.cpp (from rev 138630, trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl) (0 => 138631)
--- trunk/Source/WebCore/bindings/v8/custom/V8OscillatorNodeCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8OscillatorNodeCustom.cpp 2013-01-02 20:27:40 UTC (rev 138631)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012, Google 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(WEB_AUDIO)
+
+#include "V8OscillatorNode.h"
+
+#include "ExceptionCode.h"
+#include "OscillatorNode.h"
+#include "V8Binding.h"
+
+namespace WebCore {
+
+void V8OscillatorNode::typeAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.OscillatorNode.type._set");
+ v8::Handle<v8::Object> holder = info.Holder();
+ OscillatorNode* imp = V8OscillatorNode::toNative(holder);
+
+#if ENABLE(LEGACY_WEB_AUDIO)
+ if (value->IsNumber()) {
+ bool ok = false;
+ uint32_t type = toUInt32(value, ok);
+ if (!ok || !imp->setType(type))
+ throwError(v8TypeError, "Illegal OscillatorNode type", info.GetIsolate());
+ return;
+ }
+#endif
+
+ if (value->IsString()) {
+ String type = toWebCoreString(value);
+ if (type == "sine" || type == "square" || type == "sawtooth" || type == "triangle") {
+ imp->setType(type);
+ return;
+ }
+ }
+
+ throwError(v8TypeError, "Illegal OscillatorNode type", info.GetIsolate());
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)