Merge TM -> JM
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 13 Apr 2011 06:45:06 -0700
changeset 74934 9e455fe9aad13a0ee97fea314654006784dd0c70
parent 74933 2ad374159c492587ad0cbf7d52078dc9693b0aee (current diff)
parent 68534 cd5910633dd804405e8b1d1d26a6a74c7af0de79 (diff)
child 74935 9eafb9ecc76a1c45523df01baf51a43b142c56a2
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone6.0a1
Merge TM -> JM
content/html/content/public/nsISelectElement.idl
dom/plugins/AStream.h
dom/plugins/BrowserStreamChild.cpp
dom/plugins/BrowserStreamChild.h
dom/plugins/BrowserStreamParent.cpp
dom/plugins/BrowserStreamParent.h
dom/plugins/COMMessageFilter.cpp
dom/plugins/COMMessageFilter.h
dom/plugins/ChildAsyncCall.cpp
dom/plugins/ChildAsyncCall.h
dom/plugins/ChildTimer.cpp
dom/plugins/ChildTimer.h
dom/plugins/Makefile.in
dom/plugins/NPEventAndroid.h
dom/plugins/NPEventOSX.h
dom/plugins/NPEventWindows.h
dom/plugins/NPEventX11.h
dom/plugins/NestedLoopTimer.cpp
dom/plugins/NestedLoopTimer.h
dom/plugins/PBrowserStream.ipdl
dom/plugins/PPluginBackgroundDestroyer.ipdl
dom/plugins/PPluginIdentifier.ipdl
dom/plugins/PPluginInstance.ipdl
dom/plugins/PPluginModule.ipdl
dom/plugins/PPluginScriptableObject.ipdl
dom/plugins/PPluginStream.ipdl
dom/plugins/PPluginSurface.ipdl
dom/plugins/PStreamNotify.ipdl
dom/plugins/PluginBackgroundDestroyer.h
dom/plugins/PluginIdentifierChild.h
dom/plugins/PluginIdentifierParent.h
dom/plugins/PluginInstanceChild.cpp
dom/plugins/PluginInstanceChild.h
dom/plugins/PluginInstanceParent.cpp
dom/plugins/PluginInstanceParent.h
dom/plugins/PluginInterposeOSX.h
dom/plugins/PluginInterposeOSX.mm
dom/plugins/PluginLibrary.h
dom/plugins/PluginMessageUtils.cpp
dom/plugins/PluginMessageUtils.h
dom/plugins/PluginModuleChild.cpp
dom/plugins/PluginModuleChild.h
dom/plugins/PluginModuleParent.cpp
dom/plugins/PluginModuleParent.h
dom/plugins/PluginProcessChild.cpp
dom/plugins/PluginProcessChild.h
dom/plugins/PluginProcessParent.cpp
dom/plugins/PluginProcessParent.h
dom/plugins/PluginScriptableObjectChild.cpp
dom/plugins/PluginScriptableObjectChild.h
dom/plugins/PluginScriptableObjectParent.cpp
dom/plugins/PluginScriptableObjectParent.h
dom/plugins/PluginScriptableObjectUtils-inl.h
dom/plugins/PluginScriptableObjectUtils.h
dom/plugins/PluginStreamChild.cpp
dom/plugins/PluginStreamChild.h
dom/plugins/PluginStreamParent.cpp
dom/plugins/PluginStreamParent.h
dom/plugins/PluginSurfaceParent.cpp
dom/plugins/PluginSurfaceParent.h
dom/plugins/PluginUtilsOSX.h
dom/plugins/PluginUtilsOSX.mm
dom/plugins/StreamNotifyChild.h
dom/plugins/StreamNotifyParent.h
dom/plugins/ipdl.mk
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jsfun.cpp
js/src/jsinterp.cpp
js/src/jsinterp.h
js/src/jsinterpinlines.h
js/src/jsparse.cpp
js/src/jstracer.cpp
js/src/methodjit/MonoIC.cpp
layout/forms/resources/Makefile.in
layout/forms/resources/content/button.xml
layout/forms/resources/content/checkbox.xml
layout/forms/resources/content/radio.xml
layout/forms/resources/content/select.xml
layout/forms/resources/content/xbl-forms.css
layout/forms/resources/jar.mn
layout/forms/resources/locale/en-US/htmlforms.dtd
layout/forms/resources/skin/arrow-dn-dis.gif
layout/forms/resources/skin/arrow-dn.gif
layout/forms/resources/skin/button.css
layout/forms/resources/skin/cbox-check-dis.gif
layout/forms/resources/skin/cbox-check.gif
layout/forms/resources/skin/checkbox.css
layout/forms/resources/skin/forms.css
layout/forms/resources/skin/radio-check-dis.gif
layout/forms/resources/skin/radio-check.gif
layout/forms/resources/skin/radio.css
layout/forms/resources/skin/select-dropdown.css
layout/forms/resources/skin/select.css
layout/forms/resources/skin/twisty-clsd.gif
layout/forms/resources/skin/twisty-open.gif
mobile/branding/nightly/content/spark.png
mobile/branding/official/content/spark.png
modules/libpref/src/init/all.js
--- a/.hgtags
+++ b/.hgtags
@@ -56,8 +56,9 @@ 138f593553b66c9f815e8f57870c19d6347f7702
 138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R13
 138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R11_1_MU
 e56ecd8b3a68c158025207c5fd081d043e28f5ce GECKO_2_0_BASE
 e273946b74c8d631ed86bd74ba9afe0e67b12378 GECKO_2_1_BASE
 b70744835d94e54eec97b8fd186c96da5708a506 PRE_MOBILE_MERGE
 b70744835d94e54eec97b8fd186c96da5708a506 PRE_MOBILE_MERGE_20110406
 a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE
 a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE_20110406
+a95d426422816513477e5863add1b00ac7041dcb AURORA_BASE_20110412
--- a/browser/config/version.txt
+++ b/browser/config/version.txt
@@ -1,1 +1,1 @@
-4.2a1pre
+6.0a1
--- a/config/config.mk
+++ b/config/config.mk
@@ -830,16 +830,18 @@ endif
 
 ifdef TIERS
 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 endif
 
 OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
 
+CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
+
 EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py
 EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py
 EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py
 EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
 EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
 EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
 EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
 EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)
--- a/config/createprecomplete.py
+++ b/config/createprecomplete.py
@@ -40,16 +40,20 @@ def get_build_entries(root_path):
     return rel_file_path_list, rel_dir_path_list
 
 def generate_precomplete():
     """ Creates the precomplete file containing the remove, remove-cc, and rmdir
         application update instructions. The current working directory is used
         for the location to enumerate and to create the precomplete file.
     """
     root_path = os.getcwd()
+    # If inside a Mac bundle use the root of the bundle for the path.
+    if os.path.basename(root_path) == "MacOS":
+        root_path = os.path.abspath(os.path.join(root_path, '../../'))
+
     rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
     precomplete_file_path = os.path.join(root_path,"precomplete")
     # open in binary mode to prevent OS specific line endings.
     precomplete_file = open(precomplete_file_path, "wb")
     for rel_file_path in rel_file_path_list:
         if rel_file_path.endswith("channel-prefs.js"):
             precomplete_file.writelines("remove-cc \""+rel_file_path+"\"\n")
         else:
--- a/config/milestone.txt
+++ b/config/milestone.txt
@@ -5,9 +5,9 @@
 #    x.x.x.x
 #    x.x.x+
 #
 # Referenced by milestone.pl.
 # Hopefully I'll be able to automate replacement of *all*
 # hardcoded milestones in the tree from these two files.
 #--------------------------------------------------------
 
-2.2a1pre
+6.0a1
--- a/configure.in
+++ b/configure.in
@@ -8894,16 +8894,20 @@ dnl ====================================
 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
 fi
 
 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
   AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
 fi
 
+if test "$MOZ_APP_COMPONENT_MODULES"; then
+  AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
+fi
+
 dnl ========================================================
 dnl =
 dnl = Maintainer debug option (no --enable equivalent)
 dnl =
 dnl ========================================================
 
 AC_SUBST(AR)
 AC_SUBST(AR_FLAGS)
--- a/content/base/test/test_bug482935.html
+++ b/content/base/test/test_bug482935.html
@@ -24,35 +24,40 @@ function clearCache() {
 function testCancelInPhase4() {
 
   clearCache();
 
   // First request - should be loaded from server
   var xhr = new XMLHttpRequest();
   xhr.addEventListener("readystatechange", function(e) {
     if (xhr.readyState >= 4) {
-      xhr.abort();
-      SimpleTest.executeSoon(function() {
-        // This request was cancelled, so the responseText should be empty string
-        is(xhr.responseText, "", "Expected empty response to cancelled request");
+      xhr.addEventListener("abort", function() {
+        setTimeout(function() {
+          // This request was cancelled, so the responseText should be empty string
+          is(xhr.responseText, "", "Expected empty response to cancelled request");
 
-        // Second request - should be found in cache
-        var xhr2 = new XMLHttpRequest();
-        xhr2.open("GET", url, false); // note : synch-request
-        xhr2.setRequestHeader("X-Request", "1", false);
+          // Second request - should be found in cache
+          var xhr2 = new XMLHttpRequest();
 
-        try { xhr2.send(); }
-        catch(e) {
-          is(xhr2.status, "200", "Exception!");
-        }
+          xhr2.addEventListener("load", function() {
+            is(xhr2.responseText, "0", "Received fresh value for second request");
+            testCancelBeforePhase4();
+          }, false);
+
+          xhr2.open("GET", url, false); // note : synch-request
+          xhr2.setRequestHeader("X-Request", "1", false);
 
-        is(xhr2.responseText, "0", "Received fresh value for second request");
- 
-        testCancelBeforePhase4();
-      });
+          try { xhr2.send(); }
+          catch(e) {
+            is(xhr2.status, "200", "Exception!");
+          }
+        }, 0);
+      }, false);
+
+      xhr.abort();
     }
   }, false);
 
   xhr.open("GET", url, true);
   xhr.setRequestHeader("X-Request", "0", false);
   try { xhr.send(); }
   catch(e) {
     is("Nothing", "Exception", "Boom: " + e);
@@ -64,35 +69,40 @@ function testCancelInPhase4() {
 function testCancelBeforePhase4() {
 
   clearCache();
 
   // First request - should be loaded from server
   var xhr = new XMLHttpRequest();
   xhr.addEventListener("readystatechange", function(e) {
     if (xhr.readyState == 3) {
-      xhr.abort();
-      SimpleTest.executeSoon(function() {
-        // This request was cancelled, so the responseText should be empty string
-        is(xhr.responseText, "", "Expected empty response to cancelled request");
+      xhr.addEventListener("abort", function() {
+        setTimeout(function() {
+          // This request was cancelled, so the responseText should be empty string
+          is(xhr.responseText, "", "Expected empty response to cancelled request");
 
-        // Second request - should be found in cache
-        var xhr2 = new XMLHttpRequest();
-        xhr2.open("GET", url, false); // note : synch-request
-        xhr2.setRequestHeader("X-Request", "1", false);
+          // Second request - should be found in cache
+          var xhr2 = new XMLHttpRequest();
 
-        try { xhr2.send(); }
-        catch(e) {
-          is(xhr2.status, "200", "Exception!");
-        }
+          xhr2.addEventListener("load", function() {
+            is(xhr2.responseText, "1", "Received cached value for second request");
+            SimpleTest.finish();
+          }, false);
+
+          xhr2.open("GET", url, false); // note : synch-request
+          xhr2.setRequestHeader("X-Request", "1", false);
 
-        is(xhr2.responseText, "1", "Received cached value for second request");
+          try { xhr2.send(); }
+          catch(e) {
+            is(xhr2.status, "200", "Exception!");
+          }
+        }, 0);
+      }, false);
 
-        SimpleTest.finish();
-      });
+      xhr.abort();
     }
   }, false);
 
   xhr.open("GET", url, true);
   xhr.setRequestHeader("X-Request", "0", false);
   try { xhr.send(); }
   catch(e) {
     is("Nothing", "Exception", "Boom: " + e);
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -1370,17 +1370,17 @@ nsCanvasRenderingContext2D::Restore()
 //
 // transformations
 //
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::Scale(float x, float y)
 {
     if (!FloatValidate(x,y))
-        return NS_ERROR_DOM_SYNTAX_ERR;
+        return NS_OK;
 
     mThebes->Scale(x, y);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::Rotate(float angle)
 {
@@ -1961,17 +1961,17 @@ nsCanvasRenderingContext2D::ClearRect(fl
 
     return RedrawUser(mThebes->GetUserPathExtent());
 }
 
 nsresult
 nsCanvasRenderingContext2D::DrawRect(const gfxRect& rect, Style style)
 {
     if (!FloatValidate(rect.pos.x, rect.pos.y, rect.size.width, rect.size.height))
-        return NS_ERROR_DOM_SYNTAX_ERR;
+        return NS_OK;
 
     PathAutoSaveRestore pathSR(this);
 
     mThebes->NewPath();
     mThebes->Rectangle(rect);
 
     gfxRect dirty;
     nsresult rv = DrawPath(style, &dirty);
@@ -2153,17 +2153,17 @@ nsCanvasRenderingContext2D::ArcTo(float 
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::Arc(float x, float y, float r, float startAngle, float endAngle, PRBool ccw)
 {
     if (!FloatValidate(x,y,r,startAngle,endAngle))
-        return NS_ERROR_DOM_SYNTAX_ERR;
+        return NS_OK;
 
     if (r < 0.0)
         return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
     gfxPoint p(x,y);
 
     mHasPath = PR_TRUE;
     if (ccw)
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -3838,17 +3838,17 @@ ctx.fillRect(0, Infinity, Infinity, Infi
 ctx.fillRect(0, Infinity, 100, Infinity);
 ctx.fillRect(0, 0, Infinity, Infinity);
 
 isPixel(ctx, 50,25, 0,255,0,255, 0);
 
 } catch (e) {
     _thrown_outer = true;
 }
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
 
 
 }
 </script>
 
 <!-- [[[ test_2d.fillRect.path.html ]]] -->
 
 <p>Canvas test: 2d.fillRect.path</p>
@@ -11032,17 +11032,17 @@ ctx.lineTo(0, 50);
 ctx.fillStyle = '#0f0';
 ctx.fill();
 isPixel(ctx, 50,25, 0,255,0,255, 0);
 isPixel(ctx, 90,45, 0,255,0,255, 0);
 
 } catch (e) {
     _thrown_outer = true;
 }
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
 
 
 }
 </script>
 
 <!-- [[[ test_2d.path.arc.scale.1.html ]]] -->
 
 <p>Canvas test: 2d.path.arc.scale.1</p>
@@ -18195,17 +18195,17 @@ ctx.strokeRect(0, Infinity, Infinity, In
 ctx.strokeRect(0, Infinity, 100, Infinity);
 ctx.strokeRect(0, 0, Infinity, Infinity);
 
 isPixel(ctx, 50,25, 0,255,0,255, 0);
 
 } catch (e) {
     _thrown_outer = true;
 }
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
 
 
 }
 </script>
 
 <!-- [[[ test_2d.strokeRect.path.html ]]] -->
 
 <p>Canvas test: 2d.strokeRect.path</p>
@@ -18757,17 +18757,17 @@ ctx.scale(Infinity, Infinity);
 ctx.fillStyle = '#0f0';
 ctx.fillRect(-100, -10, 100, 50);
 
 isPixel(ctx, 50,25, 0,255,0,255, 0);
 
 } catch (e) {
     _thrown_outer = true;
 }
-todo(!_thrown_outer, 'should not throw exception');
+ok(!_thrown_outer, 'should not throw exception');
 
 
 }
 </script>
 
 <!-- [[[ test_2d.transformation.scale.zero.html ]]] -->
 
 <p>Canvas test: 2d.transformation.scale.zero</p>
--- a/content/html/content/public/Makefile.in
+++ b/content/html/content/public/Makefile.in
@@ -41,17 +41,16 @@ srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE       = content
 XPIDL_MODULE = content_html
 
 XPIDLSRCS = \
-		nsISelectElement.idl \
 		nsIFormSubmitObserver.idl \
 		nsIPhonetic.idl \
 		$(NULL)
 
 EXPORTS = \
 		nsIConstraintValidation.h \
 		nsIFormControl.h \
 		nsIForm.h \
deleted file mode 100644
--- a/content/html/content/public/nsISelectElement.idl
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-interface nsIContent;
-interface nsIDOMHTMLOptionElement;
-
-/** 
- * This interface is used to notify a SELECT when OPTION
- * elements are added and removed from its subtree.
- * Note that the nsIDOMHTMLSelectElement and nsIContent 
- * interfaces are the ones to use to access and enumerate
- * OPTIONs within a SELECT element.
- */
-
-[noscript, uuid(aa73a61a-8ef2-402d-b86c-3a5c5f2a6027)]
-interface nsISelectElement : nsISupports
-{
-
-  /**
-   * To be called when stuff is added under a child of the select--but *before*
-   * they are actually added.
-   *
-   * @param aOptions the content that was added (usually just an option, but
-   *        could be an optgroup node with many child options)
-   * @param aParent the parent the options were added to (could be an optgroup)
-   * @param aContentIndex the index where the options are being added within the
-   *        parent (if the parent is an optgroup, the index within the optgroup)
-   */
-  void willAddOptions(in nsIContent aOptions,
-                      in nsIContent aParent,
-                      in long aContentIndex,
-                      in boolean aNotify);
-
-  /**
-   * To be called when stuff is removed under a child of the select--but
-   * *before* they are actually removed.
-   *
-   * @param aParent the parent the option(s) are being removed from
-   * @param aContentIndex the index of the option(s) within the parent (if the
-   *        parent is an optgroup, the index within the optgroup)
-   */
-  void willRemoveOptions(in nsIContent aParent,
-                         in long aContentIndex,
-                         in boolean aNotify);
-
-  /**
-   * Checks whether an option is disabled (even if it's part of an optgroup)
-   *
-   * @param aIndex the index of the option to check
-   * @return whether the option is disabled
-   */
-  boolean isOptionDisabled(in long aIndex);
-
-  /**
-   * Sets multiple options (or just sets startIndex if select is single)
-   * and handles notifications and cleanup and everything under the sun.
-   * When this method exits, the select will be in a consistent state.  i.e.
-   * if you set the last option to false, it will select an option anyway.
-   *
-   * @param aStartIndex the first index to set
-   * @param aEndIndex the last index to set (set same as first index for one
-   *        option)
-   * @param aIsSelected whether to set the option(s) to true or false
-   * @param aClearAll whether to clear all other options (for example, if you
-   *        are normal-clicking on the current option)
-   * @param aSetDisabled whether it is permissible to set disabled options
-   *        (for JavaScript)
-   * @param aNotify whether to notify frames and such
-   * @return whether any options were actually changed
-   */
-  boolean setOptionsSelectedByIndex(in long aStartIndex,
-                                    in long aEndIndex,
-                                    in boolean aIsSelected,
-                                    in boolean aClearAll,
-                                    in boolean aSetDisabled,
-                                    in boolean aNotify);
-
-  /**
-   * Finds the index of a given option element
-   *
-   * @param aOption the option to get the index of
-   * @param aStartIndex the index to start looking at
-   * @param aForward TRUE to look forward, FALSE to look backward
-   * @return the option index
-   */
-  long getOptionIndex(in nsIDOMHTMLOptionElement aOption,
-                      in long aStartIndex, in boolean aForward);
-
-  /** Whether or not there are optgroups in this select */
-  readonly attribute boolean hasOptGroups;
-};
--- a/content/html/content/src/nsHTMLOptGroupElement.cpp
+++ b/content/html/content/src/nsHTMLOptGroupElement.cpp
@@ -39,18 +39,16 @@
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsIFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsIEventStateManager.h"
 #include "nsIDocument.h"
 
-#include "nsISelectElement.h"
-#include "nsIDOMHTMLSelectElement.h"
 #include "nsEventDispatcher.h"
 #include "nsHTMLSelectElement.h"
 
 /**
  * The implementation of &lt;optgroup&gt;
  */
 class nsHTMLOptGroupElement : public nsGenericHTMLElement,
                               public nsIDOMHTMLOptGroupElement
--- a/content/html/content/src/nsHTMLOptionElement.cpp
+++ b/content/html/content/src/nsHTMLOptionElement.cpp
@@ -34,28 +34,27 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHTMLOptionElement.h"
+#include "nsHTMLSelectElement.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMEventTarget.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIDOMText.h"
 #include "nsIDOMNode.h"
-#include "nsGenericElement.h"
 #include "nsIDOMHTMLCollection.h"
-#include "nsISelectElement.h"
 #include "nsISelectControlFrame.h"
 
 // Notify/query select frame for selected state
 #include "nsIFormControlFrame.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsIDOMHTMLSelectElement.h"
 #include "nsNodeInfoManager.h"
@@ -130,18 +129,17 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLOptionElemen
 
 
 NS_IMETHODIMP
 nsHTMLOptionElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   NS_ENSURE_ARG_POINTER(aForm);
   *aForm = nsnull;
 
-  nsCOMPtr<nsIDOMHTMLSelectElement> selectControl =
-    do_QueryInterface(GetSelect());
+  nsHTMLSelectElement* selectControl = GetSelect();
 
   if (selectControl) {
     selectControl->GetForm(aForm);
   }
 
   return NS_OK;
 }
 
@@ -196,17 +194,17 @@ nsHTMLOptionElement::GetSelected(PRBool*
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLOptionElement::SetSelected(PRBool aValue)
 {
   // Note: The select content obj maintains all the PresState
   // so defer to it to get the answer
-  nsCOMPtr<nsISelectElement> selectInt = do_QueryInterface(GetSelect());
+  nsHTMLSelectElement* selectInt = GetSelect();
   if (selectInt) {
     PRInt32 index;
     GetIndex(&index);
     // This should end up calling SetSelectedInternal
     return selectInt->SetOptionsSelectedByIndex(index, index, aValue,
                                                 PR_FALSE, PR_TRUE, PR_TRUE,
                                                 nsnull);
   } else {
@@ -225,18 +223,17 @@ NS_IMPL_BOOL_ATTR(nsHTMLOptionElement, D
 NS_IMETHODIMP 
 nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
 {
   NS_ENSURE_ARG_POINTER(aIndex);
 
   *aIndex = -1; // -1 indicates the index was not found
 
   // Get our containing select content object.
-  nsCOMPtr<nsIDOMHTMLSelectElement> selectElement =
-    do_QueryInterface(GetSelect());
+  nsHTMLSelectElement* selectElement = GetSelect();
 
   if (selectElement) {
     // Get the options from the select object.
     nsCOMPtr<nsIDOMHTMLOptionsCollection> options;
     selectElement->GetOptions(getter_AddRefs(options));
 
     if (options) {
       // Walk the options to find out where we are in the list (ick, O(n))
@@ -283,19 +280,19 @@ nsHTMLOptionElement::BeforeSetAttr(PRInt
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aNamespaceID != kNameSpaceID_None || aName != nsGkAtoms::selected ||
       mSelectedChanged) {
     return NS_OK;
   }
   
   // We just changed out selected state (since we look at the "selected"
-  // attribute when mSelectedChanged is false.  Let's tell our select about
+  // attribute when mSelectedChanged is false).  Let's tell our select about
   // it.
-  nsCOMPtr<nsISelectElement> selectInt = do_QueryInterface(GetSelect());
+  nsHTMLSelectElement* selectInt = GetSelect();
   if (!selectInt) {
     return NS_OK;
   }
 
   // Note that at this point mSelectedChanged is false and as long as that's
   // true it doesn't matter what value mIsSelected has.
   NS_ASSERTION(!mSelectedChanged, "Shouldn't be here");
   
@@ -366,24 +363,24 @@ nsHTMLOptionElement::IntrinsicState() co
     state &= ~NS_EVENT_STATE_DISABLED;
     state |= NS_EVENT_STATE_ENABLED;
   }
 
   return state;
 }
 
 // Get the select content element that contains this option
-nsIContent*
+nsHTMLSelectElement*
 nsHTMLOptionElement::GetSelect()
 {
   nsIContent* parent = this;
   while ((parent = parent->GetParent()) &&
          parent->IsHTML()) {
     if (parent->Tag() == nsGkAtoms::select) {
-      return parent;
+      return nsHTMLSelectElement::FromContent(parent);
     }
     if (parent->Tag() != nsGkAtoms::optgroup) {
       break;
     }
   }
   
   return nsnull;
 }
--- a/content/html/content/src/nsHTMLOptionElement.h
+++ b/content/html/content/src/nsHTMLOptionElement.h
@@ -40,28 +40,30 @@
 
 #ifndef nsHTMLOptionElement_h__
 #define nsHTMLOptionElement_h__
 
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIJSNativeInitializer.h"
 
+class nsHTMLSelectElement;
+
 class nsHTMLOptionElement : public nsGenericHTMLElement,
                             public nsIDOMHTMLOptionElement,
                             public nsIJSNativeInitializer
 {
 public:
   nsHTMLOptionElement(already_AddRefed<nsINodeInfo> aNodeInfo);
   virtual ~nsHTMLOptionElement();
 
   /** Typesafe, non-refcounting cast from nsIContent.  Cheaper than QI. **/
   static nsHTMLOptionElement* FromContent(nsIContent *aContent)
   {
-    if (aContent->NodeInfo()->Equals(nsGkAtoms::option, kNameSpaceID_XHTML))
+    if (aContent && aContent->IsHTML(nsGkAtoms::option))
       return static_cast<nsHTMLOptionElement*>(aContent);
     return nsnull;
   }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
@@ -98,19 +100,18 @@ public:
   nsresult CopyInnerTo(nsGenericElement* aDest) const;
 
   virtual nsXPCClassInfo* GetClassInfo();
 protected:
   /**
    * Get the select content element that contains this option, this
    * intentionally does not return nsresult, all we care about is if
    * there's a select associated with this option or not.
-   * @param aSelectElement the select element (out param)
    */
-  nsIContent* GetSelect();
+  nsHTMLSelectElement* GetSelect();
 
   PRPackedBool mSelectedChanged;
   PRPackedBool mIsSelected;
 
   // True only while we're under the SetOptionsSelectedByIndex call when our
   // "selected" attribute is changing and mSelectedChanged is false.
   PRPackedBool mIsInSetDefaultSelected;
 };
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -83,54 +83,52 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsSelectSt
 // nsSafeOptionListMutation
 //
 
 nsSafeOptionListMutation::nsSafeOptionListMutation(nsIContent* aSelect,
                                                    nsIContent* aParent,
                                                    nsIContent* aKid,
                                                    PRUint32 aIndex,
                                                    PRBool aNotify)
-  : mSelect(do_QueryInterface(aSelect)), mTopLevelMutation(PR_FALSE),
-    mNeedsRebuild(PR_FALSE)
+  : mSelect(nsHTMLSelectElement::FromContent(aSelect))
+  , mTopLevelMutation(PR_FALSE)
+  , mNeedsRebuild(PR_FALSE)
 {
-  nsHTMLSelectElement* select = static_cast<nsHTMLSelectElement*>(mSelect.get());
-  if (select) {
-    mTopLevelMutation = !select->mMutating;
+  if (mSelect) {
+    mTopLevelMutation = !mSelect->mMutating;
     if (mTopLevelMutation) {
-      select->mMutating = PR_TRUE;
+      mSelect->mMutating = PR_TRUE;
     } else {
       // This is very unfortunate, but to handle mutation events properly,
       // option list must be up-to-date before inserting or removing options.
       // Fortunately this is called only if mutation event listener
       // adds or removes options.
-      select->RebuildOptionsArray(aNotify);
+      mSelect->RebuildOptionsArray(aNotify);
     }
     nsresult rv;
     if (aKid) {
       rv = mSelect->WillAddOptions(aKid, aParent, aIndex, aNotify);
     } else {
       rv = mSelect->WillRemoveOptions(aParent, aIndex, aNotify);
     }
     mNeedsRebuild = NS_FAILED(rv);
   }
 }
 
 nsSafeOptionListMutation::~nsSafeOptionListMutation()
 {
   if (mSelect) {
-    nsHTMLSelectElement* select =
-      static_cast<nsHTMLSelectElement*>(mSelect.get());
     if (mNeedsRebuild || (mTopLevelMutation && mGuard.Mutated(1))) {
-      select->RebuildOptionsArray(PR_TRUE);
+      mSelect->RebuildOptionsArray(PR_TRUE);
     }
     if (mTopLevelMutation) {
-      select->mMutating = PR_FALSE;
+      mSelect->mMutating = PR_FALSE;
     }
 #ifdef DEBUG
-    select->VerifyOptionsArray();
+    mSelect->VerifyOptionsArray();
 #endif
   }
 }
 
 //----------------------------------------------------------------------
 //
 // nsHTMLSelectElement
 //
@@ -182,19 +180,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_ADDREF_INHERITED(nsHTMLSelectElement, nsGenericElement)
 NS_IMPL_RELEASE_INHERITED(nsHTMLSelectElement, nsGenericElement)
 
 
 DOMCI_NODE_DATA(HTMLSelectElement, nsHTMLSelectElement)
 
 // QueryInterface implementation for nsHTMLSelectElement
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLSelectElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLSelectElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLSelectElement,
                                    nsIDOMHTMLSelectElement,
-                                   nsISelectElement,
                                    nsIConstraintValidation)
   NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLSelectElement,
                                                nsGenericHTMLFormElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSelectElement)
 
 
 // nsIDOMHTMLSelectElement
 
--- a/content/html/content/src/nsHTMLSelectElement.h
+++ b/content/html/content/src/nsHTMLSelectElement.h
@@ -38,17 +38,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsHTMLSelectElement_h___
 #define nsHTMLSelectElement_h___
 
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsGenericHTMLElement.h"
-#include "nsISelectElement.h"
 #include "nsIDOMHTMLSelectElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMHTMLOptionsCollection.h"
 #include "nsIDOMNSHTMLOptionCollectn.h"
 #include "nsISelectControlFrame.h"
 #include "nsContentUtils.h"
 #include "nsIHTMLCollection.h"
@@ -143,17 +142,22 @@ public:
   }
 
   /**
    * Drop the reference to the select.  Called during select destruction.
    */
   void DropReference();
 
   /**
-   * See nsISelectElement.idl for documentation on this method
+   * Finds the index of a given option element
+   *
+   * @param aOption the option to get the index of
+   * @param aStartIndex the index to start looking at
+   * @param aForward TRUE to look forward, FALSE to look backward
+   * @return the option index
    */
   nsresult GetOptionIndex(mozilla::dom::Element* aOption,
                           PRInt32 aStartIndex, PRBool aForward,
                           PRInt32* aIndex);
 
 private:
   /** The list of options (holds strong references) */
   nsTArray<nsRefPtr<nsHTMLOptionElement> > mElements;
@@ -218,41 +222,48 @@ public:
   nsSafeOptionListMutation(nsIContent* aSelect, nsIContent* aParent,
                            nsIContent* aKid, PRUint32 aIndex, PRBool aNotify);
   ~nsSafeOptionListMutation();
   void MutationFailed() { mNeedsRebuild = PR_TRUE; }
 private:
   static void* operator new(size_t) CPP_THROW_NEW { return 0; }
   static void operator delete(void*, size_t) {}
   /** The select element which option list is being mutated. */
-  nsCOMPtr<nsISelectElement> mSelect;
+  nsRefPtr<nsHTMLSelectElement> mSelect;
   /** PR_TRUE if the current mutation is the first one in the stack. */
   PRBool                     mTopLevelMutation;
   /** PR_TRUE if it is known that the option list must be recreated. */
   PRBool                     mNeedsRebuild;
   /** Option list must be recreated if more than one mutation is detected. */
   nsMutationGuard            mGuard;
 };
 
 
 /**
  * Implementation of &lt;select&gt;
  */
 class nsHTMLSelectElement : public nsGenericHTMLFormElement,
                             public nsIDOMHTMLSelectElement,
-                            public nsISelectElement,
                             public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
   nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                       mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
   virtual ~nsHTMLSelectElement();
 
+  /** Typesafe, non-refcounting cast from nsIContent.  Cheaper than QI. **/
+  static nsHTMLSelectElement* FromContent(nsIContent* aContent)
+  {
+    if (aContent && aContent->IsHTML(nsGkAtoms::select))
+      return static_cast<nsHTMLSelectElement*>(aContent);
+    return nsnull;
+  }
+ 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
 
   // nsIDOMElement
   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
@@ -278,18 +289,92 @@ public:
   NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
   NS_IMETHOD SaveState();
   virtual PRBool RestoreState(nsPresState* aState);
 
   virtual void FieldSetDisabledChanged(nsEventStates aStates, PRBool aNotify);
 
   nsEventStates IntrinsicState() const;
 
-  // nsISelectElement
-  NS_DECL_NSISELECTELEMENT
+  /**
+   * To be called when stuff is added under a child of the select--but *before*
+   * they are actually added.
+   *
+   * @param aOptions the content that was added (usually just an option, but
+   *        could be an optgroup node with many child options)
+   * @param aParent the parent the options were added to (could be an optgroup)
+   * @param aContentIndex the index where the options are being added within the
+   *        parent (if the parent is an optgroup, the index within the optgroup)
+   */
+  NS_IMETHOD WillAddOptions(nsIContent* aOptions,
+                            nsIContent* aParent,
+                            PRInt32 aContentIndex,
+                            PRBool aNotify);
+
+  /**
+   * To be called when stuff is removed under a child of the select--but
+   * *before* they are actually removed.
+   *
+   * @param aParent the parent the option(s) are being removed from
+   * @param aContentIndex the index of the option(s) within the parent (if the
+   *        parent is an optgroup, the index within the optgroup)
+   */
+  NS_IMETHOD WillRemoveOptions(nsIContent* aParent,
+                               PRInt32 aContentIndex,
+                               PRBool aNotify);
+
+  /**
+   * Checks whether an option is disabled (even if it's part of an optgroup)
+   *
+   * @param aIndex the index of the option to check
+   * @return whether the option is disabled
+   */
+  NS_IMETHOD IsOptionDisabled(PRInt32 aIndex,
+                              PRBool *aIsDisabled NS_OUTPARAM);
+
+  /**
+   * Sets multiple options (or just sets startIndex if select is single)
+   * and handles notifications and cleanup and everything under the sun.
+   * When this method exits, the select will be in a consistent state.  i.e.
+   * if you set the last option to false, it will select an option anyway.
+   *
+   * @param aStartIndex the first index to set
+   * @param aEndIndex the last index to set (set same as first index for one
+   *        option)
+   * @param aIsSelected whether to set the option(s) to true or false
+   * @param aClearAll whether to clear all other options (for example, if you
+   *        are normal-clicking on the current option)
+   * @param aSetDisabled whether it is permissible to set disabled options
+   *        (for JavaScript)
+   * @param aNotify whether to notify frames and such
+   * @return whether any options were actually changed
+   */
+  NS_IMETHOD SetOptionsSelectedByIndex(PRInt32 aStartIndex,
+                                       PRInt32 aEndIndex,
+                                       PRBool aIsSelected,
+                                       PRBool aClearAll,
+                                       PRBool aSetDisabled,
+                                       PRBool aNotify,
+                                       PRBool* aChangedSomething NS_OUTPARAM);
+
+  /**
+   * Finds the index of a given option element
+   *
+   * @param aOption the option to get the index of
+   * @param aStartIndex the index to start looking at
+   * @param aForward TRUE to look forward, FALSE to look backward
+   * @return the option index
+   */
+  NS_IMETHOD GetOptionIndex(nsIDOMHTMLOptionElement* aOption,
+                            PRInt32 aStartIndex,
+                            PRBool aForward,
+                            PRInt32* aIndex NS_OUTPARAM);
+
+  /** Whether or not there are optgroups in this select */
+  NS_IMETHOD GetHasOptGroups(PRBool* aHasGroups);
 
   /**
    * Called when an attribute is about to be changed
    */
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                                nsIContent* aBindingParent,
                                PRBool aCompileEventHandlers);
   virtual nsresult BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -97,17 +97,16 @@
 #include "nsTArray.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsTextFragment.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptGlobalObjectOwner.h"
 
 #include "nsIParserService.h"
-#include "nsISelectElement.h"
 
 #include "nsIStyleSheetLinkingElement.h"
 #include "nsITimer.h"
 #include "nsDOMError.h"
 #include "nsContentPolicyUtils.h"
 #include "nsIScriptContext.h"
 #include "nsStyleLinkElement.h"
 
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -98,17 +98,16 @@
 #include "nsIDOMHTMLBodyElement.h"
 #include "nsIDOMHTMLHeadElement.h"
 #include "nsINameSpaceManager.h"
 #include "nsGenericHTMLElement.h"
 #include "mozilla/css/Loader.h"
 #include "nsIHttpChannel.h"
 #include "nsIFile.h"
 #include "nsIEventListenerManager.h"
-#include "nsISelectElement.h"
 #include "nsFrameSelection.h"
 #include "nsISelectionPrivate.h"//for toStringwithformat code
 
 #include "nsICharsetDetector.h"
 #include "nsICharsetDetectionAdaptor.h"
 #include "nsCharsetDetectionAdaptorCID.h"
 #include "nsICharsetAlias.h"
 #include "nsContentUtils.h"
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (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.mozilla.org/MPL/
  *
@@ -98,18 +98,18 @@ public:
 
     void ClearGlobalObjectOwner();
 
 protected:
     virtual ~nsXULPDGlobalObject();
 
     nsXULPrototypeDocument* mGlobalObjectOwner; // weak reference
 
-    nsCOMPtr<nsIScriptContext>  mScriptContexts[NS_STID_ARRAY_UBOUND];
-    void *                      mScriptGlobals[NS_STID_ARRAY_UBOUND];
+    nsCOMPtr<nsIScriptContext> mContext;
+    JSObject* mJSObject;
 
     nsCOMPtr<nsIPrincipal> mCachedPrincipal;
 
     static JSClass gSharedGlobalClass;
 };
 
 nsIPrincipal* nsXULPrototypeDocument::gSystemPrincipal;
 nsXULPDGlobalObject* nsXULPrototypeDocument::gSystemGlobal;
@@ -623,35 +623,30 @@ nsXULPrototypeDocument::GetScriptGlobalO
 }
 
 //----------------------------------------------------------------------
 //
 // nsXULPDGlobalObject
 //
 
 nsXULPDGlobalObject::nsXULPDGlobalObject(nsXULPrototypeDocument* owner)
-    :  mGlobalObjectOwner(owner)
+  : mGlobalObjectOwner(owner)
+  , mJSObject(NULL)
 {
-  memset(mScriptGlobals, 0, sizeof(mScriptGlobals));
 }
 
 
 nsXULPDGlobalObject::~nsXULPDGlobalObject()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULPDGlobalObject)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_0(nsXULPDGlobalObject)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXULPDGlobalObject)
-  {
-    PRUint32 lang_index;
-    NS_STID_FOR_INDEX(lang_index) {
-      cb.NoteXPCOMChild(tmp->mScriptContexts[lang_index]);
-    }
-  }
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContext)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPDGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
 NS_INTERFACE_MAP_END
 
@@ -661,160 +656,143 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPD
 //----------------------------------------------------------------------
 //
 // nsIScriptGlobalObject methods
 //
 
 nsresult
 nsXULPDGlobalObject::SetScriptContext(PRUint32 lang_id, nsIScriptContext *aScriptContext)
 {
+  NS_ABORT_IF_FALSE(lang_id == nsIProgrammingLanguage::JAVASCRIPT,
+                    "We don't support this language ID");
   // almost a clone of nsGlobalWindow
-  nsresult rv;
-
-  PRBool ok = NS_STID_VALID(lang_id);
-  NS_ASSERTION(ok, "Invalid programming language ID requested");
-  NS_ENSURE_TRUE(ok, NS_ERROR_INVALID_ARG);
-  PRUint32 lang_ndx = NS_STID_INDEX(lang_id);
-
-  if (!aScriptContext)
+  if (!aScriptContext) {
     NS_WARNING("Possibly early removal of script object, see bug #41608");
-  else {
+  } else {
     // should probably assert the context is clean???
     aScriptContext->WillInitializeContext();
-    // NOTE: We init this context with a NULL global - this is subtly
-    // different than nsGlobalWindow which passes 'this'
-    rv = aScriptContext->InitContext();
+    nsresult rv = aScriptContext->InitContext();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  NS_ASSERTION(!aScriptContext || !mScriptContexts[lang_ndx],
-               "Bad call to SetContext()!");
+  NS_ASSERTION(!aScriptContext || !mContext, "Bad call to SetContext()!");
 
-  void *script_glob = nsnull;
+  void* script_glob = NULL;
 
   if (aScriptContext) {
     aScriptContext->SetGCOnDestruction(PR_FALSE);
     aScriptContext->DidInitializeContext();
     script_glob = aScriptContext->GetNativeGlobal();
     NS_ASSERTION(script_glob, "GetNativeGlobal returned NULL!");
   }
-  mScriptContexts[lang_ndx] = aScriptContext;
-  mScriptGlobals[lang_ndx] = script_glob;
+  mContext = aScriptContext;
+  mJSObject = static_cast<JSObject*>(script_glob);
   return NS_OK;
 }
 
 nsresult
 nsXULPDGlobalObject::EnsureScriptEnvironment(PRUint32 lang_id)
 {
-  PRBool ok = NS_STID_VALID(lang_id);
-  NS_ASSERTION(ok, "Invalid programming language ID requested");
-  NS_ENSURE_TRUE(ok, NS_ERROR_INVALID_ARG);
-  PRUint32 lang_ndx = NS_STID_INDEX(lang_id);
+  NS_ABORT_IF_FALSE(lang_id == nsIProgrammingLanguage::JAVASCRIPT,
+                    "We don't support this language ID");
+  if (mContext) {
+    return NS_OK;
+  }
+  NS_ASSERTION(!mJSObject, "Have global without context?");
 
-  if (mScriptContexts[lang_ndx] == nsnull) {
-    nsresult rv;
-    NS_ASSERTION(mScriptGlobals[lang_ndx] == nsnull, "Have global without context?");
-
-    nsCOMPtr<nsIScriptRuntime> languageRuntime;
-    rv = NS_GetScriptRuntimeByID(lang_id, getter_AddRefs(languageRuntime));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+  nsCOMPtr<nsIScriptRuntime> languageRuntime;
+  nsresult rv = NS_GetScriptRuntimeByID(nsIProgrammingLanguage::JAVASCRIPT,
+                                        getter_AddRefs(languageRuntime));
+  NS_ENSURE_SUCCESS(rv, NS_OK);
 
-    nsCOMPtr<nsIScriptContext> ctxNew;
-    rv = languageRuntime->CreateContext(getter_AddRefs(ctxNew));
-    // For JS, we have to setup a special global object.  We do this then
-    // attach it as the global for this context.  Then, ::SetScriptContext
-    // will re-fetch the global and set it up in our language globals array.
-    if (lang_id == nsIProgrammingLanguage::JAVASCRIPT) {
-      // some special JS specific code we should abstract
-      JSContext *cx = (JSContext *)ctxNew->GetNativeContext();
-      JSAutoRequest ar(cx);
+  nsCOMPtr<nsIScriptContext> ctxNew;
+  rv = languageRuntime->CreateContext(getter_AddRefs(ctxNew));
+  // We have to setup a special global object.  We do this then
+  // attach it as the global for this context.  Then, ::SetScriptContext
+  // will re-fetch the global and set it up in our language globals array.
+  {
+    JSContext *cx = (JSContext *)ctxNew->GetNativeContext();
+    JSAutoRequest ar(cx);
 
-      nsIPrincipal *principal = GetPrincipal();
-      JSObject *newGlob;
-      JSCompartment *compartment;
+    nsIPrincipal *principal = GetPrincipal();
+    JSObject *newGlob;
+    JSCompartment *compartment;
 
-      rv = xpc_CreateGlobalObject(cx, &gSharedGlobalClass, principal, nsnull,
-                                  false, &newGlob, &compartment);
-      NS_ENSURE_SUCCESS(rv, nsnull);
+    rv = xpc_CreateGlobalObject(cx, &gSharedGlobalClass, principal, nsnull,
+                                false, &newGlob, &compartment);
+    NS_ENSURE_SUCCESS(rv, NS_OK);
 
-      ::JS_SetGlobalObject(cx, newGlob);
+    ::JS_SetGlobalObject(cx, newGlob);
 
-      // Add an owning reference from JS back to us. This'll be
-      // released when the JSObject is finalized.
-      ::JS_SetPrivate(cx, newGlob, this);
-      NS_ADDREF(this);
-    }
+    // Add an owning reference from JS back to us. This'll be
+    // released when the JSObject is finalized.
+    ::JS_SetPrivate(cx, newGlob, this);
+    NS_ADDREF(this);
+  }
 
-    NS_ENSURE_SUCCESS(rv, nsnull);
-    rv = SetScriptContext(lang_id, ctxNew);
-    NS_ENSURE_SUCCESS(rv, nsnull);
-  }
+  NS_ENSURE_SUCCESS(rv, NS_OK);
+  rv = SetScriptContext(lang_id, ctxNew);
+  NS_ENSURE_SUCCESS(rv, NS_OK);
   return NS_OK;
 }
 
-nsIScriptContext *
+nsIScriptContext*
 nsXULPDGlobalObject::GetScriptContext(PRUint32 lang_id)
 {
+  NS_ABORT_IF_FALSE(lang_id == nsIProgrammingLanguage::JAVASCRIPT,
+                    "We don't support this language ID");
   // This global object creates a context on demand - do that now.
-  nsresult rv = EnsureScriptEnvironment(lang_id);
+  nsresult rv = EnsureScriptEnvironment(nsIProgrammingLanguage::JAVASCRIPT);
   if (NS_FAILED(rv)) {
     NS_ERROR("Failed to setup script language");
-    return nsnull;
+    return NULL;
   }
   // Note that EnsureScriptEnvironment has validated lang_id
-  return mScriptContexts[NS_STID_INDEX(lang_id)];
+  return mContext;
 }
 
-void *
+void*
 nsXULPDGlobalObject::GetScriptGlobal(PRUint32 lang_id)
 {
-  PRBool ok = NS_STID_VALID(lang_id);
-  NS_ASSERTION(ok, "Invalid programming language ID requested");
-  NS_ENSURE_TRUE(ok, nsnull);
-  PRUint32 lang_ndx = NS_STID_INDEX(lang_id);
-
-  NS_ASSERTION(mScriptContexts[lang_ndx] != nsnull, "Querying for global before setting up context?");
-  return mScriptGlobals[lang_ndx];
+  NS_ABORT_IF_FALSE(lang_id == nsIProgrammingLanguage::JAVASCRIPT,
+                    "We don't support this language ID");
+  return mJSObject;
 }
 
 
 void
 nsXULPDGlobalObject::ClearGlobalObjectOwner()
 {
-    NS_ASSERTION(!mCachedPrincipal, "This shouldn't ever be set until now!");
+  NS_ASSERTION(!mCachedPrincipal, "This shouldn't ever be set until now!");
 
-    // Cache mGlobalObjectOwner's principal if possible.
-    if (this != nsXULPrototypeDocument::gSystemGlobal)
-        mCachedPrincipal = mGlobalObjectOwner->DocumentPrincipal();
+  // Cache mGlobalObjectOwner's principal if possible.
+  if (this != nsXULPrototypeDocument::gSystemGlobal)
+    mCachedPrincipal = mGlobalObjectOwner->DocumentPrincipal();
 
-    PRUint32 lang_ndx;
-    NS_STID_FOR_INDEX(lang_ndx) {
-        if (mScriptContexts[lang_ndx]) {
-            mScriptContexts[lang_ndx]->FinalizeContext();
-            mScriptContexts[lang_ndx] = nsnull;
-        }
-    }
+  if (mContext) {
+    mContext->FinalizeContext();
+    mContext = NULL;
+  }
 
-    mGlobalObjectOwner = nsnull;
+  mGlobalObjectOwner = NULL;
 }
 
 
 void
 nsXULPDGlobalObject::OnFinalize(PRUint32 aLangID, void *aObject)
 {
-    NS_ASSERTION(NS_STID_VALID(aLangID), "Invalid language ID");
-    NS_ASSERTION(aObject == mScriptGlobals[NS_STID_INDEX(aLangID)],
-                 "Wrong object finalized!");
-    mScriptGlobals[NS_STID_INDEX(aLangID)] = nsnull;
+  NS_ABORT_IF_FALSE(aLangID == nsIProgrammingLanguage::JAVASCRIPT,
+                    "We don't support this language ID");
+  mJSObject = NULL;
 }
 
 void
 nsXULPDGlobalObject::SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts)
 {
-    // We don't care...
+  // We don't care...
 }
 
 //----------------------------------------------------------------------
 //
 // nsIScriptObjectPrincipal methods
 //
 
 nsIPrincipal*
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -75,17 +75,17 @@ ifdef MOZ_SMIL
 DIRS += interfaces/smil
 endif
 
 DIRS += \
   public/coreEvents \
   base \
   src \
   locales \
-  plugins \
+  plugins/ipc \
   indexedDB \
   system \
   ipc \
   $(NULL)
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
rename from dom/plugins/AStream.h
rename to dom/plugins/ipc/AStream.h
rename from dom/plugins/BrowserStreamChild.cpp
rename to dom/plugins/ipc/BrowserStreamChild.cpp
rename from dom/plugins/BrowserStreamChild.h
rename to dom/plugins/ipc/BrowserStreamChild.h
rename from dom/plugins/BrowserStreamParent.cpp
rename to dom/plugins/ipc/BrowserStreamParent.cpp
rename from dom/plugins/BrowserStreamParent.h
rename to dom/plugins/ipc/BrowserStreamParent.h
rename from dom/plugins/COMMessageFilter.cpp
rename to dom/plugins/ipc/COMMessageFilter.cpp
rename from dom/plugins/COMMessageFilter.h
rename to dom/plugins/ipc/COMMessageFilter.h
rename from dom/plugins/ChildAsyncCall.cpp
rename to dom/plugins/ipc/ChildAsyncCall.cpp
rename from dom/plugins/ChildAsyncCall.h
rename to dom/plugins/ipc/ChildAsyncCall.h
rename from dom/plugins/ChildTimer.cpp
rename to dom/plugins/ipc/ChildTimer.cpp
rename from dom/plugins/ChildTimer.h
rename to dom/plugins/ipc/ChildTimer.h
rename from dom/plugins/Makefile.in
rename to dom/plugins/ipc/Makefile.in
--- a/dom/plugins/Makefile.in
+++ b/dom/plugins/ipc/Makefile.in
@@ -30,17 +30,17 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH = ../..
+DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = dom
 
rename from dom/plugins/NPEventAndroid.h
rename to dom/plugins/ipc/NPEventAndroid.h
rename from dom/plugins/NPEventOSX.h
rename to dom/plugins/ipc/NPEventOSX.h
rename from dom/plugins/NPEventWindows.h
rename to dom/plugins/ipc/NPEventWindows.h
rename from dom/plugins/NPEventX11.h
rename to dom/plugins/ipc/NPEventX11.h
rename from dom/plugins/NestedLoopTimer.cpp
rename to dom/plugins/ipc/NestedLoopTimer.cpp
rename from dom/plugins/NestedLoopTimer.h
rename to dom/plugins/ipc/NestedLoopTimer.h
rename from dom/plugins/PBrowserStream.ipdl
rename to dom/plugins/ipc/PBrowserStream.ipdl
rename from dom/plugins/PPluginBackgroundDestroyer.ipdl
rename to dom/plugins/ipc/PPluginBackgroundDestroyer.ipdl
rename from dom/plugins/PPluginIdentifier.ipdl
rename to dom/plugins/ipc/PPluginIdentifier.ipdl
rename from dom/plugins/PPluginInstance.ipdl
rename to dom/plugins/ipc/PPluginInstance.ipdl
rename from dom/plugins/PPluginModule.ipdl
rename to dom/plugins/ipc/PPluginModule.ipdl
rename from dom/plugins/PPluginScriptableObject.ipdl
rename to dom/plugins/ipc/PPluginScriptableObject.ipdl
rename from dom/plugins/PPluginStream.ipdl
rename to dom/plugins/ipc/PPluginStream.ipdl
rename from dom/plugins/PPluginSurface.ipdl
rename to dom/plugins/ipc/PPluginSurface.ipdl
rename from dom/plugins/PStreamNotify.ipdl
rename to dom/plugins/ipc/PStreamNotify.ipdl
rename from dom/plugins/PluginBackgroundDestroyer.h
rename to dom/plugins/ipc/PluginBackgroundDestroyer.h
rename from dom/plugins/PluginIdentifierChild.h
rename to dom/plugins/ipc/PluginIdentifierChild.h
rename from dom/plugins/PluginIdentifierParent.h
rename to dom/plugins/ipc/PluginIdentifierParent.h
rename from dom/plugins/PluginInstanceChild.cpp
rename to dom/plugins/ipc/PluginInstanceChild.cpp
rename from dom/plugins/PluginInstanceChild.h
rename to dom/plugins/ipc/PluginInstanceChild.h
rename from dom/plugins/PluginInstanceParent.cpp
rename to dom/plugins/ipc/PluginInstanceParent.cpp
rename from dom/plugins/PluginInstanceParent.h
rename to dom/plugins/ipc/PluginInstanceParent.h
rename from dom/plugins/PluginInterposeOSX.h
rename to dom/plugins/ipc/PluginInterposeOSX.h
rename from dom/plugins/PluginInterposeOSX.mm
rename to dom/plugins/ipc/PluginInterposeOSX.mm
rename from dom/plugins/PluginLibrary.h
rename to dom/plugins/ipc/PluginLibrary.h
rename from dom/plugins/PluginMessageUtils.cpp
rename to dom/plugins/ipc/PluginMessageUtils.cpp
rename from dom/plugins/PluginMessageUtils.h
rename to dom/plugins/ipc/PluginMessageUtils.h
rename from dom/plugins/PluginModuleChild.cpp
rename to dom/plugins/ipc/PluginModuleChild.cpp
rename from dom/plugins/PluginModuleChild.h
rename to dom/plugins/ipc/PluginModuleChild.h
rename from dom/plugins/PluginModuleParent.cpp
rename to dom/plugins/ipc/PluginModuleParent.cpp
rename from dom/plugins/PluginModuleParent.h
rename to dom/plugins/ipc/PluginModuleParent.h
rename from dom/plugins/PluginProcessChild.cpp
rename to dom/plugins/ipc/PluginProcessChild.cpp
rename from dom/plugins/PluginProcessChild.h
rename to dom/plugins/ipc/PluginProcessChild.h
rename from dom/plugins/PluginProcessParent.cpp
rename to dom/plugins/ipc/PluginProcessParent.cpp
rename from dom/plugins/PluginProcessParent.h
rename to dom/plugins/ipc/PluginProcessParent.h
rename from dom/plugins/PluginScriptableObjectChild.cpp
rename to dom/plugins/ipc/PluginScriptableObjectChild.cpp
rename from dom/plugins/PluginScriptableObjectChild.h
rename to dom/plugins/ipc/PluginScriptableObjectChild.h
rename from dom/plugins/PluginScriptableObjectParent.cpp
rename to dom/plugins/ipc/PluginScriptableObjectParent.cpp
rename from dom/plugins/PluginScriptableObjectParent.h
rename to dom/plugins/ipc/PluginScriptableObjectParent.h
rename from dom/plugins/PluginScriptableObjectUtils-inl.h
rename to dom/plugins/ipc/PluginScriptableObjectUtils-inl.h
rename from dom/plugins/PluginScriptableObjectUtils.h
rename to dom/plugins/ipc/PluginScriptableObjectUtils.h
rename from dom/plugins/PluginStreamChild.cpp
rename to dom/plugins/ipc/PluginStreamChild.cpp
rename from dom/plugins/PluginStreamChild.h
rename to dom/plugins/ipc/PluginStreamChild.h
rename from dom/plugins/PluginStreamParent.cpp
rename to dom/plugins/ipc/PluginStreamParent.cpp
rename from dom/plugins/PluginStreamParent.h
rename to dom/plugins/ipc/PluginStreamParent.h
rename from dom/plugins/PluginSurfaceParent.cpp
rename to dom/plugins/ipc/PluginSurfaceParent.cpp
rename from dom/plugins/PluginSurfaceParent.h
rename to dom/plugins/ipc/PluginSurfaceParent.h
rename from dom/plugins/PluginUtilsOSX.h
rename to dom/plugins/ipc/PluginUtilsOSX.h
rename from dom/plugins/PluginUtilsOSX.mm
rename to dom/plugins/ipc/PluginUtilsOSX.mm
rename from dom/plugins/StreamNotifyChild.h
rename to dom/plugins/ipc/StreamNotifyChild.h
rename from dom/plugins/StreamNotifyParent.h
rename to dom/plugins/ipc/StreamNotifyParent.h
rename from dom/plugins/ipdl.mk
rename to dom/plugins/ipc/ipdl.mk
--- a/embedding/android/GeckoInputConnection.java
+++ b/embedding/android/GeckoInputConnection.java
@@ -152,17 +152,17 @@ public class GeckoInputConnection
             // Set style to none
             GeckoAppShell.sendEventToGecko(
                 new GeckoEvent(0, mComposingText.length(),
                                GeckoEvent.IME_RANGE_RAWINPUT, 0, 0, 0,
                                mComposingText));
             GeckoAppShell.sendEventToGecko(
                 new GeckoEvent(GeckoEvent.IME_COMPOSITION_END, 0, 0));
             mComposing = false;
-            mComposingText = null;
+            mComposingText = "";
 
             // Make sure caret stays at the same position
             GeckoAppShell.sendEventToGecko(
                 new GeckoEvent(GeckoEvent.IME_SET_SELECTION,
                                mCompositionStart + mCompositionSelStart, 0));
         }
         return true;
     }
@@ -527,17 +527,17 @@ public class GeckoInputConnection
         int maxLen = GeckoApp.surfaceView.mEditable.length();
         Selection.setSelection(GeckoApp.surfaceView.mEditable, 
                                Math.min(start, maxLen),
                                Math.min(end, maxLen));
     }
 
     public void reset() {
         mComposing = false;
-        mComposingText = null;
+        mComposingText = "";
         mUpdateRequest = null;
     }
 
     // TextWatcher
     public void onTextChanged(CharSequence s, int start, int before, int count)
     {
         GeckoAppShell.sendEventToGecko(
             new GeckoEvent(GeckoEvent.IME_SET_SELECTION, start, before));
@@ -573,17 +573,17 @@ public class GeckoInputConnection
 
     public void beforeTextChanged(CharSequence s, int start, int count, int after)
     {
     }
 
     // Is a composition active?
     boolean mComposing;
     // Composition text when a composition is active
-    String mComposingText;
+    String mComposingText = "";
     // Start index of the composition within the text body
     int mCompositionStart;
     /* During a composition, we should not alter the real selection,
         therefore we keep our own offsets to emulate selection */
     // Start of fake selection, relative to start of composition
     int mCompositionSelStart;
     // Length of fake selection
     int mCompositionSelLen;
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -103,28 +103,26 @@ gfxUserFontSet::gfxUserFontSet()
     mFontFamilies.Init(5);
     IncrementGeneration();
 }
 
 gfxUserFontSet::~gfxUserFontSet()
 {
 }
 
-gfxFontEntry*
+void
 gfxUserFontSet::AddFontFace(const nsAString& aFamilyName,
                             const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
                             PRUint32 aWeight,
                             PRUint32 aStretch,
                             PRUint32 aItalicStyle,
                             const nsString& aFeatureSettings,
                             const nsString& aLanguageOverride,
                             gfxSparseBitSet *aUnicodeRanges)
 {
-    gfxProxyFontEntry *proxyEntry = nsnull;
-
     nsAutoString key(aFamilyName);
     ToLowerCase(key);
 
     PRBool found;
 
     if (aWeight == 0)
         aWeight = FONT_WEIGHT_NORMAL;
 
@@ -132,57 +130,39 @@ gfxUserFontSet::AddFontFace(const nsAStr
 
     gfxMixedFontFamily *family = mFontFamilies.GetWeak(key, &found);
     if (!family) {
         family = new gfxMixedFontFamily(aFamilyName);
         mFontFamilies.Put(key, family);
     }
 
     // construct a new face and add it into the family
-    nsTArray<gfxFontFeature> featureSettings;
-    gfxFontStyle::ParseFontFeatureSettings(aFeatureSettings,
-                                           featureSettings);
-    PRUint32 languageOverride =
-        gfxFontStyle::ParseFontLanguageOverride(aLanguageOverride);
-    proxyEntry = 
-        new gfxProxyFontEntry(aFontFaceSrcList, family, aWeight, aStretch, 
-                              aItalicStyle,
-                              featureSettings,
-                              languageOverride,
-                              aUnicodeRanges);
-    family->AddFontEntry(proxyEntry);
+    if (family) {
+        nsTArray<gfxFontFeature> featureSettings;
+        gfxFontStyle::ParseFontFeatureSettings(aFeatureSettings,
+                                               featureSettings);
+        PRUint32 languageOverride =
+            gfxFontStyle::ParseFontLanguageOverride(aLanguageOverride);
+        gfxProxyFontEntry *proxyEntry = 
+            new gfxProxyFontEntry(aFontFaceSrcList, family, aWeight, aStretch, 
+                                  aItalicStyle,
+                                  featureSettings,
+                                  languageOverride,
+                                  aUnicodeRanges);
+        family->AddFontEntry(proxyEntry);
 #ifdef PR_LOGGING
-    if (LOG_ENABLED()) {
-        LOG(("userfonts (%p) added (%s) with style: %s weight: %d stretch: %d", 
-             this, NS_ConvertUTF16toUTF8(aFamilyName).get(), 
-             (aItalicStyle & FONT_STYLE_ITALIC ? "italic" : 
-                 (aItalicStyle & FONT_STYLE_OBLIQUE ? "oblique" : "normal")), 
-             aWeight, aStretch));
-    }
+        if (LOG_ENABLED()) {
+            LOG(("userfonts (%p) added (%s) with style: %s weight: %d stretch: %d", 
+                 this, NS_ConvertUTF16toUTF8(aFamilyName).get(), 
+                 (aItalicStyle & FONT_STYLE_ITALIC ? "italic" : 
+                     (aItalicStyle & FONT_STYLE_OBLIQUE ? "oblique" : "normal")), 
+                 aWeight, aStretch));
+        }
 #endif
-
-    return proxyEntry;
-}
-
-void
-gfxUserFontSet::AddFontFace(const nsAString& aFamilyName,
-                            gfxFontEntry     *aFontEntry)
-{
-    nsAutoString key(aFamilyName);
-    ToLowerCase(key);
-
-    PRBool found;
-
-    gfxMixedFontFamily *family = mFontFamilies.GetWeak(key, &found);
-    if (!family) {
-        family = new gfxMixedFontFamily(aFamilyName);
-        mFontFamilies.Put(key, family);
     }
-
-    family->AddFontEntry(aFontEntry);
 }
 
 gfxFontEntry*
 gfxUserFontSet::FindFontEntry(const nsAString& aName, 
                               const gfxFontStyle& aFontStyle, 
                               PRBool& aFoundFamily,
                               PRBool& aNeedsBold,
                               PRBool& aWaitForUserFont)
@@ -556,17 +536,17 @@ gfxUserFontSet::OnLoadComplete(gfxFontEn
         }
 
         if (fe) {
             // copy OpenType feature/language settings from the proxy to the
             // newly-created font entry
             fe->mFeatureSettings.AppendElements(pe->mFeatureSettings);
             fe->mLanguageOverride = pe->mLanguageOverride;
 
-            ReplaceFontEntry(pe, fe);
+            static_cast<gfxMixedFontFamily*>(pe->mFamily)->ReplaceFontEntry(pe, fe);
             IncrementGeneration();
 #ifdef PR_LOGGING
             if (LOG_ENABLED()) {
                 nsCAutoString fontURI;
                 pe->mSrcList[pe->mSrcIndex].mURI->GetSpec(fontURI);
                 LOG(("userfonts (%p) [src %d] loaded uri: (%s) for (%s) gen: %8.8x\n",
                      this, pe->mSrcIndex, fontURI.get(),
                      NS_ConvertUTF16toUTF8(pe->mFamily->Name()).get(),
@@ -645,17 +625,17 @@ gfxUserFontSet::LoadNext(gfxProxyFontEnt
             if (fe) {
                 LOG(("userfonts (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n", 
                      this, aProxyEntry->mSrcIndex, 
                      NS_ConvertUTF16toUTF8(currSrc.mLocalName).get(), 
                      NS_ConvertUTF16toUTF8(aProxyEntry->mFamily->Name()).get(), 
                      PRUint32(mGeneration)));
                 fe->mFeatureSettings.AppendElements(aProxyEntry->mFeatureSettings);
                 fe->mLanguageOverride = aProxyEntry->mLanguageOverride;
-                ReplaceFontEntry(aProxyEntry, fe);
+                static_cast<gfxMixedFontFamily*>(aProxyEntry->mFamily)->ReplaceFontEntry(aProxyEntry, fe);
                 return STATUS_LOADED;
             } else {
                 LOG(("userfonts (%p) [src %d] failed local: (%s) for (%s)\n", 
                      this, aProxyEntry->mSrcIndex, 
                      NS_ConvertUTF16toUTF8(currSrc.mLocalName).get(), 
                      NS_ConvertUTF16toUTF8(aProxyEntry->mFamily->Name()).get()));            
             }
         } 
--- a/gfx/thebes/gfxUserFontSet.h
+++ b/gfx/thebes/gfxUserFontSet.h
@@ -89,40 +89,36 @@ public:
     gfxMixedFontFamily(const nsAString& aName)
         : gfxFontFamily(aName) { }
 
     virtual ~gfxMixedFontFamily() { }
 
     void AddFontEntry(gfxFontEntry *aFontEntry) {
         nsRefPtr<gfxFontEntry> fe = aFontEntry;
         mAvailableFonts.AppendElement(fe);
-        aFontEntry->SetFamily(this);
     }
 
     void ReplaceFontEntry(gfxFontEntry *aOldFontEntry, gfxFontEntry *aNewFontEntry) 
     {
         PRUint32 numFonts = mAvailableFonts.Length();
         for (PRUint32 i = 0; i < numFonts; i++) {
             gfxFontEntry *fe = mAvailableFonts[i];
             if (fe == aOldFontEntry) {
                 mAvailableFonts[i] = aNewFontEntry;
-                aOldFontEntry->SetFamily(nsnull);
-                aNewFontEntry->SetFamily(this);
                 return;
             }
         }
     }
 
     void RemoveFontEntry(gfxFontEntry *aFontEntry) 
     {
         PRUint32 numFonts = mAvailableFonts.Length();
         for (PRUint32 i = 0; i < numFonts; i++) {
             gfxFontEntry *fe = mAvailableFonts[i];
             if (fe == aFontEntry) {
-                aFontEntry->SetFamily(nsnull);
                 mAvailableFonts.RemoveElementAt(i);
                 return;
             }
         }
     }
 
     // temp method to determine if all proxies are loaded
     PRBool AllLoaded() 
@@ -171,27 +167,24 @@ public:
         STATUS_END_OF_LIST
     };
 
 
     // add in a font face
     // weight, stretch - 0 == unknown, [1, 9] otherwise
     // italic style = constants in gfxFontConstants.h, e.g. NS_FONT_STYLE_NORMAL
     // TODO: support for unicode ranges not yet implemented
-    gfxFontEntry *AddFontFace(const nsAString& aFamilyName,
-                              const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
-                              PRUint32 aWeight,
-                              PRUint32 aStretch,
-                              PRUint32 aItalicStyle,
-                              const nsString& aFeatureSettings,
-                              const nsString& aLanguageOverride,
-                              gfxSparseBitSet *aUnicodeRanges = nsnull);
-
-    // add in a font face for which we have the gfxFontEntry already
-    void AddFontFace(const nsAString& aFamilyName, gfxFontEntry* aFontEntry);
+    void AddFontFace(const nsAString& aFamilyName,
+                     const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
+                     PRUint32 aWeight,
+                     PRUint32 aStretch,
+                     PRUint32 aItalicStyle,
+                     const nsString& aFeatureSettings,
+                     const nsString& aLanguageOverride,
+                     gfxSparseBitSet *aUnicodeRanges = nsnull);
 
     // Whether there is a face with this family name
     PRBool HasFamily(const nsAString& aFamilyName) const
     {
         return GetFamily(aFamilyName) != nsnull;
     }
 
     // lookup a font entry for a given style, returns null if not loaded
@@ -211,22 +204,16 @@ public:
     // returns true if platform font creation sucessful (or local()
     // reference was next in line)
     // Ownership of aFontData is passed in here; the font set must
     // ensure that it is eventually deleted with NS_Free().
     PRBool OnLoadComplete(gfxFontEntry *aFontToLoad,
                           const PRUint8 *aFontData, PRUint32 aLength,
                           nsresult aDownloadStatus);
 
-    // Replace a proxy with a real fontEntry; this is implemented in
-    // nsUserFontSet in order to keep track of the entry corresponding
-    // to each @font-face rule.
-    virtual void ReplaceFontEntry(gfxProxyFontEntry *aProxy,
-                                  gfxFontEntry *aFontEntry) = 0;
-
     // generation - each time a face is loaded, generation is
     // incremented so that the change can be recognized 
     PRUint64 GetGeneration() { return mGeneration; }
 
     // increment the generation on font load
     void IncrementGeneration();
 
 protected:
--- a/ipc/ipdl/Makefile.in
+++ b/ipc/ipdl/Makefile.in
@@ -50,17 +50,17 @@ FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 
 ##-----------------------------------------------------------------------------
 ## When you add IPDL files to a source directory, list the directory here.
 ##
 IPDLDIRS =  \
   uriloader/exthandler \
-  dom/plugins  \
+  dom/plugins/ipc  \
   dom/ipc  \
   dom/src/storage \
   gfx/layers/ipc \
   ipc/testshell  \
   js/ipc  \
   js/jetpack \
   layout/ipc \
   netwerk/ipc  \
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -830,16 +830,18 @@ endif
 
 ifdef TIERS
 DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_dirs))
 STATIC_DIRS += $(foreach tier,$(TIERS),$(tier_$(tier)_staticdirs))
 endif
 
 OPTIMIZE_JARS_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/optimizejars.py)
 
+CREATE_PRECOMPLETE_CMD = $(PYTHON) $(call core_abspath,$(topsrcdir)/config/createprecomplete.py)
+
 EXPAND_LIBS = $(PYTHON) -I$(DEPTH)/config $(topsrcdir)/config/expandlibs.py
 EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_exec.py
 EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config $(topsrcdir)/config/expandlibs_gen.py
 EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
 EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
 EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
 EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
 EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)
--- a/js/src/config/milestone.txt
+++ b/js/src/config/milestone.txt
@@ -5,9 +5,9 @@
 #    x.x.x.x
 #    x.x.x+
 #
 # Referenced by milestone.pl.
 # Hopefully I'll be able to automate replacement of *all*
 # hardcoded milestones in the tree from these two files.
 #--------------------------------------------------------
 
-2.2a1pre
+6.0a1
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arguments/testDelArg3.js
@@ -0,0 +1,42 @@
+function assertGood(x) {
+    assertEq(x, "good");
+}
+
+(function() {
+    var a = arguments;
+    return function() {
+        assertGood.apply(null, a);
+    }
+})("good")();
+
+(function() {
+    var a = arguments;
+    return function() {
+        a[0] = "good";
+        assertGood.apply(null, a);
+    }
+})("bad")();
+
+Object.prototype[0] = "good";
+
+(function() {
+    var a = arguments;
+    return function() {
+        delete a[0];
+        assertGood.apply(null, a);
+    }
+})("bad")();
+
+delete Object.prototype[0];
+
+function assertUndefined(x) {
+    assertEq(x, undefined);
+}
+
+(function() {
+    var a = arguments;
+    return function() {
+        a[0] = "bad";
+        assertUndefined.apply(null, a);
+    }
+})()();
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arguments/testDelArg3Strict.js
@@ -0,0 +1,44 @@
+"use strict";
+
+function assertGood(x) {
+    assertEq(x, "good");
+}
+
+(function() {
+    var a = arguments;
+    return function() {
+        assertGood.apply(null, a);
+    }
+})("good")();
+
+(function() {
+    var a = arguments;
+    return function() {
+        a[0] = "good";
+        assertGood.apply(null, a);
+    }
+})("bad")();
+
+Object.prototype[0] = "good";
+
+(function() {
+    var a = arguments;
+    return function() {
+        delete a[0];
+        assertGood.apply(null, a);
+    }
+})("bad")();
+
+delete Object.prototype[0];
+
+function assertUndefined(x) {
+    assertEq(x, undefined);
+}
+
+(function() {
+    var a = arguments;
+    return function() {
+        a[0] = "bad";
+        assertUndefined.apply(null, a);
+    }
+})()();
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4237,17 +4237,17 @@ JS_NewArrayObject(JSContext *cx, jsint l
     return NewDenseCopiedArray(cx, (jsuint)length, Valueify(vector));
 }
 
 JS_PUBLIC_API(JSBool)
 JS_IsArrayObject(JSContext *cx, JSObject *obj)
 {
     assertSameCompartment(cx, obj);
     return obj->isArray() ||
-           (obj->isWrapper() && JSWrapper::wrappedObject(obj)->isArray());
+           (obj->isWrapper() && obj->unwrap()->isArray());
 }
 
 JS_PUBLIC_API(JSBool)
 JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp)
 {
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj);
     return js_GetLengthProperty(cx, obj, lengthp);
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -407,44 +407,64 @@ GetElement(JSContext *cx, JSObject *obj,
             return JS_FALSE;
         *hole = JS_FALSE;
     }
     return JS_TRUE;
 }
 
 namespace js {
 
+struct STATIC_SKIP_INFERENCE CopyNonHoleArgsTo
+{
+    CopyNonHoleArgsTo(JSObject *aobj, Value *dst) : aobj(aobj), dst(dst) {}
+    JSObject *aobj;
+    Value *dst;
+    bool operator()(uintN argi, Value *src) {
+        if (aobj->getArgsElement(argi).isMagic(JS_ARGS_HOLE))
+            return false;
+        *dst++ = *src;
+        return true;
+    }
+};
+
 bool
 GetElements(JSContext *cx, JSObject *aobj, jsuint length, Value *vp)
 {
     if (aobj->isDenseArray() && length <= aobj->getDenseArrayInitializedLength() &&
         !js_PrototypeHasIndexedProperties(cx, aobj)) {
         /* The prototype does not have indexed properties so hole = undefined */
         Value *srcbeg = aobj->getDenseArrayElements();
         Value *srcend = srcbeg + length;
         for (Value *dst = vp, *src = srcbeg; src < srcend; ++dst, ++src)
             *dst = src->isMagic(JS_ARRAY_HOLE) ? UndefinedValue() : *src;
     } else if (aobj->isArguments() && !aobj->isArgsLengthOverridden() &&
                !js_PrototypeHasIndexedProperties(cx, aobj)) {
         /*
-         * Two cases, two loops: note how in the case of an active stack frame
-         * backing aobj, even though we copy from fp->argv, we still must check
-         * aobj->getArgsElement(i) for a hole, to handle a delete on the
-         * corresponding arguments element. See args_delProperty.
+         * If the argsobj is for an active call, then the elements are the
+         * live args on the stack. Otherwise, the elements are the args that
+         * were copied into the argsobj by PutActivationObjects when the
+         * function returned. In both cases, it is necessary to fall off the
+         * fast path for deleted properties (MagicValue(JS_ARGS_HOLE) since
+         * this requires general-purpose property lookup.
          */
         if (JSStackFrame *fp = (JSStackFrame *) aobj->getPrivate()) {
             JS_ASSERT(fp->numActualArgs() <= JS_ARGS_LENGTH_MAX);
-            fp->forEachCanonicalActualArg(CopyNonHoleArgsTo(aobj, vp));
+            if (!fp->forEachCanonicalActualArg(CopyNonHoleArgsTo(aobj, vp)))
+                goto found_deleted_prop;
         } else {
             Value *srcbeg = aobj->getArgsElements();
             Value *srcend = srcbeg + length;
-            for (Value *dst = vp, *src = srcbeg; src < srcend; ++dst, ++src)
-                *dst = src->isMagic(JS_ARGS_HOLE) ? UndefinedValue() : *src;
+            for (Value *dst = vp, *src = srcbeg; src < srcend; ++dst, ++src) {
+                if (src->isMagic(JS_ARGS_HOLE))
+                    goto found_deleted_prop;
+                *dst = *src;
+            }
         }
     } else {
+      found_deleted_prop:
         for (uintN i = 0; i < length; i++) {
             if (!aobj->getProperty(cx, INT_TO_JSID(jsint(i)), &vp[i]))
                 return JS_FALSE;
         }
     }
 
     return true;
 }
@@ -2731,17 +2751,17 @@ array_concat(JSContext *cx, uintN argc, 
     /* Loop over [0, argc] to concat args into nobj, expanding all Arrays. */
     for (uintN i = 0; i <= argc; i++) {
         if (!JS_CHECK_OPERATION_LIMIT(cx))
             return false;
         const Value &v = p[i];
         if (v.isObject()) {
             aobj = &v.toObject();
             if (aobj->isArray() ||
-                (aobj->isWrapper() && JSWrapper::wrappedObject(aobj)->isArray())) {
+                (aobj->isWrapper() && aobj->unwrap()->isArray())) {
                 jsid id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
                 if (!aobj->getProperty(cx, id, tvr.addr()))
                     return false;
                 jsuint alength;
                 if (!ValueToLength(cx, tvr.addr(), &alength))
                     return false;
                 for (jsuint slot = 0; slot < alength; slot++) {
                     JSBool hole;
@@ -3406,17 +3426,17 @@ array_TypeExtraSome(JSContext *cx, JSTyp
 
 static JSBool
 array_isArray(JSContext *cx, uintN argc, Value *vp)
 {
     JSObject *obj;
     vp->setBoolean(argc > 0 &&
                    vp[2].isObject() &&
                    ((obj = &vp[2].toObject())->isArray() ||
-                    (obj->isWrapper() && JSWrapper::wrappedObject(obj)->isArray())));
+                    (obj->isWrapper() && obj->unwrap()->isArray())));
     return true;
 }
 
 #define GENERIC JSFUN_GENERIC_NATIVE
 
 static JSFunctionSpec array_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN_TYPE(js_toSource_str,      array_toSource,     0,0, JS_TypeHandlerString),
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -126,19 +126,21 @@ StackSegment::contains(const JSStackFram
     }
 
     if (fp > start)
         return false;
 
 #ifdef DEBUG
     bool found = false;
     JSStackFrame *stop = initialFrame->prev();
-    for (JSStackFrame *f = start; !found && f != stop; f = f->prev()) {
-        if (f == fp)
+    for (JSStackFrame *f = start; f != stop; f = f->prev()) {
+        if (f == fp) {
             found = true;
+            break;
+        }
     }
     JS_ASSERT(found);
 #endif
 
     return true;
 }
 
 JSStackFrame *
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -224,20 +224,21 @@ NewArguments(JSContext *cx, JSObject *pa
 
     return argsobj;
 }
 
 struct STATIC_SKIP_INFERENCE PutArg
 {
     PutArg(Value *dst) : dst(dst) {}
     Value *dst;
-    void operator()(uintN, Value *src) {
+    bool operator()(uintN, Value *src) {
         if (!dst->isMagic(JS_ARGS_HOLE))
             *dst = *src;
         ++dst;
+        return true;
     }
 };
 
 JSObject *
 js_GetArgsObject(JSContext *cx, JSStackFrame *fp)
 {
     /*
      * We must be in a function activation; the function must be lightweight
--- a/js/src/jsinterp.h
+++ b/js/src/jsinterp.h
@@ -425,18 +425,23 @@ struct JSStackFrame
                : NULL;
     }
 
     inline uintN numActualArgs() const;
     inline js::Value *actualArgs() const;
     inline js::Value *actualArgsEnd() const;
 
     inline js::Value &canonicalActualArg(uintN i) const;
-    template <class Op> inline void forEachCanonicalActualArg(Op op);
-    template <class Op> inline void forEachFormalArg(Op op);
+
+    /*
+     * Apply 'op' to each arg of the specified type. Stop if 'op' returns
+     * false. Return 'true' iff all 'op' calls returned true.
+     */
+    template <class Op> inline bool forEachCanonicalActualArg(Op op);
+    template <class Op> inline bool forEachFormalArg(Op op);
 
     inline void clearMissingArgs();
 
     bool hasArgsObj() const {
         return !!(flags_ & JSFRAME_HAS_ARGS_OBJ);
     }
 
     JSObject &argsObj() const {
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -303,72 +303,69 @@ JSStackFrame::canonicalActualArg(uintN i
 {
     if (i < numFormalArgs())
         return formalArg(i);
     JS_ASSERT(i < numActualArgs());
     return actualArgs()[i];
 }
 
 template <class Op>
-inline void
+inline bool
 JSStackFrame::forEachCanonicalActualArg(Op op)
 {
     uintN nformal = fun()->nargs;
     js::Value *formals = formalArgsEnd() - nformal;
     uintN nactual = numActualArgs();
     if (nactual <= nformal) {
         uintN i = 0;
         js::Value *actualsEnd = formals + nactual;
-        for (js::Value *p = formals; p != actualsEnd; ++p, ++i)
-            op(i, p);
+        for (js::Value *p = formals; p != actualsEnd; ++p, ++i) {
+            if (!op(i, p))
+                return false;
+        }
     } else {
         uintN i = 0;
         js::Value *formalsEnd = formalArgsEnd();
-        for (js::Value *p = formals; p != formalsEnd; ++p, ++i)
-            op(i, p);
+        for (js::Value *p = formals; p != formalsEnd; ++p, ++i) {
+            if (!op(i, p))
+                return false;
+        }
         js::Value *actuals = formalsEnd - (nactual + 2);
         js::Value *actualsEnd = formals - 2;
-        for (js::Value *p = actuals; p != actualsEnd; ++p, ++i)
-            op(i, p);
+        for (js::Value *p = actuals; p != actualsEnd; ++p, ++i) {
+            if (!op(i, p))
+                return false;
+        }
     }
+    return true;
 }
 
 template <class Op>
-inline void
+inline bool
 JSStackFrame::forEachFormalArg(Op op)
 {
     js::Value *formals = formalArgsEnd() - fun()->nargs;
     js::Value *formalsEnd = formalArgsEnd();
     uintN i = 0;
-    for (js::Value *p = formals; p != formalsEnd; ++p, ++i)
-        op(i, p);
+    for (js::Value *p = formals; p != formalsEnd; ++p, ++i) {
+        if (!op(i, p))
+            return false;
+    }
+    return true;
 }
 
 namespace js {
 
-struct STATIC_SKIP_INFERENCE CopyNonHoleArgsTo
-{
-    CopyNonHoleArgsTo(JSObject *aobj, Value *dst) : aobj(aobj), dst(dst) {}
-    JSObject *aobj;
-    Value *dst;
-    void operator()(uintN argi, Value *src) {
-        if (aobj->getArgsElement(argi).isMagic(JS_ARGS_HOLE))
-            dst->setUndefined();
-        else
-            *dst = *src;
-        ++dst;
-    }
-};
-
 struct CopyTo
 {
     Value *dst;
     CopyTo(Value *dst) : dst(dst) {}
-    void operator()(uintN, Value *src) {
+    bool operator()(uintN, Value *src) {
         *dst++ = *src;
+        return true;
     }
 };
 
 }
 
 JS_ALWAYS_INLINE void
 JSStackFrame::clearMissingArgs()
 {
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -10163,18 +10163,19 @@ TraceRecorder::clearReturningFrameFromNa
 
 class BoxArg
 {
   public:
     BoxArg(TraceRecorder *tr, Address addr)
         : tr(tr), addr(addr) {}
     TraceRecorder *tr;
     Address addr;
-    void operator()(uintN argi, Value *src) {
+    bool operator()(uintN argi, Value *src) {
         tr->box_value_into(*src, tr->get(src), OffsetAddress(addr, argi * sizeof(Value)));
+        return true;
     }
 };
 
 /*
  * If we have created an |arguments| object for the frame, we must copy the
  * argument values into the object as properties in case it is used after
  * this frame returns.
  */
--- a/js/src/methodjit/MonoIC.cpp
+++ b/js/src/methodjit/MonoIC.cpp
@@ -1081,22 +1081,22 @@ ic::NativeCall(VMFrame &f, CallICInfo *i
 void JS_FASTCALL
 ic::NativeNew(VMFrame &f, CallICInfo *ic)
 {
     CallCompiler cc(f, *ic, true);
     if (!cc.generateNativeStub())
         stubs::SlowNew(f, ic->frameSize.staticArgc());
 }
 
-static inline bool
-BumpStack(VMFrame &f, uintN inc)
+static const unsigned MANY_ARGS = 1024;
+static const unsigned MIN_SPACE = 500;
+
+static bool
+BumpStackFull(VMFrame &f, uintN inc)
 {
-    static const unsigned MANY_ARGS = 1024;
-    static const unsigned MIN_SPACE = 500;
-
     /* If we are not passing many args, treat this as a normal call. */
     if (inc < MANY_ARGS) {
         if (f.regs.sp + inc < f.stackLimit)
             return true;
         StackSpace &stack = f.cx->stack();
         if (!stack.bumpCommitAndLimit(f.entryfp, f.regs.sp, inc, &f.stackLimit)) {
             js_ReportOverRecursed(f.cx);
             return false;
@@ -1127,16 +1127,25 @@ BumpStack(VMFrame &f, uintN inc)
         return true;
 
     if (!stack.ensureSpace(f.cx, f.regs.sp, incWithSpace))
         return false;
     f.stackLimit = bumpedWithSpace;
     return true;
 }
 
+static JS_ALWAYS_INLINE bool
+BumpStack(VMFrame &f, uintN inc)
+{
+    /* Fast path BumpStackFull. */
+    if (inc < MANY_ARGS && f.regs.sp + inc < f.stackLimit)
+        return true;
+    return BumpStackFull(f, inc);
+}
+
 /*
  * SplatApplyArgs is only called for expressions of the form |f.apply(x, y)|.
  * Additionally, the callee has already been checked to be the native apply.
  * All successful paths through SplatApplyArgs must set f.u.call.dynamicArgc
  * and f.regs.sp.
  */
 JSBool JS_FASTCALL
 ic::SplatApplyArgs(VMFrame &f)
@@ -1156,39 +1165,56 @@ ic::SplatApplyArgs(VMFrame &f)
      *
      *  | Function.prototype.apply | f | x | arguments |
      */
     if (f.u.call.lazyArgsObj) {
         Value *vp = f.regs.sp - 3;
         JS_ASSERT(JS_CALLEE(cx, vp).toObject().getFunctionPrivate()->u.n.native == js_fun_apply);
 
         JSStackFrame *fp = f.regs.fp;
-        if (!fp->hasOverriddenArgs() &&
-            (!fp->hasArgsObj() ||
-             (fp->hasArgsObj() && !fp->argsObj().isArgsLengthOverridden() &&
-              !js_PrototypeHasIndexedProperties(cx, &fp->argsObj())))) {
+        if (!fp->hasOverriddenArgs()) {
+            uintN n;
+            if (!fp->hasArgsObj()) {
+                /* Extract the common/fast path where there is no args obj. */
+                n = fp->numActualArgs();
+                if (!BumpStack(f, n))
+                    THROWV(false);
+                Value *argv = JS_ARGV(cx, vp + 1 /* vp[1]'s argv */);
+                f.regs.sp += n;
+                fp->forEachCanonicalActualArg(CopyTo(argv));
+            } else {
+                /* Simulate the argument-pushing part of js_fun_apply: */
+                JSObject *aobj = &fp->argsObj();
 
-            uintN n = fp->numActualArgs();
-            if (!BumpStack(f, n))
-                THROWV(false);
-            f.regs.sp += n;
+                /* Steps 4-5 */
+                uintN length;
+                if (!js_GetLengthProperty(cx, aobj, &length))
+                    THROWV(false);
+
+                /* Step 6 */
+                JS_ASSERT(length <= JS_ARGS_LENGTH_MAX);
+                n = length;
 
-            Value *argv = JS_ARGV(cx, vp + 1 /* vp[1]'s argv */);
-            if (fp->hasArgsObj())
-                fp->forEachCanonicalActualArg(CopyNonHoleArgsTo(&fp->argsObj(), argv));
-            else
-                fp->forEachCanonicalActualArg(CopyTo(argv));
+                if (!BumpStack(f, n))
+                    THROWV(false);
+
+                /* Steps 7-8 */
+                Value *argv = JS_ARGV(cx, &vp[1]);  /* vp[1] is the callee */
+                f.regs.sp += n;  /* GetElements may reenter, so inc early. */
+                if (!GetElements(cx, aobj, n, argv))
+                    THROWV(false);
+            }
 
             f.u.call.dynamicArgc = n;
             return true;
         }
 
         /*
-         * Can't optimize; push the arguments object so that the stack matches
-         * the !lazyArgsObj stack state described above.
+         * Push the arguments value so that the stack matches the !lazyArgsObj
+         * stack state described above.
          */
         f.regs.sp++;
         if (!js_GetArgsValue(cx, fp, &vp[3]))
             THROWV(false);
     }
 
     Value *vp = f.regs.sp - 4;
     JS_ASSERT(JS_CALLEE(cx, vp).toObject().getFunctionPrivate()->u.n.native == js_fun_apply);
new file mode 100644
--- /dev/null
+++ b/js/src/xpconnect/crashtests/648206-1.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<script>
+
+InstallTrigger.__proto__ = window.getComputedStyle(document.documentElement);
+InstallTrigger[0] = 0;
+
+</script>
--- a/js/src/xpconnect/crashtests/crashtests.list
+++ b/js/src/xpconnect/crashtests/crashtests.list
@@ -25,8 +25,9 @@ load 509075-1.html
 load 512815-1.html
 load 515726-1.html
 load 545291-1.html
 load 558979.html
 load 582649.html
 load 603858-1.html
 load 608963.html
 load 639737-1.html
+load 648206-1.html
--- a/js/src/xpconnect/tests/chrome/Makefile.in
+++ b/js/src/xpconnect/tests/chrome/Makefile.in
@@ -56,16 +56,18 @@ include $(topsrcdir)/config/rules.mk
 		test_bug484459.xul \
 		test_cows.xul \
 		test_bug517163.xul \
 		test_bug571849.xul \
 		test_bug601803.xul \
 		test_bug610390.xul \
 		test_bug614757.xul \
 		test_bug616992.xul \
+		test_bug618176.xul \
+		file_bug618176.xul \
 		test_bug596580.xul \
 		$(NULL)
 
 # Disabled until this test gets updated to test the new proxy based
 # wrappers.
 #		test_wrappers-2.xul \
 
 libs:: $(_CHROME_FILES)
new file mode 100644
--- /dev/null
+++ b/js/src/xpconnect/tests/chrome/file_bug618176.xul
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+                 type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=618176
+-->
+<window title="Mozilla Bug 618176"
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+  onload="start()">
+  <label value="Mozilla Bug 618176"/>
+  <!-- test code goes here -->
+  <script type="application/javascript"><![CDATA[
+
+    const TEST_PAGE =
+"data:text/html,<script>var a=[1,2,3];</script>Hi";
+
+    const FRAME_SCRIPT = 
+"data:,addEventListener('pageshow', function() { sendAsyncMessage('test', content.wrappedJSObject.a) }, false);";
+   // s/content.wrappedJSObject.a/[ 1, 2, 3]/ and the test passes
+
+    function recvTest(m) {
+      var a = m.json;
+      opener.wrappedJSObject.is(a.length, 3, "array was serialized and deserialized");
+
+      messageManager.removeMessageListener("test", recvTest);
+      finish();
+    }
+
+    function start() {
+      messageManager.addMessageListener("test", recvTest);
+      messageManager.loadFrameScript(FRAME_SCRIPT, true);
+      setTimeout(function () { document.getElementById("browser").loadURI(TEST_PAGE); }, 0);
+    }
+
+    function finish() {
+      opener.setTimeout("done()", 0);
+      window.close();
+    }
+
+  ]]></script>
+
+  <browser id="browser" type="content" style="width: 200px; height: 200px;"/>
+</window>
new file mode 100644
--- /dev/null
+++ b/js/src/xpconnect/tests/chrome/test_bug618176.xul
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+                 type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=618176
+-->
+<window title="Mozilla Bug 618176"
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <script type="application/javascript"
+          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+  <!-- test results are displayed in the html:body -->
+  <body xmlns="http://www.w3.org/1999/xhtml">
+  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=618176"
+     target="_blank">Mozilla Bug 618176</a>
+  </body>
+
+  <!-- test code goes here -->
+  <script type="application/javascript"><![CDATA[
+  SimpleTest.waitForExplicitFinish();
+
+  function done() {
+    SimpleTest.finish();
+  }
+
+  addLoadEvent(function() {
+    window.open("file_bug618176.xul", "", "chrome");
+  });
+  ]]></script>
+</window>
--- a/js/src/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/src/xpconnect/wrappers/XrayWrapper.cpp
@@ -170,23 +170,36 @@ EnsureExpandoObject(JSContext *cx, JSObj
         CallQueryInterface(wn->Native(), getter_AddRefs(ci));
         if (ci)
             ci->PreserveWrapper(wn->Native());
     }
     holder->setSlot(JSSLOT_EXPANDO, ObjectValue(*expando));
     return expando;
 }
 
+static inline JSObject *
+FindWrapper(JSObject *wrapper)
+{
+    while (!wrapper->isWrapper() ||
+           !(JSWrapper::wrapperHandler(wrapper)->flags() & WrapperFactory::IS_XRAY_WRAPPER_FLAG)) {
+        wrapper = wrapper->getProto();
+        // NB: we must eventually hit our wrapper.
+    }
+
+    return wrapper;
+}
+
 // Some DOM objects have shared properties that don't have an explicit
 // getter/setter and rely on the class getter/setter. We install a
 // class getter/setter on the holder object to trigger them.
 static JSBool
 holder_get(JSContext *cx, JSObject *wrapper, jsid id, jsval *vp)
 {
-    NS_ASSERTION(wrapper->isProxy(), "bad this object in get");
+    wrapper = FindWrapper(wrapper);
+
     JSObject *holder = GetHolder(wrapper);
 
     JSObject *wnObject = GetWrappedNativeObjectFromHolder(cx, holder);
     XPCWrappedNative *wn = GetWrappedNative(wnObject);
     if (NATIVE_HAS_FLAG(wn, WantGetProperty)) {
         JSAutoEnterCompartment ac;
         if (!ac.enter(cx, holder))
             return false;
@@ -199,17 +212,18 @@ holder_get(JSContext *cx, JSObject *wrap
         }
     }
     return true;
 }
 
 static JSBool
 holder_set(JSContext *cx, JSObject *wrapper, jsid id, JSBool strict, jsval *vp)
 {
-    NS_ASSERTION(wrapper->isProxy(), "bad this object in set");
+    wrapper = FindWrapper(wrapper);
+
     JSObject *holder = GetHolder(wrapper);
     if (IsResolving(holder, id)) {
         return true;
     }
 
     JSObject *wnObject = GetWrappedNativeObjectFromHolder(cx, holder);
 
     XPCWrappedNative *wn = GetWrappedNative(wnObject);
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -99,17 +99,16 @@
 #include "nsIScriptError.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsObjectFrame.h"
 #include "nsRuleNode.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsChildIterator.h"
 #include "nsCSSRendering.h"
-#include "nsISelectElement.h"
 #include "nsLayoutErrors.h"
 #include "nsLayoutUtils.h"
 #include "nsAutoPtr.h"
 #include "nsBoxFrame.h"
 #include "nsIBoxLayout.h"
 #include "nsImageFrame.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsContentErrors.h"
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1767,16 +1767,187 @@ nsPresContext::InvalidateIsChromeCacheEx
 nsPresContext::HasAuthorSpecifiedRules(nsIFrame *aFrame, PRUint32 ruleTypeMask) const
 {
   return
     nsRuleNode::HasAuthorSpecifiedRules(aFrame->GetStyleContext(),
                                         ruleTypeMask,
                                         UseDocumentColors());
 }
 
+static void
+InsertFontFaceRule(nsCSSFontFaceRule *aRule, gfxUserFontSet* aFontSet,
+                   PRUint8 aSheetType)
+{
+  NS_ABORT_IF_FALSE(aRule->GetType() == nsICSSRule::FONT_FACE_RULE,
+                    "InsertFontFaceRule passed a non-fontface CSS rule");
+
+  // aRule->List();
+
+  nsAutoString fontfamily;
+  nsCSSValue val;
+
+  PRUint32 unit;
+  PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
+  PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
+  PRUint32 italicStyle = FONT_STYLE_NORMAL;
+  nsString featureSettings, languageOverride;
+
+  // set up family name
+  aRule->GetDesc(eCSSFontDesc_Family, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_String) {
+    val.GetStringValue(fontfamily);
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face family name has unexpected unit");
+    // If there is no family name, this rule cannot contribute a
+    // usable font, so there is no point in processing it further.
+    return;
+  }
+
+  // set up weight
+  aRule->GetDesc(eCSSFontDesc_Weight, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Integer || unit == eCSSUnit_Enumerated) {
+    weight = val.GetIntValue();
+  } else if (unit == eCSSUnit_Normal) {
+    weight = NS_STYLE_FONT_WEIGHT_NORMAL;
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face weight has unexpected unit");
+  }
+
+  // set up stretch
+  aRule->GetDesc(eCSSFontDesc_Stretch, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Enumerated) {
+    stretch = val.GetIntValue();
+  } else if (unit == eCSSUnit_Normal) {
+    stretch = NS_STYLE_FONT_STRETCH_NORMAL;
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face stretch has unexpected unit");
+  }
+
+  // set up font style
+  aRule->GetDesc(eCSSFontDesc_Style, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Enumerated) {
+    italicStyle = val.GetIntValue();
+  } else if (unit == eCSSUnit_Normal) {
+    italicStyle = FONT_STYLE_NORMAL;
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face style has unexpected unit");
+  }
+
+  // set up font features
+  aRule->GetDesc(eCSSFontDesc_FontFeatureSettings, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Normal) {
+    // empty feature string
+  } else if (unit == eCSSUnit_String) {
+    val.GetStringValue(featureSettings);
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face font-feature-settings has unexpected unit");
+  }
+
+  // set up font language override
+  aRule->GetDesc(eCSSFontDesc_FontLanguageOverride, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Normal) {
+    // empty feature string
+  } else if (unit == eCSSUnit_String) {
+    val.GetStringValue(languageOverride);
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null,
+                 "@font-face font-language-override has unexpected unit");
+  }
+
+  // set up src array
+  nsTArray<gfxFontFaceSrc> srcArray;
+
+  aRule->GetDesc(eCSSFontDesc_Src, val);
+  unit = val.GetUnit();
+  if (unit == eCSSUnit_Array) {
+    nsCSSValue::Array *srcArr = val.GetArrayValue();
+    size_t numSrc = srcArr->Count();
+    
+    for (size_t i = 0; i < numSrc; i++) {
+      val = srcArr->Item(i);
+      unit = val.GetUnit();
+      gfxFontFaceSrc *face = srcArray.AppendElements(1);
+      if (!face)
+        return;
+            
+      switch (unit) {
+       
+      case eCSSUnit_Local_Font:
+        val.GetStringValue(face->mLocalName);
+        face->mIsLocal = PR_TRUE;
+        face->mURI = nsnull;
+        face->mFormatFlags = 0;
+        break;
+      case eCSSUnit_URL:
+        face->mIsLocal = PR_FALSE;
+        face->mURI = val.GetURLValue();
+        NS_ASSERTION(face->mURI, "null url in @font-face rule");
+        face->mReferrer = val.GetURLStructValue()->mReferrer;
+        face->mOriginPrincipal = val.GetURLStructValue()->mOriginPrincipal;
+        NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
+        
+        // agent and user stylesheets are treated slightly differently,
+        // the same-site origin check and access control headers are
+        // enforced against the sheet principal rather than the document
+        // principal to allow user stylesheets to include @font-face rules
+        face->mUseOriginPrincipal = (aSheetType == nsStyleSet::eUserSheet ||
+                                     aSheetType == nsStyleSet::eAgentSheet);
+                                     
+        face->mLocalName.Truncate();
+        face->mFormatFlags = 0;
+        while (i + 1 < numSrc && (val = srcArr->Item(i+1), 
+                 val.GetUnit() == eCSSUnit_Font_Format)) {
+          nsDependentString valueString(val.GetStringBufferValue());
+          if (valueString.LowerCaseEqualsASCII("woff")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF; 
+          } else if (valueString.LowerCaseEqualsASCII("opentype")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_OPENTYPE; 
+          } else if (valueString.LowerCaseEqualsASCII("truetype")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE; 
+          } else if (valueString.LowerCaseEqualsASCII("truetype-aat")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_AAT; 
+          } else if (valueString.LowerCaseEqualsASCII("embedded-opentype")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_EOT;   
+          } else if (valueString.LowerCaseEqualsASCII("svg")) {
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_SVG;   
+          } else {
+            // unknown format specified, mark to distinguish from the 
+            // case where no format hints are specified
+            face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_UNKNOWN;
+          }
+          i++;
+        }
+        break;
+      default:
+        NS_ASSERTION(unit == eCSSUnit_Local_Font || unit == eCSSUnit_URL,
+                     "strange unit type in font-face src array");
+        break;
+      }
+     }
+  } else {
+    NS_ASSERTION(unit == eCSSUnit_Null, "@font-face src has unexpected unit");
+  }
+  
+  if (!fontfamily.IsEmpty() && srcArray.Length() > 0) {
+    aFontSet->AddFontFace(fontfamily, srcArray, weight, stretch, italicStyle,
+                          featureSettings, languageOverride);
+  }
+}
+
 gfxUserFontSet*
 nsPresContext::GetUserFontSetInternal()
 {
   // We want to initialize the user font set lazily the first time the
   // user asks for it, rather than building it too early and forcing
   // rule cascade creation.  Thus we try to enforce the invariant that
   // we *never* build the user font set until the first call to
   // GetUserFontSet.  However, once it's been requested, we can't wait
@@ -1818,47 +1989,69 @@ nsPresContext::FlushUserFontSet()
   if (!mGetUserFontSetCalled) {
     return; // No one cares about this font set yet, but we want to be careful
             // to not unset our mUserFontSetDirty bit, so when someone really
             // does we'll create it.
   }
 
   if (mUserFontSetDirty) {
     if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
+      nsRefPtr<gfxUserFontSet> oldUserFontSet = mUserFontSet;
+
       nsTArray<nsFontFaceRuleContainer> rules;
-      if (!mShell->StyleSet()->AppendFontFaceRules(this, rules)) {
-        if (mUserFontSet) {
-          mUserFontSet->Destroy();
-          NS_RELEASE(mUserFontSet);
+      if (!mShell->StyleSet()->AppendFontFaceRules(this, rules))
+        return;
+
+      PRBool differ;
+      if (rules.Length() == mFontFaceRules.Length()) {
+        differ = PR_FALSE;
+        for (PRUint32 i = 0, i_end = rules.Length(); i < i_end; ++i) {
+          if (rules[i].mRule != mFontFaceRules[i].mRule ||
+              rules[i].mSheetType != mFontFaceRules[i].mSheetType) {
+            differ = PR_TRUE;
+            break;
+          }
         }
-        return;
+      } else {
+        differ = PR_TRUE;
       }
 
-      PRBool changed = PR_FALSE;
-
-      if (rules.Length() == 0) {
+      // Only rebuild things if the set of @font-face rules is different.
+      if (differ) {
         if (mUserFontSet) {
           mUserFontSet->Destroy();
           NS_RELEASE(mUserFontSet);
         }
-        changed = PR_TRUE;
-      } else if (!mUserFontSet) {
-        mUserFontSet = new nsUserFontSet(this);
-        NS_ADDREF(mUserFontSet);
+
+        if (rules.Length() > 0) {
+          nsUserFontSet *fs = new nsUserFontSet(this);
+          if (!fs)
+            return;
+          mUserFontSet = fs;
+          NS_ADDREF(mUserFontSet);
+
+          for (PRUint32 i = 0, i_end = rules.Length(); i < i_end; ++i) {
+            InsertFontFaceRule(rules[i].mRule, fs, rules[i].mSheetType);
+          }
+        }
       }
 
-      if (mUserFontSet) {
-        changed = mUserFontSet->UpdateRules(rules);
-      }
-
-      // We need to enqueue a style change reflow (for later) to
-      // reflect that we're modifying @font-face rules.  (However,
-      // without a reflow, nothing will happen to start any downloads
-      // that are needed.)
-      if (changed) {
+#ifdef DEBUG
+      PRBool success =
+#endif
+        rules.SwapElements(mFontFaceRules);
+      NS_ASSERTION(success, "should never fail given both are heap arrays");
+
+      if (mGetUserFontSetCalled && oldUserFontSet != mUserFontSet) {
+        // If we've changed, created, or destroyed a user font set, we
+        // need to trigger a style change reflow.
+        // We need to enqueue a style change reflow (for later) to
+        // reflect that we're dropping @font-face rules.  (However,
+        // without a reflow, nothing will happen to start any downloads
+        // that are needed.)
         UserFontSetUpdated();
       }
     }
 
     mUserFontSetDirty = PR_FALSE;
   }
 }
 
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -1104,16 +1104,18 @@ protected:
   nsCOMPtr<nsITimer>    mPrefChangedTimer;
 
   FramePropertyTable    mPropertyTable;
 
   nsInvalidateRequestList mInvalidateRequests;
 
   // container for per-context fonts (downloadable, SVG, etc.)
   nsUserFontSet*        mUserFontSet;
+  // The list of @font-face rules that we put into mUserFontSet
+  nsTArray<nsFontFaceRuleContainer> mFontFaceRules;
   
   PRInt32               mFontScaler;
   nscoord               mMinimumFontSizePref;
 
   nsRect                mVisibleArea;
   nsSize                mPageSize;
   float                 mPageScale;
   float                 mPPScale;
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -74,17 +74,17 @@
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMNSEvent.h"
 #include "nsGUIEvent.h"
 #include "nsIServiceManager.h"
 #include "nsINodeInfo.h"
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
-#include "nsISelectElement.h"
+#include "nsHTMLSelectElement.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsCSSRendering.h"
 #include "nsITheme.h"
 #include "nsIDOMMouseListener.h"
 #include "nsIDOMMouseMotionListener.h"
 #include "nsIDOMKeyListener.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
@@ -280,44 +280,39 @@ void nsListControlFrame::PaintFocus(nsIR
   nsIFrame* containerFrame = GetOptionsContainer();
   if (!containerFrame) return;
 
   nsIFrame * childframe = nsnull;
   nsresult result = NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIContent> focusedContent;
 
-  nsCOMPtr<nsIDOMHTMLSelectElement> selectDOMElement(do_QueryInterface(mContent));
-  NS_ASSERTION(selectDOMElement, "Can't be null");
-
-  nsCOMPtr<nsISelectElement> selectElement(do_QueryInterface(mContent));
+  nsRefPtr<nsHTMLSelectElement> selectElement =
+    nsHTMLSelectElement::FromContent(mContent);
   NS_ASSERTION(selectElement, "Can't be null");
 
   // If we have a selected index then get that child frame
   if (focusedIndex != kNothingSelected) {
     focusedContent = GetOptionContent(focusedIndex);
     // otherwise we find the focusedContent's frame and scroll to it
     if (focusedContent) {
       childframe = focusedContent->GetPrimaryFrame();
     }
   } else {
-    nsCOMPtr<nsIDOMHTMLSelectElement> selectHTMLElement(do_QueryInterface(mContent));
-    NS_ASSERTION(selectElement, "Can't be null");
-
     // Since there isn't a selected item we need to show a focus ring around the first
     // non-disabled item and skip all the option group elements (nodes)
     nsCOMPtr<nsIDOMNode> node;
 
     PRUint32 length;
-    selectHTMLElement->GetLength(&length);
+    selectElement->GetLength(&length);
     if (length) {
       // find the first non-disabled item
       PRBool isDisabled = PR_TRUE;
-      for (PRInt32 i=0;i<PRInt32(length) && isDisabled;i++) {
-        if (NS_FAILED(selectDOMElement->Item(i, getter_AddRefs(node))) || !node) {
+      for (PRUint32 i = 0; i < length && isDisabled; i++) {
+        if (NS_FAILED(selectElement->Item(i, getter_AddRefs(node))) || !node) {
           break;
         }
         if (NS_FAILED(selectElement->IsOptionDisabled(i, &isDisabled))) {
           break;
         }
         if (isDisabled) {
           node = nsnull;
         } else {
@@ -1516,17 +1511,18 @@ nsListControlFrame::RemoveOption(PRInt32
 // as it is because it indicates that the frame is the source
 // of this event rather than the receiver.
 PRBool
 nsListControlFrame::SetOptionsSelectedFromFrame(PRInt32 aStartIndex,
                                                 PRInt32 aEndIndex,
                                                 PRBool aValue,
                                                 PRBool aClearAll)
 {
-  nsCOMPtr<nsISelectElement> selectElement(do_QueryInterface(mContent));
+  nsRefPtr<nsHTMLSelectElement> selectElement =
+    nsHTMLSelectElement::FromContent(mContent);
   PRBool wasChanged = PR_FALSE;
 #ifdef DEBUG
   nsresult rv = 
 #endif
     selectElement->SetOptionsSelectedByIndex(aStartIndex,
                                              aEndIndex,
                                              aValue,
                                              aClearAll,
@@ -1547,28 +1543,35 @@ nsListControlFrame::ToggleOptionSelected
   }
   nsCOMPtr<nsIDOMHTMLOptionElement> option = GetOption(options, aIndex);
   NS_ASSERTION(option, "No option");
   if (!option) {
     return PR_FALSE;
   }
 
   PRBool value = PR_FALSE;
-  nsresult rv = option->GetSelected(&value);
+#ifdef DEBUG
+  nsresult rv =
+#endif
+    option->GetSelected(&value);
 
   NS_ASSERTION(NS_SUCCEEDED(rv), "GetSelected failed");
-  nsCOMPtr<nsISelectElement> selectElement(do_QueryInterface(mContent));
+  nsRefPtr<nsHTMLSelectElement> selectElement =
+    nsHTMLSelectElement::FromContent(mContent);
   PRBool wasChanged = PR_FALSE;
-  rv = selectElement->SetOptionsSelectedByIndex(aIndex,
-                                                aIndex,
-                                                !value,
-                                                PR_FALSE,
-                                                PR_FALSE,
-                                                PR_TRUE,
-                                                &wasChanged);
+#ifdef DEBUG
+  rv =
+#endif
+    selectElement->SetOptionsSelectedByIndex(aIndex,
+                                             aIndex,
+                                             !value,
+                                             PR_FALSE,
+                                             PR_FALSE,
+                                             PR_TRUE,
+                                             &wasChanged);
 
   NS_ASSERTION(NS_SUCCEEDED(rv), "SetSelected failed");
 
   return wasChanged;
 }
 
 
 // Dispatch event and such
@@ -1840,17 +1843,18 @@ nscoord
 nsListControlFrame::GetHeightOfARow()
 {
   return HeightOfARow();
 }
 
 nsresult
 nsListControlFrame::IsOptionDisabled(PRInt32 anIndex, PRBool &aIsDisabled)
 {
-  nsCOMPtr<nsISelectElement> sel(do_QueryInterface(mContent));
+  nsRefPtr<nsHTMLSelectElement> sel =
+    nsHTMLSelectElement::FromContent(mContent);
   if (sel) {
     sel->IsOptionDisabled(anIndex, &aIsDisabled);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 //----------------------------------------------------------------------
deleted file mode 100644
--- a/layout/forms/resources/Makefile.in
+++ /dev/null
@@ -1,46 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (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.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 2001
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#  Brian Ryner <bryner@brianryner.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH		= ../../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-include $(topsrcdir)/config/rules.mk
-
deleted file mode 100644
--- a/layout/forms/resources/content/button.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (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.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org code.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2001
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -  Brian Ryner <bryner@brianryner.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either the GNU General Public License Version 2 or later (the "GPL"), or
-   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the LGPL or the GPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<!DOCTYPE bindings [
-<!ENTITY % htmlFormDTD SYSTEM "chrome://forms/locale/htmlforms.dtd" >
-%htmlFormDTD;
-]>
-
-<bindings id="buttonBindings"
-          xmlns="http://www.mozilla.org/xbl"
-          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-          xmlns:xbl="http://www.mozilla.org/xbl">
-
-  <binding id="button" display="xul:button"
-           extends="chrome://global/content/bindings/button.xml#button-base">
-    <content>
-      <xul:hbox class="box-inherit button-box" align="center" pack="center" flex="1">
-        <xul:description class="button-box-text" flex="1">
-          <children/>
-        </xul:description>
-      </xul:hbox>
-    </content>
-  </binding>
-
-  <binding id="inputButton" extends="chrome://global/content/bindings/general.xml#basetext"
-           display="xul:button">
-    <content>
-      <xul:hbox class="box-inherit button-box" align="center" pack="center" flex="1">
-        <xul:description class="button-box-text" xbl:inherits="value" value="  "/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-  <binding id="submitButton" extends="chrome://global/content/bindings/general.xml#basetext"
-           display="xul:button">
-    <content>
-      <xul:hbox class="box-inherit button-box" align="center" pack="center" flex="1">
-        <xul:description class="button-box-text" xbl:inherits="value" value="&submitForm;"/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-  <binding id="fileButton" extends="chrome://global/content/bindings/general.xml#basetext"
-           display="xul:button">
-    <content>
-      <xul:hbox class="box-inherit button-box" align="center" pack="center" flex="1">
-        <xul:description class="button-box-text" value="&fileBrowse;"/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-  <binding id="resetButton" extends="chrome://global/content/bindings/general.xml#basetext"
-           display="xul:button">
-    <content>
-      <xul:hbox class="box-inherit button-box" align="center" pack="center" flex="1">
-        <xul:description class="button-box-text" value="&resetForm;"/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-</bindings>          
-
deleted file mode 100644
--- a/layout/forms/resources/content/checkbox.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (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.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org code.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2001
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -  Brian Ryner <bryner@brianryner.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either the GNU General Public License Version 2 or later (the "GPL"), or
-   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the LGPL or the GPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<bindings id="checkboxBindings"
-   xmlns="http://www.mozilla.org/xbl"
-   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <binding id="checkbox" extends="xul:image"/>
-  
-</bindings>
-
-    
deleted file mode 100644
--- a/layout/forms/resources/content/radio.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (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.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org code.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2001
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -  Brian Ryner <bryner@brianryner.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either the GNU General Public License Version 2 or later (the "GPL"), or
-   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the LGPL or the GPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<bindings id="radioBindings"
-   xmlns="http://www.mozilla.org/xbl"
-   xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <binding id="radio" extends="xul:button">
-    <content>
-      <xul:hbox class="input-radio-check-box2" flex="1">
-        <xul:image class="input-radio-check" flex="1"/>
-      </xul:hbox>
-    </content>
-  </binding>
-
-</bindings>
-
-    
deleted file mode 100644
--- a/layout/forms/resources/content/select.xml
+++ /dev/null
@@ -1,823 +0,0 @@
-<?xml version="1.0"?>
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (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.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org code.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2001
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -  Brian Ryner <bryner@brianryner.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either the GNU General Public License Version 2 or later (the "GPL"), or
-   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the LGPL or the GPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<bindings id="selectBindings"
-          xmlns="http://www.mozilla.org/xbl"
-          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-          xmlns:xbl="http://www.mozilla.org/xbl">
-
-  <binding id="select-treebody">
-    <implementation>
-      <field name="_lastSelectedRow">
-        -1
-      </field>
-    </implementation>
-    <handlers>
-      <!-- If there is no modifier key, we select on mousedown, not
-           click, so that drags work correctly. -->
-      <handler event="mousedown">
-      <![CDATA[
-         if (!event.ctrlKey && !event.shiftKey && !event.metaKey) {
-           var row = {};
-           var col = {};
-           var obj = {};
-           var select = this.parentNode.parentNode.parentNode;
-           var box = select.treeBoxObject;
-           var selection = box.view.selection;
-           box.getCellAt(event.clientX, event.clientY, row, col, obj);
-
-           // save off the last selected row
-           this._lastSelectedRow = row.value;
-
-           if (row.value != -1 && !box.view.isContainer(row.value) &&
-               obj.value != "twisty" && !selection.isSelected(row.value)) {
-             selection.select(row.value);
-             select.selectElement.setOptionsSelectedByIndex(row.value, row.value,
-                                                            true, true, false, false);
-             if ("onchange" in select)
-               select.onchange();
-           }
-         }
-      ]]>
-      </handler>
-
-      <!-- On a click (up+down on the same item), deselect everything
-           except this item. -->
-      <handler event="click">
-      <![CDATA[
-         if (event.button != 0) return;
-         var row = {};
-         var col = {};
-         var obj = {};
-         var select = this.parentNode.parentNode.parentNode;
-         var box = select.treeBoxObject;
-         var selection = box.view.selection;
-         box.getCellAt(event.clientX, event.clientY, row, col, obj);
-
-         if (row.value == -1 || select.contentView.getItemAtIndex(row.value).disabled)
-           return;
-
-         if (obj.value == "twisty") {
-           box.view.toggleOpenState(row.value);
-           return;
-         }
-
-         if (box.view.isContainer(row.value))
-           return;
-
-         select = select.selectElement;
-         var augment = event.ctrlKey || event.metaKey;
-         if (event.shiftKey) {
-           selection.rangedSelect(-1, row.value, augment);
-           var start = selection.shiftSelectPivot;
-           if (start == -1)
-             start = selection.currentIndex;
-           select.setOptionsSelectedByIndex(start, row.value, true, !augment, false, false);
-           if ("onchange" in this)
-             this.onchange();
-         }
-         else if (augment) {
-           selection.toggleSelect(row.value);
-           select.setOptionsSelectedByIndex(row.value, row.value,
-                                            selection.isSelected(row.value), false, false, false);
-           selection.currentIndex = row.value;
-           if ("onchange" in this)
-             this.onchange();
-         }
-         else {
-          /* We want to deselect all the selected items except what was
-            clicked, UNLESS it was a right-click.  We have to do this
-            in click rather than mousedown so that you can drag a
-            selected group of items */
-
-           // if the last row has changed in between the time we
-           // mousedown and the time we click, don't fire the select handler.
-           // see bug #92366
-           if (this._lastSelectedRow == row.value) {
-             selection.select(row.value);
-             select.setOptionsSelectedByIndex(row.value, row.value,
-                                              true, true, false, false);
-             if ("onchange" in this)
-               this.onchange();
-           }
-         }
-      ]]>
-      </handler>
-
-    </handlers>
-  </binding>
-
-  <binding id="select-size" extends="xul:tree">
-    <content>
-      <xul:hbox>
-        <xul:treecol class="select-treecol" flex="1" primary="true"/>
-      </xul:hbox>
-      <xul:treerows class="select-treerows tree-rows" flex="1">
-        <xul:hbox flex="1" class="tree-bodybox">
-          <xul:treechildren class="select-treebody" anonid="treebody">
-            <children/>
-          </xul:treechildren>
-        </xul:hbox>
-        <xul:scrollbar orient="vertical" class="select-scrollbar" disabled="true"/>
-      </xul:treerows>
-    </content>
-
-    <implementation>
-      <property name="treeBoxObject"
-                onget="return this.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);"
-                readonly="true"/>
-      <property name="view"
-                onget="return this.treeBoxObject.view;"
-                onset="return this.treeBoxObject.view=val;"/>
-      <property name="contentView"
-                onget="return this.view.QueryInterface(Components.interfaces.nsITreeContentView);"
-                readonly="true"/>
-      <property name="selectElement"
-                onget="return this.QueryInterface(Components.interfaces.nsISelectElement);"
-                readonly="true"/>
-      <property name="currentIndex"
-                onget="return this.view.selection.currentIndex;"
-                onset="return this.view.selection.currentIndex=val;"/>
-      <property name="singleSelection"
-                onget="return this.getAttribute('seltype') == 'single'"
-                readonly="true"/>
-      <property name="firstSelectableOption" readonly="true"
-                onget="return this.getNextOptionIndex(-1);"/>
-      <property name="lastSelectableOption" readonly="true"
-                onget="return this.getPrevOptionIndex(this.view.rowCount);"/>
-
-      <field name="selectionHead">
-        -1
-      </field>
-      <field name="selectionTail">
-        -1
-      </field>
-      <method name="getNextOptionIndex">
-        <parameter name="aIndex"/>
-        <body><![CDATA[
-          var lastRow = this.view.rowCount - 1;
-          for (var i = aIndex + 1; i <= lastRow; ++i) {
-            var elem = this.contentView.getItemAtIndex(i);
-            if (elem.tagName.toLowerCase() == "option" && !elem.disabled)
-              break;
-           }
-           return i;
-         ]]></body>
-       </method>
-      <method name="getPrevOptionIndex">
-        <parameter name="aIndex"/>
-        <body><![CDATA[
-          for (var i = aIndex - 1; i >= 0; --i) {
-            var elem = this.contentView.getItemAtIndex(i);
-            if (elem.tagName.toLowerCase() == "option" && !elem.disabled)
-              break;
-           }
-           return i;
-         ]]></body>
-       </method>
-      <method name="adjustIndexForNesting">
-        <parameter name="aIndex"/>
-        <body><![CDATA[
-          return this.selectElement.getOptionIndex(this.contentView.getItemAtIndex(aIndex),
-                                                   aIndex, false);
-         ]]></body>
-       </method>
-       <method name="computePageUpIndex">
-         <parameter name="aCurrentIndex"/>
-         <body><![CDATA[
-           var f = this.treeBoxObject.getFirstVisibleRow();
-           var i = 0;
-           if (f > 0) {
-             var p = this.treeBoxObject.getPageLength();
-             if (f - p >= 0)
-               i = aCurrentIndex - p;
-             else
-               i = aCurrentIndex - f;
-           }
-           return this.getPrevOptionIndex(i+1);
-         ]]></body>
-       </method>
-       <method name="computePageDownIndex">
-         <parameter name="aCurrentIndex"/>
-         <body><![CDATA[
-           var l = this.view.rowCount - 1;
-           var f = this.treeBoxObject.getFirstVisibleRow();
-           var p = this.treeBoxObject.getPageLength();
-           var i = l;
-           var lastTopRowIndex = l - p;
-           if (f <= lastTopRowIndex) {
-             if (f + p <= lastTopRowIndex)
-               i = aCurrentIndex + p;
-             else
-               i = lastTopRowIndex + aCurrentIndex - f + 1;
-           }
-           return this.getNextOptionIndex(i-1);
-         ]]></body>
-       </method>
-       <constructor>
-         /* Update our hasgroups attribute */
-         if (this.selectElement.hasOptGroups)
-           document.getAnonymousElementByAttribute(this, "anonid", "treebody").setAttribute("hasgroups", "true");
-       </constructor>
-    </implementation>
-
-    <handlers>
-      <handler event="focus" action="this.treeBoxObject.focused = true;"/>
-      <handler event="blur" action="this.treeBoxObject.focused = false;"/>
-
-      <handler event="keypress" keycode="VK_UP">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var i = this.getPrevOptionIndex(c);
-          if (i == -1)
-            return;
-          this.selectionHead = this.selectionTail = -1;
-          this.view.selection.timedSelect(i, 500);
-          this.treeBoxObject.ensureRowIsVisible(i);
-          var selIndex = this.adjustIndexForNesting(i);
-          this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex, true, true,
-                                                       false, false);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_DOWN">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var i = this.getNextOptionIndex(c);
-          try { if (i >= this.view.rowCount)
-            return;
-          } catch (e) {}
-          this.selectionHead = this.selectionTail = -1;
-          this.view.selection.timedSelect(i, 500);
-          this.treeBoxObject.ensureRowIsVisible(i);
-          var selIndex = this.adjustIndexForNesting(i);
-          this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex, true, true, false,
-                                                      false);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_UP" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          var i = this.getPrevOptionIndex(c);
-          if (i == -1)
-            return;
-
-          var selection = this.view.selection;
-          var select = this.selectElement;
-          var selIndex = this.adjustIndexForNesting(c);
-
-          if (c == this.selectionTail) {
-            if (this.selectionHead < this.selectionTail) {
-              selection.toggleSelect(c);
-              select.setOptionsSelectedByIndex(selIndex, selIndex,
-                                               selection.isSelected(c),
-                                               false, false, false);
-              this.currentIndex = i;
-            }
-            else {
-              selection.toggleSelect(i);
-              select.setOptionsSelectedByIndex(selIndex, selIndex, true, false, false, false);
-            }
-          }
-          else {
-            selection.clearSelection();
-            this.selectionHead = c;
-            selection.rangedSelect(c, i, true);
-            var prevSelIndex = this.adjustIndexForNesting(i);
-            select.setOptionsSelectedByIndex(selIndex, prevSelIndex, true, true, false, false);
-          }
-          this.selectionTail = i;
-          this.treeBoxObject.ensureRowIsVisible(i);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_DOWN" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          var i = this.getNextOptionIndex(c);
-          try { if (i >= this.view.rowCount)
-            return;
-          } catch (e) {}
-
-          var selection = this.view.selection;
-          var select = this.selectElement;
-          var selIndex = this.adjustIndexForNesting(c);
-          var nextSelIndex = this.adjustIndexForNesting(i);
-
-          if (c == this.selectionTail) {
-            if (this.selectionHead > this.selectionTail) {
-              selection.toggleSelect(c);
-              select.setOptionsSelectedByIndex(selIndex, selIndex, selection.isSelected(c), false, false, false);
-              this.currentIndex = i;
-            }
-            else {
-              selection.toggleSelect(i);
-              select.setOptionsSelectedByIndex(nextSelIndex, nextSelIndex, selection.isSelected(i), false, false, false);
-            }
-          }
-          else {
-            selection.clearSelection();
-            this.selectionHead = c;
-            selection.rangedSelect(c, i, true);
-            select.setOptionsSelectedByIndex(selIndex, nextSelIndex, true, true, false, false);
-          }
-          this.selectionTail = i;
-          this.treeBoxObject.ensureRowIsVisible(i);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_UP" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var i = this.getPrevOptionIndex(c);
-          if (i == -1)
-            return;
-          this.currentIndex = i;
-          this.treeBoxObject.ensureRowIsVisible(i);
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_DOWN" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var i = this.getNextOptionIndex(c);
-          try { if (i >= this.view.rowCount)
-            return;
-          } catch (e) {}
-          this.currentIndex = i;
-          this.treeBoxObject.ensureRowIsVisible(i);
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_UP">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          if (this.getPrevOptionIndex(c) == -1)
-            return;
-          this.selectionHead = this.selectionTail = -1;
-          var i = this.computePageUpIndex(c);
-
-          this.treeBoxObject.scrollByPages(-1);
-          this.view.selection.timedSelect(i, 500);
-          var selIndex = this.adjustIndexForNesting(i);
-          this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex, true, true,
-                                                       false, false);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_DOWN">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var l = this.view.rowCount - 1;
-          if (this.getNextOptionIndex(c) >= l)
-            return;
-          this.selectionHead = this.selectionTail = -1;
-          var i = this.computePageDownIndex(c);
-          this.treeBoxObject.scrollByPages(1);
-          this.view.selection.timedSelect(i, 500);
-          var selIndex = this.adjustIndexForNesting(i);
-          this.selectElement.setOptionsSelectdByIndex(selIndex, selIndex, true, true,
-                                                      false, false);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          if (this.getPrevOptionIndex(c) == -1)
-            return;
-          var box = this.treeBoxObject;
-          var selection = box.view.selection;
-          var select = this.selectElement;
-          var i = this.computePageUpIndex(c);
-          box.scrollByPages(-1);
-
-          var selIndex = this.adjustIndexForNesting(c);
-          var selIndexEnd = this.adjustIndexForNesting(i);
-          var selHeadNext = this.getNextOptionIndex(this.selectionHead);
-          var selHeadPrev = this.getPrevOptionIndex(this.selectionHead);
-          var selHeadNextIndex = this.adjustIndexForNesting(selHeadNext);
-          var selHeadPrevIndex = this.adjustIndexForNesting(selHeadPrev);
-          var curPrevIndex = this.adjustIndexForNesting(this.getPrevOptionIndex(c));
-
-          if (c == this.selectionTail) {
-            if (this.selectionHead < this.selectionTail) {
-              if (i < this.selectionHead) {
-                selection.clearRange(c, this.selectionHead + 1);
-                selection.rangedSelect(selHeadPrev, i, true);
-                select.setOptionsSelectedByIndex(selIndex, selHeadNextIndex, false, false,
-                                                 false, false);
-                select.setOptionsSelectedByIndex(selHeadPrevIndex, selIndexEnd, true, false,
-                                                 false, false);
-              }
-              else {
-                selection.clearRange(c, i + 1);
-                var selIndexEndNext = this.adjustIndexForNesting(this.getNextOptionIndex(i));
-                select.setOptionsSelectedByIndex(selIndex, selIndexEndNext, false, false,
-                                                 false, false);
-                this.currentIndex = i;
-              }
-            }
-            else {
-              selection.rangedSelect(c - 1, i, true);
-              select.setOptionsSelectedByIndex(curPrevIndex, selIndexEnd, true, false,
-                                               false, false);
-            }
-          }
-          else {
-            selection.clearSelection();
-            this.selectionHead = c;
-            selection.rangedSelect(c, i, true);
-            select.setOptionsSelectedByIndex(selIndex, selIndexEnd, true, true, false, false);
-          }
-          this.selectionTail = i;
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          if (this.getNextOptionIndex(c) >= l)
-            return;
-
-          var i = this.getPageDownIndex(c);
-          var box = this.treeBoxObject;
-          box.scrollByPages(1);
-
-          var selection = box.view.selection;
-          var select = this.selectElement;
-          var selIndex = this.adjustIndexForNesting(c);
-          var selEndIndex = this.adjustIndexforNesting(i);
-          var selHeadPrevIndex = this.adjustIndexForNesting(this.getPrevOptionIndex(this.selectionHead));
-          var selHeadNextIndex = this.adjustIndexForNesting(this.getNextOptionIndex(this.selectionHead));
-          var selEndPrevIndex = this.adjustIndexForNesting(this.getPrevOptionIndex(i));
-          var curNextIndex = this.adjustIndexForNesting(this.getNextOptionIndex(c));
-
-          if (c == this.selectionTail) {
-            if (this.selectionHead > this.selectionTail) {
-              if (i > this.selectionHead) {
-                selection.clearRange(c, this.selectionHead - 1);
-                selection.rangedSelect(this.selectionHead + 1, i, true);
-                select.setOptionsSelectedByIndex(selIndex, selHeadPrevIndex, false, false,
-                                                 false, false);
-                select.setOptionsSelectedByIndex(selHeadNextIndex, selEndIndex, true, false,
-                                                 false, false);
-              }
-              else {
-                selection.clearRange(c, i - 1);
-                select.setOptionsSelectedByIndex(selIndex, selEndPrevIndex, false, false,
-                                                 false, false);
-                this.currentIndex = i;
-              }
-            }
-            else {
-              selection.rangedSelect(c + 1, i, true);
-              select.setOptionsSelectedByIndex(curNextIndex, i, true, false, false, false);
-            }
-          }
-          else {
-            selection.clearSelection();
-            this.selectionHead = c;
-            selection.rangedSelect(c, i, true);
-            select.setOptionsSelectedByIndex(selIndex, selEndIndex, true, true, false, false);
-          }
-          this.selectionTail = i;
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_UP" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          if (this.getPrevOptionIndex(c) == -1)
-            return;
-
-          this.treeBoxObject.scrollByPages(-1);
-          this.currentIndex = this.computePageUpIndex(c);
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var c = this.currentIndex;
-          var l = this.view.rowCount - 1;
-          if (this.getNextOptionIndex(c) >= l)
-            return;
-
-          this.treeBoxObject.scrollByPages(1);
-          this.currentIndex = this.computePageDownIndex(c);
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_HOME">
-        <![CDATA[
-          event.preventDefault();
-
-          var firstOptionIndex = this.firstSelectableOption;
-          if (firstOptionIndex >= this.view.rowCount ||
-              this.currentIndex == firstOptionIndex)
-            return;
-          this.selectionHead = this.selectionTail = -1;
-
-          var box = this.treeBoxObject;
-          box.view.selection.timedSelect(firstOptionIndex, 500);
-          var selIndex = this.adjustIndexForNesting(firstOptionIndex);
-          this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex, true, true,
-                                                       false, false);
-          box.ensureRowIsVisible(firstOptionIndex);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_END">
-        <![CDATA[
-          event.preventDefault();
-          var box = this.treeBoxObject;
-          var lastOptionIndex = this.lastSelectableOption;
-          if (lastOptionIndex == -1 || this.currentIndex == lastOptionIndex)
-            return;
-          this.selectionHead = this.selectionTail = -1;
-          box.view.selection.timedSelect(lastOptionIndex, 500);
-          var selIndex = this.adjustIndexForNesting(lastOptionIndex);
-          this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex, true, true,
-                                                       false, false);
-          box.ensureRowIsVisible(lastOptionIndex);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_HOME" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          var firstOptionIndex = this.firstSelectableOption;
-          if (firstOptionIndex >= this.view.rowCount ||
-              c == firstOptionIndex)
-            return;
-          var box = this.treeBoxObject;
-          var selection = box.view.selection;
-          var select = this.selectElement;
-          if (c != this.selectionTail) {
-            selection.clearSelection();
-            select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
-            this.selectionHead = c;
-          }
-          selection.rangedSelect(c, firstOptionIndex, true);
-          var selIndex = this.adjustIndexForNesting(firstOptionIndex);
-          select.setOptionsSelectedByIndex(c, selIndex, true, false, false, false);
-          this.selectionTail = firstOptionIndex;
-          box.ensureRowIsVisible(firstOptionIndex);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_END" modifiers="shift">
-        <![CDATA[
-          event.preventDefault();
-          if (this.singleSelection)
-            return;
-          var c = this.currentIndex;
-          var box = this.treeBoxObject;
-          var lastOptionIndex = this.lastSelectableOption;
-          if (lastOptionIndex == -1 || c == lastOptionIndex)
-            return;
-          var selection = box.view.selection;
-          var select = this.selectElement;
-          if (c != this.selectionTail) {
-            selection.clearSelection();
-            select.setOptionsSelectedByIndex(-1, -1, true, true, false, false);
-            this.selectionHead = c;
-          }
-          selection.rangedSelect(c, lastOptionIndex, true);
-          var selIndex = this.adjustIndexForNesting(lastOptionIndex);
-          select.setOptionsSelectedByIndex(c, selIndex, true, false, false, false);
-          this.selectionTail = lastOptionIndex;
-          box.ensureRowIsVisible(lastOptionIndex);
-          if ("onchange" in this)
-            this.onchange();
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_HOME" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var firstOptionIndex = this.firstSelectableOption;
-          if (firstOptionIndex >= this.view.rowCount)
-            return;
-          this.currentIndex = firstOptionIndex;
-          this.treeBoxObject.ensureRowIsVisible(firstOptionIndex);
-         ]]>
-      </handler>
-      <handler event="keypress" keycode="VK_END" modifiers="control">
-        <![CDATA[
-          event.preventDefault();
-          var lastOptionIndex = this.lastSelectableOption;
-          if (lastOptionIndex == -1)
-            return;
-          this.currentIndex = lastOptionIndex;
-          this.treeBoxObject.ensureRowIsVisible(lastOptionIndex);
-         ]]>
-      </handler>
-      <handler event="keypress">
-        <![CDATA[
-          var c = this.currentIndex;
-          if (event.keyCode == ' '.charCodeAt(0)) {
-            event.preventDefault();
-            var selection = this.view.selection;
-            if (event.ctrlKey || !selection.isSelected(c)) {
-              selection.toggleSelect(c);
-              var selIndex = this.adjustIndexForNesting(c);
-              this.selectElement.setOptionsSelectedByIndex(selIndex, selIndex,
-                                                           selection.isSelected(c),
-                                                           false, false, false);
-              if ("onchange" in this)
-                this.onchange();
-            }
-          } else if (event.keyCode == '+' || event.keyCode == '-') {
-             event.preventDefault();
-             var view = this.view;
-             var elem = this.contentView.getItemAtIndex(c);
-             if (elem.tagName.toLowerCase() == "optgroup" && !elem.disabled &&
-                ((event.keyCode == '+' && !view.isContainerOpen()) ||
-                 (event.keyCode == '-' && view.isContainerOpen())))
-               view.toggleOpenState(c);
-          }
-          ]]>
-      </handler>
-
-      <!-- Select element doesn't dispatch selectHas(No)Groups events anymore,
-           so this needs to be fixed if XBL form controls get activated at some
-           point. See bug 328907 -->
-      <handler event="selectHasGroups">
-        <![CDATA[
-          document.getAnonymousElementByAttribute(this, "anonid", "treebody").setAttribute("hasgroups", "true");
-          // force the tree to clear its cached twisty width
-          this.treeBoxObject.clearStyleAndImageCaches();
-        ]]>
-      </handler>
-
-      <handler event="selectHasNoGroups">
-        <![CDATA[
-          document.getAnonymousElementByAttribute(this, "anonid", "treebody").removeAttribute("hasgroups");
-          // force the tree to clear its cached twisty width
-          this.treeBoxObject.clearStyleAndImageCaches();
-        ]]>
-      </handler>
-
-    </handlers>
-
-  </binding>
-
-  <binding id="select-treerows">
-    <handlers>
-      <handler event="underflow">
-        <![CDATA[
-          this.childNodes[1].setAttribute("disabled", true);
-          event.stopPropagation();
-        ]]>
-      </handler>
-      <handler event="overflow">
-        <![CDATA[
-          this.childNodes[1].removeAttribute("disabled");
-          event.stopPropagation();
-        ]]>
-      </handler>
-    </handlers>
-  </binding>
-
-<!-- select size=1 -->
-
-  <binding id="select" extends="xul:menu">
-    <implementation>
-      <property name="selectElement" readonly="true"
-                onget="return this.QueryInterface(Components.interfaces.nsISelectElement);"/>
-      <method name="updateLabel">
-        <body>
-        <![CDATA[
-          var item = this.options.item(this.selectedIndex);
-          if (item) {
-            var newLabel = item.label;
-            if (!newLabel)
-              newLabel = item.text;
-            this.setAttribute('label', newLabel);
-          }
-        ]]>
-        </body>
-      </method>
-
-      <constructor>
-        <![CDATA[
-          this.updateLabel();
-        ]]>
-      </constructor>
-    </implementation>
-    <content>
-        <xul:hbox class="select-label-box" flex="1">
-          <xul:label flex="1" value=" " xbl:inherits="value=label"/>
-        </xul:hbox>
-        <xul:dropmarker class="select-dropmarker" type="menu"/>
-        <xul:menupopup class="select-menupopup">
-          <children/>
-        </xul:menupopup>
-    </content>
-    <handlers>
-      <handler event="command" phase="capturing">
-      <![CDATA[
-        var option = event.originalTarget;
-        if (option.localName.toLowerCase() != 'option')
-          return;
-
-        // Notify the select element that the selected item has changed.
-        // It will then give us a selectedItemChanged event.
-        var optionIndex = this.selectElement.getOptionIndex(option, 0, true);
-        var changed = this.selectElement.setOptionsSelectedByIndex(optionIndex, optionIndex,
-                                                                   true, false, false, true);
-
-        if (changed && ("onchange" in this))
-          this.onchange();
-        ]]>
-      </handler>
-
-      <handler event="selectedItemChanged" action="this.updateLabel();"/>
-    </handlers>
-  </binding>
-
-  <binding id="select-option" extends="xul:menuitem">
-    <content>
-      <xul:label xbl:inherits="value=label">
-        <children/>
-      </xul:label>
-    </content>
-  </binding>
-
-  <binding id="select-optgroup">
-    <content>
-      <xul:menu flex="1" xbl:inherits="label" class="select-menuitem">
-        <xul:menupopup class="select-optgrouppopup">
-          <children/>
-        </xul:menupopup>
-      </xul:menu>
-    </content>
-  </binding>
-
-</bindings>
deleted file mode 100644
--- a/layout/forms/resources/content/xbl-forms.css
+++ /dev/null
@@ -1,306 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2001
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Brian Ryner <bryner@brianryner.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
-@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-select[size] {
-  -moz-binding: url("chrome://forms/content/select.xml#select-size");
-  -moz-box-orient: vertical;
-  -moz-user-focus: normal;
-  -moz-user-select: none;
-}
-
-select, select[size="1"] {
-  -moz-binding: url("chrome://forms/content/select.xml#select");
-  display: -moz-inline-box;
-  -moz-box-orient: horizontal;
-  -moz-user-focus: normal;
-  font: -moz-list;
-}
-
-select[size] > option,
-select[size] > optgroup {
-  -moz-binding: none;
-}
-
-select option,
-select[size="1"] option {
-  -moz-binding: url("chrome://forms/content/select.xml#select-option");
-}
-
-select > optgroup,
-select[size="1"] > optgroup {
-  -moz-binding: url("chrome://forms/content/select.xml#select-optgroup");
-  display: -moz-box;
-  -moz-box-orient: horizontal;
-  -moz-user-focus: normal;
-}
-
-xul|*.select-treecol {
-  -moz-binding: none;
-}
-
-xul|*.select-treerows {
-  -moz-binding: url("chrome://forms/content/select.xml#select-treerows");
-}
-
-xul|*.select-treebody {
-  -moz-binding: url("chrome://forms/content/select.xml#select-treebody");
-  display: -moz-box;
-}
-
-xul|*.select-scrollbar[disabled="true"] {
-  visibility: hidden;
-}
-
-xul|*.select-menupopup,
-xul|*.select-optgrouppopup {
-  display:-moz-popup!important;
-}
-
-/* note: theme css MUST set the background color on 
-   select-optgrouppopup.  we can't set it to inherit
-   because it will inherit the highlight color if the
-   optgroup is open. */
-
-xul|*.select-menupopup {
-  background-color: inherit !important; 
-}
-
-input[type="checkbox"],
-input[type="radio"] {
-  display: -moz-inline-box;
-  margin: 3px 3px 3px 4px;
-
-  /* override these values from the input rule */
-  background-color: transparent;
-  border: none;
-  color: inherit;
-  cursor: default;
-  font: inherit;
-  text-align: inherit;
-  padding-top: 0px;
-  padding-bottom: 0px;
-  -moz-box-sizing: border-box;
-}
-
-input[type="checkbox"] {
-  -moz-binding: url("chrome://forms/content/checkbox.xml#checkbox");
-}
-
-input[type="radio"] {
-  -moz-binding: url("chrome://forms/content/radio.xml#radio");
-}
-
-button {
-  -moz-binding: url("chrome://forms/content/button.xml#button");
-  -moz-box-sizing: border-box;
-}
-
-input[type="button"],input[type="submit"],input[type="reset"] {
-  cursor: default;
-  -moz-box-sizing: border-box;
-  padding-top: 0px;
-  padding-bottom: 0px;
-}
-
-input[type="button"] {
-  -moz-binding: url("chrome://forms/content/button.xml#inputButton");
-}
-
-input[type="submit"] {
-  -moz-binding: url("chrome://forms/content/button.xml#submitButton");
-}
-
-input[type="reset"] {
-  -moz-binding: url("chrome://forms/content/button.xml#resetButton");
-}
-
-input[type="file"] > input[type="button"] {
-  -moz-binding: url("chrome://forms/content/button.xml#fileButton");
-}
-
-/*
- * The following rules are copied from forms.css, for widgets that aren't yet
- * defined in XBL.
- */
-*|*::-moz-fieldset-content {
-  display: block;
-  height: inherit;   /* Need this so percentage heights of kids work right */
-}
-
-form {
-  display: block;
-  margin: 0 0 1em 0;
-}
-
-/* miscellaneous form elements */
-
-legend {
-  padding-left: 2px;
-  padding-right: 2px;
-  border: none;
-}
-
-fieldset {
-  display: block;
-  border: 2px solid black;
-  padding: 4px 4px 4px 4px;
-  margin-left: 2px;
-  margin-right: 2px;
-}
-
-label {
-  /* our <label> support is badly broken. 
-     does not support display types other than inline(b=100801) 
-   */
-  display: inline !important;
-}
-
-/* default inputs, text inputs, and selects */
-input {
-  background-color: -moz-Field;
-  border: 2px inset ThreeDFace;
-  color: -moz-FieldText;
-  cursor: text;
-  font: -moz-field;
-  text-align: start;
-  vertical-align: text-bottom;
-  -moz-box-sizing: border-box;
-  -moz-user-focus: normal;
-  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#inputFields");
-  padding: 1px 0 1px 0;
-}
-
-input > .anonymous-div {
-  white-space : nowrap;
-}
-
-textarea {
-  background-color: -moz-Field;
-  border: 2px inset ThreeDFace;
-  color: -moz-FieldText;
-  cursor: text;
-  font: medium -moz-fixed;
-  margin: 1px 0 1px 0;
-  text-align: start;
-  vertical-align: text-bottom;
-  -moz-box-sizing: border-box;
-  -moz-user-focus: normal;
-  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
-}
-
-textarea > scrollbar {
-  cursor: default;
-}
-
-textarea > .anonymous-div,
-input > .anonymous-div {
-  -moz-user-focus: none;
-  overflow: auto;
-  border: 0px !important;
-  padding: 0px;
-  margin: 0px;
-  /* XXXldb I'm not sure if we really want the 'text-decoration: inherit',
-     but it's needed to make 'text-decoration' "work" on text inputs. */
-  text-decoration: inherit;
-  -moz-text-decoration-color: inherit;
-  -moz-text-decoration-style: inherit;
-}
-
-input:disabled,
-textarea:disabled,
-option:disabled,
-optgroup:disabled,
-select:disabled,
-select:disabled::-moz-display-comboboxcontrol-frame {
-  color: GrayText;
-  cursor: inherit; 
-}
-
-/* hidden inputs */
-input[type="hidden"] {
-  display: none;
-  -moz-binding: none;
-}
-
-/* image buttons */
-input[type="image"] {
-  border: none;
-  vertical-align: baseline;
-  background-color: transparent;
-  cursor: pointer;
-  font-family: sans-serif;
-  font-size: small;
-  -moz-binding: none;
-  padding: 0;
-}
-
-input[type="image"]:disabled {
-  cursor: inherit;
-}
-
-input[type="image"]:focus {
-  outline: 1px dotted -moz-FieldText;
-}
-
-/* file selector */
-input[type="file"] {
-  white-space: nowrap;
-  border: none;
-  cursor: default;
-  -moz-binding: none;
-  padding: 0;
-}
-
-/* button part of file selector */
-input[type="file"] > input[type="button"] {
-  height: inherit;
-}
-
-input[type="file"] > input[type="button"]::-moz-focus-inner
- {
-  padding: 0px 2px 0px 2px;
-  border: 1px dotted transparent;
-}
-
-@media print {
-  input, textarea, select, button {
-    -moz-user-focus: none !important;
-  }
-}
deleted file mode 100644
--- a/layout/forms/resources/jar.mn
+++ /dev/null
@@ -1,23 +0,0 @@
-forms.jar:
-    content/forms/xbl-forms.css               (content/xbl-forms.css)
-    content/forms/select.xml                  (content/select.xml)
-    content/forms/checkbox.xml                (content/checkbox.xml)
-    content/forms/button.xml                  (content/button.xml)
-    content/forms/radio.xml                   (content/radio.xml)
-    skin/classic/forms/button.css             (skin/button.css)
-    skin/classic/forms/checkbox.css           (skin/checkbox.css)
-    skin/classic/forms/forms.css              (skin/forms.css)
-    skin/classic/forms/radio.css              (skin/radio.css)
-    skin/classic/forms/select.css             (skin/select.css)
-    skin/classic/forms/select-dropdown.css    (skin/select-dropdown.css)
-    skin/classic/forms/arrow-dn-dis.gif       (skin/arrow-dn-dis.gif)
-    skin/classic/forms/arrow-dn.gif           (skin/arrow-dn.gif)
-    skin/classic/forms/cbox-check-dis.gif     (skin/cbox-check-dis.gif)
-    skin/classic/forms/cbox-check.gif         (skin/cbox-check.gif)
-    skin/classic/forms/radio-check-dis.gif    (skin/radio-check-dis.gif)
-    skin/classic/forms/radio-check.gif        (skin/radio-check.gif)
-    skin/classic/forms/twisty-clsd.gif        (skin/twisty-clsd.gif)
-    skin/classic/forms/twisty-open.gif        (skin/twisty-open.gif)
-
-en-US.jar:
-    locale/en-US/forms/htmlforms.dtd          (locale/en-US/htmlforms.dtd)
deleted file mode 100644
--- a/layout/forms/resources/locale/en-US/htmlforms.dtd
+++ /dev/null
@@ -1,40 +0,0 @@
-<!-- ***** BEGIN LICENSE BLOCK *****
-   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
-   -
-   - The contents of this file are subject to the Mozilla Public License Version
-   - 1.1 (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.mozilla.org/MPL/
-   -
-   - Software distributed under the License is distributed on an "AS IS" basis,
-   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-   - for the specific language governing rights and limitations under the
-   - License.
-   -
-   - The Original Code is mozilla.org code.
-   -
-   - The Initial Developer of the Original Code is
-   - Netscape Communications Corporation.
-   - Portions created by the Initial Developer are Copyright (C) 2001
-   - the Initial Developer. All Rights Reserved.
-   -
-   - Contributor(s):
-   -  Brian Ryner <bryner@brianryner.com>
-   -
-   - Alternatively, the contents of this file may be used under the terms of
-   - either the GNU General Public License Version 2 or later (the "GPL"), or
-   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-   - in which case the provisions of the GPL or the LGPL are applicable instead
-   - of those above. If you wish to allow use of your version of this file only
-   - under the terms of either the GPL or the LGPL, and not to allow others to
-   - use your version of this file under the terms of the MPL, indicate your
-   - decision by deleting the provisions above and replace them with the notice
-   - and other provisions required by the LGPL or the GPL. If you do not delete
-   - the provisions above, a recipient may use your version of this file under
-   - the terms of any one of the MPL, the GPL or the LGPL.
-   -
-   - ***** END LICENSE BLOCK ***** -->
-
-<!ENTITY resetForm         "Reset">
-<!ENTITY submitForm        "Submit Query">
-<!ENTITY fileBrowse        "Browse…">
deleted file mode 100644
index 3d62e40063176591e22bcf369c76828c1d0371b9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 62edbfd4fe314be23d79cfa20ce2f78ef0ad0125..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/layout/forms/resources/skin/button.css
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Joe Hewitt (hewitt@netscape.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* ===== button.css =====================================================
-  == Styles used by the XUL button element.
-  ======================================================================= */
-
-@namespace url(http://www.w3.org/1999/xhtml);
-@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-/* :::::::::: button :::::::::: */
-
-button,
-input[type="button"],
-input[type="submit"],
-input[type="reset"] {
-  /* -moz-appearance: button; */
-  border: 3px solid;
-  -moz-border-top-colors: transparent ThreeDHighlight ThreeDLightShadow;
-  -moz-border-right-colors: transparent ThreeDDarkShadow ThreeDShadow;
-  -moz-border-bottom-colors: transparent ThreeDDarkShadow ThreeDShadow;
-  -moz-border-left-colors: transparent ThreeDHighlight ThreeDLightShadow;
-  background-color: ThreeDFace;
-  color: ButtonText;
-}
-
-xul|*.button-box {
-  border: 1px solid transparent;
-  padding: 0px 4px 1px 3px;
-}
-
-xul|*.button-box-text {
-  margin: 0 !important;
-  text-align: center;
-}
-
-/* .......... active/open/checked state .......... */
-
-button:hover:active,
-input[type="button"]:hover:active,
-input[type="submit"]:hover:active,
-input[type="reset"]:hover:active {
-  -moz-border-top-colors: ThreeDDarkShadow ThreeDShadow transparent;
-  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow transparent;
-  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow transparent;
-  -moz-border-left-colors: ThreeDDarkShadow ThreeDShadow transparent;
-}
-
-button:hover:active > xul|*.button-box,
-input[type="button"]:hover:active > xul|*.button-box,
-input[type="submit"]:hover:active > xul|*.button-box,
-input[type="reset"]:hover:active > xul|*.button-box {
-  padding: 1px 3px 0px 4px;
-}
-
-/* .......... focused state .......... */
-
-button:focus,
-input[type="button"]:focus,
-input[type="submit"]:focus,
-input[type="reset"]:focus {
-  -moz-border-top-colors: ThreeDDarkShadow ThreeDHighlight transparent;
-  -moz-border-right-colors: ThreeDDarkShadow ThreeDDarkShadow ThreeDShadow;
-  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDDarkShadow ThreeDShadow;
-  -moz-border-left-colors: ThreeDDarkShadow ThreeDHighlight transparent;
-}
-
-button:focus > xul|*.button-box,
-input[type="button"]:focus > xul|*.button-box,
-input[type="submit"]:focus > xul|*.button-box,
-input[type="reset"]:focus > xul|*.button-box {
-  border: 1px dotted ThreeDDarkShadow;
-}
-
-/* .......... disabled state .......... */
-
-button:disabled,
-input[type="button"]:disabled,
-input[type="submit"]:disabled,
-input[type="reset"]:disabled {
-  -moz-border-top-colors: transparent ThreeDHighlight ThreeDLightShadow !important;
-  -moz-border-right-colors: transparent ThreeDDarkShadow ThreeDShadow !important;
-  -moz-border-bottom-colors: transparent ThreeDDarkShadow ThreeDShadow !important;
-  -moz-border-left-colors: transparent ThreeDHighlight ThreeDLightShadow !important;
-  color: GrayText;
-}
-
-button:disabled > xul|*.button-box,
-input[type="button"]:disabled > xul|*.button-box,
-input[type="submit"]:disabled > xul|*.button-box,
-input[type="reset"]:disabled > xul|*.button-box {
-  padding: 0px 4px 1px 3px !important;
-}
-
deleted file mode 100644
index bd43dd17c3bd07b1787baca148442ec777797d8c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index f6919f8fade6ee12fe5010e3280a39e5167a86e2..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/layout/forms/resources/skin/checkbox.css
+++ /dev/null
@@ -1,87 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* ===== checkbox.css ===================================================
-  == Styles used by the XUL checkbox element.
-  ======================================================================= */
-
-@namespace url(http://www.w3.org/1999/xhtml);
-
-/* ::::: checkbox ::::: */
-
-input[type="checkbox"] {
-/*  -moz-appearance: checkbox; */
-  -moz-box-align: center;
-  border: 2px solid;
-  padding-left: 1px;
-  padding-right: 1px;
-  -moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-  -moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-  -moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-  -moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
-  min-width: 13px;
-  min-height: 13px;
-  background: -moz-Field no-repeat 50% 50%;
-}
-
-input[type="checkbox"]:hover:active {
-  background-color: -moz-Dialog;
-}
-
-input[type="checkbox"]:focus {
-  -moz-border-top-colors: ThreeDDarkShadow ThreeDShadow;
-  -moz-border-right-colors: ThreeDDarkShadow ThreeDHighlight;
-  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDHighlight;
-  -moz-border-left-colors: ThreeDDarkShadow ThreeDShadow;
-}
-
-/* ..... disabled state ..... */
-
-input[type="checkbox"]:disabled {
-  background-color: -moz-Dialog;
-}
-
-/* ..... checked state ..... */
-
-input[type="checkbox"]:checked {
-  list-style-image: url("chrome://forms/skin/cbox-check.gif");
-}
-
-input[type="checkbox"]:disabled:checked {
-  list-style-image: url("chrome://forms/skin/cbox-check-dis.gif") !important;
-}
-
deleted file mode 100644
--- a/layout/forms/resources/skin/forms.css
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Brian Ryner <bryner@brianryner.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* This file contains skin-specific rules for HTML form controls */
-
-/* xbl-forms.css contains the XBL bindings common to all skins */
-@import url("chrome://forms/content/xbl-forms.css");
-
-@import url("chrome://forms/skin/select.css");
-@import url("chrome://forms/skin/select-dropdown.css");
-@import url("chrome://forms/skin/checkbox.css");
-@import url("chrome://forms/skin/button.css");
-@import url("chrome://forms/skin/radio.css");
deleted file mode 100644
index 5e9a1cb01431f2c37ce8a759fc34b2e284c1c7ff..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 26aa14026a6d6b4ba0f54196940f341c596a0e76..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/layout/forms/resources/skin/radio.css
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/* ===== radio.css ===================================================
-  == Styles used by the XUL radio element.
-  ======================================================================= */
-
-@namespace url(http://www.w3.org/1999/xhtml);
-@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-/* ..... disabled state ..... */
-
-input[type="radio"]:disabled {
-  background-color: -moz-Dialog;
-}
-
-/* ::::: checkmark image ::::: */
-
-input[type="radio"] {
-/*  -moz-appearance: radio; */
-  margin: 1px 0px;
-  border-top: 1px solid ThreeDShadow;
-  border-right: 1px solid ThreeDHighlight;
-  border-bottom: 1px solid ThreeDHighlight;
-  border-left: 1px solid ThreeDShadow;
-  border-radius: 50%;
-  width: 12px;
-  height: 12px;
-  background-color: -moz-Field;
-}
-
-xul|*.input-radio-check-box2 {
-  border-top: 1px solid ThreeDDarkShadow;
-  border-right: 1px solid ThreeDLightShadow;
-  border-bottom: 1px solid ThreeDLightShadow;
-  border-left: 1px solid ThreeDDarkShadow;
-  border-radius: 50%;
-  padding: 2px;
-  width: 4px;
-  height: 4px;
-  list-style-image: none;
-}
-
-input[type="radio"]:hover:active {
-  background-color: -moz-Dialog;
-}
-
-input[type="radio"]:focus > xul|*.input-radio-check-box2 {
-  border: 1px solid ThreeDDarkShadow;
-}
-
-/* ..... selected state ..... */
-
-input[type="radio"]:checked > xul|*.input-radio-check-box2 {
-  list-style-image: url("chrome://forms/skin/radio-check.gif");
-}
-
-input[type="radio"]:disabled:checked {
-  list-style-image: url("chrome://forms/skin/radio-check-dis.gif") !important
-}
deleted file mode 100644
--- a/layout/forms/resources/skin/select-dropdown.css
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Brian Ryner <bryner@brianryner.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
-@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-/**
- <select size=1/> Widget
- **/
-
-select, select[size="1"] {
-  /*-moz-appearance: menulist;*/
-  margin: 2px 4px;
-  border: 2px solid;
-  -moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-  -moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-  -moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-  -moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
-  background-color: -moz-Field;
-  color: -moz-FieldText;
-}
-
-xul|*.select-label-box {
-  -moz-box-align: center;
-  -moz-box-pack: center;
-  margin: 1px;
-  border: 1px solid transparent;
-}
-
-xul|*.select-dropmarker {
-  /*-moz-appearance: menulist-button;*/
-  min-width: 17px;
-  -moz-box-align: center;
-  -moz-box-pack: center;
-  border: 2px solid;
-  background-color: -moz-Dialog;
-  list-style-image: url("chrome://forms/skin/arrow-dn.gif");
-}
-
-xul|*.select-dropmarker,
-select:disabled:hover:active > xul|*.select-dropmarker {
-  -moz-border-top-colors: ThreeDLightShadow ThreeDHighlight;
-  -moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
-  -moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
-  -moz-border-left-colors: ThreeDLightShadow ThreeDHighlight;
-  padding: 1px;
-}
-
-select:hover:active > xul|*.select-dropmarker {
-  -moz-border-top-colors: ThreeDShadow ThreeDFace;
-  -moz-border-right-colors: ThreeDShadow ThreeDFace;
-  -moz-border-bottom-colors: ThreeDShadow ThreeDFace;
-  -moz-border-left-colors: ThreeDShadow ThreeDFace;
-  padding: 2px 0px 0px 2px;
-}
-
-select:focus > xul|*.select-label-box {
-  border: 1px dotted #F5DB95;
-  background-color: Highlight;
-  color: HighlightText;
-}
-
-xul|*.select-menupopup,
-xul|*.select-optgrouppopup {
-  -moz-binding: url("chrome://global/content/bindings/popup.xml#popup-scrollbars");
-}
-
-xul|*.select-optgrouppopup {
-  background-color: -moz-Field !important;
-}
-
-option,
-optgroup {
-  color: -moz-FieldText;
-}
-
-select > option {
-  /* make the popup wide enough for the dropdown arrow */
-  padding-right: 28px;
-}
-
-xul|*.select-menuitem > xul|*.menu-text {
-  margin-left: 0px !important;
-}
-
-/* ..... disabled state ..... */
- 
-select:disabled {
-  background-color: -moz-Dialog;
-  color: GrayText;
-}
-
-select:disabled > xul|*.select-dropmarker {
-  list-style-image: url("chrome://forms/skin/arrow-dn-dis.gif");
-}
-
-option[_moz-menuactive="true"],
-xul|*.select-menuitem[_moz-menuactive="true"] {
-  background-color: Highlight;
-  color: HighlightText !important;
-}
deleted file mode 100644
--- a/layout/forms/resources/skin/select.css
+++ /dev/null
@@ -1,123 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Brian Ryner <bryner@brianryner.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-@namespace url(http://www.w3.org/1999/xhtml); /* set default namespace to HTML */
-@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-
-/**
- <select/> Widget
- **/
-
-select[size] {
-  border: 2px inset ThreeDFace;
-  margin: 0;
-  min-height: 0;
-  color: inherit;
-/*  -moz-appearance: treeview; */
-}
-  
-xul|*.select-treebody::-moz-tree-row {
-/*  -moz-appearance: treeitem; */
-  border: 1px solid transparent;
-}
-
-xul|*.select-treecol {
-  margin: 0px !important;
-  border: none !important;
-  padding: 0px !important;
-}
-
-/* ::::: tree rows ::::: */
-
-xul|*.select-treebody::-moz-tree-row {
-  border: 1px solid transparent;
-  height: 18px;
-}
-
-xul|*.select-treebody::-moz-tree-row(selected) {
-  background-color: -moz-Dialog;
-}
-
-xul|*.select-treebody::-moz-tree-row(selected, focus) {
-  background-color: Highlight;
-}
-
-xul|*.select-treebody::-moz-tree-row(current, focus) {
-  border: 1px dotted #F5DB95;
-}
-
-/* ::::: tree cells ::::: */
-
-xul|*.select-treebody::-moz-tree-cell {
-  padding: 0px 0px 0px 2px;
-}
-
-xul|*.select-treebody::-moz-tree-cell-text {
-  color: inherit;
-}
-
-xul|*.select-treebody::-moz-tree-cell-text(selected) {
-  color: -moz-DialogText;
-}
-
-xul|*.select-treebody::-moz-tree-cell-text(selected, focus) {
-  color: HighlightText;
-}
-
-
-/* ::::: twisty ::::: */
-
-xul|*.select-treebody[hasgroups="true"]::-moz-tree-twisty 
-{
-  padding-right: 2px;
-  width: 10px; /* The image's width is 10 pixels */
-  list-style-image: url("chrome://forms/skin/twisty-clsd.gif");
-}
-
-xul|*.select-treebody[hasgroups="true"]::-moz-tree-twisty(open) {
-  width: 10px; /* The image's width is 10 pixels */
-  list-style-image: url("chrome://forms/skin/twisty-open.gif");
-}
-
-xul|*.select-treebody[hasgroups="true"]::-moz-tree-indentation {
-  width: 16px;   
-}
-
-xul|*.select-treebody::-moz-tree-line {
-  visibility: hidden;
-}
-
deleted file mode 100644
index 19ed5f509cff0caa8ad17c44d9ceca8e2fa58683..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 57303ea5d12f84d98bf0fd16e26379f8adf7d20e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/layout/reftests/bidi/bidi-004-j.html
+++ b/layout/reftests/bidi/bidi-004-j.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 004-j: rtl text with diacritics and justification -->
 <html>
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {
-  font-family: serif;
+  font-family: Raanana, serif; /* prefer Raanana on OS X for the presentation forms */
   font-size: 24px;
 }
   </style>
  <body>
   <p lang="he" style="direction: rtl; text-align: justify;">
   &#x05D1;&#x05BC;&#x05D5;&#x05BC;&#x05E9;&#x05C1;</p>
  </body>
 </html>
--- a/layout/reftests/bidi/bidi-004-ref.html
+++ b/layout/reftests/bidi/bidi-004-ref.html
@@ -1,15 +1,15 @@
 <!DOCTYPE html>
 <html>
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <style type="text/css">
 body {
-  font-family: serif;
+  font-family: Raanana, serif; /* prefer Raanana on OS X for the presentation forms */
   font-size: 24px;
 }
   </style>
  </head>
  <body>
   <p lang="he" style="unicode-bidi: bidi-override; text-align: right">
   &#xFB2A;&#xFB35;&#xFB31;</p>
  </body>
--- a/layout/reftests/bidi/bidi-004.html
+++ b/layout/reftests/bidi/bidi-004.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <!-- Bidi reftest 004: rtl text with diacritics -->
 <html>
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
   <style type="text/css">
 body {   
-  font-family: serif;
+  font-family: Raanana, serif; /* prefer Raanana on OS X for the presentation forms */
   font-size: 24px;
 }
   </style>
  <body>
   <p lang="he" style="direction: rtl;">
   &#x05D1;&#x05BC;&#x05D5;&#x05BC;&#x05E9;&#x05C1;</p>
  </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/645491-1-ref.html
@@ -0,0 +1,6 @@
+<!-- This test needs to be in quirks mode -->
+<html>
+  <body style="color: green">
+    This should be green
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/645491-1.html
@@ -0,0 +1,12 @@
+<!-- This test needs to be in quirks mode -->
+<html>
+  <head>
+    <style>
+      body { color: red; }
+      body#foo { color: green; }
+    </style>
+  </head>
+  <body onload="document.body.offsetWidth; document.body.id = 'FOO'">
+    This should be green
+  </body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1623,8 +1623,9 @@ fails-if(Android) == 634232-1.html 63423
 fails-if(Android) == 635302-1.html 635302-1-ref.html
 == 635373-1.html 635373-1-ref.html
 == 635373-2.html 635373-2-ref.html
 fails-if(http.platform=="X11"&&!layersGPUAccelerated) == 635373-3.html 635373-3-ref.html
 HTTP(..) == 635639-1.html 635639-1-ref.html
 HTTP(..) == 635639-2.html 635639-2-ref.html
 == 641770-1.html 641770-1-ref.html
 == 641856-1.html 641856-1-ref.html
+== 645491-1.html 645491-1-ref.html
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -721,72 +721,72 @@ static const PLDHashTableOps AttributeSe
   PL_DHashFinalizeStub,
   NULL
 };
 
 
 //--------------------------------
 
 // Class selectors hash table.
-struct ClassSelectorEntry : public PLDHashEntryHdr {
-  nsIAtom *mClass;
+struct AtomSelectorEntry : public PLDHashEntryHdr {
+  nsIAtom *mAtom;
   nsTArray<nsCSSSelector*> mSelectors;
 };
 
 static void
-ClassSelector_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
+AtomSelector_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
 {
-  (static_cast<ClassSelectorEntry*>(hdr))->~ClassSelectorEntry();
+  (static_cast<AtomSelectorEntry*>(hdr))->~AtomSelectorEntry();
 }
 
 static PRBool
-ClassSelector_InitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
-                        const void *key)
+AtomSelector_InitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
+                       const void *key)
 {
-  ClassSelectorEntry *entry = static_cast<ClassSelectorEntry*>(hdr);
-  new (entry) ClassSelectorEntry();
-  entry->mClass = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
+  AtomSelectorEntry *entry = static_cast<AtomSelectorEntry*>(hdr);
+  new (entry) AtomSelectorEntry();
+  entry->mAtom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
   return PR_TRUE;
 }
 
 static nsIAtom*
-ClassSelector_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr)
+AtomSelector_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr)
 {
-  const ClassSelectorEntry *entry = static_cast<const ClassSelectorEntry*>(hdr);
-  return entry->mClass;
+  const AtomSelectorEntry *entry = static_cast<const AtomSelectorEntry*>(hdr);
+  return entry->mAtom;
 }
 
 // Case-sensitive ops.
-static const RuleHashTableOps ClassSelector_CSOps = {
+static const RuleHashTableOps AtomSelector_CSOps = {
   {
   PL_DHashAllocTable,
   PL_DHashFreeTable,
   PL_DHashVoidPtrKeyStub,
   RuleHash_CSMatchEntry,
   PL_DHashMoveEntryStub,
-  ClassSelector_ClearEntry,
+  AtomSelector_ClearEntry,
   PL_DHashFinalizeStub,
-  ClassSelector_InitEntry
+  AtomSelector_InitEntry
   },
-  ClassSelector_GetKey
+  AtomSelector_GetKey
 };
 
 // Case-insensitive ops.
-static const RuleHashTableOps ClassSelector_CIOps = {
+static const RuleHashTableOps AtomSelector_CIOps = {
   {
   PL_DHashAllocTable,
   PL_DHashFreeTable,
   RuleHash_CIHashKey,
   RuleHash_CIMatchEntry,
   PL_DHashMoveEntryStub,
-  ClassSelector_ClearEntry,
+  AtomSelector_ClearEntry,
   PL_DHashFinalizeStub,
-  ClassSelector_InitEntry
+  AtomSelector_InitEntry
   },
-  ClassSelector_GetKey
+  AtomSelector_GetKey
 };
 
 //--------------------------------
 
 struct RuleCascadeData {
   RuleCascadeData(nsIAtom *aMedium, PRBool aQuirksMode)
     : mRuleHash(aQuirksMode),
       mStateSelectors(),
@@ -794,47 +794,53 @@ struct RuleCascadeData {
       mCacheKey(aMedium),
       mNext(nsnull),
       mQuirksMode(aQuirksMode)
   {
     PL_DHashTableInit(&mAttributeSelectors, &AttributeSelectorOps, nsnull,
                       sizeof(AttributeSelectorEntry), 16);
     PL_DHashTableInit(&mAnonBoxRules, &RuleHash_TagTable_Ops, nsnull,
                       sizeof(RuleHashTagTableEntry), 16);
+    PL_DHashTableInit(&mIdSelectors,
+                      aQuirksMode ? &AtomSelector_CIOps.ops :
+                                    &AtomSelector_CSOps.ops,
+                      nsnull, sizeof(AtomSelectorEntry), 16);
     PL_DHashTableInit(&mClassSelectors,
-                      aQuirksMode ? &ClassSelector_CIOps.ops :
-                                    &ClassSelector_CSOps.ops,
-                      nsnull, sizeof(ClassSelectorEntry), 16);
+                      aQuirksMode ? &AtomSelector_CIOps.ops :
+                                    &AtomSelector_CSOps.ops,
+                      nsnull, sizeof(AtomSelectorEntry), 16);
     memset(mPseudoElementRuleHashes, 0, sizeof(mPseudoElementRuleHashes));
 #ifdef MOZ_XUL
     PL_DHashTableInit(&mXULTreeRules, &RuleHash_TagTable_Ops, nsnull,
                       sizeof(RuleHashTagTableEntry), 16);
 #endif
   }
 
   ~RuleCascadeData()
   {
     PL_DHashTableFinish(&mAttributeSelectors);
     PL_DHashTableFinish(&mAnonBoxRules);
+    PL_DHashTableFinish(&mIdSelectors);
     PL_DHashTableFinish(&mClassSelectors);
 #ifdef MOZ_XUL
     PL_DHashTableFinish(&mXULTreeRules);
 #endif
     for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mPseudoElementRuleHashes); ++i) {
       delete mPseudoElementRuleHashes[i];
     }
   }
   RuleHash                 mRuleHash;
   RuleHash*
     mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount];
   nsTArray<nsCSSSelector*> mStateSelectors;
   nsEventStates            mSelectorDocumentStates;
   PLDHashTable             mClassSelectors;
+  PLDHashTable             mIdSelectors;
   nsTArray<nsCSSSelector*> mPossiblyNegatedClassSelectors;
-  nsTArray<nsCSSSelector*> mIDSelectors;
+  nsTArray<nsCSSSelector*> mPossiblyNegatedIDSelectors;
   PLDHashTable             mAttributeSelectors;
   PLDHashTable             mAnonBoxRules;
 #ifdef MOZ_XUL
   PLDHashTable             mXULTreeRules;
 #endif
 
   nsTArray<nsFontFaceRuleContainer> mFontFaceRules;
 #ifdef MOZ_CSS_ANIMATIONS
@@ -2369,31 +2375,46 @@ nsCSSRuleProcessor::HasAttributeDependen
   // Since we get both before and after notifications for attributes, we
   // don't have to ignore aData->mAttribute while matching.  Just check
   // whether we have selectors relevant to aData->mAttribute that we
   // match.  If this is the before change notification, that will catch
   // rules we might stop matching; if the after change notification, the
   // ones we might have started matching.
   if (cascade) {
     if (aData->mAttribute == aData->mElement->GetIDAttributeName()) {
-      nsCSSSelector **iter = cascade->mIDSelectors.Elements(),
-                    **end = iter + cascade->mIDSelectors.Length();
+      nsIAtom* id = aData->mElement->GetID();
+      if (id) {
+        AtomSelectorEntry *entry =
+          static_cast<AtomSelectorEntry*>
+                     (PL_DHashTableOperate(&cascade->mIdSelectors,
+                                           id, PL_DHASH_LOOKUP));
+        if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
+          nsCSSSelector **iter = entry->mSelectors.Elements(),
+                        **end = iter + entry->mSelectors.Length();
+          for(; iter != end; ++iter) {
+            AttributeEnumFunc(*iter, &data);
+          }
+        }
+      }
+
+      nsCSSSelector **iter = cascade->mPossiblyNegatedIDSelectors.Elements(),
+                    **end = iter + cascade->mPossiblyNegatedIDSelectors.Length();
       for(; iter != end; ++iter) {
         AttributeEnumFunc(*iter, &data);
       }
     }
     
     if (aData->mAttribute == aData->mElement->GetClassAttributeName()) {
       const nsAttrValue* elementClasses = aData->mElement->GetClasses();
       if (elementClasses) {
         PRInt32 atomCount = elementClasses->GetAtomCount();
         for (PRInt32 i = 0; i < atomCount; ++i) {
           nsIAtom* curClass = elementClasses->AtomAt(i);
-          ClassSelectorEntry *entry =
-            static_cast<ClassSelectorEntry*>
+          AtomSelectorEntry *entry =
+            static_cast<AtomSelectorEntry*>
                        (PL_DHashTableOperate(&cascade->mClassSelectors,
                                              curClass, PL_DHASH_LOOKUP));
           if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
             nsCSSSelector **iter = entry->mSelectors.Elements(),
                           **end = iter + entry->mSelectors.Length();
             for(; iter != end; ++iter) {
               AttributeEnumFunc(*iter, &data);
             }
@@ -2557,28 +2578,39 @@ AddSelector(RuleCascadeData* aCascade,
       }
     }
 
     // Build mStateSelectors.
     if (IsStateSelector(*negation))
       aCascade->mStateSelectors.AppendElement(aSelectorInTopLevel);
 
     // Build mIDSelectors
-    if (negation->mIDList) {
-      aCascade->mIDSelectors.AppendElement(aSelectorInTopLevel);
+    if (negation == aSelectorInTopLevel) {
+      for (nsAtomList* curID = negation->mIDList; curID;
+           curID = curID->mNext) {
+        AtomSelectorEntry *entry =
+          static_cast<AtomSelectorEntry*>(PL_DHashTableOperate(&aCascade->mIdSelectors,
+                                                               curID->mAtom,
+                                                               PL_DHASH_ADD));
+        if (entry) {
+          entry->mSelectors.AppendElement(aSelectorInTopLevel);
+        }
+      }
+    } else if (negation->mIDList) {
+      aCascade->mPossiblyNegatedIDSelectors.AppendElement(aSelectorInTopLevel);
     }
 
     // Build mClassSelectors
     if (negation == aSelectorInTopLevel) {
       for (nsAtomList* curClass = negation->mClassList; curClass;
            curClass = curClass->mNext) {
-        ClassSelectorEntry *entry =
-          static_cast<ClassSelectorEntry*>(PL_DHashTableOperate(&aCascade->mClassSelectors,
-                                                                curClass->mAtom,
-                                                                PL_DHASH_ADD));
+        AtomSelectorEntry *entry =
+          static_cast<AtomSelectorEntry*>(PL_DHashTableOperate(&aCascade->mClassSelectors,
+                                                               curClass->mAtom,
+                                                               PL_DHASH_ADD));
         if (entry) {
           entry->mSelectors.AppendElement(aSelectorInTopLevel);
         }
       }
     } else if (negation->mClassList) {
       aCascade->mPossiblyNegatedClassSelectors.AppendElement(aSelectorInTopLevel);
     }
 
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -68,18 +68,16 @@
 #include "nsIContentPolicy.h"
 #include "nsContentPolicyUtils.h"
 #include "nsContentErrors.h"
 #include "nsCrossSiteListenerProxy.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIChannelPolicy.h"
 #include "nsChannelPolicy.h"
 
-#include "nsStyleSet.h"
-
 #ifdef PR_LOGGING
 static PRLogModuleInfo *gFontDownloaderLog = PR_NewLogModule("fontdownloader");
 #endif /* PR_LOGGING */
 
 #define LOG(args) PR_LOG(gFontDownloaderLog, PR_LOG_DEBUG, args)
 #define LOG_ENABLED() PR_LOG_TEST(gFontDownloaderLog, PR_LOG_DEBUG)
 
 
@@ -433,251 +431,8 @@ nsUserFontSet::StartLoad(gfxFontEntry *a
 
   if (NS_SUCCEEDED(rv)) {
     mLoaders.PutEntry(fontLoader);
     fontLoader->StartedLoading(streamLoader);
   }
 
   return rv;
 }
-
-PRBool
-nsUserFontSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
-{
-  nsTArray<FontFaceRuleRecord> oldRules;
-  mRules.SwapElements(oldRules);
-
-  // destroy the font family records; we need to re-create them
-  // because we might end up with faces in a different order,
-  // even if they're the same font entries as before
-  mFontFamilies.Clear();
-
-  PRBool modified = PR_FALSE;
-
-  for (PRUint32 i = 0, i_end = aRules.Length(); i < i_end; ++i) {
-    // insert each rule into our list, migrating old font entries if possible
-    // rather than creating new ones; set  modified  to true if we detect
-    // that rule ordering has changed, or if a new entry is created
-    InsertRule(aRules[i].mRule, aRules[i].mSheetType, oldRules, modified);
-  }
-
-  // if any rules are left in the old list, note that the set has changed
-  if (oldRules.Length() > 0) {
-    modified = PR_TRUE;
-  }
-
-  return modified;
-}
-
-void
-nsUserFontSet::InsertRule(nsCSSFontFaceRule *aRule, PRUint8 aSheetType,
-                          nsTArray<FontFaceRuleRecord>& oldRules,
-                          PRBool& aFontSetModified)
-{
-  NS_ABORT_IF_FALSE(aRule->GetType() == nsICSSRule::FONT_FACE_RULE,
-                    "InsertRule passed a non-fontface CSS rule");
-
-  // set up family name
-  nsAutoString fontfamily;
-  nsCSSValue val;
-  PRUint32 unit;
-
-  aRule->GetDesc(eCSSFontDesc_Family, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_String) {
-    val.GetStringValue(fontfamily);
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face family name has unexpected unit");
-  }
-  if (fontfamily.IsEmpty()) {
-    // If there is no family name, this rule cannot contribute a
-    // usable font, so there is no point in processing it further.
-    return;
-  }
-
-  // first, we check in oldRules; if the rule exists there, just move it
-  // to the new rule list, and put the entry into the appropriate family
-  for (PRUint32 i = 0; i < oldRules.Length(); ++i) {
-    const FontFaceRuleRecord& ruleRec = oldRules[i];
-    if (ruleRec.mContainer.mRule == aRule &&
-        ruleRec.mContainer.mSheetType == aSheetType) {
-      AddFontFace(fontfamily, ruleRec.mFontEntry);
-      mRules.AppendElement(ruleRec);
-      oldRules.RemoveElementAt(i);
-      // note the set has been modified if an old rule was skipped to find
-      // this one - something has been dropped, or ordering changed
-      if (i > 0) {
-        aFontSetModified = PR_TRUE;
-      }
-      return;
-    }
-  }
-
-  // this is a new rule:
-
-  PRUint32 weight = NS_STYLE_FONT_WEIGHT_NORMAL;
-  PRUint32 stretch = NS_STYLE_FONT_STRETCH_NORMAL;
-  PRUint32 italicStyle = FONT_STYLE_NORMAL;
-  nsString featureSettings, languageOverride;
-
-  // set up weight
-  aRule->GetDesc(eCSSFontDesc_Weight, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Integer || unit == eCSSUnit_Enumerated) {
-    weight = val.GetIntValue();
-  } else if (unit == eCSSUnit_Normal) {
-    weight = NS_STYLE_FONT_WEIGHT_NORMAL;
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face weight has unexpected unit");
-  }
-
-  // set up stretch
-  aRule->GetDesc(eCSSFontDesc_Stretch, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Enumerated) {
-    stretch = val.GetIntValue();
-  } else if (unit == eCSSUnit_Normal) {
-    stretch = NS_STYLE_FONT_STRETCH_NORMAL;
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face stretch has unexpected unit");
-  }
-
-  // set up font style
-  aRule->GetDesc(eCSSFontDesc_Style, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Enumerated) {
-    italicStyle = val.GetIntValue();
-  } else if (unit == eCSSUnit_Normal) {
-    italicStyle = FONT_STYLE_NORMAL;
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face style has unexpected unit");
-  }
-
-  // set up font features
-  aRule->GetDesc(eCSSFontDesc_FontFeatureSettings, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Normal) {
-    // empty feature string
-  } else if (unit == eCSSUnit_String) {
-    val.GetStringValue(featureSettings);
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face font-feature-settings has unexpected unit");
-  }
-
-  // set up font language override
-  aRule->GetDesc(eCSSFontDesc_FontLanguageOverride, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Normal) {
-    // empty feature string
-  } else if (unit == eCSSUnit_String) {
-    val.GetStringValue(languageOverride);
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null,
-                 "@font-face font-language-override has unexpected unit");
-  }
-
-  // set up src array
-  nsTArray<gfxFontFaceSrc> srcArray;
-
-  aRule->GetDesc(eCSSFontDesc_Src, val);
-  unit = val.GetUnit();
-  if (unit == eCSSUnit_Array) {
-    nsCSSValue::Array *srcArr = val.GetArrayValue();
-    size_t numSrc = srcArr->Count();
-    
-    for (size_t i = 0; i < numSrc; i++) {
-      val = srcArr->Item(i);
-      unit = val.GetUnit();
-      gfxFontFaceSrc *face = srcArray.AppendElements(1);
-      if (!face)
-        return;
-            
-      switch (unit) {
-       
-      case eCSSUnit_Local_Font:
-        val.GetStringValue(face->mLocalName);
-        face->mIsLocal = PR_TRUE;
-        face->mURI = nsnull;
-        face->mFormatFlags = 0;
-        break;
-      case eCSSUnit_URL:
-        face->mIsLocal = PR_FALSE;
-        face->mURI = val.GetURLValue();
-        NS_ASSERTION(face->mURI, "null url in @font-face rule");
-        face->mReferrer = val.GetURLStructValue()->mReferrer;
-        face->mOriginPrincipal = val.GetURLStructValue()->mOriginPrincipal;
-        NS_ASSERTION(face->mOriginPrincipal, "null origin principal in @font-face rule");
-        
-        // agent and user stylesheets are treated slightly differently,
-        // the same-site origin check and access control headers are
-        // enforced against the sheet principal rather than the document
-        // principal to allow user stylesheets to include @font-face rules
-        face->mUseOriginPrincipal = (aSheetType == nsStyleSet::eUserSheet ||
-                                     aSheetType == nsStyleSet::eAgentSheet);
-                                     
-        face->mLocalName.Truncate();
-        face->mFormatFlags = 0;
-        while (i + 1 < numSrc && (val = srcArr->Item(i+1), 
-                 val.GetUnit() == eCSSUnit_Font_Format)) {
-          nsDependentString valueString(val.GetStringBufferValue());
-          if (valueString.LowerCaseEqualsASCII("woff")) {
-            face->mFormatFlags |= FLAG_FORMAT_WOFF; 
-          } else if (valueString.LowerCaseEqualsASCII("opentype")) {
-            face->mFormatFlags |= FLAG_FORMAT_OPENTYPE; 
-          } else if (valueString.LowerCaseEqualsASCII("truetype")) {
-            face->mFormatFlags |= FLAG_FORMAT_TRUETYPE; 
-          } else if (valueString.LowerCaseEqualsASCII("truetype-aat")) {
-            face->mFormatFlags |= FLAG_FORMAT_TRUETYPE_AAT; 
-          } else if (valueString.LowerCaseEqualsASCII("embedded-opentype")) {
-            face->mFormatFlags |= FLAG_FORMAT_EOT;   
-          } else if (valueString.LowerCaseEqualsASCII("svg")) {
-            face->mFormatFlags |= FLAG_FORMAT_SVG;   
-          } else {
-            // unknown format specified, mark to distinguish from the 
-            // case where no format hints are specified
-            face->mFormatFlags |= FLAG_FORMAT_UNKNOWN;
-          }
-          i++;
-        }
-        break;
-      default:
-        NS_ASSERTION(unit == eCSSUnit_Local_Font || unit == eCSSUnit_URL,
-                     "strange unit type in font-face src array");
-        break;
-      }
-     }
-  } else {
-    NS_ASSERTION(unit == eCSSUnit_Null, "@font-face src has unexpected unit");
-  }
-  
-  if (srcArray.Length() > 0) {
-    FontFaceRuleRecord ruleRec;
-    ruleRec.mContainer.mRule = aRule;
-    ruleRec.mContainer.mSheetType = aSheetType;
-    ruleRec.mFontEntry = AddFontFace(fontfamily, srcArray,
-                                     weight, stretch, italicStyle,
-                                     featureSettings, languageOverride);
-    if (ruleRec.mFontEntry) {
-      mRules.AppendElement(ruleRec);
-    }
-    // this was a new rule and fontEntry, so note that the set was modified
-    aFontSetModified = PR_TRUE;
-  }
-}
-
-void
-nsUserFontSet::ReplaceFontEntry(gfxProxyFontEntry *aProxy,
-                                gfxFontEntry *aFontEntry)
-{
-  for (PRUint32 i = 0; i < mRules.Length(); ++i) {
-    if (mRules[i].mFontEntry == aProxy) {
-      mRules[i].mFontEntry = aFontEntry;
-      break;
-    }
-  }
-  static_cast<gfxMixedFontFamily*>(aProxy->Family())->
-    ReplaceFontEntry(aProxy, aFontEntry);
-}
--- a/layout/style/nsFontFaceLoader.h
+++ b/layout/style/nsFontFaceLoader.h
@@ -45,25 +45,23 @@
 #include "nsCOMPtr.h"
 #include "nsIStreamLoader.h"
 #include "nsIURI.h"
 #include "nsIChannel.h"
 #include "nsITimer.h"
 #include "gfxUserFontSet.h"
 #include "nsHashKeys.h"
 #include "nsTHashtable.h"
-#include "nsCSSRules.h"
 
 class nsIRequest;
 class nsISupports;
 class nsPresContext;
 class nsIPrincipal;
 
 class nsFontFaceLoader;
-class nsCSSFontFaceRule;
 
 // nsUserFontSet - defines the loading mechanism for downloadable fonts
 class nsUserFontSet : public gfxUserFontSet
 {
 public:
   nsUserFontSet(nsPresContext *aContext);
   ~nsUserFontSet();
 
@@ -74,45 +72,25 @@ public:
   // returns whether load process successfully started or not
   nsresult StartLoad(gfxFontEntry *aFontToLoad, 
                      const gfxFontFaceSrc *aFontFaceSrc);
 
   // Called by nsFontFaceLoader when the loader has completed normally.
   // It's removed from the mLoaders set.
   void RemoveLoader(nsFontFaceLoader *aLoader);
 
-  PRBool UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules);
-
   nsPresContext *GetPresContext() { return mPresContext; }
 
-  virtual void ReplaceFontEntry(gfxProxyFontEntry *aProxy,
-                                gfxFontEntry *aFontEntry);
-
 protected:
-  // The font-set keeps track of the collection of rules, and their
-  // corresponding font entries (whether proxies or real entries),
-  // so that we can update the set without having to throw away
-  // all the existing fonts.
-  struct FontFaceRuleRecord {
-    nsRefPtr<gfxFontEntry>       mFontEntry;
-    nsFontFaceRuleContainer      mContainer;
-  };
-
-  void InsertRule(nsCSSFontFaceRule *aRule, PRUint8 aSheetType,
-                  nsTArray<FontFaceRuleRecord>& oldRules,
-                  PRBool& aFontSetModified);
-
   nsPresContext *mPresContext;  // weak reference
 
   // Set of all loaders pointing to us. These are not strong pointers,
   // but that's OK because nsFontFaceLoader always calls RemoveLoader on
   // us before it dies (unless we die first).
   nsTHashtable< nsPtrHashKey<nsFontFaceLoader> > mLoaders;
-
-  nsTArray<FontFaceRuleRecord>   mRules;
 };
 
 class nsFontFaceLoader : public nsIStreamLoaderObserver
 {
 public:
 
   nsFontFaceLoader(gfxFontEntry *aFontToLoad, nsIURI *aFontURI, 
                    nsUserFontSet *aFontSet, nsIChannel *aChannel);
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -447,23 +447,16 @@ pref("app.creditsURL", "http://www.mozil
 #if MOZ_UPDATE_CHANNEL == beta
 pref("app.featuresURL", "http://www.mozilla.com/%LOCALE%/mobile/beta/features/");
 pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/beta/faq/");
 #else
 pref("app.featuresURL", "http://www.mozilla.com/%LOCALE%/mobile/features/");
 pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/mobile/faq/");
 #endif
 
-pref("app.promo.spark.baseURL", "http://spark.mozilla.org");
-#ifdef MOZ_OFFICIAL_BRANDING
-pref("app.promo.spark.endDate", "2011-05-01");
-#else
-pref("app.promo.spark.endDate", "2011-01-01");
-#endif
-
 // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
 pref("security.alternate_certificate_error_page", "certerror");
 
 pref("security.warn_viewing_mixed", false); // Warning is disabled.  See Bug 616712.
 
 // Override some named colors to avoid inverse OS themes
 pref("ui.-moz-dialog", "#efebe7");
 pref("ui.-moz-dialogtext", "#101010");
--- a/mobile/branding/nightly/content/jar.mn
+++ b/mobile/branding/nightly/content/jar.mn
@@ -1,7 +1,6 @@
 chrome.jar:
 % content branding %content/branding/
   content/branding/about.png                     (about.png)
   content/branding/logoWordmark.png              (logoWordmark.png)
   content/branding/logo.png                      (logo.png)
   content/branding/favicon32.png                 (favicon32.png)
-  content/branding/spark.png                     (spark.png)
deleted file mode 100644
index 32c8af51d275b35e8300171786822fee820bb0e3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/branding/official/content/jar.mn
+++ b/mobile/branding/official/content/jar.mn
@@ -1,7 +1,6 @@
 chrome.jar:
 % content branding %content/branding/
   content/branding/about.png                     (about.png)
   content/branding/logoWordmark.png              (logoWordmark.png)
   content/branding/logo.png                      (logo.png)
   content/branding/favicon32.png                 (favicon32.png)
-  content/branding/spark.png                     (spark.png)
deleted file mode 100644
index 32c8af51d275b35e8300171786822fee820bb0e3..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/chrome/content/aboutHome.xhtml
+++ b/mobile/chrome/content/aboutHome.xhtml
@@ -81,18 +81,16 @@
       <div id="loadingAddons" class="loading">
         <img src="chrome://browser/skin/images/throbber.png"/>
       </div>
     </div>
 
     <div id="footer-wrapper">
       <span id="feedback" style="width: &aboutHome.footerWidth;" class="section-row" pref="app.feedbackURL" onclick="openLink(this);" role="button">&aboutHome.giveFeedback;</span><span id="support" style="width: &aboutHome.footerWidth;" class="section-row" pref="app.support.baseURL" onclick="openLink(this);" role="button">&aboutHome.getHelp;</span>
     </div>
-
-    <div id="promo" pref="app.promo.spark.baseURL" onclick="openLink(this);" role="button"><img src="chrome://branding/content/spark.png"/><span id="promo-label">&aboutHome.promoLabel;</span><span id="promo-button" class="section-row">&aboutHome.promoButton;</span></div>
   </div>
 
   <!-- l10n hack -->
   <div style="display: none">
     <span id="text-openalltabs">&aboutHome.openAllTabs;</span>
     <span id="text-notabs">&aboutHome.noTabs;</span>
     <span id="text-noaddons">&aboutHome.noAddons;</span>
   </div>
@@ -121,17 +119,16 @@
                     .QueryInterface(Ci.nsIDOMChromeWindow);
       }
       return gChromeWin;
     }
 
     function init() {
       initTabs();
       initAddons();
-      initPromo();
     }
 
     function uninit() {
       uninitAddons();
     }
 
     function _readFile(aFile) {
       try {
@@ -365,17 +362,11 @@
     function initAddons() {
       getChromeWin().Services.obs.addObserver(updateAddons, "recommended-addons-cache-updated", false);
       updateAddons();
     }
 
     function uninitAddons() {
       getChromeWin().Services.obs.removeObserver(updateAddons, "recommended-addons-cache-updated");
     }
-
-    function initPromo() {
-      let endDate = new Date(getChromeWin().Services.prefs.getCharPref("app.promo.spark.endDate"));
-      if (endDate > Date.now())
-        document.getElementById("promo").style.display = "block";
-    }
   ]]></script>
 </body>
 </html>
--- a/mobile/confvars.sh
+++ b/mobile/confvars.sh
@@ -33,17 +33,17 @@
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 MOZ_APP_NAME=fennec
 MOZ_APP_UA_NAME=Fennec
 
-MOZ_APP_VERSION=4.1a1pre
+MOZ_APP_VERSION=6.0a1
 
 MOZ_BRANDING_DIRECTORY=mobile/branding/nightly
 MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/branding/official
 # MOZ_APP_DISPLAYNAME is set by branding/configure.sh
 
 MOZ_SERVICES_SYNC=1
 
 MOZ_ENABLE_LIBXUL=1
--- a/mobile/locales/en-US/chrome/aboutHome.dtd
+++ b/mobile/locales/en-US/chrome/aboutHome.dtd
@@ -3,13 +3,8 @@
 <!ENTITY aboutHome.remoteTabs                   "Tabs from your other computers">
 <!ENTITY aboutHome.recommendedAddons2           "Add-ons for your &brandShortName;">
 <!ENTITY aboutHome.giveFeedback                 "Give Feedback">
 <!ENTITY aboutHome.getHelp                      "Get Help">
 <!ENTITY aboutHome.footerWidth                  "10em">
 <!ENTITY aboutHome.openAllTabs                  "Open all in tabs">
 <!ENTITY aboutHome.noTabs                       "No tabs from last time">
 <!ENTITY aboutHome.noAddons                     "No recommended add-ons">
-
-<!-- LOCALIZATION NOTE: 'Firefox Spark' is the official name of the promotion/constest and should not be translated -->
-<!ENTITY aboutHome.promoLabel                   "Firefox Spark">
-<!-- LOCALIZATION NOTE: 'Play' should be translated in the context of 'playing a game' and not 'playing a video' -->
-<!ENTITY aboutHome.promoButton                  "Play">
--- a/mobile/themes/core/aboutHome.css
+++ b/mobile/themes/core/aboutHome.css
@@ -251,47 +251,8 @@ body[dir="rtl"] {
   body[dir="ltr"]  #support {
     border-radius: 0 8px 8px 0;
   }
 
   body[dir="rtl"]  #support {
     border-radius: 8px 0 0 8px;
   }
 }
-
-#promo {
-  font-weight: bold;
-  color: rgb(254,210,13);
-  background-color: black;
-  border-radius: 6px;
-  padding: 10px;
-  margin-top: 24px;
-  box-shadow: inset rgba(0, 0, 0, 0.2) 0 -3px 0px, rgba(0, 0, 0, 0.1) 0px 2px 0px;
-  display: none;
-}
-
-#promo-label {
-  padding-left: 16px;
-}
-
-#promo-button {
-  padding: 8px;
-  margin: 0;
-  color: black;
-  font-size: 18px;
-  -moz-padding-end: 20px;
-}
-
-body[dir="ltr"] #promo-button {
-  float: right;
-  background: rgb(254,210,13) url("images/arrowright-16.png") 99% center no-repeat;
-}
-
-body[dir="rtl"] #promo-button {
-  float: left;
-  background: rgb(254,210,13) url("images/arrowleft-16.png") 1% center no-repeat;
-}
-
-@media (max-width: 399px) {
-  #promo-button {
-    display: none;
-  }
-}
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1864,26 +1864,26 @@ pref("font.name.monospace.el", "Lucida G
 pref("font.name.cursive.el", "Lucida Grande");
 pref("font.name.fantasy.el", "Lucida Grande");
 pref("font.name-list.serif.el", "Lucida Grande");
 pref("font.name-list.sans-serif.el", "Lucida Grande");
 pref("font.name-list.monospace.el", "Lucida Grande");
 pref("font.name-list.cursive.el", "Lucida Grande");
 pref("font.name-list.fantasy.el", "Lucida Grande");
 
-pref("font.name.serif.he", "Raanana");
-pref("font.name.sans-serif.he", "Arial Hebrew");
-pref("font.name.monospace.he", "Arial Hebrew");
-pref("font.name.cursive.he", "Corsiva Hebrew");
-pref("font.name.fantasy.he", "Corsiva Hebrew");
-pref("font.name-list.serif.he", "Raanana");
-pref("font.name-list.sans-serif.he", "Arial Hebrew");
-pref("font.name-list.monospace.he", "Arial Hebrew");
-pref("font.name-list.cursive.he", "Corsiva Hebrew");
-pref("font.name-list.fantasy.he", "Corsiva Hebrew");
+pref("font.name.serif.he", "Times New Roman");
+pref("font.name.sans-serif.he", "Arial");
+pref("font.name.monospace.he", "Courier New");
+pref("font.name.cursive.he", "Times New Roman");
+pref("font.name.fantasy.he", "Times New Roman");
+pref("font.name-list.serif.he", "Times New Roman");
+pref("font.name-list.sans-serif.he", "Arial");
+pref("font.name-list.monospace.he", "Courier New");
+pref("font.name-list.cursive.he", "Times New Roman");
+pref("font.name-list.fantasy.he", "Times New Roman");
 
 pref("font.name.serif.ja", "Hiragino Mincho Pro"); 
 pref("font.name.sans-serif.ja", "Hiragino Kaku Gothic Pro"); 
 pref("font.name.monospace.ja", "Osaka-Mono"); 
 pref("font.name-list.serif.ja", "Hiragino Mincho Pro"); 
 pref("font.name-list.sans-serif.ja", "Hiragino Kaku Gothic Pro"); 
 pref("font.name-list.monospace.ja", "Osaka-Mono"); 
 
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -67,17 +67,16 @@
 #include "nsIDOMDocument.h"
 #include "nsIImageDocument.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMNSHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIEventStateManager.h"
 #include "nsIDocument.h"
 #include "nsISelection.h"
-#include "nsISelectElement.h"
 #include "nsILink.h"
 #include "nsTextFragment.h"
 #include "nsIDOMNSEditableElement.h"
 #include "nsIDOMNSHTMLElement.h"
 #include "nsIEditor.h"
 
 #include "nsIDocShellTreeItem.h"
 #include "nsIWebNavigation.h"
--- a/toolkit/library/nsStaticXULComponents.cpp
+++ b/toolkit/library/nsStaticXULComponents.cpp
@@ -218,20 +218,23 @@
 #if defined(BUILD_CTYPES)
 #define JSCTYPES_MODULE MODULE(jsctypes)
 #else
 #define JSCTYPES_MODULE
 #endif
 
 #define SERVICES_CRYPTO_MODULE MODULE(nsServicesCryptoModule)
 
+#ifndef MOZ_APP_COMPONENT_MODULES
 #if defined(MOZ_APP_COMPONENT_INCLUDE)
 #include MOZ_APP_COMPONENT_INCLUDE
+#define MOZ_APP_COMPONENT_MODULES APP_COMPONENT_MODULES
 #else
-#define APP_COMPONENT_MODULES
+#define MOZ_APP_COMPONENT_MODULES
+#endif
 #endif
 
 #define XUL_MODULES                          \
     MODULE(nsUConvModule)                    \
     MODULE(nsI18nModule)                     \
     MODULE(nsChardetModule)                  \
     UNIVERSALCHARDET_MODULE                  \
     MODULE(necko)                            \
@@ -274,17 +277,17 @@
     SPELLCHECK_MODULE                        \
     LAYOUT_DEBUG_MODULE                      \
     UNIXPROXY_MODULE                         \
     OSXPROXY_MODULE                          \
     WINDOWSPROXY_MODULE                      \
     JSCTYPES_MODULE                          \
     MODULE(jsperf)                           \
     SERVICES_CRYPTO_MODULE                   \
-    APP_COMPONENT_MODULES                    \
+    MOZ_APP_COMPONENT_MODULES                \
     /* end of list */
 
 #define MODULE(_name) \
   NSMODULE_DECL(_name);
 
 XUL_MODULES
 
 #undef MODULE
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -374,18 +374,16 @@ INNER_UNMAKE_PACKAGE	= \
 SDK_SUFFIX = .tar.bz2
 SDK = $(MOZ_PKG_APPNAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
 ifeq ($(MOZ_APP_NAME),xulrunner)
 SDK = $(SDK_PATH)$(MOZ_APP_NAME)-$(MOZ_PKG_VERSION).$(AB_CD).mac-$(TARGET_CPU).sdk$(SDK_SUFFIX)
 endif
 MAKE_SDK = $(CREATE_FINAL_TAR) - $(MOZ_APP_NAME)-sdk | bzip2 -vf > $(SDK)
 endif
 
-CREATE_PRECOMPLETE = $(PYTHON) $(MOZILLA_DIR)/config/createprecomplete.py
-
 ifdef MOZ_OMNIJAR
 GENERATE_CACHE ?= true
 
 OMNIJAR_FILES	= \
   chrome \
   chrome.manifest \
   components/*.js \
   components/*.xpt \
@@ -418,20 +416,20 @@ PACK_OMNIJAR	= \
 UNPACK_OMNIJAR	= \
   $(OPTIMIZE_JARS_CMD) --deoptimize $(_ABS_DIST)/jarlog/ ./ ./ && \
   unzip -o omni.jar && \
   rm -f components/binary.manifest && \
   sed -e 's/^\#binary-component/binary-component/' components/components.manifest > components.manifest && \
   mv components.manifest components
 
 MAKE_PACKAGE	= (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR)) && \
-	              (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE)) && $(INNER_MAKE_PACKAGE)
+	              (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE_CMD)) && $(INNER_MAKE_PACKAGE)
 UNMAKE_PACKAGE	= $(INNER_UNMAKE_PACKAGE) && (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(UNPACK_OMNIJAR))
 else
-MAKE_PACKAGE	= (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE)) && $(INNER_MAKE_PACKAGE)
+MAKE_PACKAGE	= (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE_CMD)) && $(INNER_MAKE_PACKAGE)
 UNMAKE_PACKAGE	= $(INNER_UNMAKE_PACKAGE)
 endif
 
 # dummy macro if we don't have PSM built
 SIGN_NSS		=
 ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
 ifdef MOZ_PSM
 SIGN_NSS		= @echo signing nss libraries;
@@ -564,17 +562,17 @@ ifndef MOZ_PKG_MANIFEST
 endif
 	@rm -rf $(DEPTH)/installer-stage $(DIST)/xpt
 	@echo "Staging installer files..."
 	@$(NSINSTALL) -D $(DEPTH)/installer-stage/core
 ifdef MOZ_OMNIJAR
 	@(cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR))
 endif
 	@cp -av $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/. $(DEPTH)/installer-stage/core
-	@(cd $(DEPTH)/installer-stage/core && $(CREATE_PRECOMPLETE))
+	@(cd $(DEPTH)/installer-stage/core && $(CREATE_PRECOMPLETE_CMD))
 ifdef MOZ_OPTIONAL_PKG_LIST
 	@$(NSINSTALL) -D $(DEPTH)/installer-stage/optional
 	$(call PACKAGER_COPY, "$(call core_abspath,$(DIST))",\
 	  "$(call core_abspath,$(DEPTH)/installer-stage/optional)", \
 	  "$(MOZ_PKG_MANIFEST)", "$(PKGCP_OS)", 1, 0, 1 \
 	  $(foreach pkg,$(MOZ_OPTIONAL_PKG_LIST),$(PKG_ARG)) )
 	@cd $(DEPTH)/installer-stage/optional/extensions; find -maxdepth 1 -mindepth 1 -exec rm -r ../../core/extensions/{} \;
 endif
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -79,17 +79,17 @@ MAKEFILES_dom="
   dom/src/events/Makefile
   dom/src/jsurl/Makefile
   dom/src/geolocation/Makefile
   dom/src/json/Makefile
   dom/src/offline/Makefile
   dom/src/storage/Makefile
   dom/src/threads/Makefile
   dom/locales/Makefile
-  dom/plugins/Makefile
+  dom/plugins/ipc/Makefile
   js/jetpack/Makefile
 "
 
 MAKEFILES_editor="
   editor/Makefile
   editor/public/Makefile
   editor/idl/Makefile
   editor/txmgr/Makefile