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

Side by Side Diff: Source/WebCore/bindings/v8/custom/V8AudioNodeCustom.cpp

Issue 7740035: Merge 91802 - V8 custom bindings for AudioNode must do proper object checking and throw exception... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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 | « no previous file | 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 23 matching lines...) Expand all
34 #include "V8Binding.h" 34 #include "V8Binding.h"
35 #include "V8Proxy.h" 35 #include "V8Proxy.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 v8::Handle<v8::Value> V8AudioNode::connectCallback(const v8::Arguments& args) 39 v8::Handle<v8::Value> V8AudioNode::connectCallback(const v8::Arguments& args)
40 { 40 {
41 if (args.Length() < 1) 41 if (args.Length() < 1)
42 return throwError("Not enough arguments", V8Proxy::SyntaxError); 42 return throwError("Not enough arguments", V8Proxy::SyntaxError);
43 43
44 AudioNode* destinationNode = toNative(args[0]->ToObject()); 44 AudioNode* destinationNode = 0;
45 if (V8AudioNode::HasInstance(args[0]))
46 destinationNode = toNative(args[0]->ToObject());
47
45 if (!destinationNode) 48 if (!destinationNode)
46 return throwError("Invalid destination node", V8Proxy::SyntaxError); 49 return throwError("Invalid destination node", V8Proxy::SyntaxError);
47 50
48 unsigned output = 0; 51 unsigned output = 0;
49 unsigned input = 0; 52 unsigned input = 0;
50 bool ok = false; 53 bool ok = false;
51 if (args.Length() > 1) { 54 if (args.Length() > 1) {
52 output = toInt32(args[1], ok); 55 output = toInt32(args[1], ok);
53 if (!ok) 56 if (!ok)
54 return throwError("Invalid index parameters", V8Proxy::SyntaxError); 57 return throwError("Invalid index parameters", V8Proxy::SyntaxError);
(...skipping 27 matching lines...) Expand all
82 bool success = audioNode->disconnect(output); 85 bool success = audioNode->disconnect(output);
83 if (!success) 86 if (!success)
84 return throwError("Invalid index parameter", V8Proxy::SyntaxError); 87 return throwError("Invalid index parameter", V8Proxy::SyntaxError);
85 88
86 return v8::Undefined(); 89 return v8::Undefined();
87 } 90 }
88 91
89 } // namespace WebCore 92 } // namespace WebCore
90 93
91 #endif // ENABLE(WEB_AUDIO) 94 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698