Skip to content

Conversation

@domenic
Copy link
Contributor

@domenic domenic commented Mar 27, 2020

Follows whatwg/html#5411.

This moves to the imperative style of agent allocation, as HTML is no longer declaratively defining service worker agents and their relations to others.


Preview | Diff

docs/index.bs Outdated
* Let |realmExecutionContext| be the created [=execution context|JavaScript execution context=].
1. Set |serviceWorker|'s [=service worker/global object=] to |workerGlobalScope|.
1. Let |workerEventLoop| be a newly created <a>event loop</a>.
1. Let |workerEventLoop| be |agent|'s [=event loop=].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does an agent have an associated event loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Yes, as of whatwg/html@cd59059, but we did not add a dedicated definition for it. I'm on the fence as to whether we should or not... any thoughts, @annevk?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be nice, but I'd be okay with a cleanup issue of sorts. (I'm suddenly reminded of document's origin.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might as well do it now, if we're asking related specs to make changes.

1. Let |startFailed| be false.
1. Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the following steps in that context:
1. Call the JavaScript [=InitializeHostDefinedRealm|InitializeHostDefinedRealm()=] abstract operation with the following customizations:
1. Let |agent| be the result of [=obtain a service worker agent|obtaining a service worker agent=], and run the following steps in that context:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: It's be great to add "obtaining a service worker agent" as link text.

1. Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the following steps in that context:
1. Call the JavaScript [=InitializeHostDefinedRealm|InitializeHostDefinedRealm()=] abstract operation with the following customizations:
1. Let |agent| be the result of [=obtain a service worker agent|obtaining a service worker agent=], and run the following steps in that context:
1. Let |realmExecutionContext| be the result of [=create a new JavaScript realm|creating a new JavaScript realm=] given |agent| and the following customizations:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@domenic
Copy link
Contributor Author

domenic commented Apr 6, 2020

OK, the HTML changes have landed and percolated, and I've confirmed they're working correctly in the PR preview. This is ready for an editor to merge.

@jakearchibald jakearchibald merged commit 0aceaac into w3c:master Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants