Changed #define from RHINO to COMMONJS. Re-enabled recently added document-load-waiting.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2010-01-27 03:58:49 -08:00
parent a64a270e25
commit fcfeb29be5
4 changed files with 37 additions and 7 deletions
+26 -4
View File
@@ -13,11 +13,33 @@ rootNode.resolveSubPath(cwd, StaticResourceNode.DirectoryType, function(cwdNode)
for (; index < count; ++index)
cwdNode.nodeAtSubPath(FILE.normal(includePaths[index]), YES);
#ifndef RHINO
#ifdef BROWSER
OBJJ_MAIN_FILE = "main.j";
fileImporterForPath(FILE.join(cwd, "main.j"))("main.j", YES, function()
{
console.log(rootNode.toString(true));
console.log("done.");
afterDocumentLoad(main);
});
#endif
});
});
#ifdef BROWSER
function afterDocumentLoad(/*Function*/ aFunction)
{
if (documentLoaded)
return aFunction();
if (window.addEventListener)
window.addEventListener("load", aFunction, false);
else if (window.attachEvent)
window.attachEvent("onload", aFunction);
}
var documentLoaded = NO;
afterDocumentLoad(function()
{
documentLoaded = YES;
});
#endif
+2 -2
View File
@@ -43,8 +43,8 @@ function Executable(/*String*/ aCode, /*Array*/ fileDependencies, /*String*/ aSc
var code = this._code;
#if RHINO
code = "function(\"" + this.functionParameters().join("\",\"" + "\"){" + code + "/**/\n}";
#if COMMONJS
code = "function(" + this.functionParameters().join(" , ") + "){" + code + "/**/\n}";
if (typeof system !== "undefined" && system.engine === "rhino")
this._function = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, code, this._scope, 0, null);
+5 -1
View File
@@ -88,7 +88,11 @@ CLOBBER.include($BUILD_OBJECTIVE_J);
function environmentFlags()
{
return "-DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
return Array.prototype.map.apply(arguments, [function(anEnvironment)
{
return "-D" + anEnvironment.toUpperCase();
}]).join(" ") +
" -DENVIRONMENTS=\"[" + Array.prototype.map.apply(arguments, [function(anEnvironment) {
return "\\\"" + anEnvironment + "\\\"";
}]).join(", ") + "]\"";
}
+4
View File
@@ -114,10 +114,14 @@ function fileImporterForPath(/*String*/ referencePath)
fileExecutable.addEventListener("dependenciesload", function()
{
fileExecuter(aPath, isLocal);
aCallback();
});
}
else
{
fileExecuter(aPath, isLocal);
aCallback();
}
}
if (fileExecutableSearch.isComplete())