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

Unified Diff: third_party/mojo/src/mojo/public/js/validator.js

Issue 917433003: Update mojo sdk to rev 1027d24a1f68c6d10b7539b32114f1272b2cc9f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add //build/module_args/mojo.gni. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/mojo/src/mojo/public/js/codec.js ('k') | third_party/mojo/src/mojo/public/mojo.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/mojo/src/mojo/public/js/validator.js
diff --git a/third_party/mojo/src/mojo/public/js/validator.js b/third_party/mojo/src/mojo/public/js/validator.js
index a6be692ead7ca92d998b9fb0b26cc06533ec92cf..95f3d067874da857a45b293f32f2217b4192b697 100644
--- a/third_party/mojo/src/mojo/public/js/validator.js
+++ b/third_party/mojo/src/mojo/public/js/validator.js
@@ -104,7 +104,7 @@ define("mojo/public/js/validator", [
}
Validator.prototype.validateStructHeader =
- function(offset, minNumBytes, minNumFields) {
+ function(offset, minNumBytes, minVersion) {
if (!codec.isAligned(offset))
return validationError.MISALIGNED_OBJECT;
@@ -112,9 +112,10 @@ define("mojo/public/js/validator", [
return validationError.ILLEGAL_MEMORY_RANGE;
var numBytes = this.message.buffer.getUint32(offset);
- var numFields = this.message.buffer.getUint32(offset + 4);
+ var version = this.message.buffer.getUint32(offset + 4);
- if (numBytes < minNumBytes || numFields < minNumFields)
+ // Backward compatibility is not yet supported.
+ if (numBytes < minNumBytes || version < minVersion)
return validationError.UNEXPECTED_STRUCT_HEADER;
if (!this.claimRange(offset, numBytes))
@@ -129,21 +130,21 @@ define("mojo/public/js/validator", [
return err;
var numBytes = this.message.getHeaderNumBytes();
- var numFields = this.message.getHeaderNumFields();
+ var version = this.message.getHeaderVersion();
- var validNumFieldsAndNumBytes =
- (numFields == 2 && numBytes == codec.kMessageHeaderSize) ||
- (numFields == 3 &&
+ var validVersionAndNumBytes =
+ (version == 2 && numBytes == codec.kMessageHeaderSize) ||
+ (version == 3 &&
numBytes == codec.kMessageWithRequestIDHeaderSize) ||
- (numFields > 3 &&
+ (version > 3 &&
numBytes >= codec.kMessageWithRequestIDHeaderSize);
- if (!validNumFieldsAndNumBytes)
+ if (!validVersionAndNumBytes)
return validationError.UNEXPECTED_STRUCT_HEADER;
var expectsResponse = this.message.expectsResponse();
var isResponse = this.message.isResponse();
- if (numFields == 2 && (expectsResponse || isResponse))
+ if (version == 2 && (expectsResponse || isResponse))
return validationError.MESSAGE_HEADER_MISSING_REQUEST_ID;
if (isResponse && expectsResponse)
« no previous file with comments | « third_party/mojo/src/mojo/public/js/codec.js ('k') | third_party/mojo/src/mojo/public/mojo.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698