(script)
| 1618 | } |
| 1619 | |
| 1620 | async unpinScript(script) { |
| 1621 | if (script && !(script instanceof PinnedScript)) { |
| 1622 | throw Error(`Pass valid PinnedScript object. Received: ${script}`) |
| 1623 | } |
| 1624 | |
| 1625 | if (script.handle in this.pinnedScripts_) { |
| 1626 | let connection |
| 1627 | if (Object.is(this._cdpConnection, undefined)) { |
| 1628 | connection = this.createCDPConnection('page') |
| 1629 | } else { |
| 1630 | connection = this._cdpConnection |
| 1631 | } |
| 1632 | |
| 1633 | await connection.send('Page.enable', {}) |
| 1634 | |
| 1635 | await connection.send('Runtime.evaluate', { |
| 1636 | expression: script.removalScript(), |
| 1637 | }) |
| 1638 | |
| 1639 | await connection.send('Page.removeScriptToEvaluateOnLoad', { |
| 1640 | identifier: script.scriptId, |
| 1641 | }) |
| 1642 | |
| 1643 | delete this.pinnedScripts_[script.handle] |
| 1644 | } |
| 1645 | } |
| 1646 | |
| 1647 | /** |
| 1648 | * |
no test coverage detected