katalon-studio / katalon-recorder

Apache License 2.0
316 stars 144 forks source link

`<iframe>` inside ShadowDOM will cause extension script hang #105

Open gdh1995 opened 3 years ago

gdh1995 commented 3 years ago

Platform: Chrome 94, Win 10 / macOS 11.4 Extension: Katalon Recorder (Selenium tests generator) 5.5.4.8

One line description

If a page creates a Shadow DOM tree and then insert <iframe></iframe> into the tree, then this extension's content script will enter a dead loop and the whole page hangs.

Test steps

A simple test is: install Vimium C (https://github.com/gdh1995/vimium-c) and press / on a Google page. If without this extension, Vimium C should show a small input box at the bottom right corner and a user can type letters to search.

But with this enabled, a test page will hang (as reported in https://github.com/gdh1995/vimium-c/issues/457).

Buggy point

https://github.com/katalon-studio/katalon-recorder/blob/d118f95b2bdd126db824fa2c6b8b70461857a7cf/content/recorder.js#L89-L98

Here frames won't include child frames inside Shadow DOM trees, so currentWindow won't be updated, and then currentWindow !== window.top is always true.

minhthanh3145 commented 3 years ago

Thank you for the report, we'll fix it and include it in the upcoming releases.

gdh1995 commented 2 years ago

Any updates?

greyfx80 commented 2 years ago

This issue is still occurring with Chrome extension 5.8.1 and my shadow dom that I am attempting to record does NOT have an iframe in it. In fact, it breaks the shadow dom causing the browser to freeze and having to force quit the entire browser without even trying to record. Had to turn off the extension to stop it from breaking the shadow dom. This is occurring on both Mac (Chrome v. 101) and Windows(Chrome v. 89) in either incognito or regular.

gdh1995 commented 2 years ago

Hello, could you fix this in a next release? Another user of my extension also met this crash.