You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happens is that embed.js calls insertScript to get all the gli code in, but that code is not synchronous.
Later on, embed.js monkey-patches the HTMLCanvasElement prototype's getContext and introduces a reference to the gli variable.
If someone decides to create a context before gli.all.js has loaded, the gli resolves to null, and the block in lines 116--119 will always throw exceptions. No contexts ever created! :(
There doesn't seem to be a simple way to solve this besides. Perhaps getContext should throw a special "come back later" exception?
Fundamentally, it's not enough to assume that embed.js was included before anything else, because script tag insertion is async.
The text was updated successfully, but these errors were encountered:
I think there's a race condition in embed.js.
What happens is that embed.js calls
insertScript
to get all thegli
code in, but that code is not synchronous.Later on, embed.js monkey-patches the
HTMLCanvasElement
prototype'sgetContext
and introduces a reference to thegli
variable.If someone decides to create a context before
gli.all.js
has loaded, thegli
resolves to null, and the block in lines 116--119 will always throw exceptions. No contexts ever created! :(There doesn't seem to be a simple way to solve this besides. Perhaps
getContext
should throw a special "come back later" exception?Fundamentally, it's not enough to assume that
embed.js
was included before anything else, because script tag insertion is async.The text was updated successfully, but these errors were encountered: