Skip to content

Commit cc5e4c8

Browse files
committed
Sync model with WebDriver BiDi spec
1 parent 4f86670 commit cc5e4c8

18 files changed

+1271
-740
lines changed

cddl/all.cddl

Lines changed: 168 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ ErrorCode = "invalid argument" /
8181
"invalid web extension" /
8282
"move target out of bounds" /
8383
"no such alert" /
84+
"no such network collector" /
8485
"no such element" /
8586
"no such frame" /
8687
"no such handle" /
8788
"no such history entry" /
8889
"no such intercept" /
90+
"no such network data" /
8991
"no such node" /
9092
"no such request" /
9193
"no such script" /
@@ -97,6 +99,7 @@ ErrorCode = "invalid argument" /
9799
"unable to close browser" /
98100
"unable to set cookie" /
99101
"unable to set file input" /
102+
"unavailable network data" /
100103
"underspecified storage partition" /
101104
"unknown command" /
102105
"unknown error" /
@@ -151,7 +154,6 @@ session.DirectProxyConfiguration = (
151154

152155
session.ManualProxyConfiguration = (
153156
proxyType: "manual",
154-
? ftpProxy: text,
155157
? httpProxy: text,
156158
? sslProxy: text,
157159
? session.SocksProxyConfiguration,
@@ -300,9 +302,15 @@ browser.Close = (
300302

301303
browser.CreateUserContext = (
302304
method: "browser.createUserContext",
303-
params: EmptyParams,
305+
params: browser.CreateUserContextParameters,
304306
)
305307

308+
browser.CreateUserContextParameters = {
309+
? acceptInsecureCerts: bool,
310+
? proxy: session.ProxyConfiguration,
311+
? unhandledPromptBehavior: session.UserPromptHandler
312+
}
313+
306314
browser.CreateUserContextResult = browser.UserContextInfo
307315

308316
browser.GetClientWindows = (
@@ -383,6 +391,7 @@ BrowsingContextEvent = (
383391
browsingContext.ContextCreated //
384392
browsingContext.ContextDestroyed //
385393
browsingContext.DomContentLoaded //
394+
browsingContext.DownloadEnd //
386395
browsingContext.DownloadWillBegin //
387396
browsingContext.FragmentNavigated //
388397
browsingContext.HistoryUpdated //
@@ -703,6 +712,7 @@ browsingContext.HistoryUpdated = (
703712

704713
browsingContext.HistoryUpdatedParameters = {
705714
context: browsingContext.BrowsingContext,
715+
timestamp: js-uint,
706716
url: text
707717
}
708718

@@ -726,6 +736,29 @@ browsingContext.DownloadWillBeginParams = {
726736
browsingContext.BaseNavigationInfo
727737
}
728738

739+
browsingContext.DownloadEnd = (
740+
method: "browsingContext.downloadEnd",
741+
params: browsingContext.DownloadEndParams
742+
)
743+
744+
browsingContext.DownloadEndParams = {
745+
(
746+
browsingContext.DownloadCanceledParams //
747+
browsingContext.DownloadCompleteParams
748+
)
749+
}
750+
751+
browsingContext.DownloadCanceledParams = (
752+
status: "canceled",
753+
browsingContext.BaseNavigationInfo
754+
)
755+
756+
browsingContext.DownloadCompleteParams = (
757+
status: "complete",
758+
filepath: text / null,
759+
browsingContext.BaseNavigationInfo
760+
)
761+
729762
browsingContext.NavigationAborted = (
730763
method: "browsingContext.navigationAborted",
731764
params: browsingContext.NavigationInfo
@@ -767,7 +800,10 @@ browsingContext.UserPromptOpenedParameters = {
767800
}
768801

769802
EmulationCommand = (
770-
emulation.SetGeolocationOverride
803+
emulation.SetGeolocationOverride //
804+
emulation.SetLocaleOverride //
805+
emulation.SetScreenOrientationOverride //
806+
emulation.SetTimezoneOverride
771807
)
772808

773809
emulation.SetGeolocationOverride = (
@@ -776,29 +812,81 @@ emulation.SetGeolocationOverride = (
776812
)
777813

778814
emulation.SetGeolocationOverrideParameters = {
779-
coordinates: emulation.GeolocationCoordinates / null,
815+
(
816+
(coordinates: emulation.GeolocationCoordinates / null) //
817+
(error: emulation.GeolocationPositionError)
818+
),
780819
? contexts: [+browsingContext.BrowsingContext],
781820
? userContexts: [+browser.UserContext],
782821
}
783822

784823
emulation.GeolocationCoordinates = {
785-
latitude: float,
786-
longitude: float,
787-
? accuracy: float .default 1.0,
824+
latitude: -90.0..90.0,
825+
longitude: -180.0..180.0,
826+
? accuracy: (float .ge 0.0) .default 1.0,
788827
? altitude: float / null .default null,
789-
? altitudeAccuracy: float / null .default null,
790-
? heading: float / null .default null,
791-
? speed: float / null .default null,
828+
? altitudeAccuracy: (float .ge 0.0) / null .default null,
829+
? heading: (0.0...360.0) / null .default null,
830+
? speed: (float .ge 0.0) / null .default null,
831+
}
832+
833+
emulation.GeolocationPositionError = {
834+
type: "positionUnavailable"
835+
}
836+
837+
emulation.SetLocaleOverride = (
838+
method: "emulation.setLocaleOverride",
839+
params: emulation.SetLocaleOverrideParameters
840+
)
841+
842+
emulation.SetLocaleOverrideParameters = {
843+
locale: text / null,
844+
? contexts: [+browsingContext.BrowsingContext],
845+
? userContexts: [+browser.UserContext],
846+
}
847+
848+
emulation.SetScreenOrientationOverride = (
849+
method: "emulation.setScreenOrientationOverride",
850+
params: emulation.SetScreenOrientationOverrideParameters
851+
)
852+
853+
emulation.ScreenOrientationNatural = "portrait" / "landscape"
854+
emulation.ScreenOrientationType = "portrait-primary" / "portrait-secondary" / "landscape-primary" / "landscape-secondary"
855+
856+
emulation.ScreenOrientation = {
857+
natural: emulation.ScreenOrientationNatural,
858+
type: emulation.ScreenOrientationType
859+
}
860+
861+
emulation.SetScreenOrientationOverrideParameters = {
862+
screenOrientation: emulation.ScreenOrientation / null,
863+
? contexts: [+browsingContext.BrowsingContext],
864+
? userContexts: [+browser.UserContext],
865+
}
866+
867+
emulation.SetTimezoneOverride = (
868+
method: "emulation.setTimezoneOverride",
869+
params: emulation.SetTimezoneOverrideParameters
870+
)
871+
872+
emulation.SetTimezoneOverrideParameters = {
873+
timezone: text / null,
874+
? contexts: [+browsingContext.BrowsingContext],
875+
? userContexts: [+browser.UserContext],
792876
}
793877

794878

795879
NetworkCommand = (
880+
network.AddDataCollector //
796881
network.AddIntercept //
797882
network.ContinueRequest //
798883
network.ContinueResponse //
799884
network.ContinueWithAuth //
885+
network.DisownData //
800886
network.FailRequest //
887+
network.GetData //
801888
network.ProvideResponse //
889+
network.RemoveDataCollector //
802890
network.RemoveIntercept //
803891
network.SetCacheBehavior
804892
)
@@ -851,8 +939,12 @@ network.Base64Value = {
851939
value: text,
852940
}
853941

942+
network.Collector = text
943+
944+
network.CollectorType = "blob"
945+
854946

855-
network.SameSite = "strict" / "lax" / "none"
947+
network.SameSite = "strict" / "lax" / "none" / "default"
856948

857949

858950
network.Cookie = {
@@ -873,6 +965,8 @@ network.CookieHeader = {
873965
value: network.BytesValue,
874966
}
875967

968+
network.DataType = "response"
969+
876970
network.FetchTimingInfo = {
877971
timeOrigin: float,
878972
requestTime: float,
@@ -974,6 +1068,23 @@ network.UrlPatternString = {
9741068
}
9751069

9761070

1071+
network.AddDataCollector = (
1072+
method: "network.addDataCollector",
1073+
params: network.AddDataCollectorParameters
1074+
)
1075+
1076+
network.AddDataCollectorParameters = {
1077+
dataTypes: [+network.DataType],
1078+
maxEncodedDataSize: js-uint,
1079+
? collectorType: network.CollectorType .default "blob",
1080+
? contexts: [+browsingContext.BrowsingContext],
1081+
? userContexts: [+browser.UserContext],
1082+
}
1083+
1084+
network.AddDataCollectorResult = {
1085+
collector: network.Collector
1086+
}
1087+
9771088
network.AddIntercept = (
9781089
method: "network.addIntercept",
9791090
params: network.AddInterceptParameters
@@ -1039,6 +1150,17 @@ network.ContinueWithAuthNoCredentials = (
10391150
action: "default" / "cancel"
10401151
)
10411152

1153+
network.DisownData = (
1154+
method: "network.disownData",
1155+
params: network.disownDataParameters
1156+
)
1157+
1158+
network.disownDataParameters = {
1159+
dataType: network.DataType,
1160+
collector: network.Collector,
1161+
request: network.Request,
1162+
}
1163+
10421164
network.FailRequest = (
10431165
method: "network.failRequest",
10441166
params: network.FailRequestParameters
@@ -1048,6 +1170,22 @@ network.FailRequestParameters = {
10481170
request: network.Request,
10491171
}
10501172

1173+
network.GetData = (
1174+
method: "network.getData",
1175+
params: network.GetDataParameters
1176+
)
1177+
1178+
network.GetDataParameters = {
1179+
dataType: network.DataType,
1180+
? collector: network.Collector,
1181+
? disown: bool .default false,
1182+
request: network.Request,
1183+
}
1184+
1185+
network.GetDataResult = {
1186+
bytes: network.BytesValue,
1187+
}
1188+
10511189
network.ProvideResponse = (
10521190
method: "network.provideResponse",
10531191
params: network.ProvideResponseParameters
@@ -1062,6 +1200,15 @@ network.ProvideResponseParameters = {
10621200
?statusCode: js-uint,
10631201
}
10641202

1203+
network.RemoveDataCollector = (
1204+
method: "network.removeDataCollector",
1205+
params: network.RemoveDataCollectorParameters
1206+
)
1207+
1208+
network.RemoveDataCollectorParameters = {
1209+
collector: network.Collector
1210+
}
1211+
10651212
network.RemoveIntercept = (
10661213
method: "network.removeIntercept",
10671214
params: network.RemoveInterceptParameters
@@ -1199,10 +1346,10 @@ script.LocalValue = (
11991346
script.PrimitiveProtocolValue /
12001347
script.ChannelValue /
12011348
script.ArrayLocalValue /
1202-
script.DateLocalValue /
1349+
{ script.DateLocalValue } /
12031350
script.MapLocalValue /
12041351
script.ObjectLocalValue /
1205-
script.RegExpLocalValue /
1352+
{ script.RegExpLocalValue } /
12061353
script.SetLocalValue
12071354
)
12081355

@@ -1213,10 +1360,10 @@ script.ArrayLocalValue = {
12131360
value: script.ListLocalValue,
12141361
}
12151362

1216-
script.DateLocalValue = {
1363+
script.DateLocalValue = (
12171364
type: "date",
12181365
value: text
1219-
}
1366+
)
12201367

12211368
script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];
12221369

@@ -1235,10 +1382,10 @@ script.RegExpValue = {
12351382
? flags: text,
12361383
}
12371384

1238-
script.RegExpLocalValue = {
1385+
script.RegExpLocalValue = (
12391386
type: "regexp",
12401387
value: script.RegExpValue,
1241-
}
1388+
)
12421389

12431390
script.SetLocalValue = {
12441391
type: "set",
@@ -1426,14 +1573,16 @@ script.FunctionRemoteValue = {
14261573
}
14271574

14281575
script.RegExpRemoteValue = {
1576+
script.RegExpLocalValue,
14291577
? handle: script.Handle,
14301578
? internalId: script.InternalId,
1431-
} .and script.RegExpLocalValue
1579+
}
14321580

14331581
script.DateRemoteValue = {
1582+
script.DateLocalValue,
14341583
? handle: script.Handle,
14351584
? internalId: script.InternalId,
1436-
} .and script.DateLocalValue
1585+
}
14371586

14381587
script.MapRemoteValue = {
14391588
type: "map",

0 commit comments

Comments
 (0)