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

Side by Side Diff: chrome/renderer/resources/json_schema.js

Issue 7787004: Fix crash when calling chrome.tabs.move({index:-1}). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/basics/move.html » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // ----------------------------------------------------------------------------- 5 // -----------------------------------------------------------------------------
6 // NOTE: If you change this file you need to touch renderer_resources.grd to 6 // NOTE: If you change this file you need to touch renderer_resources.grd to
7 // have your change take effect. 7 // have your change take effect.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 9
10 //============================================================================== 10 //==============================================================================
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 instance, schema, path) { 398 instance, schema, path) {
399 399
400 // Forbid NaN, +Infinity, and -Infinity. Our APIs don't use them, and 400 // Forbid NaN, +Infinity, and -Infinity. Our APIs don't use them, and
401 // JSON serialization encodes them as 'null'. Re-evaluate supporting 401 // JSON serialization encodes them as 'null'. Re-evaluate supporting
402 // them if we add an API that could reasonably take them as a parameter. 402 // them if we add an API that could reasonably take them as a parameter.
403 if (isNaN(instance) || 403 if (isNaN(instance) ||
404 instance == Number.POSITIVE_INFINITY || 404 instance == Number.POSITIVE_INFINITY ||
405 instance == Number.NEGATIVE_INFINITY ) 405 instance == Number.NEGATIVE_INFINITY )
406 this.addError(path, "numberFiniteNotNan", [instance]); 406 this.addError(path, "numberFiniteNotNan", [instance]);
407 407
408 if (schema.minimum && instance < schema.minimum) 408 if (schema.minimum !== undefined && instance < schema.minimum)
409 this.addError(path, "numberMinValue", [schema.minimum]); 409 this.addError(path, "numberMinValue", [schema.minimum]);
410 410
411 if (schema.maximum && instance > schema.maximum) 411 if (schema.maximum !== undefined && instance > schema.maximum)
412 this.addError(path, "numberMaxValue", [schema.maximum]); 412 this.addError(path, "numberMaxValue", [schema.maximum]);
413 413
414 // Check for integer values outside of -2^31..2^31-1. 414 // Check for integer values outside of -2^31..2^31-1.
415 if (schema.type === "integer" && (instance | 0) !== instance) 415 if (schema.type === "integer" && (instance | 0) !== instance)
416 this.addError(path, "numberIntValue", []); 416 this.addError(path, "numberIntValue", []);
417 417
418 if (schema.maxDecimal && instance * Math.pow(10, schema.maxDecimal) % 1) 418 if (schema.maxDecimal && instance * Math.pow(10, schema.maxDecimal) % 1)
419 this.addError(path, "numberMaxDecimal", [schema.maxDecimal]); 419 this.addError(path, "numberMaxDecimal", [schema.maxDecimal]);
420 }; 420 };
421 421
(...skipping 20 matching lines...) Expand all
442 */ 442 */
443 chromeHidden.JSONSchemaValidator.prototype.addError = function( 443 chromeHidden.JSONSchemaValidator.prototype.addError = function(
444 path, key, replacements) { 444 path, key, replacements) {
445 this.errors.push({ 445 this.errors.push({
446 path: path, 446 path: path,
447 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements) 447 message: chromeHidden.JSONSchemaValidator.formatError(key, replacements)
448 }); 448 });
449 }; 449 };
450 450
451 })(); 451 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/basics/move.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698