Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new ServiceWorkerClient makes no sense? #511

Closed
annevk opened this issue Oct 13, 2014 · 6 comments
Closed

new ServiceWorkerClient makes no sense? #511

annevk opened this issue Oct 13, 2014 · 6 comments

Comments

@annevk
Copy link
Member

annevk commented Oct 13, 2014

So the idea is that new ServiceWorkerClient instantiates a new Window. However, a Client represents both a Window and a WorkerGlobalScope. This needs to be done some other way I think.

@annevk annevk changed the title new ServiceWorkerClient makes no sense? new ServiceWorkerClient makes no sense? Oct 13, 2014
@annevk annevk changed the title new ServiceWorkerClient makes no sense? new ServiceWorkerClient makes no sense? Oct 13, 2014
@KenjiBaheux
Copy link
Collaborator

Note: ServiceWorkerClient's constructor is currently out of scope for blink.

@jakearchibald
Copy link
Contributor

@annevk I'm trying to make the constructor useful & avoid the "secret token" stuff.

There could be an option bag with a 'type' property that allows it to be a document/sharedworker. If you try and construct a new sharedworker client, it throws. I suppose that's kinda reintroducing the "secret token" thing, but at least the default would be document & new ServiceWorkerClient would work.

@annevk
Copy link
Member Author

annevk commented Oct 17, 2014

Workers already have (remote) constructors. new Worker and new SharedWorker. Perhaps this should be new BrowsingContext and clients should return references to Worker/SharedWorker/BrowsingContext. That'd make some amount of sense. (Perhaps we want to rename clients to environments, as that's the term we use for these things more or less.)

@jakearchibald
Copy link
Contributor

I'm nervous about fetchEvent.client (or wherever it ends up) being a different kind of object sometimes. Same goes for items returned by .getAll.

The getAll case worries me more, because I can imagine code that "works fine" and then fails down when workers end up in that list. We could fix that by only returning BrowsingContexts unless an option is set (we already have an option for uncontrolled clients).

I'll go with that unless my brain surprises me with a better idea.

@annevk
Copy link
Member Author

annevk commented Oct 20, 2014

Can't we make sure the objects look roughly similar? After all, it seems like these objects should look roughly similar.

@jungkees
Copy link
Collaborator

jungkees commented Jan 6, 2015

I believe we've been discussing through it and sorted out the issue. For the original question here, we provide clients.openWindow(url). Closing.

@jungkees jungkees closed this as completed Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants