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

Racing condition on IE11 while parsing import scripts #299

Sleeckx opened this Issue May 6, 2015 · 1 comment


None yet
4 participants

Sleeckx commented May 6, 2015

We are building a large scale web application using webcomponentsjs and polymer. Running our web application on IE11 fails because the same script code is ran twice. Our first thought was that we were referencing the script again in another import file but after checking closely, and monitoring the network stack, this was not the case. It's a bit difficult to simulate what we noticed in a small test case, so we're hoping that this explanation will be sufficient.

The following illustration shows what is happening:

Script A is being parsed, but before it is marked complete, Script B starts parsing. In the meantime Script A is done parsing and calls nextToParse which in turn returns Script B again. Since Script B is registering Polymer elements this of course fails since the element is already being registered.

Our file setup is as follow:


Including a.js directly in the a.html file instead of an external script results in the same incorrect behavior.

Digging deeper into the webcomponentsjs code, we fixed the issue by marking the element as being parsed immediately in the markParsing function by adding elt.__importParsed = true; at the end.

    markParsing: function (elt) {
      flags.parse && console.log("parsing", elt);
      this.parsingElement = elt;
      elt.__importParsed = true;

This causes the nextToParse function to return the correct script, with the following result:

We sincerely hope that the above explanation is enough to trigger an idea as to what the real cause of the problem is since the issue occurs at random once in every 3 page loads.


This comment has been minimized.


TimvdLippe commented Apr 13, 2018

Thanks for the issue. It has been a great while since this issue was opened. Sadly, this issue misses a live reproduction with the most recent version of the webcomponents polyfill for us to be able to debug and potentially fix. Versions 1 of the polyfills fix a large amount of issues, probably including this one as well.

Please see the for guidelines on filing issues. You can start from this jsBin template as a starting point and link it in the issue template under "Live Demo".

Feel free to file a new issue following these instructions if you can still reproduce this issue with versions 1 of the polyfills. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment