(script)
| 1573 | } |
| 1574 | |
| 1575 | async unpinScript(script) { |
| 1576 | if (script && !(script instanceof PinnedScript)) { |
| 1577 | throw Error(`Pass valid PinnedScript object. Received: ${script}`) |
| 1578 | } |
| 1579 | |
| 1580 | if (script.handle in this.pinnedScripts_) { |
| 1581 | let connection |
| 1582 | if (Object.is(this._cdpConnection, undefined)) { |
| 1583 | connection = this.createCDPConnection('page') |
| 1584 | } else { |
| 1585 | connection = this._cdpConnection |
| 1586 | } |
| 1587 | |
| 1588 | await connection.send('Page.enable', {}) |
| 1589 | |
| 1590 | await connection.send('Runtime.evaluate', { |
| 1591 | expression: script.removalScript(), |
| 1592 | }) |
| 1593 | |
| 1594 | await connection.send('Page.removeScriptToEvaluateOnLoad', { |
| 1595 | identifier: script.scriptId, |
| 1596 | }) |
| 1597 | |
| 1598 | delete this.pinnedScripts_[script.handle] |
| 1599 | } |
| 1600 | } |
| 1601 | |
| 1602 | /** |
| 1603 | * |
no test coverage detected