Re: [whatwg/fetch] WIP: Cancelation (#523)

Which or the following patterns should I tend towards? Assume both are "in parallel".

1. Let value1 be null.
1. Let value2 be null.
1. Run these steps until terminated:
    1. Set value1 to (something from the HTTP cache).
    1. Set value2 to (something else from the HTTP cache).
1. If terminated, abort these steps.
1. Return value1, value2.

Or:

1. Let value1 be null.
1. Let value2 be null.
1. Set value1 to (something from the HTTP cache).
1. Set value2 to (something else from the HTTP cache).
1. If terminated, abort these steps.
1. Return value1, value2.

The former is explicit that the HTTP cache doesn't need to be read if the process becomes "terminated". However, since the cache read isn't observable, the latter also produces the same result, and a browser could optimise by aborting early.

The former requires more changes to the fetch spec, as:

1. Do something.
1. Do something else.
1. Perform (some kind of algorithm within this spec).
1. Do another thing.
1. And one last thing.

Needs to become:

1. Run these steps until terminated:
    1. Do something.
    1. Do something else.
1. If terminated, abort these steps.
1. Perform (some kind of algorithm within this spec).
1. Run these steps until terminated:
    1. Do another thing.
    1. And one last thing.
1. If terminated, abort these steps.

"Perform (some kind of algorithm within this spec)" isn't part of "Run these steps" as it'll have its own termination handling. I'm trying to keep this stuff as close to the leaf as possible.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/523#issuecomment-319350330

Received on Tuesday, 1 August 2017 12:01:13 UTC