Revert "Add crossOrigin property to <img> tag used for decoding (#54961)" (flutter/engine#55042)

This reverts commit acf6660982dff1f924f3438f05a41bcdba649105.

Reason for revert: We broke users (including a Google internal customer) that depend on credentialed image requests. See https://github.com/flutter/flutter/issues/154809

Fixes https://github.com/flutter/flutter/issues/154809
This commit is contained in:
Jackson Gardner 2024-09-09 10:22:02 -07:00 committed by GitHub
parent 2783af7183
commit 4a1b51bdda
3 changed files with 0 additions and 15 deletions

View File

@ -45,7 +45,6 @@ abstract class HtmlImageElementCodec implements ui.Codec {
imgElement = createDomHTMLImageElement(); imgElement = createDomHTMLImageElement();
imgElement!.src = src; imgElement!.src = src;
setJsProperty<String>(imgElement!, 'decoding', 'async'); setJsProperty<String>(imgElement!, 'decoding', 'async');
setJsProperty<String>(imgElement!, 'crossOrigin', 'anonymous');
// Ignoring the returned future on purpose because we're communicating // Ignoring the returned future on purpose because we're communicating
// through the `completer`. // through the `completer`.

View File

@ -40,7 +40,6 @@ T getJsProperty<T>(Object object, String name) {
} }
const Set<String> _safeJsProperties = <String>{ const Set<String> _safeJsProperties = <String>{
'crossOrigin',
'decoding', 'decoding',
'__flutter_state', '__flutter_state',
}; };

View File

@ -253,19 +253,6 @@ Future<void> testMain() async {
} }
}); });
test('crossOrigin requests cause an error', () async {
final String otherOrigin =
domWindow.location.origin.replaceAll('localhost', '127.0.0.1');
bool gotError = false;
try {
final ui.Codec _ = await renderer.instantiateImageCodecFromUrl(
Uri.parse('$otherOrigin/test_images/1x1.png'));
} catch (e) {
gotError = true;
}
expect(gotError, isTrue, reason: 'Should have got CORS error');
});
_testCkAnimatedImage(); _testCkAnimatedImage();
test('isAvif', () { test('isAvif', () {