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

#4058: fix race condition on tab load #4061

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Aug 18, 2022

What does this PR do?

Discussion

  • @fregante there's still a race in the init() method. If you put a await sleep(1000) as the first line init method, you'll see that you still get the error. That's because the __getTabData method is loading synchronously with the module load, while the registerMessenger is running async.
  • I think we need to be able explicitly set the messenger as "ready". Otherwise you'll always run into race conditions with: 1) message registration, 2) brick registration, 3) other content script initialization, etc.

Coordination

@codecov-commenter
Copy link

Codecov Report

Merging #4061 (5323be2) into main (b6180c8) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main    #4061   +/-   ##
=======================================
  Coverage   47.85%   47.85%           
=======================================
  Files         868      868           
  Lines       25872    25872           
  Branches     5361     5361           
=======================================
  Hits        12380    12380           
  Misses      12560    12560           
  Partials      932      932           
Impacted Files Coverage Δ
src/contentScript/contentScript.ts 0.00% <0.00%> (ø)
src/contentScript/contentScriptCore.ts 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@fregante fregante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's still a race in the init() method

Yes that’s why I suggested that this solution was temporary. I'd probably revert this PR in full once the issue is avoided at the root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants