Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Dec 21, 2020

Fixes #4813
Follow up to #4678

Safari does not support the CSP "worker-src" directive, so it failed to create the worker, which caused Talk to fail to load. Now the worker will be loaded only when needed (so only in Chromium), and even if the worker fails to load everything will keep going (a synchronous blurrer will be used instead of the asynchronous one from the worker).

Besides that the CSP "child-src" directive was added too as it is supported by Safari and it is used as a fallback when "worker-src" is not available. Given that Safari does not use the worker and that even if the worker fails to load it will not affect Talk load this is not really needed, but it should prevent a "scary" message in the browser logs. Replaced by a lazy loading of the worker, which should cause the worker to not be loaded in Safari.

Pending:

  • Test with Safari
    • While testing this it has been found that, all of a sudden, Safari seems to have the same performance issue with the blur filter as Chromium 🤷 But unlike Chromium it does not support filters on canvases, so the same fix can not be applied to it too... But why did it appear all of a sudden? This needs more investigation. - We were not able to find if the issue was there in previous versions or if it is a regression in Safari 14. In any case, this pull request fixes the blank page; fixing the performance hit is something for later.
  • Test with Edge (before and after being based on Chromium; I tried, but my virtual machine was not cooperating... Still uncooperative, but with a lot of patience I was able to test it...) - This pull request does not break anything in Edge. There are broken things, but they are not caused by this pull request :-P

Future:

Until now it was assumed that loading the image blurrer worker would not
fail. However, if the browser does not support the CSP "worker-src"
directive (like Safari) trying to load the worker would throw an
exception which would interrupt the load of Talk itself. Now the
exception is caught and logged instead, and the image blurrer reverts to
a synced generation if no worker is available (although that should not
happen, as the image blurrer is used only on Chromium and Chromium
supports the "worker-src" directive).

Note that Firefox does not throw an exception when loading a worker if
not allowed by the CSP. Moreover, as the worker object is created, it
does not seem to be possible to know if the worker is actually not
available. This is not a problem, though; the image blurrer is not used
on Firefox, and even if it was Firefox supports the "worker-src"
directive.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The image blurrer worker now is loaded only when it is actually needed,
so this should prevent the worker to be loaded on browsers other than
Chromium, as well as on Chromium if no call is joined.

This indirectly fixes the CSP error shown in Safari when the worker was
loaded (as the worker is no longer loaded now in Safari) due to Safari
not supporting the "worker-src" directive but requiring "child-src" to
be used instead.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu force-pushed the fix-loading-worker-on-browsers-without-csp-worker-src-directive branch from bcb6151 to 8a6e439 Compare December 21, 2020 13:01
@danxuliu
Copy link
Member Author

/backport to stable20.1

@danxuliu
Copy link
Member Author

/backport to stable20

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

🐘 Seems to work for Morris

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Works fine 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Talk 10.0.4 Stoped working for safari and mobile browsers (Safari/Firefox/Chrome for iOS and Firefox for Android)

4 participants