cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [33/37] js commit: [all] Fix a corner case in modulemapper.
Date Tue, 29 Jan 2013 19:07:51 GMT
[all] Fix a corner case in modulemapper.

If the same symbol is clobbered twice, getOriginalSymbol should return
the first clobbered value.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/abf515d3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/abf515d3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/abf515d3

Branch: refs/heads/symbolmapping
Commit: abf515d3e1b352b9ba72b113f9742654621a1fdd
Parents: 673d225
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Sat Jan 26 10:01:44 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Jan 28 19:57:05 2013 -0500

----------------------------------------------------------------------
 lib/common/modulemapper.js |    2 +-
 test/test.modulemapper.js  |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/abf515d3/lib/common/modulemapper.js
----------------------------------------------------------------------
diff --git a/lib/common/modulemapper.js b/lib/common/modulemapper.js
index ab20588..7b615e5 100644
--- a/lib/common/modulemapper.js
+++ b/lib/common/modulemapper.js
@@ -82,7 +82,7 @@ exports.mapModules = function(context) {
         if (strategy == 'm' && target) {
             builder.recursiveMerge(target, module);
         } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
-            if (target) {
+            if (!(symbolPath in origSymbols)) {
                 origSymbols[symbolPath] = target;
             }
             builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/abf515d3/test/test.modulemapper.js
----------------------------------------------------------------------
diff --git a/test/test.modulemapper.js b/test/test.modulemapper.js
index bc73042..c84df7e 100644
--- a/test/test.modulemapper.js
+++ b/test/test.modulemapper.js
@@ -145,6 +145,13 @@ describe('modulemapper', function() {
         modulemapper.mapModules(context);
         expect(modulemapper.getOriginalSymbol(context, 'obj')).toBe(orig);
     });
+    it('should remember original symbols when double clobbering', function() {
+        var orig = context.obj;
+        modulemapper.clobbers('cordova/testmodule', 'obj');
+        modulemapper.clobbers('cordova/testmodule', 'obj');
+        modulemapper.mapModules(context);
+        expect(modulemapper.getOriginalSymbol(context, 'obj')).toBe(orig);
+    });
     it('should return original symbols when symbol was not clobbered', function() {
         modulemapper.mapModules(context);
         expect(modulemapper.getOriginalSymbol(context, 'obj')).toBe(context.obj);


Mime
View raw message