You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Matthew Baxter-Reynolds (JIRA)" <ji...@apache.org> on 2012/10/18 11:26:03 UTC

[jira] [Created] (CB-1673) "cordova.windows8-debug.js" fails to load because of improperly escaped backslashes

Matthew Baxter-Reynolds created CB-1673:
-------------------------------------------

             Summary: "cordova.windows8-debug.js" fails to load because of improperly escaped backslashes
                 Key: CB-1673
                 URL: https://issues.apache.org/jira/browse/CB-1673
             Project: Apache Cordova
          Issue Type: Bug
          Components: Windows 8
            Reporter: Matthew Baxter-Reynolds
            Assignee: Jesse MacFadyen


This line:

In the jake'd build, this line is (#107) is coming up with an error...

try {eval("define(\"cordova/utils\", function(require, exports, module) {\n\nvar utils = exports;\n\n/**\n * Defines a property getter for obj[key].\n */\nutils.defineGetter = function(obj, key, func) {\n    if (Object.defineProperty) {\n        Object.defineProperty(obj, key, { get: func });\n    } else {\n        obj.__defineGetter__(key, func);\n    }\n};\n\n/**\n * Returns an indication of whether the argument is an array or not\n */\nutils.isArray = function(a) {\n    return Object.prototype.toString.call(a) == '[object Array]';\n};\n\n/**\n * Returns an indication of whether the argument is a Date or not\n */\nutils.isDate = function(d) {\n    return Object.prototype.toString.call(d) == '[object Date]';\n};\n\n/**\n * Does a deep clone of the object.\n */\nutils.clone = function(obj) {\n    if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') {\n        return obj;\n    }\n\n    var retVal, i;\n\n    if(utils.isArray(obj)){\n        retVal = [];\n        for(i = 0; i < obj.length; ++i){\n            retVal.push(utils.clone(obj[i]));\n        }\n        return retVal;\n    }\n\n    retVal = {};\n    for(i in obj){\n        if(!(i in retVal) || retVal[i] != obj[i]) {\n            retVal[i] = utils.clone(obj[i]);\n        }\n    }\n    return retVal;\n};\n\n/**\n * Returns a wrapped version of the function\n */\nutils.close = function(context, func, params) {\n    if (typeof params == 'undefined') {\n        return function() {\n            return func.apply(context, arguments);\n        };\n    } else {\n        return function() {\n            return func.apply(context, params);\n        };\n    }\n};\n\n/**\n * Create a UUID\n */\nutils.createUUID = function() {\n    return UUIDcreatePart(4) + '-' +\n        UUIDcreatePart(2) + '-' +\n        UUIDcreatePart(2) + '-' +\n        UUIDcreatePart(2) + '-' +\n        UUIDcreatePart(6);\n};\n\n/**\n * Extends a child object from a parent object using classical inheritance\n * pattern.\n */\nutils.extend = (function() {\n    // proxy used to establish prototype chain\n    var F = function() {};\n    // extend Child from Parent\n    return function(Child, Parent) {\n        F.prototype = Parent.prototype;\n        Child.prototype = new F();\n        Child.__super__ = Parent.prototype;\n        Child.prototype.constructor = Child;\n    };\n}());\n\n/**\n * Alerts a message in any available way: alert or console.log.\n */\nutils.alert = function(msg) {\n    if (alert) {\n        alert(msg);\n    } else if (console && console.log) {\n        console.log(msg);\n    }\n};\n\n/**\n * Formats a string and arguments following it ala sprintf()\n *\n * see utils.vformat() for more information\n */\nutils.format = function(formatString /* ,... */) {\n    var args = [].slice.call(arguments, 1);\n    return utils.vformat(formatString, args);\n};\n\n/**\n * Formats a string and arguments following it ala vsprintf()\n *\n * format chars:\n *   %j - format arg as JSON\n *   %o - format arg as JSON\n *   %c - format arg as ''\n *   %% - replace with '%'\n * any other char following % will format it's\n * arg via toString().\n *\n * for rationale, see FireBug's Console API:\n *    http://getfirebug.com/wiki/index.php/Console_API\n */\nutils.vformat = function(formatString, args) {\n    if (formatString === null || formatString === undefined) return \"\";\n    if (arguments.length == 1) return formatString.toString();\n    if (typeof formatString != \"string\") return formatString.toString();\n\n    var pattern = /(.*?)%(.)(.*)/;\n    var rest    = formatString;\n    var result  = [];\n\n    while (args.length) {\n        var arg   = args.shift();\n        var match = pattern.exec(rest);\n\n        if (!match) break;\n\n        rest = match[3];\n\n        result.push(match[1]);\n\n        if (match[2] == '%') {\n            result.push('%');\n            args.unshift(arg);\n            continue;\n        }\n\n        result.push(formatted(arg, match[2]));\n    }\n\n    result.push(rest);\n\n    return result.join('');\n};\n\n//------------------------------------------------------------------------------\nfunction UUIDcreatePart(length) {\n    var uuidpart = \"\";\n    for (var i=0; i<length; i++) {\n        var uuidchar = parseInt((Math.random() * 256), 10).toString(16);\n        if (uuidchar.length == 1) {\n            uuidchar = \"0\" + uuidchar;\n        }\n        uuidpart += uuidchar;\n    }\n    return uuidpart;\n}\n\n//------------------------------------------------------------------------------\nfunction formatted(object, formatChar) {\n\n    try {\n        switch(formatChar) {\n            case 'j':\n            case 'o': return JSON.stringify(object);\n            case 'c': return '';\n        }\n    }\n    catch (e) {\n        return \"error JSON.stringify()ing argument: \" + e;\n    }\n\n    if ((object === null) || (object === undefined)) {\n        return Object.prototype.toString.call(object);\n    }\n\n    return object.toString();\n}\n\n});\n\n//@ sourceURL=lib\\common\\utils.js")} catch(e) {console.log("exception: in lib\common\utils.js: " + e);console.log(e.stack);}

The fix is that last part should read:

catch(e) {console.log("exception: in lib\\common\\utils.js: " + e);console.log(e.stack);}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira