Merge m-c to s-c.
authorRichard Newman <rnewman@mozilla.com>
Tue, 21 Jan 2014 08:17:45 -0800
changeset 168682 ce3eeda375cce91d951b9ac2cee9e318e9358e2e
parent 168681 6427c85ecddd16f66365073cadd56e2b1a61c482 (current diff)
parent 168675 1b52aa569cedc2b46e7ac864b10a79781c8b2406 (diff)
child 168683 d8f0dc8111097946f21bd3484d925cbba66c9bd9
push idunknown
push userunknown
push dateunknown
milestone29.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 m-c to s-c.
ipc/chromium/base/file_version_info_linux.h
ipc/chromium/src/base/file_version_info.cc
ipc/chromium/src/base/file_version_info.h
ipc/chromium/src/base/file_version_info_linux.cc
ipc/chromium/src/base/file_version_info_linux.h.version
ipc/chromium/src/base/file_version_info_mac.mm
ipc/chromium/src/chrome/common/chrome_constants.cc
ipc/chromium/src/chrome/common/chrome_constants.h
ipc/chromium/src/chrome/common/chrome_counters.cc
ipc/chromium/src/chrome/common/chrome_counters.h
ipc/chromium/src/chrome/common/chrome_paths.cc
ipc/chromium/src/chrome/common/chrome_paths.h
ipc/chromium/src/chrome/common/chrome_paths_internal.h
ipc/chromium/src/chrome/common/chrome_paths_mac.mm
ipc/chromium/src/chrome/common/chrome_paths_win.cc
ipc/chromium/src/chrome/common/thumbnail_score.h
--- a/.lldbinit
+++ b/.lldbinit
@@ -1,30 +1,31 @@
 # .lldbinit file for debugging Mozilla
 
 # -----------------------------------------------------------------------------
 # For documentation on all of the commands and type summaries defined here
 # and in the accompanying Python scripts, see python/lldbutils/README.txt.
 # -----------------------------------------------------------------------------
 
+# Import the module that defines complex Gecko debugging commands.  This assumes
+# you are either running lldb from the top level source directory, the objdir,
+# or the dist/bin directory.  (.lldbinit files in the objdir and dist/bin set
+# topsrcdir appropriately.)
+script topsrcdir = topsrcdir if locals().has_key("topsrcdir") else "."; sys.path.append(os.path.join(topsrcdir, "python/lldbutils")); import lldbutils; lldbutils.init()
+
 # Mozilla's use of UNIFIED_SOURCES to include multiple source files into a
 # single compiled file breaks lldb breakpoint setting. This works around that.
 # See http://lldb.llvm.org/troubleshooting.html for more info.
 settings set target.inline-breakpoint-strategy always
 
 # Show the dynamic type of an object when using "expr".  This, for example,
 # will show a variable declared as "nsIFrame *" that points to an nsBlockFrame
 # object as being of type "nsBlockFrame *" rather than "nsIFrame *".
 settings set target.prefer-dynamic-value run-target
 
-# Import the module that defines complex Gecko debugging commands.  Rather
-# than do any kind of searching, this assumes that you are running lldb from
-# the top level source directory.
-script sys.path.append('python/lldbutils'); import lldbutils; lldbutils.init()
-
 # Show the string value in atoms.
 type summary add nsIAtom --summary-string "${var.mString}"
 
 # Show the value of text nodes.
 type summary add nsTextNode --summary-string "${var.mText}"
 
 # Dump the current JS stack.
 command alias js expr DumpJSStack()
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 917896 requires a clobber due to bug 961339.
+Bug 953381 requires a clobber due to bug 961339.
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -5,17 +5,16 @@
 
 #include "nsCoreUtils.h"
 
 #include "nsIAccessibleTypes.h"
 
 #include "nsIBaseWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocument.h"
-#include "nsIDOMDocument.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsRange.h"
 #include "nsIBoxObject.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDocShell.h"
 #include "nsEventListenerManager.h"
 #include "nsIPresShell.h"
@@ -29,16 +28,17 @@
 #include "nsView.h"
 #include "nsGkAtoms.h"
 #include "nsDOMTouchEvent.h"
 
 #include "nsComponentManagerUtils.h"
 
 #include "nsITreeBoxObject.h"
 #include "nsITreeColumns.h"
+#include "mozilla/dom/Element.h"
 
 using namespace mozilla;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsCoreUtils
 ////////////////////////////////////////////////////////////////////////////////
 
 bool
@@ -211,28 +211,26 @@ nsCoreUtils::GetDOMNodeFromDOMPoint(nsIN
   return aNode;
 }
 
 nsIContent*
 nsCoreUtils::GetRoleContent(nsINode *aNode)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
   if (!content) {
-    nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(aNode));
-    if (domDoc) {
+    nsCOMPtr<nsIDocument> doc(do_QueryInterface(aNode));
+    if (doc) {
       nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(aNode));
       if (htmlDoc) {
         nsCOMPtr<nsIDOMHTMLElement> bodyElement;
         htmlDoc->GetBody(getter_AddRefs(bodyElement));
         content = do_QueryInterface(bodyElement);
       }
       else {
-        nsCOMPtr<nsIDOMElement> docElement;
-        domDoc->GetDocumentElement(getter_AddRefs(docElement));
-        content = do_QueryInterface(docElement);
+        return doc->GetDocumentElement();
       }
     }
   }
 
   return content;
 }
 
 bool
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -24,17 +24,16 @@
 #include "RootAccessible.h"
 #include "States.h"
 #include "StyleInfo.h"
 #include "TableAccessible.h"
 #include "TableCellAccessible.h"
 #include "TreeWalker.h"
 
 #include "nsIDOMElement.h"
-#include "nsIDOMDocument.h"
 #include "nsIDOMNodeFilter.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMTreeWalker.h"
 #include "nsIDOMXULButtonElement.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULLabelElement.h"
@@ -78,16 +77,17 @@
 #endif
 
 #include "mozilla/Assertions.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/TreeWalker.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible: nsISupports and cycle collection
 
@@ -3069,35 +3069,36 @@ Accessible::GetSiblingAtOffset(int32_t a
 
 Accessible* 
 Accessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
 {
   Accessible* accessible = mDoc->GetAccessible(aStartNode);
   if (accessible)
     return accessible;
 
-  nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->OwnerDoc());
-  NS_ENSURE_TRUE(domDoc, nullptr);
-
-  nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aStartNode);
-  nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(GetNode());
-  nsCOMPtr<nsIDOMTreeWalker> walker;
-  domDoc->CreateTreeWalker(rootNode,
-                           nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
-                           nullptr, 1, getter_AddRefs(walker));
+  nsCOMPtr<nsIDocument> doc = aStartNode->OwnerDoc();
+
+  nsCOMPtr<nsINode> currentNode = aStartNode;
+  ErrorResult rv;
+  nsRefPtr<dom::TreeWalker> walker =
+    doc->CreateTreeWalker(*GetNode(),
+                          nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
+                          nullptr, rv);
   NS_ENSURE_TRUE(walker, nullptr);
 
-  walker->SetCurrentNode(currentNode);
+  walker->SetCurrentNode(*currentNode, rv);
+  if (rv.Failed())
+    return nullptr;
+
   while (true) {
-    walker->NextNode(getter_AddRefs(currentNode));
-    if (!currentNode)
+    currentNode = walker->NextNode(rv);
+    if (!currentNode || rv.Failed())
       return nullptr;
 
-    nsCOMPtr<nsINode> node(do_QueryInterface(currentNode));
-    Accessible* accessible = mDoc->GetAccessible(node);
+    Accessible* accessible = mDoc->GetAccessible(currentNode);
     if (accessible)
       return accessible;
   }
 
   return nullptr;
 }
 
 double
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -17,17 +17,16 @@
 
 #include "nsIMutableArray.h"
 #include "nsICommandManager.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIDOMAttr.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMDocumentType.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMXULPopupElement.h"
 #include "nsIEditingSession.h"
 #include "nsEventStateManager.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
@@ -37,16 +36,17 @@
 #include "nsIServiceManager.h"
 #include "nsViewManager.h"
 #include "nsIScrollableFrame.h"
 #include "nsUnicharUtils.h"
 #include "nsIURI.h"
 #include "nsIWebNavigation.h"
 #include "nsFocusManager.h"
 #include "mozilla/Assertions.h"
+#include "mozilla/dom/DocumentType.h"
 #include "mozilla/dom/Element.h"
 
 #ifdef MOZ_XUL
 #include "nsIXULDocument.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
@@ -347,48 +347,49 @@ DocAccessible::GetURL(nsAString& aURL)
   }
   CopyUTF8toUTF16(theURL, aURL);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetTitle(nsAString& aTitle)
 {
-  nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(mDocumentNode);
-  if (!domDocument) {
+  if (!mDocumentNode) {
     return NS_ERROR_FAILURE;
   }
-  return domDocument->GetTitle(aTitle);
+  nsString title;
+  mDocumentNode->GetTitle(title);
+  aTitle = title;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetMimeType(nsAString& aMimeType)
 {
-  nsCOMPtr<nsIDOMDocument> domDocument = do_QueryInterface(mDocumentNode);
-  if (!domDocument) {
+  if (!mDocumentNode) {
     return NS_ERROR_FAILURE;
   }
-  return domDocument->GetContentType(aMimeType);
+  return mDocumentNode->GetContentType(aMimeType);
 }
 
 NS_IMETHODIMP
 DocAccessible::GetDocType(nsAString& aDocType)
 {
-  nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(mDocumentNode));
-  nsCOMPtr<nsIDOMDocumentType> docType;
-
 #ifdef MOZ_XUL
   nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocumentNode));
   if (xulDoc) {
     aDocType.AssignLiteral("window"); // doctype not implemented for XUL at time of writing - causes assertion
     return NS_OK;
   } else
 #endif
-  if (domDoc && NS_SUCCEEDED(domDoc->GetDoctype(getter_AddRefs(docType))) && docType) {
-    return docType->GetPublicId(aDocType);
+  if (mDocumentNode) {
+    dom::DocumentType* docType = mDocumentNode->GetDoctype();
+    if (docType) {
+      return docType->GetPublicId(aDocType);
+    }
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetNameSpaceURIForID(int16_t aNameSpaceID, nsAString& aNameSpaceURI)
 {
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -79,19 +79,17 @@ RootAccessible::Name(nsString& aName)
   aName.Truncate();
 
   if (mRoleMapEntry) {
     Accessible::Name(aName);
     if (!aName.IsEmpty())
       return eNameOK;
   }
 
-  nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocumentNode);
-  NS_ENSURE_TRUE(document, eNameOK);
-  document->GetTitle(aName);
+  mDocumentNode->GetTitle(aName);
   return eNameOK;
 }
 
 role
 RootAccessible::NativeRole()
 {
   // If it's a <dialog> or <wizard>, use roles::DIALOG instead
   dom::Element* rootElm = mDocumentNode->GetRootElement();
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ b/accessible/src/html/HTMLTableAccessible.cpp
@@ -15,17 +15,16 @@
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 #include "TreeWalker.h"
 
 #include "mozilla/dom/HTMLTableElement.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMDocument.h"
 #include "nsIDOMRange.h"
 #include "nsISelectionPrivate.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDocument.h"
 #include "nsIMutableArray.h"
 #include "nsIPersistentProperties2.h"
--- a/accessible/src/jsat/TouchAdapter.jsm
+++ b/accessible/src/jsat/TouchAdapter.jsm
@@ -329,53 +329,39 @@ this.TouchAdapter = {
 };
 
 /***
  * A TouchPoint represents a single touch from the moment of contact until it is
  * lifted from the surface. It is capable of compiling gestures from the scope
  * of one single touch.
  */
 function TouchPoint(aTouch, aTime, aDPI) {
-  this.startX = this.x = aTouch.screenX * this.scaleFactor;
-  this.startY = this.y = aTouch.screenY * this.scaleFactor;
+  this.startX = this.x = aTouch.screenX;
+  this.startY = this.y = aTouch.screenY;
   this.startTime = aTime;
   this.distanceTraveled = 0;
   this.dpi = aDPI;
   this.done = false;
 }
 
 TouchPoint.prototype = {
   update: function TouchPoint_update(aTouch, aTime) {
     let lastX = this.x;
     let lastY = this.y;
-    this.x = aTouch.screenX * this.scaleFactor;
-    this.y = aTouch.screenY * this.scaleFactor;
+    this.x = aTouch.screenX;
+    this.y = aTouch.screenY;
     this.time = aTime;
 
     this.distanceTraveled += this.getDistanceToCoord(lastX, lastY);
   },
 
   getDistanceToCoord: function TouchPoint_getDistanceToCoord(aX, aY) {
     return Math.sqrt(Math.pow(this.x - aX, 2) + Math.pow(this.y - aY, 2));
   },
 
-  get scaleFactor() {
-    if (!this._scaleFactor) {
-      // Android events come with the x, y coordinates affected by the widget
-      // scaling; we restore it to normal here.
-      if (Utils.MozBuildApp == 'mobile/android') {
-        this._scaleFactor = Utils.win.devicePixelRatio;
-      } else {
-        this._scaleFactor = 1;
-      }
-    }
-
-    return this._scaleFactor;
-  },
-
   finish: function TouchPoint_finish() {
     this.done = true;
   },
 
   /**
    * Compile a gesture from an individual touch point. This is used by the
    * TouchAdapter to compound multiple single gestures in to higher level
    * gestures.
--- a/accessible/src/xul/XULTabAccessible.cpp
+++ b/accessible/src/xul/XULTabAccessible.cpp
@@ -8,17 +8,16 @@
 #include "nsAccUtils.h"
 #include "Relation.h"
 #include "Role.h"
 #include "States.h"
 
 // NOTE: alphabetically ordered
 #include "nsIAccessibleRelation.h"
 #include "nsIDocument.h"
-#include "nsIDOMDocument.h"
 #include "nsIDOMXULSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULRelatedElement.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTabAccessible
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
@@ -93,9 +93,9 @@
   <project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
   <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="5be0a9c4b3c6c004786917fdb5bee248960d045b"/>
   <project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
   <project name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="d2685281e2e54ca14d1df304867aa82c37b27162"/>
   <project name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="627f9b20fc518937b93747a7ff1ed4f5ed46e06f"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="a3daa50e9b5db558696951ae724f913e4e5c7489"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="83dbccadb19d0d3c07828c2bb0e5c2be12c0f980"/>
   <project name="android-sdk" path="sdk" remote="b2g" revision="5701d3cb45c2e848cc57003cda2e1141288ecae4"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="fce1a137746dbd354bca1918f02f96d51c40bad2">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.1" path="prebuilts/clang/darwin-x86/3.1" revision="8a10d50e8caab8c18224588f0531f1c9363965b5"/>
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.2" path="prebuilts/clang/darwin-x86/3.2" revision="2d96fcbab6efee560c2004725b21bdc06d090933"/>
@@ -126,9 +126,9 @@
   <!-- Emulator specific things -->
   <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
   <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="9e1ff573f5669a9e0756e199cb4237ab18546388"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87e1478ffc36b0b446119ae0a1ea7a02e1baea5e"/>
   <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2838a77ce4b8c09fa6a46fe25410bb3a4474cbd4"/>
   <project name="platform/development" path="development" revision="1f18cfe031ce23b7fb838fe3d4379dd802b49e71"/>
   <project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
@@ -93,9 +93,9 @@
   <project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
   <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="5be0a9c4b3c6c004786917fdb5bee248960d045b"/>
   <project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
   <project name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="d2685281e2e54ca14d1df304867aa82c37b27162"/>
   <project name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="627f9b20fc518937b93747a7ff1ed4f5ed46e06f"/>
   <project name="platform/prebuilts/tools" path="prebuilts/tools" revision="a3daa50e9b5db558696951ae724f913e4e5c7489"/>
   <project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="83dbccadb19d0d3c07828c2bb0e5c2be12c0f980"/>
   <project name="android-sdk" path="sdk" remote="b2g" revision="5701d3cb45c2e848cc57003cda2e1141288ecae4"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
 {
-    "revision": "6946a71605af13e0284fb6f5bbe38aa4c05155d7", 
+    "revision": "18e2adbabcfa967611077df5a9bff7f855041324", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
@@ -98,9 +98,9 @@
   <project name="kernel/msm" path="kernel" revision="8072055e7094023e2cac8eea425bb785fe1d4066"/>
   <project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="19933e5d182a4799c6217b19a18562193a419298"/>
   <project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="5a58382180c70d0c446badc9c9837918ab69ec60"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="20d83ab382a1f813702421e76c2f9f994585990e"/>
   <project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="1698e6e9ed7cf1d543508845fa05ed86c7e5e241"/>
   <project name="platform/hardware/msm7k" path="hardware/msm7k" revision="693e65da9905d88c23653b45800e6509143f6a78"/>
   <project name="platform/vendor/qcom-opensource/omx/mm-core" path="vendor/qcom/opensource/omx/mm-core" revision="0365db6af2d4df11184a421f97c5043db47a0c0d"/>
   <project name="platform/hardware/ril" path="hardware/ril" revision="ec40c0aee736052fc4fe01c1b8dc16929da5dc45"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -5,17 +5,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
@@ -95,9 +95,9 @@
   <project name="device-helix" path="device/qcom/helix" remote="b2g" revision="47f22c59edb13379a6995554cb4a473558929653"/>
   <project name="kernel/msm" path="kernel" revision="e9c1e0c6a0ca33f5741a48288de4b46453031210"/>
   <project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="c4e3e6cf938f1bdde78bc39f38350f72b6fc3a21"/>
   <project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="32905dde6a66296c7e5843e9664c5c6444deb38c"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="b2ac43193f3d3a44171bdb50ea3c2aeb558511d3"/>
   <project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="1698e6e9ed7cf1d543508845fa05ed86c7e5e241"/>
   <project name="platform/hardware/msm7k" path="hardware/msm7k" revision="669815aaca47afee95b4a95908dc87bff267a815"/>
   <project name="platform/vendor/qcom-opensource/omx/mm-core" path="vendor/qcom/opensource/omx/mm-core" revision="0365db6af2d4df11184a421f97c5043db47a0c0d"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -7,17 +7,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
@@ -100,9 +100,9 @@
   <project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="0a01247e4b0880f93424b27251cd3a1f6b19dbb2"/>
   <project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="1acf77a75e30f3fc8b1eed2057c97adf1cb1633f"/>
   <project name="hardware_qcom_display" path="hardware/qcom/display" remote="b2g" revision="6405d30f2fac7d8a1f2cb17b99fb7dd0a8bcfdac"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="552c3ddb7174a01f3508782d40c4d8c845ab441a"/>
   <project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="23d5707b320d7fc69f8ba3b7d84d78a1c5681708"/>
   <project name="platform/hardware/msm7k" path="hardware/msm7k" revision="8892d46805c5639b55dd07547745c5180da861e7"/>
   <project name="platform/vendor/qcom-opensource/omx/mm-core" path="vendor/qcom/opensource/omx/mm-core" revision="ab17ac9a074b4bb69986a8436336bdfbbaf9cd39"/>
   <project name="platform/hardware/ril" path="hardware/ril" remote="caf" revision="fe9a3f63922143b57e79ed570bab2328df8c83a5"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
@@ -96,9 +96,9 @@
   <project name="device-leo" path="device/qcom/leo" remote="b2g" revision="4e53c9ba4afcea9dd0c36c9464042abcf16c228d"/>
   <project name="kernel/msm" path="kernel" revision="e9c1e0c6a0ca33f5741a48288de4b46453031210"/>
   <project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="c4e3e6cf938f1bdde78bc39f38350f72b6fc3a21"/>
   <project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="32905dde6a66296c7e5843e9664c5c6444deb38c"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="b2ac43193f3d3a44171bdb50ea3c2aeb558511d3"/>
   <project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="1698e6e9ed7cf1d543508845fa05ed86c7e5e241"/>
   <project name="platform/hardware/msm7k" path="hardware/msm7k" revision="669815aaca47afee95b4a95908dc87bff267a815"/>
   <project name="platform/vendor/qcom-opensource/omx/mm-core" path="vendor/qcom/opensource/omx/mm-core" revision="0365db6af2d4df11184a421f97c5043db47a0c0d"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="fce1a137746dbd354bca1918f02f96d51c40bad2">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
   <!-- Stock Android things -->
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.1" path="prebuilts/clang/darwin-x86/3.1" revision="8a10d50e8caab8c18224588f0531f1c9363965b5"/>
   <project groups="darwin" name="platform/prebuilts/clang/darwin-x86/3.2" path="prebuilts/clang/darwin-x86/3.2" revision="2d96fcbab6efee560c2004725b21bdc06d090933"/>
@@ -136,9 +136,9 @@
   <project name="platform/hardware/qcom/display" path="hardware/qcom/display" revision="6f3b0272cefaffeaed2a7d2bb8f633059f163ddc"/>
   <project name="platform/hardware/qcom/keymaster" path="hardware/qcom/keymaster" revision="16da8262c997a5a0d797885788a64a0771b26910"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="689b476ba3eb46c34b81343295fe144a0e81a18e"/>
   <project name="platform/hardware/qcom/msm8960" path="hardware/qcom/msm8960" revision="0ba0e0e06410e048b1cd57ce985f0376b6e4c84d"/>
   <project name="platform/hardware/qcom/power" path="hardware/qcom/power" revision="acbdde094799f61b4b8cb6ec116f2bc5f37d2afd"/>
   <project name="platform/hardware/qcom/sensors" path="hardware/qcom/sensors" revision="15488e251d83ad881a61f7045c64c711f5eaf082"/>
   <project name="platform/hardware/qcom/wlan" path="hardware/qcom/wlan" revision="7bc1339234f8b8387df491c0ced88fffd7d505f0"/>
   <project name="platform/hardware/ril" path="hardware/ril" revision="d9f3acd2ac2db63697a24f29dbf04083aedbccf8"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -6,17 +6,17 @@
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="e218d17ae7d01a81d48f833cd6fafb4e11b26cd8"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="4c29941ae4adf800bac335e33e11a30a602c0e4a"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="e9b6626eddbc85873eaa2a9174a9bd5101e5c05f"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="96d2d00165f4561fbde62d1062706eab74b3a01f"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="221bcaecbbbc9d185f691471b64aed9e75b0c11d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
@@ -97,9 +97,9 @@
   <project name="platform/vendor/qcom/msm8960" path="device/qcom/msm8960" revision="58786a6a6f16384a7770f92081a5d8f7b1a067ae"/>
   <project name="device-wasabi" path="device/qcom/wasabi" remote="b2g" revision="75c4cf201326edcd909502aa52febc96bf553104"/>
   <project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="0a01247e4b0880f93424b27251cd3a1f6b19dbb2"/>
   <project name="platform/hardware/qcom/camera" path="hardware/qcom/camera" revision="1acf77a75e30f3fc8b1eed2057c97adf1cb1633f"/>
   <project name="hardware_qcom_display" path="hardware/qcom/display" remote="b2g" revision="6405d30f2fac7d8a1f2cb17b99fb7dd0a8bcfdac"/>
   <project name="platform/hardware/qcom/media" path="hardware/qcom/media" revision="552c3ddb7174a01f3508782d40c4d8c845ab441a"/>
   <project name="platform/hardware/qcom/gps" path="hardware/qcom/gps" revision="23d5707b320d7fc69f8ba3b7d84d78a1c5681708"/>
   <project name="platform/vendor/qcom-opensource/omx/mm-core" path="vendor/qcom/opensource/omx/mm-core" revision="ab17ac9a074b4bb69986a8436336bdfbbaf9cd39"/>
-</manifest>
+</manifest>
\ No newline at end of file
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -102,24 +102,24 @@ let AboutHomeListener = {
   onPageLoad: function() {
     let doc = content.document;
     if (doc.documentURI.toLowerCase() != "about:home" ||
         doc.documentElement.hasAttribute("hasBrowserHandlers")) {
       return;
     }
 
     doc.documentElement.setAttribute("hasBrowserHandlers", "true");
-    let updateListener = this;
-    addMessageListener("AboutHome:Update", updateListener);
+    let self = this;
+    addMessageListener("AboutHome:Update", self);
     addEventListener("click", this.onClick, true);
     addEventListener("pagehide", function onPageHide(event) {
       if (event.target.defaultView.frameElement)
         return;
-      removeMessageListener("AboutHome:Update", updateListener);
-      removeEventListener("click", this.onClick, true);
+      removeMessageListener("AboutHome:Update", self);
+      removeEventListener("click", self.onClick, true);
       removeEventListener("pagehide", onPageHide, true);
       if (event.target.documentElement)
         event.target.documentElement.removeAttribute("hasBrowserHandlers");
     }, true);
 
     // XXX bug 738646 - when Marketplace is launched, remove this statement and
     // the hidden attribute set on the apps button in aboutHome.xhtml
     if (Services.prefs.getPrefType("browser.aboutHome.apps") == Services.prefs.PREF_BOOL &&
@@ -136,16 +136,21 @@ let AboutHomeListener = {
   onClick: function(aEvent) {
     if (!aEvent.isTrusted || // Don't trust synthetic events
         aEvent.button == 2 || aEvent.target.localName != "button") {
       return;
     }
 
     let originalTarget = aEvent.originalTarget;
     let ownerDoc = originalTarget.ownerDocument;
+    if (ownerDoc.documentURI != "about:home") {
+      // This shouldn't happen, but we're being defensive.
+      return;
+    }
+
     let elmId = originalTarget.getAttribute("id");
 
     switch (elmId) {
       case "restorePreviousSession":
         sendAsyncMessage("AboutHome:RestorePreviousSession");
         ownerDoc.getElementById("launcher").removeAttribute("session");
         break;
 
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -86,16 +86,17 @@ support-files =
   pluginCrashCommentAndURL.html
   print_postdata.sjs
   redirect_bug623155.sjs
   test-mixedcontent-securityerrors.html
   test_bug435035.html
   test_bug462673.html
   test_bug628179.html
   test_bug839103.html
+  test_bug959531.html
   test_wyciwyg_copying.html
   title_test.svg
   video.ogg
   zoom_test.html
   test_no_mcb_on_http_site_img.html
   test_no_mcb_on_http_site_img.css
   test_no_mcb_on_http_site_font.html
   test_no_mcb_on_http_site_font.css
--- a/browser/base/content/test/general/browser_aboutHome.js
+++ b/browser/base/content/test/general/browser_aboutHome.js
@@ -324,17 +324,54 @@ let gTests = [
     Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
     registerCleanupFunction(function () {
       Services.obs.removeObserver(searchObserver, "browser-search-engine-modified");
     });
     Services.search.addEngine("http://test:80/browser/browser/base/content/test/general/POSTSearchEngine.xml",
                               Ci.nsISearchEngine.DATA_XML, null, false);
     return deferred.promise;
   }
-}
+},
+
+{
+  desc: "Make sure that a page can't imitate about:home",
+  setup: function () { },
+  run: function (aSnippetsMap)
+  {
+    let deferred = Promise.defer();
+
+    let browser = gBrowser.selectedTab.linkedBrowser;
+    waitForLoad(() => {
+      let button = browser.contentDocument.getElementById("settings");
+      ok(button, "Found settings button in test page");
+      button.click();
+
+      // It may take a few turns of the event loop before the window
+      // is displayed, so we wait.
+      function check(n) {
+        let win = Services.wm.getMostRecentWindow("Browser:Preferences");
+        ok(!win, "Preferences window not showing");
+        if (win) {
+          win.close();
+        }
+
+        if (n > 0) {
+          executeSoon(() => check(n-1));
+        } else {
+          deferred.resolve();
+        }
+      }
+
+      check(5);
+    });
+
+    browser.loadURI("https://example.com/browser/browser/base/content/test/general/test_bug959531.html");
+    return deferred.promise;
+  }
+},
 
 ];
 
 function test()
 {
   waitForExplicitFinish();
   requestLongerTimeout(2);
   ignoreAllUncaughtExceptions();
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/test_bug959531.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Test for content page with settings button</title>
+  </head>
+  <body>
+    <button name="settings" id="settings">Settings</button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/build/.lldbinit.in
@@ -0,0 +1,2 @@
+#filter substitution
+script topsrcdir = "@topsrcdir@"; lldb.debugger.HandleCommand("command source -s true '%s'" % os.path.join(topsrcdir, ".lldbinit"))
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -42,24 +42,28 @@ endif
 
 # Put a useful .gdbinit in the bin directory, to be picked up automatically
 # by GDB when we debug executables there.
 # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
 GDBINIT_FILES := $(topsrcdir)/.gdbinit
 GDBINIT_DEST = $(FINAL_TARGET)
 INSTALL_TARGETS += GDBINIT
 
-# Put a useful .lldbinit in the bin directory, to be picked up automatically
-# by LLDB when we debug executables using that directory as the current working
-# directory.
-# NOTE: Keep .lldbinit in the topsrcdir for people who run LLDB from the
-# topsrcdir rather than the bin directory.
-LLDBINIT_FILES := $(topsrcdir)/.lldbinit
-LLDBINIT_DEST = $(FINAL_TARGET)
-INSTALL_TARGETS += LLDBINIT
+# Put a .lldbinit in the bin directory and the objdir, to be picked up
+# automatically by LLDB when we debug executables using either of those two
+# directories as the current working directory.  The .lldbinit file will
+# load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
+LLDBINIT_OBJDIR := .lldbinit.in
+LLDBINIT_OBJDIR_PATH = $(DEPTH)
+LLDBINIT_OBJDIR_FLAGS += -Dtopsrcdir=$(abspath $(topsrcdir))
+PP_TARGETS += LLDBINIT_OBJDIR
+
+LLDBINIT_FINAL_TARGET_FILES := $(DEPTH)/.lldbinit
+LLDBINIT_FINAL_TARGET_DEST = $(FINAL_TARGET)
+INSTALL_TARGETS += LLDBINIT_FINAL_TARGET
 
 include $(topsrcdir)/config/rules.mk
 
 # we install to _leaktest/
 TARGET_DEPTH = ..
 include $(srcdir)/automation-build.mk
 
 _LEAKTEST_DIR = $(DEPTH)/_leaktest
--- a/content/base/src/moz.build
+++ b/content/base/src/moz.build
@@ -12,30 +12,32 @@ EXPORTS += [
     'nsAttrValue.h',
     'nsAttrValueInlines.h',
     'nsContentList.h',
     'nsContentListDeclarations.h',
     'nsContentSink.h',
     'nsCrossSiteListenerProxy.h',
     'nsDOMAttributeMap.h',
     'nsFrameMessageManager.h',
+    'nsGenericDOMDataNode.h',
     'nsGkAtomList.h',
     'nsGkAtoms.h',
     'nsImageLoadingContent.h',
     'nsMappedAttributeElement.h',
     'nsNodeInfoManager.h',
     'nsNodeUtils.h',
     'nsPropertyTable.h',
     'nsRange.h',
     'nsSandboxFlags.h',
     'nsScriptLoader.h',
     'nsStubDocumentObserver.h',
     'nsStubMutationObserver.h',
     'nsStyledElement.h',
     'nsTextFragment.h',
+    'nsTraversal.h',
 ]
 
 if CONFIG['MOZ_WEBRTC']:
     EXPORTS += [
         'nsDOMDataChannel.h',
         'nsDOMDataChannelDeclarations.h',
     ]
     SOURCES += [
--- a/content/svg/content/src/SVGMotionSMILAttr.cpp
+++ b/content/svg/content/src/SVGMotionSMILAttr.cpp
@@ -36,17 +36,17 @@ void
 SVGMotionSMILAttr::ClearAnimValue()
 {
   mSVGElement->SetAnimateMotionTransform(nullptr);
 }
 
 nsresult
 SVGMotionSMILAttr::SetAnimValue(const nsSMILValue& aValue)
 {
-  gfx::Matrix matrix = gfx::ToMatrix(SVGMotionSMILType::CreateMatrix(aValue));
+  gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
   mSVGElement->SetAnimateMotionTransform(&matrix);
   return NS_OK;
 }
 
 const nsIContent*
 SVGMotionSMILAttr::GetTargetNode() const
 {
   return mSVGElement;
--- a/content/svg/content/src/SVGMotionSMILType.cpp
+++ b/content/svg/content/src/SVGMotionSMILType.cpp
@@ -437,40 +437,40 @@ SVGMotionSMILType::Interpolate(const nsS
 
   // Construct the intermediate result segment, and put it in our outparam.
   // AppendElement has guaranteed success here, since Init() allocates 1 slot.
   resultArr.AppendElement(MotionSegment(path, resultDist,
                                         rotateType, rotateAngle));
   return NS_OK;
 }
 
-/* static */ gfxMatrix
+/* static */ gfx::Matrix
 SVGMotionSMILType::CreateMatrix(const nsSMILValue& aSMILVal)
 {
   const MotionSegmentArray& arr = ExtractMotionSegmentArray(aSMILVal);
 
-  gfxMatrix matrix;
+  gfx::Matrix matrix;
   uint32_t length = arr.Length();
   for (uint32_t i = 0; i < length; i++) {
     gfxPoint point;  // initialized below
     gfxFloat rotateAngle = arr[i].mRotateAngle; // might get updated below
     if (arr[i].mSegmentType == eSegmentType_Translation) {
       point.x = arr[i].mU.mTranslationParams.mX;
       point.y = arr[i].mU.mTranslationParams.mY;
       NS_ABORT_IF_FALSE(arr[i].mRotateType == eRotateType_Explicit,
                         "'auto'/'auto-reverse' should have been converted to "
                         "explicit angles when we generated this translation");
     } else {
       GetAngleAndPointAtDistance(arr[i].mU.mPathPointParams.mPath,
                                  arr[i].mU.mPathPointParams.mDistToPoint,
                                  arr[i].mRotateType,
                                  rotateAngle, point);
     }
-    matrix.Translate(point);
-    matrix.Rotate(rotateAngle);
+    matrix.Translate(point.x, point.y);
+    matrix = gfx::Matrix::Rotation(rotateAngle) * matrix;
   }
   return matrix;
 }
 
 /* static */ nsSMILValue
 SVGMotionSMILType::ConstructSMILValue(Path* aPath,
                                       float aDist,
                                       RotateType aRotateType,
--- a/content/svg/content/src/SVGMotionSMILType.h
+++ b/content/svg/content/src/SVGMotionSMILType.h
@@ -5,23 +5,26 @@
 
 /* implementation of nsISMILType for use by <animateMotion> element */
 
 #ifndef MOZILLA_SVGMOTIONSMILTYPE_H_
 #define MOZILLA_SVGMOTIONSMILTYPE_H_
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Attributes.h"
-#include "gfxMatrix.h"
 #include "nsISMILType.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 
+namespace gfx {
+struct Matrix;
+}
+
 /**
  * MotionRotateType: Enum to indicate the type of our "rotate" attribute.
  */
 enum RotateType {
   eRotateType_Explicit,     // for e.g. rotate="45"/"45deg"/"0.785rad"
   eRotateType_Auto,         // for rotate="auto"
   eRotateType_AutoReverse   // for rotate="auto-reverse"
 };
@@ -58,17 +61,17 @@ protected:
                                    const nsSMILValue& aTo,
                                    double& aDistance) const MOZ_OVERRIDE;
   virtual nsresult Interpolate(const nsSMILValue& aStartVal,
                                const nsSMILValue& aEndVal,
                                double aUnitDistance,
                                nsSMILValue& aResult) const MOZ_OVERRIDE;
 public:
   // Used to generate a transform matrix from an <animateMotion> nsSMILValue.
-  static gfxMatrix CreateMatrix(const nsSMILValue& aSMILVal);
+  static gfx::Matrix CreateMatrix(const nsSMILValue& aSMILVal);
 
   // Used to generate a nsSMILValue for the point at the given distance along
   // the given path.
   static nsSMILValue ConstructSMILValue(Path* aPath,
                                         float aDist,
                                         RotateType aRotateType,
                                         float aRotateAngle);
 
--- a/dom/browser-element/BrowserElementPanning.js
+++ b/dom/browser-element/BrowserElementPanning.js
@@ -539,18 +539,17 @@ const ContentPanning = {
       // flying to the top of a page when double-tapping to zoom in (bug 761721).
       // the 1.2 multiplier is just a little fuzz to compensate for bRect including horizontal
       // margins but not vertical ones.
       let cssTapY = viewport.y + data.y;
       if ((bRect.height > rect.h) && (cssTapY > rect.y + (rect.h * 1.2))) {
         rect.y = cssTapY - (rect.h / 2);
       }
 
-      var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
-      os.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
+      Services.obs.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
     }
   },
 
   _handleVisibilityChange: function(evt) {
     if (!evt.target.hidden)
       return;
 
     this._resetHover();
@@ -564,18 +563,17 @@ const ContentPanning = {
       return false;
     if (aElement instanceof Ci.nsIDOMHTMLQuoteElement)
       return false;
     return true;
   },
 
   _zoomOut: function() {
     let rect = new Rect(0, 0, 0, 0);
-    var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
-    os.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
+    Services.obs.notifyObservers(docShell, 'browser-zoom-to-rect', JSON.stringify(rect));
   },
 
   _isRectZoomedIn: function(aRect, aViewport) {
     // This function checks to see if the area of the rect visible in the
     // viewport (i.e. the "overlapArea" variable below) is approximately 
     // the max area of the rect we can show.
     let vRect = new Rect(aViewport.x, aViewport.y, aViewport.width, aViewport.height);
     let overlap = vRect.intersect(aRect);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -29,17 +29,16 @@
 #include "nsIScriptObjectPrincipal.h"
 #include "nsWeakReference.h"
 #include "nsITabChild.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/TabContext.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/layers/CompositorTypes.h"
 
-struct gfxMatrix;
 class nsICachedFileDescriptorListener;
 class nsIDOMWindowUtils;
 
 namespace mozilla {
 namespace layout {
 class RenderFrameChild;
 }
 
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -15,17 +15,16 @@
 #include "nsIAuthPromptProvider.h"
 #include "nsIBrowserDOMWindow.h"
 #include "nsIDialogParamBlock.h"
 #include "nsISecureBrowserUI.h"
 #include "nsITabParent.h"
 #include "Units.h"
 #include "js/TypeDecls.h"
 
-struct gfxMatrix;
 class nsFrameLoader;
 class nsIContent;
 class nsIPrincipal;
 class nsIURI;
 class nsIWidget;
 class nsILoadContext;
 class CpowHolder;
 
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -233,20 +233,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('and
         'src/ports/SkTime_Unix.cpp',
         'src/utils/android/ashmem.cpp',
         'src/utils/SkOSFile.cpp',
         'src/utils/SkThreadUtils_pthread.cpp',
         'src/utils/SkThreadUtils_pthread_other.cpp',
     ]
     # left out of UNIFIED_SOURCES for now to avoid having to patch skia. Should revisit eventually.
     SOURCES += [
+        'src/ports/SkFontHost_android_old.cpp',
         'src/ports/SkFontHost_cairo.cpp',
         'src/ports/SkFontHost_FreeType.cpp',
         'src/ports/SkFontHost_FreeType_common.cpp',
-        'src/ports/SkFontHost_linux.cpp',
     ]
     DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
 else:
     UNIFIED_SOURCES += [
         'src/ports/SkDebug_stdio.cpp',
     ]
 
 if CONFIG['INTEL_ARCHITECTURE']:
new file mode 100644
--- /dev/null
+++ b/gfx/skia/src/ports/SkFontHost_android_old.cpp
@@ -0,0 +1,604 @@
+
+/*
+ * Copyright 2006 The Android Open Source Project
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#include "SkFontDescriptor.h"
+#include "SkFontHost.h"
+#include "SkFontHost_FreeType_common.h"
+#include "SkDescriptor.h"
+#include "SkStream.h"
+#include "SkPaint.h"
+#include "SkString.h"
+#include "SkStream.h"
+#include "SkThread.h"
+#include "SkTSearch.h"
+#include <stdio.h>
+
+#define FONT_CACHE_MEMORY_BUDGET    (768 * 1024)
+
+#ifndef SK_FONT_FILE_PREFIX
+    #define SK_FONT_FILE_PREFIX          "/fonts/"
+#endif
+
+bool find_name_and_attributes(SkStream* stream, SkString* name, SkTypeface::Style* style,
+                                           bool* isFixedWidth);
+
+static void GetFullPathForSysFonts(SkString* full, const char name[]) {
+    full->set(getenv("ANDROID_ROOT"));
+    full->append(SK_FONT_FILE_PREFIX);
+    full->append(name);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+struct FamilyRec;
+
+/*  This guy holds a mapping of a name -> family, used for looking up fonts.
+    Since it is stored in a stretchy array that doesn't preserve object
+    semantics, we don't use constructor/destructors, but just have explicit
+    helpers to manage our internal bookkeeping.
+*/
+struct NameFamilyPair {
+    const char* fName;      // we own this
+    FamilyRec*  fFamily;    // we don't own this, we just reference it
+
+    void construct(const char name[], FamilyRec* family) {
+        fName = strdup(name);
+        fFamily = family;   // we don't own this, so just record the referene
+    }
+
+    void destruct() {
+        free((char*)fName);
+        // we don't own family, so just ignore our reference
+    }
+};
+
+// we use atomic_inc to grow this for each typeface we create
+static int32_t gUniqueFontID;
+
+// this is the mutex that protects these globals
+static SkMutex gFamilyMutex;
+static FamilyRec* gFamilyHead;
+static SkTDArray<NameFamilyPair> gNameList;
+
+struct FamilyRec {
+    FamilyRec*  fNext;
+    SkTypeface* fFaces[4];
+
+    FamilyRec()
+    {
+        fNext = gFamilyHead;
+        memset(fFaces, 0, sizeof(fFaces));
+        gFamilyHead = this;
+    }
+};
+
+static SkTypeface* find_best_face(const FamilyRec* family,
+                                  SkTypeface::Style style) {
+    SkTypeface* const* faces = family->fFaces;
+
+    if (faces[style] != NULL) { // exact match
+        return faces[style];
+    }
+    // look for a matching bold
+    style = (SkTypeface::Style)(style ^ SkTypeface::kItalic);
+    if (faces[style] != NULL) {
+        return faces[style];
+    }
+    // look for the plain
+    if (faces[SkTypeface::kNormal] != NULL) {
+        return faces[SkTypeface::kNormal];
+    }
+    // look for anything
+    for (int i = 0; i < 4; i++) {
+        if (faces[i] != NULL) {
+            return faces[i];
+        }
+    }
+    // should never get here, since the faces list should not be empty
+    SkASSERT(!"faces list is empty");
+    return NULL;
+}
+
+static FamilyRec* find_family(const SkTypeface* member) {
+    FamilyRec* curr = gFamilyHead;
+    while (curr != NULL) {
+        for (int i = 0; i < 4; i++) {
+            if (curr->fFaces[i] == member) {
+                return curr;
+            }
+        }
+        curr = curr->fNext;
+    }
+    return NULL;
+}
+
+/*  Returns the matching typeface, or NULL. If a typeface is found, its refcnt
+    is not modified.
+ */
+static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
+    FamilyRec* curr = gFamilyHead;
+    while (curr != NULL) {
+        for (int i = 0; i < 4; i++) {
+            SkTypeface* face = curr->fFaces[i];
+            if (face != NULL && face->uniqueID() == uniqueID) {
+                return face;
+            }
+        }
+        curr = curr->fNext;
+    }
+    return NULL;
+}
+
+/*  Remove reference to this face from its family. If the resulting family
+    is empty (has no faces), return that family, otherwise return NULL
+*/
+static FamilyRec* remove_from_family(const SkTypeface* face) {
+    FamilyRec* family = find_family(face);
+    SkASSERT(family->fFaces[face->style()] == face);
+    family->fFaces[face->style()] = NULL;
+
+    for (int i = 0; i < 4; i++) {
+        if (family->fFaces[i] != NULL) {    // family is non-empty
+            return NULL;
+        }
+    }
+    return family;  // return the empty family
+}
+
+// maybe we should make FamilyRec be doubly-linked
+static void detach_and_delete_family(FamilyRec* family) {
+    FamilyRec* curr = gFamilyHead;
+    FamilyRec* prev = NULL;
+
+    while (curr != NULL) {
+        FamilyRec* next = curr->fNext;
+        if (curr == family) {
+            if (prev == NULL) {
+                gFamilyHead = next;
+            } else {
+                prev->fNext = next;
+            }
+            SkDELETE(family);
+            return;
+        }
+        prev = curr;
+        curr = next;
+    }
+    SkASSERT(!"Yikes, couldn't find family in our list to remove/delete");
+}
+
+static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) {
+    NameFamilyPair* list = gNameList.begin();
+    int             count = gNameList.count();
+
+    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
+
+    if (index >= 0) {
+        return find_best_face(list[index].fFamily, style);
+    }
+    return NULL;
+}
+
+static SkTypeface* find_typeface(const SkTypeface* familyMember,
+                                 SkTypeface::Style style) {
+    const FamilyRec* family = find_family(familyMember);
+    return family ? find_best_face(family, style) : NULL;
+}
+
+static void add_name(const char name[], FamilyRec* family) {
+    SkAutoAsciiToLC tolc(name);
+    name = tolc.lc();
+
+    NameFamilyPair* list = gNameList.begin();
+    int             count = gNameList.count();
+
+    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
+
+    if (index < 0) {
+        list = gNameList.insert(~index);
+        list->construct(name, family);
+    }
+}
+
+static void remove_from_names(FamilyRec* emptyFamily)
+{
+#ifdef SK_DEBUG
+    for (int i = 0; i < 4; i++) {
+        SkASSERT(emptyFamily->fFaces[i] == NULL);
+    }
+#endif
+
+    SkTDArray<NameFamilyPair>& list = gNameList;
+
+    // must go backwards when removing
+    for (int i = list.count() - 1; i >= 0; --i) {
+        NameFamilyPair* pair = &list[i];
+        if (pair->fFamily == emptyFamily) {
+            pair->destruct();
+            list.remove(i);
+        }
+    }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+class FamilyTypeface : public SkTypeface_FreeType {
+public:
+    FamilyTypeface(Style style, bool sysFont, SkTypeface* familyMember,
+                   bool isFixedWidth)
+    : SkTypeface_FreeType(style, sk_atomic_inc(&gUniqueFontID) + 1, isFixedWidth) {
+        fIsSysFont = sysFont;
+
+        SkAutoMutexAcquire  ac(gFamilyMutex);
+
+        FamilyRec* rec = NULL;
+        if (familyMember) {
+            rec = find_family(familyMember);
+            SkASSERT(rec);
+        } else {
+            rec = SkNEW(FamilyRec);
+        }
+        rec->fFaces[style] = this;
+    }
+
+    virtual ~FamilyTypeface() {
+        SkAutoMutexAcquire  ac(gFamilyMutex);
+
+        // remove us from our family. If the family is now empty, we return
+        // that and then remove that family from the name list
+        FamilyRec* family = remove_from_family(this);
+        if (NULL != family) {
+            remove_from_names(family);
+            detach_and_delete_family(family);
+        }
+    }
+
+    bool isSysFont() const { return fIsSysFont; }
+
+    virtual const char* getUniqueString() const = 0;
+    virtual const char* getFilePath() const = 0;
+
+protected:
+    virtual void onGetFontDescriptor(SkFontDescriptor*, bool*) const SK_OVERRIDE;
+
+private:
+    bool    fIsSysFont;
+
+    typedef SkTypeface INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class StreamTypeface : public FamilyTypeface {
+public:
+    StreamTypeface(Style style, bool sysFont, SkTypeface* familyMember,
+                   SkStream* stream, bool isFixedWidth)
+    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
+        SkASSERT(stream);
+        stream->ref();
+        fStream = stream;
+    }
+    virtual ~StreamTypeface() {
+        fStream->unref();
+    }
+
+    // overrides
+    virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE {
+        *ttcIndex = 0;
+        // we just ref our existing stream, since the caller will call unref()
+        // when they are through
+        fStream->ref();
+        // must rewind each time, since the caller assumes a "new" stream
+        fStream->rewind();
+        return fStream;
+    }
+    virtual const char* getUniqueString() const { return NULL; }
+    virtual const char* getFilePath() const { return NULL; }
+
+private:
+    SkStream* fStream;
+
+    typedef FamilyTypeface INHERITED;
+};
+
+class FileTypeface : public FamilyTypeface {
+public:
+    FileTypeface(Style style, bool sysFont, SkTypeface* familyMember,
+                 const char path[], bool isFixedWidth)
+    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
+        SkString fullpath;
+
+        if (sysFont) {
+            GetFullPathForSysFonts(&fullpath, path);
+            path = fullpath.c_str();
+        }
+        fPath.set(path);
+    }
+
+    // overrides
+    virtual SkStream* onOpenStream(int* ttcIndex) const SK_OVERRIDE {
+        *ttcIndex = 0;
+        SkStream* stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
+
+        // check for failure
+        if (stream->getLength() <= 0) {
+            SkDELETE(stream);
+            stream = NULL;
+        }
+        return stream;
+    }
+    virtual const char* getUniqueString() const {
+        const char* str = strrchr(fPath.c_str(), '/');
+        if (str) {
+            str += 1;   // skip the '/'
+        }
+        return str;
+    }
+    virtual const char* getFilePath() const {
+        return fPath.c_str();
+    }
+
+private:
+    SkString fPath;
+
+    typedef FamilyTypeface INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+static bool get_name_and_style(const char path[], SkString* name,
+                               SkTypeface::Style* style,
+                               bool* isFixedWidth, bool isExpected) {
+    SkString        fullpath;
+    GetFullPathForSysFonts(&fullpath, path);
+
+    SkFILEStream stream(fullpath.c_str());
+    if (stream.getLength() > 0) {
+        find_name_and_attributes(&stream, name, style, isFixedWidth);
+        return true;
+    }
+    else {
+        SkFILEStream stream(fullpath.c_str());
+        if (stream.getLength() > 0) {
+            find_name_and_attributes(&stream, name, style, isFixedWidth);
+            return true;
+        }
+    }
+
+    if (isExpected) {
+        SkDebugf("---- failed to open <%s> as a font\n", fullpath.c_str());
+    }
+    return false;
+}
+
+// used to record our notion of the pre-existing fonts
+struct FontInitRec {
+    const char*         fFileName;
+    const char* const*  fNames;     // null-terminated list
+};
+
+static const char* gSansNames[] = {
+    "sans-serif", "arial", "helvetica", "tahoma", "verdana", NULL
+};
+
+static const char* gSerifNames[] = {
+    "serif", "times", "times new roman", "palatino", "georgia", "baskerville",
+    "goudy", "fantasy", "cursive", "ITC Stone Serif", NULL
+};
+
+static const char* gMonoNames[] = {
+    "monospace", "courier", "courier new", "monaco", NULL
+};
+
+// deliberately empty, but we use the address to identify fallback fonts
+static const char* gFBNames[] = { NULL };
+
+/*  Fonts must be grouped by family, with the first font in a family having the
+    list of names (even if that list is empty), and the following members having
+    null for the list. The names list must be NULL-terminated
+*/
+static const FontInitRec gSystemFonts[] = {
+    { "DroidSans.ttf",              gSansNames  },
+    { "DroidSans-Bold.ttf",         NULL        },
+    { "DroidSerif-Regular.ttf",     gSerifNames },
+    { "DroidSerif-Bold.ttf",        NULL        },
+    { "DroidSerif-Italic.ttf",      NULL        },
+    { "DroidSerif-BoldItalic.ttf",  NULL        },
+    { "DroidSansMono.ttf",          gMonoNames  },
+    /*  These are optional, and can be ignored if not found in the file system.
+        These are appended to gFallbackFonts[] as they are seen, so we list
+        them in the order we want them to be accessed by NextLogicalFont().
+     */
+    { "DroidSansArabic.ttf",        gFBNames    },
+    { "DroidSansHebrew.ttf",        gFBNames    },
+    { "DroidSansThai.ttf",          gFBNames    },
+    { "MTLmr3m.ttf",                gFBNames    }, // Motoya Japanese Font
+    { "MTLc3m.ttf",                 gFBNames    }, // Motoya Japanese Font
+    { "DroidSansJapanese.ttf",      gFBNames    },
+    { "DroidSansFallback.ttf",      gFBNames    }
+};
+
+#define DEFAULT_NAMES   gSansNames
+
+// these globals are assigned (once) by load_system_fonts()
+static FamilyRec* gDefaultFamily;
+static SkTypeface* gDefaultNormal;
+
+/*  This is sized conservatively, assuming that it will never be a size issue.
+    It will be initialized in load_system_fonts(), and will be filled with the
+    fontIDs that can be used for fallback consideration, in sorted order (sorted
+    meaning element[0] should be used first, then element[1], etc. When we hit
+    a fontID==0 in the array, the list is done, hence our allocation size is
+    +1 the total number of possible system fonts. Also see NextLogicalFont().
+ */
+static uint32_t gFallbackFonts[SK_ARRAY_COUNT(gSystemFonts)+1];
+
+/*  Called once (ensured by the sentinel check at the beginning of our body).
+    Initializes all the globals, and register the system fonts.
+ */
+static void load_system_fonts() {
+    // check if we've already be called
+    if (NULL != gDefaultNormal) {
+        return;
+    }
+
+    const FontInitRec* rec = gSystemFonts;
+    SkTypeface* firstInFamily = NULL;
+    int fallbackCount = 0;
+
+    for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
+        // if we're the first in a new family, clear firstInFamily
+        if (rec[i].fNames != NULL) {
+            firstInFamily = NULL;
+        }
+
+        bool isFixedWidth;
+        SkString name;
+        SkTypeface::Style style;
+
+        // we expect all the fonts, except the "fallback" fonts
+        bool isExpected = (rec[i].fNames != gFBNames);
+        if (!get_name_and_style(rec[i].fFileName, &name, &style,
+                                &isFixedWidth, isExpected)) {
+            continue;
+        }
+
+        SkTypeface* tf = SkNEW_ARGS(FileTypeface,
+                                    (style,
+                                     true,  // system-font (cannot delete)
+                                     firstInFamily, // what family to join
+                                     rec[i].fFileName,
+                                     isFixedWidth) // filename
+                                    );
+
+        if (rec[i].fNames != NULL) {
+            // see if this is one of our fallback fonts
+            if (rec[i].fNames == gFBNames) {
+            //    SkDebugf("---- adding %s as fallback[%d] fontID %d\n",
+            //             rec[i].fFileName, fallbackCount, tf->uniqueID());
+                gFallbackFonts[fallbackCount++] = tf->uniqueID();
+            }
+
+            firstInFamily = tf;
+            FamilyRec* family = find_family(tf);
+            const char* const* names = rec[i].fNames;
+
+            // record the default family if this is it
+            if (names == DEFAULT_NAMES) {
+                gDefaultFamily = family;
+            }
+            // add the names to map to this family
+            while (*names) {
+                add_name(*names, family);
+                names += 1;
+            }
+        }
+    }
+
+    // do this after all fonts are loaded. This is our default font, and it
+    // acts as a sentinel so we only execute load_system_fonts() once
+    gDefaultNormal = find_best_face(gDefaultFamily, SkTypeface::kNormal);
+    // now terminate our fallback list with the sentinel value
+    gFallbackFonts[fallbackCount] = 0;
+}
+
+void FamilyTypeface::onGetFontDescriptor(SkFontDescriptor* desc,
+                                         bool* isLocalStream) const {
+    {
+        SkAutoMutexAcquire ac(gFamilyMutex);
+        //desc->setFamilyName(find_family_name(this));
+        desc->setFontFileName(this->getUniqueString());
+    }
+    *isLocalStream = !this->isSysFont();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
+                                       const char familyName[],
+                                       SkTypeface::Style style) {
+    load_system_fonts();
+
+    SkAutoMutexAcquire  ac(gFamilyMutex);
+
+    // clip to legal style bits
+    style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
+
+    SkTypeface* tf = NULL;
+
+    if (NULL != familyFace) {
+        tf = find_typeface(familyFace, style);
+    } else if (NULL != familyName) {
+//        SkDebugf("======= familyName <%s>\n", familyName);
+        tf = find_typeface(familyName, style);
+    }
+
+    if (NULL == tf) {
+        tf = find_best_face(gDefaultFamily, style);
+    }
+
+    // we ref(), since the symantic is to return a new instance
+    tf->ref();
+    return tf;
+}
+
+SkTypeface* SkAndroidNextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
+    load_system_fonts();
+
+    /*  First see if fontID is already one of our fallbacks. If so, return
+        its successor. If fontID is not in our list, then return the first one
+        in our list. Note: list is zero-terminated, and returning zero means
+        we have no more fonts to use for fallbacks.
+     */
+    const uint32_t* list = gFallbackFonts;
+    for (int i = 0; list[i] != 0; i++) {
+        if (list[i] == currFontID) {
+            return find_from_uniqueID(list[i+1]);
+        }
+    }
+    return find_from_uniqueID(list[0]);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
+    if (NULL == stream || stream->getLength() <= 0) {
+        return NULL;
+    }
+
+    bool isFixedWidth;
+    SkString name;
+    SkTypeface::Style style;
+    find_name_and_attributes(stream, &name, &style, &isFixedWidth);
+
+    if (!name.isEmpty()) {
+        return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
+    } else {
+        return NULL;
+    }
+}
+
+SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
+    SkStream* stream = SkNEW_ARGS(SkFILEStream, (path));
+    SkTypeface* face = SkFontHost::CreateTypefaceFromStream(stream);
+    // since we created the stream, we let go of our ref() here
+    stream->unref();
+    return face;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+#include "SkFontMgr.h"
+
+SkFontMgr* SkFontMgr::Factory() {
+    // todo
+    return NULL;
+}
+
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -94,17 +94,17 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDest
         return;
 
     mBlur->Blur(mData);
 
     mozilla::gfx::Rect* dirtyRect = mBlur->GetDirtyRect();
 
     DrawTarget *dest = aDestinationCtx->GetDrawTarget();
     if (!dest) {
-      NS_ERROR("Blurring not supported for Thebes contexts!");
+      NS_WARNING("Blurring not supported for Thebes contexts!");
       return;
     }
 
     mozilla::RefPtr<SourceSurface> mask
       = dest->CreateSourceSurfaceFromData(mData,
                                           mBlur->GetSize(),
                                           mBlur->GetStride(),
                                           SurfaceFormat::A8);
--- a/gfx/thebes/gfxOS2Fonts.h
+++ b/gfx/thebes/gfxOS2Fonts.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_OS2_FONTS_H
 #define GFX_OS2_FONTS_H
 
 #include "gfxTypes.h"
 #include "gfxFont.h"
-#include "gfxMatrix.h"
 #include "nsDataHashtable.h"
 
 #define INCL_GPI
 #include <os2.h>
 #include <cairo-os2.h>
 #include "cairo-ft.h" // includes fontconfig.h, too
 #include <freetype/tttables.h>
 
--- a/gfx/thebes/gfxWindowsSurface.cpp
+++ b/gfx/thebes/gfxWindowsSurface.cpp
@@ -194,41 +194,16 @@ gfxWindowsSurface::GetAsImageSurface()
         return nullptr;
 
     nsRefPtr<gfxImageSurface> result = gfxASurface::Wrap(isurf).downcast<gfxImageSurface>();
     result->SetOpaqueRect(GetOpaqueRect());
 
     return result.forget();
 }
 
-already_AddRefed<gfxWindowsSurface>
-gfxWindowsSurface::OptimizeToDDB(HDC dc, const gfxIntSize& size, gfxImageFormat format)
-{
-    if (mForPrinting)
-        return nullptr;
-
-    if (format != gfxImageFormatRGB24)
-        return nullptr;
-
-    nsRefPtr<gfxWindowsSurface> wsurf = new gfxWindowsSurface(dc, size, format);
-    if (wsurf->CairoStatus() != 0)
-        return nullptr;
-
-    gfxContext tmpCtx(wsurf);
-    tmpCtx.SetOperator(gfxContext::OPERATOR_SOURCE);
-    tmpCtx.SetSource(this);
-    tmpCtx.Paint();
-
-    // we let the new DDB surfaces be converted back to dibsections if
-    // acquire_source_image is called on them
-    cairo_win32_surface_set_can_convert_to_dib(wsurf->CairoSurface(), TRUE);
-
-    return wsurf.forget().downcast<gfxWindowsSurface>();
-}
-
 nsresult
 gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
                                  const nsAString& aPrintToFileName)
 {
 #ifdef NS_PRINTING
 #define DOC_TITLE_LENGTH (MAX_PATH-1)
     DOCINFOW docinfo;
 
--- a/gfx/thebes/gfxWindowsSurface.h
+++ b/gfx/thebes/gfxWindowsSurface.h
@@ -52,20 +52,16 @@ public:
     virtual ~gfxWindowsSurface();
 
     HDC GetDC();
 
     HDC GetDCWithClip(gfxContext *);
 
     already_AddRefed<gfxImageSurface> GetAsImageSurface();
 
-    already_AddRefed<gfxWindowsSurface> OptimizeToDDB(HDC dc,
-                                                      const gfxIntSize& size,
-                                                      gfxImageFormat format);
-
     nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
     nsresult EndPrinting();
     nsresult AbortPrinting();
     nsresult BeginPage();
     nsresult EndPage();
 
     virtual int32_t GetDefaultContextFlags() const;
 
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -23,23 +23,16 @@ static bool gDisableOptimize = false;
 
 #if defined(XP_WIN)
 
 #include "gfxWindowsPlatform.h"
 
 /* Whether to use the windows surface; only for desktop win32 */
 #define USE_WIN_SURFACE 1
 
-static uint32_t gTotalDDBs = 0;
-static uint32_t gTotalDDBSize = 0;
-// only use up a maximum of 64MB in DDBs
-#define kMaxDDBSize (64*1024*1024)
-// and don't let anything in that's bigger than 4MB
-#define kMaxSingleDDBSize (4*1024*1024)
-
 #endif
 
 using namespace mozilla;
 using namespace mozilla::image;
 
 // Returns true if an image of aWidth x aHeight is allowed and legal.
 static bool AllowedImageSize(int32_t aWidth, int32_t aHeight)
 {
@@ -108,41 +101,32 @@ imgFrame::imgFrame() :
   mTimeout(100),
   mDisposalMethod(0), /* imgIContainer::kDisposeNotSpecified */
   mLockCount(0),
   mBlendMethod(1), /* imgIContainer::kBlendOver */
   mSinglePixel(false),
   mFormatChanged(false),
   mCompositingFailed(false),
   mNonPremult(false),
-#ifdef USE_WIN_SURFACE
-  mIsDDBSurface(false),
-#endif
   mInformedDiscardTracker(false),
   mDirty(false)
 {
   static bool hasCheckedOptimize = false;
   if (!hasCheckedOptimize) {
     if (PR_GetEnv("MOZ_DISABLE_IMAGE_OPTIMIZE")) {
       gDisableOptimize = true;
     }
     hasCheckedOptimize = true;
   }
 }
 
 imgFrame::~imgFrame()
 {
   moz_free(mPalettedImageData);
   mPalettedImageData = nullptr;
-#ifdef USE_WIN_SURFACE
-  if (mIsDDBSurface) {
-      gTotalDDBs--;
-      gTotalDDBSize -= mSize.width * mSize.height * 4;
-  }
-#endif
 
   if (mInformedDiscardTracker) {
     DiscardTracker::InformAllocation(-4 * mSize.height * mSize.width);
   }
 }
 
 nsresult imgFrame::Init(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
                         gfxImageFormat aFormat, uint8_t aPaletteDepth /* = 0 */)
@@ -291,50 +275,18 @@ nsresult imgFrame::Optimize()
   // if we're being forced to use image surfaces due to
   // resource constraints, don't try to optimize beyond same-pixel.
   if (ShouldUseImageSurfaces())
     return NS_OK;
 
   mOptSurface = nullptr;
 
 #ifdef USE_WIN_SURFACE
-  // we need to special-case windows here, because windows has
-  // a distinction between DIB and DDB and we want to use DDBs as much
-  // as we can.
   if (mWinSurface) {
-    // Don't do DDBs for large images; see bug 359147
-    // Note that we bother with DDBs at all because they are much faster
-    // on some systems; on others there isn't much of a speed difference
-    // between DIBs and DDBs.
-    //
-    // Originally this just limited to 1024x1024; but that still
-    // had us hitting overall total memory usage limits (which was
-    // around 220MB on my intel shared memory system with 2GB RAM
-    // and 16-128mb in use by the video card, so I can't make
-    // heads or tails out of this limit).
-    //
-    // So instead, we clamp the max size to 64MB (this limit shuld
-    // be made dynamic based on.. something.. as soon a we figure
-    // out that something) and also limit each individual image to
-    // be less than 4MB to keep very large images out of DDBs.
-
-    // assume (almost -- we don't quadword-align) worst-case size
-    uint32_t ddbSize = mSize.width * mSize.height * 4;
-    if (ddbSize <= kMaxSingleDDBSize &&
-        ddbSize + gTotalDDBSize <= kMaxDDBSize)
-    {
-      nsRefPtr<gfxWindowsSurface> wsurf = mWinSurface->OptimizeToDDB(nullptr, gfxIntSize(mSize.width, mSize.height), mFormat);
-      if (wsurf) {
-        gTotalDDBs++;
-        gTotalDDBSize += ddbSize;
-        mIsDDBSurface = true;
-        mOptSurface = wsurf;
-      }
-    }
-    if (!mOptSurface && !mFormatChanged) {
+    if (!mFormatChanged) {
       // just use the DIB if the format has not changed
       mOptSurface = mWinSurface;
     }
   }
 #endif
 
 #ifdef XP_MACOSX
   if (mQuartzSurface) {
--- a/image/src/imgFrame.h
+++ b/image/src/imgFrame.h
@@ -173,19 +173,16 @@ private: // data
   bool mSinglePixel;
   bool mFormatChanged;
   bool mCompositingFailed;
   bool mNonPremult;
 
   /** Have we called DiscardTracker::InformAllocation()? */
   bool mInformedDiscardTracker;
 
-#ifdef XP_WIN
-  bool mIsDDBSurface;
-#endif
   bool mDirty;
 };
 
 namespace mozilla {
 namespace image {
   // An RAII class to ensure it's easy to balance locks and unlocks on
   // imgFrames.
   class AutoFrameLocker
deleted file mode 100644
--- a/ipc/chromium/base/file_version_info_linux.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_FILE_VERSION_INFO_LINUX_H_
-#define BASE_FILE_VERSION_INFO_LINUX_H_
-
-#define COMPANY_NAME L"@COMPANY_FULLNAME@"
-#define FILE_DESCRIPTION L"@PRODUCT_FULLNAME@"
-#define FILE_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
-#define LEGAL_COPYRIGHT L"@COPYRIGHT@"
-#define PRODUCT_NAME L"@PRODUCT_FULLNAME@"
-#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
-#define COMPANY_SHORT_NAME L"@COMPANY_SHORTNAME@"
-#define PRODUCT_SHORT_NAME L"@PRODUCT_SHORTNAME@"
-#define LAST_CHANGE L"@LASTCHANGE@"
-#define OFFICIAL_BUILD 1
-// TODO(mmoss) Do these have values for Linux?
-#define INTERNAL_NAME L""
-#define ORIGINAL_FILENAME L""
-#define PRIVATE_BUILD L""
-#define SPECIAL_BUILD L""
-#define COMMENTS L""
-#define LEGAL_TRADEMARKS L""
-
-#endif  // BASE_FILE_VERSION_INFO_LINUX_H_
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -68,18 +68,16 @@ UNIFIED_SOURCES += [
     'src/base/timer.cc',
     'src/base/trace_event.cc',
     'src/base/tracked.cc',
     'src/base/tracked_objects.cc',
     'src/chrome/common/child_process.cc',
     'src/chrome/common/child_process_host.cc',
     'src/chrome/common/child_process_info.cc',
     'src/chrome/common/child_thread.cc',
-    'src/chrome/common/chrome_counters.cc',
-    'src/chrome/common/chrome_paths.cc',
     'src/chrome/common/chrome_switches.cc',
     'src/chrome/common/debug_flags.cc',
     'src/chrome/common/env_vars.cc',
     'src/chrome/common/ipc_channel_proxy.cc',
     'src/chrome/common/ipc_logging.cc',
     'src/chrome/common/ipc_message.cc',
     'src/chrome/common/ipc_sync_channel.cc',
     'src/chrome/common/ipc_sync_message.cc',
@@ -91,17 +89,16 @@ UNIFIED_SOURCES += [
 if os_win:
     SOURCES += [
         'src/base/base_paths_win.cc',
         'src/base/condition_variable_win.cc',
         'src/base/cpu.cc',
         'src/base/debug_util_win.cc',
         'src/base/event_recorder.cc',
         'src/base/file_util_win.cc',
-        'src/base/file_version_info.cc',
         'src/base/idle_timer.cc',
         'src/base/lock_impl_win.cc',
         'src/base/message_pump_win.cc',
         'src/base/object_watcher.cc',
         'src/base/platform_file_win.cc',
         'src/base/platform_thread_win.cc',
         'src/base/process_util_win.cc',
         'src/base/process_win.cc',
@@ -112,18 +109,16 @@ if os_win:
         'src/base/sys_string_conversions_win.cc',
         'src/base/system_monitor_win.cc',
         'src/base/thread_local_storage_win.cc',
         'src/base/thread_local_win.cc',
         'src/base/time_win.cc',
         'src/base/waitable_event_watcher_win.cc',
         'src/base/waitable_event_win.cc',
         'src/base/win_util.cc',
-        'src/chrome/common/chrome_constants.cc',
-        'src/chrome/common/chrome_paths_win.cc',
         'src/chrome/common/ipc_channel_win.cc',
         'src/chrome/common/process_watcher_win.cc',
         'src/chrome/common/transport_dib_win.cc',
     ]
 elif not CONFIG['MOZ_NATIVE_LIBEVENT']:
     SOURCES += [
         'src/third_party/libevent/buffer.c',
         'src/third_party/libevent/bufferevent.c',
@@ -190,37 +185,34 @@ if os_macosx:
         'src/base/time_mac.cc',
         'src/chrome/common/mach_message_source_mac.cc',
         'src/chrome/common/transport_dib_mac.cc',
     ]
     SOURCES += [
         'src/base/base_paths_mac.mm',
         'src/base/chrome_application_mac.mm',
         'src/base/file_util_mac.mm',
-        'src/base/file_version_info_mac.mm',
         'src/base/mac_util.mm',
         'src/base/message_pump_mac.mm',
         'src/base/platform_thread_mac.mm',
         'src/base/process_util_mac.mm',
         'src/base/scoped_nsautorelease_pool.mm',
         'src/base/sys_string_conversions_mac.mm',
         'src/base/worker_pool_mac.mm',
-        'src/chrome/common/chrome_paths_mac.mm',
         'src/chrome/common/mach_ipc_mac.mm',
     ]
     if not CONFIG['MOZ_NATIVE_LIBEVENT']:
         UNIFIED_SOURCES += [
             'src/third_party/libevent/kqueue.c',
         ]
 
 if os_linux:
     SOURCES += [
         'src/base/atomicops_internals_x86_gcc.cc',
         'src/base/base_paths_linux.cc',
-        'src/base/file_version_info_linux.cc',
         'src/base/idle_timer_none.cc',
         'src/base/process_util_linux.cc',
         'src/base/time_posix.cc',
     ]
     if CONFIG['MOZ_WIDGET_GTK']:
         SOURCES += [
             'src/base/message_pump_glib.cc',
         ]
deleted file mode 100644
--- a/ipc/chromium/src/base/file_version_info.cc
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <windows.h>
-
-#include "base/file_version_info.h"
-
-#include "base/logging.h"
-#include "base/path_service.h"
-
-// This has to be last.
-#include <strsafe.h>
-
-FileVersionInfo::FileVersionInfo(void* data, int language, int code_page)
-    : language_(language), code_page_(code_page) {
-  data_.reset((char*) data);
-  fixed_file_info_ = NULL;
-  UINT size;
-  ::VerQueryValue(data_.get(), L"\\", (LPVOID*)&fixed_file_info_, &size);
-}
-
-FileVersionInfo::~FileVersionInfo() {
-  DCHECK(data_.get());
-}
-
-typedef struct {
-  WORD language;
-  WORD code_page;
-} LanguageAndCodePage;
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
-  std::wstring app_path;
-  if (!PathService::Get(base::FILE_MODULE, &app_path))
-    return NULL;
-
-  return CreateFileVersionInfo(app_path);
-}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
-    const FilePath& file_path) {
-  DWORD dummy;
-  const wchar_t* path = file_path.value().c_str();
-  DWORD length = ::GetFileVersionInfoSize(path, &dummy);
-  if (length == 0)
-    return NULL;
-
-  void* data = calloc(length, 1);
-  if (!data)
-    return NULL;
-
-  if (!::GetFileVersionInfo(path, dummy, length, data)) {
-    free(data);
-    return NULL;
-  }
-
-  LanguageAndCodePage* translate = NULL;
-  uint32_t page_count;
-  BOOL query_result = VerQueryValue(data, L"\\VarFileInfo\\Translation",
-                                   (void**) &translate, &page_count);
-
-  if (query_result && translate) {
-    return new FileVersionInfo(data, translate->language,
-                               translate->code_page);
-
-  } else {
-    free(data);
-    return NULL;
-  }
-}
-
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
-    const std::wstring& file_path) {
-  FilePath file_path_fp = FilePath::FromWStringHack(file_path);
-  return CreateFileVersionInfo(file_path_fp);
-}
-
-std::wstring FileVersionInfo::company_name() {
-  return GetStringValue(L"CompanyName");
-}
-
-std::wstring FileVersionInfo::company_short_name() {
-  return GetStringValue(L"CompanyShortName");
-}
-
-std::wstring FileVersionInfo::internal_name() {
-  return GetStringValue(L"InternalName");
-}
-
-std::wstring FileVersionInfo::product_name() {
-  return GetStringValue(L"ProductName");
-}
-
-std::wstring FileVersionInfo::product_short_name() {
-  return GetStringValue(L"ProductShortName");
-}
-
-std::wstring FileVersionInfo::comments() {
-  return GetStringValue(L"Comments");
-}
-
-std::wstring FileVersionInfo::legal_copyright() {
-  return GetStringValue(L"LegalCopyright");
-}
-
-std::wstring FileVersionInfo::product_version() {
-  return GetStringValue(L"ProductVersion");
-}
-
-std::wstring FileVersionInfo::file_description() {
-  return GetStringValue(L"FileDescription");
-}
-
-std::wstring FileVersionInfo::legal_trademarks() {
-  return GetStringValue(L"LegalTrademarks");
-}
-
-std::wstring FileVersionInfo::private_build() {
-  return GetStringValue(L"PrivateBuild");
-}
-
-std::wstring FileVersionInfo::file_version() {
-  return GetStringValue(L"FileVersion");
-}
-
-std::wstring FileVersionInfo::original_filename() {
-  return GetStringValue(L"OriginalFilename");
-}
-
-std::wstring FileVersionInfo::special_build() {
-  return GetStringValue(L"SpecialBuild");
-}
-
-std::wstring FileVersionInfo::last_change() {
-  return GetStringValue(L"LastChange");
-}
-
-bool FileVersionInfo::is_official_build() {
-  return (GetStringValue(L"Official Build").compare(L"1") == 0);
-}
-
-bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
-
-  WORD lang_codepage[8];
-  int i = 0;
-  // Use the language and codepage from the DLL.
-  lang_codepage[i++] = language_;
-  lang_codepage[i++] = code_page_;
-  // Use the default language and codepage from the DLL.
-  lang_codepage[i++] = ::GetUserDefaultLangID();
-  lang_codepage[i++] = code_page_;
-  // Use the language from the DLL and Latin codepage (most common).
-  lang_codepage[i++] = language_;
-  lang_codepage[i++] = 1252;
-  // Use the default language and Latin codepage (most common).
-  lang_codepage[i++] = ::GetUserDefaultLangID();
-  lang_codepage[i++] = 1252;
-
-  i = 0;
-  while (i < arraysize(lang_codepage)) {
-    wchar_t sub_block[MAX_PATH];
-    WORD language = lang_codepage[i++];
-    WORD code_page = lang_codepage[i++];
-    _snwprintf_s(sub_block, MAX_PATH, MAX_PATH,
-                 L"\\StringFileInfo\\%04x%04x\\%ls", language, code_page, name);
-    LPVOID value = NULL;
-    uint32_t size;
-    BOOL r = ::VerQueryValue(data_.get(), sub_block, &value, &size);
-    if (r && value) {
-      value_str->assign(static_cast<wchar_t*>(value));
-      return true;
-    }
-  }
-  return false;
-}
-
-std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
-  std::wstring str;
-  if (GetValue(name, &str))
-    return str;
-  else
-    return L"";
-}
deleted file mode 100644
--- a/ipc/chromium/src/base/file_version_info.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_FILE_VERSION_INFO_H__
-#define BASE_FILE_VERSION_INFO_H__
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/scoped_ptr.h"
-
-#if defined(OS_WIN)
-struct tagVS_FIXEDFILEINFO;
-typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO;
-#elif defined(OS_MACOSX)
-#ifdef __OBJC__
-@class NSBundle;
-#else
-class NSBundle;
-#endif
-#endif
-
-// Provides a way to access the version information for a file.
-// This is the information you access when you select a file in the Windows
-// explorer, right-click select Properties, then click the Version tab.
-
-class FileVersionInfo {
- public:
-  // Creates a FileVersionInfo for the specified path. Returns NULL if something
-  // goes wrong (typically the file does not exit or cannot be opened). The
-  // returned object should be deleted when you are done with it.
-  static FileVersionInfo* CreateFileVersionInfo(const FilePath& file_path);
-  // This version, taking a wstring, is deprecated and only kept around
-  // until we can fix all callers.
-  static FileVersionInfo* CreateFileVersionInfo(const std::wstring& file_path);
-
-  // Creates a FileVersionInfo for the current module. Returns NULL in case
-  // of error. The returned object should be deleted when you are done with it.
-  static FileVersionInfo* CreateFileVersionInfoForCurrentModule();
-
-  ~FileVersionInfo();
-
-  // Accessors to the different version properties.
-  // Returns an empty string if the property is not found.
-  std::wstring company_name();
-  std::wstring company_short_name();
-  std::wstring product_name();
-  std::wstring product_short_name();
-  std::wstring internal_name();
-  std::wstring product_version();
-  std::wstring private_build();
-  std::wstring special_build();
-  std::wstring comments();
-  std::wstring original_filename();
-  std::wstring file_description();
-  std::wstring file_version();
-  std::wstring legal_copyright();
-  std::wstring legal_trademarks();
-  std::wstring last_change();
-  bool is_official_build();
-
-  // Lets you access other properties not covered above.
-  bool GetValue(const wchar_t* name, std::wstring* value);
-
-  // Similar to GetValue but returns a wstring (empty string if the property
-  // does not exist).
-  std::wstring GetStringValue(const wchar_t* name);
-
-#ifdef OS_WIN
-  // Get the fixed file info if it exists. Otherwise NULL
-  VS_FIXEDFILEINFO* fixed_file_info() { return fixed_file_info_; }
-#endif
-
- private:
-#if defined(OS_WIN)
-  FileVersionInfo(void* data, int language, int code_page);
-
-  scoped_ptr_malloc<char> data_;
-  int language_;
-  int code_page_;
-  // This is a pointer into the data_ if it exists. Otherwise NULL.
-  VS_FIXEDFILEINFO* fixed_file_info_;
-#elif defined(OS_MACOSX)
-  explicit FileVersionInfo(NSBundle *bundle);
-
-  NSBundle *bundle_;
-#elif defined(OS_LINUX)
-  FileVersionInfo();
-#endif
-
-  DISALLOW_EVIL_CONSTRUCTORS(FileVersionInfo);
-};
-
-#endif  // BASE_FILE_VERSION_INFO_H__
deleted file mode 100644
--- a/ipc/chromium/src/base/file_version_info_linux.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/file_version_info.h"
-#include "base/file_version_info_linux.h"
-
-#include <string>
-
-// TODO(mmoss) This only provides version info for the current binary, but it's
-// also called for arbitrary files (e.g. plugins).
-// See http://code.google.com/p/chromium/issues/detail?id=8132 for a discussion
-// on what we should do with this module.
-
-FileVersionInfo::FileVersionInfo() {}
-
-FileVersionInfo::~FileVersionInfo() {}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
-  return new FileVersionInfo();
-}
-
-std::wstring FileVersionInfo::company_name() {
-  return COMPANY_NAME;
-}
-
-std::wstring FileVersionInfo::company_short_name() {
-  return COMPANY_SHORT_NAME;
-}
-
-std::wstring FileVersionInfo::product_name() {
-  return PRODUCT_NAME;
-}
-
-std::wstring FileVersionInfo::product_short_name() {
-  return PRODUCT_SHORT_NAME;
-}
-
-std::wstring FileVersionInfo::internal_name() {
-  return INTERNAL_NAME;
-}
-
-std::wstring FileVersionInfo::product_version() {
-  return PRODUCT_VERSION;
-}
-
-std::wstring FileVersionInfo::private_build() {
-  return PRIVATE_BUILD;
-}
-
-std::wstring FileVersionInfo::special_build() {
-  return SPECIAL_BUILD;
-}
-
-std::wstring FileVersionInfo::comments() {
-  return COMMENTS;
-}
-
-std::wstring FileVersionInfo::original_filename() {
-  return ORIGINAL_FILENAME;
-}
-
-std::wstring FileVersionInfo::file_description() {
-  return FILE_DESCRIPTION;
-}
-
-std::wstring FileVersionInfo::file_version() {
-  return FILE_VERSION;
-}
-
-std::wstring FileVersionInfo::legal_copyright() {
-  return LEGAL_COPYRIGHT;
-}
-
-std::wstring FileVersionInfo::legal_trademarks() {
-  return LEGAL_TRADEMARKS;
-}
-
-std::wstring FileVersionInfo::last_change() {
-  return LAST_CHANGE;
-}
-
-bool FileVersionInfo::is_official_build() {
-  return OFFICIAL_BUILD;
-}
deleted file mode 100644
--- a/ipc/chromium/src/base/file_version_info_linux.h.version
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_FILE_VERSION_INFO_LINUX_H_
-#define BASE_FILE_VERSION_INFO_LINUX_H_
-
-#define COMPANY_NAME L"@COMPANY_FULLNAME@"
-#define FILE_DESCRIPTION L"@PRODUCT_FULLNAME@"
-#define FILE_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
-#define LEGAL_COPYRIGHT L"@COPYRIGHT@"
-#define PRODUCT_NAME L"@PRODUCT_FULLNAME@"
-#define PRODUCT_VERSION L"@MAJOR@.@MINOR@.@BUILD@.@PATCH@"
-#define COMPANY_SHORT_NAME L"@COMPANY_SHORTNAME@"
-#define PRODUCT_SHORT_NAME L"@PRODUCT_SHORTNAME@"
-#define LAST_CHANGE L"@LASTCHANGE@"
-#define OFFICIAL_BUILD @OFFICIAL_BUILD@
-// TODO(mmoss) Do these have values for Linux?
-#define INTERNAL_NAME L""
-#define ORIGINAL_FILENAME L""
-#define PRIVATE_BUILD L""
-#define SPECIAL_BUILD L""
-#define COMMENTS L""
-#define LEGAL_TRADEMARKS L""
-
-#endif  // BASE_FILE_VERSION_INFO_LINUX_H_
deleted file mode 100644
--- a/ipc/chromium/src/base/file_version_info_mac.mm
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/file_version_info.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/logging.h"
-#include "base/string_util.h"
-
-FileVersionInfo::FileVersionInfo(NSBundle *bundle) : bundle_(bundle) {
-  [bundle_ retain];
-}
-
-FileVersionInfo::~FileVersionInfo() {
-  [bundle_ release];
-}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
-  // TODO(erikkay): this should really use bundleForClass, but we don't have
-  // a class to hang onto yet.
-  NSBundle* bundle = [NSBundle mainBundle];
-  return new FileVersionInfo(bundle);
-}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
-    const std::wstring& file_path) {
-  NSString* path = [NSString stringWithCString:
-      reinterpret_cast<const char*>(file_path.c_str())
-        encoding:NSUTF32StringEncoding];
-  return new FileVersionInfo([NSBundle bundleWithPath:path]);
-}
-
-// static
-FileVersionInfo* FileVersionInfo::CreateFileVersionInfo(
-    const FilePath& file_path) {
-  NSString* path = [NSString stringWithUTF8String:file_path.value().c_str()];
-  return new FileVersionInfo([NSBundle bundleWithPath:path]);
-}
-
-std::wstring FileVersionInfo::company_name() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::company_short_name() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::internal_name() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::product_name() {
-  return GetStringValue(L"CFBundleName");
-}
-
-std::wstring FileVersionInfo::product_short_name() {
-  return GetStringValue(L"CFBundleName");
-}
-
-std::wstring FileVersionInfo::comments() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::legal_copyright() {
-  return GetStringValue(L"CFBundleGetInfoString");
-}
-
-std::wstring FileVersionInfo::product_version() {
-  return GetStringValue(L"CFBundleShortVersionString");
-}
-
-std::wstring FileVersionInfo::file_description() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::legal_trademarks() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::private_build() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::file_version() {
-  // CFBundleVersion has limitations that may not be honored by a
-  // proper Chromium version number, so try KSVersion first.
-  std::wstring version = GetStringValue(L"KSVersion");
-  if (version == L"")
-    version = GetStringValue(L"CFBundleVersion");
-  return version;
-}
-
-std::wstring FileVersionInfo::original_filename() {
-  return GetStringValue(L"CFBundleName");
-}
-
-std::wstring FileVersionInfo::special_build() {
-  return L"";
-}
-
-std::wstring FileVersionInfo::last_change() {
-  return L"";
-}
-
-bool FileVersionInfo::is_official_build() {
-  return false;
-}
-
-bool FileVersionInfo::GetValue(const wchar_t* name, std::wstring* value_str) {
-  if (bundle_) {
-    NSString* value = [bundle_ objectForInfoDictionaryKey:
-        [NSString stringWithUTF8String:WideToUTF8(name).c_str()]];
-    if (value) {
-      *value_str = reinterpret_cast<const wchar_t*>(
-          [value cStringUsingEncoding:NSUTF32StringEncoding]);
-      return true;
-    }
-  }
-  return false;
-}
-
-std::wstring FileVersionInfo::GetStringValue(const wchar_t* name) {
-  std::wstring str;
-  if (GetValue(name, &str))
-    return str;
-  return L"";
-}
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_constants.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/chrome_constants.h"
-
-#include "base/file_path.h"
-
-#define FPL FILE_PATH_LITERAL
-
-namespace chrome {
-
-// The following should not be used for UI strings; they are meant
-// for system strings only. UI changes should be made in the GRD.
-#if defined(OS_WIN)
-const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
-#elif defined(OS_LINUX)
-const wchar_t kBrowserProcessExecutableName[] = L"chrome";
-#elif defined(OS_MACOSX)
-const wchar_t kBrowserProcessExecutableName[] =
-#if defined(GOOGLE_CHROME_BUILD)
-    L"Chrome";
-#else
-    L"Chromium";
-#endif  // GOOGLE_CHROME_BUILD
-#endif  // OS_*
-#if defined(OS_WIN)
-const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
-#elif defined(OS_LINUX)
-const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
-#elif defined(OS_MACOSX)
-const wchar_t kBrowserProcessExecutablePath[] =
-#if defined(GOOGLE_CHROME_BUILD)
-    L"Chrome.app/Contents/MacOS/Chrome";
-#else
-    L"Chromium.app/Contents/MacOS/Chromium";
-#endif  // GOOGLE_CHROME_BUILD
-#endif  // OS_*
-#if defined(GOOGLE_CHROME_BUILD)
-const wchar_t kBrowserAppName[] = L"Chrome";
-const char    kStatsFilename[] = "ChromeStats2";
-#else
-const wchar_t kBrowserAppName[] = L"Chromium";
-const char    kStatsFilename[] = "ChromiumStats2";
-#endif
-const wchar_t kExternalTabWindowClass[] = L"Chrome_ExternalTabContainer";
-const wchar_t kMessageWindowClass[] = L"Chrome_MessageWindow";
-const wchar_t kCrashReportLog[] = L"Reported Crashes.txt";
-const wchar_t kTestingInterfaceDLL[] = L"testing_interface.dll";
-const wchar_t kNotSignedInProfile[] = L"Default";
-const wchar_t kNotSignedInID[] = L"not-signed-in";
-const wchar_t kBrowserResourcesDll[] = L"chrome.dll";
-const FilePath::CharType kExtensionFileExtension[] = FPL("crx");
-
-// filenames
-const FilePath::CharType kArchivedHistoryFilename[] = FPL("Archived History");
-const FilePath::CharType kCacheDirname[] = FPL("Cache");
-const FilePath::CharType kMediaCacheDirname[] = FPL("Media Cache");
-const FilePath::CharType kOffTheRecordMediaCacheDirname[] =
-    FPL("Incognito Media Cache");
-const wchar_t kChromePluginDataDirname[] = L"Plugin Data";
-const FilePath::CharType kCookieFilename[] = FPL("Cookies");
-const FilePath::CharType kHistoryFilename[] = FPL("History");
-const FilePath::CharType kLocalStateFilename[] = FPL("Local State");
-const FilePath::CharType kPreferencesFilename[] = FPL("Preferences");
-const FilePath::CharType kSafeBrowsingFilename[] = FPL("Safe Browsing");
-// WARNING: SingletonSocket can't contain spaces, because otherwise
-// chrome_process_util_linux would be broken.
-const FilePath::CharType kSingletonSocketFilename[] = FPL("SingletonSocket");
-const FilePath::CharType kThumbnailsFilename[] = FPL("Thumbnails");
-const wchar_t kUserDataDirname[] = L"User Data";
-const FilePath::CharType kUserScriptsDirname[] = FPL("User Scripts");
-const FilePath::CharType kWebDataFilename[] = FPL("Web Data");
-const FilePath::CharType kBookmarksFileName[] = FPL("Bookmarks");
-const FilePath::CharType kHistoryBookmarksFileName[] =
-    FPL("Bookmarks From History");
-const FilePath::CharType kCustomDictionaryFileName[] =
-    FPL("Custom Dictionary.txt");
-
-// This number used to be limited to 32 in the past (see b/535234).
-const unsigned int kMaxRendererProcessCount = 42;
-const int kStatsMaxThreads = 32;
-const int kStatsMaxCounters = 300;
-
-// We don't enable record mode in the released product because users could
-// potentially be tricked into running a product in record mode without
-// knowing it.  Enable in debug builds.  Playback mode is allowed always,
-// because it is useful for testing and not hazardous by itself.
-#ifndef NDEBUG
-const bool kRecordModeEnabled = true;
-#else
-const bool kRecordModeEnabled = false;
-#endif
-
-}  // namespace chrome
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_constants.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// A handful of resource-like constants related to the Chrome application.
-
-#ifndef CHROME_COMMON_CHROME_CONSTANTS_H_
-#define CHROME_COMMON_CHROME_CONSTANTS_H_
-
-#include "base/file_path.h"
-
-namespace chrome {
-
-extern const wchar_t kBrowserProcessExecutableName[];
-extern const wchar_t kBrowserProcessExecutablePath[];
-extern const wchar_t kBrowserAppName[];
-extern const wchar_t kMessageWindowClass[];
-extern const wchar_t kExternalTabWindowClass[];
-extern const wchar_t kCrashReportLog[];
-extern const wchar_t kTestingInterfaceDLL[];
-extern const wchar_t kNotSignedInProfile[];
-extern const wchar_t kNotSignedInID[];
-extern const char    kStatsFilename[];
-extern const wchar_t kBrowserResourcesDll[];
-extern const FilePath::CharType kExtensionFileExtension[];
-
-// filenames
-extern const FilePath::CharType kArchivedHistoryFilename[];
-extern const FilePath::CharType kCacheDirname[];
-extern const FilePath::CharType kMediaCacheDirname[];
-extern const FilePath::CharType kOffTheRecordMediaCacheDirname[];
-extern const wchar_t kChromePluginDataDirname[];
-extern const FilePath::CharType kCookieFilename[];
-extern const FilePath::CharType kHistoryFilename[];
-extern const FilePath::CharType kLocalStateFilename[];
-extern const FilePath::CharType kPreferencesFilename[];
-extern const FilePath::CharType kSafeBrowsingFilename[];
-extern const FilePath::CharType kSingletonSocketFilename[];
-extern const FilePath::CharType kThumbnailsFilename[];
-extern const wchar_t kUserDataDirname[];
-extern const FilePath::CharType kUserScriptsDirname[];
-extern const FilePath::CharType kWebDataFilename[];
-extern const FilePath::CharType kBookmarksFileName[];
-extern const FilePath::CharType kHistoryBookmarksFileName[];
-extern const FilePath::CharType kCustomDictionaryFileName[];
-
-extern const unsigned int kMaxRendererProcessCount;
-extern const int kStatsMaxThreads;
-extern const int kStatsMaxCounters;
-
-extern const bool kRecordModeEnabled;
-
-}  // namespace chrome
-
-#endif  // CHROME_COMMON_CHROME_CONSTANTS_H_
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_counters.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/chrome_counters.h"
-
-#include "base/stats_counters.h"
-
-namespace chrome {
-
-// Note: We use the construct-on-first-use pattern here, because we don't
-//       want to fight with any static initializer ordering problems later.
-//       The downside of this is that the objects don't ever get cleaned up.
-//       But they are small and this is okay.
-
-// Note: Because these are constructed on-first-use, there is a slight
-//       race condition - two threads could initialize the same counter.
-//       If this happened, the stats table would still work just fine;
-//       we'd leak the extraneous StatsCounter object once, and that
-//       would be it.  But these are small objects, so this is ok.
-
-StatsCounter& Counters::ipc_send_counter() {
-  static StatsCounter* ctr = new StatsCounter("IPC.SendMsgCount");
-  return *ctr;
-}
-
-StatsCounterTimer& Counters::chrome_main() {
-  static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.Init");
-  return *ctr;
-}
-
-StatsCounterTimer& Counters::renderer_main() {
-  static StatsCounterTimer* ctr = new StatsCounterTimer("Chrome.RendererInit");
-  return *ctr;
-}
-
-StatsCounterTimer& Counters::spellcheck_init() {
-  static StatsCounterTimer* ctr = new StatsCounterTimer("SpellCheck.Init");
-  return *ctr;
-}
-
-StatsRate& Counters::spellcheck_lookup() {
-  static StatsRate* ctr = new StatsRate("SpellCheck.Lookup");
-  return *ctr;
-}
-
-StatsCounterTimer& Counters::plugin_load() {
-  static StatsCounterTimer* ctr = new StatsCounterTimer("ChromePlugin.Load");
-  return *ctr;
-}
-
-StatsRate& Counters::plugin_intercept() {
-  static StatsRate* ctr = new StatsRate("ChromePlugin.Intercept");
-  return *ctr;
-}
-
-}  // namespace chrome
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_counters.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Counters used within the browser.
-
-#ifndef CHROME_COMMON_CHROME_COUNTERS_H_
-#define CHROME_COMMON_CHROME_COUNTERS_H_
-
-class StatsCounter;
-class StatsCounterTimer;
-class StatsRate;
-
-namespace chrome {
-
-class Counters {
- public:
-  // The number of messages sent on IPC channels.
-  static StatsCounter& ipc_send_counter();
-
-  // The amount of time spent in chrome initialization.
-  static StatsCounterTimer& chrome_main();
-
-  // The amount of time spent in renderer initialization.
-  static StatsCounterTimer& renderer_main();
-
-  // Time spent in spellchecker initialization.
-  static StatsCounterTimer& spellcheck_init();
-
-  // Time/Count of spellcheck lookups.
-  static StatsRate& spellcheck_lookup();
-
-  // Time spent loading the Chrome plugins.
-  static StatsCounterTimer& plugin_load();
-
-  // Time/Count of plugin network interception.
-  static StatsRate& plugin_intercept();
-};
-
-}  // namespace chrome
-
-#endif  // CHROME_COMMON_CHROME_COUNTERS_H_
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_paths.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/chrome_paths.h"
-
-#include "base/command_line.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "base/string_util.h"
-#include "base/sys_info.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths_internal.h"
-#include "chrome/common/chrome_switches.h"
-
-namespace chrome {
-
-bool GetGearsPluginPathFromCommandLine(FilePath* path) {
-#ifndef NDEBUG
-  // for debugging, support a cmd line based override
-  std::wstring plugin_path = CommandLine::ForCurrentProcess()->GetSwitchValue(
-      switches::kGearsPluginPathOverride);
-  // TODO(tc): After GetSwitchNativeValue lands, we don't need to use
-  // FromWStringHack.
-  *path = FilePath::FromWStringHack(plugin_path);
-  return !plugin_path.empty();
-#else
-  return false;
-#endif
-}
-
-bool PathProvider(int key, FilePath* result) {
-  return true;
-}
-
-// This cannot be done as a static initializer sadly since Visual Studio will
-// eliminate this object file if there is no direct entry point into it.
-void RegisterPathProvider() {
-  PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
-}
-
-}  // namespace chrome
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_paths.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_CHROME_PATHS_H__
-#define CHROME_COMMON_CHROME_PATHS_H__
-
-// This file declares path keys for the chrome module.  These can be used with
-// the PathService to access various special directories and files.
-
-namespace chrome {
-
-enum {
-  PATH_START = 1000,
-
-  DIR_APP = PATH_START,  // directory where dlls and data reside
-  DIR_LOGS,              // directory where logs should be written
-  DIR_USER_DATA,         // directory where user data can be written
-  DIR_CRASH_DUMPS,       // directory where crash dumps are written
-  DIR_USER_DESKTOP,      // directory that correspond to the desktop
-  DIR_RESOURCES,         // directory where application resources are stored
-  DIR_INSPECTOR,         // directory where web inspector is located
-  DIR_THEMES,            // directory where theme dll files are stored
-  DIR_LOCALES,           // directory where locale resources are stored
-  DIR_APP_DICTIONARIES,  // directory where the global dictionaries are
-  DIR_USER_DOCUMENTS,    // directory for a user's "My Documents"
-  DIR_DEFAULT_DOWNLOADS, // directory for a user's "My Documents/Downloads"
-  FILE_RESOURCE_MODULE,  // full path and filename of the module that contains
-                         // embedded resources (version, strings, images, etc.)
-  FILE_LOCAL_STATE,      // path and filename to the file in which machine/
-                         // installation-specific state is saved
-  FILE_RECORDED_SCRIPT,  // full path to the script.log file that contains
-                         // recorded browser events for playback.
-  FILE_GEARS_PLUGIN,     // full path to the gears.dll plugin file.
-  FILE_LIBAVCODEC,       // full path to libavcodec media decoding library.
-  FILE_LIBAVFORMAT,      // full path to libavformat media parsing library.
-  FILE_LIBAVUTIL,        // full path to libavutil media utility library.
-
-  // Valid only in development environment; TODO(darin): move these
-  DIR_TEST_DATA,         // directory where unit test data resides
-  DIR_TEST_TOOLS,        // directory where unit test tools reside
-  FILE_TEST_SERVER,      // simple HTTP server for testing the network stack
-  FILE_PYTHON_RUNTIME,   // Python runtime, used for running the test server
-
-  PATH_END
-};
-
-// Call once to register the provider for the path keys defined above.
-void RegisterPathProvider();
-
-}  // namespace chrome
-
-#endif  // CHROME_COMMON_CHROME_PATHS_H__
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_paths_internal.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
-#define CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
-
-class FilePath;
-
-namespace chrome {
-
-// Get the path to the user's data directory, regardless of whether
-// DIR_USER_DATA has been overridden by a command-line option.
-bool GetDefaultUserDataDirectory(FilePath* result);
-
-// Get the path to the user's documents directory.
-bool GetUserDocumentsDirectory(FilePath* result);
-
-// Get the path to the user's downloads directory.
-bool GetUserDownloadsDirectory(FilePath* result);
-
-// The path to the user's desktop.
-bool GetUserDesktop(FilePath* result);
-
-}  // namespace chrome
-
-
-#endif  // CHROME_COMMON_CHROME_PATHS_INTERNAL_H_
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_paths_mac.mm
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/common/chrome_paths_internal.h"
-
-#import <Cocoa/Cocoa.h>
-
-#import "base/base_paths.h"
-#import "base/file_path.h"
-#import "base/logging.h"
-#import "base/path_service.h"
-
-namespace chrome {
-
-bool GetDefaultUserDataDirectory(FilePath* result) {
-  bool success = false;
-  NSArray* dirs =
-      NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
-                                          NSUserDomainMask, YES);
-  if ([dirs count] && result) {
-    NSString* base = [dirs objectAtIndex:0];
-#if defined(GOOGLE_CHROME_BUILD)
-    base = [base stringByAppendingPathComponent:@"Google"];
-    NSString* tail = @"Chrome";
-#else
-    NSString* tail = @"Chromium";
-#endif
-    NSString* path = [base stringByAppendingPathComponent:tail];
-    *result = FilePath([path fileSystemRepresentation]);
-    success = true;
-  }
-  return success;
-}
-
-bool GetUserDocumentsDirectory(FilePath* result) {
-  bool success = false;
-  NSArray* docArray =
-      NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
-                                          NSUserDomainMask,
-                                          YES);
-  if ([docArray count] && result) {
-    *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
-    success = true;
-  }
-  return success;
-}
-
-bool GetUserDownloadsDirectory(FilePath* result) {
-  bool success = false;
-  NSArray* docArray =
-      NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory,
-                                          NSUserDomainMask,
-                                          YES);
-  if ([docArray count] && result) {
-    *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
-    success = true;
-  }
-  return success;
-}
-
-bool GetUserDesktop(FilePath* result) {
-  bool success = false;
-  NSArray* docArray =
-      NSSearchPathForDirectoriesInDomains(NSDesktopDirectory,
-                                          NSUserDomainMask,
-                                          YES);
-  if ([docArray count] && result) {
-    *result = FilePath([[docArray objectAtIndex:0] fileSystemRepresentation]);
-    success = true;
-  }
-  return success;
-}
-
-}  // namespace chrome
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/chrome_paths_win.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/chrome_paths_internal.h"
-
-#include <windows.h>
-#include <shellapi.h>
-#include <shlobj.h>
-
-#include "base/file_path.h"
-#include "base/path_service.h"
-#include "chrome/common/chrome_constants.h"
-
-namespace chrome {
-
-bool GetDefaultUserDataDirectory(FilePath* result) {
-  if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
-    return false;
-#if defined(GOOGLE_CHROME_BUILD)
-  *result = result->Append(FILE_PATH_LITERAL("Google"));
-#endif
-  *result = result->Append(chrome::kBrowserAppName);
-  *result = result->Append(chrome::kUserDataDirname);
-  return true;
-}
-
-bool GetUserDocumentsDirectory(FilePath* result) {
-  wchar_t path_buf[MAX_PATH];
-  if (FAILED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL,
-                             SHGFP_TYPE_CURRENT, path_buf)))
-    return false;
-  *result = FilePath(path_buf);
-  return true;
-}
-
-// On Vista, we can get the download path using a Win API
-// (http://msdn.microsoft.com/en-us/library/bb762584(VS.85).aspx),
-// but it can be set to Desktop, which is dangerous. Instead,
-// we just use 'Downloads' under DIR_USER_DOCUMENTS. Localizing
-// 'downloads' is not a good idea because Chrome's UI language
-// can be changed.
-bool GetUserDownloadsDirectory(FilePath* result) {
-  if (!GetUserDocumentsDirectory(result))
-    return false;
-
-  *result = result->Append(L"Downloads");
-  return true;
-}
-
-bool GetUserDesktop(FilePath* result) {
-  // We need to go compute the value. It would be nice to support paths
-  // with names longer than MAX_PATH, but the system functions don't seem
-  // to be designed for it either, with the exception of GetTempPath
-  // (but other things will surely break if the temp path is too long,
-  // so we don't bother handling it.
-  wchar_t system_buffer[MAX_PATH];
-  system_buffer[0] = 0;
-  if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
-                             SHGFP_TYPE_CURRENT, system_buffer)))
-    return false;
-  *result = FilePath(system_buffer);
-  return true;
-}
-
-}  // namespace chrome
--- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
@@ -21,17 +21,16 @@
 #include "base/eintr_wrapper.h"
 #include "base/lock.h"
 #include "base/logging.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
 #include "base/string_util.h"
 #include "base/singleton.h"
 #include "base/stats_counters.h"
-#include "chrome/common/chrome_counters.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/file_descriptor_set_posix.h"
 #include "chrome/common/ipc_logging.h"
 #include "chrome/common/ipc_message_utils.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 
 namespace IPC {
 
--- a/ipc/chromium/src/chrome/common/ipc_channel_win.cc
+++ b/ipc/chromium/src/chrome/common/ipc_channel_win.cc
@@ -7,17 +7,16 @@
 #include <windows.h>
 #include <sstream>
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
 #include "base/non_thread_safe.h"
 #include "base/stats_counters.h"
 #include "base/win_util.h"
-#include "chrome/common/chrome_counters.h"
 #include "chrome/common/ipc_logging.h"
 #include "chrome/common/ipc_message_utils.h"
 #include "mozilla/ipc/ProtocolUtils.h"
 
 namespace IPC {
 //------------------------------------------------------------------------------
 
 Channel::ChannelImpl::State::State(ChannelImpl* channel) : is_pending(false) {
@@ -122,17 +121,16 @@ void Channel::ChannelImpl::Close() {
 
   closed_ = true;
 }
 
 bool Channel::ChannelImpl::Send(Message* message) {
   if (thread_check_.get()) {
     DCHECK(thread_check_->CalledOnValidThread());
   }
-  chrome::Counters::ipc_send_counter().Increment();
 #ifdef IPC_MESSAGE_DEBUG_EXTRA
   DLOG(INFO) << "sending message @" << message << " on channel @" << this
              << " with type " << message->type()
              << " (" << output_queue_.size() << " in queue)";
 #endif
 
 #ifdef IPC_MESSAGE_LOG_ENABLED
   Logging::current()->OnSendMessage(message, L"");
--- a/ipc/chromium/src/chrome/common/ipc_message_utils.h
+++ b/ipc/chromium/src/chrome/common/ipc_message_utils.h
@@ -8,22 +8,22 @@
 #include <string>
 #include <vector>
 #include <map>
 
 #include "base/file_path.h"
 #include "base/string_util.h"
 #include "base/string16.h"
 #include "base/tuple.h"
+#include "base/time.h"
 
 #if defined(OS_POSIX)
 #include "chrome/common/file_descriptor_set_posix.h"
 #endif
 #include "chrome/common/ipc_sync_message.h"
-#include "chrome/common/thumbnail_score.h"
 #include "chrome/common/transport_dib.h"
 
 namespace IPC {
 
 //-----------------------------------------------------------------------------
 // An iterator class for reading the fields contained within a Message.
 
 class MessageIterator {
@@ -726,27 +726,16 @@ struct ParamTraitsIPC<base::FileDescript
 template <>
 struct ParamTraitsIPC<FilePath> {
   typedef FilePath param_type;
   static void Write(Message* m, const param_type& p);
   static bool Read(const Message* m, void** iter, param_type* r);
   static void Log(const param_type& p, std::wstring* l);
 };
 
-template<>
-struct ParamTraitsIPC<ThumbnailScore> {
-  typedef ThumbnailScore param_type;
-  static void Write(Message* m, const param_type& p);
-  static bool Read(const Message* m, void** iter, param_type* r);
-  static void Log(const param_type& p, std::wstring* l) {
-    l->append(StringPrintf(L"(%f, %d, %d)",
-                           p.boring_score, p.good_clipping, p.at_top));
-  }
-};
-
 struct LogData {
   std::wstring channel;
   int32_t routing_id;
   uint16_t type;
   std::wstring flags;
   int64_t sent;  // Time that the message was sent (i.e. at Send()).
   int64_t receive;  // Time before it was dispatched (i.e. before calling
                   // OnMessageReceived).
@@ -1040,42 +1029,16 @@ ParamTraitsIPC<FilePath>::Read(const Mes
   *r = FilePath(value);
   return true;
 }
 inline void
 ParamTraitsIPC<FilePath>::Log(const param_type& p, std::wstring* l) {
   ParamTraits<FilePath::StringType>::Log(p.value(), l);
 }
 
-
-inline void
-ParamTraitsIPC<ThumbnailScore>::Write(Message* m, const param_type& p) {
-  IPC::ParamTraits<double>::Write(m, p.boring_score);
-  IPC::ParamTraits<bool>::Write(m, p.good_clipping);
-  IPC::ParamTraits<bool>::Write(m, p.at_top);
-  IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
-}
-inline bool
-ParamTraitsIPC<ThumbnailScore>::Read(const Message* m, void** iter, param_type* r) {
-  double boring_score;
-  bool good_clipping, at_top;
-  base::Time time_at_snapshot;
-  if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) ||
-      !IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) ||
-      !IPC::ParamTraits<bool>::Read(m, iter, &at_top) ||
-      !IPC::ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot))
-    return false;
-
-  r->boring_score = boring_score;
-  r->good_clipping = good_clipping;
-  r->at_top = at_top;
-  r->time_at_snapshot = time_at_snapshot;
-  return true;
-}
-
 //-----------------------------------------------------------------------------
 // Generic message subclasses
 
 // Used for asynchronous messages.
 template <class ParamType>
 class MessageWithTuple : public Message {
  public:
   typedef ParamType Param;
deleted file mode 100644
--- a/ipc/chromium/src/chrome/common/thumbnail_score.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
-#define CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
-
-#include "base/time.h"
-
-// A set of metadata about a Thumbnail.
-struct ThumbnailScore {
-  // Initializes the ThumbnailScore to the absolute worst possible
-  // values except for time, which is set to Now().
-  ThumbnailScore();
-
-  // Builds a ThumbnailScore with the passed in values, and sets the
-  // thumbnail generation time to Now().
-  ThumbnailScore(double score, bool clipping, bool top);
-
-  // Builds a ThumbnailScore with the passed in values.
-  ThumbnailScore(double score, bool clipping, bool top,
-                 const base::Time& time);
-  ~ThumbnailScore();
-
-  // Tests for equivalence between two ThumbnailScore objects.
-  bool Equals(const ThumbnailScore& rhs) const;
-
-  // How "boring" a thumbnail is. The boring score is the 0,1 ranged
-  // percentage of pixels that are the most common luma. Higher boring
-  // scores indicate that a higher percentage of a bitmap are all the
-  // same brightness (most likely the same color).
-  double boring_score;
-
-  // Whether the thumbnail was taken with height greater then
-  // width. In cases where we don't have |good_clipping|, the
-  // thumbnails are either clipped from the horizontal center of the
-  // window, or are otherwise weirdly stretched.
-  bool good_clipping;
-
-  // Whether this thumbnail was taken while the renderer was
-  // displaying the top of the page. Most pages are more recognizable
-  // by their headers then by a set of random text half way down the
-  // page; i.e. most MediaWiki sites would be indistinguishable by
-  // thumbnails with |at_top| set to false.
-  bool at_top;
-
-  // Record the time when a thumbnail was taken. This is used to make
-  // sure thumbnails are kept fresh.
-  base::Time time_at_snapshot;
-
-  // How bad a thumbnail needs to be before we completely ignore it.
-  static const double kThumbnailMaximumBoringness;
-
-  // Time before we take a worse thumbnail (subject to
-  // kThumbnailMaximumBoringness) over what's currently in the database
-  // for freshness.
-  static const base::TimeDelta kUpdateThumbnailTime;
-
-  // Penalty of how much more boring a thumbnail should be per hour.
-  static const double kThumbnailDegradePerHour;
-};
-
-// Checks whether we should replace one thumbnail with another.
-bool ShouldReplaceThumbnailWith(const ThumbnailScore& current,
-                                const ThumbnailScore& replacement);
-
-#endif  // CHROME_BROWSER_COMMON_THUMBNAIL_SCORE_H__
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -10,17 +10,16 @@
     iframe {
       width: 600px;
       height: 600px;
     }
   </style>
 <script type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
-SimpleTest.requestLongerTimeout(2);
 
 var canvases = [];
 function callbackTestCanvas(canvas)
 {
   canvases.push(canvas);
 
   if (canvases.length != 2)
     return;
@@ -55,17 +54,16 @@ function remotePageLoaded(callback) {
     callback();
   }, 0);
 };
 
 const MAX_ITERATIONS = 1000;
 
 function createIframe(url,next) {
   var iframe = document.createElement("iframe");
-  iframe.focus();
   iframe.src = url;
   iframe.remotePageLoaded = remotePageLoaded;
   var me = this;
   var currentIteration = 0;
   function iframeLoadCompleted() {
     var docEl = iframe.contentDocument.documentElement;
     if (docEl.className.indexOf("reftest-wait") >= 0) {
       if (currentIteration++ > MAX_ITERATIONS) {
@@ -79,16 +77,17 @@ function createIframe(url,next) {
     iframe.remotePageLoaded(function() {
       if (next) {
         setTimeout(function(){createIframe(next,null);}, 0)
       }
     });
   }
   iframe.addEventListener("load", iframeLoadCompleted, false);
   window.document.body.appendChild(iframe);
+  iframe.focus();
 };
 
 function refTest(test,ref) {
   createIframe(test,ref);
 };
 
 var caretBlinkTime = null;
 function endTest() {
@@ -186,13 +185,15 @@ function runTests() {
     SpecialPowers.setIntPref("ui.caretBlinkTime", -1);
 
     nextTest();
   } catch(e) {
     endTest();
   }
 }
 
+SimpleTest.waitForFocus(runTests);
+
 </script>
 </head>
-<body onload="runTests()">
+<body>
 </body>
 </html>
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -6,16 +6,17 @@
  * http://mozilla.org/MPL/2.0/. */
 
 /* rendering object for CSS "display: flex" */
 
 #include "nsFlexContainerFrame.h"
 #include "nsContentUtils.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsDisplayList.h"
+#include "nsIFrameInlines.h"
 #include "nsLayoutUtils.h"
 #include "nsPlaceholderFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "prlog.h"
 #include <algorithm>
 
 using namespace mozilla::css;
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -122,16 +122,33 @@ FontSizeInflationListMarginAdjustment(co
       // but simply inflated at the same amount as the text, in app units.
       return nsPresContext::CSSPixelsToAppUnits(40) * (inflation - 1);
     }
   }
 
   return 0;
 }
 
+// NOTE: If we ever want to use nsCSSOffsetState for a flex item or a grid
+// item, we need to make it take the containing-block height as well as the
+// width, since flex items and grid items resolve vertical percent margins
+// and padding against the containing-block height, rather than its width.
+nsCSSOffsetState::nsCSSOffsetState(nsIFrame *aFrame,
+                                   nsRenderingContext *aRenderingContext,
+                                   nscoord aContainingBlockWidth)
+  : frame(aFrame)
+  , rendContext(aRenderingContext)
+  , mWritingMode(aFrame->GetWritingMode())
+{
+  MOZ_ASSERT(!aFrame->IsFlexItem(),
+             "We're about to resolve vertical percent margin & padding "
+             "values against CB width, which is incorrect for flex items");
+  InitOffsets(aContainingBlockWidth, aContainingBlockWidth, frame->GetType());
+}
+
 // Initialize a reflow state for a child frame's reflow. Some state
 // is copied from the parent reflow state; the remaining state is
 // computed.
 nsHTMLReflowState::nsHTMLReflowState(nsPresContext*           aPresContext,
                                      const nsHTMLReflowState& aParentReflowState,
                                      nsIFrame*                aFrame,
                                      const nsSize&            aAvailableSpace,
                                      nscoord                  aContainingBlockWidth,
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -146,31 +146,18 @@ public:
   // Callers using this constructor must call InitOffsets on their own.
   nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext)
     : frame(aFrame)
     , rendContext(aRenderingContext)
     , mWritingMode(aFrame->GetWritingMode())
   {
   }
 
-  // NOTE: If we ever want to use nsCSSOffsetState for a flex item or a grid
-  // item, we need to make it take the containing-block height as well as the
-  // width, since flex items and grid items resolve vertical percent margins
-  // and padding against the containing-block height, rather than its width.
   nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
-                   nscoord aContainingBlockWidth)
-    : frame(aFrame)
-    , rendContext(aRenderingContext)
-    , mWritingMode(aFrame->GetWritingMode())
-  {
-    MOZ_ASSERT(!aFrame->IsFlexItem(),
-               "We're about to resolve vertical percent margin & padding "
-               "values against CB width, which is incorrect for flex items");
-    InitOffsets(aContainingBlockWidth, aContainingBlockWidth, frame->GetType());
-  }
+                   nscoord aContainingBlockWidth);
 
 #ifdef DEBUG
   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
   // to the display-reflow infrastructure.
   static void* DisplayInitOffsetsEnter(nsIFrame* aFrame,
                                        nsCSSOffsetState* aState,
                                        nscoord aHorizontalPercentBasis,
                                        nscoord aVerticalPercentBasis,
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2223,22 +2223,16 @@ public:
    * have kids.  It could still have kids created via
    * nsIAnonymousContentCreator.  Returning true indicates that "normal"
    * (non-anonymous, XBL-bound, CSS generated content, etc) children should not
    * be constructed.
    */
   virtual bool IsLeaf() const;
 
   /**
-   * Is this a flex item? (Is the parent a flex container frame?)
-   */
-  bool IsFlexItem() const
-  { return mParent && mParent->GetType() == nsGkAtoms::flexContainerFrame; }
-
-  /**
    * Marks all display items created by this frame as needing a repaint,
    * and calls SchedulePaint() if requested and one is not already pending.
    *
    * This includes all display items created by this frame, including
    * container types.
    *
    * @param aDisplayItemKey If specified, only issues an invalidate
    * if this frame painted a display item of that type during the 
@@ -2967,16 +2961,21 @@ NS_PTR_TO_INT32(frame->Properties().Get(
    * @param aPoint The point to check for its distance to this frame.
    * @param aCurrentBestFrame Pointer to a struct that will be updated with
    *   a pointer to this frame and its distance to aPoint, if this frame
    *   is indeed closer than the current distance in aCurrentBestFrame.
    */
   virtual void FindCloserFrameForSelection(nsPoint aPoint,
                                            FrameWithDistance* aCurrentBestFrame);
 
+  /**
+   * Is this a flex item? (i.e. a non-abs-pos child of a flex container)
+   */
+  inline bool IsFlexItem() const;
+
   inline bool IsBlockInside() const;
   inline bool IsBlockOutside() const;
   inline bool IsInlineOutside() const;
   inline uint8_t GetDisplay() const;
   inline bool IsFloating() const;
   inline bool IsPositioned() const;
   inline bool IsRelativelyPositioned() const;
   inline bool IsAbsolutelyPositioned() const;
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -6,16 +6,24 @@
 
 #ifndef nsIFrameInlines_h___
 #define nsIFrameInlines_h___
 
 #include "nsIFrame.h"
 #include "nsStyleStructInlines.h"
 
 bool
+nsIFrame::IsFlexItem() const
+{
+  return mParent &&
+    mParent->GetType() == nsGkAtoms::flexContainerFrame &&
+    !IsAbsolutelyPositioned();
+}
+
+bool
 nsIFrame::IsFloating() const
 {
   return StyleDisplay()->IsFloating(this);
 }
 
 bool
 nsIFrame::IsPositioned() const
 {
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-abpos-child-1-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+  <title>CSS Reftest Reference</title>
+  <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+  <meta charset="utf-8">
+  <style>
+    .tealBlock {
+      background: teal;
+      width: 20px;
+      height: 20px;
+      margin-bottom: 5px;
+    }
+  </style>
+</head>
+<body>
+  <div class="tealBlock"></div>
+  <div class="tealBlock"></div>
+  <div class="tealBlock"></div>
+  <div class="tealBlock"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-abpos-child-1a.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+  <title>CSS Test: Testing that "min-width", "max-width", "min-height", and "max-height" are applied on absolutely positioned children of a horizontal flex container</title>
+  <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+  <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#abspos-items">
+  <link rel="match" href="flexbox-abspos-child-1-ref.html">
+  <meta charset="utf-8">
+  <style>
+    .flexContainer {
+      display: flex;
+      height: 10px;
+      width: 10px;
+      background: purple;
+      margin-bottom: 15px;
+      position: relative;
+    }
+    .absPos {
+      position: absolute;
+      background: teal;
+    }
+    .testMinWidth {
+      width: 10px;
+      height: 20px;
+      min-width: 20px;
+    }
+    .testMaxWidth {
+      width: 50px;
+      height: 20px;
+      max-width: 20px;
+    }
+    .testMinHeight {
+      width: 20px;
+      height: 10px;
+      min-height: 20px;
+    }
+    .testMaxHeight {
+      width: 20px;
+      height: 50px;
+      max-height: 20px;
+    }
+  </style>
+</head>
+<body>
+  <div class="flexContainer"><div class="absPos testMinWidth"></div></div>
+  <div class="flexContainer"><div class="absPos testMaxWidth"></div></div>
+  <div class="flexContainer"><div class="absPos testMinHeight"></div></div>
+  <div class="flexContainer"><div class="absPos testMaxHeight"></div></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-abpos-child-1b.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+  <title>CSS Test: Testing that "min-width", "max-width", "min-height", and "max-height" are applied on absolutely positioned children of a vertical flex container</title>
+  <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+  <link rel="help" href="http://www.w3.org/TR/css3-flexbox/#abspos-items">
+  <link rel="match" href="flexbox-abspos-child-1-ref.html">
+  <meta charset="utf-8">
+  <style>
+    .flexContainer {
+      display: flex;
+      flex-direction: column;
+      height: 10px;
+      width: 10px;
+      background: purple;
+      margin-bottom: 15px;
+      position: relative;
+    }
+    .absPos {
+      position: absolute;
+      background: teal;
+    }
+    .testMinWidth {
+      width: 10px;
+      height: 20px;
+      min-width: 20px;
+    }
+    .testMaxWidth {
+      width: 50px;
+      height: 20px;
+      max-width: 20px;
+    }
+    .testMinHeight {
+      width: 20px;
+      height: 10px;
+      min-height: 20px;
+    }
+    .testMaxHeight {
+      width: 20px;
+      height: 50px;
+      max-height: 20px;
+    }
+  </style>
+</head>
+<body>
+  <div class="flexContainer"><div class="absPos testMinWidth"></div></div>
+  <div class="flexContainer"><div class="absPos testMaxWidth"></div></div>
+  <div class="flexContainer"><div class="absPos testMinHeight"></div></div>
+  <div class="flexContainer"><div class="absPos testMaxHeight"></div></div>
+</body>
+</html>
--- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list
+++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list
@@ -1,8 +1,12 @@
+# Tests for absolutely-positioned children of a flex container
+== flexbox-abpos-child-1a.html flexbox-abpos-child-1-ref.html
+== flexbox-abpos-child-1b.html flexbox-abpos-child-1-ref.html
+
 # Tests for handling anonymous flex items
 == flexbox-anonymous-items-1.html flexbox-anonymous-items-1-ref.html
 
 # Tests for alignment of flex lines (align-content property)
 == flexbox-align-content-horiz-1a.xhtml flexbox-align-content-horiz-1-ref.xhtml
 == flexbox-align-content-horiz-1b.xhtml flexbox-align-content-horiz-1-ref.xhtml
 == flexbox-align-content-vert-1a.xhtml  flexbox-align-content-vert-1-ref.xhtml
 == flexbox-align-content-vert-1b.xhtml  flexbox-align-content-vert-1-ref.xhtml
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -269,16 +269,19 @@ pref("browser.search.jarURIs", "chrome:/
 // tell the search service that we don't really expose the "current engine"
 pref("browser.search.noCurrentEngine", true);
 
 #ifdef MOZ_OFFICIAL_BRANDING
 // {moz:official} expands to "official"
 pref("browser.search.official", true);
 #endif
 
+// Control media casting feature
+pref("browser.casting.enabled", false);
+
 // Enable sparse localization by setting a few package locale overrides
 pref("chrome.override_package.global", "browser");
 pref("chrome.override_package.mozapps", "browser");
 pref("chrome.override_package.passwordmgr", "browser");
 
 // enable xul error pages
 pref("browser.xul.error_pages.enabled", true);
 
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -151,16 +151,17 @@ abstract public class BrowserApp extends
         @Override
         public float getInterpolation(float t) {
             t -= 1.0f;
             return t * t * t * t * t + 1.0f;
         }
     };
 
     private FindInPageBar mFindInPageBar;
+    private MediaCastingBar mMediaCastingBar;
 
     private boolean mAccessibilityEnabled = false;
 
     // We'll ask for feedback after the user launches the app this many times.
     private static final int FEEDBACK_LAUNCH_COUNT = 15;
 
     // Whether the dynamic toolbar pref is enabled.
     private boolean mDynamicToolbarEnabled = false;
@@ -525,16 +526,17 @@ abstract public class BrowserApp extends
         mBrowserToolbar.setOnKeyListener(this);
 
         if (mTabsPanel != null) {
             mTabsPanel.setTabsLayoutChangeListener(this);
             updateSideBarState();
         }
 
         mFindInPageBar = (FindInPageBar) findViewById(R.id.find_in_page);
+        mMediaCastingBar = (MediaCastingBar) findViewById(R.id.media_casting);
 
         registerEventListener("CharEncoding:Data");
         registerEventListener("CharEncoding:State");
         registerEventListener("Feedback:LastUrl");
         registerEventListener("Feedback:OpenPlayStore");
         registerEventListener("Feedback:MaybeLater");
         registerEventListener("Telemetry:Gather");
         registerEventListener("Settings:Show");
@@ -825,16 +827,21 @@ abstract public class BrowserApp extends
         if (mBrowserToolbar != null)
             mBrowserToolbar.onDestroy();
 
         if (mFindInPageBar != null) {
             mFindInPageBar.onDestroy();
             mFindInPageBar = null;
         }
 
+        if (mMediaCastingBar != null) {
+            mMediaCastingBar.onDestroy();
+            mMediaCastingBar = null;
+        }
+
         if (mSharedPreferencesHelper != null) {
             mSharedPreferencesHelper.uninit();
             mSharedPreferencesHelper = null;
         }
 
         if (mOrderedBroadcastHelper != null) {
             mOrderedBroadcastHelper.uninit();
             mOrderedBroadcastHelper = null;
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/MediaCastingBar.java
@@ -0,0 +1,118 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.gecko;
+
+import org.mozilla.gecko.util.GeckoEventListener;
+import org.mozilla.gecko.util.ThreadUtils;
+
+import org.json.JSONObject;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+public class MediaCastingBar extends RelativeLayout implements View.OnClickListener, GeckoEventListener  {
+    private static final String LOGTAG = "MediaCastingBar";
+
+    private TextView mCastingTo;
+    private ImageButton mMediaPlay;
+    private ImageButton mMediaPause;
+    private ImageButton mMediaStop;
+
+    private boolean mInflated = false;
+
+    public MediaCastingBar(Context context, AttributeSet attrs) {
+        super(context, attrs);
+
+        GeckoAppShell.getEventDispatcher().registerEventListener("Casting:Started", this);
+        GeckoAppShell.getEventDispatcher().registerEventListener("Casting:Stopped", this);
+    }
+
+    public void inflateContent() {
+        LayoutInflater inflater = LayoutInflater.from(getContext());
+        View content = inflater.inflate(R.layout.media_casting, this);
+
+        mMediaPlay = (ImageButton) content.findViewById(R.id.media_play);
+        mMediaPlay.setOnClickListener(this);
+        mMediaPause = (ImageButton) content.findViewById(R.id.media_pause);
+        mMediaPause.setOnClickListener(this);
+        mMediaStop = (ImageButton) content.findViewById(R.id.media_stop);
+        mMediaStop.setOnClickListener(this);
+
+        mCastingTo = (TextView) content.findViewById(R.id.media_casting_to);
+
+        // Capture clicks on the rest of the view to prevent them from
+        // leaking into other views positioned below.
+        content.setOnClickListener(this);
+
+        mInflated = true;
+    }
+
+    public void show() {
+        if (!mInflated)
+            inflateContent();
+
+        setVisibility(VISIBLE);
+    }
+
+    public void hide() {
+        setVisibility(GONE);
+    }
+
+    public void onDestroy() {
+        GeckoAppShell.getEventDispatcher().unregisterEventListener("Casting:Started", this);
+        GeckoAppShell.getEventDispatcher().unregisterEventListener("Casting:Stopped", this);
+    }
+
+    // View.OnClickListener implementation
+    @Override
+    public void onClick(View v) {
+        final int viewId = v.getId();
+
+        if (viewId == R.id.media_play) {
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Casting:Play", ""));
+            mMediaPlay.setVisibility(GONE);
+            mMediaPause.setVisibility(VISIBLE);
+        } else if (viewId == R.id.media_pause) {
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Casting:Pause", ""));
+            mMediaPause.setVisibility(GONE);
+            mMediaPlay.setVisibility(VISIBLE);
+        } else if (viewId == R.id.media_stop) {
+            GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Casting:Stop", ""));
+        }
+    }
+
+    // GeckoEventListener implementation
+    @Override
+    public void handleMessage(final String event, final JSONObject message) {
+        final String device = message.optString("device");
+
+        ThreadUtils.postToUiThread(new Runnable() {
+            @Override
+            public void run() {
+                if (event.equals("Casting:Started")) {
+                    show();
+                    if (!TextUtils.isEmpty(device)) {
+                        mCastingTo.setText(device);
+                    } else {
+                        // Should not happen
+                        mCastingTo.setText("");
+                        Log.d(LOGTAG, "Device name is empty.");
+                    }
+                    mMediaPlay.setVisibility(GONE);
+                    mMediaPause.setVisibility(VISIBLE);
+                } else if (event.equals("Casting:Stopped")) {
+                    hide();
+                }
+            }
+        });
+    }
+}
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -214,16 +214,23 @@ size. -->
 
 <!-- Localization note (find_text, find_prev, find_next, find_close) : These strings are used
      as alternate text for accessibility. They are not visible in the UI. -->
 <!ENTITY find_text "Find in Page">
 <!ENTITY find_prev "Previous">
 <!ENTITY find_next "Next">
 <!ENTITY find_close "Close">
 
+<!-- Localization note (media_casting_to, media_play, media_pause, media_stop) : These strings are used
+     as alternate text for accessibility. They are not visible in the UI. -->
+<!ENTITY media_casting_to "Casting to Device">
+<!ENTITY media_play "Play">
+<!ENTITY media_pause "Pause">
+<!ENTITY media_stop "Stop">
+
 <!ENTITY contextmenu_open_new_tab "Open in New Tab">
 <!ENTITY contextmenu_open_private_tab "Open in Private Tab">
 <!ENTITY contextmenu_open_in_reader "Open in Reader">
 <!ENTITY contextmenu_remove "Remove">
 <!ENTITY contextmenu_add_to_launcher "Add to Home Screen">
 <!ENTITY contextmenu_share "Share">
 <!ENTITY contextmenu_pasteandgo "Paste &amp; Go">
 <!ENTITY contextmenu_paste "Paste">
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -243,16 +243,17 @@ gbjar.sources += [
     'home/TopSitesPanel.java',
     'home/TopSitesThumbnailView.java',
     'home/TwoLinePageRow.java',
     'InputMethods.java',
     'JavaAddonManager.java',
     'LightweightTheme.java',
     'LightweightThemeDrawable.java',
     'LocaleManager.java',
+    'MediaCastingBar.java',
     'MemoryMonitor.java',
     'menu/GeckoMenu.java',
     'menu/GeckoMenuInflater.java',
     'menu/GeckoMenuItem.java',
     'menu/GeckoSubMenu.java',
     'menu/MenuItemActionBar.java',
     'menu/MenuItemActionView.java',
     'menu/MenuItemDefault.java',
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5f635fc10aba60c7360e69170c69507a1f4df38c
GIT binary patch
literal 362
zc%17D@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTCmSQK*5Dp-y;YjHK@;M7UB8wRq
zL=J;6qiBJz6HrjH#5JNMI6tkVJh3R1p}f3YFEcN@I61K(RWH9NefB#WDWIa~o-U3d
z8I5meI&vK{5OGmYTB-g~>XEHY%id1w{0F8k{-H<GVobOXs!iA>!Sq>y#pus7`&)UF
z9E5Z?2bzD-7Yj&cG(F3m6MjX8QHJX$$Ad}F^2->`WuE)UP_X`0Tguyti9IUI&nTQs
zT$tw(xlV6cdidAP&v;8R`DWTMy%4|ld&*S1+v_IiUixF7z-S6K4G*#TS&3DW-OO`$
z&*y!pHfLZ6K9#ggkD=na*=Dx~ED7-^+!?O7ewBWv{O!`b^S9EP^miSNaOh>dVxs?n
ZQ7LXG$Haem)<7>ac)I$ztaD0e0ssbzf=~be
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ac69ea59a43370a3d777570c7e8d5a882a32cf13
GIT binary patch
literal 670
zc$@*A0%84$P)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00004b3#c}2nYxW
zd<bNS00009a7bBm000!j000!j0TpmfLI3~&8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10vkz0K~!jg?b*+Z%~2S~@z<Rzl!daf@-O(YP$b#0kj9TlvB3g6
zTUjVuODPMnku3`~Op&r-WBgpBP!>WIW$s*yGZ)<%&79|ZzV~}4^R8QWbDrn(>3Qxs
z&pEf%?RG6>Mw%8-l|=(hvuL1cA_ku00+trm5~3B@Mtch;un(__D#|2Mfu4c2c#6?-
za`LJ28)#z%ZsI(a6j78(q=h<WH~tX&@wTd{9ICWXKO6B3JK}QkDQTdMl^DahVC-xn
zE%ej;`u#o*;zMqN97<N8pRLlFu`Q5e-qdNJja9gZ(`W^9%}Jz%eqdQ3*KHie$H3Zu
zGRRqIyR=JfDjBrS7Md;BYCOQHV2l|=TIf5L7s!1BNARUekU>_UpHV!)hAKgtG%$iS
zc!c9sg5*;28KW&7ikEOr8V<8)+5msfheMKyEQZ0r-!Wh0E^K6m@1ryQIf*N|iz5a~
zR-l9T(vCC{3D9&4jbojlc$zWLnT~N5JMpPXutB%bB)&=aggX`D{AQ2_y3+k%58ec0
z%wQ1HXwUFvY*tV_^;cjLQ#gUEfn0M^r-3QF!)|G4tA#pSXbkJsD4z1$Xm5)=gI)L>
z5tT#97V1cslLNRLR+LF816@4EUJLALvG@HVwivK@s#TyPz0w`S^<s)Lsbb)@G)2BF
zrY1n-RpOTPGI11Niz~_`VqmEFFaM<+Di#ei&4M@Z3!9jND^Z?P5&!@I07*qoM6N<$
Ef_wTT0ssI2
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b1bcd06079dc098921ce1501daf086a839a050ac
GIT binary patch
literal 763
zc$@+I0tEeuP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00004b3#c}2nYxW
zd<bNS00009a7bBm000!j000!j0TpmfLI3~&8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10(eP8K~!jg?U}J^8$lFB@1{$wN}xs}LLU<KLKuSy#^hI27z{29
z217_bC4b;Pq;%mp4*rEmJ}G7gEz3%NZ)T-+ur5qFZ|)iGT<yFq0R7K;*R_FM9RRx4
z0ibKWS%AKzsidMM9|K9fl!++-LrJ%izDxS5e2AH(J4rt!P295q&lmv@z>>AT0EM$o
z9CP3=uqtc*0mhyhp2a=@ziZ~BZW7ENm9<utI!oZOT&q=paap*@eAKnW{Bc?9xuMRo
z+^A7o029JbyUl#mm7(4VVb`0?S0NsNVJ<)qcru!gy4+Illfiry;vVSd01Q|kGLJ4A
zYMnaFS2fK65HL%GIIq+=D~)^2f8&LOvmUxRn-ASKEr8F7=1uWz1rY1l^BN&x&W**q
z7eIvgOL>kx^2D(lK-gk1RhAge1`xhDv}#-YwhkadET$aJCN;(G&H+SvJXTeW+r0yb
z5R<7|<gVYwjck}P_bz+&%pEw-*!}qEo#lAQF@KR^z7BD^Z-C1d%vT{+glOIiz*URp
z>kucq2DsjV`8ve$E&vL`3zpYV3dEA|;@BEML3p+G8hIxCM=TN{=4}8JgiA$=`D#3R
z<90>3M9p#mrU~X(G{>Shb|b_f2cS>5SX(ajmN@jp?~>3^=;Z*2(AubX<2ISM#GoaH
zW0!97Qax)5jo93ki-*n=f7{|XcIQkjM(ctiwEODax!BV*$6jSL#d7S*wcc8cW6Zis
z7Y~^!?ixlto?|!8)KW|Z5aGFe!WeS~h#1rN7+Q(-Q9#mn;+~}Ul73~s&xh{|A0_>e
t^yr?P2=Hq3X1|fW8XW+-)&Zbv{R1#$Nns?;kY)e?002ovPDHLkV1gB0Q;7fo
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..81712cabed27c3aba37a0789a41f0196af80459d
GIT binary patch
literal 252
zc%17D@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@;M7UB8!3Q
zuY)k7lg8`{prB-lYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt+|FE{-7)
zt#7Xzay1z6v_9PbYRS5}ReksVn_N10)N#&~T^3Uoy;vafkkv@VW>)^%PQ##0s}@~n
z{lTrk@Y?gY%42<_hrA7}uhxhkP?aoy^Jz{k^M_1Mg$4#D4lr@S=ENC?`ER2VJf3mB
mXwW^~Ti!2SdzM9m_XgvIUy_Znsh%MJF?hQAxvX<aXaWEb+gQT@
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..77f87b387b96f89fb54374c8452fcdc121a05e20
GIT binary patch
literal 463
zc$@*x0WkiFP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10Zd6mK~z|U?bo|5L{S*U@!z09MB*8gXq2K95g|f})=P-m18C@V
zB7#EV0VdHYTneH=Bs7XMhD;d6G0hZapUXHQR=xLL|MRVHUrwoBuPag=g}VO(1Ok+?
z)GmNhKoh>Bie0SW?WX~1==y@V#T0Jx0!Y#W-5A6v=86DljPJuXHpG?5q$CkE>jhVs
z#(i3VEZeXLLpaAo5dhGMe(YgA&3aiPXjTPhn8jl#K%OUIFGg{R@ge|-D>Z;4tfACu
zLY@&ctAb<9e>bSzm(fM50U=+O^u<y~gk|jK0gyyhJYW*nArtb9AQCs<aHx4GKu81;
zR<R&HqJxz+f*PJNgOfB1WNE@kd=JdvDUCVldmzFV#<G}`Jc1AL0keq1EXGLy8WFtW
zPQ1l_{7LqL1B~QpPFMxX*uiF=#tnsBMs3xv_%r(30H3RcRM*L2<_rJ;002ovPDHLk
FV1mZ@xbXl0
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..64e7c9a3c200c669ee311ddc1452453e46c9020c
GIT binary patch
literal 497
zc$@+80S^9&P)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004b3#c}2nYxW
zd<bNS00009a7bBm000fw000fw0YWI7cmMzZ8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10d7e|K~z|U?Uzk%!Y~kphpu~!h^VLsh(M6!{G1_2Xh4K@zAlV~
zq0Wq5Dn*s@B=78bU+m|ftN@u)Z?n2D0RIJ`5|K_s+Kjq|h#W<vF?#}9+W`Yk15g|N
z1y}=LzzAG{gVtXwbhs4=H2`~MOc|JaU2h+f1<*vyLx@<x51@ZC564tF0LO_!UKd~+
z^xr7vUR@4A!Oy9TK~%sea5DN1K$`>b93~CooM2v0`B;fAv8Ps(6<QO(3YVq}O8RpE
ze8{YIel`z7`Z9pv!gfwHk8ZhG%ef2QCGF@QMdX@XHIa0C`?3^`xaHdX)e`J7%tMGC
z7vPrw_S`R{TzQD{w*a+aKH@^D&CZBB%+|R8ZG!m;w==3lh$07|GYa-RhRh1-h`ZpD
z0V?7%poMEUF$Ub#-sAxIg5jIMPo);BSZLK(k+lo_tH=yf&}tr^aq4}Lat<`O^^1mR
nqP4gjnMd*pmS3|4U|xL#Wo(iwv{AY?00000NkvXXu0mjf#~;iT
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..bc3930fcc219c390aab75ba2d659264d19254c05
GIT binary patch
literal 389
zc%17D@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=EX7WqAsj$Z!;#Vf<Z~8yL>4nJ
zNUsNB#yF{oGC)De64!{5;QX|b^2DN4hVt@qz0ADq;^f4FRK5J7^x5xhq!<_&nLJ$_
zLn`LHon^?^<RHQ-AJ_HxMedgGOjUfgQ#Njil$I7&T_cdjYuqV1d;jE49g&iyQ`XGn
z)pbZ_h-x^-u!W(QF@sTx`2v$kG0P2gP38LSDt`~G`L{Lg&7Qv@Kl9qcAKqeouCiPI
zx}WE^sh@Y9`kG(C4OGmwfHk9o!MXj~66Uw!f7qcSHZ0TcZ7}6=;JzTyAhzJ6=7ukA
zYZJlt9GEB9q>I4>+V0=D)I5h5WIr3jw=V)YoM7gR#A8d7-rAlleDKTk<l>}z3zOcu
sKl>5#ZT&|vpfxZH3>kDCHveMqmr>R5lze6;0Sqz*Pgg&ebxsLQ095geRsaA1
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2ce52f803941cc582a296542acddb3c94c9ccc7b
GIT binary patch
literal 853
zc$@)M1FHOqP)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF00004b3#c}2nYxW
zd<bNS00009a7bBm000}W000}W0bUxB8~^|S8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H10@6uDK~#90?b<(Rl~)+Y@lUMP(n`g}$*Dr2LWdL-aVUt0OP91*
zgfvJjROlp5E{=i@4&tJlLzXzGv|U;RrBs4cY(T+91W{5d4o0FvqPY$y7cWtZ$@`r5
zyf5DGk_+Mfp6C2{e&@b_&OoQr@jkPnbOWX78&JA|()0}|-9Tyj29$1~G!X{;fxqy1
zfL84c1Y8Jp1!nLg&Q=wylZXlE8n6cAIEhsOy0s870rMDG_}p3e{5N*vZdLKzL{0#&
zjM$8S@J)bzR-z5)WgULOQG5_kCkqh~c<${B>_*~G?7_cPi$#-j0(cdPuQ7=o0rf)3
zZ9p&UrE7-6L3Kljh`=m9T;g|r#}9Z|wRlzPoPb_-Nxu@?0_s<ylmV~-mvJzlhh-BH
zfoJ%rqQ-fQV!CQGOQk8B(Gad<u<pVoBe0myFoFF+dhbM&41m=*g)w{*sQXr$5`o1G
zOE*-Tau;ga1oZNSWWsPJeKgwu_*ja=X(=AzG&KT?`AOO!H%1FLeFAzJlzu9QB1PL|
z0DOvbIBx0pA8#b$N^n|gtZpXoJ?>W#i7?<1)>ai+CO7eA6@j)zU@;R_1=?!B3mg(~
z*}SrPFSQ%+pY(k3a)el04Cp>wy&`RVQ&GZgiNF9(V7tJ@(~b#vf_*Z*b8NZ+xA5J<
z-z+pa0^`^s<Kk(i0dqJY?esIj+ON^H2uw-4{FOk>|D{P2a7nu3t8MW#!+;KsVJ99`
zZ)a&lL}0$ccOPRfE(G+kEK2SHH}EZP2lTLPN=0A{TNPeB^&2pUpD}``0ktbrX9Vs^
z2dAzE)C?o{1a$v*5npN8;;APBN2K!r#ScTgiJTFbmQI2E7EmJ_xeS<;?&9tQ=w~HI
z1kOlDUmCx7Vhxy;9#W1<r$$;qL<D}7Oc=qn0KHm?crnsy+VXZd8+`*xH&B|s0i_!#
fP2Ygh4V303iw~YqV&68P00000NkvXXu0mjfz*lU%
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f00e43782fcc7b279bcc8dd7ffedbf495c55045b
GIT binary patch
literal 1261
zc$@+41QPp+P)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF00004b3#c}2nYxW
zd<bNS00009a7bBm000}W000}W0bUxB8~^|S8FWQhbW?9;ba!ELWdL_~cP?peYja~^
zaAhuUa%Y?FJQ@H11Zqh{K~#90?V8JrTtyVde?1ddGGnIa#S9Z>Cn6F=#I^CU%t8<)
zD#1WdaFdOHM79nDg9*{lF(E`EAxqzjVVI0DCcbsZN|XpjP~64&T%0cK?&-&^s?$?Q
z`h$XL=H7G8_uZ;n=bkz>N!-mCD;+>-j07khKxvEwC>=m)j07khKxvEwC>=m)cnL58
zG=NLMvXjkTI0766W?ZaE${mxER`nllO4{RKx7%20@pE0$bgs?ZfbNsDrtR32wB$&<
zCh1ty_Ew9ZYm(}v1lTQUy$kt(pCm0hkw4yre85#nQ#&odl%$P5<O6<?w2(>uL?7}2
z8?pzoBLdWAs#nE#lI9cqj7d6GfqcNaY)KAPfN9yfi^VsR<|4_TjvybfCVMFlMSvOE
zn>Q6-Nt&(TXIxUFc~1=afK^Eo75qdCa5N#9P7K<*#wDF?UYkNbpwY)i+lWboehsNZ
zM%u9#_z<Xf`QI+!EO4Odqn6=kvhtNxm1>TVh~zvSY5Uf-OVR}=+czaGt0JdZ0Z{jZ
zBn4sXx<}H*Oj`k)ip)Z5QuK_j0dE4Yl0Q|i0Jnhs88!kofqlTwF*l_M07m*P;4t|j
zc;H8j{4cRLrhW|ycm;SHBcJnP%srU+9(bGt@{m3Q0>&^A4pL?&d<#5*Eu$pl)&sVH
zL%<pGXF@E##-@ETdGINSYymF==h!(BZeUOTw_HQHOQ03wSR(VBm%$$R5_k&u-NTq?
zP4FM!Mc_S0o1ORqcoHY_;9nHIgQc?XJKF{L9DDM&J&g{dDtrfc9=P26?XkwL08ayd
zIM`~#u*%~10`twkbGF7H-YwwotcZGG7y?WI9{`Uz*b3t92hL+(jIQt&ppJd+KI&{2
z;2CVIbrr!=fN9_(;1Nfgop=^_7u#}O;3dE;@G<bPlf7OLmS;3@62U`&IgI>X2U~*>
zGR*_PJ2=FjYhWJu1b8SnkO%}3Ucx@avN+`2ya0R(JeXl4HAe^{90X31vDKyuu!xa=
zAk}dbIXOZQ;Sg4wNwSq9z!LBoaDR%!4qV2vyi^1c4r67ycoAX>h|PlIrc(j)qO2gg
zTh-1P`ymu)k14Xq8*}lptmNzw=ml9RJlLL6+<9X^+bbH90GFHsJg;{0Vbqm&?%2)8
zkuLVLPlo=CUSBOM4O^e*fETbY#!lSEK6h_q_zCZTh3b)2p8*qUZ-t3{Dh=7$-ylD;
zvV+uAT$df>4&`KMQr%l(dLfWMEj#kA>Ss=Nq#lcFitHPT6#!WiLci9SPV%QB$%ip7
zYp$q@t4in>N)Z4J-ns($6S6j!R6h%{Hk(1%P-34@YGA1M))mMf&m<qlqO9Sn7uJ>7
zACxNq+P-zQCL|u@!&p-H1Z+(SeL<cAAbaVww$4N)A`xSc+7q!=MfL-A8(s$^Gr;Ru
z7s(qQ276!`Siy3V*MPrr4SJpo{Vy@<7B3w@X^aFY9YAS}1SlOqX^aFY9YAT^^#c40
X@w81DKldN}00000NkvXXu0mjfR9Gk5
--- a/mobile/android/base/resources/layout/gecko_app.xml
+++ b/mobile/android/base/resources/layout/gecko_app.xml
@@ -43,16 +43,23 @@
 
         <org.mozilla.gecko.FindInPageBar android:id="@+id/find_in_page"
                                          android:layout_width="fill_parent"
                                          android:layout_height="wrap_content"
                                          android:layout_alignParentBottom="true"
                                          style="@style/FindBar"
                                          android:visibility="gone"/>
 
+        <org.mozilla.gecko.MediaCastingBar android:id="@+id/media_casting"
+                                           android:layout_width="fill_parent"
+                                           android:layout_height="wrap_content"
+                                           android:layout_alignParentBottom="true"
+                                           style="@style/FindBar"
+                                           android:visibility="gone"/>
+
         <RelativeLayout android:id="@+id/camera_layout"
                         android:layout_height="wrap_content"
                         android:layout_width="wrap_content"
                         android:layout_alignParentRight="true"
                         android:layout_alignParentBottom="true">
         </RelativeLayout>
 
         <FrameLayout android:id="@+id/search_container"
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/resources/layout/media_casting.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <RelativeLayout android:id="@+id/media_controls"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_centerInParent="true">
+
+        <ImageButton android:id="@+id/media_play"
+                     style="@style/FindBar.ImageButton"
+                     android:contentDescription="@string/media_play"
+                     android:src="@drawable/media_bar_play"
+                     android:visibility="gone"/>
+
+        <ImageButton android:id="@+id/media_pause"
+                     style="@style/FindBar.ImageButton"
+                     android:contentDescription="@string/media_pause"
+                     android:src="@drawable/media_bar_pause"/>
+
+    </RelativeLayout>
+
+    <TextView android:id="@+id/media_casting_to"
+              android:layout_width="wrap_content"
+              android:layout_height="wrap_content"
+              android:layout_marginLeft="5dip"
+              android:layout_marginRight="5dip"
+              android:layout_alignParentLeft="true"
+              android:layout_toLeftOf="@id/media_controls"
+              android:layout_centerVertical="true"
+              android:singleLine="true"
+              android:ellipsize="end"
+              android:textColor="#FFFFFFFF"
+              android:contentDescription="@string/media_casting_to"/>
+
+    <ImageButton android:id="@+id/media_stop"
+                 style="@style/FindBar.ImageButton"
+                 android:contentDescription="@string/media_stop"
+                 android:layout_alignParentRight="true"
+                 android:src="@drawable/media_bar_stop"/>
+
+</merge>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -78,16 +78,21 @@
   <string name="desktop_mode">&desktop_mode;</string>
   <string name="tools">&tools;</string>
 
   <string name="find_text">&find_text;</string>
   <string name="find_prev">&find_prev;</string>
   <string name="find_next">&find_next;</string>
   <string name="find_close">&find_close;</string>
 
+  <string name="media_casting_to">&media_casting_to;</string>
+  <string name="media_play">&media_play;</string>
+  <string name="media_pause">&media_pause;</string>
+  <string name="media_stop">&media_stop;</string>
+
   <string name="settings">&settings;</string>
   <string name="settings_title">&settings_title;</string>
   <string name="pref_category_advanced">&pref_category_advanced;</string>
   <string name="pref_category_customize">&pref_category_customize;</string>
   <string name="pref_category_search">&pref_category_search2;</string>
   <string name="pref_category_display">&pref_category_display;</string>
   <string name="pref_category_privacy_short">&pref_category_privacy_short;</string>
   <string name="pref_category_vendor">&pref_category_vendor;</string>
--- a/mobile/android/base/tests/robocop.ini
+++ b/mobile/android/base/tests/robocop.ini
@@ -74,16 +74,17 @@ skip-if = processor == "x86"
 [testBrowserDiscovery]
 [testDeviceSearchEngine]
 [testJNI]
 # [testMozPay] # see bug 945675
 [testOrderedBroadcast]
 [testSharedPreferences]
 [testSimpleDiscovery]
 [testUITelemetry]
+[testVideoDiscovery]
 
 # Used for Talos, please don't use in mochitest
 #[testPan]
 #[testCheck]
 #[testCheck2]
 #[testBrowserProviderPerf]
 
 # Using UITest
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/testVideoDiscovery.java
@@ -0,0 +1,10 @@
+package org.mozilla.gecko.tests;
+
+import org.mozilla.gecko.*;
+
+
+public class testVideoDiscovery extends JavascriptTest {
+    public testVideoDiscovery() {
+        super("testVideoDiscovery.js");
+    }
+}
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/testVideoDiscovery.js
@@ -0,0 +1,84 @@
+// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+
+Cu.import("resource://gre/modules/Services.jsm");
+
+function ok(passed, text) {
+  do_report_result(passed, text, Components.stack.caller, false);
+}
+
+// The chrome window
+let chromeWin;
+
+// Track the <browser> where the tests are happening
+let browser;
+
+function middle(element) {
+  let rect = element.getBoundingClientRect();
+  let x = (rect.right - rect.left) / 2 + rect.left;
+  let y = (rect.bottom - rect.top) / 2 + rect.top;
+  return [x, y];
+}
+
+add_test(function setup_browser() {
+  chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
+  let BrowserApp = chromeWin.BrowserApp;
+
+  do_register_cleanup(function cleanup() {
+    BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
+  });
+
+  let url = "http://mochi.test:8888/tests/robocop/video_discovery.html";
+  browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
+  browser.addEventListener("load", function startTests(event) {
+    browser.removeEventListener("load", startTests, true);
+    Services.tm.mainThread.dispatch(run_next_test, Ci.nsIThread.DISPATCH_NORMAL);
+  }, true);
+});
+
+let videoDiscoveryTests = [
+  { id: "simple-mp4", source: "http://mochi.test:8888/simple.mp4", poster: "http://mochi.test:8888/simple.png", text: "simple video with mp4 src" },
+  { id: "simple-fail", pass: false, text: "simple video with no mp4 src" },
+  { id: "with-sources-mp4", source: "http://mochi.test:8888/simple.mp4", text: "video with mp4 extension source child" },
+  { id: "with-sources-fail", pass: false, text: "video with no mp4 extension source child" },
+  { id: "with-sources-mimetype", source: "http://mochi.test:8888/simple-video-mp4", text: "video with mp4 mimetype source child" },
+  { id: "video-overlay", source: "http://mochi.test:8888/simple.mp4", text: "div overlay covering a simple video with mp4 src" }
+];
+
+function execute_video_test(test) {
+  let element = browser.contentDocument.getElementById(test.id);
+  if (element) {
+    let [x, y] = middle(element);
+    let video = chromeWin.CastingApps.getVideo(element, x, y);
+    if (video) {
+      let matchPoster = (test.poster == video.poster);
+      let matchSource = (test.source == video.source);
+      ok(matchPoster && matchSource && test.pass, test.text);
+    } else {
+      ok(!test.pass, test.text);
+    }
+  } else {
+    ok(false, "test element not found: [" + test.id + "]");
+  }
+  run_next_test();
+}
+
+let videoTest;
+while ((videoTest = videoDiscoveryTests.shift())) {
+  if (!("poster" in videoTest)) {
+    videoTest.poster = "";
+  }
+  if (!("pass" in videoTest)) {
+    videoTest.pass = true;
+  }
+
+  add_test(execute_video_test.bind(this, videoTest));
+}
+
+run_next_test();
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/tests/video_discovery.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+  <head>
+    <title>Video Discovery Test</title>
+    <style type="text/css">
+      #video-box {
+        float: left;
+      }
+      #video-overlay, #video-player {
+        width: 640px;
+        min-height: 370px;
+      }
+      #video-overlay {
+        position: absolute;
+        float: left;
+        background-color:#f00;
+        z-index:10;
+      }
+    </style>
+  </head>
+  <body>
+    <!-- PASS: src uses a mp4 extension -->
+    <video id="simple-mp4" poster="/simple.png" src="/simple.mp4"></video>
+
+    <!-- FAIL: src uses a ogg extension -->
+    <video id="simple-fail" src="/simple.ogg"></video>
+
+    <!-- PASS: source list uses a mp4 extension -->
+    <video id="with-sources-mp4">
+      <source src="/simple.ogg">
+      <source src="/simple.mp4">
+    </video>
+
+    <!-- FAIL: source list uses a mp4 extension -->
+    <video id="with-sources-fail">
+      <source src="/simple.ogg">
+      <source src="/simple.webm">
+    </video>
+
+    <!-- PASS: source list uses a mp4 mimetype -->
+    <video id="with-sources-mimetype">
+      <source src="/simple-video-ogg" type="video/ogg">
+      <source src="/simple-video-mp4" type="video/mp4">
+    </video>
+
+    <!-- PASS: source list uses a mp4 mimetype and extra data -->
+    <video id="with-sources-mimetype-plus">
+      <source src="/simple-video-ogg" type="video/ogg">
+      <source src="/simple-video-mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'">
+    </video>
+
+    <!-- PASS: div overlay covers a video with mp4 src -->
+    <div id="video-box">
+      <div id="video-overlay"></div>
+      <div>
+        <video id="video-player" src="/simple.mp4"></video>
+      </div>
+    </div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/mobile/android/chrome/content/CastingApps.js
@@ -0,0 +1,243 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict";
+
+var CastingApps = {
+  _castMenuId: -1,
+
+  init: function ca_init() {
+    if (!this.isEnabled()) {
+      return;
+    }
+
+    // Search for devices continuously every 120 seconds
+    SimpleServiceDiscovery.search(120 * 1000);
+
+    this._castMenuId = NativeWindow.contextmenus.add(
+      Strings.browser.GetStringFromName("contextmenu.castToScreen"),
+      this.filterCast,
+      this.openExternal.bind(this)
+    );
+
+    Services.obs.addObserver(this, "Casting:Play", false);
+    Services.obs.addObserver(this, "Casting:Pause", false);
+    Services.obs.addObserver(this, "Casting:Stop", false);
+  },
+
+  uninit: function ca_uninit() {
+    Services.obs.removeObserver(this, "Casting:Play");
+    Services.obs.removeObserver(this, "Casting:Pause");
+    Services.obs.removeObserver(this, "Casting:Stop");
+
+    NativeWindow.contextmenus.remove(this._castMenuId);
+  },
+
+  isEnabled: function isEnabled() {
+    return Services.prefs.getBoolPref("browser.casting.enabled");
+  },
+
+  observe: function (aSubject, aTopic, aData) {
+    switch (aTopic) {
+      case "Casting:Play":
+        if (this.session && this.session.remoteMedia.status == "paused") {
+          this.session.remoteMedia.play();
+        }
+        break;
+      case "Casting:Pause":
+        if (this.session && this.session.remoteMedia.status == "started") {
+          this.session.remoteMedia.pause();
+        }
+        break;
+      case "Casting:Stop":
+        if (this.session) {
+          this.closeExternal();
+        }
+        break;
+    }
+  },
+
+  makeURI: function makeURI(aURL, aOriginCharset, aBaseURI) {
+    return Services.io.newURI(aURL, aOriginCharset, aBaseURI);
+  },
+
+  getVideo: function(aElement, aX, aY) {
+    // Fast path: Is the given element a video element
+    let video = this._getVideo(aElement);
+    if (video) {
+      return video;
+    }
+
+    // The context menu system will keep walking up the DOM giving us a chance
+    // to find an element we match. When it hits <html> things can go BOOM.
+    try {
+      // Maybe this is an overlay, with the video element under it
+      // Use the (x, y) location to guess at a <video> element
+      let elements = aElement.ownerDocument.querySelectorAll("video");
+      for (let element of elements) {
+        // Look for a video element contained in the overlay bounds
+        let rect = element.getBoundingClientRect();
+        if (aY >= rect.top && aX >= rect.left && aY <= rect.bottom && aX <= rect.right) {
+          video = this._getVideo(element);
+          if (video) {
+            break;
+          }
+        }
+      }
+    } catch(e) {}
+
+    // Could be null
+    return video;
+  },
+
+  _getVideo: function(aElement) {
+    // Given the hardware support for H264, let's only look for 'mp4' sources
+    if (!aElement instanceof HTMLVideoElement) {
+      return null;
+    }
+
+    function allowableExtension(aURI) {
+      if (aURI && aURI instanceof Ci.nsIURL) {
+        return (aURI.fileExtension == "mp4");
+      }
+      return false;
+    }
+
+    // Grab the poster attribute from the <video>
+    let posterURL = aElement.poster;
+
+    // First, look to see if the <video> has a src attribute
+    let sourceURL = aElement.src;
+
+    // If empty, try the currentSrc
+    if (!sourceURL) {
+      sourceURL = aElement.currentSrc;
+    }
+
+    if (sourceURL) {
+      // Use the file extension to guess the mime type
+      let sourceURI = this.makeURI(sourceURL, null, this.makeURI(aElement.baseURI));
+      if (allowableExtension(sourceURI)) {
+        return { video: aElement, source: sourceURI.spec, poster: posterURL };
+      }
+    }
+
+    // Next, look to see if there is a <source> child element that meets
+    // our needs
+    let sourceNodes = aElement.getElementsByTagName("source");
+    for (let sourceNode of sourceNodes) {
+      let sourceURI = this.makeURI(sourceNode.src, null, this.makeURI(sourceNode.baseURI));
+
+      // Using the type attribute is our ideal way to guess the mime type. Otherwise,
+      // fallback to using the file extension to guess the mime type
+      if (sourceNode.type == "video/mp4" || allowableExtension(sourceURI)) {
+        return { video: aElement, source: sourceURI.spec, poster: posterURL };
+      }
+    }
+
+    return null;
+  },
+
+  filterCast: {
+    matches: function(aElement, aX, aY) {
+      if (SimpleServiceDiscovery.services.length == 0)
+        return false;
+      let video = CastingApps.getVideo(aElement, aX, aY);
+      if (CastingApps.session) {
+        return (video && CastingApps.session.data.source != video.source);
+      }
+      return (video != null);
+    }
+  },
+
+  prompt: function(aCallback) {
+    let items = [];
+    SimpleServiceDiscovery.services.forEach(function(aService) {
+      let item = {
+        label: aService.friendlyName,
+        selected: false
+      };
+      items.push(item);
+    });
+
+    let prompt = new Prompt({
+      title: Strings.browser.GetStringFromName("casting.prompt")
+    }).setSingleChoiceItems(items).show(function(data) {
+      let selected = data.button;
+      let service = selected == -1 ? null : SimpleServiceDiscovery.services[selected];
+      if (aCallback)
+        aCallback(service);
+    });
+  },
+
+  openExternal: function(aElement, aX, aY) {
+    // Start a second screen media service
+    let video = this.getVideo(aElement, aX, aY);
+    if (!video) {
+      return;
+    }
+
+    this.prompt(function(aService) {
+      if (!aService)
+        return;
+
+      // Make sure we have a player app for the given service
+      let app = SimpleServiceDiscovery.findAppForService(aService, "video-sharing");
+      if (!app)
+        return;
+
+      video.title = aElement.ownerDocument.defaultView.top.document.title;
+      if (video.element) {
+        // If the video is currently playing on the device, pause it
+        if (!video.element.paused) {
+          video.element.pause();
+        }
+      }
+
+      app.stop(function() {
+        app.start("", function() {
+          app.remoteMedia(function(aRemoteMedia) {
+            this.session = {
+              service: aService,
+              app: app,
+              remoteMedia: aRemoteMedia,
+              data: {
+                title: video.title,
+                source: video.source,
+                poster: video.poster
+              }
+            };
+          }.bind(this), this);
+        }.bind(this));
+      }.bind(this));
+    }.bind(this));
+  },
+
+  // RemoteMedia callback API methods
+  onRemoteMediaStart: function(aRemoteMedia) {
+    if (!this.session) {
+      return;
+    }
+
+    aRemoteMedia.load(this.session.data);
+    sendMessageToJava({ type: "Casting:Started", device: this.session.service.friendlyName });
+  },
+
+  onRemoteMediaStop: function(aRemoteMedia) {
+    sendMessageToJava({ type: "Casting:Stopped" });
+  },
+
+  onRemoteMediaStatus: function(aRemoteMedia) {
+    if (!this.session) {
+      return;
+    }
+
+    let status = aRemoteMedia.status;
+    if (status == "completed") {
+      aRemoteMedia.shutdown();
+      this.session.app.stop();
+      delete this.session;
+    }
+  }
+};
+
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -58,16 +58,19 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
                                   "resource://gre/modules/FormHistory.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
+XPCOMUtils.defineLazyModuleGetter(this, "SimpleServiceDiscovery",
+                                  "resource://gre/modules/SimpleServiceDiscovery.jsm");
+
 #ifdef NIGHTLY_BUILD
 XPCOMUtils.defineLazyModuleGetter(this, "ShumwayUtils",
                                   "resource://shumway/ShumwayUtils.jsm");
 #endif
 
 #ifdef MOZ_ANDROID_SYNTHAPKS
 XPCOMUtils.defineLazyModuleGetter(this, "WebappManager",
                                   "resource://gre/modules/WebappManager.jsm");
@@ -77,16 +80,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 [
   ["SelectHelper", "chrome://browser/content/SelectHelper.js"],
   ["InputWidgetHelper", "chrome://browser/content/InputWidgetHelper.js"],
   ["AboutReader", "chrome://browser/content/aboutReader.js"],
   ["MasterPassword", "chrome://browser/content/MasterPassword.js"],
   ["PluginHelper", "chrome://browser/content/PluginHelper.js"],
   ["OfflineApps", "chrome://browser/content/OfflineApps.js"],
   ["Linkifier", "chrome://browser/content/Linkify.js"],
+  ["CastingApps", "chrome://browser/content/CastingApps.js"],
 ].forEach(function (aScript) {
   let [name, script] = aScript;
   XPCOMUtils.defineLazyGetter(window, name, function() {
     let sandbox = {};
     Services.scriptloader.loadSubScript(script, sandbox);
     return sandbox[name];
   });
 });
@@ -381,16 +385,17 @@ var BrowserApp = {
     Cu.import("resource://gre/modules/AppsUtils.jsm");
 #else
     WebappsUI.init();
 #endif
     RemoteDebugger.init();
     Reader.init();
     UserAgentOverrides.init();
     DesktopUserAgent.init();
+    CastingApps.init();
     Distribution.init();
     Tabs.init();
 #ifdef ACCESSIBILITY
     AccessFu.attach(window);
 #endif
 #ifdef NIGHTLY_BUILD
     ShumwayUtils.init();
 #endif
@@ -722,16 +727,17 @@ var BrowserApp = {
 #ifndef MOZ_ANDROID_SYNTHAPKS
     WebappsUI.uninit();
 #endif
     RemoteDebugger.uninit();
     Reader.uninit();
     UserAgentOverrides.uninit();
     DesktopUserAgent.uninit();
     ExternalApps.uninit();
+    CastingApps.uninit();
     Distribution.uninit();
     Tabs.uninit();
   },
 
   // This function returns false during periods where the browser displayed document is
   // different from the browser content document, so user actions and some kinds of viewport
   // updates should be ignored. This period starts when we start loading a new page or
   // switch tabs, and ends when the new browser content document has been drawn and handed
--- a/mobile/android/chrome/jar.mn
+++ b/mobile/android/chrome/jar.mn
@@ -48,16 +48,17 @@ chrome.jar:
   content/PluginHelper.js              (content/PluginHelper.js)
   content/OfflineApps.js               (content/OfflineApps.js)
   content/MasterPassword.js            (content/MasterPassword.js)
   content/FindHelper.js                (content/FindHelper.js)
   content/PermissionsHelper.js         (content/PermissionsHelper.js)
   content/FeedHandler.js               (content/FeedHandler.js)
   content/Feedback.js                  (content/Feedback.js)
   content/Linkify.js                   (content/Linkify.js)
+  content/CastingApps.js               (content/CastingApps.js)
 #ifdef MOZ_SERVICES_HEALTHREPORT
   content/aboutHealthReport.xhtml      (content/aboutHealthReport.xhtml)
 * content/aboutHealthReport.js         (content/aboutHealthReport.js)
 #endif
   content/aboutAccounts.xhtml          (content/aboutAccounts.xhtml)
 * content/aboutAccounts.js             (content/aboutAccounts.js)
 
 % content branding %content/branding/
--- a/mobile/android/locales/en-US/chrome/browser.properties
+++ b/mobile/android/locales/en-US/chrome/browser.properties
@@ -154,16 +154,19 @@ browser.menu.showCharacterEncoding=false
 
 # LOCALIZATION NOTE (intl.charsetmenu.browser.static): Set to a series of comma separated
 # values for charsets that the user can select from in the Character Encoding menu.
 intl.charsetmenu.browser.static=iso-8859-1,utf-8,big5,iso-2022-jp,shift_jis,euc-jp
 
 # Text Selection
 selectionHelper.textCopied=Text copied to clipboard
 
+# Casting
+casting.prompt=Cast to Device
+
 # Context menu
 contextmenu.openInNewTab=Open Link in New Tab
 contextmenu.openInPrivateTab=Open Link in Private Tab
 contextmenu.addToReadingList=Add to Reading List
 contextmenu.share=Share
 contextmenu.copyLink=Copy Link
 contextmenu.shareLink=Share Link
 contextmenu.bookmarkLink=Bookmark Link
@@ -186,16 +189,17 @@ contextmenu.playMedia=Play
 contextmenu.pauseMedia=Pause
 contextmenu.shareMedia=Share Video
 contextmenu.showControls2=Show Controls
 contextmenu.mute=Mute
 contextmenu.unmute=Unmute
 contextmenu.saveVideo=Save Video
 contextmenu.saveAudio=Save Audio
 contextmenu.addToContacts=Add to Contacts
+contextmenu.castToScreen=Cast to Screen
 
 contextmenu.copy=Copy
 contextmenu.cut=Cut
 contextmenu.selectAll=Select All
 contextmenu.paste=Paste
 
 # Select UI
 selectHelper.closeMultipleSelectDialog=Done
--- a/modules/libjar/zipwriter/public/nsIZipWriter.idl
+++ b/modules/libjar/zipwriter/public/nsIZipWriter.idl
@@ -31,17 +31,17 @@ interface nsIZipEntry;
  *
  * Entry names should use /'s as path separators and should not start with
  * a /.
  *
  * It is not generally necessary to add directory entries in order to add file
  * entries within them, however it is possible that some zip programs may
  * experience problems what that.
  */
-[scriptable, uuid(6d4ef074-206c-4649-9884-57bc355864d6)]
+[scriptable, uuid(3ca10750-797e-4a22-bcfe-66170b5e96dd)]
 interface nsIZipWriter : nsISupports
 {
   /**
    * Some predefined compression levels
    */
   const uint32_t COMPRESSION_NONE    = 0;
   const uint32_t COMPRESSION_FASTEST = 1;
   const uint32_t COMPRESSION_DEFAULT = 6;
@@ -201,9 +201,20 @@ interface nsIZipWriter : nsISupports
   /**
    * Closes the zip file.
    *
    * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
    * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
    * @throws <other-error> on failure to complete the zip file
    */
   void close();
+
+  /**
+   * Make all stored(uncompressed) files align to given alignment size.
+   *
+   * @param aAlignSize is the alignment size, valid values from 2 to 32768, and
+            must be power of 2.
+   *
+   * @throws NS_ERROR_INVALID_ARG if aAlignSize is invalid
+   * @throws <other-error> on failure to update the zip file
+   */
+  void alignStoredFiles(in uint16_t aAlignSize);
 };
--- a/modules/libjar/zipwriter/src/nsZipHeader.cpp
+++ b/modules/libjar/zipwriter/src/nsZipHeader.cpp
@@ -337,8 +337,59 @@ const uint8_t * nsZipHeader::GetExtraFie
         return buf + pos - 4;
       }
 
       pos += blocksize;
     }
 
     return nullptr;
 }
+
+/*
+ * Pad extra field to align data starting position to specified size.
+ */
+nsresult nsZipHeader::PadExtraField(uint32_t aOffset, uint16_t aAlignSize)
+{
+    uint32_t pad_size;
+    uint32_t pa_offset;
+    uint32_t pa_end;
+
+    // Check for range and power of 2.
+    if (aAlignSize < 2 || aAlignSize > 32768 ||
+        (aAlignSize & (aAlignSize - 1)) != 0) {
+      return NS_ERROR_INVALID_ARG;
+    }
+
+    // Point to current starting data position.
+    aOffset += ZIP_FILE_HEADER_SIZE + mName.Length() + mLocalFieldLength;
+
+    // Calculate aligned offset.
+    pa_offset = aOffset & ~(aAlignSize - 1);
+    pa_end = pa_offset + aAlignSize;
+    pad_size = pa_end - aOffset;
+    if (pad_size == 0) {
+      return NS_OK;
+    }
+
+    // Leave enough room(at least 4 bytes) for valid values in extra field.
+    while (pad_size < 4) {
+      pad_size += aAlignSize;
+    }
+    // Extra field length is 2 bytes.
+    if (mLocalFieldLength + pad_size > 65535) {
+      return NS_ERROR_FAILURE;
+    }
+
+    nsAutoArrayPtr<uint8_t> field = mLocalExtraField;
+    uint32_t pos = mLocalFieldLength;
+
+    mLocalExtraField = new uint8_t[mLocalFieldLength + pad_size];
+    memcpy(mLocalExtraField.get(), field, mLocalFieldLength);
+    // Use 0xFFFF as tag ID to avoid conflict with other IDs.
+    // For more information, please read "Extensible data fields" section in:
+    // http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+    WRITE16(mLocalExtraField.get(), &pos, 0xFFFF);
+    WRITE16(mLocalExtraField.get(), &pos, pad_size - 4);
+    memset(mLocalExtraField.get() + pos, 0, pad_size - 4);
+    mLocalFieldLength += pad_size;
+
+    return NS_OK;
+}
--- a/modules/libjar/zipwriter/src/nsZipHeader.h
+++ b/modules/libjar/zipwriter/src/nsZipHeader.h
@@ -83,11 +83,12 @@ public:
     void Init(const nsACString & aPath, PRTime aDate, uint32_t aAttr,
               uint32_t aOffset);
     uint32_t GetFileHeaderLength();
     nsresult WriteFileHeader(nsIOutputStream *aStream);
     uint32_t GetCDSHeaderLength();
     nsresult WriteCDSHeader(nsIOutputStream *aStream);
     nsresult ReadCDSHeader(nsIInputStream *aStream);
     const uint8_t * GetExtraField(uint16_t aTag, bool aLocal, uint16_t *aBlockSize);
+    nsresult PadExtraField(uint32_t aOffset, uint16_t aAlignSize);
 };
 
 #endif
--- a/modules/libjar/zipwriter/src/nsZipWriter.cpp
+++ b/modules/libjar/zipwriter/src/nsZipWriter.cpp
@@ -1,15 +1,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "nsZipWriter.h"
+
+#include <algorithm>
+
 #include "StreamFunctions.h"
-#include "nsZipWriter.h"
 #include "nsZipDataStream.h"
 #include "nsISeekableStream.h"
 #include "nsIAsyncStreamCopier.h"
 #include "nsIStreamListener.h"
 #include "nsIInputStreamPump.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMemory.h"
 #include "nsError.h"
@@ -546,20 +549,17 @@ NS_IMETHODIMP nsZipWriter::RemoveEntry(c
                 inputStream->Close();
                 return rv;
             }
 
             uint32_t count = mCDSOffset - mHeaders[pos + 1]->mOffset;
             uint32_t read = 0;
             char buf[4096];
             while (count > 0) {
-                if (count < sizeof(buf))
-                    read = count;
-                else
-                    read = sizeof(buf);
+                read = std::min(count, (uint32_t) sizeof(buf));
 
                 rv = inputStream->Read(buf, read, &read);
                 if (NS_FAILED(rv)) {
                     inputStream->Close();
                     Cleanup();
                     return rv;
                 }
 
@@ -732,16 +732,138 @@ NS_IMETHODIMP nsZipWriter::OnStopRequest
         return rv;
     }
 
     BeginProcessingNextItem();
 
     return NS_OK;
 }
 
+/*
+ * Make all stored(uncompressed) files align to given alignment size.
+ */
+NS_IMETHODIMP nsZipWriter::AlignStoredFiles(uint16_t aAlignSize)
+{
+    nsresult rv;
+
+    // Check for range and power of 2.
+    if (aAlignSize < 2 || aAlignSize > 32768 ||
+        (aAlignSize & (aAlignSize - 1)) != 0) {
+        return NS_ERROR_INVALID_ARG;
+    }
+
+    for (int i = 0; i < mHeaders.Count(); i++) {
+        nsZipHeader *header = mHeaders[i];
+
+        // Check whether this entry is file and compression method is stored.
+        bool isdir;
+        rv = header->GetIsDirectory(&isdir);
+        if (NS_FAILED(rv)) {
+            return rv;
+        }
+        if (isdir || header->mMethod != 0) {
+            continue;
+        }
+        // Pad extra field to align data starting position to specified size.
+        uint32_t old_len = header->mLocalFieldLength;
+        rv = header->PadExtraField(header->mOffset, aAlignSize);
+        if (NS_FAILED(rv)) {
+            continue;
+        }
+        // No padding means data already aligned.
+        uint32_t shift = header->mLocalFieldLength - old_len;
+        if (shift == 0) {
+            continue;
+        }
+
+        // Flush any remaining data before we start.
+        rv = mStream->Flush();
+        if (NS_FAILED(rv)) {
+            return rv;
+        }
+
+        // Open zip file for reading.
+        nsCOMPtr<nsIInputStream> inputStream;
+        rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), mFile);
+        if (NS_FAILED(rv)) {
+            return rv;
+        }
+
+        nsCOMPtr<nsISeekableStream> in_seekable = do_QueryInterface(inputStream);
+        nsCOMPtr<nsISeekableStream> out_seekable = do_QueryInterface(mStream);
+
+        uint32_t data_offset = header->mOffset + header->GetFileHeaderLength() - shift;
+        uint32_t count = mCDSOffset - data_offset;
+        uint32_t read;
+        char buf[4096];
+
+        // Shift data to aligned postion.
+        while (count > 0) {
+            read = std::min(count, (uint32_t) sizeof(buf));
+
+            rv = in_seekable->Seek(nsISeekableStream::NS_SEEK_SET,
+                                   data_offset + count - read);
+            if (NS_FAILED(rv)) {
+                break;
+             }
+
+            rv = inputStream->Read(buf, read, &read);
+            if (NS_FAILED(rv)) {
+                break;
+            }
+
+            rv = out_seekable->Seek(nsISeekableStream::NS_SEEK_SET,
+                                    data_offset + count - read + shift);
+            if (NS_FAILED(rv)) {
+                break;
+             }
+
+            rv = ZW_WriteData(mStream, buf, read);
+            if (NS_FAILED(rv)) {
+                break;
+            }
+
+            count -= read;
+        }
+        inputStream->Close();
+        if (NS_FAILED(rv)) {
+            Cleanup();
+            return rv;
+        }
+
+        // Update current header
+        rv = out_seekable->Seek(nsISeekableStream::NS_SEEK_SET,
+                                header->mOffset);
+        if (NS_FAILED(rv)) {
+            Cleanup();
+            return rv;
+        }
+        rv = header->WriteFileHeader(mStream);
+        if (NS_FAILED(rv)) {
+            Cleanup();
+            return rv;
+        }
+
+        // Update offset of all other headers
+        int pos = i + 1;
+        while (pos < mHeaders.Count()) {
+            mHeaders[pos]->mOffset += shift;
+            pos++;
+        }
+        mCDSOffset += shift;
+        rv = SeekCDS();
+        if (NS_FAILED(rv)) {
+            return rv;
+        }
+        mCDSDirty = true;
+    }
+
+    return NS_OK;
+}
+
 nsresult nsZipWriter::InternalAddEntryDirectory(const nsACString & aZipEntry,
                                                 PRTime aModTime,
                                                 uint32_t aPermissions)
 {
     nsRefPtr<nsZipHeader> header = new nsZipHeader();
     NS_ENSURE_TRUE(header, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t zipAttributes = ZIP_ATTRS(aPermissions, ZIP_ATTRS_DIRECTORY);
new file mode 100644
--- /dev/null
+++ b/modules/libjar/zipwriter/test/unit/test_alignment.js
@@ -0,0 +1,113 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+const DATA = "ZIP WRITER TEST DATA";
+const FILENAME = "test_data.txt";
+const CRC = 0xe6164331;
+const time = 1199145600000; // Jan 1st 2008
+
+var TESTS = [
+  {
+    name: "test.txt",
+    compression: Ci.nsIZipWriter.COMPRESSION_DEFAULT
+  },
+  {
+    name: "test.png",
+    compression: Ci.nsIZipWriter.COMPRESSION_NONE
+  }
+];
+
+function swap16(n)
+{
+  return (((n >> 8) & 0xFF) <<  0) |
+         (((n >>  0) & 0xFF) << 8);
+}
+
+function swap32(n)
+{
+  return (((n >> 24) & 0xFF) <<  0) |
+         (((n >> 16) & 0xFF) <<  8) |
+         (((n >>  8) & 0xFF) << 16) |
+         (((n >>  0) & 0xFF) << 24);
+}
+
+function move_to_data(bis, offset)
+{
+  bis.readBytes(18); // Move to compressed size
+  var size = swap32(bis.read32());
+  bis.readBytes(4);
+  var file_len = swap16(bis.read16());
+  var extra_len = swap16(bis.read16());
+  var file = bis.readBytes(file_len);
+  bis.readBytes(extra_len);
+  offset += ZIP_FILE_HEADER_SIZE + file_len + extra_len;
+
+  return {offset: offset, size: size};
+}
+
+function test_alignment(align_size)
+{
+  // Create zip for testing.
+  zipW.open(tmpFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
+  for (var i = 0; i < TESTS.length; i++) {
+    var source = do_get_file(DATA_DIR + TESTS[i].name);
+    zipW.addEntryFile(TESTS[i].name, TESTS[i].compression, source, false);
+  }
+  var stream = Cc["@mozilla.org/io/string-input-stream;1"]
+                .createInstance(Ci.nsIStringInputStream);
+  stream.setData(DATA, DATA.length);
+  zipW.addEntryStream(FILENAME, time * PR_USEC_PER_MSEC,
+                      Ci.nsIZipWriter.COMPRESSION_NONE, stream, false);
+  zipW.alignStoredFiles(align_size);
+  zipW.close();
+
+  // Check data can be decompressed.
+  var zipR = new ZipReader(tmpFile);
+  var stream = Cc["@mozilla.org/scriptableinputstream;1"]
+                .createInstance(Ci.nsIScriptableInputStream);
+  stream.init(zipR.getInputStream(FILENAME));
+  var result = stream.read(DATA.length);
+  do_check_eq(result, DATA);
+  stream.close();
+  zipR.close();
+
+  // Check data is correct and aligned.
+  var fis = Cc["@mozilla.org/network/file-input-stream;1"]
+                 .createInstance(Ci.nsIFileInputStream);
+  fis.init(tmpFile, -1, -1, null);
+  let bis = Cc["@mozilla.org/binaryinputstream;1"]
+              .createInstance(Ci.nsIBinaryInputStream);
+  bis.setInputStream(fis);
+  var offset = 0;
+
+  var ret = move_to_data(bis, offset); // "test.txt"
+  offset = ret.offset;
+  bis.readBytes(ret.size);
+  offset += ret.size;
+
+  ret = move_to_data(bis, offset); // "test.png"
+  offset = ret.offset;
+  do_check_eq(offset % align_size, 0);
+  bis.readBytes(ret.size);
+  offset += ret.size;
+
+  ret = move_to_data(bis, offset); // "test_data.txt"
+  offset = ret.offset;
+  var result = bis.readBytes(DATA.length);
+  do_check_eq(result, DATA);
+  do_check_eq(offset % align_size, 0);
+
+  fis.close();
+  bis.close();
+}
+
+function run_test()
+{
+  test_alignment(2);
+  test_alignment(4);
+  test_alignment(16);
+  test_alignment(4096);
+  test_alignment(32768);
+}
--- a/modules/libjar/zipwriter/test/unit/xpcshell.ini
+++ b/modules/libjar/zipwriter/test/unit/xpcshell.ini
@@ -29,8 +29,9 @@ support-files =
 [test_directory.js]
 [test_editexisting.js]
 [test_storedata.js]
 [test_sync.js]
 [test_undochange.js]
 [test_zipcomment.js]
 [test_zippermissions.js]
 [test_bug717061.js]
+[test_alignment.js]
--- a/tools/profiler/IOInterposer.cpp
+++ b/tools/profiler/IOInterposer.cpp
@@ -241,16 +241,24 @@ IOInterposeObserver::Operation IOInterpo
   // IOInterposer::Init most be called before this method.
   MOZ_ASSERT(sObserverLists);
   if (!sObserverLists) {
     return;
   }
 
   AutoPRLock listLock(sObserverLists->mObserverListsLock);
 
+  if (aOp & IOInterposeObserver::OpCreateOrOpen) {
+    VectorRemove(sObserverLists->mCreateObservers, aObserver);
+    if (sObserverLists->mCreateObservers.empty()) {
+      sObservedOperations = (IOInterposeObserver::Operation)
+                       (sObservedOperations &
+                        ~IOInterposeObserver::OpCreateOrOpen);
+    }
+  }
   if (aOp & IOInterposeObserver::OpRead) {
     VectorRemove(sObserverLists->mReadObservers, aObserver);
     if (sObserverLists->mReadObservers.empty()) {
       sObservedOperations = (IOInterposeObserver::Operation)
                        (sObservedOperations & ~IOInterposeObserver::OpRead);
     }
   }
   if (aOp & IOInterposeObserver::OpWrite) {
@@ -262,9 +270,23 @@ IOInterposeObserver::Operation IOInterpo
   }
   if (aOp & IOInterposeObserver::OpFSync) {
     VectorRemove(sObserverLists->mFSyncObservers, aObserver);
     if (sObserverLists->mFSyncObservers.empty()) {
       sObservedOperations = (IOInterposeObserver::Operation)
                        (sObservedOperations & ~IOInterposeObserver::OpFSync);
     }
   }
+  if (aOp & IOInterposeObserver::OpStat) {
+    VectorRemove(sObserverLists->mStatObservers, aObserver);
+    if (sObserverLists->mStatObservers.empty()) {
+      sObservedOperations = (IOInterposeObserver::Operation)
+                       (sObservedOperations & ~IOInterposeObserver::OpStat);
+    }
+  }
+  if (aOp & IOInterposeObserver::OpClose) {
+    VectorRemove(sObserverLists->mCloseObservers, aObserver);
+    if (sObserverLists->mCloseObservers.empty()) {
+      sObservedOperations = (IOInterposeObserver::Operation)
+                       (sObservedOperations & ~IOInterposeObserver::OpClose);
+    }
+  }
 }
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -23,17 +23,16 @@
 #include <malloc.h>
 #include "nsWindow.h"
 #include "nsIComboboxControlFrame.h"
 #include "prinrval.h"
 #include "WinUtils.h"
 
 #include "gfxPlatform.h"
 #include "gfxContext.h"
-#include "gfxMatrix.h"
 #include "gfxWindowsPlatform.h"
 #include "gfxWindowsSurface.h"
 #include "gfxWindowsNativeDrawing.h"
 
 #include "nsUXThemeData.h"
 #include "nsUXThemeConstants.h"
 #include <algorithm>