Support Prototype Extensions
fastboot currently builds the application instance outside of the vm from within visitRoute
visitRoute currently utilizies the sandbox indirectly, via this.app which is created from an app factory returned from the sandbox.
If, instead, visitRoute delegated its work to a function run within the sandbox context, prototype extensions would work (or at least an impediment to their working would be removed).
I'm not familiar enough with the internals to be sure, but I imagine the rough todo is something like
-
add a
_visitRoutefunction to the sandbox context. This function would roughly do the work ofbuildAppInstanceandvisitRoutetoday (ie build the application instance and visit the route) -
change
visitRouteto invoke_visitRouteon the sandbox.
Yes, that path forward seems correct to me.
@kratiahuja - Does that look right to you also?
Yes, we would also need to make sure the FastBoot result is outside the sandbox so that we can serialize and send the template.
But otherwise at high level it looks correct to me. I'll try finding the branch where I started some of this work last year.
Ok, so I did a spike of the above proposed option. However, prototype extensions still don't work in one usecase: When I define something outside of the sandbox (example sandboxGlobals) and access it inside the sandbox, it still does not work. Therefore it will still not work when a communication happens through najax. I believe this is how node releams work.
I can put out a PR otherwise but the above usecase will still not work.
@kratiahuja - I'm curious if you still have that WIP spike laying around locally. I'd be happy to dust it off and see about pushing it forward...