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

Side by Side Diff: sdk/lib/js/dartium/js_dartium.dart

Issue 1380963003: Preserve identity of Dart wrappers on DOM objects (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Support for interoperating with JavaScript. 6 * Support for interoperating with JavaScript.
7 * 7 *
8 * This library provides access to JavaScript objects from Dart, allowing 8 * This library provides access to JavaScript objects from Dart, allowing
9 * Dart code to get and set properties, and call methods of JavaScript objects 9 * Dart code to get and set properties, and call methods of JavaScript objects
10 * and invoke JavaScript functions. The library takes care of converting 10 * and invoke JavaScript functions. The library takes care of converting
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 /** 482 /**
483 * Proxies a JavaScript object to Dart. 483 * Proxies a JavaScript object to Dart.
484 * 484 *
485 * The properties of the JavaScript object are accessible via the `[]` and 485 * The properties of the JavaScript object are accessible via the `[]` and
486 * `[]=` operators. Methods are callable via [callMethod]. 486 * `[]=` operators. Methods are callable via [callMethod].
487 */ 487 */
488 class JsObject extends NativeFieldWrapperClass2 { 488 class JsObject extends NativeFieldWrapperClass2 {
489 JsObject.internal(); 489 JsObject.internal();
490 490
491 /** 491 /**
492 * If this JsObject is wrapped, e.g. DOM objects, then we can save the
493 * wrapper here and preserve its identity.
494 */
495 var wrapper;
Jacob 2015/10/01 21:07:47 this needs to be private
496
497 /**
492 * Constructs a new JavaScript object from [constructor] and returns a proxy 498 * Constructs a new JavaScript object from [constructor] and returns a proxy
493 * to it. 499 * to it.
494 */ 500 */
495 factory JsObject(JsFunction constructor, [List arguments]) { 501 factory JsObject(JsFunction constructor, [List arguments]) {
496 try { 502 try {
497 return _create(constructor, arguments); 503 return _create(constructor, arguments);
498 } catch (e) { 504 } catch (e) {
499 // Re-throw any errors (returned as a string) as a DomException. 505 // Re-throw any errors (returned as a string) as a DomException.
500 throw new html.DomException.jsInterop(e); 506 throw new html.DomException.jsInterop(e);
501 } 507 }
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 869
864 /** 870 /**
865 * Returns a method that can be called with an arbitrary number (for n less 871 * Returns a method that can be called with an arbitrary number (for n less
866 * than 11) of arguments without violating Dart type checks. 872 * than 11) of arguments without violating Dart type checks.
867 */ 873 */
868 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) => 874 Function _wrapAsDebuggerVarArgsFunction(JsFunction jsFunction) =>
869 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED, 875 ([a1 = _UNDEFINED, a2 = _UNDEFINED, a3 = _UNDEFINED, a4 = _UNDEFINED,
870 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED, 876 a5 = _UNDEFINED, a6 = _UNDEFINED, a7 = _UNDEFINED, a8 = _UNDEFINED,
871 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly( 877 a9 = _UNDEFINED, a10 = _UNDEFINED]) => jsFunction._applyDebuggerOnly(
872 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10])); 878 _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698