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

Side by Side Diff: mojo/public/js/bindings/validator.js

Issue 467263006: JavaScript Content Handler Version 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
« mojo/apps/js/js_app.cc ('K') | « mojo/mojo_apps.gypi ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 define("mojo/public/js/bindings/validator", [ 5 define("mojo/public/js/bindings/validator", [
6 "mojo/public/js/bindings/codec", 6 "mojo/public/js/bindings/codec",
7 ], function(codec) { 7 ], function(codec) {
8 8
9 var validationError = { 9 var validationError = {
10 NONE: 'VALIDATION_ERROR_NONE', 10 NONE: 'VALIDATION_ERROR_NONE',
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (structOffset === null) 181 if (structOffset === null)
182 return validationError.ILLEGAL_POINTER; 182 return validationError.ILLEGAL_POINTER;
183 183
184 if (structOffset === NULL_MOJO_POINTER) 184 if (structOffset === NULL_MOJO_POINTER)
185 return nullable ? 185 return nullable ?
186 validationError.NONE : validationError.UNEXPECTED_NULL_POINTER; 186 validationError.NONE : validationError.UNEXPECTED_NULL_POINTER;
187 187
188 return structClass.validate(this, structOffset); 188 return structClass.validate(this, structOffset);
189 } 189 }
190 190
191 Validator.prototype.validateStringPointer = function(offset) { 191 Validator.prototype.validateStringPointer = function(offset, nullable) {
192 return this.validateArrayPointer( 192 return this.validateArrayPointer(
193 offset, codec.Uint8.encodedSize, 0, codec.Uint8); 193 offset, codec.Uint8.encodedSize, 0, codec.Uint8, nullable);
194 } 194 }
195 195
196 // Similar to Array_Data<T>::Validate() 196 // Similar to Array_Data<T>::Validate()
197 // mojo/public/cpp/bindings/lib/array_internal.h 197 // mojo/public/cpp/bindings/lib/array_internal.h
198 198
199 Validator.prototype.validateArray = 199 Validator.prototype.validateArray =
200 function (offset, elementSize, expectedElementCount, elementType) { 200 function (offset, elementSize, expectedElementCount, elementType) {
201 if (!codec.isAligned(offset)) 201 if (!codec.isAligned(offset))
202 return validationError.MISALIGNED_OBJECT; 202 return validationError.MISALIGNED_OBJECT;
203 203
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return err; 282 return err;
283 } 283 }
284 return validationError.NONE; 284 return validationError.NONE;
285 } 285 }
286 286
287 var exports = {}; 287 var exports = {};
288 exports.validationError = validationError; 288 exports.validationError = validationError;
289 exports.Validator = Validator; 289 exports.Validator = Validator;
290 return exports; 290 return exports;
291 }); 291 });
OLDNEW
« mojo/apps/js/js_app.cc ('K') | « mojo/mojo_apps.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698