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

Unified Diff: sdk/lib/html/scripts/generator.py

Issue 11299220: Add @JSName annotation for native fields and methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/html/scripts/generator.py
diff --git a/sdk/lib/html/scripts/generator.py b/sdk/lib/html/scripts/generator.py
index 76b5ecfe5a570a05349b8e8f7fe85150b079b6a3..30b03330942d6eaf27752f739094ffdd369aea72 100644
--- a/sdk/lib/html/scripts/generator.py
+++ b/sdk/lib/html/scripts/generator.py
@@ -545,11 +545,15 @@ dart2js_conversions = {
'SerializedScriptValue set Worker.postMessage': _serialize_SSV,
# receiving message via MessageEvent
- 'DOMObject get MessageEvent.data':
+ '* get MessageEvent.data':
Conversion('_convertNativeToDart_SerializedScriptValue',
'dynamic', 'dynamic'),
- 'DOMObject get PopStateEvent.state':
+ '* get History.state':
+ Conversion('_convertNativeToDart_SerializedScriptValue',
+ 'dynamic', 'dynamic'),
+
+ '* get PopStateEvent.state':
Conversion('_convertNativeToDart_SerializedScriptValue',
'dynamic', 'dynamic'),
@@ -577,13 +581,14 @@ dart2js_conversions = {
def FindConversion(idl_type, direction, interface, member):
table = dart2js_conversions
return (table.get('%s %s %s.%s' % (idl_type, direction, interface, member)) or
+ table.get('* %s %s.%s' % (direction, interface, member)) or
table.get('%s %s %s.*' % (idl_type, direction, interface)) or
table.get('%s %s' % (idl_type, direction)))
return None
# ------------------------------------------------------------------------------
-# Annotations to be placed on members. The table is indexed by the IDL
+# Annotations to be placed on native members. The table is indexed by the IDL
# interface and member name, and by IDL return or field type name. Both are
# used to assemble the annotations:
#
@@ -602,8 +607,18 @@ dart2js_annotations = {
'CanvasRenderingContext2D.webkitGetImageDataHD':
"@Creates('ImageData|=Object')",
+ # Methods returning Window can return a local window, or a cross-frame
+ # window (=Object) that needs wrapping.
+ 'DOMWindow':
+ "@Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object')",
+
'DOMWindow.openDatabase': "@Creates('Database') @Creates('DatabaseSync')",
+ # Cross-frame windows are EventTargets.
+ 'EventTarget':
+ #"@Creates('Null') @Returns('EventTarget|=Object')",
+ "@Creates('EventTarget|=Object') @Returns('EventTarget|=Object')",
+
'FileReader.result': "@Creates('String|ArrayBuffer|Null')",
# Rather than have the result of an IDBRequest as a union over all possible
@@ -645,6 +660,16 @@ dart2js_annotations = {
'MessageEvent.ports': "@Creates('=List')",
+ 'MessageEvent.data':
+ "@_annotation_Creates_SerializedScriptValue "
+ "@_annotation_Returns_SerializedScriptValue",
+ 'PopStateEvent.state':
+ "@_annotation_Creates_SerializedScriptValue "
+ "@_annotation_Returns_SerializedScriptValue",
+ 'SerializedScriptValue':
+ "@_annotation_Creates_SerializedScriptValue "
+ "@_annotation_Returns_SerializedScriptValue",
+
'SQLResultSetRowList.item': "@Creates('=Object')",
'XMLHttpRequest.response':
@@ -1096,7 +1121,7 @@ _idl_type_registry = {
item_type='MediaStream', suppress_interface=True),
'NamedNodeMap': TypeData(clazz='Interface', item_type='Node'),
'NodeList': TypeData(clazz='Interface', item_type='Node',
- suppress_interface=True),
+ suppress_interface=False, dart_type='List<Node>'),
'SVGAnimatedLengthList': TypeData(clazz='Interface',
item_type='SVGAnimatedLength'),
'SVGAnimatedNumberList': TypeData(clazz='Interface',

Powered by Google App Engine
This is Rietveld 408576698