CWS Updates: requestUpdateCheck + reload Behavior

77 views
Skip to first unread message

Gokulan Gnanendran

unread,
Sep 1, 2024, 4:28:08 PMSep 1
to Chromium Extensions
Hey team, 

I have an extension that communicates with backend services which may require the extension to be updated to a certain version. I am using the strategy described in the `chrome.runtime.requestUpdateCheck()` documentation here:

  • When the extension detects that it is out-of-date, it shows the user an update prompt.
  • When the user clicks the button on the prompt, the handler calls `requestUpdateCheck`. 
  • If `requestUpdateCheck` reports that `update_available`, then the extension calls `chrome.runtime.reload()`.
  • After the update is installed, the extension performs some setup work in response to the `onInstalled` event in the background script.

This normally works fine. However, while testing (via a beta extension), I noticed that the extension was not updated after calling `chrome.runtime.reload()` even though `requestUpdateCheck` reported that an update (with the expected `available_version`) was available. Note: I have been facilitating testing by rolling back builds while bumping the build number.

I have a few questions around this:
  • Did this occur due to how I've been testing?
    • Are my updates potentially too frequent?
  • Is there a way to simulate CWS extension updates?
  • Is there a way to ensure that an update will occur before calling chrome.runtime.reload()?
  • Is there an existing way to detect that a `chrome.runtime.reload()` has occurred?
    • I'd use this instead of onInstalled.
Let me know if you have any questions or have any alternate suggestions!

Thanks,
Goki

Reply all
Reply to author
Forward
0 new messages