I somehow managed to get the developer tools to break on the line that was hanging the tab!
In a postMessage handler callback on the window, I was popping objects off of an array in the closure’s parent scope and calling a function called “func” in those objects in a while loop. Maybe this is a JIT’ing problem?
The code that hangs looks like this:
while(messages.length) {
try {
messages.shift().func();
} catch (e) {
log.info(...)
}
}
By removing the shift() and doing a for-loop over the array, I was able to avoid the hang. The line I was able to pause the browser on was the while(messages.length) line. The hang always occurred when there was a ton of DOM manipulation happening coincidentally with some of my integration tests.