whatwg / fetch

Fetch Standard
https://fetch.spec.whatwg.org/
Other
2.11k stars 329 forks source link

Global and a ReadableStream reader when consuming the body #826

Open bakulf opened 5 years ago

bakulf commented 5 years ago

"Let reader be the result of getting a reader from stream. If that threw an exception, return a new promise rejected with that exception."

In which global should this reader belong to? And what about the 'promise' created by the reader when retrieving data from the ReadableStream? I guess it's the same global of the reader.

domenic commented 5 years ago

In which way is this observable?

annevk commented 5 years ago

It's not, apart from extensions perhaps. Perhaps this should say "implementation-defined realm", but perhaps it'd fall out of fixing https://github.com/heycam/webidl/issues/135?

annevk commented 5 years ago

(Also relates to #730 somewhat I suppose for the creation of the empty stream.)

bzbarsky commented 5 years ago

It's not, apart from extensions perhaps.

The Promise involved is completely unobservable?

annevk commented 5 years ago

The promise returned by the undefined "transforming" operation (hopefully IDL integrates that part of the promises guide at some point) would be exposed. Presumably that would use the global of this per yet-to-be-defined IDL shorthands.

bzbarsky commented 5 years ago

Which "this", in this case?

annevk commented 5 years ago

Of the object on which the method is declared that ends up returning the promise. As the "consume body" algorithm is some internal algorithm of that object, the this object is somewhat obvious, but perhaps we'd need to make this explicit anyway somehow depending on how promises and object creation get formalized in IDL.