| 130 | // Browser extension is doing this via exchanging messages |
| 131 | // between devtools_page and dedicated content script for it, see `fetchFileWithCaching.js`. |
| 132 | async function fetchFileWithCaching(url: string) { |
| 133 | if (resourceCache.has(url)) { |
| 134 | return Promise.resolve(resourceCache.get(url)); |
| 135 | } |
| 136 | |
| 137 | return fetch(url) |
| 138 | .then(data => data.text()) |
| 139 | .then(content => { |
| 140 | resourceCache.set(url, content); |
| 141 | |
| 142 | return content; |
| 143 | }); |
| 144 | } |
| 145 | |
| 146 | function canViewElementSourceFunction( |
| 147 | _source: ReactFunctionLocation | ReactCallSite, |