diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index 392a8c98c7..c9d40dd0ab 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -46,7 +46,6 @@ define( var key = extension.key, dependencies = extension.depends || []; - if (!key) { $log.warn([ "Cannot register ", diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index 86eb657f35..126b9ab3f9 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -44,13 +44,20 @@ define( implPromise = loader.load(implPath), definition = extension.getDefinition(); + // Wrap a constructor function (to avoid modifying the original) + function constructorFor(impl) { + function Constructor() { + return impl.apply(this, arguments); + } + Constructor.prototype = impl.prototype; + return Constructor; + } + // Attach values from the object definition to the // loaded implementation. function attachDefinition(impl) { var result = (typeof impl === 'function') ? - function () { - return impl.apply({}, arguments); - } : + constructorFor(impl) : Object.create(impl); // Copy over static properties