diff options
author | Valerio Virgillito | 2012-03-08 13:56:09 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-03-08 13:56:09 -0800 |
commit | 22a66cb6e243a3f1c867b62e3942fd2e828019d9 (patch) | |
tree | 4b2f8bf0d8306964f35435dac3d1f6592b3dee19 | |
parent | cef07085443b7c31e878daaad083b7408c57e104 (diff) | |
download | ninja-22a66cb6e243a3f1c867b62e3942fd2e828019d9.tar.gz |
integrating v0.7 montage into ninja
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
48 files changed, 1994 insertions, 1565 deletions
diff --git a/node_modules/montage/bin/montage b/node_modules/montage/bin/montage new file mode 100755 index 00000000..aaa84003 --- /dev/null +++ b/node_modules/montage/bin/montage | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/usr/bin/env node | ||
2 | // --harmony_weakmaps --harmony_proxies | ||
3 | require("../montage.js").initMontage(); | ||
diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index ff94f303..8fcf7977 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js | |||
@@ -71,14 +71,14 @@ Object.defineProperty(M, "create", { | |||
71 | 71 | ||
72 | var newObject = Object.create(typeof aPrototype === "undefined" ? this : aPrototype); | 72 | var newObject = Object.create(typeof aPrototype === "undefined" ? this : aPrototype); |
73 | 73 | ||
74 | if (typeof newObject.didCreate === "function") { | ||
75 | newObject.didCreate(); | ||
76 | } | ||
77 | |||
78 | if (newObject._dependenciesForProperty) { | 74 | if (newObject._dependenciesForProperty) { |
79 | newObject._dependencyListeners = {}; | 75 | newObject._dependencyListeners = {}; |
80 | } | 76 | } |
81 | 77 | ||
78 | if (typeof newObject.didCreate === "function") { | ||
79 | newObject.didCreate(); | ||
80 | } | ||
81 | |||
82 | return newObject; | 82 | return newObject; |
83 | } else { | 83 | } else { |
84 | var result = Object.create(aPrototype); | 84 | var result = Object.create(aPrototype); |
@@ -713,13 +713,17 @@ if (!Object.seal) { | |||
713 | */ | 713 | */ |
714 | Object.defineProperty(M, "callDelegateMethod", { | 714 | Object.defineProperty(M, "callDelegateMethod", { |
715 | value: function(name) { | 715 | value: function(name) { |
716 | var delegate, delegateFunctionName, delegateFunction; | 716 | var delegate = this.delegate, delegateFunctionName, delegateFunction; |
717 | if (typeof this.identifier === "string") { | 717 | if (typeof this.identifier === "string") { |
718 | delegateFunctionName = this.identifier + name.toCapitalized(); | 718 | delegateFunctionName = this.identifier + name.toCapitalized(); |
719 | } else { | 719 | if (delegate && typeof (delegateFunction = delegate[delegateFunctionName]) === "function") { |
720 | delegateFunctionName = name; | 720 | // remove first argument |
721 | Array.prototype.shift.call(arguments); | ||
722 | return delegateFunction.apply(delegate, arguments); | ||
723 | } | ||
721 | } | 724 | } |
722 | if ((delegate = this.delegate) && typeof (delegateFunction = delegate[delegateFunctionName]) === "function") { | 725 | |
726 | if (delegate && typeof (delegateFunction = delegate[name]) === "function") { | ||
723 | // remove first argument | 727 | // remove first argument |
724 | Array.prototype.shift.call(arguments); | 728 | Array.prototype.shift.call(arguments); |
725 | return delegateFunction.apply(delegate, arguments); | 729 | return delegateFunction.apply(delegate, arguments); |
diff --git a/node_modules/montage/core/deserializer.js b/node_modules/montage/core/deserializer.js index 0abc924b..7e812235 100755 --- a/node_modules/montage/core/deserializer.js +++ b/node_modules/montage/core/deserializer.js | |||
@@ -18,6 +18,14 @@ var Montage = require("montage").Montage, | |||
18 | // By rebinding eval to a new name, it loses its ability to | 18 | // By rebinding eval to a new name, it loses its ability to |
19 | // capture the calling scope. | 19 | // capture the calling scope. |
20 | var globalEval = eval; | 20 | var globalEval = eval; |
21 | var canEval = true; | ||
22 | |||
23 | // CSP doesn't let you eval | ||
24 | try { | ||
25 | eval(""); | ||
26 | } catch(ex) { | ||
27 | canEval = false; | ||
28 | } | ||
21 | 29 | ||
22 | /** | 30 | /** |
23 | @class module:montage/core/deserializer.Deserializer | 31 | @class module:montage/core/deserializer.Deserializer |
@@ -81,6 +89,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
81 | _reset: {value: function() { | 89 | _reset: {value: function() { |
82 | this._serializationString = null; | 90 | this._serializationString = null; |
83 | this._requiredModuleIds = null; | 91 | this._requiredModuleIds = null; |
92 | this._areModulesLoaded = false; | ||
84 | this._parseFunction = null; | 93 | this._parseFunction = null; |
85 | this._serialization = null; | 94 | this._serialization = null; |
86 | this._compiledDeserializationFunction = null; | 95 | this._compiledDeserializationFunction = null; |
@@ -342,7 +351,12 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
342 | this._parseForModules(); | 351 | this._parseForModules(); |
343 | } | 352 | } |
344 | 353 | ||
345 | this._loadModules(this._requiredModuleIds, callback); | 354 | if (this._requiredModuleIds.length > 0) { |
355 | this._loadModules(this._requiredModuleIds, callback); | ||
356 | } else { | ||
357 | this._areModulesLoaded = true; | ||
358 | return callback(); | ||
359 | } | ||
346 | }}, | 360 | }}, |
347 | 361 | ||
348 | /** | 362 | /** |
@@ -356,16 +370,40 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri | |||
356 | /** | 370 | /** |
357 | @private | 371 | @private |
358 | */ | 372 | */ |
373 | _findObjectNameRegExp: { | ||
374 | value: /([^\/]+?)(\.reel)?$/ | ||
375 | }, | ||
376 | _toCamelCaseRegExp: { | ||
377 | value: /(?:^|-)([^-])/g | ||
378 | }, | ||
379 | _replaceToCamelCase: { | ||
380 | value: function(_, g1) { return g1.toUpperCase() } | ||
381 | }, | ||
359 | _parseForModules: {value: function() { | 382 | _parseForModules: {value: function() { |
360 | var serialization = this._serialization, | 383 | var serialization = this._serialization, |
361 | moduleIds = this._requiredModuleIds = [], | 384 | moduleIds = this._requiredModuleIds = [], |
362 | modules = this._modules; | 385 | modules = this._modules, |
386 | desc, moduleId; | ||
363 | 387 | ||
364 | for (var label in serialization) { | 388 | for (var label in serialization) { |
365 | var desc = serialization[label]; | 389 | desc = serialization[label]; |
366 | var moduleId = desc.module; | 390 | moduleId = null; |
391 | |||
392 | if ("module" in desc) { | ||
393 | moduleId = desc.module; | ||
394 | } else if (name = /*assignment*/(desc.prototype || desc.object)) { | ||
395 | objectLocation = name.split("["); | ||
396 | moduleId = objectLocation[0]; | ||
397 | desc.module = moduleId; | ||
398 | if (objectLocation.length == 2) { | ||
399 | desc.name = objectLocation[1].slice(0, -1); | ||
400 | } else { | ||
401 | this._findObjectNameRegExp.test(moduleId); | ||
402 | desc.name = RegExp.$1.replace(this._toCamelCaseRegExp, this._replaceToCamelCase); | ||
403 | } | ||
404 | } | ||
367 | 405 | ||
368 | if (moduleId && mo |