{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/799","labels_url":"https://api.github.com/repos/systemjs/systemjs/issues/799/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/systemjs/issues/799/comments","events_url":"https://api.github.com/repos/systemjs/systemjs/issues/799/events","html_url":"https://github.com/systemjs/systemjs/issues/799","id":107482698,"number":799,"title":"IE9 and IE10 reports multiple anonymous registers","user":{"login":"Zenorbi","id":313625,"avatar_url":"https://avatars.githubusercontent.com/u/313625?v=3","gravatar_id":"","url":"https://api.github.com/users/Zenorbi","html_url":"https://github.com/Zenorbi","followers_url":"https://api.github.com/users/Zenorbi/followers","following_url":"https://api.github.com/users/Zenorbi/following{/other_user}","gists_url":"https://api.github.com/users/Zenorbi/gists{/gist_id}","starred_url":"https://api.github.com/users/Zenorbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zenorbi/subscriptions","organizations_url":"https://api.github.com/users/Zenorbi/orgs","repos_url":"https://api.github.com/users/Zenorbi/repos","events_url":"https://api.github.com/users/Zenorbi/events{/privacy}","received_events_url":"https://api.github.com/users/Zenorbi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-21T10:19:14Z","updated_at":"2015-09-24T20:13:36Z","closed_at":"2015-09-22T21:18:29Z","body":"The attached test-app shows the bug described here.\r\n\r\nhttps://github.com/Zenorbi/systemjs-ie-issue\r\n\r\nTo run the test:\r\n```bash\r\nnpm install\r\nnode_modules/.bin/gulp serve\r\n```\r\nSteps to reproduce:\r\n- Open the project in IE9 or IE10 (emulated IE's also show the bug).\r\n- Open the console.\r\n- Disable caching.\r\n- Try refreshing the page until an exception happens (should show the bug within 5 refreshes).\r\n\r\nconsole.log to show the position of the bug:\r\n- open jspm_packages/system.src.js\r\n- go to line 2436 `function doRegister(loader, name, register) {` and insert `console.log(\"doRegister called\")`\r\n- go to line 2352 `function complete(evt) {` and insert `console.log(s.readyState, s.src)`\r\n\r\nNow, when you get an exception it shows that two files load simultaneously and then both execute `System.register` causing SystemJS to think it has 2 anonymous registers (and also missing the first script's register).\r\n\r\nIn IE, there is a special `readyState` for script tags called `\"interactive\"`. Interactive means the script is loaded and it's currently under the first execution. SystemJS should keep and array of currently loading modules and whenever `doRegister` is called, it should look for that `readyState`. RequireJS does this to avoid the bug.\r\n\r\nFrom RequireJS:\r\n```\r\n//Probably IE. IE (at least 6-8) do not fire\r\n//script onload right after executing the script, so\r\n//we cannot tie the anonymous define call to a name.\r\n//However, IE reports the script as being in 'interactive'\r\n//readyState at the time of the define call.\r\n```"},"comment":{"url":"https://api.github.com/repos/systemjs/systemjs/issues/comments/143037696","html_url":"https://github.com/systemjs/systemjs/issues/799#issuecomment-143037696","issue_url":"https://api.github.com/repos/systemjs/systemjs/issues/799","id":143037696,"user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars.githubusercontent.com/u/598730?v=3","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T20:13:36Z","updated_at":"2015-09-24T20:13:36Z","body":"Sure, no problem at all, this was a critical one so thanks for helping to isolate and understand it!"}}