Bug 1413256 - ConstantSourceNode.offset min/max values. Most-negative and most-positive single-float instead of -infinity/+infinity. r?padenot draft
authorThéo Rabut <theo.rabut@etu.univ-lyon1.fr>
Mon, 20 Nov 2017 16:53:43 +0100
changeset 700615 787bd092c6f0939b9c94c45372328d809976295d
parent 699635 010374bce60670cf1348150fe493d0193318d4f6
child 740942 978251ed266e9175d3122303b3d1207a05974cec
push id89909
push userbmo:theo.rabut@etu.univ-lyon1.fr
push dateMon, 20 Nov 2017 15:55:03 +0000
reviewerspadenot
bugs1413256
milestone59.0a1
Bug 1413256 - ConstantSourceNode.offset min/max values. Most-negative and most-positive single-float instead of -infinity/+infinity. r?padenot MozReview-Commit-ID: USUW4tjgSD
dom/media/webaudio/ConstantSourceNode.cpp
dom/media/webaudio/test/mochitest.ini
dom/media/webaudio/test/test_bug1413256.html
--- a/dom/media/webaudio/ConstantSourceNode.cpp
+++ b/dom/media/webaudio/ConstantSourceNode.cpp
@@ -145,17 +145,19 @@ public:
 };
 
 ConstantSourceNode::ConstantSourceNode(AudioContext* aContext)
   : AudioScheduledSourceNode(aContext,
                              1,
                              ChannelCountMode::Max,
                              ChannelInterpretation::Speakers)
   , mOffset(new AudioParam(this, ConstantSourceNodeEngine::OFFSET,
-                           "offset", 1.0f))
+                           "offset", 1.0f,
+                           std::numeric_limits<float>::lowest(),
+                           std::numeric_limits<float>::max()))
   , mStartCalled(false)
 {
   ConstantSourceNodeEngine* engine = new ConstantSourceNodeEngine(this, aContext->Destination());
   mStream = AudioNodeStream::Create(aContext, engine,
                                     AudioNodeStream::NEED_MAIN_THREAD_FINISHED,
                                     aContext->Graph());
   engine->SetSourceStream(mStream);
   mStream->AddMainThreadListener(this);
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -102,16 +102,17 @@ tags=capturestream
 [test_bug1113634.html]
 [test_bug1118372.html]
 [test_bug1027864.html]
 [test_bug1056032.html]
 skip-if = toolkit == 'android' # bug 1056706
 [test_bug1255618.html]
 [test_bug1267579.html]
 [test_bug1355798.html]
+[test_bug1413256.html]
 [test_channelMergerNode.html]
 [test_channelMergerNodeWithVolume.html]
 [test_channelSplitterNode.html]
 [test_channelSplitterNodeWithVolume.html]
 skip-if = (android_version == '18' && debug) # bug 1158417
 [test_convolverNode.html]
 [test_convolverNode_mono_mono.html]
 [test_convolverNodeChannelCount.html]
new file mode 100644
--- /dev/null
+++ b/dom/media/webaudio/test/test_bug1413256.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test offset.minValue and offset.maxValue are correct</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="webaudio.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+c = new AudioContext();
+n = new ConstantSourceNode(c);
+var min =-3.4028234663852886e+38;
+var max = 3.4028234663852886e+38;
+is(n.offset.minValue, min,"Sould be the most-negative single-float value");
+is(n.offset.maxValue, max,"Should be the most-positive single-float value");
+
+
+</script>
+</pre>
+</body>
+</html>
\ No newline at end of file