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

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

Issue 511443002: Mojo javascript encoder: Empty string encoded as NULL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment about undefined. 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 | no next file » | 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 88433e2fc4bc40f6646e373ad0a0fb4dccf379f7..623cca71b66ff334e41f72173997199cbd410e52 100644
--- a/mojo/public/js/bindings/codec.js
+++ b/mojo/public/js/bindings/codec.js
@@ -316,7 +316,8 @@ define("mojo/public/js/bindings/codec", [
};
Encoder.prototype.encodeStructPointer = function(cls, val) {
- if (!val) {
+ if (val == null) {
+ // Also handles undefined, since undefined == null.
this.encodePointer(val);
return;
}
@@ -325,7 +326,8 @@ define("mojo/public/js/bindings/codec", [
};
Encoder.prototype.encodeArrayPointer = function(cls, val) {
- if (!val) {
+ if (val == null) {
+ // Also handles undefined, since undefined == null.
this.encodePointer(val);
return;
}
@@ -337,7 +339,8 @@ define("mojo/public/js/bindings/codec", [
};
Encoder.prototype.encodeStringPointer = function(val) {
- if (!val) {
+ if (val == null) {
+ // Also handles undefined, since undefined == null.
this.encodePointer(val);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698