diff --git a/vendor/benchmark.js/benchmark.js b/vendor/benchmark.js/benchmark.js index 48dab5a6f..4bed27239 100644 --- a/vendor/benchmark.js/benchmark.js +++ b/vendor/benchmark.js/benchmark.js @@ -1156,7 +1156,7 @@ // reset if the state has changed else if ((suite.aborted || suite.running) && (suite.emit(event = Event('reset')), !event.cancelled)) { - suite.running = false; + suite.aborted = suite.running = false; if (!aborting) { invoke(suite, 'reset'); } @@ -1569,16 +1569,119 @@ // lazy define for hi-res timers clock = function(clone) { var deferred; - templateData.uid = uid + uidCounter++; if (clone instanceof Deferred) { deferred = clone; clone = deferred.benchmark; } var bench = clone._original, - fn = bench.fn, - fnArg = deferred ? getFirstArgument(fn) || 'deferred' : '', - stringable = isStringable(fn); + stringable = isStringable(bench.fn), + count = bench.count = clone.count, + decompilable = support.decompilation || stringable, + id = bench.id, + name = bench.name || (typeof id == 'number' ? '' : id), + result = 0; + + // init `minTime` if needed + clone.minTime = bench.minTime || (bench.minTime = bench.options.minTime = options.minTime); + + // repair nanosecond timer + // (some Chrome builds erase the `ns` variable after millions of executions) + if (applet) { + try { + timer.ns.nanoTime(); + } catch(e) { + // use non-element to avoid issues with libs that augment them + timer.ns = new applet.Packages.nano; + } + } + + // Compile in setup/teardown functions and the test loop. + // Create a new compiled test, instead of using the cached `bench.compiled`, + // to avoid potential engine optimizations enabled over the life of the test. + var funcBody = deferred + ? 'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;' + + // when `deferred.cycles` is `0` then... + 'if(!d#.cycles){' + + // set `deferred.fn` + 'd#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};' + + // set `deferred.teardown` + 'd#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};' + + // execute the benchmark's `setup` + 'if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};' + + // start timer + 't#.start(d#);' + + // execute `deferred.fn` and return a dummy object + '}d#.fn();return{uid:"${uid}"}' + + : 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};' + + 'while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}'; + + var compiled = bench.compiled = clone.compiled = createCompiled(bench, deferred, funcBody), + isEmpty = !(templateData.fn || stringable); + + try { + if (isEmpty) { + // Firefox may remove dead code from Function#toString results + // http://bugzil.la/536085 + throw new Error('The test "' + name + '" is empty. This may be the result of dead code removal.'); + } + else if (!deferred) { + // pretest to determine if compiled code is exits early, usually by a + // rogue `return` statement, by checking for a return object with the uid + bench.count = 1; + compiled = (compiled.call(bench, context, timer) || {}).uid == templateData.uid && compiled; + bench.count = count; + } + } catch(e) { + compiled = null; + clone.error = e || new Error(String(e)); + bench.count = count; + } + // fallback when a test exits early or errors during pretest + if (decompilable && !compiled && !deferred && !isEmpty) { + funcBody = ( + clone.error && !stringable + ? 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count' + : 'function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count' + ) + + ',n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};' + + 'delete m#.f#;${teardown}\nreturn{elapsed:r#}'; + + compiled = createCompiled(bench, deferred, funcBody); + + try { + // pretest one more time to check for errors + bench.count = 1; + compiled.call(bench, context, timer); + bench.count = count; + delete clone.error; + } + catch(e) { + bench.count = count; + if (!clone.error) { + clone.error = e || new Error(String(e)); + } + } + } + // if no errors run the full test loop + if (!clone.error) { + compiled = bench.compiled = clone.compiled = createCompiled(bench, deferred, funcBody); + result = compiled.call(deferred || bench, context, timer).elapsed; + } + return result; + }; + + /*----------------------------------------------------------------------*/ + + /** + * Creates a compiled function from the given function `body`. + */ + function createCompiled(bench, deferred, body) { + var fn = bench.fn, + fnArg = deferred ? getFirstArgument(fn) || 'deferred' : ''; + + templateData.uid = uid + uidCounter++; _.extend(templateData, { 'setup': getSource(bench.setup, interpolate('m#.setup()')), @@ -1625,28 +1728,6 @@ 'end': interpolate('r#=(new n#-s#)/1e3') }); } - - var count = bench.count = clone.count, - decompilable = support.decompilation || stringable, - id = bench.id, - isEmpty = !(templateData.fn || stringable), - name = bench.name || (typeof id == 'number' ? '' : id), - ns = timer.ns, - result = 0; - - // init `minTime` if needed - clone.minTime = bench.minTime || (bench.minTime = bench.options.minTime = options.minTime); - - // repair nanosecond timer - // (some Chrome builds erase the `ns` variable after millions of executions) - if (applet) { - try { - ns.nanoTime(); - } catch(e) { - // use non-element to avoid issues with libs that augment them - ns = timer.ns = new applet.Packages.nano; - } - } // define `timer` methods timer.start = createFunction( interpolate('o#'), @@ -1658,92 +1739,7 @@ interpolate('var n#=this.ns,s#=o#.timeStamp,${end};o#.elapsed=r#') ); - // Compile in setup/teardown functions and the test loop. - // Create a new compiled test, instead of using the cached `bench.compiled`, - // to avoid potential engine optimizations enabled over the life of the test. - var compiled = bench.compiled = createCompiled( - deferred - ? 'var d#=this,${fnArg}=d#,m#=d#.benchmark._original,f#=m#.fn,su#=m#.setup,td#=m#.teardown;' + - // when `deferred.cycles` is `0` then... - 'if(!d#.cycles){' + - // set `deferred.fn` - 'd#.fn=function(){var ${fnArg}=d#;if(typeof f#=="function"){try{${fn}\n}catch(e#){f#(d#)}}else{${fn}\n}};' + - // set `deferred.teardown` - 'd#.teardown=function(){d#.cycles=0;if(typeof td#=="function"){try{${teardown}\n}catch(e#){td#()}}else{${teardown}\n}};' + - // execute the benchmark's `setup` - 'if(typeof su#=="function"){try{${setup}\n}catch(e#){su#()}}else{${setup}\n};' + - // start timer - 't#.start(d#);' + - // execute `deferred.fn` and return a dummy object - '}d#.fn();return{uid:"${uid}"}' - - : 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};' + - 'while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}' - ); - - try { - if (isEmpty) { - // Firefox may remove dead code from Function#toString results - // http://bugzil.la/536085 - throw new Error('The test "' + name + '" is empty. This may be the result of dead code removal.'); - } - else if (!deferred) { - // pretest to determine if compiled code is exits early, usually by a - // rogue `return` statement, by checking for a return object with the uid - bench.count = 1; - compiled = (compiled.call(bench, context, timer) || {}).uid == templateData.uid && compiled; - bench.count = count; - } - } catch(e) { - compiled = null; - clone.error = e || new Error(String(e)); - bench.count = count; - } - // fallback when a test exits early or errors during pretest - if (decompilable && !compiled && !deferred && !isEmpty) { - compiled = createCompiled( - (clone.error && !stringable - ? 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count' - : 'function f#(){${fn}\n}var r#,s#,m#=this,i#=m#.count' - ) + - ',n#=t#.ns;${setup}\n${begin};m#.f#=f#;while(i#--){m#.f#()}${end};' + - 'delete m#.f#;${teardown}\nreturn{elapsed:r#}' - ); - - try { - // pretest one more time to check for errors - bench.count = 1; - compiled.call(bench, context, timer); - bench.compiled = compiled; - bench.count = count; - delete clone.error; - } - catch(e) { - bench.count = count; - if (clone.error) { - compiled = null; - } else { - bench.compiled = compiled; - clone.error = e || new Error(String(e)); - } - } - } - // assign `compiled` to `clone` before calling in case a deferred benchmark - // immediately calls `deferred.resolve()` - clone.compiled = compiled; - // if no errors run the full test loop - if (!clone.error) { - result = compiled.call(deferred || bench, context, timer).elapsed; - } - return result; - }; - - /*----------------------------------------------------------------------*/ - - /** - * Creates a compiled function from the given function `body`. - */ - function createCompiled(body) { + // create compiled test return createFunction( interpolate('window,t#'), 'var global = window, clearTimeout = global.clearTimeout, setTimeout = global.setTimeout;\n' + diff --git a/vendor/curl/src/curl.js b/vendor/curl/src/curl.js index 2c1c08426..5f79867fd 100644 --- a/vendor/curl/src/curl.js +++ b/vendor/curl/src/curl.js @@ -13,7 +13,7 @@ (function (global) { //"use strict"; don't restore this until the config routine is refactored var - version = '0.7.4', + version = '0.7.6', curlName = 'curl', defineName = 'define', runModuleAttr = 'data-curl-run', @@ -303,15 +303,32 @@ // functions that dependencies will use: - function toAbsId (childId) { - return core.toAbsId(childId, def.id, cfg); + function toAbsId (childId, checkPlugins) { + var absId, parts, plugin; + + absId = core.toAbsId(childId, def.id, cfg); + if (!checkPlugins) return absId; + + parts = pluginParts(absId); + if (!parts.pluginId) return absId; + + plugin = cache[parts.pluginId]; + // check if plugin supports the normalize method + if ('normalize' in plugin) { + // note: dojo/has may return falsey values (0, actually) + parts.resourceId = plugin['normalize'](parts.resourceId, toAbsId, def.config) || ''; + } + else { + parts.resourceId = toAbsId(parts.resourceId); + } + return parts.pluginId + '!' + parts.resourceId; } function toUrl (n) { // the AMD spec states that we should not append an extension // in this function since it could already be appended. // we need to use toAbsId in case this is a module id. - return core.resolvePathInfo(toAbsId(n), cfg).url; + return core.resolvePathInfo(toAbsId(n, true), cfg).url; } function localRequire (ids, callback, errback) { @@ -327,7 +344,7 @@ throw new Error('require(id, callback) not allowed'); } // return resource - rvid = toAbsId(ids); + rvid = toAbsId(ids, true); childDef = cache[rvid]; if (!(rvid in cache)) { // this should only happen when devs attempt their own diff --git a/vendor/requirejs/require.js b/vendor/requirejs/require.js index 52c2b076b..c0da866be 100644 --- a/vendor/requirejs/require.js +++ b/vendor/requirejs/require.js @@ -1,5 +1,5 @@ /** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * @license RequireJS 2.1.8+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ @@ -12,7 +12,7 @@ var requirejs, require, define; (function (global) { var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, - version = '2.1.8', + version = '2.1.8+', commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, @@ -1609,7 +1609,7 @@ var requirejs, require, define; //Join the path parts together, then figure out if baseUrl is needed. url = syms.join('/'); - url += (ext || (/\?/.test(url) || skipExt ? '' : '.js')); + url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js')); url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; }