You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by ti...@apache.org on 2015/05/07 06:12:59 UTC

incubator-ripple git commit: RIPPLE-74 Ripple does not pass geolocation info to app.

Repository: incubator-ripple
Updated Branches:
  refs/heads/master ded244aca -> fb3127ba7


RIPPLE-74 Ripple does not pass geolocation info to app.

The underlying problem here was that Ripple was failing to patch window.navigator.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/fb3127ba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/fb3127ba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/fb3127ba

Branch: refs/heads/master
Commit: fb3127ba76fe2eeac2e4d934ee984b130e16b4ee
Parents: ded244a
Author: Tim Barham <ti...@microsoft.com>
Authored: Wed May 6 15:32:08 2015 +1000
Committer: Tim Barham <ti...@microsoft.com>
Committed: Wed May 6 15:32:08 2015 +1000

----------------------------------------------------------------------
 lib/client/emulatorBridge.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/fb3127ba/lib/client/emulatorBridge.js
----------------------------------------------------------------------
diff --git a/lib/client/emulatorBridge.js b/lib/client/emulatorBridge.js
index a848014..710b03b 100644
--- a/lib/client/emulatorBridge.js
+++ b/lib/client/emulatorBridge.js
@@ -76,11 +76,18 @@ module.exports = {
         _doc = doc;
         _xhr = win.XMLHttpRequest;
 
-        var marshal = function (obj, key) {
-                window[key] = win[key] = obj;
-            },
-            currentPlatform = platform.current(),
-            sandbox = {};
+        function marshal(obj, key) {
+            // Use defineProperty, otherwise we won't be able to override built-in read-only properties.
+            Object.defineProperty(window, key, {
+                value: obj
+            });
+            Object.defineProperty(win, key, {
+                value: obj
+            });
+        }
+
+        var currentPlatform = platform.current(),
+            sandbox         = {};
 
         marshal(window.tinyHippos, "tinyHippos");
         marshal(window.XMLHttpRequest, "XMLHttpRequest");