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

Unified Diff: mojo/public/js/bindings/codec.js

Issue 490623003: Add JS bindings validation logic for non-nullable types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 4 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 | « no previous file | mojo/public/js/bindings/validation_unittests.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/bindings/codec.js
diff --git a/mojo/public/js/bindings/codec.js b/mojo/public/js/bindings/codec.js
index af58da9d6738dc45273a0bafa339dc03162a547f..88433e2fc4bc40f6646e373ad0a0fb4dccf379f7 100644
--- a/mojo/public/js/bindings/codec.js
+++ b/mojo/public/js/bindings/codec.js
@@ -593,6 +593,14 @@ define("mojo/public/js/bindings/codec", [
encoder.encodeStringPointer(val);
};
+ function NullableString() {
+ }
+
+ NullableString.encodedSize = String.encodedSize;
+
+ NullableString.decode = String.decode;
+
+ NullableString.encode = String.encode;
function Float() {
}
@@ -643,6 +651,12 @@ define("mojo/public/js/bindings/codec", [
this.cls.encode(objectEncoder, val);
};
+ function NullablePointerTo(cls) {
+ PointerTo.call(this, cls);
+ }
+
+ NullablePointerTo.prototype = Object.create(PointerTo.prototype);
+
function ArrayOf(cls) {
this.cls = cls;
}
@@ -657,6 +671,12 @@ define("mojo/public/js/bindings/codec", [
encoder.encodeArrayPointer(this.cls, val);
};
+ function NullableArrayOf(cls) {
+ ArrayOf.call(this, cls);
+ }
+
+ NullableArrayOf.prototype = Object.create(ArrayOf.prototype);
+
function Handle() {
}
@@ -670,6 +690,15 @@ define("mojo/public/js/bindings/codec", [
encoder.encodeHandle(val);
};
+ function NullableHandle() {
+ }
+
+ NullableHandle.encodedSize = Handle.encodedSize;
+
+ NullableHandle.decode = Handle.decode;
+
+ NullableHandle.encode = Handle.encode;
+
var exports = {};
exports.align = align;
exports.isAligned = isAligned;
@@ -695,9 +724,13 @@ define("mojo/public/js/bindings/codec", [
exports.Float = Float;
exports.Double = Double;
exports.String = String;
+ exports.NullableString = NullableString;
exports.PointerTo = PointerTo;
+ exports.NullablePointerTo = NullablePointerTo;
exports.ArrayOf = ArrayOf;
+ exports.NullableArrayOf = NullableArrayOf;
exports.PackedBool = PackedBool;
exports.Handle = Handle;
+ exports.NullableHandle = NullableHandle;
return exports;
});
« no previous file with comments | « no previous file | mojo/public/js/bindings/validation_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698