Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Thu, 08 Dec 2011 12:07:54 -0800
changeset 111690 046f56a7f5bf81ca094d3b950717186195dd53c8
parent 111689 dccc47e6137a1db2ae7ac6e941f9c47b7799c82f (current diff)
parent 83895 5c8405e6226eda1629be41b51a044eab8ac52740 (diff)
child 111691 e286c0ea289ffa1d8bcf5bb109334bc647cfa65b
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge from mozilla-central.
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/mac/nsAccessibleWrap.h
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/msaa/nsAccessNodeWrap.cpp
accessible/src/msaa/nsAccessNodeWrap.h
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsDocAccessibleWrap.cpp
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/tests/mochitest/events.js
b2g/app/nsBrowserApp.cpp
b2g/chrome/jar.mn
b2g/confvars.sh
b2g/installer/package-manifest.in
b2g/locales/en-US/chrome/webapps.dtd
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/nsContextMenu.js
browser/base/content/tabbrowser.xml
browser/components/sessionstore/src/nsSessionStore.js
browser/components/tabview/test/Makefile.in
browser/components/tabview/ui.js
browser/devtools/highlighter/test/browser_inspector_initialization.js
browser/devtools/webconsole/HUDService.jsm
browser/devtools/webconsole/test/browser/Makefile.in
chrome/src/nsChromeRegistry.h
chrome/src/nsChromeRegistryChrome.cpp
config/autoconf.mk.in
configure.in
content/base/public/nsContentPolicyUtils.h
content/base/public/nsIContent.h
content/base/public/nsIDOMGCParticipant.h
content/base/public/nsIDocument.h
content/base/public/nsINode.h
content/base/src/nsCSPService.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsDocument.cpp
content/base/src/nsDocument.h
content/base/src/nsEventSource.cpp
content/base/src/nsEventSource.h
content/base/src/nsFrameLoader.cpp
content/base/src/nsFrameLoader.h
content/base/src/nsGenericElement.cpp
content/base/src/nsInProcessTabChildGlobal.cpp
content/base/src/nsNoDataProtocolContentPolicy.cpp
content/base/src/nsWebSocket.cpp
content/base/src/nsXMLHttpRequest.cpp
content/base/src/nsXMLHttpRequest.h
content/base/test/Makefile.in
content/base/test/test_XHR.html
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMEventTargetHelper.cpp
content/events/src/nsDOMEventTargetHelper.h
content/events/src/nsEventDispatcher.cpp
content/html/content/src/nsHTMLSharedObjectElement.cpp
content/html/content/test/file_fullscreen-api.html
content/svg/content/src/Makefile.in
content/svg/content/src/nsSVGAnimationElement.cpp
content/svg/content/src/nsSVGElement.cpp
docshell/shistory/src/nsSHistory.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/base/nsGlobalWindow.cpp
dom/indexedDB/IDBDatabase.cpp
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/indexedDB/IDBTransaction.cpp
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/locales/en-US/chrome/dom/dom.properties
dom/plugins/base/android/ANPCanvas.cpp
dom/plugins/base/android/ANPPaint.cpp
dom/plugins/base/android/ANPPath.cpp
dom/plugins/base/android/ANPTypeface.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginInstanceOwner.h
dom/telephony/Radio.cpp
dom/telephony/Radio.h
dom/telephony/worker-component/Makefile.in
dom/telephony/worker-component/nsIRadioInterface.idl
dom/telephony/worker-component/nsITelephonyWorker.idl
dom/telephony/worker-component/nsTelephonyWorker.js
dom/telephony/worker-component/nsTelephonyWorker.manifest
dom/telephony/worker-component/ril_consts.js
dom/telephony/worker-component/ril_worker.js
dom/tests/browser/browser_popup_blocker_save_open_panel.js
dom/workers/RuntimeService.cpp
editor/libeditor/base/nsEditor.cpp
embedding/android/AndroidManifest.xml.in
embedding/android/GeckoApp.java
embedding/android/GeckoAppShell.java
embedding/android/GeckoConnectivityReceiver.java
embedding/android/GeckoSurfaceView.java
embedding/android/LauncherShortcuts.java.in
embedding/android/Makefile.in
extensions/permissions/nsContentBlocker.cpp
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEGL.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxGDIFont.cpp
intl/hyphenation/src/nsHyphenationManager.cpp
js/src/assembler/assembler/ARMAssembler.cpp
js/src/configure.in
js/src/frontend/BytecodeEmitter.cpp
js/src/jit-test/jit_test.py
js/src/jit-test/tests/basic/arith.js
js/src/jit-test/tests/basic/bug489098.js
js/src/jit-test/tests/basic/jitstatsArchFlags.js
js/src/jit-test/tests/basic/testArrayIn.js
js/src/jit-test/tests/basic/testBreak.js
js/src/jit-test/tests/basic/testCallNull.js
js/src/jit-test/tests/basic/testContinueWithLabel2.js
js/src/jit-test/tests/basic/testHOTLOOPCorrectness.js
js/src/jit-test/tests/basic/testInitMethod.js
js/src/jit-test/tests/basic/testMethodInitDeref.js
js/src/jit-test/tests/basic/testMethodInitUneval.js
js/src/jit-test/tests/basic/testMethodOverride.js
js/src/jit-test/tests/basic/testNewDate.js
js/src/jit-test/tests/basic/testRUNLOOPCorrectness.js
js/src/jit-test/tests/basic/testRegExpLiteral.js
js/src/jit-test/tests/basic/testSetMethod.js
js/src/jit-test/tests/basic/testSideExitInConstructor.js
js/src/jit-test/tests/basic/testStringPropIncrement.js
js/src/jit-test/tests/basic/wrap-primitive-this.js
js/src/jit-test/tests/jaeger/bug580884-2.js
js/src/jsanalyze.cpp
js/src/jsanalyze.h
js/src/jsapi.cpp
js/src/jsarray.cpp
js/src/jsatom.cpp
js/src/jsatominlines.h
js/src/jsbool.cpp
js/src/jscntxt.cpp
js/src/jscntxt.h
js/src/jscntxtinlines.h
js/src/jscompartment.cpp
js/src/jscompartment.h
js/src/jsdate.cpp
js/src/jsdbgapi.cpp
js/src/jsdbgapi.h
js/src/jsexn.cpp
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/jsfun.cpp
js/src/jsgc.cpp
js/src/jsgcmark.cpp
js/src/jsgcmark.h
js/src/jsinfer.cpp
js/src/jsinterp.cpp
js/src/jsinterp.h
js/src/jsinterpinlines.h
js/src/jsiter.cpp
js/src/jsnum.cpp
js/src/jsobj.cpp
js/src/jsobjinlines.h
js/src/json.cpp
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsopcode.tbl
js/src/jspropertycache.cpp
js/src/jsproxy.cpp
js/src/jsprvtd.h
js/src/jsreflect.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsscriptinlines.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/jstypedarray.cpp
js/src/jsxml.cpp
js/src/methodjit/Compiler.cpp
js/src/methodjit/FastArithmetic.cpp
js/src/methodjit/FastOps.cpp
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/LoopState.cpp
js/src/methodjit/MethodJIT.h
js/src/methodjit/PolyIC.cpp
js/src/methodjit/StubCalls.cpp
js/src/shell/js.cpp
js/src/vm/Debugger.cpp
js/src/vm/Stack.cpp
js/src/vm/Stack.h
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.h
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCMaps.cpp
js/xpconnect/src/XPCMaps.h
js/xpconnect/src/XPCThreadContext.cpp
js/xpconnect/src/XPCWrappedNativeInfo.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
js/xpconnect/wrappers/WrapperFactory.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/crashtests/crashtests.list
layout/base/nsBidiPresUtils.cpp
layout/base/nsCSSRendering.cpp
layout/base/nsPresShell.cpp
layout/build/Makefile.in
layout/build/nsLayoutModule.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsIFrame.h
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsSimplePageSequence.h
layout/generic/nsSubDocumentFrame.cpp
layout/reftests/border-radius/reftest.list
layout/reftests/reftest.list
layout/reftests/svg/as-image/lime-anim-100x100.svg
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsCSSRuleProcessor.h
layout/style/test/test_transitions_per_property.html
layout/svg/base/src/nsSVGUtils.cpp
layout/tables/crashtests/crashtests.list
layout/tables/nsTableCellFrame.cpp
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoConnectivityReceiver.java
mobile/android/base/LauncherShortcuts.java.in
mobile/android/base/Makefile.in
mobile/xul/chrome/content/browser.js
mobile/xul/chrome/content/content.js
mobile/xul/installer/package-manifest.in
mobile/xul/locales/l10n-central.ini
mobile/xul/locales/l10n-mozilla-1.9.2.ini
mobile/xul/locales/l10n-mozilla-2.0.ini
modules/libjar/nsJAR.cpp
modules/libjar/nsJAR.h
modules/libjar/nsZipArchive.cpp
modules/libjar/nsZipArchive.h
modules/libpref/src/Preferences.cpp
modules/libpref/src/init/all.js
netwerk/base/public/nsNetUtil.h
netwerk/dns/nsHostResolver.h
netwerk/protocol/http/nsHttpConnectionMgr.cpp
other-licenses/android/APKOpen.cpp
other-licenses/android/Makefile.in
other-licenses/android/nsGeckoUtils.cpp
security/manager/ssl/src/nsNSSCallbacks.cpp
startupcache/StartupCache.cpp
startupcache/StartupCache.h
storage/src/mozStorageAsyncStatement.cpp
storage/src/mozStorageAsyncStatementExecution.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStorageConnection.h
storage/src/mozStorageStatement.cpp
testing/mozbase/manifestdestiny/README.txt
testing/mozbase/manifestdestiny/manifestparser.py
testing/mozbase/mozhttpd/mozhttpd.py
testing/mozbase/mozinfo/mozinfo.py
testing/mozbase/mozinstall/mozinstall.py
testing/testsuite-targets.mk
toolkit/components/aboutmemory/content/aboutMemory.js
toolkit/components/aboutmemory/tests/chrome/test_asyncClose_leak.xul
toolkit/components/places/History.cpp
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/nsNavBookmarks.h
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/tests/head_common.js
toolkit/components/prompts/content/tabprompts.xml
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
toolkit/content/license.html
toolkit/content/widgets/videocontrols.css
toolkit/content/widgets/videocontrols.xml
toolkit/locales/en-US/chrome/global/videocontrols.dtd
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/update/nsUpdateService.js
toolkit/themes/pinstripe/global/media/videocontrols.css
toolkit/themes/winstripe/global/media/videocontrols.css
toolkit/xre/nsAndroidStartup.cpp
tools/profiler/sps/Makefile.in
widget/src/android/AndroidBridge.cpp
widget/src/android/AndroidBridge.h
widget/src/android/AndroidJNI.cpp
widget/src/android/nsAppShell.cpp
widget/src/android/nsWindow.cpp
widget/src/android/nsWindow.h
widget/src/gtk2/nsPrintSettingsGTK.cpp
widget/src/gtk2/nsPrintSettingsGTK.h
widget/src/windows/nsFilePicker.cpp
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
widget/src/xpwidgets/nsPrintSettingsImpl.cpp
xpcom/analysis/final.js
xpcom/base/nsConsoleService.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsStackWalk.cpp
xpcom/build/Omnijar.cpp
xpcom/build/Omnijar.h
xpcom/components/nsComponentManager.cpp
xpcom/components/nsComponentManager.h
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsTHashtable.h
xpcom/glue/pldhash.cpp
xpcom/glue/pldhash.h
xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp
xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
xpcom/reflect/xptinfo/src/xptiprivate.h
xpcom/string/public/nsTString.h
xpcom/tests/static-checker/TestFinal.cpp
xpcom/tests/static-checker/TestFinalFunction.cpp
xpcom/tests/static-checker/TestFinalGrandparentFunction.cpp
xpcom/tests/static-checker/TestFinalTemplate.cpp
xulrunner/installer/debian/postinst
xulrunner/installer/debian/prerm
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1537,41 +1537,29 @@ nsAccessible::State()
     // XXX: Perhaps we will be able to make this less hacky if we support
     // extended states in nsARIAMap, e.g. derive COLLAPSED from
     // EXPANDABLE && !EXPANDED.
     state &= ~states::COLLAPSED;
   }
 
   if (!(state & states::UNAVAILABLE)) {
     state |= states::ENABLED | states::SENSITIVE;
+
+    // If the object is a current item of container widget then mark it as
+    // ACTIVE. This allows screen reader virtual buffer modes to know which
+    // descendant is the current one that would get focus if the user navigates
+    // to the container widget.
+    nsAccessible* widget = ContainerWidget();
+    if (widget && widget->CurrentItem() == this)
+      state |= states::ACTIVE;
   }
 
   if ((state & states::COLLAPSED) || (state & states::EXPANDED))
     state |= states::EXPANDABLE;
 
-  if (mRoleMapEntry) {
-    // If an object has an ancestor with the activedescendant property
-    // pointing at it, we mark it as ACTIVE even if it's not currently focused.
-    // This allows screen reader virtual buffer modes to know which descendant
-    // is the current one that would get focus if the user navigates to the container widget.
-    nsAutoString id;
-    if (nsCoreUtils::GetID(mContent, id)) {
-      nsIContent *ancestorContent = mContent;
-      nsAutoString activeID;
-      while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
-        if (ancestorContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, activeID)) {
-          if (id == activeID) {
-            state |= states::ACTIVE;
-          }
-          break;
-        }
-      }
-    }
-  }
-
   // For some reasons DOM node may have not a frame. We tract such accessibles
   // as invisible.
   nsIFrame *frame = GetFrame();
   if (!frame)
     return state;
 
   const nsStyleDisplay* display = frame->GetStyleDisplay();
   if (display && display->mOpacity == 1.0f &&
@@ -2950,25 +2938,28 @@ nsAccessible::CurrentItem()
 }
 
 nsAccessible*
 nsAccessible::ContainerWidget() const
 {
   nsIAtom* idAttribute = mContent->GetIDAttributeName();
   if (idAttribute) {
     if (mContent->HasAttr(kNameSpaceID_None, idAttribute)) {
-      nsAccessible* parent = Parent();
-      do {
+      for (nsAccessible* parent = Parent(); parent; parent = parent->Parent()) {
         nsIContent* parentContent = parent->GetContent();
         if (parentContent &&
             parentContent->HasAttr(kNameSpaceID_None,
                                    nsGkAtoms::aria_activedescendant)) {
           return parent;
         }
-      } while ((parent = parent->Parent()));
+
+        // Don't cross DOM document boundaries.
+        if (parent->IsDocumentNode())
+          break;
+      }
     }
   }
   return nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible protected methods
 
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -298,26 +298,24 @@ nsTextEquivUtils::AppendFromValue(nsAcce
   }
 
   //XXX: is it necessary to care the accessible is not a document?
   if (aAccessible->IsDocumentNode())
     return NS_ERROR_UNEXPECTED;
 
   nsIContent *content = aAccessible->GetContent();
 
-  nsCOMPtr<nsIContent> parent = content->GetParent();
-  PRInt32 indexOf = parent->IndexOf(content);
-
-  for (PRInt32 i = indexOf - 1; i >= 0; i--) {
+  for (nsIContent* childContent = content->GetPreviousSibling(); childContent;
+       childContent = childContent->GetPreviousSibling()) {
     // check for preceding text...
-    if (!parent->GetChildAt(i)->TextIsOnlyWhitespace()) {
-      PRUint32 childCount = parent->GetChildCount();
-      for (PRUint32 j = indexOf + 1; j < childCount; j++) {
+    if (!childContent->TextIsOnlyWhitespace()) {
+      for (nsIContent* siblingContent = content->GetNextSibling(); siblingContent;
+           siblingContent = siblingContent->GetNextSibling()) {
         // .. and subsequent text
-        if (!parent->GetChildAt(j)->TextIsOnlyWhitespace()) {
+        if (!siblingContent->TextIsOnlyWhitespace()) {
           nsresult rv = aAccessible->GetValue(text);
           NS_ENSURE_SUCCESS(rv, rv);
 
           return AppendString(aString, text) ?
             NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
           break;
         }
       }
@@ -327,20 +325,18 @@ nsTextEquivUtils::AppendFromValue(nsAcce
 
   return NS_OK_NO_NAME_CLAUSE_HANDLED;
 }
 
 nsresult
 nsTextEquivUtils::AppendFromDOMChildren(nsIContent *aContent,
                                         nsAString *aString)
 {
-  PRUint32 childCount = aContent->GetChildCount();
-  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsCOMPtr<nsIContent> childContent = aContent->GetChildAt(childIdx);
-
+  for (nsIContent* childContent = aContent->GetFirstChild(); childContent;
+       childContent = childContent->GetNextSibling()) {
     nsresult rv = AppendFromDOMNode(childContent, aString);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 nsresult
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -715,21 +715,21 @@ nsHTMLGroupboxAccessible::
 }
 
 PRUint32
 nsHTMLGroupboxAccessible::NativeRole()
 {
   return nsIAccessibleRole::ROLE_GROUPING;
 }
 
-nsIContent* nsHTMLGroupboxAccessible::GetLegend()
+nsIContent*
+nsHTMLGroupboxAccessible::GetLegend()
 {
-  nsresult count = 0;
-  nsIContent *legendContent = nsnull;
-  while ((legendContent = mContent->GetChildAt(count++)) != nsnull) {
+  for (nsIContent* legendContent = mContent->GetFirstChild(); legendContent;
+       legendContent = legendContent->GetNextSibling()) {
     if (legendContent->NodeInfo()->Equals(nsGkAtoms::legend,
                                           mContent->GetNameSpaceID())) {
       // Either XHTML namespace or no namespace
       return legendContent;
     }
   }
 
   return nsnull;
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -166,19 +166,18 @@ nsHTMLSelectListAccessible::CacheChildre
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectListAccessible protected
 
 void
 nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
 {
   nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
-  PRUint32 numChildren = aParentContent->GetChildCount();
-  for (PRUint32 count = 0; count < numChildren; count ++) {
-    nsIContent *childContent = aParentContent->GetChildAt(count);
+  for (nsIContent* childContent = aParentContent->GetFirstChild(); childContent;
+       childContent = childContent->GetNextSibling()) {
     if (!childContent->IsHTML()) {
       continue;
     }
 
     nsCOMPtr<nsIAtom> tag = childContent->Tag();
     if (tag == nsGkAtoms::option ||
         tag == nsGkAtoms::optgroup) {
 
@@ -225,17 +224,17 @@ nsHTMLSelectOptionAccessible::GetNameInt
   // CASE #1 -- great majority of the cases
   // find the label attribute - this is what the W3C says we should use
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
   if (!aName.IsEmpty())
     return NS_OK;
 
   // CASE #2 -- no label parameter, get the first child, 
   // use it if it is a text node
-  nsIContent *text = mContent->GetChildAt(0);
+  nsIContent* text = mContent->GetFirstChild();
   if (!text)
     return NS_OK;
 
   if (text->IsNodeOfType(nsINode::eTEXT)) {
     nsAutoString txtValue;
     nsresult rv = nsTextEquivUtils::
       AppendTextEquivFromTextContent(text, &txtValue);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -340,24 +339,22 @@ nsHTMLSelectOptionAccessible::GetLevelIn
 
   return level;
 }
 
 void
 nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                                          PRInt32 *aSetSize)
 {
-  nsIContent *parentContent = mContent->GetParent();
-
   PRInt32 posInSet = 0, setSize = 0;
   bool isContentFound = false;
 
-  PRUint32 childCount = parentContent->GetChildCount();
-  for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsIContent *childContent = parentContent->GetChildAt(childIdx);
+  nsIContent* parentContent = mContent->GetParent();
+  for (nsIContent* childContent = parentContent->GetFirstChild(); childContent;
+       childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(mContent->NodeInfo())) {
       if (!isContentFound) {
         if (childContent == mContent)
           isContentFound = true;
 
         posInSet++;
       }
       setSize++;
@@ -784,17 +781,17 @@ void nsHTMLComboboxListAccessible::GetBo
     return;
 
   if (0 == (comboAcc->State() & states::COLLAPSED)) {
     nsHTMLSelectListAccessible::GetBoundsRect(aBounds, aBoundingFrame);
     return;
   }
 
   // Get the first option.
-  nsIContent* content = mContent->GetChildAt(0);
+  nsIContent* content = mContent->GetFirstChild();
   if (!content) {
     return;
   }
   nsIFrame* frame = content->GetPrimaryFrame();
   if (!frame) {
     *aBoundingFrame = nsnull;
     return;
   }
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -401,38 +401,35 @@ nsHTMLTableHeaderCellAccessible::NativeR
     case 0:
       return nsIAccessibleRole::ROLE_COLUMNHEADER;
     case 1:
       return nsIAccessibleRole::ROLE_ROWHEADER;
   }
 
   // Assume it's columnheader if there are headers in siblings, oterwise
   // rowheader.
-  nsIContent *parent = mContent->GetParent();
-  if (!parent) {
+  nsIContent* parentContent = mContent->GetParent();
+  if (!parentContent) {
     NS_ERROR("Deattached content on alive accessible?");
     return nsIAccessibleRole::ROLE_NOTHING;
   }
 
-  PRInt32 indexInParent = parent->IndexOf(mContent);
-
-  for (PRInt32 idx = indexInParent - 1; idx >= 0; idx--) {
-    nsIContent* sibling = parent->GetChildAt(idx);
-    if (sibling && sibling->IsElement()) {
-      if (nsCoreUtils::IsHTMLTableHeader(sibling))
+  for (nsIContent* siblingContent = mContent->GetPreviousSibling(); siblingContent;
+       siblingContent = siblingContent->GetPreviousSibling()) {
+    if (siblingContent->IsElement()) {
+      if (nsCoreUtils::IsHTMLTableHeader(siblingContent))
         return nsIAccessibleRole::ROLE_COLUMNHEADER;
       return nsIAccessibleRole::ROLE_ROWHEADER;
     }
   }
 
-  PRInt32 childCount = parent->GetChildCount();
-  for (PRInt32 idx = indexInParent + 1; idx < childCount; idx++) {
-    nsIContent* sibling = parent->GetChildAt(idx);
-    if (sibling && sibling->IsElement()) {
-      if (nsCoreUtils::IsHTMLTableHeader(sibling))
+  for (nsIContent* siblingContent = mContent->GetNextSibling(); siblingContent;
+       siblingContent = siblingContent->GetNextSibling()) {
+    if (siblingContent->IsElement()) {
+      if (nsCoreUtils::IsHTMLTableHeader(siblingContent))
         return nsIAccessibleRole::ROLE_COLUMNHEADER;
       return nsIAccessibleRole::ROLE_ROWHEADER;
     }
   }
 
   // No elements in siblings what means the table has one column only. Therefore
   // it should be column header.
   return nsIAccessibleRole::ROLE_COLUMNHEADER;
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -386,19 +386,19 @@ GetNativeFromGeckoAccessible(nsIAccessib
 }
 
 // gets our native children lazily.
 // returns nil when there are no children.
 - (NSArray*)children
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if (mChildren)
+  if (mChildren || !mGeckoAccessible->AreChildrenCached())
     return mChildren;
-    
+
   mChildren = [[NSMutableArray alloc] init];
   
   // get the array of children.
   nsTArray<nsRefPtr<nsAccessibleWrap> > childrenArray;
   mGeckoAccessible->GetUnignoredChildren(childrenArray);
   
   // now iterate through the children array, and get each native accessible.
   int totalCount = childrenArray.Length();
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -78,18 +78,16 @@ class nsAccessibleWrap : public nsAccess
     virtual void InvalidateChildren();
 
     virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
     // ignored means that the accessible might still have children, but is not displayed
     // to the user. it also has no native accessible object represented for it.
     bool IsIgnored();
     
-    PRInt32 GetUnignoredChildCount(bool aDeepCount);
-    
     bool HasPopup () {
       return (NativeState() & mozilla::a11y::states::HASPOPUP);
     }
     
     // return this accessible's all children, adhering to "flat" accessibles by not returning their children.
     void GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray);
     virtual already_AddRefed<nsIAccessible> GetUnignoredParent();
     
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -205,52 +205,16 @@ nsAccessibleWrap::InvalidateChildren()
     mozAccessible *object = mNativeWrapper->getNativeObject();
     [object invalidateChildren];
   }
   nsAccessible::InvalidateChildren();
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-PRInt32
-nsAccessibleWrap::GetUnignoredChildCount(bool aDeepCount)
-{
-  // if we're flat, we have no children.
-  if (nsAccUtils::MustPrune(this))
-    return 0;
-
-  PRInt32 resultChildCount = 0;
-
-  PRInt32 childCount = GetChildCount();
-  for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
-    nsAccessibleWrap *childAcc =
-      static_cast<nsAccessibleWrap*>(GetChildAt(childIdx));
-
-    // if the current child is not ignored, count it.
-    if (!childAcc->IsIgnored())
-      ++resultChildCount;
-
-    // if it's flat, we don't care to inspect its children.
-    if (nsAccUtils::MustPrune(childAcc))
-      continue;
-
-    if (aDeepCount) {
-      // recursively count the unignored children of our children since it's a deep count.
-      resultChildCount += childAcc->GetUnignoredChildCount(true);
-    } else {
-      // no deep counting, but if the child is ignored, we want to substitute it for its
-      // children.
-      if (childAcc->IsIgnored()) 
-        resultChildCount += childAcc->GetUnignoredChildCount(false);
-    }
-  } 
-  
-  return resultChildCount;
-}
-
 // if we for some reason have no native accessible, we should be skipped over (and traversed)
 // when fetching all unignored children, etc.  when counting unignored children, we will not be counted.
 bool 
 nsAccessibleWrap::IsIgnored() 
 {
   return (mNativeWrapper == nsnull) || mNativeWrapper->isIgnored();
 }
 
new file mode 100644
--- /dev/null
+++ b/accessible/src/msaa/Compatibility.cpp
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* ***** 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):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (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 ***** */
+
+#include "Compatibility.h"
+
+#include "nsWinUtils.h"
+
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
+using namespace mozilla::a11y;
+
+/**
+ * Return true if module version is lesser than the given version.
+ */
+bool
+IsModuleVersionLessThan(HMODULE aModuleHandle, DWORD aMajor, DWORD aMinor)
+{
+  PRUnichar fileName[MAX_PATH];
+  ::GetModuleFileNameW(aModuleHandle, fileName, MAX_PATH);
+
+  DWORD dummy = 0;
+  DWORD length = ::GetFileVersionInfoSizeW(fileName, &dummy);
+
+  LPBYTE versionInfo = new BYTE[length];
+  ::GetFileVersionInfoW(fileName, 0, length, versionInfo);
+
+  UINT uLen;
+  VS_FIXEDFILEINFO* fixedFileInfo = NULL;
+  ::VerQueryValueW(versionInfo, L"\\", (LPVOID*)&fixedFileInfo, &uLen);
+  DWORD dwFileVersionMS = fixedFileInfo->dwFileVersionMS;
+  DWORD dwFileVersionLS = fixedFileInfo->dwFileVersionLS;
+  delete [] versionInfo;
+
+  DWORD dwLeftMost = HIWORD(dwFileVersionMS);
+  DWORD dwSecondRight = HIWORD(dwFileVersionLS);
+  return (dwLeftMost < aMajor ||
+    (dwLeftMost == aMajor && dwSecondRight < aMinor));
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Compatibility
+////////////////////////////////////////////////////////////////////////////////
+
+PRUint32 Compatibility::sMode = Compatibility::NoCompatibilityMode;
+
+void
+Compatibility::Init()
+{
+  HMODULE jawsHandle = ::GetModuleHandleW(L"jhook");
+  if (jawsHandle) {
+    sMode |= JAWSMode;
+    // IA2 off mode for JAWS versions below 8.0.2173.
+    if (IsModuleVersionLessThan(jawsHandle, 8, 2173))
+      sMode |= IA2OffMode;
+  }
+
+  if (::GetModuleHandleW(L"gwm32inc"))
+    sMode |= WEMode;
+  if (::GetModuleHandleW(L"dolwinhk"))
+    sMode |= DolphinMode;
+
+  // Turn off new tab switching for Jaws and WE.
+  if (sMode & JAWSMode || sMode & WEMode) {
+    // Check to see if the pref for disallowing CtrlTab is already set. If so,
+    // bail out (respect the user settings). If not, set it.
+    if (!Preferences::HasUserValue("browser.ctrlTab.disallowForScreenReaders"))
+      Preferences::SetBool("browser.ctrlTab.disallowForScreenReaders", true);
+  }
+}
+
new file mode 100644
--- /dev/null
+++ b/accessible/src/msaa/Compatibility.h
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* ***** 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):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (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 ***** */
+
+#ifndef COMPATIBILITY_MANAGER_H
+#define COMPATIBILITY_MANAGER_H
+
+#include "prtypes.h"
+
+class nsAccessNodeWrap;
+
+namespace mozilla {
+namespace a11y {
+
+/**
+ * Used to get compatibility modes. Note, modes are computed at accessibility
+ * start up time and aren't changed during lifetime.
+ */
+class Compatibility
+{
+public:
+  /**
+   * Return true if IAccessible2 disabled.
+   */
+  static bool IsIA2Off() { return sMode & IA2OffMode; }
+
+  /**
+   * Return true if JAWS mode is enabled.
+   */
+  static bool IsJAWS() { return sMode & JAWSMode; }
+
+  /**
+   * Return true if WE mode is enabled.
+   */
+  static bool IsWE() { return sMode & WEMode; }
+
+  /**
+   * Return true if Dolphin mode is enabled.
+   */
+  static bool IsDolphin() { return sMode & DolphinMode; }
+
+private:
+  Compatibility();
+  Compatibility(const Compatibility&);
+  Compatibility& operator = (const Compatibility&);
+
+  /**
+   * Initialize compatibility mode. Called by nsAccessNodeWrap during
+   * accessibility initialization.
+   */
+  static void Init();
+  friend class nsAccessNodeWrap;
+
+  /**
+   * List of compatibility modes.
+   */
+  enum {
+    NoCompatibilityMode = 0,
+    JAWSMode = 1 << 0,
+    WEMode = 1 << 1,
+    DolphinMode = 1 << 2,
+    IA2OffMode = 1 << 3
+  };
+
+private:
+  static PRUint32 sMode;
+};
+
+} // a11y namespace
+} // mozilla namespace
+
+#endif
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -69,16 +69,17 @@ CPPSRCS = \
   CAccessibleText.cpp \
   CAccessibleEditableText.cpp \
   CAccessibleHyperlink.cpp \
   CAccessibleHypertext.cpp \
   ia2AccessibleRelation.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
+  Compatibility.cpp \
   $(NULL)
 
 EXPORTS = \
   nsAccessNodeWrap.h \
   nsAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -36,16 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccessNodeWrap.h"
 
 #include "AccessibleApplication.h"
 #include "ISimpleDOMNode_i.c"
 
+#include "Compatibility.h"
 #include "nsAccessibilityService.h"
 #include "nsApplicationAccessibleWrap.h"
 #include "nsCoreUtils.h"
 #include "nsRootAccessible.h"
 #include "nsWinUtils.h"
 #include "Statistics.h"
 
 #include "nsAttrName.h"
@@ -65,30 +66,18 @@ using namespace mozilla::a11y;
 /// the accessible library and cached methods
 HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
 HINSTANCE nsAccessNodeWrap::gmUserLib = nsnull;
 LPFNACCESSIBLEOBJECTFROMWINDOW nsAccessNodeWrap::gmAccessibleObjectFromWindow = nsnull;
 LPFNLRESULTFROMOBJECT nsAccessNodeWrap::gmLresultFromObject = NULL;
 LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
 LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
 
-// Used to determine whether an IAccessible2 compatible screen reader is loaded.
-bool nsAccessNodeWrap::gIsIA2Disabled = false;
-
 AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
 
-// Pref to disallow CtrlTab preview functionality if JAWS or Window-Eyes are
-// running.
-#define CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF "browser.ctrlTab.disallowForScreenReaders"
-
-
-/* For documentation of the accessibility architecture, 
- * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
- */
-
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNodeWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsAccessNodeWrap::
   nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessNode(aContent, aShell)
 {
@@ -608,17 +597,17 @@ void nsAccessNodeWrap::InitAccessibility
 
   if (gmUserLib) {
     if (!gmNotifyWinEvent)
       gmNotifyWinEvent = (LPFNNOTIFYWINEVENT)GetProcAddress(gmUserLib,"NotifyWinEvent");
     if (!gmGetGUIThreadInfo)
       gmGetGUIThreadInfo = (LPFNGETGUITHREADINFO)GetProcAddress(gmUserLib,"GetGUIThreadInfo");
   }
 
-  DoATSpecificProcessing();
+  Compatibility::Init();
 
   nsWinUtils::MaybeStartWindowEmulation();
 
   nsAccessNode::InitXPAccessibility();
 }
 
 void nsAccessNodeWrap::ShutdownAccessibility()
 {
@@ -666,83 +655,16 @@ GetHRESULT(nsresult aResult)
     case NS_ERROR_NOT_IMPLEMENTED:
       return E_NOTIMPL;
 
     default:
       return E_FAIL;
   }
 }
 
-bool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
-{
-  HMODULE jhookhandle = ::GetModuleHandleW(kJAWSModuleHandle);
-  if (!jhookhandle)
-    return false;  // No JAWS, or some other screen reader, use IA2
-
-  PRUnichar fileName[MAX_PATH];
-  ::GetModuleFileNameW(jhookhandle, fileName, MAX_PATH);
-
-  DWORD dummy;
-  DWORD length = ::GetFileVersionInfoSizeW(fileName, &dummy);
-
-  LPBYTE versionInfo = new BYTE[length];
-  ::GetFileVersionInfoW(fileName, 0, length, versionInfo);
-
-  UINT uLen;
-  VS_FIXEDFILEINFO *fixedFileInfo;
-  ::VerQueryValueW(versionInfo, L"\\", (LPVOID*)&fixedFileInfo, &uLen);
-  DWORD dwFileVersionMS = fixedFileInfo->dwFileVersionMS;
-  DWORD dwFileVersionLS = fixedFileInfo->dwFileVersionLS;
-  delete [] versionInfo;
-
-  DWORD dwLeftMost = HIWORD(dwFileVersionMS);
-//  DWORD dwSecondLeft = LOWORD(dwFileVersionMS);
-  DWORD dwSecondRight = HIWORD(dwFileVersionLS);
-//  DWORD dwRightMost = LOWORD(dwFileVersionLS);
-
-  return (dwLeftMost < 8
-          || (dwLeftMost == 8 && dwSecondRight < 2173));
-}
-
-void nsAccessNodeWrap::TurnOffNewTabSwitchingForJawsAndWE()
-{
-  HMODULE srHandle = ::GetModuleHandleW(kJAWSModuleHandle);
-  if (!srHandle) {
-    // No JAWS, try Window-Eyes
-    srHandle = ::GetModuleHandleW(kWEModuleHandle);
-    if (!srHandle) {
-      // no screen reader we're interested in. Bail out.
-      return;
-    }
-  }
-
-  // Check to see if the pref for disallowing CtrlTab is already set.
-  // If so, bail out.
-  // If not, set it.
-  if (Preferences::HasUserValue(CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF)) {
-    // This pref has been set before. There is no default for it.
-    // Do nothing further, respect the setting that's there.
-    // That way, if noone touches it, it'll stay on after toggled once.
-    // If someone decided to turn it off, we respect that, too.
-    return;
-  }
-  
-  // Value has never been set, set it.
-  Preferences::SetBool(CTRLTAB_DISALLOW_FOR_SCREEN_READERS_PREF, true);
-}
-
-void nsAccessNodeWrap::DoATSpecificProcessing()
-{
-  if (IsOnlyMsaaCompatibleJawsPresent())
-    // All versions below 8.0.2173 are not compatible
-    gIsIA2Disabled  = true;
-
-  TurnOffNewTabSwitchingForJawsAndWE();
-}
-
 nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> nsAccessNodeWrap::sHWNDCache;
 
 LRESULT CALLBACK
 nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
   // Note, this window's message handling should not invoke any call that
   // may result in a cross-process ipc call. Doing so may violate RPC
   // message semantics.
--- a/accessible/src/msaa/nsAccessNodeWrap.h
+++ b/accessible/src/msaa/nsAccessNodeWrap.h
@@ -154,22 +154,16 @@ public: // construction, destruction
     static HINSTANCE gmUserLib;
     static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
     static LPFNLRESULTFROMOBJECT gmLresultFromObject;
     static LPFNNOTIFYWINEVENT gmNotifyWinEvent;
     static LPFNGETGUITHREADINFO gmGetGUIThreadInfo;
 
     static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
 
-    static bool IsOnlyMsaaCompatibleJawsPresent();
-
-    static void TurnOffNewTabSwitchingForJawsAndWE();
-
-    static void DoATSpecificProcessing();
-
   static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
 
   static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg,
                                      WPARAM WParam, LPARAM lParam);
 
   static nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> sHWNDCache;
 
 protected:
@@ -178,22 +172,16 @@ protected:
    * Return ISimpleDOMNode instance for existing accessible object or
    * creates new nsAccessNode instance if the accessible doesn't exist.
    *
    * @note ISimpleDOMNode is returned addrefed
    */
   ISimpleDOMNode *MakeAccessNode(nsINode *aNode);
 
     /**
-     * Used to determine whether an IAccessible2 compatible screen reader is
-     * loaded. Currently used for JAWS versions older than 8.0.2173.
-     */
-     static bool gIsIA2Disabled;
-
-    /**
      * It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
      * implementation.
      */
     static AccTextChangeEvent* gTextEvent;
 };
 
 /**
  * Converts nsresult to HRESULT.
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -33,16 +33,17 @@
  * 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 "nsAccessibleWrap.h"
 
+#include "Compatibility.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsWinUtils.h"
 #include "Relation.h"
 #include "States.h"
 
 #include "ia2AccessibleRelation.h"
 
@@ -124,17 +125,17 @@ STDMETHODIMP nsAccessibleWrap::QueryInte
     *ppv = static_cast<IAccessible*>(this);
   else if (IID_IEnumVARIANT == iid) {
     long numChildren;
     get_accChildCount(&numChildren);
     if (numChildren > 0)  // Don't support this interface for leaf elements
       *ppv = static_cast<IEnumVARIANT*>(this);
   } else if (IID_IServiceProvider == iid)
     *ppv = static_cast<IServiceProvider*>(this);
-  else if (IID_IAccessible2 == iid && !gIsIA2Disabled)
+  else if (IID_IAccessible2 == iid && !Compatibility::IsIA2Off())
     *ppv = static_cast<IAccessible2*>(this);
 
   if (NULL == *ppv) {
     HRESULT hr = CAccessibleComponent::QueryInterface(iid, ppv);
     if (SUCCEEDED(hr))
       return hr;
   }
 
@@ -1587,21 +1588,23 @@ nsAccessibleWrap::FirePlatformEvent(AccE
          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);
+  if (Compatibility::IsJAWS()) {
+    if (eventType == nsIAccessibleEvent::EVENT_SELECTION &&
+      accessible->Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION) {
+      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/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -33,16 +33,17 @@
  * 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 "mozilla/dom/TabChild.h"
 
+#include "Compatibility.h"
 #include "nsDocAccessibleWrap.h"
 #include "ISimpleDOMDocument_i.c"
 #include "nsIAccessibilityService.h"
 #include "nsRootAccessible.h"
 #include "nsWinUtils.h"
 #include "Statistics.h"
 
 #include "nsIDocShell.h"
@@ -286,17 +287,17 @@ nsDocAccessibleWrap::DoInitialUpdate()
       if (tabChild)
         tabChild->SendGetWidgetNativeData(&nativeData);
       else
         nativeData = reinterpret_cast<mozilla::WindowsHandle>(
           rootDocument->GetNativeWindow());
 
       bool isActive = true;
       PRInt32 x = CW_USEDEFAULT, y = CW_USEDEFAULT, width = 0, height = 0;
-      if (nsWinUtils::IsWindowEmulationFor(kDolphinModuleHandle)) {
+      if (Compatibility::IsDolphin()) {
         GetBounds(&x, &y, &width, &height);
         PRInt32 rootX = 0, rootY = 0, rootWidth = 0, rootHeight = 0;
         rootDocument->GetBounds(&rootX, &rootY, &rootWidth, &rootHeight);
         x = rootX - x;
         y -= rootY;
 
         nsCOMPtr<nsISupports> container = mDocument->GetContainer();
         nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
--- a/accessible/src/msaa/nsRootAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsRootAccessibleWrap.cpp
@@ -33,21 +33,24 @@
  * 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 "nsRootAccessibleWrap.h"
 
+#include "Compatibility.h"
 #include "nsWinUtils.h"
 
 #include "nsIDOMEventTarget.h"
 #include "nsEventListenerManager.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsRootAccessibleWrap::
   nsRootAccessibleWrap(nsIDocument* aDocument, nsIContent* aRootContent,
                        nsIWeakReference* aShell) :
   nsRootAccessible(aDocument, aRootContent, aShell)
 {
@@ -58,17 +61,17 @@ nsRootAccessibleWrap::~nsRootAccessibleW
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsRootAccessible
 
 void
 nsRootAccessibleWrap::DocumentActivated(nsDocAccessible* aDocument)
 {
-  if (nsWinUtils::IsWindowEmulationFor(kDolphinModuleHandle) &&
+  if (Compatibility::IsDolphin() &&
       nsCoreUtils::IsTabDocument(aDocument->GetDocumentNode())) {
     PRUint32 count = mChildDocuments.Length();
     for (PRUint32 idx = 0; idx < count; idx++) {
       nsDocAccessible* childDoc = mChildDocuments[idx];
       HWND childDocHWND = static_cast<HWND>(childDoc->GetNativeWindow());
       if (childDoc != aDocument)
         nsWinUtils::HideNativeWindow(childDocHWND);
       else
--- a/accessible/src/msaa/nsWinUtils.cpp
+++ b/accessible/src/msaa/nsWinUtils.cpp
@@ -35,24 +35,26 @@
  * 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 "nsWinUtils.h"
 
+#include "Compatibility.h"
 #include "nsIWinAccessNode.h"
 #include "nsRootAccessible.h"
 
 #include "mozilla/Preferences.h"
 #include "nsArrayUtils.h"
 #include "nsIDocShellTreeItem.h"
 
 using namespace mozilla;
+using namespace mozilla::a11y;
 
 // 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)
@@ -106,30 +108,33 @@ nsWinUtils::ConvertToIA2Array(nsIArray *
   return S_OK;
 }
 
 bool
 nsWinUtils::MaybeStartWindowEmulation()
 {
   // Register window class that'll be used for document accessibles associated
   // with tabs.
-  if (IsWindowEmulationFor(0)) {
+  if (Compatibility::IsJAWS() || Compatibility::IsWE() ||
+      Compatibility::IsDolphin() ||
+      Preferences::GetBool("browser.tabs.remote")) {
     RegisterNativeWindow(kClassNameTabContent);
     nsAccessNodeWrap::sHWNDCache.Init(4);
     return true;
   }
+
   return false;
 }
 
 void
 nsWinUtils::ShutdownWindowEmulation()
 {
   // Unregister window call that's used for document accessibles associated
   // with tabs.
-  if (IsWindowEmulationFor(0))
+  if (IsWindowEmulationStarted())
     ::UnregisterClassW(kClassNameTabContent, GetModuleHandle(NULL));
 }
 
 bool
 nsWinUtils::IsWindowEmulationStarted()
 {
   return nsAccessNodeWrap::sHWNDCache.IsInitialized();
 }
@@ -179,21 +184,8 @@ nsWinUtils::ShowNativeWindow(HWND aWnd)
 
 void
 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)
-{
-  // Window emulation is always enabled in multiprocess Firefox.
-  if (Preferences::GetBool("browser.tabs.remote"))
-    return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) : true;
-
-  return kModuleHandle ? ::GetModuleHandleW(kModuleHandle) :
-    ::GetModuleHandleW(kJAWSModuleHandle) ||
-    ::GetModuleHandleW(kWEModuleHandle)  ||
-    ::GetModuleHandleW(kDolphinModuleHandle);
-}
--- a/accessible/src/msaa/nsWinUtils.h
+++ b/accessible/src/msaa/nsWinUtils.h
@@ -44,20 +44,16 @@
 #include "Accessible2.h"
 
 #include "nsIArray.h"
 #include "nsIDocument.h"
 
 const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
 const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
 
-const LPCWSTR kJAWSModuleHandle = L"jhook";
-const LPCWSTR kWEModuleHandle = L"gwm32inc";
-const LPCWSTR kDolphinModuleHandle = L"dolwinhk";
-
 class nsWinUtils
 {
 public:
   /**
    * Convert nsIArray array of accessible objects to an array of IUnknown*
    * objects used in IA2 methods.
    */
   static HRESULT ConvertToIA2Array(nsIArray *aCollection,
@@ -94,17 +90,12 @@ public:
    * Helper to show window.
    */
   static void ShowNativeWindow(HWND aWnd);
 
   /**
    * Helper to hide window.
    */
   static void HideNativeWindow(HWND aWnd);
-
-  /**
-   * Return true if window emulation is enabled.
-   */
-  static bool IsWindowEmulationFor(LPCWSTR kModuleHandle);
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -251,34 +251,29 @@ nsXULListboxAccessible::GetColumnCount(P
 {
   NS_ENSURE_ARG_POINTER(aColumnsCout);
   *aColumnsCout = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsIContent* headContent = nsnull;
-
-  PRUint32 count = mContent->GetChildCount();
-  for (PRUint32 index = 0; index < count; ++index) {
-    nsIContent* childContent = mContent->GetChildAt(index);
+  for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
+       childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::listcols,
                                          kNameSpaceID_XUL)) {
       headContent = childContent;
     }
   }
-
   if (!headContent)
     return NS_OK;
 
   PRUint32 columnCount = 0;
-
-  count = headContent->GetChildCount();
-  for (PRUint32 index = 0; index < count; ++index) {
-    nsIContent* childContent = headContent->GetChildAt(index);
+  for (nsIContent* childContent = headContent->GetFirstChild(); childContent;
+       childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::listcol,
                                          kNameSpaceID_XUL)) {
       columnCount++;
     }
   }
 
   *aColumnsCout = columnCount;
   return NS_OK;
@@ -952,21 +947,21 @@ nsXULListitemAccessible::Description(nsS
 
 /**
   * If there is a Listcell as a child ( not anonymous ) use it, otherwise
   *   default to getting the name from GetXULName
   */
 nsresult
 nsXULListitemAccessible::GetNameInternal(nsAString& aName)
 {
-  nsIContent* child = mContent->GetChildAt(0);
-  if (child) {
-    if (child->NodeInfo()->Equals(nsGkAtoms::listcell,
-                                  kNameSpaceID_XUL)) {
-      child->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
+  nsIContent* childContent = mContent->GetFirstChild();
+  if (childContent) {
+    if (childContent->NodeInfo()->Equals(nsGkAtoms::listcell,
+                                         kNameSpaceID_XUL)) {
+      childContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
       return NS_OK;
     }
   }
   return GetXULName(aName);
 }
 
 PRUint32
 nsXULListitemAccessible::NativeRole()
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -323,17 +323,17 @@ function eventQueue(aEventType)
     if (!aUncondProcess && this.areAllEventsExpected()) {
       // We need delay to avoid events coalesce from different invokers.
       var queue = this;
       SimpleTest.executeSoon(function() { queue.processNextInvoker(); });
       return;
     }
 
     // Check in timeout invoker didn't fire registered events.
-    window.setTimeout(function(aQueue) { aQueue.processNextInvoker(); }, 100,
+    window.setTimeout(function(aQueue) { aQueue.processNextInvoker(); }, 300,
                       this);
   }
 
   /**
    * Handle events for the current invoker.
    */
   this.handleEvent = function eventQueue_handleEvent(aEvent)
   {
--- a/accessible/tests/mochitest/states/test_aria.html
+++ b/accessible/tests/mochitest/states/test_aria.html
@@ -92,16 +92,20 @@
       // aria-checked
       testStates("aria_checked_checkbox", STATE_CHECKED);
       testStates("aria_mixed_checkbox", STATE_MIXED);
 
       // test disabled group and all its descendants to see if they are
       // disabled, too. See bug 429285.
       testAriaDisabledTree("group");
 
+      // active state caused by aria-activedescendant
+      testStates("as_item1", 0, EXT_STATE_ACTIVE);
+      testStates("as_item2", 0, 0, 0, EXT_STATE_ACTIVE);
+
       // universal ARIA properties inherited from file input control
       var fileTextField = getAccessible("fileinput").firstChild;
       testStates(fileTextField,
                  STATE_BUSY | STATE_UNAVAILABLE | STATE_REQUIRED | STATE_HASPOPUP | STATE_INVALID);
       var fileBrowseButton = getAccessible("fileinput").lastChild;
       testStates(fileBrowseButton,
                  STATE_BUSY | STATE_UNAVAILABLE | STATE_REQUIRED | STATE_HASPOPUP | STATE_INVALID);
 
@@ -179,16 +183,21 @@
      title="aria-orientation should be applied to separator and slider roles">
     Mozilla Bug 681674
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=699017"
      title="File input control should be propogate states to descendants">
     Mozilla Bug 699017
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=689847"
+     title="Expose active state on current item of selectable widgets">
+    Mozilla Bug 689847
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <div id="textbox_autocomplete_inline" role="textbox" aria-autocomplete="inline"></div>
   <div id="textbox_autocomplete_list" role="textbox" aria-autocomplete="list"></div>
   <div id="textbox_autocomplete_both" role="textbox" aria-autocomplete="both"></div>
@@ -224,16 +233,23 @@
       <div role="option" id="item1">Item 1</div>
       <div role="option" id="item2">Item 2</div>
       <div role="option" id="item3">Item 3</div>
       <div role="option" id="item4">Item 4</div>
     </div>
     <div role="slider" tabindex="0">A slider</div>
   </div>
 
+  <!-- Test active state -->
+  <div id="as_listbox" tabindex="0" role="listbox"
+       aria-activedescendant="as_item1">
+    <div role="option" id="as_item1">Item 1</div>
+    <div role="option" id="as_item2">Item 2</div>
+  </div>
+
   <!-- universal ARIA properties should be inherited by text field of file input -->
   <input type="file" id="fileinput"
          aria-busy="true"
          aria-disabled="true"
          aria-required="true"
          aria-haspopup="true"
          aria-invalid="true">
 
--- a/accessible/tests/mochitest/states/test_selects.html
+++ b/accessible/tests/mochitest/states/test_selects.html
@@ -20,30 +20,34 @@
       testStates(combobox,
                  STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSABLE, 0,
                  STATE_FOCUSED, 0);
 
       var comboboxList = combobox.firstChild;
       testStates(comboboxList, 0, 0, STATE_FOCUSABLE, 0);
 
       var opt1 = comboboxList.firstChild;
-      testStates(opt1, STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE, 0,
-                 STATE_FOCUSED, 0);
+      testStates(opt1, STATE_SELECTABLE | STATE_SELECTED | STATE_FOCUSABLE,
+                 EXT_STATE_ACTIVE, STATE_FOCUSED, 0);
 
       var opt2 = comboboxList.lastChild;
       testStates(opt2, STATE_SELECTABLE | STATE_FOCUSABLE, 0, STATE_SELECTED, 0,
-                 STATE_FOCUSED, 0);
+                 STATE_FOCUSED, EXT_STATE_ACTIVE);
 
       // listbox
       var listbox = getAccessible("listbox");
       testStates(listbox, STATE_FOCUSABLE, 0,
-                 STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSED, 0);
+                 STATE_HASPOPUP | STATE_COLLAPSED | STATE_FOCUSED);
 
-      testStates(listbox.firstChild, STATE_SELECTABLE, 0,
-                 STATE_SELECTED | STATE_FOCUSED | STATE_FOCUSED, 0);
+      testStates(listbox.firstChild, STATE_SELECTABLE, EXT_STATE_ACTIVE,
+                 STATE_SELECTED | STATE_FOCUSED | STATE_FOCUSED);
+
+      testStates(listbox.lastChild, STATE_SELECTABLE, 0,
+                 STATE_SELECTED | STATE_FOCUSED | STATE_FOCUSED,
+                 0, 0, EXT_STATE_ACTIVE);
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 
@@ -55,16 +59,21 @@
      title="mochitest for selects and lists">
     Mozilla Bug 443889
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=640716"
      title="mochitest for selects and lists">
     Mozilla Bug 640716
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=689847"
+     title="Expose active state on current item of selectable widgets">
+    Mozilla Bug 689847
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <select id="combobox">
     <option>item 1</option>
     <option>item 2</option>
copy from mobile/xul/LICENSE
copy to b2g/LICENSE
copy from mobile/xul/Makefile.in
copy to b2g/Makefile.in
--- a/mobile/xul/Makefile.in
+++ b/b2g/Makefile.in
@@ -10,49 +10,39 @@
 # 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.
 #
 # The Initial Developer of the Original Code is
 # the Mozilla Foundation <http://www.mozilla.org/>.
-# Portions created by the Initial Developer are Copyright (C) 2007
+# Portions created by the Initial Developer are Copyright (C) 2011
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
-#   Mark Finkle <mfinkle@mozilla.com>
-#   Joel Maher <jmaher@mozilla.com>
+#   Chris Jones <jones.chris.g@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
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH      = ../..
+DEPTH      = ..
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = chrome locales components modules themes/core app
-
-ifndef LIBXUL_SDK
-PARALLEL_DIRS += $(DEPTH)/xulrunner/tools/redit
-endif
+DIRS = chrome locales app
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/testing/testsuite-targets.mk
-
-package-mobile-tests:
-	$(MAKE) stage-mochitest DIST_BIN=$(DEPTH)/$(DIST)/bin/xulrunner
-	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
-	@(cd $(PKG_STAGE) && tar $(TAR_CREATE_FLAGS) - *) | bzip2 -f > $(DIST)/$(PKG_PATH)$(TEST_PACKAGE)
copy from mobile/xul/app/Makefile.in
copy to b2g/app/Makefile.in
--- a/mobile/xul/app/Makefile.in
+++ b/b2g/app/Makefile.in
@@ -10,99 +10,100 @@
 # 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.
 #
 # The Initial Developer of the Original Code is
 # the Mozilla Foundation <http://www.mozilla.org/>.
-# Portions created by the Initial Developer are Copyright (C) 2007
+# Portions created by the Initial Developer are Copyright (C) 2011
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
-#   Mark Finkle <mfinkle@mozilla.com>
+#   Chris Jones <jones.chris.g@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
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH     = ../../..
+DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = profile/extensions
-
-PREF_JS_EXPORTS = $(srcdir)/mobile.js
+PREF_JS_EXPORTS = $(srcdir)/b2g.js
 
 ifndef LIBXUL_SDK
-ifneq (Android,$(OS_TARGET))
 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 += $(JEMALLOC_LIBS)
+
 LIBS += \
   $(EXTRA_DSO_LIBS) \
   $(XPCOM_STANDALONE_GLUE_LDOPTS) \
   $(NULL)
 
-ifeq ($(MOZ_PLATFORM_MAEMO),6)
-LIBS += \
-  $(LIBXUL_DIST)/../widget/src/qt/faststartupqt/$(LIB_PREFIX)faststartupqt.$(LIB_SUFFIX) \
-  $(MOZ_QT_LIBS) \
-  $(NULL)
-LOCAL_INCLUDES += -I$(topsrcdir)/widget/src/qt/faststartupqt $(TK_CFLAGS)
-endif
-
 ifeq ($(OS_ARCH),WINNT)
 OS_LIBS += $(call EXPAND_LIBNAME,version)
 endif
 
 ifdef _MSC_VER
 # Always enter a Windows program through wmain, whether or not we're
 # a console application.
 WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
 endif
-endif
 endif #LIBXUL_SDK
 
-# Make sure the standalone glue doesn't try to get libxpcom.so from mobile/app.
+# Make sure the standalone glue doesn't try to get libxpcom.so from b2g/app.
 NSDISTMODE = copy
 
 include $(topsrcdir)/config/rules.mk
 
-APP_ICON = mobile
+APP_ICON = b2g
 
 DEFINES += \
   -DAPP_NAME=$(MOZ_APP_NAME) \
   -DAPP_VERSION=$(MOZ_APP_VERSION) \
   -DMOZ_UPDATER=$(MOZ_UPDATER) \
   $(NULL)
 
+# strip a trailing slash from the repo URL because it's not always present,
+# and we want to construct a working URL in buildconfig.html
+# make+shell+sed = awful
+_dollar=$$
+SOURCE_REPO := $(shell cd $(srcdir)/.. && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+# extra sanity check for old versions of hg
+# that don't support showconfig
+ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
+DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
+endif
+
 ifeq ($(OS_ARCH),WINNT)
 REDIT_PATH = $(LIBXUL_DIST)/bin
 endif
 
 APP_BINARY = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 
@@ -126,17 +127,17 @@ else
 APPFILES = MacOS
 endif
 
 libs repackage::
 	mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
 	rsync -a --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 "*.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/%APP_BINARY%/$(APP_BINARY)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
+	sed -e "s/%MOZ_APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/" -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%APP_BINARY%/$(APP_BINARY)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
 	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -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
 ifdef LIBXUL_SDK
 	cp $(LIBXUL_DIST)/bin/xulrunner$(BIN_SUFFIX) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(APP_BINARY)
 	rsync -a --exclude nsinstall --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
 else
 	rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
@@ -152,21 +153,16 @@ ifdef LIBXUL_SDK
 endif
 ifndef SKIP_COPY_XULRUNNER
 ifdef LIBXUL_SDK
 	$(NSINSTALL) -D $(DIST)/bin/xulrunner
 	(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
 endif
 endif # SKIP_COPY_XULRUNNER
 
-ifeq ($(MOZ_PLATFORM_MAEMO),6)
-	$(NSINSTALL) -D $(DIST)/bin/res/drawable
-	cp $(srcdir)/maemo/* $(DIST)/bin/res/drawable/
-	cp $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/favicon32.png $(DIST)/bin/res/drawable/
-endif
 	$(NSINSTALL) -D $(DIST)/bin/chrome/icons/default
 
 ifeq ($(OS_ARCH),WINNT)
 	cp $(srcdir)/$(APP_ICON).ico $(DIST)/bin/chrome/icons/default/$(APP_ICON).ico
 	$(REDIT_PATH)/redit$(HOST_BIN_SUFFIX) $(DIST)/bin/$(APP_BINARY) $(srcdir)/$(APP_ICON).ico
 endif
 
 endif
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..38312abac42830818edef700470cf1c59b25bb81
GIT binary patch
literal 4286
zc%1E*du&rx9LFyq3Xv%F9r;5iVtl(H&iF`V7$KsffJj8g%SRN=U=9?)A$4QG2BWkJ
z;s)&=taM|e?Yebc+x4|Vw?5Xr+}5sL+pXKWuA|!!#f13voV!O94e_mi@N2%kC%5PR
zKEKB~=cWuZg?wUS82ZgfI1F<O!!Y*}ky}gxGj@N%Zk#cuD|W^Hs%=c!>fF3_2k*aN
z14uqvtU`5d0~sRj-{O|kws68D-*PE5Gp7`i3L_mx)%Ff<v8kE!PcRF$_5`8Qq8BOa
zoZ=b>0s~PDpF5A;gnz75L;0|_2Oz4d8<!<YwDj-d?>s14Cy=NiR-J(_7($_>3{v%J
z?9W$Vf1UzLt%=+#MORNhj+AP_<>%wQE!@AQC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ub4SFLdsH
z7=43KwbFg&g_P{6hM^x|^Lrr6T@A(2l~5I~g7!orbSGCsU%CeRvNcc~TLIbEuORKM
zd64I<K!s>6>;W(AgWn@ZZbZ4mgZln+s1KbZ<4#hC1{^NcO`c1_N=r0XUQ1%q<I55a
z<YXUPdPmvkZGJCQ`Rkz*C&HrG09*A3XsAg-qhTYOO;nrEWZZ;C{YE&nNhr)%hN3-7
zP$?XX!Q6e8#9(4;OMTPxioB;$pteRSo5ZrTKy3qgzoMw70kveEP4>>)6W#OnLZmK_
zg_Qp)j_-I8&4%shu%*H6NJpoWY8TuM>2TZAVV0&KW9>^=c~=b56Q6*pU_C6JfX@-R
zfV?UTn;*@SvM7`AmXcU_wAOTe*uv-8dXMwD@80tOXV=Pk&a`E-QM_{z?2--WP=ACD
z)n;@WQW13Lpu2^SHu?K#*KCI-Z!-$gH?sUAA1{Jv+w*#wBk`3?6s2ovf<0D;7Lles
z7_D%2q57L1cJGpTBBIH)L1XyhjoD7kuKVFPWun`{pH!r`5@G)-G8UlAEPz9K2>Iju
zH)HS7(`P6A5T6{H6UmXp;b-3=WtMhdjjJDZeWUvE7$><uH|nP(DTb%dd<;I*0R(MA
zR*^m}!rpRr9H<wfLa+fT3m(AgyXSB(cg_*cQqmJ1+1L8Z&AZeDE9S(|IJBA1`fPb?
z&`RpwT=FK2f|pVL={#rFD|2Yielv$FcE$dWhD+_ooxsKU!0=3fJ7r8{+K=RK0M$i?
snNM|rVeS}an3;ZtnPy;^sZ?BsnKGeq_uQ!rW0=XEdIA1vzd}*_30+pCwEzGB
new file mode 100644
--- /dev/null
+++ b/b2g/app/b2g.js
@@ -0,0 +1,395 @@
+/* ***** 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 Mobile Browser.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Matt Brubeck <mbrubeck@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#filter substitution
+
+pref("toolkit.defaultChromeURI", "chrome://browser/content/shell.xul");
+pref("general.useragent.compatMode.firefox", true);
+pref("browser.chromeURL", "chrome://browser/content/");
+#ifdef MOZ_OFFICIAL_BRANDING
+pref("browser.homescreenURL", "file:///system/home/homescreen.html");
+#else
+pref("browser.homescreenURL", "file:///data/local/homescreen.html,file:///system/home/homescreen.html");
+#endif
+
+// Device pixel to CSS px ratio, in percent. Set to -1 to calculate based on display density.
+pref("browser.viewport.scaleRatio", -1);
+
+/* allow scrollbars to float above chrome ui */
+pref("ui.scrollbarsCanOverlapContent", 1);
+
+/* cache prefs */
+pref("browser.cache.disk.enable", false);
+pref("browser.cache.disk.capacity", 0); // kilobytes
+pref("browser.cache.disk.smart_size.enabled", false);
+pref("browser.cache.disk.smart_size.first_run", false);
+
+pref("browser.cache.memory.enable", true);
+pref("browser.cache.memory.capacity", 1024); // kilobytes
+
+/* image cache prefs */
+pref("image.cache.size", 1048576); // bytes
+
+/* offline cache prefs */
+pref("browser.offline-apps.notify", true);
+pref("browser.cache.offline.enable", true);
+pref("browser.cache.offline.capacity", 5120); // kilobytes
+pref("offline-apps.quota.max", 2048); // kilobytes
+pref("offline-apps.quota.warn", 1024); // kilobytes
+
+/* protocol warning prefs */
+pref("network.protocol-handler.warn-external.tel", false);
+pref("network.protocol-handler.warn-external.mailto", false);
+pref("network.protocol-handler.warn-external.vnd.youtube", false);
+
+/* http prefs */
+pref("network.http.pipelining", true);
+pref("network.http.pipelining.ssl", true);
+pref("network.http.proxy.pipelining", true);
+pref("network.http.pipelining.maxrequests" , 6);
+pref("network.http.keep-alive.timeout", 600);
+pref("network.http.max-connections", 6);
+pref("network.http.max-connections-per-server", 4);
+pref("network.http.max-persistent-connections-per-server", 4);
+pref("network.http.max-persistent-connections-per-proxy", 4);
+
+// See bug 545869 for details on why these are set the way they are
+pref("network.buffer.cache.count", 24);
+pref("network.buffer.cache.size",  16384);
+
+/* session history */
+pref("browser.sessionhistory.max_total_viewers", 1);
+pref("browser.sessionhistory.max_entries", 50);
+
+/* session store */
+pref("browser.sessionstore.resume_session_once", false);
+pref("browser.sessionstore.resume_from_crash", true);
+pref("browser.sessionstore.resume_from_crash_timeout", 60); // minutes
+pref("browser.sessionstore.interval", 10000); // milliseconds
+pref("browser.sessionstore.max_tabs_undo", 1);
+
+/* these should help performance */
+pref("mozilla.widget.force-24bpp", true);
+pref("mozilla.widget.use-buffer-pixmap", true);
+pref("mozilla.widget.disable-native-theme", true);
+pref("layout.reflow.synthMouseMove", false);
+
+/* download manager (don't show the window or alert) */
+pref("browser.download.useDownloadDir", true);
+pref("browser.download.folderList", 1); // Default to ~/Downloads
+pref("browser.download.manager.showAlertOnComplete", false);
+pref("browser.download.manager.showAlertInterval", 2000);
+pref("browser.download.manager.retention", 2);
+pref("browser.download.manager.showWhenStarting", false);
+pref("browser.download.manager.closeWhenDone", true);
+pref("browser.download.manager.openDelay", 0);
+pref("browser.download.manager.focusWhenStarting", false);
+pref("browser.download.manager.flashCount", 2);
+pref("browser.download.manager.displayedHistoryDays", 7);
+
+/* download alerts (disabled above) */
+pref("alerts.slideIncrement", 1);
+pref("alerts.slideIncrementTime", 10);
+pref("alerts.totalOpenTime", 6000);
+pref("alerts.height", 50);
+
+/* download helper */
+pref("browser.helperApps.deleteTempFileOnExit", false);
+
+/* password manager */
+pref("signon.rememberSignons", true);
+pref("signon.expireMasterPassword", false);
+pref("signon.SignonFileName", "signons.txt");
+
+/* autocomplete */
+pref("browser.formfill.enable", true);
+
+/* spellcheck */
+pref("layout.spellcheckDefault", 0);
+
+/* block popups by default, and notify the user about blocked popups */
+pref("dom.disable_open_during_load", true);
+pref("privacy.popups.showBrowserMessage", true);
+
+pref("keyword.enabled", true);
+pref("keyword.URL", "http://www.google.com/m?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=");
+
+pref("accessibility.typeaheadfind", false);
+pref("accessibility.typeaheadfind.timeout", 5000);
+pref("accessibility.typeaheadfind.flashBar", 1);
+pref("accessibility.typeaheadfind.linksonly", false);
+pref("accessibility.typeaheadfind.casesensitive", 0);
+
+// pointer to the default engine name
+pref("browser.search.defaultenginename", "chrome://browser/locale/region.properties");
+
+// SSL error page behaviour
+pref("browser.ssl_override_behavior", 2);
+pref("browser.xul.error_pages.expert_bad_cert", false);
+
+// disable logging for the search service by default
+pref("browser.search.log", false);
+
+// disable updating
+pref("browser.search.update", false);
+pref("browser.search.update.log", false);
+pref("browser.search.updateinterval", 6);
+
+// enable search suggestions by default
+pref("browser.search.suggest.enabled", true);
+
+// tell the search service that we don't really expose the "current engine"
+pref("browser.search.noCurrentEngine", true);
+
+// enable xul error pages
+pref("browser.xul.error_pages.enabled", true);
+
+// disable color management
+pref("gfx.color_management.mode", 0);
+
+// don't allow JS to move and resize existing windows
+pref("dom.disable_window_move_resize", true);
+
+// prevent click image resizing for nsImageDocument
+pref("browser.enable_click_image_resizing", false);
+
+// controls which bits of private data to clear. by default we clear them all.
+pref("privacy.item.cache", true);
+pref("privacy.item.cookies", true);
+pref("privacy.item.offlineApps", true);
+pref("privacy.item.history", true);
+pref("privacy.item.formdata", true);
+pref("privacy.item.downloads", true);
+pref("privacy.item.passwords", true);
+pref("privacy.item.sessions", true);
+pref("privacy.item.geolocation", true);
+pref("privacy.item.siteSettings", true);
+pref("privacy.item.syncAccount", true);
+
+// URL to the Learn More link XXX this is the firefox one.  Bug 495578 fixes this.
+pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/firefox/geolocation/");
+
+// base url for the wifi geolocation network provider
+pref("geo.wifi.uri", "https://maps.googleapis.com/maps/api/browserlocation/json");
+
+// enable geo
+pref("geo.enabled", true);
+
+// content sink control -- controls responsiveness during page load
+// see https://bugzilla.mozilla.org/show_bug.cgi?id=481566#c9
+pref("content.sink.enable_perf_mode",  2); // 0 - switch, 1 - interactive, 2 - perf
+pref("content.sink.pending_event_mode", 0);
+pref("content.sink.perf_deflect_count", 1000000);
+pref("content.sink.perf_parse_time", 50000000);
+
+pref("javascript.options.mem.high_water_mark", 32);
+
+// Maximum scripts runtime before showing an alert
+pref("dom.max_chrome_script_run_time", 0); // disable slow script dialog for chrome
+pref("dom.max_script_run_time", 20);
+
+// plugins
+pref("plugin.disable", true);
+pref("dom.ipc.plugins.enabled", true);
+
+// product URLs
+// The breakpad report server to link to in about:crashes
+pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
+pref("app.releaseNotesURL", "http://www.mozilla.com/%LOCALE%/b2g/%VERSION%/releasenotes/");
+pref("app.support.baseURL", "http://support.mozilla.com/b2g");
+pref("app.feedbackURL", "http://input.mozilla.com/feedback/");
+pref("app.privacyURL", "http://www.mozilla.com/%LOCALE%/m/privacy.html");
+pref("app.creditsURL", "http://www.mozilla.org/credits/");
+pref("app.featuresURL", "http://www.mozilla.com/%LOCALE%/b2g/features/");
+pref("app.faqURL", "http://www.mozilla.com/%LOCALE%/b2g/faq/");
+
+// Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
+pref("security.alternate_certificate_error_page", "certerror");
+
+pref("security.warn_viewing_mixed", false); // Warning is disabled.  See Bug 616712.
+
+// Override some named colors to avoid inverse OS themes
+pref("ui.-moz-dialog", "#efebe7");
+pref("ui.-moz-dialogtext", "#101010");
+pref("ui.-moz-field", "#fff");
+pref("ui.-moz-fieldtext", "#1a1a1a");
+pref("ui.-moz-buttonhoverface", "#f3f0ed");
+pref("ui.-moz-buttonhovertext", "#101010");
+pref("ui.-moz-combobox", "#fff");
+pref("ui.-moz-comboboxtext", "#101010");
+pref("ui.buttonface", "#ece7e2");
+pref("ui.buttonhighlight", "#fff");
+pref("ui.buttonshadow", "#aea194");
+pref("ui.buttontext", "#101010");
+pref("ui.captiontext", "#101010");
+pref("ui.graytext", "#b1a598");
+pref("ui.highlight", "#fad184");
+pref("ui.highlighttext", "#1a1a1a");
+pref("ui.infobackground", "#f5f5b5");
+pref("ui.infotext", "#000");
+pref("ui.menu", "#f7f5f3");
+pref("ui.menutext", "#101010");
+pref("ui.threeddarkshadow", "#000");
+pref("ui.threedface", "#ece7e2");
+pref("ui.threedhighlight", "#fff");
+pref("ui.threedlightshadow", "#ece7e2");
+pref("ui.threedshadow", "#aea194");
+pref("ui.window", "#efebe7");
+pref("ui.windowtext", "#101010");
+pref("ui.windowframe", "#efebe7");
+
+// replace newlines with spaces on paste into single-line text boxes
+pref("editor.singleLine.pasteNewlines", 2);
+
+// threshold where a tap becomes a drag, in 1/240" reference pixels
+// The names of the preferences are to be in sync with nsEventStateManager.cpp
+pref("ui.dragThresholdX", 25);
+pref("ui.dragThresholdY", 25);
+
+// Layers Acceleration
+pref("layers.acceleration.disabled", false);
+
+// Web Notifications
+pref("notification.feature.enabled", true);
+
+// IndexedDB
+pref("indexedDB.feature.enabled", true);
+pref("dom.indexedDB.warningQuota", 5);
+
+// prevent video elements from preloading too much data
+pref("media.preload.default", 1); // default to preload none
+pref("media.preload.auto", 2);    // preload metadata if preload=auto
+
+//  0: don't show fullscreen keyboard
+//  1: always show fullscreen keyboard
+// -1: show fullscreen keyboard based on threshold pref
+pref("widget.ime.android.landscape_fullscreen", -1);
+pref("widget.ime.android.fullscreen_threshold", 250); // in hundreths of inches
+
+// optimize images memory usage
+pref("image.mem.decodeondraw", true);
+pref("content.image.allow_locking", false);
+pref("image.mem.min_discard_timeout_ms", 10000);
+
+// enable touch events interfaces
+pref("dom.w3c_touch_events.enabled", true);
+pref("dom.w3c_touch_events.safetyX", 0); // escape borders in units of 1/240"
+pref("dom.w3c_touch_events.safetyY", 120); // escape borders in units of 1/240"
+
+#ifdef MOZ_SAFE_BROWSING
+// Safe browsing does nothing unless this pref is set
+pref("browser.safebrowsing.enabled", true);
+
+// Prevent loading of pages identified as malware
+pref("browser.safebrowsing.malware.enabled", true);
+
+// Non-enhanced mode (local url lists) URL list to check for updates
+pref("browser.safebrowsing.provider.0.updateURL", "http://safebrowsing.clients.google.com/safebrowsing/downloads?client={moz:client}&appver={moz:version}&pver=2.2");
+
+pref("browser.safebrowsing.dataProvider", 0);
+
+// Does the provider name need to be localizable?
+pref("browser.safebrowsing.provider.0.name", "Google");
+pref("browser.safebrowsing.provider.0.keyURL", "https://sb-ssl.google.com/safebrowsing/newkey?client={moz:client}&appver={moz:version}&pver=2.2");
+pref("browser.safebrowsing.provider.0.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/report?");
+pref("browser.safebrowsing.provider.0.gethashURL", "http://safebrowsing.clients.google.com/safebrowsing/gethash?client={moz:client}&appver={moz:version}&pver=2.2");
+
+// HTML report pages
+pref("browser.safebrowsing.provider.0.reportGenericURL", "http://{moz:locale}.phish-generic.mozilla.com/?hl={moz:locale}");
+pref("browser.safebrowsing.provider.0.reportErrorURL", "http://{moz:locale}.phish-error.mozilla.com/?hl={moz:locale}");
+pref("browser.safebrowsing.provider.0.reportPhishURL", "http://{moz:locale}.phish-report.mozilla.com/?hl={moz:locale}");
+pref("browser.safebrowsing.provider.0.reportMalwareURL", "http://{moz:locale}.malware-report.mozilla.com/?hl={moz:locale}");
+pref("browser.safebrowsing.provider.0.reportMalwareErrorURL", "http://{moz:locale}.malware-error.mozilla.com/?hl={moz:locale}");
+
+// FAQ URLs
+pref("browser.safebrowsing.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/phishing-protection/");
+pref("browser.geolocation.warning.infoURL", "http://www.mozilla.com/%LOCALE%/%APP%/geolocation/");
+
+// Name of the about: page contributed by safebrowsing to handle display of error
+// pages on phishing/malware hits.  (bug 399233)
+pref("urlclassifier.alternate_error_page", "blocked");
+
+// The number of random entries to send with a gethash request.
+pref("urlclassifier.gethashnoise", 4);
+
+// The list of tables that use the gethash request to confirm partial results.
+pref("urlclassifier.gethashtables", "goog-phish-shavar,goog-malware-shavar");
+
+// If an urlclassifier table has not been updated in this number of seconds,
+// a gethash request will be forced to check that the result is still in
+// the database.
+pref("urlclassifier.confirm-age", 2700);
+
+// Maximum size of the sqlite3 cache during an update, in bytes
+pref("urlclassifier.updatecachemax", 4194304);
+
+// URL for checking the reason for a malware warning.
+pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site=");
+#endif
+
+// True if this is the first time we are showing about:firstrun
+pref("browser.firstrun.show.uidiscovery", true);
+pref("browser.firstrun.show.localepicker", true);
+
+// initiated by a user
+pref("content.ime.strict_policy", true);
+
+// True if you always want dump() to work
+//
+// On Android, you also need to do the following for the output
+// to show up in logcat:
+//
+// $ adb shell stop
+// $ adb shell setprop log.redirect-stdio true
+// $ adb shell start
+pref("browser.dom.window.dump.enabled", false);
+
+
+
+// Temporarily relax file:// origin checks so that we can use <img>s
+// from other dirs as webgl textures and more.  Remove me when we have
+// installable apps or wifi support.
+pref("security.fileuri.strict_origin_policy", false);
+
+// Temporarily force-enable GL compositing.  This is default-disabled
+// deep within the bowels of the widgetry system.  Remove me when GL
+// compositing isn't default disabled in widget/src/android.
+pref("layers.acceleration.force-enabled", true);
+
+// screen.enabled and screen.brightness properties.
+pref("dom.screenEnabledProperty.enabled", true);
+pref("dom.screenBrightnessProperty.enabled", true);
copy from mobile/xul/app/macbuild/Contents/Info.plist.in
copy to b2g/app/macbuild/Contents/Info.plist.in
--- a/mobile/xul/app/macbuild/Contents/Info.plist.in
+++ b/b2g/app/macbuild/Contents/Info.plist.in
@@ -24,17 +24,17 @@
 				<string>HTML</string>
 			</array>
 			<key>CFBundleTypeRole</key>
 			<string>Viewer</string>
 		</dict>
 		<dict>
 			<key>CFBundleTypeExtensions</key>
 			<array>
-			    <string>text</string>
+			  <string>text</string>
 				<string>txt</string>
 				<string>js</string>
 				<string>log</string>
 				<string>css</string>
 				<string>xul</string>
 				<string>rdf</string>
 			</array>
 			<key>CFBundleTypeIconFile</key>
@@ -67,25 +67,25 @@
 				<string>JPEG</string>
 				<string>PNGf</string>
 			</array>
 			<key>CFBundleTypeRole</key>
 			<string>Viewer</string>
 		</dict>
 	</array>
 	<key>CFBundleExecutable</key>
-	<string>fennec</string>
+	<string>%MOZ_APP_NAME%</string>
 	<key>CFBundleGetInfoString</key>
 	<string>%APP_NAME% %APP_VERSION%</string>
 	<key>CFBundleIconFile</key>
-	<string>fennec</string>
+	<string>%MOZ_APP_NAME%</string>
 	<key>CFBundleIdentifier</key>
-	<string>org.mozilla.fennec</string>
+	<string>org.mozilla.b2g</string>
 	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
+	<string>%MOZ_APP_VERSION%</string>
 	<key>CFBundleName</key>
 	<string>%APP_NAME%</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<string>%APP_VERSION%</string>
 	<key>CFBundleSignature</key>
 	<string>MOZB</string>
copy from mobile/xul/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
copy to b2g/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
copy from mobile/xul/app/nsBrowserApp.cpp
copy to b2g/app/nsBrowserApp.cpp
--- a/mobile/xul/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -64,23 +64,16 @@
 #define snprintf _snprintf
 #define strcasecmp _stricmp
 #endif
 #include "BinaryPath.h"
 
 #include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
 
 #include "mozilla/Telemetry.h"
-#if MOZ_PLATFORM_MAEMO == 6
-#include "nsFastStartupQt.h"
-// this used by nsQAppInstance, but defined only in nsAppRunner
-// FastStartupQt using gArgc/v so we need to define it here
-int    gArgc;
-char **gArgv;
-#endif
 
 static void Output(const char *fmt, ... )
 {
   va_list ap;
   va_start(ap, fmt);
 
 #if defined(XP_WIN) && !MOZ_WINCONSOLE
   PRUnichar msg[2048];
@@ -206,35 +199,16 @@ static int do_main(const char *exePath, 
       return 255;
     }
     result = XRE_main(argc, argv, &sAppData);
   }
 
   return result;
 }
 
-#if MOZ_PLATFORM_MAEMO == 6
-static bool
-GeckoPreLoader(const char* execPath)
-{
-  nsresult rv = XPCOMGlueStartup(execPath);
-  if (NS_FAILED(rv)) {
-    Output("Couldn't load XPCOM.\n");
-    return false;
-  }
-
-  rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
-  if (NS_FAILED(rv)) {
-    Output("Couldn't load XRE functions.\n");
-    return false;
-  }
-  return true;
-}
-#endif
-
 int main(int argc, char* argv[])
 {
   char exePath[MAXPATHLEN];
 
   nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't calculate the application directory.\n");
     return 255;
@@ -259,34 +233,30 @@ int main(int argc, char* argv[])
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
   if (gotCounters && !ioCounters.ReadOperationCount)
 #endif
   {
       XPCOMGlueEnablePreload();
   }
 
-#if MOZ_PLATFORM_MAEMO == 6
-  nsFastStartup startup;
-  startup.CreateFastStartup(argc, argv, exePath, GeckoPreLoader);
-#else
+
   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;
   }
-#endif
 
 #ifdef XRE_HAS_DLL_BLOCKLIST
   XRE_SetupDllBlocklist();
 #endif
 
   if (gotCounters) {
 #if defined(XP_WIN)
     XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
copy from mobile/xul/branding/official/Makefile.in
copy to b2g/branding/official/Makefile.in
--- a/mobile/xul/branding/official/Makefile.in
+++ b/b2g/branding/official/Makefile.in
@@ -29,17 +29,17 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH = ../../../..
+DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
copy from mobile/xul/branding/official/android-resources.mn
copy to b2g/branding/official/android-resources.mn
--- a/mobile/xul/branding/official/android-resources.mn
+++ b/b2g/branding/official/android-resources.mn
@@ -1,6 +1,1 @@
-mobile/xul/app/android/drawable/alertaddons.png
-mobile/xul/app/android/drawable/alertdownloads.png
-mobile/xul/branding/official/content/splash.png
-mobile/xul/branding/official/content/splash_v9.9.png
-mobile/xul/branding/official/content/splash_v8.9.png
-mobile/xul/branding/official/content/favicon32.png
+b2g/branding/official/content/splash.png
copy from mobile/xul/branding/official/configure.sh
copy to b2g/branding/official/configure.sh
--- a/mobile/xul/branding/official/configure.sh
+++ b/b2g/branding/official/configure.sh
@@ -1,3 +1,3 @@
-MOZ_APP_DISPLAYNAME=Firefox
-ANDROID_PACKAGE_NAME=org.mozilla.firefox
+MOZ_APP_DISPLAYNAME=B2G
+ANDROID_PACKAGE_NAME=org.mozilla.b2g
 MOZ_UPDATER=
copy from mobile/xul/branding/official/content/Makefile.in
copy to b2g/branding/official/content/Makefile.in
--- a/mobile/xul/branding/official/content/Makefile.in
+++ b/b2g/branding/official/content/Makefile.in
@@ -1,25 +1,12 @@
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../../..
+DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
 
-LINUX_BRANDING_FILES = \
-	fennec_26x26.png \
-	fennec_40x40.png \
-	fennec_48x48.png \
-	fennec_72x72.png \
-	fennec_scalable.png \
-	fennec_maemo_icon26.txt \
-	$(NULL)
-
-export::
-	$(NSINSTALL) -D $(DIST)/branding
-	cp $(addprefix $(srcdir)/, $(LINUX_BRANDING_FILES)) $(DIST)/branding/
-	$(NSINSTALL) -D $(DIST)/install
copy from mobile/xul/branding/official/content/about.png
copy to b2g/branding/official/content/about.png
copy from mobile/xul/branding/official/content/favicon32.png
copy to b2g/branding/official/content/favicon32.png
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b7513c2e4689ae656c99a0e79ae266a5931594e3
GIT binary patch
literal 5302
zc$@*Y6iMreP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^02E$HL_t(&-sPHkl;u@*??3zeraRWuT|HIxL^pId
zfd-mx1`$DmLTgmir%6b7Jj6U#CSDSUyce7hTu&olVq%O&0b@kp;w2(#7@{Bn3C*B1
zLpR;f-PLndSJkbmJN?FU_WR=&1eZ#J&zFDRZ>_!Vx#RhMe`oJ~zI&f5{9-TT)i+d~
zR7<LUfQZ35OJ^>FeKDl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k{wC}l*g-5C*BL*
zc!CCmk>E1T`+syUcSe_R?aJHamsUQi9$A#B7ytF*TT&}6U;&uzjX9wEOex@mrNliG
z8|*1zu!jr7z>=5L)N_ArSf4-A2=!cIrEse3oN*o{o-kC@s+yo;%A^QKpac^LQ2;tB
z%Y9-{p+;8}VMU=MFcGN8Pz?3ShI+0Ze`t{#?vig^|A70eQv{#+3E_($_pm%Odxip_
za*8Dk^n@Sj-S-2dZ|>7q{_@7!3KOcJ+sg0?kx(nG1eX>do*>jz>V_axghtTHp^QLS
z60kv}(G?L>4OBc3Q|qrFI*=oe+Vs=koZkEK3HRk5&~<v}nV#VDJ>j#bBK*_YG<Cuf
z>OkKq)^I{0eL%gb82N>U+3~uK&1bD!Ut?h*B~=lF10hBW^T%7*tRSiz3Bo{)F0WD_
zt`XF9xdiWpG!+gW&fK0yI^Dm2tiAWHdHc|j#P7?X)e~~|l(Eo5{mxUJ`JZRknCV$V
zwWo+?Px$`cX!f2*z`)fp+b%n;Z>yW=EV;Ae9$7V73C>zpT|U|fnq#4^b+dx6{Al*j
zo{WQ_ob%#xA$<s@=E@nJ>It0ocG)dZD&fRfJZ0A1&m#QKvu#fIzN>rTG42W8=qaJz
zQ&6S%H-Op*teGx<bP7Z@7+wma%VX8pS;)SwXQ3yI?Fp2hB6tUA_r_xHeB!hIsQ});
z#KuW=$_RV29`^*Vo^n1BLWADt%qj1-y;;+}8FW3tPmHW5Xwn;L&&=(~{Wkx`w$7fg
zj1#UB^sd8GuJtMJRz0Cl%%b$}ZEqC4=fxBDS^oR+@5eK8{2ypgiU*47lQ94Q002ov
JPDHLkV1lvM5PJXs
copy from mobile/xul/branding/official/content/jar.mn
copy to b2g/branding/official/content/jar.mn
copy from mobile/xul/branding/official/content/logo.png
copy to b2g/branding/official/content/logo.png
copy from mobile/xul/branding/official/content/logoWordmark.png
copy to b2g/branding/official/content/logoWordmark.png
copy from mobile/xul/branding/official/content/splash.png
copy to b2g/branding/official/content/splash.png
copy from mobile/xul/branding/official/locales/Makefile.in
copy to b2g/branding/official/locales/Makefile.in
--- a/mobile/xul/branding/official/locales/Makefile.in
+++ b/b2g/branding/official/locales/Makefile.in
@@ -29,19 +29,19 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH          = ../../../../..
+DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = mobile/branding/official/locales
+relativesrcdir = b2g/branding/official/locales
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 include $(topsrcdir)/config/rules.mk
copy from mobile/xul/branding/official/locales/en-US/brand.dtd
copy to b2g/branding/official/locales/en-US/brand.dtd
--- a/mobile/xul/branding/official/locales/en-US/brand.dtd
+++ b/b2g/branding/official/locales/en-US/brand.dtd
@@ -1,4 +1,4 @@
-<!ENTITY  brandShortName  "Firefox">
-<!ENTITY  brandFullName   "Mozilla Firefox">
+<!ENTITY  brandShortName  "B2G">
+<!ENTITY  brandFullName   "Mozilla B2G">
 <!ENTITY  vendorShortName "Mozilla">
-<!ENTITY  logoTrademark   "Firefox and the Firefox logos are trademarks of the Mozilla Foundation.">
+<!ENTITY  logoTrademark   "B2G and the B2G logos are trademarks of the Mozilla Foundation.">
copy from mobile/xul/branding/official/locales/en-US/brand.properties
copy to b2g/branding/official/locales/en-US/brand.properties
--- a/mobile/xul/branding/official/locales/en-US/brand.properties
+++ b/b2g/branding/official/locales/en-US/brand.properties
@@ -1,2 +1,2 @@
-brandShortName=Firefox
-brandFullName=Mozilla Firefox
+brandShortName=B2G
+brandFullName=Mozilla B2G
copy from mobile/xul/branding/official/locales/jar.mn
copy to b2g/branding/official/locales/jar.mn
copy from mobile/xul/branding/unofficial/Makefile.in
copy to b2g/branding/unofficial/Makefile.in
--- a/mobile/xul/branding/unofficial/Makefile.in
+++ b/b2g/branding/unofficial/Makefile.in
@@ -29,17 +29,17 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH = ../../../..
+DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 	content \
copy from mobile/xul/branding/unofficial/android-resources.mn
copy to b2g/branding/unofficial/android-resources.mn
--- a/mobile/xul/branding/unofficial/android-resources.mn
+++ b/b2g/branding/unofficial/android-resources.mn
@@ -1,6 +1,1 @@
-mobile/xul/app/android/drawable/alertaddons.png
-mobile/xul/app/android/drawable/alertdownloads.png
-mobile/xul/branding/unofficial/content/splash.png
-mobile/xul/branding/unofficial/content/splash_v9.9.png
-mobile/xul/branding/unofficial/content/splash_v8.9.png
-mobile/xul/branding/unofficial/content/favicon32.png
+b2g/branding/unofficial/content/splash.png
copy from mobile/xul/branding/unofficial/configure.sh
copy to b2g/branding/unofficial/configure.sh
--- a/mobile/xul/branding/unofficial/configure.sh
+++ b/b2g/branding/unofficial/configure.sh
@@ -1,3 +1,3 @@
-ANDROID_PACKAGE_NAME=org.mozilla.fennec_`echo $USER`
-MOZ_APP_DISPLAYNAME=Fennec
+ANDROID_PACKAGE_NAME=org.mozilla.b2g_`echo $USER`
+MOZ_APP_DISPLAYNAME=B2G
 MOZ_UPDATER=
copy from mobile/xul/branding/unofficial/content/Makefile.in
copy to b2g/branding/unofficial/content/Makefile.in
--- a/mobile/xul/branding/unofficial/content/Makefile.in
+++ b/b2g/branding/unofficial/content/Makefile.in
@@ -1,25 +1,11 @@
 # Branding Makefile
 #  - jars chrome artwork
 
-DEPTH = ../../../../..
+DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 include $(topsrcdir)/config/rules.mk
-
-LINUX_BRANDING_FILES = \
-	fennec_26x26.png \
-	fennec_40x40.png \
-	fennec_48x48.png \
-	fennec_72x72.png \
-	fennec_scalable.png \
-	fennec_maemo_icon26.txt \
-	$(NULL)
-
-export::
-	$(NSINSTALL) -D $(DIST)/branding
-	cp $(addprefix $(srcdir)/, $(LINUX_BRANDING_FILES)) $(DIST)/branding/
-	$(NSINSTALL) -D $(DIST)/install
copy from mobile/xul/branding/unofficial/content/about.png
copy to b2g/branding/unofficial/content/about.png
copy from mobile/xul/branding/unofficial/content/favicon32.png
copy to b2g/branding/unofficial/content/favicon32.png
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3ae248c857d7010eee72e3f20f5a8fbaeed4f196
GIT binary patch
literal 4053
zc$@*%4=V79P)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00001b5ch_0Itp)
z=>Px#24YJ`L;(K){{a7>y{D4^01tghL_t(&-tC!rY*p8t$3N%Zx4-A*+0Q!$o7I3Z
zBtY7*7_%BkAcY2+PB)sQYEn%{nNC}&YX2Bbr<K~O?aVYyGnzJNl8};yK*AQYV`J73
z0+a+Wn{Dv!XTSa3{mdT@(Wq(Kq)jWe;wv5L9_gO@`~J@FocsHp-+?>0gFCo`zYi?>
z@`rl;=+Tys#H{#pKhScth5EVm@AebdTF1Y<yQA`4`@r~&Bg<6NvO;c=oL(L2oqO-N
zD^;`RT@*s-0I%%WL}6Y9^XnTvdIyfQwlaU-ygxYjsi%L#R~}mrz}}a4Kk)47o^KrO
zHYTNm`MyYb*jHXx<kEW+vh!*}#-hVUVQNTQSR$h<=S|vIJ0tg}lP1=;0UU2R&b{^b
z{*j0sCDz}=eQO^4T?a}z{Ob1_1OCALl;yG%PoOnA9KYcB3WwLNY8;uVS6`+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copy from mobile/xul/branding/unofficial/content/logo.png
copy to b2g/branding/unofficial/content/logo.png
copy from mobile/xul/branding/unofficial/content/logoWordmark.png
copy to b2g/branding/unofficial/content/logoWordmark.png
copy from mobile/xul/branding/unofficial/content/splash.png
copy to b2g/branding/unofficial/content/splash.png
copy from mobile/xul/branding/unofficial/locales/Makefile.in
copy to b2g/branding/unofficial/locales/Makefile.in
--- a/mobile/xul/branding/unofficial/locales/Makefile.in
+++ b/b2g/branding/unofficial/locales/Makefile.in
@@ -30,19 +30,19 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH          = ../../../../..
+DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
-relativesrcdir = mobile/branding/unofficial/locales
+relativesrcdir = b2g/branding/unofficial/locales
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(AB_CD)
 
 include $(topsrcdir)/config/rules.mk
copy from mobile/xul/branding/unofficial/locales/en-US/brand.dtd
copy to b2g/branding/unofficial/locales/en-US/brand.dtd
--- a/mobile/xul/branding/unofficial/locales/en-US/brand.dtd
+++ b/b2g/branding/unofficial/locales/en-US/brand.dtd
@@ -1,4 +1,4 @@
-<!ENTITY  brandShortName  "Fennec">
-<!ENTITY  brandFullName   "Mozilla Fennec">
+<!ENTITY  brandShortName  "B2G">
+<!ENTITY  brandFullName   "Mozilla B2G">
 <!ENTITY  vendorShortName "Mozilla">
 <!ENTITY  logoTrademark   "">
copy from mobile/xul/branding/unofficial/locales/en-US/brand.properties
copy to b2g/branding/unofficial/locales/en-US/brand.properties
--- a/mobile/xul/branding/unofficial/locales/en-US/brand.properties
+++ b/b2g/branding/unofficial/locales/en-US/brand.properties
@@ -1,2 +1,2 @@
-brandShortName=Fennec
-brandFullName=Mozilla Fennec
+brandShortName=B2G
+brandFullName=Mozilla B2G
copy from mobile/xul/branding/unofficial/locales/jar.mn
copy to b2g/branding/unofficial/locales/jar.mn
copy from mobile/xul/build.mk
copy to b2g/build.mk
--- a/mobile/xul/build.mk
+++ b/b2g/build.mk
@@ -31,19 +31,16 @@
 # 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 *****
 
 ifndef LIBXUL_SDK
-# Needed for building our components as part of libxul
-APP_LIBXUL_DIRS += mobile/xul/components/build
-
 include $(topsrcdir)/toolkit/toolkit-tiers.mk
 else
 ifdef ENABLE_TESTS
 tier_testharness_dirs += \
   testing/mochitest \
   $(NULL)
 endif
 endif
@@ -55,43 +52,37 @@ tier_app_dirs += extensions
 endif
 
 ifdef MOZ_SERVICES_SYNC
 tier_app_dirs += services
 endif
 
 tier_app_dirs += \
   $(MOZ_BRANDING_DIRECTORY) \
-  mobile/xul \
+  b2g \
   $(NULL)
 
 
 installer: 
-	@$(MAKE) -C mobile/xul/installer installer
+	@$(MAKE) -C b2g/installer installer
 
 package:
-	@$(MAKE) -C mobile/xul/installer
+	@$(MAKE) -C b2g/installer
 
 install::
-	@echo "Mobile can't be installed directly."
+	@echo "B2G can't be installed directly."
 	@exit 1
 
-deb: package
-	@$(MAKE) -C mobile/xul/installer deb
-
 upload::
-	@$(MAKE) -C mobile/xul/installer upload
+	@$(MAKE) -C b2g/installer upload
 
 ifdef ENABLE_TESTS
 # Implemented in testing/testsuite-targets.mk
 
 mochitest-browser-chrome:
 	$(RUN_MOCHITEST) --browser-chrome
 	$(CHECK_TEST_ERROR)
 
 mochitest:: mochitest-browser-chrome
 
 .PHONY: mochitest-browser-chrome
 endif
 
-ifeq ($(OS_TARGET),Linux)
-deb: installer
-endif
copy from mobile/xul/chrome/Makefile.in
copy to b2g/chrome/Makefile.in
--- a/mobile/xul/chrome/Makefile.in
+++ b/b2g/chrome/Makefile.in
@@ -30,26 +30,21 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH     = ../../..
+DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
            -DPACKAGE=browser \
            -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
            $(NULL)
 
-
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
-
 include $(topsrcdir)/config/rules.mk
copy from mobile/xul/chrome/content/commandUtil.js
copy to b2g/chrome/content/commandUtil.js
--- a/mobile/xul/chrome/content/commandUtil.js
+++ b/b2g/chrome/content/commandUtil.js
@@ -34,164 +34,164 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 /**
  * Command Updater
  */
-var CommandUpdater = {
+let CommandUpdater = {
   /**
    * Gets a controller that can handle a particular command.
-   * @param   command
-   *          A command to locate a controller for, preferring controllers that
-   *          show the command as enabled.
-   * @returns In this order of precedence:
+   * @param {string} command
+   *        A command to locate a controller for, preferring controllers that
+   *        show the command as enabled.
+   * @return {object} In this order of precedence:
    *            - the first controller supporting the specified command
    *              associated with the focused element that advertises the
-   *              command as ENABLED
+   *              command as ENABLED.
    *            - the first controller supporting the specified command
    *              associated with the global window that advertises the
-   *              command as ENABLED
+   *              command as ENABLED.
    *            - the first controller supporting the specified command
-   *              associated with the focused element
+   *              associated with the focused element.
    *            - the first controller supporting the specified command
-   *              associated with the global window
+   *              associated with the global window.
    */
   _getControllerForCommand: function(command) {
     try {
-      var controller = top.document.commandDispatcher.getControllerForCommand(command);
+      let commandDispatcher = top.document.commandDispatcher;
+      let controller = commandDispatcher.getControllerForCommand(command);
       if (controller && controller.isCommandEnabled(command))
         return controller;
     }
-    catch(e) {
-    }
-    var controllerCount = window.controllers.getControllerCount();
-    for (var i = 0; i < controllerCount; ++i) {
-      var current = window.controllers.getControllerAt(i);
+    catch (e) { }
+
+    let controllerCount = window.controllers.getControllerCount();
+    for (let i = 0; i < controllerCount; ++i) {
+      let current = window.controllers.getControllerAt(i);
       try {
-        if (current.supportsCommand(command) && current.isCommandEnabled(command))
+        if (current.supportsCommand(command) &&
+            current.isCommandEnabled(command))
           return current;
       }
-      catch (e) {
-      }
+      catch (e) { }
     }
     return controller || window.controllers.getControllerForCommand(command);
   },
 
   /**
    * Updates the state of a XUL <command> element for the specified command
    * depending on its state.
-   * @param   command
-   *          The name of the command to update the XUL <command> element for
+   * @param {string} command
+   *        The name of the command to update the XUL <command> element for.
    */
   updateCommand: function(command) {
-    var enabled = false;
+    let enabled = false;
     try {
-      var controller = this._getControllerForCommand(command);
+      let controller = this._getControllerForCommand(command);
       if (controller) {
         enabled = controller.isCommandEnabled(command);
       }
     }
-    catch(ex) { }
+    catch (ex) { }
 
     this.enableCommand(command, enabled);
   },
 
   /**
    * Updates the state of a XUL <command> element for the specified command
    * depending on its state.
-   * @param   command
-   *          The name of the command to update the XUL <command> element for
+   * @param {string} command
+   *        The name of the command to update the XUL <command> element for.
    */
   updateCommands: function(_commands) {
-    var commands = _commands.split(",");
-    for (var command in commands) {
+    let commands = _commands.split(',');
+    for (let command in commands) {
       this.updateCommand(commands[command]);
     }
   },
 
   /**
    * Enables or disables a XUL <command> element.
-   * @param   command
-   *          The name of the command to enable or disable
-   * @param   enabled
+   * @param {string} command
+   *          The name of the command to enable or disable.
+   * @param {bool} enabled
    *          true if the command should be enabled, false otherwise.
    */
   enableCommand: function(command, enabled) {
-    var element = document.getElementById(command);
+    let element = document.getElementById(command);
     if (!element)
       return;
+
     if (enabled)
-      element.removeAttribute("disabled");
+      element.removeAttribute('disabled');
     else
-      element.setAttribute("disabled", "true");
+      element.setAttribute('disabled', 'true');
   },
 
   /**
    * Performs the action associated with a specified command using the most
    * relevant controller.
-   * @param   command
+   * @param {string} command
    *          The command to perform.
    */
   doCommand: function(command) {
-    var controller = this._getControllerForCommand(command);
+    let controller = this._getControllerForCommand(command);
     if (!controller)
       return;
     controller.doCommand(command);
   },
 
   /**
    * Changes the label attribute for the specified command.
-   * @param   command
+   * @param {string} command
    *          The command to update.
-   * @param   labelAttribute
+   * @param {string} labelAttribute
    *          The label value to use.
    */
   setMenuValue: function(command, labelAttribute) {
-    var commandNode = top.document.getElementById(command);
-    if (commandNode)
-    {
-      var label = commandNode.getAttribute(labelAttribute);
-      if ( label )
+    let commandNode = top.document.getElementById(command);
+    if (commandNode) {
+      let label = commandNode.getAttribute(labelAttribute);
+      if (label)
         commandNode.setAttribute('label', label);
     }
   },
 
   /**
    * Changes the accesskey attribute for the specified command.
-   * @param   command
+   * @param {string} command
    *          The command to update.
-   * @param   valueAttribute
+   * @param {string} valueAttribute
    *          The value attribute to use.
    */
   setAccessKey: function(command, valueAttribute) {
-    var commandNode = top.document.getElementById(command);
-    if (commandNode)
-    {
-      var value = commandNode.getAttribute(valueAttribute);
-      if ( value )
+    let commandNode = top.document.getElementById(command);
+    if (commandNode) {
+      let value = commandNode.getAttribute(valueAttribute);
+      if (value)
         commandNode.setAttribute('accesskey', value);
     }
   },
 
   /**
    * Inform all the controllers attached to a node that an event has occurred
-   * (e.g. the tree controllers need to be informed of blur events so that they can change some of the
-   * menu items back to their default values)
-   * @param   node
-   *          The node receiving the event
-   * @param   event
+   * (e.g. the tree controllers need to be informed of blur events so that they
+   * can change some of the menu items back to their default values)
+   * @param  {node} node
+   *          The node receiving the event.
+   * @param  {event} event
    *          The event.
    */
   onEvent: function(node, event) {
-    var numControllers = node.controllers.getControllerCount();
-    var controller;
+    let numControllers = node.controllers.getControllerCount();
+    let controller;
 
-    for ( var controllerIndex = 0; controllerIndex < numControllers; controllerIndex++ )
-    {
-      controller = node.controllers.getControllerAt(controllerIndex);
-      if ( controller )
+    for (let i = 0; i < numControllers; i++) {
+      controller = node.controllers.getControllerAt(i);
+      if (controller)
         controller.onEvent(event);
     }
   }
 };
+
copy from mobile/xul/chrome/content/netError.xhtml
copy to b2g/chrome/content/netError.xhtml
--- a/mobile/xul/chrome/content/netError.xhtml
+++ b/b2g/chrome/content/netError.xhtml
@@ -313,17 +313,16 @@
         <h1 id="et_fileNotFound">&fileNotFound.title;</h1>
         <h1 id="et_malformedURI">&malformedURI.title;</h1>
         <h1 id="et_protocolNotFound">&protocolNotFound.title;</h1>
         <h1 id="et_connectionFailure">&connectionFailure.title;</h1>
         <h1 id="et_netTimeout">&netTimeout.title;</h1>
         <h1 id="et_redirectLoop">&redirectLoop.title;</h1>
         <h1 id="et_unknownSocketType">&unknownSocketType.title;</h1>
         <h1 id="et_netReset">&netReset.title;</h1>
-        <h1 id="et_notCached">&notCached.title;</h1>
         <h1 id="et_netOffline">&netOffline.title;</h1>
         <h1 id="et_netInterrupt">&netInterrupt.title;</h1>
         <h1 id="et_deniedPortAccess">&deniedPortAccess.title;</h1>
         <h1 id="et_proxyResolveFailure">&proxyResolveFailure.title;</h1>
         <h1 id="et_proxyConnectFailure">&proxyConnectFailure.title;</h1>
         <h1 id="et_contentEncodingError">&contentEncodingError.title;</h1>
         <h1 id="et_unsafeContentType">&unsafeContentType.title;</h1>
         <h1 id="et_nssFailure2">&nssFailure2.title;</h1>
@@ -338,17 +337,16 @@
         <div id="ed_fileNotFound">&fileNotFound.longDesc;</div>
         <div id="ed_malformedURI">&malformedURI.longDesc;</div>
         <div id="ed_protocolNotFound">&protocolNotFound.longDesc;</div>
         <div id="ed_connectionFailure">&connectionFailure.longDesc;</div>
         <div id="ed_netTimeout">&netTimeout.longDesc;</div>
         <div id="ed_redirectLoop">&redirectLoop.longDesc;</div>
         <div id="ed_unknownSocketType">&unknownSocketType.longDesc;</div>
         <div id="ed_netReset">&netReset.longDesc;</div>
-        <div id="ed_notCached">&notCached.longDesc;</div>
         <div id="ed_netOffline">&netOffline.longDesc2;</div>
         <div id="ed_netInterrupt">&netInterrupt.longDesc;</div>
         <div id="ed_deniedPortAccess">&deniedPortAccess.longDesc;</div>
         <div id="ed_proxyResolveFailure">&proxyResolveFailure.longDesc2;</div>
         <div id="ed_proxyConnectFailure">&proxyConnectFailure.longDesc;</div>
         <div id="ed_contentEncodingError">&contentEncodingError.longDesc;</div>
         <div id="ed_unsafeContentType">&unsafeContentType.longDesc;</div>
         <div id="ed_nssFailure2">&nssFailure2.longDesc;</div>
new file mode 100644
--- /dev/null
+++ b/b2g/chrome/content/shell.js
@@ -0,0 +1,220 @@
+/* ***** 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 B2G.
+ *
+ * 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 ***** */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+const CC = Components.Constructor;
+
+Cu.import('resource://gre/modules/Services.jsm');
+
+const LocalFile = CC('@mozilla.org/file/local;1',
+                     'nsILocalFile',
+                     'initWithPath');
+var shell = {
+  get home() {
+    delete this.home;
+    return this.home = document.getElementById('homescreen');
+  },
+
+  get homeSrc() {
+    try {
+      let homeSrc = Cc['@mozilla.org/process/environment;1']
+                      .getService(Ci.nsIEnvironment)
+                      .get('B2G_HOMESCREEN');
+      if (homeSrc)
+        return homeSrc;
+    } catch (e) {}
+
+    let urls = Services.prefs.getCharPref('browser.homescreenURL').split(',');
+    for (let i = 0; i < urls.length; i++) {
+      let url = urls[i];
+      if (url.substring(0, 7) != 'file://')
+        return url;
+
+      let file = new LocalFile(url.substring(7, url.length));
+      if (file.exists())
+        return url;
+    }
+    return null;
+  },
+
+  start: function shell_init() {
+    window.controllers.appendController(this);
+    window.addEventListener('keypress', this);
+    this.home.addEventListener('load', this, true);
+
+    let ioService = Cc['@mozilla.org/network/io-service;1']
+                      .getService(Ci.nsIIOService2);
+    ioService.offline = false;
+
+    let browser = this.home;
+    browser.homePage = this.homeSrc;
+    browser.goHome();
+  },
+
+  stop: function shell_stop() {
+    window.controllers.removeController(this);
+    window.removeEventListener('keypress', this);
+  },
+
+  supportsCommand: function shell_supportsCommand(cmd) {
+    let isSupported = false;
+    switch (cmd) {
+      case 'cmd_close':
+        isSupported = true;
+        break;
+      default:
+        isSupported = false;
+        break;
+    }
+    return isSupported;
+  },
+
+  isCommandEnabled: function shell_isCommandEnabled(cmd) {
+    return true;
+  },
+
+  doCommand: function shell_doCommand(cmd) {
+    switch (cmd) {
+      case 'cmd_close':
+        this.sendEvent(this.home.contentWindow, 'appclose');
+        break;
+    }
+  },
+
+  handleEvent: function shell_handleEvent(evt) {
+    switch (evt.type) {
+      case 'keypress':
+        switch (evt.keyCode) {
+          case evt.DOM_VK_HOME:
+            this.sendEvent(this.home.contentWindow, 'home');
+            break;
+          case evt.DOM_VK_SLEEP:
+            screen.mozEnabled = !screen.mozEnabled;
+            break;
+          case evt.DOM_VK_ESCAPE:
+            if (evt.defaultPrevented)
+              return;
+            this.doCommand('cmd_close');
+            break;
+        }
+        break;
+      case 'load':
+        this.home.removeEventListener('load', this, true);
+        this.sendEvent(window, 'ContentStart');
+        break;
+    }
+  },
+  sendEvent: function shell_sendEvent(content, type, details) {
+    let event = content.document.createEvent('CustomEvent');
+    event.initCustomEvent(type, true, true, details ? details : {});
+    content.dispatchEvent(event);
+  }
+};
+
+(function VirtualKeyboardManager() {
+  let activeElement = null;
+  let isKeyboardOpened = false;
+
+  let constructor = {
+    handleEvent: function vkm_handleEvent(evt) {
+      let contentWindow = shell.home.contentWindow.wrappedJSObject;
+
+      switch (evt.type) {
+        case 'ContentStart':
+          contentWindow.navigator.mozKeyboard = new MozKeyboard();
+          break;
+        case 'keypress':
+          if (evt.keyCode != evt.DOM_VK_ESCAPE || !isKeyboardOpened)
+            return;
+
+          shell.sendEvent(contentWindow, 'hideime');
+          isKeyboardOpened = false;
+
+          evt.preventDefault();
+          evt.stopPropagation();
+          break;
+        case 'mousedown':
+          if (evt.target != activeElement || isKeyboardOpened)
+            return;
+
+          let type = activeElement.type;
+          shell.sendEvent(contentWindow, 'showime', { type: type });
+          isKeyboardOpened = true;
+          break;
+      }
+    },
+    observe: function vkm_observe(subject, topic, data) {
+      let contentWindow = shell.home.contentWindow;
+
+      let shouldOpen = parseInt(data);
+      if (shouldOpen && !isKeyboardOpened) {
+        activeElement = Cc['@mozilla.org/focus-manager;1']
+                          .getService(Ci.nsIFocusManager)
+                          .focusedElement;
+        if (!activeElement)
+          return;
+
+        let type = activeElement.type;
+        shell.sendEvent(contentWindow, 'showime', { type: type });
+      } else if (!shouldOpen && isKeyboardOpened) {
+        shell.sendEvent(contentWindow, 'hideime');
+      }
+      isKeyboardOpened = shouldOpen;
+    }
+  };
+
+  Services.obs.addObserver(constructor, "ime-enabled-state-changed", false);
+  ['ContentStart', 'keypress', 'mousedown'].forEach(function vkm_events(type) {
+    window.addEventListener(type, constructor, true);
+  });
+})();
+
+
+function MozKeyboard() {
+}
+
+MozKeyboard.prototype = {
+  sendKey: function mozKeyboardSendKey(keyCode) {
+    var utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
+                      .getInterface(Ci.nsIDOMWindowUtils);
+    ['keydown', 'keypress', 'keyup'].forEach(function sendKeyEvents(type) {
+      utils.sendKeyEvent(type, keyCode, keyCode, null);
+    });
+  }
+};
+
new file mode 100644
--- /dev/null
+++ b/b2g/chrome/content/shell.xul
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+
+<!-- ***** BEGIN LICENSE BLOCK *****
+   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
+   -
+   - The contents of this file are subject to the Mozilla Public License Version
+   - 1.1 (the "License"); you may not use this file except in compliance with
+   - the License. You may obtain a copy of the License at
+   - http://www.mozilla.org/MPL/
+   -
+   - Software distributed under the License is distributed on an "AS IS" basis,
+   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+   - for the specific language governing rights and limitations under the
+   - License.
+   -
+   - The Original Code is Mozilla Mobile Browser.
+   -
+   - The Initial Developer of the Original Code is
+   - Mozilla Corporation.
+   - Portions created by the Initial Developer are Copyright (C) 2011
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -   Chris Jones <jones.chris.g@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
+   - decision by deleting the provisions above and replace them with the notice
+   - and other provisions required by the LGPL or the GPL. If you do not delete
+   - the provisions above, a recipient may use your version of this file under
+   - the terms of any one of the MPL, the GPL or the LGPL.
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        id="shell"
+        width="480" height="800"
+#ifdef ANDROID
+        sizemode="fullscreen"
+#endif
+        style="background: black; overflow: hidden;"
+        onload="shell.start();"
+        onunload="shell.stop();">
+
+  <script type="application/javascript" src="chrome://browser/content/commandUtil.js"/>
+  <script type="application/javascript" src="chrome://browser/content/shell.js"/>
+  <script type="application/javascript" src="chrome://browser/content/touch.js"/>
+
+  <commandset id="mainCommandSet">
+    <command id="cmd_close" oncommand="CommandUpdater.doCommand(this.id);"/>
+  </commandset>
+
+  <browser id="homescreen" type="content-primary" flex="1" style="overflow: hidden;"/>
+</window>
+
new file mode 100644
--- /dev/null
+++ b/b2g/chrome/content/touch.js
@@ -0,0 +1,240 @@
+/* ***** 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 B2G.
+ *
+ * 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):
+ *
+ * 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 ***** */
+
+(function touchEventHandler() {
+  let debugging = false;
+  function debug(str) {
+    if (debugging)
+      dump(str + '\n');
+  };
+
+  let contextMenuTimeout = 0;
+
+  // This guard is used to not re-enter the events processing loop for
+  // self dispatched events
+  let ignoreEvents = false;
+
+  // During a 'touchstart' and the first 'touchmove' mouse events can be
+  // prevented for the current touch sequence.
+  let canPreventMouseEvents = false;
+
+  // Used to track the first mousemove and to cancel click dispatc if it's not
+  // true.
+  let isNewTouchAction = false;
+
+  // If this is set to true all mouse events will be cancelled by calling
+  // both evt.preventDefault() and evt.stopPropagation().
+  // This will not prevent a contextmenu event to be fired.
+  // This can be turned on if canPreventMouseEvents is true and the consumer
+  // application call evt.preventDefault();
+  let preventMouseEvents = false;
+
+  let TouchEventHandler = {
+    events: ['mousedown', 'mousemove', 'mouseup', 'click', 'unload'],
+    start: function teh_start() {
+      this.events.forEach((function(evt) {
+        shell.home.addEventListener(evt, this, true);
+      }).bind(this));
+    },
+    stop: function teh_stop() {
+      this.events.forEach((function(evt) {
+        shell.home.removeEventListener(evt, this, true);
+      }).bind(this));
+    },
+    handleEvent: function teh_handleEvent(evt) {
+      if (evt.button || ignoreEvents)
+        return;
+
+      let eventTarget = this.target;
+      let type = '';
+      switch (evt.type) {
+        case 'mousedown':
+          debug('mousedown:');
+
+          this.target = evt.target;
+          this.timestamp = evt.timeStamp;
+          evt.target.setCapture(false);
+
+          preventMouseEvents = false;
+          canPreventMouseEvents = true;
+          isNewTouchAction = true;
+
+          contextMenuTimeout =
+            this.sendContextMenu(evt.target, evt.pageX, evt.pageY, 2000);
+          this.startX = evt.pageX;
+          this.startY = evt.pageY;
+          type = 'touchstart';
+          break;
+
+        case 'mousemove':
+          if (!eventTarget)
+            return;
+
+          // On device a mousemove event if fired right after the mousedown
+          // because of the size of the finger, so let's ignore what happens
+          // below 5ms
+          if (evt.timeStamp - this.timestamp < 30)
+            break;
+
+          if (isNewTouchAction) {
+            canPreventMouseEvents = true;
+            isNewTouchAction = false;
+          }
+
+          if (Math.abs(this.startX - evt.pageX) > 15 ||
+              Math.abs(this.startY - evt.pageY) > 15)
+            window.clearTimeout(contextMenuTimeout);
+          type = 'touchmove';
+          break;
+
+        case 'mouseup':
+          if (!eventTarget)
+            return;
+          debug('mouseup:');
+
+          window.clearTimeout(contextMenuTimeout);
+          eventTarget.ownerDocument.releaseCapture();
+          this.target = null;
+          type = 'touchend';
+          break;
+
+        case 'unload':
+          if (!eventTarget)
+            return;
+
+          window.clearTimeout(contextMenuTimeout);
+          eventTarget.ownerDocument.releaseCapture();
+          this.target = null;
+          TouchEventHandler.stop();
+          return;
+
+        case 'click':
+          if (!isNewTouchAction) {
+            debug('click: cancel');
+
+            evt.preventDefault();
+            evt.stopPropagation();
+          } else {
+            // Mouse events has been cancelled so dispatch a sequence
+            // of events to where touchend has been fired
+            if (preventMouseEvents) {
+              let target = evt.target;
+              ignoreEvents = true;
+              try {
+                this.fireMouseEvent('mousemove', evt);
+                this.fireMouseEvent('mousedown', evt);
+                this.fireMouseEvent('mouseup', evt);
+              } catch (e) {
+                alert(e);
+              }
+              evt.preventDefault();
+              evt.stopPropagation();
+              ignoreEvents = false;
+            }
+
+            debug('click: fire');
+          }
+          return;
+      }
+
+      let target = eventTarget || this.target;
+      if (target && type) {
+        let touchEvent = this.sendTouchEvent(evt, target, type);
+        if (touchEvent.defaultPrevented && canPreventMouseEvents)
+          preventMouseEvents = true;
+      }
+
+      if (preventMouseEvents) {
+        evt.preventDefault();
+        evt.stopPropagation();
+
+        if (type != 'touchmove')
+          debug('cancelled (fire ' + type + ')');
+      }
+    },
+    fireMouseEvent: function teh_fireMouseEvent(type, evt)  {
+      debug(type + ': fire');
+
+      let content = evt.target.ownerDocument.defaultView;
+      var utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
+                         .getInterface(Ci.nsIDOMWindowUtils);
+      utils.sendMouseEvent(type, evt.pageX, evt.pageY, 0, 1, 0, true);
+    },
+    sendContextMenu: function teh_sendContextMenu(target, x, y, delay) {
+      let doc = target.ownerDocument;
+      let evt = doc.createEvent('MouseEvent');
+      evt.initMouseEvent('contextmenu', true, true, doc.defaultView,
+                         0, x, y, x, y, false, false, false, false,
+                         0, null);
+
+      let timeout = window.setTimeout((function contextMenu() {
+        debug('fire context-menu');
+
+        target.dispatchEvent(evt);
+        if (!evt.defaultPrevented)
+          return;
+
+        doc.releaseCapture();
+        this.target = null;
+
+        isNewTouchAction = false;
+      }).bind(this), delay);
+      return timeout;
+    },
+    sendTouchEvent: function teh_sendTouchEvent(evt, target, name) {
+      let touchEvent = document.createEvent('touchevent');
+      let point = document.createTouch(window, target, 0,
+                                     evt.pageX, evt.pageY,
+                                     evt.screenX, evt.screenY,
+                                     evt.clientX, evt.clientY,
+                                     1, 1, 0, 0);
+      let touches = document.createTouchList(point);
+      let targetTouches = touches;
+      let changedTouches = touches;
+      touchEvent.initTouchEvent(name, true, true, window, 0,
+                                false, false, false, false,
+                                touches, targetTouches, changedTouches);
+      target.dispatchEvent(touchEvent);
+      return touchEvent;
+    }
+  };
+
+  window.addEventListener('ContentStart', function touchStart(evt) {
+    window.removeEventListener('ContentStart', touchStart);
+    TouchEventHandler.start();
+  });
+})();
+
copy from mobile/xul/chrome/jar.mn
copy to b2g/chrome/jar.mn
--- a/mobile/xul/chrome/jar.mn
+++ b/b2g/chrome/jar.mn
@@ -1,89 +1,13 @@
 #filter substitution
 
 chrome.jar:
+% content branding %content/branding/
 % content browser %content/
 
-* content/about.xhtml                  (content/about.xhtml)
-  content/config.xul                   (content/config.xul)
-  content/config.js                    (content/config.js)
-  content/aboutCertError.xhtml         (content/aboutCertError.xhtml)
-  content/aboutHome.xhtml              (content/aboutHome.xhtml)
-  content/localePicker.xul             (content/localePicker.xul)
-  content/localePicker.js              (content/localePicker.js)
-* content/aboutRights.xhtml            (content/aboutRights.xhtml)
-  content/blockedSite.xhtml            (content/blockedSite.xhtml)
-  content/languages.properties         (content/languages.properties)
-* content/browser.xul                  (content/browser.xul)
-* content/browser.js                   (content/browser.js)
-* content/browser-ui.js                (content/browser-ui.js)
-* content/browser-scripts.js           (content/browser-scripts.js)
-* content/common-ui.js                 (content/common-ui.js)
-* content/AlertsHelper.js              (content/AlertsHelper.js)
-  content/AppMenu.js                   (content/AppMenu.js)
-* content/AwesomePanel.js              (content/AwesomePanel.js)
-  content/BookmarkHelper.js            (content/BookmarkHelper.js)
-  content/BookmarkPopup.js             (content/BookmarkPopup.js)
-  content/CharsetMenu.js               (content/CharsetMenu.js)
-  content/ContentPopupHelper.js        (content/ContentPopupHelper.js)
-* content/ContextCommands.js           (content/ContextCommands.js)
-  content/IndexedDB.js                 (content/IndexedDB.js)
-  content/MenuListHelperUI.js          (content/MenuListHelperUI.js)
-  content/OfflineApps.js               (content/OfflineApps.js)
-* content/PageActions.js               (content/PageActions.js)
-  content/SelectHelperUI.js            (content/SelectHelperUI.js)
-  content/SelectionHelper.js           (content/SelectionHelper.js)
-  content/SharingUI.js                 (content/SharingUI.js)
-  content/TabletSidebar.js             (content/TabletSidebar.js)
-  content/TabsPopup.js                 (content/TabsPopup.js)
-  content/MasterPasswordUI.js          (content/MasterPasswordUI.js)
-* content/content.js                   (content/content.js)
-  content/commandUtil.js               (content/commandUtil.js)
-* content/bindings.xml                 (content/bindings.xml)
-  content/tabs.xml                     (content/tabs.xml)
-  content/bindings/checkbox.xml        (content/bindings/checkbox.xml)
-* content/bindings/browser.xml         (content/bindings/browser.xml)
-  content/bindings/browser.js          (content/bindings/browser.js)
-  content/notification.xml             (content/notification.xml)
-  content/bindings/extensions.xml      (content/bindings/extensions.xml)
-  content/bindings/downloads.xml       (content/bindings/downloads.xml)
-  content/bindings/console.xml         (content/bindings/console.xml)
-  content/bindings/dialog.xml          (content/bindings/dialog.xml)
-  content/bindings/pageaction.xml      (content/bindings/pageaction.xml)
-  content/bindings/arrowbox.xml        (content/bindings/arrowbox.xml)
-  content/browser.css                  (content/browser.css)
-  content/cursor.css                   (content/cursor.css)
-% content branding %content/branding/
-  content/sanitize.js                  (content/sanitize.js)
-* content/input.js                     (content/input.js)
-* content/Util.js                      (content/Util.js)
-  content/forms.js                     (content/forms.js)
-* content/preferences.js               (content/preferences.js)
-  content/exceptions.js                (content/exceptions.js)
-* content/extensions.js                (content/extensions.js)
-* content/downloads.js                 (content/downloads.js)
-  content/console.js                   (content/console.js)
-  content/prompt/alert.xul             (content/prompt/alert.xul)
-  content/prompt/confirm.xul           (content/prompt/confirm.xul)
-  content/prompt/prompt.xul            (content/prompt/prompt.xul)
-  content/prompt/promptPassword.xul    (content/prompt/promptPassword.xul)
-  content/prompt/select.xul            (content/prompt/select.xul)
-  content/prompt/prompt.js             (content/prompt/prompt.js)
-  content/share.xul                    (content/share.xul)
-  content/webapps.xul                  (content/webapps.xul)
-  content/WebappsUI.js                 (content/WebappsUI.js)
-  content/masterPassword.xul           (content/masterPassword.xul)
-  content/removeMasterPassword.xul     (content/removeMasterPassword.xul)
-  content/AnimatedZoom.js              (content/AnimatedZoom.js)
-#ifdef MOZ_SERVICES_SYNC
-  content/sync.js                      (content/sync.js)
-#endif
-  content/LoginManagerChild.js         (content/LoginManagerChild.js)
-  content/fullscreen-video.js          (content/fullscreen-video.js)
-  content/fullscreen-video.xhtml       (content/fullscreen-video.xhtml)
-  content/netError.xhtml               (content/netError.xhtml)
-  content/CapturePickerUI.js           (content/CapturePickerUI.js)
-  content/CaptureDialog.js             (content/CaptureDialog.js)
-  content/CaptureDialog.xul            (content/CaptureDialog.xul)
-  
-% override chrome://global/content/config.xul chrome://browser/content/config.xul
+* content/shell.xul                     (content/shell.xul)
+  content/shell.js                      (content/shell.js)
+  content/touch.js                      (content/touch.js)
+  content/commandUtil.js                (content/commandUtil.js)
+
 % override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
+  content/netError.xhtml                (content/netError.xhtml)
copy from mobile/xul/confvars.sh
copy to b2g/confvars.sh
--- a/mobile/xul/confvars.sh
+++ b/b2g/confvars.sh
@@ -30,44 +30,40 @@
 # 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 *****
 
-MOZ_APP_BASENAME=Fennec
+MOZ_APP_BASENAME=B2G
 MOZ_APP_VENDOR=Mozilla
 
 MOZ_APP_VERSION=11.0a1
 
-MOZ_BRANDING_DIRECTORY=mobile/xul/branding/unofficial
-MOZ_OFFICIAL_BRANDING_DIRECTORY=mobile/xul/branding/official
+MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
+MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
 # MOZ_APP_DISPLAYNAME is set by branding/configure.sh
 
 MOZ_SAFE_BROWSING=
-MOZ_SERVICES_SYNC=1
+MOZ_SERVICES_SYNC=
 
 MOZ_DISABLE_DOMCRYPTO=1
+MOZ_APP_STATIC_INI=1
+
+if test "$OS_TARGET" = "Android"; then
+MOZ_CAPTURE=1
+MOZ_RAW=1
+fi
+
+# use custom widget for html:select
+MOZ_USE_NATIVE_POPUP_WINDOWS=1
 
 if test "$LIBXUL_SDK"; then
 MOZ_XULRUNNER=1
 else
 MOZ_XULRUNNER=
 MOZ_PLACES=1
 fi
 
-if test "$OS_TARGET" = "Android"; then
-MOZ_CAPTURE=1
-MOZ_RAW=1
-fi
-
-# Needed for building our components as part of libxul
-MOZ_APP_COMPONENT_LIBS="browsercomps"
-MOZ_APP_COMPONENT_INCLUDE=nsBrowserComponents.h
-
-# use custom widget for html:select
-MOZ_USE_NATIVE_POPUP_WINDOWS=1
-
-MOZ_APP_ID={a23983c0-fd0e-11dc-95ff-0800200c9a66}
+MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61}
 MOZ_EXTENSION_MANAGER=1
-MOZ_APP_STATIC_INI=1
copy from mobile/xul/installer/Makefile.in
copy to b2g/installer/Makefile.in
--- a/mobile/xul/installer/Makefile.in
+++ b/b2g/installer/Makefile.in
@@ -31,41 +31,35 @@
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH     = ../../..
+DEPTH     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
-
-# overwrite mobile-l10n.js with a matchOS=true one for multi-locale builds
-ifeq ($(AB_CD),multi)
-PREF_JS_EXPORTS = $(srcdir)/mobile-l10n.js
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 MOZ_PKG_REMOVALS = $(srcdir)/removed-files.in
 
 MOZ_PKG_MANIFEST_P = $(srcdir)/package-manifest.in
 
 MOZ_NONLOCALIZED_PKG_LIST = \
 	xpcom \
 	browser \
-	mobile \
+	b2g \
 	$(NULL)
 
-MOZ_LOCALIZED_PKG_LIST = $(AB_CD) multilocale
+MOZ_LOCALIZED_PKG_LIST = $(AB_CD)
 
 DEFINES += \
 	-DAB_CD=$(AB_CD) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DPREF_DIR=$(PREF_DIR) \
 	$(NULL)
 
 ifeq ($(MOZ_CHROME_FILE_FORMAT),jar)
@@ -93,24 +87,16 @@ else
 # Every other platform just winds up in dist/bin
 BINPATH = bin
 endif
 DEFINES += -DBINPATH=$(BINPATH)
 
 ifdef MOZ_PKG_MANIFEST_P
 $(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) FORCE
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $< > $@
-ifdef MOZ_CHROME_MULTILOCALE
-	printf "\n[multilocale]\n" >> $@
-	for LOCALE in en-US $(MOZ_CHROME_MULTILOCALE) ;\
-	do \
-	  printf "$(BINPATH)/chrome/$$LOCALE$(JAREXT)\n" >> $@; \
-	  printf "$(BINPATH)/chrome/$$LOCALE.manifest\n" >> $@; \
-	done
-endif
 
 GARBAGE += $(MOZ_PKG_MANIFEST)
 endif
 
 ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
 PACKAGE_XULRUNNER =
 UNPACKAGE =
 else
@@ -124,134 +110,17 @@ else
 MOZ_GRE_PKG_DIR=$(MOZ_PKG_DIR)
 endif
 
 package-xulrunner:
 ifdef LIBXUL_SDK
 ifndef SYSTEM_LIBXUL
 	@echo "Packaging xulrunner..."
 	@rm -rf $(LIBXUL_DIST)/xulrunner*
-	@$(MAKE) -C $(LIBXUL_DIST)/.. package || echo "Perhaps you're trying to package a prebuilt SDK. See 'https://wiki.mozilla.org/Mobile/Build/Fennec#Build' for more information."
+	@$(MAKE) -C $(LIBXUL_DIST)/.. package || echo "Perhaps you're trying to package a prebuilt SDK. See 'https://wiki.mozilla.org/B2G' for more information."
 	@cd $(DIST)/$(MOZ_PKG_DIR); $(UNMAKE_PACKAGE)
 	@echo "Removing unpackaged files... (the ones xulrunner/installer keeps)"
 	@cd $(DIST)/$(MOZ_PKG_DIR)/xulrunner; rm -rf $(NO_PKG_FILES)
 else
 	@echo "Using system xulrunner..."
 endif
 endif
 
-ifeq ($(OS_TARGET),Linux)
-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)
-ABS_OBJDIR=`cd $(DEPTH); pwd`
-ABS_TOPSRCDIR=$(shell cd $(topsrcdir); pwd)
-BASE64_ICON = dist/branding/fennec_maemo_icon26.txt
-MOZ_DEB_TIMESTAMP = "$(shell date  +"%a, %d  %b %Y %T %z" )"
-
-DEB_PKG_VERSION = $(shell echo $(MOZ_APP_VERSION) | $(PERL) -pe 's/pre/~$(GRE_BUILDID)/; s/^([0-9.]+)([a-z][0-9]+)/$$1~$$2/')
-
-DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
-# package name should match mobile/installer/debian/changelog.in
-DEB_PKG_NAME = $(MOZ_PKG_APPNAME)_$(DEB_PKG_VERSION)_$(DEB_BUILD_ARCH).deb
-
-DEFINES += \
-	-DGRE_MILESTONE=$(GRE_MILESTONE) \
-	-DGRE_BUILDID=$(GRE_BUILDID) \
-	-Dinstalldir=$(installdir) \
-	-DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \
-	-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
-	-DABS_OBJDIR=$(ABS_OBJDIR) \
-	-DBASE64_ICON=$(BASE64_ICON) \
-	-DMOZ_DEB_TIMESTAMP=$(MOZ_DEB_TIMESTAMP) \
-	-DDEB_PKG_VERSION=$(DEB_PKG_VERSION) \
-	$(NULL)
-
-DEBDESTDIR=debian/$(MOZ_APP_NAME)
-
-PP_DEB_FILES =	debian/control \
-		debian/changelog \
-		debian/$(MOZ_APP_NAME).desktop \
-		debian/$(MOZ_APP_NAME).links \
-		debian/$(MOZ_APP_NAME).service \
-		debian/compat \
-		debian/files \
-		debian/menu \
-		debian/fennec.preinst \
-		debian/fennec.prerm \
-		debian/fennec.postinst \
-		$(NULL)
-
-ifeq ($(MOZ_PLATFORM_MAEMO),6)
-PP_DEB_FILES += debian/fennec.aegis \
-		debian/backup \
-		debian/restore \
-		debian/fennec.conf \
-		debian/fennec-cud.sh \
-		debian/fennec-rfs.sh \
-		 debian/fennec.policy \
-                $(NULL)
-endif
-
-$(PP_DEB_FILES):
-	@$(EXIT_ON_ERROR) \
-	for f in $(PP_DEB_FILES); do \
-           src=$(srcdir)/debian/`basename $$f`.in; \
-	   echo $$src ">" $$f ;\
-           $(RM) -f $$f; \
-           mkdir -p debian;  \
-           $(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-             $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $$src > $$f; \
-         done
-
-deb: $(PP_DEB_FILES) $(DIST)/branding/$(MOZ_APP_NAME)_scalable.png \
-	$(DIST)/branding/$(MOZ_APP_NAME)_26x26.png \
-	$(DIST)/branding/$(MOZ_APP_NAME)_40x40.png
-	rm -rf $(DEBDESTDIR)/$(installdir)/*
-	$(NSINSTALL) -D $(DEBDESTDIR)/$(installdir)
-	cp -pRL $(DIST)/$(MOZ_APP_NAME)/* $(DEBDESTDIR)/$(installdir)
-ifeq ($(MOZ_PLATFORM_MAEMO),6)
-	$(NSINSTALL)  debian/$(MOZ_APP_NAME).desktop $(DEBDESTDIR)/usr/share/applications/
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/dbus-1/services/
-	cp debian/$(MOZ_APP_NAME).service $(DEBDESTDIR)/usr/share/dbus-1/services/org.mozilla.$(MOZ_APP_NAME).service
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/themes/blanco/meegotouch/icons/
-	cp $(DIST)/branding/$(MOZ_APP_NAME)_scalable.png $(DEBDESTDIR)/usr/share/themes/blanco/meegotouch/icons/$(MOZ_APP_NAME).png
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/backup-framework/applications
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/$(MOZ_APP_NAME)
-	$(NSINSTALL) -D $(DEBDESTDIR)/etc/osso-cud-scripts
-	$(NSINSTALL) -D $(DEBDESTDIR)/etc/osso-rfs-scripts
-	$(NSINSTALL) -m 755 debian/backup  $(DEBDESTDIR)/usr/share/$(MOZ_APP_NAME)/
-	$(NSINSTALL) -m 755 debian/restore $(DEBDESTDIR)/usr/share/$(MOZ_APP_NAME)/
-	cp debian/$(MOZ_APP_NAME).conf $(DEBDESTDIR)/usr/share/backup-framework/applications/$(MOZ_APP_NAME).conf
-	cp debian/$(MOZ_APP_NAME)-cud.sh $(DEBDESTDIR)/etc/osso-cud-scripts/$(MOZ_APP_NAME)-cud.sh
-	cp debian/$(MOZ_APP_NAME)-rfs.sh $(DEBDESTDIR)/etc/osso-rfs-scripts/$(MOZ_APP_NAME)-rfs.sh
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/policy/etc/syspart.conf.d
-	cp debian/$(MOZ_APP_NAME).policy $(DEBDESTDIR)/usr/share/policy/etc/syspart.conf.d/$(MOZ_APP_NAME)
-else
-	$(NSINSTALL)  debian/$(MOZ_APP_NAME).desktop $(DEBDESTDIR)/usr/share/applications/hildon/
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/dbus-1/services/
-	cp debian/$(MOZ_APP_NAME).service $(DEBDESTDIR)/usr/share/dbus-1/services/org.mozilla.$(MOZ_APP_NAME).service
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/icons/hicolor/scalable/hildon/
-	cp $(DIST)/branding/$(MOZ_APP_NAME)_scalable.png $(DEBDESTDIR)/usr/share/icons/hicolor/scalable/hildon/$(MOZ_APP_NAME).png
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/icons/hicolor/26x26/hildon/
-	cp $(DIST)/branding/$(MOZ_APP_NAME)_26x26.png $(DEBDESTDIR)/usr/share/icons/hicolor/26x26/hildon/$(MOZ_APP_NAME).png
-	$(NSINSTALL) -D $(DEBDESTDIR)/usr/share/icons/hicolor/40x40/hildon/
-	cp $(DIST)/branding/$(MOZ_APP_NAME)_40x40.png $(DEBDESTDIR)/usr/share/icons/hicolor/40x40/hildon/$(MOZ_APP_NAME).png
-endif
-	fakeroot dh_link; fakeroot dh_fixperms; fakeroot dh_installdeb; fakeroot dh_shlibdeps; fakeroot dh_gencontrol; fakeroot dh_md5sums; fakeroot dh_builddeb;
-
-# a defined CONTENTMANAGER implicitly means MOZ_PLATFORM_MAEMO is equals 6
-# in case you use CONTENTMANGER you need to sign your package to gain tracker access.
-ifeq ($(MOZ_PLATFORM_MAEMO),6)
-	if test -e "/usr/bin/aegis-deb-add"; then \
-	   fakeroot aegis-deb-add -control $(DEBDESTDIR)/DEBIAN/control .. debian/fennec.aegis=_aegis; \
-	else \
-	   echo aegis-builder not found, security signing failed!; \
-	fi
-endif
-
-	echo $(DEB_PKG_NAME) > $(DIST)/deb_name.txt
-
-installer: deb
-	@echo Installer DEB created!
-
-# relative to $(DIST)
-UPLOAD_EXTRA_FILES += ../mobile/$(DEB_PKG_NAME) deb_name.txt
-endif
copy from mobile/xul/installer/package-manifest.in
copy to b2g/installer/package-manifest.in
--- a/mobile/xul/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -1,9 +1,9 @@
-; Package file for the Fennec build. 
+; Package file for the B2G build. 
 ;
 ; File format:
 ;
 ; [] designates a toplevel component. Example: [xpcom]
 ; - in front of a file specifies it to be removed from the destination
 ; * wildcard support to recursively copy the entire directory
 ; ; file comment
 ;
@@ -16,17 +16,17 @@
 @APPNAME@/Contents/PkgInfo
 @APPNAME@/Contents/Plug-Ins/
 @APPNAME@/Contents/Resources/
 #endif
 
 [@AB_CD@]
 @BINPATH@/chrome/@AB_CD@@JAREXT@
 @BINPATH@/chrome/@AB_CD@.manifest
-@BINPATH@/@PREF_DIR@/mobile-l10n.js
+@BINPATH@/@PREF_DIR@/b2g-l10n.js
 @BINPATH@/searchplugins/*
 @BINPATH@/defaults/profile/bookmarks.html
 @BINPATH@/defaults/profile/localstore.rdf
 @BINPATH@/defaults/profile/mimeTypes.rdf
 @BINPATH@/defaults/profile/chrome/*
 #ifdef MOZ_UPDATER
 @BINPATH@/update.locale
 @BINPATH@/updater.ini
@@ -42,62 +42,57 @@
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
-@BINPATH@/@DLL_PREFIX@mozutils@DLL_SUFFIX@
 #ifdef XP_MACOSX
 @BINPATH@/XUL
 #else
 @BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
 #endif
 #ifdef XP_MACOSX
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
 #ifdef XP_WIN32
+#ifndef MOZ_MEMORY
 #if _MSC_VER == 1400
 @BINPATH@/Microsoft.VC80.CRT.manifest
 @BINPATH@/msvcm80.dll
 @BINPATH@/msvcp80.dll
 @BINPATH@/msvcr80.dll
 #elif _MSC_VER == 1500
 @BINPATH@/Microsoft.VC90.CRT.manifest
 @BINPATH@/msvcm90.dll
 @BINPATH@/msvcp90.dll
 @BINPATH@/msvcr90.dll
 #elif _MSC_VER == 1600
 @BINPATH@/msvcp100.dll
 @BINPATH@/msvcr100.dll
-#elif _MSC_VER == 1700
-@BINPATH@/msvcp110.dll
-@BINPATH@/msvcr110.dll
 #endif
-
+#else
+@BINPATH@/mozcrt19.dll
+@BINPATH@/mozcpp19.dll
 #endif
-
+#endif
 #ifdef ANDROID
 @BINPATH@/AndroidManifest.xml
 @BINPATH@/resources.arsc
 @BINPATH@/classes.dex
 @BINPATH@/@DLL_PREFIX@mozutils@DLL_SUFFIX@
 @BINPATH@/res/drawable
 @BINPATH@/res/drawable-hdpi
 @BINPATH@/res/layout
 #endif
 
-#ifdef MOZ_PLATFORM_MAEMO
-@BINPATH@/res/drawable
-#endif
-
 [browser]
 ; [Base Browser Files]
 #ifndef XP_UNIX
 @BINPATH@/@MOZ_APP_NAME@.exe
 #else
 @BINPATH@/@MOZ_APP_NAME@-bin
 @BINPATH@/@MOZ_APP_NAME@
 #endif
@@ -147,33 +142,32 @@
 @BINPATH@/components/content_xtf.xpt
 @BINPATH@/components/cookie.xpt
 @BINPATH@/components/directory.xpt
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_base.xpt
 #ifdef MOZ_B2G_RIL
 @BINPATH@/components/dom_telephony.xpt
-@BINPATH@/components/dom_telephony_worker.xpt
+@BINPATH@/components/dom_system_b2g.xpt
 #endif
 @BINPATH@/components/dom_battery.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_core.xpt
 @BINPATH@/components/dom_css.xpt
 @BINPATH@/components/dom_events.xpt
 @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_storage.xpt
-@BINPATH@/components/dom_sms.xpt
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_threads.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_views.xpt
 @BINPATH@/components/dom_xbl.xpt
 @BINPATH@/components/dom_xpath.xpt
 @BINPATH@/components/dom_xul.xpt
 @BINPATH@/components/dom_loadsave.xpt
@@ -247,45 +241,52 @@
 @BINPATH@/components/storage.xpt
 @BINPATH@/components/telemetry.xpt
 @BINPATH@/components/toolkitprofile.xpt
 #ifdef MOZ_ENABLE_XREMOTE
 @BINPATH@/components/toolkitremote.xpt
 #endif
 @BINPATH@/components/txtsvc.xpt
 @BINPATH@/components/txmgr.xpt
+#ifdef MOZ_USE_NATIVE_UCONV
+@BINPATH@/components/ucnative.xpt
+#endif
 @BINPATH@/components/uconv.xpt
 @BINPATH@/components/unicharutil.xpt
 #ifdef MOZ_UPDATER
 @BINPATH@/components/update.xpt
 #endif
 @BINPATH@/components/uriloader.xpt
 @BINPATH@/components/urlformatter.xpt
 @BINPATH@/components/webBrowser_core.xpt
 @BINPATH@/components/webbrowserpersist.xpt
 @BINPATH@/components/webshell_idls.xpt
 @BINPATH@/components/widget.xpt
 #ifdef XP_MACOSX
 @BINPATH@/components/widget_cocoa.xpt
 #endif
+#ifdef ANDROID
+@BINPATH@/components/widget_android.xpt
+#endif
 @BINPATH@/components/windowds.xpt
 @BINPATH@/components/windowwatcher.xpt
 @BINPATH@/components/xpcom_base.xpt
 @BINPATH@/components/xpcom_system.xpt
 @BINPATH@/components/xpcom_components.xpt
 @BINPATH@/components/xpcom_ds.xpt
 @BINPATH@/components/xpcom_io.xpt
 @BINPATH@/components/xpcom_threads.xpt
 @BINPATH@/components/xpcom_xpti.xpt
 @BINPATH@/components/xpconnect.xpt
 @BINPATH@/components/xulapp.xpt
 @BINPATH@/components/xul.xpt
 @BINPATH@/components/xuldoc.xpt
 @BINPATH@/components/xultmpl.xpt
 @BINPATH@/components/zipwriter.xpt
+@BINPATH@/components/webapps.xpt
 
 ; JavaScript components
 @BINPATH@/components/ConsoleAPI.manifest
 @BINPATH@/components/ConsoleAPI.js
 @BINPATH@/components/FeedProcessor.manifest
 @BINPATH@/components/FeedProcessor.js
 @BINPATH@/components/BrowserFeeds.manifest
 @BINPATH@/components/FeedConverter.js
@@ -299,16 +300,18 @@
 @BINPATH@/components/nsSetDefaultBrowser.manifest
 @BINPATH@/components/nsSetDefaultBrowser.js
 @BINPATH@/components/BrowserPlaces.manifest
 @BINPATH@/components/nsPrivateBrowsingService.manifest
 @BINPATH@/components/nsPrivateBrowsingService.js
 @BINPATH@/components/toolkitsearch.manifest
 @BINPATH@/components/nsSearchService.js
 @BINPATH@/components/nsSearchSuggestions.js
+@BINPATH@/components/nsTryToClose.manifest
+@BINPATH@/components/nsTryToClose.js
 @BINPATH@/components/passwordmgr.manifest
 @BINPATH@/components/nsLoginInfo.js
 @BINPATH@/components/nsLoginManager.js
 @BINPATH@/components/nsLoginManagerPrompter.js
 @BINPATH@/components/storage-Legacy.js
 @BINPATH@/components/storage-mozStorage.js
 @BINPATH@/components/crypto-SDR.js
 @BINPATH@/components/jsconsole-clhandler.manifest
@@ -383,22 +386,16 @@
 @BINPATH@/components/contentSecurityPolicy.manifest
 @BINPATH@/components/contentSecurityPolicy.js
 @BINPATH@/components/contentAreaDropListener.manifest
 @BINPATH@/components/contentAreaDropListener.js
 @BINPATH@/components/messageWakeupService.js
 @BINPATH@/components/messageWakeupService.manifest
 @BINPATH@/components/nsFilePicker.js
 @BINPATH@/components/nsFilePicker.manifest
-#ifdef MOZ_B2G_RIL
-@BINPATH@/components/nsTelephonyWorker.manifest
-@BINPATH@/components/nsTelephonyWorker.js
-@BINPATH@/components/Telephony.manifest
-@BINPATH@/components/Telephony.js
-#endif
 #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
@@ -461,18 +458,17 @@
 #ifndef XP_MACOSX
 @BINPATH@/icons/*.xpm
 @BINPATH@/icons/*.png
 #endif
 #endif
 
 ; [Default Preferences]
 ; All the pref files must be part of base to prevent migration bugs
-@BINPATH@/@PREF_DIR@/mobile.js
-@BINPATH@/@PREF_DIR@/mobile-branding.js
+@BINPATH@/@PREF_DIR@/b2g.js
 @BINPATH@/@PREF_DIR@/channel-prefs.js
 #ifdef MOZ_SERVICES_SYNC
 @BINPATH@/@PREF_DIR@/services-sync.js
 #endif
 @BINPATH@/greprefs.js
 @BINPATH@/defaults/autoconfig/platform.js
 @BINPATH@/defaults/autoconfig/prefcalls.js
 @BINPATH@/defaults/profile/prefs.js
@@ -512,17 +508,19 @@
 @BINPATH@/res/entityTables/*
 #ifdef XP_MACOSX
 @BINPATH@/res/MainMenu.nib/
 #endif
 
 ; svg
 @BINPATH@/res/svg.css
 @BINPATH@/components/dom_svg.xpt
+#ifdef MOZ_SMIL
 @BINPATH@/components/dom_smil.xpt
+#endif
 
 ; [Personal Security Manager]
 ;
 @BINPATH@/@DLL_PREFIX@nssckbi@DLL_SUFFIX@
 @BINPATH@/components/pipboot.xpt
 @BINPATH@/components/pipnss.xpt
 @BINPATH@/components/pippki.xpt
 @BINPATH@/@DLL_PREFIX@nss3@DLL_SUFFIX@
@@ -586,42 +584,12 @@ bin/libfreebl_32int64_3.so
 bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
 #endif
 
 ; [OS/2]
 #ifdef XP_OS2
 @BINPATH@/MozSounds.cmd
 #endif
 
-[mobile]
+[b2g]
 @BINPATH@/chrome/icons/
 @BINPATH@/chrome/chrome@JAREXT@
 @BINPATH@/chrome/chrome.manifest
-@BINPATH@/components/AboutRedirector.js
-@BINPATH@/components/AddonUpdateService.js
-@BINPATH@/components/AlertsService.js
-@BINPATH@/components/AutoCompleteCache.js
-@BINPATH@/components/BlocklistPrompt.js
-@BINPATH@/components/BrowserCLH.js
-@BINPATH@/components/BrowserStartup.js
-@BINPATH@/components/ContentDispatchChooser.js
-@BINPATH@/components/ContentPermissionPrompt.js
-@BINPATH@/components/DirectoryProvider.js
-@BINPATH@/components/DownloadManagerUI.js
-@BINPATH@/components/FormAutoComplete.js
-@BINPATH@/components/HelperAppDialog.js
-@BINPATH@/components/LoginManager.js
-@BINPATH@/components/LoginManagerPrompter.js
-@BINPATH@/components/MobileComponents.manifest
-@BINPATH@/components/MobileComponents.xpt
-@BINPATH@/components/PromptService.js
-@BINPATH@/components/SessionStore.js
-@BINPATH@/components/Sidebar.js
-#ifdef MOZ_SAFE_BROWSING
-@BINPATH@/components/SafeBrowsing.js
-#endif
-#ifdef MOZ_UPDATER
-@BINPATH@/components/UpdatePrompt.js
-#endif
-@BINPATH@/components/XPIDialogService.js
-@BINPATH@/components/CapturePicker.js
-@BINPATH@/components/browsercomps.xpt
-@BINPATH@/extensions/feedback@mobile.mozilla.org.xpi
copy from mobile/xul/installer/removed-files.in
copy to b2g/installer/removed-files.in
--- a/mobile/xul/installer/removed-files.in
+++ b/b2g/installer/removed-files.in
@@ -1,30 +1,1 @@
-update.locale
 README.txt
-components/nsTryToClose.js
-#if MOZ_UPDATE_CHANNEL != beta
-extensions/feedback@mobile.mozilla.org.xpi
-#endif
-#ifdef XP_WIN
-  #if _MSC_VER != 1400
-    @BINPATH@/Microsoft.VC80.CRT.manifest
-    @BINPATH@/msvcm80.dll
-    @BINPATH@/msvcp80.dll
-    @BINPATH@/msvcr80.dll
-  #endif
-  #if _MSC_VER != 1500
-    @BINPATH@/Microsoft.VC90.CRT.manifest
-    @BINPATH@/msvcm90.dll
-    @BINPATH@/msvcp90.dll
-    @BINPATH@/msvcr90.dll
-  #endif
-  #if _MSC_VER != 1600
-    @BINPATH@/msvcp100.dll
-    @BINPATH@/msvcr100.dll
-  #endif
-  #if _MSC_VER != 1700
-    @BINPATH@/msvcp110.dll
-    @BINPATH@/msvcr110.dll
-  #endif
-  mozcrt19.dll
-  mozcpp19.dll
-#endif
copy from mobile/xul/locales/Makefile.in
copy to b2g/locales/Makefile.in
--- a/mobile/xul/locales/Makefile.in
+++ b/b2g/locales/Makefile.in
@@ -1,249 +1,227 @@
+# vim:set ts=8 sw=8 sts=8 noet:
 # ***** 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.
+# The Original Code is the Mozilla Browser code.
 #
 # The Initial Developer of the Original Code is
-# the Mozilla Foundation <http://www.mozilla.org/>.
-# Portions created by the Initial Developer are Copyright (C) 2007
+# Benjamin Smedberg <bsmedberg@covad.net>
+# Portions created by the Initial Developer are Copyright (C) 2004
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
-#   Mark Finkle <mfinkle@mozilla.com>
-#   Axel Hecht <l10n@mozilla.com>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either the GNU General Public License Version 2 or later (the "GPL"), or
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
-DEPTH     = ../../..
-topsrcdir = @top_srcdir@
-srcdir    = @srcdir@
-VPATH     = @srcdir@
-relativesrcdir = mobile/xul/locales
+DEPTH		= ../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir = b2g/locales
 
 include $(DEPTH)/config/autoconf.mk
+
 include $(topsrcdir)/config/config.mk
 
 ifdef LOCALE_MERGEDIR
-vpath book%.inc $(LOCALE_MERGEDIR)/mobile/profile
-endif
-vpath book%.inc $(LOCALE_SRCDIR)/profile
-ifdef LOCALE_MERGEDIR
-vpath book%.inc @srcdir@/en-US/profile
-endif
-
-ifdef LOCALE_MERGEDIR
-vpath crashreporter%.ini $(LOCALE_MERGEDIR)/mobile/crashreporter
+vpath crashreporter%.ini $(LOCALE_MERGEDIR)/b2g/crashreporter
 endif
 vpath crashreporter%.ini $(LOCALE_SRCDIR)/crashreporter
 ifdef LOCALE_MERGEDIR
 vpath crashreporter%.ini @srcdir@/en-US/crashreporter
 endif
 
+
 SUBMAKEFILES += \
-        $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \
-        $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/Makefile \
-        $(NULL)
+	$(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/Makefile \
+	$(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/Makefile \
+	$(NULL)
+
+# This makefile uses variable overrides from the libs-% target to
+# build non-default locales to non-default dist/ locations. Be aware!
 
-MOZ_LANGPACK_EID=langpack-$(AB_CD)@firefox-mobile.mozilla.org
-PREF_JS_EXPORTS = $(firstword $(wildcard $(LOCALE_SRCDIR)/mobile-l10n.js) \
-                       @srcdir@/en-US/mobile-l10n.js )
+PWD := $(CURDIR)
 
-# Shouldn't := DEB_BUILD_ARCH despite the $(shell ) as deb isn't everywhere
-DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
-DATASTAGE = $(CURDIR)/data-stage
+# These are defaulted to be compatible with the files the wget-en-US target
+# pulls. You may override them if you provide your own files. You _must_
+# override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not
+# work in that case.
+ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE)
+WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
+RETRIEVE_WINDOWS_INSTALLER = 1
 
-SEARCH_PLUGINS = $(shell cat \
-  $(firstword $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \
-       @srcdir@/en-US/searchplugins/list.txt ) )
+MOZ_LANGPACK_EID=langpack-$(AB_CD)@b2g.mozilla.org
 
-tmp-search.jar.mn::
-	printf "$(AB_CD).jar:" > $@
-	printf "$(foreach plugin,$(SEARCH_PLUGINS),$(subst __PLUGIN_SUBST__,$(plugin), \n locale/$(AB_CD)/browser/searchplugins/__PLUGIN_SUBST__.xml (__PLUGIN_SUBST__.xml)))" >>  $@
-	@echo   >> $@
+PREF_JS_EXPORTS = $(call MERGE_FILE,b2g-l10n.js)
 
-searchplugins: tmp-search.jar.mn
-	$(PYTHON) $(MOZILLA_DIR)/config/JarMaker.py \
-          $(QUIET) -j $(FINAL_TARGET)/chrome \
-          -s $(topsrcdir)/$(relativesrcdir)/en-US/searchplugins \
-          -s $(LOCALE_SRCDIR)/searchplugins \
-          $(MAKE_JARS_FLAGS) tmp-search.jar.mn
+ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
+MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
+MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
+MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
+MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
+endif
 
-export:: searchplugins
-
-GARBAGE += tmp-search.jar.mn
+ifeq (WINNT,$(OS_ARCH))
+UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(STAGEDIST)/uninstall; \
+    $(NSINSTALL) -D $(STAGEDIST)/uninstall; \
+    cp ../installer/windows/l10ngen/helper.exe $(STAGEDIST)/uninstall; \
+    $(RM) $(_ABS_DIST)/l10n-stage/setup.exe; \
+    cp ../installer/windows/l10ngen/setup.exe $(_ABS_DIST)/l10n-stage; \
+    $(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 include $(topsrcdir)/toolkit/locales/l10n.mk
 
-clobber-zip:
-	$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
-	  $(STAGEDIST)/chrome/$(AB_CD).manifest \
-	  $(STAGEDIST)/defaults/preferences/mobile-l10n.js
-	$(RM) -r $(STAGEDIST)/dictionaries \
-	  $(STAGEDIST)/hyphenation \
-	  $(STAGEDIST)/defaults/profile \
-	  $(STAGEDIST)/chrome/$(AB_CD)
+$(STAGEDIST): $(DIST)/branding
+
+$(DIST)/branding:
+	$(NSINSTALL) -D $@
+
+libs::
+	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
+	fi
+install::
+	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
+	  $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
+	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(DESTDIR)$(mozappdir)/defaults/existing-profile-defaults.js; \
+	fi
+
+NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
 
 libs-%:
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
+	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
-	@$(MAKE) -B bookmarks.json AB_CD=$*
-	@$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
-	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/preferences BOTH_MANIFESTS=1
+	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) BOTH_MANIFESTS=1
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 
-# Tailored target to just add the chrome processing for multi-locale builds
-chrome-%:
-	@$(MAKE) -C $(DEPTH)/toolkit/locales chrome-$*
-	@$(MAKE) -C $(DEPTH)/services/sync/locales chrome AB_CD=$*
-	@$(MAKE) -B bookmarks.json AB_CD=$*
-	@$(MAKE) -B searchplugins AB_CD=$*
-	@$(MAKE) chrome AB_CD=$*
-	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales chrome AB_CD=$*
-ifeq ($(OS_TARGET),Android)
-	@$(MAKE) -C $(DEPTH)/embedding/android chrome AB_CD=$*
+
+repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
+repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
+	@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
+	$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
+	$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
+	$(MAKE) repackage-zip \
+	  AB_CD=$(AB_CD) \
+	  MOZ_PKG_FORMAT=SFX7Z \
+	  ZIP_IN="$(WIN32_INSTALLER_IN)" \
+	  ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
+	  SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
+	              $(topsrcdir)/b2g/installer/windows/app.tag"
+
+ifeq (WINNT,$(OS_ARCH))
+repackage-win32-installer-%:
+	@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
+else
+repackage-win32-installer-%: ;
 endif
 
-# This is a generic target that will make a langpack and repack tarball
-# builds. It is called from the tinderbox scripts. Alter it with caution.
 
-installers-%: clobber-% langpack-% repackage-zip-%
+clobber-zip:
+	$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
+	  $(STAGEDIST)/chrome/$(AB_CD).manifest \
+	  $(STAGEDIST)/defaults/pref/b2g-l10n.js
+	  $(STAGEDIST)/dictionaries \
+	  $(STAGEDIST)/hyphenation \
+	  $(STAGEDIST)/defaults/profile \
+	  $(STAGEDIST)/chrome/$(AB_CD)
+
+
+langpack: langpack-$(AB_CD)
+
+# This is a generic target that will make a langpack, repack ZIP (+tarball)
+# builds, and repack an installer if applicable. It is called from the
+# tinderbox scripts. Alter it with caution.
+
+installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
 	@echo "repackaging done"
 
-NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
-
-bookmarks.json: bookmarks.inc generic/profile/bookmarks.json.in
-	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
-	  -I $< \
-	  -DAB_CD=$(NO_JA_JP_MAC_AB_CD) \
-	  $(srcdir)/generic/profile/bookmarks.json.in \
-	  > $@
-
-export:: bookmarks.json
-
 ifdef MOZ_UPDATER
-ifdef LOCALE_MERGEDIR
-UPDATER_INI := $(firstword $(wildcard $(LOCALE_MERGEDIR)/updater/updater.ini) \
-       $(wildcard $(LOCALE_SRCDIR)/updater/updater.ini) \
-       $(srcdir)/en-US/updater/updater.ini )
+libs:: $(call MERGE_FILE,updater/updater.ini)
+ifeq ($(OS_ARCH),WINNT)
+	cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
+	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
+	  sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
+	  $(FINAL_TARGET)/updater.ini
 else
-UPDATER_INI := $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
-endif
-libs:: $(UPDATER_INI)
 	cat $< | \
 	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
 	  sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
 	  $(FINAL_TARGET)/updater.ini
 endif
+endif
 
 ifdef MOZ_CRASHREPORTER
 libs:: crashreporter-override.ini
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
 endif
 
-# When we unpack fennec on MacOS X the platform.ini and application.ini are in slightly
+# When we unpack b2g on MacOS X the platform.ini and application.ini are in slightly
 # different locations that on all other platforms
 ifeq (Darwin, $(OS_ARCH))
 ifdef LIBXUL_SDK
 GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/../Frameworks/XUL.framework/Versions/$(MOZILLA_VERSION)/platform.ini"
 else
 GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/platform.ini"
 endif
-FENNEC_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
+B2G_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
 else
 ifdef LIBXUL_SDK
 GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/xulrunner/platform.ini"
 else
 GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/platform.ini"
 endif
-FENNEC_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
+B2G_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
 endif
 
+
 ident:
 	@printf "gecko_revision "
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(GECKO_PLATFORM_INI_PATH) Build SourceStamp
-	@printf "fennec_revision "
-	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App SourceStamp
+	@printf "b2g_revision "
+	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(B2G_APPLICATION_INI_PATH) App SourceStamp
 	@printf "buildid "
-	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App BuildID
-
-# special targets just to do the debian single locale packages
-wget-DEB_PKG_NAME:
-ifndef WGET
-	$(error Wget not installed)
-endif
-ifndef EN_US_BINARY_URL
-	$(error EN_US_BINARY_URL not defined)
-endif
-	@$(WGET) -q -O - $(EN_US_BINARY_URL)/deb_name.txt
-
-wget-deb:
-ifndef WGET
-	$(error Wget not installed)
-endif
-ifndef EN_US_BINARY_URL
-	$(error EN_US_BINARY_URL not defined)
-endif
-ifndef DEB_PKG_NAME
-	$(error DEB_PKG_NAME not defined)
-endif
-	$(WGET) -nv -N  $(EN_US_BINARY_URL)/$(DEB_PKG_NAME)
-
-$(DATASTAGE): $(DEB_PKG_NAME)
-	$(RM) -rf $(DATASTAGE)
-	$(NSINSTALL) -D $(DATASTAGE)/DEBIAN
-	ar -p $(DEB_PKG_NAME) data.tar.gz | $(TAR) -zx -C $(DATASTAGE)
-	$(MAKE) clobber-zip AB_CD=en-US STAGEDIST=$(DATASTAGE)/$(installdir)
-	ar -p $(DEB_PKG_NAME) control.tar.gz | $(TAR) -zx -C $(DATASTAGE)/DEBIAN
-# XXX hack around multi-locale deb right now
-	$(RM) $(DATASTAGE)/$(installdir)/chrome/??.*
-	$(RM) $(DATASTAGE)/$(installdir)/chrome/??-??.*
-
-repackage-deb: $(DATASTAGE)
-	$(RM) -rf $(AB_CD)
-	$(NSINSTALL) -D $(AB_CD)/tmp
-	cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
-	  $(TAR) --exclude=install.rdf --exclude=chrome.manifest --exclude=crashreporter.app $(TAR_CREATE_FLAGS) - * | ( cd $(DATASTAGE)/$(installdir) && $(TAR) -xf - )
-	cd $(DATASTAGE) && $(TAR) $(TAR_CREATE_FLAGS) - * | (cd $(CURDIR)/$(AB_CD)/tmp && $(TAR) -xf - )
-	$(MAKE) clobber-zip STAGEDIST=$(DATASTAGE)/$(installdir)
-	cd $(AB_CD) && dpkg-deb -b tmp $(DEB_PKG_NAME)
-	$(RM) -rf $(AB_CD)/tmp
-
-deb-%: AB_CD=$*
-deb-%: clobber-% langpack-%
-ifndef DEB_PKG_NAME
-	$(error DEB_PKG_NAME not defined)
-endif
-	@$(MAKE) repackage-deb AB_CD=$(AB_CD) DEB_PKG_NAME=$(DEB_PKG_NAME)
+	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(B2G_APPLICATION_INI_PATH) App BuildID
 
 merge-%:
 ifdef LOCALE_MERGEDIR
 	$(RM) -rf $(LOCALE_MERGEDIR)
 	MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
 endif
 	@echo
+
+# test target, depends on make package
+# try to repack x-test, with just toolkit/defines.inc being there
+l10n-check::
+	$(RM) -rf x-test
+	$(NSINSTALL) -D x-test/toolkit
+	echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
+	$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
copy from mobile/xul/locales/all-locales
copy to b2g/locales/all-locales
new file mode 100644
--- /dev/null
+++ b/b2g/locales/en-US/b2g-l10n.js
@@ -0,0 +1,39 @@
+# ***** 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 Firefox browser.
+#
+# The Initial Developer of the Original Code is
+# Benjamin Smedberg <bsmedberg@covad.net>
+# Portions created by the Initial Developer are Copyright (C) 2004
+# 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 *****
+
+#filter substitution
+
+pref("general.useragent.locale", "@AB_CD@");
copy from mobile/xul/locales/en-US/chrome/about.dtd
copy to b2g/locales/en-US/chrome/about.dtd
copy from mobile/xul/locales/en-US/chrome/aboutCertError.dtd
copy to b2g/locales/en-US/chrome/aboutCertError.dtd
copy from mobile/xul/locales/en-US/chrome/notification.dtd
copy to b2g/locales/en-US/chrome/notification.dtd
copy from mobile/xul/locales/en-US/chrome/overrides/appstrings.properties
copy to b2g/locales/en-US/chrome/overrides/appstrings.properties
copy from mobile/xul/locales/en-US/chrome/overrides/netError.dtd
copy to b2g/locales/en-US/chrome/overrides/netError.dtd
copy from mobile/xul/locales/en-US/chrome/overrides/passwordmgr.properties
copy to b2g/locales/en-US/chrome/overrides/passwordmgr.properties
copy from mobile/xul/locales/en-US/chrome/phishing.dtd
copy to b2g/locales/en-US/chrome/phishing.dtd
copy from mobile/xul/locales/en-US/chrome/webapps.dtd
copy to b2g/locales/en-US/chrome/webapps.dtd
copy from mobile/xul/locales/en-US/crashreporter/crashreporter-override.ini
copy to b2g/locales/en-US/crashreporter/crashreporter-override.ini
--- a/mobile/xul/locales/en-US/crashreporter/crashreporter-override.ini
+++ b/b2g/locales/en-US/crashreporter/crashreporter-override.ini
@@ -1,10 +1,10 @@
 # This file is in the UTF-8 encoding
 [Strings]
 # LOCALIZATION NOTE (CrashReporterProductErrorText2): %s is replaced with another string containing detailed information.
-CrashReporterProductErrorText2=Firefox has crashed. Unfortunately the crash reporter is unable to submit a crash report.\n\nDetails: %s
-CrashReporterDescriptionText2=Firefox has crashed. Your tabs will be listed on the Firefox Start page when you restart.\n\nPlease help us fix the problem!
+CrashReporterProductErrorText2=B2G has crashed. Unfortunately the crash reporter is unable to submit a crash report.\n\nDetails: %s
+CrashReporterDescriptionText2=B2G has crashed. Your tabs will be listed on the B2G Start page when you restart.\n\nPlease help us fix the problem!
 # LOCALIZATION NOTE (CheckSendReport): The %s is replaced with the vendor name.
 CheckSendReport=Send %s a crash report
 CheckIncludeURL=Include the page address
-Quit2=Quit Firefox
-Restart=Restart Firefox
+Quit2=Quit B2G
+Restart=Restart B2G
copy from mobile/xul/locales/en-US/defines.inc
copy to b2g/locales/en-US/defines.inc
copy from mobile/xul/locales/en-US/installer/setup.ini
copy to b2g/locales/en-US/installer/setup.ini
copy from mobile/xul/locales/en-US/updater/updater.ini
copy to b2g/locales/en-US/updater/updater.ini
copy from mobile/xul/locales/filter.py
copy to b2g/locales/filter.py
--- a/mobile/xul/locales/filter.py
+++ b/b2g/locales/filter.py
@@ -33,33 +33,32 @@
 # 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 *****
 
 
 def test(mod, path, entity = None):
   import re
-  # ignore anything but mobile, which is our local repo checkout name
+  # ignore anything but b2g, which is our local repo checkout name
   if mod not in ("netwerk", "dom", "toolkit", "security/manager",
                  "services/sync", "embedding/android",
-                 "mobile"):
+                 "b2g"):
     return False
 
   # Ignore Lorentz strings, at least temporarily
   if mod == "toolkit" and path == "chrome/mozapps/plugins/plugins.dtd":
     if entity.startswith('reloadPlugin.'): return False
     if entity.startswith('report.'): return False
 
-  if mod != "mobile":
-    # we only have exceptions for mobile
+  if mod != "b2g":
+    # we only have exceptions for b2g
     return True
   if not entity:
-    return not (re.match(r"searchplugins\/.+\.xml", path) or
-                re.match(r"mobile-l10n.js", path) or
+    return not (re.match(r"b2g-l10n.js", path) or
                 re.match(r"defines.inc", path))
   if path == "defines.inc":
     return entity != "MOZ_LANGPACK_CONTRIBUTORS"
 
   if path != "chrome/region.properties":
     # only region.properties exceptions remain, compare all others
     return True
   
copy from mobile/xul/locales/generic/install.rdf
copy to b2g/locales/generic/install.rdf
--- a/mobile/xul/locales/generic/install.rdf
+++ b/b2g/locales/generic/install.rdf
@@ -48,15 +48,15 @@
                em:type="8"
                em:creator="@MOZ_LANGPACK_CREATOR@">
 #ifdef MOZ_LANGPACK_CONTRIBUTORS
     @MOZ_LANGPACK_CONTRIBUTORS@
 #endif
 
     <em:targetApplication>
       <Description>
-        <em:id>{a23983c0-fd0e-11dc-95ff-0800200c9a66}</em:id>
+        <em:id>{3c2e2abc-06d4-11e1-ac3b-374f68613e61}</em:id>
         <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
         <em:maxVersion>@MOZ_APP_VERSION@</em:maxVersion>
       </Description>
     </em:targetApplication>
   </Description>
 </RDF>
copy from mobile/xul/locales/jar.mn
copy to b2g/locales/jar.mn
--- a/mobile/xul/locales/jar.mn
+++ b/b2g/locales/jar.mn
@@ -1,31 +1,12 @@
 #filter substitution
 
 @AB_CD@.jar:
 % locale browser @AB_CD@ %locale/@AB_CD@/browser/
   locale/@AB_CD@/browser/about.dtd                (%chrome/about.dtd)
   locale/@AB_CD@/browser/aboutCertError.dtd       (%chrome/aboutCertError.dtd)
-  locale/@AB_CD@/browser/aboutHome.dtd            (%chrome/aboutHome.dtd)
-  locale/@AB_CD@/browser/browser.dtd              (%chrome/browser.dtd)
-  locale/@AB_CD@/browser/browser.properties       (%chrome/browser.properties)
-  locale/@AB_CD@/browser/config.dtd               (%chrome/config.dtd)
-  locale/@AB_CD@/browser/localepicker.properties  (%chrome/localepicker.properties)
-  locale/@AB_CD@/browser/region.properties        (%chrome/region.properties)
-  locale/@AB_CD@/browser/preferences.dtd          (%chrome/preferences.dtd)
-  locale/@AB_CD@/browser/checkbox.dtd             (%chrome/checkbox.dtd)
   locale/@AB_CD@/browser/notification.dtd         (%chrome/notification.dtd)
-  locale/@AB_CD@/browser/sync.dtd                 (%chrome/sync.dtd)
-  locale/@AB_CD@/browser/sync.properties          (%chrome/sync.properties)
-  locale/@AB_CD@/browser/prompt.dtd               (%chrome/prompt.dtd)
   locale/@AB_CD@/browser/webapps.dtd              (%chrome/webapps.dtd)
-  locale/@AB_CD@/browser/feedback.dtd             (%chrome/feedback.dtd)
   locale/@AB_CD@/browser/phishing.dtd             (%chrome/phishing.dtd)
-  locale/@AB_CD@/browser/bookmarks.json           (bookmarks.json)
-  locale/@AB_CD@/browser/searchplugins/list.txt   (%searchplugins/list.txt)
 
-# Fennec-specific overrides of generic strings
 * locale/@AB_CD@/browser/netError.dtd             (%chrome/overrides/netError.dtd)
 % override chrome://global/locale/netError.dtd    chrome://browser/locale/netError.dtd
-* locale/@AB_CD@/browser/appstrings.properties    (%chrome/overrides/appstrings.properties)
-% override chrome://global/locale/appstrings.properties chrome://browser/locale/appstrings.properties
-* locale/@AB_CD@/browser/passwordmgr.properties    (%chrome/overrides/passwordmgr.properties)
-% override chrome://passwordmgr/locale/passwordmgr.properties chrome://browser/locale/passwordmgr.properties
copy from mobile/xul/locales/l10n.ini
copy to b2g/locales/l10n.ini
--- a/mobile/xul/locales/l10n.ini
+++ b/b2g/locales/l10n.ini
@@ -1,11 +1,10 @@
 [general]
 depth = ../..
-all = mobile/xul/locales/all-locales
+all = b2g/locales/all-locales
 
 [compare]
-dirs = mobile
+dirs = b2g
 
 [includes]
 toolkit = toolkit/locales/l10n.ini
 services_sync = services/sync/locales/l10n.ini
-embedding_android = embedding/android/locales/l10n.ini
copy from mobile/xul/makefiles.sh
copy to b2g/makefiles.sh
--- a/mobile/xul/makefiles.sh
+++ b/b2g/makefiles.sh
@@ -10,49 +10,44 @@
 # 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.
 #
 # The Initial Developer of the Original Code is
 # the Mozilla Foundation <http://www.mozilla.org/>.
-# Portions created by the Initial Developer are Copyright (C) 2007
+# Portions created by the Initial Developer are Copyright (C) 2011
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
-#   Mark Finkle <mfinkle@mozilla.com>
 #
 # Alternatively, the contents of this file may be used under the terms of
 # either the GNU General Public License Version 2 or later (the "GPL"), or
 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 # in which case the provisions of the GPL or the LGPL are applicable instead
 # of those above. If you wish to allow use of your version of this file only
 # under the terms of either the GPL or the LGPL, and not to allow others to
 # use your version of this file under the terms of the MPL, indicate your
 # decision by deleting the provisions above and replace them with the notice
 # and other provisions required by the GPL or the LGPL. If you do not delete
 # the provisions above, a recipient may use your version of this file under
 # the terms of any one of the MPL, the GPL or the LGPL.
 #
 # ***** END LICENSE BLOCK *****
 
 add_makefiles "
-mobile/xul/app/Makefile
-mobile/xul/app/profile/extensions/Makefile
+netwerk/locales/Makefile
+dom/locales/Makefile
+toolkit/locales/Makefile
+security/manager/locales/Makefile
+b2g/app/Makefile
 $MOZ_BRANDING_DIRECTORY/Makefile
-$MOZ_BRANDING_DIRECTORY/content/Makefile
-$MOZ_BRANDING_DIRECTORY/locales/Makefile
-mobile/xul/chrome/Makefile
-mobile/xul/components/Makefile
-mobile/xul/components/build/Makefile
-mobile/xul/modules/Makefile
-mobile/xul/installer/Makefile
-mobile/xul/locales/Makefile
-mobile/xul/Makefile
-mobile/xul/themes/core/Makefile
-"
+b2g/chrome/Makefile
+b2g/installer/Makefile
+b2g/locales/Makefile
+b2g/Makefile"
 
-if [ "$ENABLE_TESTS" ]; then
-  add_makefiles "
-    mobile/xul/chrome/tests/Makefile
-  "
+if test -n "$MOZ_UPDATE_PACKAGING"; then
+   add_makefiles "
+     tools/update-packaging/Makefile
+   "
 fi
--- a/browser/base/content/aboutHome.js
+++ b/browser/base/content/aboutHome.js
@@ -175,16 +175,19 @@ function onSearchSubmit(aEvent)
   aEvent.preventDefault();
 }
 
 
 function setupSearchEngine()
 {
   gSearchEngine = JSON.parse(localStorage["search-engine"]);
 
+  if (!gSearchEngine)
+    return;
+
   // Look for extended information, like logo and links.
   let searchEngineInfo = SEARCH_ENGINES[gSearchEngine.name];
   if (searchEngineInfo) {
     for (let prop in searchEngineInfo)
       gSearchEngine[prop] = searchEngineInfo[prop];
   }
 
   // Enqueue additional params if required by the engine definition.
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -122,30 +122,30 @@ var StarUI = {
               PlacesUIUtils.ptm.endBatch();
               break;
             }
           }
           this._actionOnHide = "";
         }
         break;
       case "keypress":
-        if (aEvent.getPreventDefault()) {
+        if (aEvent.defaultPrevented) {
           // The event has already been consumed inside of the panel.
           break;
         }
         switch (aEvent.keyCode) {
           case KeyEvent.DOM_VK_ESCAPE:
             if (!this._element("editBookmarkPanelContent").hidden)
               this.cancelButtonOnCommand();
             break;
           case KeyEvent.DOM_VK_RETURN:
             if (aEvent.target.className == "expander-up" ||
                 aEvent.target.className == "expander-down" ||
                 aEvent.target.id == "editBMPanel_newFolderButton") {
-              //XXX Why is this necessary? The getPreventDefault() check should
+              //XXX Why is this necessary? The defaultPrevented check should
               //    be enough.
               break;
             }
             this.panel.hidePopup();
             break;
         }
         break;
     }
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3964,16 +3964,20 @@ var FullScreen = {
     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;
     }
 
+    // Ensure the sidebar is hidden.
+    if (!document.getElementById("sidebar-box").hidden)
+      toggleSidebar();
+
     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);
@@ -5756,17 +5760,17 @@ function hrefAndLinkNodeForClickEvent(ev
  * @param event
  *        The click event.
  * @param isPanelClick
  *        Whether the event comes from a web panel.
  * @note default event is prevented if the click is handled.
  */
 function contentAreaClick(event, isPanelClick)
 {
-  if (!event.isTrusted || event.getPreventDefault() || event.button == 2)
+  if (!event.isTrusted || event.defaultPrevented || event.button == 2)
     return true;
 
   let [href, linkNode] = hrefAndLinkNodeForClickEvent(event);
   if (!href) {
     // Not a link, handle middle mouse navigation.
     if (event.button == 1 &&
         gPrefService.getBoolPref("middlemouse.contentLoadURL") &&
         !gPrefService.getBoolPref("general.autoScroll")) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -274,17 +274,21 @@
 
     <menupopup id="contentAreaContextMenu" pagemenu="start"
                onpopupshowing="if (event.target != this)
                                  return true;
                                gContextMenu = new nsContextMenu(this, gBrowser, event.shiftKey);
                                if (gContextMenu.shouldDisplay)
                                  updateEditUIVisibility();
                                return gContextMenu.shouldDisplay;"
-               onpopuphiding="if (event.target == this) { gContextMenu = null; updateEditUIVisibility(); }">
+               onpopuphiding="if (event.target != this)
+                                return;
+                              gContextMenu.hiding();
+                              gContextMenu = null;
+                              updateEditUIVisibility();">
 #include browser-context.inc
     </menupopup>
 
     <menupopup id="placesContext"/>
 
     <panel id="notification-popup"
            type="arrow"
            footertype="promobox"
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -92,16 +92,22 @@ nsContextMenu.prototype = {
     } catch (e) { }
     this.isTextSelected = this.isTextSelection();
     this.isContentSelected = this.isContentSelection();
 
     // Initialize (disable/remove) menu items.
     this.initItems();
   },
 
+  hiding: function CM_hiding() {
+    InlineSpellCheckerUI.clearSuggestionsFromMenu();
+    InlineSpellCheckerUI.clearDictionaryListFromMenu();
+    InlineSpellCheckerUI.uninit();
+  },
+
   initItems: function CM_initItems() {
     this.initPageMenuSeparator();
     this.initOpenItems();
     this.initNavigationItems();
     this.initViewItems();
     this.initMiscItems();
     this.initSpellingItems();
     this.initSaveItems();
@@ -483,26 +489,16 @@ nsContextMenu.prototype = {
     this.onMathML          = false;
     this.inFrame           = false;
     this.inSyntheticDoc    = false;
     this.hasBGImage        = false;
     this.bgImageURL        = "";
     this.onEditableArea    = false;
     this.isDesignMode      = false;
 
-    // Clear any old spellchecking items from the menu, this used to
-    // be in the menu hiding code but wasn't getting called in all
-    // situations. Here, we can ensure it gets cleaned up any time the
-    // menu is shown. Note: must be before uninit because that clears the
-    // internal vars
-    InlineSpellCheckerUI.clearSuggestionsFromMenu();
-    InlineSpellCheckerUI.clearDictionaryListFromMenu();
-
-    InlineSpellCheckerUI.uninit();
-
     // Remember the node that was clicked.
     this.target = aNode;
 
     // Check if we are in a synthetic document (stand alone image, video, etc.).
     this.inSyntheticDoc =  this.target.ownerDocument.mozSyntheticDocument;
     // First, do checks for nodes that never have children.
     if (this.target.nodeType == Node.ELEMENT_NODE) {
       // See if the user clicked on an image.
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1958,16 +1958,18 @@
         <body>
         <![CDATA[
           Array.forEach(this.tabs, function(tab) {
             if (aTabs.indexOf(tab) == -1)
               this.hideTab(tab);
             else
               this.showTab(tab);
           }, this);
+
+          this.tabContainer.mTabstrip.ensureElementIsVisible(this.selectedTab, false);
         ]]>
         </body>
       </method>
 
       <method name="showTab">
         <parameter name="aTab"/>
         <body>
         <![CDATA[
@@ -2407,17 +2409,17 @@
           if (aEvent.altKey)
             return;
 
           // We need to take care of FAYT-watching as long as the findbar
           // isn't initialized.  The checks on aEvent are copied from
           // _shouldFastFind (see findbar.xml).
           if (!gFindBarInitialized &&
               !(aEvent.ctrlKey || aEvent.metaKey) &&
-              !aEvent.getPreventDefault()) {
+              !aEvent.defaultPrevented) {
             let charCode = aEvent.charCode;
             if (charCode) {
               let char = String.fromCharCode(charCode);
               if (char == "'" || char == "/" ||
                   Services.prefs.getBoolPref("accessibility.typeaheadfind")) {
                 gFindBar._onBrowserKeypress(aEvent);
                 return;
               }
--- a/browser/base/content/test/browser_contentAreaClick.js
+++ b/browser/base/content/test/browser_contentAreaClick.js
@@ -228,19 +228,19 @@ function test() {
 let gClickHandler = {
   handleEvent: function (event) {
     let linkId = event.target.id || event.target.localName;
     is(event.type, "click",
        gCurrentTest.desc + ":Handler received a click event on " + linkId);
 
     let isPanelClick = linkId == "panellink";
     let returnValue = gTestWin.contentAreaClick(event, isPanelClick);
-    let prevent = event.getPreventDefault();
+    let prevent = event.defaultPrevented;
     is(prevent, gCurrentTest.preventDefault,
-       gCurrentTest.desc + ": event.getPreventDefault() is correct (" + prevent + ")")
+       gCurrentTest.desc + ": event.defaultPrevented is correct (" + prevent + ")")
 
     // Check that all required methods have been called.
     gCurrentTest.expectedInvokedMethods.forEach(function(aExpectedMethodName) {
       isnot(gInvokedMethods.indexOf(aExpectedMethodName), -1,
             gCurrentTest.desc + ":" + aExpectedMethodName + " was invoked");
     });
     
     if (gInvokedMethods.length != gCurrentTest.expectedInvokedMethods.length) {
--- a/browser/base/content/test/browser_ctrlTab.js
+++ b/browser/base/content/test/browser_ctrlTab.js
@@ -69,17 +69,17 @@ function test() {
 
   gBrowser.removeTab(gBrowser.tabContainer.lastChild);
   checkTabs(1);
 
   { // test for bug 445768
     let focusedWindow = document.commandDispatcher.focusedWindow;
     let eventConsumed = true;
     let detectKeyEvent = function (event) {
-      eventConsumed = event.getPreventDefault();
+      eventConsumed = event.defaultPrevented;
     };
     document.addEventListener("keypress", detectKeyEvent, false);
     pressCtrlTab();
     document.removeEventListener("keypress", detectKeyEvent, false);
     ok(eventConsumed, "Ctrl+Tab consumed by the tabbed browser if one tab is open");
     is(focusedWindow, document.commandDispatcher.focusedWindow,
        "Ctrl+Tab doesn't change focus if one tab is open");
   }
--- a/browser/base/content/web-panels.xul
+++ b/browser/base/content/web-panels.xul
@@ -82,18 +82,20 @@
     <tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
     <menupopup id="contentAreaContextMenu" pagemenu="start"
                onpopupshowing="if (event.target != this)
                                  return true;
                                gContextMenu = new nsContextMenu(this, getPanelBrowser(), event.shiftKey);
                                if (gContextMenu.shouldDisplay)
                                  document.popupNode = this.triggerNode;
                                return gContextMenu.shouldDisplay;"
-               onpopuphiding="if (event.target == this)
-                                gContextMenu = null;">
+               onpopuphiding="if (event.target != this)
+                                return;
+                              gContextMenu.hiding();
+                              gContextMenu = null;">
 #include browser-context.inc
     </menupopup>
   </popupset>
 
   <commandset id="editMenuCommands"/> 
   <browser id="web-panels-browser" persist="cachedurl" type="content" flex="1"
            context="contentAreaContextMenu" tooltip="aHTMLTooltip"
            onclick="return window.parent.contentAreaClick(event, true);"/>
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -75,16 +75,19 @@ installer:
 	@$(MAKE) -C browser/installer installer
 
 package:
 	@$(MAKE) -C browser/installer
 
 package-compare:
 	@$(MAKE) -C browser/installer package-compare
 
+stage-package:
+	@$(MAKE) -C browser/installer stage-package
+
 install::
 	@$(MAKE) -C browser/installer install
 
 clean::
 	@$(MAKE) -C browser/installer clean
 
 distclean::
 	@$(MAKE) -C browser/installer distclean
--- a/browser/components/certerror/content/aboutCertError.xhtml
+++ b/browser/components/certerror/content/aboutCertError.xhtml
@@ -118,21 +118,22 @@
         };
         replaceWithHost(intro);
         
         if (getCSSClass() == "expertBadCert") {
           toggle('technicalContent');
           toggle('expertContent');
         }
 
-        // if this is a Strict-Transport-Security host and the cert
-        // is bad, don't allow overrides (STS Spec section 7.3).
-        if (getCSSClass() == "badStsCert") {
+        // Disallow overrides if this is a Strict-Transport-Security
+        // host and the cert is bad (STS Spec section 7.3) or if the
+        // certerror is in a frame (bug 633691).
+        if (getCSSClass() == "badStsCert" || window != top) {
           var ec = document.getElementById('expertContent');
-          document.getElementById('errorLongContent').removeChild(ec);
+          ec.parentNode.removeChild(ec);
         }
         
         var tech = document.getElementById("technicalContentText");
         if (tech)
           tech.textContent = getDescription();
         
         addDomainErrorLink();
       }
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
@@ -78,17 +78,17 @@ function synthesizeDragWithDirection(aEl
            "Flavor " + types[f] + " for item " + t + " should be the same.");
         is(dataTransfer.mozGetDataAt(types[f], t),
            expecteditem[f].substring(types[f].length + 2),
            "Contents for item " + t + " with flavor " + types[f] + " should be the same.");
       }
     }
 
     if (!aExpectedDragData.length)
-      ok(event.getPreventDefault(), "Drag has been canceled.");
+      ok(event.defaultPrevented, "Drag has been canceled.");
 
     event.preventDefault();
     event.stopPropagation();
 
     gBookmarksToolbar.removeEventListener("dragstart", arguments.callee, false);
 
     // This is likely to cause a click event, and, in case we are dragging a
     // bookmark, an unwanted page visit.  Prevent the click event.
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -173,16 +173,26 @@ function SessionStoreService() {
   });
 
   // when crash recovery is disabled, session data is not written to disk
   XPCOMUtils.defineLazyGetter(this, "_resume_from_crash", function () {
     // get crash recovery state from prefs and allow for proper reaction to state changes
     this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true);
     return this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
   });
+
+  XPCOMUtils.defineLazyGetter(this, "_max_tabs_undo", function () {
+    this._prefBranch.addObserver("sessionstore.max_tabs_undo", this, true);
+    return this._prefBranch.getIntPref("sessionstore.max_tabs_undo");
+  });
+
+  XPCOMUtils.defineLazyGetter(this, "_max_windows_undo", function () {
+    this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);
+    return this._prefBranch.getIntPref("sessionstore.max_windows_undo");
+  });
 }
 
 SessionStoreService.prototype = {
   classID: Components.ID("{5280606b-2510-4fe0-97ef-9b5a22eafe6b}"),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsISessionStore,
                                          Ci.nsIDOMEventListener,
                                          Ci.nsIObserver,
                                          Ci.nsISupportsWeakReference]),
@@ -286,20 +296,16 @@ SessionStoreService.prototype = {
     }, this);
 
     var pbs = Cc["@mozilla.org/privatebrowsing;1"].
               getService(Ci.nsIPrivateBrowsingService);
     this._inPrivateBrowsing = pbs.privateBrowsingEnabled;
 
     // Do pref migration before we store any values and start observing changes
     this._migratePrefs();
-
-    // observe prefs changes so we can modify stored data to match
-    this._prefBranch.addObserver("sessionstore.max_tabs_undo", this, true);
-    this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);
     
     // this pref is only read at startup, so no need to observe it
     this._sessionhistory_max_entries =
       this._prefBranch.getIntPref("sessionhistory.max_entries");
 
     this._restoreOnDemand =
       this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
     this._prefBranch.addObserver("sessionstore.restore_on_demand", this, true);
@@ -637,21 +643,23 @@ SessionStoreService.prototype = {
 
       this._clearRestoringWindows();
       break;
     case "nsPref:changed": // catch pref changes
       switch (aData) {
       // if the user decreases the max number of closed tabs they want
       // preserved update our internal states to match that max
       case "sessionstore.max_tabs_undo":
+        this._max_tabs_undo = this._prefBranch.getIntPref("sessionstore.max_tabs_undo");
         for (let ix in this._windows) {
-          this._windows[ix]._closedTabs.splice(this._prefBranch.getIntPref("sessionstore.max_tabs_undo"), this._windows[ix]._closedTabs.length);
+          this._windows[ix]._closedTabs.splice(this._max_tabs_undo, this._windows[ix]._closedTabs.length);
         }
         break;
       case "sessionstore.max_windows_undo":
+        this._max_windows_undo = this._prefBranch.getIntPref("sessionstore.max_windows_undo");
         this._capClosedWindows();
         break;
       case "sessionstore.interval":
         this._interval = this._prefBranch.getIntPref("sessionstore.interval");
         // reset timer and save
         if (this._saveTimer) {
           this._saveTimer.cancel();
           this._saveTimer = null;
@@ -1089,20 +1097,19 @@ SessionStoreService.prototype = {
    *        Tab reference
    */
   onTabClose: function sss_onTabClose(aWindow, aTab) {
     // notify the tabbrowser that the tab state will be retrieved for the last time
     // (so that extension authors can easily set data on soon-to-be-closed tabs)
     var event = aWindow.document.createEvent("Events");
     event.initEvent("SSTabClosing", true, false);
     aTab.dispatchEvent(event);
-    
-    var maxTabsUndo = this._prefBranch.getIntPref("sessionstore.max_tabs_undo");
+
     // don't update our internal state if we don't have to
-    if (maxTabsUndo == 0) {
+    if (this._max_tabs_undo == 0) {
       return;
     }
     
     // make sure that the tab related data is up-to-date
     var tabState = this._collectTabData(aTab);
     this._updateTextAndScrollDataForTab(aWindow, aTab.linkedBrowser, tabState);
 
     // store closed-tab data for undo
@@ -1113,18 +1120,18 @@ SessionStoreService.prototype = {
       
       this._windows[aWindow.__SSi]._closedTabs.unshift({
         state: tabState,
         title: tabTitle,
         image: aTab.getAttribute("image"),
         pos: aTab._tPos
       });
       var length = this._windows[aWindow.__SSi]._closedTabs.length;
-      if (length > maxTabsUndo)
-        this._windows[aWindow.__SSi]._closedTabs.splice(maxTabsUndo, length - maxTabsUndo);
+      if (length > this._max_tabs_undo)
+        this._windows[aWindow.__SSi]._closedTabs.splice(this._max_tabs_undo, length - this._max_tabs_undo);
     }
   },
 
   /**
    * When a tab loads, save state.
    * @param aWindow
    *        Window reference
    * @param aBrowser
@@ -2513,17 +2520,17 @@ SessionStoreService.prototype = {
     //XXXzpao We should do this for _restoreLastWindow == true, but that has
     //        its own check for popups. c.f. bug 597619
     if (nonPopupCount == 0 && lastClosedWindowsCopy.length > 0 &&
         this._loadState == STATE_QUITTING) {
       // prepend the last non-popup browser window, so that if the user loads more tabs
       // at startup we don't accidentally add them to a popup window
       do {
         total.unshift(lastClosedWindowsCopy.shift())
-      } while (total[0].isPopup)
+      } while (total[0].isPopup && lastClosedWindowsCopy.length > 0)
     }
 #endif
 
     if (aPinnedOnly) {
       // perform a deep copy so that existing session variables are not changed.
       total = JSON.parse(this._toJSONString(total));
       total = total.filter(function (win) {
         win.tabs = win.tabs.filter(function (tab) tab.pinned);
@@ -4259,27 +4266,26 @@ SessionStoreService.prototype = {
   },
 
   /**
    * Resize this._closedWindows to the value of the pref, except in the case
    * where we don't have any non-popup windows on Windows and Linux. Then we must
    * resize such that we have at least one non-popup window.
    */
   _capClosedWindows : function sss_capClosedWindows() {
-    let maxWindowsUndo = this._prefBranch.getIntPref("sessionstore.max_windows_undo");
-    if (this._closedWindows.length <= maxWindowsUndo)
+    if (this._closedWindows.length <= this._max_windows_undo)
       return;
-    let spliceTo = maxWindowsUndo;
+    let spliceTo = this._max_windows_undo;
 #ifndef XP_MACOSX
     let normalWindowIndex = 0;
     // try to find a non-popup window in this._closedWindows
     while (normalWindowIndex < this._closedWindows.length &&
            !!this._closedWindows[normalWindowIndex].isPopup)
       normalWindowIndex++;
-    if (normalWindowIndex >= maxWindowsUndo)
+    if (normalWindowIndex >= this._max_windows_undo)
       spliceTo = normalWindowIndex + 1;
 #endif
     this._closedWindows.splice(spliceTo, this._closedWindows.length);
   },
 
   _clearRestoringWindows: function sss__clearRestoringWindows() {
     for (let i = 0; i < this._closedWindows.length; i++) {
       delete this._closedWindows[i]._shouldRestore;
@@ -4520,17 +4526,18 @@ let XPathHelper = {
 // This is used to help meter the number of restoring tabs. This is the control
 // point for telling the next tab to restore. It gets attached to each gBrowser
 // via gBrowser.addTabsProgressListener
 let gRestoreTabsProgressListener = {
   ss: null,
   onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
     // Ignore state changes on browsers that we've already restored and state
     // changes that aren't applicable.
-    if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
+    if (aBrowser.__SS_restoreState &&
+        aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
         aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
       // We need to reset the tab before starting the next restore.
       let tab = this.ss._getTabForBrowser(aBrowser);
       this.ss._resetTabRestoringState(tab);
       this.ss.restoreNextTab();
     }
--- a/browser/components/tabview/test/Makefile.in
+++ b/browser/components/tabview/test/Makefile.in
@@ -159,16 +159,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug673196.js \
                  browser_tabview_bug673729.js \
                  browser_tabview_bug677310.js \
                  browser_tabview_bug679853.js \
                  browser_tabview_bug681599.js \
                  browser_tabview_bug685476.js \
                  browser_tabview_bug685692.js \
                  browser_tabview_bug686654.js \
+                 browser_tabview_bug696602.js \
                  browser_tabview_bug697390.js \
                  browser_tabview_bug705621.js \
                  browser_tabview_bug706430.js \
                  browser_tabview_bug706736.js \
                  browser_tabview_click_group.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
new file mode 100644
--- /dev/null
+++ b/browser/components/tabview/test/browser_tabview_bug696602.js
@@ -0,0 +1,51 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+let win;
+
+function test() {
+  waitForExplicitFinish();
+
+  newWindowWithTabView(function(newWin) {
+    win = newWin;
+
+    registerCleanupFunction(function() {
+      win.close();
+    });
+
+    let cw = win.TabView.getContentWindow();
+    let groupItemOne = cw.GroupItems.groupItems[0];
+    let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10);
+
+    is(win.gBrowser.tabContainer.getAttribute("overflow"), "true",
+       "The tabstrip is overflow");
+
+    is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs");
+    is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs");
+
+    checkSelectedTabVisible("two", function() {
+      showTabView(function() {
+        checkSelectedTabVisible("one", finish);
+        groupItemOne.getChild(9).zoomIn();
+      }, win);
+    });
+    groupItemTwo.getChild(9).zoomIn();
+  }, function(newWin) {
+    for (let i = 0; i < 9; i++)
+      newWin.gBrowser.addTab();
+  });
+}
+
+function isSelectedTabVisible() {
+  let tabstrip = win.gBrowser.tabContainer.mTabstrip;
+  let scrollRect = tabstrip.scrollClientRect;
+  let tab = win.gBrowser.selectedTab.getBoundingClientRect();
+
+  return (scrollRect.left <= tab.left && tab.right <= scrollRect.right);
+}
+
+function checkSelectedTabVisible(groupName, callback) {
+  whenTabViewIsHidden(function() {
+    ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible");
+    callback();
+  }, win);
+}
--- a/browser/components/tabview/ui.js
+++ b/browser/components/tabview/ui.js
@@ -147,16 +147,20 @@ let UI = {
   // Variable: ignoreKeypressForSearch
   // Used to prevent keypress being handled after quitting search mode.
   ignoreKeypressForSearch: false,
 
   // Variable: _lastOpenedTab
   // Used to keep track of the last opened tab.
   _lastOpenedTab: null,
 
+  // Variable: _originalSmoothScroll
+  // Used to keep track of the tab strip smooth scroll value.
+  _originalSmoothScroll: null,
+
   // ----------
   // Function: toString
   // Prints [UI] for debug use
   toString: function UI_toString() {
     return "[UI]";
   },
 
   // ----------
@@ -509,16 +513,21 @@ let UI = {
   // Parameters:
   //   zoomOut - true for zoom out animation, false for nothing.
   showTabView: function UI_showTabView(zoomOut) {
     if (this.isTabViewVisible() || this._isChangingVisibility)
       return;
 
     this._isChangingVisibility = true;
 
+    // store tab strip smooth scroll value and disable it.
+    let tabStrip = gBrowser.tabContainer.mTabstrip;
+    this._originalSmoothScroll = tabStrip.smoothScroll;
+    tabStrip.smoothScroll = false;
+
     // initialize the direction of the page
     this._initPageDirection();
 
     var self = this;
     var currentTab = this._currentTab;
 
     this._reorderTabItemsOnShow.forEach(function(groupItem) {
       groupItem.reorderTabItemsBasedOnTabOrder();
@@ -604,16 +613,17 @@ let UI = {
     // as well as avoiding the flash of black as we animate out
     gTabViewFrame.style.marginTop = gBrowser.boxObject.y + "px";
 #endif
     gTabViewDeck.selectedPanel = gBrowserPanel;
     gWindow.TabsInTitlebar.allowedBy("tabview-open", true);
     gBrowser.selectedBrowser.focus();
 
     gBrowser.updateTitlebar();
+    gBrowser.tabContainer.mTabstrip.smoothScroll = this._originalSmoothScroll;
 #ifdef XP_MACOSX
     this.setTitlebarColors(false);
 #endif
     Storage.saveVisibilityData(gWindow, "false");
 
     this._isChangingVisibility = false;
 
     let event = document.createEvent("Events");
--- a/browser/devtools/highlighter/inspector.jsm
+++ b/browser/devtools/highlighter/inspector.jsm
@@ -75,16 +75,19 @@ const INSPECTOR_NOTIFICATIONS = {
 
   // Fires once the Inspector completes the initialization and opens up on
   // screen.
   OPENED: "inspector-opened",
 
   // Fires once the Inspector is closed.
   CLOSED: "inspector-closed",
 
+  // Fires once the Inspector is destroyed. Not fired on tab switch.
+  DESTROYED: "inspector-destroyed",
+
   // Fires when the Inspector is reopened after tab-switch.
   STATE_RESTORED: "inspector-state-restored",
 
   // Fires when the Tree Panel is opened and initialized.
   TREEPANELREADY: "inspector-treepanel-ready",
 
   // Fires when the CSS Rule View is opened and initialized.
   RULEVIEWREADY: "inspector-ruleview-ready",
@@ -280,16 +283,17 @@ Highlighter.prototype = {
     };
   },
 
   /**
    * Destroy the nodes.
    */
   destroy: function Highlighter_destroy()
   {
+    this.IUI.win.clearTimeout(this.transitionDisabler);
     this.browser.removeEventListener("scroll", this, true);
     this.browser.removeEventListener("resize", this, true);
     this.boundCloseEventHandler = null;
     this._contentRect = null;
     this._highlightRect = null;
     this._highlighting = false;
     this.veilTopBox = null;
     this.veilLeftBox = null;
@@ -1040,16 +1044,18 @@ InspectorUI.prototype = {
     // highlighter/HTML panel dismisses the editor
     if (this.treePanel && this.treePanel.editingContext)
       this.treePanel.closeEditor();
 
     if (this.closing || !this.win || !this.browser) {
       return;
     }
 
+    let winId = new String(this.winID); // retain this to notify observers.
+
     this.closing = true;
     this.toolbar.hidden = true;
 
     this.progressListener.destroy();
     delete this.progressListener;
 
     if (!aKeepStore) {
       this.store.deleteStore(this.winID);
@@ -1098,16 +1104,18 @@ InspectorUI.prototype = {
     this.selection = null;
     this.closing = false;
     this.isDirty = false;
 
     delete this.treePanel;
     delete this.stylePanel;
     delete this.toolbar;
     Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.CLOSED, null);
+    if (!aKeepStore)
+      Services.obs.notifyObservers(null, INSPECTOR_NOTIFICATIONS.DESTROYED, winId);
   },
 
   /**
    * Begin inspecting webpage, attach page event listeners, activate
    * highlighter event listeners.
    */
   startInspecting: function IUI_startInspecting()
   {
--- a/browser/devtools/highlighter/test/browser_inspector_initialization.js
+++ b/browser/devtools/highlighter/test/browser_inspector_initialization.js
@@ -34,16 +34,17 @@
  * 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 ***** */
 let doc;
 let salutation;
 let closing;
+let winId;
 
 function createDocument()
 {
   doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
     'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
     '<h1>Some header text</h1>\n' +
     '<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
     '<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
@@ -177,45 +178,48 @@ function inspectNodesFromContextTestWhil
   ok(closing, "we have the closing statement");
   executeSoon(function() {
     InspectorUI.openInspectorUI(closing);
   });
 }
 
 function inspectNodesFromContextTestHighlight()
 {
+  winId = InspectorUI.winID;
   Services.obs.removeObserver(inspectNodesFromContextTestHighlight, InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING);
-  Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false);
+  Services.obs.addObserver(finishInspectorTests, InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED, false);
   is(InspectorUI.selection, closing, "InspectorUI.selection is header");
   executeSoon(function() {
-    InspectorUI.closeInspectorUI(true);
+    InspectorUI.closeInspectorUI();
   });
 }
 
 function inspectNodesFromContextTestTrap()
 {
   Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
   ok(false, "Inspector UI has been opened again. We Should Not Be Here!");
 }
 
-function finishInspectorTests()
+function finishInspectorTests(subject, topic, aWinIdString)
 {
   Services.obs.removeObserver(finishInspectorTests,
-    InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED);
+    InspectorUI.INSPECTOR_NOTIFICATIONS.DESTROYED);
 
+  is(parseInt(aWinIdString), winId, "winId of destroyed Inspector matches");
   ok(!InspectorUI.highlighter, "Highlighter is gone");
   ok(!InspectorUI.treePanel, "Inspector Tree Panel is closed");
   ok(!InspectorUI.inspecting, "Inspector is not inspecting");
   ok(!InspectorUI.isSidebarOpen, "Inspector Sidebar is closed");
   ok(!InspectorUI.stylePanel, "Inspector Style Panel is gone");
   ok(!InspectorUI.ruleView, "Inspector Rule View is gone");
   is(InspectorUI.sidebarToolbar.children.length, 0, "No items in the Sidebar toolbar");
   is(InspectorUI.sidebarDeck.children.length, 0, "No items in the Sidebar deck");
   ok(!InspectorUI.toolbar, "toolbar is hidden");
 
+  Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
   gBrowser.removeCurrentTab();
   finish();
 }
 
 function test()
 {
   waitForExplicitFinish();
   ignoreAllUncaughtExceptions();
--- a/browser/devtools/webconsole/HUDService.jsm
+++ b/browser/devtools/webconsole/HUDService.jsm
@@ -1832,20 +1832,23 @@ HUD_SERVICE.prototype =
     hud.destroy();
 
     // Make sure that the console panel does not try to call
     // deactivateHUDForContext() again.
     hud.consoleWindowUnregisterOnHide = false;
 
     // Remove the HUDBox and the consolePanel if the Web Console is inside a
     // floating panel.
+    if (hud.consolePanel && hud.consolePanel.parentNode) {
+      hud.consolePanel.parentNode.removeChild(hud.consolePanel);
+      hud.consolePanel.removeAttribute("hudId");
+      hud.consolePanel = null;
+    }
+
     hud.HUDBox.parentNode.removeChild(hud.HUDBox);
-    if (hud.consolePanel) {
-      hud.consolePanel.parentNode.removeChild(hud.consolePanel);
-    }
 
     if (hud.splitter.parentNode) {
       hud.splitter.parentNode.removeChild(hud.splitter);
     }
 
     if (hud.jsterm) {
       hud.jsterm.autocompletePopup.destroy();
     }
@@ -3314,48 +3317,33 @@ HeadsUpDisplay.prototype = {
     panel.addEventListener("popupshown", onPopupShown,false);
 
     let onPopupHidden = (function HUD_onPopupHidden(aEvent) {
       if (aEvent.target != panel) {
         return;
       }
 
       panel.removeEventListener("popuphidden", onPopupHidden, false);
-      if (panel.parentNode) {
-        panel.parentNode.removeChild(panel);
-      }
 
       let width = 0;
       try {
         width = Services.prefs.getIntPref("devtools.webconsole.width");
       }
       catch (ex) { }
 
       if (width > 0) {
         Services.prefs.setIntPref("devtools.webconsole.width", panel.clientWidth);
       }
 
-      /*
-       * Removed because of bug 674562
-       * Services.prefs.setIntPref("devtools.webconsole.top", panel.panelBox.y);
-       * Services.prefs.setIntPref("devtools.webconsole.left", panel.panelBox.x);
-       */
-
-      // Make sure we are not going to close again, drop the hudId reference of
-      // the panel.
-      panel.removeAttribute("hudId");
-
+      // Are we destroying the HUD or repositioning it?
       if (this.consoleWindowUnregisterOnHide) {
         HUDService.deactivateHUDForContext(this.tab, false);
-      }
-      else {
+      } else {
         this.consoleWindowUnregisterOnHide = true;
       }
-
-      this.consolePanel = null;
     }).bind(this);
 
     panel.addEventListener("popuphidden", onPopupHidden, false);
 
     let lastIndex = -1;
 
     if (this.outputNode.getIndexOfFirstVisibleRow) {
       lastIndex = this.outputNode.getIndexOfFirstVisibleRow() +
@@ -3483,23 +3471,24 @@ HeadsUpDisplay.prototype = {
     }
 
     let closeButton = this.consoleFilterToolbar.
       getElementsByClassName("webconsole-close-button")[0];
     closeButton.removeAttribute("hidden");
 
     this.uiInOwnWindow = false;
     if (this.consolePanel) {
+      // must destroy the consolePanel
+      this.consoleWindowUnregisterOnHide = false;
+      this.consolePanel.hidePopup();
+      this.consolePanel.parentNode.removeChild(this.consolePanel);
+      this.consolePanel = null;   // remove this as we're not in panel anymore
       this.HUDBox.removeAttribute("flex");
       this.HUDBox.removeAttribute("height");
       this.HUDBox.style.height = height + "px";
-
-      // must destroy the consolePanel
-      this.consoleWindowUnregisterOnHide = false;
-      this.consolePanel.hidePopup();
     }
 
     if (this.jsterm) {
       this.jsterm.inputNode.focus();
     }
     if (this.gcliterm) {
       this.gcliterm.inputNode.focus();
     }
@@ -6199,17 +6188,17 @@ HeadsUpDisplayUICommands = {
     var tabId = gBrowser.getNotificationBox(linkedBrowser).getAttribute("id");
     var hudId = "hud_" + tabId;
     var ownerDocument = gBrowser.selectedTab.ownerDocument;
     var hud = ownerDocument.getElementById(hudId);
     var hudRef = HUDService.hudReferences[hudId];
 
     if (hudRef && hud) {
       if (hudRef.consolePanel) {
-        HUDService.deactivateHUDForContext(gBrowser.selectedTab, false);
+        hudRef.consolePanel.hidePopup();
       }
       else {
         HUDService.storeHeight(hudId);
 
         HUDService.animate(hudId, ANIMATE_OUT, function() {
           // If the user closes the console while the console is animating away,
           // then these callbacks will queue up, but all the callbacks after the
           // first will have no console to operate on. This test handles this
--- a/browser/devtools/webconsole/test/browser/Makefile.in
+++ b/browser/devtools/webconsole/test/browser/Makefile.in
@@ -143,16 +143,17 @@ include $(topsrcdir)/config/rules.mk
 	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 \
+	browser_webconsole_window_zombie.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_webconsole_position_ui.js
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_position_ui.js
@@ -56,17 +56,19 @@ function onLoad() {
 
     document.addEventListener("popuphidden", function popupHidden() {
       document.removeEventListener("popuphidden", popupHidden, false);
 
       id = hudBox.parentNode.childNodes[2].getAttribute("id");
       is(id, hudId, "below position is correct after reopen");
 
       diffHeight = Math.abs(hudBox.clientHeight - boxHeight);
-      ok(diffHeight < 3, "hudBox height is still correct");
+      // dump("Diffheight: " + diffHeight + " clientHeight: " + hudBox.clientHeight + " boxHeight: " + boxHeight + "\n");
+      // XXX TODO bug 702707
+      todo(diffHeight < 3, "hudBox height is still correct");
 
       is(Services.prefs.getCharPref(POSITION_PREF), "below", "pref is below");
 
       // following three disabled due to bug 674562
       // is(Services.prefs.getIntPref(WIDTH_PREF), panelWidth, "width pref updated - bug 674562");
       // isnot(Services.prefs.getIntPref(TOP_PREF), 50, "top location pref updated - bug 674562");
       // isnot(Services.prefs.getIntPref(LEFT_PREF), 51, "left location pref updated - bug 674562");
 
new file mode 100644
--- /dev/null
+++ b/browser/devtools/webconsole/test/browser/browser_webconsole_window_zombie.js
@@ -0,0 +1,45 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const TEST_URI = "data:text/html,<p>test for bug 577721";
+
+const POSITION_PREF = "devtools.webconsole.position";
+
+function test() {
+  addTab(TEST_URI);
+  browser.addEventListener("DOMContentLoaded", onLoad, false);
+  registerCleanupFunction(testEnd);
+}
+
+function testEnd() {
+  Services.prefs.clearUserPref(POSITION_PREF);
+}
+
+function onLoad() {
+  browser.removeEventListener("DOMContentLoaded", onLoad, false);
+
+  openConsole();
+
+  let hudId = HUDService.getHudIdByWindow(content);
+  let hudRef = HUDService.hudReferences[hudId];
+  let hudBox = hudRef.HUDBox;
+
+  // listen for the panel popupshown event.
+  document.addEventListener("popupshown", function popupShown() {
+    document.removeEventListener("popupshown", popupShown, false);
+
+    ok(hudRef.consolePanel, "console is in a panel");
+
+    document.addEventListener("popuphidden", function popupHidden() {
+      document.removeEventListener("popuphidden", popupHidden, false);
+      finishTest();
+    }, false);
+
+    // Close the window console via the menu item
+    let menu = document.getElementById("webConsole");
+    menu.click();
+  }, false);
+
+  hudRef.positionConsole("window");
+}
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -109,16 +109,17 @@ MOZ_PKG_MAC_EXTRA=--symlink "/Applicatio
 endif
 
 ifndef LIBXUL_SDK
 INSTALL_SDK = 1
 endif
 
 GENERATE_CACHE = 1
 
+include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 ifeq (bundle, $(MOZ_FS_LAYOUT))
 BINPATH = $(_BINPATH)
 DEFINES += -DAPPNAME=$(_APPNAME)
 else
 # Every other platform just winds up in dist/bin
 BINPATH = bin
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -133,17 +133,17 @@
 @BINPATH@/components/cookie.xpt
 @BINPATH@/components/directory.xpt
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_base.xpt
 #ifdef MOZ_B2G_RIL
 @BINPATH@/components/dom_telephony.xpt
-@BINPATH@/components/dom_telephony_worker.xpt
+@BINPATH@/components/dom_system_b2g.xpt
 #endif
 @BINPATH@/components/dom_battery.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_core.xpt
 @BINPATH@/components/dom_css.xpt
 @BINPATH@/components/dom_events.xpt
 @BINPATH@/components/dom_geolocation.xpt
 @BINPATH@/components/dom_notification.xpt
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -65,17 +65,17 @@ components/nsExtensionManager.js
 components/nsInterfaceInfoToIDL.js
 components/nsScriptableIO.js
 components/nsUrlClassifierTable.js
 components/nsXmlRpcClient.js
 components/pluginGlue.js
 components/sidebar.xpt
 #ifdef MOZ_B2G_RIL
 components/dom_telephony.xpt
-components/dom_telephony_worker.xpt
+components/dom_system_b2g.xpt
 #endif
 components/WeaveCrypto.js
 components/WeaveCrypto.manifest
 components/xmlextras.xpt
 components/xpcom.xpt
 components/xpti.dat
 components/xptitemp.dat
 components/nsMicrosummaryService.js
@@ -1137,17 +1137,17 @@ xpicleanup@BIN_SUFFIX@
   components/cookie.xpt
   components/crashreporter.xpt
   components/directory.xpt
   components/docshell.xpt
   components/dom.xpt
   components/dom_base.xpt
 #ifdef MOZ_B2G_RIL
   components/dom_telephony.xpt
-  components/dom_telephony_worker.xpt
+  components/dom_system_b2g.xpt
 #endif
   components/dom_canvas.xpt
   components/dom_core.xpt
   components/dom_css.xpt
   components/dom_events.xpt
   components/dom_geolocation.xpt
   components/dom_html.xpt
   components/dom_json.xpt
--- a/build/mobile/sutagent/android/DoCommand.java
+++ b/build/mobile/sutagent/android/DoCommand.java
@@ -132,17 +132,17 @@ public class DoCommand {
 
     String    currentDir = "/";
     String    sErrorPrefix = "##AGENT-WARNING## ";
     boolean bTraceOn = false;
 
     String ffxProvider = "org.mozilla.ffxcp";
     String fenProvider = "org.mozilla.fencp";
 
-    private final String prgVersion = "SUTAgentAndroid Version 1.02";
+    private final String prgVersion = "SUTAgentAndroid Version 1.03";
 
     public enum Command
         {
         RUN ("run"),
         EXEC ("exec"),
         ENVRUN ("envrun"),
         KILL ("kill"),
         PS ("ps"),
@@ -3144,19 +3144,25 @@ private void CancelNotification()
         theArgs[2] = "pm uninstall " + sApp + ";reboot;exit";
 
         try
             {
             pProc = Runtime.getRuntime().exec(theArgs);
 
             RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
             outThrd.start();
-            outThrd.join(60000);
-            int nRet = pProc.exitValue();
-            sRet = "\nuninst complete [" + nRet + "]";
+            try {
+                outThrd.join(60000);
+                int nRet = pProc.exitValue();
+                sRet = "\nuninst complete [" + nRet + "]";
+                }
+            catch (IllegalThreadStateException itse) {
+                itse.printStackTrace();
+                sRet = "\nuninst command timed out";
+                }
             }
         catch (IOException e)
             {
             sRet = e.getMessage();
             e.printStackTrace();
             }
         catch (InterruptedException e)
             {
@@ -3187,68 +3193,92 @@ private void CancelNotification()
             }
 
         try
             {
             pProc = Runtime.getRuntime().exec(theArgs);
 
             RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
             outThrd.start();
-            outThrd.join(90000);
-            int nRet = pProc.exitValue();
-            sRet = "\nmove complete [" + nRet + "]";
+            try {
+                outThrd.join(90000);
+                int nRet = pProc.exitValue();
+                sRet = "\nmove complete [" + nRet + "]";
+                }
+            catch (IllegalThreadStateException itse) {
+                itse.printStackTrace();
+                sRet = "\nmove command timed out";
+            }
             try
                 {
                 out.write(sRet.getBytes());
                 out.flush();
                 }
             catch (IOException e1)
                 {
                 e1.printStackTrace();
                 }
 
             theArgs[2] = "chmod 666 /data/local/tmp/" + srcFile.getName() + ";exit";
             pProc = Runtime.getRuntime().exec(theArgs);
             RedirOutputThread outThrd2 = new RedirOutputThread(pProc, out);
             outThrd2.start();
-            outThrd2.join(10000);
-            int nRet2 = pProc.exitValue();
-            sRet = "\npermission change complete [" + nRet2 + "]\n";
+            try {
+                outThrd2.join(10000);
+                int nRet2 = pProc.exitValue();
+                sRet = "\npermission change complete [" + nRet2 + "]\n";
+                }
+            catch (IllegalThreadStateException itse) {
+                itse.printStackTrace();
+                sRet = "\npermission change timed out";
+            }
             try {
                 out.write(sRet.getBytes());
                 out.flush();
                 }
             catch (IOException e1)
                 {
                 e1.printStackTrace();
                 }
 
             theArgs[2] = "pm install -r /data/local/tmp/" + srcFile.getName() + " Cleanup" + ";exit";
             pProc = Runtime.getRuntime().exec(theArgs);
             RedirOutputThread outThrd3 = new RedirOutputThread(pProc, out);
             outThrd3.start();
-            outThrd3.join(60000);
-            int nRet3 = pProc.exitValue();
-            sRet = "\ninstallation complete [" + nRet3 + "]";
+            try {
+                outThrd3.join(60000);
+                int nRet3 = pProc.exitValue();
+                sRet = "\ninstallation complete [" + nRet3 + "]";
+                }
+            catch (IllegalThreadStateException itse) {
+                itse.printStackTrace();
+                sRet = "\npm install command timed out";
+            }
             try {
                 out.write(sRet.getBytes());
                 out.flush();
                 }
             catch (IOException e1)
                 {
                 e1.printStackTrace();
                 }
 
             theArgs[2] = "rm /data/local/tmp/" + srcFile.getName() + ";exit";
             pProc = Runtime.getRuntime().exec(theArgs);
             RedirOutputThread outThrd4 = new RedirOutputThread(pProc, out);
             outThrd4.start();
-            outThrd4.join(60000);
-            int nRet4 = pProc.exitValue();
-            sRet = "\ntmp file removed [" + nRet4 + "]";
+            try {
+                outThrd4.join(60000);
+                int nRet4 = pProc.exitValue();
+                sRet = "\ntmp file removed [" + nRet4 + "]";
+                }
+            catch (IllegalThreadStateException itse) {
+                itse.printStackTrace();
+                sRet = "\nrm command timed out";
+            }
             try {
                 out.write(sRet.getBytes());
                 out.flush();
                 }
             catch (IOException e1)
                 {
                 e1.printStackTrace();
                 }
@@ -3436,38 +3466,57 @@ private void CancelNotification()
         else
             {
             prgIntent.setAction(Intent.ACTION_MAIN);
             }
 
         try
             {
             contextWrapper.startActivity(prgIntent);
+            FindProcThread findProcThrd = new FindProcThread(contextWrapper, sArgs[0]);
+            findProcThrd.start();
+            findProcThrd.join(7000);
+            if (!findProcThrd.bFoundIt && !findProcThrd.bStillRunning) {
+                sRet = "Unable to start " + sArgs[0] + "";
+                }
             }
         catch(ActivityNotFoundException anf)
             {
             anf.printStackTrace();
             }
+        catch (InterruptedException e) {
+            e.printStackTrace();
+        }
 
         ctx = null;
         return (sRet);
         }
 
     public String StartPrg(String [] progArray, OutputStream out)
         {
         String sRet = "";
+        int    lcv = 0;
 
         try
             {
             pProc = Runtime.getRuntime().exec(progArray);
             RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
             outThrd.start();
-            outThrd.join(10000);
-            int nRetCode = pProc.exitValue();
-            sRet = "return code [" + nRetCode + "]";
+            while (lcv < 30) {
+                try {
+                    outThrd.join(10000);
+                    int nRetCode = pProc.exitValue();
+                    sRet = "return code [" + nRetCode + "]";
+                    break;
+                    }
+                catch (IllegalThreadStateException itse) {
+                    lcv++;
+                    itse.printStackTrace();
+                    }
+                }
             }
         catch (IOException e)
             {
             e.printStackTrace();
             }
         catch (InterruptedException e)
             {
             e.printStackTrace();
@@ -3566,19 +3615,31 @@ private void CancelNotification()
                 }
 
             if (theArgs[0].contains("/") || theArgs[0].contains("\\") || !theArgs[0].contains("."))
                 {
                 pProc = Runtime.getRuntime().exec(theArgs, envArray);
 
                 RedirOutputThread outThrd = new RedirOutputThread(pProc, out);
                 outThrd.start();
-                outThrd.join(10000);
-                int nRetCode = pProc.exitValue();
-                sRet = "return code [" + nRetCode + "]";
+
+                lcv = 0;
+
+                while (lcv < 30) {
+                    try {
+                        outThrd.join(10000);
+                        int nRetCode = pProc.exitValue();
+                        sRet = "return code [" + nRetCode + "]";
+                        lcv = 30;
+                        }
+                    catch (IllegalThreadStateException itse) {
+                        lcv++;
+                        itse.printStackTrace();
+                        }
+                    }
                 }
             else
                 {
                 Intent preIntent = new Intent();
                 for (lcv = 0; lcv < envArray.length; lcv++)
                     {
                     preIntent.putExtra("env" + lcv, envArray[lcv]);
                     }
@@ -3667,15 +3728,16 @@ private void CancelNotification()
             "clok                         - the current device time expressed as the" +
             "                               number of millisecs since epoch\n" +
             "settime date time            - sets the device date and time\n" +
             "                               (YYYY/MM/DD HH:MM:SS)\n" +
             "tzset timezone               - sets the device timezone format is\n" +
             "                               GMTxhh:mm x = +/- or a recognized Olsen string\n" +
             "tzget                        - returns the current timezone set on the device\n" +
             "rebt                         - reboot device\n" +
+            "adb ip|usb                   - set adb to use tcp/ip on port 5555 or usb\n" +
             "quit                         - disconnect SUTAgent\n" +
             "exit                         - close SUTAgent\n" +
             "ver                          - SUTAgent version\n" +
             "help                         - you're reading it";
         return (sRet);
         }
 }
new file mode 100644
--- /dev/null
+++ b/build/mobile/sutagent/android/FindProcThread.java
@@ -0,0 +1,100 @@
+/* ***** 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 Android SUTAgent code.
+ *
+ * The Initial Developer of the Original Code is
+ * Bob Moss.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  Bob Moss <bmoss@mozilla.com>
+ * 
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+package com.mozilla.SUTAgentAndroid.service;
+
+import java.util.List;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.ContextWrapper;
+
+public class FindProcThread extends Thread {
+    ContextWrapper    contextWrapper = null;
+    String sProcNameToFind = "";
+    boolean bFoundIt = false;
+    boolean bStillRunning = true;
+
+    public FindProcThread(ContextWrapper ctx, String sProcessName) {
+        this.contextWrapper = ctx;
+        this.sProcNameToFind = sProcessName;
+        this.bFoundIt = false;
+    }
+
+    public void run() {
+        ActivityManager aMgr = (ActivityManager) contextWrapper.getSystemService(Activity.ACTIVITY_SERVICE);
+        List <ActivityManager.RunningAppProcessInfo> lProcesses;
+        int lcv = 0;
+        int nNumLoops = 0;
+        String strProcName = "";
+        int    nPID = 0;
+
+        if (aMgr == null)
+            return;
+
+
+        // While we are still looping looking for the process in the list and we haven't found it
+        while (bStillRunning && !bFoundIt) {
+            lProcesses = aMgr.getRunningAppProcesses();
+            if (lProcesses != null) {
+                for (lcv = 0; lcv < lProcesses.size(); lcv++) {
+                    if (lProcesses.get(lcv).processName.contains(sProcNameToFind)) {
+                        strProcName = lProcesses.get(lcv).processName;
+                        nPID = lProcesses.get(lcv).pid;
+                        bFoundIt = true;
+                        break;
+                    }
+                }
+                if (bFoundIt)             // This saves you half a second of wait time if we've found it in the list
+                    continue;
+            }
+            try {
+                Thread.sleep(500);         // Sleep half a second
+                if (++nNumLoops > 10) { // loop up to 10 times
+                    bStillRunning = false;
+                }
+                lProcesses = null;
+                System.gc();
+                Thread.yield();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                bStillRunning = false;
+            }
+        }
+    }
+
+}
--- a/build/mobile/sutagent/android/Makefile.in
+++ b/build/mobile/sutagent/android/Makefile.in
@@ -46,16 +46,17 @@ MODULE = sutAgentAndroid
 
 JAVAFILES = \
   AlertLooperThread.java \
   ASMozStub.java \
   CmdWorkerThread.java \
   DataWorkerThread.java \
   DoAlert.java \
   DoCommand.java \
+  FindProcThread.java \
   NtpMessage.java \
   Power.java \
   RedirOutputThread.java \
   RunCmdThread.java \
   RunDataThread.java \
   SUTAgentAndroid.java \
   SUTStartupIntentReceiver.java \
   WifiConfiguration.java \
--- a/build/unix/mozconfig.linux
+++ b/build/unix/mozconfig.linux
@@ -1,2 +1,2 @@
-CC=/tools/gcc-4.5-0moz2/bin/gcc
-CXX=/tools/gcc-4.5-0moz2/bin/g++
+CC=/tools/gcc-4.5-0moz3/bin/gcc
+CXX=/tools/gcc-4.5-0moz3/bin/g++
--- a/chrome/src/nsChromeRegistry.h
+++ b/chrome/src/nsChromeRegistry.h
@@ -57,16 +57,17 @@
 #include "nsTHashtable.h"
 #include "nsURIHashKey.h"
 #include "nsInterfaceHashtable.h"
 #include "nsXULAppAPI.h"
 #include "nsIResProtocolHandler.h"
 #include "nsIXPConnect.h"
 
 #include "mozilla/Omnijar.h"
+#include "mozilla/FileLocation.h"
 
 class nsIDOMWindow;
 class nsIURL;
 
 // The chrome registry is actually split between nsChromeRegistryChrome and
 // nsChromeRegistryContent. The work/data that is common to both resides in
 // the shared nsChromeRegistry implementation, with operations that only make
 // sense for one side erroring out in the other.
@@ -134,39 +135,31 @@ protected:
   static nsresult GetProviderAndPath(nsIURL* aChromeURL,
                                      nsACString& aProvider, nsACString& aPath);
 
 public:
   static already_AddRefed<nsChromeRegistry> GetSingleton();
 
   struct ManifestProcessingContext
   {
-    ManifestProcessingContext(NSLocationType aType, nsILocalFile* aFile)
+    ManifestProcessingContext(NSLocationType aType, mozilla::FileLocation &aFile)
       : mType(aType)
       , mFile(aFile)
-      , mPath(NULL)
-    { }
-
-    ManifestProcessingContext(NSLocationType aType, nsILocalFile* aFile, const char* aPath)
-      : mType(aType)
-      , mFile(aFile)
-      , mPath(aPath)
     { }
 
     ~ManifestProcessingContext()
     { }
 
     nsIURI* GetManifestURI();
     nsIXPConnect* GetXPConnect();
 
     already_AddRefed<nsIURI> ResolveURI(const char* uri);
 
     NSLocationType mType;
-    nsILocalFile* mFile;
-    const char* mPath;
+    mozilla::FileLocation mFile;
     nsCOMPtr<nsIURI> mManifestURI;
     nsCOMPtr<nsIXPConnect> mXPConnect;
   };
 
   virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
                                char *const * argv, bool platform,
                                bool contentaccessible) = 0;
   virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -783,37 +783,19 @@ nsChromeRegistryChrome::GetXULOverlays(n
   return NS_NewArrayEnumerator(aResult, *parray);
 }
 #endif // MOZ_XUL
 
 nsIURI*
 nsChromeRegistry::ManifestProcessingContext::GetManifestURI()
 {
   if (!mManifestURI) {
-    nsCOMPtr<nsIIOService> io = mozilla::services::GetIOService();
-    if (!io) {
-      NS_WARNING("No IO service trying to process chrome manifests");
-      return NULL;
-    }
-
-    if (mPath) {
-      nsCOMPtr<nsIURI> fileURI;
-      io->NewFileURI(mFile, getter_AddRefs(fileURI));
-
-      nsCAutoString spec;
-      fileURI->GetSpec(spec);
-      spec.Insert(NS_LITERAL_CSTRING("jar:"), 0);
-      spec.AppendLiteral("!/");
-      spec.Append(mPath);
-
-      NS_NewURI(getter_AddRefs(mManifestURI), spec, NULL, NULL, io);
-    }
-    else {
-      io->NewFileURI(mFile, getter_AddRefs(mManifestURI));
-    }
+    nsCString uri;
+    mFile.GetURIString(uri);
+    NS_NewURI(getter_AddRefs(mManifestURI), uri);
   }
   return mManifestURI;
 }
 
 nsIXPConnect*
 nsChromeRegistry::ManifestProcessingContext::GetXPConnect()
 {
   if (!mXPConnect)
--- a/client.mk
+++ b/client.mk
@@ -205,17 +205,17 @@ everything: clean build
 ifdef MOZ_OBJDIR
   PGO_OBJDIR = $(MOZ_OBJDIR)
 else
   PGO_OBJDIR := $(TOPSRCDIR)
 endif
 
 profiledbuild::
 	$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
-	$(MAKE) -C $(PGO_OBJDIR) package
+	$(MAKE) -C $(PGO_OBJDIR) stage-package
 	OBJDIR=${PGO_OBJDIR} JARLOG_DIR=${PGO_OBJDIR}/jarlog/en-US $(PROFILE_GEN_SCRIPT)
 	$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
 	$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
 
 #####################################################
 # Build date unification
 
 ifdef MOZ_UNIFY_BDATE
--- a/configure.in
+++ b/configure.in
@@ -7274,17 +7274,17 @@ AC_SUBST(WIN32_CRT_LIBS)
 dnl Need to set this for make because NSS doesn't have configure
 AC_SUBST(DLLFLAGS)
 
 dnl We need to wrap dlopen and related functions on Android because we use
 dnl our own linker.
 if test "$OS_TARGET" = Android; then
     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozutils"
     if test "$MOZ_WIDGET_TOOLKIT" = android; then
-        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
+        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
     fi
 fi
 
 dnl ========================================================
 dnl = Use malloc wrapper lib
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -129,16 +129,25 @@ public:
    */
   void UpdateState(bool aNotify);
   
   /**
    * Method to update mState with link state information.  This does not notify.
    */
   void UpdateLinkState(nsEventStates aState);
 
+  /**
+   * Returns true if this element is either a full-screen element or an
+   * ancestor of the full-screen element.
+   */
+  bool IsFullScreenAncestor() const {
+    return mState.HasAtLeastOneOfStates(NS_EVENT_STATE_FULL_SCREEN_ANCESTOR |
+                                        NS_EVENT_STATE_FULL_SCREEN);
+  }
+
 protected:
   /**
    * Method to get the _intrinsic_ content state of this element.  This is the
    * state that is independent of the element's presentation.  To get the full
    * content state, use State().  See nsEventStates.h for
    * the possible bits that could be set here.
    */
   virtual nsEventStates IntrinsicState() const;
--- a/content/base/public/nsContentPolicyUtils.h
+++ b/content/base/public/nsContentPolicyUtils.h
@@ -134,16 +134,17 @@ NS_CP_ContentTypeName(PRUint32 contentTy
     CASE_RETURN( TYPE_REFRESH           );
     CASE_RETURN( TYPE_XBL               );
     CASE_RETURN( TYPE_PING              );
     CASE_RETURN( TYPE_XMLHTTPREQUEST    );
     CASE_RETURN( TYPE_OBJECT_SUBREQUEST );
     CASE_RETURN( TYPE_DTD               );
     CASE_RETURN( TYPE_FONT              );
     CASE_RETURN( TYPE_MEDIA             );
+    CASE_RETURN( TYPE_WEBSOCKET         );
    default:
     return "<Unknown Type>";
   }
 }
 
 #endif // defined(PR_LOGGING)
 
 #undef CASE_RETURN
--- a/content/base/public/nsIContent.h
+++ b/content/base/public/nsIContent.h
@@ -319,18 +319,17 @@ public:
     return IsInNamespace(kNameSpaceID_XHTML);
   }
 
   inline bool IsHTML(nsIAtom* aTag) const {
     return mNodeInfo->Equals(aTag, kNameSpaceID_XHTML);
   }
 
   inline bool IsSVG() const {
-    /* Some things in the SVG namespace are not in fact SVG elements */
-    return IsNodeOfType(eSVG);
+    return IsInNamespace(kNameSpaceID_SVG);
   }
 
   inline bool IsXUL() const {
     return IsInNamespace(kNameSpaceID_XUL);
   }
 
   inline bool IsMathML() const {
     return IsInNamespace(kNameSpaceID_MathML);
--- a/content/base/public/nsIContentPolicy.idl
+++ b/content/base/public/nsIContentPolicy.idl
@@ -132,16 +132,21 @@ interface nsIContentPolicy : nsISupports
    */
   const unsigned long TYPE_FONT = 14;
 
   /**
    * Indicates a video or audio load.
    */
   const unsigned long TYPE_MEDIA = 15;  
 
+  /**
+   * Indicates a WebSocket load.
+   */
+  const unsigned long TYPE_WEBSOCKET = 16;
+
   /* Please update nsContentBlocker when adding new content types. */
 
   //////////////////////////////////////////////////////////////////////
 
   /**
    * Returned from shouldLoad or shouldProcess if the load or process request
    * is rejected based on details of the request.
    */
deleted file mode 100644
--- a/content/base/public/nsIDOMGCParticipant.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsIDOMGCParticipant_h_
-#define nsIDOMGCParticipant_h_
-
-#include "nsISupports.h"
-
-template<class E> class nsCOMArray;
-
-// 0e2a5a8d-28fd-4a5c-8bf1-5b0067ff3286
-#define NS_IDOMGCPARTICIPANT_IID \
-{ 0x0e2a5a8d, 0x28fd, 0x4a5c, \
-  {0x8b, 0xf1, 0x5b, 0x00, 0x67, 0xff, 0x32, 0x86} }
-
-/**
- * DOM GC Participants are objects that expose information about
- * reachability in the native object graphs to help prevent script ->
- * native -> script cyclical reference from causing leaks due to the
- * creation of garbage collection roots and native/script boundaries.
- *
- * Some implementations of nsIDOMGCParticipant may be responsible for
- * enforcing the requirement that callers of
- * |nsDOMClassInfo::PreserveWrapper| must call
- * |nsDOMClassInfo::ReleaseWrapper| before the nsIDOMGCParticipant
- * argument to the former is destroyed.
- */
-class nsIDOMGCParticipant : public nsISupports
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMGCPARTICIPANT_IID)
-
-  /**
-   * Get a reference node for what is known to be a strongly connected
-   * component of nsIDOMGCParticipants.  For example, DOM trees are
-   * strongly connected, so can return the root node to greatly reduce
-   * the number of nodes on which we need to run graph algorithms.
-   *
-   * Note that it's acceptable for nodes in a single strongly connected
-   * component to return different values for GetSCCIndex, as long as
-   * those two values claim that they're reachable from each other in
-   * AppendReachableList.
-   */
-  virtual nsIDOMGCParticipant* GetSCCIndex() = 0;
-
-  /**
-   * Append the list of nsIDOMGCPartipants reachable from this one via
-   * C++ getters exposed to script that return a different result from
-   * |GetSCCIndex|.  The caller is responsible for taking the transitive
-   * closure of |AppendReachableList|.
-   *
-   * This will only be called on objects that are returned by GetSCCIndex.
-   *
-   * null pointers may be appended; they will be ignored by the caller.
-   */
-  virtual void AppendReachableList(nsCOMArray<nsIDOMGCParticipant>& aArray) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMGCParticipant, NS_IDOMGCPARTICIPANT_IID)
-
-#endif // !defined(nsIDOMGCParticipant_h_)
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -119,18 +119,19 @@ class Loader;
 
 namespace dom {
 class Link;
 class Element;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_IDOCUMENT_IID \
-{ 0x3b78f6, 0x6dc5, 0x44c6, \
-  { 0xbc, 0x28, 0x60, 0x2a, 0xb2, 0x4f, 0xfb, 0x7b } }
+{ 0x283ec27d, 0x5b23, 0x49b2, \
+  { 0x94, 0xd9, 0x9, 0xb5, 0xdb, 0x45, 0x30, 0x73 } }
+
 
 // Flag for AddStyleSheet().
 #define NS_STYLESHEET_FROM_CATALOG                (1 << 0)
 
 // Enum for requesting a particular type of document when creating a doc
 enum DocumentFlavor {
   DocumentFlavorLegacyGuess, // compat with old code until made HTML5-compliant
   DocumentFlavorHTML, // HTMLDocument with HTMLness bit set to true
@@ -747,31 +748,41 @@ public:
    * contains the element which requested DOM full-screen mode if the
    * requestee is in a subdocument. Note this element must be *in*
    * this document.
    */
   virtual Element* GetFullScreenElement() = 0;
 
   /**
    * Asynchronously requests that the document make aElement the full-screen
-   * element, and move into full-screen mode.
+   * element, and move into full-screen mode. The current full-screen element
+   * (if any) is pushed onto the full-screen element stack, and it can be
+   * returned to full-screen status by calling RestorePreviousFullScreenState().
    */
   virtual void AsyncRequestFullScreen(Element* aElement) = 0;
 
   /**
-   * Requests that the document, and all documents in its hierarchy exit
-   * from DOM full-screen mode.
+   * Restores the previous full-screen element to full-screen status. If there
+   * is no former full-screen element, this exits full-screen, moving the
+   * top-level browser window out of full-screen mode.
    */
-  virtual void CancelFullScreen() = 0;
+  virtual void RestorePreviousFullScreenState() = 0;
 
   /**
    * Returns true if this document is in full-screen mode.
    */
   virtual bool IsFullScreenDoc() = 0;
 
+  /**
+   * Exits all documents from DOM full-screen mode, and moves the top-level
+   * browser window out of full-screen mode. If aRunAsync is true, this runs
+   * asynchronously.
+   */
+  static void ExitFullScreen(bool aRunAsync);
+
   //----------------------------------------------------------------------
 
   // Document notification API's
 
   /**
    * Add a new observer of document change notifications. Whenever
    * content is changed, appended, inserted or removed the observers are
    * informed.  An observer that is already observing the document must
@@ -1513,17 +1524,19 @@ public:
    * Lookup an image element using its associated ID, which is usually provided
    * by |-moz-element()|. Similar to GetElementById, with the difference that
    * elements set using mozSetImageElement have higher priority.
    * @param aId the ID associated the element we want to lookup
    * @return the element associated with |aId|
    */
   virtual Element* LookupImageElement(const nsAString& aElementId) = 0;
 
-  void ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback);
+  nsresult ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback,
+                                        PRInt32 *aHandle);
+  void CancelFrameRequestCallback(PRInt32 aHandle);
 
   typedef nsTArray< nsCOMPtr<nsIFrameRequestCallback> > FrameRequestCallbackList;
   /**
    * Put this document's frame request callbacks into the provided
    * list, and forget about them.
    */
   void TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks);
 
@@ -1794,23 +1807,52 @@ protected:
   PRUint32 mEventsSuppressed;
 
   /**
    * The number number of external scripts (ones with the src attribute) that
    * have this document as their owner and that are being evaluated right now.
    */
   PRUint32 mExternalScriptsBeingEvaluated;
 
+  /**
+   * The current frame request callback handle
+   */
+  PRInt32 mFrameRequestCallbackCounter;
+
   // Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow,
   // updated on every set of mSecriptGlobalObject.
   nsPIDOMWindow *mWindow;
 
   nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
 
-  FrameRequestCallbackList mFrameRequestCallbacks;
+  struct FrameRequest {
+    FrameRequest(nsIFrameRequestCallback* aCallback,
+                 PRInt32 aHandle) :
+      mCallback(aCallback),
+      mHandle(aHandle)
+    {}
+
+    // Conversion operator so that we can append these to a
+    // FrameRequestCallbackList
+    operator nsIFrameRequestCallback* const () const { return mCallback; }
+
+    // Comparator operators to allow RemoveElementSorted with an
+    // integer argument on arrays of FrameRequest
+    bool operator==(PRInt32 aHandle) const {
+      return mHandle == aHandle;
+    }
+    bool operator<(PRInt32 aHandle) const {
+      return mHandle < aHandle;
+    }
+    
+    nsCOMPtr<nsIFrameRequestCallback> mCallback;
+    PRInt32 mHandle;
+  };
+
+  nsTArray<FrameRequest> mFrameRequestCallbacks;
 
   // This object allows us to evict ourself from the back/forward cache.  The
   // pointer is non-null iff we're currently in the bfcache.
   nsIBFCacheEntry *mBFCacheEntry;
 
   // Our base target.
   nsString mBaseTarget;
 
--- a/content/base/public/nsIEventSource.idl
+++ b/content/base/public/nsIEventSource.idl
@@ -46,27 +46,32 @@
 
 #include "nsISupports.idl"
 
 interface nsIDOMEventListener;
 interface nsIPrincipal;
 interface nsIScriptContext;
 interface nsPIDOMWindow;
 
-[scriptable, uuid(755e2d2d-a836-4539-83f4-16b51156341f)]
+[scriptable, uuid(a3d3181e-47c1-4f2e-b2c7-94775a86f5c5)]
 interface nsIEventSource : nsISupports
 {
   readonly attribute DOMString url;
 
   // ready state
   const unsigned short CONNECTING = 0;
   const unsigned short OPEN = 1;
   const unsigned short CLOSED = 2;
   readonly attribute long readyState;
 
+  // if true then cross-site Access-Control requests are made using credentials
+  // such as cookies and authorization headers. Never affects same-site
+  // requests.
+  readonly attribute boolean withCredentials;
+
   // event handler attributes
   attribute nsIDOMEventListener onopen;
   attribute nsIDOMEventListener onmessage;
   attribute nsIDOMEventListener onerror;
 
   /**
    * Close the connection, if any, and set the readyState attribute to CLOSED.
    * If the connection is already closed, the method does nothing.
@@ -78,14 +83,19 @@ interface nsIEventSource : nsISupports
    * context, and owner window that should be used.
    *
    * @param principal The principal to use for the request. This must not be
    *                  null.
    * @param scriptContext The script context to use for the request. May be
    *                      null.
    * @param ownerWindow The associated window for the request. May be null.
    * @param url The EventSource's url. This must not be empty.
+   * @param withCredentials When set to true attempts to make cross-site
+   *                        Access-Control requests with credentials such as
+   *                        cookies and authorization headers. Never affects
+   *                        same-site requests.
    */
   [noscript] void init(in nsIPrincipal principal,
                        in nsIScriptContext scriptContext,
                        in nsPIDOMWindow ownerWindow,
-                       in DOMString url);
+                       in DOMString url,
+                       in boolean withCredentials);
 };
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -339,27 +339,25 @@ public:
     /** text nodes */
     eTEXT                = 1 << 3,
     /** xml processing instructions */
     ePROCESSING_INSTRUCTION = 1 << 4,
     /** comment nodes */
     eCOMMENT             = 1 << 5,
     /** form control elements */
     eHTML_FORM_CONTROL   = 1 << 6,
-    /** svg elements */
-    eSVG                 = 1 << 7,
     /** document fragments */
-    eDOCUMENT_FRAGMENT   = 1 << 8,
+    eDOCUMENT_FRAGMENT   = 1 << 7,
     /** data nodes (comments, PIs, text). Nodes of this type always
      returns a non-null value for nsIContent::GetText() */
-    eDATA_NODE           = 1 << 19,
+    eDATA_NODE           = 1 << 8,
     /** nsHTMLMediaElement */
-    eMEDIA               = 1 << 10,
+    eMEDIA               = 1 << 9,
     /** animation elements */
-    eANIMATION           = 1 << 11
+    eANIMATION           = 1 << 10
   };
 
   /**
    * API for doing a quick check if a content is of a given
    * type, such as Text, Document, Comment ...  Use this when you can instead of
    * checking the tag.
    *
    * @param aFlags what types you want to test for (see above)
--- a/content/base/src/FileIOObject.cpp
+++ b/content/base/src/FileIOObject.cpp
@@ -83,22 +83,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 FileIOObject::FileIOObject()
   : mProgressEventWasDelayed(false),
     mTimerIsActive(false),
     mReadyState(0),
     mTotal(0), mTransferred(0)
 {}
 
-FileIOObject::~FileIOObject()
-{
-  if (mListenerManager)
-    mListenerManager->Disconnect();
-}
-
 void
 FileIOObject::StartProgressEventTimer()
 {
   if (!mProgressNotifier) {
     mProgressNotifier = do_CreateInstance(NS_TIMER_CONTRACTID);
   }
   if (mProgressNotifier) {
     mProgressEventWasDelayed = false;
--- a/content/base/src/FileIOObject.h
+++ b/content/base/src/FileIOObject.h
@@ -58,17 +58,16 @@ extern const PRUint64 kUnknownSize;
 // A common base class for FileReader and FileSaver
 
 class FileIOObject : public nsDOMEventTargetWrapperCache,
                      public nsIStreamListener,
                      public nsITimerCallback
 {
 public:
   FileIOObject();
-  ~FileIOObject();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Common methods
   NS_METHOD Abort();
   NS_METHOD GetReadyState(PRUint16* aReadyState);
   NS_METHOD GetError(nsIDOMFileError** aError);
 
--- a/content/base/src/contentSecurityPolicy.js
+++ b/content/base/src/contentSecurityPolicy.js
@@ -97,16 +97,17 @@ function ContentSecurityPolicy() {
   csp._MAPPINGS[cp.TYPE_IMAGE]             = cspr_sd.IMG_SRC;
   csp._MAPPINGS[cp.TYPE_STYLESHEET]        = cspr_sd.STYLE_SRC;
   csp._MAPPINGS[cp.TYPE_OBJECT]            = cspr_sd.OBJECT_SRC;
   csp._MAPPINGS[cp.TYPE_OBJECT_SUBREQUEST] = cspr_sd.OBJECT_SRC;
   csp._MAPPINGS[cp.TYPE_SUBDOCUMENT]       = cspr_sd.FRAME_SRC;
   csp._MAPPINGS[cp.TYPE_MEDIA]             = cspr_sd.MEDIA_SRC;
   csp._MAPPINGS[cp.TYPE_FONT]              = cspr_sd.FONT_SRC;
   csp._MAPPINGS[cp.TYPE_XMLHTTPREQUEST]    = cspr_sd.XHR_SRC;
+  csp._MAPPINGS[cp.TYPE_WEBSOCKET]         = cspr_sd.XHR_SRC;
 
 
   /* These must go through the catch-all */
   csp._MAPPINGS[cp.TYPE_XBL]               = cspr_sd.DEFAULT_SRC;
   csp._MAPPINGS[cp.TYPE_PING]              = cspr_sd.DEFAULT_SRC;
   csp._MAPPINGS[cp.TYPE_DTD]               = cspr_sd.DEFAULT_SRC;
 }
 
--- a/content/base/src/nsCSPService.cpp
+++ b/content/base/src/nsCSPService.cpp
@@ -50,16 +50,18 @@
 #include "nsIChannelEventSink.h"
 #include "nsIPropertyBag2.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsNetError.h"
 #include "nsChannelProperties.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 #include "mozilla/Preferences.h"
+#include "nsIScriptError.h"
+#include "nsContentUtils.h"
 
 using namespace mozilla;
 
 /* Keeps track of whether or not CSP is enabled */
 bool CSPService::sCSPEnabled = true;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gCspPRLog;
@@ -279,15 +281,33 @@ CSPService::AsyncOnChannelRedirect(nsICh
   if (aDecision != 1) {
     autoCallback.DontCallback();
     return NS_BINDING_FAILED;
   }
 
   // the redirect is permitted, so propagate the Content Security Policy
   // and load type to the redirecting channel
   nsresult rv;
-  nsCOMPtr<nsIWritablePropertyBag2> props2 = do_QueryInterface(newChannel, &rv);
-  if (props2)
-    props2->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
-                                   channelPolicy);
+  nsCOMPtr<nsIWritablePropertyBag2> props2 = do_QueryInterface(newChannel);
+  if (props2) {
+    rv = props2->SetPropertyAsInterface(NS_CHANNEL_PROP_CHANNEL_POLICY,
+                                        channelPolicy);
+    if (NS_SUCCEEDED(rv)) {
+      return NS_OK;
+    }
+  }
 
-  return NS_OK;
+  // The redirecting channel isn't a writable property bag, we won't be able
+  // to enforce the load policy if it redirects again, so we stop it now.
+  nsXPIDLString message;
+  nsCAutoString newUriSpec;
+  newUri->GetSpec(newUriSpec);
+  const PRUnichar *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
+  if (NS_SUCCEEDED(rv)) {
+    nsContentUtils::ReportToConsole(nsContentUtils::eDOM_PROPERTIES,
+                                   "InvalidRedirectChannelWarning",
+                                    formatParams, 1, nsnull, EmptyString(),
+                                    0, 0, nsIScriptError::warningFlag,
+                                    "Redirect Error");
+  }
+
+  return NS_BINDING_FAILED;
 }
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -525,17 +525,17 @@ nsContentUtils::InitializeEventTable() {
   static const EventNameMapping eventArray[] = {
 #define EVENT(name_,  _id, _type, _struct)          \
     { nsGkAtoms::on##name_, _id, _type, _struct },
 #define WINDOW_ONLY_EVENT EVENT
 #define NON_IDL_EVENT EVENT
 #include "nsEventNameList.h"
 #undef WINDOW_ONLY_EVENT
 #undef EVENT
-    nsnull
+    { nsnull }
   };
 
   sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>;
   sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>;
   sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
 
   if (!sAtomEventTable || !sStringEventTable || !sUserDefinedEvents ||
       !sAtomEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1) ||
@@ -573,17 +573,17 @@ nsContentUtils::InitializeTouchEventTabl
     sEventTableInitialized = true;
     static const EventNameMapping touchEventArray[] = {
 #define EVENT(name_,  _id, _type, _struct)
 #define TOUCH_EVENT(name_,  _id, _type, _struct)      \
       { nsGkAtoms::on##name_, _id, _type, _struct },
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef EVENT
-      nsnull
+      { nsnull }
     };
     // Subtract one from the length because of the trailing null
     for (PRUint32 i = 0; i < ArrayLength(touchEventArray) - 1; ++i) {
       if (!sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]) ||
           !sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
                                   touchEventArray[i])) {
         delete sAtomEventTable;
         sAtomEventTable = nsnull;
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -1533,17 +1533,16 @@ nsDOMImplementation::CreateHTMLDocument(
 // ==================================================================
 
   // NOTE! nsDocument::operator new() zeroes out all members, so don't
   // bother initializing members to 0.
 
 nsDocument::nsDocument(const char* aContentType)
   : nsIDocument()
   , mAnimatingImages(true)
-  , mIsFullScreen(false)
   , mVisibilityState(eHidden)
 {
   SetContentTypeInternal(nsDependentCString(aContentType));
   
 #ifdef PR_LOGGING
   if (!gDocumentLeakPRLog)
     gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
 
@@ -1868,17 +1867,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLayoutHistoryState)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOnloadBlocker)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mImageMaps,
                                                        nsIDOMNodeList)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOriginalDocument)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedEncoder)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFullScreenElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mStateObjectCached)
 
   // Traverse all our nsCOMArrays.
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mStyleSheets)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mCatalogSheets)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mPreloadingImages)
 
   for (PRUint32 i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
@@ -1923,17 +1921,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mXPathEvaluatorTearoff)
   tmp->mCachedRootElement = nsnull; // Avoid a dangling pointer
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDisplayDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mImageMaps)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFullScreenElement)
 
   tmp->mParentDocument = nsnull;
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mPreloadingImages)
 
   
   if (tmp->mBoxObjectTable) {
    tmp->mBoxObjectTable->EnumerateRead(ClearAllBoxObjects, nsnull);
@@ -7299,31 +7296,16 @@ nsDocument::OnPageShow(bool aPersisted,
 static bool
 NotifyPageHide(nsIDocument* aDocument, void* aData)
 {
   const bool* aPersistedPtr = static_cast<const bool*>(aData);
   aDocument->OnPageHide(*aPersistedPtr, nsnull);
   return true;
 }
 
-static bool
-SetFullScreenState(nsIDocument* aDoc, Element* aElement, bool aIsFullScreen);
-
-static void
-SetWindowFullScreen(nsIDocument* aDoc, bool aValue);
-
-static bool
-ResetFullScreen(nsIDocument* aDocument, void* aData) {
-  if (aDocument->IsFullScreenDoc()) {
-    ::SetFullScreenState(aDocument, nsnull, false);
-    aDocument->EnumerateSubDocuments(ResetFullScreen, nsnull);
-  }
-  return true;
-}
-
 void
 nsDocument::OnPageHide(bool aPersisted,
                        nsIDOMEventTarget* aDispatchStartTarget)
 {
   // Send out notifications that our <link> elements are detached,
   // but only if this is not a full unload.
   Element* root = GetRootElement();
   if (aPersisted && root) {
@@ -7368,33 +7350,25 @@ nsDocument::OnPageHide(bool aPersisted,
   
   EnumerateExternalResources(NotifyPageHide, &aPersisted);
   EnumerateFreezableElements(NotifyActivityChanged, nsnull);
 
   if (IsFullScreenDoc()) {
     // A full-screen doc has been hidden. We need to ensure we exit
     // full-screen, i.e. remove full-screen state from all full-screen
     // documents, and exit the top-level window from full-screen mode.
-    // Unfortunately by the time a doc is hidden, it has been removed
-    // from the doc tree, so we can't just call CancelFullScreen()...
-
-    // So firstly reset full-screen state in *this* document. OnPageHide()
-    // is called in every hidden document, so doing this ensures all hidden
-    // documents have their state reset.
-    ::SetFullScreenState(this, nsnull, false);
-
-    // Next walk the document tree of still visible documents, and reset
-    // their full-screen state. We then move the top-level window out
-    // of full-screen mode.
-    nsCOMPtr<nsIDocument> fullScreenRoot(do_QueryReferent(sFullScreenRootDoc));
-    if (fullScreenRoot) {
-      fullScreenRoot->EnumerateSubDocuments(ResetFullScreen, nsnull);
-      SetWindowFullScreen(fullScreenRoot, false);
-      sFullScreenRootDoc = nsnull;
-    }
+    // By the time a doc is hidden, it has been removed from the doc tree,
+    // so nsIDocument::ExitFullScreen() won't be able to traverse to this
+    // document to reset its state, so reset full-screen state in *this*
+    // document. OnPageHide() is called in every hidden document, so doing
+    // this ensures all hidden documents have their full-screen state reset.
+    ClearFullScreenStack();
+
+    // Next reset full-screen state in all visible documents in the doctree.
+    nsIDocument::ExitFullScreen(false);
   }
 }
 
 void
 nsDocument::WillDispatchMutationEvent(nsINode* aTarget)
 {
   NS_ASSERTION(mSubtreeModifiedDepth != 0 ||
                mSubtreeModifiedTargets.Count() == 0,
@@ -8062,25 +8036,48 @@ nsIDocument::CreateStaticClone(nsISuppor
         }
       }
     }
   }
   mCreatingStaticClone = false;
   return clonedDoc.forget();
 }
 
-void
-nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback)
-{
+nsresult
+nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback,
+                                          PRInt32 *aHandle)
+{
+  if (mFrameRequestCallbackCounter == PR_INT32_MAX) {
+    // Can't increment without overflowing; bail out
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  PRInt32 newHandle = ++mFrameRequestCallbackCounter;
+
   bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
-  if (mFrameRequestCallbacks.AppendElement(aCallback) &&
-      !alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
+  FrameRequest *request =
+    mFrameRequestCallbacks.AppendElement(FrameRequest(aCallback, newHandle));
+  NS_ASSERTION(request, "This is supposed to be infallible!");
+  if (!alreadyRegistered && mPresShell && IsEventHandlingEnabled()) {
     mPresShell->GetPresContext()->RefreshDriver()->
       ScheduleFrameRequestCallbacks(this);
   }
+
+  *aHandle = newHandle;
+  return NS_OK;
+}
+
+void
+nsIDocument::CancelFrameRequestCallback(PRInt32 aHandle)
+{
+  // mFrameRequestCallbacks is stored sorted by handle
+  mFrameRequestCallbacks.RemoveElementSorted(aHandle);
+
+  // Not going to worry about unscheduling our refresh driver
+  // callback.  It'll just be a no-op when it happens, if we have no
+  // more frame request callbacks.
 }
 
 nsresult
 nsDocument::GetStateObject(nsIVariant** aState)
 {
   // Get the document's current state object. This is the object backing both
   // history.state and popStateEvent.state.
   //
@@ -8440,53 +8437,23 @@ DispatchFullScreenChange(nsIDocument* aT
   nsRefPtr<nsPLDOMEvent> e =
     new nsPLDOMEvent(aTarget,
                      NS_LITERAL_STRING("mozfullscreenchange"),
                      true,
                      false);
   e->PostDOMEvent();
 }
 
-bool
-nsDocument::SetFullScreenState(Element* aElement, bool aIsFullScreen)
-{
-  if (mFullScreenElement) {
-    // Reset the ancestor and full-screen styles on the outgoing full-screen
-    // element in the current document.
-    nsEventStateManager::SetFullScreenState(mFullScreenElement, false);
-    mFullScreenElement = nsnull;
-  }
-  if (aElement) {
-    nsEventStateManager::SetFullScreenState(aElement, aIsFullScreen);
-  }
-  mFullScreenElement = aElement;
-
-  if (mIsFullScreen == aIsFullScreen) {
-    return false;
-  }
-  mIsFullScreen = aIsFullScreen;
-  return true;
-}
-
-// Wrapper for the nsIDocument -> nsDocument cast required to call
-// nsDocument::SetFullScreenState().
-static bool
-SetFullScreenState(nsIDocument* aDoc, Element* aElement, bool aIsFullScreen)
-{
-  return static_cast<nsDocument*>(aDoc)->
-    SetFullScreenState(aElement, aIsFullScreen);
-}
-
 NS_IMETHODIMP
 nsDocument::MozCancelFullScreen()
 {
   if (!nsContentUtils::IsRequestFullScreenAllowed()) {
     return NS_OK;
   }
-  CancelFullScreen();
+  RestorePreviousFullScreenState();
   return NS_OK;
 }
 
 // Runnable to set window full-screen mode. Used as a script runner
 // to ensure we only call nsGlobalWindow::SetFullScreen() when it's safe to 
 // run script. nsGlobalWindow::SetFullScreen() dispatches a synchronous event
 // (handled in chome code) which is unsafe to run if this is called in
 // nsGenericElement::UnbindFromTree().
@@ -8509,52 +8476,149 @@ private:
 };
 
 static void
 SetWindowFullScreen(nsIDocument* aDoc, bool aValue)
 {
   nsContentUtils::AddScriptRunner(new nsSetWindowFullScreen(aDoc, aValue));
 }
 
-void
-nsDocument::CancelFullScreen()
+class nsCallExitFullScreen : public nsRunnable {
+public:
+  NS_IMETHOD Run()
+  {
+    nsDocument::ExitFullScreen();
+    return NS_OK;
+  }
+};
+
+/* static */
+void
+nsIDocument::ExitFullScreen(bool aRunAsync)
+{
+  if (aRunAsync) {
+    NS_DispatchToCurrentThread(new nsCallExitFullScreen());
+    return;
+  }
+  nsDocument::ExitFullScreen();
+}
+
+static bool
+ResetFullScreen(nsIDocument* aDocument, void* aData) {
+  if (aDocument->IsFullScreenDoc()) {
+    static_cast<nsDocument*>(aDocument)->ClearFullScreenStack();
+    NS_ASSERTION(!aDocument->IsFullScreenDoc(), "Should reset full-screen");
+    nsTArray<nsIDocument*>* changed = reinterpret_cast<nsTArray<nsIDocument*>*>(aData);
+    changed->AppendElement(aDocument);
+    aDocument->EnumerateSubDocuments(ResetFullScreen, aData);
+  }
+  return true;
+}
+
+/* static */
+void
+nsDocument::ExitFullScreen()
+{
+  // Clear full-screen stacks in all descendant documents.
+  nsCOMPtr<nsIDocument> root(do_QueryReferent(sFullScreenRootDoc));
+  if (!root) {
+    // Not in full-screen mode.
+    return;
+  }
+  NS_ASSERTION(root->IsFullScreenDoc(),
+    "Full-screen root should be a full-screen doc...");
+
+  // Stores a list of documents to which we must dispatch "mozfullscreenchange".
+  // We're required by the spec to dispatch the events in leaf-to-root
+  // order when exiting full-screen, but we traverse the doctree in a
+  // root-to-leaf order, so we save references to the documents we must
+  // dispatch to so that we dispatch in the specified order.
+  nsAutoTArray<nsIDocument*, 8> changed;
+
+  // Walk the tree of full-screen documents, and reset their full-screen state.
+  ResetFullScreen(root, static_cast<void*>(&changed));
+
+  // Dispatch "mozfullscreenchange" events. Note this loop is in reverse
+  // order so that the events for the leaf document arrives before the root
+  // document, as required by the spec.
+  for (PRUint32 i = 0; i < changed.Length(); ++i) {
+    DispatchFullScreenChange(changed[changed.Length() - i - 1]);
+  }
+
+  // Reset global state. Do this before we move the window out of full-screen
+  // mode, as that calls nsGlobalWindow::SetFullScreen() which calls back into
+  // nsIDocument::ExitFullScreen().
+  sFullScreenRootDoc = nsnull;
+  sFullScreenDoc = nsnull;
+
+  // Move the top-level window out of full-screen mode.
+  SetWindowFullScreen(root, false);
+}
+
+void
+nsDocument::RestorePreviousFullScreenState()
 {
   NS_ASSERTION(!IsFullScreenDoc() || sFullScreenDoc != nsnull,
                "Should have a full-screen doc when full-screen!");
 
   if (!IsFullScreenDoc() || !GetWindow() || !sFullScreenDoc) {
     return;
   }
 
-  // Reset full-screen state in all full-screen documents.
-  nsCOMPtr<nsIDocument> doc(do_QueryReferent(sFullScreenDoc));
-  while (doc != nsnull) {
-    if (::SetFullScreenState(doc, nsnull, false)) {
-      DispatchFullScreenChange(doc);
-    }
+  // Clear full-screen stacks in all descendant documents, bottom up.
+  nsCOMPtr<nsIDocument> fullScreenDoc(do_QueryReferent(sFullScreenDoc));
+  nsIDocument* doc = fullScreenDoc;
+  while (doc != this) {
+    NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc");
+    static_cast<nsDocument*>(doc)->ClearFullScreenStack();
+    DispatchFullScreenChange(doc);
     doc = doc->GetParentDocument();
   }
-  sFullScreenDoc = nsnull;
-  sFullScreenRootDoc = nsnull;
-
-  // Move the window out of full-screen mode.
-  SetWindowFullScreen(this, false);
-
-  return;
+
+  // Roll-back full-screen state to previous full-screen element.
+  NS_ASSERTION(doc == this, "Must have reached this doc.");
+  while (doc != nsnull) {
+    static_cast<nsDocument*>(doc)->FullScreenStackPop();
+    DispatchFullScreenChange(doc);
+    if (static_cast<nsDocument*>(doc)->mFullScreenStack.IsEmpty()) {
+      // Full-screen stack in document is empty. Go back up to the parent
+      // document. We'll pop the containing element off its stack, and use
+      // its next full-screen element as the full-screen element.
+      doc = doc->GetParentDocument();
+    } else {
+      // Else we popped the top of the stack, and there's still another
+      // element in there, so that will become the full-screen element.
+      sFullScreenDoc = do_GetWeakReference(doc);
+      break;
+    }
+  }
+
+  if (doc == nsnull) {
+    // We moved all documents out of full-screen mode, reset global full-screen
+    // state and move the top-level window out of full-screen mode.
+    DebugOnly< nsCOMPtr<nsIDocument> > root(do_QueryReferent(sFullScreenRootDoc));
+    NS_ASSERTION(!root->IsFullScreenDoc(), "Should have cleared all docs' stacks");
+    sFullScreenDoc = nsnull;
+    sFullScreenRootDoc = nsnull;
+    SetWindowFullScreen(this, false);
+  }
 }
 
 bool
 nsDocument::IsFullScreenDoc()
 {
-  return mIsFullScreen;
+  return GetFullScreenElement() != nsnull;
 }
 
 static nsIDocument*
 GetCommonAncestor(nsIDocument* aDoc1, nsIDocument* aDoc2)
 {
+  if (!aDoc1 || !aDoc2) {
+    return nsnull;
+  }
   nsIDocument* doc1 = aDoc1;
   nsIDocument* doc2 = aDoc2;
 
   nsAutoTArray<nsIDocument*, 30> parents1, parents2;
   do {
     parents1.AppendElement(doc1);
     doc1 = doc1->GetParentDocument();
   } while (doc1);
@@ -8629,21 +8693,108 @@ LogFullScreenDenied(bool aLogFailure, co
                                   aMessage,
                                   nsnull, 0, nsnull,
                                   EmptyString(), 0, 0,
                                   nsIScriptError::warningFlag,
                                   "DOM", aDoc);
 }
 
 void
+nsDocument::ClearFullScreenStack()
+{
+  if (mFullScreenStack.IsEmpty()) {
+    return;
+  }
+  // The top element in the full-screen stack will have full-screen
+  // style bits set on it and its ancestors. Remove the style bits.
+  // Note the non-top elements won't have the style bits set.
+  Element* top = FullScreenStackTop();
+  NS_ASSERTION(top, "Should have a top when full-screen stack isn't empty");
+  if (top) {
+    nsEventStateManager::SetFullScreenState(top, false);
+  }
+  mFullScreenStack.Clear();
+}
+
+bool
+nsDocument::FullScreenStackPush(Element* aElement)
+{
+  NS_ASSERTION(aElement, "Must pass non-null to FullScreenStackPush()");
+  Element* top = FullScreenStackTop();
+  if (top == aElement || !aElement) {