-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1007920-render-audio-params-correctly.patch
920 lines (881 loc) · 36.1 KB
/
1007920-render-audio-params-correctly.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
From 383905a776e51fce1c82514514fcfeb5852eac42 Mon Sep 17 00:00:00 2001
From: Jordan Santell <[email protected]>
Date: Tue, 20 May 2014 11:17:04 -0700
Subject: Bug 1007920 - Handle non-primitive types in the AudioNode
actor and in the web audio editor tool. r=vp
---
.../devtools/webaudioeditor/test/440hz_sine.ogg | Bin 0 -> 11822 bytes
browser/devtools/webaudioeditor/test/browser.ini | 7 +-
.../test/browser_audionode-actor-get-params-01.js | 46 ++++++++
.../test/browser_audionode-actor-get-params-02.js | 45 ++++++++
.../test/browser_audionode-actor-get-params.js | 51 ---------
.../test/browser_audionode-actor-get-set-param.js | 3 +-
.../test/browser_wa_properties-view-edit.js | 4 +-
.../browser_wa_properties-view-params-objects.js | 39 +++++++
.../test/browser_wa_properties-view-params.js | 39 +++++++
.../webaudioeditor/test/doc_buffer-and-array.html | 56 ++++++++++
browser/devtools/webaudioeditor/test/head.js | 120 ++++++++++++++++++---
toolkit/devtools/server/actors/webaudio.js | 52 +++++++--
12 files changed, 383 insertions(+), 79 deletions(-)
create mode 100644 browser/devtools/webaudioeditor/test/440hz_sine.ogg
create mode 100644 browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-01.js
create mode 100644 browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-02.js
delete mode 100644 browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params.js
create mode 100644 browser/devtools/webaudioeditor/test/browser_wa_properties-view-params-objects.js
create mode 100644 browser/devtools/webaudioeditor/test/browser_wa_properties-view-params.js
create mode 100644 browser/devtools/webaudioeditor/test/doc_buffer-and-array.html
diff --git a/browser/devtools/webaudioeditor/test/440hz_sine.ogg b/browser/devtools/webaudioeditor/test/440hz_sine.ogg
new file mode 100644
index 0000000000000000000000000000000000000000..bd84564e2cd30d4bdceb85d6b9d9036257d38f69
GIT binary patch
literal 11822
zcmai43m}wf_kV^7BS}c3RHKNoY(~gbN~(=PtwFg&BFQC0x@@Ug)XJ8mNp2NILSz-u
zZX!#HD7m#=bfwa!*4Ndh|9Rfa7<T{PH#?1Y<~?(sbNij=_ng_~{{Bu#22qbE^M0_!
zm&aZ!-)Br=Yz__g35dWSFczP|f8eo&LHsFaEXUuJJn%R1od)Kz4i%%X!yeaUNkx<4
zzH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)fAuOjxE188a-GEmXN<I
z9vm`c-lelJKxcjTvYbB!MDEArw$4vw%^j2$v0Mf}D~|EqbW8w08m=Ubg@HegiZ>Y+
zQ9%su-KSe``4A!m0@z`npUDlawBwTw=7)N@Qxm76V@nB4{~kMem%$LGV`UK2!)D17
nCw%gsebi*;wWxzTt182pL*f6>ETi!3ywjVry7NNIndtujeasA}
literal 0
HcmV?d00001
diff --git a/browser/devtools/webaudioeditor/test/browser.ini b/browser/devtools/webaudioeditor/test/browser.ini
index 30cd892..2bc0dbe 100644
--- a/browser/devtools/webaudioeditor/test/browser.ini
+++ b/browser/devtools/webaudioeditor/test/browser.ini
@@ -1,27 +1,32 @@
[DEFAULT]
skip-if = e10s # Bug ?????? - devtools tests disabled with e10s
subsuite = devtools
support-files =
doc_simple-context.html
doc_complex-context.html
doc_simple-node-creation.html
+ doc_buffer-and-array.html
+ 440hz_sine.ogg
head.js
[browser_audionode-actor-get-set-param.js]
[browser_audionode-actor-get-type.js]
-[browser_audionode-actor-get-params.js]
+[browser_audionode-actor-get-params-01.js]
+[browser_audionode-actor-get-params-02.js]
[browser_audionode-actor-get-param-flags.js]
[browser_audionode-actor-is-source.js]
[browser_webaudio-actor-simple.js]
[browser_wa_first-run.js]
[browser_wa_graph-click.js]
[browser_wa_graph-render-01.js]
[browser_wa_graph-render-02.js]
[browser_wa_properties-view.js]
[browser_wa_properties-view-edit.js]
+[browser_wa_properties-view-params.js]
+[browser_wa_properties-view-params-objects.js]
[browser_wa_inspector.js]
[browser_wa_inspector-toggle.js]
diff --git a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-01.js b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-01.js
new file mode 100644
index 0000000..046dffa
--- /dev/null
+++ b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-01.js
@@ -0,0 +1,46 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Test AudioNode#getParams()
+ */
+
+function spawnTest () {
+ let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL);
+ let [_, nodes] = yield Promise.all([
+ front.setup({ reload: true }),
+ getN(front, "create-node", 14)
+ ]);
+
+ let allNodeParams = yield Promise.all(nodes.map(node => node.getParams()));
+ let nodeTypes = [
+ "AudioDestinationNode",
+ "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode",
+ "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode",
+ "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode"
+ ];
+
+ nodeTypes.forEach((type, i) => {
+ let params = allNodeParams[i];
+ params.forEach(({param, value, flags}) => {
+ ok(param in NODE_DEFAULT_VALUES[type], "expected parameter for " + type);
+
+ ok(typeof flags === "object", type + " has a flags object");
+
+ if (param === "buffer") {
+ is(flags.Buffer, true, "`buffer` params have Buffer flag");
+ }
+ else if (param === "bufferSize" || param === "frequencyBinCount") {
+ is(flags.readonly, true, param + " is readonly");
+ }
+ else if (param === "curve") {
+ is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
+ } else {
+ is(Object.keys(flags), 0, type + "-" + param + " has no flags set")
+ }
+ });
+ });
+
+ yield removeTab(target.tab);
+ finish();
+}
diff --git a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-02.js b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-02.js
new file mode 100644
index 0000000..7a7bb95
--- /dev/null
+++ b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params-02.js
@@ -0,0 +1,45 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that default properties are returned with the correct type
+ * from the AudioNode actors.
+ */
+
+function spawnTest() {
+ let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL);
+ let [_, nodes] = yield Promise.all([
+ front.setup({ reload: true }),
+ getN(front, "create-node", 14)
+ ]);
+
+ let allParams = yield Promise.all(nodes.map(node => node.getParams()));
+ let types = [
+ "AudioDestinationNode", "AudioBufferSourceNode", "ScriptProcessorNode",
+ "AnalyserNode", "GainNode", "DelayNode", "BiquadFilterNode", "WaveShaperNode",
+ "PannerNode", "ConvolverNode", "ChannelSplitterNode", "ChannelMergerNode",
+ "DynamicsCompressorNode", "OscillatorNode"
+ ];
+
+ allParams.forEach((params, i) => {
+ compare(params, NODE_DEFAULT_VALUES[types[i]], types[i]);
+ });
+
+ yield removeTab(target.tab);
+ finish();
+}
+
+function compare (actual, expected, type) {
+ actual.forEach(({ value, param }) => {
+ value = getGripValue(value);
+ if (typeof expected[param] === "function") {
+ ok(expected[param](value), type + " has a passing value for " + param);
+ }
+ else {
+ ise(value, expected[param], type + " has correct default value and type for " + param);
+ }
+ });
+
+ is(actual.length, Object.keys(expected).length,
+ type + " has correct amount of properties.");
+}
diff --git a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params.js b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params.js
deleted file mode 100644
index 3a7867e..0000000
--- a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-params.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test AudioNode#getParams()
- */
-
-function spawnTest () {
- let [target, debuggee, front] = yield initBackend(SIMPLE_NODES_URL);
- let [_, nodes] = yield Promise.all([
- front.setup({ reload: true }),
- getN(front, "create-node", 14)
- ]);
-
- let allNodeParams = yield Promise.all(nodes.map(node => node.getParams()));
- let nodeTypes = [
- "AudioDestinationNode",
- "AudioBufferSourceNode", "ScriptProcessorNode", "AnalyserNode", "GainNode",
- "DelayNode", "BiquadFilterNode", "WaveShaperNode", "PannerNode", "ConvolverNode",
- "ChannelSplitterNode", "ChannelMergerNode", "DynamicsCompressorNode", "OscillatorNode"
- ];
-
- nodeTypes.forEach((type, i) => {
- let params = allNodeParams[i];
- params.forEach(({param, value, flags}) => {
- ok(~NODE_PROPERTIES[type].indexOf(param), "expected parameter for " + type);
-
- // Skip over some properties that are undefined by default
- if (!/buffer|loop|smoothing|curve|cone/.test(param)) {
- ok(value != undefined, param + " is not undefined");
- }
-
- ok(typeof flags === "object", type + " has a flags object");
-
- if (param === "buffer") {
- is(flags.Buffer, true, "`buffer` params have Buffer flag");
- }
- else if (param === "bufferSize" || param === "frequencyBinCount") {
- is(flags.readonly, true, param + " is readonly");
- }
- else if (param === "curve") {
- is(flags["Float32Array"], true, "`curve` param has Float32Array flag");
- } else {
- is(Object.keys(flags), 0, type + "-" + param + " has no flags set")
- }
- });
- });
-
- yield removeTab(target.tab);
- finish();
-}
diff --git a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-set-param.js b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-set-param.js
index 4748217..3122b8a 100644
--- a/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-set-param.js
+++ b/browser/devtools/webaudioeditor/test/browser_audionode-actor-get-set-param.js
@@ -15,17 +15,18 @@ function spawnTest () {
let freq = yield oscNode.getParam("frequency");
info(typeof freq);
ise(freq, 440, "AudioNode:getParam correctly fetches AudioParam");
let type = yield oscNode.getParam("type");
ise(type, "sine", "AudioNode:getParam correctly fetches non-AudioParam");
let type = yield oscNode.getParam("not-a-valid-param");
- is(type, undefined, "AudioNode:getParam correctly returns false for invalid param");
+ ok(type.type === "undefined",
+ "AudioNode:getParam correctly returns a grip value for `undefined` for an invalid param.");
let resSuccess = yield oscNode.setParam("frequency", 220);
let freq = yield oscNode.getParam("frequency");
ise(freq, 220, "AudioNode:setParam correctly sets a `number` AudioParam");
is(resSuccess, undefined, "AudioNode:setParam returns undefined for correctly set AudioParam");
resSuccess = yield oscNode.setParam("type", "square");
let type = yield oscNode.getParam("type");
diff --git a/browser/devtools/webaudioeditor/test/browser_wa_properties-view-edit.js b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-edit.js
index 3816f8c..073b58e 100644
--- a/browser/devtools/webaudioeditor/test/browser_wa_properties-view-edit.js
+++ b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-edit.js
@@ -26,30 +26,30 @@ function spawnTest() {
yield Promise.all([
once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET),
once(panelWin, EVENTS.UI_INSPECTOR_TOGGLED)
]);
let setAndCheck = setAndCheckVariable(panelWin, gVars);
checkVariableView(gVars, 0, {
- "type": "\"sine\"",
+ "type": "sine",
"frequency": 440,
"detune": 0
}, "default loaded string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
checkVariableView(gVars, 0, {
"gain": 0
}, "default loaded number");
click(panelWin, findGraphNode(panelWin, nodeIds[1]));
yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
- yield setAndCheck(0, "type", "square", "\"square\"", "sets string as string");
+ yield setAndCheck(0, "type", "square", "square", "sets string as string");
click(panelWin, findGraphNode(panelWin, nodeIds[2]));
yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
yield setAndCheck(0, "gain", 0.005, 0.005, "sets number as number");
yield teardown(panel);
finish();
}
diff --git a/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params-objects.js b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params-objects.js
new file mode 100644
index 0000000..58521b5
--- /dev/null
+++ b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params-objects.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that params view correctly displays non-primitive properties
+ * like AudioBuffer and Float32Array in properties of AudioNodes.
+ */
+
+function spawnTest() {
+ let [target, debuggee, panel] = yield initWebAudioEditor(BUFFER_AND_ARRAY_URL);
+ let { panelWin } = panel;
+ let { gFront, $, $$, EVENTS, WebAudioInspectorView } = panelWin;
+ let gVars = WebAudioInspectorView._propsView;
+
+ let started = once(gFront, "start-context");
+
+ reload(target);
+
+ let [actors] = yield Promise.all([
+ getN(gFront, "create-node", 3),
+ waitForGraphRendered(panelWin, 3, 2)
+ ]);
+ let nodeIds = actors.map(actor => actor.actorID);
+
+ click(panelWin, findGraphNode(panelWin, nodeIds[2]));
+ yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
+ checkVariableView(gVars, 0, {
+ "curve": "Float32Array"
+ }, "WaveShaper's `curve` is listed as an `Float32Array`.");
+
+ click(panelWin, findGraphNode(panelWin, nodeIds[1]));
+ yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
+ checkVariableView(gVars, 0, {
+ "buffer": "AudioBuffer"
+ }, "AudioBufferSourceNode's `buffer` is listed as an `AudioBuffer`.");
+
+ yield teardown(panel);
+ finish();
+}
diff --git a/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params.js b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params.js
new file mode 100644
index 0000000..0fce988
--- /dev/null
+++ b/browser/devtools/webaudioeditor/test/browser_wa_properties-view-params.js
@@ -0,0 +1,39 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that params view correctly displays all properties for nodes
+ * correctly, with default values and correct types.
+ */
+
+function spawnTest() {
+ let [target, debuggee, panel] = yield initWebAudioEditor(SIMPLE_NODES_URL);
+ let { panelWin } = panel;
+ let { gFront, $, $$, EVENTS, WebAudioInspectorView } = panelWin;
+ let gVars = WebAudioInspectorView._propsView;
+
+ let started = once(gFront, "start-context");
+
+ reload(target);
+
+ let [actors] = yield Promise.all([
+ getN(gFront, "create-node", 14),
+ waitForGraphRendered(panelWin, 14, 0)
+ ]);
+ let nodeIds = actors.map(actor => actor.actorID);
+ let types = [
+ "AudioDestinationNode", "AudioBufferSourceNode", "ScriptProcessorNode",
+ "AnalyserNode", "GainNode", "DelayNode", "BiquadFilterNode", "WaveShaperNode",
+ "PannerNode", "ConvolverNode", "ChannelSplitterNode", "ChannelMergerNode",
+ "DynamicsCompressorNode", "OscillatorNode"
+ ];
+
+ for (let i = 0; i < types.length; i++) {
+ click(panelWin, findGraphNode(panelWin, nodeIds[i]));
+ yield once(panelWin, EVENTS.UI_INSPECTOR_NODE_SET);
+ checkVariableView(gVars, 0, NODE_DEFAULT_VALUES[types[i]], types[i]);
+ }
+
+ yield teardown(panel);
+ finish();
+}
diff --git a/browser/devtools/webaudioeditor/test/doc_buffer-and-array.html b/browser/devtools/webaudioeditor/test/doc_buffer-and-array.html
new file mode 100644
index 0000000..49dc91f
--- /dev/null
+++ b/browser/devtools/webaudioeditor/test/doc_buffer-and-array.html
@@ -0,0 +1,56 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!doctype html>
+
+<html>
+ <head>
+ <meta charset="utf-8"/>
+ <title>Web Audio Editor test page</title>
+ </head>
+
+ <body>
+
+ <script type="text/javascript;version=1.8">
+ "use strict";
+
+ let audioURL = "http://example.com/browser/browser/devtools/webaudioeditor/test/440hz_sine.ogg";
+
+ let ctx = new AudioContext();
+ let bufferNode = ctx.createBufferSource();
+ let shaperNode = ctx.createWaveShaper();
+ shaperNode.curve = generateWaveShapingCurve();
+
+ let xhr = getBuffer(audioURL, () => {
+ ctx.decodeAudioData(xhr.response, (buffer) => {
+ bufferNode.buffer = buffer;
+ bufferNode.connect(shaperNode);
+ shaperNode.connect(ctx.destination);
+ });
+ });
+
+ function generateWaveShapingCurve() {
+ let frames = 65536;
+ let curve = new Float32Array(frames);
+ let n = frames;
+ let n2 = n / 2;
+
+ for (let i = 0; i < n; ++i) {
+ let x = (i - n2) / n2;
+ let y = Math.atan(5 * x) / (0.5 * Math.PI);
+ }
+
+ return curve;
+ }
+
+ function getBuffer (url, callback) {
+ let xhr = new XMLHttpRequest();
+ xhr.open("GET", url, true);
+ xhr.responseType = "arraybuffer";
+ xhr.onload = callback;
+ xhr.send();
+ return xhr;
+ }
+ </script>
+ </body>
+
+</html>
diff --git a/browser/devtools/webaudioeditor/test/head.js b/browser/devtools/webaudioeditor/test/head.js
index d9d6f6b..587bbae 100644
--- a/browser/devtools/webaudioeditor/test/head.js
+++ b/browser/devtools/webaudioeditor/test/head.js
@@ -19,16 +19,17 @@ let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.j
let { WebAudioFront } = devtools.require("devtools/server/actors/webaudio");
let TargetFactory = devtools.TargetFactory;
const EXAMPLE_URL = "http://example.com/browser/browser/devtools/webaudioeditor/test/";
const SIMPLE_CONTEXT_URL = EXAMPLE_URL + "doc_simple-context.html";
const COMPLEX_CONTEXT_URL = EXAMPLE_URL + "doc_complex-context.html";
const SIMPLE_NODES_URL = EXAMPLE_URL + "doc_simple-node-creation.html";
+const BUFFER_AND_ARRAY_URL = EXAMPLE_URL + "doc_buffer-and-array.html";
// All tests are asynchronous.
waitForExplicitFinish();
let gToolEnabled = Services.prefs.getBoolPref("devtools.webaudioeditor.enabled");
registerCleanupFunction(() => {
info("finish() was called, cleaning up...");
@@ -214,18 +215,33 @@ function waitForGraphRendered (front, nodeCount, edgeCount) {
function checkVariableView (view, index, hash, description = "") {
info("Checking Variable View");
let scope = view.getScopeAtIndex(index);
let variables = Object.keys(hash);
variables.forEach(variable => {
let aVar = scope.get(variable);
is(aVar.target.querySelector(".name").getAttribute("value"), variable,
"Correct property name for " + variable);
- is(aVar.target.querySelector(".value").getAttribute("value"), hash[variable],
- "Correct property value of " + hash[variable] + " for " + variable + " " + description);
+ let value = aVar.target.querySelector(".value").getAttribute("value");
+
+ // Cast value with JSON.parse if possible;
+ // will fail when displaying Object types like "ArrayBuffer"
+ // and "Float32Array", but will match the original value.
+ try {
+ value = JSON.parse(value);
+ }
+ catch (e) {}
+ if (typeof hash[variable] === "function") {
+ ok(hash[variable](value),
+ "Passing property value of " + value + " for " + variable + " " + description);
+ }
+ else {
+ ise(value, hash[variable],
+ "Correct property value of " + hash[variable] + " for " + variable + " " + description);
+ }
});
}
function modifyVariableView (win, view, index, prop, value) {
let deferred = Promise.defer();
let scope = view.getScopeAtIndex(index);
let aVar = scope.get(prop);
scope.expand();
@@ -288,27 +304,97 @@ function isVisible (element) {
function wait (n) {
let { promise, resolve } = Promise.defer();
setTimeout(resolve, n);
info("Waiting " + n/1000 + " seconds.");
return promise;
}
/**
+ * Returns the primitive value of a grip's value, or the
+ * original form that the string grip.type comes from.
+ */
+function getGripValue (value) {
+ if (~["boolean", "string", "number"].indexOf(typeof value)) {
+ return value;
+ }
+
+ switch (value.type) {
+ case "undefined": return undefined;
+ case "Infinity": return Infinity;
+ case "-Infinity": return -Infinity;
+ case "NaN": return NaN;
+ case "-0": return -0;
+ case "null": return null;
+ default: return value;
+ }
+}
+
+/**
* List of audio node properties to test against expectations of the AudioNode actor
*/
-const NODE_PROPERTIES = {
- "OscillatorNode": ["type", "frequency", "detune"],
- "GainNode": ["gain"],
- "DelayNode": ["delayTime"],
- "AudioBufferSourceNode": ["buffer", "playbackRate", "loop", "loopStart", "loopEnd"],
- "ScriptProcessorNode": ["bufferSize"],
- "PannerNode": ["panningModel", "distanceModel", "refDistance", "maxDistance", "rolloffFactor", "coneInnerAngle", "coneOuterAngle", "coneOuterGain"],
- "ConvolverNode": ["buffer", "normalize"],
- "DynamicsCompressorNode": ["threshold", "knee", "ratio", "reduction", "attack", "release"],
- "BiquadFilterNode": ["type", "frequency", "Q", "detune", "gain"],
- "WaveShaperNode": ["curve", "oversample"],
- "AnalyserNode": ["fftSize", "minDecibels", "maxDecibels", "smoothingTimeConstraint", "frequencyBinCount"],
- "AudioDestinationNode": [],
- "ChannelSplitterNode": [],
- "ChannelMergerNode": []
+const NODE_DEFAULT_VALUES = {
+ "AudioDestinationNode": {},
+ "AudioBufferSourceNode": {
+ "playbackRate": 1,
+ "loop": false,
+ "loopStart": 0,
+ "loopEnd": 0,
+ "buffer": null
+ },
+ "ScriptProcessorNode": {
+ "bufferSize": 4096
+ },
+ "AnalyserNode": {
+ "fftSize": 2048,
+ "minDecibels": -100,
+ "maxDecibels": -30,
+ "smoothingTimeConstant": 0.8,
+ "frequencyBinCount": 1024
+ },
+ "GainNode": {
+ "gain": 1
+ },
+ "DelayNode": {
+ "delayTime": 0
+ },
+ "BiquadFilterNode": {
+ "type": "lowpass",
+ "frequency": 350,
+ "Q": 1,
+ "detune": 0,
+ "gain": 0
+ },
+ "WaveShaperNode": {
+ "curve": null,
+ "oversample": "none"
+ },
+ "PannerNode": {
+ "panningModel": "HRTF",
+ "distanceModel": "inverse",
+ "refDistance": 1,
+ "maxDistance": 10000,
+ "rolloffFactor": 1,
+ "coneInnerAngle": 360,
+ "coneOuterAngle": 360,
+ "coneOuterGain": 0
+ },
+ "ConvolverNode": {
+ "buffer": null,
+ "normalize": true
+ },
+ "ChannelSplitterNode": {},
+ "ChannelMergerNode": {},
+ "DynamicsCompressorNode": {
+ "threshold": -24,
+ "knee": 30,
+ "ratio": 12,
+ "reduction": 0,
+ "attack": 0.003000000026077032,
+ "release": 0.25
+ },
+ "OscillatorNode": {
+ "type": "sine",
+ "frequency": 440,
+ "detune": 0
+ }
};
diff --git a/toolkit/devtools/server/actors/webaudio.js b/toolkit/devtools/server/actors/webaudio.js
index 8118ee6..a2925d9 100644
--- a/toolkit/devtools/server/actors/webaudio.js
+++ b/toolkit/devtools/server/actors/webaudio.js
@@ -6,16 +6,17 @@
const {Cc, Ci, Cu, Cr} = require("chrome");
const Services = require("Services");
const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
const events = require("sdk/event/core");
const protocol = require("devtools/server/protocol");
const { CallWatcherActor, CallWatcherFront } = require("devtools/server/actors/call-watcher");
+const { ThreadActor } = require("devtools/server/actors/script");
const { on, once, off, emit } = events;
const { method, Arg, Option, RetVal } = protocol;
exports.register = function(handle) {
handle.addTabActor(WebAudioActor, "webaudioActor");
};
@@ -93,17 +94,17 @@ const NODE_PROPERTIES = {
"WaveShaperNode": {
"curve": { "Float32Array": true },
"oversample": {}
},
"AnalyserNode": {
"fftSize": {},
"minDecibels": {},
"maxDecibels": {},
- "smoothingTimeConstraint": {},
+ "smoothingTimeConstant": {},
"frequencyBinCount": { "readonly": true },
},
"AudioDestinationNode": {},
"ChannelSplitterNode": {},
"ChannelMergerNode": {}
};
/**
@@ -123,17 +124,17 @@ let AudioNodeActor = exports.AudioNodeActor = protocol.ActorClass({
* The server connection.
* @param AudioNode node
* The AudioNode that was created.
*/
initialize: function (conn, node) {
protocol.Actor.prototype.initialize.call(this, conn);
this.node = unwrap(node);
try {
- this.type = this.node.toString().match(/\[object (.*)\]$/)[1];
+ this.type = getConstructorName(this.node);
} catch (e) {
this.type = "";
}
},
/**
* Returns the name of the audio type.
* Examples: "OscillatorNode", "MediaElementAudioSourceNode"
@@ -183,21 +184,33 @@ let AudioNodeActor = exports.AudioNodeActor = protocol.ActorClass({
/**
* Gets a param on the audio node.
*
* @param String param
* Name of the AudioParam to fetch.
*/
getParam: method(function (param) {
- // If property does not exist, just return "undefined"
- if (!this.node[param])
- return undefined;
+ // Check to see if it's an AudioParam -- if so,
+ // return the `value` property of the parameter.
let value = isAudioParam(this.node, param) ? this.node[param].value : this.node[param];
- return value;
+
+ // Return the grip form of the value; at this time,
+ // there shouldn't be any non-primitives at the moment, other than
+ // AudioBuffer or Float32Array references and the like,
+ // so this just formats the value to be displayed in the VariablesView,
+ // without using real grips and managing via actor pools.
+ let grip;
+ try {
+ grip = ThreadActor.prototype.createValueGrip(value);
+ }
+ catch (e) {
+ grip = createObjectGrip(value);
+ }
+ return grip;
}, {
request: {
param: Arg(0, "string")
},
response: { text: RetVal("nullable:primitive") }
}),
/**
@@ -494,28 +507,53 @@ WebAudioFront.NODE_ROUTING_METHODS = new Set(NODE_ROUTING_METHODS);
*
* @param AudioNode node
* An AudioNode.
* @param String prop
* Property of `node` to evaluate to see if it's an AudioParam.
* @return Boolean
*/
function isAudioParam (node, prop) {
- return /AudioParam/.test(node[prop].toString());
+ return !!(node[prop] && /AudioParam/.test(node[prop].toString()));
}
/**
* Takes an `Error` object and constructs a JSON-able response
*
* @param Error err
* A TypeError, RangeError, etc.
* @return Object
*/
function constructError (err) {
return {
message: err.message,
type: err.constructor.name
};
}
+/**
+ * Takes an object and converts it's `toString()` form, like
+ * "[object OscillatorNode]" or "[object Float32Array]"
+ * to a string of just the constructor name, like "OscillatorNode",
+ * or "Float32Array".
+ */
+function getConstructorName (obj) {
+ return obj.toString().match(/\[object (.*)\]$/)[1];
+}
+
+/**
+ * Create a grip-like object to pass in renderable information
+ * to the front-end for things like Float32Arrays, AudioBuffers,
+ * without tracking them in an actor pool.
+ */
+function createObjectGrip (value) {
+ return {
+ type: "object",
+ preview: {
+ kind: "ObjectWithText",
+ text: ""
+ },
+ class: getConstructorName(value)
+ };
+}
function unwrap (obj) {
return XPCNativeWrapper.unwrap(obj);
}
--
1.8.4.2