(frame, acc = [], depth = 0)
| 914 | } |
| 915 | |
| 916 | const flattenFrameTree = (frame, acc = [], depth = 0) => { |
| 917 | if (!frame) { |
| 918 | return acc |
| 919 | } |
| 920 | let frameName = null |
| 921 | try { |
| 922 | frameName = typeof frame.name === 'string' && frame.name.length ? frame.name : null |
| 923 | } catch (_) { |
| 924 | frameName = null |
| 925 | } |
| 926 | acc.push({ frame, depth, url: normalizeInspectorUrl(frame.url || ''), name: frameName }) |
| 927 | const children = Array.isArray(frame.frames) ? frame.frames : [] |
| 928 | for (const child of children) { |
| 929 | flattenFrameTree(child, acc, depth + 1) |
| 930 | } |
| 931 | return acc |
| 932 | } |
| 933 | |
| 934 | const findDescendantByUrl = (frame, targetUrl) => { |
| 935 | if (!frame || !targetUrl) { |
no test coverage detected