New popup Window Only Opens When DevTools is Active

67 views
Skip to first unread message

yuval yehie

unread,
Aug 14, 2024, 7:32:17 AMAug 14
to Chromium Extensions
Issue with Chrome Extension: New Recipe Window Only Opens When DevTools is Active

I recently encountered an interesting challenge while developing a Chrome extension designed to modify recipes. The extension works in a straightforward manner: users select how they want to modify a recipe, a loading window appears while the modifications are processed, and finally, a new window opens displaying the modified recipe.

However, I ran into a peculiar problem: the new recipe window only opened if the Chrome DevTools were active. If DevTools wasn't open, the window simply wouldn't appear, leaving users with no feedback or results.

In an effort to resolve the issue, I experimented with using Chrome's alarms API to better control the timing of the window opening. The idea was to set up an alarm to trigger the window opening after a specific delay, ensuring that all other processes were complete. Unfortunately, this approach didn’t fully resolve the problem either—the new recipe window still only appeared when DevTools was active.

After some further investigation, I realized that the issue might be related to how the script was being executed and how Chrome handles certain operations depending on the state of the DevTools. While it's tempting to find a way to automatically open DevTools to sidestep the issue, Chrome's security protocols prevent extensions from doing so silently.

To troubleshoot and resolve the problem, I explored several strategies:

  • Ensuring event listeners were properly set up.
  • Adding error handling to catch any silent failures.
  • Using chrome.windows.create for a more reliable window-opening approach.
  • Logging errors using chrome.runtime.lastError to capture any issues without relying on DevTools.

    I would be happy to receive guidance on how to solve the problem, thanks in advance!

Patrick Kettner

unread,
Aug 14, 2024, 12:08:20 PMAug 14
to yuval yehie, Chromium Extensions
In the past, I have seen this happen because the reporter's devtools is set to not load pages from the service worker - can you check if "bypass for network" is checked in the Application tab of devtools?

patrick
--
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/e2a09a97-5246-4697-a955-6a97f571cdb8n%40chromium.org.
Reply all
Reply to author
Forward
0 new messages