-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
JSONP call fails in Internet Explorer 11 and Google Maps API #39496
Comments
The problem is that Internet Explorer 11 (and with that EdgeHTML) trigger the Note: In IE 11, the Promise polyfill from the Google Maps script is used which uses My guess is that IE and EdgeHTML add a microtask at the end of the execution queue if they see any In a local setup I tried to replace the following line: angular/packages/common/http/src/jsonp.ts Line 193 in c83b2ad
with: node.addEventListener('load', event => setTimeout(() => onLoad(event))); and after that it worked in Internet Explorer. Because with an extra The same should probably be done for the Would you agree to such a fix? |
@JiaLiPassion is there a chance this could be due to some sort of conflict with Google Map's Promise polyfill and Zone's patching for Promise? |
@jelbourn , sure, I will check it. |
@sebastianhaeni, I just debug the case, and in
So I would suggest not using |
…#39512) Before this change, when trying to load a JSONP script that calls the JSONP callback inside a microtask, it will fail in Internet Explorer 11 and EdgeHTML. This commit changes the onLoad cleanup to be queued after the loaded endpoint executed any potential microtask itself. This ensures that the aforementioned browsers will first evaluate the loaded script calling the JSONP callback and only then run the cleanup inside onLoad. Fixes #39496 PR Close #39512
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The issue is caused by package
@angular/common
.And it is related to
@angular/google-maps
.Is this a regression?
I'm not sure. This is the first time for me trying to implement a JSONP call to the Google Maps API in Angular and support Internet Explorer 11.
Description
A JSONP call to the Google Maps API fails in Internet Explorer 11 while it works fine in other browsers.
I followed this guide: https://github.com/angular/components/tree/master/src/google-maps#lazy-loading-the-api
JSONP calls only fail in Internet Explorer with the Google Maps API. I tried other JSONP endpoints, and they seem to work fine.
So, if you think this is not an Angular issue, this bug needs to taken to the Google Maps API I guess.
🔬 Minimal Reproduction
I created a demo repository here: https://github.com/sebastianhaeni/angular-jsonp-bug
Unfortunately it cannot be reproduced on stackblitz because it needs a full prod build, so IE 11 can execute the JavaScript (ES5 and polyfills needed).
My hunch is that it's somehow a problem with the lifecycle of the JSONP callback function on the
window
object, which is maybe removed too early.🔥 Exception or Error
🌍 Your Environment
Angular Version:
Anything else relevant?
Specific browser version:
The text was updated successfully, but these errors were encountered: