(cb, onError)
| 46 | |
| 47 | let session; |
| 48 | function sendInspectorCommand(cb, onError) { |
| 49 | const { hasInspector } = internalBinding('config'); |
| 50 | if (!hasInspector) return onError(); |
| 51 | // Do not preview when the permission model is enabled |
| 52 | // because this feature require access to the inspector, |
| 53 | // which is unavailable in this case. |
| 54 | if (permission.isEnabled()) return onError(); |
| 55 | const inspector = require('inspector'); |
| 56 | if (session === undefined) session = new inspector.Session(); |
| 57 | session.connect(); |
| 58 | try { |
| 59 | return cb(session); |
| 60 | } finally { |
| 61 | session.disconnect(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | function isInspectorMessage(string) { |
| 66 | return isUsingInspector() && RegExpPrototypeExec(kInspectMsgRegex, string) !== null; |
no test coverage detected
searching dependent graphs…