git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9938 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/storage/Storage.gwt.xml b/user/src/com/google/gwt/storage/Storage.gwt.xml
index 8c3396f..98c0055 100644
--- a/user/src/com/google/gwt/storage/Storage.gwt.xml
+++ b/user/src/com/google/gwt/storage/Storage.gwt.xml
@@ -34,16 +34,12 @@
     <when-property-is name="storageSupport" value="no" />
   </replace-with>
 
-  <replace-with class="com.google.gwt.storage.client.StorageImplMozilla">
-    <when-type-is class="com.google.gwt.storage.client.StorageImpl" />
-    <when-property-is name="user.agent" value="gecko1_8" />
-  </replace-with>
-
   <replace-with class="com.google.gwt.storage.client.StorageImplNonNativeEvents">
     <when-type-is class="com.google.gwt.storage.client.StorageImpl" />
     <any>
       <when-property-is name="user.agent" value="safari" />
       <when-property-is name="user.agent" value="ie9" />
+      <when-property-is name="user.agent" value="gecko1_8" />
     </any>
   </replace-with>
 
diff --git a/user/src/com/google/gwt/storage/client/StorageImpl.java b/user/src/com/google/gwt/storage/client/StorageImpl.java
index f943939..6adb878 100644
--- a/user/src/com/google/gwt/storage/client/StorageImpl.java
+++ b/user/src/com/google/gwt/storage/client/StorageImpl.java
@@ -146,7 +146,13 @@
    *      Storage - Storage.key(n)</a>
    */
   public native String key(String storage, int index) /*-{
-    return $wnd[storage].key(index);
+    // few browsers implement retrieval correctly when index is out of range.
+    // compensate to preserve API expectation. According to W3C Web Storage spec
+    // <a href="http://www.w3.org/TR/webstorage/#dom-storage-key">
+    // "If n is greater than or equal to the number of key/value pairs in the
+    // object, then this method must return null."
+    return (index >= 0 && index < $wnd[storage].length) ?
+      $wnd[storage].key(index) : null;
   }-*/;
 
   /**
diff --git a/user/src/com/google/gwt/storage/client/StorageImplIE8.java b/user/src/com/google/gwt/storage/client/StorageImplIE8.java
index 358fd09..a8205e5 100644
--- a/user/src/com/google/gwt/storage/client/StorageImplIE8.java
+++ b/user/src/com/google/gwt/storage/client/StorageImplIE8.java
@@ -25,17 +25,6 @@
  */
 class StorageImplIE8 extends StorageImplNonNativeEvents {
   /*
-   * IE8 will throw "JavaScriptException: (Error): Invalid argument." for
-   * indices outside the range of 0 - storage.length(). In this impl method, we
-   * return null instead, in order to match the Storage spec.
-   */
-  @Override
-  public native String key(String storage, int index) /*-{
-    return (index >= 0 && index < $wnd[storage].length) ? 
-      $wnd[storage].key(index) : null;
-  }-*/;
-
-  /*
    * IE8 will throw "Class doesn't support Automation" error when comparing
    * $wnd["localStorage"] === $wnd["localStorage"]. In this impl method, we
    * work around it by using an attribute on the StorageEvent.
diff --git a/user/src/com/google/gwt/storage/client/StorageImplMozilla.java b/user/src/com/google/gwt/storage/client/StorageImplMozilla.java
deleted file mode 100644
index c8ca4d8..0000000
--- a/user/src/com/google/gwt/storage/client/StorageImplMozilla.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.google.gwt.storage.client;
-
-/**
- * Mozilla-specific implementation of a Storage.
- *
- * <p>
- * Implementation of StorageEvents is incomplete for Mozilla. This class amends
- * the properties consistently with W3C's StorageEvent.
- * </p>
- */
-class StorageImplMozilla extends StorageImplNonNativeEvents {
-  /*
-   * Firefox incorrectly handles indices outside the range of 
-   * 0 to storage.length(). See bugzilla.mozilla.org/show_bug.cgi?id=50924
-   */
-  @Override
-  public native String key(String storage, int index) /*-{
-    return (index >= 0 && index < $wnd[storage].length) ? 
-      $wnd[storage].key(index) : null;
-  }-*/;
-}
diff --git a/user/test/com/google/gwt/user/client/WindowTest.java b/user/test/com/google/gwt/user/client/WindowTest.java
index 82e04da..fae2b13 100644
--- a/user/test/com/google/gwt/user/client/WindowTest.java
+++ b/user/test/com/google/gwt/user/client/WindowTest.java
@@ -305,10 +305,15 @@
         return;
       }
 
+      // FF4 on win can start in 'almost' fullscreen when the window title bar 
+      // is hidden but accounted incorrectly, so, move the window and resize to 
+      // smaller size first, to take it out of 'full screen mode'.
+      Window.moveTo(10,10);
+      Window.resizeTo(700, 500);
+
       // store the original size (to be used in restoreSize)
       clientHeight = Window.getClientHeight();
       clientWidth = Window.getClientWidth();
-
       // IE cannot resize window out of the screen, so we need to move the
       // window such that it can be resized to below size.
       // We do not have method to return the window coordinates (screenLeft,
@@ -321,9 +326,11 @@
       // sizes as requested.
       // If the sizes are too big, for example, height > screen.availHeight + 40
       // on FF, resizeTo silently sets the height to screen.availHeight + 40.
-      Window.resizeTo(800, 600);
-      extraHeight = 600 - Window.getClientHeight();
-      extraWidth = 800 - Window.getClientWidth();
+      // hive machines are configured at this time as 800x600, reduce the size 
+      // to give some 'buffer'
+      Window.resizeTo(750, 550);
+      extraWidth = 750 - Window.getClientWidth();
+      extraHeight = 550 - Window.getClientHeight();
       initialized = true;
       restoreSize();
     }
@@ -363,13 +370,14 @@
       public void execute() {
         // Sizes must be appropriate, otherwise browsers may not resize as
         // requested. See comments in ResizeHelper.
-        int width = 900;
+        int width = 600;
         int height = 500;
         // ensureInitialized could fail on Chrome
         if (!ResizeHelper.resizeTo(width, height)) {
           handlerRegistration.removeHandler();
           finishTest(); // nothing we can test
         }
+
         assertEquals(width, Window.getClientWidth() + ResizeHelper.getExtraWidth());
         assertEquals(height, Window.getClientHeight() + ResizeHelper.getExtraHeight());
         // TODO: TestResizeHandler.getWidth() returns 0 -- need to investigate
@@ -380,7 +388,7 @@
         assertEquals(height + 20, Window.getClientHeight() + ResizeHelper.getExtraHeight());
         // assertEquals(resizeHandler.getWidth(), Window.getClientWidth());
         // assertEquals(resizeHandler.getHeight(), Window.getClientHeight());
-    
+
         // Cleanup the window
         handlerRegistration.removeHandler();
         ResizeHelper.restoreSize();