fastboot icon indicating copy to clipboard operation
fastboot copied to clipboard

Support Prototype Extensions

Open hjdivad opened this issue 7 years ago • 5 comments

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).

hjdivad avatar Oct 17 '17 13:10 hjdivad

I'm not familiar enough with the internals to be sure, but I imagine the rough todo is something like

  1. add a _visitRoute function to the sandbox context. This function would roughly do the work of buildAppInstance and visitRoute today (ie build the application instance and visit the route)

  2. change visitRoute to invoke _visitRoute on the sandbox.

hjdivad avatar Oct 17 '17 13:10 hjdivad

Yes, that path forward seems correct to me.

@kratiahuja - Does that look right to you also?

rwjblue avatar Oct 17 '17 13:10 rwjblue

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.

kratiahuja avatar Oct 17 '17 13:10 kratiahuja

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 avatar Jan 22 '19 02:01 kratiahuja

@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...

rwjblue avatar Oct 26 '19 02:10 rwjblue