Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioNode.cpp

Issue 2632373003: Throw correct error when connecting to different context. (Closed)
Patch Set: Update tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 if (destination && inputIndex >= destination->numberOfInputs()) { 614 if (destination && inputIndex >= destination->numberOfInputs()) {
615 exceptionState.throwDOMException( 615 exceptionState.throwDOMException(
616 IndexSizeError, "input index (" + String::number(inputIndex) + 616 IndexSizeError, "input index (" + String::number(inputIndex) +
617 ") exceeds number of inputs (" + 617 ") exceeds number of inputs (" +
618 String::number(destination->numberOfInputs()) + 618 String::number(destination->numberOfInputs()) +
619 ")."); 619 ").");
620 return nullptr; 620 return nullptr;
621 } 621 }
622 622
623 if (context() != destination->context()) { 623 if (context() != destination->context()) {
624 exceptionState.throwDOMException(SyntaxError, 624 exceptionState.throwDOMException(InvalidAccessError,
625 "cannot connect to a destination " 625 "cannot connect to a destination "
626 "belonging to a different audio context."); 626 "belonging to a different audio context.");
627 return nullptr; 627 return nullptr;
628 } 628 }
629 629
630 // ScriptProcessorNodes with 0 output channels can't be connected to any 630 // ScriptProcessorNodes with 0 output channels can't be connected to any
631 // destination. If there are no output channels, what would the destination 631 // destination. If there are no output channels, what would the destination
632 // receive? Just disallow this. 632 // receive? Just disallow this.
633 if (handler().getNodeType() == AudioHandler::NodeTypeJavaScript && 633 if (handler().getNodeType() == AudioHandler::NodeTypeJavaScript &&
634 handler().numberOfOutputChannels() == 0) { 634 handler().numberOfOutputChannels() == 0) {
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 } 947 }
948 948
949 void AudioNode::didAddOutput(unsigned numberOfOutputs) { 949 void AudioNode::didAddOutput(unsigned numberOfOutputs) {
950 m_connectedNodes.push_back(nullptr); 950 m_connectedNodes.push_back(nullptr);
951 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size()); 951 DCHECK_EQ(numberOfOutputs, m_connectedNodes.size());
952 m_connectedParams.push_back(nullptr); 952 m_connectedParams.push_back(nullptr);
953 DCHECK_EQ(numberOfOutputs, m_connectedParams.size()); 953 DCHECK_EQ(numberOfOutputs, m_connectedParams.size());
954 } 954 }
955 955
956 } // namespace blink 956 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698