Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4369)

Unified Diff: chrome/renderer/resources/require.js

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile errors Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/require.js
diff --git a/chrome/renderer/resources/require.js b/chrome/renderer/resources/require.js
index 34f3543a432fe5bcd2348aaf24c2e3b270b0eff9..ad865a7bf69db5b0f438ae0111a594f56b25c38e 100644
--- a/chrome/renderer/resources/require.js
+++ b/chrome/renderer/resources/require.js
@@ -34,7 +34,7 @@ ModuleLoader.prototype.run = function(id) {
return null;
}
var wrappedSource = wrap(source);
Aaron Boodman 2012/03/01 07:24:26 Unless v8 does something fancy internally, it seem
Aaron Boodman 2012/03/01 07:30:32 I feel pretty strongly that the right answer here
koz (OOO until 15th September) 2012/03/02 01:13:58 As discussed, I've reimplemented with "new Functio
- var f = bootstrap.Run(wrappedSource);
+ var f = bootstrap.Run(wrappedSource, id);
var exports = {};
f(require, requireNative, exports);
return exports;
@@ -53,7 +53,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) {

Powered by Google App Engine
This is Rietveld 408576698