* Gets a script ID if it exists, or waits to up maxTime. In rare cases we * can get a request (like a stacktrace request) from DAP before Chrome * finishes passing its sources over. We *should* normally know about all * possible script IDs; this waits if we see one that we don't.
(scriptId: string, maxTime = 500)
| 773 | * possible script IDs; this waits if we see one that we don't. |
| 774 | */ |
| 775 | private async getScriptByIdOrWait(scriptId: string, maxTime = 500) { |
| 776 | let script = this._sourceContainer.scriptsById.get(scriptId); |
| 777 | if (script) { |
| 778 | return script; |
| 779 | } |
| 780 | |
| 781 | const deadline = Date.now() + maxTime; |
| 782 | do { |
| 783 | await delay(50); |
| 784 | script = this._sourceContainer.scriptsById.get(scriptId); |
| 785 | } while (!script && Date.now() < deadline); |
| 786 | |
| 787 | return script; |
| 788 | } |
| 789 | |
| 790 | async renderDebuggerLocation(loc: Cdp.Debugger.Location): Promise<string> { |
| 791 | const raw = this.rawLocation(loc); |
no test coverage detected