Re: Help finding right place for my questions

Bobby Holley <[email protected]> Sun, 10 Nov 2019 11:06:17 -0800
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <CADa3RMPQodn3d+TOBBCKtOuNBk5xM2AREupK8VPeC87K9V0d2A@mail.gmail.com>
I would suggest having a look at Pyodide for prior art in this space:
https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/

I'm going to assert that the future of python in the browser will involve
targeting WebAssembly, rather than any bespoke python hooks in the browser
engine (the chances of us or any other browser engine accepting patches for
python integration are extremely low). I would highly suggest orienting
your research towards WebAssembly, which is a very promising technology
with substantial runway for new research.

bholley

On Sun, Nov 10, 2019 at 10:33 AM yun bao <[email protected]> wrote:

> I'm still in the initial information gathering phase of my thesis.  So I
> expect my thesis idea (which is admittedly rather vague at this point) to
> change a lot as I learn more about the domain.  However, as I'm applying to
> a graduate program outside of my home country, the application deadline is
> December 1st.  So, I don't have a lot of time to refine the idea.
>
> My original idea was to use as little JavaScript as possible.  At a bare
> minimum, I envision not needing to translate Python to JavaScript in some
> way, which is how most projects I've seen have managed to get Python
> running in a browser.  The long term goal is having a Python engine running
> in a web browser.  So, Python is actually executed as Python (or whatever
> Python is normally executed as under the hood), and not subjected to some
> convoluted process that turns it into JavaScript.
>
> I'm thinking the best Python implementation for use in a browser would be
> PyPy, since it uses JIT compilation.  I'm not sure that the whole of the
> Python standard library will ever be available for use in a browser,
> though.  I think, as a proof of concept, just getting a Python engine
> running in a browser, even if only a small subset of the standard library
> is available, and playing nice with a rendering/layout engine, would be a
> kind of success.
>
> The PyPy folks are currently working on sandboxing PyPy (
> https://pypy.readthedocs.io/en/latest/sandbox.html).  It seems like there
> might be a few research opportunities just in the security related aspects
> of running Python in a browser.
>
> Thank you for your input, Boris.  If you, or anyone else, have any more
> information or advice to share, I'd love to hear it.
>
> Andrew
>
> On Sat, Nov 9, 2019 at 9:55 PM Boris Zbarsky <[email protected]> wrote:
>
> > On 11/9/19 4:16 PM, yun bao wrote:
> > > Right now I'm trying to better understand the general domain and
> > discover if any
> > > there are any well known problems related to making a Python web
> browser
> > > engine.
> >
> > Are you planning to do _just_ Python, or both Python and JavaScript?
> >
> > In the latter case, there is one well-known problem: preventing leaks
> > due to circular object graphs that span both the JS and Python heaps,
> > because the JS garbage collector does not know about the Python side and
> > vice versa.  This was a significant problem for PyXPCOM before we
> > removed it.
> >
> > In both cases, there is the issue that the core Python language is not
> > really what anyone thinks of as "using Python"; people tend to assume
> > that with the language comes the standard library.  And the Python
> > standard library doesn't really have concepts of sandboxing, origins,
> > etc, that the web browser environment relies on for safety.  This means
> > that exposing parts of the standard library without introducing security
> > holes might be complicated, depending on your threat model.
> >
> > There are also various practical issues in terms of the browser
> > internals assuming that objects have JS representations, parts of web
> > APIs actually being very JS-specific (typed arrays, Promises, etc), and
> > other JS dependencies, but the above are the two big conceptual problems
> > I know of that people haven't really found solutions for in the past.
> >
> > -Boris
> > _______________________________________________
> > dev-tech-js-engine mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-tech-js-engine
> >
> _______________________________________________
> dev-tech-js-engine mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>