Navigation Menu

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

Clean up boot process #10271

Merged
merged 15 commits into from Jan 30, 2015
Merged

Clean up boot process #10271

merged 15 commits into from Jan 30, 2015

Conversation

wycats
Copy link
Member

@wycats wycats commented Jan 23, 2015

This refactor improves the clarity and explicitness of the Application boot process. In particular, it takes
advantage of the previous ApplicationInstance refactoring, and explicitly exposes boot phases via promises.

The end-game here is to allow FastBoot to boot up an application but not create an application instance, and allow individual FastBoot requests to create instances on demand via the visit() API.

This will also help the testing infrastructure, which also wants to boot an application once for the entire test suite, and create an instance for each test run.

@@ -256,28 +256,27 @@ var Application = Namespace.extend(DeferredMixin, {
init: function() {
this._super();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this._super.apply(this, arguments);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. This code is not in a change in this commit.

@tomdale
Copy link
Member

tomdale commented Jan 29, 2015

@rwjblue asked for a diagram of this change, thought it might be useful for others.
untitled 3 2015-01-29 11-51-14

Tom Dale and Yehuda Katz and others added 11 commits January 29, 2015 15:51
This is the beginning of a refactor that improves the clarity and
explicitness of the Application boot process. In particular, it takes
advantage of the previous ApplicationInstance refactoring, and
explicitly exposes boot phases via promises.

The end-game here is to allow FastBoot to boot up an application but
not create an application instance, and allow individual FastBoot
requests to create instances on demand.

This will also help the testing infrastructure, which also wants to boot
an application once for the entire test suite, and create an instance
for each test run.
This test had its heart in the right place, but the semantics it
actually exercises are unimportant and simply tested the side-effects
of a previous implementation.

To wit, this test sets the application’s location to `none`, yet still
expects the application’s `rootURL` to be injected on _any_ arbitrary
location looked up via the container.

Under the hood, the router registered a private (dash-prefixed)
injection, so we feel confident we can refactor the internal
implementation without breaking any apps.

In short, this test was testing the side-effects of a private injection,
which we are eliminating, while retaining the public API it supported.
A registry's fallback registry resolves registrations and injections
when no matches can be found.
The instance's registry sets its fallback to the corresponding
application's registry.
Ensure that `name` and `type` are valid after initial parsing and before
any post-parsing mutations might be performed.

This fixes a problem in which mutations are performed to the cached
object (e.g. "route:basic" -> "route:") and then the validation of the
mutated object fail when it's accessed a second time.

It's also more efficient, since validation only occurs once.
@tomdale tomdale changed the title WIP: Clean up boot process Clean up boot process Jan 29, 2015
// decremented by the Application's own `initialize` method.
this._readinessDeferrals = 1;

if (!Ember.FEATURES.isEnabled('ember-application-visit') || this.autoboot) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature flag system cannot handle this properly.

It must be precisely:

if (Ember.FEATURES.isEnabled('ember-application-visit')) {
  /* stuff when enabled */
} else {
  /* stuff when disabled */
}

rwjblue added a commit that referenced this pull request Jan 30, 2015
@rwjblue rwjblue merged commit c84b77d into master Jan 30, 2015
@rwjblue rwjblue deleted the boot-reform branch January 30, 2015 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants