mithwire 0.50.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
mithwire/cdp/audits.py ADDED
@@ -0,0 +1,1995 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: Audits (experimental)
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import dom
15
+ from . import network
16
+ from . import page
17
+ from . import runtime
18
+
19
+
20
+ @dataclass
21
+ class AffectedCookie:
22
+ '''
23
+ Information about a cookie that is affected by an inspector issue.
24
+ '''
25
+ #: The following three properties uniquely identify a cookie
26
+ name: str
27
+
28
+ path: str
29
+
30
+ domain: str
31
+
32
+ def to_json(self) -> T_JSON_DICT:
33
+ json: T_JSON_DICT = dict()
34
+ json['name'] = self.name
35
+ json['path'] = self.path
36
+ json['domain'] = self.domain
37
+ return json
38
+
39
+ @classmethod
40
+ def from_json(cls, json: T_JSON_DICT) -> AffectedCookie:
41
+ return cls(
42
+ name=str(json['name']),
43
+ path=str(json['path']),
44
+ domain=str(json['domain']),
45
+ )
46
+
47
+
48
+ @dataclass
49
+ class AffectedRequest:
50
+ '''
51
+ Information about a request that is affected by an inspector issue.
52
+ '''
53
+ url: str
54
+
55
+ #: The unique request id.
56
+ request_id: typing.Optional[network.RequestId] = None
57
+
58
+ def to_json(self) -> T_JSON_DICT:
59
+ json: T_JSON_DICT = dict()
60
+ json['url'] = self.url
61
+ if self.request_id is not None:
62
+ json['requestId'] = self.request_id.to_json()
63
+ return json
64
+
65
+ @classmethod
66
+ def from_json(cls, json: T_JSON_DICT) -> AffectedRequest:
67
+ return cls(
68
+ url=str(json['url']),
69
+ request_id=network.RequestId.from_json(json['requestId']) if json.get('requestId', None) is not None else None,
70
+ )
71
+
72
+
73
+ @dataclass
74
+ class AffectedFrame:
75
+ '''
76
+ Information about the frame affected by an inspector issue.
77
+ '''
78
+ frame_id: page.FrameId
79
+
80
+ def to_json(self) -> T_JSON_DICT:
81
+ json: T_JSON_DICT = dict()
82
+ json['frameId'] = self.frame_id.to_json()
83
+ return json
84
+
85
+ @classmethod
86
+ def from_json(cls, json: T_JSON_DICT) -> AffectedFrame:
87
+ return cls(
88
+ frame_id=page.FrameId.from_json(json['frameId']),
89
+ )
90
+
91
+
92
+ class CookieExclusionReason(enum.Enum):
93
+ EXCLUDE_SAME_SITE_UNSPECIFIED_TREATED_AS_LAX = "ExcludeSameSiteUnspecifiedTreatedAsLax"
94
+ EXCLUDE_SAME_SITE_NONE_INSECURE = "ExcludeSameSiteNoneInsecure"
95
+ EXCLUDE_SAME_SITE_LAX = "ExcludeSameSiteLax"
96
+ EXCLUDE_SAME_SITE_STRICT = "ExcludeSameSiteStrict"
97
+ EXCLUDE_DOMAIN_NON_ASCII = "ExcludeDomainNonASCII"
98
+ EXCLUDE_THIRD_PARTY_COOKIE_BLOCKED_IN_FIRST_PARTY_SET = "ExcludeThirdPartyCookieBlockedInFirstPartySet"
99
+ EXCLUDE_THIRD_PARTY_PHASEOUT = "ExcludeThirdPartyPhaseout"
100
+ EXCLUDE_PORT_MISMATCH = "ExcludePortMismatch"
101
+ EXCLUDE_SCHEME_MISMATCH = "ExcludeSchemeMismatch"
102
+
103
+ def to_json(self) -> str:
104
+ return self.value
105
+
106
+ @classmethod
107
+ def from_json(cls, json: str) -> CookieExclusionReason:
108
+ return cls(json)
109
+
110
+
111
+ class CookieWarningReason(enum.Enum):
112
+ WARN_SAME_SITE_UNSPECIFIED_CROSS_SITE_CONTEXT = "WarnSameSiteUnspecifiedCrossSiteContext"
113
+ WARN_SAME_SITE_NONE_INSECURE = "WarnSameSiteNoneInsecure"
114
+ WARN_SAME_SITE_UNSPECIFIED_LAX_ALLOW_UNSAFE = "WarnSameSiteUnspecifiedLaxAllowUnsafe"
115
+ WARN_SAME_SITE_STRICT_LAX_DOWNGRADE_STRICT = "WarnSameSiteStrictLaxDowngradeStrict"
116
+ WARN_SAME_SITE_STRICT_CROSS_DOWNGRADE_STRICT = "WarnSameSiteStrictCrossDowngradeStrict"
117
+ WARN_SAME_SITE_STRICT_CROSS_DOWNGRADE_LAX = "WarnSameSiteStrictCrossDowngradeLax"
118
+ WARN_SAME_SITE_LAX_CROSS_DOWNGRADE_STRICT = "WarnSameSiteLaxCrossDowngradeStrict"
119
+ WARN_SAME_SITE_LAX_CROSS_DOWNGRADE_LAX = "WarnSameSiteLaxCrossDowngradeLax"
120
+ WARN_ATTRIBUTE_VALUE_EXCEEDS_MAX_SIZE = "WarnAttributeValueExceedsMaxSize"
121
+ WARN_DOMAIN_NON_ASCII = "WarnDomainNonASCII"
122
+ WARN_THIRD_PARTY_PHASEOUT = "WarnThirdPartyPhaseout"
123
+ WARN_CROSS_SITE_REDIRECT_DOWNGRADE_CHANGES_INCLUSION = "WarnCrossSiteRedirectDowngradeChangesInclusion"
124
+ WARN_DEPRECATION_TRIAL_METADATA = "WarnDeprecationTrialMetadata"
125
+ WARN_THIRD_PARTY_COOKIE_HEURISTIC = "WarnThirdPartyCookieHeuristic"
126
+
127
+ def to_json(self) -> str:
128
+ return self.value
129
+
130
+ @classmethod
131
+ def from_json(cls, json: str) -> CookieWarningReason:
132
+ return cls(json)
133
+
134
+
135
+ class CookieOperation(enum.Enum):
136
+ SET_COOKIE = "SetCookie"
137
+ READ_COOKIE = "ReadCookie"
138
+
139
+ def to_json(self) -> str:
140
+ return self.value
141
+
142
+ @classmethod
143
+ def from_json(cls, json: str) -> CookieOperation:
144
+ return cls(json)
145
+
146
+
147
+ class InsightType(enum.Enum):
148
+ '''
149
+ Represents the category of insight that a cookie issue falls under.
150
+ '''
151
+ GIT_HUB_RESOURCE = "GitHubResource"
152
+ GRACE_PERIOD = "GracePeriod"
153
+ HEURISTICS = "Heuristics"
154
+
155
+ def to_json(self) -> str:
156
+ return self.value
157
+
158
+ @classmethod
159
+ def from_json(cls, json: str) -> InsightType:
160
+ return cls(json)
161
+
162
+
163
+ @dataclass
164
+ class CookieIssueInsight:
165
+ '''
166
+ Information about the suggested solution to a cookie issue.
167
+ '''
168
+ type_: InsightType
169
+
170
+ #: Link to table entry in third-party cookie migration readiness list.
171
+ table_entry_url: typing.Optional[str] = None
172
+
173
+ def to_json(self) -> T_JSON_DICT:
174
+ json: T_JSON_DICT = dict()
175
+ json['type'] = self.type_.to_json()
176
+ if self.table_entry_url is not None:
177
+ json['tableEntryUrl'] = self.table_entry_url
178
+ return json
179
+
180
+ @classmethod
181
+ def from_json(cls, json: T_JSON_DICT) -> CookieIssueInsight:
182
+ return cls(
183
+ type_=InsightType.from_json(json['type']),
184
+ table_entry_url=str(json['tableEntryUrl']) if json.get('tableEntryUrl', None) is not None else None,
185
+ )
186
+
187
+
188
+ @dataclass
189
+ class CookieIssueDetails:
190
+ '''
191
+ This information is currently necessary, as the front-end has a difficult
192
+ time finding a specific cookie. With this, we can convey specific error
193
+ information without the cookie.
194
+ '''
195
+ cookie_warning_reasons: typing.List[CookieWarningReason]
196
+
197
+ cookie_exclusion_reasons: typing.List[CookieExclusionReason]
198
+
199
+ #: Optionally identifies the site-for-cookies and the cookie url, which
200
+ #: may be used by the front-end as additional context.
201
+ operation: CookieOperation
202
+
203
+ #: If AffectedCookie is not set then rawCookieLine contains the raw
204
+ #: Set-Cookie header string. This hints at a problem where the
205
+ #: cookie line is syntactically or semantically malformed in a way
206
+ #: that no valid cookie could be created.
207
+ cookie: typing.Optional[AffectedCookie] = None
208
+
209
+ raw_cookie_line: typing.Optional[str] = None
210
+
211
+ site_for_cookies: typing.Optional[str] = None
212
+
213
+ cookie_url: typing.Optional[str] = None
214
+
215
+ request: typing.Optional[AffectedRequest] = None
216
+
217
+ #: The recommended solution to the issue.
218
+ insight: typing.Optional[CookieIssueInsight] = None
219
+
220
+ def to_json(self) -> T_JSON_DICT:
221
+ json: T_JSON_DICT = dict()
222
+ json['cookieWarningReasons'] = [i.to_json() for i in self.cookie_warning_reasons]
223
+ json['cookieExclusionReasons'] = [i.to_json() for i in self.cookie_exclusion_reasons]
224
+ json['operation'] = self.operation.to_json()
225
+ if self.cookie is not None:
226
+ json['cookie'] = self.cookie.to_json()
227
+ if self.raw_cookie_line is not None:
228
+ json['rawCookieLine'] = self.raw_cookie_line
229
+ if self.site_for_cookies is not None:
230
+ json['siteForCookies'] = self.site_for_cookies
231
+ if self.cookie_url is not None:
232
+ json['cookieUrl'] = self.cookie_url
233
+ if self.request is not None:
234
+ json['request'] = self.request.to_json()
235
+ if self.insight is not None:
236
+ json['insight'] = self.insight.to_json()
237
+ return json
238
+
239
+ @classmethod
240
+ def from_json(cls, json: T_JSON_DICT) -> CookieIssueDetails:
241
+ return cls(
242
+ cookie_warning_reasons=[CookieWarningReason.from_json(i) for i in json['cookieWarningReasons']],
243
+ cookie_exclusion_reasons=[CookieExclusionReason.from_json(i) for i in json['cookieExclusionReasons']],
244
+ operation=CookieOperation.from_json(json['operation']),
245
+ cookie=AffectedCookie.from_json(json['cookie']) if json.get('cookie', None) is not None else None,
246
+ raw_cookie_line=str(json['rawCookieLine']) if json.get('rawCookieLine', None) is not None else None,
247
+ site_for_cookies=str(json['siteForCookies']) if json.get('siteForCookies', None) is not None else None,
248
+ cookie_url=str(json['cookieUrl']) if json.get('cookieUrl', None) is not None else None,
249
+ request=AffectedRequest.from_json(json['request']) if json.get('request', None) is not None else None,
250
+ insight=CookieIssueInsight.from_json(json['insight']) if json.get('insight', None) is not None else None,
251
+ )
252
+
253
+
254
+ class PerformanceIssueType(enum.Enum):
255
+ DOCUMENT_COOKIE = "DocumentCookie"
256
+
257
+ def to_json(self) -> str:
258
+ return self.value
259
+
260
+ @classmethod
261
+ def from_json(cls, json: str) -> PerformanceIssueType:
262
+ return cls(json)
263
+
264
+
265
+ @dataclass
266
+ class PerformanceIssueDetails:
267
+ '''
268
+ Details for a performance issue.
269
+ '''
270
+ performance_issue_type: PerformanceIssueType
271
+
272
+ source_code_location: typing.Optional[SourceCodeLocation] = None
273
+
274
+ def to_json(self) -> T_JSON_DICT:
275
+ json: T_JSON_DICT = dict()
276
+ json['performanceIssueType'] = self.performance_issue_type.to_json()
277
+ if self.source_code_location is not None:
278
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
279
+ return json
280
+
281
+ @classmethod
282
+ def from_json(cls, json: T_JSON_DICT) -> PerformanceIssueDetails:
283
+ return cls(
284
+ performance_issue_type=PerformanceIssueType.from_json(json['performanceIssueType']),
285
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']) if json.get('sourceCodeLocation', None) is not None else None,
286
+ )
287
+
288
+
289
+ class MixedContentResolutionStatus(enum.Enum):
290
+ MIXED_CONTENT_BLOCKED = "MixedContentBlocked"
291
+ MIXED_CONTENT_AUTOMATICALLY_UPGRADED = "MixedContentAutomaticallyUpgraded"
292
+ MIXED_CONTENT_WARNING = "MixedContentWarning"
293
+
294
+ def to_json(self) -> str:
295
+ return self.value
296
+
297
+ @classmethod
298
+ def from_json(cls, json: str) -> MixedContentResolutionStatus:
299
+ return cls(json)
300
+
301
+
302
+ class MixedContentResourceType(enum.Enum):
303
+ ATTRIBUTION_SRC = "AttributionSrc"
304
+ AUDIO = "Audio"
305
+ BEACON = "Beacon"
306
+ CSP_REPORT = "CSPReport"
307
+ DOWNLOAD = "Download"
308
+ EVENT_SOURCE = "EventSource"
309
+ FAVICON = "Favicon"
310
+ FONT = "Font"
311
+ FORM = "Form"
312
+ FRAME = "Frame"
313
+ IMAGE = "Image"
314
+ IMPORT = "Import"
315
+ JSON = "JSON"
316
+ MANIFEST = "Manifest"
317
+ PING = "Ping"
318
+ PLUGIN_DATA = "PluginData"
319
+ PLUGIN_RESOURCE = "PluginResource"
320
+ PREFETCH = "Prefetch"
321
+ RESOURCE = "Resource"
322
+ SCRIPT = "Script"
323
+ SERVICE_WORKER = "ServiceWorker"
324
+ SHARED_WORKER = "SharedWorker"
325
+ SPECULATION_RULES = "SpeculationRules"
326
+ STYLESHEET = "Stylesheet"
327
+ TRACK = "Track"
328
+ VIDEO = "Video"
329
+ WORKER = "Worker"
330
+ XML_HTTP_REQUEST = "XMLHttpRequest"
331
+ XSLT = "XSLT"
332
+
333
+ def to_json(self) -> str:
334
+ return self.value
335
+
336
+ @classmethod
337
+ def from_json(cls, json: str) -> MixedContentResourceType:
338
+ return cls(json)
339
+
340
+
341
+ @dataclass
342
+ class MixedContentIssueDetails:
343
+ #: The way the mixed content issue is being resolved.
344
+ resolution_status: MixedContentResolutionStatus
345
+
346
+ #: The unsafe http url causing the mixed content issue.
347
+ insecure_url: str
348
+
349
+ #: The url responsible for the call to an unsafe url.
350
+ main_resource_url: str
351
+
352
+ #: The type of resource causing the mixed content issue (css, js, iframe,
353
+ #: form,...). Marked as optional because it is mapped to from
354
+ #: blink::mojom::RequestContextType, which will be replaced
355
+ #: by network::mojom::RequestDestination
356
+ resource_type: typing.Optional[MixedContentResourceType] = None
357
+
358
+ #: The mixed content request.
359
+ #: Does not always exist (e.g. for unsafe form submission urls).
360
+ request: typing.Optional[AffectedRequest] = None
361
+
362
+ #: Optional because not every mixed content issue is necessarily linked to a frame.
363
+ frame: typing.Optional[AffectedFrame] = None
364
+
365
+ def to_json(self) -> T_JSON_DICT:
366
+ json: T_JSON_DICT = dict()
367
+ json['resolutionStatus'] = self.resolution_status.to_json()
368
+ json['insecureURL'] = self.insecure_url
369
+ json['mainResourceURL'] = self.main_resource_url
370
+ if self.resource_type is not None:
371
+ json['resourceType'] = self.resource_type.to_json()
372
+ if self.request is not None:
373
+ json['request'] = self.request.to_json()
374
+ if self.frame is not None:
375
+ json['frame'] = self.frame.to_json()
376
+ return json
377
+
378
+ @classmethod
379
+ def from_json(cls, json: T_JSON_DICT) -> MixedContentIssueDetails:
380
+ return cls(
381
+ resolution_status=MixedContentResolutionStatus.from_json(json['resolutionStatus']),
382
+ insecure_url=str(json['insecureURL']),
383
+ main_resource_url=str(json['mainResourceURL']),
384
+ resource_type=MixedContentResourceType.from_json(json['resourceType']) if json.get('resourceType', None) is not None else None,
385
+ request=AffectedRequest.from_json(json['request']) if json.get('request', None) is not None else None,
386
+ frame=AffectedFrame.from_json(json['frame']) if json.get('frame', None) is not None else None,
387
+ )
388
+
389
+
390
+ class BlockedByResponseReason(enum.Enum):
391
+ '''
392
+ Enum indicating the reason a response has been blocked. These reasons are
393
+ refinements of the net error BLOCKED_BY_RESPONSE.
394
+ '''
395
+ COEP_FRAME_RESOURCE_NEEDS_COEP_HEADER = "CoepFrameResourceNeedsCoepHeader"
396
+ COOP_SANDBOXED_I_FRAME_CANNOT_NAVIGATE_TO_COOP_PAGE = "CoopSandboxedIFrameCannotNavigateToCoopPage"
397
+ CORP_NOT_SAME_ORIGIN = "CorpNotSameOrigin"
398
+ CORP_NOT_SAME_ORIGIN_AFTER_DEFAULTED_TO_SAME_ORIGIN_BY_COEP = "CorpNotSameOriginAfterDefaultedToSameOriginByCoep"
399
+ CORP_NOT_SAME_ORIGIN_AFTER_DEFAULTED_TO_SAME_ORIGIN_BY_DIP = "CorpNotSameOriginAfterDefaultedToSameOriginByDip"
400
+ CORP_NOT_SAME_ORIGIN_AFTER_DEFAULTED_TO_SAME_ORIGIN_BY_COEP_AND_DIP = "CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip"
401
+ CORP_NOT_SAME_SITE = "CorpNotSameSite"
402
+ SRI_MESSAGE_SIGNATURE_MISMATCH = "SRIMessageSignatureMismatch"
403
+
404
+ def to_json(self) -> str:
405
+ return self.value
406
+
407
+ @classmethod
408
+ def from_json(cls, json: str) -> BlockedByResponseReason:
409
+ return cls(json)
410
+
411
+
412
+ @dataclass
413
+ class BlockedByResponseIssueDetails:
414
+ '''
415
+ Details for a request that has been blocked with the BLOCKED_BY_RESPONSE
416
+ code. Currently only used for COEP/COOP, but may be extended to include
417
+ some CSP errors in the future.
418
+ '''
419
+ request: AffectedRequest
420
+
421
+ reason: BlockedByResponseReason
422
+
423
+ parent_frame: typing.Optional[AffectedFrame] = None
424
+
425
+ blocked_frame: typing.Optional[AffectedFrame] = None
426
+
427
+ def to_json(self) -> T_JSON_DICT:
428
+ json: T_JSON_DICT = dict()
429
+ json['request'] = self.request.to_json()
430
+ json['reason'] = self.reason.to_json()
431
+ if self.parent_frame is not None:
432
+ json['parentFrame'] = self.parent_frame.to_json()
433
+ if self.blocked_frame is not None:
434
+ json['blockedFrame'] = self.blocked_frame.to_json()
435
+ return json
436
+
437
+ @classmethod
438
+ def from_json(cls, json: T_JSON_DICT) -> BlockedByResponseIssueDetails:
439
+ return cls(
440
+ request=AffectedRequest.from_json(json['request']),
441
+ reason=BlockedByResponseReason.from_json(json['reason']),
442
+ parent_frame=AffectedFrame.from_json(json['parentFrame']) if json.get('parentFrame', None) is not None else None,
443
+ blocked_frame=AffectedFrame.from_json(json['blockedFrame']) if json.get('blockedFrame', None) is not None else None,
444
+ )
445
+
446
+
447
+ class HeavyAdResolutionStatus(enum.Enum):
448
+ HEAVY_AD_BLOCKED = "HeavyAdBlocked"
449
+ HEAVY_AD_WARNING = "HeavyAdWarning"
450
+
451
+ def to_json(self) -> str:
452
+ return self.value
453
+
454
+ @classmethod
455
+ def from_json(cls, json: str) -> HeavyAdResolutionStatus:
456
+ return cls(json)
457
+
458
+
459
+ class HeavyAdReason(enum.Enum):
460
+ NETWORK_TOTAL_LIMIT = "NetworkTotalLimit"
461
+ CPU_TOTAL_LIMIT = "CpuTotalLimit"
462
+ CPU_PEAK_LIMIT = "CpuPeakLimit"
463
+
464
+ def to_json(self) -> str:
465
+ return self.value
466
+
467
+ @classmethod
468
+ def from_json(cls, json: str) -> HeavyAdReason:
469
+ return cls(json)
470
+
471
+
472
+ @dataclass
473
+ class HeavyAdIssueDetails:
474
+ #: The resolution status, either blocking the content or warning.
475
+ resolution: HeavyAdResolutionStatus
476
+
477
+ #: The reason the ad was blocked, total network or cpu or peak cpu.
478
+ reason: HeavyAdReason
479
+
480
+ #: The frame that was blocked.
481
+ frame: AffectedFrame
482
+
483
+ def to_json(self) -> T_JSON_DICT:
484
+ json: T_JSON_DICT = dict()
485
+ json['resolution'] = self.resolution.to_json()
486
+ json['reason'] = self.reason.to_json()
487
+ json['frame'] = self.frame.to_json()
488
+ return json
489
+
490
+ @classmethod
491
+ def from_json(cls, json: T_JSON_DICT) -> HeavyAdIssueDetails:
492
+ return cls(
493
+ resolution=HeavyAdResolutionStatus.from_json(json['resolution']),
494
+ reason=HeavyAdReason.from_json(json['reason']),
495
+ frame=AffectedFrame.from_json(json['frame']),
496
+ )
497
+
498
+
499
+ class ContentSecurityPolicyViolationType(enum.Enum):
500
+ K_INLINE_VIOLATION = "kInlineViolation"
501
+ K_EVAL_VIOLATION = "kEvalViolation"
502
+ K_URL_VIOLATION = "kURLViolation"
503
+ K_SRI_VIOLATION = "kSRIViolation"
504
+ K_TRUSTED_TYPES_SINK_VIOLATION = "kTrustedTypesSinkViolation"
505
+ K_TRUSTED_TYPES_POLICY_VIOLATION = "kTrustedTypesPolicyViolation"
506
+ K_WASM_EVAL_VIOLATION = "kWasmEvalViolation"
507
+
508
+ def to_json(self) -> str:
509
+ return self.value
510
+
511
+ @classmethod
512
+ def from_json(cls, json: str) -> ContentSecurityPolicyViolationType:
513
+ return cls(json)
514
+
515
+
516
+ @dataclass
517
+ class SourceCodeLocation:
518
+ url: str
519
+
520
+ line_number: int
521
+
522
+ column_number: int
523
+
524
+ script_id: typing.Optional[runtime.ScriptId] = None
525
+
526
+ def to_json(self) -> T_JSON_DICT:
527
+ json: T_JSON_DICT = dict()
528
+ json['url'] = self.url
529
+ json['lineNumber'] = self.line_number
530
+ json['columnNumber'] = self.column_number
531
+ if self.script_id is not None:
532
+ json['scriptId'] = self.script_id.to_json()
533
+ return json
534
+
535
+ @classmethod
536
+ def from_json(cls, json: T_JSON_DICT) -> SourceCodeLocation:
537
+ return cls(
538
+ url=str(json['url']),
539
+ line_number=int(json['lineNumber']),
540
+ column_number=int(json['columnNumber']),
541
+ script_id=runtime.ScriptId.from_json(json['scriptId']) if json.get('scriptId', None) is not None else None,
542
+ )
543
+
544
+
545
+ @dataclass
546
+ class ContentSecurityPolicyIssueDetails:
547
+ #: Specific directive that is violated, causing the CSP issue.
548
+ violated_directive: str
549
+
550
+ is_report_only: bool
551
+
552
+ content_security_policy_violation_type: ContentSecurityPolicyViolationType
553
+
554
+ #: The url not included in allowed sources.
555
+ blocked_url: typing.Optional[str] = None
556
+
557
+ frame_ancestor: typing.Optional[AffectedFrame] = None
558
+
559
+ source_code_location: typing.Optional[SourceCodeLocation] = None
560
+
561
+ violating_node_id: typing.Optional[dom.BackendNodeId] = None
562
+
563
+ def to_json(self) -> T_JSON_DICT:
564
+ json: T_JSON_DICT = dict()
565
+ json['violatedDirective'] = self.violated_directive
566
+ json['isReportOnly'] = self.is_report_only
567
+ json['contentSecurityPolicyViolationType'] = self.content_security_policy_violation_type.to_json()
568
+ if self.blocked_url is not None:
569
+ json['blockedURL'] = self.blocked_url
570
+ if self.frame_ancestor is not None:
571
+ json['frameAncestor'] = self.frame_ancestor.to_json()
572
+ if self.source_code_location is not None:
573
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
574
+ if self.violating_node_id is not None:
575
+ json['violatingNodeId'] = self.violating_node_id.to_json()
576
+ return json
577
+
578
+ @classmethod
579
+ def from_json(cls, json: T_JSON_DICT) -> ContentSecurityPolicyIssueDetails:
580
+ return cls(
581
+ violated_directive=str(json['violatedDirective']),
582
+ is_report_only=bool(json['isReportOnly']),
583
+ content_security_policy_violation_type=ContentSecurityPolicyViolationType.from_json(json['contentSecurityPolicyViolationType']),
584
+ blocked_url=str(json['blockedURL']) if json.get('blockedURL', None) is not None else None,
585
+ frame_ancestor=AffectedFrame.from_json(json['frameAncestor']) if json.get('frameAncestor', None) is not None else None,
586
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']) if json.get('sourceCodeLocation', None) is not None else None,
587
+ violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']) if json.get('violatingNodeId', None) is not None else None,
588
+ )
589
+
590
+
591
+ class SharedArrayBufferIssueType(enum.Enum):
592
+ TRANSFER_ISSUE = "TransferIssue"
593
+ CREATION_ISSUE = "CreationIssue"
594
+
595
+ def to_json(self) -> str:
596
+ return self.value
597
+
598
+ @classmethod
599
+ def from_json(cls, json: str) -> SharedArrayBufferIssueType:
600
+ return cls(json)
601
+
602
+
603
+ @dataclass
604
+ class SharedArrayBufferIssueDetails:
605
+ '''
606
+ Details for a issue arising from an SAB being instantiated in, or
607
+ transferred to a context that is not cross-origin isolated.
608
+ '''
609
+ source_code_location: SourceCodeLocation
610
+
611
+ is_warning: bool
612
+
613
+ type_: SharedArrayBufferIssueType
614
+
615
+ def to_json(self) -> T_JSON_DICT:
616
+ json: T_JSON_DICT = dict()
617
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
618
+ json['isWarning'] = self.is_warning
619
+ json['type'] = self.type_.to_json()
620
+ return json
621
+
622
+ @classmethod
623
+ def from_json(cls, json: T_JSON_DICT) -> SharedArrayBufferIssueDetails:
624
+ return cls(
625
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']),
626
+ is_warning=bool(json['isWarning']),
627
+ type_=SharedArrayBufferIssueType.from_json(json['type']),
628
+ )
629
+
630
+
631
+ @dataclass
632
+ class CorsIssueDetails:
633
+ '''
634
+ Details for a CORS related issue, e.g. a warning or error related to
635
+ CORS RFC1918 enforcement.
636
+ '''
637
+ cors_error_status: network.CorsErrorStatus
638
+
639
+ is_warning: bool
640
+
641
+ request: AffectedRequest
642
+
643
+ location: typing.Optional[SourceCodeLocation] = None
644
+
645
+ initiator_origin: typing.Optional[str] = None
646
+
647
+ resource_ip_address_space: typing.Optional[network.IPAddressSpace] = None
648
+
649
+ client_security_state: typing.Optional[network.ClientSecurityState] = None
650
+
651
+ def to_json(self) -> T_JSON_DICT:
652
+ json: T_JSON_DICT = dict()
653
+ json['corsErrorStatus'] = self.cors_error_status.to_json()
654
+ json['isWarning'] = self.is_warning
655
+ json['request'] = self.request.to_json()
656
+ if self.location is not None:
657
+ json['location'] = self.location.to_json()
658
+ if self.initiator_origin is not None:
659
+ json['initiatorOrigin'] = self.initiator_origin
660
+ if self.resource_ip_address_space is not None:
661
+ json['resourceIPAddressSpace'] = self.resource_ip_address_space.to_json()
662
+ if self.client_security_state is not None:
663
+ json['clientSecurityState'] = self.client_security_state.to_json()
664
+ return json
665
+
666
+ @classmethod
667
+ def from_json(cls, json: T_JSON_DICT) -> CorsIssueDetails:
668
+ return cls(
669
+ cors_error_status=network.CorsErrorStatus.from_json(json['corsErrorStatus']),
670
+ is_warning=bool(json['isWarning']),
671
+ request=AffectedRequest.from_json(json['request']),
672
+ location=SourceCodeLocation.from_json(json['location']) if json.get('location', None) is not None else None,
673
+ initiator_origin=str(json['initiatorOrigin']) if json.get('initiatorOrigin', None) is not None else None,
674
+ resource_ip_address_space=network.IPAddressSpace.from_json(json['resourceIPAddressSpace']) if json.get('resourceIPAddressSpace', None) is not None else None,
675
+ client_security_state=network.ClientSecurityState.from_json(json['clientSecurityState']) if json.get('clientSecurityState', None) is not None else None,
676
+ )
677
+
678
+
679
+ class AttributionReportingIssueType(enum.Enum):
680
+ PERMISSION_POLICY_DISABLED = "PermissionPolicyDisabled"
681
+ UNTRUSTWORTHY_REPORTING_ORIGIN = "UntrustworthyReportingOrigin"
682
+ INSECURE_CONTEXT = "InsecureContext"
683
+ INVALID_HEADER = "InvalidHeader"
684
+ INVALID_REGISTER_TRIGGER_HEADER = "InvalidRegisterTriggerHeader"
685
+ SOURCE_AND_TRIGGER_HEADERS = "SourceAndTriggerHeaders"
686
+ SOURCE_IGNORED = "SourceIgnored"
687
+ TRIGGER_IGNORED = "TriggerIgnored"
688
+ OS_SOURCE_IGNORED = "OsSourceIgnored"
689
+ OS_TRIGGER_IGNORED = "OsTriggerIgnored"
690
+ INVALID_REGISTER_OS_SOURCE_HEADER = "InvalidRegisterOsSourceHeader"
691
+ INVALID_REGISTER_OS_TRIGGER_HEADER = "InvalidRegisterOsTriggerHeader"
692
+ WEB_AND_OS_HEADERS = "WebAndOsHeaders"
693
+ NO_WEB_OR_OS_SUPPORT = "NoWebOrOsSupport"
694
+ NAVIGATION_REGISTRATION_WITHOUT_TRANSIENT_USER_ACTIVATION = "NavigationRegistrationWithoutTransientUserActivation"
695
+ INVALID_INFO_HEADER = "InvalidInfoHeader"
696
+ NO_REGISTER_SOURCE_HEADER = "NoRegisterSourceHeader"
697
+ NO_REGISTER_TRIGGER_HEADER = "NoRegisterTriggerHeader"
698
+ NO_REGISTER_OS_SOURCE_HEADER = "NoRegisterOsSourceHeader"
699
+ NO_REGISTER_OS_TRIGGER_HEADER = "NoRegisterOsTriggerHeader"
700
+ NAVIGATION_REGISTRATION_UNIQUE_SCOPE_ALREADY_SET = "NavigationRegistrationUniqueScopeAlreadySet"
701
+
702
+ def to_json(self) -> str:
703
+ return self.value
704
+
705
+ @classmethod
706
+ def from_json(cls, json: str) -> AttributionReportingIssueType:
707
+ return cls(json)
708
+
709
+
710
+ class SharedDictionaryError(enum.Enum):
711
+ USE_ERROR_CROSS_ORIGIN_NO_CORS_REQUEST = "UseErrorCrossOriginNoCorsRequest"
712
+ USE_ERROR_DICTIONARY_LOAD_FAILURE = "UseErrorDictionaryLoadFailure"
713
+ USE_ERROR_MATCHING_DICTIONARY_NOT_USED = "UseErrorMatchingDictionaryNotUsed"
714
+ USE_ERROR_UNEXPECTED_CONTENT_DICTIONARY_HEADER = "UseErrorUnexpectedContentDictionaryHeader"
715
+ WRITE_ERROR_COSS_ORIGIN_NO_CORS_REQUEST = "WriteErrorCossOriginNoCorsRequest"
716
+ WRITE_ERROR_DISALLOWED_BY_SETTINGS = "WriteErrorDisallowedBySettings"
717
+ WRITE_ERROR_EXPIRED_RESPONSE = "WriteErrorExpiredResponse"
718
+ WRITE_ERROR_FEATURE_DISABLED = "WriteErrorFeatureDisabled"
719
+ WRITE_ERROR_INSUFFICIENT_RESOURCES = "WriteErrorInsufficientResources"
720
+ WRITE_ERROR_INVALID_MATCH_FIELD = "WriteErrorInvalidMatchField"
721
+ WRITE_ERROR_INVALID_STRUCTURED_HEADER = "WriteErrorInvalidStructuredHeader"
722
+ WRITE_ERROR_INVALID_TTL_FIELD = "WriteErrorInvalidTTLField"
723
+ WRITE_ERROR_NAVIGATION_REQUEST = "WriteErrorNavigationRequest"
724
+ WRITE_ERROR_NO_MATCH_FIELD = "WriteErrorNoMatchField"
725
+ WRITE_ERROR_NON_INTEGER_TTL_FIELD = "WriteErrorNonIntegerTTLField"
726
+ WRITE_ERROR_NON_LIST_MATCH_DEST_FIELD = "WriteErrorNonListMatchDestField"
727
+ WRITE_ERROR_NON_SECURE_CONTEXT = "WriteErrorNonSecureContext"
728
+ WRITE_ERROR_NON_STRING_ID_FIELD = "WriteErrorNonStringIdField"
729
+ WRITE_ERROR_NON_STRING_IN_MATCH_DEST_LIST = "WriteErrorNonStringInMatchDestList"
730
+ WRITE_ERROR_NON_STRING_MATCH_FIELD = "WriteErrorNonStringMatchField"
731
+ WRITE_ERROR_NON_TOKEN_TYPE_FIELD = "WriteErrorNonTokenTypeField"
732
+ WRITE_ERROR_REQUEST_ABORTED = "WriteErrorRequestAborted"
733
+ WRITE_ERROR_SHUTTING_DOWN = "WriteErrorShuttingDown"
734
+ WRITE_ERROR_TOO_LONG_ID_FIELD = "WriteErrorTooLongIdField"
735
+ WRITE_ERROR_UNSUPPORTED_TYPE = "WriteErrorUnsupportedType"
736
+
737
+ def to_json(self) -> str:
738
+ return self.value
739
+
740
+ @classmethod
741
+ def from_json(cls, json: str) -> SharedDictionaryError:
742
+ return cls(json)
743
+
744
+
745
+ class SRIMessageSignatureError(enum.Enum):
746
+ MISSING_SIGNATURE_HEADER = "MissingSignatureHeader"
747
+ MISSING_SIGNATURE_INPUT_HEADER = "MissingSignatureInputHeader"
748
+ INVALID_SIGNATURE_HEADER = "InvalidSignatureHeader"
749
+ INVALID_SIGNATURE_INPUT_HEADER = "InvalidSignatureInputHeader"
750
+ SIGNATURE_HEADER_VALUE_IS_NOT_BYTE_SEQUENCE = "SignatureHeaderValueIsNotByteSequence"
751
+ SIGNATURE_HEADER_VALUE_IS_PARAMETERIZED = "SignatureHeaderValueIsParameterized"
752
+ SIGNATURE_HEADER_VALUE_IS_INCORRECT_LENGTH = "SignatureHeaderValueIsIncorrectLength"
753
+ SIGNATURE_INPUT_HEADER_MISSING_LABEL = "SignatureInputHeaderMissingLabel"
754
+ SIGNATURE_INPUT_HEADER_VALUE_NOT_INNER_LIST = "SignatureInputHeaderValueNotInnerList"
755
+ SIGNATURE_INPUT_HEADER_VALUE_MISSING_COMPONENTS = "SignatureInputHeaderValueMissingComponents"
756
+ SIGNATURE_INPUT_HEADER_INVALID_COMPONENT_TYPE = "SignatureInputHeaderInvalidComponentType"
757
+ SIGNATURE_INPUT_HEADER_INVALID_COMPONENT_NAME = "SignatureInputHeaderInvalidComponentName"
758
+ SIGNATURE_INPUT_HEADER_INVALID_HEADER_COMPONENT_PARAMETER = "SignatureInputHeaderInvalidHeaderComponentParameter"
759
+ SIGNATURE_INPUT_HEADER_INVALID_DERIVED_COMPONENT_PARAMETER = "SignatureInputHeaderInvalidDerivedComponentParameter"
760
+ SIGNATURE_INPUT_HEADER_KEY_ID_LENGTH = "SignatureInputHeaderKeyIdLength"
761
+ SIGNATURE_INPUT_HEADER_INVALID_PARAMETER = "SignatureInputHeaderInvalidParameter"
762
+ SIGNATURE_INPUT_HEADER_MISSING_REQUIRED_PARAMETERS = "SignatureInputHeaderMissingRequiredParameters"
763
+ VALIDATION_FAILED_SIGNATURE_EXPIRED = "ValidationFailedSignatureExpired"
764
+ VALIDATION_FAILED_INVALID_LENGTH = "ValidationFailedInvalidLength"
765
+ VALIDATION_FAILED_SIGNATURE_MISMATCH = "ValidationFailedSignatureMismatch"
766
+ VALIDATION_FAILED_INTEGRITY_MISMATCH = "ValidationFailedIntegrityMismatch"
767
+
768
+ def to_json(self) -> str:
769
+ return self.value
770
+
771
+ @classmethod
772
+ def from_json(cls, json: str) -> SRIMessageSignatureError:
773
+ return cls(json)
774
+
775
+
776
+ class UnencodedDigestError(enum.Enum):
777
+ MALFORMED_DICTIONARY = "MalformedDictionary"
778
+ UNKNOWN_ALGORITHM = "UnknownAlgorithm"
779
+ INCORRECT_DIGEST_TYPE = "IncorrectDigestType"
780
+ INCORRECT_DIGEST_LENGTH = "IncorrectDigestLength"
781
+
782
+ def to_json(self) -> str:
783
+ return self.value
784
+
785
+ @classmethod
786
+ def from_json(cls, json: str) -> UnencodedDigestError:
787
+ return cls(json)
788
+
789
+
790
+ class ConnectionAllowlistError(enum.Enum):
791
+ INVALID_HEADER = "InvalidHeader"
792
+ MORE_THAN_ONE_LIST = "MoreThanOneList"
793
+ ITEM_NOT_INNER_LIST = "ItemNotInnerList"
794
+ INVALID_ALLOWLIST_ITEM_TYPE = "InvalidAllowlistItemType"
795
+ REPORTING_ENDPOINT_NOT_TOKEN = "ReportingEndpointNotToken"
796
+ INVALID_URL_PATTERN = "InvalidUrlPattern"
797
+
798
+ def to_json(self) -> str:
799
+ return self.value
800
+
801
+ @classmethod
802
+ def from_json(cls, json: str) -> ConnectionAllowlistError:
803
+ return cls(json)
804
+
805
+
806
+ @dataclass
807
+ class AttributionReportingIssueDetails:
808
+ '''
809
+ Details for issues around "Attribution Reporting API" usage.
810
+ Explainer: https://github.com/WICG/attribution-reporting-api
811
+ '''
812
+ violation_type: AttributionReportingIssueType
813
+
814
+ request: typing.Optional[AffectedRequest] = None
815
+
816
+ violating_node_id: typing.Optional[dom.BackendNodeId] = None
817
+
818
+ invalid_parameter: typing.Optional[str] = None
819
+
820
+ def to_json(self) -> T_JSON_DICT:
821
+ json: T_JSON_DICT = dict()
822
+ json['violationType'] = self.violation_type.to_json()
823
+ if self.request is not None:
824
+ json['request'] = self.request.to_json()
825
+ if self.violating_node_id is not None:
826
+ json['violatingNodeId'] = self.violating_node_id.to_json()
827
+ if self.invalid_parameter is not None:
828
+ json['invalidParameter'] = self.invalid_parameter
829
+ return json
830
+
831
+ @classmethod
832
+ def from_json(cls, json: T_JSON_DICT) -> AttributionReportingIssueDetails:
833
+ return cls(
834
+ violation_type=AttributionReportingIssueType.from_json(json['violationType']),
835
+ request=AffectedRequest.from_json(json['request']) if json.get('request', None) is not None else None,
836
+ violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']) if json.get('violatingNodeId', None) is not None else None,
837
+ invalid_parameter=str(json['invalidParameter']) if json.get('invalidParameter', None) is not None else None,
838
+ )
839
+
840
+
841
+ @dataclass
842
+ class QuirksModeIssueDetails:
843
+ '''
844
+ Details for issues about documents in Quirks Mode
845
+ or Limited Quirks Mode that affects page layouting.
846
+ '''
847
+ #: If false, it means the document's mode is "quirks"
848
+ #: instead of "limited-quirks".
849
+ is_limited_quirks_mode: bool
850
+
851
+ document_node_id: dom.BackendNodeId
852
+
853
+ url: str
854
+
855
+ frame_id: page.FrameId
856
+
857
+ loader_id: network.LoaderId
858
+
859
+ def to_json(self) -> T_JSON_DICT:
860
+ json: T_JSON_DICT = dict()
861
+ json['isLimitedQuirksMode'] = self.is_limited_quirks_mode
862
+ json['documentNodeId'] = self.document_node_id.to_json()
863
+ json['url'] = self.url
864
+ json['frameId'] = self.frame_id.to_json()
865
+ json['loaderId'] = self.loader_id.to_json()
866
+ return json
867
+
868
+ @classmethod
869
+ def from_json(cls, json: T_JSON_DICT) -> QuirksModeIssueDetails:
870
+ return cls(
871
+ is_limited_quirks_mode=bool(json['isLimitedQuirksMode']),
872
+ document_node_id=dom.BackendNodeId.from_json(json['documentNodeId']),
873
+ url=str(json['url']),
874
+ frame_id=page.FrameId.from_json(json['frameId']),
875
+ loader_id=network.LoaderId.from_json(json['loaderId']),
876
+ )
877
+
878
+
879
+ @dataclass
880
+ class NavigatorUserAgentIssueDetails:
881
+ url: str
882
+
883
+ location: typing.Optional[SourceCodeLocation] = None
884
+
885
+ def to_json(self) -> T_JSON_DICT:
886
+ json: T_JSON_DICT = dict()
887
+ json['url'] = self.url
888
+ if self.location is not None:
889
+ json['location'] = self.location.to_json()
890
+ return json
891
+
892
+ @classmethod
893
+ def from_json(cls, json: T_JSON_DICT) -> NavigatorUserAgentIssueDetails:
894
+ return cls(
895
+ url=str(json['url']),
896
+ location=SourceCodeLocation.from_json(json['location']) if json.get('location', None) is not None else None,
897
+ )
898
+
899
+
900
+ @dataclass
901
+ class SharedDictionaryIssueDetails:
902
+ shared_dictionary_error: SharedDictionaryError
903
+
904
+ request: AffectedRequest
905
+
906
+ def to_json(self) -> T_JSON_DICT:
907
+ json: T_JSON_DICT = dict()
908
+ json['sharedDictionaryError'] = self.shared_dictionary_error.to_json()
909
+ json['request'] = self.request.to_json()
910
+ return json
911
+
912
+ @classmethod
913
+ def from_json(cls, json: T_JSON_DICT) -> SharedDictionaryIssueDetails:
914
+ return cls(
915
+ shared_dictionary_error=SharedDictionaryError.from_json(json['sharedDictionaryError']),
916
+ request=AffectedRequest.from_json(json['request']),
917
+ )
918
+
919
+
920
+ @dataclass
921
+ class SRIMessageSignatureIssueDetails:
922
+ error: SRIMessageSignatureError
923
+
924
+ signature_base: str
925
+
926
+ integrity_assertions: typing.List[str]
927
+
928
+ request: AffectedRequest
929
+
930
+ def to_json(self) -> T_JSON_DICT:
931
+ json: T_JSON_DICT = dict()
932
+ json['error'] = self.error.to_json()
933
+ json['signatureBase'] = self.signature_base
934
+ json['integrityAssertions'] = [i for i in self.integrity_assertions]
935
+ json['request'] = self.request.to_json()
936
+ return json
937
+
938
+ @classmethod
939
+ def from_json(cls, json: T_JSON_DICT) -> SRIMessageSignatureIssueDetails:
940
+ return cls(
941
+ error=SRIMessageSignatureError.from_json(json['error']),
942
+ signature_base=str(json['signatureBase']),
943
+ integrity_assertions=[str(i) for i in json['integrityAssertions']],
944
+ request=AffectedRequest.from_json(json['request']),
945
+ )
946
+
947
+
948
+ @dataclass
949
+ class UnencodedDigestIssueDetails:
950
+ error: UnencodedDigestError
951
+
952
+ request: AffectedRequest
953
+
954
+ def to_json(self) -> T_JSON_DICT:
955
+ json: T_JSON_DICT = dict()
956
+ json['error'] = self.error.to_json()
957
+ json['request'] = self.request.to_json()
958
+ return json
959
+
960
+ @classmethod
961
+ def from_json(cls, json: T_JSON_DICT) -> UnencodedDigestIssueDetails:
962
+ return cls(
963
+ error=UnencodedDigestError.from_json(json['error']),
964
+ request=AffectedRequest.from_json(json['request']),
965
+ )
966
+
967
+
968
+ @dataclass
969
+ class ConnectionAllowlistIssueDetails:
970
+ error: ConnectionAllowlistError
971
+
972
+ request: AffectedRequest
973
+
974
+ def to_json(self) -> T_JSON_DICT:
975
+ json: T_JSON_DICT = dict()
976
+ json['error'] = self.error.to_json()
977
+ json['request'] = self.request.to_json()
978
+ return json
979
+
980
+ @classmethod
981
+ def from_json(cls, json: T_JSON_DICT) -> ConnectionAllowlistIssueDetails:
982
+ return cls(
983
+ error=ConnectionAllowlistError.from_json(json['error']),
984
+ request=AffectedRequest.from_json(json['request']),
985
+ )
986
+
987
+
988
+ class GenericIssueErrorType(enum.Enum):
989
+ FORM_LABEL_FOR_NAME_ERROR = "FormLabelForNameError"
990
+ FORM_DUPLICATE_ID_FOR_INPUT_ERROR = "FormDuplicateIdForInputError"
991
+ FORM_INPUT_WITH_NO_LABEL_ERROR = "FormInputWithNoLabelError"
992
+ FORM_AUTOCOMPLETE_ATTRIBUTE_EMPTY_ERROR = "FormAutocompleteAttributeEmptyError"
993
+ FORM_EMPTY_ID_AND_NAME_ATTRIBUTES_FOR_INPUT_ERROR = "FormEmptyIdAndNameAttributesForInputError"
994
+ FORM_ARIA_LABELLED_BY_TO_NON_EXISTING_ID_ERROR = "FormAriaLabelledByToNonExistingIdError"
995
+ FORM_INPUT_ASSIGNED_AUTOCOMPLETE_VALUE_TO_ID_OR_NAME_ATTRIBUTE_ERROR = "FormInputAssignedAutocompleteValueToIdOrNameAttributeError"
996
+ FORM_LABEL_HAS_NEITHER_FOR_NOR_NESTED_INPUT_ERROR = "FormLabelHasNeitherForNorNestedInputError"
997
+ FORM_LABEL_FOR_MATCHES_NON_EXISTING_ID_ERROR = "FormLabelForMatchesNonExistingIdError"
998
+ FORM_INPUT_HAS_WRONG_BUT_WELL_INTENDED_AUTOCOMPLETE_VALUE_ERROR = "FormInputHasWrongButWellIntendedAutocompleteValueError"
999
+ RESPONSE_WAS_BLOCKED_BY_ORB = "ResponseWasBlockedByORB"
1000
+ NAVIGATION_ENTRY_MARKED_SKIPPABLE = "NavigationEntryMarkedSkippable"
1001
+ BACK_UI_NAVIGATION_WOULD_SKIP_AD = "BackUINavigationWouldSkipAd"
1002
+ AUTOFILL_AND_MANUAL_TEXT_POLICY_CONTROLLED_FEATURES_INFO = "AutofillAndManualTextPolicyControlledFeaturesInfo"
1003
+ AUTOFILL_POLICY_CONTROLLED_FEATURE_INFO = "AutofillPolicyControlledFeatureInfo"
1004
+ MANUAL_TEXT_POLICY_CONTROLLED_FEATURE_INFO = "ManualTextPolicyControlledFeatureInfo"
1005
+ FORM_MODEL_CONTEXT_PARAMETER_MISSING_TITLE_AND_DESCRIPTION = "FormModelContextParameterMissingTitleAndDescription"
1006
+ FORM_MODEL_CONTEXT_MISSING_TOOL_NAME = "FormModelContextMissingToolName"
1007
+ FORM_MODEL_CONTEXT_MISSING_TOOL_DESCRIPTION = "FormModelContextMissingToolDescription"
1008
+ FORM_MODEL_CONTEXT_REQUIRED_PARAMETER_MISSING_NAME = "FormModelContextRequiredParameterMissingName"
1009
+ FORM_MODEL_CONTEXT_PARAMETER_MISSING_NAME = "FormModelContextParameterMissingName"
1010
+
1011
+ def to_json(self) -> str:
1012
+ return self.value
1013
+
1014
+ @classmethod
1015
+ def from_json(cls, json: str) -> GenericIssueErrorType:
1016
+ return cls(json)
1017
+
1018
+
1019
+ @dataclass
1020
+ class GenericIssueDetails:
1021
+ '''
1022
+ Depending on the concrete errorType, different properties are set.
1023
+ '''
1024
+ #: Issues with the same errorType are aggregated in the frontend.
1025
+ error_type: GenericIssueErrorType
1026
+
1027
+ frame_id: typing.Optional[page.FrameId] = None
1028
+
1029
+ violating_node_id: typing.Optional[dom.BackendNodeId] = None
1030
+
1031
+ violating_node_attribute: typing.Optional[str] = None
1032
+
1033
+ request: typing.Optional[AffectedRequest] = None
1034
+
1035
+ def to_json(self) -> T_JSON_DICT:
1036
+ json: T_JSON_DICT = dict()
1037
+ json['errorType'] = self.error_type.to_json()
1038
+ if self.frame_id is not None:
1039
+ json['frameId'] = self.frame_id.to_json()
1040
+ if self.violating_node_id is not None:
1041
+ json['violatingNodeId'] = self.violating_node_id.to_json()
1042
+ if self.violating_node_attribute is not None:
1043
+ json['violatingNodeAttribute'] = self.violating_node_attribute
1044
+ if self.request is not None:
1045
+ json['request'] = self.request.to_json()
1046
+ return json
1047
+
1048
+ @classmethod
1049
+ def from_json(cls, json: T_JSON_DICT) -> GenericIssueDetails:
1050
+ return cls(
1051
+ error_type=GenericIssueErrorType.from_json(json['errorType']),
1052
+ frame_id=page.FrameId.from_json(json['frameId']) if json.get('frameId', None) is not None else None,
1053
+ violating_node_id=dom.BackendNodeId.from_json(json['violatingNodeId']) if json.get('violatingNodeId', None) is not None else None,
1054
+ violating_node_attribute=str(json['violatingNodeAttribute']) if json.get('violatingNodeAttribute', None) is not None else None,
1055
+ request=AffectedRequest.from_json(json['request']) if json.get('request', None) is not None else None,
1056
+ )
1057
+
1058
+
1059
+ @dataclass
1060
+ class DeprecationIssueDetails:
1061
+ '''
1062
+ This issue tracks information needed to print a deprecation message.
1063
+ https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/third_party/blink/renderer/core/frame/deprecation/README.md
1064
+ '''
1065
+ source_code_location: SourceCodeLocation
1066
+
1067
+ #: One of the deprecation names from third_party/blink/renderer/core/frame/deprecation/deprecation.json5
1068
+ type_: str
1069
+
1070
+ affected_frame: typing.Optional[AffectedFrame] = None
1071
+
1072
+ def to_json(self) -> T_JSON_DICT:
1073
+ json: T_JSON_DICT = dict()
1074
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
1075
+ json['type'] = self.type_
1076
+ if self.affected_frame is not None:
1077
+ json['affectedFrame'] = self.affected_frame.to_json()
1078
+ return json
1079
+
1080
+ @classmethod
1081
+ def from_json(cls, json: T_JSON_DICT) -> DeprecationIssueDetails:
1082
+ return cls(
1083
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']),
1084
+ type_=str(json['type']),
1085
+ affected_frame=AffectedFrame.from_json(json['affectedFrame']) if json.get('affectedFrame', None) is not None else None,
1086
+ )
1087
+
1088
+
1089
+ @dataclass
1090
+ class BounceTrackingIssueDetails:
1091
+ '''
1092
+ This issue warns about sites in the redirect chain of a finished navigation
1093
+ that may be flagged as trackers and have their state cleared if they don't
1094
+ receive a user interaction. Note that in this context 'site' means eTLD+1.
1095
+ For example, if the URL ``https://example.test:80/bounce`` was in the
1096
+ redirect chain, the site reported would be ``example.test``.
1097
+ '''
1098
+ tracking_sites: typing.List[str]
1099
+
1100
+ def to_json(self) -> T_JSON_DICT:
1101
+ json: T_JSON_DICT = dict()
1102
+ json['trackingSites'] = [i for i in self.tracking_sites]
1103
+ return json
1104
+
1105
+ @classmethod
1106
+ def from_json(cls, json: T_JSON_DICT) -> BounceTrackingIssueDetails:
1107
+ return cls(
1108
+ tracking_sites=[str(i) for i in json['trackingSites']],
1109
+ )
1110
+
1111
+
1112
+ @dataclass
1113
+ class CookieDeprecationMetadataIssueDetails:
1114
+ '''
1115
+ This issue warns about third-party sites that are accessing cookies on the
1116
+ current page, and have been permitted due to having a global metadata grant.
1117
+ Note that in this context 'site' means eTLD+1. For example, if the URL
1118
+ ``https://example.test:80/web_page`` was accessing cookies, the site reported
1119
+ would be ``example.test``.
1120
+ '''
1121
+ allowed_sites: typing.List[str]
1122
+
1123
+ opt_out_percentage: float
1124
+
1125
+ is_opt_out_top_level: bool
1126
+
1127
+ operation: CookieOperation
1128
+
1129
+ def to_json(self) -> T_JSON_DICT:
1130
+ json: T_JSON_DICT = dict()
1131
+ json['allowedSites'] = [i for i in self.allowed_sites]
1132
+ json['optOutPercentage'] = self.opt_out_percentage
1133
+ json['isOptOutTopLevel'] = self.is_opt_out_top_level
1134
+ json['operation'] = self.operation.to_json()
1135
+ return json
1136
+
1137
+ @classmethod
1138
+ def from_json(cls, json: T_JSON_DICT) -> CookieDeprecationMetadataIssueDetails:
1139
+ return cls(
1140
+ allowed_sites=[str(i) for i in json['allowedSites']],
1141
+ opt_out_percentage=float(json['optOutPercentage']),
1142
+ is_opt_out_top_level=bool(json['isOptOutTopLevel']),
1143
+ operation=CookieOperation.from_json(json['operation']),
1144
+ )
1145
+
1146
+
1147
+ class ClientHintIssueReason(enum.Enum):
1148
+ META_TAG_ALLOW_LIST_INVALID_ORIGIN = "MetaTagAllowListInvalidOrigin"
1149
+ META_TAG_MODIFIED_HTML = "MetaTagModifiedHTML"
1150
+
1151
+ def to_json(self) -> str:
1152
+ return self.value
1153
+
1154
+ @classmethod
1155
+ def from_json(cls, json: str) -> ClientHintIssueReason:
1156
+ return cls(json)
1157
+
1158
+
1159
+ @dataclass
1160
+ class FederatedAuthRequestIssueDetails:
1161
+ federated_auth_request_issue_reason: FederatedAuthRequestIssueReason
1162
+
1163
+ def to_json(self) -> T_JSON_DICT:
1164
+ json: T_JSON_DICT = dict()
1165
+ json['federatedAuthRequestIssueReason'] = self.federated_auth_request_issue_reason.to_json()
1166
+ return json
1167
+
1168
+ @classmethod
1169
+ def from_json(cls, json: T_JSON_DICT) -> FederatedAuthRequestIssueDetails:
1170
+ return cls(
1171
+ federated_auth_request_issue_reason=FederatedAuthRequestIssueReason.from_json(json['federatedAuthRequestIssueReason']),
1172
+ )
1173
+
1174
+
1175
+ class FederatedAuthRequestIssueReason(enum.Enum):
1176
+ '''
1177
+ Represents the failure reason when a federated authentication reason fails.
1178
+ Should be updated alongside RequestIdTokenStatus in
1179
+ third_party/blink/public/mojom/devtools/inspector_issue.mojom to include
1180
+ all cases except for success.
1181
+ '''
1182
+ SHOULD_EMBARGO = "ShouldEmbargo"
1183
+ TOO_MANY_REQUESTS = "TooManyRequests"
1184
+ WELL_KNOWN_HTTP_NOT_FOUND = "WellKnownHttpNotFound"
1185
+ WELL_KNOWN_NO_RESPONSE = "WellKnownNoResponse"
1186
+ WELL_KNOWN_INVALID_RESPONSE = "WellKnownInvalidResponse"
1187
+ WELL_KNOWN_LIST_EMPTY = "WellKnownListEmpty"
1188
+ WELL_KNOWN_INVALID_CONTENT_TYPE = "WellKnownInvalidContentType"
1189
+ CONFIG_NOT_IN_WELL_KNOWN = "ConfigNotInWellKnown"
1190
+ WELL_KNOWN_TOO_BIG = "WellKnownTooBig"
1191
+ CONFIG_HTTP_NOT_FOUND = "ConfigHttpNotFound"
1192
+ CONFIG_NO_RESPONSE = "ConfigNoResponse"
1193
+ CONFIG_INVALID_RESPONSE = "ConfigInvalidResponse"
1194
+ CONFIG_INVALID_CONTENT_TYPE = "ConfigInvalidContentType"
1195
+ IDP_NOT_POTENTIALLY_TRUSTWORTHY = "IdpNotPotentiallyTrustworthy"
1196
+ DISABLED_IN_SETTINGS = "DisabledInSettings"
1197
+ DISABLED_IN_FLAGS = "DisabledInFlags"
1198
+ ERROR_FETCHING_SIGNIN = "ErrorFetchingSignin"
1199
+ INVALID_SIGNIN_RESPONSE = "InvalidSigninResponse"
1200
+ ACCOUNTS_HTTP_NOT_FOUND = "AccountsHttpNotFound"
1201
+ ACCOUNTS_NO_RESPONSE = "AccountsNoResponse"
1202
+ ACCOUNTS_INVALID_RESPONSE = "AccountsInvalidResponse"
1203
+ ACCOUNTS_LIST_EMPTY = "AccountsListEmpty"
1204
+ ACCOUNTS_INVALID_CONTENT_TYPE = "AccountsInvalidContentType"
1205
+ ID_TOKEN_HTTP_NOT_FOUND = "IdTokenHttpNotFound"
1206
+ ID_TOKEN_NO_RESPONSE = "IdTokenNoResponse"
1207
+ ID_TOKEN_INVALID_RESPONSE = "IdTokenInvalidResponse"
1208
+ ID_TOKEN_IDP_ERROR_RESPONSE = "IdTokenIdpErrorResponse"
1209
+ ID_TOKEN_CROSS_SITE_IDP_ERROR_RESPONSE = "IdTokenCrossSiteIdpErrorResponse"
1210
+ ID_TOKEN_INVALID_REQUEST = "IdTokenInvalidRequest"
1211
+ ID_TOKEN_INVALID_CONTENT_TYPE = "IdTokenInvalidContentType"
1212
+ ERROR_ID_TOKEN = "ErrorIdToken"
1213
+ CANCELED = "Canceled"
1214
+ RP_PAGE_NOT_VISIBLE = "RpPageNotVisible"
1215
+ SILENT_MEDIATION_FAILURE = "SilentMediationFailure"
1216
+ NOT_SIGNED_IN_WITH_IDP = "NotSignedInWithIdp"
1217
+ MISSING_TRANSIENT_USER_ACTIVATION = "MissingTransientUserActivation"
1218
+ REPLACED_BY_ACTIVE_MODE = "ReplacedByActiveMode"
1219
+ RELYING_PARTY_ORIGIN_IS_OPAQUE = "RelyingPartyOriginIsOpaque"
1220
+ TYPE_NOT_MATCHING = "TypeNotMatching"
1221
+ UI_DISMISSED_NO_EMBARGO = "UiDismissedNoEmbargo"
1222
+ CORS_ERROR = "CorsError"
1223
+ SUPPRESSED_BY_SEGMENTATION_PLATFORM = "SuppressedBySegmentationPlatform"
1224
+
1225
+ def to_json(self) -> str:
1226
+ return self.value
1227
+
1228
+ @classmethod
1229
+ def from_json(cls, json: str) -> FederatedAuthRequestIssueReason:
1230
+ return cls(json)
1231
+
1232
+
1233
+ @dataclass
1234
+ class FederatedAuthUserInfoRequestIssueDetails:
1235
+ federated_auth_user_info_request_issue_reason: FederatedAuthUserInfoRequestIssueReason
1236
+
1237
+ def to_json(self) -> T_JSON_DICT:
1238
+ json: T_JSON_DICT = dict()
1239
+ json['federatedAuthUserInfoRequestIssueReason'] = self.federated_auth_user_info_request_issue_reason.to_json()
1240
+ return json
1241
+
1242
+ @classmethod
1243
+ def from_json(cls, json: T_JSON_DICT) -> FederatedAuthUserInfoRequestIssueDetails:
1244
+ return cls(
1245
+ federated_auth_user_info_request_issue_reason=FederatedAuthUserInfoRequestIssueReason.from_json(json['federatedAuthUserInfoRequestIssueReason']),
1246
+ )
1247
+
1248
+
1249
+ class FederatedAuthUserInfoRequestIssueReason(enum.Enum):
1250
+ '''
1251
+ Represents the failure reason when a getUserInfo() call fails.
1252
+ Should be updated alongside FederatedAuthUserInfoRequestResult in
1253
+ third_party/blink/public/mojom/devtools/inspector_issue.mojom.
1254
+ '''
1255
+ NOT_SAME_ORIGIN = "NotSameOrigin"
1256
+ NOT_IFRAME = "NotIframe"
1257
+ NOT_POTENTIALLY_TRUSTWORTHY = "NotPotentiallyTrustworthy"
1258
+ NO_API_PERMISSION = "NoApiPermission"
1259
+ NOT_SIGNED_IN_WITH_IDP = "NotSignedInWithIdp"
1260
+ NO_ACCOUNT_SHARING_PERMISSION = "NoAccountSharingPermission"
1261
+ INVALID_CONFIG_OR_WELL_KNOWN = "InvalidConfigOrWellKnown"
1262
+ INVALID_ACCOUNTS_RESPONSE = "InvalidAccountsResponse"
1263
+ NO_RETURNING_USER_FROM_FETCHED_ACCOUNTS = "NoReturningUserFromFetchedAccounts"
1264
+
1265
+ def to_json(self) -> str:
1266
+ return self.value
1267
+
1268
+ @classmethod
1269
+ def from_json(cls, json: str) -> FederatedAuthUserInfoRequestIssueReason:
1270
+ return cls(json)
1271
+
1272
+
1273
+ @dataclass
1274
+ class ClientHintIssueDetails:
1275
+ '''
1276
+ This issue tracks client hints related issues. It's used to deprecate old
1277
+ features, encourage the use of new ones, and provide general guidance.
1278
+ '''
1279
+ source_code_location: SourceCodeLocation
1280
+
1281
+ client_hint_issue_reason: ClientHintIssueReason
1282
+
1283
+ def to_json(self) -> T_JSON_DICT:
1284
+ json: T_JSON_DICT = dict()
1285
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
1286
+ json['clientHintIssueReason'] = self.client_hint_issue_reason.to_json()
1287
+ return json
1288
+
1289
+ @classmethod
1290
+ def from_json(cls, json: T_JSON_DICT) -> ClientHintIssueDetails:
1291
+ return cls(
1292
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']),
1293
+ client_hint_issue_reason=ClientHintIssueReason.from_json(json['clientHintIssueReason']),
1294
+ )
1295
+
1296
+
1297
+ @dataclass
1298
+ class FailedRequestInfo:
1299
+ #: The URL that failed to load.
1300
+ url: str
1301
+
1302
+ #: The failure message for the failed request.
1303
+ failure_message: str
1304
+
1305
+ request_id: typing.Optional[network.RequestId] = None
1306
+
1307
+ def to_json(self) -> T_JSON_DICT:
1308
+ json: T_JSON_DICT = dict()
1309
+ json['url'] = self.url
1310
+ json['failureMessage'] = self.failure_message
1311
+ if self.request_id is not None:
1312
+ json['requestId'] = self.request_id.to_json()
1313
+ return json
1314
+
1315
+ @classmethod
1316
+ def from_json(cls, json: T_JSON_DICT) -> FailedRequestInfo:
1317
+ return cls(
1318
+ url=str(json['url']),
1319
+ failure_message=str(json['failureMessage']),
1320
+ request_id=network.RequestId.from_json(json['requestId']) if json.get('requestId', None) is not None else None,
1321
+ )
1322
+
1323
+
1324
+ class PartitioningBlobURLInfo(enum.Enum):
1325
+ BLOCKED_CROSS_PARTITION_FETCHING = "BlockedCrossPartitionFetching"
1326
+ ENFORCE_NOOPENER_FOR_NAVIGATION = "EnforceNoopenerForNavigation"
1327
+
1328
+ def to_json(self) -> str:
1329
+ return self.value
1330
+
1331
+ @classmethod
1332
+ def from_json(cls, json: str) -> PartitioningBlobURLInfo:
1333
+ return cls(json)
1334
+
1335
+
1336
+ @dataclass
1337
+ class PartitioningBlobURLIssueDetails:
1338
+ #: The BlobURL that failed to load.
1339
+ url: str
1340
+
1341
+ #: Additional information about the Partitioning Blob URL issue.
1342
+ partitioning_blob_url_info: PartitioningBlobURLInfo
1343
+
1344
+ def to_json(self) -> T_JSON_DICT:
1345
+ json: T_JSON_DICT = dict()
1346
+ json['url'] = self.url
1347
+ json['partitioningBlobURLInfo'] = self.partitioning_blob_url_info.to_json()
1348
+ return json
1349
+
1350
+ @classmethod
1351
+ def from_json(cls, json: T_JSON_DICT) -> PartitioningBlobURLIssueDetails:
1352
+ return cls(
1353
+ url=str(json['url']),
1354
+ partitioning_blob_url_info=PartitioningBlobURLInfo.from_json(json['partitioningBlobURLInfo']),
1355
+ )
1356
+
1357
+
1358
+ class ElementAccessibilityIssueReason(enum.Enum):
1359
+ DISALLOWED_SELECT_CHILD = "DisallowedSelectChild"
1360
+ DISALLOWED_OPT_GROUP_CHILD = "DisallowedOptGroupChild"
1361
+ NON_PHRASING_CONTENT_OPTION_CHILD = "NonPhrasingContentOptionChild"
1362
+ INTERACTIVE_CONTENT_OPTION_CHILD = "InteractiveContentOptionChild"
1363
+ INTERACTIVE_CONTENT_LEGEND_CHILD = "InteractiveContentLegendChild"
1364
+ INTERACTIVE_CONTENT_SUMMARY_DESCENDANT = "InteractiveContentSummaryDescendant"
1365
+
1366
+ def to_json(self) -> str:
1367
+ return self.value
1368
+
1369
+ @classmethod
1370
+ def from_json(cls, json: str) -> ElementAccessibilityIssueReason:
1371
+ return cls(json)
1372
+
1373
+
1374
+ @dataclass
1375
+ class ElementAccessibilityIssueDetails:
1376
+ '''
1377
+ This issue warns about errors in the select or summary element content model.
1378
+ '''
1379
+ node_id: dom.BackendNodeId
1380
+
1381
+ element_accessibility_issue_reason: ElementAccessibilityIssueReason
1382
+
1383
+ has_disallowed_attributes: bool
1384
+
1385
+ def to_json(self) -> T_JSON_DICT:
1386
+ json: T_JSON_DICT = dict()
1387
+ json['nodeId'] = self.node_id.to_json()
1388
+ json['elementAccessibilityIssueReason'] = self.element_accessibility_issue_reason.to_json()
1389
+ json['hasDisallowedAttributes'] = self.has_disallowed_attributes
1390
+ return json
1391
+
1392
+ @classmethod
1393
+ def from_json(cls, json: T_JSON_DICT) -> ElementAccessibilityIssueDetails:
1394
+ return cls(
1395
+ node_id=dom.BackendNodeId.from_json(json['nodeId']),
1396
+ element_accessibility_issue_reason=ElementAccessibilityIssueReason.from_json(json['elementAccessibilityIssueReason']),
1397
+ has_disallowed_attributes=bool(json['hasDisallowedAttributes']),
1398
+ )
1399
+
1400
+
1401
+ class StyleSheetLoadingIssueReason(enum.Enum):
1402
+ LATE_IMPORT_RULE = "LateImportRule"
1403
+ REQUEST_FAILED = "RequestFailed"
1404
+
1405
+ def to_json(self) -> str:
1406
+ return self.value
1407
+
1408
+ @classmethod
1409
+ def from_json(cls, json: str) -> StyleSheetLoadingIssueReason:
1410
+ return cls(json)
1411
+
1412
+
1413
+ @dataclass
1414
+ class StylesheetLoadingIssueDetails:
1415
+ '''
1416
+ This issue warns when a referenced stylesheet couldn't be loaded.
1417
+ '''
1418
+ #: Source code position that referenced the failing stylesheet.
1419
+ source_code_location: SourceCodeLocation
1420
+
1421
+ #: Reason why the stylesheet couldn't be loaded.
1422
+ style_sheet_loading_issue_reason: StyleSheetLoadingIssueReason
1423
+
1424
+ #: Contains additional info when the failure was due to a request.
1425
+ failed_request_info: typing.Optional[FailedRequestInfo] = None
1426
+
1427
+ def to_json(self) -> T_JSON_DICT:
1428
+ json: T_JSON_DICT = dict()
1429
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
1430
+ json['styleSheetLoadingIssueReason'] = self.style_sheet_loading_issue_reason.to_json()
1431
+ if self.failed_request_info is not None:
1432
+ json['failedRequestInfo'] = self.failed_request_info.to_json()
1433
+ return json
1434
+
1435
+ @classmethod
1436
+ def from_json(cls, json: T_JSON_DICT) -> StylesheetLoadingIssueDetails:
1437
+ return cls(
1438
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']),
1439
+ style_sheet_loading_issue_reason=StyleSheetLoadingIssueReason.from_json(json['styleSheetLoadingIssueReason']),
1440
+ failed_request_info=FailedRequestInfo.from_json(json['failedRequestInfo']) if json.get('failedRequestInfo', None) is not None else None,
1441
+ )
1442
+
1443
+
1444
+ class PropertyRuleIssueReason(enum.Enum):
1445
+ INVALID_SYNTAX = "InvalidSyntax"
1446
+ INVALID_INITIAL_VALUE = "InvalidInitialValue"
1447
+ INVALID_INHERITS = "InvalidInherits"
1448
+ INVALID_NAME = "InvalidName"
1449
+
1450
+ def to_json(self) -> str:
1451
+ return self.value
1452
+
1453
+ @classmethod
1454
+ def from_json(cls, json: str) -> PropertyRuleIssueReason:
1455
+ return cls(json)
1456
+
1457
+
1458
+ @dataclass
1459
+ class PropertyRuleIssueDetails:
1460
+ '''
1461
+ This issue warns about errors in property rules that lead to property
1462
+ registrations being ignored.
1463
+ '''
1464
+ #: Source code position of the property rule.
1465
+ source_code_location: SourceCodeLocation
1466
+
1467
+ #: Reason why the property rule was discarded.
1468
+ property_rule_issue_reason: PropertyRuleIssueReason
1469
+
1470
+ #: The value of the property rule property that failed to parse
1471
+ property_value: typing.Optional[str] = None
1472
+
1473
+ def to_json(self) -> T_JSON_DICT:
1474
+ json: T_JSON_DICT = dict()
1475
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
1476
+ json['propertyRuleIssueReason'] = self.property_rule_issue_reason.to_json()
1477
+ if self.property_value is not None:
1478
+ json['propertyValue'] = self.property_value
1479
+ return json
1480
+
1481
+ @classmethod
1482
+ def from_json(cls, json: T_JSON_DICT) -> PropertyRuleIssueDetails:
1483
+ return cls(
1484
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']),
1485
+ property_rule_issue_reason=PropertyRuleIssueReason.from_json(json['propertyRuleIssueReason']),
1486
+ property_value=str(json['propertyValue']) if json.get('propertyValue', None) is not None else None,
1487
+ )
1488
+
1489
+
1490
+ class UserReidentificationIssueType(enum.Enum):
1491
+ BLOCKED_FRAME_NAVIGATION = "BlockedFrameNavigation"
1492
+ BLOCKED_SUBRESOURCE = "BlockedSubresource"
1493
+ NOISED_CANVAS_READBACK = "NoisedCanvasReadback"
1494
+
1495
+ def to_json(self) -> str:
1496
+ return self.value
1497
+
1498
+ @classmethod
1499
+ def from_json(cls, json: str) -> UserReidentificationIssueType:
1500
+ return cls(json)
1501
+
1502
+
1503
+ @dataclass
1504
+ class UserReidentificationIssueDetails:
1505
+ '''
1506
+ This issue warns about uses of APIs that may be considered misuse to
1507
+ re-identify users.
1508
+ '''
1509
+ type_: UserReidentificationIssueType
1510
+
1511
+ #: Applies to BlockedFrameNavigation and BlockedSubresource issue types.
1512
+ request: typing.Optional[AffectedRequest] = None
1513
+
1514
+ #: Applies to NoisedCanvasReadback issue type.
1515
+ source_code_location: typing.Optional[SourceCodeLocation] = None
1516
+
1517
+ def to_json(self) -> T_JSON_DICT:
1518
+ json: T_JSON_DICT = dict()
1519
+ json['type'] = self.type_.to_json()
1520
+ if self.request is not None:
1521
+ json['request'] = self.request.to_json()
1522
+ if self.source_code_location is not None:
1523
+ json['sourceCodeLocation'] = self.source_code_location.to_json()
1524
+ return json
1525
+
1526
+ @classmethod
1527
+ def from_json(cls, json: T_JSON_DICT) -> UserReidentificationIssueDetails:
1528
+ return cls(
1529
+ type_=UserReidentificationIssueType.from_json(json['type']),
1530
+ request=AffectedRequest.from_json(json['request']) if json.get('request', None) is not None else None,
1531
+ source_code_location=SourceCodeLocation.from_json(json['sourceCodeLocation']) if json.get('sourceCodeLocation', None) is not None else None,
1532
+ )
1533
+
1534
+
1535
+ class PermissionElementIssueType(enum.Enum):
1536
+ INVALID_TYPE = "InvalidType"
1537
+ FENCED_FRAME_DISALLOWED = "FencedFrameDisallowed"
1538
+ CSP_FRAME_ANCESTORS_MISSING = "CspFrameAncestorsMissing"
1539
+ PERMISSIONS_POLICY_BLOCKED = "PermissionsPolicyBlocked"
1540
+ PADDING_RIGHT_UNSUPPORTED = "PaddingRightUnsupported"
1541
+ PADDING_BOTTOM_UNSUPPORTED = "PaddingBottomUnsupported"
1542
+ INSET_BOX_SHADOW_UNSUPPORTED = "InsetBoxShadowUnsupported"
1543
+ REQUEST_IN_PROGRESS = "RequestInProgress"
1544
+ UNTRUSTED_EVENT = "UntrustedEvent"
1545
+ REGISTRATION_FAILED = "RegistrationFailed"
1546
+ TYPE_NOT_SUPPORTED = "TypeNotSupported"
1547
+ INVALID_TYPE_ACTIVATION = "InvalidTypeActivation"
1548
+ SECURITY_CHECKS_FAILED = "SecurityChecksFailed"
1549
+ ACTIVATION_DISABLED = "ActivationDisabled"
1550
+ GEOLOCATION_DEPRECATED = "GeolocationDeprecated"
1551
+ INVALID_DISPLAY_STYLE = "InvalidDisplayStyle"
1552
+ NON_OPAQUE_COLOR = "NonOpaqueColor"
1553
+ LOW_CONTRAST = "LowContrast"
1554
+ FONT_SIZE_TOO_SMALL = "FontSizeTooSmall"
1555
+ FONT_SIZE_TOO_LARGE = "FontSizeTooLarge"
1556
+ INVALID_SIZE_VALUE = "InvalidSizeValue"
1557
+
1558
+ def to_json(self) -> str:
1559
+ return self.value
1560
+
1561
+ @classmethod
1562
+ def from_json(cls, json: str) -> PermissionElementIssueType:
1563
+ return cls(json)
1564
+
1565
+
1566
+ @dataclass
1567
+ class PermissionElementIssueDetails:
1568
+ '''
1569
+ This issue warns about improper usage of the <permission> element.
1570
+ '''
1571
+ issue_type: PermissionElementIssueType
1572
+
1573
+ #: The value of the type attribute.
1574
+ type_: typing.Optional[str] = None
1575
+
1576
+ #: The node ID of the <permission> element.
1577
+ node_id: typing.Optional[dom.BackendNodeId] = None
1578
+
1579
+ #: True if the issue is a warning, false if it is an error.
1580
+ is_warning: typing.Optional[bool] = None
1581
+
1582
+ #: Fields for message construction:
1583
+ #: Used for messages that reference a specific permission name
1584
+ permission_name: typing.Optional[str] = None
1585
+
1586
+ #: Used for messages about occlusion
1587
+ occluder_node_info: typing.Optional[str] = None
1588
+
1589
+ #: Used for messages about occluder's parent
1590
+ occluder_parent_node_info: typing.Optional[str] = None
1591
+
1592
+ #: Used for messages about activation disabled reason
1593
+ disable_reason: typing.Optional[str] = None
1594
+
1595
+ def to_json(self) -> T_JSON_DICT:
1596
+ json: T_JSON_DICT = dict()
1597
+ json['issueType'] = self.issue_type.to_json()
1598
+ if self.type_ is not None:
1599
+ json['type'] = self.type_
1600
+ if self.node_id is not None:
1601
+ json['nodeId'] = self.node_id.to_json()
1602
+ if self.is_warning is not None:
1603
+ json['isWarning'] = self.is_warning
1604
+ if self.permission_name is not None:
1605
+ json['permissionName'] = self.permission_name
1606
+ if self.occluder_node_info is not None:
1607
+ json['occluderNodeInfo'] = self.occluder_node_info
1608
+ if self.occluder_parent_node_info is not None:
1609
+ json['occluderParentNodeInfo'] = self.occluder_parent_node_info
1610
+ if self.disable_reason is not None:
1611
+ json['disableReason'] = self.disable_reason
1612
+ return json
1613
+
1614
+ @classmethod
1615
+ def from_json(cls, json: T_JSON_DICT) -> PermissionElementIssueDetails:
1616
+ return cls(
1617
+ issue_type=PermissionElementIssueType.from_json(json['issueType']),
1618
+ type_=str(json['type']) if json.get('type', None) is not None else None,
1619
+ node_id=dom.BackendNodeId.from_json(json['nodeId']) if json.get('nodeId', None) is not None else None,
1620
+ is_warning=bool(json['isWarning']) if json.get('isWarning', None) is not None else None,
1621
+ permission_name=str(json['permissionName']) if json.get('permissionName', None) is not None else None,
1622
+ occluder_node_info=str(json['occluderNodeInfo']) if json.get('occluderNodeInfo', None) is not None else None,
1623
+ occluder_parent_node_info=str(json['occluderParentNodeInfo']) if json.get('occluderParentNodeInfo', None) is not None else None,
1624
+ disable_reason=str(json['disableReason']) if json.get('disableReason', None) is not None else None,
1625
+ )
1626
+
1627
+
1628
+ @dataclass
1629
+ class SelectivePermissionsInterventionIssueDetails:
1630
+ '''
1631
+ The issue warns about blocked calls to privacy sensitive APIs via the
1632
+ Selective Permissions Intervention.
1633
+ '''
1634
+ #: Which API was intervened on.
1635
+ api_name: str
1636
+
1637
+ #: Why the ad script using the API is considered an ad.
1638
+ ad_ancestry: network.AdAncestry
1639
+
1640
+ #: The stack trace at the time of the intervention.
1641
+ stack_trace: typing.Optional[runtime.StackTrace] = None
1642
+
1643
+ def to_json(self) -> T_JSON_DICT:
1644
+ json: T_JSON_DICT = dict()
1645
+ json['apiName'] = self.api_name
1646
+ json['adAncestry'] = self.ad_ancestry.to_json()
1647
+ if self.stack_trace is not None:
1648
+ json['stackTrace'] = self.stack_trace.to_json()
1649
+ return json
1650
+
1651
+ @classmethod
1652
+ def from_json(cls, json: T_JSON_DICT) -> SelectivePermissionsInterventionIssueDetails:
1653
+ return cls(
1654
+ api_name=str(json['apiName']),
1655
+ ad_ancestry=network.AdAncestry.from_json(json['adAncestry']),
1656
+ stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if json.get('stackTrace', None) is not None else None,
1657
+ )
1658
+
1659
+
1660
+ class InspectorIssueCode(enum.Enum):
1661
+ '''
1662
+ A unique identifier for the type of issue. Each type may use one of the
1663
+ optional fields in InspectorIssueDetails to convey more specific
1664
+ information about the kind of issue.
1665
+ '''
1666
+ COOKIE_ISSUE = "CookieIssue"
1667
+ MIXED_CONTENT_ISSUE = "MixedContentIssue"
1668
+ BLOCKED_BY_RESPONSE_ISSUE = "BlockedByResponseIssue"
1669
+ HEAVY_AD_ISSUE = "HeavyAdIssue"
1670
+ CONTENT_SECURITY_POLICY_ISSUE = "ContentSecurityPolicyIssue"
1671
+ SHARED_ARRAY_BUFFER_ISSUE = "SharedArrayBufferIssue"
1672
+ CORS_ISSUE = "CorsIssue"
1673
+ ATTRIBUTION_REPORTING_ISSUE = "AttributionReportingIssue"
1674
+ QUIRKS_MODE_ISSUE = "QuirksModeIssue"
1675
+ PARTITIONING_BLOB_URL_ISSUE = "PartitioningBlobURLIssue"
1676
+ NAVIGATOR_USER_AGENT_ISSUE = "NavigatorUserAgentIssue"
1677
+ GENERIC_ISSUE = "GenericIssue"
1678
+ DEPRECATION_ISSUE = "DeprecationIssue"
1679
+ CLIENT_HINT_ISSUE = "ClientHintIssue"
1680
+ FEDERATED_AUTH_REQUEST_ISSUE = "FederatedAuthRequestIssue"
1681
+ BOUNCE_TRACKING_ISSUE = "BounceTrackingIssue"
1682
+ COOKIE_DEPRECATION_METADATA_ISSUE = "CookieDeprecationMetadataIssue"
1683
+ STYLESHEET_LOADING_ISSUE = "StylesheetLoadingIssue"
1684
+ FEDERATED_AUTH_USER_INFO_REQUEST_ISSUE = "FederatedAuthUserInfoRequestIssue"
1685
+ PROPERTY_RULE_ISSUE = "PropertyRuleIssue"
1686
+ SHARED_DICTIONARY_ISSUE = "SharedDictionaryIssue"
1687
+ ELEMENT_ACCESSIBILITY_ISSUE = "ElementAccessibilityIssue"
1688
+ SRI_MESSAGE_SIGNATURE_ISSUE = "SRIMessageSignatureIssue"
1689
+ UNENCODED_DIGEST_ISSUE = "UnencodedDigestIssue"
1690
+ CONNECTION_ALLOWLIST_ISSUE = "ConnectionAllowlistIssue"
1691
+ USER_REIDENTIFICATION_ISSUE = "UserReidentificationIssue"
1692
+ PERMISSION_ELEMENT_ISSUE = "PermissionElementIssue"
1693
+ PERFORMANCE_ISSUE = "PerformanceIssue"
1694
+ SELECTIVE_PERMISSIONS_INTERVENTION_ISSUE = "SelectivePermissionsInterventionIssue"
1695
+
1696
+ def to_json(self) -> str:
1697
+ return self.value
1698
+
1699
+ @classmethod
1700
+ def from_json(cls, json: str) -> InspectorIssueCode:
1701
+ return cls(json)
1702
+
1703
+
1704
+ @dataclass
1705
+ class InspectorIssueDetails:
1706
+ '''
1707
+ This struct holds a list of optional fields with additional information
1708
+ specific to the kind of issue. When adding a new issue code, please also
1709
+ add a new optional field to this type.
1710
+ '''
1711
+ cookie_issue_details: typing.Optional[CookieIssueDetails] = None
1712
+
1713
+ mixed_content_issue_details: typing.Optional[MixedContentIssueDetails] = None
1714
+
1715
+ blocked_by_response_issue_details: typing.Optional[BlockedByResponseIssueDetails] = None
1716
+
1717
+ heavy_ad_issue_details: typing.Optional[HeavyAdIssueDetails] = None
1718
+
1719
+ content_security_policy_issue_details: typing.Optional[ContentSecurityPolicyIssueDetails] = None
1720
+
1721
+ shared_array_buffer_issue_details: typing.Optional[SharedArrayBufferIssueDetails] = None
1722
+
1723
+ cors_issue_details: typing.Optional[CorsIssueDetails] = None
1724
+
1725
+ attribution_reporting_issue_details: typing.Optional[AttributionReportingIssueDetails] = None
1726
+
1727
+ quirks_mode_issue_details: typing.Optional[QuirksModeIssueDetails] = None
1728
+
1729
+ partitioning_blob_url_issue_details: typing.Optional[PartitioningBlobURLIssueDetails] = None
1730
+
1731
+ navigator_user_agent_issue_details: typing.Optional[NavigatorUserAgentIssueDetails] = None
1732
+
1733
+ generic_issue_details: typing.Optional[GenericIssueDetails] = None
1734
+
1735
+ deprecation_issue_details: typing.Optional[DeprecationIssueDetails] = None
1736
+
1737
+ client_hint_issue_details: typing.Optional[ClientHintIssueDetails] = None
1738
+
1739
+ federated_auth_request_issue_details: typing.Optional[FederatedAuthRequestIssueDetails] = None
1740
+
1741
+ bounce_tracking_issue_details: typing.Optional[BounceTrackingIssueDetails] = None
1742
+
1743
+ cookie_deprecation_metadata_issue_details: typing.Optional[CookieDeprecationMetadataIssueDetails] = None
1744
+
1745
+ stylesheet_loading_issue_details: typing.Optional[StylesheetLoadingIssueDetails] = None
1746
+
1747
+ property_rule_issue_details: typing.Optional[PropertyRuleIssueDetails] = None
1748
+
1749
+ federated_auth_user_info_request_issue_details: typing.Optional[FederatedAuthUserInfoRequestIssueDetails] = None
1750
+
1751
+ shared_dictionary_issue_details: typing.Optional[SharedDictionaryIssueDetails] = None
1752
+
1753
+ element_accessibility_issue_details: typing.Optional[ElementAccessibilityIssueDetails] = None
1754
+
1755
+ sri_message_signature_issue_details: typing.Optional[SRIMessageSignatureIssueDetails] = None
1756
+
1757
+ unencoded_digest_issue_details: typing.Optional[UnencodedDigestIssueDetails] = None
1758
+
1759
+ connection_allowlist_issue_details: typing.Optional[ConnectionAllowlistIssueDetails] = None
1760
+
1761
+ user_reidentification_issue_details: typing.Optional[UserReidentificationIssueDetails] = None
1762
+
1763
+ permission_element_issue_details: typing.Optional[PermissionElementIssueDetails] = None
1764
+
1765
+ performance_issue_details: typing.Optional[PerformanceIssueDetails] = None
1766
+
1767
+ selective_permissions_intervention_issue_details: typing.Optional[SelectivePermissionsInterventionIssueDetails] = None
1768
+
1769
+ def to_json(self) -> T_JSON_DICT:
1770
+ json: T_JSON_DICT = dict()
1771
+ if self.cookie_issue_details is not None:
1772
+ json['cookieIssueDetails'] = self.cookie_issue_details.to_json()
1773
+ if self.mixed_content_issue_details is not None:
1774
+ json['mixedContentIssueDetails'] = self.mixed_content_issue_details.to_json()
1775
+ if self.blocked_by_response_issue_details is not None:
1776
+ json['blockedByResponseIssueDetails'] = self.blocked_by_response_issue_details.to_json()
1777
+ if self.heavy_ad_issue_details is not None:
1778
+ json['heavyAdIssueDetails'] = self.heavy_ad_issue_details.to_json()
1779
+ if self.content_security_policy_issue_details is not None:
1780
+ json['contentSecurityPolicyIssueDetails'] = self.content_security_policy_issue_details.to_json()
1781
+ if self.shared_array_buffer_issue_details is not None:
1782
+ json['sharedArrayBufferIssueDetails'] = self.shared_array_buffer_issue_details.to_json()
1783
+ if self.cors_issue_details is not None:
1784
+ json['corsIssueDetails'] = self.cors_issue_details.to_json()
1785
+ if self.attribution_reporting_issue_details is not None:
1786
+ json['attributionReportingIssueDetails'] = self.attribution_reporting_issue_details.to_json()
1787
+ if self.quirks_mode_issue_details is not None:
1788
+ json['quirksModeIssueDetails'] = self.quirks_mode_issue_details.to_json()
1789
+ if self.partitioning_blob_url_issue_details is not None:
1790
+ json['partitioningBlobURLIssueDetails'] = self.partitioning_blob_url_issue_details.to_json()
1791
+ if self.navigator_user_agent_issue_details is not None:
1792
+ json['navigatorUserAgentIssueDetails'] = self.navigator_user_agent_issue_details.to_json()
1793
+ if self.generic_issue_details is not None:
1794
+ json['genericIssueDetails'] = self.generic_issue_details.to_json()
1795
+ if self.deprecation_issue_details is not None:
1796
+ json['deprecationIssueDetails'] = self.deprecation_issue_details.to_json()
1797
+ if self.client_hint_issue_details is not None:
1798
+ json['clientHintIssueDetails'] = self.client_hint_issue_details.to_json()
1799
+ if self.federated_auth_request_issue_details is not None:
1800
+ json['federatedAuthRequestIssueDetails'] = self.federated_auth_request_issue_details.to_json()
1801
+ if self.bounce_tracking_issue_details is not None:
1802
+ json['bounceTrackingIssueDetails'] = self.bounce_tracking_issue_details.to_json()
1803
+ if self.cookie_deprecation_metadata_issue_details is not None:
1804
+ json['cookieDeprecationMetadataIssueDetails'] = self.cookie_deprecation_metadata_issue_details.to_json()
1805
+ if self.stylesheet_loading_issue_details is not None:
1806
+ json['stylesheetLoadingIssueDetails'] = self.stylesheet_loading_issue_details.to_json()
1807
+ if self.property_rule_issue_details is not None:
1808
+ json['propertyRuleIssueDetails'] = self.property_rule_issue_details.to_json()
1809
+ if self.federated_auth_user_info_request_issue_details is not None:
1810
+ json['federatedAuthUserInfoRequestIssueDetails'] = self.federated_auth_user_info_request_issue_details.to_json()
1811
+ if self.shared_dictionary_issue_details is not None:
1812
+ json['sharedDictionaryIssueDetails'] = self.shared_dictionary_issue_details.to_json()
1813
+ if self.element_accessibility_issue_details is not None:
1814
+ json['elementAccessibilityIssueDetails'] = self.element_accessibility_issue_details.to_json()
1815
+ if self.sri_message_signature_issue_details is not None:
1816
+ json['sriMessageSignatureIssueDetails'] = self.sri_message_signature_issue_details.to_json()
1817
+ if self.unencoded_digest_issue_details is not None:
1818
+ json['unencodedDigestIssueDetails'] = self.unencoded_digest_issue_details.to_json()
1819
+ if self.connection_allowlist_issue_details is not None:
1820
+ json['connectionAllowlistIssueDetails'] = self.connection_allowlist_issue_details.to_json()
1821
+ if self.user_reidentification_issue_details is not None:
1822
+ json['userReidentificationIssueDetails'] = self.user_reidentification_issue_details.to_json()
1823
+ if self.permission_element_issue_details is not None:
1824
+ json['permissionElementIssueDetails'] = self.permission_element_issue_details.to_json()
1825
+ if self.performance_issue_details is not None:
1826
+ json['performanceIssueDetails'] = self.performance_issue_details.to_json()
1827
+ if self.selective_permissions_intervention_issue_details is not None:
1828
+ json['selectivePermissionsInterventionIssueDetails'] = self.selective_permissions_intervention_issue_details.to_json()
1829
+ return json
1830
+
1831
+ @classmethod
1832
+ def from_json(cls, json: T_JSON_DICT) -> InspectorIssueDetails:
1833
+ return cls(
1834
+ cookie_issue_details=CookieIssueDetails.from_json(json['cookieIssueDetails']) if json.get('cookieIssueDetails', None) is not None else None,
1835
+ mixed_content_issue_details=MixedContentIssueDetails.from_json(json['mixedContentIssueDetails']) if json.get('mixedContentIssueDetails', None) is not None else None,
1836
+ blocked_by_response_issue_details=BlockedByResponseIssueDetails.from_json(json['blockedByResponseIssueDetails']) if json.get('blockedByResponseIssueDetails', None) is not None else None,
1837
+ heavy_ad_issue_details=HeavyAdIssueDetails.from_json(json['heavyAdIssueDetails']) if json.get('heavyAdIssueDetails', None) is not None else None,
1838
+ content_security_policy_issue_details=ContentSecurityPolicyIssueDetails.from_json(json['contentSecurityPolicyIssueDetails']) if json.get('contentSecurityPolicyIssueDetails', None) is not None else None,
1839
+ shared_array_buffer_issue_details=SharedArrayBufferIssueDetails.from_json(json['sharedArrayBufferIssueDetails']) if json.get('sharedArrayBufferIssueDetails', None) is not None else None,
1840
+ cors_issue_details=CorsIssueDetails.from_json(json['corsIssueDetails']) if json.get('corsIssueDetails', None) is not None else None,
1841
+ attribution_reporting_issue_details=AttributionReportingIssueDetails.from_json(json['attributionReportingIssueDetails']) if json.get('attributionReportingIssueDetails', None) is not None else None,
1842
+ quirks_mode_issue_details=QuirksModeIssueDetails.from_json(json['quirksModeIssueDetails']) if json.get('quirksModeIssueDetails', None) is not None else None,
1843
+ partitioning_blob_url_issue_details=PartitioningBlobURLIssueDetails.from_json(json['partitioningBlobURLIssueDetails']) if json.get('partitioningBlobURLIssueDetails', None) is not None else None,
1844
+ navigator_user_agent_issue_details=NavigatorUserAgentIssueDetails.from_json(json['navigatorUserAgentIssueDetails']) if json.get('navigatorUserAgentIssueDetails', None) is not None else None,
1845
+ generic_issue_details=GenericIssueDetails.from_json(json['genericIssueDetails']) if json.get('genericIssueDetails', None) is not None else None,
1846
+ deprecation_issue_details=DeprecationIssueDetails.from_json(json['deprecationIssueDetails']) if json.get('deprecationIssueDetails', None) is not None else None,
1847
+ client_hint_issue_details=ClientHintIssueDetails.from_json(json['clientHintIssueDetails']) if json.get('clientHintIssueDetails', None) is not None else None,
1848
+ federated_auth_request_issue_details=FederatedAuthRequestIssueDetails.from_json(json['federatedAuthRequestIssueDetails']) if json.get('federatedAuthRequestIssueDetails', None) is not None else None,
1849
+ bounce_tracking_issue_details=BounceTrackingIssueDetails.from_json(json['bounceTrackingIssueDetails']) if json.get('bounceTrackingIssueDetails', None) is not None else None,
1850
+ cookie_deprecation_metadata_issue_details=CookieDeprecationMetadataIssueDetails.from_json(json['cookieDeprecationMetadataIssueDetails']) if json.get('cookieDeprecationMetadataIssueDetails', None) is not None else None,
1851
+ stylesheet_loading_issue_details=StylesheetLoadingIssueDetails.from_json(json['stylesheetLoadingIssueDetails']) if json.get('stylesheetLoadingIssueDetails', None) is not None else None,
1852
+ property_rule_issue_details=PropertyRuleIssueDetails.from_json(json['propertyRuleIssueDetails']) if json.get('propertyRuleIssueDetails', None) is not None else None,
1853
+ federated_auth_user_info_request_issue_details=FederatedAuthUserInfoRequestIssueDetails.from_json(json['federatedAuthUserInfoRequestIssueDetails']) if json.get('federatedAuthUserInfoRequestIssueDetails', None) is not None else None,
1854
+ shared_dictionary_issue_details=SharedDictionaryIssueDetails.from_json(json['sharedDictionaryIssueDetails']) if json.get('sharedDictionaryIssueDetails', None) is not None else None,
1855
+ element_accessibility_issue_details=ElementAccessibilityIssueDetails.from_json(json['elementAccessibilityIssueDetails']) if json.get('elementAccessibilityIssueDetails', None) is not None else None,
1856
+ sri_message_signature_issue_details=SRIMessageSignatureIssueDetails.from_json(json['sriMessageSignatureIssueDetails']) if json.get('sriMessageSignatureIssueDetails', None) is not None else None,
1857
+ unencoded_digest_issue_details=UnencodedDigestIssueDetails.from_json(json['unencodedDigestIssueDetails']) if json.get('unencodedDigestIssueDetails', None) is not None else None,
1858
+ connection_allowlist_issue_details=ConnectionAllowlistIssueDetails.from_json(json['connectionAllowlistIssueDetails']) if json.get('connectionAllowlistIssueDetails', None) is not None else None,
1859
+ user_reidentification_issue_details=UserReidentificationIssueDetails.from_json(json['userReidentificationIssueDetails']) if json.get('userReidentificationIssueDetails', None) is not None else None,
1860
+ permission_element_issue_details=PermissionElementIssueDetails.from_json(json['permissionElementIssueDetails']) if json.get('permissionElementIssueDetails', None) is not None else None,
1861
+ performance_issue_details=PerformanceIssueDetails.from_json(json['performanceIssueDetails']) if json.get('performanceIssueDetails', None) is not None else None,
1862
+ selective_permissions_intervention_issue_details=SelectivePermissionsInterventionIssueDetails.from_json(json['selectivePermissionsInterventionIssueDetails']) if json.get('selectivePermissionsInterventionIssueDetails', None) is not None else None,
1863
+ )
1864
+
1865
+
1866
+ class IssueId(str):
1867
+ '''
1868
+ A unique id for a DevTools inspector issue. Allows other entities (e.g.
1869
+ exceptions, CDP message, console messages, etc.) to reference an issue.
1870
+ '''
1871
+ def to_json(self) -> str:
1872
+ return self
1873
+
1874
+ @classmethod
1875
+ def from_json(cls, json: str) -> IssueId:
1876
+ return cls(json)
1877
+
1878
+ def __repr__(self):
1879
+ return 'IssueId({})'.format(super().__repr__())
1880
+
1881
+
1882
+ @dataclass
1883
+ class InspectorIssue:
1884
+ '''
1885
+ An inspector issue reported from the back-end.
1886
+ '''
1887
+ code: InspectorIssueCode
1888
+
1889
+ details: InspectorIssueDetails
1890
+
1891
+ #: A unique id for this issue. May be omitted if no other entity (e.g.
1892
+ #: exception, CDP message, etc.) is referencing this issue.
1893
+ issue_id: typing.Optional[IssueId] = None
1894
+
1895
+ def to_json(self) -> T_JSON_DICT:
1896
+ json: T_JSON_DICT = dict()
1897
+ json['code'] = self.code.to_json()
1898
+ json['details'] = self.details.to_json()
1899
+ if self.issue_id is not None:
1900
+ json['issueId'] = self.issue_id.to_json()
1901
+ return json
1902
+
1903
+ @classmethod
1904
+ def from_json(cls, json: T_JSON_DICT) -> InspectorIssue:
1905
+ return cls(
1906
+ code=InspectorIssueCode.from_json(json['code']),
1907
+ details=InspectorIssueDetails.from_json(json['details']),
1908
+ issue_id=IssueId.from_json(json['issueId']) if json.get('issueId', None) is not None else None,
1909
+ )
1910
+
1911
+
1912
+ def get_encoded_response(
1913
+ request_id: network.RequestId,
1914
+ encoding: str,
1915
+ quality: typing.Optional[float] = None,
1916
+ size_only: typing.Optional[bool] = None
1917
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[str], int, int]]:
1918
+ '''
1919
+ Returns the response body and size if it were re-encoded with the specified settings. Only
1920
+ applies to images.
1921
+
1922
+ :param request_id: Identifier of the network request to get content for.
1923
+ :param encoding: The encoding to use.
1924
+ :param quality: *(Optional)* The quality of the encoding (0-1). (defaults to 1)
1925
+ :param size_only: *(Optional)* Whether to only return the size information (defaults to false).
1926
+ :returns: A tuple with the following items:
1927
+
1928
+ 0. **body** - *(Optional)* The encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON)
1929
+ 1. **originalSize** - Size before re-encoding.
1930
+ 2. **encodedSize** - Size after re-encoding.
1931
+ '''
1932
+ params: T_JSON_DICT = dict()
1933
+ params['requestId'] = request_id.to_json()
1934
+ params['encoding'] = encoding
1935
+ if quality is not None:
1936
+ params['quality'] = quality
1937
+ if size_only is not None:
1938
+ params['sizeOnly'] = size_only
1939
+ cmd_dict: T_JSON_DICT = {
1940
+ 'method': 'Audits.getEncodedResponse',
1941
+ 'params': params,
1942
+ }
1943
+ json = yield cmd_dict
1944
+ return (
1945
+ str(json['body']) if json.get('body', None) is not None else None,
1946
+ int(json['originalSize']),
1947
+ int(json['encodedSize'])
1948
+ )
1949
+
1950
+
1951
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1952
+ '''
1953
+ Disables issues domain, prevents further issues from being reported to the client.
1954
+ '''
1955
+ cmd_dict: T_JSON_DICT = {
1956
+ 'method': 'Audits.disable',
1957
+ }
1958
+ json = yield cmd_dict
1959
+
1960
+
1961
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1962
+ '''
1963
+ Enables issues domain, sends the issues collected so far to the client by means of the
1964
+ ``issueAdded`` event.
1965
+ '''
1966
+ cmd_dict: T_JSON_DICT = {
1967
+ 'method': 'Audits.enable',
1968
+ }
1969
+ json = yield cmd_dict
1970
+
1971
+
1972
+ def check_forms_issues() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[GenericIssueDetails]]:
1973
+ '''
1974
+ Runs the form issues check for the target page. Found issues are reported
1975
+ using Audits.issueAdded event.
1976
+
1977
+ :returns:
1978
+ '''
1979
+ cmd_dict: T_JSON_DICT = {
1980
+ 'method': 'Audits.checkFormsIssues',
1981
+ }
1982
+ json = yield cmd_dict
1983
+ return [GenericIssueDetails.from_json(i) for i in json['formIssues']]
1984
+
1985
+
1986
+ @event_class('Audits.issueAdded')
1987
+ @dataclass
1988
+ class IssueAdded:
1989
+ issue: InspectorIssue
1990
+
1991
+ @classmethod
1992
+ def from_json(cls, json: T_JSON_DICT) -> IssueAdded:
1993
+ return cls(
1994
+ issue=InspectorIssue.from_json(json['issue'])
1995
+ )