diff --git a/subresource-loading.bs b/subresource-loading.bs index 513a6ca34..49baa3b1e 100644 --- a/subresource-loading.bs +++ b/subresource-loading.bs @@ -59,41 +59,286 @@ Note: This specification is under construction. See A fetched web bundle is a representation of a web bundle format defined in [[draft-ietf-wpack-bundled-responses-latest]]. +A web bundle fetch entry is a [=struct=] with the following +[=struct/items=]: + +- source, a [=URL=] of a web bundle. +- credentials, a [=request/credentials + mode=]. +- state, an internal state which is + "fetching", "fetched", or "failed". Initially "fetching". +- fetched bundle, a [=fetched web + bundle=] or null. + +ISSUE: A better name for [=web bundle fetch entry=]? + +A [=web bundle fetch entry=] |entry| is used +by a registration in [=Document=] |document| if |document|'s +[=Document/web bundle registration list=] [=list/contains=] a [=web bundle +registration=] whose [=web bundle registration/fetch entry=] is |entry|. + A bundle rule is a [=struct=] with the following [=struct/items=]: -- source, a [=URL=] of a web bundle. -- credentials, a [=request/credentials mode=]. - resources, a [=list=] of [=URLs=]. - scopes, a [=list=] of [=URLs=]. -A web bundle is a [=struct=] with the following [=struct/items=]: +A web bundle registration is a [=struct=] with the following +[=struct/items=]: + +- fetch entry, a [=web bundle fetch + entry=]. +- rule, a [=bundle rule=]. + +A web bundle parse result is a [=struct=] with the following +[=struct/items=]: -- fetched bundle, a [=fetched web bundle=] or null. -- rule, a [=bundle rule=]. -- state, an internal state which is "fetching", - "fetched", or "failed". Initially "fetching". +- source, a [=URL=] of a web bundle. +- credentials, a [=request/credentials + mode=]. +- rule, a [=bundle rule=]. Each [=environment settings object=] will get a -web bundle list algorithm, which -returns a [=list=] of [=web bundles=]. +web bundle registration list +algorithm, which returns a [=list=] of [=web bundle registrations=]. -A {{Document}} has a web bundle list, which is a -[=list=] of [=web bundles=]. It is initially empty. +A {{Document}} has a web bundle registration list, which +is a [=list=] of [=web bundle registrations=]. It is initially empty. In set up a window environment settings object, settings object's [=environment settings object/web bundle -list=] returns the [=Document/web bundle list=] of window's -associated Document. +registration list=] returns the [=Document/web bundle registration list=] of +window's associated Document. In set up a worker environment settings object, settings object's [=environment settings object/web bundle -list=] returns an empty [=list=]. +registration list=] returns an empty [=list=]. + +A {{Document}} has a web bundle fetch entry list, which +is a [=list=] of [=web bundle fetch entries=]. It is initially empty. + +ISSUE: While [=list=] is used for [=Document/web bundle fetch entry list=], the +order shouldn't be important. ISSUE: Not supported for workers. # HTML monkeypatches # {#html-monkeypatches} -Note: TODO. This section uses [=fetch web bundle=]. +To process web bundles in the prepare a script algorithm +consistently with existing script types (i.e. classic or module), we make the +following changes: + +- Introduce web bundle result, which is a [=struct=] with two + [=struct/items=]: + - a registration, a [=web bundle + registration=]; and + - an error to rethrow, a JavaScript value + representing a parse error when non-null. +- Add "`webbundle`" to a possible value of the script's type. +- Rename the script's script to the script's + result, which can be either a + script + or a [=web bundle result=]. + +Note: Because we don't make [=web bundle result=] a new subclass of +script, +other script execution-related specs are left unaffected. + +## Prepare a script ## {#integration-prepare-a-script} + +Inside the prepare a script algorithm, we make the following +changes: + +- Insert the following step to [=prepare a script=] step 8, under "Determine the + script's type as follows:": + - If the script block's type string is an [=ASCII case-insensitive=] match for + the string "`webbundle`", the script's type is + "`webbundle`". +- Insert the following case to prepare a script step 26.7: + + - "`webbundle`": + + 1. [=Queue a task=] to [=fire an event=] named `error` at the element, and + return. + + Note: `