Merge m-i to m-c, a=merge
authorPhil Ringnalda <philringnalda@gmail.com>
Sun, 10 May 2015 09:10:19 -0700
changeset 274557 30a4ba533b1c0d6debe4d84f79c9e9a868efd052
parent 274552 641fcb51bd9a8bcb28ce4016b9c6ab4839c62087 (current diff)
parent 274556 57c740d1586ac157dbbfbc60bc1be53f47e66b4e (diff)
child 274558 7c00628cbfb12966475d1ae5ebf7b97278afba9a
child 274563 645a1e17de30dc707c2cf51f86ba41df185139bf
child 274571 ac0f231f4342d6c89d3d195da6b67edd7ba5229c
child 274575 f1e48e9516fa7d50f07159023972458ef42e0ff9
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone40.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-i to m-c, a=merge
docshell/base/nsDocShell.cpp
layout/reftests/text/text-align-match-parent-01.html
layout/reftests/text/text-align-match-parent-02.html
layout/reftests/text/text-align-match-parent-03.html
layout/reftests/text/text-align-match-parent-04.html
layout/reftests/text/text-align-match-parent-ref.html
layout/reftests/text/text-align-match-parent-root-ltr-ref.html
layout/reftests/text/text-align-match-parent-root-ltr.html
layout/reftests/text/text-align-match-parent-root-rtl-ref.html
layout/reftests/text/text-align-match-parent-root-rtl.html
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10734,17 +10734,17 @@ nsDocShell::DoURILoad(nsIURI* aURI,
                                   aReferrerURI);
   }
 
   //
   // If this is a HTTP channel, then set up the HTTP specific information
   // (ie. POST data, referrer, ...)
   //
   if (httpChannel) {
-    nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(httpChannel));
+    nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
     /* Get the cache Key from SH */
     nsCOMPtr<nsISupports> cacheKey;
     if (mLSHE) {
       mLSHE->GetCacheKey(getter_AddRefs(cacheKey));
     } else if (mOSHE) {  // for reload cases
       mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
     }
 
@@ -11284,17 +11284,17 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsICh
       (aLoadType == LOAD_RELOAD_BYPASS_CACHE ||
        aLoadType == LOAD_RELOAD_BYPASS_PROXY ||
        aLoadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE ||
        aLoadType == LOAD_RELOAD_ALLOW_MIXED_CONTENT)) {
     NS_ASSERTION(!updateSHistory,
                  "We shouldn't be updating session history for forced"
                  " reloads!");
 
-    nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(aChannel));
+    nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(aChannel));
     nsCOMPtr<nsISupports> cacheKey;
     // Get the Cache Key and store it in SH.
     if (cacheChannel) {
       cacheChannel->GetCacheKey(getter_AddRefs(cacheKey));
     }
     // If we already have a loading history entry, store the new cache key
     // in it.  Otherwise, since we're doing a reload and won't be updating
     // our history entry, store the cache key in our current history entry.
@@ -11838,17 +11838,17 @@ nsDocShell::AddToSessionHistory(nsIURI* 
   // Get the post data & referrer
   nsCOMPtr<nsIInputStream> inputStream;
   nsCOMPtr<nsIURI> referrerURI;
   uint32_t referrerPolicy = mozilla::net::RP_Default;
   nsCOMPtr<nsISupports> cacheKey;
   nsCOMPtr<nsISupports> owner = aOwner;
   bool expired = false;
   bool discardLayoutState = false;
-  nsCOMPtr<nsICachingChannel> cacheChannel;
+  nsCOMPtr<nsICacheInfoChannel> cacheChannel;
   if (aChannel) {
     cacheChannel = do_QueryInterface(aChannel);
 
     /* If there is a caching channel, get the Cache Key and store it
      * in SH.
      */
     if (cacheChannel) {
       cacheChannel->GetCacheKey(getter_AddRefs(cacheKey));
--- a/docshell/test/mochitest.ini
+++ b/docshell/test/mochitest.ini
@@ -62,17 +62,17 @@ skip-if = buildapp == 'mulet' || (builda
 skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(debug-only failure) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
 [test_bug530396.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Timeouts on B2G desktop
 support-files = bug530396-noref.sjs bug530396-subframe.html
 [test_bug540462.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_bug551225.html]
 [test_bug570341.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
+skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #debug-only failure, android bug 1040769
 [test_bug580069.html]
 [test_bug590573.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 823022 # b2g(queryinterfaces into webnavigation, might suffer from something similar as bug 823022) b2g-debug(queryinterfaces into webnavigation, might suffer from something similar as bug 823022) b2g-desktop(queryinterfaces into webnavigation, might suffer from something similar as bug 823022)
 [test_bug598895.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == 'android' #Bug 931116, b2g desktop specific, initial triage
 [test_bug634834.html]
 [test_bug637644.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == 'android' #Bug 931116, b2g desktop specific, initial triage
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7705,8 +7705,62 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<
   }
   if (aPreventDefault) {
     *aPreventDefault = (status == nsEventStatus_eConsumeNoDefault);
   }
 
   return NS_OK;
 }
 
+/* static */
+void
+nsContentUtils::FirePageHideEvent(nsIDocShellTreeItem* aItem,
+                                  EventTarget* aChromeEventHandler)
+{
+  nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
+  NS_ASSERTION(doc, "What happened here?");
+  doc->OnPageHide(true, aChromeEventHandler);
+
+  int32_t childCount = 0;
+  aItem->GetChildCount(&childCount);
+  nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
+  kids.AppendElements(childCount);
+  for (int32_t i = 0; i < childCount; ++i) {
+    aItem->GetChildAt(i, getter_AddRefs(kids[i]));
+  }
+
+  for (uint32_t i = 0; i < kids.Length(); ++i) {
+    if (kids[i]) {
+      FirePageHideEvent(kids[i], aChromeEventHandler);
+    }
+  }
+}
+
+// The pageshow event is fired for a given document only if IsShowing() returns
+// the same thing as aFireIfShowing.  This gives us a way to fire pageshow only
+// on documents that are still loading or only on documents that are already
+// loaded.
+/* static */
+void
+nsContentUtils::FirePageShowEvent(nsIDocShellTreeItem* aItem,
+                                  EventTarget* aChromeEventHandler,
+                                  bool aFireIfShowing)
+{
+  int32_t childCount = 0;
+  aItem->GetChildCount(&childCount);
+  nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
+  kids.AppendElements(childCount);
+  for (int32_t i = 0; i < childCount; ++i) {
+    aItem->GetChildAt(i, getter_AddRefs(kids[i]));
+  }
+
+  for (uint32_t i = 0; i < kids.Length(); ++i) {
+    if (kids[i]) {
+      FirePageShowEvent(kids[i], aChromeEventHandler, aFireIfShowing);
+    }
+  }
+
+  nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
+  NS_ASSERTION(doc, "What happened here?");
+  if (doc->IsShowing() == aFireIfShowing) {
+    doc->OnPageShow(true, aChromeEventHandler);
+  }
+}
\ No newline at end of file
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -46,16 +46,17 @@ class imgLoader;
 class imgRequestProxy;
 class nsAutoScriptBlockerSuppressNodeRemoved;
 class nsHtml5StringParser;
 class nsIChannel;
 class nsIConsoleService;
 class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
+class nsIDocShellTreeItem;
 class nsIDocument;
 class nsIDocumentLoaderFactory;
 class nsIDOMDocument;
 class nsIDOMDocumentFragment;
 class nsIDOMEvent;
 class nsIDOMHTMLInputElement;
 class nsIDOMKeyEvent;
 class nsIDOMNode;
@@ -2346,16 +2347,23 @@ public:
                                  int32_t aModifiers,
                                  bool aIgnoreRootScrollFrame,
                                  float aPressure,
                                  unsigned short aInputSourceArg,
                                  bool aToWindow,
                                  bool *aPreventDefault,
                                  bool aIsSynthesized);
 
+  static void FirePageShowEvent(nsIDocShellTreeItem* aItem,
+                                mozilla::dom::EventTarget* aChromeEventHandler,
+                                bool aFireIfShowing);
+
+  static void FirePageHideEvent(nsIDocShellTreeItem* aItem,
+                                mozilla::dom::EventTarget* aChromeEventHandler);
+
 private:
   static bool InitializeEventTable();
 
   static nsresult EnsureStringBundle(PropertiesFile aFile);
 
   static bool CanCallerAccess(nsIPrincipal* aSubjectPrincipal,
                                 nsIPrincipal* aPrincipal);
 
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -498,69 +498,16 @@ nsFrameLoader::GetDocShell(nsIDocShell *
 
   *aDocShell = mDocShell;
   NS_IF_ADDREF(*aDocShell);
 
   return rv;
 }
 
 static void
-FirePageHideEvent(nsIDocShellTreeItem* aItem,
-                  EventTarget* aChromeEventHandler)
-{
-  nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
-  NS_ASSERTION(doc, "What happened here?");
-  doc->OnPageHide(true, aChromeEventHandler);
-
-  int32_t childCount = 0;
-  aItem->GetChildCount(&childCount);
-  nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
-  kids.AppendElements(childCount);
-  for (int32_t i = 0; i < childCount; ++i) {
-    aItem->GetChildAt(i, getter_AddRefs(kids[i]));
-  }
-
-  for (uint32_t i = 0; i < kids.Length(); ++i) {
-    if (kids[i]) {
-      FirePageHideEvent(kids[i], aChromeEventHandler);
-    }
-  }
-}
-
-// The pageshow event is fired for a given document only if IsShowing() returns
-// the same thing as aFireIfShowing.  This gives us a way to fire pageshow only
-// on documents that are still loading or only on documents that are already
-// loaded.
-static void
-FirePageShowEvent(nsIDocShellTreeItem* aItem,
-                  EventTarget* aChromeEventHandler,
-                  bool aFireIfShowing)
-{
-  int32_t childCount = 0;
-  aItem->GetChildCount(&childCount);
-  nsAutoTArray<nsCOMPtr<nsIDocShellTreeItem>, 8> kids;
-  kids.AppendElements(childCount);
-  for (int32_t i = 0; i < childCount; ++i) {
-    aItem->GetChildAt(i, getter_AddRefs(kids[i]));
-  }
-
-  for (uint32_t i = 0; i < kids.Length(); ++i) {
-    if (kids[i]) {
-      FirePageShowEvent(kids[i], aChromeEventHandler, aFireIfShowing);
-    }
-  }
-
-  nsCOMPtr<nsIDocument> doc = aItem->GetDocument();
-  NS_ASSERTION(doc, "What happened here?");
-  if (doc->IsShowing() == aFireIfShowing) {
-    doc->OnPageShow(true, aChromeEventHandler);
-  }
-}
-
-static void
 SetTreeOwnerAndChromeEventHandlerOnDocshellTree(nsIDocShellTreeItem* aItem,
                                                 nsIDocShellTreeOwner* aOwner,
                                                 EventTarget* aHandler)
 {
   NS_PRECONDITION(aItem, "Must have item");
 
   aItem->SetTreeOwner(aOwner);
 
@@ -1018,16 +965,19 @@ nsFrameLoader::SwapWithOtherRemoteLoader
   aFirstToSwap.swap(aSecondToSwap);
 
   ourFrameFrame->EndSwapDocShells(otherFrame);
 
   ourDoc->FlushPendingNotifications(Flush_Layout);
   otherDoc->FlushPendingNotifications(Flush_Layout);
 
   mInSwap = aOther->mInSwap = false;
+
+  unused << mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
+  unused << aOther->mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
   return NS_OK;
 }
 
 nsresult
 nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
                                    nsRefPtr<nsFrameLoader>& aFirstToSwap,
                                    nsRefPtr<nsFrameLoader>& aSecondToSwap)
 {
@@ -1194,44 +1144,44 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
   if (mInSwap || aOther->mInSwap) {
     return NS_ERROR_NOT_IMPLEMENTED;
   }
   mInSwap = aOther->mInSwap = true;
 
   // Fire pageshow events on still-loading pages, and then fire pagehide
   // events.  Note that we do NOT fire these in the normal way, but just fire
   // them on the chrome event handlers.
-  FirePageShowEvent(ourDocshell, ourEventTarget, false);
-  FirePageShowEvent(otherDocshell, otherEventTarget, false);
-  FirePageHideEvent(ourDocshell, ourEventTarget);
-  FirePageHideEvent(otherDocshell, otherEventTarget);
+  nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, false);
+  nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, false);
+  nsContentUtils::FirePageHideEvent(ourDocshell, ourEventTarget);
+  nsContentUtils::FirePageHideEvent(otherDocshell, otherEventTarget);
   
   nsIFrame* ourFrame = ourContent->GetPrimaryFrame();
   nsIFrame* otherFrame = otherContent->GetPrimaryFrame();
   if (!ourFrame || !otherFrame) {
     mInSwap = aOther->mInSwap = false;
-    FirePageShowEvent(ourDocshell, ourEventTarget, true);
-    FirePageShowEvent(otherDocshell, otherEventTarget, true);
+    nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
+    nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   nsSubDocumentFrame* ourFrameFrame = do_QueryFrame(ourFrame);
   if (!ourFrameFrame) {
     mInSwap = aOther->mInSwap = false;
-    FirePageShowEvent(ourDocshell, ourEventTarget, true);
-    FirePageShowEvent(otherDocshell, otherEventTarget, true);
+    nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
+    nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // OK.  First begin to swap the docshells in the two nsIFrames
   rv = ourFrameFrame->BeginSwapDocShells(otherFrame);
   if (NS_FAILED(rv)) {
     mInSwap = aOther->mInSwap = false;
-    FirePageShowEvent(ourDocshell, ourEventTarget, true);
-    FirePageShowEvent(otherDocshell, otherEventTarget, true);
+    nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
+    nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
     return rv;
   }
 
   // Now move the docshells to the right docshell trees.  Note that this
   // resets their treeowners to null.
   ourParentItem->RemoveChild(ourDocshell);
   otherParentItem->RemoveChild(otherDocshell);
   if (ourType == nsIDocShellTreeItem::typeContent) {
@@ -1324,18 +1274,18 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
   // the wrong appUnitsPerDevPixel value. So we tell the PresShells that their
   // backing scale factor may have changed. (Bug 822266)
   ourShell->BackingScaleFactorChanged();
   otherShell->BackingScaleFactorChanged();
 
   ourParentDocument->FlushPendingNotifications(Flush_Layout);
   otherParentDocument->FlushPendingNotifications(Flush_Layout);
 
-  FirePageShowEvent(ourDocshell, ourEventTarget, true);
-  FirePageShowEvent(otherDocshell, otherEventTarget, true);
+  nsContentUtils::FirePageShowEvent(ourDocshell, ourEventTarget, true);
+  nsContentUtils::FirePageShowEvent(otherDocshell, otherEventTarget, true);
 
   mInSwap = aOther->mInSwap = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFrameLoader::Destroy()
 {
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -345,17 +345,17 @@ skip-if = buildapp == 'b2g' || e10s # b2
 [test_XHR_anon.html]
 [test_XHR_header.html]
 [test_XHR_onuploadprogress.html]
 [test_XHR_parameters.html]
 skip-if = buildapp == 'b2g' # b2g(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-debug(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-desktop(86 total, 4 failing - testing mozAnon - got false, expected true)
 [test_XHR_system.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + )
 [test_XHR_timeout.html]
-skip-if = buildapp == 'b2g' # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
+skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
 support-files = test_XHR_timeout.js
 [test_base.xhtml]
 [test_blobconstructor.html]
 [test_bug166235.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(clipboard undefined) b2g-debug(clipboard undefined) b2g-desktop(clipboard undefined)
 [test_bug199959.html]
 [test_bug218236.html]
 [test_bug218277.html]
--- a/dom/canvas/test/mochitest.ini
+++ b/dom/canvas/test/mochitest.ini
@@ -210,17 +210,17 @@ disabled = bug 407107
 [test_bug613794.html]
 [test_bug753758.html]
 [test_bug764125.html]
 [test_bug856472.html]
 [test_bug866575.html]
 skip-if = (toolkit == 'gonk' && debug) #bug 1045153
 [test_bug902651.html]
 [test_canvas.html]
-skip-if = (toolkit == 'gonk' && debug) || (toolkit == 'android' && processor == 'x86') #debug-only crash; bug 933541 #x86 only bug 913662
+skip-if = (toolkit == 'gonk' && debug) || (toolkit == 'android' && processor == 'x86') || (android_version == '18' && debug) #debug-only crash; bug 933541 #x86 only bug 913662 #android 4.3 debug bug 1143317
 [test_canvas_focusring.html]
 skip-if = (toolkit == 'gonk' && !debug) || os == 'win' #specialpowers.wrap
 [test_canvas_font_setter.html]
 [test_canvas_path.html]
 [test_hitregion_canvas.html]
 [test_hitregion_event.html]
 skip-if = os == "android" || appname == "b2g"
 [test_canvas_strokeStyle_getter.html]
--- a/dom/imptests/html/mochitest.ini
+++ b/dom/imptests/html/mochitest.ini
@@ -112,17 +112,17 @@ skip-if = (toolkit == 'gonk' && debug) #
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createElement.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createElementNS.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createEvent.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createProcessingInstruction-literal-1.xhtml]
-skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
+skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createProcessingInstruction-literal-2.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createProcessingInstruction.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createProcessingInstruction.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Document-createTreeWalker.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
@@ -156,17 +156,17 @@ skip-if = (toolkit == 'gonk' && debug) #
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-contains.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-contains.xml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-insertBefore.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-isEqualNode.xhtml]
-skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
+skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-lookupPrefix.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-nodeName.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-nodeName.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/nodes/test_Node-normalize.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
@@ -252,17 +252,17 @@ skip-if = (toolkit == 'gonk' && debug) #
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/ranges/test_Range-isPointInRange.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/ranges/test_Range-mutations.html]
 skip-if = buildapp == 'b2g' || android_version == '18' #Test timed out. Bug 1078287
 [dom/ranges/test_Range-selectNode.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/ranges/test_Range-set.html]
-skip-if = buildapp == 'b2g'
+skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # android debug time outs
 [dom/ranges/test_Range-surroundContents.html]
 skip-if = buildapp == 'b2g'
 [dom/test_historical.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/test_interface-objects.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [dom/test_interfaces.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
@@ -285,17 +285,17 @@ skip-if = true || (toolkit == 'gonk' && 
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/browsers/the-window-object/test_window-prototype-chain.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-case.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-case.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.html]
-skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
+skip-if = (toolkit == 'gonk' && debug) || (android_version == '18' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-id.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.xhtml]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
 [html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-newelements.html]
 skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -675,16 +675,22 @@ child:
      */
     ThemeChanged(LookAndFeelInt[] lookAndFeelIntCache);
 
     /**
      * Tell the child of an app's offline status
      */
     AppOfflineStatus(uint32_t id, bool offline);
 
+    /**
+     * Tell the browser that its frame loader has been swapped
+     * with another.
+     */
+    SwappedWithOtherRemoteLoader();
+
 /*
  * FIXME: write protocol!
 
 state LIVE:
     send LoadURL goto LIVE;
 //etc.
     send Destroy goto DYING;
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2708,16 +2708,37 @@ TabChild::RecvAppOfflineStatus(const uin
   if (gIOService && ioService) {
     gIOService->SetAppOfflineInternal(aId, aOffline ?
       nsIAppOfflineInfo::OFFLINE : nsIAppOfflineInfo::ONLINE);
   }
   return true;
 }
 
 bool
+TabChild::RecvSwappedWithOtherRemoteLoader()
+{
+  nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
+  if (NS_WARN_IF(!ourDocShell)) {
+    return true;
+  }
+
+  nsCOMPtr<nsPIDOMWindow> ourWindow = ourDocShell->GetWindow();
+  if (NS_WARN_IF(!ourWindow)) {
+    return true;
+  }
+
+  nsCOMPtr<EventTarget> ourEventTarget = ourWindow->GetParentTarget();
+
+  nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, false);
+  nsContentUtils::FirePageHideEvent(ourDocShell, ourEventTarget);
+  nsContentUtils::FirePageShowEvent(ourDocShell, ourEventTarget, true);
+  return true;
+}
+
+bool
 TabChild::RecvDestroy()
 {
   MOZ_ASSERT(mDestroyed == false);
   mDestroyed = true;
 
   if (mTabChildGlobal) {
     // Message handlers are called from the event loop, so it better be safe to
     // run script.
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -382,16 +382,18 @@ public:
                                       const bool& aRunInGlobalScope) override;
     virtual bool RecvAsyncMessage(const nsString& aMessage,
                                   const ClonedMessageData& aData,
                                   InfallibleTArray<CpowEntry>&& aCpows,
                                   const IPC::Principal& aPrincipal) override;
 
     virtual bool RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline) override;
 
+    virtual bool RecvSwappedWithOtherRemoteLoader() override;
+
     virtual PDocumentRendererChild*
     AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform,
                                 const nsString& bgcolor,
                                 const uint32_t& renderFlags, const bool& flushLayout,
                                 const nsIntSize& renderSize) override;
     virtual bool DeallocPDocumentRendererChild(PDocumentRendererChild* actor) override;
     virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
                                                   const nsRect& documentRect,
--- a/dom/media/webaudio/test/mochitest.ini
+++ b/dom/media/webaudio/test/mochitest.ini
@@ -80,16 +80,17 @@ skip-if = android_version == '10' # bug 
 [test_bug966247.html]
 [test_bug972678.html]
 [test_bug1056032.html]
 skip-if = toolkit == 'android' # bug 1056706
 [test_channelMergerNode.html]
 [test_channelMergerNodeWithVolume.html]
 [test_channelSplitterNode.html]
 [test_channelSplitterNodeWithVolume.html]
+skip-if = (android_version == '18' && debug) # bug 1158417
 [test_convolverNode.html]
 [test_convolverNode_mono_mono.html]
 [test_convolverNodeChannelCount.html]
 [test_convolverNodePassThrough.html]
 [test_convolverNodeWithGain.html]
 [test_currentTime.html]
 [test_decodeMultichannel.html]
 [test_decodeAudioDataPromise.html]
--- a/dom/media/webspeech/recognition/test/mochitest.ini
+++ b/dom/media/webspeech/recognition/test/mochitest.ini
@@ -5,16 +5,17 @@ support-files =
   hello.ogg^headers^
   silence.ogg
   silence.ogg^headers^
 
 [test_abort.html]
 skip-if = toolkit == 'android' || toolkit == 'gonk' # bug 1037287
 [test_audio_capture_error.html]
 [test_call_start_from_end_handler.html]
+skip-if = (android_version == '18' && debug) # bug 967606
 [test_nested_eventloop.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(showmodaldialog)
 [test_preference_enable.html]
 [test_recognition_service_error.html]
 skip-if = buildapp == 'b2g' # b2g(timed out)
 [test_success_without_recognition_service.html]
 [test_timeout.html]
 skip-if = os == "win"
--- a/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/nsWebBrowserPersist.cpp
@@ -14,17 +14,17 @@
 #include "nsComponentManagerUtils.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIStorageStream.h"
 #include "nsISeekableStream.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsIEncodedChannel.h"
 #include "nsIUploadChannel.h"
-#include "nsICachingChannel.h"
+#include "nsICacheInfoChannel.h"
 #include "nsIFileChannel.h"
 #include "nsEscape.h"
 #include "nsUnicharUtils.h"
 #include "nsIStringEnumerator.h"
 #include "nsCRT.h"
 #include "nsSupportsArray.h"
 #include "nsContentCID.h"
 #include "nsStreamUtils.h"
@@ -1269,17 +1269,17 @@ nsresult nsWebBrowserPersist::SaveURIInt
                 nsCOMPtr<nsIUploadChannel> uploadChannel(do_QueryInterface(httpChannel));
                 NS_ASSERTION(uploadChannel, "http must support nsIUploadChannel");
                 // Attach the postdata to the http channel
                 uploadChannel->SetUploadStream(aPostData, EmptyCString(), -1);
             }
         }
 
         // Cache key
-        nsCOMPtr<nsICachingChannel> cacheChannel(do_QueryInterface(httpChannel));
+        nsCOMPtr<nsICacheInfoChannel> cacheChannel(do_QueryInterface(httpChannel));
         if (cacheChannel && cacheKey)
         {
             cacheChannel->SetCacheKey(cacheKey);
         }
 
         // Headers
         if (aExtraHeaders)
         {
--- a/layout/reftests/text/reftest.list
+++ b/layout/reftests/text/reftest.list
@@ -99,22 +99,16 @@ HTTP(..) == synthetic-bold-papyrus-01.ht
 != text-align-center-last-center.html text-align-center-last-justify.html
 != text-align-justify-last-start.html text-align-justify-last-end.html
 != text-align-justify-last-start.html text-align-justify-last-center.html
 != text-align-justify-last-start.html text-align-justify-last-justify.html
 != text-align-justify-last-end.html text-align-justify-last-center.html
 != text-align-justify-last-end.html text-align-justify-last-justify.html
 != text-align-justify-last-center.html text-align-justify-last-justify.html
 == text-align-left-in-rtl-block.html text-align-left-in-rtl-block-ref.html
-== text-align-match-parent-01.html text-align-match-parent-ref.html
-== text-align-match-parent-02.html text-align-match-parent-ref.html
-== text-align-match-parent-03.html text-align-match-parent-ref.html
-== text-align-match-parent-04.html text-align-match-parent-ref.html
-== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
-== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
 HTTP(..) == variation-selector-unsupported-1.html variation-selector-unsupported-1-ref.html
 == white-space-1a.html white-space-1-ref.html
 == white-space-1b.html white-space-1-ref.html
 == white-space-2.html white-space-2-ref.html
 == wordbreak-1.html wordbreak-1-ref.html
 == wordbreak-2.html wordbreak-2-ref.html
 == wordbreak-3.html wordbreak-3-ref.html
 skip-if((Android&&AndroidVersion!=15)||(B2G&&browserIsRemote)) == wordbreak-4a.html wordbreak-4a-ref.html
--- a/layout/reftests/w3c-css/submitted/reftest.list
+++ b/layout/reftests/w3c-css/submitted/reftest.list
@@ -42,17 +42,17 @@ include ruby/reftest.list
 
 # Selectors Level 3
 # include selectors3/reftest.list
 
 # Selectors Level 4
 # include selectors4/reftest.list
 
 # Text Level 3
-# include text3/reftest.list
+include text3/reftest.list
 
 # Text Decoration Level 3
 include text-decor-3/reftest.list
 
 # Transforms
 # include transforms/reftest.list
 
 # Transitions
new file mode 100644
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/text3/reftest.list
@@ -0,0 +1,6 @@
+== text-align-match-parent-01.html text-align-match-parent-ref.html
+== text-align-match-parent-02.html text-align-match-parent-ref.html
+== text-align-match-parent-03.html text-align-match-parent-ref.html
+== text-align-match-parent-04.html text-align-match-parent-ref.html
+== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
+== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
rename from layout/reftests/text/text-align-match-parent-01.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-01.html
--- a/layout/reftests/text/text-align-match-parent-01.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-01.html
@@ -1,22 +1,30 @@
 <!DOCTYPE html>
 <html>
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="assert" content="Text checks that an element with
+     text-align: match-parent inherits its parent's value and calculates
+     'start' and 'end' with respect to its parent's direction"
+     <link rel="match" href="text-align-match-parent-ref.html">
+    <style type="text/css">
 div.start  { text-align: start; }
 div.end    { text-align: end; }
 div.left   { text-align: left; }
 div.right  { text-align: right; }
 div > div  { text-align: match-parent; }
     </style>
   </head>
   <body>
+   <div>Test passes if each line that says "Left" is aligned left and
+   each line that says "Right" is aligned right</div>
    <div class="start" dir="ltr"><div dir="ltr">Left</div></div>
    <div class="start" dir="ltr"><div dir="rtl">Left</div></div>
    <div class="start" dir="rtl"><div dir="ltr">Right</div></div>
    <div class="start" dir="rtl"><div dir="rtl">Right</div></div>
    <div class="end" dir="ltr"><div dir="ltr">Right</div></div>
    <div class="end" dir="ltr"><div dir="rtl">Right</div></div>
    <div class="end" dir="rtl"><div dir="ltr">Left</div></div>
    <div class="end" dir="rtl"><div dir="rtl">Left</div></div>
rename from layout/reftests/text/text-align-match-parent-02.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-02.html
--- a/layout/reftests/text/text-align-match-parent-02.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-02.html
@@ -1,50 +1,56 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="flags" content="dom">
+    <meta name="assert" content="Text checks that an element with
+      text-align: match-parent still aligns correctly if the parent's
+      dir attribute is changed">
+     <link rel="match" href="text-align-match-parent-ref.html">
+    <style type="text/css">
 div.start  { text-align: start; }
 div.end    { text-align: end; }
 div.left   { text-align: left; }
 div.right  { text-align: right; }
 div > div  { text-align: match-parent; }
     </style>
+    <script type="text/javascript">
+function changeParentDir()
+{
+  for (parent = 0; parent < 16; ++parent) {
+     var parentDiv = document.getElementById("d" + parent);
+     if (parentDiv.dir == "rtl") {
+       parentDiv.dir = "ltr";
+     } else {
+       parentDiv.dir = "rtl";
+     }
+   }
+
+  document.documentElement.removeAttribute("class");
+}
+    </script>
   </head>
-  <body>
+  <body onload="changeParentDir()">
+   <div>Test passes if each line that says "Left" is aligned left and
+   each line that says "Right" is aligned right</div>
    <div id="d0" class="start" dir="rtl"><div dir="ltr">Left</div></div>
    <div id="d1" class="start" dir="rtl"><div dir="rtl">Left</div></div>
    <div id="d2" class="start" dir="ltr"><div dir="ltr">Right</div></div>
    <div id="d3" class="start" dir="ltr"><div dir="rtl">Right</div></div>
    <div id="d4" class="end" dir="rtl"><div dir="ltr">Right</div></div>
    <div id="d5" class="end" dir="rtl"><div dir="rtl">Right</div></div>
    <div id="d6" class="end" dir="ltr"><div dir="ltr">Left</div></div>
    <div id="d7" class="end" dir="ltr"><div dir="rtl">Left</div></div>
    <div id="d8" class="left" dir="rtl"><div dir="ltr">Left</div></div>
    <div id="d9" class="left" dir="rtl"><div dir="rtl">Left</div></div>
    <div id="d10" class="left" dir="ltr"><div dir="ltr">Left</div></div>
    <div id="d11" class="left" dir="ltr"><div dir="rtl">Left</div></div>
    <div id="d12" class="right" dir="rtl"><div dir="ltr">Right</div></div>
    <div id="d13" class="right" dir="rtl"><div dir="rtl">Right</div></div>
    <div id="d14" class="right" dir="ltr"><div dir="ltr">Right</div></div>
    <div id="d15" class="right" dir="ltr"><div dir="rtl">Right</div></div>
-
-   <script type="text/javascript">
-function changeParentDir()
-{
-  for (parent = 0; parent < 16; ++parent) {
-     var parentDiv = document.getElementById("d" + parent);
-     if (parentDiv.dir == "rtl") {
-       parentDiv.dir = "ltr";
-     } else {
-       parentDiv.dir = "rtl";
-     }
-   }
-
-  document.documentElement.removeAttribute("class");
-}
-
-document.addEventListener("MozReftestInvalidate", changeParentDir, false);
-   </script>
  </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-03.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-03.html
--- a/layout/reftests/text/text-align-match-parent-03.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-03.html
@@ -1,47 +1,52 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="flags" content="dom">
+    <meta name="assert" content="Text checks that an element whose
+      text-align property is changed to match-parent aligns correctly">
+     <link rel="match" href="text-align-match-parent-ref.html">
+    <style type="text/css">
 div.start  { text-align: start; }
 div.end    { text-align: end; }
 div.left   { text-align: left; }
 div.right  { text-align: right; }
 div.center { text-align: center; }
 div.match  { text-align: match-parent; }
     </style>
+   <script type="text/javascript">
+function changeChildAlign()
+{
+  for (child = 0; child < 16; ++child) {
+     var childDiv = document.getElementById("d" + child);
+     childDiv.className = "match";
+   }
+
+  document.documentElement.removeAttribute("class");
+}
+   </script>
   </head>
-  <body>
+  <body onload="changeChildAlign()">
+   <div>Test passes if each line that says "Left" is aligned left and
+   each line that says "Right" is aligned right</div>
    <div class="start" dir="ltr"><div id="d0" class="center" dir="ltr">Left</div></div>
    <div class="start" dir="ltr"><div id="d1" class="center" dir="rtl">Left</div></div>
    <div class="start" dir="rtl"><div id="d2" class="center" dir="ltr">Right</div></div>
    <div class="start" dir="rtl"><div id="d3" class="center" dir="rtl">Right</div></div>
    <div class="end" dir="ltr"><div id="d4" class="center" dir="ltr">Right</div></div>
    <div class="end" dir="ltr"><div id="d5" class="center" dir="rtl">Right</div></div>
    <div class="end" dir="rtl"><div id="d6" class="center" dir="ltr">Left</div></div>
    <div class="end" dir="rtl"><div id="d7" class="center" dir="rtl">Left</div></div>
    <div class="left" dir="ltr"><div id="d8" class="center" dir="ltr">Left</div></div>
    <div class="left" dir="ltr"><div id="d9" class="center" dir="rtl">Left</div></div>
    <div class="left" dir="rtl"><div id="d10" class="center" dir="ltr">Left</div></div>
    <div class="left" dir="rtl"><div id="d11" class="center" dir="rtl">Left</div></div>
    <div class="right" dir="ltr"><div id="d12" class="center" dir="ltr">Right</div></div>
    <div class="right" dir="ltr"><div id="d13" class="center" dir="rtl">Right</div></div>
    <div class="right" dir="rtl"><div id="d14" class="center" dir="ltr">Right</div></div>
    <div class="right" dir="rtl"><div id="d15" class="center" dir="rtl">Right</div></div>
-
-   <script type="text/javascript">
-function changeChildAlign()
-{
-  for (child = 0; child < 16; ++child) {
-     var childDiv = document.getElementById("d" + child);
-     childDiv.className = "match";
-   }
-
-  document.documentElement.removeAttribute("class");
-}
-
-document.addEventListener("MozReftestInvalidate", changeChildAlign, false);
-   </script>
  </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-04.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-04.html
--- a/layout/reftests/text/text-align-match-parent-04.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-04.html
@@ -1,46 +1,52 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="flags" content="dom">
+    <meta name="assert" content="Text checks that an element with
+      text-align: match-parent still aligns correctly if the parent's
+      width is changed">
+     <link rel="match" href="text-align-match-parent-ref.html">
+    <style type="text/css">
 div.start  { text-align: start; }
 div.end    { text-align: end; }
 div.left   { text-align: left; }
 div.right  { text-align: right; }
 div > div  { text-align: match-parent; }
     </style>
+    <script type="text/javascript">
+function changeParentWidth()
+{
+  for (parent = 0; parent < 16; ++parent) {
+     var parentDiv = document.getElementById("d" + parent);
+     parentDiv.style.width = "";
+   }
+
+  document.documentElement.removeAttribute("class");
+}
+   </script>
   </head>
-  <body>
+  <body onload="changeParentWidth()">
+   <div>Test passes if each line that says "Left" is aligned left and
+   each line that says "Right" is aligned right</div>
    <div id="d0" style="width: 50%;" class="start" dir="ltr"><div dir="ltr">Left</div></div>
    <div id="d1" style="width: 50%;" class="start" dir="ltr"><div dir="rtl">Left</div></div>
    <div id="d2" style="width: 50%;" class="start" dir="rtl"><div dir="ltr">Right</div></div>
    <div id="d3" style="width: 50%;" class="start" dir="rtl"><div dir="rtl">Right</div></div>
    <div id="d4" style="width: 50%;" class="end" dir="ltr"><div dir="ltr">Right</div></div>
    <div id="d5" style="width: 50%;" class="end" dir="ltr"><div dir="rtl">Right</div></div>
    <div id="d6" style="width: 50%;" class="end" dir="rtl"><div dir="ltr">Left</div></div>
    <div id="d7" style="width: 50%;" class="end" dir="rtl"><div dir="rtl">Left</div></div>
    <div id="d8" style="width: 50%;" class="left" dir="ltr"><div dir="ltr">Left</div></div>
    <div id="d9" style="width: 50%;" class="left" dir="ltr"><div dir="rtl">Left</div></div>
    <div id="d10" style="width: 50%;" class="left" dir="rtl"><div dir="ltr">Left</div></div>
    <div id="d11" style="width: 50%;" class="left" dir="rtl"><div dir="rtl">Left</div></div>
    <div id="d12" style="width: 50%;" class="right" dir="ltr"><div dir="ltr">Right</div></div>
    <div id="d13" style="width: 50%;" class="right" dir="ltr"><div dir="rtl">Right</div></div>
    <div id="d14" style="width: 50%;" class="right" dir="rtl"><div dir="ltr">Right</div></div>
    <div id="d15" style="width: 50%;" class="right" dir="rtl"><div dir="rtl">Right</div></div>
-
-   <script type="text/javascript">
-function changeParentWidth()
-{
-  for (parent = 0; parent < 16; ++parent) {
-     var parentDiv = document.getElementById("d" + parent);
-     parentDiv.style.width = "";
-   }
-
-  document.documentElement.removeAttribute("class");
-}
-
-document.addEventListener("MozReftestInvalidate", changeParentWidth, false);
-   </script>
  </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-ref.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-ref.html
--- a/layout/reftests/text/text-align-match-parent-ref.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-ref.html
@@ -1,21 +1,22 @@
 <!DOCTYPE html>
 <html>
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
-div.start  { text-align: start; }
-div.end    { text-align: end; }
+    <title>CSS Reftest Reference</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <style type="text/css">
 div.left   { text-align: left; }
 div.right  { text-align: right; }
     </style>
   </head>
   <body>
+   <div>Test passes if each line that says "Left" is aligned left and
+   each line that says "Right" is aligned right</div>
    <div class="left">Left</div>
    <div class="left">Left</div>
    <div class="right">Right</div>
    <div class="right">Right</div>
    <div class="right">Right</div>
    <div class="right">Right</div>
    <div class="left">Left</div>
    <div class="left">Left</div>
rename from layout/reftests/text/text-align-match-parent-root-ltr-ref.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-ltr-ref.html
--- a/layout/reftests/text/text-align-match-parent-root-ltr-ref.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-ltr-ref.html
@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <html dir="ltr">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Reftest Reference</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <style type="text/css">
 html { text-align: start; }
     </style>
   </head>
   <body>
-    Root element ltr
+    <p>This line should be aligned left</p>
   </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-root-ltr.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-ltr.html
--- a/layout/reftests/text/text-align-match-parent-root-ltr.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-ltr.html
@@ -1,13 +1,19 @@
 <!DOCTYPE html>
 <html dir="ltr">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="assert" content="Text checks that
+      text-align: match-parent on a root element with dir=ltr is
+      equivalent to text-align: start">
+    <link rel="match" href="text-align-match-parent-root-ltr-ref.html">
+    <style type="text/css">
 html { text-align: match-parent; }
     </style>
   </head>
   <body>
-    Root element ltr
+    <p>This line should be aligned left</p>
   </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-root-rtl-ref.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-rtl-ref.html
--- a/layout/reftests/text/text-align-match-parent-root-rtl-ref.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-rtl-ref.html
@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <html dir="rtl">
   <head>
     <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Reftest Reference</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <style type="text/css">
 html { text-align: start; }
     </style>
   </head>
   <body>
-    Root element rtl
+    <p>This line should be aligned right</p>
   </body>
 </html>
rename from layout/reftests/text/text-align-match-parent-root-rtl.html
rename to layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-rtl.html
--- a/layout/reftests/text/text-align-match-parent-root-rtl.html
+++ b/layout/reftests/w3c-css/submitted/text3/text-align-match-parent-root-rtl.html
@@ -1,13 +1,18 @@
 <!DOCTYPE html>
 <html dir="rtl">
   <head>
-    <meta charset="utf-8">
-    <title>Text-align: match-parent</title>
-    <style>
+    <title>CSS Text: text-align: match-parent</title>
+    <link rel="author" title="Simon Montagu" href="mailto:smontagu@mozilla.com">
+    <link rel="help" href="http://www.w3.org/TR/css-text-3/#text-align-property">
+    <meta name="assert" content="Text checks that
+      text-align: match-parent on a root element with dir=rtl is
+      equivalent to text-align: start">
+    <link rel="match" href="text-align-match-parent-root-rtl-ref.html">
+    <style type="text/css">
 html { text-align: match-parent; }
     </style>
   </head>
   <body>
-    Root element rtl
+    <p>This line should be aligned right</p>
   </body>
 </html>
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -211,16 +211,17 @@ skip-if = (toolkit == 'gonk' && debug) |
 [test_transitions_and_restyles.html]
 [test_transitions_and_zoom.html]
 [test_transitions_cancel_near_end.html]
 skip-if = android_version == '10' #Android 2.3 aws only; bug 1030432
 [test_transitions_computed_values.html]
 [test_transitions_computed_value_combinations.html]
 [test_transitions_events.html]
 [test_transitions.html]
+skip-if = (android_version == '18' && debug) # bug 1159532
 [test_transitions_per_property.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 775227 # b2g(times out, needs more time + various failures) b2g-debug(times out, needs more time + various failures) b2g-desktop(times out, needs more time + various failures)
 [test_transitions_step_functions.html]
 [test_transitions_dynamic_changes.html]
 [test_transitions_bug537151.html]
 [test_unclosed_parentheses.html]
 [test_unicode_range_loading.html]
 support-files = ../../reftests/fonts/markA.woff ../../reftests/fonts/markB.woff ../../reftests/fonts/markC.woff ../../reftests/fonts/markD.woff
--- a/netwerk/base/nsICacheInfoChannel.idl
+++ b/netwerk/base/nsICacheInfoChannel.idl
@@ -1,15 +1,15 @@
 /* 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 "nsISupports.idl"
 
-[scriptable, uuid (299d69b4-ee86-4541-802d-7642671ebf97)]
+[scriptable, uuid (c5f583f0-ae53-4e39-8af9-2c2d0d7af093)]
 interface nsICacheInfoChannel : nsISupports
 {
   /**
    * Get expiration time from cache token. This attribute is equivalent to
    * nsICachingChannel.cacheToken.expirationTime.
    */
   readonly attribute uint32_t cacheTokenExpirationTime;
 
@@ -21,9 +21,28 @@ interface nsICacheInfoChannel : nsISuppo
   attribute ACString cacheTokenCachedCharset;
 
   /**
    * TRUE if this channel's data is being loaded from the cache.  This value
    * is undefined before the channel fires its OnStartRequest notification
    * and after the channel fires its OnStopRequest notification.
    */
   boolean isFromCache();
+
+  /**
+   * Set/get the cache key... uniquely identifies the data in the cache
+   * for this channel.  Holding a reference to this key does NOT prevent
+   * the cached data from being removed.
+   *
+   * A cache key retrieved from a particular instance of nsICachingChannel
+   * could be set on another instance of nsICachingChannel provided the
+   * underlying implementations are compatible and provided the new 
+   * channel instance was created with the same URI.  The implementation of
+   * nsICachingChannel would be expected to use the cache entry identified
+   * by the cache token.  Depending on the value of nsIRequest::loadFlags,
+   * the cache entry may be validated, overwritten, or simply read.
+   *
+   * The cache key may be NULL indicating that the URI of the channel is
+   * sufficient to locate the same cache entry.  Setting a NULL cache key
+   * is likewise valid.
+   */
+  attribute nsISupports cacheKey;
 };
--- a/netwerk/base/nsICachingChannel.idl
+++ b/netwerk/base/nsICachingChannel.idl
@@ -12,17 +12,17 @@ interface nsIFile;
  * to affect its behavior with respect to how it uses the cache service.
  *
  * This interface provides:
  *   1) Support for "stream as file" semantics (for JAR and plugins).
  *   2) Support for "pinning" cached data in the cache (for printing and save-as).
  *   3) Support for uniquely identifying cached data in cases when the URL
  *      is insufficient (e.g., HTTP form submission).
  */
-[scriptable, uuid(3d46b469-7405-416e-ba42-84899963b403)]
+[scriptable, uuid(436b939d-e391-48e5-ba64-ab0e496e3400)]
 interface nsICachingChannel : nsICacheInfoChannel
 {
     /**
      * Set/get the cache token... uniquely identifies the data in the cache.
      * Holding a reference to this token prevents the cached data from being
      * removed.
      * 
      * A cache token retrieved from a particular instance of nsICachingChannel
@@ -41,35 +41,16 @@ interface nsICachingChannel : nsICacheIn
      * is any.
      *
      * @throws
      *      NS_ERROR_NOT_AVAILABLE when there is not offline cache token
      */
     attribute nsISupports offlineCacheToken;
 
     /**
-     * Set/get the cache key... uniquely identifies the data in the cache
-     * for this channel.  Holding a reference to this key does NOT prevent
-     * the cached data from being removed.
-     * 
-     * A cache key retrieved from a particular instance of nsICachingChannel
-     * could be set on another instance of nsICachingChannel provided the
-     * underlying implementations are compatible and provided the new 
-     * channel instance was created with the same URI.  The implementation of
-     * nsICachingChannel would be expected to use the cache entry identified
-     * by the cache token.  Depending on the value of nsIRequest::loadFlags,
-     * the cache entry may be validated, overwritten, or simply read.
-     *
-     * The cache key may be NULL indicating that the URI of the channel is
-     * sufficient to locate the same cache entry.  Setting a NULL cache key
-     * is likewise valid.
-     */
-    attribute nsISupports cacheKey;
-
-    /**
      * Instructs the channel to only store the metadata of the entry, and not
      * the content. When reading an existing entry, this automatically sets
      * LOAD_ONLY_IF_MODIFIED flag.
      * Must be called before asyncOpen().
      */
     attribute boolean cacheOnlyMetadata;
 
     /**************************************************************************
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -25,16 +25,28 @@ namespace net {
 //-----------------------------------------------------------------------------
 
 union OptionalHttpResponseHead
 {
   void_t;
   nsHttpResponseHead;
 };
 
+struct HttpChannelCacheKey
+{
+  uint32_t postId;
+  nsCString key;
+};
+
+union OptionalHttpChannelCacheKey
+{
+  void_t;
+  HttpChannelCacheKey;
+};
+
 struct HttpChannelOpenArgs
 {
   URIParams                   uri;
   // - TODO: bug 571161: unclear if any HTTP channel clients ever
   // set originalURI != uri (about:credits?); also not clear if
   // chrome channel would ever need to know.  Get rid of next arg?
   OptionalURIParams           original;
   OptionalURIParams           doc;
@@ -62,16 +74,17 @@ struct HttpChannelOpenArgs
   bool                        allowAltSvc;
   OptionalFileDescriptorSet   fds;
   PrincipalInfo               requestingPrincipalInfo;
   PrincipalInfo               triggeringPrincipalInfo;
   uint32_t                    securityFlags;
   uint32_t                    contentPolicyType;
   uint32_t                    innerWindowID;
   OptionalHttpResponseHead    synthesizedResponseHead;
+  OptionalHttpChannelCacheKey cacheKey;
 };
 
 struct HttpChannelConnectArgs
 {
   uint32_t channelId;
 };
 
 union HttpChannelCreationArgs
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -318,67 +318,72 @@ class StartRequestEvent : public Channel
                     const bool& useResponseHead,
                     const nsHttpHeaderArray& requestHeaders,
                     const bool& isFromCache,
                     const bool& cacheEntryAvailable,
                     const uint32_t& cacheExpirationTime,
                     const nsCString& cachedCharset,
                     const nsCString& securityInfoSerialization,
                     const NetAddr& selfAddr,
-                    const NetAddr& peerAddr)
+                    const NetAddr& peerAddr,
+                    const HttpChannelCacheKey& cacheKey)
   : mChild(child)
   , mChannelStatus(channelStatus)
   , mResponseHead(responseHead)
   , mRequestHeaders(requestHeaders)
   , mUseResponseHead(useResponseHead)
   , mIsFromCache(isFromCache)
   , mCacheEntryAvailable(cacheEntryAvailable)
   , mCacheExpirationTime(cacheExpirationTime)
   , mCachedCharset(cachedCharset)
   , mSecurityInfoSerialization(securityInfoSerialization)
   , mSelfAddr(selfAddr)
   , mPeerAddr(peerAddr)
+  , mCacheKey(cacheKey)
   {}
 
   void Run()
   {
     LOG(("StartRequestEvent [this=%p]\n", mChild));
     mChild->OnStartRequest(mChannelStatus, mResponseHead, mUseResponseHead,
                            mRequestHeaders, mIsFromCache, mCacheEntryAvailable,
                            mCacheExpirationTime, mCachedCharset,
-                           mSecurityInfoSerialization, mSelfAddr, mPeerAddr);
+                           mSecurityInfoSerialization, mSelfAddr, mPeerAddr,
+                           mCacheKey);
   }
  private:
   HttpChannelChild* mChild;
   nsresult mChannelStatus;
   nsHttpResponseHead mResponseHead;
   nsHttpHeaderArray mRequestHeaders;
   bool mUseResponseHead;
   bool mIsFromCache;
   bool mCacheEntryAvailable;
   uint32_t mCacheExpirationTime;
   nsCString mCachedCharset;
   nsCString mSecurityInfoSerialization;
   NetAddr mSelfAddr;
   NetAddr mPeerAddr;
+  HttpChannelCacheKey mCacheKey;
 };
 
 bool
 HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
                                      const nsHttpResponseHead& responseHead,
                                      const bool& useResponseHead,
                                      const nsHttpHeaderArray& requestHeaders,
                                      const bool& isFromCache,
                                      const bool& cacheEntryAvailable,
                                      const uint32_t& cacheExpirationTime,
                                      const nsCString& cachedCharset,
                                      const nsCString& securityInfoSerialization,
                                      const NetAddr& selfAddr,
                                      const NetAddr& peerAddr,
-                                     const int16_t& redirectCount)
+                                     const int16_t& redirectCount,
+                                     const HttpChannelCacheKey& cacheKey)
 {
   LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
   // mFlushedForDiversion and mDivertingToParent should NEVER be set at this
   // stage, as they are set in the listener's OnStartRequest.
   MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
     "mFlushedForDiversion should be unset before OnStartRequest!");
   MOZ_RELEASE_ASSERT(!mDivertingToParent,
     "mDivertingToParent should be unset before OnStartRequest!");
@@ -387,38 +392,39 @@ HttpChannelChild::RecvOnStartRequest(con
   mRedirectCount = redirectCount;
 
   if (mEventQ->ShouldEnqueue()) {
     mEventQ->Enqueue(new StartRequestEvent(this, channelStatus, responseHead,
                                            useResponseHead, requestHeaders,
                                            isFromCache, cacheEntryAvailable,
                                            cacheExpirationTime, cachedCharset,
                                            securityInfoSerialization, selfAddr,
-                                           peerAddr));
+                                           peerAddr, cacheKey));
   } else {
     OnStartRequest(channelStatus, responseHead, useResponseHead, requestHeaders,
                    isFromCache, cacheEntryAvailable, cacheExpirationTime,
                    cachedCharset, securityInfoSerialization, selfAddr,
-                   peerAddr);
+                   peerAddr, cacheKey);
   }
   return true;
 }
 
 void
 HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
                                  const nsHttpResponseHead& responseHead,
                                  const bool& useResponseHead,
                                  const nsHttpHeaderArray& requestHeaders,
                                  const bool& isFromCache,
                                  const bool& cacheEntryAvailable,
                                  const uint32_t& cacheExpirationTime,
                                  const nsCString& cachedCharset,
                                  const nsCString& securityInfoSerialization,
                                  const NetAddr& selfAddr,
-                                 const NetAddr& peerAddr)
+                                 const NetAddr& peerAddr,
+                                 const HttpChannelCacheKey& cacheKey)
 {
   LOG(("HttpChannelChild::OnStartRequest [this=%p]\n", this));
 
   // mFlushedForDiversion and mDivertingToParent should NEVER be set at this
   // stage, as they are set in the listener's OnStartRequest.
   MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
     "mFlushedForDiversion should be unset before OnStartRequest!");
   MOZ_RELEASE_ASSERT(!mDivertingToParent,
@@ -436,16 +442,20 @@ HttpChannelChild::OnStartRequest(const n
                          getter_AddRefs(mSecurityInfo));
   }
 
   mIsFromCache = isFromCache;
   mCacheEntryAvailable = cacheEntryAvailable;
   mCacheExpirationTime = cacheExpirationTime;
   mCachedCharset = cachedCharset;
 
+  nsRefPtr<nsHttpChannelCacheKey> tmpKey = new nsHttpChannelCacheKey();
+  tmpKey->SetData(cacheKey.postId(), cacheKey.key());
+  CallQueryInterface(tmpKey.get(), getter_AddRefs(mCacheKey));
+
   AutoEventEnqueuer ensureSerialDispatch(mEventQ);
 
   // replace our request headers with what actually got sent in the parent
   mRequestHead.Headers() = requestHeaders;
 
   // Note: this is where we would notify "http-on-examine-response" observers.
   // We have deliberately disabled this for child processes (see bug 806753)
   //
@@ -1642,16 +1652,30 @@ HttpChannelChild::ContinueAsyncOpen()
   openArgs.resumeAt() = mSendResumeAt;
   openArgs.startPos() = mStartPos;
   openArgs.entityID() = mEntityID;
   openArgs.chooseApplicationCache() = mChooseApplicationCache;
   openArgs.appCacheClientID() = appCacheClientId;
   openArgs.allowSpdy() = mAllowSpdy;
   openArgs.allowAltSvc() = mAllowAltSvc;
 
+  if (mCacheKey) {
+    uint32_t postId;
+    nsAutoCString key;
+    nsresult rv = static_cast<nsHttpChannelCacheKey *>(
+      static_cast<nsISupportsPRUint32 *>(mCacheKey.get()))->GetData(&postId,
+                                                                    key);
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
+    openArgs.cacheKey() = HttpChannelCacheKey(postId, key);
+  } else {
+    openArgs.cacheKey() = mozilla::void_t();
+  }
+
   propagateLoadInfo(mLoadInfo, openArgs);
 
   // The socket transport in the chrome process now holds a logical ref to us
   // until OnStopRequest, or we do a redirect, or we hit an IPDL error.
   AddIPDLReference();
 
   PBrowserOrId browser = static_cast<ContentChild*>(gNeckoChild->Manager())
                          ->GetBrowserOrId(tabChild);
@@ -1784,16 +1808,31 @@ HttpChannelChild::IsFromCache(bool *valu
 {
   if (!mIsPending)
     return NS_ERROR_NOT_AVAILABLE;
 
   *value = mIsFromCache;
   return NS_OK;
 }
 
+NS_IMETHODIMP
+HttpChannelChild::GetCacheKey(nsISupports **cacheKey)
+{
+  NS_IF_ADDREF(*cacheKey = mCacheKey);
+  return NS_OK;
+}
+NS_IMETHODIMP
+HttpChannelChild::SetCacheKey(nsISupports *cacheKey)
+{
+  ENSURE_CALLED_BEFORE_ASYNC_OPEN();
+
+  mCacheKey = cacheKey;
+  return NS_OK;
+}
+
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIResumableChannel
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::ResumeAt(uint64_t startPos, const nsACString& entityID)
 {
   LOG(("HttpChannelChild::ResumeAt [this=%p]\n", this));
--- a/netwerk/protocol/http/HttpChannelChild.h
+++ b/netwerk/protocol/http/HttpChannelChild.h
@@ -112,17 +112,18 @@ protected:
                           const nsHttpHeaderArray& requestHeaders,
                           const bool& isFromCache,
                           const bool& cacheEntryAvailable,
                           const uint32_t& cacheExpirationTime,
                           const nsCString& cachedCharset,
                           const nsCString& securityInfoSerialization,
                           const NetAddr& selfAddr,
                           const NetAddr& peerAddr,
-                          const int16_t& redirectCount) override;
+                          const int16_t& redirectCount,
+                          const HttpChannelCacheKey& cacheKey) override;
   bool RecvOnTransportAndData(const nsresult& channelStatus,
                               const nsresult& status,
                               const uint64_t& progress,
                               const uint64_t& progressMax,
                               const nsCString& data,
                               const uint64_t& offset,
                               const uint32_t& count) override;
   bool RecvOnStopRequest(const nsresult& statusCode, const ResourceTimingStruct& timing) override;
@@ -171,16 +172,17 @@ private:
   nsRefPtr<InterceptStreamListener> mInterceptListener;
   nsRefPtr<nsInputStreamPump> mSynthesizedResponsePump;
   int64_t mSynthesizedStreamLength;
 
   bool mIsFromCache;
   bool mCacheEntryAvailable;
   uint32_t     mCacheExpirationTime;
   nsCString    mCachedCharset;
+  nsCOMPtr<nsISupports> mCacheKey;
 
   // If ResumeAt is called before AsyncOpen, we need to send extra data upstream
   bool mSendResumeAt;
 
   bool mIPCOpen;
   bool mKeptAlive;            // IPC kept open, but only for security info
   nsRefPtr<ChannelEventQueue> mEventQ;
 
@@ -203,17 +205,18 @@ private:
                       const bool& useResponseHead,
                       const nsHttpHeaderArray& requestHeaders,
                       const bool& isFromCache,
                       const bool& cacheEntryAvailable,
                       const uint32_t& cacheExpirationTime,
                       const nsCString& cachedCharset,
                       const nsCString& securityInfoSerialization,
                       const NetAddr& selfAddr,
-                      const NetAddr& peerAddr);
+                      const NetAddr& peerAddr,
+                      const HttpChannelCacheKey& cacheKey);
   void OnTransportAndData(const nsresult& channelStatus,
                           const nsresult& status,
                           const uint64_t progress,
                           const uint64_t& progressMax,
                           const nsCString& data,
                           const uint64_t& offset,
                           const uint32_t& count);
   void OnStopRequest(const nsresult& channelStatus, const ResourceTimingStruct& timing);
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -108,17 +108,17 @@ HttpChannelParent::Init(const HttpChanne
                        a.requestMethod(), a.uploadStream(),
                        a.uploadStreamHasHeaders(), a.priority(), a.classOfService(),
                        a.redirectionLimit(), a.allowPipelining(), a.allowSTS(),
                        a.thirdPartyFlags(), a.resumeAt(), a.startPos(),
                        a.entityID(), a.chooseApplicationCache(),
                        a.appCacheClientID(), a.allowSpdy(), a.allowAltSvc(), a.fds(),
                        a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
                        a.securityFlags(), a.contentPolicyType(), a.innerWindowID(),
-                       a.synthesizedResponseHead());
+                       a.synthesizedResponseHead(), a.cacheKey());
   }
   case HttpChannelCreationArgs::THttpChannelConnectArgs:
   {
     const HttpChannelConnectArgs& cArgs = aArgs.get_HttpChannelConnectArgs();
     return ConnectChannel(cArgs.channelId());
   }
   default:
     NS_NOTREACHED("unknown open type");
@@ -262,17 +262,18 @@ HttpChannelParent::DoAsyncOpen(  const U
                                  const bool&                allowSpdy,
                                  const bool&                allowAltSvc,
                                  const OptionalFileDescriptorSet& aFds,
                                  const ipc::PrincipalInfo&  aRequestingPrincipalInfo,
                                  const ipc::PrincipalInfo&  aTriggeringPrincipalInfo,
                                  const uint32_t&            aSecurityFlags,
                                  const uint32_t&            aContentPolicyType,
                                  const uint32_t&            aInnerWindowID,
-                                 const OptionalHttpResponseHead& aSynthesizedResponseHead)
+                                 const OptionalHttpResponseHead& aSynthesizedResponseHead,
+                                 const OptionalHttpChannelCacheKey& aCacheKey)
 {
   nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
   if (!uri) {
     // URIParams does MOZ_ASSERT if null, but we need to protect opt builds from
     // null deref here.
     return false;
   }
   nsCOMPtr<nsIURI> originalUri = DeserializeURI(aOriginalURI);
@@ -384,16 +385,25 @@ HttpChannelParent::DoAsyncOpen(  const U
     mChannel->InternalSetUploadStream(stream);
     mChannel->SetUploadStreamHasHeaders(uploadStreamHasHeaders);
   }
 
   if (aSynthesizedResponseHead.type() == OptionalHttpResponseHead::TnsHttpResponseHead) {
     mSynthesizedResponseHead = new nsHttpResponseHead(aSynthesizedResponseHead.get_nsHttpResponseHead());
   }
 
+  if (aCacheKey.type() == OptionalHttpChannelCacheKey::THttpChannelCacheKey) {
+    nsRefPtr<nsHttpChannelCacheKey> cacheKey = new nsHttpChannelCacheKey();
+    cacheKey->SetData(aCacheKey.get_HttpChannelCacheKey().postId(),
+                      aCacheKey.get_HttpChannelCacheKey().key());
+    nsCOMPtr<nsISupports> cacheKeySupp;
+    CallQueryInterface(cacheKey.get(), getter_AddRefs(cacheKeySupp));
+    mChannel->SetCacheKey(cacheKeySupp);
+  }
+
   if (priority != nsISupportsPriority::PRIORITY_NORMAL) {
     mChannel->SetPriority(priority);
   }
   if (classOfService) {
     mChannel->SetClassFlags(classOfService);
   }
   mChannel->SetRedirectionLimit(redirectionLimit);
   mChannel->SetAllowPipelining(allowPipelining);
@@ -799,26 +809,42 @@ HttpChannelParent::OnStartRequest(nsIReq
     mAssociatedContentSecurity = do_QueryInterface(secInfoSupp);
     nsCOMPtr<nsISerializable> secInfoSer = do_QueryInterface(secInfoSupp);
     if (secInfoSer)
       NS_SerializeToString(secInfoSer, secInfoSerialization);
   }
 
   uint16_t redirectCount = 0;
   mChannel->GetRedirectCount(&redirectCount);
+
+  nsCOMPtr<nsISupports> cacheKeySupp;
+  mChannel->GetCacheKey(getter_AddRefs(cacheKeySupp));
+  uint32_t postId = 0;
+  nsAutoCString key;
+  if (cacheKeySupp) {
+    nsresult rv = static_cast<nsHttpChannelCacheKey *>(
+      static_cast<nsISupportsPRUint32 *>(cacheKeySupp.get()))->GetData(&postId,
+                                                                       key);
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
+  }
+  HttpChannelCacheKey cacheKey = HttpChannelCacheKey(postId, key);
+
   if (mIPCClosed ||
       !SendOnStartRequest(channelStatus,
                           responseHead ? *responseHead : nsHttpResponseHead(),
                           !!responseHead,
                           requestHead->Headers(),
                           isFromCache,
                           mCacheEntry ? true : false,
                           expirationTime, cachedCharset, secInfoSerialization,
                           mChannel->GetSelfAddr(), mChannel->GetPeerAddr(),
-                          redirectCount))
+                          redirectCount,
+                          cacheKey))
   {
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HttpChannelParent::OnStopRequest(nsIRequest *aRequest,
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -116,17 +116,18 @@ protected:
                    const bool&                allowSpdy,
                    const bool&                allowAltSvc,
                    const OptionalFileDescriptorSet& aFds,
                    const ipc::PrincipalInfo&  aRequestingPrincipalInfo,
                    const ipc::PrincipalInfo&  aTriggeringPrincipalInfo,
                    const uint32_t&            aSecurityFlags,
                    const uint32_t&            aContentPolicyType,
                    const uint32_t&            aInnerWindowID,
-                   const OptionalHttpResponseHead& aSynthesizedResponseHead);
+                   const OptionalHttpResponseHead& aSynthesizedResponseHead,
+                   const OptionalHttpChannelCacheKey& aCacheKey);
 
   virtual bool RecvSetPriority(const uint16_t& priority) override;
   virtual bool RecvSetClassOfService(const uint32_t& cos) override;
   virtual bool RecvSetCacheTokenCachedCharset(const nsCString& charset) override;
   virtual bool RecvSuspend() override;
   virtual bool RecvResume() override;
   virtual bool RecvCancel(const nsresult& status) override;
   virtual bool RecvRedirect2Verify(const nsresult& result,
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -3,25 +3,23 @@
 
 /* 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 protocol PNecko;
 include InputStreamParams;
 include URIParams;
+include NeckoChannelParams;
 
 include protocol PBlob; //FIXME: bug #792908
 
 include "mozilla/net/NeckoMessageUtils.h";
 
-using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
 using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
-using class nsHttpResponseHead from "nsHttpResponseHead.h";
-using struct nsHttpAtom from "nsHttp.h";
 using mozilla::net::NetAddr from "mozilla/net/DNS.h";
 using struct mozilla::net::ResourceTimingStruct from "mozilla/net/TimingStruct.h";
 
 namespace mozilla {
 namespace net {
 
 //-------------------------------------------------------------------
 protocol PHttpChannel
@@ -88,17 +86,18 @@ child:
                  nsHttpHeaderArray   requestHeaders,
                  bool                isFromCache,
                  bool                cacheEntryAvailable,
                  uint32_t            cacheExpirationTime,
                  nsCString           cachedCharset,
                  nsCString           securityInfoSerialization,
                  NetAddr             selfAddr,
                  NetAddr             peerAddr,
-                 int16_t             redirectCount);
+                 int16_t             redirectCount,
+                 HttpChannelCacheKey cacheKey);
 
   // Combines a single OnDataAvailable and its associated OnProgress &
   // OnStatus calls into one IPDL message
   OnTransportAndData(nsresult  channelStatus,
                      nsresult  transportStatus,
                      uint64_t  progress,
                      uint64_t  progressMax,
                      nsCString data,
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6032,45 +6032,16 @@ nsHttpChannel::GetOfflineCacheToken(nsIS
 }
 
 NS_IMETHODIMP
 nsHttpChannel::SetOfflineCacheToken(nsISupports *token)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-class nsHttpChannelCacheKey final : public nsISupportsPRUint32,
-                                    public nsISupportsCString
-{
-    NS_DECL_ISUPPORTS
-
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_FORWARD_NSISUPPORTSPRUINT32(mSupportsPRUint32->)
-
-    // Both interfaces declares toString method with the same signature.
-    // Thus we have to delegate only to nsISupportsPRUint32 implementation.
-    NS_IMETHOD GetData(nsACString & aData) override
-    {
-        return mSupportsCString->GetData(aData);
-    }
-    NS_IMETHOD SetData(const nsACString & aData) override
-    {
-        return mSupportsCString->SetData(aData);
-    }
-
-public:
-    nsresult SetData(uint32_t aPostID, const nsACString& aKey);
-
-protected:
-    ~nsHttpChannelCacheKey() {}
-
-    nsCOMPtr<nsISupportsPRUint32> mSupportsPRUint32;
-    nsCOMPtr<nsISupportsCString> mSupportsCString;
-};
-
 NS_IMPL_ADDREF(nsHttpChannelCacheKey)
 NS_IMPL_RELEASE(nsHttpChannelCacheKey)
 NS_INTERFACE_TABLE_HEAD(nsHttpChannelCacheKey)
 NS_INTERFACE_TABLE_BEGIN
 NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsHttpChannelCacheKey,
                                    nsISupports, nsISupportsPRUint32)
 NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(nsHttpChannelCacheKey,
                                    nsISupportsPrimitive, nsISupportsPRUint32)
@@ -6106,16 +6077,29 @@ nsresult nsHttpChannelCacheKey::SetData(
     if (NS_FAILED(rv)) return rv;
 
     mSupportsPRUint32->SetData(aPostID);
     if (NS_FAILED(rv)) return rv;
 
     return NS_OK;
 }
 
+nsresult nsHttpChannelCacheKey::GetData(uint32_t *aPostID,
+                                        nsACString& aKey)
+{
+    nsresult rv;
+
+    rv = mSupportsPRUint32->GetData(aPostID);
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
+
+    return mSupportsCString->GetData(aKey);
+}
+
 NS_IMETHODIMP
 nsHttpChannel::GetCacheKey(nsISupports **key)
 {
     // mayhemer: TODO - do we need this API?
 
     nsresult rv;
     NS_ENSURE_ARG_POINTER(key);
 
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -36,16 +36,50 @@ class Http2PushedStream;
 class HttpChannelSecurityWarningReporter
 {
 public:
   virtual nsresult ReportSecurityMessage(const nsAString& aMessageTag,
                                          const nsAString& aMessageCategory) = 0;
 };
 
 //-----------------------------------------------------------------------------
+// nsHttpChannelCacheKey
+//-----------------------------------------------------------------------------
+
+class nsHttpChannelCacheKey final : public nsISupportsPRUint32,
+                                    public nsISupportsCString
+{
+    NS_DECL_ISUPPORTS
+
+    NS_DECL_NSISUPPORTSPRIMITIVE
+    NS_FORWARD_NSISUPPORTSPRUINT32(mSupportsPRUint32->)
+
+    // Both interfaces declares toString method with the same signature.
+    // Thus we have to delegate only to nsISupportsPRUint32 implementation.
+    NS_IMETHOD GetData(nsACString & aData) override
+    {
+        return mSupportsCString->GetData(aData);
+    }
+    NS_IMETHOD SetData(const nsACString & aData) override
+    {
+        return mSupportsCString->SetData(aData);
+    }
+
+public:
+    nsresult SetData(uint32_t aPostID, const nsACString& aKey);
+    nsresult GetData(uint32_t *aPostID, nsACString& aKey);
+
+protected:
+    ~nsHttpChannelCacheKey() {}
+
+    nsCOMPtr<nsISupportsPRUint32> mSupportsPRUint32;
+    nsCOMPtr<nsISupportsCString> mSupportsCString;
+};
+
+//-----------------------------------------------------------------------------
 // nsHttpChannel
 //-----------------------------------------------------------------------------
 
 // Use to support QI nsIChannel to nsHttpChannel
 #define NS_HTTPCHANNEL_IID                         \
 {                                                  \
   0x301bf95b,                                      \
   0x7bb3,                                          \
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
@@ -20,16 +20,17 @@ NS_IMPL_RELEASE(nsViewSourceChannel)
 */
 NS_INTERFACE_MAP_BEGIN(nsViewSourceChannel)
     NS_INTERFACE_MAP_ENTRY(nsIViewSourceChannel)
     NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
     NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
     NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIHttpChannel, mHttpChannel)
     NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIHttpChannelInternal, mHttpChannelInternal)
     NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsICachingChannel, mCachingChannel)
+    NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsICacheInfoChannel, mCacheInfoChannel)
     NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIApplicationCacheChannel, mApplicationCacheChannel)
     NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIUploadChannel, mUploadChannel)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIRequest, nsIViewSourceChannel)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIChannel, nsIViewSourceChannel)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIViewSourceChannel)
 NS_INTERFACE_MAP_END
 
 nsresult
@@ -75,16 +76,17 @@ nsViewSourceChannel::Init(nsIURI* uri)
     NS_ENSURE_SUCCESS(rv, rv);
 
     mIsSrcdocChannel = false;
 
     mChannel->SetOriginalURI(mOriginalURI);
     mHttpChannel = do_QueryInterface(mChannel);
     mHttpChannelInternal = do_QueryInterface(mChannel);
     mCachingChannel = do_QueryInterface(mChannel);
+    mCacheInfoChannel = do_QueryInterface(mChannel);
     mApplicationCacheChannel = do_QueryInterface(mChannel);
     mUploadChannel = do_QueryInterface(mChannel);
     
     return NS_OK;
 }
 
 nsresult
 nsViewSourceChannel::InitSrcdoc(nsIURI* aURI, const nsAString &aSrcdoc)
@@ -112,16 +114,17 @@ nsViewSourceChannel::InitSrcdoc(nsIURI* 
     NS_ENSURE_SUCCESS(rv, rv);
     mOriginalURI = aURI;
     mIsSrcdocChannel = true;
 
     mChannel->SetOriginalURI(mOriginalURI);
     mHttpChannel = do_QueryInterface(mChannel);
     mHttpChannelInternal = do_QueryInterface(mChannel);
     mCachingChannel = do_QueryInterface(mChannel);
+    mCacheInfoChannel = do_QueryInterface(mChannel);
     mApplicationCacheChannel = do_QueryInterface(mChannel);
     mUploadChannel = do_QueryInterface(mChannel);
     return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIRequest methods:
 
@@ -539,16 +542,17 @@ nsViewSourceChannel::GetIsSrcdocChannel(
 NS_IMETHODIMP
 nsViewSourceChannel::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_FAILURE);
     // The channel may have gotten redirected... Time to update our info
     mChannel = do_QueryInterface(aRequest);
     mHttpChannel = do_QueryInterface(aRequest);
     mCachingChannel = do_QueryInterface(aRequest);
+    mCacheInfoChannel = do_QueryInterface(mChannel);
     mUploadChannel = do_QueryInterface(aRequest);
     
     return mListener->OnStartRequest(static_cast<nsIViewSourceChannel*>
                                                 (this),
                                      aContext);
 }
 
 
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.h
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.h
@@ -30,17 +30,17 @@ class nsViewSourceChannel final : public
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSICHANNEL
     NS_DECL_NSIVIEWSOURCECHANNEL
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSIHTTPCHANNEL
-    NS_FORWARD_SAFE_NSICACHEINFOCHANNEL(mCachingChannel)
+    NS_FORWARD_SAFE_NSICACHEINFOCHANNEL(mCacheInfoChannel)
     NS_FORWARD_SAFE_NSICACHINGCHANNEL(mCachingChannel)
     NS_FORWARD_SAFE_NSIAPPLICATIONCACHECHANNEL(mApplicationCacheChannel)
     NS_FORWARD_SAFE_NSIAPPLICATIONCACHECONTAINER(mApplicationCacheChannel)
     NS_FORWARD_SAFE_NSIUPLOADCHANNEL(mUploadChannel)
     NS_FORWARD_SAFE_NSIHTTPCHANNELINTERNAL(mHttpChannelInternal)
 
     // nsViewSourceChannel methods:
     nsViewSourceChannel()
@@ -53,16 +53,17 @@ public:
 
 protected:
     ~nsViewSourceChannel() {}
 
     nsCOMPtr<nsIChannel>        mChannel;
     nsCOMPtr<nsIHttpChannel>    mHttpChannel;
     nsCOMPtr<nsIHttpChannelInternal>    mHttpChannelInternal;
     nsCOMPtr<nsICachingChannel> mCachingChannel;
+    nsCOMPtr<nsICacheInfoChannel> mCacheInfoChannel;
     nsCOMPtr<nsIApplicationCacheChannel> mApplicationCacheChannel;
     nsCOMPtr<nsIUploadChannel>  mUploadChannel;
     nsCOMPtr<nsIStreamListener> mListener;
     nsCOMPtr<nsIURI>            mOriginalURI;
     nsCString                   mContentType;
     bool                        mIsDocument; // keeps track of the LOAD_DOCUMENT_URI flag
     bool                        mOpened;
     bool                        mIsSrcdocChannel;
--- a/testing/mochitest/tests/MochiKit-1.4.2/tests/mochitest.ini
+++ b/testing/mochitest/tests/MochiKit-1.4.2/tests/mochitest.ini
@@ -14,16 +14,17 @@ support-files =
 
 [test_MochiKit-Async.html]
 skip-if = (toolkit == 'android' && processor == 'x86') #x86 only
 [test_MochiKit-Base.html]
 [test_MochiKit-Color.html]
 [test_MochiKit-DateTime.html]
 [test_MochiKit-DOM.html]
 [test_MochiKit-DOM-Safari.html]
+skip-if = (android_version == '18' && debug) # intermittent time-out
 [test_MochiKit-DragAndDrop.html]
 [test_MochiKit-Format.html]
 [test_MochiKit-Iter.html]
 [test_MochiKit-Logging.html]
 [test_MochiKit-MochiKit.html]
 [test_MochiKit-Selector.html]
 [test_MochiKit-Signal.html]
 [test_MochiKit-Style.html]