diff --git a/angularFiles.js b/angularFiles.js index 9603c289abd8..9aa2ef7eda22 100755 --- a/angularFiles.js +++ b/angularFiles.js @@ -66,6 +66,7 @@ angularFiles = { ], 'angularLoader': [ + 'src/minErr.js', 'src/loader.js' ], diff --git a/src/loader.js b/src/loader.js index 0560595d5082..b8d509175fc9 100644 --- a/src/loader.js +++ b/src/loader.js @@ -11,6 +11,7 @@ function setupModuleLoader(window) { var $injectorMinErr = minErr('$injector'); + var ngMinErr = minErr('ng'); function ensure(obj, name, factory) { return obj[name] || (obj[name] = factory()); @@ -71,6 +72,12 @@ function setupModuleLoader(window) { * @returns {module} new module with the {@link angular.Module} api. */ return function module(name, requires, configFn) { + var assertNotHasOwnProperty = function(name, context) { + if (name === 'hasOwnProperty') { + throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context); + } + }; + assertNotHasOwnProperty(name, 'module'); if (requires && modules.hasOwnProperty(name)) { modules[name] = null; diff --git a/src/loader.prefix b/src/loader.prefix index 3ab7dd06e4fe..3da8da2719a8 100644 --- a/src/loader.prefix +++ b/src/loader.prefix @@ -4,4 +4,4 @@ * License: MIT */ 'use strict'; -( +(function() { diff --git a/src/loader.suffix b/src/loader.suffix index b8a5d43dc726..d74135ea1638 100644 --- a/src/loader.suffix +++ b/src/loader.suffix @@ -1,4 +1,5 @@ -)(window); +setupModuleLoader(window); +})(window); /** * Closure compiler type information