From 12299139d50e4e612c85da30913fe20ea521b109 Mon Sep 17 00:00:00 2001 From: Razvan Maries Date: Fri, 30 Nov 2018 06:58:06 +0200 Subject: [PATCH] Backed out changeset 0e1dbfd10378 (bug 1501709) for build bustages on Windows platform, CLOSED TREE. --- dom/media/webaudio/AudioParamDescriptorMap.h | 25 --- .../webaudio/AudioWorkletGlobalScope.cpp | 82 ------- dom/media/webaudio/AudioWorkletGlobalScope.h | 8 - dom/media/webaudio/moz.build | 1 - dom/webidl/AudioParamDescriptor.webidl | 22 -- dom/webidl/moz.build | 1 - ...ioWorkletGlobalScopeRegisterProcessor.html | 9 - ...udioWorkletGlobalScopeRegisterProcessor.js | 210 ------------------ 8 files changed, 358 deletions(-) delete mode 100644 dom/media/webaudio/AudioParamDescriptorMap.h delete mode 100644 dom/webidl/AudioParamDescriptor.webidl diff --git a/dom/media/webaudio/AudioParamDescriptorMap.h b/dom/media/webaudio/AudioParamDescriptorMap.h deleted file mode 100644 index b64d170207fc..000000000000 --- a/dom/media/webaudio/AudioParamDescriptorMap.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_AudioParamDescriptor_h -#define mozilla_dom_AudioParamDescriptor_h - -#include "mozilla/dom/AudioParamDescriptorBinding.h" -#include "nsTArray.h" - -namespace mozilla { -namespace dom { - -// Note: we call this "map" to match the spec, but we store audio param -// descriptors in an array, because we need ordered access, and don't need the -// map functionalities. -typedef nsTArray AudioParamDescriptorMap; - - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_AudioParamDescriptor_h diff --git a/dom/media/webaudio/AudioWorkletGlobalScope.cpp b/dom/media/webaudio/AudioWorkletGlobalScope.cpp index e0bd404f4ff7..01a399c76860 100644 --- a/dom/media/webaudio/AudioWorkletGlobalScope.cpp +++ b/dom/media/webaudio/AudioWorkletGlobalScope.cpp @@ -10,9 +10,6 @@ #include "jsapi.h" #include "mozilla/dom/AudioWorkletGlobalScopeBinding.h" #include "mozilla/dom/WorkletPrincipal.h" -#include "mozilla/dom/AudioParamDescriptorBinding.h" -#include "nsPrintfCString.h" -#include "nsTHashtable.h" namespace mozilla { namespace dom { @@ -181,10 +178,6 @@ void AudioWorkletGlobalScope::RegisterProcessor(JSContext* aCx, * (name - descriptors) to the node name to parameter descriptor * map of the associated BaseAudioContext. */ - AudioParamDescriptorMap map = DescriptorsFromJS(aCx, descriptors, aRv); - if (aRv.Failed()) { - return; - } // TODO: we don't have a proper mechanism to communicate with the // control thread currently. See // https://bugzilla.mozilla.org/show_bug.cgi?id=1473467#c3 @@ -199,80 +192,5 @@ double AudioWorkletGlobalScope::CurrentTime() const { return mCurrentTime; } float AudioWorkletGlobalScope::SampleRate() const { return mSampleRate; } -AudioParamDescriptorMap AudioWorkletGlobalScope::DescriptorsFromJS( - JSContext* aCx, const JS::Rooted& aDescriptors, ErrorResult& aRv) -{ - // We already checked if aDescriptors is an array or undefined in step 8 of - // registerProcessor, so we should be confident aDescriptors if valid here - if (aDescriptors.isUndefined()) { - return AudioParamDescriptorMap(); - } - MOZ_ASSERT(aDescriptors.isObject()); - - AudioParamDescriptorMap res; - // To check for duplicates - nsTHashtable namesSet; - - JS::Rooted aDescriptorsArray(aCx, &aDescriptors.toObject()); - uint32_t length = 0; - if (!JS_GetArrayLength(aCx, aDescriptorsArray, &length)) { - aRv.NoteJSContextException(aCx); - return AudioParamDescriptorMap(); - } - - for (uint32_t i = 0; i < length; ++i) { - JS::Rooted descriptorElement(aCx); - if (!JS_GetElement(aCx, aDescriptorsArray, i, &descriptorElement)) { - aRv.NoteJSContextException(aCx); - return AudioParamDescriptorMap(); - } - - AudioParamDescriptor descriptor; - nsPrintfCString sourceDescription("Element %u in parameterDescriptors", i); - if (!descriptor.Init(aCx, descriptorElement, sourceDescription.get())) { - aRv.NoteJSContextException(aCx); - return AudioParamDescriptorMap(); - } - - if (namesSet.Contains(descriptor.mName)) { - aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR, - NS_LITERAL_CSTRING("Duplicated name \"") + - NS_ConvertUTF16toUTF8(descriptor.mName) + - NS_LITERAL_CSTRING("\" in parameterDescriptors.")); - return AudioParamDescriptorMap(); - } - - if (descriptor.mMinValue > descriptor.mMaxValue) { - aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR, - NS_LITERAL_CSTRING("In parameterDescriptors, ") + - NS_ConvertUTF16toUTF8(descriptor.mName) + - NS_LITERAL_CSTRING(" minValue should be smaller than maxValue.")); - return AudioParamDescriptorMap(); - } - - if (descriptor.mDefaultValue < descriptor.mMinValue || - descriptor.mDefaultValue > descriptor.mMaxValue) { - aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR, - NS_LITERAL_CSTRING("In parameterDescriptors, ") + - NS_ConvertUTF16toUTF8(descriptor.mName) + - NS_LITERAL_CSTRING(" defaultValue is out of the range defined by " - "minValue and maxValue.")); - return AudioParamDescriptorMap(); - } - - if (!res.AppendElement(descriptor)) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); - return AudioParamDescriptorMap(); - } - - if (!namesSet.PutEntry(descriptor.mName, fallible)) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); - return AudioParamDescriptorMap(); - } - } - - return res; -} - } // namespace dom } // namespace mozilla diff --git a/dom/media/webaudio/AudioWorkletGlobalScope.h b/dom/media/webaudio/AudioWorkletGlobalScope.h index b1016f1a9826..4d10a0f487ec 100644 --- a/dom/media/webaudio/AudioWorkletGlobalScope.h +++ b/dom/media/webaudio/AudioWorkletGlobalScope.h @@ -7,7 +7,6 @@ #ifndef mozilla_dom_AudioWorkletGlobalScope_h #define mozilla_dom_AudioWorkletGlobalScope_h -#include "mozilla/dom/AudioParamDescriptorMap.h" #include "mozilla/dom/FunctionBinding.h" #include "mozilla/dom/WorkletGlobalScope.h" #include "nsRefPtrHashtable.h" @@ -43,13 +42,6 @@ class AudioWorkletGlobalScope final : public WorkletGlobalScope { private: ~AudioWorkletGlobalScope() = default; - // Returns an AudioParamDescriptorMap filled with AudioParamDescriptor - // objects, extracted from JS. Returns an empty map in case of error and set - // aRv accordingly. - AudioParamDescriptorMap DescriptorsFromJS( - JSContext* aCx, const JS::Rooted& aDescriptors, - ErrorResult& aRv); - const RefPtr mImpl; uint64_t mCurrentFrame; diff --git a/dom/media/webaudio/moz.build b/dom/media/webaudio/moz.build index e2c5386d75d1..8cdfa9af7ed3 100644 --- a/dom/media/webaudio/moz.build +++ b/dom/media/webaudio/moz.build @@ -47,7 +47,6 @@ EXPORTS.mozilla.dom += [ 'AudioListener.h', 'AudioNode.h', 'AudioParam.h', - 'AudioParamDescriptorMap.h', 'AudioParamMap.h', 'AudioProcessingEvent.h', 'AudioScheduledSourceNode.h', diff --git a/dom/webidl/AudioParamDescriptor.webidl b/dom/webidl/AudioParamDescriptor.webidl deleted file mode 100644 index b55224f808d5..000000000000 --- a/dom/webidl/AudioParamDescriptor.webidl +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. - * - * The origin of this IDL file is - * https://webaudio.github.io/web-audio-api/#dictdef-audioparamdescriptor - * - * Copyright © 2018 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C - * liability, trademark and document use rules apply. - */ - -dictionary AudioParamDescriptor { - required DOMString name; - float defaultValue = 0; - float minValue = -3.4028235e38; - float maxValue = 3.4028235e38; - // AutomationRate for AudioWorklet is not needed until bug 1504984 is - // implemented - // AutomationRate automationRate = "a-rate"; -}; - diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index ec316a015fc2..3817dd3f8ac8 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -378,7 +378,6 @@ WEBIDL_FILES = [ 'AudioListener.webidl', 'AudioNode.webidl', 'AudioParam.webidl', - 'AudioParamDescriptor.webidl', 'AudioParamMap.webidl', 'AudioProcessingEvent.webidl', 'AudioScheduledSourceNode.webidl', diff --git a/dom/worklet/tests/test_audioWorkletGlobalScopeRegisterProcessor.html b/dom/worklet/tests/test_audioWorkletGlobalScopeRegisterProcessor.html index ed06a7824bec..5dfcac4a4f6c 100644 --- a/dom/worklet/tests/test_audioWorkletGlobalScopeRegisterProcessor.html +++ b/dom/worklet/tests/test_audioWorkletGlobalScopeRegisterProcessor.html @@ -20,15 +20,6 @@ function configureTest() { "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.process is not callable.", "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor constructor.parameterDescriptors is neither an array nor undefined.", "NotSupportedError: Argument 1 of AudioWorkletGlobalScope.registerProcessor is invalid: a class with the same name is already registered.", - "TypeError: Missing required 'name' member of AudioParamDescriptor.", - "TypeError: 'defaultValue' member of AudioParamDescriptor is not a finite floating-point value.", - "TypeError: 'minValue' member of AudioParamDescriptor is not a finite floating-point value.", - "TypeError: 'maxValue' member of AudioParamDescriptor is not a finite floating-point value.", - "NotSupportedError: Duplicated name \"test\" in parameterDescriptors.", - "TypeError: Element 0 in parameterDescriptors can't be converted to a dictionary.", - "NotSupportedError: In parameterDescriptors, test defaultValue is out of the range defined by minValue and maxValue.", - "NotSupportedError: In parameterDescriptors, test defaultValue is out of the range defined by minValue and maxValue.", - "NotSupportedError: In parameterDescriptors, test minValue should be smaller than maxValue.", ]; var expected_errors_i = 0; diff --git a/dom/worklet/tests/worklet_test_audioWorkletGlobalScopeRegisterProcessor.js b/dom/worklet/tests/worklet_test_audioWorkletGlobalScopeRegisterProcessor.js index a393e61a66f1..ab4d24cd8405 100644 --- a/dom/worklet/tests/worklet_test_audioWorkletGlobalScopeRegisterProcessor.js +++ b/dom/worklet/tests/worklet_test_audioWorkletGlobalScopeRegisterProcessor.js @@ -41,144 +41,6 @@ class DummyProcessWorkletProcessor extends AudioWorkletProcessor { } } -class DescriptorsNoNameWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - defaultValue: 0.707 - }]; - } -} - -class DescriptorsDefaultValueNotNumberWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: "test", - defaultValue: "test" - }]; - } -} - -class DescriptorsMinValueNotNumberWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: "test", - minValue: "test" - }]; - } -} - -class DescriptorsMaxValueNotNumberWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: "test", - maxValue: "test" - }]; - } -} - -class DescriptorsDuplicatedNameWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: "test", - }, { - name: "test", - }]; - } -} - -class DescriptorsNotDictWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [42]; - } -} - -class DescriptorsOutOfRangeMinWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: 'test', - defaultValue: 0, - minValue: 1, - maxValue: 2, - }]; - } -} - -class DescriptorsOutOfRangeMaxWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: 'test', - defaultValue: 3, - minValue: 1, - maxValue: 2, - }]; - } -} - -class DescriptorsBadRangeMaxWorkletProcessor extends AudioWorkletProcessor { - constructor() { super(); } - - process() { - // Do nothing, output silence - } - - static get parameterDescriptors() { - return [{ - name: 'test', - defaultValue: 1.5, - minValue: 2, - maxValue: 1, - }]; - } -} - // Test not a constructor // "TypeError: Argument 2 of AudioWorkletGlobalScope.registerProcessor is not a constructor." try { @@ -242,75 +104,3 @@ try { } catch (e) { console.log(e) } - -// "name" is a mandatory field in descriptors -// "TypeError: Missing required 'name' member of AudioParamDescriptor." -try { - registerProcessor("descriptors-no-name-worklet-processor", DescriptorsNoNameWorkletProcessor); -} catch (e) { - console.log(e) -} - -// "defaultValue" should be a number -// "TypeError: 'defaultValue' member of AudioParamDescriptor is not a finite floating-point value." -try { - registerProcessor("descriptors-default-value-not-number-worklet-processor", DescriptorsDefaultValueNotNumberWorkletProcessor); -} catch (e) { - console.log(e) -} - -// "min" should be a number -// "TypeError: 'minValue' member of AudioParamDescriptor is not a finite floating-point value." -try { - registerProcessor("descriptors-min-value-not-number-worklet-processor", DescriptorsMinValueNotNumberWorkletProcessor); -} catch (e) { - console.log(e) -} - -// "max" should be a number -// "TypeError: 'maxValue' member of AudioParamDescriptor is not a finite floating-point value." -try { - registerProcessor("descriptors-max-value-not-number-worklet-processor", DescriptorsMaxValueNotNumberWorkletProcessor); -} catch (e) { - console.log(e) -} - -// Duplicated values are not allowed for "name" -// "NotSupportedError: Duplicated name \"test\" in parameterDescriptors" -try { - registerProcessor("descriptors-duplicated-name-worklet-processor", DescriptorsDuplicatedNameWorkletProcessor); -} catch (e) { - console.log(e) -} - -// Descriptors' elements should be dictionnary -// "TypeError: Element 0 in parameterDescriptors can't be converted to a dictionary.", -try { - registerProcessor("descriptors-not-dict-worklet-processor", DescriptorsNotDictWorkletProcessor); -} catch (e) { - console.log(e) -} - -// defaultValue value should be in range [minValue, maxValue]. defaultValue < minValue is not allowed -// "NotSupportedError: In parameterDescriptors, test defaultValue is out of the range defined by minValue and maxValue.", -try { - registerProcessor("descriptors-out-of-range-min-worklet-processor", DescriptorsOutOfRangeMinWorkletProcessor); -} catch (e) { - console.log(e) -} - -// defaultValue value should be in range [minValue, maxValue]. defaultValue > maxValue is not allowed -// "NotSupportedError: In parameterDescriptors, test defaultValue is out of the range defined by minValue and maxValue.", -try { - registerProcessor("descriptors-out-of-range-max-worklet-processor", DescriptorsOutOfRangeMaxWorkletProcessor); -} catch (e) { - console.log(e) -} - -// We should have minValue < maxValue to define a valid range -// "NotSupportedError: In parameterDescriptors, test minValue should be smaller than maxValue.", -try { - registerProcessor("descriptors-bad-range-max-worklet-processor", DescriptorsBadRangeMaxWorkletProcessor); -} catch (e) { - console.log(e) -}