(socket, instance)
| 121 | |
| 122 | class InspectorSession { |
| 123 | constructor(socket, instance) { |
| 124 | this._instance = instance; |
| 125 | this._socket = socket; |
| 126 | this._nextId = 1; |
| 127 | this._commandResponsePromises = new Map(); |
| 128 | this._unprocessedNotifications = []; |
| 129 | this._notificationCallback = null; |
| 130 | this._scriptsIdsByUrl = new Map(); |
| 131 | this._pausedDetails = null; |
| 132 | |
| 133 | let buffer = Buffer.alloc(0); |
| 134 | socket.on('data', (data) => { |
| 135 | buffer = Buffer.concat([buffer, data]); |
| 136 | do { |
| 137 | const { length, message, closed } = parseWSFrame(buffer); |
| 138 | if (!length) |
| 139 | break; |
| 140 | |
| 141 | if (closed) { |
| 142 | socket.write(Buffer.from([0x88, 0x00])); // WS close frame |
| 143 | } |
| 144 | buffer = buffer.slice(length); |
| 145 | if (message) |
| 146 | this._onMessage(message); |
| 147 | } while (true); |
| 148 | }); |
| 149 | this._terminationPromise = new Promise((resolve) => { |
| 150 | socket.once('close', resolve); |
| 151 | }); |
| 152 | } |
| 153 | |
| 154 | |
| 155 | waitForServerDisconnect() { |
nothing calls this directly
no test coverage detected