Re: [w3c/ServiceWorker] ready promise is kind of weird with overlapping scopes (#1278)

>  it's OK to change a property that returns a promise,

The guidance from @annevk (and seemed also from @domenic) on #223 seemed to be that the promise shouldn't change: "always returning a new object from an attribute is a non-starter". Also see the comment on blink-dev https://groups.google.com/a/chromium.org/d/msg/blink-dev/jjh4KUS0cS0/c81n5M6c8qwJ

There might be confusion about what's a "stable promise". I think there's two possible definitions of stability: 1) whether the property can vend multiple promises:
```
x = navigator.serviceWorker.ready;
// ...
y = navigator.serviceWorker.ready; 
x === y; // true always
```

And 2), whether the promise can resolve/reject to different values over its lifetime.
```
x = navigator.serviceWorker.ready;
x.then(r => result = r);
// ...
x.then(r => result2 = r);
result === result2; // true always
```

@yutakahirano tells me stability 2) is always the case: once a given promise resolves/rejects, it always resolves/rejects to the same value. Is the stability 1) assumption no longer always true?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1278#issuecomment-365824817

Received on Thursday, 15 February 2018 04:50:46 UTC