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

cssmanager: Refactor CSS manager creation to avoid race condition #4963

Merged
merged 5 commits into from
Mar 20, 2021

Conversation

rhansen
Copy link
Member

@rhansen rhansen commented Mar 20, 2021

Multiple commits:

  • cssmanager: Simplify iteration over style sheets
  • cssmanager: Throw if no matching style sheet is found
  • Ace2Inner: Promisify init()
  • pad_editor: Promisify init()
  • cssmanager: Refactor CSS manager creation to avoid race condition

Fixes #4961

cc @webzwo0i

This avoids a later null dereference when the stack trace isn't as
useful.
Safari takes a while to initialize `document.styleSheets`, which
results in a race condition when loading the pad. Avoid the race
condition by accessing the CSSStyleSheet objects directly from the
HTMLStyleElement DOM objects.
@JohnMcLear
Copy link
Member

Looks good to me! Thanks!

@JohnMcLear JohnMcLear merged commit 3ad1d0a into develop Mar 20, 2021
@JohnMcLear JohnMcLear deleted the rhansen-cssmanager branch March 20, 2021 01:07
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.

TypeError: null is not an object (evaluating 'browserSheet.insertRule')
2 participants