brython-dev / brython

Brython (Browser Python) is an implementation of Python 3 running in the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error getting attribute DOMEvent.data, in iOS browsers with iOS<16.0

benjie-git opened this issue · comments

In my main app and web workers, I bind the 'message' event to a method, and get the event's data attribute. This works on Chrome, and the latest Safari, but as of recent brython, this no longer works in older iOS browsers (all of which are WebKit/Safari based).

I try to run:

    def OnMessage(self, evt):
        data = evt.data  # This crashes
        ...

I get a ReferenceError: Can't find variable: Worker coming from py_dom.js: line 354

            }else if(ev.target instanceof Worker){

when I change this line to:

            }else if(typeof Worker !== 'undefined' && ev.target instanceof Worker){

then it works again in older iOS Safari browsers.

Thanks Ben !