Commit e5a9e6d 1 parent 9c107ad commit e5a9e6d Copy full SHA for e5a9e6d
File tree 9 files changed +257
-116
lines changed
9 files changed +257
-116
lines changed Original file line number Diff line number Diff line change 1
1
The MIT License (MIT)
2
2
3
- Copyright (c) 2016-2018 Kenneth Shaw
3
+ Copyright (c) 2016-2024 Kenneth Shaw
4
4
5
5
Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
of this software and associated documentation files (the "Software"), to deal
Original file line number Diff line number Diff line change 30
30
// - add Error() method to `Runtime.ExceptionDetails` so that it can be used
31
31
// as error.
32
32
// - change `Network.Headers` type to map[string]interface{}.
33
+ // - add special unmarshaler to `Network.CookiePartitionKey` type to handle
34
+ // different versions.
33
35
//
34
36
// Please note that the above is not an exhaustive list of all modifications
35
37
// applied to the domains, however it does attempt to give a comprehensive
@@ -253,6 +255,12 @@ const ModifierCommand Modifier = ModifierMeta
253
255
}
254
256
}
255
257
}
258
+
259
+ // add unmarshaler for CookiePartitionKey type
260
+ if t .Name == "CookiePartitionKey" {
261
+ t .Extra += gotpl .ExtraCookiePartitionKeyUnmarshaler (snaker .ForceCamelIdentifier (t .Name ))
262
+ t .SwapEasyJSONUnmarshaler = true
263
+ }
256
264
}
257
265
258
266
case "Page" :
Original file line number Diff line number Diff line change @@ -354,6 +354,35 @@ func (t *{%s= typ %}) UnmarshalJSON(buf []byte) error {
354
354
}
355
355
{% endfunc %}
356
356
357
+
358
+ // ExtraCookiePartitionKeyUnmarshaler is a template that handles unmarshaling
359
+ // Network.CookiePartitionKey.
360
+ {% func ExtraCookiePartitionKeyUnmarshaler(typ string) %}
361
+ // UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
362
+ func (t *{%s= typ %}) UnmarshalEasyJSONZZ(in *jlexer.Lexer) {
363
+ buf := in.Raw()
364
+ if l := len(buf); l > 2 && buf[0] == '"' && buf[l-1] == '"' {
365
+ var err error
366
+ if t.TopLevelSite, err = strconv.Unquote(string(buf)); err != nil {
367
+ in.AddError(err)
368
+ }
369
+ return
370
+ }
371
+ dec := json.NewDecoder(bytes.NewReader(buf))
372
+ dec.DisallowUnknownFields()
373
+ var v struct{
374
+ TopLevelSite string `json:"topLevelSite"`
375
+ HasCrossSiteAncestor bool `json:"hasCrossSiteAncestor"`
376
+ }
377
+ if err := dec.Decode(&v); err != nil {
378
+ in.AddError(err)
379
+ } else {
380
+ t.TopLevelSite, t.HasCrossSiteAncestor = v.TopLevelSite, v.HasCrossSiteAncestor
381
+ }
382
+ }
383
+ {% endfunc %}
384
+
385
+
357
386
// ExtraExecutorTemplate is the additional shared executor interface for all
358
387
// the domains.
359
388
{% func ExtraExecutorTemplate() %}
You can’t perform that action at this time.
0 commit comments