diff --git a/AppKit/CPImage.j b/AppKit/CPImage.j index 32571acd4..3774af6c5 100644 --- a/AppKit/CPImage.j +++ b/AppKit/CPImage.j @@ -28,6 +28,9 @@ @import "CPGeometry.j" +#include "Platform/DOM.h" + + CPImageLoadStatusInitialized = 0; CPImageLoadStatusLoading = 1; CPImageLoadStatusCompleted = 2; @@ -258,6 +261,7 @@ function CPAppKitImage(aFilename, aSize) _loadStatus = CPImageLoadStatusLoading; +#if PLATFORM(DOM) _image = new Image(); var isSynchronous = YES; @@ -304,6 +308,7 @@ function CPAppKitImage(aFilename, aSize) // onload and friends may fire after this point but BEFORE the end of the run loop, // crazy, I know. So don't set isSynchronous here, rather wait a bit longer. window.setTimeout(function() { isSynchronous = NO; }, 0); +#endif } - (BOOL)isThreePartImage diff --git a/Objective-J/Executable.js b/Objective-J/Executable.js index 7902dede8..8ac69954a 100644 --- a/Objective-J/Executable.js +++ b/Objective-J/Executable.js @@ -138,26 +138,31 @@ Executable.prototype.setCode = function(code) { this._code = code; -#if COMMONJS - code = "function(" + this.functionParameters().join(" , ") + "){" + code + "/**/\n}"; + var parameters = this.functionParameters().join(","); +#if COMMONJS if (typeof system !== "undefined" && system.engine === "rhino") + { + code = "function(" + parameters + "){" + code + "/**/\n}"; this._function = Packages.org.mozilla.javascript.Context.getCurrentContext().compileFunction(window, code, this._scope, 0, NULL); + } else - this._function = eval("(" + code + ")"); -#else + { +#endif // "//@ sourceURL=" at the end lets us name our eval'd files for debuggers, etc. // * WebKit: http://pmuellr.blogspot.com/2009/06/debugger-friendly.html // * Firebug: http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/ //if (YES) { code += "/**/\n//@ sourceURL=" + this._scope; - this._function = new Function(this.functionParameters(), code); + this._function = new Function(parameters, code); //} else { // // Firebug only does it for "eval()", not "new Function()". Ugh. Slower. // var functionText = "(function(){"+GET_CODE(aFragment)+"/**/\n})\n//@ sourceURL="+GET_FILE(aFragment).path; // compiled = eval(functionText); //} this._function.displayName = this._scope; +#if COMMONJS + } #endif }