numbas / numbas-extension-programming

An extension for Numbas which provides a code editor and the ability to evaluate code written in Python and R.
Apache License 2.0
3 stars 1 forks source link

Field declaration error in Safari (Version 13.0.5) #8

Closed chrismgraham closed 2 years ago

chrismgraham commented 2 years ago

In programming.js at the start of the CodeRunner class

class CodeRunner {
   queue = Promise.resolve();

The public field declaration of queue seems to not be supported by Safari before v14.1.

I had a blind stab, moving it inside the constructor on the next line

class CodeRunner {

   constructor() {

      this.queue = Promise.resolve();
       ...

which gets past the error, but raises another on line 13 of pyodide_worker.js ("Unhandled Promise Rejection: TypeError: undefined is not a constructor").

I stopped there as I don't know what I'm doing and not clear if that error was a result of my previous fix!

christianp commented 2 years ago

Public class fields are only supported in Safari from 14.1.

The error in pyodide_worker.js was due to WebAssembly.Global only being supported in Safari from 13.1, which Pyodide documents in their section on supported browsers.