whatwg / loader

Loader Standard
https://whatwg.github.io/loader/
Creative Commons Zero v1.0 Universal
607 stars 45 forks source link

Needs to specify set state to max #16

Closed arv closed 9 years ago

arv commented 9 years ago

There are a few alg steps like these:

Set _entry_.[[State]] to the max of _entry_.[[State]] and "translate".

We need to specify what this means.

How about:

GetStateValue(state)

  1. If state is the string "fetch" return 0.
  2. If state is the string "translate" return 1.
  3. If state is the string "instantiate" return 2.
  4. If state is the string "link" return 3.
  5. If state is the string "ready" return 4.

SetStateToMax(entry, newState)

  1. Let state be entry.[[State]].
  2. Let stateValue be GetStateValue(state).
  3. Let newStateValue be GetStateValue(newState).
  4. If newStateValue is larger than stateValue, set entry.[[State]] to newState.
caridy commented 9 years ago

Similarely, we have steps like:

1. If _entry_.[[State]] is greater than "link", return a new error promise.

and

1. If _pair_.[[value]].[[State]] is less than "link", then throw a new TypeError.
caridy commented 9 years ago

Solved by https://github.com/whatwg/loader/pull/65

caridy commented 9 years ago

Closing this now that we have all abstract operations in place.