Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0 version not work on chrome #471

Merged
merged 6 commits into from
Jun 19, 2024

Conversation

vitonsky
Copy link
Collaborator

@vitonsky vitonsky commented Jun 19, 2024

Closes #468 and #470

The problem

New release 6.0.0 does not work for some chrome users.

Investigation revealed 2 problem:

Config are broken for some users

According to the user report, property appConfig contains only one value.

While debugging been found the root cause of this bug, our config migrations use an async calls for methods in browser.storage.local, but some migrations does not use await keyword, that make possible a race condition where storage value overwrites multiple times in not determined order, so result value is unpredictable.

We did not catch a bug, because tests uses a mocked extensions API from package https://github.com/RickyMarou/jest-webextension-mock where did not implemented a random delays, so our tests did not imitate a case when promises resolves with different delays.

Also, it is important to mention that bug been occurred not for all users, but only for some users (we don't know the numbers, unfortunately). No one my personal PC did not reproduce a bug.

Old chrome versions does not have a constants with reasons for offscreen documents creation

One of user reports contains the error below:

image

User report that environment is "Windows 7 pro and chrome 109 portable".

Even considering legacy OS and browser version, we found that chrome 109 release date is "January 10, 2023" that is only 1.5 years ago, so we should support such browsers when it possible.

It looks the problem here is chrome 109 does not have a dictionary in property chrome.offscreen.Reason.

The solution

The first problem with invalid config is pretty dangerous. Our changes to fix it is:

  • added await keywords in migrations, to prevent a problem for the future
  • implemented mechanism to run some code after migration with "hooks". We implemented hook, to fix broken config after all config migrations, to ensure config will be correct even if previously it been broken. To run this mechanism, we added an empty migration. We did not add the code to migration, because it is not reliable to fix config in migration, since migration must be immutable, but code to validate correct config and object with default config will be changed with a time.
  • updated scripts who configure test environment. Methods of storage object been patched, to add small random delays. We tested behavior and may confirm that bug reproduces with code before changes
  • added tests for call migrations multiple times to catch any possible race conditions in future

For the second problem we replaced constant values to a string literals

@vitonsky vitonsky merged commit 5501c85 into master Jun 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not working.... Background script not responding 6.0 version not work on chrome 126.0.6478.62
1 participant