Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to use a single sandboxed context per visit request. #236

Merged
merged 10 commits into from
Oct 30, 2019

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Oct 26, 2019

  • Make a vm.createContext per visit
  • Remove the ability to provide a custom sandbox class (we can always
    add this back if needed, but the complexity it adds seems quite high
    and very very few (if any) folks use it).
  • Ensure the scripts bytecode is shared between visit requests.
  • Various internal refactors to simplify things as we went.

Co-authored-by: @krisselden


TODO:

Follow-up TODO:


Closes #241
Closes #242

src/ember-app.js Outdated Show resolved Hide resolved
src/ember-app.js Outdated Show resolved Hide resolved
src/ember-app.js Outdated Show resolved Hide resolved
@rwjblue rwjblue force-pushed the build-vm-context-per-visit branch 2 times, most recently from f90d10a to 85f0392 Compare October 30, 2019 18:41
rwjblue and others added 7 commits October 30, 2019 16:12
Co-authored-by: Kris Selden <kselden@linkedin.com>
Co-authored-by: Kris Selden <kselden@linkedin.com>
Avoid reevaluating the app files and vendor files from scratch for each
visit request.

Co-authored-by: Kris Selden <kselden@linkedin.com>
…nce`)

* Collapse `createEmberApp` into `buildApp` (since we are no longer
  separating the concepts of `Ember.Application` vs
  `Ember.ApplicationInstance`)
* Stash the `Ember.Application` instance (along with the
  `Ember.ApplicationInstance` instance) after creation, for destruction
  later
* Ensure destruction of both `Ember.Application` and
  `Ember.ApplicationInstance` occur when the `visit` has completed.
This helps ensure that if the dist files themselves are invalid, we fail
fast (e.g. before the first `fastboot.visit()` invocation).
src/ember-app.js Outdated Show resolved Hide resolved
@kratiahuja
Copy link
Contributor

@rwjblue Thanks for making these changes, these look good to me except the two questions above.

…t requests.

This shows that mutating the prototype of an object used in multiple
requests, leaks that mutation.
@rwjblue rwjblue changed the title Refactor to use a single vm context per visit request. Refactor to use a single sandboxed context per visit request. Oct 30, 2019
@rwjblue rwjblue merged commit cf0f451 into ember-fastboot:master Oct 30, 2019
@rwjblue rwjblue deleted the build-vm-context-per-visit branch October 30, 2019 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants