forked from llimllib/chrome-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceWorker.py
110 lines (73 loc) · 3.43 KB
/
ServiceWorker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from enum import Enum
from typing import Any, List
from base import ChromeCommand
import Target
class ServiceWorkerRegistration:
"""ServiceWorker registration."""
def __init__(self, registrationId: str, scopeURL: str, isDeleted: bool):
self.registrationId = registrationId
self.scopeURL = scopeURL
self.isDeleted = isDeleted
ServiceWorkerVersionRunningStatus = Enum("ServiceWorkerVersionRunningStatus", "stopped starting running stopping")
ServiceWorkerVersionRunningStatus.__doc__ = ""
ServiceWorkerVersionStatus = Enum("ServiceWorkerVersionStatus", "new installing installed activating activated redundant")
ServiceWorkerVersionStatus.__doc__ = ""
class ServiceWorkerVersion:
"""ServiceWorker version."""
def __init__(self, versionId: str, registrationId: str, scriptURL: str, runningStatus: "ServiceWorkerVersionRunningStatus", status: "ServiceWorkerVersionStatus", scriptLastModified: float=None, scriptResponseTime: float=None, controlledClients: List=None, targetId: "Target.TargetID"=None):
self.versionId = versionId
self.registrationId = registrationId
self.scriptURL = scriptURL
self.runningStatus = runningStatus
self.status = status
# The Last-Modified header value of the main script.
self.scriptLastModified = scriptLastModified
# The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.
self.scriptResponseTime = scriptResponseTime
self.controlledClients = controlledClients
self.targetId = targetId
class ServiceWorkerErrorMessage:
"""ServiceWorker error message."""
def __init__(self, errorMessage: str, registrationId: str, versionId: str, sourceURL: str, lineNumber: int, columnNumber: int):
self.errorMessage = errorMessage
self.registrationId = registrationId
self.versionId = versionId
self.sourceURL = sourceURL
self.lineNumber = lineNumber
self.columnNumber = columnNumber
class enable(ChromeCommand):
def __init__(self): pass
class disable(ChromeCommand):
def __init__(self): pass
class unregister(ChromeCommand):
def __init__(self, scopeURL: str):
self.scopeURL = scopeURL
class updateRegistration(ChromeCommand):
def __init__(self, scopeURL: str):
self.scopeURL = scopeURL
class startWorker(ChromeCommand):
def __init__(self, scopeURL: str):
self.scopeURL = scopeURL
class skipWaiting(ChromeCommand):
def __init__(self, scopeURL: str):
self.scopeURL = scopeURL
class stopWorker(ChromeCommand):
def __init__(self, versionId: str):
self.versionId = versionId
class inspectWorker(ChromeCommand):
def __init__(self, versionId: str):
self.versionId = versionId
class setForceUpdateOnPageLoad(ChromeCommand):
def __init__(self, forceUpdateOnPageLoad: bool):
self.forceUpdateOnPageLoad = forceUpdateOnPageLoad
class deliverPushMessage(ChromeCommand):
def __init__(self, origin: str, registrationId: str, data: str):
self.origin = origin
self.registrationId = registrationId
self.data = data
class dispatchSyncEvent(ChromeCommand):
def __init__(self, origin: str, registrationId: str, tag: str, lastChance: bool):
self.origin = origin
self.registrationId = registrationId
self.tag = tag
self.lastChance = lastChance