diff --git a/.gitignore b/.gitignore index ed89a75c4..13e80cf8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules /index.html *.cddl -*.json \ No newline at end of file +*.json diff --git a/index.bs b/index.bs index 70a7731ee..7dd0e7333 100644 --- a/index.bs +++ b/index.bs @@ -74,6 +74,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ text: remote end steps; url: dfn-remote-end-steps text: remote end; url: dfn-remote-ends text: reset the input state; url: dfn-reset-the-input-state + text: scroll into view; url: dfn-scrolls-into-view text: session ID; url: dfn-session-id text: session not created; url: dfn-session-not-created text: session; url: dfn-sessions @@ -81,6 +82,7 @@ spec: WEBDRIVER; urlPrefix: https://w3c.github.io/webdriver/ text: success; url: dfn-success text: try; url: dfn-try text: trying; url: dfn-try + text: unable to capture screen; url: dfn-unable-to-capture-screen text: unknown command; url: dfn-unknown-command text: unknown error; url: dfn-unknown-error text: unsupported operation; url: dfn-unsupported-operation @@ -143,8 +145,14 @@ spec: ECMASCRIPT; urlPrefix: https://tc39.es/ecma262/ spec: GEOMETRY; urlPrefix: https://drafts.fxtf.org/geometry/ type: dfn text: rectangle; url: rectangle + text: x coordinate; url: rectangle-x-coordinate + text: y coordinate; url: rectangle-y-coordinate + text: width dimension; url: rectangle-width-dimension + text: height dimension; url: rectangle-height-dimension spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ type: dfn + text: 2D; url: canvas.html#concept-canvas-2d + text: 2D context creation algorithm; url: canvas.html#2d-context-creation-algorithm text: a browsing context is discarded; url: window-object.html#a-browsing-context-is-discarded text: active browsing context; url: document-sequences.html#nav-bc text: active document; for: browsing context; url: document-sequences.html#active-document @@ -154,6 +162,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: create a classic script; url: webappapis.html#creating-a-classic-script text: create a new browsing context; url: browsers.html#creating-a-new-browsing-context text: confirm; url: timers-and-user-prompts.html#dom-confirm + text: context mode; url: /canvas.html#offscreencanvas-context-mode text: default classic script fetch options; url: webappapis.html#default-classic-script-fetch-options text: environment settings object's Realm; url: webappapis.html#environment-settings-object's-realm text: handled; url: webappapis.html#concept-error-handled @@ -183,6 +192,9 @@ spec: HR-TIME; urlPrefix: https://w3c.github.io/hr-time/ spec: RFC4648; urlPrefix: https://tools.ietf.org/html/rfc4648 type: dfn text: Base64 Encode; url: section-4 +spec: CSSOM-VIEW; urlPrefix: https://drafts.csswg.org/cssom-view/ + type: dfn + text: visual viewport; url: #visual-viewport
@@ -321,7 +333,7 @@ ErrorResponse = { id: js-uint / null, error: ErrorCode, message: text, - ?stacktrace: text, + ? stacktrace: text, Extensible } @@ -476,19 +488,22 @@ with the following additional codes:-ErrorCode = ("invalid argument" / - "invalid session id" / - "no such alert" / - "no such frame" / - "no such handle" / +ErrorCode = "invalid argument" / + "invalid session id" / + "move target out of bounds" / + "no such alert" / + "no such element" / + "no such frame" / + "no such handle" / "no such intercept" / - "no such node" / - "no such script" / - "session not created" / - "unable to close browser" / - "unknown command" / - "unknown error" / - "unsupported operation") + "no such node" / + "no such script" / + "session not created" / + "unable to capture screen" / + "unable to close browser" / + "unknown command" / + "unknown error" / + "unsupported operation"## Events ## {#events} @@ -1196,7 +1211,10 @@ SessionCommand = ( [=local end definition=]-SessionResult = (session.StatusResult) +SessionResult = ( + session.NewResult // + session.StatusResult +)@@ -1332,8 +1350,8 @@ filter only those that ought to be returned to the local end.+#### The browsingContext.setViewport Command #### {#command-browsingContext-setViewport} + +The browsingContext.setViewport command specific viewport characteristics (e.g. viewport width and viewport height) on the given top-level browsing context. + +session.CapabilitiesRequest = { - ?alwaysMatch: session.CapabilityRequest, - ?firstMatch: [*session.CapabilityRequest] + ? alwaysMatch: session.CapabilityRequest, + ? firstMatch: [*session.CapabilityRequest] }@@ -1346,25 +1364,25 @@ for a session.session.CapabilityRequest = { - ?acceptInsecureCerts: bool, - ?browserName: text, - ?browserVersion: text, - ?platformName: text, - ?proxy: { - ?proxyType: "pac" / "direct" / "autodetect" / "system" / "manual", - ?proxyAutoconfigUrl: text, - ?ftpProxy: text, - ?httpProxy: text, - ?noProxy: [*text], - ?sslProxy: text, - ?socksProxy: text, - ?socksVersion: 0..255, + ? acceptInsecureCerts: bool, + ? browserName: text, + ? browserVersion: text, + ? platformName: text, + ? proxy: { + ? proxyType: "pac" / "direct" / "autodetect" / "system" / "manual", + ? proxyAutoconfigUrl: text, + ? ftpProxy: text, + ? httpProxy: text, + ? noProxy: [*text], + ? sslProxy: text, + ? socksProxy: text, + ? socksVersion: 0..255, }, Extensible };-Thesession.CapabilityRequest
type represents a sepecific set of +Thesession.CapabilityRequest
type represents a specific set of requested capabilities. #### The session.SubscriptionRequest Type #### {#type-session-SubscriptionRequest} @@ -1372,7 +1390,7 @@ requested capabilities.session.SubscriptionRequest = { events: [*text], - ?contexts: [*browsingContext.BrowsingContext], + ? contexts: [*browsingContext.BrowsingContext], }@@ -1465,14 +1483,14 @@ This is a [=static command=]. browserVersion: text, platformName: text, proxy: { - ?proxyType: "pac" / "direct" / "autodetect" / "system" / "manual", - ?proxyAutoconfigUrl: text, - ?ftpProxy: text, - ?httpProxy: text, - ?noProxy: [*text], - ?sslProxy: text, - ?socksProxy: text, - ?socksVersion: 0..255, + ? proxyType: "pac" / "direct" / "autodetect" / "system" / "manual", + ? proxyAutoconfigUrl: text, + ? ftpProxy: text, + ? httpProxy: text, + ? noProxy: [*text], + ? sslProxy: text, + ? socksProxy: text, + ? socksVersion: 0..255, }, setWindowRect: bool, Extensible @@ -1870,7 +1888,7 @@ browsingContext.Info = { context: browsingContext.BrowsingContext, url: text, children: browsingContext.InfoList / null - ?parent: browsingContext.BrowsingContext / null, + ? parent: browsingContext.BrowsingContext / null, } @@ -2121,7 +2139,27 @@ Base64-encoded string. } browsingContext.CaptureScreenshotParameters = { - context: browsingContext.BrowsingContext + context: browsingContext.BrowsingContext, + ? clip: browsingContext.ClipRectangle + } + + browsingContext.ClipRectangle = ( + browsingContext.BoxClipRectangle // + browsingContext.ElementClipRectangle + ) + + browsingContext.ElementClipRectangle = { + type: "element", + element: script.SharedReference, + ? scrollIntoView: bool + } + + browsingContext.BoxClipRectangle = { + type: "viewport", + x: float, + y: float, + width: float, + height: float } @@ -2137,10 +2175,121 @@ Base64-encoded string. TODO: Full page screenshots, and multiple output formats ++To normalise rect given |rect|: + +Note: This ensures that the resulting rect has positive [=width dimension=] and +[=height dimension=]. + +1. Let |x| be |rect|'s [=x coordinate=]. + +1. Let |y| be |rect|'s [=y coordinate=]. + +1. Let |width| be |rect|'s [=width dimension=]. + +1. Let |height| be |rect|'s [=height dimension=]. + +1. If |width| is less than 0, set |x| to |x| + |width| and then set |width| to + -|width|. + +1. If |height| is less than 0, set |y| to |y| + |height| and then set |height| + to -|height|. + +1. Return a new {{DOMRectReadOnly}} with [=x coordinate=] |x|, [=y coordinate=] + |y|, [=width dimension=] |width| and [=height dimension=] |height|. + ++ ++To rectangle intersection given |rect1| and |rect2| + +1. Let |rect1| be [=normalise rect=] with |rect1|. + +1. Let |rect2| be [=normalise rect=] with |rect2|. + +1. Let |x1_0| be |rect1|'s [=x coordinate=]. + +1. Let |x2_0| be |rect2|'s [=x coordinate=]. + +1. Let |x1_1| be |rect1|'s [=x coordinate=] plus |rect1|'s [=width dimension=]. + +1. Let |x2_1| be |rect2|'s [=x coordinate=] plus |rect2|'s [=width dimension=]. + +1. Let |x_0| be the maximum element of «|x1_0|, |x2_0|». + +1. Let |x_1| be the minimum element of «|x1_1|, |x2_1|». + +1. Let |y1_0| be |rect1|'s [=y coordinate=]. + +1. Let |y2_0| be |rect2|'s [=y coordinate=]. + +1. Let |y1_1| be |rect1|'s [=y coordinate=] plus |rect1|'s [=height dimension=]. + +1. Let |y2_1| be |rect2|'s [=y coordinate=] plus |rect2|'s [=height dimension=]. + +1. Let |y_0| be the maximum element of «|y1_0|, |y2_0|». + +1. Let |y_1| be the minimum element of «|y1_1|, |y2_1|». + +1. If |x_1| is less than |x_0|, let |width| be 0. Otherwise let |width| be + |x_1| - |x_0|. + +1. If |y_1| is less than |y_0|, let |height| be 0. Otherwise let |height| be + |y_1| - |y_0|. + +1. Return a new {{DOMRectReadOnly}} with [=x coordinate=] |x_0|, [=y coordinate=] + |y_0|, [=width dimension=] |width| and [=height dimension=] |height|. + ++ ++To render viewport to a canvas given |viewport| and |rect|: + +1. Assert: |rect| is normalized and represents a non-empty sub-region of |viewport|, + i.e. all the following hold: + * |rect|'s [=x coordinate=] is greater than or equal to 0. + * |rect|'s [=width dimension=] is greater than 0. + * |rect|'s [=y coordinate=] is greater than or equal to 0. + * |rect|'s [=height dimension=] is greater than 0. + * |rect|'s [=x coordinate=] plus |rect|'s [=width dimension=] is less than + or equal to |viewport|'s width. + * |rect|'s [=y coordinate=] plus |rect|'s [=height dimension=] is less than + or equal to |viewport|'s height. + +1. Let |scale| be [=determine the device pixel ratio=] for the output device of |viewport|. + +1. Let |paint width| be |rect|'s [=width dimension=] multiplied by |scale|, + rounded to the nearest integer, so it matches the width of |rect| in device + pixels. + +1. Let |paint height| be |rect|'s [=height dimension=] multiplied by |scale|, + rounded to the nearest integer, so it matches the height of |rect| in device + pixels. + +1. Let |canvas| be a new {{HTMLCanvasElement}} with {{HTMLCanvasElement/width}} |paint + width| and {{HTMLCanvasElement/height}} |paint height|. + +1. Let |context| be the result of running the [=2D context creation algorithm=] + with |canvas| and null. + +1. Set |canvas|'s [=context mode=] to [=2D=]. + +1. Complete implementation specific steps equivalent to drawing the region of + the framebuffer representing the region of |viewport| covered by |rect| to + |context|, such that each pixel in the framebuffer corresponds to a pixel in + |context| with (|rect|'s [=x coordinate=], |rect|'s [=y coordinate=]) in + viewport coordinates corresponding to (0,0) in |context| and (|rect|'s + [=x coordinate=] + |rect|'s [=width dimension=], |rect|'s + [=y coordinate=] + |rect|'s [=height dimension=]) corresponding to (|paint + width|, |paint height|). + +1. Return [=canvas=]. + ++ The [=remote end steps=] with session and |command parameters| are: -1. Let |context id| be the value of thecontext
field of - |command parameters|. +1. Let |context id| be |command parameters|["context
"]. 1. Let |context| be the result of [=trying=] to [=get a browsing context=] with |context id|. @@ -2150,25 +2299,74 @@ The [=remote end steps=] with session and |command parameters| 1. Let |document| be |context|'s [=active document=]. +1. Let |viewport| be |document|'s [=visual viewport=]. + 1. Immediately after the next invocation of the [=run the animation frame callbacks=] algorithm for |document|: Issue: This ought to be integrated into the update rendering algorithm in some more explicit way. - 1. Let |root rect| be |document|’s [=document element=]'s [=rectangle=]. +1. Let |viewport rect| be a {{DOMRectReadOnly}} with [=x coordinate=] 0, [=y + coordinate=] 0, [=width dimension=] |viewport| width, and [=height + dimension=] |viewport| height. - 1. Let |canvas| be the result of [=trying=] to [=draw a bounding box from the - framebuffer=] with |root rect|. +1. Let |clip rect| be |viewport rect|. - 1. Let |encoding result| be the result of [=trying=] to [=encode a canvas as - Base64=] with |canvas|. +1. If |command parameters| contains "clip
": - 1. Let |body| be a [=/map=] matching the -browsingContext.CaptureScreenshotResult
production, with the -data
field set to |encoding result|. + 1. Let |clip| be |command parameters|["clip
"]. + + 1. Run the steps under the first matching condition: ++
+ +1. Let |rect| be the [=rectangle intersection=] of |viewport rect| and |clip rect|. + +1. If |rect|'s [=width dimension=] is 0 or |rect|'s [=height dimension=] is 0, + return [=error=] with error code [=unable to capture screen=]. + +1. Let |canvas| be [=render viewport to a canvas=] with |viewport| and |rect|. + +1. Let |encoding result| be the result of [=trying=] to [=encode a canvas as + Base64=] with |canvas|. + +1. Let |body| be a [=/map=] matching the +- |clip| matches the
browsingContext.ElementClipRectangle
+ production: +- + 1. Let |environment settings| be the [=environment settings object=] whose + [=relevant global object=]'s associated
Document
is + |document|. + + 1. Let |realm| be |environment settings|' [=realm execution context=]'s + Realm component. + + 1. Let |element| be the result of [=trying=] to [=deserialize remote reference=] + with |clip|["element
"], |realm|, and |session|. + + 1. If |element| doesn't implement {{Element}} return [=error=] with [=error code=] + [=no such element=]. + + 1. If |element|'s [=node document=] is not |document|, return [=error=] with + [=error code=] [=no such element=]. + + 1. If |clip| contains "scrollIntoView
" and + |clip|["scrollIntoView
"]: - 1. Return [=success=] with data |body|. + 1. [=Scroll into view=] with |element|. + + 1. Let |clip rect| be [=get the bounding box=] for |element|. + +- |clip| matches the
browsingContext.BoxClipRectangle
production: +- + 1. Let |clip rect| be a {{DOMRectReadOnly}} with x coordinate |clip|["
x
"], + y coordinate |clip|["y
"], width |clip|["width
"], + and height |clip|["height
"]. +browsingContext.CaptureScreenshotResult
production, with the +data
field set to |encoding result|. + +1. Return [=success=] with data |body|. #### The browsingContext.close Command #### {#command-browsingContext-close} @@ -2241,7 +2439,7 @@ The browsingContext.create command creates a new browsingContext.CreateParameters = { type: browsingContext.CreateType, - ?referenceContext: browsingContext.BrowsingContext + ? referenceContext: browsingContext.BrowsingContext } @@ -2328,8 +2526,8 @@ or all top-level contexts when no parent is provided. } browsingContext.GetTreeParameters = { - ?maxDepth: js-uint, - ?root: browsingContext.BrowsingContext, + ? maxDepth: js-uint, + ? root: browsingContext.BrowsingContext, } @@ -2457,7 +2655,7 @@ browsing context to the given URL. browsingContext.NavigateParameters = { context: browsingContext.BrowsingContext, url: text, - ?wait: browsingContext.ReadinessState, + ? wait: browsingContext.ReadinessState, } @@ -2524,25 +2722,25 @@ PDF document represented as a Base64-encoded string. browsingContext.PrintParameters = { context: browsingContext.BrowsingContext, - ?background: bool .default false, - ?margin: browsingContext.PrintMarginParameters, - ?orientation: ("portrait" / "landscape") .default "portrait", - ?page: browsingContext.PrintPageParameters, - ?pageRanges: [*(js-uint / text)], - ?scale: 0.1..2.0 .default 1.0, - ?shrinkToFit: bool .default true, + ? background: bool .default false, + ? margin: browsingContext.PrintMarginParameters, + ? orientation: ("portrait" / "landscape") .default "portrait", + ? page: browsingContext.PrintPageParameters, + ? pageRanges: [*(js-uint / text)], + ? scale: (0.1..2.0) .default 1.0, + ? shrinkToFit: bool .default true, } browsingContext.PrintMarginParameters = { - ?bottom: (float .ge 0.0) .default 1.0, - ?left: (float .ge 0.0) .default 1.0, - ?right: (float .ge 0.0) .default 1.0, - ?top: (float .ge 0.0) .default 1.0, + ? bottom: (float .ge 0.0) .default 1.0, + ? left: (float .ge 0.0) .default 1.0, + ? right: (float .ge 0.0) .default 1.0, + ? top: (float .ge 0.0) .default 1.0, } browsingContext.PrintPageParameters = { - ?height: (float .ge 0.0) .default 27.94, - ?width: (float .ge 0.0) .default 21.59, + ? height: (float .ge 0.0) .default 27.94, + ? width: (float .ge 0.0) .default 21.59, } @@ -2666,8 +2864,8 @@ browsing context. browsingContext.ReloadParameters = { context: browsingContext.BrowsingContext, - ?ignoreCache: bool, - ?wait: browsingContext.ReadinessState, + ? ignoreCache: bool, + ? wait: browsingContext.ReadinessState, } @@ -2710,6 +2908,62 @@ The [=remote end steps=] with |command parameters| are:
+ browsingContext.SetViewport = { + method: "browsingContext.setViewport", + params: browsingContext.SetViewportParameters + }; + + browsingContext.SetViewportParameters = { + context: browsingContext.BrowsingContext, + viewport: browsingContext.Viewport / null, + } + + browsingContext.Viewport = { + width: js-uint, + height: js-uint, + } ++
+ EmptyResult ++
context
"] field.
+
+1. Let |context| be the result of [=trying=] to [=get a browsing context=] with |context id|.
+
+1. If |context| is not a [=top-level browsing context=], return [=error=] with [=error code=] [=invalid argument=].
+
+1. Let |viewport parameter| be the |command parameters|["viewport
"] field.
+
+1. If |viewport parameter| is not null:
+ 1. Let |width| be the |viewport parameter|["width
"]
+ 1. Let |height| be the |viewport parameter|["height
"]
+ 1. If the |width| or |height| is outside of the implementation-specific or runtime constraints, return an [=error=] with the [=error code=] [=unsupported operation=].
+ 1. Set the layout [[css2#viewport]] of the |context| to be |width| CSS pixels wide and |height| CSS pixels high.
+1. Else:
+ 1. Set the layout [[css2#viewport]] of |context| to the implementation-defined default layout viewport for |context|.
+1. Run the [[cssom-view-1#resizing-viewports]] steps.
+1. Return [=success=] with data null.
+
+-network.BaseParameters = { +network.BaseParameters = ( context: browsingContext.BrowsingContext / null, isBlocked: bool, navigation: browsingContext.Navigation / null, @@ -3374,7 +3628,7 @@ network.BaseParameters = { request: network.RequestData, timestamp: js-uint, ?intercepts: [*network.Intercept] -} +)The
network.BaseParameters
type is an abstract type representing
@@ -3715,10 +3969,10 @@ To serialize a header given |header|:
network.Initiator = { type: "parser" / "script" / "preflight" / "other", - ?columnNumber: js-uint, - ?lineNumber: js-uint, - ?stackTrace: script.StackTrace, - ?request: network.Request + ? columnNumber: js-uint, + ? lineNumber: js-uint, + ? stackTrace: script.StackTrace, + ? request: network.Request };@@ -4979,8 +5233,8 @@ script.ChannelValue = { script.ChannelProperties = { channel: script.Channel, - ?serializationOptions: script.SerializationOptions, - ?ownership: script.ResultOwnership, + ? serializationOptions: script.SerializationOptions, + ? ownership: script.ResultOwnership, } @@ -5143,7 +5397,7 @@ script.ObjectLocalValue = { script.RegExpValue = { pattern: text, - ?flags: text, + ? flags: text, } script.RegExpLocalValue = { @@ -5532,16 +5786,16 @@ script.RealmInfo = ( script.WorkletRealmInfo ) -script.BaseRealmInfo = { +script.BaseRealmInfo = ( realm: script.Realm, origin: text -} +) script.WindowRealmInfo = { script.BaseRealmInfo, type: "window", context: browsingContext.BrowsingContext, - ?sandbox: text + ? sandbox: text } script.DedicatedWorkerRealmInfo = { @@ -5724,7 +5978,7 @@ script.RemoteReference = ( script.SharedReference = { sharedId: script.SharedId - ?handle: script.Handle, + ? handle: script.Handle, Extensible } @@ -5732,7 +5986,7 @@ script.RemoteObjectReference = { handle: script.Handle, - ?sharedId: script.SharedId + ? sharedId: script.SharedId Extensible } @@ -5857,148 +6111,151 @@ script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]] script.SymbolRemoteValue = { type: "symbol", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.ArrayRemoteValue = { type: "array", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.ListRemoteValue, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.ListRemoteValue, } script.ObjectRemoteValue = { type: "object", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.MappingRemoteValue, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.MappingRemoteValue, } script.FunctionRemoteValue = { type: "function", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.RegExpRemoteValue = { - script.RegExpLocalValue, - ?handle: script.Handle, - ?internalId: script.InternalId, -} + ? handle: script.Handle, + ? internalId: script.InternalId, +} .and script.RegExpLocalValue script.DateRemoteValue = { - script.DateLocalValue, - ?handle: script.Handle, - ?internalId: script.InternalId, -} + ? handle: script.Handle, + ? internalId: script.InternalId, +} .and script.DateLocalValue script.MapRemoteValue = { type: "map", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.MappingRemoteValue, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.MappingRemoteValue, } script.SetRemoteValue = { type: "set", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.ListRemoteValue + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.ListRemoteValue } script.WeakMapRemoteValue = { type: "weakmap", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.WeakSetRemoteValue = { type: "weakset", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.IteratorRemoteValue = { type: "iterator", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.GeneratorRemoteValue = { type: "generator", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.ErrorRemoteValue = { type: "error", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.ProxyRemoteValue = { type: "proxy", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.PromiseRemoteValue = { type: "promise", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.TypedArrayRemoteValue = { type: "typedarray", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.ArrayBufferRemoteValue = { type: "arraybuffer", - ?handle: script.Handle, - ?internalId: script.InternalId, + ? handle: script.Handle, + ? internalId: script.InternalId, } script.NodeListRemoteValue = { type: "nodelist", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.ListRemoteValue, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.ListRemoteValue, } script.HTMLCollectionRemoteValue = { type: "htmlcollection", - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.ListRemoteValue, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.ListRemoteValue, } script.NodeRemoteValue = { type: "node", - ?sharedId: script.SharedId, - ?handle: script.Handle, - ?internalId: script.InternalId, - ?value: script.NodeProperties, + ? sharedId: script.SharedId, + ? handle: script.Handle, + ? internalId: script.InternalId, + ? value: script.NodeProperties, } script.NodeProperties = { nodeType: js-uint, childNodeCount: js-uint, - ?attributes: {*text => text}, - ?children: [*script.NodeRemoteValue], - ?localName: text, - ?mode: "open" / "closed", - ?namespaceURI: text, - ?nodeValue: text, - ?shadowRoot: script.NodeRemoteValue / null, + ? attributes: {*text => text}, + ? children: [*script.NodeRemoteValue], + ? localName: text, + ? mode: "open" / "closed", + ? namespaceURI: text, + ? nodeValue: text, + ? shadowRoot: script.NodeRemoteValue / null, } script.WindowProxyRemoteValue = { type: "window", - ?handle: script.Handle, - ?internalId: script.InternalId, + value: script.WindowProxyProperties, + ? handle: script.Handle, + ? internalId: script.InternalId +} + +script.WindowProxyProperties = { + context: browsingContext.BrowsingContext } @@ -6066,13 +6323,13 @@ To get the handle for an object given |realm|, |ownership type| and
script.RegExpValue
production in the
+ 1. Let |serialized| be a [=/map=] matching the script.RegExpValue
production in the
[=local end definition=], with the pattern
property set to the
|pattern| and the the flags
property set to the |flags|.
1. Let |remote value| be a [=/map=] matching the script.RegExpRemoteValue
production in the [=local end definition=], with the handle
property set to |handle id| if it's not null, or omitted otherwise, and
- the value
property set to |value|.
+ the value
property set to |serialized|.
script.NodeRemoteValue
production in the [=local end definition=], with the sharedId
@@ -6353,9 +6609,22 @@ an |ownership type|, a |serialization internal map|, a |realm| and a |session|:
|serialized|.
script.WindowProxyRemoteValue
- production in the [=local end definition=], with the handle
- property set to |handle id| if it's not null, or omitted otherwise.
+ script.WindowProxyProperties
production in the [=local end
+ definition=] with the context
property set to |context id|.
+
+ 1. Let |remote value| be a [=/map=] matching the script.WindowProxyRemoteValue
+ production in the [=local end definition=], with the handle
+ property set to |handle id| if it's not null, or omitted otherwise, and
+ the value
property set to |serialized|.
script.ObjectRemoteValue
@@ -6399,9 +6668,6 @@ an |ownership type|, a |serialization internal map|, a |realm| and a |session|:
Issue: |children| and child nodes are different things. Either childNodeCount
should
reference to childNodes
, or it should be renamed to childrenCount
.
-Issue: nodeValue
can be null. Omit the field in such a case, or adjust type to allow
-null value.
-
script.SerializationOptions = { - ?maxDomDepth: (js-uint / null) .default 0, - ?maxObjectDepth: (js-uint / null) .default null, - ?includeShadowTree: ("none" / "open" / "all") .default "none", + ? maxDomDepth: (js-uint / null) .default 0, + ? maxObjectDepth: (js-uint / null) .default null, + ? includeShadowTree: ("none" / "open" / "all") .default "none", }@@ -6652,7 +6918,7 @@ Record=] of type
throw
, |exception|, is given by:
script.Source = ( realm: script.Realm, - ?context: browsingContext.BrowsingContext + ? context: browsingContext.BrowsingContext );@@ -6698,7 +6964,7 @@ script.RealmTarget = { script.ContextTarget = { context: browsingContext.BrowsingContext, - ?sandbox: text + ? sandbox: text } script.Target = ( @@ -6767,8 +7033,8 @@ script=]. script.AddPreloadScriptParameters = { functionDeclaration: text, - ?arguments: [*script.ChannelValue], - ?sandbox: text + ? arguments: [*script.ChannelValue], + ? sandbox: text } @@ -6823,7 +7089,7 @@ other handles or strong ECMAScript references. } script.DisownParameters = { - handles: [script.Handle] + handles: [*script.Handle] target: script.Target; } @@ -6877,10 +7143,10 @@ Note: In case of an arrow function in
functionDeclaration
, the
functionDeclaration: text,
awaitPromise: bool,
target: script.Target,
- ?arguments: [*script.ArgumentValue],
- ?resultOwnership: script.ResultOwnership,
- ?serializationOptions: script.SerializationOptions,
- ?this: script.ArgumentValue,
+ ? arguments: [*script.ArgumentValue],
+ ? resultOwnership: script.ResultOwnership,
+ ? serializationOptions: script.SerializationOptions,
+ ? this: script.ArgumentValue,
}
script.ArgumentValue = (
@@ -7065,8 +7331,8 @@ the promise is returned.
expression: text,
target: script.Target,
awaitPromise: bool,
- ?resultOwnership: script.ResultOwnership,
- ?serializationOptions: script.SerializationOptions,
+ ? resultOwnership: script.ResultOwnership,
+ ? serializationOptions: script.SerializationOptions,
}
@@ -7164,8 +7430,8 @@ realm associated with the [=document=] currently loaded in a specified
}
script.GetRealmsParameters = {
- ?context: browsingContext.BrowsingContext,
- ?type: script.RealmType,
+ ? context: browsingContext.BrowsingContext,
+ ? type: script.RealmType,
}
@@ -7521,7 +7787,7 @@ related to logging.
A [=BiDi Session=] has a log event buffer which is a [=/map=] from
[=browsing context id=] to a list of log events for that context that have not
been emitted. User agents may impose a maximum size on this buffer, subject to
-the condition that if events A and B happen in the same context with A occuring
+the condition that if events A and B happen in the same context with A occurring
before B, and both are added to the buffer, the entry for B must not be removed
before the entry for A.
@@ -7587,13 +7853,13 @@ log.Entry = (
log.JavascriptLogEntry
)
-log.BaseLogEntry = {
+log.BaseLogEntry = (
level: log.Level,
source: script.Source,
text: text / null,
timestamp: js-uint,
- ?stackTrace: script.StackTrace,
-}
+ ? stackTrace: script.StackTrace,
+)
log.GenericLogEntry = {
log.BaseLogEntry,
@@ -7913,7 +8179,7 @@ specified sequence of user input actions.
input.PointerType = "mouse" / "pen" / "touch"
input.PointerParameters = {
- ?pointerType: input.PointerType .default "mouse"
+ ? pointerType: input.PointerType .default "mouse"
}
input.PointerSourceAction = (
@@ -7985,7 +8251,7 @@ specified sequence of user input actions.
? height: js-uint .default 1,
? pressure: float .default 0.0,
? tangentialPressure: float .default 0.0,
- ? twist: 0..359 .default 0,
+ ? twist: (0..359) .default 0,
(input.TiltProperties // input.AngleProperties)
)
@@ -7995,8 +8261,8 @@ specified sequence of user input actions.
)
input.TiltProperties = (
- ? tiltX: -90..90 .default 0,
- ? tiltY: -90..90 .default 0,
+ ? tiltX: (-90..90) .default 0,
+ ? tiltY: (-90..90) .default 0,
)
input.Origin = "viewport" / "pointer" / input.ElementOrigin
diff --git a/proposals/bootstrap-scripts.md b/proposals/bootstrap-scripts.md
index a98cbe4b1..bdfe4ff43 100644
--- a/proposals/bootstrap-scripts.md
+++ b/proposals/bootstrap-scripts.md
@@ -22,7 +22,7 @@ The [bidirectional WebDriver protocol](./core.md) defines 3 types of script cont
The main purpose of a bootstrap script is to run before any other scripts in the same script context. To do anything with a script context, the WebDriver client normally needs to know its ID. The WebDriver client first learns of a context's ID through a scriptContextCreated event. However, due to the asynchronous nature of events, it is possible (and even likely) that this context will start running script before the WebDriver client has a chance to inject a bootstrap script. Therefore, the WebDriver client needs some way to register a bootstrap script to run in a script context before it even knows the script context's ID.
-A solution would be to not use IDs at all, but to use match patterns. Instead of the client stating "Run this bootstrap script on scriptContext #4" (which is impractical for the reason stated above), the client would say "Run this bootstrap script on all script contexts belonging to example.com" or "Run this bootstrap script for service workers runing example.com/sw.js". This is similar in principle to setting a conditional breakpoint. The client declares where they want the bootstrap script to run, and the browser will check every new script context to see if it matches the user's conditions. Here's what the API call to register a bootstrap script would look like:
+A solution would be to not use IDs at all, but to use match patterns. Instead of the client stating "Run this bootstrap script on scriptContext #4" (which is impractical for the reason stated above), the client would say "Run this bootstrap script on all script contexts belonging to example.com" or "Run this bootstrap script for service workers running example.com/sw.js". This is similar in principle to setting a conditional breakpoint. The client declares where they want the bootstrap script to run, and the browser will check every new script context to see if it matches the user's conditions. Here's what the API call to register a bootstrap script would look like:
```javascript
{
@@ -156,7 +156,7 @@ function myBootstrapScript(port) {
The browser would call the function, passing in a MessagePort object. This would scope the port variable so that it is only visible inside the function. Of course, the user could proceed to expose the port to the page somehow, but this would at least be an explicit choice by the user.
-Another option is to avoid running bootstraps scripts in the same context as page script, and run them in some kind of "isolated" context instead; Something similar to a WebExtension [content script](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#Content_script_environment), which has access to a clean version of the DOM, but has its own global scope. This would make it possible to expose the MessortPort (and possibly other priviledged APIs) to the bootstrap script as globals. However, this kind of functionality may not be available in all browsers and doesn't appear to be standardized outside of WebExtensions. This also makes it difficult for the bootstrap script to manipulate the page's view of the DOM, which could be a useful feature.
+Another option is to avoid running bootstraps scripts in the same context as page script, and run them in some kind of "isolated" context instead; Something similar to a WebExtension [content script](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#Content_script_environment), which has access to a clean version of the DOM, but has its own global scope. This would make it possible to expose the MessortPort (and possibly other privileged APIs) to the bootstrap script as globals. However, this kind of functionality may not be available in all browsers and doesn't appear to be standardized outside of WebExtensions. This also makes it difficult for the bootstrap script to manipulate the page's view of the DOM, which could be a useful feature.
## Examples
@@ -164,7 +164,7 @@ Below are some end-to-end WebDriver example using bootstrap scripts with messagi
### Record navigation performance
-This example creates a PerformanceObserver before a page starts loading, and uses the message port to continuosly send performance entries to the WebDriver client as they happen.
+This example creates a PerformanceObserver before a page starts loading, and uses the message port to continuously send performance entries to the WebDriver client as they happen.
```javascript
// Bootstrap strip that observes navigation performance entries and forwards them to the client.
@@ -251,7 +251,7 @@ try {
### Intercept console.log calls
-This example wraps the page's console.log method with a custom method that sends the arguments up to the client and then forwards to the original console.log method. Note that this is not a complete solution for adding logging to bidi WebDriver since it covers only console.log calls from JS and ignores other sources of console messages. Logging deserves its own set of new WebDriver APIs. However, this example is useful to illustrate how bootstap scripts empower users to add at least some of this functionality to WebDriver themselves.
+This example wraps the page's console.log method with a custom method that sends the arguments up to the client and then forwards to the original console.log method. Note that this is not a complete solution for adding logging to bidi WebDriver since it covers only console.log calls from JS and ignores other sources of console messages. Logging deserves its own set of new WebDriver APIs. However, this example is useful to illustrate how bootstrap scripts empower users to add at least some of this functionality to WebDriver themselves.
```javascript
function bootstrapFunc(port) {
@@ -260,7 +260,7 @@ function bootstrapFunc(port) {
console.log = function customLog(...args) {
// Notify client. Args are serialized as JSON.
port.postMessage({ msg: "consoleLog", args: args });
- // Pass-thru to real console.log method.
+ // Pass-through to real console.log method.
originalLog(...args);
}
diff --git a/proposals/openrpc.json b/proposals/openrpc.json
index b1e91fb15..bd303fa69 100644
--- a/proposals/openrpc.json
+++ b/proposals/openrpc.json
@@ -1651,4 +1651,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/scripts/cddl/utils.js b/scripts/cddl/utils.js
index 68c9b21ea..f1effb967 100644
--- a/scripts/cddl/utils.js
+++ b/scripts/cddl/utils.js
@@ -11,13 +11,13 @@
* @param {Array