Merge m-c to b-s.
authorKyle Huey <khuey@kylehuey.com>
Tue, 29 Nov 2011 16:31:01 -0500
changeset 81787 5559ff27e7a227b6b104220cefd2e33c2b54542a
parent 81786 752ef8b0c92ae52355ca0fadf4ee64bd49d53bdd (current diff)
parent 81731 4c3b8d006a0d9c44dbc43227c0720bb2ca4572ea (diff)
child 81788 0e5dfc784411bf06ed09da884a6791aa127a2d06
push idunknown
push userunknown
push dateunknown
milestone11.0a1
Merge m-c to b-s.
browser/app/application.ini
browser/themes/gnomestripe/feeds/audioFeedIcon.png
browser/themes/gnomestripe/feeds/audioFeedIcon16.png
browser/themes/gnomestripe/feeds/videoFeedIcon.png
browser/themes/gnomestripe/feeds/videoFeedIcon16.png
browser/themes/pinstripe/feeds/audioFeedIcon.png
browser/themes/pinstripe/feeds/audioFeedIcon16.png
browser/themes/pinstripe/feeds/videoFeedIcon.png
browser/themes/pinstripe/feeds/videoFeedIcon16.png
browser/themes/winstripe/aboutSessionRestore-window-icon.png
browser/themes/winstripe/feeds/audioFeedIcon-aero.png
browser/themes/winstripe/feeds/audioFeedIcon.png
browser/themes/winstripe/feeds/audioFeedIcon16-aero.png
browser/themes/winstripe/feeds/audioFeedIcon16.png
browser/themes/winstripe/feeds/videoFeedIcon-aero.png
browser/themes/winstripe/feeds/videoFeedIcon.png
browser/themes/winstripe/feeds/videoFeedIcon16-aero.png
browser/themes/winstripe/feeds/videoFeedIcon16.png
browser/themes/winstripe/places/searching_16-aero.png
browser/themes/winstripe/preferences/plugin-aero.png
dom/interfaces/base/nsIAnimationFrameListener.idl
extensions/pref/system-pref/src/Makefile.in
extensions/pref/system-pref/src/gconf/Makefile.in
extensions/pref/system-pref/src/gconf/gconf_pref_list.inc
extensions/pref/system-pref/src/gconf/nsSystemPrefService.cpp
extensions/pref/system-pref/src/gconf/nsSystemPrefService.h
extensions/pref/system-pref/src/nsSystemPref.cpp
extensions/pref/system-pref/src/nsSystemPref.h
extensions/pref/system-pref/src/nsSystemPrefFactory.cpp
extensions/pref/system-pref/src/nsSystemPrefLog.h
gfx/thebes/EGLUtils.h
gfx/thebes/GLContext.cpp
gfx/thebes/GLContext.h
gfx/thebes/GLContextProvider.h
gfx/thebes/GLContextProviderCGL.mm
gfx/thebes/GLContextProviderEGL.cpp
gfx/thebes/GLContextProviderGLX.cpp
gfx/thebes/GLContextProviderImpl.h
gfx/thebes/GLContextProviderNull.cpp
gfx/thebes/GLContextProviderOSMesa.cpp
gfx/thebes/GLContextProviderWGL.cpp
gfx/thebes/GLContextSymbols.h
gfx/thebes/GLDefs.h
gfx/thebes/GLXLibrary.h
gfx/thebes/WGLLibrary.h
js/src/imacro_asm.py
js/src/imacros.jsasm
js/src/jsbuiltins.cpp
js/src/jsbuiltins.h
js/src/jshotloop.h
js/src/jstracer.cpp
js/src/jstracer.h
js/src/lirasm/LInsClasses.tbl
js/src/lirasm/Makefile.in
js/src/lirasm/lirasm.cpp
js/src/lirasm/testlirc.sh
js/src/lirasm/tests/32-bit/many_params.in
js/src/lirasm/tests/32-bit/many_params.out
js/src/lirasm/tests/64-bit/dasq.in
js/src/lirasm/tests/64-bit/dasq.out
js/src/lirasm/tests/64-bit/qasd.in
js/src/lirasm/tests/64-bit/qasd.out
js/src/lirasm/tests/64-bit/shq.in
js/src/lirasm/tests/64-bit/shq.out
js/src/lirasm/tests/add.in
js/src/lirasm/tests/add.out
js/src/lirasm/tests/addd.in
js/src/lirasm/tests/addd.out
js/src/lirasm/tests/addjovi.in
js/src/lirasm/tests/addjovi.out
js/src/lirasm/tests/addjovi_ovf.in
js/src/lirasm/tests/addjovi_ovf.out
js/src/lirasm/tests/addsub.in
js/src/lirasm/tests/addsub.out
js/src/lirasm/tests/backjump.in
js/src/lirasm/tests/backjump.out
js/src/lirasm/tests/bigendian/fuzz-527178.in
js/src/lirasm/tests/bigendian/fuzz-527178.out
js/src/lirasm/tests/bigendian/ldc2i.in
js/src/lirasm/tests/bigendian/ldc2i.out
js/src/lirasm/tests/bigendian/lds2i.in
js/src/lirasm/tests/bigendian/lds2i.out
js/src/lirasm/tests/bigendian/lduc2ui.in
js/src/lirasm/tests/bigendian/lduc2ui.out
js/src/lirasm/tests/bigendian/ldus2ui.in
js/src/lirasm/tests/bigendian/ldus2ui.out
js/src/lirasm/tests/bug596923.in
js/src/lirasm/tests/bug596923.out
js/src/lirasm/tests/bug643969.in
js/src/lirasm/tests/bug643969.out
js/src/lirasm/tests/call1.in
js/src/lirasm/tests/call1.out
js/src/lirasm/tests/call2.in
js/src/lirasm/tests/call2.out
js/src/lirasm/tests/calld1.in
js/src/lirasm/tests/calld1.out
js/src/lirasm/tests/callid1.in
js/src/lirasm/tests/callid1.out
js/src/lirasm/tests/callid2.in
js/src/lirasm/tests/callid2.out
js/src/lirasm/tests/callid3.in
js/src/lirasm/tests/callid3.out
js/src/lirasm/tests/callv.in
js/src/lirasm/tests/callv.out
js/src/lirasm/tests/cmov.in
js/src/lirasm/tests/cmov.out
js/src/lirasm/tests/cond_eqd.in
js/src/lirasm/tests/cond_eqd.out
js/src/lirasm/tests/cond_eqi.in
js/src/lirasm/tests/cond_eqi.out
js/src/lirasm/tests/cond_ged.in
js/src/lirasm/tests/cond_ged.out
js/src/lirasm/tests/cond_gei.in
js/src/lirasm/tests/cond_gei.out
js/src/lirasm/tests/cond_geui.in
js/src/lirasm/tests/cond_geui.out
js/src/lirasm/tests/cond_gtd.in
js/src/lirasm/tests/cond_gtd.out
js/src/lirasm/tests/cond_gti.in
js/src/lirasm/tests/cond_gti.out
js/src/lirasm/tests/cond_gtui.in
js/src/lirasm/tests/cond_gtui.out
js/src/lirasm/tests/cond_led.in
js/src/lirasm/tests/cond_led.out
js/src/lirasm/tests/cond_lei.in
js/src/lirasm/tests/cond_lei.out
js/src/lirasm/tests/cond_leui.in
js/src/lirasm/tests/cond_leui.out
js/src/lirasm/tests/cond_ltd.in
js/src/lirasm/tests/cond_ltd.out
js/src/lirasm/tests/cond_lti.in
js/src/lirasm/tests/cond_lti.out
js/src/lirasm/tests/cond_ltui.in
js/src/lirasm/tests/cond_ltui.out
js/src/lirasm/tests/divd.in
js/src/lirasm/tests/divd.out
js/src/lirasm/tests/float_double.in
js/src/lirasm/tests/float_double.out
js/src/lirasm/tests/floatingpoint.in
js/src/lirasm/tests/floatingpoint.out
js/src/lirasm/tests/fneg.in
js/src/lirasm/tests/fneg.out
js/src/lirasm/tests/fpu1-598151.in
js/src/lirasm/tests/fpu1-598151.out
js/src/lirasm/tests/fpu2-598151.in
js/src/lirasm/tests/fpu2-598151.out
js/src/lirasm/tests/fuzz-527178.in
js/src/lirasm/tests/fuzz-527178.out
js/src/lirasm/tests/hardfloat/d2i.in
js/src/lirasm/tests/hardfloat/d2i.out
js/src/lirasm/tests/hardfloat/f2i.in
js/src/lirasm/tests/hardfloat/f2i.out
js/src/lirasm/tests/hardfloat/i2d.in
js/src/lirasm/tests/hardfloat/i2d.out
js/src/lirasm/tests/hardfloat/ui2d.in
js/src/lirasm/tests/hardfloat/ui2d.out
js/src/lirasm/tests/largeframe.in
js/src/lirasm/tests/largeframe.out
js/src/lirasm/tests/ldc2i.in
js/src/lirasm/tests/ldc2i.out
js/src/lirasm/tests/lds2i.in
js/src/lirasm/tests/lds2i.out
js/src/lirasm/tests/lduc2ui.in
js/src/lirasm/tests/lduc2ui.out
js/src/lirasm/tests/ldus2ui.in
js/src/lirasm/tests/ldus2ui.out
js/src/lirasm/tests/littleendian/fuzz-527178.in
js/src/lirasm/tests/littleendian/fuzz-527178.out
js/src/lirasm/tests/littleendian/ldc2i.in
js/src/lirasm/tests/littleendian/ldc2i.out
js/src/lirasm/tests/littleendian/lds2i.in
js/src/lirasm/tests/littleendian/lds2i.out
js/src/lirasm/tests/littleendian/lduc2ui.in
js/src/lirasm/tests/littleendian/lduc2ui.out
js/src/lirasm/tests/littleendian/ldus2ui.in
js/src/lirasm/tests/littleendian/ldus2ui.out
js/src/lirasm/tests/loadstore.in
js/src/lirasm/tests/loadstore.out
js/src/lirasm/tests/mul_xxx.in
js/src/lirasm/tests/mul_xxx.out
js/src/lirasm/tests/mul_xxy.in
js/src/lirasm/tests/mul_xxy.out
js/src/lirasm/tests/mul_xyy.in
js/src/lirasm/tests/mul_xyy.out
js/src/lirasm/tests/mul_xyz.in
js/src/lirasm/tests/mul_xyz.out
js/src/lirasm/tests/muld.in
js/src/lirasm/tests/muld.out
js/src/lirasm/tests/muljovi.in
js/src/lirasm/tests/muljovi.out
js/src/lirasm/tests/muljovi_ovf.in
js/src/lirasm/tests/muljovi_ovf.out
js/src/lirasm/tests/muljovi_xxx.in
js/src/lirasm/tests/muljovi_xxx.out
js/src/lirasm/tests/muljovi_xxy.in
js/src/lirasm/tests/muljovi_xxy.out
js/src/lirasm/tests/muljovi_xyy.in
js/src/lirasm/tests/muljovi_xyy.out
js/src/lirasm/tests/muljovi_xyz.in
js/src/lirasm/tests/muljovi_xyz.out
js/src/lirasm/tests/mulov_xxx.in
js/src/lirasm/tests/mulov_xxx.out
js/src/lirasm/tests/mulov_xxy.in
js/src/lirasm/tests/mulov_xxy.out
js/src/lirasm/tests/mulov_xyy.in
js/src/lirasm/tests/mulov_xyy.out
js/src/lirasm/tests/mulov_xyz.in
js/src/lirasm/tests/mulov_xyz.out
js/src/lirasm/tests/multfrag1.in
js/src/lirasm/tests/multfrag1.out
js/src/lirasm/tests/multfrag2.in
js/src/lirasm/tests/multfrag2.out
js/src/lirasm/tests/multfrag3.in
js/src/lirasm/tests/multfrag3.out
js/src/lirasm/tests/negnot.in
js/src/lirasm/tests/negnot.out
js/src/lirasm/tests/random.out
js/src/lirasm/tests/shi.in
js/src/lirasm/tests/shi.out
js/src/lirasm/tests/softfloat/dhi2i.in
js/src/lirasm/tests/softfloat/dhi2i.out
js/src/lirasm/tests/softfloat/dlo2i.in
js/src/lirasm/tests/softfloat/dlo2i.out
js/src/lirasm/tests/softfloat/ii2d.in
js/src/lirasm/tests/softfloat/ii2d.out
js/src/lirasm/tests/std2f.in
js/src/lirasm/tests/std2f.out
js/src/lirasm/tests/subd.in
js/src/lirasm/tests/subd.out
js/src/lirasm/tests/subjovi.in
js/src/lirasm/tests/subjovi.out
js/src/lirasm/tests/subjovi_ovf.in
js/src/lirasm/tests/subjovi_ovf.out
js/src/nanojit-import-filemap
js/src/nanojit-import-rev
js/src/nanojit/Allocator.cpp
js/src/nanojit/Allocator.h
js/src/nanojit/Assembler.cpp
js/src/nanojit/Assembler.h
js/src/nanojit/CodeAlloc.cpp
js/src/nanojit/CodeAlloc.h
js/src/nanojit/Containers.cpp
js/src/nanojit/Containers.h
js/src/nanojit/Fragmento.cpp
js/src/nanojit/Fragmento.h
js/src/nanojit/LIR.cpp
js/src/nanojit/LIR.h
js/src/nanojit/LIRopcode.tbl
js/src/nanojit/Native.h
js/src/nanojit/NativeARM.cpp
js/src/nanojit/NativeARM.h
js/src/nanojit/NativeCommon.h
js/src/nanojit/NativeMIPS.cpp
js/src/nanojit/NativeMIPS.h
js/src/nanojit/NativePPC.cpp
js/src/nanojit/NativePPC.h
js/src/nanojit/NativeSH4-auto-generated.h
js/src/nanojit/NativeSH4.cpp
js/src/nanojit/NativeSH4.h
js/src/nanojit/NativeSparc.cpp
js/src/nanojit/NativeSparc.h
js/src/nanojit/NativeX64.cpp
js/src/nanojit/NativeX64.h
js/src/nanojit/Nativei386.cpp
js/src/nanojit/Nativei386.h
js/src/nanojit/RegAlloc.cpp
js/src/nanojit/RegAlloc.h
js/src/nanojit/VMPI.cpp
js/src/nanojit/VMPI.h
js/src/nanojit/avmplus.cpp
js/src/nanojit/avmplus.h
js/src/nanojit/manifest.mk
js/src/nanojit/nanojit.h
js/src/nanojit/njconfig.cpp
js/src/nanojit/njconfig.h
js/src/nanojit/njcpudetect.h
js/src/tracejit/Writer-inl.h
js/src/tracejit/Writer.cpp
js/src/tracejit/Writer.h
js/src/tracevis/README
js/src/tracevis/acts.py
js/src/tracevis/binlog.py
js/src/tracevis/config.py
js/src/tracevis/tree.py
js/src/tracevis/vis.py
mobile/xul/app/application.ini
toolkit/components/places/nsIDynamicContainer.idl
toolkit/components/places/tests/unit/nsDynamicContainerServiceSample.js
toolkit/components/places/tests/unit/nsDynamicContainerServiceSample.manifest
toolkit/components/places/tests/unit/test_457698_crash.js
toolkit/components/places/tests/unit/test_dynamic_containers.js
toolkit/content/tests/browser/common/mockObjects.js
toolkit/content/tests/chrome/test_autocomplete.xul
toolkit/crashreporter/google-breakpad/Makefile.am
toolkit/crashreporter/google-breakpad/Makefile.in
toolkit/crashreporter/google-breakpad/src/client/mac/handler/minidump_test.xcodeproj/project.pbxproj
toolkit/crashreporter/google-breakpad/src/common/Makefile.in
toolkit/crashreporter/google-breakpad/src/common/mac/macho_id.cc
toolkit/crashreporter/google-breakpad/src/common/mac/macho_id.h
toolkit/crashreporter/google-breakpad/src/common/md5.h
toolkit/crashreporter/google-breakpad/src/tools/mac/crash_report/crash_report.xcodeproj/project.pbxproj
toolkit/locales/en-US/chrome/mozapps/xpinstall/xpinstallConfirm.dtd
toolkit/locales/en-US/chrome/mozapps/xpinstall/xpinstallConfirm.properties
toolkit/mozapps/xpinstall/Makefile.in
toolkit/mozapps/xpinstall/content/xpinstallConfirm.css
toolkit/mozapps/xpinstall/content/xpinstallConfirm.js
toolkit/mozapps/xpinstall/content/xpinstallConfirm.xul
toolkit/mozapps/xpinstall/content/xpinstallItem.xml
toolkit/mozapps/xpinstall/content/xpistatus.js
toolkit/mozapps/xpinstall/content/xpistatus.xul
toolkit/mozapps/xpinstall/jar.mn
toolkit/themes/gnomestripe/mozapps/extensions/category-extensions.png
toolkit/themes/gnomestripe/mozapps/extensions/category-languages.png
toolkit/themes/gnomestripe/mozapps/extensions/category-themes.png
toolkit/themes/gnomestripe/mozapps/passwordmgr/key.png
toolkit/themes/gnomestripe/mozapps/places/tagContainerIcon.png
toolkit/themes/gnomestripe/mozapps/plugins/pluginOutdated-16.png
toolkit/themes/pinstripe/global/dirListing/local.png
toolkit/themes/pinstripe/global/notification/question-icon.png
toolkit/themes/pinstripe/mozapps/extensions/category-extensions.png
toolkit/themes/pinstripe/mozapps/extensions/category-languages.png
toolkit/themes/pinstripe/mozapps/extensions/category-themes.png
toolkit/themes/pinstripe/mozapps/places/tagContainerIcon.png
toolkit/themes/pinstripe/mozapps/xpinstall/xpinstallConfirm.css
toolkit/themes/winstripe/global/arrow/arrow-lft-hov.gif
toolkit/themes/winstripe/global/arrow/arrow-rit-hov.gif
toolkit/themes/winstripe/global/console/bullet-error-aero.png
toolkit/themes/winstripe/global/console/bullet-error.png
toolkit/themes/winstripe/global/console/bullet-question-aero.png
toolkit/themes/winstripe/global/console/bullet-question.png
toolkit/themes/winstripe/global/console/bullet-warning-aero.png
toolkit/themes/winstripe/global/console/bullet-warning.png
toolkit/themes/winstripe/global/icons/informationBar-30-aero.png
toolkit/themes/winstripe/global/icons/informationBar-30.png
toolkit/themes/winstripe/global/icons/informationBar-60-aero.png
toolkit/themes/winstripe/global/icons/informationBar-60.png
toolkit/themes/winstripe/global/icons/loading_16-aero.png
toolkit/themes/winstripe/global/icons/notfound-aero.png
toolkit/themes/winstripe/global/icons/notfound.png
toolkit/themes/winstripe/global/icons/notloading_16-aero.png
toolkit/themes/winstripe/global/icons/questionBar-30-aero.png
toolkit/themes/winstripe/global/icons/questionBar-30.png
toolkit/themes/winstripe/global/icons/questionBar-60-aero.png
toolkit/themes/winstripe/global/icons/questionBar-60.png
toolkit/themes/winstripe/mozapps/extensions/category-extensions-aero.png
toolkit/themes/winstripe/mozapps/extensions/category-extensions.png
toolkit/themes/winstripe/mozapps/extensions/category-languages-aero.png
toolkit/themes/winstripe/mozapps/extensions/category-languages.png
toolkit/themes/winstripe/mozapps/extensions/category-themes-aero.png
toolkit/themes/winstripe/mozapps/extensions/category-themes.png
toolkit/themes/winstripe/mozapps/places/tagContainerIcon-aero.png
toolkit/themes/winstripe/mozapps/places/tagContainerIcon.png
toolkit/themes/winstripe/mozapps/plugins/pluginFinderWizard.css
toolkit/themes/winstripe/mozapps/plugins/pluginHelp-16-aero.png
toolkit/themes/winstripe/mozapps/plugins/pluginOutdated-16-aero.png
toolkit/themes/winstripe/mozapps/plugins/pluginOutdated-16.png
toolkit/themes/winstripe/mozapps/xpinstall/xpinstallConfirm.css
view/public/nsIViewObserver.h
xpinstall/packager/Packager.pm
xpinstall/packager/pkgcp.pl
xpinstall/packager/xptlink.pl
--- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp
@@ -39,37 +39,42 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsApplicationAccessibleWrap.h"
 
 #include "nsCOMPtr.h"
 #include "nsMai.h"
 #include "prlink.h"
 #include "prenv.h"
-#include "nsIPrefBranch.h"
+#include "mozilla/Preferences.h"
+#include "nsIGConfService.h"
 #include "nsIServiceManager.h"
 #include "nsAutoPtr.h"
 #include "nsAccessibilityService.h"
 #include "AtkSocketAccessible.h"
 
 #include <gtk/gtk.h>
 #include <atk/atk.h>
 
+using namespace mozilla;
+
 typedef GType (* AtkGetTypeType) (void);
 GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
 static bool sATKChecked = false;
 static PRLibrary *sATKLib = nsnull;
 static const char sATKLibName[] = "libatk-1.0.so.0";
 static const char sATKHyperlinkImplGetTypeSymbol[] =
     "atk_hyperlink_impl_get_type";
 static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
-static const char sSysPrefService [] =
-    "@mozilla.org/system-preference-service;1";
+static const char sUseSystemPrefsKey[] =
+    "config.use_system_prefs";
 static const char sAccessibilityKey [] =
     "config.use_system_prefs.accessibility";
+static const char sGconfAccessibilityKey[] =
+    "/desktop/gnome/interface/accessibility";
 
 /* gail function pointer */
 static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
                                                  const gchar *event_type);
 static void (* gail_remove_global_event_listener) (guint remove_listener);
 static void (* gail_remove_key_event_listener) (guint remove_listener);
 static AtkObject * (*gail_get_root) (void);
 
@@ -620,21 +625,27 @@ nsApplicationAccessibleWrap::Init()
 
     // check if accessibility enabled/disabled by environment variable
     bool isGnomeATEnabled = false;
     const char *envValue = PR_GetEnv(sAccEnv);
     if (envValue) {
         isGnomeATEnabled = !!atoi(envValue);
     } else {
         //check gconf-2 setting
-        nsresult rv;
-        nsCOMPtr<nsIPrefBranch> sysPrefService =
-            do_GetService(sSysPrefService, &rv);
-        if (NS_SUCCEEDED(rv) && sysPrefService) {
-            sysPrefService->GetBoolPref(sAccessibilityKey, &isGnomeATEnabled);
+        if (Preferences::GetBool(sUseSystemPrefsKey, false)) {
+            nsresult rv;
+            nsCOMPtr<nsIGConfService> gconf =
+                do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
+            if (NS_SUCCEEDED(rv) && gconf) {
+                gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey),
+                               &isGnomeATEnabled);
+            }
+        } else {
+            isGnomeATEnabled =
+                Preferences::GetBool(sAccessibilityKey, false);
         }
     }
 
     if (isGnomeATEnabled) {
         // load and initialize gail library
         nsresult rv = LoadGtkModule(sGail);
         if (NS_SUCCEEDED(rv)) {
             (*sGail.init)();
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -45,16 +45,17 @@
 #include "nsApplicationAccessibleWrap.h"
 #include "nsARIAGridAccessibleWrap.h"
 #include "nsARIAMap.h"
 #include "FocusManager.h"
 
 #include "nsIContentViewer.h"
 #include "nsCURILoader.h"
 #include "nsDocAccessible.h"
+#include "nsHTMLCanvasAccessible.h"
 #include "nsHTMLImageMapAccessible.h"
 #include "nsHTMLLinkAccessible.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsHTMLTableAccessibleWrap.h"
 #include "nsHTMLTextAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
 #include "nsIAccessibilityService.h"
 #include "nsIAccessibleProvider.h"
@@ -271,16 +272,26 @@ nsAccessibilityService::CreateHTMLCombob
 {
   nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
   nsAccessible* accessible = new nsHTMLComboboxAccessible(aContent, weakShell);
   NS_IF_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
+nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent,
+                                                   nsIPresShell* aPresShell)
+{
+  nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
+  nsAccessible* accessible = new nsHTMLCanvasAccessible(aContent, weakShell);
+  NS_IF_ADDREF(accessible);
+  return accessible;
+}
+
+already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
   nsAutoString mapElmName;
   aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::usemap, mapElmName);
   nsCOMPtr<nsIDOMHTMLMapElement> mapElm;
   if (nsIDocument* document = aContent->GetCurrentDoc()) {
     mapElm = do_QueryInterface(document->FindImageMap(mapElmName));
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -78,16 +78,18 @@ public:
                                                   bool aCanCreate);
 
   virtual already_AddRefed<nsAccessible>
     CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
+  already_AddRefed<nsAccessible>
+    CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
   virtual already_AddRefed<nsAccessible>
     CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -399,16 +399,22 @@ public:
    * Assert if child not in parent's cache if the cache was initialized at this
    * point.
    */
   void TestChildCache(nsAccessible* aCachedChild) const;
 
   //////////////////////////////////////////////////////////////////////////////
   // Downcasting and types
 
+  inline bool IsAbbreviation() const
+  {
+    return mContent->IsHTML() &&
+      (mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
+  }
+
   inline bool IsApplication() const { return mFlags & eApplicationAccessible; }
 
   bool IsAutoComplete() const { return mFlags & eAutoCompleteAccessible; }
 
   inline bool IsAutoCompletePopup() const { return mFlags & eAutoCompletePopupAccessible; }
 
   inline bool IsCombobox() const { return mFlags & eComboboxAccessible; }
 
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -386,39 +386,35 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
     return;
 
   nsDocAccessible* targetDocument = accessible->GetDocAccessible();
   NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
 
   nsINode* targetNode = accessible->GetNode();
 
 #ifdef MOZ_XUL
-  bool isTree = targetNode->IsElement() &&
-    targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
-
-  if (isTree) {
-    nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
-    NS_ASSERTION(treeAcc,
-                 "Accessible for xul:tree isn't nsXULTreeAccessible.");
+  nsRefPtr<nsXULTreeAccessible> treeAcc;
+  if (targetNode->IsElement() &&
+      targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree,
+                                                  kNameSpaceID_XUL)) {
+    treeAcc = do_QueryObject(accessible);
 
-    if (treeAcc) {
-      if (eventType.EqualsLiteral("TreeViewChanged")) {
-        treeAcc->TreeViewChanged();
-        return;
-      }
+    if (eventType.EqualsLiteral("TreeViewChanged")) {
+      treeAcc->TreeViewChanged();
+      return;
+    }
 
-      if (eventType.EqualsLiteral("TreeRowCountChanged")) {
-        HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
-        return;
-      }
-      
-      if (eventType.EqualsLiteral("TreeInvalidated")) {
-        HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
-        return;
-      }
+    if (eventType.EqualsLiteral("TreeRowCountChanged")) {
+      HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
+      return;
+    }
+
+    if (eventType.EqualsLiteral("TreeInvalidated")) {
+      HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
+      return;
     }
   }
 #endif
 
   if (eventType.EqualsLiteral("RadioStateChange")) {
     PRUint64 state = accessible->State();
 
     // radiogroup in prefWindow is exposed as a list,
@@ -446,38 +442,36 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
 
     nsRefPtr<AccEvent> accEvent =
       new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
 
     nsEventShell::FireEvent(accEvent);
     return;
   }
 
-  nsAccessible *treeItemAccessible = nsnull;
+  nsAccessible* treeItemAcc = nsnull;
 #ifdef MOZ_XUL
-  // If it's a tree element, need the currently selected item
-  if (isTree) {
-    treeItemAccessible = accessible->CurrentItem();
-    if (treeItemAccessible)
-      accessible = treeItemAccessible;
+  // If it's a tree element, need the currently selected item.
+  if (treeAcc) {
+    treeItemAcc = accessible->CurrentItem();
+    if (treeItemAcc)
+      accessible = treeItemAcc;
   }
-#endif
 
-#ifdef MOZ_XUL
-  if (treeItemAccessible && eventType.EqualsLiteral("OpenStateChange")) {
+  if (treeItemAcc && eventType.EqualsLiteral("OpenStateChange")) {
     PRUint64 state = accessible->State();
     bool isEnabled = (state & states::EXPANDED) != 0;
 
     nsRefPtr<AccEvent> accEvent =
       new AccStateChangeEvent(accessible, states::EXPANDED, isEnabled);
     nsEventShell::FireEvent(accEvent);
     return;
   }
 
-  if (treeItemAccessible && eventType.EqualsLiteral("select")) {
+  if (treeItemAcc && eventType.EqualsLiteral("select")) {
     // XXX: We shouldn't be based on DOM select event which doesn't provide us
     // any context info. We should integrate into nsTreeSelection instead.
     // If multiselect tree, we should fire selectionadd or selection removed
     if (FocusMgr()->HasDOMFocus(targetNode)) {
       nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel =
         do_QueryInterface(targetNode);
       nsAutoString selType;
       multiSel->GetSelType(selType);
@@ -486,18 +480,20 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
         // for each tree item. Perhaps each tree item will need to cache its
         // selection state and fire an event after a DOM "select" event when
         // that state changes. nsXULTreeAccessible::UpdateTreeSelection();
         nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
                                 accessible);
         return;
       }
 
-      nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION,
-                              treeItemAccessible);
+      nsRefPtr<AccSelChangeEvent> selChangeEvent =
+        new AccSelChangeEvent(treeAcc, treeItemAcc,
+                              AccSelChangeEvent::eSelectionAdd);
+      nsEventShell::FireEvent(selChangeEvent);
       return;
     }
   }
   else
 #endif
   if (eventType.EqualsLiteral("AlertActive")) {
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
   }
--- a/accessible/src/html/Makefile.in
+++ b/accessible/src/html/Makefile.in
@@ -45,16 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_html_s
 LIBXUL_LIBRARY = 1
 
 
 
 CPPSRCS = \
+  nsHTMLCanvasAccessible.cpp \
   nsHTMLFormControlAccessible.cpp \
   nsHTMLImageAccessible.cpp \
   nsHTMLImageMapAccessible.cpp \
   nsHTMLLinkAccessible.cpp \
   nsHTMLSelectAccessible.cpp \
   nsHTMLTableAccessible.cpp \
   nsHTMLTextAccessible.cpp \
   nsHyperTextAccessible.cpp \
new file mode 100644
--- /dev/null
+++ b/accessible/src/html/nsHTMLCanvasAccessible.cpp
@@ -0,0 +1,52 @@
+/* -*- 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
+ * Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 ***** */
+
+#include "nsHTMLCanvasAccessible.h"
+
+using namespace mozilla::a11y;
+
+nsHTMLCanvasAccessible::
+  nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
+  nsHyperTextAccessible(aContent, aShell)
+{
+}
+
+PRUint32
+nsHTMLCanvasAccessible::NativeRole()
+{
+  return nsIAccessibleRole::ROLE_CANVAS;
+}
new file mode 100644
--- /dev/null
+++ b/accessible/src/html/nsHTMLCanvasAccessible.h
@@ -0,0 +1,56 @@
+/* -*- 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
+ * Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * 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 ***** */
+
+#include "nsHyperTextAccessible.h"
+
+#ifndef _nsHTMLCanvasAccessible_H_
+#define _nsHTMLCanvasAccessible_H_
+
+/**
+ * HTML canvas accessible (html:canvas).
+ */
+class nsHTMLCanvasAccessible : public nsHyperTextAccessible
+{
+public:
+  nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell);
+  virtual ~nsHTMLCanvasAccessible() { }
+
+  // nsAccessible
+  virtual PRUint32 NativeRole();
+};
+
+#endif
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -119,31 +119,58 @@ nsresult
 nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  // table-cell-index attribute
   nsCOMPtr<nsIAccessibleTable> tableAcc(GetTableAccessible());
   if (!tableAcc)
     return NS_OK;
 
   PRInt32 rowIdx = -1, colIdx = -1;
   rv = GetCellIndexes(rowIdx, colIdx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt32 idx = -1;
   rv = tableAcc->GetCellIndexAt(rowIdx, colIdx, &idx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoString stringIdx;
   stringIdx.AppendInt(idx);
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex, stringIdx);
+
+  // abbr attribute
+
+  // Pick up object attribute from abbr DOM element (a child of the cell) or
+  // from abbr DOM attribute.
+  nsAutoString abbrText;
+  if (GetChildCount() == 1) {
+    nsAccessible* abbr = FirstChild();
+    if (abbr->IsAbbreviation()) {
+      nsTextEquivUtils::
+        AppendTextEquivFromTextContent(abbr->GetContent()->GetFirstChild(),
+                                       &abbrText);
+    }
+  }
+  if (abbrText.IsEmpty())
+    mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr, abbrText);
+
+  if (!abbrText.IsEmpty())
+    nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::abbr, abbrText);
+
+  // axis attribute
+  nsAutoString axisText;
+  mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
+  if (!axisText.IsEmpty())
+    nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::axis, axisText);
+
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: nsIAccessibleTableCell implementation
 
 NS_IMETHODIMP
 nsHTMLTableCellAccessible::GetTable(nsIAccessibleTable **aTable)
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -2054,16 +2054,35 @@ nsHyperTextAccessible::ScrollSubstringTo
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible public
 
+nsresult
+nsHyperTextAccessible::GetNameInternal(nsAString& aName)
+{
+  nsresult rv = nsAccessibleWrap::GetNameInternal(aName);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  // Get name from title attribute for HTML abbr and acronym elements making it
+  // a valid name from markup. Otherwise their name isn't picked up by recursive
+  // name computation algorithm. See NS_OK_NAME_FROM_TOOLTIP.
+  if (aName.IsEmpty() && IsAbbreviation()) {
+    nsAutoString name;
+    if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, name)) {
+      name.CompressWhitespace();
+      aName = name;
+    }
+  }
+  return NS_OK;
+}
+
 void
 nsHyperTextAccessible::InvalidateChildren()
 {
   mOffsets.Clear();
 
   nsAccessibleWrap::InvalidateChildren();
 }
 
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -81,16 +81,17 @@ public:
   NS_DECL_NSIACCESSIBLETEXT
   NS_DECL_NSIACCESSIBLEHYPERTEXT
   NS_DECL_NSIACCESSIBLEEDITABLETEXT
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
   // nsAccessible
   virtual PRInt32 GetLevelInternal();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
+  virtual nsresult GetNameInternal(nsAString& aName);
   virtual PRUint32 NativeRole();
   virtual PRUint64 NativeState();
 
   virtual void InvalidateChildren();
   virtual bool RemoveChild(nsAccessible* aAccessible);
 
   // nsHyperTextAccessible (static helper method)
 
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -1582,16 +1582,23 @@ nsAccessibleWrap::FirePlatformEvent(AccE
 #ifdef DEBUG_A11Y
   printf("\n\nMSAA event: event: %d, target: %s@id='%s', childid: %d, hwnd: %d\n\n",
          eventType, NS_ConvertUTF16toUTF8(tag).get(), id.get(),
          childID, hWnd);
 #endif
 
   // Fire MSAA event for client area window.
   NotifyWinEvent(winEvent, hWnd, OBJID_CLIENT, childID);
+
+  // JAWS announces collapsed combobox navigation based on focus events.
+  if (eventType == nsIAccessibleEvent::EVENT_SELECTION &&
+      accessible->Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION &&
+      nsWinUtils::IsWindowEmulationFor(kJAWSModuleHandle)) {
+    NotifyWinEvent(EVENT_OBJECT_FOCUS, hWnd, OBJID_CLIENT, childID);
+  }
   return NS_OK;
 }
 
 //------- Helper methods ---------
 
 PRInt32 nsAccessibleWrap::GetChildIDFor(nsAccessible* aAccessible)
 {
   // A child ID of the window is required, when we use NotifyWinEvent,
--- a/accessible/src/msaa/nsWinUtils.cpp
+++ b/accessible/src/msaa/nsWinUtils.cpp
@@ -38,19 +38,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsWinUtils.h"
 
 #include "nsIWinAccessNode.h"
 #include "nsRootAccessible.h"
 
+#include "mozilla/Preferences.h"
 #include "nsArrayUtils.h"
 #include "nsIDocShellTreeItem.h"
 
+using namespace mozilla;
+
 // Window property used by ipc related code in identifying accessible
 // tab windows.
 const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow";
 
 HRESULT
 nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
                               long *aIA2ArrayLen)
 {
@@ -180,18 +183,17 @@ nsWinUtils::HideNativeWindow(HWND aWnd)
   ::SetWindowPos(aWnd, NULL, 0, 0, 0, 0,
                  SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
                  SWP_NOZORDER | SWP_NOACTIVATE);
 }
 
 bool
 nsWinUtils::IsWindowEmulationFor(LPCWSTR kModuleHandle)
 {
-#ifdef MOZ_E10S_COMPAT
   // Window emulation is always enabled in multiprocess Firefox.
-  return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) : true;
-#else
+  if (Preferences::GetBool("browser.tabs.remote"))
+    return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) : true;
+
   return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) :
     ::GetModuleHandleW(kJAWSModuleHandle) ||
     ::GetModuleHandleW(kWEModuleHandle)  ||
     ::GetModuleHandleW(kDolphinModuleHandle);
-#endif
 }
--- a/accessible/tests/mochitest/attributes/test_obj.html
+++ b/accessible/tests/mochitest/attributes/test_obj.html
@@ -86,17 +86,20 @@ https://bugzilla.mozilla.org/show_bug.cg
       testAttrs("liveGroup", {"live" : "polite"}, true);
       testAttrs("liveGroupChild", {"container-live" : "polite"}, true);
       testAttrs("liveGroup", {"container-live-role" : "group"}, true);
       testAttrs("liveGroupChild", {"container-live-role" : "group"}, true);
 
       // html
       testAttrs("radio", {"checkable" : "true"}, true); 
       testAttrs("checkbox", {"checkable" : "true"}, true); 
-      testAttrs("draggable", {"draggable" : "true"}, true); 
+      testAttrs("draggable", {"draggable" : "true"}, true);
+      testAttrs("th1", { "abbr": "SS#" }, true);
+      testAttrs("th2", { "abbr": "SS#" }, true);
+      testAttrs("th2", { "axis": "social" }, true);
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
@@ -170,10 +173,16 @@ https://bugzilla.mozilla.org/show_bug.cg
   <div id="liveGroup" role="group" aria-live="polite">
     excuse <div id="liveGroupChild">me</div>
   </div>
 
   <!-- html -->
   <input id="radio" type="radio"/>
   <input id="checkbox" type="checkbox"/>
   <div id="draggable" draggable="true">Draggable div</div>
+  <table>
+    <tr>
+      <th id="th1"><abbr title="Social Security Number">SS#</abbr></th>
+      <th id="th2" abbr="SS#" axis="social">Social Security Number</th>
+    </tr>
+  </table>
 </body>
 </html>
--- a/accessible/tests/mochitest/name/test_general.html
+++ b/accessible/tests/mochitest/name/test_general.html
@@ -127,16 +127,20 @@
       // ARIA role option is presented allowing the name calculation from
       // visible children (bug 443081).
       testName("lb_opt1_children_hidden", "i am visible");
 
       // Get the name from subtree of menuitem crossing role nothing to get
       // the name from its children.
       testName("tablemenuitem", "menuitem 1");
 
+      // Get the name from child acronym title attribute rather than from
+      // acronym content.
+      testName("label_with_acronym", "O A T F World Wide Web");
+
       //////////////////////////////////////////////////////////////////////////
       // title attribute
 
       // If nothing is left. Let's try title attribute.
       testName("btn_title", "title");
 
       //////////////////////////////////////////////////////////////////////////
       // textarea name
@@ -215,16 +219,21 @@
      title="Use placeholder as name if name is otherwise empty">
     Mozilla Bug 604391
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=669312"
      title="Accessible name is duplicated when input has a label associated uisng for/id and is wrapped around the input">
     Mozilla Bug 669312
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=704416"
+     title="HTML acronym and abbr names should be provided by @title">
+    Mozilla Bug 704416
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <!-- aria-label, simple label -->
   <span id="btn_simple_aria_label" role="button" aria-label="I am a button"/>
   <br/>
@@ -390,16 +399,21 @@
     <tr role="menuitem" id="tablemenuitem">
       <td>menuitem 1</td>
     </tr>
     <tr role="menuitem">
       <td>menuitem 2</td>
     </tr>
   </table>
 
+  <label id="label_with_acronym">
+    <acronym title="O A T F">OATF</acronym>
+    <abbr title="World Wide Web">WWW</abbr>
+  </label>
+
   <!-- name from title attribute -->
   <span id="btn_title" role="group" title="title">15</span>
 
   <!-- A textarea nested in a label with a text child (bug #453371). -->
   <form>
     <label>Story
       <textarea id="textareawithchild" name="name">Foo</textarea>
       is ended.
--- a/accessible/tests/mochitest/role.js
+++ b/accessible/tests/mochitest/role.js
@@ -2,16 +2,17 @@
 // Role constants
 
 const ROLE_ALERT = nsIAccessibleRole.ROLE_ALERT;
 const ROLE_ANIMATION = nsIAccessibleRole.ROLE_ANIMATION;
 const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
 const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
 const ROLE_AUTOCOMPLETE = nsIAccessibleRole.ROLE_AUTOCOMPLETE;
 const ROLE_BUTTONDROPDOWNGRID = nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
+const ROLE_CANVAS = nsIAccessibleRole.ROLE_CANVAS;
 const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
 const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
 const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON;
 const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW;
 const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
 const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
 const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
 const ROLE_COLUMNHEADER = nsIAccessibleRole.ROLE_COLUMNHEADER;
--- a/accessible/tests/mochitest/tree/Makefile.in
+++ b/accessible/tests/mochitest/tree/Makefile.in
@@ -47,16 +47,17 @@ include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =\
 		dockids.html \
 	$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
 		test_aria_globals.html \
 		test_aria_imgmap.html \
 		test_aria_presentation.html \
 		test_button.xul \
+		test_canvas.html \
 		test_combobox.xul \
 		test_cssoverflow.html \
 		test_dochierarchy.html \
 		test_dockids.html \
 		test_filectrl.html \
 		test_formctrl.html \
 		test_formctrl.xul \
 		test_gencontent.html \
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/tree/test_canvas.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=495912
+-->
+<head>
+  <title>File Input Control tests</title>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+  <script type="application/javascript"
+          src="../common.js"></script>
+  <script type="application/javascript"
+          src="../role.js"></script>
+
+  <script type="application/javascript">
+    function doTest()
+    {
+      var accTree = {
+        role: ROLE_CANVAS,
+        children: [
+        ]
+      };
+      testAccessibleTree("canvas", accTree);
+
+      SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addA11yLoadEvent(doTest);
+  </script>
+</head>
+<body>
+
+  <a target="_blank"
+     title="Expose alternative content in Canvas element to ATs"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=495912">Mozilla Bug 495912</a>
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <canvas id="canvas" tabindex="0">
+    fallback content.
+  </canvas>
+
+  <script type="text/javascript">
+    var c=document.getElementById("canvas");
+    var cxt=c.getContext("2d");
+    cxt.fillStyle="#005500";
+    cxt.fillRect(0,0,150,75);
+  </script>  
+
+</body>
+</html>
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -7,16 +7,17 @@ builtin(include, build/autoconf/glib.m4)
 builtin(include, build/autoconf/nspr.m4)dnl
 builtin(include, build/autoconf/nss.m4)dnl
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/freetype2.m4)dnl
 builtin(include, build/autoconf/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
 builtin(include, build/autoconf/mozheader.m4)dnl
+builtin(include, build/autoconf/mozcommonheader.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 builtin(include, build/autoconf/lto.m4)dnl
 builtin(include, build/autoconf/gcc-pr49911.m4)dnl
 builtin(include, build/autoconf/frameptr.m4)dnl
 
 MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -56,52 +56,29 @@ PREF_JS_EXPORTS = $(srcdir)/profile/fire
 # hardcode en-US for the moment
 AB_CD = en-US
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 APP_VERSION = $(shell cat $(srcdir)/../config/version.txt)
 DEFINES += -DAPP_VERSION="$(APP_VERSION)"
 
-DIST_FILES = application.ini
-
-GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
-GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
-
-DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
-
-MOZ_SOURCE_STAMP ?= $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null)
-ifdef MOZ_SOURCE_STAMP
-DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
-endif
-
-SOURCE_REPO := $(shell hg -R $(topsrcdir) showconfig paths.default 2>/dev/null | sed -e "s/^ssh:/http:/")
-ifdef SOURCE_REPO
-DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
-endif
-
-DEFINES += -DMOZ_APP_BASENAME="$(MOZ_APP_BASENAME)" \
-           -DMOZ_APP_VENDOR="$(MOZ_APP_VENDOR)"
-
-ifdef MOZ_APP_PROFILE
-DEFINES += -DMOZ_APP_PROFILE="$(MOZ_APP_PROFILE)"
-endif
-
 ifdef LIBXUL_SDK
 include $(topsrcdir)/config/rules.mk
 else
 # Build a binary bootstrapping with XRE_main
 
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 
 CPPSRCS = nsBrowserApp.cpp
 
 LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/build
+LOCAL_INCLUDES += -I$(DEPTH)/build
 
 DEFINES += -DXPCOM_GLUE
 STL_FLAGS=
 
 LIBS += \
 	$(EXTRA_DSO_LIBS) \
 	$(XPCOM_STANDALONE_GLUE_LDOPTS) \
 	$(NULL)
@@ -182,20 +159,16 @@ libs::
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
 
 endif
 
 endif # LIBXUL_SDK
 
 DEFINES += -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\"
 
-ifdef MOZILLA_OFFICIAL
-DEFINES += -DMOZILLA_OFFICIAL
-endif
-
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 libs::
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(DIST)/bin/icons
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png  $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png  $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png  $(DIST)/bin/chrome/icons/default
 endif
 
@@ -223,17 +196,17 @@ clean clobber repackage::
 	$(RM) -r $(DIST)/$(APP_NAME).app
 
 ifdef LIBXUL_SDK
 APPFILES = Resources
 else
 APPFILES = MacOS
 endif
 
-libs repackage:: $(PROGRAM) application.ini
+libs repackage:: $(PROGRAM)
 	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/MacOS
 	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
 	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
 	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
 	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%LOWER_APP_NAME%/$(LOWER_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
 	sed -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
 	rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
 	$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1318359094000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1321712096000">
   <emItems>
       <emItem  blockID="i41" id="{99079a25-328f-4bd4-be04-00955acaa0a7}">
                         <versionRange  minVersion="0.1" maxVersion="4.3.1.00" severity="1">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
                         <versionRange  minVersion=" " severity="1">
                     </versionRange>
@@ -112,16 +112,23 @@
                               <versionRange  minVersion="3.5.7" maxVersion="*" />
                           </targetApplication>
                     </versionRange>
                   </emItem>
       <emItem  blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
                         <versionRange  minVersion="2.2" maxVersion="2.2">
                     </versionRange>
                   </emItem>
+      <emItem  blockID="i45" id="{22119944-ED35-4ab1-910B-E619EA06A115}">
+                        <versionRange  minVersion="0.1" maxVersion="7.6.1">
+                      <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+                              <versionRange  minVersion="8.0a1" maxVersion="*" />
+                          </targetApplication>
+                    </versionRange>
+                  </emItem>
       <emItem  blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
                         <versionRange  minVersion="2.0" maxVersion="2.0">
                     </versionRange>
                   </emItem>
       <emItem  blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
                         </emItem>
       <emItem  blockID="i24" id="{6E19037A-12E3-4295-8915-ED48BC341614}">
                         <versionRange  minVersion="0.1" maxVersion="1.3.328.4" severity="1">
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -31,18 +31,18 @@
  * 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 "application.ini.h"
 #include "nsXPCOMGlue.h"
-#include "nsXULAppAPI.h"
 #if defined(XP_WIN)
 #include <windows.h>
 #include <stdlib.h>
 #elif defined(XP_UNIX)
 #include <sys/time.h>
 #include <sys/resource.h>
 #endif
 
@@ -135,30 +135,17 @@ static const nsDynamicFunctionLoad kXULF
     { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
     { "XRE_main", (NSFuncPtr*) &XRE_main },
     { nsnull, nsnull }
 };
 
 static int do_main(const char *exePath, int argc, char* argv[])
 {
   nsCOMPtr<nsILocalFile> appini;
-#ifdef XP_WIN
-  // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
-  // encoded path, so it is safe to convert it
-  nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
-                                getter_AddRefs(appini));
-#else
-  nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
-                                      getter_AddRefs(appini));
-#endif
-  if (NS_FAILED(rv)) {
-    return 255;
-  }
-
-  appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
+  nsresult rv;
 
   // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
   // Note that -app must be the *first* argument.
   const char *appDataFile = getenv("XUL_APP_FILE");
   if (appDataFile && *appDataFile) {
     rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
     if (NS_FAILED(rv)) {
       Output("Invalid path found: '%s'", appDataFile);
@@ -183,25 +170,42 @@ static int do_main(const char *exePath, 
       Output("Couldn't set %s.\n", appEnv);
       return 255;
     }
     argv[2] = argv[0];
     argv += 2;
     argc -= 2;
   }
 
-  nsXREAppData *appData;
-  rv = XRE_CreateAppData(appini, &appData);
-  if (NS_FAILED(rv)) {
-    Output("Couldn't read application.ini");
-    return 255;
+  int result;
+  if (appini) {
+    nsXREAppData *appData;
+    rv = XRE_CreateAppData(appini, &appData);
+    if (NS_FAILED(rv)) {
+      Output("Couldn't read application.ini");
+      return 255;
+    }
+    result = XRE_main(argc, argv, appData);
+    XRE_FreeAppData(appData);
+  } else {
+#ifdef XP_WIN
+    // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
+    // encoded path, so it is safe to convert it
+    rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), PR_FALSE,
+                         getter_AddRefs(appini));
+#else
+    rv = NS_NewNativeLocalFile(nsDependentCString(exePath), PR_FALSE,
+                               getter_AddRefs(appini));
+#endif
+    if (NS_FAILED(rv)) {
+      return 255;
+    }
+    result = XRE_main(argc, argv, &sAppData);
   }
 
-  int result = XRE_main(argc, argv, appData);
-  XRE_FreeAppData(appData);
   return result;
 }
 
 int main(int argc, char* argv[])
 {
   char exePath[MAXPATHLEN];
 
   nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
@@ -235,16 +239,18 @@ int main(int argc, char* argv[])
   }
 
 
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
     return 255;
   }
+  // Reset exePath so that it is the directory name and not the xpcom dll name
+  *lastSlash = 0;
 
   rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XRE functions.\n");
     return 255;
   }
 
 #ifdef XRE_HAS_DLL_BLOCKLIST
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1033,16 +1033,28 @@ pref("devtools.gcli.enable", false);
 pref("devtools.hud.height", 0);
 
 // Remember the Web Console position. Possible values:
 //   above - above the web page,
 //   below - below the web page,
 //   window - in a separate window/popup panel.
 pref("devtools.webconsole.position", "above");
 
+// Remember the Web Console filters
+pref("devtools.webconsole.filter.network", true);
+pref("devtools.webconsole.filter.networkinfo", true);
+pref("devtools.webconsole.filter.csserror", true);
+pref("devtools.webconsole.filter.cssparser", true);
+pref("devtools.webconsole.filter.exception", true);
+pref("devtools.webconsole.filter.jswarn", true);
+pref("devtools.webconsole.filter.error", true);
+pref("devtools.webconsole.filter.warn", true);
+pref("devtools.webconsole.filter.info", true);
+pref("devtools.webconsole.filter.log", true);
+
 // The number of lines that are displayed in the web console for the Net,
 // CSS, JS and Web Developer categories.
 pref("devtools.hud.loglimit.network", 200);
 pref("devtools.hud.loglimit.cssparser", 200);
 pref("devtools.hud.loglimit.exception", 200);
 pref("devtools.hud.loglimit.console", 200);
 
 // The developer tools editor configuration:
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -236,18 +236,30 @@
 #ifdef XP_GNOME
     <key id="key_search2" key="&searchFocusUnix.commandkey;" command="Tools:Search" modifiers="accel"/>
     <key id="key_openDownloads" key="&downloadsUnix.commandkey;" command="Tools:Downloads" modifiers="accel,shift"/>
 #else
     <key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/>
 #endif
     <key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/>
     <key id="key_errorConsole" key="&errorConsoleCmd.commandkey;" oncommand="toJavaScriptConsole();" modifiers="accel,shift" disabled="true"/>
-    <key id="key_webConsole" key="&webConsoleCmd.commandkey;" oncommand="HUDConsoleUI.toggleHUD();" modifiers="accel,shift"/>
-    <key id="key_inspect" key="&inspectMenu.commandkey;" command="Tools:Inspect" modifiers="accel,shift"/>
+    <key id="key_webConsole" key="&webConsoleCmd.commandkey;" oncommand="HUDConsoleUI.toggleHUD();"
+#ifdef XP_MACOSX
+        modifiers="accel,alt"
+#else
+        modifiers="accel,shift"
+#endif
+    />
+    <key id="key_inspect" key="&inspectMenu.commandkey;" command="Tools:Inspect"
+#ifdef XP_MACOSX
+        modifiers="accel,alt"
+#else
+        modifiers="accel,shift"
+#endif
+    />
     <key id="key_scratchpad" keycode="&scratchpad.keycode;" modifiers="shift"
          keytext="&scratchpad.keytext;" command="Tools:Scratchpad"/>
     <key id="key_styleeditor" keycode="&styleeditor.keycode;" modifiers="shift"
          keytext="&styleeditor.keytext;" command="Tools:StyleEditor"/>
     <key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile"  modifiers="accel"/>
     <key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
     <key id="printKb" key="&printCmd.commandkey;" command="cmd_print"  modifiers="accel"/>
     <key id="key_close" key="&closeCmd.key;" command="cmd_close" modifiers="accel"/>
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3476,17 +3476,16 @@ const BrowserSearch = {
     // SearchService._addEngineToStore() should fail for such an engine),
     // but let's be on the safe side.
     if (!submission)
       return;
 
     openLinkIn(submission.uri.spec,
                useNewTab ? "tab" : "current",
                { postData: submission.postData,
-                 inBackground: false,
                  relatedToCurrent: true });
   },
 
   /**
    * Returns the search bar element if it is present in the toolbar, null otherwise.
    */
   get searchBar() {
     return document.getElementById("searchbar");
@@ -3926,37 +3925,39 @@ var FullScreen = {
       return;
     }
 
     // We receive "mozfullscreenchange" events for each subdocument which
     // is an ancestor of the document containing the element which requested
     // full-screen. Only add listeners and show warning etc when the event we
     // receive is targeted at the chrome document, i.e. only once every time
     // we enter DOM full-screen mode.
-    let targetDoc = event.target.ownerDocument ? event.target.ownerDocument : event.target;
-    if (targetDoc != document) {
+    if (event.target != document) {
       // However, if we receive a "mozfullscreenchange" event for a document
       // which is not a subdocument of the currently selected tab, we know that
       // we've switched tabs since the request to enter full-screen was made,
       // so we should exit full-screen since the "full-screen document" isn't
       // acutally visible.
-      if (targetDoc.defaultView.top != gBrowser.contentWindow) {
+      if (event.target.defaultView.top != gBrowser.contentWindow) {
         document.mozCancelFullScreen();
       }
       return;
     }
 
     let focusManger = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
     if (focusManger.activeWindow != window) {
       // The top-level window has lost focus since the request to enter
       // full-screen was made. Cancel full-screen.
       document.mozCancelFullScreen();
       return;
     }
 
+    if (gFindBarInitialized)
+      gFindBar.close();
+
     this.showWarning(true);
 
     // Exit DOM full-screen mode upon open, close, or change tab.
     gBrowser.tabContainer.addEventListener("TabOpen", this.exitDomFullScreen);
     gBrowser.tabContainer.addEventListener("TabClose", this.exitDomFullScreen);
     gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
 
     // Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -413,17 +413,17 @@ nsContextMenu.prototype = {
     var onMedia = (this.onVideo || this.onAudio);
     // Several mutually exclusive items... play/pause, mute/unmute, show/hide
     this.showItem("context-media-play",  onMedia && (this.target.paused || this.target.ended));
     this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended);
     this.showItem("context-media-mute",   onMedia && !this.target.muted);
     this.showItem("context-media-unmute", onMedia && this.target.muted);
     this.showItem("context-media-showcontrols", onMedia && !this.target.controls);
     this.showItem("context-media-hidecontrols", onMedia && this.target.controls);
-    this.showItem("context-video-fullscreen", this.onVideo);
+    this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.mozFullScreenElement == null);
     var statsShowing = this.onVideo && this.target.wrappedJSObject.mozMediaStatisticsShowing;
     this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing);
     this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing);
 
     // Disable them when there isn't a valid media source loaded.
     if (onMedia) {
       var hasError = this.target.error != null ||
                      this.target.networkState == this.target.NETWORK_NO_SOURCE;
@@ -854,20 +854,25 @@ nsContextMenu.prototype = {
     canvas.width = video.videoWidth;
     canvas.height = video.videoHeight;
     var ctxDraw = canvas.getContext("2d");
     ctxDraw.drawImage(video, 0, 0);
     saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", true, false, document.documentURIObject);
   },
 
   fullScreenVideo: function () {
-    this.target.pause();
-
-    openDialog("chrome://browser/content/fullscreen-video.xhtml",
-               "", "chrome,centerscreen,dialog=no", this.target);
+    let video = this.target;
+    if (document.mozFullScreenEnabled)
+      video.mozRequestFullScreen();
+    else {
+      // Fallback for the legacy full-screen video implementation.
+      video.pause();
+      openDialog("chrome://browser/content/fullscreen-video.xhtml",
+                  "", "chrome,centerscreen,dialog=no", video);
+    }
   },
 
   // Change current window to the URL of the background image.
   viewBGImage: function(e) {
     urlSecurityCheck(this.bgImageURL,
                      this.browser.contentPrincipal,
                      Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
     var doc = this.target.ownerDocument;
--- a/browser/components/migration/content/migration.js
+++ b/browser/components/migration/content/migration.js
@@ -335,16 +335,19 @@ var MigrationWizard = {
         source = "sourceNameIE";
         break;
       case "opera":
         source = "sourceNameOpera";
         break;
       case "safari":
         source = "sourceNameSafari";
         break;
+      case "chrome":
+        source = "sourceNameChrome";
+        break;
     }
 
     // semi-wallpaper for crash when multiple profiles exist, since we haven't initialized mSourceProfile in places
     this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
 
     var oldHomePageURL = this._migrator.sourceHomePageURL;
 
     if (oldHomePageURL && source) {
--- a/browser/components/migration/content/migration.xul
+++ b/browser/components/migration/content/migration.xul
@@ -74,16 +74,17 @@
 #elifdef XP_UNIX
       <radio id="opera"     label="&importFromOpera.label;"     accesskey="&importFromOpera.accesskey;"/>
 #elifdef XP_WIN
 #ifndef NO_IE_MIGRATOR
       <radio id="ie"        label="&importFromIE.label;"        accesskey="&importFromIE.accesskey;"/>
 #endif
       <radio id="opera"     label="&importFromOpera.label;"     accesskey="&importFromOpera.accesskey;"/>
 #endif
+      <radio id="chrome"    label="&importFromChrome.label;"    accesskey="&importFromChrome.accesskey;"/>
       <radio id="fromfile"  label="&importFromHTMLFile.label;"  accesskey="&importFromHTMLFile.accesskey;" hidden="true"/>
       <radio id="nothing"   label="&importFromNothing.label;"   accesskey="&importFromNothing.accesskey;" hidden="true"/>
     </radiogroup>
     <label id="noSources" hidden="true">&noMigrationSources.label;</label>
   </wizardpage>
 
   <wizardpage id="selectProfile" pageid="selectProfile" label="&selectProfile.title;"
               next="importItems"
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/src/BrowserProfileMigrators.manifest
@@ -0,0 +1,2 @@
+component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
+contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
new file mode 100644
--- /dev/null
+++ b/browser/components/migration/src/ChromeProfileMigrator.js
@@ -0,0 +1,532 @@
+/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 sts=2 et
+ * ***** 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 the Browser Profile Migrator.
+ *
+ * The Initial Developer of the Original Code is the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Makoto Kato <m_kato@ga2.so-net.ne.jp> (Original Author)
+ *
+ * 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 ***** */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+const LOCAL_FILE_CID = "@mozilla.org/file/local;1";
+const FILE_INPUT_STREAM_CID = "@mozilla.org/network/file-input-stream;1";
+
+const BUNDLE_MIGRATION = "chrome://browser/locale/migration/migration.properties";
+
+const MIGRATE_ALL = 0x0000;
+const MIGRATE_SETTINGS = 0x0001;
+const MIGRATE_COOKIES = 0x0002;
+const MIGRATE_HISTORY = 0x0004;
+const MIGRATE_FORMDATA = 0x0008;
+const MIGRATE_PASSWORDS = 0x0010;
+const MIGRATE_BOOKMARKS = 0x0020;
+const MIGRATE_OTHERDATA = 0x0040;
+
+const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000;
+const S100NS_PER_MS = 10;
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
+Components.utils.import("resource://gre/modules/NetUtil.jsm");
+
+XPCOMUtils.defineLazyGetter(this, "bookmarksSubfolderTitle", function () {
+  // get "import from google chrome" string for folder
+  let strbundle =
+    Services.strings.createBundle(BUNDLE_MIGRATION);
+  let sourceNameChrome = strbundle.GetStringFromName("sourceNameChrome");
+  return strbundle.formatStringFromName("importedBookmarksFolder",
+                                        [sourceNameChrome],
+                                        1);
+});
+
+/*
+ * Convert Chrome time format to Date object
+ *
+ * @param   aTime
+ *          Chrome time 
+ * @return  converted Date object
+ * @note    Google Chrome uses FILETIME / 10 as time.
+ *          FILETIME is based on same structure of Windows.
+ */
+function chromeTimeToDate(aTime)
+{
+  return new Date((aTime * S100NS_PER_MS - S100NS_FROM1601TO1970 ) / 10000);
+}
+
+/*
+ * Insert bookmark items into specific folder.
+ *
+ * @param   aFolderId
+ *          id of folder where items will be inserted
+ * @param   aItems
+ *          bookmark items to be inserted
+ */
+function insertBookmarkItems(aFolderId, aItems)
+{
+  for (let i = 0; i < aItems.length; i++) {
+    let item = aItems[i];
+
+    try {
+      if (item.type == "url") {
+        PlacesUtils.bookmarks.insertBookmark(aFolderId,
+                                             NetUtil.newURI(item.url),
+                                             PlacesUtils.bookmarks.DEFAULT_INDEX,
+                                             item.name);
+      } else if (item.type == "folder") {
+        let newFolderId =
+          PlacesUtils.bookmarks.createFolder(aFolderId,
+                                             item.name,
+                                             PlacesUtils.bookmarks.DEFAULT_INDEX);
+
+        insertBookmarkItems(newFolderId, item.children);
+      }
+    } catch (e) {
+      Cu.reportError(e);
+    }
+  }
+}
+
+function ChromeProfileMigrator()
+{
+}
+
+ChromeProfileMigrator.prototype = {
+  _paths: {
+    bookmarks : null,
+    cookies : null,
+    history : null,
+    prefs : null,
+  },
+
+  _homepageURL : null,
+  _replaceBookmarks : false,
+
+  /*
+   * Notify to observers to start migration
+   *
+   * @param   aType
+   *          notification type such as MIGRATE_BOOKMARKS
+   */
+
+  _notifyStart : function Chrome_notifyStart(aType)
+  {
+    Services.obs.notifyObservers(null, "Migration:ItemBeforeMigrate", aType);
+    this._pendingCount++;
+  },
+
+  /*
+   * Notify to observers to finish migration for item
+   * If all items are finished, it sends migration end notification.
+   *
+   * @param   aType
+   *          notification type such as MIGRATE_BOOKMARKS
+   */
+  _notifyCompleted : function Chrome_notifyIfCompleted(aType)
+  {
+    Services.obs.notifyObservers(null, "Migration:ItemAfterMigrate", aType);
+    if (--this._pendingCount == 0) {
+      // All items are migrated, so we have to send end notification.
+      Services.obs.notifyObservers(null, "Migration:Ended", null);
+    }
+  },
+
+  /*
+   * Migrating bookmark items
+   */
+  _migrateBookmarks : function Chrome_migrateBookmarks()
+  {
+    this._notifyStart(MIGRATE_BOOKMARKS);
+
+    try {
+      PlacesUtils.bookmarks.runInBatchMode({
+        _self : this,
+        runBatched : function (aUserData) {
+          let migrator = this._self;
+          let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+          file.initWithPath(migrator._paths.bookmarks);
+
+          NetUtil.asyncFetch(file, function(aInputStream, aResultCode) {
+            if (!Components.isSuccessCode(aResultCode)) {
+              migrator._notifyCompleted(MIGRATE_BOOKMARKS);
+              return;
+            }
+
+            // Parse Chrome bookmark file that is JSON format
+            let bookmarkJSON = NetUtil.readInputStreamToString(aInputStream,
+                                                               aInputStream.available(),
+                                                               { charset : "UTF-8" });
+            let roots = JSON.parse(bookmarkJSON).roots;
+
+            // Importing bookmark bar items
+            if (roots.bookmark_bar.children &&
+                roots.bookmark_bar.children.length > 0) {
+              // Toolbar
+              let parentId = PlacesUtils.toolbarFolderId;
+              if (!migrator._replaceBookmarks) { 
+                parentId =
+                  PlacesUtils.bookmarks.createFolder(parentId,
+                                                     bookmarksSubfolderTitle,
+                                                     PlacesUtils.bookmarks.DEFAULT_INDEX);
+              }
+              insertBookmarkItems(parentId, roots.bookmark_bar.children);
+            }
+
+            // Importing bookmark menu items
+            if (roots.other.children &&
+                roots.other.children.length > 0) {
+              // Bookmark menu
+              let parentId = PlacesUtils.bookmarksMenuFolderId;
+              if (!migrator._replaceBookmarks) { 
+                parentId =
+                  PlacesUtils.bookmarks.createFolder(parentId,
+                                                     bookmarksSubfolderTitle,
+                                                     PlacesUtils.bookmarks.DEFAULT_INDEX);
+              }
+              insertBookmarkItems(parentId, roots.other.children);
+            }
+
+            migrator._notifyCompleted(MIGRATE_BOOKMARKS);
+          });
+        }
+      }, null);
+    } catch (e) {
+      Cu.reportError(e);
+      this._notifyCompleted(MIGRATE_BOOKMARKS);
+    }
+  },
+
+  /*
+   * Migrating history
+   */
+  _migrateHistory : function Chrome_migrateHistory()
+  {
+    this._notifyStart(MIGRATE_HISTORY);
+
+    try {
+      PlacesUtils.history.runInBatchMode({
+        _self : this,
+        runBatched : function (aUserData) {
+          // access sqlite3 database of Chrome's history
+          let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+          file.initWithPath(this._self._paths.history);
+
+          let dbConn = Services.storage.openUnsharedDatabase(file);
+          let stmt = dbConn.createAsyncStatement(
+              "SELECT url, title, last_visit_time, typed_count FROM urls WHERE hidden = 0");
+
+          stmt.executeAsync({
+            _asyncHistory : Cc["@mozilla.org/browser/history;1"]
+                            .getService(Ci.mozIAsyncHistory),
+            _db : dbConn,
+            _self : this._self,
+            handleResult : function(aResults) {
+              let places = [];
+              for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
+                try {
+                  // if having typed_count, we changes transition type to typed.
+                  let transType = PlacesUtils.history.TRANSITION_LINK;
+                  if (row.getResultByName("typed_count") > 0)
+                    transType = PlacesUtils.history.TRANSITION_TYPED;
+
+                  places.push({
+                    uri: NetUtil.newURI(row.getResultByName("url")),
+                    title: row.getResultByName("title"),
+                    visits: [{
+                      transitionType: transType,
+                      visitDate: chromeTimeToDate(
+                                   row.getResultByName(
+                                     "last_visit_time")) * 1000,
+                    }],
+                  });
+                } catch (e) {
+                  Cu.reportError(e);
+                }
+              }
+
+              try {
+                this._asyncHistory.updatePlaces(places);
+              } catch (e) {
+                Cu.reportError(e);
+              }
+            },
+
+            handleError : function(aError) {
+              Cu.reportError("Async statement execution returned with '" +
+                             aError.result + "', '" + aError.message + "'");
+            },
+
+            handleCompletion : function(aReason) {
+              this._db.asyncClose();
+              this._self._notifyCompleted(MIGRATE_HISTORY);
+            }
+          });
+          stmt.finalize();
+        }
+      }, null);
+    } catch (e) {
+      Cu.reportError(e);
+      this._notifyCompleted(MIGRATE_HISTORY);
+    }
+  },
+
+  /*
+   * Migrating cookies
+   */
+  _migrateCookies : function Chrome_migrateCookies()
+  {
+    this._notifyStart(MIGRATE_COOKIES);
+
+    try {
+      // Access sqlite3 database of Chrome's cookie
+      let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+      file.initWithPath(this._paths.cookies);
+
+      let dbConn = Services.storage.openUnsharedDatabase(file);
+      let stmt = dbConn.createAsyncStatement(
+          "SELECT host_key, path, name, value, secure, httponly, expires_utc FROM cookies");
+
+      stmt.executeAsync({
+        _db : dbConn,
+        _self : this,
+        handleResult : function(aResults) {
+          for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
+            let host_key = row.getResultByName("host_key");
+            if (host_key.match(/^\./)) {
+              // 1st character of host_key may be ".", so we have to remove it
+              host_key = host_key.substr(1);
+            }
+
+            try {
+              let expiresUtc =
+                chromeTimeToDate(row.getResultByName("expires_utc")) / 1000;
+              Services.cookies.add(host_key,
+                                   row.getResultByName("path"),
+                                   row.getResultByName("name"),
+                                   row.getResultByName("value"),
+                                   row.getResultByName("secure"),
+                                   row.getResultByName("httponly"),
+                                   false,
+                                   parseInt(expiresUtc));
+            } catch (e) {
+              Cu.reportError(e);
+            }
+          }
+        },
+
+        handleError : function(aError) {
+          Cu.reportError("Async statement execution returned with '" +
+                         aError.result + "', '" + aError.message + "'");
+        },
+
+        handleCompletion : function(aReason) {
+          this._db.asyncClose();
+          this._self._notifyCompleted(MIGRATE_COOKIES);
+        },
+      });
+      stmt.finalize();
+    } catch (e) {
+      Cu.reportError(e);
+      this._notifyCompleted(MIGRATE_COOKIES);
+    }
+  },
+
+  /*
+   * nsIBrowserProfileMigrator interface implementation
+   */
+
+  /*
+   * Let's migrate all items
+   *
+   * @param   aItems
+   *          list of data items to migrate.  but this is unused.
+   * @param   aStartup
+   *          non-null if called during startup.
+   * @param   aProfile
+   *          this is unused due to single profile support only
+   */
+  migrate : function Chrome_migrate(aItems, aStartup, aProfile)
+  {
+    if (aStartup) {
+      aStartup.doStartup();
+      this._replaceBookmarks = true;
+    }
+
+    Services.obs.notifyObservers(null, "Migration:Started", null);
+
+    // Reset panding count.  If this count becomes 0, "Migration:Ended"
+    // notification is sent
+    this._pendingCount = 1;
+
+    if (aItems & MIGRATE_HISTORY)
+      this._migrateHistory();
+
+    if (aItems & MIGRATE_COOKIES)
+      this._migrateCookies();
+
+    if (aItems & MIGRATE_BOOKMARKS)
+      this._migrateBookmarks();
+
+    if (--this._pendingCount == 0) {
+      // When async imports are immeditelly completed unfortunately,
+      // this will be called.
+      // Usually, this notification is sent by _notifyCompleted()
+      Services.obs.notifyObservers(null, "Migration:Ended", null);
+    }
+  },
+
+  /*
+   * return supported migration types
+   *
+   * @param   aProfile
+   *          this is unused due to single profile support only
+   * @param   aDoingStartup
+   *          non-null if called during startup.
+   * @return  supported migration types
+   */
+  getMigrateData: function Chrome_getMigrateData(aProfile, aDoingStartup)
+  {
+#ifdef XP_WIN
+    let chromepath = Services.dirsvc.get("LocalAppData", Ci.nsIFile).path +
+                     "\\Google\\Chrome\\User Data\\Default\\";
+#elifdef XP_MACOSX
+    let chromepath = Services.dirsvc.get("Home", Ci.nsIFile).path +
+                     "/Library/Application Support/Google/Chrome/Default/";
+#else
+    let chromepath = Services.dirsvc.get("Home", Ci.nsIFile).path +
+                     "/.config/google-chrome/Default/";
+#endif
+
+    let result = 0;
+
+    // bookmark and preference are JSON format
+
+    try {
+      let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+      file.initWithPath(chromepath + "Bookmarks");
+      if (file.exists()) {
+        this._paths.bookmarks = file.path
+        result += MIGRATE_BOOKMARKS;
+      }
+    } catch (e) {
+      Cu.reportError(e);
+    }
+
+    if (!this._paths.prefs)
+      this._paths.prefs = chromepath + "Preferences";
+
+    // history and cookies are SQLite database
+
+    try {
+      let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+      file.initWithPath(chromepath + "History");
+      if (file.exists()) {
+        this._paths.history = file.path
+        result += MIGRATE_HISTORY;
+      }
+    } catch (e) {
+      Cu.reportError(e);
+    }
+
+    try {
+      let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+      file.initWithPath(chromepath + "Cookies");
+      if (file.exists()) {
+        this._paths.cookies = file.path
+        result += MIGRATE_COOKIES;
+      }
+    } catch (e) {
+      Cu.reportError(e);
+    }
+
+    return result;
+  },
+
+  /*
+   * Whether we support migration of Chrome
+   *
+   * @return true if supported
+   */
+  sourceExists: function Chrome_sourceExists()
+  {
+    let result = this.getMigrateData(null, false);
+    return result != 0;
+  },
+
+  // Although Chrome supports multi-profiles, there is no way
+  // to get profile lists.
+  sourceHasMultipleProfiles: false,
+  sourceProfiles: null,
+
+  /*
+   * Return home page URL
+   *
+   * @return  home page URL
+   */
+  sourceHomePageURL: function Chrome_sourceHomePageURL()
+  {
+    try  {
+      if (this._homepageURL)
+        return this._homepageURL;
+
+      if (!this._paths.prefs)
+        this.getMigrateData(null, false);
+
+      // XXX reading and parsing JSON is synchronous.
+      let file = Cc[LOCAL_FILE_CID].createInstance(Ci.nsILocalFile);
+      file.initWithPath(this._paths.prefs);
+      let fstream = Cc[FILE_INPUT_STREAM_CID].
+                    createInstance(Ci.nsIFileInputStream);
+      fstream.init(file, -1, 0, 0); 
+      this._homepageURL = JSON.parse(
+        NetUtil.readInputStreamToString(fstream, fstream.available(),
+                                        { charset: "UTF-8" })).homepage;
+      return this._homepageURL;
+    } catch (e) {
+      Cu.reportError(e);
+    }
+    return "";
+  },
+
+  QueryInterface: XPCOMUtils.generateQI([
+    Ci.nsIBrowserProfileMigrator
+  ]),
+
+  classDescription: "Chrome Profile Migrator",
+  contractID: "@mozilla.org/profile/migrator;1?app=browser&type=chrome",
+  classID: Components.ID("{4cec1de4-1671-4fc3-a53e-6c539dc77a26}")
+};
+
+const NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeProfileMigrator]);
--- a/browser/components/migration/src/Makefile.in
+++ b/browser/components/migration/src/Makefile.in
@@ -62,10 +62,18 @@ CPPSRCS += nsIEProfileMigrator.cpp \
            $(NULL)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += nsSafariProfileMigrator.cpp \
            $(NULL)
 endif            
 
+EXTRA_PP_COMPONENTS = \
+  ChromeProfileMigrator.js \
+  $(NULL)
+
+EXTRA_COMPONENTS = \
+	BrowserProfileMigrators.manifest \
+	$(NULL)
+
 include $(topsrcdir)/config/rules.mk
 
--- a/browser/components/migration/src/nsProfileMigrator.cpp
+++ b/browser/components/migration/src/nsProfileMigrator.cpp
@@ -158,16 +158,17 @@ nsProfileMigrator::Import()
 
 NS_IMPL_ISUPPORTS1(nsProfileMigrator, nsIProfileMigrator)
 
 #ifdef XP_WIN
 
 #define INTERNAL_NAME_IEXPLORE        "iexplore"
 #define INTERNAL_NAME_MOZILLA_SUITE   "apprunner"
 #define INTERNAL_NAME_OPERA           "opera"
+#define INTERNAL_NAME_CHROME          "chrome"
 #endif
 
 nsresult
 nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
                                                 nsCOMPtr<nsIBrowserProfileMigrator>& bpm)
 {
 #if XP_WIN
 
@@ -241,32 +242,37 @@ nsProfileMigrator::GetDefaultBrowserMigr
   if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_IEXPLORE)) {
     aKey = "ie";
     return NS_OK;
   }
   else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_OPERA)) {
     aKey = "opera";
     return NS_OK;
   }
+  else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_CHROME)) {
+    aKey = "chrome";
+    return NS_OK;
+  }
 
 #else
   bool exists = false;
 #define CHECK_MIGRATOR(browser) do {\
   bpm = do_CreateInstance(NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX browser);\
   if (bpm)\
     bpm->GetSourceExists(&exists);\
   if (exists) {\
     aKey = browser;\
     return NS_OK;\
   }} while(0)
 
 #if defined(XP_MACOSX)
   CHECK_MIGRATOR("safari");
 #endif
   CHECK_MIGRATOR("opera");
+  CHECK_MIGRATOR("chrome");
 
 #undef CHECK_MIGRATOR
 #endif
   return NS_ERROR_FAILURE;
 }
 
 bool
 nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -442,17 +442,16 @@ PlacesController.prototype = {
    * Gathers information about the selected nodes according to the following
    * rules:
    *    "link"              node is a URI
    *    "bookmark"          node is a bookamrk
    *    "livemarkChild"     node is a child of a livemark
    *    "tagChild"          node is a child of a tag
    *    "folder"            node is a folder
    *    "query"             node is a query
-   *    "dynamiccontainer"  node is a dynamic container
    *    "separator"         node is a separator line
    *    "host"              node is a host
    *
    * @returns an array of objects corresponding the selected nodes. Each
    *          object has each of the properties above set if its corresponding
    *          node matches the rule. In addition, the annotations names for each
    *          node are set on its corresponding object as properties.
    * Notes:
@@ -485,19 +484,16 @@ PlacesController.prototype = {
                 break;
               case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
               case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
                 nodeData["day"] = true;
                 break;
             }
           }
           break;
-        case Ci.nsINavHistoryResultNode.RESULT_TYPE_DYNAMIC_CONTAINER:
-          nodeData["dynamiccontainer"] = true;
-          break;
         case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
         case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
           nodeData["folder"] = true;
           break;
         case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
           nodeData["separator"] = true;
           break;
         case Ci.nsINavHistoryResultNode.RESULT_TYPE_URI:
--- a/browser/config/mozconfigs/linux32/debug
+++ b/browser/config/mozconfigs/linux32/debug
@@ -1,13 +1,13 @@
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
--- a/browser/config/mozconfigs/linux32/l10n-mozconfig
+++ b/browser/config/mozconfigs/linux32/l10n-mozconfig
@@ -1,7 +1,7 @@
 ac_add_options --with-l10n-base=../../l10n-central
 ac_add_options --enable-official-branding
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 
-CC=/tools/gcc-4.3.3/installed/bin/gcc
-CXX=/tools/gcc-4.3.3/installed/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
--- a/browser/config/mozconfigs/linux32/nightly
+++ b/browser/config/mozconfigs/linux32/nightly
@@ -1,17 +1,17 @@
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 
 # Nightlies only since this has a cost in performance
 ac_add_options --enable-js-diagnostics
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/browser/config/mozconfigs/linux32/qt
+++ b/browser/config/mozconfigs/linux32/qt
@@ -1,13 +1,13 @@
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # PGO
 mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'
--- a/browser/config/mozconfigs/linux32/release
+++ b/browser/config/mozconfigs/linux32/release
@@ -1,14 +1,14 @@
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-official-branding
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # PGO
 mk_add_options MOZ_PGO=1
 mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'
 
 # Needed to enable breakpad in application.ini
--- a/browser/config/mozconfigs/linux32/rpm
+++ b/browser/config/mozconfigs/linux32/rpm
@@ -4,18 +4,18 @@ ac_add_options --enable-codesighs
 # Options for rpm versions of mozconfigs
 PREFIX=/usr
 LIBDIR=${PREFIX}/lib
 ac_add_options --with-app-name=mozilla-nightly
 ac_add_options --disable-updater
 ac_add_options --prefix=$PREFIX
 ac_add_options --libdir=$LIBDIR
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/browser/config/mozconfigs/linux64/debug
+++ b/browser/config/mozconfigs/linux64/debug
@@ -1,13 +1,13 @@
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
--- a/browser/config/mozconfigs/linux64/l10n-mozconfig
+++ b/browser/config/mozconfigs/linux64/l10n-mozconfig
@@ -1,7 +1,7 @@
 ac_add_options --with-l10n-base=../../l10n-central
 ac_add_options --enable-official-branding
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 
-CC=/tools/gcc/bin/gcc
-CXX=/tools/gcc/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
--- a/browser/config/mozconfigs/linux64/nightly
+++ b/browser/config/mozconfigs/linux64/nightly
@@ -1,17 +1,17 @@
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 
 # Nightlies only since this has a cost in performance
 ac_add_options --enable-js-diagnostics
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/browser/config/mozconfigs/linux64/release
+++ b/browser/config/mozconfigs/linux64/release
@@ -1,14 +1,14 @@
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-official-branding
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # PGO
 mk_add_options MOZ_PGO=1
 mk_add_options PROFILE_GEN_SCRIPT='$(PYTHON) @MOZ_OBJDIR@/_profile/pgo/profileserver.py 10'
 
 # Needed to enable breakpad in application.ini
--- a/browser/config/mozconfigs/linux64/rpm
+++ b/browser/config/mozconfigs/linux64/rpm
@@ -4,18 +4,18 @@ ac_add_options --enable-codesighs
 # Options for rpm versions of mozconfigs
 PREFIX=/usr
 LIBDIR=${PREFIX}/lib64
 ac_add_options --with-app-name=mozilla-nightly
 ac_add_options --disable-updater
 ac_add_options --prefix=$PREFIX
 ac_add_options --libdir=$LIBDIR
 
-CC=/tools/gcc-4.5/bin/gcc
-CXX=/tools/gcc-4.5/bin/g++
+. $topsrcdir/build/unix/mozconfig.linux
+
 # Avoid dependency on libstdc++ 4.5
 ac_add_options --enable-stdcxx-compat
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -46,8 +46,12 @@ MOZ_SAFE_BROWSING=1
 MOZ_SERVICES_SYNC=1
 MOZ_APP_VERSION=$FIREFOX_VERSION
 MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
 # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
 # Changing either of these values requires a clobber to ensure correct results,
 # because branding dependencies are broken.
 MOZ_BRANDING_DIRECTORY=browser/branding/nightly
 MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
+MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+MOZ_PROFILE_MIGRATOR=1
+MOZ_EXTENSION_MANAGER=1
+MOZ_APP_STATIC_INI=1
--- a/browser/devtools/highlighter/TreePanel.jsm
+++ b/browser/devtools/highlighter/TreePanel.jsm
@@ -40,17 +40,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 const Cu = Components.utils;
 
 Cu.import("resource:///modules/domplate.jsm");
 Cu.import("resource:///modules/InsideOutBox.jsm");
-Cu.import("resource:///modules/Services.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 var EXPORTED_SYMBOLS = ["TreePanel", "DOMHelpers"];
 
 const INSPECTOR_URI = "chrome://browser/content/inspector.html";
 
 /**
  * TreePanel
  * A container for the Inspector's HTML Tree Panel widget constructor function.
--- a/browser/devtools/highlighter/inspector.jsm
+++ b/browser/devtools/highlighter/inspector.jsm
@@ -21,16 +21,17 @@
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Rob Campbell <rcampbell@mozilla.com> (original author)
  *   Mihai Șucan <mihai.sucan@gmail.com>
  *   Julian Viereck <jviereck@mozilla.com>
  *   Paul Rouget <paul@mozilla.com>
  *   Kyle Simpson <ksimpson@mozilla.com>
+ *   Johan Charlez <johan.charlez@gmail.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
@@ -1107,18 +1108,18 @@ InspectorUI.prototype = {
   {
     if (!this.inspecting) {
       return;
     }
 
     this.inspectToolbutton.checked = false;
     // Detach event listeners from content window and child windows to disable
     // highlighting. We still want to be notified if the user presses "ESCAPE"
-    // to unlock the node, so we don't remove the "keypress" event until
-    // the highlighter is removed.
+    // to close the inspector, or "RETURN" to unlock the node, so we don't 
+    // remove the "keypress" event until the highlighter is removed.
     this.highlighter.detachInspectListeners();
 
     this.inspecting = false;
     this.toolsDim(false);
     if (this.highlighter.node) {
       this.select(this.highlighter.node, true, true, !aPreventScroll);
     } else {
       this.select(null, true, true);
@@ -1181,17 +1182,18 @@ InspectorUI.prototype = {
 
     if (this.store.getValue(this.winID, "inspecting")) {
       this.startInspecting();
     }
 
     this.restoreToolState(this.winID);
 
     this.win.focus();
-    Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.OPENED, null);
+    Services.obs.notifyObservers({wrappedJSObject: this},
+                                 INSPECTOR_NOTIFICATIONS.OPENED, null);
   },
 
   /**
    * Main callback handler for events.
    *
    * @param event
    *        The event to be handled.
    */
@@ -1243,18 +1245,22 @@ InspectorUI.prototype = {
 
         if (this.store.isEmpty()) {
           this.tabbrowser.tabContainer.removeEventListener("TabSelect", this,
                                                          false);
         }
         break;
       case "keypress":
         switch (event.keyCode) {
+          case this.chromeWin.KeyEvent.DOM_VK_ESCAPE:
+            this.closeInspectorUI(false);
+            event.preventDefault();
+            event.stopPropagation();
+            break;
           case this.chromeWin.KeyEvent.DOM_VK_RETURN:
-          case this.chromeWin.KeyEvent.DOM_VK_ESCAPE:
             this.toggleInspection();
             event.preventDefault();
             event.stopPropagation();
             break;
           case this.chromeWin.KeyEvent.DOM_VK_LEFT:
             let node;
             if (this.selection) {
               node = this.selection.parentNode;
--- a/browser/devtools/highlighter/test/browser_inspector_highlighter.js
+++ b/browser/devtools/highlighter/test/browser_inspector_highlighter.js
@@ -89,21 +89,24 @@ function setupHighlighterTests()
 {
   h1 = doc.querySelector("h1");
   ok(h1, "we have the header");
   Services.obs.addObserver(runSelectionTests,
     InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
   InspectorUI.toggleInspectorUI();
 }
 
-function runSelectionTests()
+function runSelectionTests(subject)
 {
   Services.obs.removeObserver(runSelectionTests,
     InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false);
 
+  is(subject.wrappedJSObject, InspectorUI,
+     "InspectorUI accessible in the observer");
+
   executeSoon(function() {
     Services.obs.addObserver(performTestComparisons,
       InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
     EventUtils.synthesizeMouse(h1, 2, 2, {type: "mousemove"}, content);
   });
 }
 
 function performTestComparisons(evt)
@@ -112,22 +115,22 @@ function performTestComparisons(evt)
     InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
 
   InspectorUI.stopInspecting();
   ok(InspectorUI.highlighter.isHighlighting, "highlighter is highlighting");
   is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection")
   is(InspectorUI.selection, h1, "selection matches node");
   is(InspectorUI.selection, InspectorUI.highlighter.highlitNode, "selection matches highlighter");
 
-  Services.obs.addObserver(finishTestComparisons,
-      InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
 
   div = doc.querySelector("div#checkOutThisWickedSpread");
 
   executeSoon(function() {
+    Services.obs.addObserver(finishTestComparisons,
+        InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
     InspectorUI.inspectNode(div);
   });
 }
 
 function finishTestComparisons()
 {
   Services.obs.removeObserver(finishTestComparisons,
     InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
--- a/browser/devtools/highlighter/test/browser_inspector_iframeTest.js
+++ b/browser/devtools/highlighter/test/browser_inspector_iframeTest.js
@@ -100,23 +100,25 @@ function runIframeTests()
 
   executeSoon(moveMouseOver.bind(this, div1));
 }
 
 function performTestComparisons1()
 {
   Services.obs.removeObserver(performTestComparisons1,
     InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
-  Services.obs.addObserver(performTestComparisons2,
-    InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
 
   is(InspectorUI.selection, div1, "selection matches div1 node");
   is(InspectorUI.highlighter.highlitNode, div1, "highlighter matches selection");
 
-  executeSoon(moveMouseOver.bind(this, div2));
+  executeSoon(function() {
+    Services.obs.addObserver(performTestComparisons2,
+      InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
+    moveMouseOver(div2);
+  });
 }
 
 function performTestComparisons2()
 {
   Services.obs.removeObserver(performTestComparisons2,
     InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false);
 
   is(InspectorUI.selection, div2, "selection matches div2 node");
--- a/browser/devtools/highlighter/test/browser_inspector_keybindings.js
+++ b/browser/devtools/highlighter/test/browser_inspector_keybindings.js
@@ -39,41 +39,44 @@ function test()
     });
   }
 
   function lockNode()
   {
     Services.obs.removeObserver(lockNode,
       InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
 
-    EventUtils.synthesizeKey("VK_ESCAPE", { });
+    EventUtils.synthesizeKey("VK_RETURN", { });
 
     executeSoon(isTheNodeLocked);
   }
 
   function isTheNodeLocked()
   {
     is(InspectorUI.selection, node, "selection matches node");
     ok(!InspectorUI.inspecting, "the node is locked");
     unlockNode();
   }
 
   function unlockNode() {
-    EventUtils.synthesizeKey("VK_ESCAPE", { });
+    EventUtils.synthesizeKey("VK_RETURN", { });
 
     executeSoon(isTheNodeUnlocked);
   }
 
   function isTheNodeUnlocked()
   {
     ok(InspectorUI.inspecting, "the node is unlocked");
 
+    // Let's close the inspector
     Services.obs.addObserver(finishUp,
       InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
-    InspectorUI.closeInspectorUI();
+
+    EventUtils.synthesizeKey("VK_ESCAPE", {});
+    ok(true, "Inspector is closing successfuly");
   }
 
   function finishUp() {
     Services.obs.removeObserver(finishUp,
                                 InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
     doc = node = null;
     gBrowser.removeCurrentTab();
     finish();
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -61,16 +61,19 @@ Cu.import("resource:///modules/PropertyP
 Cu.import("resource:///modules/source-editor.jsm");
 Cu.import("resource:///modules/devtools/scratchpad-manager.jsm");
 
 
 const SCRATCHPAD_CONTEXT_CONTENT = 1;
 const SCRATCHPAD_CONTEXT_BROWSER = 2;
 const SCRATCHPAD_L10N = "chrome://browser/locale/devtools/scratchpad.properties";
 const DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
+const BUTTON_POSITION_SAVE = 0;
+const BUTTON_POSITION_CANCEL = 1;
+const BUTTON_POSITION_DONT_SAVE = 2;
 
 /**
  * The scratchpad object handles the Scratchpad window functionality.
  */
 var Scratchpad = {
   /**
    * The script execution context. This tells Scratchpad in which context the
    * script shall execute.
@@ -596,40 +599,58 @@ var Scratchpad = {
     if (fp.show() != Ci.nsIFilePicker.returnCancel) {
       this.setFilename(fp.file.path);
       this.importFromFile(fp.file, false, this.onTextSaved.bind(this));
     }
   },
 
   /**
    * Save the textbox content to the currently open file.
+   *
+   * @param function aCallback
+   *        Optional function you want to call when file is saved
    */
-  saveFile: function SP_saveFile()
+  saveFile: function SP_saveFile(aCallback)
   {
     if (!this.filename) {
-      return this.saveFileAs();
+      return this.saveFileAs(aCallback);
     }
 
     let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
     file.initWithPath(this.filename);
-    this.exportToFile(file, true, false, this.onTextSaved.bind(this));
+
+    this.exportToFile(file, true, false, function(aStatus) {
+      this.onTextSaved();
+      if (aCallback) {
+        aCallback(aStatus);
+      }
+    });
   },
 
   /**
    * Save the textbox content to a new file.
+   *
+   * @param function aCallback
+   *        Optional function you want to call when file is saved
    */
-  saveFileAs: function SP_saveFileAs()
+  saveFileAs: function SP_saveFileAs(aCallback)
   {
     let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
     fp.init(window, this.strings.GetStringFromName("saveFileAs"),
             Ci.nsIFilePicker.modeSave);
     fp.defaultString = "scratchpad.js";
     if (fp.show() != Ci.nsIFilePicker.returnCancel) {
       this.setFilename(fp.file.path);
-      this.exportToFile(fp.file, true, false, this.onTextSaved.bind(this));
+
+      this.exportToFile(fp.file, true, false, function(aStatus) {
+        this.onTextSaved();
+        if (aCallback) {
+          aCallback(aStatus);
+        }
+      });
     }
   },
 
   /**
    * Open the Error Console.
    */
   openErrorConsole: function SP_openErrorConsole()
   {
@@ -840,16 +861,19 @@ var Scratchpad = {
    * This method adds a listener to the editor for text changes. Called when
    * a scratchpad is saved, opened from file, or restored from a saved file.
    */
   onTextSaved: function SP_onTextSaved(aStatus)
   {
     if (aStatus && !Components.isSuccessCode(aStatus)) {
       return;
     }
+    if (!document) {
+      return;  // file saved to disk after window has closed
+    }
     document.title = document.title.replace(/^\*/, "");
     this.saved = true;
     this.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
                                  this.onTextChanged);
   },
 
   /**
    * The scratchpad handler for editor text change events. This handler
@@ -877,16 +901,76 @@ var Scratchpad = {
 
     this.resetContext();
     this.editor.removeEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
                                     this.onContextMenu);
     this.editor.destroy();
     this.editor = null;
   },
 
+  /**
+   * Prompt to save scratchpad if it has unsaved changes.
+   *
+   * @param function aCallback
+   *        Optional function you want to call when file is saved
+   * @return boolean
+   *         Whether the window should be closed
+   */
+  promptSave: function SP_promptSave(aCallback)
+  {
+    if (this.filename && !this.saved) {
+      let ps = Services.prompt;
+      let flags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_SAVE +
+                  ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL +
+                  ps.BUTTON_POS_2 * ps.BUTTON_TITLE_DONT_SAVE;
+
+      let button = ps.confirmEx(window,
+                          this.strings.GetStringFromName("confirmClose.title"),
+                          this.strings.GetStringFromName("confirmClose"),
+                          flags, null, null, null, null, {});
+
+      if (button == BUTTON_POSITION_CANCEL) {
+        return false;
+      }
+      if (button == BUTTON_POSITION_SAVE) {
+        this.saveFile(aCallback);
+      }
+    }
+    return true;
+  },
+
+  /**
+   * Handler for window close event. Prompts to save scratchpad if
+   * there are unsaved changes.
+   *
+   * @param nsIDOMEvent aEvent
+   */
+  onClose: function SP_onClose(aEvent)
+  {
+    let toClose = this.promptSave();
+    if (!toClose) {
+      aEvent.preventDefault();
+    }
+  },
+
+  /**
+   * Close the scratchpad window. Prompts before closing if the scratchpad
+   * has unsaved changes.
+   *
+   * @param function aCallback
+   *        Optional function you want to call when file is saved
+   */
+  close: function SP_close(aCallback)
+  {
+    let toClose = this.promptSave(aCallback);
+    if (toClose) {
+      window.close();
+    }
+  },
+
   _observers: [],
 
   /**
    * Add an observer for Scratchpad events.
    *
    * The observer implements IScratchpadObserver := {
    *   onReady:      Called when the Scratchpad and its SourceEditor are ready.
    *                 Arguments: (Scratchpad aScratchpad)
@@ -946,8 +1030,9 @@ var Scratchpad = {
 };
 
 XPCOMUtils.defineLazyGetter(Scratchpad, "strings", function () {
   return Services.strings.createBundle(SCRATCHPAD_L10N);
 });
 
 addEventListener("DOMContentLoaded", Scratchpad.onLoad.bind(Scratchpad), false);
 addEventListener("unload", Scratchpad.onUnload.bind(Scratchpad), false);
+addEventListener("close", Scratchpad.onClose.bind(Scratchpad), false);
--- a/browser/devtools/scratchpad/scratchpad.xul
+++ b/browser/devtools/scratchpad/scratchpad.xul
@@ -64,17 +64,17 @@
   <command id="sp-cmd-openFile" oncommand="Scratchpad.openFile();"/>
   <command id="sp-cmd-save" oncommand="Scratchpad.saveFile();"/>
   <command id="sp-cmd-saveas" oncommand="Scratchpad.saveFileAs();"/>
 
   <!-- TODO: bug 650340 - implement printFile()
   <command id="sp-cmd-printFile" oncommand="Scratchpad.printFile();" disabled="true"/>
  -->
 
-  <command id="sp-cmd-close" oncommand="window.close();"/>
+  <command id="sp-cmd-close" oncommand="Scratchpad.close();"/>
   <command id="sp-cmd-run" oncommand="Scratchpad.run();"/>
   <command id="sp-cmd-inspect" oncommand="Scratchpad.inspect();"/>
   <command id="sp-cmd-display" oncommand="Scratchpad.display();"/>
   <command id="sp-cmd-contentContext" oncommand="Scratchpad.setContentContext();"/>
   <command id="sp-cmd-browserContext" oncommand="Scratchpad.setBrowserContext();" disabled="true"/>
   <command id="sp-cmd-resetContext" oncommand="Scratchpad.resetContext();"/>
   <command id="sp-cmd-errorConsole" oncommand="Scratchpad.openErrorConsole();" disabled="true"/>
   <command id="sp-cmd-webConsole" oncommand="Scratchpad.openWebConsole();"/>
--- a/browser/devtools/scratchpad/test/Makefile.in
+++ b/browser/devtools/scratchpad/test/Makefile.in
@@ -54,11 +54,12 @@ include $(topsrcdir)/config/rules.mk
 		browser_scratchpad_bug_646070_chrome_context_pref.js \
 		browser_scratchpad_bug_660560_tab.js \
 		browser_scratchpad_open.js \
 		browser_scratchpad_restore.js \
 		browser_scratchpad_bug_679467_falsy.js \
 		browser_scratchpad_bug_699130_edit_ui_updates.js \
 		browser_scratchpad_bug_669612_unsaved.js \
 		head.js \
+		browser_scratchpad_bug_653427_confirm_close.js \
 
 libs:: $(_BROWSER_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js
@@ -0,0 +1,188 @@
+/* vim: set ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+
+Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/FileUtils.jsm");
+
+// only finish() when correct number of tests are done
+const expected = 5;
+var count = 0;
+function done()
+{
+  if (++count == expected) {
+    cleanup();
+    finish();
+  }
+}
+
+var ScratchpadManager = Scratchpad.ScratchpadManager;
+var gFile;
+
+var oldPrompt = Services.prompt;
+
+function test()
+{
+  waitForExplicitFinish();
+
+  gFile = createTempFile("fileForBug653427.tmp");
+  writeFile(gFile, "text", testUnsaved.call(this));
+
+  testNew();
+  testSavedFile();
+
+  content.location = "data:text/html,<p>test scratchpad save file prompt on closing";
+}
+
+function testNew()
+{
+  let win = ScratchpadManager.openScratchpad();
+
+  win.addEventListener("load", function() {
+    win.Scratchpad.close();
+
+    ok(win.closed, "new scratchpad window should close without prompting")
+    done();
+  });
+}
+
+function testSavedFile()
+{
+  let win = ScratchpadManager.openScratchpad();
+
+  win.addEventListener("load", function() {
+    win.Scratchpad.filename = "test.js";
+    win.Scratchpad.saved = true;
+    win.Scratchpad.close();
+
+    ok(win.closed, "scratchpad from file with no changes should close")
+    done();
+  });
+}
+
+function testUnsaved()
+{
+  testUnsavedFileCancel();
+  testUnsavedFileSave();
+  testUnsavedFileDontSave();
+}
+
+function testUnsavedFileCancel()
+{
+  let win = ScratchpadManager.openScratchpad();
+
+  win.addEventListener("load", function() {
+    win.Scratchpad.filename = "test.js";
+    win.Scratchpad.saved = false;
+
+    Services.prompt = {
+      confirmEx: function() {
+        return win.BUTTON_POSITION_CANCEL;
+      }
+    }
+
+    win.Scratchpad.close();
+
+    ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
+
+    win.close();
+    done();
+  });
+}
+
+function testUnsavedFileSave()
+{
+  let win = ScratchpadManager.openScratchpad();
+
+  win.addEventListener("load", function() {
+    win.Scratchpad.importFromFile(gFile, true, function(status, content) {
+      win.Scratchpad.filename = gFile.path;
+      win.Scratchpad.onTextSaved();
+
+      let text = "new text";
+      win.Scratchpad.setText(text);
+
+      Services.prompt = {
+        confirmEx: function() {
+          return win.BUTTON_POSITION_SAVE;
+        }
+      }
+
+      win.Scratchpad.close(function() {
+        readFile(gFile, function(savedContent) {
+          is(savedContent, text, 'prompted "Save" worked when closing scratchpad');
+          done();
+        });
+      });
+
+      ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
+    });
+  });
+}
+
+function testUnsavedFileDontSave()
+{
+  let win = ScratchpadManager.openScratchpad();
+
+  win.addEventListener("load", function() {
+    win.Scratchpad.filename = gFile.path;
+    win.Scratchpad.saved = false;
+
+    Services.prompt = {
+      confirmEx: function() {
+        return win.BUTTON_POSITION_DONT_SAVE;
+      }
+    }
+
+    win.Scratchpad.close();
+
+    ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
+    done();
+  });
+}
+
+function cleanup()
+{
+  Services.prompt = oldPrompt;
+  gFile.remove(false);
+  gFile = null;
+}
+
+function createTempFile(name)
+{
+  let file = FileUtils.getFile("TmpD", [name]);
+  file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
+  file.QueryInterface(Ci.nsILocalFile)
+  return file;
+}
+
+function writeFile(file, content, callback)
+{
+  let fout = Cc["@mozilla.org/network/file-output-stream;1"].
+             createInstance(Ci.nsIFileOutputStream);
+  fout.init(file.QueryInterface(Ci.nsILocalFile), 0x02 | 0x08 | 0x20,
+            0644, fout.DEFER_OPEN);
+
+  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
+                  createInstance(Ci.nsIScriptableUnicodeConverter);
+  converter.charset = "UTF-8";
+  let fileContentStream = converter.convertToInputStream(content);
+
+  NetUtil.asyncCopy(fileContentStream, fout, callback);
+}
+
+function readFile(file, callback)
+{
+  let channel = NetUtil.newChannel(file);
+  channel.contentType = "application/javascript";
+
+  NetUtil.asyncFetch(channel, function(inputStream, status) {
+    ok(Components.isSuccessCode(status),
+       "file was read successfully");
+
+    let content = NetUtil.readInputStreamToString(inputStream,
+                                                  inputStream.available());
+    callback(content);
+  });
+}
--- a/browser/devtools/shared/Templater.jsm
+++ b/browser/devtools/shared/Templater.jsm
@@ -338,17 +338,17 @@ Templater.prototype._toNode = function(t
  * an inserter function.
  * @param thing The object which could be real data or a promise of real data
  * we use it directly if it's not a promise, or resolve it if it is.
  * @param siblingNode The element before which we insert new elements.
  * @param inserter The function to to the insertion. If thing is not a promise
  * then _handleAsync() is just 'inserter(thing, siblingNode)'
  */
 Templater.prototype._handleAsync = function(thing, siblingNode, inserter) {
-  if (typeof thing.then === 'function') {
+  if (thing != null && typeof thing.then === 'function') {
     // Placeholder element to be replaced once we have the real data
     var tempNode = siblingNode.ownerDocument.createElement('span');
     siblingNode.parentNode.insertBefore(tempNode, siblingNode);
     thing.then(function(delayed) {
       inserter(delayed, tempNode);
       tempNode.parentNode.removeChild(tempNode);
     }.bind(this));
   }
--- a/browser/devtools/webconsole/GcliCommands.jsm
+++ b/browser/devtools/webconsole/GcliCommands.jsm
@@ -79,17 +79,17 @@ gcli.addCommand({
     let commandNames = canon.getCommandNames();
     commandNames.sort();
 
     output.push("<table>");
     for (let i = 0; i < commandNames.length; i++) {
       let command = canon.getCommand(commandNames[i]);
       if (!command.hidden && command.description) {
         output.push("<tr>");
-        output.push('<th class="gcliCmdHelpRight">' + command.name + "</th>");
+        output.push('<th class="gcli-help-right">' + command.name + "</th>");
         output.push("<td>&#x2192; " + command.description + "</td>");
         output.push("</tr>");
       }
     }
     output.push("</table>");
 
     return output.join("");
   }
--- a/browser/devtools/webconsole/HUDService.jsm
+++ b/browser/devtools/webconsole/HUDService.jsm
@@ -1633,16 +1633,17 @@ HUD_SERVICE.prototype =
    * @param string aToggleType
    * @param boolean aState
    * @returns void
    */
   setFilterState: function HS_setFilterState(aHUDId, aToggleType, aState)
   {
     this.filterPrefs[aHUDId][aToggleType] = aState;
     this.adjustVisibilityForMessageType(aHUDId, aToggleType, aState);
+    Services.prefs.setBoolPref(PREFS_PREFIX + aToggleType, aState);
   },
 
   /**
    * Splits the given console messages into groups based on their timestamps.
    *
    * @param nsIDOMNode aOutputNode
    *        The output node to alter.
    * @returns void
@@ -3554,17 +3555,17 @@ HeadsUpDisplay.prototype = {
       if (!usegcli) {
         let context = Cu.getWeakReference(aWindow);
         let mixin = new JSTermFirefoxMixin(context, aParentNode,
                                            aExistingConsole);
         this.jsterm = new JSTerm(context, aParentNode, mixin, this.console);
       }
       else {
         this.gcliterm = new GcliTerm(aWindow, this.hudId, this.chromeDocument,
-                                     this.console, this.hintNode);
+                                     this.console, this.hintNode, this.consoleWrap);
         aParentNode.appendChild(this.gcliterm.element);
       }
     }
     else {
       throw new Error("Unsupported Gecko Application");
     }
   },
 
@@ -3652,31 +3653,29 @@ HeadsUpDisplay.prototype = {
     this.createConsoleMenu(this.consoleWrap);
 
     this.filterPrefs = HUDService.getDefaultFilterPrefs(this.hudId);
 
     let consoleFilterToolbar = this.makeFilterToolbar();
     consoleFilterToolbar.setAttribute("id", "viewGroup");
     this.consoleFilterToolbar = consoleFilterToolbar;
 
-    let hintSpacerNode = this.makeXULNode("box");
-    hintSpacerNode.setAttribute("flex", 1);
-
     this.hintNode = this.makeXULNode("div");
     this.hintNode.setAttribute("class", "gcliterm-hint-node");
 
     let hintParentNode = this.makeXULNode("vbox");
     hintParentNode.setAttribute("flex", "0");
     hintParentNode.setAttribute("class", "gcliterm-hint-parent");
-    hintParentNode.appendChild(hintSpacerNode);
+    hintParentNode.setAttribute("pack", "end");
     hintParentNode.appendChild(this.hintNode);
     hintParentNode.hidden = true;
 
     let hbox = this.makeXULNode("hbox");
     hbox.setAttribute("flex", "1");
+    hbox.setAttribute("class", "gcliterm-display");
 
     this.outputNode = this.makeXULNode("richlistbox");
     this.outputNode.setAttribute("class", "hud-output-node");
     this.outputNode.setAttribute("flex", "1");
     this.outputNode.setAttribute("orient", "vertical");
     this.outputNode.setAttribute("context", this.hudId + "-output-contextmenu");
     this.outputNode.setAttribute("style", "direction: ltr;");
     this.outputNode.setAttribute("seltype", "multiple");
@@ -3759,18 +3758,18 @@ HeadsUpDisplay.prototype = {
         name: "PageJS",
         category: "js",
         severities: [
           { name: "ConsoleErrors", prefKey: "exception" },
           { name: "ConsoleWarnings", prefKey: "jswarn" }
         ]
       },
       {
-        name: "PageWebDeveloper",
-        category: "webdev",
+        name: "PageLogging",
+        category: "logging",
         severities: [
           { name: "ConsoleErrors", prefKey: "error" },
           { name: "ConsoleWarnings", prefKey: "warn" },
           { name: "ConsoleInfo", prefKey: "info" },
           { name: "ConsoleLog", prefKey: "log" }
         ]
       }
     ];
@@ -6286,28 +6285,27 @@ HeadsUpDisplayUICommands = {
         this.setAttribute("checked", state);
 
         let prefKey = this.getAttribute("prefKey");
         HUDService.setFilterState(hudId, prefKey, state);
 
         // Adjust the state of the button appropriately.
         let menuPopup = this.parentNode;
 
-        let allChecked = true;
+        let someChecked = false;
         let menuItem = menuPopup.firstChild;
         while (menuItem) {
-          if (menuItem.getAttribute("checked") !== "true") {
-            allChecked = false;
+          if (menuItem.getAttribute("checked") === "true") {
+            someChecked = true;
             break;
           }
           menuItem = menuItem.nextSibling;
         }
-
         let toolbarButton = menuPopup.parentNode;
-        toolbarButton.setAttribute("checked", allChecked);
+        toolbarButton.setAttribute("checked", someChecked);
         break;
       }
     }
 
     return true;
   },
 
   command: function UIC_command(aButton) {
@@ -6335,126 +6333,57 @@ HeadsUpDisplayUICommands = {
 
 //////////////////////////////////////////////////////////////////////////
 // ConsoleStorage
 //////////////////////////////////////////////////////////////////////////
 
 var prefs = Services.prefs;
 
 const GLOBAL_STORAGE_INDEX_ID = "GLOBAL_CONSOLE";
-const PREFS_BRANCH_PREF = "devtools.hud.display.filter";
-const PREFS_PREFIX = "devtools.hud.display.filter.";
+const PREFS_PREFIX = "devtools.webconsole.filter.";
 const PREFS = { network: PREFS_PREFIX + "network",
                 networkinfo: PREFS_PREFIX + "networkinfo",
                 csserror: PREFS_PREFIX + "csserror",
                 cssparser: PREFS_PREFIX + "cssparser",
                 exception: PREFS_PREFIX + "exception",
                 jswarn: PREFS_PREFIX + "jswarn",
                 error: PREFS_PREFIX + "error",
                 info: PREFS_PREFIX + "info",
                 warn: PREFS_PREFIX + "warn",
                 log: PREFS_PREFIX + "log",
-                global: PREFS_PREFIX + "global",
               };
 
 function ConsoleStorage()
 {
   this.sequencer = null;
   this.consoleDisplays = {};
   // each display will have an index that tracks each ConsoleEntry
   this.displayIndexes = {};
   this.globalStorageIndex = [];
   this.globalDisplay = {};
   this.createDisplay(GLOBAL_STORAGE_INDEX_ID);
   // TODO: need to create a method that truncates the message
   // see bug 570543
 
-  // store an index of display prefs
-  this.displayPrefs = {};
-
-  // check prefs for existence, create & load if absent, load them if present
-  let filterPrefs;
-  let defaultDisplayPrefs;
-
-  try {
-    filterPrefs = prefs.getBoolPref(PREFS_BRANCH_PREF);
-  }
-  catch (ex) {
-    filterPrefs = false;
-  }
-
-  // TODO: for FINAL release,
-  // use the sitePreferencesService to save specific site prefs
-  // see bug 570545
-
-  if (filterPrefs) {
-    defaultDisplayPrefs = {
-      network: (prefs.getBoolPref(PREFS.network) ? true: false),
-      networkinfo: (prefs.getBoolPref(PREFS.networkinfo) ? true: false),
-      csserror: (prefs.getBoolPref(PREFS.csserror) ? true: false),
-      cssparser: (prefs.getBoolPref(PREFS.cssparser) ? true: false),
-      exception: (prefs.getBoolPref(PREFS.exception) ? true: false),
-      jswarn: (prefs.getBoolPref(PREFS.jswarn) ? true: false),
-      error: (prefs.getBoolPref(PREFS.error) ? true: false),
-      info: (prefs.getBoolPref(PREFS.info) ? true: false),
-      warn: (prefs.getBoolPref(PREFS.warn) ? true: false),
-      log: (prefs.getBoolPref(PREFS.log) ? true: false),
-      global: (prefs.getBoolPref(PREFS.global) ? true: false),
-    };
-  }
-  else {
-    prefs.setBoolPref(PREFS_BRANCH_PREF, false);
-    // default prefs for each HeadsUpDisplay
-    prefs.setBoolPref(PREFS.network, true);
-    prefs.setBoolPref(PREFS.networkinfo, true);
-    prefs.setBoolPref(PREFS.csserror, true);
-    prefs.setBoolPref(PREFS.cssparser, true);
-    prefs.setBoolPref(PREFS.exception, true);
-    prefs.setBoolPref(PREFS.jswarn, true);
-    prefs.setBoolPref(PREFS.error, true);
-    prefs.setBoolPref(PREFS.info, true);
-    prefs.setBoolPref(PREFS.warn, true);
-    prefs.setBoolPref(PREFS.log, true);
-    prefs.setBoolPref(PREFS.global, false);
-
-    defaultDisplayPrefs = {
-      network: prefs.getBoolPref(PREFS.network),
-      networkinfo: prefs.getBoolPref(PREFS.networkinfo),
-      csserror: prefs.getBoolPref(PREFS.csserror),
-      cssparser: prefs.getBoolPref(PREFS.cssparser),
-      exception: prefs.getBoolPref(PREFS.exception),
-      jswarn: prefs.getBoolPref(PREFS.jswarn),
-      error: prefs.getBoolPref(PREFS.error),
-      info: prefs.getBoolPref(PREFS.info),
-      warn: prefs.getBoolPref(PREFS.warn),
-      log: prefs.getBoolPref(PREFS.log),
-      global: prefs.getBoolPref(PREFS.global),
-    };
-  }
-  this.defaultDisplayPrefs = defaultDisplayPrefs;
+  this.defaultDisplayPrefs = {
+    network: prefs.getBoolPref(PREFS.network),
+    networkinfo: prefs.getBoolPref(PREFS.networkinfo),
+    csserror: prefs.getBoolPref(PREFS.csserror),
+    cssparser: prefs.getBoolPref(PREFS.cssparser),
+    exception: prefs.getBoolPref(PREFS.exception),
+    jswarn: prefs.getBoolPref(PREFS.jswarn),
+    error: prefs.getBoolPref(PREFS.error),
+    info: prefs.getBoolPref(PREFS.info),
+    warn: prefs.getBoolPref(PREFS.warn),
+    log: prefs.getBoolPref(PREFS.log),
+  };
 }
 
 ConsoleStorage.prototype = {
 
-  updateDefaultDisplayPrefs:
-  function CS_updateDefaultDisplayPrefs(aPrefsObject) {
-    prefs.setBoolPref(PREFS.network, (aPrefsObject.network ? true : false));
-    prefs.setBoolPref(PREFS.networkinfo,
-                      (aPrefsObject.networkinfo ? true : false));
-    prefs.setBoolPref(PREFS.csserror, (aPrefsObject.csserror ? true : false));
-    prefs.setBoolPref(PREFS.cssparser, (aPrefsObject.cssparser ? true : false));
-    prefs.setBoolPref(PREFS.exception, (aPrefsObject.exception ? true : false));
-    prefs.setBoolPref(PREFS.jswarn, (aPrefsObject.jswarn ? true : false));
-    prefs.setBoolPref(PREFS.error, (aPrefsObject.error ? true : false));
-    prefs.setBoolPref(PREFS.info, (aPrefsObject.info ? true : false));
-    prefs.setBoolPref(PREFS.warn, (aPrefsObject.warn ? true : false));
-    prefs.setBoolPref(PREFS.log, (aPrefsObject.log ? true : false));
-    prefs.setBoolPref(PREFS.global, (aPrefsObject.global ? true : false));
-  },
-
   sequenceId: function CS_sequencerId()
   {
     if (!this.sequencer) {
       this.sequencer = this.createSequencer();
     }
     return this.sequencer.next();
   },
 
@@ -6946,17 +6875,17 @@ let commandExports = undefined;
  * @param nsIDOMDocument aDocument
  *        The DOM document from which to create nodes.
  * @param object aConsole
  *        Console object to use within the GcliTerm.
  * @param nsIDOMElement aHintNode
  *        The node to which we add GCLI's hints.
  * @constructor
  */
-function GcliTerm(aContentWindow, aHudId, aDocument, aConsole, aHintNode)
+function GcliTerm(aContentWindow, aHudId, aDocument, aConsole, aHintNode, aConsoleWrap)
 {
   this.context = Cu.getWeakReference(aContentWindow);
   this.hudId = aHudId;
   this.document = aDocument;
   this.console = aConsole;
   this.hintNode = aHintNode;
 
   this.createUI();
@@ -6972,17 +6901,17 @@ function GcliTerm(aContentWindow, aHudId
     jsEnvironment: {
       globalObject: unwrap(aContentWindow),
       evalFunction: this.evalInSandbox.bind(this)
     },
     inputElement: this.inputNode,
     completeElement: this.completeNode,
     inputBackgroundElement: this.inputStack,
     hintElement: this.hintNode,
-    completionPrompt: "",
+    consoleWrap: aConsoleWrap,
     gcliTerm: this
   };
 
   gcli._internal.commandOutputManager.addListener(this.onCommandOutput, this);
   gcli._internal.createView(this.opts);
 
   if (!commandExports) {
     commandExports = loadCommands();
@@ -6990,17 +6919,25 @@ function GcliTerm(aContentWindow, aHudId
 }
 
 GcliTerm.prototype = {
   /**
    * Remove the hint column from the display.
    */
   hide: function GcliTerm_hide()
   {
-    this.hintNode.parentNode.hidden = true;
+    let permaHint = false;
+    try {
+      permaHint = Services.prefs.getBoolPref("devtools.gcli.permaHint");
+    }
+    catch (ex) {}
+
+    if (!permaHint) {
+      this.hintNode.parentNode.hidden = true;
+    }
   },
 
   /**
    * Undo the effects of calling hide().
    */
   show: function GcliTerm_show()
   {
     this.hintNode.parentNode.hidden = false;
--- a/browser/devtools/webconsole/gcli.jsm
+++ b/browser/devtools/webconsole/gcli.jsm
@@ -233,17 +233,21 @@ var console = {};
       }
       catch (ex) {
         // Can't use a real ellipsis here, because cmd.exe isn't unicode-enabled
         json = "{" + Object.keys(aThing).join(":..,") + ":.., " + "}";
       }
       return type + fmt(json, 50, 0);
     }
 
-    var str = aThing.toString(); //.replace(/\s+/g, " ");
+    if (typeof aThing == "function") {
+      return fmt(aThing.toString().replace(/\s+/g, " "), 80, 0);
+    }
+
+    var str = aThing.toString().replace(/\n/g, "|");
     return fmt(str, 80, 0);
   }
 
   /**
    * Create a simple debug representation of a given element.
    *
    * @param {nsIDOMElement} aElement
    *        The element to debug
@@ -290,20 +294,33 @@ var console = {};
         var keys = Object.getOwnPropertyNames(aThing);
         if (keys.length > 0) {
           reply += type + "\n";
           keys.forEach(function(aProp) {
             reply += logProperty(aProp, aThing[aProp]);
           }, this);
         }
         else {
-          reply += type + " (enumerated with for-in)\n";
-          var prop;
-          for (prop in aThing) {
-            reply += logProperty(prop, aThing[prop]);
+          reply += type + "\n";
+          var root = aThing;
+          var logged = [];
+          while (root != null) {
+            var properties = Object.keys(root);
+            properties.sort();
+            properties.forEach(function(property) {
+              if (!(property in logged)) {
+                logged[property] = property;
+                reply += logProperty(property, aThing[property]);
+              }
+            });
+
+            root = Object.getPrototypeOf(root);
+            if (root != null) {
+              reply += '  - prototype ' + getCtorName(root) + '\n';
+            }
           }
         }
       }
 
       return reply;
     }
 
     return "  " + aThing.toString() + "\n";
@@ -664,37 +681,34 @@ var mozl10n = {};
     }
     catch (ex) {
       throw new Error("Failure in lookupFormat('" + name + "')");
     }
   };
 
 })(mozl10n);
 
-define('gcli/index', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/types/basic', 'gcli/types/javascript', 'gcli/types/node', 'gcli/cli', 'gcli/ui/inputter', 'gcli/ui/arg_fetch', 'gcli/ui/menu', 'gcli/ui/focus'], function(require, exports, module) {
+define('gcli/index', ['require', 'exports', 'module' , 'gcli/canon', 'gcli/types/basic', 'gcli/types/javascript', 'gcli/types/node', 'gcli/cli', 'gcli/ui/display'], function(require, exports, module) {
 
   // The API for use by command authors
   exports.addCommand = require('gcli/canon').addCommand;
   exports.removeCommand = require('gcli/canon').removeCommand;
   exports.lookup = mozl10n.lookup;
   exports.lookupFormat = mozl10n.lookupFormat;
 
   // Internal startup process. Not exported
   require('gcli/types/basic').startup();
   require('gcli/types/javascript').startup();
   require('gcli/types/node').startup();
   require('gcli/cli').startup();
 
   var Requisition = require('gcli/cli').Requisition;
+  var Display = require('gcli/ui/display').Display;
+
   var cli = require('gcli/cli');
-  var Inputter = require('gcli/ui/inputter').Inputter;
-  var ArgFetcher = require('gcli/ui/arg_fetch').ArgFetcher;
-  var CommandMenu = require('gcli/ui/menu').CommandMenu;
-  var FocusManager = require('gcli/ui/focus').FocusManager;
-
   var jstype = require('gcli/types/javascript');
   var nodetype = require('gcli/types/node');
 
   /**
    * API for use by HUDService only.
    * This code is internal and subject to change without notice.
    */
   exports._internal = {
@@ -712,69 +726,40 @@ define('gcli/index', ['require', 'export
      * - jsEnvironment.evalFunction: 'eval' in a sandbox
      * - inputElement: GCLITerm.inputNode
      * - completeElement: GCLITerm.completeNode
      * - gcliTerm: GCLITerm
      * - hintElement: GCLITerm.hintNode
      * - inputBackgroundElement: GCLITerm.inputStack
      */
     createView: function(opts) {
-      opts.autoHide = true;
-      opts.requisition = new Requisition(opts.environment, opts.chromeDocument);
-      opts.completionPrompt = '';
-
       jstype.setGlobalObject(opts.jsEnvironment.globalObject);
       nodetype.setDocument(opts.contentDocument);
       cli.setEvalFunction(opts.jsEnvironment.evalFunction);
 
-      // Create a FocusManager for the various parts to register with
-      if (!opts.focusManager) {
-        opts.debug = true;
-        opts.focusManager = new FocusManager({ document: opts.chromeDocument });
+      if (opts.requisition == null) {
+        opts.requisition = new Requisition(opts.environment, opts.chromeDocument);
       }
 
-      opts.inputter = new Inputter(opts);
-      opts.inputter.update();
-      if (opts.gcliTerm) {
-        opts.focusManager.onFocus.add(opts.gcliTerm.show, opts.gcliTerm);
-        opts.focusManager.onBlur.add(opts.gcliTerm.hide, opts.gcliTerm);
-        opts.focusManager.addMonitoredElement(opts.gcliTerm.hintNode, 'gcliTerm');
-      }
-
-      if (opts.hintElement) {
-        opts.menu = new CommandMenu(opts.chromeDocument, opts.requisition);
-        opts.hintElement.appendChild(opts.menu.element);
-
-        opts.argFetcher = new ArgFetcher(opts.chromeDocument, opts.requisition);
-        opts.hintElement.appendChild(opts.argFetcher.element);
-
-        opts.menu.onCommandChange();
-      }
+      opts.display = new Display(opts);
     },
 
     /**
      * Undo the effects of createView() to prevent memory leaks
      */
     removeView: function(opts) {
-      opts.hintElement.removeChild(opts.menu.element);
-      opts.menu.destroy();
-      opts.hintElement.removeChild(opts.argFetcher.element);
-      opts.argFetcher.destroy();
-
-      opts.inputter.destroy();
-      opts.focusManager.removeMonitoredElement(opts.gcliTerm.hintNode, 'gcliTerm');
-      opts.focusManager.onFocus.remove(opts.gcliTerm.show, opts.gcliTerm);
-      opts.focusManager.onBlur.remove(opts.gcliTerm.hide, opts.gcliTerm);
-      opts.focusManager.destroy();
+      opts.display.destroy();
+      delete opts.display;
+
+      opts.requisition.destroy();
+      delete opts.requisition;
 
       cli.unsetEvalFunction();
       nodetype.unsetDocument();
       jstype.unsetGlobalObject();
-
-      opts.requisition.destroy();
     },
 
     commandOutputManager: require('gcli/canon').commandOutputManager
   };
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
@@ -1121,24 +1106,17 @@ canon.commandOutputManager = new Command
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
 define('gcli/util', ['require', 'exports', 'module' ], function(require, exports, module) {
 
 /*
- * This module is a Pilot-Lite. It exports a number of objects that replicate
- * parts of the Pilot project. It aims to be mostly API compatible, while
- * removing the submodule complexity and helping us make things work inside
- * Firefox.
- * The Pilot compatible exports are: console/dom/event
- *
- * In addition it contains a small event library similar to EventEmitter but
- * which makes it harder to mistake the event in use.
+ * A number of DOM manipulation and event handling utilities.
  */
 
 
 //------------------------------------------------------------------------------
 
 /**
  * Create an event.
  * For use as follows:
@@ -1207,36 +1185,35 @@ exports.createEvent = function(name) {
   return event;
 };
 
 
 //------------------------------------------------------------------------------
 
 var dom = {};
 
-var NS_XHTML = 'http://www.w3.org/1999/xhtml';
-
-/**
- * Pass-through to createElement or createElementNS
+dom.NS_XHTML = 'http://www.w3.org/1999/xhtml';
+
+/**
+ * Create an HTML or XHTML element depending on whether the document is HTML
+ * or XML based. Where HTML/XHTML elements are distinguished by whether they
+ * are created using doc.createElementNS('http://www.w3.org/1999/xhtml', tag)
+ * or doc.createElement(tag)
+ * If you want to create a XUL element then you don't have a problem knowing
+ * what namespace you want.
  * @param doc The document in which to create the element
  * @param tag The name of the tag to create
- * @param ns Custom namespace, HTML/XHTML is assumed if this is missing
  * @returns The created element
  */
-dom.createElement = function(doc, tag, ns) {
-  // If we've not been given a namespace, but the document is XML, then we
-  // use an XHTML namespace, otherwise we use HTML
-  if (ns == null && doc.xmlVersion != null) {
-    ns = NS_XHTML;
-  }
-  if (ns == null) {
-    return doc.createElement(tag);
+dom.createElement = function(doc, tag) {
+  if (dom.isXmlDocument(doc)) {
+    return doc.createElementNS(dom.NS_XHTML, tag);
   }
   else {
-    return doc.createElementNS(ns, tag);
+    return doc.createElement(tag);
   }
 };
 
 /**
  * Remove all the child nodes from this node
  * @param elem The element that should have it's children removed
  */
 dom.clearElement = function(elem) {
@@ -1259,36 +1236,55 @@ dom.importCss = function(cssText, doc) {
 
   var head = doc.getElementsByTagName('head')[0] || doc.documentElement;
   head.appendChild(style);
 
   return style;
 };
 
 /**
- * Using setInnerHtml(foo) rather than innerHTML = foo allows us to enable
- * tweaks in XHTML documents.
+ * There are problems with innerHTML on XML documents, so we need to do a dance
+ * using document.createRange().createContextualFragment() when in XML mode
  */
 dom.setInnerHtml = function(elem, html) {
-  if (!this.document || elem.namespaceURI === NS_XHTML) {
-    try {
-      dom.clearElement(elem);
-      var range = elem.ownerDocument.createRange();
-      html = '<div xmlns="' + NS_XHTML + '">' + html + '</div>';
-      elem.appendChild(range.createContextualFragment(html));
-    }
-    catch (ex) {
-      elem.innerHTML = html;
+  if (dom.isXmlDocument(elem.ownerDocument)) {
+    dom.clearElement(elem);
+    html = '<div xmlns="' + dom.NS_XHTML + '">' + html + '</div>';
+    var range = elem.ownerDocument.createRange();
+    var child = range.createContextualFragment(html).childNodes[0];
+    while (child.hasChildNodes()) {
+      elem.appendChild(child.firstChild);
     }
   }
   else {
     elem.innerHTML = html;
   }
 };
 
+/**
+ * How to detect if we're in an XUL document (and therefore should create
+ * elements in an XHTML namespace)
+ * In a Mozilla XUL document, document.xmlVersion = null, however in Chrome
+ * document.contentType = undefined.
+ * @param doc The document element to work from (defaulted to the global
+ * 'document' if missing
+ */
+dom.isXmlDocument = function(doc) {
+  doc = doc || document;
+  // Best test for Firefox
+  if (doc.contentType && doc.contentType != 'text/html') {
+    return true;
+  }
+  // Best test for Chrome
+  if (doc.xmlVersion != null) {
+    return true;
+  }
+  return false;
+};
+
 exports.dom = dom;
 
 
 //------------------------------------------------------------------------------
 
 /**
  * Various event utilities
  */
@@ -4032,24 +4028,26 @@ UnassignedAssignment.prototype.setUnassi
  * The event object looks like { command: A }
  * <li>assignmentChange: This is a forward of the Assignment.assignmentChange
  * event. It is fired when any assignment (except the commandAssignment)
  * changes.
  * <li>inputChange: The text to be mirrored in a command line has changed.
  * The event object looks like { newText: X }.
  * </ul>
  *
- * @param environment An opaque object passed to commands using ExecutionContext
- * @param document A DOM Document passed to commands using ExecutionContext in
- * order to allow creation of DOM nodes.
+ * @param environment An optional opaque object passed to commands using
+ * ExecutionContext.
+ * @param doc A DOM Document passed to commands using ExecutionContext in
+ * order to allow creation of DOM nodes. If missing Requisition will use the
+ * global 'document'.
  * @constructor
  */
-function Requisition(environment, document) {
+function Requisition(environment, doc) {
   this.environment = environment;
-  this.document = document;
+  this.document = doc || document;
 
   // The command that we are about to execute.
   // @see setCommandConversion()
   this.commandAssignment = new CommandAssignment();
 
   // The object that stores of Assignment objects that we are filling out.
   // The Assignment objects are stored under their param.name for named
   // lookup. Note: We make use of the property of Javascript objects that
@@ -4181,17 +4179,16 @@ Requisition.prototype._onCommandAssignme
   }
   this.assignmentCount = Object.keys(this._assignments).length;
 
   this.commandChange({
     requisition: this,
     oldValue: ev.oldValue,
     newValue: command
   });
-//  this.inputChange();
 };
 
 /**
  * Assignments have an order, so we need to store them in an array.
  * But we also need named access ...
  * @return The found assignment, or undefined, if no match was found
  */
 Requisition.prototype.getAssignment = function(nameOrNumber) {
@@ -4366,26 +4363,24 @@ Requisition.prototype.toString = functio
   }
 
   return this.toCanonicalString();
 };
 
 /**
  * Return an array of Status scores so we can create a marked up
  * version of the command line input.
- */
-Requisition.prototype.getInputStatusMarkup = function() {
+ * @param cursor We only take a status of INCOMPLETE to be INCOMPLETE when the
+ * cursor is actually in the argument. Otherwise it's an error.
+ */
+Requisition.prototype.getInputStatusMarkup = function(cursor) {
   var argTraces = this.createInputArgTrace();
-  // We only take a status of INCOMPLETE to be INCOMPLETE when the cursor is
-  // actually in the argument. Otherwise it's an error.
   // Generally the 'argument at the cursor' is the argument before the cursor
   // unless it is before the first char, in which case we take the first.
-  var cursor = this.input.cursor.start === 0 ?
-      0 :
-      this.input.cursor.start - 1;
+  cursor = cursor === 0 ? 0 : cursor - 1;
   var cTrace = argTraces[cursor];
 
   var statuses = [];
   for (var i = 0; i < argTraces.length; i++) {
     var argTrace = argTraces[i];
     var arg = argTrace.arg;
     var status = Status.VALID;
     if (argTrace.part === 'text') {
@@ -4564,19 +4559,18 @@ Requisition.prototype.exec = function(in
  * <p>The general sequence is:
  * <ul>
  * <li>_tokenize(): convert _typed into _parts
  * <li>_split(): convert _parts into _command and _unparsedArgs
  * <li>_assign(): convert _unparsedArgs into requisition
  * </ul>
  */
 Requisition.prototype.update = function(input) {
-  this.input = input;
-  if (this.input.cursor == null) {
-    this.input.cursor = { start: input.length, end: input.length };
+  if (input.cursor == null) {
+    input.cursor = { start: input.length, end: input.length };
   }
 
   this._structuralChangeInProgress = true;
 
   this._args = this._tokenize(input.typed);
 
   var args = this._args.slice(0); // i.e. clone
   this._split(args);
@@ -5042,16 +5036,145 @@ define('gcli/promise', ['require', 'expo
 
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
+define('gcli/ui/display', ['require', 'exports', 'module' , 'gcli/ui/inputter', 'gcli/ui/arg_fetch', 'gcli/ui/menu', 'gcli/ui/focus'], function(require, exports, module) {
+
+var Inputter = require('gcli/ui/inputter').Inputter;
+var ArgFetcher = require('gcli/ui/arg_fetch').ArgFetcher;
+var CommandMenu = require('gcli/ui/menu').CommandMenu;
+var FocusManager = require('gcli/ui/focus').FocusManager;
+
+/**
+ * Display is responsible for generating the UI for GCLI, this implementation
+ * is a special case for use inside Firefox
+ */
+function Display(options) {
+  this.hintElement = options.hintElement;
+  this.gcliTerm = options.gcliTerm;
+  this.consoleWrap = options.consoleWrap;
+  this.requisition = options.requisition;
+
+  // Create a FocusManager for the various parts to register with
+  this.focusManager = new FocusManager({ document: options.chromeDocument });
+  this.focusManager.onFocus.add(this.gcliTerm.show, this.gcliTerm);
+  this.focusManager.onBlur.add(this.gcliTerm.hide, this.gcliTerm);
+  this.focusManager.addMonitoredElement(this.gcliTerm.hintNode, 'gcliTerm');
+
+  this.inputter = new Inputter({
+    document: options.contentDocument,
+    requisition: options.requisition,
+    inputElement: options.inputElement,
+    completeElement: options.completeElement,
+    completionPrompt: '',
+    backgroundElement: options.backgroundElement,
+    focusManager: this.focusManager
+  });
+
+  this.menu = new CommandMenu({
+    document: options.contentDocument,
+    requisition: options.requisition,
+    menuClass: 'gcliterm-menu'
+  });
+  this.hintElement.appendChild(this.menu.element);
+
+  this.argFetcher = new ArgFetcher({
+    document: options.contentDocument,
+    requisition: options.requisition,
+    argFetcherClass: 'gcliterm-argfetcher'
+  });
+  this.hintElement.appendChild(this.argFetcher.element);
+
+  this.chromeWindow = options.chromeDocument.defaultView;
+  this.resizer = this.resizer.bind(this);
+  this.chromeWindow.addEventListener('resize', this.resizer, false);
+  this.requisition.commandChange.add(this.resizer, this);
+}
+
+/**
+ * Avoid memory leaks
+ */
+Display.prototype.destroy = function() {
+  this.chromeWindow.removeEventListener('resize', this.resizer, false);
+  delete this.resizer;
+  delete this.chromeWindow;
+  delete this.consoleWrap;
+
+  this.hintElement.removeChild(this.menu.element);
+  this.menu.destroy();
+  this.hintElement.removeChild(this.argFetcher.element);
+  this.argFetcher.destroy();
+
+  this.inputter.destroy();
+
+  this.focusManager.removeMonitoredElement(this.gcliTerm.hintNode, 'gcliTerm');
+  this.focusManager.onFocus.remove(this.gcliTerm.show, this.gcliTerm);
+  this.focusManager.onBlur.remove(this.gcliTerm.hide, this.gcliTerm);
+  this.focusManager.destroy();
+
+  delete this.gcliTerm;
+  delete this.hintElement;
+};
+
+/**
+ * Called on chrome window resize, or on divider slide
+ */
+Display.prototype.resizer = function() {
+  var parentRect = this.consoleWrap.getBoundingClientRect();
+  var parentHeight = parentRect.bottom - parentRect.top - 64;
+
+  if (parentHeight < 100) {
+    this.hintElement.classList.add('gcliterm-hint-nospace');
+  }
+  else {
+    this.hintElement.classList.remove('gcliterm-hint-nospace');
+
+    var isMenuVisible = this.menu.element.style.display !== 'none';
+    if (isMenuVisible) {
+      this.menu.setMaxHeight(parentHeight);
+
+      // Magic numbers. We have 2 options - lots of complex dom math to derive
+      // the height of a menu item (19 pixels) and the vertical padding
+      // (22 pixels), or we could just hard-code. The former is *slightly* more
+      // resilient to refactoring (but still breaks with dom structure changes),
+      // the latter is simpler, faster and easier.
+      var idealMenuHeight = (19 * this.menu.items.length) + 22;
+
+      if (idealMenuHeight > parentHeight) {
+        this.hintElement.style.overflowY = 'scroll';
+        this.hintElement.style.borderBottomColor = 'threedshadow';
+      }
+      else {
+        this.hintElement.style.overflowY = null;
+        this.hintElement.style.borderBottomColor = 'white';
+      }
+    }
+    else {
+      this.argFetcher.setMaxHeight(parentHeight);
+
+      this.hintElement.style.overflowY = null;
+      this.hintElement.style.borderBottomColor = 'white';
+    }
+  }
+};
+
+exports.Display = Display;
+
+});
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
 define('gcli/ui/inputter', ['require', 'exports', 'module' , 'gcli/util', 'gcli/types', 'gcli/history', 'text!gcli/ui/inputter.css'], function(require, exports, module) {
 var cliView = exports;
 
 
 var KeyEvent = require('gcli/util').event.KeyEvent;
 var dom = require('gcli/util').dom;
 
 var Status = require('gcli/types').Status;
@@ -5062,17 +5185,17 @@ var inputterCss = require('text!gcli/ui/
 
 /**
  * A wrapper to take care of the functions concerning an input element
  */
 function Inputter(options) {
   this.requisition = options.requisition;
 
   // Suss out where the input element is
-  this.element = options.inputElement || 'gcliInput';
+  this.element = options.inputElement || 'gcli-input';
   if (typeof this.element === 'string') {
     this.document = options.document || document;
     var name = this.element;
     this.element = this.document.getElementById(name);
     if (!this.element) {
       throw new Error('No element with id=' + name + '.');
     }
   }
@@ -5094,41 +5217,37 @@ function Inputter(options) {
   this._caretChange = null;
 
   // Ensure that TAB/UP/DOWN isn't handled by the browser
   this.onKeyDown = this.onKeyDown.bind(this);
   this.onKeyUp = this.onKeyUp.bind(this);
   this.element.addEventListener('keydown', this.onKeyDown, false);
   this.element.addEventListener('keyup', this.onKeyUp, false);
 
-  if (options.completer == null) {
-    options.completer = new Completer(options);
-  }
-  else if (typeof options.completer === 'function') {
-    options.completer = new options.completer(options);
-  }
-  this.completer = options.completer;
+  this.completer = options.completer || new Completer(options);
   this.completer.decorate(this);
 
   // Use the provided history object, or instantiate our own
-  this.history = options.history = options.history || new History(options);
+  this.history = options.history || new History(options);
   this._scrollingThroughHistory = false;
 
   // Cursor position affects hint severity
   this.onMouseUp = function(ev) {
     this.completer.update(this.getInputState());
   }.bind(this);
   this.element.addEventListener('mouseup', this.onMouseUp, false);
 
   this.focusManager = options.focusManager;
   if (this.focusManager) {
     this.focusManager.addMonitoredElement(this.element, 'input');
   }
 
   this.requisition.inputChange.add(this.onInputChange, this);
+
+  this.update();
 }
 
 /**
  * Avoid memory leaks
  */
 Inputter.prototype.destroy = function() {
   this.requisition.inputChange.remove(this.onInputChange, this);
   if (this.focusManager) {
@@ -5367,22 +5486,22 @@ Inputter.prototype.onKeyUp = function(ev
   if (ev.keyCode === KeyEvent.DOM_VK_TAB && !ev.shiftKey) {
     // If the TAB keypress took the cursor from another field to this one,
     // then they get the keydown/keypress, and we get the keyup. In this
     // case we don't want to do any completion.
     // If the time of the keydown/keypress of TAB was close (i.e. within
     // 1 second) to the time of the keyup then we assume that we got them
     // both, and do the completion.
     if (this.lastTabDownAt + 1000 > ev.timeStamp) {
-      this.getCurrentAssignment().complete();
       // It's possible for TAB to not change the input, in which case the
       // onInputChange event will not fire, and the caret move will not be
-      // processed. So we check that this is done
+      // processed. So we check that this is done first
       this._caretChange = Caret.TO_ARG_END;
       this._processCaretChange(this.getInputState(), true);
+      this.getCurrentAssignment().complete();
     }
     this.lastTabDownAt = 0;
     this._scrollingThroughHistory = false;
     return;
   }
 
   if (ev.keyCode === KeyEvent.DOM_VK_UP) {
     if (this.element.value === '' || this._scrollingThroughHistory) {
@@ -5462,37 +5581,37 @@ cliView.Inputter = Inputter;
  * Properties on the options object:
  * - document (required) DOM document to be used in creating elements
  * - requisition (required) A GCLI Requisition object whose state is monitored
  * - completeElement (optional) An element to use
  * - completionPrompt (optional) The prompt to show before a completion.
  *   Defaults to '&#x00bb;' (double greater-than, a.k.a right guillemet).
  */
 function Completer(options) {
-  this.document = options.document;
+  this.document = options.document || document;
   this.requisition = options.requisition;
   this.elementCreated = false;
 
-  this.element = options.completeElement || 'gcliComplete';
+  this.element = options.completeElement || 'gcli-row-complete';
   if (typeof this.element === 'string') {
     var name = this.element;
     this.element = this.document.getElementById(name);
 
     if (!this.element) {
       this.elementCreated = true;
       this.element = dom.createElement(this.document, 'div');
-      this.element.className = 'gcliCompletion gcliVALID';
+      this.element.className = 'gcli-in-complete gcli-in-valid';
       this.element.setAttribute('tabindex', '-1');
       this.element.setAttribute('aria-live', 'polite');
     }
   }
 
   this.completionPrompt = typeof options.completionPrompt === 'string'
-    ? options.completionPrompt
-    : '&#x00bb;';
+      ? options.completionPrompt
+      : '&#x00bb;';
 
   if (options.inputBackgroundElement) {
     this.backgroundElement = options.inputBackgroundElement;
   }
   else {
     this.backgroundElement = this.element;
   }
 }
@@ -5590,47 +5709,47 @@ function isStrictCompletion(inputValue, 
 
 /**
  * Bring the completion element up to date with what the requisition says
  */
 Completer.prototype.update = function(input) {
   var current = this.requisition.getAssignmentAt(input.cursor.start);
   var predictions = current.getPredictions();
 
-  var completion = '<span class="gcliPrompt">' + this.completionPrompt + '</span> ';
+  var completion = '<span class="gcli-prompt">' + this.completionPrompt + '</span> ';
   if (input.typed.length > 0) {
-    var scores = this.requisition.getInputStatusMarkup();
+    var scores = this.requisition.getInputStatusMarkup(input.cursor.start);
     completion += this.markupStatusScore(scores, input);
   }
 
   if (input.typed.length > 0 && predictions.length > 0) {
     var tab = predictions[0].name;
     var existing = current.getArg().text;
     if (isStrictCompletion(existing, tab) && input.cursor.start === input.typed.length) {
       // Display the suffix of the prediction as the completion.
       var numLeadingSpaces = existing.match(/^(\s*)/)[0].length;
       var suffix = tab.slice(existing.length - numLeadingSpaces);
-      completion += '<span class="gcliCompl">' + suffix + '</span>';
+      completion += '<span class="gcli-in-ontab">' + suffix + '</span>';
     } else {
       // Display the '-> prediction' at the end of the completer element
-      completion += ' &#xa0;<span class="gcliCompl">&#x21E5; ' +
+      completion += ' &#xa0;<span class="gcli-in-ontab">&#x21E5; ' +
           tab + '</span>';
     }
   }
 
   // A hack to add a grey '}' to the end of the command line when we've opened
   // with a { but haven't closed it
   var command = this.requisition.commandAssignment.getValue();
   if (command && command.name === '{') {
     if (this.requisition.getAssignment(0).getArg().suffix.indexOf('}') === -1) {
-      completion += '<span class="gcliCloseBrace">}</span>';
-    }
-  }
-
-  dom.setInnerHtml(this.element, '<span>' + completion + '</span>');
+      completion += '<span class="gcli-in-closebrace">}</span>';
+    }
+  }
+
+  dom.setInnerHtml(this.element, completion);
 };
 
 /**
  * Mark-up an array of Status values with spans
  */
 Completer.prototype.markupStatusScore = function(scores, input) {
   var completion = '';
   if (scores.length === 0) {
@@ -5641,17 +5760,17 @@ Completer.prototype.markupStatusScore = 
   var lastStatus = -1;
   while (true) {
     if (lastStatus !== scores[i]) {
       var state = scores[i];
       if (!state) {
         console.error('No state at i=' + i + '. scores.len=' + scores.length);
         state = Status.VALID;
       }
-      completion += '<span class="gcli' + state.toString() + '">';
+      completion += '<span class="gcli-in-' + state.toString().toLowerCase() + '">';
       lastStatus = scores[i];
     }
     var char = input.typed[i];
     if (char === ' ') {
       char = '&#xa0;';
     }
     completion += char;
     i++;
@@ -5752,48 +5871,53 @@ var Templater = require('gcli/ui/domtemp
 
 var editorCss = require('text!gcli/ui/arg_fetch.css');
 var argFetchHtml = require('text!gcli/ui/arg_fetch.html');
 
 
 /**
  * A widget to display an inline dialog which allows the user to fill out
  * the arguments to a command.
- * @param document The document to use in creating widgets
- * @param requisition The Requisition to fill out
- */
-function ArgFetcher(document, requisition) {
-  this.document = document;
-  this.requisition = requisition;
+ * @param options An object containing the customizations, which include:
+ * - document: The document to use in creating widgets
+ * - requisition: The Requisition to fill out
+ * - argFetcherClass: Custom class name when generating the top level element
+ *   which allows different layout systems
+ */
+function ArgFetcher(options) {
+  this.document = options.document || document;
+  this.requisition = options.requisition;
 
   // FF can be really hard to debug if doc is null, so we check early on
   if (!this.document) {
     throw new Error('No document');
   }
 
   this.element =  dom.createElement(this.document, 'div');
-  this.element.className = 'gcliCliEle';
+  this.element.className = options.argFetcherClass || 'gcli-argfetch';
   // We cache the fields we create so we can destroy them later
   this.fields = [];
 
   this.tmpl = new Templater();
   // Populated by template
   this.okElement = null;
 
   // Pull the HTML into the DOM, but don't add it to the document
   if (editorCss != null) {
     this.style = dom.importCss(editorCss, this.document);
   }
 
   var templates = dom.createElement(this.document, 'div');
   dom.setInnerHtml(templates, argFetchHtml);
-  this.reqTempl = templates.querySelector('#gcliReqTempl');
+  this.reqTempl = templates.querySelector('.gcli-af-template');
 
   this.requisition.commandChange.add(this.onCommandChange, this);
   this.requisition.inputChange.add(this.onInputChange, this);
+
+  this.onCommandChange();
 }
 
 /**
  * Avoid memory leaks
  */
 ArgFetcher.prototype.destroy = function() {
   this.requisition.inputChange.remove(this.onInputChange, this);
   this.requisition.commandChange.remove(this.onCommandChange, this);
@@ -5851,41 +5975,49 @@ ArgFetcher.prototype.onInputChange = fun
   }
 };
 
 /**
  * Called by the template process in #onCommandChange() to get an instance
  * of field for each assignment.
  */
 ArgFetcher.prototype.getInputFor = function(assignment) {
-  var newField = getField(assignment.param.type, {
-    document: this.document,
-    type: assignment.param.type,
-    name: assignment.param.name,
-    requisition: this.requisition,
-    required: assignment.param.isDataRequired(),
-    named: !assignment.param.isPositionalAllowed()
-  });
-
-  // BUG 664198 - remove on delete
-  newField.fieldChanged.add(function(ev) {
-    assignment.setConversion(ev.conversion);
-  }, this);
-  assignment.assignmentChange.add(function(ev) {
-    newField.setConversion(ev.conversion);
-  }.bind(this));
-
-  this.fields.push(newField);
-  newField.setConversion(this.assignment.conversion);
-
-  // Bug 681894: we add the field as a property of the assignment so that
-  // #linkMessageElement() can call 'field.setMessageElement(element)'
-  assignment.field = newField;
-
-  return newField.element;
+  try {
+    var newField = getField(assignment.param.type, {
+      document: this.document,
+      type: assignment.param.type,
+      name: assignment.param.name,
+      requisition: this.requisition,
+      required: assignment.param.isDataRequired(),
+      named: !assignment.param.isPositionalAllowed()
+    });
+
+    // BUG 664198 - remove on delete
+    newField.fieldChanged.add(function(ev) {
+      assignment.setConversion(ev.conversion);
+    }, this);
+    assignment.assignmentChange.add(function(ev) {
+      newField.setConversion(ev.conversion);
+    }.bind(this));
+
+    this.fields.push(newField);
+    newField.setConversion(this.assignment.conversion);
+
+    // Bug 681894: we add the field as a property of the assignment so that
+    // #linkMessageElement() can call 'field.setMessageElement(element)'
+    assignment.field = newField;
+
+    return newField.element;
+  }
+  catch (ex) {
+    // This is called from within Templater which can make tracing errors hard
+    // so we log here if anything goes wrong
+    console.error(ex);
+    return '';
+  }
 };
 
 /**
  * Called by the template to setup an mutable message field
  */
 ArgFetcher.prototype.linkMessageElement = function(assignment, element) {
   // Bug 681894: See comment in getInputFor()
   var field = assignment.field;
@@ -5907,16 +6039,32 @@ ArgFetcher.prototype.onFormOk = function
 
 /**
  * Event handler added by the template menu.html
  */
 ArgFetcher.prototype.onFormCancel = function(ev) {
   this.requisition.clear();
 };
 
+/**
+ * Change how much vertical space this dialog can take up
+ */
+ArgFetcher.prototype.setMaxHeight = function(height, isTooBig) {
+  this.fields.forEach(function(field) {
+    if (field.menu) {
+      // Magic number alert: 105 is roughly the size taken up by the rest of
+      // the dialog for the '{' command. We could spend ages calculating 105
+      // by doing math on the various components that contribute to the 105,
+      // but I don't think that would make it significantly less fragile under
+      // refactoring. Plus this works.
+      field.menu.setMaxHeight(height - 105);
+    }
+  });
+};
+
 argFetch.ArgFetcher = ArgFetcher;
 
 
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
@@ -6099,17 +6247,17 @@ exports.getField = getField;
  */
 function StringField(type, options) {
   this.document = options.document;
   this.type = type;
   this.arg = new Argument();
 
   this.element = dom.createElement(this.document, 'input');
   this.element.type = 'text';
-  this.element.style.width = '100%';
+  this.element.className = 'gcli-field';
 
   this.onInputChange = this.onInputChange.bind(this);
   this.element.addEventListener('keyup', this.onInputChange, false);
 
   this.fieldChanged = createEvent('StringField.fieldChanged');
 }
 
 StringField.prototype = Object.create(Field.prototype);
@@ -6259,17 +6407,17 @@ addField(BooleanField);
  * </ul>
  */
 function SelectionField(type, options) {
   this.document = options.document;
   this.type = type;
   this.items = [];
 
   this.element = dom.createElement(this.document, 'select');
-  this.element.style.width = '180px';
+  this.element.className = 'gcli-field';
   this._addOption({
     name: l10n.lookupFormat('fieldSelectionSelect', [ options.name ])
   });
   var lookup = this.type.getLookup();
   lookup.forEach(this._addOption, this);
 
   this.onInputChange = this.onInputChange.bind(this);
   this.element.addEventListener('change', this.onInputChange, false);
@@ -6334,21 +6482,21 @@ function JavascriptField(type, options) 
   this.onInputChange = this.onInputChange.bind(this);
   this.arg = new Argument('', '{ ', ' }');
 
   this.element = dom.createElement(this.document, 'div');
 
   this.input = dom.createElement(this.document, 'input');
   this.input.type = 'text';
   this.input.addEventListener('keyup', this.onInputChange, false);
-  this.input.style.marginBottom = '0px';
-  this.input.style.width = options.name.length === 0 ? '240px' : '160px';
+  this.input.style.marginBottom = '0';
+  this.input.className = 'gcli-field';
   this.element.appendChild(this.input);
 
-  this.menu = new Menu(this.document, { field: true });
+  this.menu = new Menu({ document: this.document, field: true });
   this.element.appendChild(this.menu.element);
 
   this.setConversion(this.type.parse(new Argument('')));
 
   this.fieldChanged = createEvent('JavascriptField.fieldChanged');
 
   // i.e. Register this.onItemClick as the default action for a menu click
   this.menu.onItemClick = this.onItemClick.bind(this);
@@ -6650,36 +6798,46 @@ var Templater = require('gcli/ui/domtemp
 
 var menuCss = require('text!gcli/ui/menu.css');
 var menuHtml = require('text!gcli/ui/menu.html');
 
 
 /**
  * Menu is a display of the commands that are possible given the state of a
  * requisition.
- * @param document The document from which we create elements.
  * @param options A way to customize the menu display. Valid options are:
- * - field:true Turns the menu display into a drop-down for use inside a
- * JavascriptField.
- */
-function Menu(document, options) {
-  this.element =  dom.createElement(document, 'div');
-  this.element.className = 'gcliMenu';
+ * - field: [boolean] Turns the menu display into a drop-down for use inside a
+ *   JavascriptField.
+ * - document: The document to use in creating widgets
+ * - menuClass: Custom class name when generating the top level element
+ *   which allows different layout systems
+ */
+function Menu(options) {
+  options = options || {};
+  this.document = options.document || document;
+
+  // FF can be really hard to debug if doc is null, so we check early on
+  if (!this.document) {
+    throw new Error('No document');
+  }
+
+  this.element =  dom.createElement(this.document, 'div');
+  this.element.classList.add(options.menuClass || 'gcli-menu');
   if (options && options.field) {
-    this.element.className += ' gcliMenuField';
+    this.element.classList.add(options.menuFieldClass || 'gcli-menu-field');
   }
 
   // Pull the HTML into the DOM, but don't add it to the document
   if (menuCss != null) {
-    this.style = dom.importCss(menuCss, document);
-  }
-
-  var templates = dom.createElement(document, 'div');
+    this.style = dom.importCss(menuCss, this.document);
+  }
+
+  var templates = dom.createElement(this.document, 'div');
   dom.setInnerHtml(templates, menuHtml);
-  this.optTempl = templates.querySelector('#gcliOptTempl');
+  this.optTempl = templates.querySelector('.gcli-menu-template');
 
   // Contains the items that should be displayed
   this.items = null;
 }
 
 /**
  * Avoid memory leaks
  */
@@ -6729,29 +6887,41 @@ Menu.prototype.show = function(items, er
 
 /**
  * Hide the menu
  */
 Menu.prototype.hide = function() {
   this.element.style.display = 'none';
 };
 
+/**
+ * Change how much vertical space this menu can take up
+ */
+Menu.prototype.setMaxHeight = function(height) {
+  this.element.style.maxHeight = height + 'px';
+};
+
 exports.Menu = Menu;
 
 
 /**
  * CommandMenu is a special menu that integrates with a Requisition to display
  * available commands.
- */
-function CommandMenu(document, requisition) {
-  Menu.call(this, document);
-  this.requisition = requisition;
+ * @param options A way to customize the menu display. Valid options include
+ * those valid for Menu(), plus:
+ * - requisition: The Requisition to fill out (required)
+ */
+function CommandMenu(options) {
+  Menu.call(this, options);
+  this.requisition = options.requisition;
 
   this.requisition.commandChange.add(this.onCommandChange, this);
   canon.canonChange.add(this.onCommandChange, this);
+
+  this.onCommandChange();
 }
 
 CommandMenu.prototype = Object.create(Menu.prototype);
 
 /**
  * Avoid memory leaks
  */
 CommandMenu.prototype.destroy = function() {
@@ -6762,18 +6932,18 @@ CommandMenu.prototype.destroy = function
 };
 
 /**
  * We want to fill-in the clicked command in the cli input when the user clicks
  */
 CommandMenu.prototype.onItemClick = function(ev) {
   var type = this.requisition.commandAssignment.param.type;
 
-  var text = type.stringify(ev.currentTarget.item);
-  var arg = new Argument(text);
+  var name = ev.currentTarget.querySelector('.gcli-menu-name').innerHTML;
+  var arg = new Argument(name);
   arg.suffix = ' ';
 
   var conversion = type.parse(arg);
   this.requisition.commandAssignment.setConversion(conversion);
 };
 
 /**
  * Update the various hint components to reflect the changed command
@@ -6823,78 +6993,71 @@ exports.CommandMenu = CommandMenu;
 
 define('gcli/ui/domtemplate', ['require', 'exports', 'module' ], function(require, exports, module) {
 
   Components.utils.import("resource:///modules/devtools/Templater.jsm");
   exports.Templater = Templater;
 
 });
 define("text!gcli/ui/menu.css", [], void 0);
-define("text!gcli/ui/menu.html", [], "" +
-  "<!--" +
-  "Template for the beginnings of a command menu." +
-  "This will work with things other than a command - many things are a set of" +
-  "things with a name and description." +
-  "In the command context it is evaluated once for every keypress in the cli" +
-  "when a command has not been entered." +
-  "-->" +
-  "<div id=\"gcliOptTempl\" aria-live=\"polite\">" +
-  "  <div class=\"gcliOption\" foreach=\"item in ${items}\" onclick=\"${onItemClick}\"" +
-  "      title=\"${item.manual || ''}\">" +
-  "    ${__element.item = item; ''}" +
-  "    <span class=\"gcliOptionName\">${item.name}</span>" +
-  "    <span class=\"gcliOptionDesc\">${item.description}</span>" +
-  "  </div>" +
-  "  <div class=\"gcliMenuError\" if=\"${error}\">${error}</div>" +
-  "</div>" +
+define("text!gcli/ui/menu.html", [], "\n" +
+  "<table class=\"gcli-menu-template\" aria-live=\"polite\">\n" +
+  "  <tr class=\"gcli-menu-option\" foreach=\"item in ${items}\"\n" +
+  "      onclick=\"${onItemClick}\" title=\"${item.manual || ''}\">\n" +
+  "    <td class=\"gcli-menu-name\">${item.name}</td>\n" +
+  "    <td class=\"gcli-menu-desc\">${item.description}</td>\n" +
+  "  </tr>\n" +
+  "  <tr if=\"${error}\">\n" +
+  "    <td class=\"gcli-menu-error\" colspan=\"2\">${error}</td>\n" +
+  "  </tr>\n" +
+  "</table>\n" +
   "");
 
 define("text!gcli/ui/arg_fetch.css", [], void 0);
-define("text!gcli/ui/arg_fetch.html", [], "" +
-  "<!--" +
-  "Template for an Assignment." +
-  "Evaluated each time the commandAssignment changes" +
-  "-->" +
-  "<div id=\"gcliReqTempl\" aria-live=\"polite\">" +
-  "  <div>" +
-  "    <div class=\"gcliCmdDesc\">" +
-  "      ${requisition.commandAssignment.getValue().description}" +
-  "    </div>" +
-  "    <table class=\"gcliParams\">" +
-  "      <tbody class=\"gcliAssignment\"" +
-  "          foreach=\"assignment in ${requisition.getAssignments()}\">" +
-  "        <!-- Parameter -->" +
-  "        <tr class=\"gcliGroupRow\">" +
-  "          <td class=\"gcliParamName\">" +
-  "            <label for=\"gcliForm${assignment.param.name}\">" +
-  "              ${assignment.param.description ? assignment.param.description + ':' : ''}" +
-  "            </label>" +
-  "          </td>" +
-  "          <td class=\"gcliParamInput\">${getInputFor(assignment)}</td>" +
-  "          <td>" +
-  "            <span class=\"gcliRequired\" if=\"${assignment.param.isDataRequired()}\"> *</span>" +
-  "          </td>" +
-  "        </tr>" +
-  "        <tr class=\"gcliGroupRow\">" +
-  "          <td class=\"gcliParamError\" colspan=\"2\">" +
-  "            ${linkMessageElement(assignment, __element)}" +
-  "          </td>" +
-  "        </tr>" +
-  "      </tbody>" +
-  "      <tfoot>" +
-  "        <tr>" +
-  "          <td colspan=\"3\" class=\"gcliParamSubmit\">" +
-  "            <input type=\"submit\" value=\"Cancel\" onclick=\"${onFormCancel}\"/>" +
-  "            <input type=\"submit\" value=\"OK\" onclick=\"${onFormOk}\" save=\"${okElement}\"/>" +
-  "          </td>" +
-  "        </tr>" +
-  "      </tfoot>" +
-  "    </table>" +
-  "  </div>" +
-  "</div>" +
+define("text!gcli/ui/arg_fetch.html", [], "\n" +
+  "<!--\n" +
+  "Template for an Assignment.\n" +
+  "Evaluated each time the commandAssignment changes\n" +
+  "-->\n" +
+  "<div class=\"gcli-af-template\" aria-live=\"polite\">\n" +
+  "  <div>\n" +
+  "    <div class=\"gcli-af-cmddesc\">\n" +
+  "      ${requisition.commandAssignment.getValue().description}\n" +
+  "    </div>\n" +
+  "    <table class=\"gcli-af-params\">\n" +
+  "      <tbody foreach=\"assignment in ${requisition.getAssignments()}\">\n" +
+  "        <!-- Parameter -->\n" +
+  "        <tr>\n" +
+  "          <td class=\"gcli-af-paramname\">\n" +
+  "            <label for=\"gcliForm${assignment.param.name}\">\n" +
+  "              ${assignment.param.description ? assignment.param.description + ':' : ''}\n" +
+  "            </label>\n" +
+  "          </td>\n" +
+  "          <td>${getInputFor(assignment)}</td>\n" +
+  "          <td>\n" +
+  "            <span class=\"gcli-af-required\" if=\"${assignment.param.isDataRequired()}\">*</span>\n" +
+  "          </td>\n" +
+  "        </tr>\n" +
+  "        <tr>\n" +
+  "          <td class=\"gcli-af-error\" colspan=\"2\">\n" +
+  "            ${linkMessageElement(assignment, __element)}\n" +
+  "          </td>\n" +
+  "        </tr>\n" +
+  "      </tbody>\n" +
+  "      <tfoot>\n" +
+  "        <tr>\n" +
+  "          <td colspan=\"3\" class=\"gcli-af-submit\">\n" +
+  "            <input type=\"submit\" value=\"Cancel\" onclick=\"${onFormCancel}\"/>\n" +
+  "            <input type=\"submit\" value=\"OK\" onclick=\"${onFormOk}\" save=\"${okElement}\"/>\n" +
+  "          </td>\n" +
+  "        </tr>\n" +
+  "      </tfoot>\n" +
+  "    </table>\n" +
+  "  </div>\n" +
+  "</div>\n" +
   "");
 
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
--- a/browser/devtools/webconsole/test/browser/Makefile.in
+++ b/browser/devtools/webconsole/test/browser/Makefile.in
@@ -145,16 +145,17 @@ include $(topsrcdir)/config/rules.mk
 	browser_webconsole_bug_659907_console_dir.js \
 	browser_webconsole_bug_678816.js \
 	browser_webconsole_bug_664131_console_group.js \
 	browser_gcli_inspect.js \
 	browser_gcli_integrate.js \
 	browser_gcli_require.js \
 	browser_gcli_web.js \
 	browser_webconsole_bug_658368_time_methods.js \
+	browser_webconsole_bug_622303_persistent_filters.js \
 	head.js \
 	$(NULL)
 
 _BROWSER_TEST_PAGES = \
 	test-console.html \
 	test-network.html \
 	test-network-request.html \
 	test-mutation.html \
--- a/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
+++ b/browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
@@ -31,16 +31,17 @@ function onLoad() {
     openConsole();
 
     testCreateCommands();
     testCallCommands();
     testRemoveCommands();
   }
   catch (ex) {
     gcli._internal.console.error('Test Failure', ex);
+    ok(false, '' + ex);
   }
   finally {
     closeConsole();
     finishTest();
   }
 }
 
 let tselarr = {
@@ -77,17 +78,17 @@ function testCallCommands() {
 
   // Test unsuccessful auto-completion
   gcliterm.inputNode.value = "ec";
   gcliterm.inputNode.focus();
   EventUtils.synthesizeKey("d", {});
   is(gcliterm.completeNode.textContent, " ecd", "Completion for \"ecd\"");
 
   // Test a normal command's life cycle
-  gcliterm.opts.inputter.setInput("echo hello world");
+  gcliterm.opts.display.inputter.setInput("echo hello world");
   gcliterm.opts.requisition.exec();
 
   let nodes = hud.outputNode.querySelectorAll("description");
 
   is(nodes.length, 2, "Right number of output nodes");
   ok(/hello world/.test(nodes[0].textContent), "the command's output is correct.");
 
   gcliterm.clearOutput();
--- a/browser/devtools/webconsole/test/browser/browser_gcli_web.js
+++ b/browser/devtools/webconsole/test/browser/browser_gcli_web.js
@@ -908,17 +908,17 @@ function update(input) {
   if (debug) {
     console.log('####### TEST: typed="' + input.typed +
         '" cur=' + input.cursor.start +
         ' cli=', requ);
   }
 
   status = requ.getStatus();
   assignC = requ.getAssignmentAt(input.cursor.start);
-  statuses = requ.getInputStatusMarkup().map(function(s) {
+  statuses = requ.getInputStatusMarkup(input.cursor.start).map(function(s) {
     return s.toString()[0];
   }).join('');
 
   if (requ.commandAssignment.getValue()) {
     assign1 = requ.getAssignment(0);
     assign2 = requ.getAssignment(1);
   }
   else {
@@ -1426,17 +1426,17 @@ function input(typed) {
 
   if (debug) {
     console.log('####### TEST: typed="' + typed +
         '" cur=' + cursor.start +
         ' cli=', requ);
   }
 
   status = requ.getStatus();
-  statuses = requ.getInputStatusMarkup().map(function(s) {
+  statuses = requ.getInputStatusMarkup(input.cursor.start).map(function(s) {
     return s.toString()[0];
   }).join('');
 
   if (requ.commandAssignment.getValue()) {
     assign = requ.getAssignment(0);
   }
   else {
     assign = undefined;
@@ -1583,16 +1583,17 @@ function onLoad() {
 
   try {
     openConsole();
     define.globalDomain.require("gclitest/index");
   }
   catch (ex) {
     failed = ex;
     console.error('Test Failure', ex);
+    ok(false, '' + ex);
   }
   finally {
     closeConsole();
     finish();
   }
 
   if (failed) {
     throw failed;
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_589162_css_filter.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_589162_css_filter.js
@@ -22,25 +22,24 @@ function onContentLoaded()
 
   let msg = "the unknown CSS property warning is displayed";
   testLogEntry(outputNode, "foobarCssParser", msg, true);
 
   HUDService.setFilterState(hudId, "cssparser", false);
 
   executeSoon(
     function (){
-      HUDService.setFilterState(hudId, "cssparser", false);
-
       let msg = "the unknown CSS property warning is not displayed, " +
                 "after filtering";
       testLogEntry(outputNode, "foobarCssParser", msg, true, true);
+
+      HUDService.setFilterState(hudId, "cssparser", true);
+      finishTest();
     }
   );
-
-  finishTest();
 }
 
 /**
  * Unit test for bug 589162:
  * CSS filtering on the console does not work
  */
 function test()
 {
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597460_filter_scroll.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_597460_filter_scroll.js
@@ -49,16 +49,19 @@ function tabReload(aEvent) {
   ok(scrollBox.scrollTop > 0, "scroll location is not at the top");
 
   // Make sure the Web Console output is scrolled as near as possible to the
   // bottom.
   let nodeHeight = hud.outputNode.querySelector(".hud-log").clientHeight;
   ok(scrollBox.scrollTop >= scrollBox.scrollHeight - scrollBox.clientHeight -
      nodeHeight * 2, "scroll location is correct");
 
+  HUDService.setFilterState(hud.hudId, "network", true);
+  HUDService.setFilterState(hud.hudId, "networkinfo", true);
+
   executeSoon(finishTest);
 }
 
 function test() {
   addTab(TEST_URI);
   browser.addEventListener("load", tabLoad, true);
 }
 
--- a/browser/devtools/webconsole/test/browser/browser_webconsole_bug_601667_filter_buttons.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_601667_filter_buttons.js
@@ -16,17 +16,17 @@ function testFilterButtons() {
 
   let hud = HUDService.getHudByWindow(content);
   hudId = hud.hudId;
   hudBox = hud.HUDBox;
 
   testMenuFilterButton("net");
   testMenuFilterButton("css");
   testMenuFilterButton("js");
-  testMenuFilterButton("webdev");
+  testMenuFilterButton("logging");
 
   finishTest();
 }
 
 function testMenuFilterButton(aCategory) {
   let selector = ".webconsole-filter-button[category=\"" + aCategory + "\"]";
   let button = hudBox.querySelector(selector);
   ok(button, "we have the \"" + aCategory + "\" button");
@@ -54,67 +54,78 @@ function testMenuFilterButton(aCategory)
        aCategory + " is checked after clicking it");
     ok(HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
        "on after clicking the appropriate menu item");
     menuItem = menuItem.nextSibling;
   }
   ok(isChecked(button), "the button for category " + aCategory + " is " +
      "checked after turning on all its menu items");
 
-  // Turn one filter off; make sure the button is no longer checked.
+  // Turn one filter off; make sure the button is still checked.
   prefKey = firstMenuItem.getAttribute("prefKey");
   chooseMenuItem(firstMenuItem);
   ok(!isChecked(firstMenuItem), "the first menu item for category " +
      aCategory + " is no longer checked after clicking it");
   ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
      "turned off after clicking the appropriate menu item");
-  ok(!isChecked(button), "the button for category " + aCategory + " is no " +
-     "longer checked after turning off its first menu item");
+  ok(isChecked(button), "the button for category " + aCategory + " is still " +
+     "checked after turning off its first menu item");
 
-  // Turn all the filters on by clicking the main part of the button.
+  // Turn all the filters off by clicking the main part of the button.
   let anonymousNodes = document.getAnonymousNodes(button);
   let subbutton;
   for (let i = 0; i < anonymousNodes.length; i++) {
     let node = anonymousNodes[i];
     if (node.classList.contains("toolbarbutton-menubutton-button")) {
       subbutton = node;
       break;
     }
   }
   ok(subbutton, "we have the subbutton for category " + aCategory);
 
   clickButton(subbutton);
+  ok(!isChecked(button), "the button for category " + aCategory + " is " +
+     "no longer checked after clicking its main part");
+
+  menuItem = firstMenuItem;
+  while (menuItem) {
+    let prefKey = menuItem.getAttribute("prefKey");
+    ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
+       aCategory + " is no longer checked after clicking the button");
+    ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
+       "off after clicking the button");
+    menuItem = menuItem.nextSibling;
+  }
+
+  // Turn all the filters on by clicking the main part of the button.
+  clickButton(subbutton);
+
   ok(isChecked(button), "the button for category " + aCategory + " is " +
      "checked after clicking its main part");
 
   menuItem = firstMenuItem;
   while (menuItem) {
     let prefKey = menuItem.getAttribute("prefKey");
     ok(isChecked(menuItem), "menu item " + prefKey + " for category " +
        aCategory + " is checked after clicking the button");
     ok(HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
        "on after clicking the button");
-    menuItem = menuItem.nextSibling; 
+    menuItem = menuItem.nextSibling;
   }
 
-  // Turn all the filters off by clicking the main part of the button.
-  clickButton(subbutton);
-  ok(!isChecked(subbutton), "the button for category " + aCategory + " is " +
-     "no longer checked after clicking it");
-
+  // Uncheck the main button by unchecking all the filters
   menuItem = firstMenuItem;
   while (menuItem) {
-    let prefKey = menuItem.getAttribute("prefKey");
-    ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
-       aCategory + " is no longer checked after clicking the button");
-    ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
-       "off after clicking the button");
+    chooseMenuItem(menuItem);
     menuItem = menuItem.nextSibling;
   }
 
+  ok(!isChecked(button), "the button for category " + aCategory + " is " +
+     "unchecked after unchecking all its filters");
+
   // Turn all the filters on again by clicking the button.
   clickButton(subbutton);
 }
 
 function clickButton(aNode) {
   EventUtils.sendMouseEvent({ type: "click" }, aNode);
 }
 
new file mode 100644
--- /dev/null
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_bug_622303_persistent_filters.js
@@ -0,0 +1,59 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  let prefService = Services.prefs;
+  let prefs = [
+    "network",
+    "networkinfo",
+    "csserror",
+    "cssparser",
+    "exception",
+    "jswarn",
+    "error",
+    "warn",
+    "info",
+    "log"
+  ];
+
+  //Set all prefs to true
+  prefs.forEach(function(pref) {
+    prefService.setBoolPref("devtools.webconsole.filter." + pref, true);
+  });
+
+  addTab("about:blank");
+  openConsole();
+  
+  let hud = HUDService.getHudByWindow(content);
+  let hudId = HUDService.getHudIdByWindow(content);
+
+  //Check if the filters menuitems exists and is checked
+  prefs.forEach(function(pref) {
+    let checked = hud.HUDBox.querySelector("menuitem[prefKey=" + pref + "]").
+      getAttribute("checked");
+    is(checked, "true", "menuitem for " + pref + " exists and is checked");
+  });
+  
+  //Set all prefs to false
+  prefs.forEach(function(pref) {
+    HUDService.setFilterState(hudId, pref, false);
+  });
+
+  //Re-init the console
+  closeConsole();
+  openConsole();
+
+  hud = HUDService.getHudByWindow(content);
+  
+  //Check if filters menuitems exists and are unchecked
+  prefs.forEach(function(pref) {
+    let checked = hud.HUDBox.querySelector("menuitem[prefKey=" + pref + "]").
+      getAttribute("checked");
+    is(checked, "false", "menuitem for " + pref + " exists and is not checked");
+    prefService.clearUserPref("devtools.webconsole.filter." + pref);
+  });
+  
+  gBrowser.removeCurrentTab();
+  
+  finish();
+}
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -143,16 +143,17 @@
 @BINPATH@/components/dom_geolocation.xpt
 @BINPATH@/components/dom_notification.xpt
 @BINPATH@/components/dom_html.xpt
 @BINPATH@/components/dom_indexeddb.xpt
 @BINPATH@/components/dom_offline.xpt
 @BINPATH@/components/dom_json.xpt
 @BINPATH@/components/dom_range.xpt
 @BINPATH@/components/dom_sidebar.xpt
+@BINPATH@/components/dom_sms.xpt
 @BINPATH@/components/dom_storage.xpt
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_threads.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_xbl.xpt
 @BINPATH@/components/dom_xpath.xpt
 @BINPATH@/components/dom_xul.xpt
 @BINPATH@/components/dom_loadsave.xpt
@@ -351,16 +352,18 @@
 @BINPATH@/components/satchel.manifest
 @BINPATH@/components/nsFormAutoComplete.js
 @BINPATH@/components/nsFormHistory.js
 @BINPATH@/components/nsInputListAutoComplete.js
 @BINPATH@/components/contentSecurityPolicy.manifest
 @BINPATH@/components/contentSecurityPolicy.js
 @BINPATH@/components/contentAreaDropListener.manifest
 @BINPATH@/components/contentAreaDropListener.js
+@BINPATH@/components/BrowserProfileMigrators.manifest
+@BINPATH@/components/ChromeProfileMigrator.js
 #ifdef XP_MACOSX
 @BINPATH@/components/libalerts_s.dylib
 #endif
 #ifdef MOZ_ENABLE_DBUS
 @BINPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@
 #endif
 @BINPATH@/components/nsINIProcessor.manifest
 @BINPATH@/components/nsINIProcessor.js
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -9,16 +9,17 @@
 @DLL_PREFIX@xpcom_compat@DLL_SUFFIX@
 @DLL_PREFIX@xpistub@DLL_SUFFIX@
 @DLL_PREFIX@zlib@DLL_SUFFIX@
 @DLL_PREFIX@jemalloc@DLL_SUFFIX@
 #ifdef MOZ_STATIC_JS
 @DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 LICENSE
+update.locale
 browserconfig.properties
 chrome/US.jar
 chrome/app-chrome.manifest
 chrome/browser.manifest
 chrome/chrome.rdf
 chrome/chromelist.txt
 chrome/classic.jar
 chrome/classic.manifest
@@ -308,16 +309,17 @@ searchplugins/answers.png
 searchplugins/answers.src
 searchplugins/answers.src
 searchplugins/atlas-sk.gif
 searchplugins/atlas-sk.png
 searchplugins/atlas-sk.src
 searchplugins/baidu.gif
 searchplugins/baidu.png
 searchplugins/baidu.src
+searchplugins/bluu.xml
 searchplugins/bok-NO.gif
 searchplugins/bok-NO.png
 searchplugins/bok-NO.src
 searchplugins/bolcom-nl.gif
 searchplugins/bolcom-nl.png
 searchplugins/bolcom-nl.src
 searchplugins/bookplus-fi.gif
 searchplugins/bookplus-fi.png
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -424,32 +424,44 @@ can reach it easily. -->
 <!ENTITY copyAudioURLCmd.label        "Copy Audio Location">
 <!ENTITY copyAudioURLCmd.accesskey    "o">
 <!ENTITY copyEmailCmd.label           "Copy Email Address">
 <!ENTITY copyEmailCmd.accesskey       "E">
 <!ENTITY thisFrameMenu.label              "This Frame">
 <!ENTITY thisFrameMenu.accesskey          "h">
 
 <!-- Media (video/audio) controls -->
+<!-- LOCALIZATION NOTE: The access keys for "Play" and
+"Pause" are the same because the two context-menu
+items are mutually exclusive. -->
 <!ENTITY mediaPlay.label             "Play">
 <!ENTITY mediaPlay.accesskey         "P">
 <!ENTITY mediaPause.label            "Pause">
 <!ENTITY mediaPause.accesskey        "P">
+<!-- LOCALIZATION NOTE: The access keys for "Mute" and
+"Unmute" are the same because the two context-menu
+items are mutually exclusive. -->
 <!ENTITY mediaMute.label             "Mute">
 <!ENTITY mediaMute.accesskey         "M">
 <!ENTITY mediaUnmute.label           "Unmute">
 <!ENTITY mediaUnmute.accesskey       "m">
+<!-- LOCALIZATION NOTE: The access keys for "Show Controls" and
+"Hide Controls" are the same because the two context-menu
+items are mutually exclusive. -->
 <!ENTITY mediaShowControls.label     "Show Controls">
 <!ENTITY mediaShowControls.accesskey "C">
 <!ENTITY mediaHideControls.label     "Hide Controls">
 <!ENTITY mediaHideControls.accesskey "C">
 <!ENTITY videoFullScreen.label       "Full Screen">
 <!ENTITY videoFullScreen.accesskey   "F">
 <!ENTITY videoSaveImage.label        "Save Snapshot As…">
 <!ENTITY videoSaveImage.accesskey    "S">
+<!-- LOCALIZATION NOTE: The access keys for "Show Statistics" and
+"Hide Statistics" are the same because the two context-menu
+items are mutually exclusive. -->
 <!ENTITY videoShowStats.label        "Show Statistics">
 <!ENTITY videoShowStats.accesskey    "t">
 <!ENTITY videoHideStats.label        "Hide Statistics">
 <!ENTITY videoHideStats.accesskey    "t">
 
 <!-- LOCALIZATION NOTE :
 fullZoomEnlargeCmd.commandkey3, fullZoomReduceCmd.commandkey2 and
 fullZoomResetCmd.commandkey2 are alternative acceleration keys for zoom.
--- a/browser/locales/en-US/chrome/browser/devtools/gcli.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/gcli.properties
@@ -15,17 +15,17 @@ canonDescNone=(No description)
 # of JavaScript like traditional developer tool command lines. This describes
 # the '{' command.
 cliEvalJavascript=Enter JavaScript directly
 
 # LOCALIZATION NOTE (fieldSelectionSelect): When a command has a parameter
 # that has a number of pre-defined options the user interface presents these
 # in a drop-down menu, where the first 'option' is an indicator that a
 # selection should be made. This string describes that first option.
-fieldSelectionSelect=Select a %S ...
+fieldSelectionSelect=Select a %S …
 
 # LOCALIZATION NOTE (fieldArrayAdd): When a command has a parameter that can
 # be repeated a number of times (e.g. like the 'cat a.txt b.txt' command) the
 # user interface presents buttons to add and remove arguments. This string is
 # used to add arguments.
 fieldArrayAdd=Add
 
 # LOCALIZATION NOTE (fieldArrayDel): When a command has a parameter that can
--- a/browser/locales/en-US/chrome/browser/devtools/inspector.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/inspector.properties
@@ -1,8 +1,17 @@
+# LOCALIZATION NOTE These strings are used inside the Inspector
+# which is available from the Web Developer sub-menu -> 'Inspect'.
+#
+# The correct localization of this file might be to keep it in
+# English, or another language commonly spoken among web developers.
+# You want to make that choice consistent across the developer tools.
+# A good criteria is the language in which you'd find the best
+# documentation on web development on the web.
+
 # LOCALIZATION NOTE (confirmNavigationAway): Used in the Inspector tool, when
 # the user tries to navigate away from a web page, to confirm the change of
 # page.
 confirmNavigationAway.message=Leaving this page will close the Inspector and the changes you have made will be lost.
 confirmNavigationAway.buttonLeave=Leave Page
 confirmNavigationAway.buttonLeaveAccesskey=L
 confirmNavigationAway.buttonStay=Stay on Page
 confirmNavigationAway.buttonStayAccesskey=S
--- a/browser/locales/en-US/chrome/browser/devtools/scratchpad.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/scratchpad.dtd
@@ -1,11 +1,17 @@
 <!-- LOCALIZATION NOTE : FILE This file contains the Scratchpad window strings -->
 <!-- LOCALIZATION NOTE : FILE Do not translate commandkeys -->
 
+<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
+  - keep it in English, or another language commonly spoken among web developers.
+  - You want to make that choice consistent across the developer tools.
+  - A good criteria is the language in which you'd find the best
+  - documentation on web development on the web. -->
+
 <!-- LOCALIZATION NOTE (scratchpad.title):
   -  The Scratchpad is intended to provide a simple text editor for creating
   -  and evaluating bits of JavaScript code for the purposes of function
   -  prototyping, experimentation and convenient scripting.
   -
   -  It's quite possible that you won't have a good analogue for the word
   -  "Scratchpad" in your locale. You should feel free to find a close
   -  approximation to it or choose a word (or words) that means
--- a/browser/locales/en-US/chrome/browser/devtools/scratchpad.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/scratchpad.properties
@@ -1,8 +1,17 @@
+# LOCALIZATION NOTE These strings are used inside the JavaScript scratchpad
+# which is available from the Web Developer sub-menu -> 'Scratchpad'.
+#
+# The correct localization of this file might be to keep it in
+# English, or another language commonly spoken among web developers.
+# You want to make that choice consistent across the developer tools.
+# A good criteria is the language in which you'd find the best
+# documentation on web development on the web.
+
 # LOCALIZATION NOTE  (propertyPanel.updateButton.label): Used in the Property
 # Panel that is opened by the Scratchpad window when inspecting an object. This
 # is the Update button label.
 propertyPanel.updateButton.label=Update
 propertyPanel.updateButton.accesskey=U
 
 # LOCALIZATION NOTE  (export.fileOverwriteConfirmation): This is displayed when
 # the user attempts to save to an already existing file.
@@ -24,16 +33,24 @@ openFile.failed=Failed to read the file.
 # LOCALIZATION NOTE  (saveFileAs): This is the file picker title, when you save
 # a file in Scratchpad.
 saveFileAs=Save File As
 
 # LOCALIZATION NOTE  (saveFile.failed): This is the message displayed when file
 # save fails.
 saveFile.failed=The file save operation failed.
 
+# LOCALIZATION NOTE  (confirmClose): This is message in the prompt dialog when
+# you try to close a scratchpad with unsaved changes.
+confirmClose=Do you want to save the changes you made to this scratchpad?
+
+# LOCALIZATION NOTE  (confirmClose.title): This is title of the prompt dialog when
+# you try to close a scratchpad with unsaved changes.
+confirmClose.title=Unsaved Changes
+
 # LOCALIZATION NOTE  (scratchpadIntro): This is a multi-line comment explaining
 # how to use the Scratchpad. Note that this should be a valid JavaScript
 # comment inside /* and */.
 scratchpadIntro=/*\n * This is a JavaScript Scratchpad.\n *\n * Enter some JavaScript, then Right Click or choose from the Execute Menu:\n * 1. Run to evaluate the selected text,\n * 2. Inspect to bring up an Object Inspector on the result, or,\n * 3. Display to insert the result in a comment after the selection.\n */\n\n
 
 # LOCALIZATION NOTE  (notification.browserContext): This is the message displayed
 # over the top of the editor when the user has switched to browser context.
 browserContext.notification=This scratchpad executes in the Browser context.
--- a/browser/locales/en-US/chrome/browser/devtools/styleinspector.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/styleinspector.dtd
@@ -1,8 +1,14 @@
+<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
+  - keep it in English, or another language commonly spoken among web developers.
+  - You want to make that choice consistent across the developer tools.
+  - A good criteria is the language in which you'd find the best
+  - documentation on web development on the web. -->
+
 <!-- LOCALIZATION NOTE (userStylesLabel): This is the label for the checkbox
   -  that specifies whether the styles that are not from the user's stylesheet
   -  should be displayed or not. -->
 <!ENTITY userStylesLabel    "Only user styles">
 
 <!-- LOCALIZATION NOTE (userStylesSearch): This is the placeholder that goes in
   -  the search box when no search term has been entered. -->
 <!ENTITY userStylesSearch      "Search">
--- a/browser/locales/en-US/chrome/browser/devtools/styleinspector.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/styleinspector.properties
@@ -1,9 +1,16 @@
 # LOCALIZATION NOTE These strings are used inside the Style Inspector.
+#
+# The correct localization of this file might be to keep it in
+# English, or another language commonly spoken among web developers.
+# You want to make that choice consistent across the developer tools.
+# A good criteria is the language in which you'd find the best
+# documentation on web development on the web.
+
 
 # LOCALIZATION NOTE (panelTitle): This is the panel title
 panelTitle=Style Inspector
 
 # LOCALIZATION NOTE (rule.status): For each style property the panel shows
 # the rules which hold that specific property. For every rule, the rule status
 # is also displayed: a rule can be the best match, a match, a parent match, or a
 # rule did not match the element the user has highlighted.
--- a/browser/locales/en-US/chrome/browser/devtools/webConsole.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/webConsole.dtd
@@ -1,8 +1,14 @@
+<!-- LOCALIZATION NOTE : FILE The correct localization of this file might be to
+  - keep it in English, or another language commonly spoken among web developers.
+  - You want to make that choice consistent across the developer tools.
+  - A good criteria is the language in which you'd find the best
+  - documentation on web development on the web. -->
+
 <!ENTITY networkPanel.requestURL                  "Request URL">
 <!ENTITY networkPanel.requestMethod               "Request Method">
 <!ENTITY networkPanel.statusCode                  "Status Code">
 
 <!ENTITY networkPanel.requestHeaders              "Request Headers">
 <!ENTITY networkPanel.requestCookie               "Sent Cookie">
 <!ENTITY networkPanel.requestBody                 "Request Body">
 <!ENTITY networkPanel.requestFormData             "Sent Form Data">
--- a/browser/locales/en-US/chrome/browser/devtools/webconsole.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/webconsole.properties
@@ -1,8 +1,15 @@
+# LOCALIZATION NOTE
+# The correct localization of this file might be to keep it in
+# English, or another language commonly spoken among web developers.
+# You want to make that choice consistent across the developer tools.
+# A good criteria is the language in which you'd find the best
+# documentation on web development on the web.
+
 typeError=Error: 
 typeWarning=Warning: 
 typeNetwork=Network: 
 typeException=Exception:  
 typeCssParser=CSS Parser: 
 typeStrict=Strict Warning: 
 msgCategory=Category: 
 errLine=Line: %S
@@ -13,29 +20,27 @@ categoryConsole=Console:
 btnMutation=DOM Mutation
 tipMutation=Toggle DOM Mutation event logging
 btnPageNet=Net
 tipPageNet=Log network access
 btnPageCSS=CSS
 tipPageCSS=Log CSS parsing errors
 btnPageJS=JS
 tipPageJS=Log JavaScript exceptions
-# LOCALIZATION NOTE (btnPageWebDeveloper):
+# LOCALIZATION NOTE (btnPageLogging):
 #
-# This is used as the text of the "Web Developer" button on the toolbar. It
+# This is used as the text of the "Logging" button on the toolbar. It
 # shows or hides messages that the web developer inserted on the page for
-# debugging purposes, using calls such console.log() and console.error(). You
-# may wish to localize this as "Page" if that is clearer in your locale. See
-# bug 601667 for more information.
-btnPageWebDeveloper=Web Developer
-# LOCALIZATION NOTE (tipPageWebDeveloper):
+# debugging purposes, using calls such console.log() and console.error().
+btnPageLogging=Logging
+# LOCALIZATION NOTE (tipPageLogging):
 #
-# This is used as the text of the tool tip for the "Web Developer" button on
+# This is used as the text of the tool tip for the "Logging" button on
 # the toolbar.
-tipPageWebDeveloper=Log messages sent to the "console" object
+tipPageLogging=Log messages sent to the "console" object
 btnConsoleErrors=Errors
 tipConsoleErrors=Log calls to console.error()
 btnConsoleInfo=Info
 tipConsoleInfo=Log calls to console.info()
 btnConsoleWarnings=Warnings
 tipConsoleWarnings=Log calls to console.warn()
 btnConsoleLog=Log
 tipConsoleLog=Log calls to console.log()
--- a/browser/locales/en-US/chrome/browser/migration/migration.dtd
+++ b/browser/locales/en-US/chrome/browser/migration/migration.dtd
@@ -10,16 +10,18 @@
 <!ENTITY importFromNothing.label        "Don't import anything">
 <!ENTITY importFromNothing.accesskey    "D">
 <!ENTITY importFromSeamonkey.label      "Netscape 6, 7 or Mozilla 1.x">
 <!ENTITY importFromSeamonkey.accesskey  "N">
 <!ENTITY importFromOpera.label          "Opera">
 <!ENTITY importFromOpera.accesskey      "O">
 <!ENTITY importFromSafari.label         "Safari">
 <!ENTITY importFromSafari.accesskey     "S">
+<!ENTITY importFromChrome.label         "Chrome">
+<!ENTITY importFromChrome.accesskey     "C">
 <!ENTITY importFromHTMLFile.label       "From an HTML File">
 <!ENTITY importFromHTMLFile.accesskey   "F">
 
 <!ENTITY noMigrationSources.label       "No programs that contain bookmarks, history or password data could be found.">
 
 <!ENTITY importSource.title             "Import Settings and Data">
 <!ENTITY importItems.title              "Items to Import">
 <!ENTITY importItems.label              "Select which items to import:">
--- a/browser/locales/en-US/chrome/browser/migration/migration.properties
+++ b/browser/locales/en-US/chrome/browser/migration/migration.properties
@@ -1,54 +1,62 @@
 profileName_format=%S %S
 
 # Browser Specific
 sourceNameIE=Internet Explorer
 sourceNameSeamonkey=Netscape 6/7/Mozilla
 sourceNameOpera=Opera
 sourceNameSafari=Safari
+sourceNameChrome=Google Chrome
 
 importedBookmarksFolder=From %S
 importedSearchURLsFolder=Keyword Searches (From %S)
 importedSearchURLsTitle=Search on %S
 importedSearchUrlDesc=Type "%S <search query>" in the Location Bar to perform a search on %S.
 
 importedSeamonkeyBookmarksTitle=From Netscape 6/7/Mozilla
 importedSafariBookmarks=From Safari
 importedOperaHotlistTitle=From Opera
 importedOperaSearchUrls=Keyword Searches (From Opera)
 
 # Import Sources
 1_ie=Internet Options
 1_opera=Preferences
 1_seamonkey=Preferences
 1_safari=Preferences
+1_chrome=Preferences
 
 2_ie=Cookies
 2_opera=Cookies
 2_seamonkey=Cookies
 2_safari=Cookies
+2_chrome=Cookies
 
 4_ie=Browsing History
 4_opera=Browsing History
 4_seamonkey=Browsing History
 4_safari=Browsing History
+4_chrome=Browsing History
 
 8_ie=Saved Form History
 8_opera=Saved Form History
 8_seamonkey=Saved Form History
 8_safari=Saved Form History
+8_chrome=Saved Form History
 
 16_ie=Saved Passwords
 16_opera=Saved Passwords
 16_seamonkey=Saved Passwords
 16_safari=Saved Passwords
+16_chrome=Saved Passwords
 
 32_ie=Favorites
 32_opera=Bookmarks
 32_seamonkey=Bookmarks
 32_safari=Bookmarks
+32_chrome=Bookmarks
 
 64_ie=Other Data
 64_opera=Other Data
 64_seamonkey=Other Data
 64_safari=Other Data
+64_chrome=Other Data
 
--- a/browser/themes/gnomestripe/browser.css
+++ b/browser/themes/gnomestripe/browser.css
@@ -217,17 +217,17 @@ menuitem.bookmark-item {
   list-style-image: url("chrome://browser/skin/places/livemark-item.png");
 }
 
 .bookmark-item[container][query] {
   list-style-image: url("chrome://browser/skin/places/query.png");
 }
 
 .bookmark-item[query][tagContainer] {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
 }
 
 .bookmark-item[query][dayContainer] {
   list-style-image: url("chrome://browser/skin/places/calendar.png");
 }
 
 .bookmark-item[query][hostContainer] {
   list-style-image: url("moz-icon://stock/gtk-directory?size=menu");
--- a/browser/themes/gnomestripe/devtools/gcli.css
+++ b/browser/themes/gnomestripe/devtools/gcli.css
@@ -31,211 +31,256 @@
  * 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 ***** */
 
 /* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
+
+/* Bug 678152 calls for UX review which will fix the color names */
+
 .gcliterm-input-node,
 .gcliterm-complete-node {
   border: none;
   -moz-appearance: none;
   height: 100%;
   vertical-align: middle;
   background-color: transparent;
   font: 12px Consolas, "Lucida Console", monospace;
-  padding: 2px 0 0 16px;
+}
+
+.gcliterm-input-node {
+  padding-top: 2px;
+  padding-bottom: 0;
+  -moz-padding-start: 16px;
+  -moz-padding-end: 0;
 }
 
 .gcliterm-complete-node {
   color: #FFF;
-  padding: 4px 4px 2px 21px;
+  padding-top: 4px;
+  padding-bottom: 2px;
+  -moz-padding-start: 21px;
+  -moz-padding-end: 4px;
 }
 
-.gcliVALID {
+.gcli-in-valid {
   border-bottom: none;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   color: #DDD;
   border-bottom: 1px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   color: #DDD;
   border-bottom: 1px dotted #F00;
 }
 
-.gcliCompl {
+.gcli-in-ontab {
   color: #999;
 }
 
 .gcliterm-stack-node {
   background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
   width: 100%;
 }
 
+.gcliterm-argfetcher {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
 .gcliterm-hint-node {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-bottom: 0px !important;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid #FFF;
+  border-left: 1px solid threedshadow;
+  border-right: 1px solid threedshadow;
   border-top-right-radius: 5px;
   border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
-  overflow: auto;
-  padding: 10px;
+  margin-bottom: -1px;
 }
 
 .gcliterm-hint-parent {
-  border-bottom: 1px solid #AAA;
+  width: 300px;
+  padding: 10px 10px 0;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid threedshadow;
 }
 
-.gcliCmdHelpRight {
+.gcli-help-right {
   text-align: right;
 }
 
+.gcliterm-menu {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
+.gcliterm-hint-nospace {
+  display: none;
+}
+
+/*
+ * The language of a console is not en_US or any other common language
+ * (i.e we don't attempt to translate 'console.log(x)')
+ * So we fix .gcliterm-input-node/.gcliterm-complete-node elements to be ltr.
+ * As a result we also want the hints to pop up on the left (above the prompt)
+ */
+.gcliterm-input-node,
+.gcliterm-complete-node,
+.gcliterm-display {
+  direction: ltr;
+}
+
+/*
+ * We want the stuff under .gcliterm-display to obey normal direction rules
+ * so we need to swap back when the document is in rtl mode.
+ * The selectors below are faster, but equivalent to:
+ * .gcliterm-display > *:-moz-locale-dir(rtl) {
+ *   direction: rtl;
+ * }
+ * In non-performance critical situations the above is preferred due to it's
+ * greater resilience to refactoring
+ */
+.gcliterm-hint-parent:-moz-locale-dir(rtl),
+.hud-output-node:-moz-locale-dir(rtl) {
+  direction: rtl;
+}
+
+/* From: $GCLI/mozilla/gcli/ui/gcliterm-gnomestripe.css */
+
 /* From: $GCLI/lib/gcli/ui/arg_fetch.css */
-.gcliCmdDesc {
+
+.gcli-argfetch {
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
+}
+
+.gcli-af-cmddesc {
   font-weight: bold;
   text-align: center;
   margin-bottom: 5px;
-  border-bottom: 1px solid #ddd;
-  padding-bottom: 3px;
+  padding: 3px 10px 0;
 }
 
-.gcliParamGroup {
-  font-weight: bold;
+.gcli-af-params {
+  padding: 0 10px;
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
 }
 
-.gcliParamName {
+.gcli-af-paramname {
   text-align: right;
   font-size: 90%;
 }
 
-.gcliParamError {
+.gcli-af-required {
+  font-size: 90%;
+  color: #f66;
+  padding-left: 5px;
+}
+
+.gcli-af-error {
   font-size: 80%;
   color: #900;
 }
 
-.gcliParamSubmit {
+.gcli-af-submit {
   text-align: right;
 }
 
-.gcliGroupSymbol {
-  font-size: 90%;
-  color: #666;
-}
-
-.gcliRequired {
-  font-size: 80%;
-  color: #666;
-}
-
-.gcliParams {
+.gcli-field {
   width: 100%;
 }
 
-/* From: $GCLI/lib/gcli/ui/hinter.css */
-.gcliHintParent {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-top-right-radius: 5px;
-  border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
+/* From: $GCLI/lib/gcli/ui/menu.css */
+
+.gcli-menu {
+  width: 100%;
   overflow: hidden;
 }
 
-.gcliHints {
-  overflow: auto;
-  padding: 10px;
-  display: inline-block;
+.gcli-menu-field {
+  border: 1px solid #aaa;
+  border-top: 0;
+  border-bottom-right-radius: 5px;
+  border-bottom-left-radius: 5px;
+  max-height: 300px;
+  margin: 0 3px;
+  padding: 0;
 }
 
-.gcliHints ul {
-  margin: 0;
-  padding: 0 15px;
+.gcli-menu-template {
+  border-collapse: collapse;
+  width: 100%;
+  margin: 10px 0;
 }
 
-/* From: $GCLI/lib/gcli/ui/menu.css */
-.gcliOption {
+.gcli-menu-option {
   overflow: hidden;
   white-space: nowrap;
   cursor: pointer;
   padding: 2px;
 }
 
-.gcliOption:hover {
+.gcli-menu-option:hover {
   background-color: rgb(230, 230, 230);
 }
 
-.gcliOptionName {
-  padding-right: 5px;
+.gcli-menu-name {
+  padding-top: 0;
+  padding-bottom: 0;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
 }
 
-.gcliOptionDesc {
+.gcli-menu-desc {
   font-size: 80%;
   color: #999;
 }
 
-.gcliMenuError {
+.gcli-menu-error {
   overflow: hidden;
   white-space: nowrap;
-  padding: 8px 2px 2px 2px;
+  padding-top: 8px;
+  padding-bottom: 2px;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
   font-size: 80%;
   color: red;
 }
 
-.gcliMenuField {
-  background-color: white;
-  color: black;
-  border: 1px solid #aaa;
-  padding: 2px;
-  max-height: 300px;
-  overflow-y: auto;
-  max-width: 220px;
-  overflow-x: hidden;
-  margin: 0px 10px;
-  border-top: 0px !important;
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-}
+/* From: $GCLI/lib/gcli/ui/inputter.css */
 
-/* From: $GCLI/lib/gcli/ui/inputter.css */
-.gcliCompletion {
+.gcli-in-complete {
   position: absolute;
   z-index: -1000;
-  background-color: #DDD;
   border: 1px transparent solid;
   padding: 1px 1px 1px 2px;
-}
-
-.gcliCompletion {
   color: #DDD;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   border-bottom: 2px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   border-bottom: 2px dotted #F00;
 }
 
-.gcliPrompt {
+.gcli-in-ontab {
+  color: #999;
+}
+
+.gcli-in-closebrace {
+  color: #999;
+}
+
+.gcli-prompt {
   color: #66F;
   font-weight: bold;
 }
-
-.gcliCompl {
-  color: #999;
-}
-
-.gcliCloseBrace {
-  color: #999;
-}
deleted file mode 100644
index a788fffb00e59e3fff6931ad34cbc12a59f34254..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index f8536a4e1f9301b9d1304e575d17214325f9652f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index a788fffb00e59e3fff6931ad34cbc12a59f34254..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index f8536a4e1f9301b9d1304e575d17214325f9652f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/gnomestripe/jar.mn
+++ b/browser/themes/gnomestripe/jar.mn
@@ -34,20 +34,20 @@ browser.jar:
   skin/classic/browser/Secure.png
   skin/classic/browser/Security-broken.png
   skin/classic/browser/setDesktopBackground.css
   skin/classic/browser/Toolbar.png
   skin/classic/browser/Toolbar-small.png
   skin/classic/browser/urlbar-arrow.png
   skin/classic/browser/feeds/feedIcon.png             (feeds/feedIcon.png)
   skin/classic/browser/feeds/feedIcon16.png           (feeds/feedIcon16.png)
-  skin/classic/browser/feeds/videoFeedIcon.png        (feeds/videoFeedIcon.png)
-  skin/classic/browser/feeds/videoFeedIcon16.png      (feeds/videoFeedIcon16.png)
-  skin/classic/browser/feeds/audioFeedIcon.png        (feeds/audioFeedIcon.png)
-  skin/classic/browser/feeds/audioFeedIcon16.png      (feeds/audioFeedIcon16.png)
+  skin/classic/browser/feeds/videoFeedIcon.png        (feeds/feedIcon.png)
+  skin/classic/browser/feeds/videoFeedIcon16.png      (feeds/feedIcon16.png)
+  skin/classic/browser/feeds/audioFeedIcon.png        (feeds/feedIcon.png)
+  skin/classic/browser/feeds/audioFeedIcon16.png      (feeds/feedIcon16.png)
   skin/classic/browser/feeds/subscribe.css            (feeds/subscribe.css)
   skin/classic/browser/feeds/subscribe-ui.css         (feeds/subscribe-ui.css)
   skin/classic/browser/places/bookmarksMenu.png       (places/bookmarksMenu.png)
   skin/classic/browser/places/bookmarksToolbar.png    (places/bookmarksToolbar.png)
   skin/classic/browser/places/calendar.png            (places/calendar.png)
 * skin/classic/browser/places/editBookmarkOverlay.css (places/editBookmarkOverlay.css)
   skin/classic/browser/places/livemark-item.png       (places/livemark-item.png)
   skin/classic/browser/places/pageStarred.png         (places/pageStarred.png)
--- a/browser/themes/gnomestripe/places/places.css
+++ b/browser/themes/gnomestripe/places/places.css
@@ -72,17 +72,17 @@ treechildren::-moz-tree-image(title, que
 
 treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
   list-style-image: url("chrome://browser/skin/places/downloads.png");
   -moz-image-region: auto;
 }
 
 treechildren::-moz-tree-image(title, query, tagContainer),
 treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
 }
 
 /* calendar icon for folders grouping items by date */
 treechildren::-moz-tree-image(title, query, dayContainer) {
   list-style-image: url("chrome://browser/skin/places/calendar.png");
 }
 
 treechildren::-moz-tree-image(title, query, hostContainer) {
--- a/browser/themes/pinstripe/browser.css
+++ b/browser/themes/pinstripe/browser.css
@@ -83,16 +83,27 @@
   border-top: 1px solid rgba(0,0,0,0.65);
 }
 
 #navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar) {
   -moz-box-align: center;
   padding: 2px 4px;
 }
 
+/* Because of -moz-box-align: center above, separators will be invisible unless
+   we set their min-height. See bug 583510 for more information. */
+toolbarseparator {
+  min-height: 22px;
+}
+
+/* We need more height when toolbar buttons show both icon and text. */
+toolbar[mode="full"] toolbarseparator {
+  min-height: 36px;
+}
+
 #nav-bar {
   padding-bottom: 4px !important;
 }
 
 #PersonalToolbar {
   -moz-appearance: none;
   margin-top: -2px; /* overlay the bottom border of the toolbar above us */
   padding-top: 1px !important;
@@ -226,17 +237,17 @@ toolbarbutton.bookmark-item > menupopup 
   list-style-image: url("chrome://browser/skin/page-livemarks.png");
 }
 
 .bookmark-item[query] {
   list-style-image: url("chrome://browser/skin/places/query.png");
 }
 
 .bookmark-item[query][tagContainer] {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
 }
 
 .bookmark-item[query][dayContainer] {
   list-style-image: url("chrome://browser/skin/places/history.png");
 }
 
 .bookmark-item[query][hostContainer] {
   list-style-image: url("chrome://global/skin/tree/folder.png");
@@ -1897,16 +1908,17 @@ toolbarbutton.chevron > .toolbarbutton-m
   box-shadow: @focusRingShadow@;
 }
 
 .tabbrowser-tab:not([selected="true"]):not(:hover):not(:-moz-lwtheme) {
   color: #222;
 }
 
 .tabbrowser-tab[selected="true"] {
+  color: #000;
   z-index: 1;
   position: relative;
 }
 
 .tabbrowser-tab:-moz-lwtheme {
   color: inherit;
   text-shadow: inherit;
 }
--- a/browser/themes/pinstripe/devtools/gcli.css
+++ b/browser/themes/pinstripe/devtools/gcli.css
@@ -31,211 +31,260 @@
  * 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 ***** */
 
 /* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
+
+/* Bug 678152 calls for UX review which will fix the color names */
+
 .gcliterm-input-node,
 .gcliterm-complete-node {
   border: none;
   -moz-appearance: none;
   height: 100%;
   vertical-align: middle;
   background-color: transparent;
   font: 12px Consolas, "Lucida Console", monospace;
-  padding: 2px 0 0 16px;
+}
+
+.gcliterm-input-node {
+  padding-top: 2px;
+  padding-bottom: 0;
+  -moz-padding-start: 16px;
+  -moz-padding-end: 0;
 }
 
 .gcliterm-complete-node {
   color: #FFF;
-  padding: 4px 4px 2px 21px;
+  padding-top: 4px;
+  padding-bottom: 2px;
+  -moz-padding-start: 21px;
+  -moz-padding-end: 4px;
 }
 
-.gcliVALID {
+.gcli-in-valid {
   border-bottom: none;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   color: #DDD;
   border-bottom: 1px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   color: #DDD;
   border-bottom: 1px dotted #F00;
 }
 
-.gcliCompl {
+.gcli-in-ontab {
   color: #999;
 }
 
 .gcliterm-stack-node {
   background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
   width: 100%;
 }
 
+.gcliterm-argfetcher {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
 .gcliterm-hint-node {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-bottom: 0px !important;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid #FFF;
+  border-left: 1px solid threedshadow;
+  border-right: 1px solid threedshadow;
   border-top-right-radius: 5px;
   border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
-  overflow: auto;
-  padding: 10px;
+  margin-bottom: -1px;
 }
 
 .gcliterm-hint-parent {
-  border-bottom: 1px solid #AAA;
+  width: 300px;
+  padding: 10px 10px 0;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid threedshadow;
+}
+
+.gcli-help-right {
+  text-align: right;
+}
+
+.gcliterm-menu {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
+.gcliterm-hint-nospace {
+  display: none;
 }
 
-.gcliCmdHelpRight {
-  text-align: right;
+/*
+ * The language of a console is not en_US or any other common language
+ * (i.e we don't attempt to translate 'console.log(x)')
+ * So we fix .gcliterm-input-node/.gcliterm-complete-node elements to be ltr.
+ * As a result we also want the hints to pop up on the left (above the prompt)
+ */
+.gcliterm-input-node,
+.gcliterm-complete-node,
+.gcliterm-display {
+  direction: ltr;
+}
+
+/*
+ * We want the stuff under .gcliterm-display to obey normal direction rules
+ * so we need to swap back when the document is in rtl mode.
+ * The selectors below are faster, but equivalent to:
+ * .gcliterm-display > *:-moz-locale-dir(rtl) {
+ *   direction: rtl;
+ * }
+ * In non-performance critical situations the above is preferred due to it's
+ * greater resilience to refactoring
+ */
+.gcliterm-hint-parent:-moz-locale-dir(rtl),
+.hud-output-node:-moz-locale-dir(rtl) {
+  direction: rtl;
+}
+
+/* From: $GCLI/mozilla/gcli/ui/gcliterm-pinstripe.css */
+
+.gcliterm-complete-node {
+  padding-top: 6px !important;
 }
 
 /* From: $GCLI/lib/gcli/ui/arg_fetch.css */
-.gcliCmdDesc {
+
+.gcli-argfetch {
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
+}
+
+.gcli-af-cmddesc {
   font-weight: bold;
   text-align: center;
   margin-bottom: 5px;
-  border-bottom: 1px solid #ddd;
-  padding-bottom: 3px;
+  padding: 3px 10px 0;
 }
 
-.gcliParamGroup {
-  font-weight: bold;
+.gcli-af-params {
+  padding: 0 10px;
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
 }
 
-.gcliParamName {
+.gcli-af-paramname {
   text-align: right;
   font-size: 90%;
 }
 
-.gcliParamError {
+.gcli-af-required {
+  font-size: 90%;
+  color: #f66;
+  padding-left: 5px;
+}
+
+.gcli-af-error {
   font-size: 80%;
   color: #900;
 }
 
-.gcliParamSubmit {
+.gcli-af-submit {
   text-align: right;
 }
 
-.gcliGroupSymbol {
-  font-size: 90%;
-  color: #666;
-}
-
-.gcliRequired {
-  font-size: 80%;
-  color: #666;
-}
-
-.gcliParams {
+.gcli-field {
   width: 100%;
 }
 
-/* From: $GCLI/lib/gcli/ui/hinter.css */
-.gcliHintParent {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-top-right-radius: 5px;
-  border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
+/* From: $GCLI/lib/gcli/ui/menu.css */
+
+.gcli-menu {
+  width: 100%;
   overflow: hidden;
 }
 
-.gcliHints {
-  overflow: auto;
-  padding: 10px;
-  display: inline-block;
+.gcli-menu-field {
+  border: 1px solid #aaa;
+  border-top: 0;
+  border-bottom-right-radius: 5px;
+  border-bottom-left-radius: 5px;
+  max-height: 300px;
+  margin: 0 3px;
+  padding: 0;
 }
 
-.gcliHints ul {
-  margin: 0;
-  padding: 0 15px;
+.gcli-menu-template {
+  border-collapse: collapse;
+  width: 100%;
+  margin: 10px 0;
 }
 
-/* From: $GCLI/lib/gcli/ui/menu.css */
-.gcliOption {
+.gcli-menu-option {
   overflow: hidden;
   white-space: nowrap;
   cursor: pointer;
   padding: 2px;
 }
 
-.gcliOption:hover {
+.gcli-menu-option:hover {
   background-color: rgb(230, 230, 230);
 }
 
-.gcliOptionName {
-  padding-right: 5px;
+.gcli-menu-name {
+  padding-top: 0;
+  padding-bottom: 0;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
 }
 
-.gcliOptionDesc {
+.gcli-menu-desc {
   font-size: 80%;
   color: #999;
 }
 
-.gcliMenuError {
+.gcli-menu-error {
   overflow: hidden;
   white-space: nowrap;
-  padding: 8px 2px 2px 2px;
+  padding-top: 8px;
+  padding-bottom: 2px;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
   font-size: 80%;
   color: red;
 }
 
-.gcliMenuField {
-  background-color: white;
-  color: black;
-  border: 1px solid #aaa;
-  padding: 2px;
-  max-height: 300px;
-  overflow-y: auto;
-  max-width: 220px;
-  overflow-x: hidden;
-  margin: 0px 10px;
-  border-top: 0px !important;
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-}
+/* From: $GCLI/lib/gcli/ui/inputter.css */
 
-/* From: $GCLI/lib/gcli/ui/inputter.css */
-.gcliCompletion {
+.gcli-in-complete {
   position: absolute;
   z-index: -1000;
-  background-color: #DDD;
   border: 1px transparent solid;
   padding: 1px 1px 1px 2px;
-}
-
-.gcliCompletion {
   color: #DDD;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   border-bottom: 2px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   border-bottom: 2px dotted #F00;
 }
 
-.gcliPrompt {
+.gcli-in-ontab {
+  color: #999;
+}
+
+.gcli-in-closebrace {
+  color: #999;
+}
+
+.gcli-prompt {
   color: #66F;
   font-weight: bold;
 }
-
-.gcliCompl {
-  color: #999;
-}
-
-.gcliCloseBrace {
-  color: #999;
-}
deleted file mode 100644
index 236b5f82106ed4e9f74eff40a29ee36701a894c2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index a489de3bf858b6ea84d1470c17ab157f50adc01d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 236b5f82106ed4e9f74eff40a29ee36701a894c2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index a489de3bf858b6ea84d1470c17ab157f50adc01d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/pinstripe/jar.mn
+++ b/browser/themes/pinstripe/jar.mn
@@ -46,20 +46,20 @@ browser.jar:
   skin/classic/browser/toolbarbutton-dropmarker.png
   skin/classic/browser/urlbar-history-dropmarker.png
   skin/classic/browser/urlbar-arrow.png
   skin/classic/browser/urlbar-popup-blocked.png
   skin/classic/browser/feeds/subscribe.css                  (feeds/subscribe.css)
   skin/classic/browser/feeds/subscribe-ui.css               (feeds/subscribe-ui.css)
   skin/classic/browser/feeds/feedIcon.png                   (feeds/feedIcon.png)
   skin/classic/browser/feeds/feedIcon16.png                 (feeds/feedIcon16.png)
-  skin/classic/browser/feeds/videoFeedIcon.png              (feeds/videoFeedIcon.png)
-  skin/classic/browser/feeds/videoFeedIcon16.png            (feeds/videoFeedIcon16.png)
-  skin/classic/browser/feeds/audioFeedIcon.png              (feeds/audioFeedIcon.png)
-  skin/classic/browser/feeds/audioFeedIcon16.png            (feeds/audioFeedIcon16.png)
+  skin/classic/browser/feeds/videoFeedIcon.png              (feeds/feedIcon.png)
+  skin/classic/browser/feeds/videoFeedIcon16.png            (feeds/feedIcon16.png)
+  skin/classic/browser/feeds/audioFeedIcon.png              (feeds/feedIcon.png)
+  skin/classic/browser/feeds/audioFeedIcon16.png            (feeds/feedIcon16.png)
   skin/classic/browser/setDesktopBackground.css
   skin/classic/browser/inspector.css
   skin/classic/browser/monitor.png
   skin/classic/browser/monitor_16-10.png
   skin/classic/browser/places/allBookmarks.png              (places/allBookmarks.png)
 * skin/classic/browser/places/places.css                    (places/places.css)
 * skin/classic/browser/places/organizer.css                 (places/organizer.css)
   skin/classic/browser/places/query.png                     (places/query.png)
--- a/browser/themes/pinstripe/places/places.css
+++ b/browser/themes/pinstripe/places/places.css
@@ -1,18 +1,12 @@
 %include ../shared.inc
 
 /* Sidebars */
 
-.sidebar-placesTree {
-  background-color: transparent !important;
-  -moz-appearance: none !important;
-  border: none !important;
-}
-
 #bookmarksPanel, 
 #history-panel,
 #sidebar-search-container {
   -moz-appearance: none !important;
   background-color: transparent !important;
   border-top: none !important;
 }
 
@@ -145,17 +139,17 @@ treechildren::-moz-tree-image(query) {
 }
 
 treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
   list-style-image: url("chrome://browser/skin/places/downloads.png");
 }
 
 treechildren::-moz-tree-image(title, query, tagContainer),
 treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
 }
 
 /* calendar icon for folders grouping items by date */
 treechildren::-moz-tree-image(title, query, dayContainer) {
   list-style-image: url("chrome://browser/skin/places/history.png");
 }
 
 treechildren::-moz-tree-image(title, query, hostContainer) {
deleted file mode 100644
index ff2ecc2f351ef37d250264aa2bb273de08518165..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/winstripe/browser.css
+++ b/browser/themes/winstripe/browser.css
@@ -616,17 +616,17 @@ menuitem.bookmark-item {
 }
 
 .bookmark-item[container][query] {
   list-style-image: url("chrome://browser/skin/places/query.png");
   -moz-image-region: auto;
 }
 
 .bookmark-item[query][tagContainer] {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
   -moz-image-region: auto;
 }
 
 .bookmark-item[query][dayContainer] {
   list-style-image: url("chrome://browser/skin/places/calendar.png");
   -moz-image-region: auto;
 }
 
@@ -2628,23 +2628,25 @@ panel[dimmed="true"] {
   background-color: rgba(0, 0, 0, 0.5);
 }
 
 #highlighter-closebutton {
   list-style-image: url("chrome://browser/skin/devtools/toolbarbutton-close.png");
   -moz-image-region: rect(0, 16px, 16px, 0);
   min-width: 16px;
   width: 16px;
+  -moz-appearance: none;
+  border-style: none;
 }
 
 #highlighter-closebutton:hover {
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
-#highlighter-closebutton:active {
+#highlighter-closebutton:hover:active {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
 #highlighter-veil-transparentbox {
   box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
   outline: 1px dashed rgba(255,255,255,0.5);
   outline-offset: -1px;
 }
@@ -2850,17 +2852,16 @@ panel[dimmed="true"] {
   background-color: transparent;
   border-width: 2px 13px;
   outline: none;
   color: hsl(210,30%,85%);
   max-width: 85px;
   /* The content of the button can be larger than the button */
   overflow: hidden;
   min-height: 25px;
-
   margin: 0 -11px 0 0;
   padding: 0 9px;
 }
 
 .inspector-breadcrumbs-button[checked] > .inspector-breadcrumbs-tag {
   color: hsl(200,100%,60%);
 }
 
--- a/browser/themes/winstripe/devtools/gcli.css
+++ b/browser/themes/winstripe/devtools/gcli.css
@@ -31,211 +31,256 @@
  * 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 ***** */
 
 /* From: $GCLI/mozilla/gcli/ui/gcliterm.css */
+
+/* Bug 678152 calls for UX review which will fix the color names */
+
 .gcliterm-input-node,
 .gcliterm-complete-node {
   border: none;
   -moz-appearance: none;
   height: 100%;
   vertical-align: middle;
   background-color: transparent;
   font: 12px Consolas, "Lucida Console", monospace;
-  padding: 2px 0 0 16px;
+}
+
+.gcliterm-input-node {
+  padding-top: 2px;
+  padding-bottom: 0;
+  -moz-padding-start: 16px;
+  -moz-padding-end: 0;
 }
 
 .gcliterm-complete-node {
   color: #FFF;
-  padding: 4px 4px 2px 21px;
+  padding-top: 4px;
+  padding-bottom: 2px;
+  -moz-padding-start: 21px;
+  -moz-padding-end: 4px;
 }
 
-.gcliVALID {
+.gcli-in-valid {
   border-bottom: none;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   color: #DDD;
   border-bottom: 1px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   color: #DDD;
   border-bottom: 1px dotted #F00;
 }
 
-.gcliCompl {
+.gcli-in-ontab {
   color: #999;
 }
 
 .gcliterm-stack-node {
   background: url("chrome://global/skin/icons/commandline.png") 4px center no-repeat;
   width: 100%;
 }
 
+.gcliterm-argfetcher {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
 .gcliterm-hint-node {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-bottom: 0px !important;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid #FFF;
+  border-left: 1px solid threedshadow;
+  border-right: 1px solid threedshadow;
   border-top-right-radius: 5px;
   border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
-  overflow: auto;
-  padding: 10px;
+  margin-bottom: -1px;
 }
 
 .gcliterm-hint-parent {
-  border-bottom: 1px solid #AAA;
+  width: 300px;
+  padding: 10px 10px 0;
+  border-top: 1px solid threedshadow;
+  border-bottom: 1px solid threedshadow;
 }
 
-.gcliCmdHelpRight {
+.gcli-help-right {
   text-align: right;
 }
 
+.gcliterm-menu {
+  display: -moz-box;
+  -moz-box-flex: 1;
+}
+
+.gcliterm-hint-nospace {
+  display: none;
+}
+
+/*
+ * The language of a console is not en_US or any other common language
+ * (i.e we don't attempt to translate 'console.log(x)')
+ * So we fix .gcliterm-input-node/.gcliterm-complete-node elements to be ltr.
+ * As a result we also want the hints to pop up on the left (above the prompt)
+ */
+.gcliterm-input-node,
+.gcliterm-complete-node,
+.gcliterm-display {
+  direction: ltr;
+}
+
+/*
+ * We want the stuff under .gcliterm-display to obey normal direction rules
+ * so we need to swap back when the document is in rtl mode.
+ * The selectors below are faster, but equivalent to:
+ * .gcliterm-display > *:-moz-locale-dir(rtl) {
+ *   direction: rtl;
+ * }
+ * In non-performance critical situations the above is preferred due to it's
+ * greater resilience to refactoring
+ */
+.gcliterm-hint-parent:-moz-locale-dir(rtl),
+.hud-output-node:-moz-locale-dir(rtl) {
+  direction: rtl;
+}
+
+/* From: $GCLI/mozilla/gcli/ui/gcliterm-winstripe.css */
+
 /* From: $GCLI/lib/gcli/ui/arg_fetch.css */
-.gcliCmdDesc {
+
+.gcli-argfetch {
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
+}
+
+.gcli-af-cmddesc {
   font-weight: bold;
   text-align: center;
   margin-bottom: 5px;
-  border-bottom: 1px solid #ddd;
-  padding-bottom: 3px;
+  padding: 3px 10px 0;
 }
 
-.gcliParamGroup {
-  font-weight: bold;
+.gcli-af-params {
+  padding: 0 10px;
+  width: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
 }
 
-.gcliParamName {
+.gcli-af-paramname {
   text-align: right;
   font-size: 90%;
 }
 
-.gcliParamError {
+.gcli-af-required {
+  font-size: 90%;
+  color: #f66;
+  padding-left: 5px;
+}
+
+.gcli-af-error {
   font-size: 80%;
   color: #900;
 }
 
-.gcliParamSubmit {
+.gcli-af-submit {
   text-align: right;
 }
 
-.gcliGroupSymbol {
-  font-size: 90%;
-  color: #666;
-}
-
-.gcliRequired {
-  font-size: 80%;
-  color: #666;
-}
-
-.gcliParams {
+.gcli-field {
   width: 100%;
 }
 
-/* From: $GCLI/lib/gcli/ui/hinter.css */
-.gcliHintParent {
-  color: #000;
-  background: rgba(250, 250, 250, 0.8);
-  border: 1px solid #AAA;
-  border-top-right-radius: 5px;
-  border-top-left-radius: 5px;
-  margin-left: 10px;
-  margin-right: 10px;
-  display: inline-block;
+/* From: $GCLI/lib/gcli/ui/menu.css */
+
+.gcli-menu {
+  width: 100%;
   overflow: hidden;
 }
 
-.gcliHints {
-  overflow: auto;
-  padding: 10px;
-  display: inline-block;
+.gcli-menu-field {
+  border: 1px solid #aaa;
+  border-top: 0;
+  border-bottom-right-radius: 5px;
+  border-bottom-left-radius: 5px;
+  max-height: 300px;
+  margin: 0 3px;
+  padding: 0;
 }
 
-.gcliHints ul {
-  margin: 0;
-  padding: 0 15px;
+.gcli-menu-template {
+  border-collapse: collapse;
+  width: 100%;
+  margin: 10px 0;
 }
 
-/* From: $GCLI/lib/gcli/ui/menu.css */
-.gcliOption {
+.gcli-menu-option {
   overflow: hidden;
   white-space: nowrap;
   cursor: pointer;
   padding: 2px;
 }
 
-.gcliOption:hover {
+.gcli-menu-option:hover {
   background-color: rgb(230, 230, 230);
 }
 
-.gcliOptionName {
-  padding-right: 5px;
+.gcli-menu-name {
+  padding-top: 0;
+  padding-bottom: 0;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
 }
 
-.gcliOptionDesc {
+.gcli-menu-desc {
   font-size: 80%;
   color: #999;
 }
 
-.gcliMenuError {
+.gcli-menu-error {
   overflow: hidden;
   white-space: nowrap;
-  padding: 8px 2px 2px 2px;
+  padding-top: 8px;
+  padding-bottom: 2px;
+  -moz-padding-start: 10px;
+  -moz-padding-end: 2px;
   font-size: 80%;
   color: red;
 }
 
-.gcliMenuField {
-  background-color: white;
-  color: black;
-  border: 1px solid #aaa;
-  padding: 2px;
-  max-height: 300px;
-  overflow-y: auto;
-  max-width: 220px;
-  overflow-x: hidden;
-  margin: 0px 10px;
-  border-top: 0px !important;
-  border-bottom-right-radius: 5px;
-  border-bottom-left-radius: 5px;
-}
+/* From: $GCLI/lib/gcli/ui/inputter.css */
 
-/* From: $GCLI/lib/gcli/ui/inputter.css */
-.gcliCompletion {
+.gcli-in-complete {
   position: absolute;
   z-index: -1000;
-  background-color: #DDD;
   border: 1px transparent solid;
   padding: 1px 1px 1px 2px;
-}
-
-.gcliCompletion {
   color: #DDD;
 }
 
-.gcliINCOMPLETE {
+.gcli-in-incomplete {
   border-bottom: 2px dotted #999;
 }
 
-.gcliERROR {
+.gcli-in-error {
   border-bottom: 2px dotted #F00;
 }
 
-.gcliPrompt {
+.gcli-in-ontab {
+  color: #999;
+}
+
+.gcli-in-closebrace {
+  color: #999;
+}
+
+.gcli-prompt {
   color: #66F;
   font-weight: bold;
 }
-
-.gcliCompl {
-  color: #999;
-}
-
-.gcliCloseBrace {
-  color: #999;
-}
deleted file mode 100644
index b4d5994995f24adf40fe10f407c9644e802b140d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index e69bc4496139006ad20e34db308bfcc0cbc396c2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 7c3aceb66f351208cf25ff02abe617cbb5e56456..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d778807532bc0a1d47ac82370255600d503d66eb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index b4d5994995f24adf40fe10f407c9644e802b140d..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index e69bc4496139006ad20e34db308bfcc0cbc396c2..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 7c3aceb66f351208cf25ff02abe617cbb5e56456..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index d778807532bc0a1d47ac82370255600d503d66eb..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/themes/winstripe/jar.mn
+++ b/browser/themes/winstripe/jar.mn
@@ -1,17 +1,17 @@
 browser.jar:
 % skin browser classic/1.0 %skin/classic/browser/ os=WINNT osversion<6
 % skin browser classic/1.0 %skin/classic/browser/ os!=WINNT
 # NOTE: If you add a new file here, you'll need to add it to the aero
 # section at the bottom of this file
         skin/classic/browser/sanitizeDialog.css                      (sanitizeDialog.css)
 *       skin/classic/browser/aboutPrivateBrowsing.css                (aboutPrivateBrowsing.css)
 *       skin/classic/browser/aboutSessionRestore.css                 (aboutSessionRestore.css)
-        skin/classic/browser/aboutSessionRestore-window-icon.png     (aboutSessionRestore-window-icon.png)
+        skin/classic/browser/aboutSessionRestore-window-icon.png     (preferences/application.png)
         skin/classic/browser/aboutCertError.css                      (aboutCertError.css)
 #ifdef MOZ_SERVICES_SYNC
         skin/classic/browser/aboutSyncTabs.css
 #endif
         skin/classic/browser/actionicon-tab.png
         skin/classic/browser/appmenu-icons.png
         skin/classic/browser/appmenu-dropmarker.png
 *       skin/classic/browser/browser.css                             (browser.css)
@@ -46,20 +46,20 @@ browser.jar:
         skin/classic/browser/menu-forward.png                        (menu-forward.png)
         skin/classic/browser/monitor.png
         skin/classic/browser/monitor_16-10.png
         skin/classic/browser/urlbar-arrow.png
         skin/classic/browser/urlbar-popup-blocked.png
         skin/classic/browser/urlbar-history-dropmarker.png
         skin/classic/browser/feeds/feedIcon.png                      (feeds/feedIcon.png)
         skin/classic/browser/feeds/feedIcon16.png                    (feeds/feedIcon16.png)
-        skin/classic/browser/feeds/audioFeedIcon.png                 (feeds/audioFeedIcon.png)
-        skin/classic/browser/feeds/audioFeedIcon16.png               (feeds/audioFeedIcon16.png)
-        skin/classic/browser/feeds/videoFeedIcon.png                 (feeds/videoFeedIcon.png)
-        skin/classic/browser/feeds/videoFeedIcon16.png               (feeds/videoFeedIcon16.png)
+        skin/classic/browser/feeds/audioFeedIcon.png                 (feeds/feedIcon.png)
+        skin/classic/browser/feeds/audioFeedIcon16.png               (feeds/feedIcon16.png)
+        skin/classic/browser/feeds/videoFeedIcon.png                 (feeds/feedIcon.png)
+        skin/classic/browser/feeds/videoFeedIcon16.png               (feeds/feedIcon16.png)
         skin/classic/browser/feeds/subscribe.css                     (feeds/subscribe.css)
         skin/classic/browser/feeds/subscribe-ui.css                  (feeds/subscribe-ui.css)
         skin/classic/browser/inspector.css
         skin/classic/browser/places/places.css                       (places/places.css)
 *       skin/classic/browser/places/organizer.css                    (places/organizer.css)
         skin/classic/browser/places/bookmark.png                     (places/bookmark.png)
         skin/classic/browser/places/editBookmark.png                 (places/editBookmark.png)
         skin/classic/browser/places/query.png                        (places/query.png)
@@ -199,20 +199,20 @@ browser.jar:
         skin/classic/aero/browser/menu-forward.png                   (menu-forward-aero.png)
         skin/classic/aero/browser/monitor.png
         skin/classic/aero/browser/monitor_16-10.png
         skin/classic/aero/browser/urlbar-arrow.png
         skin/classic/aero/browser/urlbar-popup-blocked.png
         skin/classic/aero/browser/urlbar-history-dropmarker.png
         skin/classic/aero/browser/feeds/feedIcon.png                 (feeds/feedIcon-aero.png)
         skin/classic/aero/browser/feeds/feedIcon16.png               (feeds/feedIcon16-aero.png)
-        skin/classic/aero/browser/feeds/audioFeedIcon.png            (feeds/audioFeedIcon-aero.png)
-        skin/classic/aero/browser/feeds/audioFeedIcon16.png          (feeds/audioFeedIcon16-aero.png)
-        skin/classic/aero/browser/feeds/videoFeedIcon.png            (feeds/videoFeedIcon-aero.png)
-        skin/classic/aero/browser/feeds/videoFeedIcon16.png          (feeds/videoFeedIcon16-aero.png)
+        skin/classic/aero/browser/feeds/audioFeedIcon.png            (feeds/feedIcon-aero.png)
+        skin/classic/aero/browser/feeds/audioFeedIcon16.png          (feeds/feedIcon16-aero.png)
+        skin/classic/aero/browser/feeds/videoFeedIcon.png            (feeds/feedIcon-aero.png)
+        skin/classic/aero/browser/feeds/videoFeedIcon16.png          (feeds/feedIcon16-aero.png)
         skin/classic/aero/browser/feeds/subscribe.css                (feeds/subscribe.css)
         skin/classic/aero/browser/feeds/subscribe-ui.css             (feeds/subscribe-ui.css)
         skin/classic/aero/browser/inspector.css
 *       skin/classic/aero/browser/places/places.css                  (places/places-aero.css)
 *       skin/classic/aero/browser/places/organizer.css               (places/organizer-aero.css)
         skin/classic/aero/browser/places/bookmark.png                (places/bookmark.png)
         skin/classic/aero/browser/places/editBookmark.png            (places/editBookmark.png)
         skin/classic/aero/browser/places/query.png                   (places/query-aero.png)
@@ -223,26 +223,25 @@ browser.jar:
         skin/classic/aero/browser/places/editBookmarkOverlay.css     (places/editBookmarkOverlay.css)
         skin/classic/aero/browser/places/libraryToolbar.png          (places/libraryToolbar-aero.png)
         skin/classic/aero/browser/places/starred48.png               (places/starred48-aero.png)
         skin/classic/aero/browser/places/unstarred48.png             (places/unstarred48.png)
         skin/classic/aero/browser/places/tag.png                     (places/tag-aero.png)
         skin/classic/aero/browser/places/history.png                 (places/history-aero.png)
         skin/classic/aero/browser/places/allBookmarks.png            (places/allBookmarks-aero.png)
         skin/classic/aero/browser/places/unsortedBookmarks.png       (places/unsortedBookmarks-aero.png)
-        skin/classic/aero/browser/places/searching_16.png            (places/searching_16-aero.png)
+        skin/classic/aero/browser/places/searching_16.png            (places/searching_16.png)
         skin/classic/aero/browser/places/downloads.png               (places/downloads.png)
         skin/classic/aero/browser/preferences/alwaysAsk.png          (preferences/alwaysAsk-aero.png)
         skin/classic/aero/browser/preferences/application.png        (preferences/application-aero.png)
         skin/classic/aero/browser/preferences/mail.png               (preferences/mail-aero.png)
         skin/classic/aero/browser/preferences/Options.png            (preferences/Options-aero.png)
 #ifdef MOZ_SERVICES_SYNC
         skin/classic/aero/browser/preferences/Options-sync.png       (preferences/Options-sync.png)
 #endif
-        skin/classic/aero/browser/preferences/plugin.png             (preferences/plugin-aero.png)
         skin/classic/aero/browser/preferences/saveFile.png           (preferences/saveFile-aero.png)
 *       skin/classic/aero/browser/preferences/preferences.css        (preferences/preferences.css)
         skin/classic/aero/browser/preferences/applications.css       (preferences/applications.css)
         skin/classic/aero/browser/preferences/aboutPermissions.css   (preferences/aboutPermissions.css)
         skin/classic/aero/browser/tabbrowser/alltabs.png             (tabbrowser/alltabs.png)
         skin/classic/aero/browser/tabbrowser/newtab.png              (tabbrowser/newtab.png)
         skin/classic/aero/browser/tabbrowser/newtab-inverted.png     (tabbrowser/newtab-inverted.png)
         skin/classic/aero/browser/tabbrowser/connecting.png          (tabbrowser/connecting.png)
--- a/browser/themes/winstripe/places/places.css
+++ b/browser/themes/winstripe/places/places.css
@@ -76,17 +76,17 @@ treechildren::-moz-tree-image(container,
 /* query-nodes should be styled even if they're not expandable */
 treechildren::-moz-tree-image(title, query) {
   list-style-image: url("chrome://browser/skin/places/query.png");
   -moz-image-region: auto;
 }
 
 treechildren::-moz-tree-image(title, query, tagContainer),
 treechildren::-moz-tree-image(query, OrganizerQuery_Tags) {
-  list-style-image: url("chrome://mozapps/skin/places/tagContainerIcon.png");
+  list-style-image: url("chrome://browser/skin/places/tag.png");
   -moz-image-region: auto;
 }
 
 treechildren::-moz-tree-image(query, OrganizerQuery_Downloads) {
   list-style-image: url("chrome://browser/skin/places/downloads.png");
   -moz-image-region: auto;
 }
 
deleted file mode 100644
index 2f97e742a3f0855c97a356c9f699b3bda3ac7c7b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 5d796cc4c57dd3da1669fd4e51ba8d954ed4c866..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -51,25 +51,80 @@ endif
 
 ifeq (WINNT,$(OS_ARCH))
 DIRS = win32
 endif
 
 DIRS += pgo
 
 ifdef ENABLE_TESTS
+  DIRS += autoconf/test
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
   DIRS += mobile/sutagent/android \
           mobile/sutagent/android/watcher \
           mobile/sutagent/android/ffxcp \
           mobile/sutagent/android/fencp \
           $(NULL)
 endif
 endif
 
+ifdef MOZ_APP_BASENAME
+DIST_FILES = application.ini
+
+ifdef LIBXUL_SDK
+GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
+APP_INI_DEPS = $(LIBXUL_DIST)/bin/platform.ini
+else
+GRE_MILESTONE = $(shell tail -n 1 $(topsrcdir)/config/milestone.txt 2>/dev/null || tail -1 $(topsrcdir)/config/milestone.txt)
+APP_INI_DEPS = $(topsrcdir)/config/milestone.txt
+endif
+
+APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
+APP_INI_DEPS += $(DEPTH)/config/buildid
+
+DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DAPP_BUILDID=$(APP_BUILDID)
+
+DEFINES += -DMOZ_APP_VERSION="$(MOZ_APP_VERSION)"
+APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
+
+MOZ_SOURCE_STAMP ?= $(firstword $(shell hg -R $(topsrcdir) parent --template="{node|short}\n" 2>/dev/null))
+ifdef MOZ_SOURCE_STAMP
+DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
+endif
+
+_dollar=$$
+SOURCE_REPO := $(shell cd $(topsrcdir) && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+ifdef SOURCE_REPO
+DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
+endif
+
+DEFINES += \
+  -DMOZ_APP_BASENAME="$(MOZ_APP_BASENAME)" \
+  -DMOZ_APP_VENDOR="$(MOZ_APP_VENDOR)" \
+  -DMOZ_APP_ID="$(MOZ_APP_ID)" \
+  $(NULL)
+
+ifdef MOZ_APP_PROFILE
+DEFINES += -DMOZ_APP_PROFILE="$(MOZ_APP_PROFILE)"
+endif
+
+ifdef MOZILLA_OFFICIAL
+DEFINES += -DMOZILLA_OFFICIAL
+endif
+
+ifdef MOZ_PROFILE_MIGRATOR
+DEFINES += -DMOZ_PROFILE_MIGRATOR
+endif
+
+ifdef MOZ_EXTENSION_MANAGER
+DEFINES += -DMOZ_EXTENSION_MANAGER
+endif
+
+endif
+
 include $(topsrcdir)/config/rules.mk
 
 # we install to _leaktest/
 TARGET_DEPTH = ..
 include $(srcdir)/automation-build.mk
 
 _LEAKTEST_DIR = $(DEPTH)/_leaktest
 GARBAGE_DIRS += $(_LEAKTEST_DIR)
@@ -94,16 +149,29 @@ GARBAGE_DIRS += $(_LEAKTEST_DIR)
 		$(topsrcdir)/build/pgo/blueprint/fancytype-screen.css \
 		$(NULL)
 
 leaktest.py: leaktest.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $^ > $@
 	chmod +x $@
 GARBAGE += leaktest.py
 
+ifdef MOZ_APP_BASENAME
+application.ini: application.ini.in $(APP_INI_DEPS)
+	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@
+GARBAGE += application.ini
+
+ifdef MOZ_APP_STATIC_INI
+application.ini.h: appini_header.py application.ini 
+	$(PYTHON) $^ > $@
+export:: application.ini.h
+GARBAGE += application.ini.h
+endif
+endif
+
 libs:: $(_LEAKTEST_FILES)
 	$(INSTALL) $^ $(_LEAKTEST_DIR)
 
 ifdef MOZ_VALGRIND
 _VALGRIND_DIR = $(DEPTH)/_valgrind
 GARBAGE_DIRS += $(_VALGRIND_DIR)
 
 _VALGRIND_FILES = \
new file mode 100644
--- /dev/null
+++ b/build/appini_header.py
@@ -0,0 +1,86 @@
+# ***** 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 a build helper for libraries
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Mike Hommey <mh@glandium.org>
+#
+# 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 *****
+
+'''Parses a given application.ini file and outputs the corresponding
+   XULAppData structure as a C++ header file'''
+
+import ConfigParser
+import sys
+
+def main(file):
+    config = ConfigParser.RawConfigParser()
+    config.read(file)
+    flags = set()
+    try:
+        if config.getint('XRE', 'EnableExtensionManager') == 1:
+            flags.add('NS_XRE_ENABLE_EXTENSION_MANAGER')
+    except: pass
+    try:
+        if config.getint('XRE', 'EnableProfileMigrator') == 1:
+            flags.add('NS_XRE_ENABLE_PROFILE_MIGRATOR')
+    except: pass
+    try:
+        if config.getint('Crash Reporter', 'Enabled') == 1:
+            flags.add('NS_XRE_ENABLE_CRASH_REPORTER')
+    except: pass
+    appdata = dict(("%s:%s" % (s, o), config.get(s, o)) for s in config.sections() for o in config.options(s))
+    appdata['flags'] = ' | '.join(flags) if flags else '0'
+    appdata['App:profile'] = '"%s"' % appdata['App:profile'] if 'App:profile' in appdata else 'NULL'
+
+    print '''#include "nsXULAppAPI.h"
+             static const nsXREAppData sAppData = {
+                 sizeof(nsXREAppData),
+                 NULL, // directory
+                 "%(App:vendor)s",
+                 "%(App:name)s",
+                 "%(App:version)s",
+                 "%(App:buildid)s",
+                 "%(App:id)s",
+                 NULL, // copyright
+                 %(flags)s,
+                 NULL, // xreDirectory
+                 "%(Gecko:minversion)s",
+                 "%(Gecko:maxversion)s",
+                 "%(Crash Reporter:serverurl)s",
+                 %(App:profile)s
+             };''' % appdata
+
+if __name__ == '__main__':
+    if len(sys.argv) != 1:
+        main(sys.argv[1])
+    else:
+        print >>sys.stderr, "Usage: %s /path/to/application.ini" % sys.argv[0]
rename from browser/app/application.ini
rename to build/application.ini.in
--- a/browser/app/application.ini
+++ b/build/application.ini.in
@@ -1,8 +1,14 @@
+#if MOZ_APP_STATIC_INI
+; This file is not used. If you modify it and want the application to use
+; your modifications, start with the "-app /path/to/application.ini"
+; argument.
+#endif
+#if 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/
 ;
@@ -29,39 +35,43 @@
 ; 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 *****
-
+#endif
 #filter substitution
 [App]
 Vendor=@MOZ_APP_VENDOR@
 Name=@MOZ_APP_BASENAME@
-Version=@APP_VERSION@
+Version=@MOZ_APP_VERSION@
 #ifdef MOZ_APP_PROFILE
 Profile=@MOZ_APP_PROFILE@
 #endif
-BuildID=@GRE_BUILDID@
+BuildID=@APP_BUILDID@
 #ifdef MOZ_SOURCE_REPO
 SourceRepository=@MOZ_SOURCE_REPO@
 #endif
 #ifdef MOZ_SOURCE_STAMP
 SourceStamp=@MOZ_SOURCE_STAMP@
 #endif
-ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+ID=@MOZ_APP_ID@
 
 [Gecko]
 MinVersion=@GRE_MILESTONE@
 MaxVersion=@GRE_MILESTONE@
 
 [XRE]
+#ifdef MOZ_PROFILE_MIGRATOR
 EnableProfileMigrator=1
+#endif
+#ifdef MOZ_EXTENSION_MANAGER
 EnableExtensionManager=1
+#endif
 
 [Crash Reporter]
 #if MOZILLA_OFFICIAL
 Enabled=1
 #endif
-ServerURL=https://crash-reports.mozilla.com/submit?id=ec8030f7-c20a-464f-9b0e-13a3a9e97384&version=@APP_VERSION@&buildid=@GRE_BUILDID@
+ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@APP_BUILDID@
--- a/build/autoconf/make-makefile
+++ b/build/autoconf/make-makefile
@@ -1,9 +1,9 @@
-#! /usr/bin/env perl
+#!/usr/bin/env perl
 # ***** 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/
 #
@@ -11,149 +11,281 @@
 # 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) 1999
+# Portions created by the Initial Developer are Copyright (C) 1999-2011
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
+#   Steve Lamm <slamm@netscape.com>
+#   Joey Armstrong <joey@mozilla.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 *****
 
-# make-makefiles - Quickly create Makefiles for subdirectories.
-#      Also, creates any needed subdirectories.
-#
-# usage: make-makefiles [ -t <topsrcdir> -p <print_topsrcdir> -d <depth> ] [ <subdir> | <subdir>/Makefile ] ...
+##----------------------------##
+##---] CORE/CPAN INCLUDES [---##
+##----------------------------##
+use strict;
+use warnings;
+use Getopt::Long;
 
-# Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
+use Benchmark;
+use Cwd;
+use File::Basename;
+use File::Copy;
+use File::Path      qw{mkpath};
+
+##-------------------##
+##---]  EXPORTS  [---##
+##-------------------##
+our $VERSION = qw(2.0);
+
+##--------------------##
+##---]  INCLUDES  [---##
+##--------------------##
 
-#$debug = 1;
+##############################################################
+# pymake: special case path handling for windows cmd shell.
+#   if invoked by cmd.exe and msys-perl is in play
+#     $0 may contain a drive letter
+#     modules use-or-expect msys/unix paths
+#     adjust $0 => C:/foo => /c/foo so string tests and
+#     manipulation can by applied properly.
+##############################################################
+sub BEGIN
+{
+    if ($^O eq 'msys' && $ENV{PATH} =~ m!\w:/!)
+    {
+	$0 =~ s!^(\w):!/$1!;
+    }
+    eval 'use FindBin';
+    die $@ if ($@);
+}
+
+use lib $FindBin::Bin;
+use makemakefile;
 
-if ($^O eq 'msys') {
-  $pwdcmd = 'pwd -W';
+##-------------------##
+##---]  GLOBALS  [---##
+##-------------------##
+my %argv;
+
+my $t0 = Benchmark->new();
+sub END
+{
+    if ($argv{bench})
+    {
+        my $t1 = Benchmark->new();
+        my $delta = timediff($t1, $t0);
+        print STDERR timestr($delta), "\n";
+    }
 }
-else {
-  $pwdcmd = 'pwd';
-}
+
+##----------------##
+##---]  MAIN  [---##
+##----------------##
+umask 0;
+
+my $debug = $argv{debug} || 0;
+
+my $pwdcmd = ($^O eq 'msys') ? 'pwd -W' : 'pwd';
 
 # Determine various tree path variables
 #
-($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
+my ($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
 
-$object_fullpath = `$pwdcmd`;
+my $object_fullpath = `$pwdcmd`; # Cwd::getcwd()
 chdir $depth;
-$object_root = `$pwdcmd`;
+my $object_root = `$pwdcmd`;  # Cwd::getcwd()
 chomp $object_fullpath;
 chomp $object_root;
 
 # $source_subdir is the path from the object root to where
 #    'make-makefile' was called. For example, if make-makefile was
 #    called from "mozilla/gfx/src", then $source_subdir would be
 #    "gfx/src/".
-$source_subdir = "$object_fullpath/";
+my $source_subdir = "$object_fullpath/";
 my $quoted_object_root = quotemeta($object_root);
 $source_subdir =~ s|^$quoted_object_root/||;
 
 # Prefix makefiles with $source_subdir so that paths
 # will be relative to the top of the object tree.
 #
-for $makefile (@makefiles) {
+my $makefile;
+for $makefile (@makefiles) { # dead code ?
   $makefile = "$source_subdir$makefile";
 }
 
-create_directories(@makefiles);
-
 # Find the path to the source directory based on how 'make-makefile'
 #  was invoked. The path is either relative to the object directory
 #  or an absolute path.
-$given_srcdir = find_srcdir($topsrcdir, $depth);
-$pgiven_srcdir = find_srcdir($ptopsrcdir, $depth);
+my $given_srcdir = find_srcdir($topsrcdir, $depth);
+my $pgiven_srcdir = find_srcdir($ptopsrcdir, $depth);
 
 if ($debug) {
   warn "object_fullpath = $object_fullpath\n";
   warn "object_root     = $object_root\n";
   warn "source_subdir   = $source_subdir\n";
   warn "makefiles       = @makefiles\n";
   warn "given_srcdir    = $given_srcdir\n";
 }
 
-@unhandled = update_makefiles($given_srcdir, $pgiven_srcdir, @makefiles);
+my @errors;
+my @unhandled = update_makefiles_legacy($given_srcdir, $pgiven_srcdir, @makefiles);
+push(@errors, $@) if ($@);
 
 run_config_status(@unhandled);
+push(@errors, $@) if ($@ && $argv{'no-warnings'});
+
+exit scalar(@errors);
 
 # end of Main
 ############################################################
 
-sub dirname {
- return $_[0] =~ /(.*)\/.*/ ? "$1" : '.';
-}
-
+###########################################################################
 # find_depth: Pull the value of DEPTH out of a Makefile (or Makefile.in)
+###########################################################################
 sub find_depth {
   my $depth = '';
   open(MAKEFILE, "<$_[0]") || die "Unable to open $_[0]: $!\n";
   while (<MAKEFILE>) {
     next unless /^DEPTH\s*=\s*(\..*)/;
     $depth = $1;
     last;
   }
   close MAKEFILE;
   return $depth;
 }
 
+###########################################################################
+## Intent: Parse command line arguments and assign values
+###########################################################################
 sub parse_arguments {
   my @args = @_;
-  my $depth = '';
-  my $topsrcdir = '';
-  my $ptopsrcdir;
   my @makefiles = ();
 
-  while (1) {
-    if ($args[0] eq '-d') {
-      $depth = $args[1];
-      shift @args; 
-      shift @args; 
-    } elsif ($args[0] eq '-t') {
-      $topsrcdir = $args[1];
-      shift @args; 
-      shift @args; 
-    } elsif ($args[0] eq '-p') {
-      $ptopsrcdir = $args[1];
-      shift @args;
-      shift @args;
-    } else {
-      last;
-    }
+  my @arglist = qw(badtokens! bench
+                   chdir=s
+                   debug
+                   depth|d=s
+                   enhanced
+                   obj=s top|t=s ptop|p=s
+                   src=s dst=s
+                   );
+  unless(GetOptions(\%argv, @arglist))
+  {
+      my $script = join('/', $FindBin::RealBin, $FindBin::Script);
+      system("perldoc $script </dev/null");
+      exit
+  }
+  @args = @ARGV;
+
+  my $topsrcdir = $argv{top} || '';
+  if (! $topsrcdir)
+  {
+      $topsrcdir = $argv{top} = getTopDir();
+  }
+
+  my $ptopsrcdir ||= $argv{ptop} || $topsrcdir || '';
+
+  ## Init --no- switch values
+  foreach my $var (qw(badtokens exclusions warnings))
+  {
+      $argv{"no-${var}"} = $argv{$var} || 0;
+  }
+  # Propogate parsed arguments for module use [--debug, --verbose]
+  while (my($k, $v) = each %argv)
+  {
+      $main::argv{$k} = $v;
+  }
+
+  if ($argv{chdir})
+  {
+      chdir $argv{chdir} || die "chdir $argv{chdir} failed: $!";
   }
 
-  if ($topsrcdir eq '') {
-    $topsrcdir = $0; # Figure out topsrcdir based on program name.
-    $topsrcdir =~ s|/?build/autoconf/.*$||;
+  ##############################################################
+  ## Arguments allowing make-makefile to be invoked from $topsrc
+  ##############################################################
+  if (!$argv{top} || !$argv{obj})
+  {
   }
-  if ($ptopsrcdir eq '') {
-    $ptopsrcdir = $topsrcdir;
+  ## Limit access to container makefiles for now
+  elsif ($argv{enhanced})
+  {
+      my @errors;
+
+      ## iterate over @ARGV to preserve original filename for 'unhandled'
+      my @files = map{ getRelPath($_) } @ARGV;
+
+      my $top = getTopDir();
+      my $obj = getObjDir();
+
+      mkdirr(map{ "$obj/$_" } @files);
+      push(@errors, $@) if ($@); # legacy behavior: do not exit with status
+
+      my $exclude = join('/', $FindBin::RealBin, $FindBin::Script);
+      $exclude .= '.excl'; # $argv{exclude}
+      my %exclude = getExclusions($exclude);
+      my @unhandled;
+      foreach my $relpath (@files)
+      {
+          my $rel = join('/', $relpath, 'Makefile.in');
+          my $mf = join('/', $top, $rel);
+          next if ($exclude{$rel});
+          print STDERR " ** relpath=[$relpath], mf=[$mf]\n" if ($main::argv{debug});
+
+          my $rc = updateMakefiles($relpath, {depth=>$depth, obj=>$obj, top=>$top});
+          if ($@)
+          {
+            push(@errors, $@);
+          }
+          elsif ($rc eq 'badtokens')
+          {
+            push(@unhandled, $mf);
+          }
+      }
+
+      run_config_status(@unhandled);
+      push(@errors, $@) if ($@ && $argv{'no-warnings'});
+      exit scalar(@errors);
   }
-  if ($depth eq '') {
+
+
+  my $depth = $argv{depth} || '';
+  if (! $depth)
+  {
+      foreach my $fyl (@args)
+      {
+          if (my $tmp = find_depth($fyl))
+          {
+              $depth = $tmp;
+              last;
+          }
+      }
+  }
+
+  if (! $depth) {
     # Use $(DEPTH) in the Makefile or Makefile.in to determine the depth
     if (-e "Makefile.in") {
       $depth = find_depth("Makefile.in");
     } elsif (-e "Makefile") {
       $depth = find_depth("Makefile");
     } elsif (-e "../Makefile") {
       $depth = "../".find_depth("../Makefile");
       $depth =~ s/\/\.$//;
@@ -161,44 +293,31 @@ sub parse_arguments {
       warn "Unable to determine depth (e.g. ../..) to root of objdir tree.\n";
       die  "No Makefile(.in) present. Try running with '-d <depth>'\n";
     }
   } 
 
   # Build the list of makefiles to generate
   #
   @makefiles = ();
-  my $makefile;
-  foreach $makefile (@args) {
-    $makefile =~ s/\.in$//;
-    $makefile =~ s/\/$//;
-    $makefile =~ /Makefile$/
-	or $makefile =~ /^\.\//
-	or $makefile .= "/Makefile";
+  while (@args)
+  {
+      next unless my $makefile = shift @args;
+      $makefile =~ s/\.in$//;
+      $makefile =~ s/\/$//;
+      $makefile =~ /Makefile$/
+        or $makefile =~ /^\.\//
+        or $makefile .= "/Makefile";
     push @makefiles, "$makefile";
   }
-  @makefiles = "Makefile" unless @args;
+  @makefiles = "Makefile" unless @makefiles;
 
   return ($topsrcdir, $ptopsrcdir, $depth, @makefiles);
 }
 
-
-# Create all the directories at once.
-#   This can be much faster than calling mkdir() for each one.
-sub create_directories {
-  my @makefiles = @_;
-  my @dirs = ();
-  my $ac_file;
-  foreach $ac_file (@makefiles) {
-    push @dirs, dirname($ac_file);
-  }
-  # Call mkdir with the directories sorted by subdir count (how many /'s)
-  system "mkdir -p ". join(' ', map("\"$_\"", @dirs)) if @dirs;
-}
-
 # Find the top of the source directory
 # (Assuming that the executable is in $top_srcdir/build/autoconf)
 sub find_srcdir {
   my ($ac_given_srcdir, $depth) = @_;
 
   if ($debug) {
     print "ac_given_srcdir = $ac_given_srcdir\n";
     print "depth           = $depth\n";
@@ -209,116 +328,151 @@ sub find_srcdir {
   }
   if ($debug) {
     print "ac_given_srcdir = $ac_given_srcdir\n";
   }
   $ac_given_srcdir = '.' if $ac_given_srcdir eq '';
   return $ac_given_srcdir;
 }
 
-# Output the makefiles.
-#
-sub update_makefiles {
-  my ($ac_given_srcdir, $pac_given_srcdir, @makefiles) = @_;
-  my @unhandled=();
+1;
+###########################################################################
+## perldoc 
+###########################################################################
+__END__
+
+=head1 NAME
+
+make-makefile - Generate a Makefile from a F<Makefile.in> template
+
+=head1 SYNOPSIS
+
+make-makefile [--top t] [--obj o] [--depth d] foo/bar/Makefile.in tans/fans/Makefile foo/bar
+
+=head1 DESCRIPTION
 
-  my $ac_file;
-  foreach $ac_file (@makefiles) {
-    my $ac_file_in    = "$ac_given_srcdir/${ac_file}.in";
-    my $ac_dir        = dirname($ac_file);
-    my $ac_dots       = '';
-    my $ac_dir_suffix = '';
-    my $srcdir        = '.';
-    my $top_srcdir    = '.';
+Given options and makefile path arguments determine path to the template
+F<Makefile.in> beneath a source directory and path to generated F<Makefile>
+beneath $MOZ_OBJDIR.  DEPTH from destination directory to the 'root' will
+also be determined.  F<Makefile.in> will be read in, template strings of the
+gorm @token@ will be replaced with derived values and a generated makefile
+will be written out as F<Makefile>.
+
+Makefile DEPTH= can be determined in a few different ways:
+  o The string C<DEPTH=../../..> may be embedded within F<Makefile.in>.
+  o Search parent directories for F<Makefile.in> and use it to assign the child.
+
+
+=head2 Option List
+
+=over 4
+
+=item --chdir
+
+Move to this directory before doing anything else
 
-    # Determine $srcdir and $top_srcdir
-    #
-    if ($ac_dir ne '.') {
-      $ac_dir_suffix = "/$ac_dir";
-      $ac_dir_suffix =~ s%^/\./%/%;
-      $ac_dots = $ac_dir_suffix;
-      # Remove .. components from the provided dir suffix, and
-      # also the forward path components they were reversing.
-      my $backtracks = $ac_dots =~ s%\.\.(/|$)%%g;
-      while ($backtracks--) {
-        $ac_dots =~ s%/[^/]*%%;
-      }
-      $ac_dots =~ s%/[^/]*%../%g;
-    }
-    if ($ac_given_srcdir eq '.') {
-      if ($ac_dots ne '') {
-        $top_srcdir = $ac_dots;
-        $top_srcdir =~ s%/$%%;
-      }
-    } elsif ($pac_given_srcdir =~ m%^/% or $pac_given_srcdir =~ m%^.:/%) {
-      $srcdir     = "$pac_given_srcdir$ac_dir_suffix";
-      $top_srcdir = "$pac_given_srcdir";
-    } else {
-      if ($debug) {
-      	print "ac_dots       = $ac_dots\n";
-	print "ac_dir_suffix = $ac_dir_suffix\n";
-      }
-      $srcdir     = "$ac_dots$ac_given_srcdir$ac_dir_suffix";
-      $top_srcdir = "$ac_dots$ac_given_srcdir";
-    }
+=item -d, --depth
+
+Explicitly specify the relative path from directory containing Makefile.in
+to the top sandbox directory.  memory/makefile, DEPTH=../.., js/src/config, DEPTH=..
+
+=item --enhanced
+
+Use alternate/simplified path construction when options --top and --obj are
+passed.  This feature will be used by container makefiles to support makefile
+generation while cd'd into the sandbox top directory.
+
+=item -t, --top
+
+Path the root of a development sandbox.
+
+=item --obj
+
+Path to object directory where generated makefile will be written ($MOZ_OBJDIR).
+
+=item --ptop
+
+Print top source dir
+
+=back
+
+
+=head2 Options List DEBUG
+
+=over 4
+
+=item --bench
+
+Enable script benchmarking, report elapsed runtime.
+
+=item --debug
 
-    if ($debug) {
-      print "ac_dir     = $ac_dir\n";
-      print "ac_file    = $ac_file\n";
-      print "ac_file_in = $ac_file_in\n";
-      print "srcdir     = $srcdir\n";
-      print "top_srcdir = $top_srcdir\n";
-      print "cwd        = " . `$pwdcmd` . "\n";
-    }
+Enable script debug mode.
+
+=back
+
+
+=head2 Options List --NO-
+
+=over 4
+
+=item --no-badtokens (wip)
+
+Handle unexpanded @token@ makefile tokens as an error condition.
+Do not rely on system(config.status) to externally supply values.
+
+=item --no-excludes
+
+Ignore file entries on the exclusion list, generate everything.
 
-    # Copy the file and make substitutions.
-    #    @srcdir@     -> value of $srcdir
-    #    @top_srcdir@ -> value of $top_srcdir
-    #
-    if (-e $ac_file) {
-      next if -M _ < -M $ac_file_in;  # Next if Makefile is up-to-date.
-      warn "updating $ac_file\n";
-    } else {
-      warn "creating $ac_file\n";
-    }
+=item --no-warnings
+
+Warnings are handled as an error condition.
+
+=back
+
+
+=head2 Examples
 
-    open INFILE, "<$ac_file_in" or do {
-      warn "$0: Cannot read $ac_file_in: No such file or directory\n";
-      next;
-    };
-    open OUTFILE, ">$ac_file" or do {
-      warn "$0: Unable to create $ac_file\n";
-      next;
-    };
+=over 4
+
+=item * make-makefile -t /mozilla/nightly -d . memory/mozalloc
+
+cd $MOZ_OBJDIR;
+--top and --depth are explicitly set for generting memory/mozalloc/Makefile.
+
+=item * make-makefile -t /mozilla/nightly -d ../../../.. html5lib_tree_construction/Makefile
 
-    while (<INFILE>) {
-      #if (/\@[_a-zA-Z]*\@.*\@[_a-zA-Z]*\@/) {
-      #  #warn "Two defines on a line:$ac_file:$.:$_";
-      #  push @unhandled, $ac_file;
-      #  last;
-      #}
+cd $MOZ_OBJDIR/parser/htmlparser/tests/mochitest
+
+--top and --depth are explicitly set for generting a makefile from within
+a subdirectory of $MOZ_OBJDIR
+
+=item * make-makefile --top /mozilla/nightly --obj /mozilla/nightly/obj memory/mozalloc
 
-      s/\@srcdir\@/$srcdir/g;
-      s/\@top_srcdir\@/$top_srcdir/g;
+With --top and --obj explicitly set generate $MOZ_OBJDIR/memory/mozalloc/Makefile
+while sitting in the sandbox root.
+
+=back
+
+
+=head2 Work In Progress
+
+=over 4
 
-      if (/\@[_a-zA-Z]*\@/) {
-        #warn "Unknown variable:$ac_file:$.:$_";
-        push @unhandled, $ac_file;
-        last;
-      }
-      print OUTFILE;
-    }
-    close INFILE;
-    close OUTFILE;
-  }
-  return @unhandled;
-}
+=item --no-badtokens
+
+Fail on unexpanded @foo@ makefile tokens.  Any tokens that can be expanded
+directly by make-makefile will avoid config.status shell overhead.
+
+=item Depth from delta(--obj, --top)
 
-sub run_config_status {
-  my @unhandled = @_;
+If DEPTH= has not been embedded within a makefile the value could
+be set directly if --top and --obj are specified and the paths overlap.
+
+=back
+
 
-  # Run config.status with any unhandled files.
-  #
-  if (@unhandled) {
-    $ENV{CONFIG_FILES}= join ' ', @unhandled;
-    system "./config.status";
-  }
-}
+=head1 SEE ALSO
+
+L<config/rules.mk>
+
+=cut
new file mode 100644
--- /dev/null
+++ b/build/autoconf/make-makefile.excl
@@ -0,0 +1,5 @@
+###########################################################################
+## Intent: Exclusion list for container make builds
+###########################################################################
+
+# EOF
new file mode 100644
--- /dev/null
+++ b/build/autoconf/makemakefile.pm
@@ -0,0 +1,745 @@
+package makemakefile;
+
+# ***** 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) 1999-2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Steve Lamm <slamm@netscape.com>
+#   Joey Armstrong <joey@mozilla.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 *****
+
+##----------------------------##
+##---] CORE/CPAN INCLUDES [---##
+##----------------------------##
+use strict;
+use warnings;
+# use feature 'state'; 5.10+ not available everywhere
+
+##-------------------##
+##---]  EXPORTS  [---##
+##-------------------##
+our $VERSION = qw(2.0);
+use Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(dirname_legacy
+                 getConfig getDepth getRelPath getObjDir getTopDir mkdirr
+                 getExclusions
+                 run_config_status
+                 updateMakefiles
+                 update_makefiles_legacy
+                 );
+
+##--------------------##
+##---]  INCLUDES  [---##
+##--------------------##
+use Cwd;
+use Cwd     qw{abs_path};
+use FindBin;
+use File::Basename;
+use File::Copy;
+
+##-------------------##
+##---]  GLOBALS  [---##
+##-------------------##
+umask 0;
+my $cwd = Cwd::abs_path('.');
+my %argv;
+
+
+###########################################################################
+## Intent: Helper function, retrieve contents of a file with error checking
+## -----------------------------------------------------------------------
+## Args:
+##   scalar   path to input file
+## Returns:
+##   array    contents of the given file
+##   $@       set on error
+###########################################################################
+sub cat
+{
+    my $fyl = shift || '';
+    $@ = '';
+    my @data;
+
+    local *FYL;
+    if (!open(FYL, $fyl))
+    {
+        $@ = "open($fyl) failed: $!";
+    }
+    else
+    {
+        @data = <FYL>;
+        close(FYL);
+    }
+    return @data;
+} # cat
+
+###########################################################################
+## Intent: Return directory path for a given argument
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+## Todo:
+##   o Check if function can be replaced by File::Basename::dirname()
+###########################################################################
+sub dirname_legacy
+{
+    my $str = (@_ && defined($_[0])) ? shift : '';
+    return $str =~ /(.*)\/.*/ ? "$1" : '.';
+}
+
+###########################################################################
+## Intent: Given a list of makefile paths recursively create all
+##         directories between file and the root
+## -----------------------------------------------------------------------
+## Args:
+##   array   A list of makefiles
+##   fargs   Function arguments
+##     mode  Filesystem mode used for directory creation
+## Returns:
+##   $@      Set on error
+##   0       on success
+## -----------------------------------------------------------------------
+## Note:
+##   Reporting directory creation can be enabled by the --verbose
+##   command line argument.
+###########################################################################
+sub mkdirr
+{
+    my %fargs = (@_ && ref($_[$#_])) ? %{ (pop) } : ();
+    my $mode = $fargs{mode} || 0755;
+    my $verbose = $main::argv{verbose} || 0;
+    $@ = '' unless ($fargs{recursive});
+    $fargs{recursive} = 1;
+
+    my @errors;
+    push(@errors, $@) if ($@);
+    foreach my $path (@_)
+    {
+        (my $dir = $path) =~ s%/?Makefile[^/]*$%%o;
+        next unless (length($dir));
+        next if (-e $dir);
+        mkdirr( dirname($dir), \%fargs);
+        eval{ File::Path::mkpath($dir, $verbose, 0755); };
+        push(@errors, $@) if ($@);
+    }
+    $@ = join("\n", @errors);
+    return $@ ? 0 : 1;
+} # mkdirr
+
+###########################################################################
+## Intent: Read in configure values and return a hash of key/value pairs
+## -----------------------------------------------------------------------
+## Args:
+##   fargs  Function arguments
+##     reset   clear value storage and repopulate
+## Returns:
+##   hash  configure data to use for makefile substitutions
+## -----------------------------------------------------------------------
+## Todo: wrapper for reading config* and run_config_status
+###########################################################################
+my %_CONFIG_; # todo: state %config; w/5.10
+sub getConfig
+{
+    my %fargs = (@_ && ref($_[$#_]) eq 'HASH') ? %{ (pop) } : ();
+    if ($fargs{reset})
+    {
+        %_CONFIG_ = ();
+        shift;
+    }
+
+    #my $ac_file_in    = "$ac_given_srcdir/${ac_file}.in";
+    #my $ac_dir        = dirname_legacy($ac_file);
+    #my $ac_dots       = '';
+    #my $ac_dir_suffix = '';
+    #my $srcdir        = '.';
+    #my $top_srcdir    = '.';
+    unless (%_CONFIG_)
+    {
+        while (@_)
+        {
+            my ($k, $v) = splice(@_, 0, 2);
+            $_CONFIG_{$k} = $v;
+        }
+    }
+
+    return %_CONFIG_;
+} # getConfig
+
+###########################################################################
+## Intent: Determine path depth between leaf and root directory.
+##   o DEPTH= may be set by makefile content
+##   o DEPTH= may be set by Makefile in a parent
+##   o Manually determine by relpath form leaf to sandbox top
+## -----------------------------------------------------------------------
+## Args:
+##   scalar  Path to makefile or directory to determine DEPTH for
+## Returns:
+##   scalar  Relative path from leaf to root directory
+## -----------------------------------------------------------------------
+###########################################################################
+sub getDepth($)
+{
+    my $fyl = shift || '';
+
+    my @path = split(m%/%o, $fyl);
+    pop(@path) if ('Makefile' eq substr($path[$#path], 0, 8));
+    my $depth;
+    my @depth;
+
+    my $top = getTopDir();
+    my @top = split(m%/%o, $top);
+    my @pathNoTop = @path;
+    splice(@pathNoTop, 0, scalar(@top));
+
+    SEARCH:
+    while (@path)
+    {
+        ## Search for a file containing DEPTH=../..
+        foreach my $fyl ( qw{Makefile.in Makefile} )
+        {
+            my $path = join('/', @path, $fyl);
+            local *FYL;
+            if (!open(FYL, $path)) {} # NOP
+            elsif (my @tmp = map{ /^\s*DEPTH\s*=\s*([\.\/]+)/o ? $1 : () } <FYL>)
+            {
+                $depth = join('/', @depth, shift @tmp);
+                last SEARCH;
+            }
+            close(FYL);
+        }
+        pop @path;
+        pop @pathNoTop;
+
+        if (0 == scalar(@pathNoTop))
+        {
+            $depth = join('/', @depth);
+            last;
+        }
+        
+        ## Construct path manually
+        push(@depth, '..');
+    }
+    return $depth;
+} # getDepth
+
+###########################################################################
+## Intent: Read in the exclusion file
+###########################################################################
+sub getExclusions
+{
+    my $file = shift || '';
+    
+    return () if ($main::argv{'no-exclusions'});
+
+    my %exclude;
+    if ($file)
+    {
+        my @data = cat($file);
+        foreach (@data)
+        {
+            next unless ($_);
+            next if (/^\s*\#/o);
+            next unless (m%/%);
+            chomp;
+            $exclude{$_}++;
+        }
+    }
+    return %exclude;
+} # getExclusions
+
+###########################################################################
+## Intent: Given the path to a makefile beneath either src or obj
+##         derive the relative path prefix between makefile and root.
+###########################################################################
+sub getRelPath
+{
+    my $path0 =  shift;
+    my $abspath;
+
+    # Determine type and orientation
+    my $name = basename($path0);
+    my $haveMF = ($name eq 'Makefile.in') ? 1
+        : ($name eq 'Makefile') ? -1
+        : 0
+        ;
+
+    ####################################################
+    ## Prep work: form a relative path with ../ removed
+    ####################################################
+    my $top = getTopDir();
+    my $obj = getObjDir();
+    ## If the same Makefile will be created alongside Makefile.in
+    my $topQM = quotemeta($top);
+    my $objQM = quotemeta($obj);
+
+    if ('..' eq substr($path0, 0, 2))
+    {
+        my @cwd = split(m%/%, $cwd);
+        my @pth = split(m%/%, $path0);
+        while (@pth && $pth[0] eq '..')
+        {
+            pop(@cwd);
+            shift @pth;
+        }
+        $path0 = join('/', @cwd, @pth);
+        $abspath = $path0;
+    }
+
+    if ('/' eq substr($path0, 0, 1))
+    {
+        $path0 =~ s%^$objQM\/?%%;
+        $path0 =~ s%^$topQM\/?%%;
+    }
+
+    #######################################################################
+    ## Build a list of directories to search.  Input source will be one
+    ## of path to Makefile.in, path to Makefile, directory, file within
+    ## a directory or relative path from cwd.
+    #######################################################################
+    my @subdirs;
+    my $path = (0 == $haveMF) ? $path0 : dirname($path0);
+    push(@subdirs, $path); # containing directory
+    push(@subdirs, dirname($path)) if (0 == $haveMF && -f $path); # Arg is file within a directory
+    push(@subdirs, $cwd);  # relative to pwd
+
+    # obj - path to generated makefile
+    # top - path to Makefile.in source template
+    my @prefixes = ('/' ne substr($path0, 0, 1))
+        ? (&getTopDir, &getObjDir)
+        : ()
+        ;
+
+  ON_SAFARI:
+    for my $prefix (@prefixes)
+    {
+        next unless ($prefix); # no command line not passed
+        foreach my $subdir (@subdirs)
+        {
+            foreach my $mf ('Makefile.in', 'Makefile')
+            {
+                my $path = join('/', $prefix, $subdir, $mf);
+                if (-e $path)
+                {
+                    $name = $mf;
+                    $haveMF = ($mf eq 'Makefile.in') ? 1 : -1;
+                    $abspath = $path;
+                    last ON_SAFARI;
+                }
+            }
+        }
+    }
+
+    #######################################################################
+    ## Generated makefile does not yet exist or path is invalid.
+    ## Should this conditon be handled to detect non-existent Makefile.in:
+    ##   Makefile.am => Makefile.in => Makefile but Makefile.in
+    #######################################################################
+    if (!$abspath && -1 == $haveMF && $obj)
+    {
+        $abspath = ('/' eq substr($path0, 0, 1)) 
+            ? $path0
+            : join('/', $obj, $path0)
+            ;
+    }
+
+    ########################################################
+    ## If --top and/or --obj specified extract relative path
+    ########################################################
+    my $relpath;
+    if (! $abspath)
+    {
+        # Error, fall through
+    }
+    elsif (1 == $haveMF) # Makefile.in
+    {
+        ## err w/o --top
+        (my $tmp = $abspath) =~ s%^$topQM/?%%;
+        $relpath = dirname($tmp) unless ($tmp eq $abspath);
+    }
+    elsif (-1 == $haveMF) # Makefile
+    {
+        ## err w/o --obj
+        (my $tmp = $abspath) =~ s%^$objQM/?%%;
+        $relpath = dirname($tmp) unless ($tmp eq $abspath);
+    }
+
+    $relpath ||= '';
+    $relpath =~ s%/./%/%og; # filter ./
+
+    $@ = ($relpath) ? '' : "ERROR($path0): Unable to locate sources";
+    return $relpath || '';
+} # getRelPath
+
+###########################################################################
+## Intent: Determine sandbox root from script startup directory
+## -----------------------------------------------------------------------
+## Args:
+##    _set_    optional, if passed use the given value as path
+##    _reset_  clear cached directory path to reassign
+## Returns:
+##   scalar - absolute path to the sandbox root directory
+## -----------------------------------------------------------------------
+###########################################################################
+my $gtd_dir;
+sub getTopDir
+{
+    if (@_) # testing override
+    {
+        $gtd_dir = abs_path($_[1] || '.') if ($_[0] eq '_set_');
+        $gtd_dir = ''    if ($_[0] eq '_reset_');
+    }
+
+    unless ($gtd_dir)
+    {
+        ## Set by command line
+        if ($main::argv{top})
+        {
+            $gtd_dir = $main::argv{top};
+        }
+        else
+        {
+            my $path = abs_path($FindBin::RealBin);
+            my @path = split(m%/%o, $path);
+            ## --2 memory/mozalloc/Makefile.in
+            ## --3 was this for FindBin::Script ?
+            splice(@path, -2);
+            $gtd_dir = join('/', @path);
+        }
+    }
+    return $gtd_dir;
+} # getTopDir
+
+###########################################################################
+## Intent: Determine path to MOZ_OBJDIR/object directory
+## -----------------------------------------------------------------------
+## Args:
+##   _set_    optional testing arg, if passed re-compute cached value
+## Returns:
+##   scalar - absolute path to the sandbox object directory
+## -----------------------------------------------------------------------
+###########################################################################
+my $god_dir;