Repository navigation
fix(browser): stop malformed localhost pages from freezing the new tab page probe - #34427
Conversation
…b page probe The title and icon-link regexes rescanned the rest of the body from every unclosed opener, so a 192 KB page of repeated '<link ' or '<title>' blocked the main or runtime event loop for seconds. Scan tags forward only.
|
No actionable comments were generated in the recent review.
|
The browser's new tab page probes local servers for their title and icon. A localhost page full of unclosed
<linkor<title>tags could freeze Orca's main process, or the runtime server for a remote workspace, for seconds. Those pages now parse in a few milliseconds.The title and icon-link regexes rescanned the rest of the body from every opener that had no closing
>or</title>, so the parse grew quadratically with page size. It runs synchronously, so the 1.5 s HTTP timeout couldn't cut it short. Both now scan forward once: find the opener, thenindexOf('>'), then continue from there. Titles and icons come out the same as before for every input (real sites plus a 200k-case differential fuzz against the old regexes). The loopback, same-origin and size checks are unchanged.Time spent in
probeWorkspacePortPagewith a loopback server serving each page:<title>ok</title>+'<link '.repeat(32000)(192 KB)'<title>'.repeat(27000)(189 KB)Linear: STA-11898