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

Unified Diff: sdk/lib/html/html_common/conversions.dart

Issue 886673002: Check for null prototype in isJavaScriptSimpleObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Eliminate common sub-expression Created 5 years, 11 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 | tests/html/postmessage_structured_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/html_common/conversions.dart
diff --git a/sdk/lib/html/html_common/conversions.dart b/sdk/lib/html/html_common/conversions.dart
index 255b3e5e65140d4161f0a1d88d24d0f22148e214..042a78472455fa7443a8830e423e4302d21631ec 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -392,8 +392,11 @@ convertDartToNative_ImageData(ImageData imageData) {
bool isJavaScriptDate(value) => JS('bool', '# instanceof Date', value);
bool isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value);
bool isJavaScriptArray(value) => JS('bool', '# instanceof Array', value);
-bool isJavaScriptSimpleObject(value) =>
- JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value);
+bool isJavaScriptSimpleObject(value) {
+ var proto = JS('', 'Object.getPrototypeOf(#)', value);
+ return JS('bool', '# === Object.prototype', proto) ||
+ JS('bool', '# === null', proto);
+}
bool isImmutableJavaScriptArray(value) =>
JS('bool', r'!!(#.immutable$list)', value);
« no previous file with comments | « no previous file | tests/html/postmessage_structured_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698