INNER CODE UNIT · Python

DisposableDispatcher

feder-cr/invisible_playwright · src/invisible_playwright/_juggler/server.py:73

class DisposableDispatcher(Dispatcher):
    """The handle `add_init_script` gives back so a caller can remove it.

    ⛔ IT IS PART OF THE CONTRACT, NOT AN EXTRA. `_page.py` and
    `_browser_context.py` both wrap the reply in `from_channel(...)`, so a
    server that answers `None` does not merely lose the handle - it raises
    `AttributeError: 'NoneType' object has no attribute '_object'` inside the
    client, on a call that otherwise worked. The first implementation here
    returned None and that is exactly what happened.
    """

    TYPE = "Disposable"
    METHODS = {"dispose": "op_dispose"}

    def __init__(self, server, parent, undo) -> None:
        self._undo = undo
        super().__init__(server, parent, {})

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…