diff --git a/packages/ember-application/lib/system/application-instance.js b/packages/ember-application/lib/system/application-instance.js index d957ff914e5..2f820ceb83f 100644 --- a/packages/ember-application/lib/system/application-instance.js +++ b/packages/ember-application/lib/system/application-instance.js @@ -4,10 +4,7 @@ import { assign } from 'ember-utils'; import { get, set, run, computed } from 'ember-metal'; -import { - buildFakeRegistryWithDeprecations, - RSVP -} from 'ember-runtime'; +import { RSVP } from 'ember-runtime'; import { environment } from 'ember-environment'; import { jQuery } from 'ember-views'; import EngineInstance from './engine-instance'; @@ -487,12 +484,4 @@ BootOptions.prototype.toEnvironment = function() { return env; }; -Object.defineProperty(ApplicationInstance.prototype, 'registry', { - configurable: true, - enumerable: false, - get() { - return buildFakeRegistryWithDeprecations(this, 'ApplicationInstance'); - } -}); - export default ApplicationInstance; diff --git a/packages/ember-application/lib/system/application.js b/packages/ember-application/lib/system/application.js index 3581852c46a..d37042ba6a0 100644 --- a/packages/ember-application/lib/system/application.js +++ b/packages/ember-application/lib/system/application.js @@ -15,7 +15,6 @@ import { setNamespaceSearchDisabled, runLoadHooks, _loaded, - buildFakeRegistryWithDeprecations, RSVP } from 'ember-runtime'; import { EventDispatcher, jQuery } from 'ember-views'; @@ -978,14 +977,6 @@ const Application = Engine.extend({ } }); -Object.defineProperty(Application.prototype, 'registry', { - configurable: true, - enumerable: false, - get() { - return buildFakeRegistryWithDeprecations(this, 'Application'); - } -}); - Application.reopenClass({ /** This creates a registry with the default Ember naming conventions. diff --git a/packages/ember-application/tests/system/application_instance_test.js b/packages/ember-application/tests/system/application_instance_test.js index 06843a9a666..bd953f37c2e 100644 --- a/packages/ember-application/tests/system/application_instance_test.js +++ b/packages/ember-application/tests/system/application_instance_test.js @@ -35,30 +35,6 @@ QUnit.test('an application instance can be created based upon an application', f equal(appInstance.application, application, 'application should be set to parent'); }); -QUnit.test('properties (and aliases) are correctly assigned for accessing the container and registry', function() { - expect(6); - - appInstance = run(() => ApplicationInstance.create({ application })); - - ok(appInstance, 'instance should be created'); - ok(appInstance.__container__, '#__container__ is accessible'); - ok(appInstance.__registry__, '#__registry__ is accessible'); - - // stub with a no-op to keep deprecation test simple - appInstance.__container__.lookup = function() { - ok(true, '#loookup alias is called correctly'); - }; - - ok(typeof appInstance.registry.register === 'function', '#registry.register is available as a function'); - appInstance.__registry__.register = function() { - ok(true, '#register alias is called correctly'); - }; - - expectDeprecation(() => { - appInstance.registry.register(); - }, /Using `ApplicationInstance.registry.register` is deprecated. Please use `ApplicationInstance.register` instead./); -}); - QUnit.test('customEvents added to the application before setupEventDispatcher', function(assert) { assert.expect(1); diff --git a/packages/ember-application/tests/system/application_test.js b/packages/ember-application/tests/system/application_test.js index f5cd501f3ab..3437abb871b 100644 --- a/packages/ember-application/tests/system/application_test.js +++ b/packages/ember-application/tests/system/application_test.js @@ -111,20 +111,6 @@ moduleFor('Ember.Application, autobooting multiple apps', class extends Applicat moduleFor('Ember.Application', class extends ApplicationTestCase { - ['@test includes deprecated access to `application.registry`'](assert) { - assert.expect(3); - - assert.ok(typeof this.application.registry.register === 'function', '#registry.register is available as a function'); - - this.application.__registry__.register = function() { - assert.ok(true, '#register alias is called correctly'); - }; - - expectDeprecation(() => { - this.application.registry.register(); - }, /Using `Application.registry.register` is deprecated. Please use `Application.register` instead./); - } - [`@test builds a registry`](assert) { let {application} = this; assert.strictEqual(application.resolveRegistration('application:main'), application, `application:main is registered`); diff --git a/packages/ember-runtime/lib/index.js b/packages/ember-runtime/lib/index.js index cf1a29f730d..460da5b29a7 100644 --- a/packages/ember-runtime/lib/index.js +++ b/packages/ember-runtime/lib/index.js @@ -2,7 +2,6 @@ export { default as Object, FrameworkObject } from './system/object'; export { default as String } from './system/string'; export { default as RegistryProxyMixin, - buildFakeRegistryWithDeprecations } from './mixins/registry_proxy'; export { default as ContainerProxyMixin diff --git a/packages/ember-runtime/lib/mixins/registry_proxy.js b/packages/ember-runtime/lib/mixins/registry_proxy.js index f9a452135ac..0d5fce85f11 100644 --- a/packages/ember-runtime/lib/mixins/registry_proxy.js +++ b/packages/ember-runtime/lib/mixins/registry_proxy.js @@ -5,7 +5,6 @@ import { Mixin } from 'ember-metal'; -import { deprecate } from 'ember-debug'; /** RegistryProxyMixin is used to provide public access to specific @@ -243,40 +242,3 @@ function registryAlias(name) { return this.__registry__[name](...arguments); }; } - -export function buildFakeRegistryWithDeprecations(instance, typeForMessage) { - let fakeRegistry = {}; - let registryProps = { - resolve: 'resolveRegistration', - register: 'register', - unregister: 'unregister', - has: 'hasRegistration', - option: 'registerOption', - options: 'registerOptions', - getOptions: 'registeredOptions', - optionsForType: 'registerOptionsForType', - getOptionsForType: 'registeredOptionsForType', - injection: 'inject' - }; - - for (let deprecatedProperty in registryProps) { - fakeRegistry[deprecatedProperty] = buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, registryProps[deprecatedProperty]); - } - - return fakeRegistry; -} - -function buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, nonDeprecatedProperty) { - return function() { - deprecate( - `Using \`${typeForMessage}.registry.${deprecatedProperty}\` is deprecated. Please use \`${typeForMessage}.${nonDeprecatedProperty}\` instead.`, - false, - { - id: 'ember-application.app-instance-registry', - until: '3.0.0', - url: 'https://emberjs.com/deprecations/v2.x/#toc_ember-application-registry-ember-applicationinstance-registry' - } - ); - return instance[nonDeprecatedProperty](...arguments); - }; -}