Index: sdk/lib/html/src/dart2js_Conversions.dart |
diff --git a/sdk/lib/html/src/dart2js_Conversions.dart b/sdk/lib/html/src/dart2js_Conversions.dart |
index b5daaf300f2a707d6c1e84b6190401c5af5e6b79..b0452bec855fa920bf63fc4df82cf175939f5f8e 100644 |
--- a/sdk/lib/html/src/dart2js_Conversions.dart |
+++ b/sdk/lib/html/src/dart2js_Conversions.dart |
@@ -61,6 +61,15 @@ class _TypedImageData implements ImageData { |
} |
ImageData _convertNativeToDart_ImageData(nativeImageData) { |
+ |
+ // None of the native getters that return ImageData have the type ImageData |
+ // since that is incorrect for FireFox (which returns a plain Object). So we |
+ // need something that tells the compiler that the ImageData class has been |
+ // instantiated. |
+ // TODO(sra): Remove this when all the ImageData returning APIs have been |
+ // annotated as returning the union ImageData + Object. |
+ JS('ImageData', '0'); |
+ |
if (nativeImageData is ImageData) return nativeImageData; |
// On Firefox the above test fails because imagedata is a plain object. |
@@ -76,7 +85,7 @@ ImageData _convertNativeToDart_ImageData(nativeImageData) { |
// with native names. |
_convertDartToNative_ImageData(ImageData imageData) { |
if (imageData is _TypedImageData) { |
- return JS('Object', '{data: #, height: #, width: #}', |
+ return JS('', '{data: #, height: #, width: #}', |
imageData.data, imageData.height, imageData.width); |
} |
return imageData; |