From c68ea416607fa33732ac94f93fc2edb43055d675 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Fri, 14 Apr 2017 14:31:19 -0700 Subject: [PATCH 1/2] =?UTF-8?q?[BUGFIX=20release]=20Don=E2=80=99t=20leak?= =?UTF-8?q?=20container=20while=20injection=20deprecated=20container?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/container/lib/container.js | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/packages/container/lib/container.js b/packages/container/lib/container.js index b95b3850ce1..8c34bea889d 100644 --- a/packages/container/lib/container.js +++ b/packages/container/lib/container.js @@ -527,25 +527,28 @@ function factoryInjectionsFor(container, fullName) { return factoryInjections; } -// TODO - remove when Ember reaches v3.0.0 -function injectDeprecatedContainer(object, container) { - if ('container' in object) { return; } - Object.defineProperty(object, 'container', { - configurable: true, - enumerable: false, - get() { - deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); - return this[CONTAINER_OVERRIDE] || container; - }, +const INJECTED_DEPRECATED_CONTAINER_DESC = { + configurable: true, + enumerable: false, + get() { + deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); + return this[CONTAINER_OVERRIDE]; + }, - set(value) { - deprecate(`Providing the \`container\` property to ${this} is deprecated. Please use \`Ember.setOwner\` or \`owner.ownerInjection()\` instead to provide an owner to the instance being created.`, false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); + set(value) { + deprecate(`Providing the \`container\` property to ${this} is deprecated. Please use \`Ember.setOwner\` or \`owner.ownerInjection()\` instead to provide an owner to the instance being created.`, false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); - this[CONTAINER_OVERRIDE] = value; + this[CONTAINER_OVERRIDE] = value; - return value; - } - }); + return value; + } +}; + +// TODO - remove when Ember reaches v3.0.0 +function injectDeprecatedContainer(object, container) { + if ('container' in object) { return; } + Object.defineProperty(object, 'container', INJECTED_DEPRECATED_CONTAINER_DESC); + object[CONTAINER_OVERRIDE] = container; } function destroyDestroyables(container) { From e95112888464823ebbd91f368a667e24fff19ce2 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Fri, 14 Apr 2017 14:37:01 -0700 Subject: [PATCH 2/2] cleanup docs --- packages/container/lib/container.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/container/lib/container.js b/packages/container/lib/container.js index 8c34bea889d..4d4a882adfc 100644 --- a/packages/container/lib/container.js +++ b/packages/container/lib/container.js @@ -45,41 +45,30 @@ export default function Container(registry, options) { } Container.prototype = { - /** - @private - @property owner - @type Object - */ - owner: null, - /** @private @property registry @type Registry @since 1.11.0 */ - registry: null, /** @private @property cache @type InheritingDict */ - cache: null, /** @private @property factoryCache @type InheritingDict */ - factoryCache: null, /** @private @property validationCache @type InheritingDict */ - validationCache: null, /** Given a fullName return a corresponding instance.