jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

LinkDynamicModules iteration and FinishLoad incompatible #78

Closed guybedford closed 10 years ago

guybedford commented 10 years ago

LinkDynamicModules runs a loop through the load record list (https://github.com/jorendorff/js-loaders/blob/master/Loader.js#L1640)

FinishLoad clears load records from the load record list of the linkSets (https://github.com/jorendorff/js-loaders/blob/master/Loader.js#L1440)

So the iteration needs to take into account that the array will have changed.

Perhaps replace line 1640 with something like:

  while(loads.length) {
    load = loads[0];
    load.status = 'linked';
    finishLoad(loader, load);
  }
guybedford commented 10 years ago

BuildLinkageGroups effectively does this clone, stopping this from happening.