[flutter_releases] Flutter stable 2.5.3 Engine Cherrypicks (#29188)

* 'Update Dart SDK to 4ac35a7ec8c598ba1fdd8a1835a7fd84c61d9221'

* Call _isLoopback as a last resort (#28576)

* Update expected licenses signature.

Co-authored-by: Bruno Leroux <leroux_bruno@yahoo.fr>
diff --git a/DEPS b/DEPS
index 51c2c87..a617c6a 100644
--- a/DEPS
+++ b/DEPS
@@ -35,7 +35,7 @@
   # Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
   # You can use //tools/dart/create_updated_flutter_deps.py to produce
   # updated revision list of existing dependencies.
-  'dart_revision': '020b3efd3f0023c5db2097787f7cf778db837a8f',
+  'dart_revision': '4ac35a7ec8c598ba1fdd8a1835a7fd84c61d9221',
 
   # WARNING: DO NOT EDIT MANUALLY
   # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party
index 3503074..c396bfe 100644
--- a/ci/licenses_golden/licenses_third_party
+++ b/ci/licenses_golden/licenses_third_party
@@ -1,4 +1,4 @@
-Signature: 53f29196ad211ebb19347a5978c6166c
+Signature: 26f3a3f927ee221f3706f8ef7aee1d2c
 
 UNUSED LICENSES:
 
diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart
index c0b78e7..8f76027 100644
--- a/lib/ui/hooks.dart
+++ b/lib/ui/hooks.dart
@@ -249,20 +249,22 @@
 // ignore: unused_element
 void Function(Uri) _getHttpConnectionHookClosure(bool mayInsecurelyConnectToAllDomains) {
   return (Uri uri) {
-      if (_isLoopback(uri.host)) {
-        return;
-      }
       final dynamic zoneOverride = Zone.current[#flutter.io.allow_http];
       if (zoneOverride == true) {
         return;
       }
       if (zoneOverride == false && uri.isScheme('http')) {
-        // Going to throw
+        // Going to _isLoopback check before throwing
       } else if (mayInsecurelyConnectToAllDomains || uri.isScheme('https')) {
         // In absence of zone override, if engine setting allows the connection
         // or if connection is to `https`, allow the connection.
         return;
       }
+      // Loopback connections are always allowed
+      // Check at last resort to avoid debug annoyance of try/on ArgumentError
+      if (_isLoopback(uri.host)) {
+        return;
+      }
       throw UnsupportedError(
         'Non-https connection "$uri" is not supported by the platform. '
         'Refer to https://flutter.dev/docs/release/breaking-changes/network-policy-ios-android.');
diff --git a/testing/dart/http_disallow_http_connections_test.dart b/testing/dart/http_disallow_http_connections_test.dart
index f9b8e4e..f2839b9 100644
--- a/testing/dart/http_disallow_http_connections_test.dart
+++ b/testing/dart/http_disallow_http_connections_test.dart
@@ -52,7 +52,7 @@
 }
 
 void main() {
-  test('testWithHostname', () async {
+  test('testWithLocalIP', () async {
     await bindServerAndTest(await getLocalHostIP(), (HttpClient httpClient, Uri httpUri) async {
       asyncExpectThrows<UnsupportedError>(
           () async =>  httpClient.getUrl(httpUri));
@@ -67,6 +67,30 @@
     });
   });
 
+  test('testWithHostname', () async {
+    await bindServerAndTest(Platform.localHostname, (HttpClient httpClient, Uri httpUri) async {
+      asyncExpectThrows<UnsupportedError>(
+          () async =>  httpClient.getUrl(httpUri));
+
+      final _MockZoneValue mockFoo = _MockZoneValue('foo');
+      asyncExpectThrows<UnsupportedError>(
+          () async => runZoned(() => httpClient.getUrl(httpUri),
+            zoneValues: <dynamic, dynamic>{#flutter.io.allow_http: mockFoo}));
+      expect(mockFoo.checked, isTrue);
+
+      final _MockZoneValue mockFalse = _MockZoneValue(false);
+      asyncExpectThrows<UnsupportedError>(
+          () async => runZoned(() => httpClient.getUrl(httpUri),
+            zoneValues: <dynamic, dynamic>{#flutter.io.allow_http: mockFalse}));
+      expect(mockFalse.checked, isTrue);
+
+      final _MockZoneValue mockTrue = _MockZoneValue(true);
+      await runZoned(() => httpClient.getUrl(httpUri),
+        zoneValues: <dynamic, dynamic>{#flutter.io.allow_http: mockTrue});
+      expect(mockFalse.checked, isTrue);
+    });
+  });
+
   test('testWithLoopback', () async {
     await bindServerAndTest('127.0.0.1', (HttpClient httpClient, Uri uri) async {
       await httpClient.getUrl(Uri.parse('http://localhost:${uri.port}'));
@@ -82,3 +106,27 @@
     }
   });
 }
+
+class _MockZoneValue {
+  _MockZoneValue(this._value);
+
+  Object? _value;
+  bool _falseChecked = false;
+  bool _trueChecked = false;
+
+  @override
+  bool operator ==(Object o) {
+    if(o == true) {
+      _trueChecked = true;
+    }
+    if(o == false) {
+      _falseChecked = true;
+    }
+    return _value == o;
+  }
+
+  bool get checked => _falseChecked && _trueChecked;
+
+  @override
+  int get hashCode => _value.hashCode;
+}