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

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

Issue 16832002: Fixing SerializedScriptValue letting Dart list members through to native lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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/indexeddb_2_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 063c7e9389c0a86210320899b8f1ead858c71861..12591d575ccf8263c861af45a3a8c9cb8f72cd3b 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -173,38 +173,10 @@ _convertDartToNative_PrepareForStructuredClone(value) {
int i = 0;
- if (isJavaScriptArray(e) &&
- // We have to copy immutable lists, otherwise the structured clone
- // algorithm will copy the .immutable$list marker property, making the
- // list immutable when received!
- !isImmutableJavaScriptArray(e)) {
- writeSlot(slot, true); // Deferred copy.
- for ( ; i < length; i++) {
- var element = e[i];
- var elementCopy = walk(element);
- if (!identical(elementCopy, element)) {
- copy = readSlot(slot); // Cyclic reference may have created it.
- if (true == copy) {
- copy = JS('=List', 'new Array(#)', length);
- writeSlot(slot, copy);
- }
- for (int j = 0; j < i; j++) {
- copy[j] = e[j];
- }
- copy[i] = elementCopy;
- i++;
- break;
- }
- }
- if (copy == null) {
- copy = e;
- writeSlot(slot, copy);
- }
- } else {
- // Not a JavaScript Array. We are forced to make a copy.
- copy = JS('=List', 'new Array(#)', length);
- writeSlot(slot, copy);
- }
+ // Always clone the list, as it may have non-native properties or methods
+ // from interceptors and such.
+ copy = JS('=List', 'new Array(#)', length);
+ writeSlot(slot, copy);
for ( ; i < length; i++) {
copy[i] = walk(e[i]);
« no previous file with comments | « no previous file | tests/html/indexeddb_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698