(
self, parent: ChannelOwner, type: str, guid: str, initializer: Dict
)
| 111 | ) |
| 112 | |
| 113 | def __init__( |
| 114 | self, parent: ChannelOwner, type: str, guid: str, initializer: Dict |
| 115 | ) -> None: |
| 116 | super().__init__(parent, type, guid, initializer) |
| 117 | # Browser is null for browser contexts created outside of normal browser, e.g. android or electron. |
| 118 | # circular import workaround: |
| 119 | self._browser: Optional["Browser"] = None |
| 120 | if parent.__class__.__name__ == "Browser": |
| 121 | self._browser = cast("Browser", parent) |
| 122 | self._pages: List[Page] = [] |
| 123 | self._routes: List[RouteHandler] = [] |
| 124 | self._web_socket_routes: List[WebSocketRouteHandler] = [] |
| 125 | self._bindings: Dict[str, Any] = {} |
| 126 | self._timeout_settings = TimeoutSettings(None) |
| 127 | self._owner_page: Optional[Page] = None |
| 128 | self._options: Dict[str, Any] = initializer["options"] |
| 129 | self._service_workers: Set[Worker] = set() |
| 130 | self._base_url: Optional[str] = self._options.get("baseURL") |
| 131 | self._videos_dir: Optional[str] = self._options.get("recordVideo") |
| 132 | self._tracing = cast(Tracing, from_channel(initializer["tracing"])) |
| 133 | self._debugger: Debugger = cast(Debugger, from_channel(initializer["debugger"])) |
| 134 | self._request: APIRequestContext = from_channel(initializer["requestContext"]) |
| 135 | self._request._timeout_settings = self._timeout_settings |
| 136 | self._clock = Clock(self) |
| 137 | self._credentials = Credentials(self) |
| 138 | self._channel.on( |
| 139 | "bindingCall", |
| 140 | lambda params: self._on_binding(from_channel(params["binding"])), |
| 141 | ) |
| 142 | self._channel.on("close", lambda _: self._on_close()) |
| 143 | self._channel.on( |
| 144 | "page", lambda params: self._on_page(from_channel(params["page"])) |
| 145 | ) |
| 146 | self._channel.on( |
| 147 | "route", |
| 148 | lambda params: self._loop.create_task( |
| 149 | self._on_route( |
| 150 | from_channel(params.get("route")), |
| 151 | ) |
| 152 | ), |
| 153 | ) |
| 154 | self._channel.on( |
| 155 | "webSocketRoute", |
| 156 | lambda params: self._loop.create_task( |
| 157 | self._on_web_socket_route( |
| 158 | from_channel(params["webSocketRoute"]), |
| 159 | ) |
| 160 | ), |
| 161 | ) |
| 162 | |
| 163 | self._channel.on( |
| 164 | "serviceWorker", |
| 165 | lambda params: self._on_service_worker(from_channel(params["worker"])), |
| 166 | ) |
| 167 | self._channel.on( |
| 168 | "console", |
| 169 | lambda event: self._on_console_message(event), |
| 170 | ) |
nothing calls this directly
no test coverage detected