Skip to content

Commit f85dca2

Browse files
committed
Ensure correct shaping for isDestroy[ing|ed] on CoreObject.
Shaping the prototype is not enough, we should ensure the instance properties are set in the constructor.
1 parent e81233a commit f85dca2

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

packages/ember-runtime/lib/system/core_object.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ var finishPartial = Mixin.finishPartial;
5050
var reopen = Mixin.prototype.reopen;
5151
var hasCachedComputedProperties = false;
5252

53+
const FALSE_DESCRIPTOR = {
54+
configurable: true,
55+
writable: true,
56+
enumerable: false,
57+
value: false
58+
};
59+
5360
function makeCtor() {
5461
// Note: avoid accessing any properties on the object since it makes the
5562
// method a lot faster. This is glue code so we want it to be as fast as
@@ -67,7 +74,18 @@ function makeCtor() {
6774
initProperties = [arguments[0]];
6875
}
6976

77+
this.__defineNonEnumerable({
78+
name: 'isDestroying',
79+
descriptor: FALSE_DESCRIPTOR
80+
});
81+
82+
this.__defineNonEnumerable({
83+
name: 'isDestroyed',
84+
descriptor: FALSE_DESCRIPTOR
85+
});
86+
7087
this.__defineNonEnumerable(GUID_KEY_PROPERTY);
88+
7189
var m = meta(this);
7290
var proto = m.proto;
7391
m.proto = this;

packages/ember/tests/routing/query_params_test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import RSVP from 'ember-runtime/ext/rsvp';
33
import Route from 'ember-routing/system/route';
44
import run from 'ember-metal/run_loop';
55
import get from 'ember-metal/property_get';
6-
import EmberObject from 'ember-runtime/system/object';
76
import isEnabled from 'ember-metal/features';
87
import { computed } from 'ember-metal/computed';
98
import { compile } from 'ember-template-compiler/tests/utils/helpers';
@@ -2551,11 +2550,11 @@ if (isEnabled('ember-routing-route-configured-query-params')) {
25512550

25522551
let indexModelCount = 0;
25532552
App.IndexRoute = Route.extend({
2554-
queryParams: EmberObject.create({
2553+
queryParams: {
25552554
unknownProperty(keyName) {
25562555
return { refreshModel: true };
25572556
}
2558-
}),
2557+
},
25592558
model(params) {
25602559
indexModelCount++;
25612560

@@ -2745,12 +2744,12 @@ if (isEnabled('ember-routing-route-configured-query-params')) {
27452744
});
27462745

27472746
App.ApplicationRoute = Route.extend({
2748-
queryParams: EmberObject.create({
2747+
queryParams: {
27492748
unknownProperty(keyName) {
27502749
// We are simulating all qps requiring refresh
27512750
return { replace: true };
27522751
}
2753-
})
2752+
}
27542753
});
27552754

27562755
bootApplication();

0 commit comments

Comments
 (0)