Content script was crashing after 5 - 6 minutes of the Chrome extension run

63 views
Skip to first unread message

Patricio Gonzalez

unread,
May 15, 2023, 1:21:04 PM5/15/23
to Chromium Extensions
Hi,
   We are working on updating our Chrome extension to manifest v3. We put it in the store three months ago with the changes, and we have to roll it back because many users reported that the content script was crashing. It was tough to figure out the error because just disappeared the code of the content script without leaving any logs or network requests showing the error.

Since three weeks ago, we can't reproduce the error. It should be fixed now without us making any changes. A couple of questions.

- In these latest months, have you made some changes that prevented that crash?
- Is there a way to debug this type of thing?

I'm sorry for not being more specific. We are trying to understand why it was crashing. If you need more information, please don't hesitate to let us know.

Patricio

Patrick Kettner

unread,
May 15, 2023, 1:28:19 PM5/15/23
to Patricio Gonzalez, Chromium Extensions
There’s not a ton to go off based on what you said, are you able to replicate the crash using an older version of chrome? Do you have a crash ID from chrome://crashes?

--
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/ee3f85ab-8e25-4a4d-8c59-35421d48a673n%40chromium.org.

Patricio Gonzalez

unread,
May 15, 2023, 1:45:06 PM5/15/23
to Chromium Extensions, Patrick Kettner, Chromium Extensions
Patrick,
  It never happened to us on the manifest v2; our extension uses the content script to add a sideout in the page to handle a messaging app, this sideout has an iframe that checks every 5 minutes or so if there is a new version if it is, reload the iframe, the last time we could reproduce was with another page ( not any of our customers) www.espn.com 
and just before it crashes, we get a console error but from ESPN, not from our extension

```Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.```

I don't know if it is related, I will look up chrome://crashes

Patricio

Patrick Kettner

unread,
May 15, 2023, 2:43:02 PM5/15/23
to Patricio Gonzalez, Chromium Extensions
Shot in the dark, but would you happen to be using chrome.tabs.sendMesasge()? It will that error (async) if a content script hasn't registered a listener

Patricio Gonzalez

unread,
May 15, 2023, 3:42:10 PM5/15/23
to Chromium Extensions, Patrick Kettner, Chromium Extensions, Patricio Gonzalez
mm, yes, could it be, I have a lot of these errors/warnings in the chrome.tabs.sendMessage  that i get rid of the chrome.runtime.lastError API, 

like this:
chrome.tabs.query({}, (tabs) => {
tabs.forEach((tab) => {
chrome.tabs.sendMessage(tab.id, { type: REMOVE_SLIDEOUT }, () => {
return !chrome.runtime.lastError;
});
});
});

we have several like this, i don't get the errors, and it keeps working. For example, the prev example runs behind an onInstalled listener
chrome.runtime.onInstalled.addListener(installedHandler);

This code is on the service worker to the content script, if there is a problem of that kind, I think is there
Reply all
Reply to author
Forward
0 new messages