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

Side by Side Diff: sdk/lib/html/html_common/conversions_dartium.dart

Issue 1421023005: Should we really be calling the serialized script value logic when getting elements out of Lists re… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of html_common; 1 part of html_common;
2 2
3 convertDartToNative_PrepareForStructuredClone(value) => 3 convertDartToNative_PrepareForStructuredClone(value) =>
4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone( value); 4 new _StructuredCloneDartium().convertDartToNative_PrepareForStructuredClone( value);
5 5
6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) => 6 convertNativeToDart_AcceptStructuredClone(object, {mustCopy: false}) =>
7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon e(object, mustCopy: mustCopy); 7 new _AcceptStructuredCloneDartium().convertNativeToDart_AcceptStructuredClon e(object, mustCopy: mustCopy);
8 8
9 class _StructuredCloneDartium extends _StructuredClone { 9 class _StructuredCloneDartium extends _StructuredClone {
10 newJsMap() => new js.JsObject(js.context["Object"]); 10 newJsMap() => new js.JsObject(js.context["Object"]);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 // TODO(alanknight): With upgraded custom elements this causes a failure bec ause 231 // TODO(alanknight): With upgraded custom elements this causes a failure bec ause
232 // we need a new wrapper after the type changes. We could possibly invalidat e this 232 // we need a new wrapper after the type changes. We could possibly invalidat e this
233 // if the constructor name didn't match? 233 // if the constructor name didn't match?
234 var wrapper = js.getDartHtmlWrapperFor(jsObject); 234 var wrapper = js.getDartHtmlWrapperFor(jsObject);
235 if (wrapper != null) { 235 if (wrapper != null) {
236 return wrapper; 236 return wrapper;
237 } 237 }
238 238
239 // TODO(jacobr): auomatically wrapping JsArray here is fundamentally broken
240 // as it hijacks adding custom methods on JS Array classes as part of the
241 // new typed DartJsInterop.
242 // To make this work we really need to make DartHtmlWrappingList extend
243 // JsArrayImpl. Fixing this issue needs to be part of a broader refactor
244 // that allows calling custom typed JS interop methods on all dart:html
245 // classes.
Alan Knight 2015/11/09 20:46:07 I think the largest issue here is that we call wra
239 if (jsObject is js.JsArray) { 246 if (jsObject is js.JsArray) {
240 var wrappingList = new DartHtmlWrappingList(jsObject); 247 var wrappingList = new DartHtmlWrappingList(jsObject);
241 js.setDartHtmlWrapperFor(jsObject, wrappingList); 248 js.setDartHtmlWrapperFor(jsObject, wrappingList);
242 return wrappingList; 249 return wrappingList;
243 } 250 }
244 251
245 var constructor = js.JsNative.getProperty(jsObject, 'constructor'); 252 var constructor = js.JsNative.getProperty(jsObject, 'constructor');
246 if (constructor == null) { 253 if (constructor == null) {
247 // Perfectly valid case for JavaScript objects where __proto__ has 254 // Perfectly valid case for JavaScript objects where __proto__ has
248 // intentionally been set to null. 255 // intentionally been set to null.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 380 }
374 381
375 /** 382 /**
376 * Wraps a JsArray and will call wrap_jso on its entries. 383 * Wraps a JsArray and will call wrap_jso on its entries.
377 */ 384 */
378 class DartHtmlWrappingList extends ListBase implements NativeFieldWrapperClass2 { 385 class DartHtmlWrappingList extends ListBase implements NativeFieldWrapperClass2 {
379 DartHtmlWrappingList(this.blink_jsObject); 386 DartHtmlWrappingList(this.blink_jsObject);
380 387
381 final js.JsArray blink_jsObject; 388 final js.JsArray blink_jsObject;
382 389
383 operator [](int index) => wrap_jso(js.JsNative.getArrayIndex(blink_jsObject, i ndex)); 390 operator [](int index) => wrap_jso_no_SerializedScriptvalue(js.JsNative.getArr ayIndex(blink_jsObject, index));
Alan Knight 2015/11/09 20:46:07 I *think* this might be ok, but should look at the
384 391
385 operator []=(int index, value) => blink_jsObject[index] = value; 392 operator []=(int index, value) => blink_jsObject[index] = value;
386 393
387 int get length => blink_jsObject.length; 394 int get length => blink_jsObject.length;
388 int set length(int newLength) => blink_jsObject.length = newLength; 395 int set length(int newLength) => blink_jsObject.length = newLength;
389 } 396 }
OLDNEW
« 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