Skip to content

Commit 1b2656a

Browse files
Revert "Add crossOrigin property to <img> tag used for decoding (flutter#54961)" (flutter#55042)
This reverts commit 4844cb4. Reason for revert: We broke users (including a Google internal customer) that depend on credentialed image requests. See flutter#154809 Fixes flutter#154809
1 parent 9822a71 commit 1b2656a

3 files changed

Lines changed: 0 additions & 15 deletions

File tree

lib/web_ui/lib/src/engine/html_image_element_codec.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ abstract class HtmlImageElementCodec implements ui.Codec {
4545
imgElement = createDomHTMLImageElement();
4646
imgElement!.src = src;
4747
setJsProperty<String>(imgElement!, 'decoding', 'async');
48-
setJsProperty<String>(imgElement!, 'crossOrigin', 'anonymous');
4948

5049
// Ignoring the returned future on purpose because we're communicating
5150
// through the `completer`.

lib/web_ui/lib/src/engine/safe_browser_api.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ T getJsProperty<T>(Object object, String name) {
4040
}
4141

4242
const Set<String> _safeJsProperties = <String>{
43-
'crossOrigin',
4443
'decoding',
4544
'__flutter_state',
4645
};

lib/web_ui/test/canvaskit/image_golden_test.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,6 @@ Future<void> testMain() async {
253253
}
254254
});
255255

256-
test('crossOrigin requests cause an error', () async {
257-
final String otherOrigin =
258-
domWindow.location.origin.replaceAll('localhost', '127.0.0.1');
259-
bool gotError = false;
260-
try {
261-
final ui.Codec _ = await renderer.instantiateImageCodecFromUrl(
262-
Uri.parse('$otherOrigin/test_images/1x1.png'));
263-
} catch (e) {
264-
gotError = true;
265-
}
266-
expect(gotError, isTrue, reason: 'Should have got CORS error');
267-
});
268-
269256
_testCkAnimatedImage();
270257

271258
test('isAvif', () {

0 commit comments

Comments
 (0)