Revision: 6910
Author: j...@google.com
Date: Mon Nov 16 08:35:40 2009
Log: Merge trunk r6909 into this branch

Fixes JSNI uses of JSOs as maps in Chrome DevMode.

    svn merge --ignore-ancestry -c6909 \
        https://google-web-toolkit.googlecode.com/svn/trunk/ .


http://code.google.com/p/google-web-toolkit/source/detail?r=6910

Modified:
  /releases/2.0/branch-info.txt
  /releases/2.0/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html
  /releases/2.0/user/src/com/google/gwt/i18n/client/Dictionary.java

=======================================
--- /releases/2.0/branch-info.txt       Mon Nov 16 08:25:35 2009
+++ /releases/2.0/branch-info.txt       Mon Nov 16 08:35:40 2009
@@ -664,3 +664,8 @@
  tr...@6907 was merged into this branch
    Add registry keys to IE plugin installer
          svn merge --ignore-ancestry -c6907  
http://google-web-toolkit.googlecode.com/svn/trunk/ .
+
+tr...@6909 was merged into this branch
+ Fixes JSNI uses of JSOs as maps in Chrome DevMode.
+    svn merge --ignore-ancestry -c6909 \
+      https://google-web-toolkit.googlecode.com/svn/trunk/ .
=======================================
---  
/releases/2.0/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html      
 
Fri Nov 13 09:24:32 2009
+++  
/releases/2.0/dev/core/src/com/google/gwt/core/ext/linker/impl/hosted.html      
 
Mon Nov 16 08:35:40 2009
@@ -94,13 +94,22 @@
      external.gwtOnLoad(window, null, $hostedHtmlVersion);
    };
  } else {
-  // install eval wrapper on FF to avoid EvalError problem
-  if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) {
+  var ua = navigator.userAgent.toLowerCase();
+  if (ua.indexOf("gecko") != -1) {
+    // install eval wrapper on FF to avoid EvalError problem
+    // TODO(jat): should this UA check be more specific (this hits chrome  
too)?
      var __eval = window.eval;
      window.eval = function(s) {
        return __eval(s);
      }
    }
+  if (ua.indexOf("chrome") != -1) {
+    // work around __gwt_ObjectId appearing in JS objects
+    var hop = Object.prototype.hasOwnProperty;
+    Object.prototype.hasOwnProperty = function(prop) {
+      return prop != "__gwt_ObjectId" && hop.call(this, prop);
+    };
+  }

    // wrapper to call JS methods, which we need both to be able to supply a
    // different this for method lookup and to get the exception back
=======================================
--- /releases/2.0/user/src/com/google/gwt/i18n/client/Dictionary.java   Mon  
Jun  1 16:12:37 2009
+++ /releases/2.0/user/src/com/google/gwt/i18n/client/Dictionary.java   Mon  
Nov 16 08:35:40 2009
@@ -143,20 +143,19 @@
     * @throws MissingResourceException if the value is not found
     */
    public native String get(String key) /*-{
-   var value = th...@com.google.gwt.i18n.client.dictionary::dict[key];
-   var keys = th...@com.google.gwt.i18n.client.dictionary::accessedKeys;
-   keys.unshift(key);
-   // only keep the last 30 elements. Shrink it when array exceeds 60
-   if (keys.length > 60) {
-     keys.splice(30);
-   }
-   if (value == null || !Object.prototype.hasOwnProperty.call(
-       th...@com.google.gwt.i18n.client.dictionary::dict, key))
-   {
-      
th...@com.google.gwt.i18n.client.dictionary::resourceError(Ljava/lang/String;)(key);
-   }
-   return String(value);
-   }-*/;
+    var map = th...@com.google.gwt.i18n.client.dictionary::dict;
+    var value = map[key];
+    var keys = th...@com.google.gwt.i18n.client.dictionary::accessedKeys;
+    keys.unshift(key);
+    // only keep the last 30 elements. Shrink it when array exceeds 60
+    if (keys.length > 60) {
+      keys.splice(30);
+    }
+    if (value == null || !map.hasOwnProperty(key)) {
+       
th...@com.google.gwt.i18n.client.dictionary::resourceError(Ljava/lang/String;)(key);
+    }
+    return String(value);
+  }-*/;

    /**
     * The set of keys associated with this dictionary.
@@ -196,15 +195,21 @@
    }

    private native void addKeys(HashSet<String> s) /*-{
-    for (x in th...@com.google.gwt.i18n.client.dictionary::dict) {
-      s...@java.util.hashset::add(Ljava/lang/Object;)(x);
+    var map = th...@com.google.gwt.i18n.client.dictionary::dict
+    for (var key in map) {
+      if (map.hasOwnProperty(key)) {
+        s...@java.util.hashset::add(Ljava/lang/Object;)(key);
+      }
      }
    }-*/;

    private native void addValues(ArrayList<String> s) /*-{
-    for (x in th...@com.google.gwt.i18n.client.dictionary::dict) {
-      var value =  
th...@com.google.gwt.i18n.client.dictionary::get(Ljava/lang/String;)(x);
-      s...@java.util.arraylist::add(Ljava/lang/Object;)(value);
+    var map = th...@com.google.gwt.i18n.client.dictionary::dict
+    for (var key in map) {
+      if (map.hasOwnProperty(key)) {
+        var value =  
th...@com.google.gwt.i18n.client.dictionary::get(Ljava/lang/String;)(key);
+        s...@java.util.arraylist::add(Ljava/lang/Object;)(value);
+      }
      }
    }-*/;

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to