(frame, targetUrl)
| 932 | } |
| 933 | |
| 934 | const findDescendantByUrl = (frame, targetUrl) => { |
| 935 | if (!frame || !targetUrl) { |
| 936 | return null |
| 937 | } |
| 938 | const normalizedTarget = normalizeInspectorUrl(targetUrl) |
| 939 | if (!normalizedTarget) { |
| 940 | return null |
| 941 | } |
| 942 | const stack = [frame] |
| 943 | while (stack.length) { |
| 944 | const current = stack.pop() |
| 945 | try { |
| 946 | const currentUrl = normalizeInspectorUrl(current.url || '') |
| 947 | if (currentUrl && urlsRoughlyMatch(normalizedTarget, currentUrl)) { |
| 948 | return current |
| 949 | } |
| 950 | } catch (_) {} |
| 951 | const children = Array.isArray(current.frames) ? current.frames : [] |
| 952 | for (const child of children) { |
| 953 | if (child) { |
| 954 | stack.push(child) |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | return null |
| 959 | } |
| 960 | |
| 961 | const selectTargetFrame = (webContents, payload = {}) => { |
| 962 | if (!webContents || !webContents.mainFrame) { |
no test coverage detected