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

Side by Side Diff: chrome/renderer/resources/extensions/schema_utils.js

Issue 10566018: Initial work to remove the notion of all extension message payloads as strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review changes. Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/resources/extensions/event.js ('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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Routines used to validate and normalize arguments. 5 // Routines used to validate and normalize arguments.
6 6
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8 8
9 // TODO(benwells): unit test this file. 9 // TODO(benwells): unit test this file.
10 // JSONSchemaValidator is not loaded in unit tests. 10 // JSONSchemaValidator is not loaded in unit tests.
(...skipping 18 matching lines...) Expand all
29 message += "Property '" + err.path + "': "; 29 message += "Property '" + err.path + "': ";
30 } 30 }
31 message += err.message; 31 message += err.message;
32 message = message.substring(0, message.length - 1); 32 message = message.substring(0, message.length - 1);
33 message += ", "; 33 message += ", ";
34 } 34 }
35 message = message.substring(0, message.length - 2); 35 message = message.substring(0, message.length - 2);
36 message += "."; 36 message += ".";
37 throw new Error(message); 37 throw new Error(message);
38 } else if (!parameterSchemas[i].optional) { 38 } else if (!parameterSchemas[i].optional) {
39 throw new Error("Parameter " + (i + 1) + " is required."); 39 throw new Error("Parameter " + (i + 1) + " (" +
40 parameterSchemas[i].name + ") is required.");
40 } 41 }
41 } 42 }
42 }; 43 };
43 } else { 44 } else {
44 validate = function() {}; 45 validate = function() {};
45 } 46 }
46 47
47 // Generate all possible signatures for a given API function. 48 // Generate all possible signatures for a given API function.
48 function getSignatures(parameterSchemas) { 49 function getSignatures(parameterSchemas) {
49 if (parameterSchemas.length === 0) 50 if (parameterSchemas.length === 0)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return true; 153 return true;
153 } 154 }
154 } 155 }
155 return false; 156 return false;
156 }; 157 };
157 158
158 exports.isFunctionSignatureAmbiguous = isFunctionSignatureAmbiguous; 159 exports.isFunctionSignatureAmbiguous = isFunctionSignatureAmbiguous;
159 exports.normalizeArgumentsAndValidate = normalizeArgumentsAndValidate; 160 exports.normalizeArgumentsAndValidate = normalizeArgumentsAndValidate;
160 exports.schemaValidator = schemaValidator; 161 exports.schemaValidator = schemaValidator;
161 exports.validate = validate; 162 exports.validate = validate;
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/event.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698