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

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

Issue 2676443005: Add interface versioning. Methods queryVersion and requireVersion. (Closed)
Patch Set: Expect the result inside the error handler for test. Code formatting and address codereview comment… Created 3 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
Index: mojo/public/js/validator.js
diff --git a/mojo/public/js/validator.js b/mojo/public/js/validator.js
index 9f2b7cf4db141f3eab218b4e79ce89e69e9c4fa2..fee742d0c1b1c2761f99bd4494e587e5237965fd 100644
--- a/mojo/public/js/validator.js
+++ b/mojo/public/js/validator.js
@@ -210,6 +210,27 @@ define("mojo/public/js/validator", [
return validationError.NONE;
};
+ Validator.prototype.validateMessageIsRequestWithoutResponse = function() {
+ if (this.message.isResponse() || this.message.expectsResponse()) {
+ return validationError.MESSAGE_HEADER_INVALID_FLAGS;
+ }
+ return validationError.NONE;
+ };
+
+ Validator.prototype.validateMessageIsRequestExpectingResponse = function() {
+ if (this.message.isResponse() || !this.message.expectsResponse()) {
+ return validationError.MESSAGE_HEADER_INVALID_FLAGS;
+ }
+ return validationError.NONE;
+ };
+
+ Validator.prototype.validateMessageIsResponse = function() {
+ if (this.message.expectsResponse() || !this.message.isResponse()) {
+ return validationError.MESSAGE_HEADER_INVALID_FLAGS;
+ }
+ return validationError.NONE;
+ };
+
// Returns the message.buffer relative offset this pointer "points to",
// NULL_MOJO_POINTER if the pointer represents a null, or JS null if the
// pointer's value is not valid.

Powered by Google App Engine
This is Rietveld 408576698