Skip to content

Commit f64db6f

Browse files
author
Chris Rogers
committed
Don't allow nodes of one context to be connected to nodes of another context
https://bugs.webkit.org/show_bug.cgi?id=67245 Source/WebCore: Reviewed by Dimitri Glazkov. Tests: updated webaudio/audionode.html * webaudio/AudioNode.cpp: (WebCore::AudioNode::connect): LayoutTests: Reviewed by Dimitri Glazkov. * webaudio/audionode-expected.txt: * webaudio/audionode.html: Canonical link: https://commits.webkit.org/83054@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94127 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b93066b commit f64db6f

5 files changed

Lines changed: 36 additions & 0 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2011-08-30 Chris Rogers <crogers@google.com>
2+
3+
Don't allow nodes of one context to be connected to nodes of another context
4+
https://bugs.webkit.org/show_bug.cgi?id=67245
5+
6+
Reviewed by Dimitri Glazkov.
7+
8+
* webaudio/audionode-expected.txt:
9+
* webaudio/audionode.html:
10+
111
2011-08-30 Aaron Colwell <acolwell@chromium.org>
212

313
Add MediaSource API to HTMLMediaElement

LayoutTests/webaudio/audionode-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PASS connect() exception thrown for illegal destination AudioNode.
1111
PASS connect() exception thrown for illegal output index.
1212
PASS connect() exception thrown for illegal input index.
1313
PASS audioNode.connect(context.destination) succeeded.
14+
PASS exception thrown when connecting to other context's node.
1415
PASS successfullyParsed is true
1516

1617
TEST COMPLETE

LayoutTests/webaudio/audionode.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
description("Basic tests for AudioNode API.");
1616

1717
var context = 0;
18+
var context2 = 0;
1819

1920
function runTest() {
2021
if (window.layoutTestController) {
@@ -72,6 +73,15 @@
7273
} catch(e) {
7374
testFailed("audioNode.connect(context.destination) failed.");
7475
}
76+
77+
// Create a new context and try to connect the other context's node to this one.
78+
try {
79+
context2 = new webkitAudioContext();
80+
window.audioNode.connect(context2.destination);
81+
testFailed("exception should be thrown when connecting to other context's node.");
82+
} catch(e) {
83+
testPassed("exception thrown when connecting to other context's node.");
84+
}
7585

7686
finishJSTest();
7787
}

Source/WebCore/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2011-08-30 Chris Rogers <crogers@google.com>
2+
3+
Don't allow nodes of one context to be connected to nodes of another context
4+
https://bugs.webkit.org/show_bug.cgi?id=67245
5+
6+
Reviewed by Dimitri Glazkov.
7+
8+
Tests: updated webaudio/audionode.html
9+
10+
* webaudio/AudioNode.cpp:
11+
(WebCore::AudioNode::connect):
12+
113
2011-08-30 Dan Bernstein <mitz@apple.com>
214

315
WebCore part of <rdar://problem/9281695> Add text search API for getting the DOM range of a text match

Source/WebCore/webaudio/AudioNode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ bool AudioNode::connect(AudioNode* destination, unsigned outputIndex, unsigned i
126126
output->disconnectAllInputs();
127127
return true;
128128
}
129+
130+
if (context() != destination->context())
131+
return false;
129132

130133
AudioNodeInput* input = destination->input(inputIndex);
131134
input->connect(output);

0 commit comments

Comments
 (0)