| Index: chrome/renderer/resources/require.js
|
| diff --git a/chrome/renderer/resources/require.js b/chrome/renderer/resources/require.js
|
| index 34f3543a432fe5bcd2348aaf24c2e3b270b0eff9..7108616d7b5252285ec1ab9a86abc9b8d7cee78d 100644
|
| --- a/chrome/renderer/resources/require.js
|
| +++ b/chrome/renderer/resources/require.js
|
| @@ -15,15 +15,9 @@
|
| //
|
| // |bootstrap| contains the following fields:
|
| // - GetSource(module): returns the source code for |module|
|
| -// - Run(source): runs the string os JS |source|
|
| // - GetNative(nativeName): returns the named native object
|
| (function(bootstrap) {
|
|
|
| -function wrap(source) {
|
| - return "(function(require, requireNative, exports) {" + source +
|
| - "\n})";
|
| -}
|
| -
|
| function ModuleLoader() {
|
| this.cache_ = {};
|
| };
|
| @@ -33,9 +27,8 @@ ModuleLoader.prototype.run = function(id) {
|
| if (!source) {
|
| return null;
|
| }
|
| - var wrappedSource = wrap(source);
|
| - var f = bootstrap.Run(wrappedSource);
|
| var exports = {};
|
| + var f = new Function("require", "requireNative", "exports", source);
|
| f(require, requireNative, exports);
|
| return exports;
|
| };
|
| @@ -53,7 +46,11 @@ ModuleLoader.prototype.load = function(id) {
|
| var moduleLoader = new ModuleLoader();
|
|
|
| function requireNative(nativeName) {
|
| - return bootstrap.GetNative(nativeName);
|
| + var result = bootstrap.GetNative(nativeName);
|
| + if (!result) {
|
| + throw "No such native object: '" + nativeName + "'";
|
| + }
|
| + return result;
|
| }
|
|
|
| function require(moduleId) {
|
|
|