Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core, web): fix an incompatibility with Flutter Beta that would occur when calling method on TrustedScriptURL #12274

Merged
merged 3 commits into from Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -129,10 +129,15 @@ class FirebaseCoreWeb extends FirebasePlatform {
web.document.createElement('script') as web.HTMLScriptElement;
script.type = 'text/javascript';
script.crossOrigin = 'anonymous';
final stringUrl = trustedUrl != null
// Necessary for the JS interop to work correctly on Flutter Beta 3.19.
// ignore: unnecessary_cast
? (trustedUrl as JSObject).callMethod('toString'.toJS)
: src;
script.text = '''
window.ff_trigger_$windowVar = async (callback) => {
console.debug("Initializing Firebase $windowVar");
callback(await import("${trustedUrl != null ? trustedUrl.callMethod('toString'.toJS) : src}"));
callback(await import("$stringUrl"));
};
''';

Expand Down