Extension is hanging if removing an iframe injected in the DOM after v3 migration

135 views
Skip to first unread message

Tarun Khandelwal

unread,
Sep 6, 2022, 2:08:21 AM9/6/22
to Chromium Extensions
Hello everyone,

Recently I migrated my extension to v3, I followed the migration guide and was able to migrate the plugin successfully. But I noticed one issue.

So my plugin injects a button in the document screen. And when user clicks on the button I send a message to content script to inject an iframe in the DOM which is running a react application.

So the iframe is kind of a modal, so there is remove icon present in the modal where user can click and remove the modal from the DOM, remove action sends a message to content script and content scripts removes the modal iframe from the DOM.

Now this was working fine in v2 manifest extension but now this action is actually freezing the extension and removing the extension from all the tabs. I also noticed that if I open a new tab it keeps on loading, and there is no extension buttons present in the screen.  I have to forcefully quit the chrome and restart it to again use the extension. 

What so far I debugged is that as soon as modal iframe gets injected it makes an api call and if api call is in pending state and then if user closes the modal then only it will freeze. If I wait and let all the api calls initiated by the modal iframe complete and then remove it, it works fine.

I can fix this by cancelling all ongoing apis calls before closing the modal but I want to know why is that happening and it was working fine in v2.

wOxxOm

unread,
Sep 6, 2022, 5:57:37 AM9/6/22
to Chromium Extensions, ta...@gkmit.co
It's probably https://crbug.com/1264817

In my tests it can be fixed by adding  self.oninstall = () => self.skipWaiting() to the background script and recreating all iframes because the old ones will be unable to connect after the update.

Tarun Khandelwal

unread,
Sep 6, 2022, 6:43:03 AM9/6/22
to Chromium Extensions, wOxxOm, Tarun Khandelwal
Hi, I tried this but it's not working and I am unsure if my issue is related to the bug you mentioned. The iframe that I am saying is added by using a content script and whenever I remove that iframe and if there is any pending request from this iframe then it will freeze the extension UI.


Screenshot 2022-09-06 at 4.11.52 PM.png

wOxxOm

unread,
Sep 6, 2022, 6:51:24 AM9/6/22
to Chromium Extensions, ta...@gkmit.co, wOxxOm
Well, indeed it sounds like a different problem. As to why it happens, I guess because it's a bug in ManifestV3, which is still as unreliable as it was 3 years ago. You can report it on https://crbug.com with a demo extension and an instruction. Hopefully it'll be fixed someday, at least for our grandchildren :-)

ភា រិទ្ធ

unread,
Sep 6, 2022, 2:47:03 PM9/6/22
to Tarun Khandelwal, Chromium Extensions, wOxxOm

នៅ​ថ្ងៃទី អង្គារ 6 កញ្ញា 2022, 5:43 PM Tarun Khandelwal <ta...@gkmit.co> បាន​សរសេរ​ថា៖
--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/f0a079cd-87d8-4af6-9a06-38c81624c6fcn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages