Merge inbound to m-c a=merge CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 16 Sep 2016 14:31:34 -0700
changeset 314255 17fd06efdbb7b7a9a0006c0ab02ddbab6a0c9376
parent 314233 f398b9d4696e2152d2c3040aa89073ff60e5955d (current diff)
parent 314254 c0021d576b3a738e055b0c1c6608823038cba3a0 (diff)
child 314256 b401cb17167b34c362eb819259effbb3c0979f59
push id30713
push userkwierso@gmail.com
push dateFri, 16 Sep 2016 21:32:12 +0000
treeherdermozilla-central@b401cb17167b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone51.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 inbound to m-c a=merge CLOSED TREE
dom/base/nsLocation.cpp
dom/base/nsLocation.h
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -630,18 +630,21 @@ pref("network.protocol-handler.expose.ma
 pref("network.protocol-handler.expose.news", false);
 pref("network.protocol-handler.expose.snews", false);
 pref("network.protocol-handler.expose.nntp", false);
 
 pref("accessibility.typeaheadfind", false);
 pref("accessibility.typeaheadfind.timeout", 5000);
 pref("accessibility.typeaheadfind.linksonly", false);
 pref("accessibility.typeaheadfind.flashBar", 1);
+
+#ifdef NIGHTLY_BUILD
 pref("findbar.highlightAll", true);
 pref("findbar.modalHighlight", true);
+#endif
 
 // Tracks when accessibility is loaded into the previous session.
 pref("accessibility.loadedInLastSession", false);
 
 pref("plugins.click_to_play", true);
 pref("plugins.testmode", false);
 
 pref("plugin.default.state", 1);
rename from dom/base/nsLocation.cpp
rename to dom/base/Location.cpp
--- a/dom/base/nsLocation.cpp
+++ b/dom/base/Location.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsLocation.h"
+#include "Location.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptContext.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellLoadInfo.h"
 #include "nsIWebNavigation.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIURIFixup.h"
@@ -30,83 +30,83 @@
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/Likely.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsNullPrincipal.h"
 #include "ScriptSettings.h"
 #include "mozilla/dom/LocationBinding.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
 static nsresult
 GetDocumentCharacterSetForURI(const nsAString& aHref, nsACString& aCharset)
 {
   aCharset.Truncate();
 
   if (nsIDocument* doc = GetEntryDocument()) {
     aCharset = doc->GetDocumentCharacterSet();
   }
 
   return NS_OK;
 }
 
-nsLocation::nsLocation(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell)
+Location::Location(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell)
   : mInnerWindow(aWindow)
 {
   MOZ_ASSERT(aDocShell);
   MOZ_ASSERT(mInnerWindow->IsInnerWindow());
 
   mDocShell = do_GetWeakReference(aDocShell);
 }
 
-nsLocation::~nsLocation()
+Location::~Location()
 {
 }
 
-// QueryInterface implementation for nsLocation
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsLocation)
+// QueryInterface implementation for Location
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Location)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsIDOMLocation)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMLocation)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTION_CLASS(nsLocation)
+NS_IMPL_CYCLE_COLLECTION_CLASS(Location)
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsLocation)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Location)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mInnerWindow);
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsLocation)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Location)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInnerWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsLocation)
+NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Location)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsLocation)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsLocation)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(Location)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(Location)
 
 void
-nsLocation::SetDocShell(nsIDocShell *aDocShell)
+Location::SetDocShell(nsIDocShell *aDocShell)
 {
    mDocShell = do_GetWeakReference(aDocShell);
 }
 
 nsIDocShell *
-nsLocation::GetDocShell()
+Location::GetDocShell()
 {
   nsCOMPtr<nsIDocShell> docshell(do_QueryReferent(mDocShell));
   return docshell;
 }
 
 nsresult
-nsLocation::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
+Location::CheckURL(nsIURI* aURI, nsIDocShellLoadInfo** aLoadInfo)
 {
   *aLoadInfo = nullptr;
 
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
   NS_ENSURE_TRUE(docShell, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIPrincipal> triggeringPrincipal;
   nsCOMPtr<nsIURI> sourceURI;
@@ -159,20 +159,21 @@ nsLocation::CheckURL(nsIURI* aURI, nsIDo
       bool urisEqual = false;
       if (docOriginalURI && docCurrentURI && principalURI) {
         principalURI->Equals(docOriginalURI, &urisEqual);
       }
       if (urisEqual) {
         sourceURI = docCurrentURI;
       }
       else {
-        // Use principalURI as long as it is not an nsNullPrincipalURI.
-        // We could add a method such as GetReferrerURI to principals to make this
-        // cleaner, but given that we need to start using Source Browsing Context
-        // for referrer (see Bug 960639) this may be wasted effort at this stage.
+        // Use principalURI as long as it is not an nsNullPrincipalURI.  We
+        // could add a method such as GetReferrerURI to principals to make this
+        // cleaner, but given that we need to start using Source Browsing
+        // Context for referrer (see Bug 960639) this may be wasted effort at
+        // this stage.
         if (principalURI) {
           bool isNullPrincipalScheme;
           rv = principalURI->SchemeIs(NS_NULLPRINCIPAL_SCHEME,
                                      &isNullPrincipalScheme);
           if (NS_SUCCEEDED(rv) && !isNullPrincipalScheme) {
             sourceURI = principalURI;
           }
         }
@@ -200,17 +201,17 @@ nsLocation::CheckURL(nsIURI* aURI, nsIDo
   }
 
   loadInfo.swap(*aLoadInfo);
 
   return NS_OK;
 }
 
 nsresult
-nsLocation::GetURI(nsIURI** aURI, bool aGetInnermostURI)
+Location::GetURI(nsIURI** aURI, bool aGetInnermostURI)
 {
   *aURI = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell, &rv));
   if (NS_FAILED(rv)) {
     return rv;
@@ -238,17 +239,17 @@ nsLocation::GetURI(nsIURI** aURI, bool a
 
   nsCOMPtr<nsIURIFixup> urifixup(do_GetService(NS_URIFIXUP_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return urifixup->CreateExposableURI(uri, aURI);
 }
 
 nsresult
-nsLocation::GetWritableURI(nsIURI** aURI, const nsACString* aNewRef)
+Location::GetWritableURI(nsIURI** aURI, const nsACString* aNewRef)
 {
   *aURI = nullptr;
 
   nsCOMPtr<nsIURI> uri;
 
   nsresult rv = GetURI(getter_AddRefs(uri));
   if (NS_FAILED(rv) || !uri) {
     return rv;
@@ -257,17 +258,17 @@ nsLocation::GetWritableURI(nsIURI** aURI
   if (!aNewRef) {
     return uri->Clone(aURI);
   }
 
   return uri->CloneWithNewRef(*aNewRef, aURI);
 }
 
 nsresult
-nsLocation::SetURI(nsIURI* aURI, bool aReplace)
+Location::SetURI(nsIURI* aURI, bool aReplace)
 {
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
   if (docShell) {
     nsCOMPtr<nsIDocShellLoadInfo> loadInfo;
 
     if(NS_FAILED(CheckURL(aURI, getter_AddRefs(loadInfo))))
       return NS_ERROR_FAILURE;
 
@@ -287,17 +288,17 @@ nsLocation::SetURI(nsIURI* aURI, bool aR
     return docShell->LoadURI(aURI, loadInfo,
                              nsIWebNavigation::LOAD_FLAGS_NONE, true);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocation::GetHash(nsAString& aHash)
+Location::GetHash(nsAString& aHash)
 {
   aHash.SetLength(0);
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetURI(getter_AddRefs(uri));
   if (NS_FAILED(rv) || !uri) {
     return rv;
   }
@@ -346,33 +347,33 @@ nsLocation::GetHash(nsAString& aHash)
   } else {
     mCachedHash = aHash;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocation::SetHash(const nsAString& aHash)
+Location::SetHash(const nsAString& aHash)
 {
   NS_ConvertUTF16toUTF8 hash(aHash);
   if (hash.IsEmpty() || hash.First() != char16_t('#')) {
     hash.Insert(char16_t('#'), 0);
   }
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri), &hash);
   if (NS_FAILED(rv) || !uri) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetHost(nsAString& aHost)
+Location::GetHost(nsAString& aHost)
 {
   aHost.Truncate();
 
   nsCOMPtr<nsIURI> uri;
   nsresult result;
 
   result = GetURI(getter_AddRefs(uri), true);
 
@@ -385,65 +386,65 @@ nsLocation::GetHost(nsAString& aHost)
       AppendUTF8toUTF16(hostport, aHost);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocation::SetHost(const nsAString& aHost)
+Location::SetHost(const nsAString& aHost)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !uri)) {
     return rv;
   }
 
   rv = uri->SetHostPort(NS_ConvertUTF16toUTF8(aHost));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetHostname(nsAString& aHostname)
+Location::GetHostname(nsAString& aHostname)
 {
   aHostname.Truncate();
 
   nsCOMPtr<nsIURI> uri;
   GetURI(getter_AddRefs(uri), true);
   if (uri) {
     nsContentUtils::GetHostOrIPv6WithBrackets(uri, aHostname);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocation::SetHostname(const nsAString& aHostname)
+Location::SetHostname(const nsAString& aHostname)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !uri)) {
     return rv;
   }
 
   rv = uri->SetHost(NS_ConvertUTF16toUTF8(aHostname));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetHref(nsAString& aHref)
+Location::GetHref(nsAString& aHref)
 {
   aHref.Truncate();
 
   nsCOMPtr<nsIURI> uri;
   nsresult result;
 
   result = GetURI(getter_AddRefs(uri));
 
@@ -456,17 +457,17 @@ nsLocation::GetHref(nsAString& aHref)
       AppendUTF8toUTF16(uriString, aHref);
     }
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::SetHref(const nsAString& aHref)
+Location::SetHref(const nsAString& aHref)
 {
   nsAutoString oldHref;
   nsresult rv = NS_OK;
 
   JSContext *cx = nsContentUtils::GetCurrentJSContext();
   if (cx) {
     rv = SetHrefWithContext(cx, aHref, false);
   } else {
@@ -482,33 +483,33 @@ nsLocation::SetHref(const nsAString& aHr
       }
     }
   }
 
   return rv;
 }
 
 nsresult
-nsLocation::SetHrefWithContext(JSContext* cx, const nsAString& aHref,
+Location::SetHrefWithContext(JSContext* cx, const nsAString& aHref,
                                bool aReplace)
 {
   nsCOMPtr<nsIURI> base;
 
   // Get the source of the caller
   nsresult result = GetSourceBaseURL(cx, getter_AddRefs(base));
 
   if (NS_FAILED(result)) {
     return result;
   }
 
   return SetHrefWithBase(aHref, base, aReplace);
 }
 
 nsresult
-nsLocation::SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
+Location::SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
                             bool aReplace)
 {
   nsresult result;
   nsCOMPtr<nsIURI> newUri;
 
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
 
   nsAutoCString docCharset;
@@ -548,17 +549,17 @@ nsLocation::SetHrefWithBase(const nsAStr
 
     return SetURI(newUri, aReplace || inScriptTag);
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::GetOrigin(nsAString& aOrigin)
+Location::GetOrigin(nsAString& aOrigin)
 {
   aOrigin.Truncate();
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetURI(getter_AddRefs(uri), true);
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(uri, NS_OK);
 
@@ -566,17 +567,17 @@ nsLocation::GetOrigin(nsAString& aOrigin
   rv = nsContentUtils::GetUTFOrigin(uri, origin);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aOrigin = origin;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocation::GetPathname(nsAString& aPathname)
+Location::GetPathname(nsAString& aPathname)
 {
   aPathname.Truncate();
 
   nsCOMPtr<nsIURI> uri;
   nsresult result = NS_OK;
 
   result = GetURI(getter_AddRefs(uri));
 
@@ -590,34 +591,34 @@ nsLocation::GetPathname(nsAString& aPath
       AppendUTF8toUTF16(file, aPathname);
     }
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::SetPathname(const nsAString& aPathname)
+Location::SetPathname(const nsAString& aPathname)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !uri)) {
     return rv;
   }
 
   rv = uri->SetPath(NS_ConvertUTF16toUTF8(aPathname));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetPort(nsAString& aPort)
+Location::GetPort(nsAString& aPort)
 {
   aPort.SetLength(0);
 
   nsCOMPtr<nsIURI> uri;
   nsresult result = NS_OK;
 
   result = GetURI(getter_AddRefs(uri), true);
 
@@ -634,17 +635,17 @@ nsLocation::GetPort(nsAString& aPort)
     // Don't propagate this exception to caller
     result = NS_OK;
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::SetPort(const nsAString& aPort)
+Location::SetPort(const nsAString& aPort)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !uri)) {
     return rv;
   }
 
   // perhaps use nsReadingIterators at some point?
@@ -665,17 +666,17 @@ nsLocation::SetPort(const nsAString& aPo
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetProtocol(nsAString& aProtocol)
+Location::GetProtocol(nsAString& aProtocol)
 {
   aProtocol.SetLength(0);
 
   nsCOMPtr<nsIURI> uri;
   nsresult result = NS_OK;
 
   result = GetURI(getter_AddRefs(uri));
 
@@ -689,17 +690,17 @@ nsLocation::GetProtocol(nsAString& aProt
       aProtocol.Append(char16_t(':'));
     }
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::SetProtocol(const nsAString& aProtocol)
+Location::SetProtocol(const nsAString& aProtocol)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !uri)) {
     return rv;
   }
 
   rv = uri->SetScheme(NS_ConvertUTF16toUTF8(aProtocol));
@@ -716,34 +717,34 @@ nsLocation::SetProtocol(const nsAString&
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 void
-nsLocation::GetUsername(nsAString& aUsername, ErrorResult& aError)
+Location::GetUsername(nsAString& aUsername, ErrorResult& aError)
 {
   THROW_AND_RETURN_IF_CALLER_DOESNT_SUBSUME();
 
   aUsername.Truncate();
   nsCOMPtr<nsIURI> uri;
   nsresult result = GetURI(getter_AddRefs(uri));
   if (uri) {
     nsAutoCString username;
     result = uri->GetUsername(username);
     if (NS_SUCCEEDED(result)) {
       CopyUTF8toUTF16(username, aUsername);
     }
   }
 }
 
 void
-nsLocation::SetUsername(const nsAString& aUsername, ErrorResult& aError)
+Location::SetUsername(const nsAString& aUsername, ErrorResult& aError)
 {
   THROW_AND_RETURN_IF_CALLER_DOESNT_SUBSUME();
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aError.Throw(rv);
     return;
@@ -758,34 +759,34 @@ nsLocation::SetUsername(const nsAString&
     aError.Throw(rv);
     return;
   }
 
   rv = SetURI(uri);
 }
 
 void
-nsLocation::GetPassword(nsAString& aPassword, ErrorResult& aError)
+Location::GetPassword(nsAString& aPassword, ErrorResult& aError)
 {
   THROW_AND_RETURN_IF_CALLER_DOESNT_SUBSUME();
 
   aPassword.Truncate();
   nsCOMPtr<nsIURI> uri;
   nsresult result = GetURI(getter_AddRefs(uri));
   if (uri) {
     nsAutoCString password;
     result = uri->GetPassword(password);
     if (NS_SUCCEEDED(result)) {
       CopyUTF8toUTF16(password, aPassword);
     }
   }
 }
 
 void
-nsLocation::SetPassword(const nsAString& aPassword, ErrorResult& aError)
+Location::SetPassword(const nsAString& aPassword, ErrorResult& aError)
 {
   THROW_AND_RETURN_IF_CALLER_DOESNT_SUBSUME();
 
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aError.Throw(rv);
     return;
@@ -800,17 +801,17 @@ nsLocation::SetPassword(const nsAString&
     aError.Throw(rv);
     return;
   }
 
   rv = SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::GetSearch(nsAString& aSearch)
+Location::GetSearch(nsAString& aSearch)
 {
   aSearch.SetLength(0);
 
   nsCOMPtr<nsIURI> uri;
   nsresult result = NS_OK;
 
   result = GetURI(getter_AddRefs(uri));
 
@@ -826,28 +827,28 @@ nsLocation::GetSearch(nsAString& aSearch
       AppendUTF8toUTF16(search, aSearch);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsLocation::SetSearch(const nsAString& aSearch)
+Location::SetSearch(const nsAString& aSearch)
 {
   nsresult rv = SetSearchInternal(aSearch);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsLocation::SetSearchInternal(const nsAString& aSearch)
+Location::SetSearchInternal(const nsAString& aSearch)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = GetWritableURI(getter_AddRefs(uri));
 
   nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
   if (NS_WARN_IF(NS_FAILED(rv) || !url)) {
     return rv;
   }
@@ -856,22 +857,23 @@ nsLocation::SetSearchInternal(const nsAS
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return SetURI(uri);
 }
 
 NS_IMETHODIMP
-nsLocation::Reload(bool aForceget)
+Location::Reload(bool aForceget)
 {
   nsresult rv;
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell));
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
-  nsCOMPtr<nsPIDOMWindowOuter> window = docShell ? docShell->GetWindow() : nullptr;
+  nsCOMPtr<nsPIDOMWindowOuter> window = docShell ? docShell->GetWindow()
+                                                 : nullptr;
 
   if (window && window->IsHandlingResizeEvent()) {
     // location.reload() was called on a window that is handling a
     // resize event. Sites do this since Netscape 4.x needed it, but
     // we don't, and it's a horrible experience for nothing. In stead
     // of reloading the page, just clear style data and reflow the
     // page since some sites may use this trick to work around gecko
     // reflow bugs, and this should have the same effect.
@@ -904,17 +906,17 @@ nsLocation::Reload(bool aForceget)
   } else {
     rv = NS_ERROR_FAILURE;
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsLocation::Replace(const nsAString& aUrl)
+Location::Replace(const nsAString& aUrl)
 {
   nsresult rv = NS_OK;
   if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
     return SetHrefWithContext(cx, aUrl, true);
   }
 
   nsAutoString oldHref;
 
@@ -925,17 +927,17 @@ nsLocation::Replace(const nsAString& aUr
 
   rv = NS_NewURI(getter_AddRefs(oldUri), oldHref);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return SetHrefWithBase(aUrl, oldUri, true);
 }
 
 NS_IMETHODIMP
-nsLocation::Assign(const nsAString& aUrl)
+Location::Assign(const nsAString& aUrl)
 {
   if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
     return SetHrefWithContext(cx, aUrl, false);
   }
 
   nsAutoString oldHref;
   nsresult result = NS_OK;
 
@@ -950,66 +952,71 @@ nsLocation::Assign(const nsAString& aUrl
       result = SetHrefWithBase(aUrl, oldUri, false);
     }
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsLocation::ToString(nsAString& aReturn)
+Location::ToString(nsAString& aReturn)
 {
   return GetHref(aReturn);
 }
 
 NS_IMETHODIMP
-nsLocation::ValueOf(nsIDOMLocation** aReturn)
+Location::ValueOf(nsIDOMLocation** aReturn)
 {
   nsCOMPtr<nsIDOMLocation> loc(this);
   loc.forget(aReturn);
   return NS_OK;
 }
 
 nsresult
-nsLocation::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL)
+Location::GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL)
 {
   *sourceURL = nullptr;
   nsIDocument* doc = GetEntryDocument();
   // If there's no entry document, we either have no Script Entry Point or one
-  // that isn't a DOM Window.  This doesn't generally happen with the DOM,
-  // but can sometimes happen with extension code in certain IPC configurations.
-  // If this happens, try falling back on the current document associated with
-  // the docshell. If that fails, just return null and hope that the caller passed
+  // that isn't a DOM Window.  This doesn't generally happen with the DOM, but
+  // can sometimes happen with extension code in certain IPC configurations.  If
+  // this happens, try falling back on the current document associated with the
+  // docshell. If that fails, just return null and hope that the caller passed
   // an absolute URI.
   if (!doc && GetDocShell()) {
-    nsCOMPtr<nsPIDOMWindowOuter> docShellWin = do_QueryInterface(GetDocShell()->GetScriptGlobalObject());
+    nsCOMPtr<nsPIDOMWindowOuter> docShellWin =
+      do_QueryInterface(GetDocShell()->GetScriptGlobalObject());
     if (docShellWin) {
       doc = docShellWin->GetDoc();
     }
   }
   NS_ENSURE_TRUE(doc, NS_OK);
   *sourceURL = doc->GetBaseURI().take();
   return NS_OK;
 }
 
 bool
-nsLocation::CallerSubsumes()
+Location::CallerSubsumes()
 {
   // Get the principal associated with the location object.  Note that this is
   // the principal of the page which will actually be navigated, not the
   // principal of the Location object itself.  This is why we need this check
   // even though we only allow limited cross-origin access to Location objects
   // in general.
   nsCOMPtr<nsPIDOMWindowOuter> outer = mInnerWindow->GetOuterWindow();
   if (MOZ_UNLIKELY(!outer))
     return false;
   nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(outer);
   bool subsumes = false;
-  nsresult rv = nsContentUtils::SubjectPrincipal()->SubsumesConsideringDomain(sop->GetPrincipal(), &subsumes);
+  nsresult rv =
+    nsContentUtils::SubjectPrincipal()->SubsumesConsideringDomain(sop->GetPrincipal(), &subsumes);
   NS_ENSURE_SUCCESS(rv, false);
   return subsumes;
 }
 
 JSObject*
-nsLocation::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+Location::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return LocationBinding::Wrap(aCx, this, aGivenProto);
 }
+
+} // dom namespace
+} // mozilla namespace
rename from dom/base/nsLocation.h
rename to dom/base/Location.h
--- a/dom/base/nsLocation.h
+++ b/dom/base/Location.h
@@ -1,44 +1,45 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
-#ifndef nsLocation_h__
-#define nsLocation_h__
+#ifndef mozilla_dom_Location_h
+#define mozilla_dom_Location_h
 
-#include "nsIDOMLocation.h"
-#include "nsString.h"
-#include "nsIWeakReferenceUtils.h"
-#include "nsWrapperCache.h"
-#include "nsCycleCollectionParticipant.h"
 #include "js/TypeDecls.h"
 #include "mozilla/ErrorResult.h"
+#include "nsCycleCollectionParticipant.h"
+#include "nsIDOMLocation.h"
+#include "nsIWeakReferenceUtils.h"
 #include "nsPIDOMWindow.h"
+#include "nsString.h"
+#include "nsWrapperCache.h"
 
-class nsIURI;
 class nsIDocShell;
 class nsIDocShellLoadInfo;
+class nsIURI;
+
+namespace mozilla {
+namespace dom {
 
 //*****************************************************************************
-// nsLocation: Script "location" object
+// Location: Script "location" object
 //*****************************************************************************
 
-class nsLocation final : public nsIDOMLocation
-                       , public nsWrapperCache
+class Location final : public nsIDOMLocation
+                     , public nsWrapperCache
 {
-  typedef mozilla::ErrorResult ErrorResult;
-
 public:
-  nsLocation(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell);
+  Location(nsPIDOMWindowInner* aWindow, nsIDocShell *aDocShell);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsLocation,
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Location,
                                                          nsIDOMLocation)
 
   void SetDocShell(nsIDocShell *aDocShell);
   nsIDocShell *GetDocShell();
 
   // nsIDOMLocation
   NS_DECL_NSIDOMLOCATION
 
@@ -159,20 +160,22 @@ public:
   {
     // GetHref checks CallerSubsumes.
     GetHref(aRetval, aError);
   }
   nsPIDOMWindowInner* GetParentObject() const
   {
     return mInnerWindow;
   }
-  virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+  virtual JSObject* WrapObject(JSContext* aCx,
+                               JS::Handle<JSObject*> aGivenProto) override;
 
 protected:
-  virtual ~nsLocation();
+  virtual ~Location();
 
   nsresult SetSearchInternal(const nsAString& aSearch);
 
   // In the case of jar: uris, we sometimes want the place the jar was
   // fetched from as the URI instead of the jar: uri itself.  Pass in
   // true for aGetInnermostURI when that's the case.
   nsresult GetURI(nsIURI** aURL, bool aGetInnermostURI = false);
   nsresult GetWritableURI(nsIURI** aURL,
@@ -188,9 +191,12 @@ protected:
   nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
   bool CallerSubsumes();
 
   nsString mCachedHash;
   nsCOMPtr<nsPIDOMWindowInner> mInnerWindow;
   nsWeakPtr mDocShell;
 };
 
-#endif // nsLocation_h__
+} // dom namespace
+} // mozilla namespace
+
+#endif // mozilla_dom_Location_h
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -180,16 +180,17 @@ EXPORTS.mozilla.dom += [
     'FileList.h',
     'FileReader.h',
     'FormData.h',
     'FragmentOrElement.h',
     'FromParser.h',
     'ImageEncoder.h',
     'ImportManager.h',
     'Link.h',
+    'Location.h',
     'NameSpaceConstants.h',
     'Navigator.h',
     'NodeInfo.h',
     'NodeInfoInlines.h',
     'NodeIterator.h',
     'ProcessGlobal.h',
     'ResponsiveImageSelector.h',
     'SameProcessMessageQueue.h',
@@ -239,16 +240,17 @@ UNIFIED_SOURCES += [
     'File.cpp',
     'FileList.cpp',
     'FileReader.cpp',
     'FormData.cpp',
     'FragmentOrElement.cpp',
     'ImageEncoder.cpp',
     'ImportManager.cpp',
     'Link.cpp',
+    'Location.cpp',
     'MultipartBlobImpl.cpp',
     'Navigator.cpp',
     'NodeInfo.cpp',
     'NodeIterator.cpp',
     'nsAtomListUtils.cpp',
     'nsAttrAndChildArray.cpp',
     'nsAttrValue.cpp',
     'nsAttrValueOrString.cpp',
@@ -283,17 +285,16 @@ UNIFIED_SOURCES += [
     'nsHTMLContentSerializer.cpp',
     'nsIGlobalObject.cpp',
     'nsINode.cpp',
     'nsInProcessTabChildGlobal.cpp',
     'nsJSEnvironment.cpp',
     'nsJSTimeoutHandler.cpp',
     'nsJSUtils.cpp',
     'nsLineBreaker.cpp',
-    'nsLocation.cpp',
     'nsMappedAttributeElement.cpp',
     'nsMappedAttributes.cpp',
     'nsMimeTypeArray.cpp',
     'nsNameSpaceManager.cpp',
     'nsNoDataProtocolContentPolicy.cpp',
     'nsNodeInfoManager.cpp',
     'nsNodeUtils.cpp',
     'nsOpenURIInFrameParams.cpp',
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -238,17 +238,17 @@
 #include "mozilla/dom/XPathNSResolverBinding.h"
 #include "mozilla/dom/XPathResult.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDocumentActivity.h"
 #include "nsIStructuredCloneContainer.h"
 #include "nsIMutableArray.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "nsWindowMemoryReporter.h"
-#include "nsLocation.h"
+#include "mozilla/dom/Location.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/BoxObject.h"
 #include "gfxPrefs.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/StyleSheetHandle.h"
 #include "mozilla/StyleSheetHandleInlines.h"
@@ -6513,28 +6513,28 @@ nsDocument::GetDefaultView(mozIDOMWindow
 
 NS_IMETHODIMP
 nsDocument::GetLocation(nsIDOMLocation **_retval)
 {
   *_retval = nsIDocument::GetLocation().take();
   return NS_OK;
 }
 
-already_AddRefed<nsLocation>
+already_AddRefed<Location>
 nsIDocument::GetLocation() const
 {
   nsCOMPtr<nsPIDOMWindowInner> w = do_QueryInterface(mScriptGlobalObject);
 
   if (!w) {
     return nullptr;
   }
 
   nsGlobalWindow* window = nsGlobalWindow::Cast(w);
   ErrorResult dummy;
-  RefPtr<nsLocation> loc = window->GetLocation(dummy);
+  RefPtr<Location> loc = window->GetLocation(dummy);
   dummy.SuppressException();
   return loc.forget();
 }
 
 Element*
 nsIDocument::GetHtmlElement() const
 {
   Element* rootElement = GetRootElement();
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -198,17 +198,17 @@
 
 #include "nsRefreshDriver.h"
 #include "Layers.h"
 
 #include "mozilla/AddonPathService.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
-#include "nsLocation.h"
+#include "mozilla/dom/Location.h"
 #include "nsHTMLDocument.h"
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "prrng.h"
 #include "nsSandboxFlags.h"
 #include "TimeChangeObserver.h"
 #include "mozilla/dom/AudioContext.h"
 #include "mozilla/dom/BrowserElementDictionariesBinding.h"
@@ -9749,24 +9749,24 @@ nsGlobalWindow::GetPrivateRoot()
         top = parent->GetTop();
       }
     }
   }
 
   return top;
 }
 
-nsLocation*
+Location*
 nsGlobalWindow::GetLocation(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsInnerWindow());
 
   nsIDocShell *docShell = GetDocShell();
   if (!mLocation && docShell) {
-    mLocation = new nsLocation(AsInner(), docShell);
+    mLocation = new Location(AsInner(), docShell);
   }
   return mLocation;
 }
 
 nsIDOMLocation*
 nsGlobalWindow::GetLocation()
 {
   FORWARD_TO_INNER(GetLocation, (), nullptr);
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -83,17 +83,16 @@ class nsIDOMOfflineResourceList;
 class nsIScrollableFrame;
 class nsIControllers;
 class nsIJSID;
 class nsIScriptContext;
 class nsIScriptTimeoutHandler;
 class nsIWebBrowserChrome;
 
 class nsDOMWindowList;
-class nsLocation;
 class nsScreen;
 class nsHistory;
 class nsGlobalWindowObserver;
 class nsGlobalWindow;
 class nsDOMWindowUtils;
 class nsIIdleService;
 struct nsRect;
 
@@ -106,16 +105,17 @@ class BarProp;
 struct ChannelPixelLayout;
 class Console;
 class Crypto;
 class CustomElementsRegistry;
 class External;
 class Function;
 class Gamepad;
 enum class ImageBitmapFormat : uint32_t;
+class Location;
 class MediaQueryList;
 class MozSelfSupport;
 class Navigator;
 class OwningExternalOrWindowProxy;
 class Promise;
 class PostMessageEvent;
 struct RequestInit;
 class RequestOrUSVString;
@@ -875,17 +875,17 @@ public:
   nsIDocument* GetDocument()
   {
     return GetDoc();
   }
   void GetNameOuter(nsAString& aName);
   void GetName(nsAString& aName, mozilla::ErrorResult& aError);
   void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
   void SetName(const nsAString& aName, mozilla::ErrorResult& aError);
-  nsLocation* GetLocation(mozilla::ErrorResult& aError);
+  mozilla::dom::Location* GetLocation(mozilla::ErrorResult& aError);
   nsIDOMLocation* GetLocation() override;
   nsHistory* GetHistory(mozilla::ErrorResult& aError);
   mozilla::dom::CustomElementsRegistry* CustomElements() override;
   mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError);
   mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError);
@@ -1845,17 +1845,17 @@ protected:
   // that come after it.
   mozilla::LinkedList<nsTimeout> mTimeouts;
   // If mTimeoutInsertionPoint is non-null, insertions should happen after it.
   // This is a dummy timeout at the moment; if that ever changes, the logic in
   // ResetTimersForNonBackgroundWindow needs to change.
   nsTimeout*                    mTimeoutInsertionPoint;
   uint32_t                      mTimeoutPublicIdCounter;
   uint32_t                      mTimeoutFiringDepth;
-  RefPtr<nsLocation>          mLocation;
+  RefPtr<mozilla::dom::Location> mLocation;
   RefPtr<nsHistory>           mHistory;
   RefPtr<mozilla::dom::CustomElementsRegistry> mCustomElements;
 
   // These member variables are used on both inner and the outer windows.
   nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
 
   typedef nsTArray<RefPtr<mozilla::dom::StorageEvent>> nsDOMStorageEventArray;
   nsDOMStorageEventArray mPendingStorageEvents;
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -80,17 +80,16 @@ class nsIObserver;
 class nsIPresShell;
 class nsIPrincipal;
 class nsIRequest;
 class nsIRunnable;
 class nsIStreamListener;
 class nsIStructuredCloneContainer;
 class nsIURI;
 class nsIVariant;
-class nsLocation;
 class nsViewManager;
 class nsPresContext;
 class nsRange;
 class nsScriptLoader;
 class nsSMILAnimationController;
 class nsTextNode;
 class nsWindowSizes;
 class nsDOMCaretPosition;
@@ -133,16 +132,17 @@ class Event;
 class EventTarget;
 class FontFaceSet;
 class FrameRequestCallback;
 struct FullscreenRequest;
 class ImportManager;
 class HTMLBodyElement;
 struct LifecycleCallbackArgs;
 class Link;
+class Location;
 class MediaQueryList;
 class GlobalObject;
 class NodeFilter;
 class NodeIterator;
 enum class OrientationType : uint32_t;
 class ProcessingInstruction;
 class Promise;
 class StyleSheetList;
@@ -2556,17 +2556,17 @@ public:
     CreateCDATASection(const nsAString& aData, mozilla::ErrorResult& rv);
   already_AddRefed<mozilla::dom::Attr>
     CreateAttribute(const nsAString& aName, mozilla::ErrorResult& rv);
   already_AddRefed<mozilla::dom::Attr>
     CreateAttributeNS(const nsAString& aNamespaceURI,
                       const nsAString& aQualifiedName,
                       mozilla::ErrorResult& rv);
   void GetInputEncoding(nsAString& aInputEncoding) const;
-  already_AddRefed<nsLocation> GetLocation() const;
+  already_AddRefed<mozilla::dom::Location> GetLocation() const;
   void GetReferrer(nsAString& aReferrer) const;
   void GetLastModified(nsAString& aLastModified) const;
   void GetReadyState(nsAString& aReadyState) const;
   // Not const because otherwise the compiler can't figure out whether to call
   // this GetTitle or the nsAString version from non-const methods, since
   // neither is an exact match.
   virtual void GetTitle(nsString& aTitle) = 0;
   virtual void SetTitle(const nsAString& aTitle, mozilla::ErrorResult& rv) = 0;
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -633,20 +633,16 @@ DOMInterfaces = {
     'wrapperCache': False,
 },
 
 'LocalMediaStream': {
     'headerFile': 'DOMMediaStream.h',
     'nativeType': 'mozilla::DOMLocalMediaStream'
 },
 
-'Location': {
-    'nativeType': 'nsLocation',
-},
-
 'MediaList': {
     'nativeType': 'nsMediaList',
     'headerFile': 'nsIMediaList.h',
 },
 
 'MediaKeys' : {
     'implicitJSContext': [ 'createSession']
 },
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -1154,22 +1154,16 @@ CanvasRenderingContext2D::ParseColor(con
 
 nsresult
 CanvasRenderingContext2D::Reset()
 {
   if (mCanvasElement) {
     mCanvasElement->InvalidateCanvas();
   }
 
-  // only do this for non-docshell created contexts,
-  // since those are the ones that we created a surface for
-  if (mTarget && IsTargetValid() && !mDocShell) {
-    gCanvasAzureMemoryUsed -= mWidth * mHeight * 4;
-  }
-
   bool forceReset = true;
   ReturnTarget(forceReset);
   mTarget = nullptr;
   mBufferProvider = nullptr;
 
   // reset hit regions
   mHitRegionsOptions.ClearAndRetainStorage();
 
@@ -1622,18 +1616,16 @@ CanvasRenderingContext2D::EnsureTarget(c
   }
 
   MOZ_ASSERT(newTarget);
   MOZ_ASSERT(newProvider);
 
   mTarget = newTarget.forget();
   mBufferProvider = newProvider.forget();
 
-  RegisterAllocation();
-
   // Skia expects the unused X channel to contains 0 even for opaque operations
   // so we can't skip clearing in that case, even if we are going to cover the
   // entire canvas in the next drawing operation.
   if (!canDiscardContent || mTarget->GetBackendType() == gfx::BackendType::SKIA) {
     mTarget->ClearRect(canvasRect);
   }
 
   RestoreClipsAndTransformToTarget();
@@ -1667,44 +1659,31 @@ CanvasRenderingContext2D::SetInitialStat
   state->shadowColor = NS_RGBA(0,0,0,0);
 }
 
 void
 CanvasRenderingContext2D::SetErrorState()
 {
   EnsureErrorTarget();
 
-  if (mTarget && mTarget != sErrorTarget) {
-    gCanvasAzureMemoryUsed -= mWidth * mHeight * 4;
-  }
-
   mTarget = sErrorTarget;
   mBufferProvider = nullptr;
 
   // clear transforms, clips, etc.
   SetInitialState();
 }
 
 void
-CanvasRenderingContext2D::RegisterAllocation()
-{
-  // XXX - It would make more sense to track the allocation in
-  // PeristentBufferProvider, rather than here.
+EnsureCanvasMemoryReporter()
+{
   static bool registered = false;
-  // FIXME: Disable the reporter for now, see bug 1241865
-  if (!registered && false) {
+  if (!registered) {
     registered = true;
     RegisterStrongMemoryReporter(new Canvas2dPixelsReporter());
   }
-
-  gCanvasAzureMemoryUsed += mWidth * mHeight * 4;
-  JSContext* context = nsContentUtils::GetCurrentJSContext();
-  if (context) {
-    JS_updateMallocCounter(context, mWidth * mHeight * 4);
-  }
 }
 
 static already_AddRefed<LayerManager>
 LayerManagerFromCanvasElement(nsINode* aCanvasElement)
 {
   if (!aCanvasElement || !aCanvasElement->OwnerDoc()) {
     return nullptr;
   }
@@ -1778,17 +1757,19 @@ CanvasRenderingContext2D::TrySharedTarge
   }
 
   RefPtr<LayerManager> layerManager = LayerManagerFromCanvasElement(mCanvasElement);
 
   if (!layerManager) {
     return false;
   }
 
-  aOutProvider = layerManager->CreatePersistentBufferProvider(GetSize(), GetSurfaceFormat());
+  EnsureCanvasMemoryReporter();
+  aOutProvider = layerManager->CreatePersistentBufferProvider(GetSize(), GetSurfaceFormat(),
+                                                              &gCanvasAzureMemoryUsed);
 
   if (!aOutProvider) {
     return false;
   }
 
   // We can pass an empty persisted rect since we just created the buffer
   // provider (nothing to restore).
   aOutDT = aOutProvider->BorrowDrawTarget(IntRect());
@@ -4886,19 +4867,16 @@ CanvasRenderingContext2D::DrawImage(cons
     uint32_t sfeFlags = nsLayoutUtils::SFE_WANT_FIRST_FRAME |
                         nsLayoutUtils::SFE_NO_RASTERIZING_VECTORS;
 
     nsLayoutUtils::SurfaceFromElementResult res =
       CanvasRenderingContext2D::CachedSurfaceFromElement(element);
 
     if (!res.mSourceSurface) {
       res = nsLayoutUtils::SurfaceFromElement(element, sfeFlags, mTarget);
-      if (res.mSourceSurface) {
-        gfxUtils::WriteAsPNG(res.mSourceSurface, "/Volumes/firefoxos/Dev/mozilla-git/temp.png");
-      }
     }
 
     if (!res.mSourceSurface && !res.mDrawInfo.mImgContainer) {
       // The spec says to silently do nothing in the following cases:
       //   - The element is still loading.
       //   - The image is bad, but it's not in the broken state (i.e., we could
       //     decode the headers and get the size).
       if (!res.mIsStillLoading && !res.mHasSize) {
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -232,17 +232,18 @@ public:
   void Clear() const
   {
     // Deprecated
   }
   mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aRv);
   // The XPCOM CaptureEvents works fine for us.
   // The XPCOM ReleaseEvents works fine for us.
   // We're picking up GetLocation from Document
-  already_AddRefed<nsLocation> GetLocation() const {
+  already_AddRefed<mozilla::dom::Location> GetLocation() const
+  {
     return nsIDocument::GetLocation();
   }
 
   virtual nsHTMLDocument* AsHTMLDocument() override { return this; }
 
 protected:
   ~nsHTMLDocument();
 
--- a/dom/html/test/test_hash_encoded.html
+++ b/dom/html/test/test_hash_encoded.html
@@ -90,17 +90,17 @@ function doTestEncoded() {
   is(parsed.b.key, 'value', 'JSON not parsed correctly');
 
   url = new URL("http://www.example.com/test/");
   url.hash = '#{"a":[13, 42], "b":{"key":"value"}}';
   is(target.hash, '#{"a":[13, 42], "b":{"key":"value"}}', 'Unexpected url hash');
   parsed = JSON.parse(target.hash.substring(1));
   is(parsed.b.key, 'value', 'JSON not parsed correctly');
 
-  // Tests nsLocation::GetHash
+  // Tests Location::GetHash
 
   window.history.pushState(1, document.title, '#q=♥â¥#hello');
   is(location.hash,'#q=♥â¥#hello', 'Unexpected location hash');
 
   window.history.pushState(1, document.title, '#q=%E2%99%A5%C3%A2%C2%A5');
   is(location.hash,'#q=%E2%99%A5%C3%A2%C2%A5', 'Unexpected location hash');
 
   window.history.pushState(1, document.title, '#/search/%23important');
--- a/dom/media/WebVTTListener.cpp
+++ b/dom/media/WebVTTListener.cpp
@@ -155,17 +155,17 @@ WebVTTListener::OnDataAvailable(nsIReque
 
 NS_IMETHODIMP
 WebVTTListener::OnCue(JS::Handle<JS::Value> aCue, JSContext* aCx)
 {
   if (!aCue.isObject()) {
     return NS_ERROR_FAILURE;
   }
 
-  TextTrackCue* cue;
+  TextTrackCue* cue = nullptr;
   nsresult rv = UNWRAP_OBJECT(VTTCue, &aCue.toObject(), cue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   cue->SetTrackElement(mElement);
   mElement->mTrack->AddCue(*cue);
 
   return NS_OK;
 }
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -434,17 +434,17 @@ function(peer, desc, stateExpected) {
 /**
  * Adds and removes steps to/from the execution chain based on the configured
  * testOptions.
  */
 PeerConnectionTest.prototype.updateChainSteps = function() {
   if (this.testOptions.h264) {
     this.chain.insertAfterEach(
       'PC_LOCAL_CREATE_OFFER',
-      [PC_LOCAL_REMOVE_VP8_FROM_OFFER]);
+      [PC_LOCAL_REMOVE_ALL_BUT_H264_FROM_OFFER]);
   }
   if (!this.testOptions.bundle) {
     this.chain.insertAfterEach(
       'PC_LOCAL_CREATE_OFFER',
       [PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER]);
   }
   if (!this.testOptions.rtcpmux) {
     this.chain.insertAfterEach(
--- a/dom/media/tests/mochitest/sdpUtils.js
+++ b/dom/media/tests/mochitest/sdpUtils.js
@@ -19,26 +19,24 @@ checkSdpAfterEndOfTrickle: function(sdp,
 
 // takes sdp in string form (or possibly a fragment, say an m-section), and
 // verifies that the default 0.0.0.0 addr is not present.
 checkSdpCLineNotDefault: function(sdpStr, label) {
   info("CLINE-NO-DEFAULT-ADDR-SDP: " + JSON.stringify(sdpStr));
   ok(!sdpStr.includes("c=IN IP4 0.0.0.0"), label + ": SDP contains non-zero IP c line");
 },
 
-// Also remove mode 0 if it's offered
 // Note, we don't bother removing the fmtp lines, which makes a good test
-// for some SDP parsing issues.
-removeVP8: function(sdp) {
-  var updated_sdp = sdp.replace("a=rtpmap:120 VP8/90000\r\n","");
-  updated_sdp = updated_sdp.replace("RTP/SAVPF 120 126 97\r\n","RTP/SAVPF 126 97\r\n");
-  updated_sdp = updated_sdp.replace("RTP/SAVPF 120 126\r\n","RTP/SAVPF 126\r\n");
-  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 nack\r\n","");
-  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 nack pli\r\n","");
-  updated_sdp = updated_sdp.replace("a=rtcp-fb:120 ccm fir\r\n","");
+// for some SDP parsing issues.  It would be good to have a "removeAllButCodec(sdp, codec)" too.
+removeCodec: function(sdp, codec) {
+    var updated_sdp = sdp.replace(new RegExp("a=rtpmap:" + codec + ".*\\/90000\\r\\n",""),"");
+    updated_sdp = updated_sdp.replace(new RegExp("(RTP\\/SAVPF.*)( " + codec + ")(.*\\r\\n)",""),"$1$3");
+    updated_sdp = updated_sdp.replace(new RegExp("a=rtcp-fb:" + codec + " nack\\r\\n",""),"");
+    updated_sdp = updated_sdp.replace(new RegExp("a=rtcp-fb:" + codec + " nack pli\\r\\n",""),"");
+    updated_sdp = updated_sdp.replace(new RegExp("a=rtcp-fb:" + codec + " ccm fir\\r\\n",""),"");
   return updated_sdp;
 },
 
 removeRtcpMux: function(sdp) {
   return sdp.replace(/a=rtcp-mux\r\n/g,"");
 },
 
 removeBundle: function(sdp) {
@@ -120,17 +118,18 @@ verifySdp: function(desc, expectedType, 
   info("expected video tracks: " + videoTracks);
   if (videoTracks == 0) {
     ok(!desc.sdp.includes("m=video"), "video m-line is absent from SDP");
   } else {
     ok(desc.sdp.includes("m=video"), "video m-line is present in SDP");
     if (testOptions.h264) {
       ok(desc.sdp.includes("a=rtpmap:126 H264/90000"), "H.264 codec is present in SDP");
     } else {
-      ok(desc.sdp.includes("a=rtpmap:120 VP8/90000"), "VP8 codec is present in SDP");
+	ok(desc.sdp.includes("a=rtpmap:120 VP8/90000") ||
+	   desc.sdp.includes("a=rtpmap:121 VP9/90000"), "VP8 or VP9 codec is present in SDP");
     }
     is(testOptions.rtcpmux, desc.sdp.includes("a=rtcp-mux"), "RTCP Mux is offered in SDP");
   }
 
   return requiresTrickleIce;
 },
 
 /**
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -502,19 +502,20 @@ var commandsPeerConnectionOfferAnswer = 
         Promise.reject("No SDP")
       ])
       .then(sdp => sdputils.checkSdpAfterEndOfTrickle(sdp, test.testOptions, test.pcRemote.label),
             () => info("pcRemote: Gathering is not complete yet, skipping post-gathering SDP check"));
     }
   }
 ];
 
-function PC_LOCAL_REMOVE_VP8_FROM_OFFER(test) {
+function PC_LOCAL_REMOVE_ALL_BUT_H264_FROM_OFFER(test) {
   isnot(test.originalOffer.sdp.search("H264/90000"), -1, "H.264 should be present in the SDP offer");
-  test.originalOffer.sdp = sdputils.removeVP8(test.originalOffer.sdp);
+    test.originalOffer.sdp = sdputils.removeCodec(sdputils.removeCodec(sdputils.removeCodec(
+	test.originalOffer.sdp, 120), 121, 97));
   info("Updated H264 only offer: " + JSON.stringify(test.originalOffer));
 };
 
 function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) {
   test.originalOffer.sdp = sdputils.removeBundle(test.originalOffer.sdp);
   info("Updated no bundle offer: " + JSON.stringify(test.originalOffer));
 };
 
--- a/dom/media/tests/mochitest/test_peerConnection_scaleResolution.html
+++ b/dom/media/tests/mochitest/test_peerConnection_scaleResolution.html
@@ -11,31 +11,33 @@
     title: "Scale resolution down on a PeerConnection",
     visible: true
   });
 
   var mustRejectWith = (msg, reason, f) =>
     f().then(() => ok(false, msg),
              e => is(e.name, reason, msg));
 
-  var removeVP8 = d => (d.sdp = d.sdp.replace("a=rtpmap:120 VP8/90000\r\n", ""), d);
+  var removeAllButCodec = (d, codec) =>
+    (d.sdp = d.sdp.replace(/m=video (\w) UDP\/TLS\/RTP\/SAVPF \w.*\r\n/,
+                           "m=video $1 UDP/TLS/RTP/SAVPF " + codec + "\r\n"), d);
 
   function testScale(codec) {
     var pc1 = new RTCPeerConnection();
     var pc2 = new RTCPeerConnection();
 
     var add = (pc, can, failed) => can && pc.addIceCandidate(can).catch(failed);
     pc1.onicecandidate = e => add(pc2, e.candidate, generateErrorCallback());
     pc2.onicecandidate = e => add(pc1, e.candidate, generateErrorCallback());
 
     info("testing scaling with " + codec);
 
     pc1.onnegotiationneeded = e =>
       pc1.createOffer()
-      .then(d => pc1.setLocalDescription(codec == "VP8" ? d : removeVP8(d)))
+      .then(d => pc1.setLocalDescription(codec == "VP8" ? d : removeAllButCodec(d, 126)))
       .then(() => pc2.setRemoteDescription(pc1.localDescription))
       .then(() => pc2.createAnswer()).then(d => pc2.setLocalDescription(d))
       .then(() => pc1.setRemoteDescription(pc2.localDescription))
       .catch(generateErrorCallback());
 
     return navigator.mediaDevices.getUserMedia({ video: true })
     .then(stream => {
       var v1 = createMediaElement('video', 'v1');
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -821,17 +821,17 @@ mount_operation_ask_password (GMountOper
     return;
   }
   nsAutoString nsmessage;
 
   if (flags & G_ASK_PASSWORD_NEED_PASSWORD) {
     if (flags & G_ASK_PASSWORD_NEED_USERNAME) {
       if (!realm.IsEmpty()) {
         const char16_t *strings[] = { realm.get(), dispHost.get() };
-        bundle->FormatStringFromName(u"EnterLoginForRealm2",
+        bundle->FormatStringFromName(u"EnterLoginForRealm3",
                                      strings, 2, getter_Copies(nsmessage));
       } else {
         const char16_t *strings[] = { dispHost.get() };
         bundle->FormatStringFromName(u"EnterUserPasswordFor2",
                                      strings, 1, getter_Copies(nsmessage));
       }
     } else {
       NS_ConvertUTF8toUTF16 userName(default_user);
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -22,16 +22,17 @@
 
 #if defined(WIN32)
 #include "ScaledFontWin.h"
 #include "NativeFontResourceGDI.h"
 #endif
 
 #ifdef XP_DARWIN
 #include "ScaledFontMac.h"
+#include "NativeFontResourceMac.h"
 #endif
 
 #ifdef MOZ_WIDGET_GTK
 #include "ScaledFontFontconfig.h"
 #endif
 
 #ifdef XP_DARWIN
 #include "DrawTargetCG.h"
@@ -543,16 +544,18 @@ Factory::CreateNativeFontResource(uint8_
 #ifdef WIN32
       if (GetDirect3D11Device()) {
         return NativeFontResourceDWrite::Create(aData, aSize,
                                                 /* aNeedsCairo = */ true);
       } else {
         return NativeFontResourceGDI::Create(aData, aSize,
                                              /* aNeedsCairo = */ true);
       }
+#elif XP_DARWIN
+      return NativeFontResourceMac::Create(aData, aSize);
 #else
       gfxWarning() << "Unable to create cairo scaled font from truetype data";
       return nullptr;
 #endif
     }
   default:
     gfxWarning() << "Unable to create requested font resource from truetype data";
     return nullptr;
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -123,16 +123,17 @@ enum class LogReason : int {
   TextureAliveAfterShutdown,
   InvalidContext,
   InvalidCommandList,
   AsyncTransactionTimeout, // 30
   TextureCreation,
   InvalidCacheSurface,
   AlphaWithBasicClient,
   UnbalancedClipStack,
+  ProcessingError,
   // End
   MustBeLessThanThis = 101,
 };
 
 struct BasicLogger
 {
   // For efficiency, this method exists and copies the logic of the
   // OutputMessage below.  If making any changes here, also make it
new file mode 100644
--- /dev/null
+++ b/gfx/2d/NativeFontResourceMac.cpp
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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 "NativeFontResourceMac.h"
+#include "Types.h"
+
+#include "mozilla/RefPtr.h"
+
+#ifdef MOZ_WIDGET_UIKIT
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
+namespace mozilla {
+namespace gfx {
+
+/* static */
+already_AddRefed<NativeFontResourceMac>
+NativeFontResourceMac::Create(uint8_t *aFontData, uint32_t aDataLength)
+{
+  // copy font data
+  CFDataRef data = CFDataCreate(kCFAllocatorDefault, aFontData, aDataLength);
+  if (!data) {
+    return nullptr;
+  }
+
+  // create a provider
+  CGDataProviderRef provider = CGDataProviderCreateWithCFData(data);
+
+  // release our reference to the CFData, provider keeps it alive
+  CFRelease(data);
+
+  // create the font object
+  CGFontRef fontRef = CGFontCreateWithDataProvider(provider);
+
+  // release our reference, font will keep it alive as long as needed
+  CGDataProviderRelease(provider);
+
+  if (!fontRef) {
+    return nullptr;
+  }
+
+  // passes ownership of fontRef to the NativeFontResourceMac instance
+  RefPtr<NativeFontResourceMac> fontResource =
+    new NativeFontResourceMac(fontRef);
+
+  return fontResource.forget();
+}
+
+already_AddRefed<ScaledFont>
+NativeFontResourceMac::CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize)
+{
+  RefPtr<ScaledFontBase> scaledFont = new ScaledFontMac(mFontRef, aGlyphSize);
+
+  if (!scaledFont->PopulateCairoScaledFont()) {
+    gfxWarning() << "Unable to create cairo scaled Mac font.";
+    return nullptr;
+  }
+
+  return scaledFont.forget();
+}
+
+} // gfx
+} // mozilla
new file mode 100644
--- /dev/null
+++ b/gfx/2d/NativeFontResourceMac.h
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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/. */
+
+#ifndef mozilla_gfx_NativeFontResourceMac_h
+#define mozilla_gfx_NativeFontResourceMac_h
+
+#include "2D.h"
+#include "mozilla/AlreadyAddRefed.h"
+#include "ScaledFontMac.h"
+
+namespace mozilla {
+namespace gfx {
+
+class NativeFontResourceMac final : public NativeFontResource
+{
+public:
+  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceMac)
+
+  static already_AddRefed<NativeFontResourceMac>
+    Create(uint8_t *aFontData, uint32_t aDataLength);
+
+  already_AddRefed<ScaledFont>
+    CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize);
+
+  ~NativeFontResourceMac()
+  {
+    CFRelease(mFontRef);
+  }
+
+private:
+  explicit NativeFontResourceMac(CGFontRef aFontRef) : mFontRef(aFontRef) {}
+
+  CGFontRef mFontRef;
+};
+
+} // gfx
+} // mozilla
+
+#endif // mozilla_gfx_NativeFontResourceMac_h
--- a/gfx/2d/RecordedEvent.cpp
+++ b/gfx/2d/RecordedEvent.cpp
@@ -1514,16 +1514,20 @@ RecordedFontData::~RecordedFontData()
 }
 
 bool
 RecordedFontData::PlayEvent(Translator *aTranslator) const
 {
   RefPtr<NativeFontResource> fontResource =
     Factory::CreateNativeFontResource(mData, mFontDetails.size,
                                       aTranslator->GetDesiredFontType());
+  if (!fontResource) {
+    return false;
+  }
+
   aTranslator->AddNativeFontResource(mFontDetails.fontDataKey, fontResource);
   return true;
 }
 
 void
 RecordedFontData::RecordToStream(std::ostream &aStream) const
 {
   MOZ_ASSERT(mGetFontFileDataSucceeded);
--- a/gfx/2d/SFNTNameTable.cpp
+++ b/gfx/2d/SFNTNameTable.cpp
@@ -5,16 +5,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SFNTNameTable.h"
 
 #include "BigEndianInts.h"
 #include "Logging.h"
 #include "mozilla/Move.h"
 
+#if defined(XP_MACOSX)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
 namespace mozilla {
 namespace gfx {
 
 static const BigEndianUint16 FORMAT_0 = 0;
 
 static const BigEndianUint16 NAME_ID_FAMILY = 1;
 static const BigEndianUint16 NAME_ID_STYLE = 2;
 static const BigEndianUint16 NAME_ID_FULL = 4;
@@ -22,16 +26,18 @@ static const BigEndianUint16 NAME_ID_FUL
 static const BigEndianUint16 PLATFORM_ID_UNICODE = 0;
 static const BigEndianUint16 PLATFORM_ID_MAC = 1;
 static const BigEndianUint16 PLATFORM_ID_MICROSOFT = 3;
 
 static const BigEndianUint16 ENCODING_ID_MICROSOFT_SYMBOL = 0;
 static const BigEndianUint16 ENCODING_ID_MICROSOFT_UNICODEBMP = 1;
 static const BigEndianUint16 ENCODING_ID_MICROSOFT_UNICODEFULL = 10;
 
+static const BigEndianUint16 ENCODING_ID_MAC_ROMAN = 0;
+
 static const BigEndianUint16 LANG_ID_MAC_ENGLISH = 0;
 
 static const BigEndianUint16 LANG_ID_MICROSOFT_EN_US = 0x0409;
 
 #pragma pack(push, 1)
 
 // Name table has a header, followed by name records, followed by string data.
 struct NameHeader
@@ -48,16 +54,25 @@ struct NameRecord
   BigEndianUint16 languageID;
   BigEndianUint16 nameID;
   BigEndianUint16 length;     // String length in bytes.
   BigEndianUint16 offset;     // String offset from start of storage in bytes.
 };
 
 #pragma pack(pop)
 
+enum ENameDecoder : int
+{
+  eNameDecoderUTF16,
+#if defined(XP_MACOSX)
+  eNameDecoderMacRoman,
+#endif
+  eNameDecoderNone
+};
+
 /* static */
 UniquePtr<SFNTNameTable>
 SFNTNameTable::Create(const uint8_t *aNameData, uint32_t aDataLength)
 {
   MOZ_ASSERT(aNameData);
 
   if (aDataLength < sizeof(NameHeader)) {
     gfxWarning() << "Name data too short to contain NameHeader.";
@@ -93,111 +108,137 @@ SFNTNameTable::SFNTNameTable(const NameH
                                                      + sizeof(NameHeader)))
   , mEndOfRecords(mFirstRecord + aNameHeader->count)
   , mStringData(aNameData + aNameHeader->stringOffset)
   , mStringDataLength(aDataLength - aNameHeader->stringOffset)
 {
   MOZ_ASSERT(reinterpret_cast<const uint8_t*>(aNameHeader) == aNameData);
 }
 
-#if defined(XP_MACOSX)
-static const BigEndianUint16 CANONICAL_LANG_ID = LANG_ID_MAC_ENGLISH;
-static const BigEndianUint16 PLATFORM_ID = PLATFORM_ID_MAC;
-#else
-static const BigEndianUint16 CANONICAL_LANG_ID = LANG_ID_MICROSOFT_EN_US;
-static const BigEndianUint16 PLATFORM_ID = PLATFORM_ID_MICROSOFT;
-#endif
-
 static bool
 IsUTF16Encoding(const NameRecord *aNameRecord)
 {
   if (aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
       (aNameRecord->encodingID == ENCODING_ID_MICROSOFT_UNICODEBMP ||
        aNameRecord->encodingID == ENCODING_ID_MICROSOFT_SYMBOL)) {
     return true;
   }
 
   if (aNameRecord->platformID == PLATFORM_ID_UNICODE) {
     return true;
   }
 
   return false;
 }
 
+#if defined(XP_MACOSX)
+static bool
+IsMacRomanEncoding(const NameRecord *aNameRecord)
+{
+  if (aNameRecord->platformID == PLATFORM_ID_MAC &&
+      aNameRecord->encodingID == ENCODING_ID_MAC_ROMAN) {
+    return true;
+  }
+
+  return false;
+}
+#endif
+
 static NameRecordMatchers*
-CreateCanonicalU16Matchers(const BigEndianUint16& aNameID)
+CreateCanonicalMatchers(const BigEndianUint16& aNameID)
 {
+  // For Windows, we return only Microsoft platform name record
+  // matchers. On Mac, we return matchers for both Microsoft platform
+  // records and Mac platform records.
   NameRecordMatchers *matchers = new NameRecordMatchers();
 
-  // First, look for the English name (this will normally succeed).
+#if defined(XP_MACOSX)
+  // First, look for the English name.
   if (!matchers->append(
     [=](const NameRecord *aNameRecord) {
-        return aNameRecord->nameID == aNameID &&
-               aNameRecord->languageID == CANONICAL_LANG_ID &&
-               aNameRecord->platformID == PLATFORM_ID &&
-               IsUTF16Encoding(aNameRecord);
+        if (aNameRecord->nameID == aNameID &&
+            aNameRecord->languageID == LANG_ID_MAC_ENGLISH &&
+            aNameRecord->platformID == PLATFORM_ID_MAC &&
+            IsMacRomanEncoding(aNameRecord)) {
+          return eNameDecoderMacRoman;
+        } else  {
+          return eNameDecoderNone;
+        }
     })) {
     MOZ_CRASH();
   }
 
   // Second, look for all languages.
   if (!matchers->append(
     [=](const NameRecord *aNameRecord) {
-        return aNameRecord->nameID == aNameID &&
-               aNameRecord->platformID == PLATFORM_ID &&
-               IsUTF16Encoding(aNameRecord);
+        if (aNameRecord->nameID == aNameID &&
+            aNameRecord->platformID == PLATFORM_ID_MAC &&
+            IsMacRomanEncoding(aNameRecord)) {
+          return eNameDecoderMacRoman;
+        } else  {
+          return eNameDecoderNone;
+        }
+    })) {
+    MOZ_CRASH();
+  }
+#endif /* defined(XP_MACOSX) */
+
+  // First, look for the English name (this will normally succeed).
+  if (!matchers->append(
+    [=](const NameRecord *aNameRecord) {
+        if (aNameRecord->nameID == aNameID &&
+            aNameRecord->languageID == LANG_ID_MICROSOFT_EN_US &&
+            aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
+            IsUTF16Encoding(aNameRecord)) {
+          return eNameDecoderUTF16;
+        } else {
+          return eNameDecoderNone;
+        }
     })) {
     MOZ_CRASH();
   }
 
-#if defined(XP_MACOSX)
-  // On Mac may be dealing with font that only has Microsoft name entries.
+  // Second, look for all languages.
   if (!matchers->append(
     [=](const NameRecord *aNameRecord) {
-        return aNameRecord->nameID == aNameID &&
-               aNameRecord->languageID == LANG_ID_MICROSOFT_EN_US &&
-               aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
-               IsUTF16Encoding(aNameRecord);
+        if (aNameRecord->nameID == aNameID &&
+            aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
+            IsUTF16Encoding(aNameRecord)) {
+          return eNameDecoderUTF16;
+        } else {
+          return eNameDecoderNone;
+        }
     })) {
     MOZ_CRASH();
   }
-  if (!matchers->append(
-    [=](const NameRecord *aNameRecord) {
-        return aNameRecord->nameID == aNameID &&
-               aNameRecord->platformID == PLATFORM_ID_MICROSOFT &&
-               IsUTF16Encoding(aNameRecord);
-    })) {
-    MOZ_CRASH();
-  }
-#endif
 
   return matchers;
 }
 
 static const NameRecordMatchers&
 FullNameMatchers()
 {
   static const NameRecordMatchers *sFullNameMatchers =
-    CreateCanonicalU16Matchers(NAME_ID_FULL);
+    CreateCanonicalMatchers(NAME_ID_FULL);
   return *sFullNameMatchers;
 }
 
 static const NameRecordMatchers&
 FamilyMatchers()
 {
   static const NameRecordMatchers *sFamilyMatchers =
-    CreateCanonicalU16Matchers(NAME_ID_FAMILY);
+    CreateCanonicalMatchers(NAME_ID_FAMILY);
   return *sFamilyMatchers;
 }
 
 static const NameRecordMatchers&
 StyleMatchers()
 {
   static const NameRecordMatchers *sStyleMatchers =
-    CreateCanonicalU16Matchers(NAME_ID_STYLE);
+    CreateCanonicalMatchers(NAME_ID_STYLE);
   return *sStyleMatchers;
 }
 
 bool
 SFNTNameTable::GetU16FullName(mozilla::u16string& aU16FullName)
 {
   if (ReadU16Name(FullNameMatchers(), aU16FullName)) {
     return true;
@@ -225,29 +266,39 @@ bool
 SFNTNameTable::ReadU16Name(const NameRecordMatchers& aMatchers,
                            mozilla::u16string& aU16Name)
 {
   MOZ_ASSERT(!aMatchers.empty());
 
   for (size_t i = 0; i < aMatchers.length(); ++i) {
     const NameRecord* record = mFirstRecord;
     while (record != mEndOfRecords) {
-      if (aMatchers[i](record)) {
-        return ReadU16NameFromRecord(record, aU16Name);
+      switch (aMatchers[i](record)) {
+        case eNameDecoderUTF16:
+          return ReadU16NameFromU16Record(record, aU16Name);
+#if defined(XP_MACOSX)
+        case eNameDecoderMacRoman:
+          return ReadU16NameFromMacRomanRecord(record, aU16Name);
+#endif
+        case eNameDecoderNone:
+          break;
+        default:
+          MOZ_CRASH("Invalid matcher encoding type");
+          break;
       }
       ++record;
     }
   }
 
   return false;
 }
 
 bool
-SFNTNameTable::ReadU16NameFromRecord(const NameRecord *aNameRecord,
-                                     mozilla::u16string& aU16Name)
+SFNTNameTable::ReadU16NameFromU16Record(const NameRecord *aNameRecord,
+                                        mozilla::u16string& aU16Name)
 {
   uint32_t offset = aNameRecord->offset;
   uint32_t length = aNameRecord->length;
   if (mStringDataLength < offset + length) {
     gfxWarning() << "Name data too short to contain name string.";
     return false;
   }
 
@@ -256,10 +307,51 @@ SFNTNameTable::ReadU16NameFromRecord(con
   UniquePtr<char16_t[]> nameData(new char16_t[actualLength]);
   NativeEndian::copyAndSwapFromBigEndian(nameData.get(), startOfName,
                                          actualLength);
 
   aU16Name.assign(nameData.get(), actualLength);
   return true;
 }
 
+#if defined(XP_MACOSX)
+bool
+SFNTNameTable::ReadU16NameFromMacRomanRecord(const NameRecord *aNameRecord,
+                                             mozilla::u16string& aU16Name)
+{
+  uint32_t offset = aNameRecord->offset;
+  uint32_t length = aNameRecord->length;
+  if (mStringDataLength < offset + length) {
+    gfxWarning() << "Name data too short to contain name string.";
+    return false;
+  }
+  if (length > INT_MAX) {
+    gfxWarning() << "Name record too long to decode.";
+    return false;
+  }
+
+  // pointer to the Mac Roman encoded string in the name record
+  const uint8_t *encodedStr = mStringData + offset;
+
+  CFStringRef cfString;
+  cfString = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, encodedStr,
+                                           length, kCFStringEncodingMacRoman,
+                                           false, kCFAllocatorNull);
+
+  // length (in UTF-16 code pairs) of the decoded string
+  CFIndex decodedLength = CFStringGetLength(cfString);
+
+  // temporary buffer
+  UniquePtr<UniChar[]> u16Buffer = MakeUnique<UniChar[]>(decodedLength);
+
+  CFStringGetCharacters(cfString, CFRangeMake(0, decodedLength),
+                        u16Buffer.get());
+
+  CFRelease(cfString);
+
+  aU16Name.assign(reinterpret_cast<char16_t*>(u16Buffer.get()), decodedLength);
+
+  return true;
+}
+#endif
+
 } // gfx
 } // mozilla
--- a/gfx/2d/SFNTNameTable.h
+++ b/gfx/2d/SFNTNameTable.h
@@ -12,18 +12,19 @@
 #include "mozilla/Vector.h"
 #include "u16string.h"
 
 namespace mozilla {
 namespace gfx {
 
 struct NameHeader;
 struct NameRecord;
+enum ENameDecoder : int;
 
-typedef Vector<function<bool(const NameRecord*)>> NameRecordMatchers;
+typedef Vector<function<ENameDecoder(const NameRecord*)>> NameRecordMatchers;
 
 class SFNTNameTable final
 {
 public:
 
   /**
    * Creates a SFNTNameTable if the header data is valid. Note that the data is
    * NOT copied, so must exist for the lifetime of the table.
@@ -33,32 +34,37 @@ public:
    * @return UniquePtr to a SFNTNameTable or nullptr if the header is invalid.
    */
   static UniquePtr<SFNTNameTable> Create(const uint8_t *aNameData,
                                          uint32_t aDataLength);
 
   /**
    * Gets the full name from the name table. If the full name string is not
    * present it will use the family space concatenated with the style.
-   * This will only read names that are already UTF16.
+   * This will only read names that are already UTF16 or Mac OS Roman.
    *
    * @param aU16FullName string to be populated with the full name.
    * @return true if the full name is successfully read.
    */
   bool GetU16FullName(mozilla::u16string& aU16FullName);
 
 private:
 
   SFNTNameTable(const NameHeader *aNameHeader, const uint8_t *aNameData,
                 uint32_t aDataLength);
 
   bool ReadU16Name(const NameRecordMatchers& aMatchers, mozilla::u16string& aU16Name);
 
-  bool ReadU16NameFromRecord(const NameRecord *aNameRecord,
-                             mozilla::u16string& aU16Name);
+  bool ReadU16NameFromU16Record(const NameRecord *aNameRecord,
+                                mozilla::u16string& aU16Name);
+
+#if defined(XP_MACOSX)
+  bool ReadU16NameFromMacRomanRecord(const NameRecord *aNameRecord,
+                                     mozilla::u16string& aU16Name);
+#endif
 
   const NameRecord *mFirstRecord;
   const NameRecord *mEndOfRecords;
   const uint8_t *mStringData;
   const uint32_t mStringDataLength;
 };
 
 } // gfx
--- a/gfx/2d/ScaledFontMac.cpp
+++ b/gfx/2d/ScaledFontMac.cpp
@@ -19,16 +19,19 @@
 
 #ifdef MOZ_WIDGET_COCOA
 // prototype for private API
 extern "C" {
 CGPathRef CGFontGetGlyphPath(CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph);
 };
 #endif
 
+#ifdef USE_CAIRO_SCALED_FONT
+#include "cairo-quartz.h"
+#endif
 
 namespace mozilla {
 namespace gfx {
 
 ScaledFontMac::CTFontDrawGlyphsFuncT* ScaledFontMac::CTFontDrawGlyphsPtr = nullptr;
 bool ScaledFontMac::sSymbolLookupDone = false;
 
 ScaledFontMac::ScaledFontMac(CGFontRef aFont, Float aSize)
@@ -279,10 +282,19 @@ ScaledFontMac::GetFontFileData(FontFileD
 
     // we always use an index of 0
     aDataCallback(buf.data, buf.offset, 0, mSize, aBaton);
 
     return true;
 
 }
 
+#ifdef USE_CAIRO_SCALED_FONT
+cairo_font_face_t*
+ScaledFontMac::GetCairoFontFace()
+{
+  MOZ_ASSERT(mFont);
+  return cairo_quartz_font_face_create_for_cgfont(mFont);
+}
+#endif
+
 } // namespace gfx
 } // namespace mozilla
--- a/gfx/2d/ScaledFontMac.h
+++ b/gfx/2d/ScaledFontMac.h
@@ -30,16 +30,20 @@ public:
   virtual FontType GetType() const { return FontType::MAC; }
 #ifdef USE_SKIA
   virtual SkTypeface* GetSkTypeface();
 #endif
   virtual already_AddRefed<Path> GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget);
   virtual void CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint);
   virtual bool GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton);
 
+#ifdef USE_CAIRO_SCALED_FONT
+  cairo_font_face_t* GetCairoFontFace();
+#endif
+
 private:
   friend class DrawTargetCG;
   friend class DrawTargetSkia;
   CGFontRef mFont;
   CTFontRef mCTFont; // only created if CTFontDrawGlyphs is available, otherwise null
 
   typedef void (CTFontDrawGlyphsFuncT)(CTFontRef,
                                        const CGGlyph[], const CGPoint[],
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -59,16 +59,17 @@ EXPORTS.mozilla.gfx += [
 EXPORTS.mozilla.gfx += ['ssse3-scaler.h']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
     EXPORTS.mozilla.gfx += [
         'MacIOSurface.h',
     ]
     UNIFIED_SOURCES += [
         'DrawTargetCG.cpp',
+        'NativeFontResourceMac.cpp',
         'PathCG.cpp',
         'ScaledFontMac.cpp',
         'SourceSurfaceCG.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     SOURCES += [
         'DrawTargetD2D1.cpp',
         'ExtendInputEffectD2D1.cpp',
--- a/gfx/layers/IPDLActor.h
+++ b/gfx/layers/IPDLActor.h
@@ -110,37 +110,29 @@ public:
 
   bool CanSend() const { return !mDestroyed; }
 
   // Override this rather than ActorDestroy
   virtual void Destroy() {}
 
   virtual bool RecvDestroy() override
   {
-    if (!mDestroyed) {
-      Destroy();
-      mDestroyed = true;
-    }
+    DestroyIfNeeded();
     Unused << Protocol::Send__delete__(this);
     return true;
   }
 
-  virtual bool RecvDestroySync() override
-  {
-    if (!mDestroyed) {
-      Destroy();
-      mDestroyed = true;
-    }
-    return true;
-  }
-
   typedef ipc::IProtocolManager<ipc::IProtocol>::ActorDestroyReason Why;
 
-  virtual void ActorDestroy(Why) override
-  {
+  virtual void ActorDestroy(Why) override {
+    DestroyIfNeeded();
+  }
+
+protected:
+  void DestroyIfNeeded() {
     if (!mDestroyed) {
       Destroy();
       mDestroyed = true;
     }
   }
 
 private:
   bool mDestroyed;
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -197,25 +197,28 @@ LayerManager::CreateDrawTarget(const Int
                                SurfaceFormat aFormat)
 {
   return gfxPlatform::GetPlatform()->
     CreateOffscreenCanvasDrawTarget(aSize, aFormat);
 }
 
 already_AddRefed<PersistentBufferProvider>
 LayerManager::CreatePersistentBufferProvider(const mozilla::gfx::IntSize &aSize,
-                                             mozilla::gfx::SurfaceFormat aFormat)
+                                             mozilla::gfx::SurfaceFormat aFormat,
+                                             int64_t* aMemoryCounter)
 {
   RefPtr<PersistentBufferProviderBasic> bufferProvider =
     PersistentBufferProviderBasic::Create(aSize, aFormat,
-      gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
+      gfxPlatform::GetPlatform()->GetPreferredCanvasBackend(),
+      aMemoryCounter
+    );
 
   if (!bufferProvider) {
     bufferProvider = PersistentBufferProviderBasic::Create(aSize, aFormat,
-      gfxPlatform::GetPlatform()->GetFallbackCanvasBackend());
+      gfxPlatform::GetPlatform()->GetFallbackCanvasBackend(), aMemoryCounter);
   }
 
   return bufferProvider.forget();
 }
 
 #ifdef DEBUG
 void
 LayerManager::Mutated(Layer* aLayer)
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -480,17 +480,18 @@ public:
                      mozilla::gfx::SurfaceFormat aFormat);
 
   /**
    * Creates a PersistentBufferProvider for use with canvas which is optimized for
    * inter-operating with this layermanager.
    */
   virtual already_AddRefed<PersistentBufferProvider>
     CreatePersistentBufferProvider(const mozilla::gfx::IntSize &aSize,
-                                   mozilla::gfx::SurfaceFormat aFormat);
+                                   mozilla::gfx::SurfaceFormat aFormat,
+                                   int64_t* aMemoryCounter);
 
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) { return true; }
 
   /**
    * returns the maximum texture size on this layer backend, or INT32_MAX
    * if there is no maximum
    */
   virtual int32_t GetMaxTextureSize() const = 0;
--- a/gfx/layers/PersistentBufferProvider.cpp
+++ b/gfx/layers/PersistentBufferProvider.cpp
@@ -11,24 +11,33 @@
 #include "gfxPlatform.h"
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
-PersistentBufferProviderBasic::PersistentBufferProviderBasic(DrawTarget* aDt)
+PersistentBufferProviderBasic::PersistentBufferProviderBasic(DrawTarget* aDt, int64_t* aMemoryCounter)
 : mDrawTarget(aDt)
+, mMemoryCounter(aMemoryCounter)
 {
+  if (mMemoryCounter) {
+    IntSize size = mDrawTarget->GetSize();
+    *mMemoryCounter += size.width * size.height * gfx::BytesPerPixel(mDrawTarget->GetFormat());
+  }
   MOZ_COUNT_CTOR(PersistentBufferProviderBasic);
 }
 
 PersistentBufferProviderBasic::~PersistentBufferProviderBasic()
 {
+  if (mMemoryCounter) {
+    IntSize size = mDrawTarget->GetSize();
+    *mMemoryCounter -= size.width * size.height * gfx::BytesPerPixel(mDrawTarget->GetFormat());
+  }
   MOZ_COUNT_DTOR(PersistentBufferProviderBasic);
 }
 
 already_AddRefed<gfx::DrawTarget>
 PersistentBufferProviderBasic::BorrowDrawTarget(const gfx::IntRect& aPersistedRect)
 {
   MOZ_ASSERT(!mSnapshot);
   RefPtr<gfx::DrawTarget> dt(mDrawTarget);
@@ -62,36 +71,37 @@ PersistentBufferProviderBasic::ReturnSna
   RefPtr<SourceSurface> snapshot = aSnapshot;
   MOZ_ASSERT(!snapshot || snapshot == mSnapshot);
   mSnapshot = nullptr;
 }
 
 //static
 already_AddRefed<PersistentBufferProviderBasic>
 PersistentBufferProviderBasic::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
-                                      gfx::BackendType aBackend)
+                                      gfx::BackendType aBackend, int64_t* aMemoryCounter)
 {
   RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend(aBackend, aSize, aFormat);
 
   if (!dt) {
     return nullptr;
   }
 
   RefPtr<PersistentBufferProviderBasic> provider =
-    new PersistentBufferProviderBasic(dt);
+    new PersistentBufferProviderBasic(dt, aMemoryCounter);
 
   return provider.forget();
 }
 
 
 //static
 already_AddRefed<PersistentBufferProviderShared>
 PersistentBufferProviderShared::Create(gfx::IntSize aSize,
                                        gfx::SurfaceFormat aFormat,
-                                       CompositableForwarder* aFwd)
+                                       CompositableForwarder* aFwd,
+                                       int64_t* aMemoryCounter)
 {
   if (!aFwd || !aFwd->IPCOpen()) {
     return nullptr;
   }
 
   RefPtr<TextureClient> texture = TextureClient::CreateForDrawing(
     aFwd, aFormat, aSize,
     BackendSelector::Canvas,
@@ -99,33 +109,37 @@ PersistentBufferProviderShared::Create(g
     TextureAllocationFlags::ALLOC_DEFAULT
   );
 
   if (!texture) {
     return nullptr;
   }
 
   RefPtr<PersistentBufferProviderShared> provider =
-    new PersistentBufferProviderShared(aSize, aFormat, aFwd, texture);
+    new PersistentBufferProviderShared(aSize, aFormat, aFwd, texture, aMemoryCounter);
+
   return provider.forget();
 }
 
 PersistentBufferProviderShared::PersistentBufferProviderShared(gfx::IntSize aSize,
                                                                gfx::SurfaceFormat aFormat,
                                                                CompositableForwarder* aFwd,
-                                                               RefPtr<TextureClient>& aTexture)
+                                                               RefPtr<TextureClient>& aTexture,
+                                                               int64_t* aMemoryCounter)
 
 : mSize(aSize)
 , mFormat(aFormat)
 , mFwd(aFwd)
 , mFront(Nothing())
+, mMemoryCounter(aMemoryCounter)
 {
   if (mTextures.append(aTexture)) {
     mBack = Some<uint32_t>(0);
   }
+  OnAllocation();
   MOZ_COUNT_CTOR(PersistentBufferProviderShared);
 }
 
 PersistentBufferProviderShared::~PersistentBufferProviderShared()
 {
   MOZ_COUNT_DTOR(PersistentBufferProviderShared);
 
   if (IsActivityTracked()) {
@@ -288,16 +302,17 @@ PersistentBufferProviderShared::BorrowDr
       mFwd, mFormat, mSize,
       BackendSelector::Canvas,
       TextureFlags::DEFAULT,
       TextureAllocationFlags::ALLOC_DEFAULT
     );
 
     MOZ_ASSERT(newTexture);
     if (newTexture) {
+      OnAllocation();
       if (mTextures.append(newTexture)) {
         tex = newTexture;
         mBack = Some<uint32_t>(mTextures.length() - 1);
       }
     }
   }
 
   if (!tex || !tex->Lock(OpenMode::OPEN_READ_WRITE)) {
@@ -400,46 +415,71 @@ PersistentBufferProviderShared::ReturnSn
 }
 
 void
 PersistentBufferProviderShared::NotifyInactive()
 {
   RefPtr<TextureClient> front = GetTexture(mFront);
   RefPtr<TextureClient> back = GetTexture(mBack);
 
+  for (unsigned i = 0; i < mTextures.length(); ++i) {
+    OnDeallocation();
+  }
+
   // Clear all textures (except the front and back ones that we just kept).
   mTextures.clear();
 
   if (back) {
     if (mTextures.append(back)) {
       mBack = Some<uint32_t>(0);
+      OnAllocation();
     }
     if (front == back) {
       mFront = mBack;
     }
   }
 
   if (front && front != back) {
     if (mTextures.append(front)) {
       mFront = Some<uint32_t>(mTextures.length() - 1);
+      OnAllocation();
     }
   }
 }
 
 void
 PersistentBufferProviderShared::Destroy()
 {
   mSnapshot = nullptr;
   mDrawTarget = nullptr;
 
   for (uint32_t i = 0; i < mTextures.length(); ++i) {
     TextureClient* texture = mTextures[i];
     if (texture && texture->IsLocked()) {
       MOZ_ASSERT(false);
       texture->Unlock();
     }
+    if (texture) {
+      OnDeallocation();
+    }
   }
 
   mTextures.clear();
 }
 
+void
+PersistentBufferProviderShared::OnAllocation()
+{
+  if (mMemoryCounter) {
+    *mMemoryCounter += mSize.width * mSize.height * gfx::BytesPerPixel(mFormat);
+  }
+}
+
+void
+PersistentBufferProviderShared::OnDeallocation()
+{
+  if (mMemoryCounter) {
+    *mMemoryCounter -= mSize.width * mSize.height * gfx::BytesPerPixel(mFormat);
+  }
+}
+
 } // namespace layers
 } // namespace mozilla
\ No newline at end of file
--- a/gfx/layers/PersistentBufferProvider.h
+++ b/gfx/layers/PersistentBufferProvider.h
@@ -77,19 +77,20 @@ public:
 
 
 class PersistentBufferProviderBasic : public PersistentBufferProvider
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PersistentBufferProviderBasic, override)
 
   static already_AddRefed<PersistentBufferProviderBasic>
-  Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::BackendType aBackend);
+  Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::BackendType aBackend,
+         int64_t* aMemoryCounter);
 
-  explicit PersistentBufferProviderBasic(gfx::DrawTarget* aTarget);
+  explicit PersistentBufferProviderBasic(gfx::DrawTarget* aTarget, int64_t* aMemoryCounter = nullptr);
 
   virtual LayersBackend GetType() override { return LayersBackend::LAYERS_BASIC; }
 
   virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget(const gfx::IntRect& aPersistedRect) override;
 
   virtual bool ReturnDrawTarget(already_AddRefed<gfx::DrawTarget> aDT) override;
 
   virtual already_AddRefed<gfx::SourceSurface> BorrowSnapshot() override;
@@ -97,32 +98,34 @@ public:
   virtual void ReturnSnapshot(already_AddRefed<gfx::SourceSurface> aSnapshot) override;
 
   virtual bool PreservesDrawingState() const override { return true; }
 private:
   ~PersistentBufferProviderBasic();
 
   RefPtr<gfx::DrawTarget> mDrawTarget;
   RefPtr<gfx::SourceSurface> mSnapshot;
+  int64_t* mMemoryCounter;
 };
 
 
 /**
  * Provides access to a buffer which can be sent to the compositor without
  * requiring a copy.
  */
 class PersistentBufferProviderShared : public PersistentBufferProvider
                                      , public ActiveResource
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PersistentBufferProviderShared, override)
 
   static already_AddRefed<PersistentBufferProviderShared>
   Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
-         CompositableForwarder* aFwd);
+         CompositableForwarder* aFwd,
+         int64_t* aMemoryCounter);
 
   virtual LayersBackend GetType() override { return LayersBackend::LAYERS_CLIENT; }
 
   virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget(const gfx::IntRect& aPersistedRect) override;
 
   virtual bool ReturnDrawTarget(already_AddRefed<gfx::DrawTarget> aDT) override;
 
   virtual already_AddRefed<gfx::SourceSurface> BorrowSnapshot() override;
@@ -136,36 +139,41 @@ public:
   virtual void OnShutdown() override { Destroy(); }
 
   virtual bool SetForwarder(CompositableForwarder* aFwd) override;
 
   virtual bool PreservesDrawingState() const override { return false; }
 protected:
   PersistentBufferProviderShared(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                                  CompositableForwarder* aFwd,
-                                 RefPtr<TextureClient>& aTexture);
+                                 RefPtr<TextureClient>& aTexture,
+                                 int64_t* aMemoryCounter);
 
   ~PersistentBufferProviderShared();
 
+  void OnAllocation();
+  void OnDeallocation();
+
   TextureClient* GetTexture(Maybe<uint32_t> aIndex);
   bool CheckIndex(uint32_t aIndex) { return aIndex < mTextures.length(); }
 
   void Destroy();
 
   gfx::IntSize mSize;
   gfx::SurfaceFormat mFormat;
   RefPtr<CompositableForwarder> mFwd;
   Vector<RefPtr<TextureClient>, 4> mTextures;
   // Offset of the texture in mTextures that the canvas uses.
   Maybe<uint32_t> mBack;
   // Offset of the texture in mTextures that is presented to the compositor.
   Maybe<uint32_t> mFront;
 
   RefPtr<gfx::DrawTarget> mDrawTarget;
   RefPtr<gfx::SourceSurface > mSnapshot;
+  int64_t* mMemoryCounter;
 };
 
 struct AutoReturnSnapshot
 {
   PersistentBufferProvider* mBufferProvider;
   RefPtr<gfx::SourceSurface>* mSnapshot;
 
   explicit AutoReturnSnapshot(PersistentBufferProvider* aProvider = nullptr)
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -835,32 +835,33 @@ bool
 ClientLayerManager::DependsOnStaleDevice() const
 {
   return gfxPlatform::GetPlatform()->GetDeviceCounter() != mDeviceCounter;
 }
 
 
 already_AddRefed<PersistentBufferProvider>
 ClientLayerManager::CreatePersistentBufferProvider(const gfx::IntSize& aSize,
-                                                   gfx::SurfaceFormat aFormat)
+                                                   gfx::SurfaceFormat aFormat,
+                                                   int64_t* aMemoryCounter)
 {
   // Don't use a shared buffer provider if compositing is considered "not cheap"
   // because the canvas will most likely be flattened into a thebes layer instead
   // of being sent to the compositor, in which case rendering into shared memory
   // is wasteful.
   if (IsCompositingCheap() &&
       gfxPrefs::PersistentBufferProviderSharedEnabled()) {
     RefPtr<PersistentBufferProvider> provider
-      = PersistentBufferProviderShared::Create(aSize, aFormat, AsShadowForwarder());
+      = PersistentBufferProviderShared::Create(aSize, aFormat, AsShadowForwarder(), aMemoryCounter);
     if (provider) {
       return provider.forget();
     }
   }
 
-  return LayerManager::CreatePersistentBufferProvider(aSize, aFormat);
+  return LayerManager::CreatePersistentBufferProvider(aSize, aFormat, aMemoryCounter);
 }
 
 
 ClientLayer::~ClientLayer()
 {
   if (HasShadow()) {
     PLayerChild::Send__delete__(GetShadow());
   }
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -226,17 +226,18 @@ public:
   public:
     virtual void DidComposite() = 0;
   };
 
   void AddDidCompositeObserver(DidCompositeObserver* aObserver);
   void RemoveDidCompositeObserver(DidCompositeObserver* aObserver);
 
   virtual already_AddRefed<PersistentBufferProvider>
-  CreatePersistentBufferProvider(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) override;
+  CreatePersistentBufferProvider(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat,
+                                 int64_t* aMemoryCounter) override;
 
 protected:
   enum TransactionPhase {
     PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
   };
   TransactionPhase mPhase;
 
 private:
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -80,16 +80,21 @@ public:
   virtual bool RecvRecycleTexture(const TextureFlags& aTextureFlags) override;
 
   TextureHost* GetTextureHost() { return mTextureHost; }
 
   virtual void Destroy() override;
 
   uint64_t GetSerial() const { return mSerial; }
 
+  virtual bool RecvDestroySync() override {
+    DestroyIfNeeded();
+    return true;
+  }
+
   HostIPCAllocator* mSurfaceAllocator;
   RefPtr<TextureHost> mTextureHost;
   // mSerial is unique in TextureClient's process.
   const uint64_t mSerial;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 PTextureParent*
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -17,16 +17,17 @@
 #include "mozilla/layers/IAPZCTreeManager.h"
 #include "mozilla/layers/APZCTreeManagerChild.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/layers/PLayerTransactionChild.h"
 #include "mozilla/layers/TextureClient.h"// for TextureClient
 #include "mozilla/layers/TextureClientPool.h"// for TextureClientPool
 #include "mozilla/gfx/gfxVars.h"
 #include "mozilla/gfx/GPUProcessManager.h"
+#include "mozilla/gfx/Logging.h"
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsAutoPtr.h"
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsIObserver.h"                // for nsIObserver
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsTArray.h"                   // for nsTArray, nsTArray_Impl
 #include "nsXULAppAPI.h"                // for XRE_GetIOMessageLoop, etc
 #include "FrameLayerBuilder.h"
@@ -1063,14 +1064,16 @@ CompositorBridgeChild::DeallocPAPZCTreeM
   APZCTreeManagerChild* parent = static_cast<APZCTreeManagerChild*>(aActor);
   parent->Release();
   return true;
 }
 
 void
 CompositorBridgeChild::ProcessingError(Result aCode, const char* aReason)
 {
-  MOZ_RELEASE_ASSERT(aCode == MsgDropped, "Processing error in CompositorBridgeChild");
+  if (aCode != MsgDropped) {
+    gfxDevCrash(gfx::LogReason::ProcessingError) << "Processing error in CompositorBridgeChild: " << int(aCode);
+  }
 }
 
 } // namespace layers
 } // namespace mozilla
 
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -131,37 +131,16 @@ struct CompositableTransaction
     AddNoSwapEdit(op);
     MarkSyncTransaction();
   }
   void MarkSyncTransaction()
   {
     mSwapRequired = true;
   }
 
-  void FallbackDestroyActors()
-  {
-    for (auto& actor : mDestroyedActors) {
-      switch (actor.type()) {
-      case OpDestroy::TPTextureChild: {
-        DebugOnly<bool> ok = TextureClient::DestroyFallback(actor.get_PTextureChild());
-        MOZ_ASSERT(ok);
-        break;
-      }
-      case OpDestroy::TPCompositableChild: {
-        DebugOnly<bool> ok = actor.get_PCompositableChild()->SendDestroySync();
-        MOZ_ASSERT(ok);
-        break;
-      }
-      default:
-        MOZ_CRASH("GFX: IBC Fallback destroy actors");
-      }
-    }
-    mDestroyedActors.Clear();
-  }
-
   OpVector mOperations;
   OpDestroyVector mDestroyedActors;
   bool mSwapRequired;
   bool mFinished;
 };
 
 struct AutoEndTransaction {
   explicit AutoEndTransaction(CompositableTransaction* aTxn) : mTxn(aTxn) {}
@@ -390,23 +369,16 @@ ImageBridgeChild::CancelWaitForRecycle(u
   mTexturesWaitingRecycled.Remove(aTextureId);
 }
 
 // Singleton
 static StaticMutex sImageBridgeSingletonLock;
 static StaticRefPtr<ImageBridgeChild> sImageBridgeChildSingleton;
 static Thread *sImageBridgeChildThread = nullptr;
 
-void
-ImageBridgeChild::FallbackDestroyActors() {
-  if (mTxn && !mTxn->mDestroyedActors.IsEmpty()) {
-    mTxn->FallbackDestroyActors();
-  }
-}
-
 // Helper that creates a monitor and a "done" flag, then enters the monitor.
 // This can go away when we switch ImageBridge to an XPCOM thread.
 class MOZ_STACK_CLASS SynchronousTask
 {
   friend class AutoCompleteTask;
 
 public:
   explicit SynchronousTask(const char* name)
@@ -473,17 +445,16 @@ ImageBridgeChild::ShutdownStep1(Synchron
   InfallibleTArray<PTextureChild*> textures;
   ManagedPTextureChild(textures);
   for (int i = textures.Length() - 1; i >= 0; --i) {
     RefPtr<TextureClient> client = TextureClient::AsTextureClient(textures[i]);
     if (client) {
       client->Destroy();
     }
   }
-  FallbackDestroyActors();
 
   SendWillClose();
   MarkShutDown();
 
   // From now on, no message can be sent through the image bridge from the
   // client side except the final Stop message.
 }
 
@@ -851,25 +822,23 @@ ImageBridgeChild::EndTransaction()
     ShadowLayerForwarder::PlatformSyncBeforeUpdate();
   }
 
   AutoTArray<EditReply, 10> replies;
 
   if (mTxn->mSwapRequired) {
     if (!SendUpdate(cset, mTxn->mDestroyedActors, GetFwdTransactionId(), &replies)) {
       NS_WARNING("could not send async texture transaction");
-      mTxn->FallbackDestroyActors();
       return;
     }
   } else {
     // If we don't require a swap we can call SendUpdateNoSwap which
     // assumes that aReplies is empty (DEBUG assertion)
     if (!SendUpdateNoSwap(cset, mTxn->mDestroyedActors, GetFwdTransactionId())) {
       NS_WARNING("could not send async texture transaction (no swap)");
-      mTxn->FallbackDestroyActors();
       return;
     }
   }
   for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
     NS_RUNTIMEABORT("not reached");
   }
 }
 
--- a/gfx/layers/ipc/ImageBridgeChild.h
+++ b/gfx/layers/ipc/ImageBridgeChild.h
@@ -378,17 +378,16 @@ protected:
   void BindSameProcess(RefPtr<ImageBridgeParent> aParent);
 
   void SendImageBridgeThreadId();
 
   void WillShutdown();
   void ShutdownStep1(SynchronousTask* aTask);
   void ShutdownStep2(SynchronousTask* aTask);
   void MarkShutDown();
-  void FallbackDestroyActors();
 
   void ActorDestroy(ActorDestroyReason aWhy) override;
   void DeallocPImageBridgeChild() override;
 
   bool CanSend() const;
 
 private:
   class ShutdownObserver final : public nsIObserver
--- a/gfx/layers/ipc/ImageBridgeParent.cpp
+++ b/gfx/layers/ipc/ImageBridgeParent.cpp
@@ -163,16 +163,18 @@ private:
   InfallibleTArray<OpDestroy>* mToDestroy;
 };
 
 bool
 ImageBridgeParent::RecvUpdate(EditArray&& aEdits, OpDestroyArray&& aToDestroy,
                               const uint64_t& aFwdTransactionId,
                               EditReplyArray* aReply)
 {
+  // This ensures that destroy operations are always processed. It is not safe
+  // to early-return from RecvUpdate without doing so.
   AutoImageBridgeParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
   UpdateFwdTransactionId(aFwdTransactionId);
 
   EditReplyVector replyv;
   for (EditArray::index_type i = 0; i < aEdits.Length(); ++i) {
     if (!ReceiveCompositableUpdate(aEdits[i], replyv)) {
       return false;
     }
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -265,16 +265,18 @@ LayerTransactionParent::RecvUpdate(Infal
 
   if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
     for (const auto& op : aToDestroy) {
       DestroyActor(op);
     }
     return true;
   }
 
+  // This ensures that destroy operations are always processed. It is not safe
+  // to early-return from RecvUpdate without doing so.
   AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this, &aToDestroy);
   EditReplyVector replyv;
 
   {
     AutoResolveRefLayers resolve(mCompositorBridge->GetCompositionManager(this));
     layer_manager()->BeginTransaction();
   }
 
--- a/gfx/layers/ipc/PCompositable.ipdl
+++ b/gfx/layers/ipc/PCompositable.ipdl
@@ -17,17 +17,12 @@ async protocol PCompositable
     manager PImageBridge or PLayerTransaction;
 child:
     async __delete__();
 parent:
     /**
      * Asynchronously tell the compositor side to remove the texture.
      */
     async Destroy();
-
-    /**
-     * Never used (needed for ParentActor).
-     */
-    async DestroySync();
 };
 
 } // namespace
 } // namespace
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -155,37 +155,16 @@ public:
   }
   bool RotationChanged() const {
     return mRotationChanged;
   }
   bool Finished() const { return !mOpen && Empty(); }
 
   bool Opened() const { return mOpen; }
 
-  void FallbackDestroyActors()
-  {
-    for (auto& actor : mDestroyedActors) {
-      switch (actor.type()) {
-      case OpDestroy::TPTextureChild: {
-        DebugOnly<bool> ok = TextureClient::DestroyFallback(actor.get_PTextureChild());
-        MOZ_ASSERT(ok);
-        break;
-      }
-      case OpDestroy::TPCompositableChild: {
-        DebugOnly<bool> ok = actor.get_PCompositableChild()->SendDestroySync();
-        MOZ_ASSERT(ok);
-        break;
-      }
-      default:
-        MOZ_CRASH("GFX: SL Fallback destroy actors");
-      }
-    }
-    mDestroyedActors.Clear();
-  }
-
   EditVector mCset;
   EditVector mPaints;
   OpDestroyVector mDestroyedActors;
   ShadowableLayerSet mMutants;
   gfx::IntRect mTargetBounds;
   ScreenRotation mTargetRotation;
   dom::ScreenOrientationInternal mTargetOrientation;
   bool mSwapRequired;
@@ -221,19 +200,16 @@ ShadowLayerForwarder::ShadowLayerForward
  , mPaintSyncId(0)
 {
   mTxn = new Transaction();
 }
 
 ShadowLayerForwarder::~ShadowLayerForwarder()
 {
   MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?");
-  if (!mTxn->mDestroyedActors.IsEmpty()) {
-    mTxn->FallbackDestroyActors();
-  }
   delete mTxn;
   if (mShadowManager) {
     mShadowManager->SetForwarder(nullptr);
     mShadowManager->Destroy();
   }
 }
 
 void
@@ -764,34 +740,32 @@ ShadowLayerForwarder::EndTransaction(Inf
         !mShadowManager->IPCOpen() ||
         !mShadowManager->SendUpdate(cset, mTxn->mDestroyedActors,
                                     GetFwdTransactionId(),
                                     aId, targetConfig, mPluginWindowData,
                                     mIsFirstPaint, aScheduleComposite,
                                     aPaintSequenceNumber, aIsRepeatTransaction,
                                     aTransactionStart, mPaintSyncId, aReplies)) {
       MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
-      mTxn->FallbackDestroyActors();
       return false;
     }
   } else {
     // If we don't require a swap we can call SendUpdateNoSwap which
     // assumes that aReplies is empty (DEBUG assertion)
     MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction..."));
     RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
     if (!HasShadowManager() ||
         !mShadowManager->IPCOpen() ||
         !mShadowManager->SendUpdateNoSwap(cset, mTxn->mDestroyedActors,
                                           GetFwdTransactionId(),
                                           aId, targetConfig, mPluginWindowData,
                                           mIsFirstPaint, aScheduleComposite,
                                           aPaintSequenceNumber, aIsRepeatTransaction,
                                           aTransactionStart, mPaintSyncId)) {
       MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
-      mTxn->FallbackDestroyActors();
       return false;
     }
   }
 
   *aSent = true;
   mIsFirstPaint = false;
   mPaintSyncId = 0;
   MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1168,16 +1168,17 @@ RasterImage::Decode(const IntSize& aSize
     task = DecoderFactory::CreateDecoder(mDecoderType, WrapNotNull(this),
                                          mSourceBuffer, mSize, aSize,
                                          decoderFlags, surfaceFlags,
                                          mRequestedSampleSize);
   }
 
   // Make sure DecoderFactory was able to create a decoder successfully.
   if (!task) {
+    DoError();
     return NS_ERROR_FAILURE;
   }
 
   mDecodeCount++;
 
   // We're ready to decode; start the decoder.
   LaunchDecodingTask(task, this, aFlags, mHasSourceData);
   return NS_OK;
@@ -1222,16 +1223,17 @@ RasterImage::RecoverFromInvalidFrames(co
   // Relock the image if it's supposed to be locked.
   if (mLockCount > 0) {
     SurfaceCache::LockImage(ImageKey(this));
   }
 
   // Animated images require some special handling, because we normally require
   // that they never be discarded.
   if (mAnimationState) {
+    mAnimationState->SetDoneDecoding(false);
     Decode(mSize, aFlags | FLAG_SYNC_DECODE, PlaybackType::eAnimated);
     ResetAnimation();
     return;
   }
 
   // For non-animated images, it's fine to recover using an async decode.
   Decode(aSize, aFlags, PlaybackType::eStatic);
 }
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -11551,26 +11551,22 @@ CodeGenerator::visitAssertRangeD(LAssert
     emitAssertRangeD(r, input, temp);
 }
 
 void
 CodeGenerator::visitAssertRangeF(LAssertRangeF* ins)
 {
     FloatRegister input = ToFloatRegister(ins->input());
     FloatRegister temp = ToFloatRegister(ins->temp());
-    FloatRegister dest = input;
-    if (hasMultiAlias())
-        dest = ToFloatRegister(ins->armtemp());
+    FloatRegister temp2 = ToFloatRegister(ins->temp2());
 
     const Range* r = ins->range();
 
-    masm.convertFloat32ToDouble(input, dest);
-    emitAssertRangeD(r, dest, temp);
-    if (dest == input)
-        masm.convertDoubleToFloat32(input, input);
+    masm.convertFloat32ToDouble(input, temp);
+    emitAssertRangeD(r, temp, temp2);
 }
 
 void
 CodeGenerator::visitAssertRangeV(LAssertRangeV* ins)
 {
     const Range* r = ins->range();
     const ValueOperand value = ToValue(ins, LAssertRangeV::Input);
     Register tag = masm.splitTagForTest(value);
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -3767,21 +3767,20 @@ LIRGenerator::visitAssertRange(MAssertRa
       case MIRType::Int32:
         lir = new(alloc()) LAssertRangeI(useRegisterAtStart(input));
         break;
 
       case MIRType::Double:
         lir = new(alloc()) LAssertRangeD(useRegister(input), tempDouble());
         break;
 
-      case MIRType::Float32: {
-        LDefinition armtemp = hasMultiAlias() ? tempDouble() : LDefinition::BogusTemp();
-        lir = new(alloc()) LAssertRangeF(useRegister(input), tempDouble(), armtemp);
+      case MIRType::Float32:
+        lir = new(alloc()) LAssertRangeF(useRegister(input), tempDouble(), tempDouble());
         break;
-      }
+
       case MIRType::Value:
         lir = new(alloc()) LAssertRangeV(useBox(input), tempToUnbox(), tempDouble(), tempDouble());
         break;
 
       default:
         MOZ_CRASH("Unexpected Range for MIRType");
         break;
     }
--- a/js/src/jit/shared/LIR-shared.h
+++ b/js/src/jit/shared/LIR-shared.h
@@ -8541,32 +8541,31 @@ class LAssertRangeD : public LInstructio
         return mir()->assertedRange();
     }
 };
 
 class LAssertRangeF : public LInstructionHelper<0, 1, 2>
 {
   public:
     LIR_HEADER(AssertRangeF)
-    LAssertRangeF(const LAllocation& input, const LDefinition& temp, const LDefinition& armtemp) {
+    LAssertRangeF(const LAllocation& input, const LDefinition& temp, const LDefinition& temp2) {
         setOperand(0, input);
         setTemp(0, temp);
-        setTemp(1, armtemp);
-    }
-    const LDefinition* armtemp() {
-        return getTemp(1);
+        setTemp(1, temp2);
     }
 
     const LAllocation* input() {
         return getOperand(0);
     }
-
     const LDefinition* temp() {
         return getTemp(0);
     }
+    const LDefinition* temp2() {
+        return getTemp(1);
+    }
 
     MAssertRange* mir() {
         return mir_->toAssertRange();
     }
     const Range* range() {
         return mir()->assertedRange();
     }
 };
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -477,16 +477,19 @@ elif CONFIG['JS_CODEGEN_ARM']:
         'jit/arm/MoveEmitter-arm.cpp',
         'jit/arm/SharedIC-arm.cpp',
         'jit/arm/Trampoline-arm.cpp',
     ]
     if CONFIG['JS_SIMULATOR_ARM']:
         UNIFIED_SOURCES += [
             'jit/arm/Simulator-arm.cpp'
         ]
+        # Configuration used only for testing.
+        if CONFIG['OS_ARCH'] == 'Linux':
+            CXXFLAGS += [ '-msse2', '-mfpmath=sse' ]
     elif CONFIG['OS_ARCH'] == 'Darwin':
         SOURCES += [
             'jit/arm/llvm-compiler-rt/arm/aeabi_idivmod.S',
             'jit/arm/llvm-compiler-rt/arm/aeabi_uidivmod.S',
         ]
 elif CONFIG['JS_CODEGEN_ARM64']:
     UNIFIED_SOURCES += [
         'jit/arm64/Architecture-arm64.cpp',
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -4387,61 +4387,62 @@ nsFlexContainerFrame::ReflowFlexItem(nsP
   if (aItem.Frame() == mFrames.FirstChild()) {
     aItem.SetAscent(childDesiredSize.BlockStartAscent());
   }
 }
 
 /* virtual */ nscoord
 nsFlexContainerFrame::GetMinISize(nsRenderingContext* aRenderingContext)
 {
-  nscoord minWidth = 0;
-  DISPLAY_MIN_WIDTH(this, minWidth);
+  nscoord minISize = 0;
+  DISPLAY_MIN_WIDTH(this, minISize);
 
   RenumberList();
 
   const nsStylePosition* stylePos = StylePosition();
   const FlexboxAxisTracker axisTracker(this, GetWritingMode());
 
   for (nsIFrame* childFrame : mFrames) {
-    nscoord childMinWidth =
+    nscoord childMinISize =
       nsLayoutUtils::IntrinsicForContainer(aRenderingContext, childFrame,
                                            nsLayoutUtils::MIN_ISIZE);
-    // For a horizontal single-line flex container, the intrinsic min width is
-    // the sum of its items' min widths.
-    // For a vertical flex container, or for a multi-line horizontal flex
-    // container, the intrinsic min width is the max of its items' min widths.
-    if (axisTracker.IsMainAxisHorizontal() &&
+    // For a horizontal single-line flex container, the intrinsic min
+    // isize is the sum of its items' min isizes.
+    // For a column-oriented flex container, or for a multi-line row-
+    // oriented flex container, the intrinsic min isize is the max of
+    // its items' min isizes.
+    if (axisTracker.IsRowOriented() &&
         NS_STYLE_FLEX_WRAP_NOWRAP == stylePos->mFlexWrap) {
-      minWidth += childMinWidth;
+      minISize += childMinISize;
     } else {
-      minWidth = std::max(minWidth, childMinWidth);
+      minISize = std::max(minISize, childMinISize);
     }
   }
-  return minWidth;
+  return minISize;
 }
 
 /* virtual */ nscoord
 nsFlexContainerFrame::GetPrefISize(nsRenderingContext* aRenderingContext)
 {
-  nscoord prefWidth = 0;
-  DISPLAY_PREF_WIDTH(this, prefWidth);
+  nscoord prefISize = 0;
+  DISPLAY_PREF_WIDTH(this, prefISize);
 
   RenumberList();
 
   // XXXdholbert Optimization: We could cache our intrinsic widths like
   // nsBlockFrame does (and return it early from this function if it's set).
   // Whenever anything happens that might change it, set it to
   // NS_INTRINSIC_WIDTH_UNKNOWN (like nsBlockFrame::MarkIntrinsicISizesDirty
   // does)
   const FlexboxAxisTracker axisTracker(this, GetWritingMode());
 
   for (nsIFrame* childFrame : mFrames) {
-    nscoord childPrefWidth =
+    nscoord childPrefISize =
       nsLayoutUtils::IntrinsicForContainer(aRenderingContext, childFrame,
                                            nsLayoutUtils::PREF_ISIZE);
-    if (axisTracker.IsMainAxisHorizontal()) {
-      prefWidth += childPrefWidth;
+    if (axisTracker.IsRowOriented()) {
+      prefISize += childPrefISize;
     } else {
-      prefWidth = std::max(prefWidth, childPrefWidth);
+      prefISize = std::max(prefISize, childPrefISize);
     }
   }
-  return prefWidth;
+  return prefISize;
 }
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -2137,36 +2137,36 @@ JsepSessionImpl::SetupDefaultCodecs()
                                     8000,
                                     1,
                                     8000 / 50,   // frequency / 50
                                     8 * 8000 * 1 // 8 * frequency * channels
                                     ));
 
   // Supported video codecs.
   // Note: order here implies priority for building offers!
+  JsepVideoCodecDescription* vp8 = new JsepVideoCodecDescription(
+      "120",
+      "VP8",
+      90000
+      );
+  // Defaults for mandatory params
+  vp8->mConstraints.maxFs = 12288; // Enough for 2048x1536
+  vp8->mConstraints.maxFps = 60;
+  mSupportedCodecs.values.push_back(vp8);
+
   JsepVideoCodecDescription* vp9 = new JsepVideoCodecDescription(
       "121",
       "VP9",
       90000
       );
   // Defaults for mandatory params
   vp9->mConstraints.maxFs = 12288; // Enough for 2048x1536
   vp9->mConstraints.maxFps = 60;
   mSupportedCodecs.values.push_back(vp9);
 
-  JsepVideoCodecDescription* vp8 = new JsepVideoCodecDescription(
-      "120",
-      "VP8",
-      90000
-      );
-  // Defaults for mandatory params
-  vp8->mConstraints.maxFs = 12288; // Enough for 2048x1536
-  vp8->mConstraints.maxFps = 60;
-  mSupportedCodecs.values.push_back(vp8);
-
   JsepVideoCodecDescription* h264_1 = new JsepVideoCodecDescription(
       "126",
       "H264",
       90000
       );
   h264_1->mPacketizationMode = 1;
   // Defaults for mandatory params
   h264_1->mProfileLevelId = 0x42E00D;
--- a/media/webrtc/signaling/test/jsep_session_unittest.cpp
+++ b/media/webrtc/signaling/test/jsep_session_unittest.cpp
@@ -2738,18 +2738,18 @@ TEST_F(JsepSessionTest, ValidateOfferedC
 
   ASSERT_EQ(2U, outputSdp->GetMediaSectionCount());
   auto& video_section = outputSdp->GetMediaSection(1);
   ASSERT_EQ(SdpMediaSection::kVideo, video_section.GetMediaType());
   auto& video_attrs = video_section.GetAttributeList();
   ASSERT_EQ(SdpDirectionAttribute::kSendrecv, video_attrs.GetDirection());
 
   ASSERT_EQ(6U, video_section.GetFormats().size());
-  ASSERT_EQ("121", video_section.GetFormats()[0]);
-  ASSERT_EQ("120", video_section.GetFormats()[1]);
+  ASSERT_EQ("120", video_section.GetFormats()[0]);
+  ASSERT_EQ("121", video_section.GetFormats()[1]);
   ASSERT_EQ("126", video_section.GetFormats()[2]);
   ASSERT_EQ("97", video_section.GetFormats()[3]);
   ASSERT_EQ("122", video_section.GetFormats()[4]);
   ASSERT_EQ("123", video_section.GetFormats()[5]);
 
   // Validate rtpmap
   ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kRtpmapAttribute));
   auto& rtpmaps = video_attrs.GetRtpmap();
@@ -2834,18 +2834,18 @@ TEST_F(JsepSessionTest, ValidateOfferedC
   const SdpFmtpAttributeList::Parameters* red_params =
     video_section.FindFmtp("122");
   ASSERT_TRUE(red_params);
   ASSERT_EQ(SdpRtpmapAttributeList::kRed, red_params->codec_type);
 
   auto& parsed_red_params =
       *static_cast<const SdpFmtpAttributeList::RedParameters*>(red_params);
   ASSERT_EQ(5U, parsed_red_params.encodings.size());
-  ASSERT_EQ(121, parsed_red_params.encodings[0]);
-  ASSERT_EQ(120, parsed_red_params.encodings[1]);
+  ASSERT_EQ(120, parsed_red_params.encodings[0]);
+  ASSERT_EQ(121, parsed_red_params.encodings[1]);
   ASSERT_EQ(126, parsed_red_params.encodings[2]);
   ASSERT_EQ(97, parsed_red_params.encodings[3]);
   ASSERT_EQ(123, parsed_red_params.encodings[4]);
 }
 
 TEST_F(JsepSessionTest, ValidateAnsweredCodecParams)
 {
   // TODO(bug 1099351): Once fixed, we can allow red in this offer,
@@ -2899,55 +2899,57 @@ TEST_F(JsepSessionTest, ValidateAnswered
   auto& video_section = outputSdp->GetMediaSection(1);
   ASSERT_EQ(SdpMediaSection::kVideo, video_section.GetMediaType());
   auto& video_attrs = video_section.GetAttributeList();
   ASSERT_EQ(SdpDirectionAttribute::kSendrecv, video_attrs.GetDirection());
 
   // TODO(bug 1099351): Once fixed, this stuff will need to be updated.
   ASSERT_EQ(1U, video_section.GetFormats().size());
   // ASSERT_EQ(3U, video_section.GetFormats().size());
-  ASSERT_EQ("121", video_section.GetFormats()[0]);
-  // ASSERT_EQ("126", video_section.GetFormats()[1]);
-  // ASSERT_EQ("97", video_section.GetFormats()[2]);
+  ASSERT_EQ("120", video_section.GetFormats()[0]);
+  // ASSERT_EQ("121", video_section.GetFormats()[1]);
+  // ASSERT_EQ("126", video_section.GetFormats()[2]);
+  // ASSERT_EQ("97", video_section.GetFormats()[3]);
 
   // Validate rtpmap
   ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kRtpmapAttribute));
   auto& rtpmaps = video_attrs.GetRtpmap();
-  ASSERT_TRUE(rtpmaps.HasEntry("121"));
+  ASSERT_TRUE(rtpmaps.HasEntry("120"));
+  //ASSERT_TRUE(rtpmaps.HasEntry("121"));
   // ASSERT_TRUE(rtpmaps.HasEntry("126"));
   // ASSERT_TRUE(rtpmaps.HasEntry("97"));
 
-  //auto& vp8_entry = rtpmaps.GetEntry("120");
-  auto& vp9_entry = rtpmaps.GetEntry("121");
+  auto& vp8_entry = rtpmaps.GetEntry("120");
+  //auto& vp9_entry = rtpmaps.GetEntry("121");
   // auto& h264_1_entry = rtpmaps.GetEntry("126");
   // auto& h264_0_entry = rtpmaps.GetEntry("97");
 
-  //ASSERT_EQ("VP8", vp8_entry.name);
-  ASSERT_EQ("VP9", vp9_entry.name);
+  ASSERT_EQ("VP8", vp8_entry.name);
+  //ASSERT_EQ("VP9", vp9_entry.name);
   // ASSERT_EQ("H264", h264_1_entry.name);
   // ASSERT_EQ("H264", h264_0_entry.name);
 
   // Validate fmtps
   ASSERT_TRUE(video_attrs.HasAttribute(SdpAttribute::kFmtpAttribute));
   auto& fmtps = video_attrs.GetFmtp().mFmtps;
 
   ASSERT_EQ(1U, fmtps.size());
   // ASSERT_EQ(3U, fmtps.size());
 
-  // VP9
-  ASSERT_EQ("121", fmtps[0].format);
+  // VP8
+  ASSERT_EQ("120", fmtps[0].format);
   ASSERT_TRUE(!!fmtps[0].parameters);
-  ASSERT_EQ(SdpRtpmapAttributeList::kVP9, fmtps[0].parameters->codec_type);
-
-  auto& parsed_vp9_params =
+  ASSERT_EQ(SdpRtpmapAttributeList::kVP8, fmtps[0].parameters->codec_type);
+
+  auto& parsed_vp8_params =
       *static_cast<const SdpFmtpAttributeList::VP8Parameters*>(
           fmtps[0].parameters.get());
 
-  ASSERT_EQ((uint32_t)12288, parsed_vp9_params.max_fs);
-  ASSERT_EQ((uint32_t)60, parsed_vp9_params.max_fr);
+  ASSERT_EQ((uint32_t)12288, parsed_vp8_params.max_fs);
+  ASSERT_EQ((uint32_t)60, parsed_vp8_params.max_fr);
 
 
   SetLocalAnswer(answer);
   SetRemoteAnswer(answer);
 
   auto offerPairs = mSessionOff.GetNegotiatedTrackPairs();
   ASSERT_EQ(2U, offerPairs.size());
   ASSERT_TRUE(offerPairs[1].mSending);
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -4160,19 +4160,21 @@ TEST_P(SignalingTest, ValidateMultipleVi
 {
   EnsureInit();
   OfferOptions options;
 
   a1_->CreateOffer(options, OFFER_AV);
   std::string offer = a1_->offer();
 
 #ifdef H264_P0_SUPPORTED
-  ASSERT_NE(offer.find("UDP/TLS/RTP/SAVPF 120 126 97"), std::string::npos);
+  ASSERT_NE(offer.find("UDP/TLS/RTP/SAVPF 120 126 97") ||
+            offer.find("UDP/TLS/RTP/SAVPF 120 121 126 97"), std::string::npos);
 #else
-  ASSERT_NE(offer.find("UDP/TLS/RTP/SAVPF 120 126"), std::string::npos);
+  ASSERT_NE(offer.find("UDP/TLS/RTP/SAVPF 120 126") ||
+            offer.find("UDP/TLS/RTP/SAVPF 120 121 126"), std::string::npos);
 #endif
   ASSERT_NE(offer.find("a=rtpmap:120 VP8/90000"), std::string::npos);
   ASSERT_NE(offer.find("a=rtpmap:126 H264/90000"), std::string::npos);
   ASSERT_NE(offer.find("a=fmtp:126 profile-level-id="), std::string::npos);
   ASSERT_NE(offer.find("a=rtcp-fb:120 nack"), std::string::npos);
   ASSERT_NE(offer.find("a=rtcp-fb:120 nack pli"), std::string::npos);
   ASSERT_NE(offer.find("a=rtcp-fb:120 ccm fir"), std::string::npos);
   ASSERT_NE(offer.find("a=rtcp-fb:126 nack"), std::string::npos);
@@ -4195,18 +4197,25 @@ TEST_P(SignalingTest, RemoveVP8FromOffer
   OfferOptions options;
   size_t match;
 
   a1_->CreateOffer(options, OFFER_AV);
 
   // Remove VP8 from offer
   std::string offer = a1_->offer();
   match = offer.find("UDP/TLS/RTP/SAVPF 120");
+  if (match != std::string::npos) {
+    offer.replace(match, strlen("UDP/TLS/RTP/SAVPF 120"), "UDP/TLS/RTP/SAVPF");
+  }
+  match = offer.find("UDP/TLS/RTP/SAVPF 121");
+  if (match != std::string::npos) {
+    offer.replace(match, strlen("UDP/TLS/RTP/SAVPF 121"), "UDP/TLS/RTP/SAVPF");
+  }
+  match = offer.find("UDP/TLS/RTP/SAVPF 126");
   ASSERT_NE(std::string::npos, match);
-  offer.replace(match, strlen("UDP/TLS/RTP/SAVPF 120"), "UDP/TLS/RTP/SAVPF");
 
   match = offer.find("profile-level-id");
   ASSERT_NE(std::string::npos, match);
   offer.replace(match,
                 strlen("profile-level-id"),
                 "max-foo=1234;profile-level-id");
 
   ParsedSDP sdpWrapper(offer);
--- a/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
+++ b/media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp9/vp9_impl.cc
@@ -659,21 +659,21 @@ void VP9EncoderImpl::PopulateCodecSpecif
     for (size_t i = 0; i < vp9_info->num_spatial_layers; ++i) {
       vp9_info->width[i] = codec_.width *
                            svc_internal_.svc_params.scaling_factor_num[i] /
                            svc_internal_.svc_params.scaling_factor_den[i];
       vp9_info->height[i] = codec_.height *
                             svc_internal_.svc_params.scaling_factor_num[i] /
                             svc_internal_.svc_params.scaling_factor_den[i];
     }
-    if (!vp9_info->flexible_mode) {
-      vp9_info->gof.CopyGofInfoVP9(gof_);
-    }
   }
 #endif
+  if (!vp9_info->flexible_mode) {
+    vp9_info->gof.CopyGofInfoVP9(gof_);
+  }
 }
 
 int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) {
   encoded_image_._length = 0;
   encoded_image_._frameType = kDeltaFrame;
   RTPFragmentationHeader frag_info;
   // Note: no data partitioning in VP9, so 1 partition only. We keep this
   // fragmentation data for now, until VP9 packetizer is implemented.
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -690,25 +690,25 @@ var PromptUtils = {
     if (realm.length > 150) {
       realm = realm.substring(0, 150);
       // Append "..." (or localized equivalent).
       realm += this.ellipsis;
     }
 
     let text;
     if (isProxy) {
-      text = this.bundle.formatStringFromName("EnterLoginForProxy2", [realm, displayHost], 2);
+      text = this.bundle.formatStringFromName("EnterLoginForProxy3", [realm, displayHost], 2);
     } else if (isPassOnly) {
       text = this.bundle.formatStringFromName("EnterPasswordFor", [username, displayHost], 2);
     } else if (isCrossOrig) {
-      text = this.bundle.formatStringFromName("EnterUserPasswordForCrossOrigin", [displayHost], 1);
+      text = this.bundle.formatStringFromName("EnterUserPasswordForCrossOrigin2", [displayHost], 1);
     } else if (!realm) {
       text = this.bundle.formatStringFromName("EnterUserPasswordFor2", [displayHost], 1);
     } else {
-      text = this.bundle.formatStringFromName("EnterLoginForRealm2", [realm, displayHost], 2);
+      text = this.bundle.formatStringFromName("EnterLoginForRealm3", [realm, displayHost], 2);
     }
 
     return text;
   },
 
   // JS port of http://mxr.mozilla.org/mozilla-central/source/embedding/components/windowwatcher/nsPromptUtils.h#89
   getAuthHostPort: function pu_getAuthHostPort(aChannel, aAuthInfo) {
     let uri = aChannel.URI;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -200,17 +200,17 @@ pref("dom.keyboardevent.code.enabled", t
 // If this is true, TextEventDispatcher dispatches keydown and keyup events
 // even during composition (keypress events are never fired during composition
 // even if this is true).
 pref("dom.keyboardevent.dispatch_during_composition", false);
 
 // Whether the UndoManager API is enabled
 pref("dom.undo_manager.enabled", false);
 
-// Whether URL,nsLocation,Link::GetHash should be percent encoded
+// Whether URL,Location,Link::GetHash should be percent encoded
 // in setter and percent decoded in getter (old behaviour = true)
 pref("dom.url.encode_decode_hash", true);
 // Whether ::GetHash should do percent decoding (old behaviour = true)
 pref("dom.url.getters_decode_hash", false);
 
 // Whether to run add-on code in different compartments from browser code. This
 // causes a separate compartment for each (addon, global) combination, which may
 // significantly increase the number of compartments in the system.
@@ -447,16 +447,17 @@ pref("media.navigator.video.default_heig
 pref("media.peerconnection.enabled", true);
 pref("media.peerconnection.video.enabled", true);
 pref("media.navigator.video.max_fs", 12288); // Enough for 2048x1536
 pref("media.navigator.video.max_fr", 60);
 pref("media.navigator.video.h264.level", 31); // 0x42E01f - level 3.1
 pref("media.navigator.video.h264.max_br", 0);
 pref("media.navigator.video.h264.max_mbps", 0);
 pref("media.peerconnection.video.h264_enabled", false);
+pref("media.peerconnection.video.vp9_enabled", true);
 pref("media.getusermedia.aec", 1);
 pref("media.getusermedia.browser.enabled", true);
 #endif
 // Gonk typically captures at QVGA, and so min resolution is QQVGA or
 // 160x120; 100Kbps is plenty for that.
 // Desktop is typically VGA capture or more; and qm_select will not drop resolution
 // below 1/2 in each dimension (or so), so QVGA (320x200) is the lowest here usually.
 pref("media.peerconnection.video.min_bitrate", 0);
@@ -1094,17 +1095,17 @@ pref("print.print_unwriteable_margin_bot
 // This is used by both Printing and Print Preview
 // Units are in 1/100ths of an inch.
 pref("print.print_edge_top", 0);
 pref("print.print_edge_left", 0);
 pref("print.print_edge_right", 0);
 pref("print.print_edge_bottom", 0);
 
 // Print via the parent process. This is only used when e10s is enabled.
-#if defined(XP_WIN)
+#if defined(XP_WIN) || defined(XP_MACOSX)
 pref("print.print_via_parent", true);
 #else
 pref("print.print_via_parent", false);
 #endif
 
 // Pref used by the spellchecker extension to control the
 // maximum number of misspelled words that will be underlined
 // in a document.
--- a/taskcluster/taskgraph/action.py
+++ b/taskcluster/taskgraph/action.py
@@ -4,16 +4,17 @@
 # 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/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import json
 import logging
 import requests
+import yaml
 
 from .create import create_tasks
 from .decision import write_artifact
 from .parameters import Parameters
 from .optimize import optimize_task_graph
 from .taskgraph import TaskGraph
 
 logger = logging.getLogger(__name__)
@@ -28,29 +29,31 @@ def taskgraph_action(options):
      * creating taskgraph of tasks asked for in parameters with respect to
      a given gecko decision task and schedule these jobs.
     """
 
     parameters = get_action_parameters(options)
     decision_task_id = parameters['decision_id']
     # read in the full graph for reference
     full_task_json = get_artifact(decision_task_id, "public/full-task-graph.json")
+    decision_params = get_artifact(decision_task_id, "public/parameters.yml")
     all_tasks, full_task_graph = TaskGraph.from_json(full_task_json, options['root'])
 
     target_tasks = set(parameters['task_labels'].split(','))
     target_graph = full_task_graph.graph.transitive_closure(target_tasks)
     target_task_graph = TaskGraph(
         {l: all_tasks[l] for l in target_graph.nodes},
         target_graph)
 
     existing_tasks = get_artifact(decision_task_id, "public/label-to-taskid.json")
 
     # We don't want to optimize target tasks since they have been requested by user
     # Hence we put `target_tasks under` `do_not_optimize`
     optimized_graph, label_to_taskid = optimize_task_graph(target_task_graph=target_task_graph,
+                                                           params=decision_params,
                                                            do_not_optimize=target_tasks,
                                                            existing_tasks=existing_tasks)
 
     # write out the optimized task graph to describe what will actually happen,
     # and the map of labels to taskids
     write_artifact('task-graph.json', optimized_graph.to_json())
     write_artifact('label-to-taskid.json', label_to_taskid)
     # actually create the graph
@@ -67,10 +70,13 @@ def get_action_parameters(options):
     ] if n in options}
 
     return Parameters(parameters)
 
 
 def get_artifact(task_id, path):
     url = TASKCLUSTER_QUEUE_URL + task_id + "/artifacts/" + path
     resp = requests.get(url=url)
-    artifact = json.loads(resp.text)
+    if path.endswith('.json'):
+        artifact = json.loads(resp.text)
+    elif path.endswith('.yml'):
+        artifact = yaml.load(resp.text)
     return artifact
--- a/toolkit/components/passwordmgr/test/browser/browser.ini
+++ b/toolkit/components/passwordmgr/test/browser/browser.ini
@@ -47,16 +47,15 @@ support-files =
 [browser_notifications_password.js]
 [browser_notifications_2.js]
 skip-if = os == "linux" # Bug 1272849 Main action button disabled state intermittent
 [browser_passwordmgr_editing.js]
 skip-if = os == "linux"
 [browser_context_menu.js]
 skip-if = e10s
 [browser_context_menu_iframe.js]
-skip-if = e10s
 [browser_passwordmgr_contextmenu.js]
 subsuite = clipboard
 [browser_passwordmgr_fields.js]
 [browser_passwordmgr_observers.js]
 [browser_passwordmgr_sort.js]
 [browser_passwordmgr_switchtab.js]
 [browser_passwordmgrdlg.js]
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
@@ -76,17 +76,17 @@ runInParent(() => {
   pwmgr.addLogin(httpUpgradeLogin);
   pwmgr.addLogin(httpsDowngradeLogin);
   pwmgr.addLogin(dedupeHttpUpgradeLogin);
   pwmgr.addLogin(dedupeHttpsUpgradeLogin);
 });
 
 add_task(function* test_iframe() {
   state = {
-    msg         : "http://mochi.test:8888 is requesting your username and password.\n\nThe site says: “mochitest”",
+    msg         : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest”",
     title       : "Authentication Required",
     textValue   : "mochiuser1",
     passValue   : "mochipass1",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -105,17 +105,17 @@ add_task(function* test_iframe() {
   var iframeLoaded = onloadPromiseFor("iframe");
   iframe.src = "authenticate.sjs?user=mochiuser1&pass=mochipass1";
   yield promptDone;
   yield iframeLoaded;
   checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1"},
                       iframe.contentDocument);
 
   state = {
-    msg         : "http://mochi.test:8888 is requesting your username and password.\n\nThe site says: “mochitest2”",
+    msg         : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest2”",
     title       : "Authentication Required",
     textValue   : "mochiuser2",
     passValue   : "mochipass2",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -146,17 +146,17 @@ add_task(function* test_iframe() {
   yield iframeLoaded;
   checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1"},
                       iframe.contentDocument);
 
   // Same realm we've already authenticated to, but with a different
   // expected password (to trigger an auth prompt, and change-password
   // popup notification).
   state = {
-    msg         : "http://mochi.test:8888 is requesting your username and password.\n\nThe site says: “mochitest”",
+    msg         : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest”",
     title       : "Authentication Required",
     textValue   : "mochiuser1",
     passValue   : "mochipass1",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -178,17 +178,17 @@ add_task(function* test_iframe() {
   checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1-new"},
                       iframe.contentDocument);
   yield promptShownPromise;
 
   // Same as last test, but for a realm we haven't already authenticated
   // to (but have an existing saved login for, so that we'll trigger
   // a change-password popup notification.
   state = {
-    msg         : "http://mochi.test:8888 is requesting your username and password.\n\nThe site says: “mochitest3”",
+    msg         : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest3”",
     title       : "Authentication Required",
     textValue   : "mochiuser3",
     passValue   : "mochipass3-old",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -224,17 +224,17 @@ add_task(function* test_iframe() {
 
     // Clear cached auth from this subtest, and avoid leaking due to bug 459620.
     var authMgr = Cc['@mozilla.org/network/http-auth-manager;1'].
                   getService(Ci.nsIHttpAuthManager);
     authMgr.clearAll();
   });
 
   state = {
-    msg         : "http://mochi.test:8888 is requesting your username and password.\n\nThe site says: “mochitest3”",
+    msg         : "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest3”",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -258,17 +258,17 @@ add_task(function* test_iframe() {
   yield iframeLoaded;
   checkEchoedAuthInfo({user: "mochiuser3", pass: "mochipass3-old"},
                       iframe.contentDocument);
   yield promptShownPromise;
 });
 
 add_task(function* test_schemeUpgrade() {
   let state = {
-    msg         : "https://example.com is requesting your username and password.\n\n" +
+    msg         : "https://example.com is requesting your username and password. " +
                   "WARNING: Your password will not be sent to the website you are currently visiting!",
     title       : "Authentication Required",
     textValue   : "httpUser",
     passValue   : "httpPass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
@@ -291,17 +291,17 @@ add_task(function* test_schemeUpgrade() 
   yield promptDone;
   yield iframeLoaded;
   checkEchoedAuthInfo({user: "httpUser", pass: "httpPass"},
                       SpecialPowers.wrap(iframe).contentDocument);
 });
 
 add_task(function* test_schemeDowngrade() {
   let state = {
-    msg         : "http://example.com is requesting your username and password.\n\n" +
+    msg         : "http://example.com is requesting your username and password. " +
                   "WARNING: Your password will not be sent to the website you are currently visiting!",
     title       : "Authentication Required",
     textValue   : "", // empty because we shouldn't downgrade
     passValue   : "",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
@@ -322,17 +322,17 @@ add_task(function* test_schemeDowngrade(
   iframe.src = "http://example.com" + AUTHENTICATE_PATH +
                "?user=unused&pass=unused&realm=schemeDowngrade";
   yield promptDone;
   yield iframeLoaded;
 });
 
 add_task(function* test_schemeUpgrade_dedupe() {
   let state = {
-    msg         : "https://example.org is requesting your username and password.\n\n" +
+    msg         : "https://example.org is requesting your username and password. " +
                   "WARNING: Your password will not be sent to the website you are currently visiting!",
     title       : "Authentication Required",
     textValue   : "dedupeUser",
     passValue   : "httpsPass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth.html
@@ -120,17 +120,17 @@ let prompterParent = runInParent(() => {
   pwmgr.addLogin(login2D);
   pwmgr.addLogin(login2E);
 });
 
 let prompter2 = new PrompterProxy(prompterParent);
 
 add_task(function* test_accept() {
   state = {
-    msg         : "http://example.com is requesting your username and password.\n\nThe site says: “some realm”",
+    msg         : "http://example.com is requesting your username and password. The site says: “some realm”",
     title       : "Authentication Required",
     textValue   : "inuser",
     passValue   : "inpass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -157,17 +157,17 @@ add_task(function* test_accept() {
 
   ok(isOk, "Checking dialog return value (accept)");
   is(authinfo.username, "outuser", "Checking returned username");
   is(authinfo.password, "outpass", "Checking returned password");
 });
 
 add_task(function* test_cancel() {
   state = {
-    msg         : "http://example.com is requesting your username and password.\n\nThe site says: “some realm”",
+    msg         : "http://example.com is requesting your username and password. The site says: “some realm”",
     title       : "Authentication Required",
     textValue   : "outuser",
     passValue   : "outpass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -184,17 +184,17 @@ add_task(function* test_cancel() {
   yield promptDone;
 
   ok(!isOk, "Checking dialog return value (cancel)");
 });
 
 add_task(function* test_pwonly() {
   // test filling in password-only login
   state = {
-    msg         : "http://example.com is requesting your username and password.\n\nThe site says: “http://example.com”",
+    msg         : "http://example.com is requesting your username and password. The site says: “http://example.com”",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "examplepass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -218,17 +218,17 @@ add_task(function* test_pwonly() {
   is(authinfo.username, "", "Checking returned username");
   is(authinfo.password, "examplepass", "Checking returned password");
 });
 
 add_task(function* test_multipleExisting() {
   // test filling in existing login (undetermined from multiple selection)
   // user2name/user2pass would also be valid to fill here.
   state = {
-    msg         : "http://example2.com is requesting your username and password.\n\nThe site says: “http://example2.com”",
+    msg         : "http://example2.com is requesting your username and password. The site says: “http://example2.com”",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -252,17 +252,17 @@ add_task(function* test_multipleExisting
   ok(authinfo.username == "user1name" || authinfo.username == "user2name", "Checking returned username");
   ok(authinfo.password == "user1pass" || authinfo.password == "user2pass", "Checking returned password");
 });
 
 add_task(function* test_multipleExisting2() {
   // test filling in existing login (undetermined --> user1)
   // user2name/user2pass would also be valid to fill here.
   state = {
-    msg         : "http://example2.com is requesting your username and password.\n\nThe site says: “http://example2.com”",
+    msg         : "http://example2.com is requesting your username and password. The site says: “http://example2.com”",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -289,17 +289,17 @@ add_task(function* test_multipleExisting
   is(authinfo.username, "user1name", "Checking returned username");
   is(authinfo.password, "user1pass", "Checking returned password");
 });
 
 add_task(function* test_multipleExisting3() {
   // test filling in existing login (undetermined --> user2)
   // user2name/user2pass would also be valid to fill here.
   state = {
-    msg         : "http://example2.com is requesting your username and password.\n\nThe site says: “http://example2.com”",
+    msg         : "http://example2.com is requesting your username and password. The site says: “http://example2.com”",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -326,17 +326,17 @@ add_task(function* test_multipleExisting
   is(authinfo.username, "user2name", "Checking returned username");
   is(authinfo.password, "user2pass", "Checking returned password");
 });
 
 add_task(function* test_changingMultiple() {
   // test changing a password (undetermined --> user2 w/ newpass)
   // user2name/user2pass would also be valid to fill here.
   state = {
-    msg         : "http://example2.com is requesting your username and password.\n\nThe site says: “http://example2.com”",
+    msg         : "http://example2.com is requesting your username and password. The site says: “http://example2.com”",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -363,17 +363,17 @@ add_task(function* test_changingMultiple
   is(authinfo.username, "user2name", "Checking returned username");
   is(authinfo.password, "NEWuser2pass", "Checking returned password");
 });
 
 add_task(function* test_changingMultiple2() {
   // test changing a password (undetermined --> user2 w/ origpass)
   // user2name/user2pass would also be valid to fill here.
   state = {
-    msg         : "http://example2.com is requesting your username and password.\n\nThe site says: “http://example2.com”",
+    msg         : "http://example2.com is requesting your username and password. The site says: “http://example2.com”",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
@@ -137,17 +137,17 @@ startup();
 add_task(function* setup() {
   info("Waiting for startup to complete...");
   yield startupComplete;
 });
 
 add_task(function* test_noAutologin() {
   // test proxy login (default = no autologin), make sure it prompts.
   state = {
-    msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password.\n\nThe site says: “Proxy Realm”",
+    msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password. The site says: “Proxy Realm”",
     title       : "Authentication Required",
     textValue   : "proxuser",
     passValue   : "proxpass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -195,17 +195,17 @@ add_task(function* test_autologin() {
   isnot(time1, time2, "Checking that timeLastUsed was updated");
   is(proxyAuthinfo.username, "proxuser", "Checking returned username");
   is(proxyAuthinfo.password, "proxpass", "Checking returned password");
 });
 
 add_task(function* test_autologin_incorrect() {
   // test proxy login (with autologin), ensure it prompts after a failed auth.
   state = {
-    msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password.\n\nThe site says: “Proxy Realm”",
+    msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password. The site says: “Proxy Realm”",
     title       : "Authentication Required",
     textValue   : "proxuser",
     passValue   : "proxpass",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
--- a/toolkit/components/prompts/src/nsPrompter.js
+++ b/toolkit/components/prompts/src/nsPrompter.js
@@ -268,25 +268,25 @@ var PromptUtilsTemp = {
         if (realm.length > 150) {
             realm = realm.substring(0, 150);
             // Append "..." (or localized equivalent).
             realm += this.ellipsis;
         }
 
         let text;
         if (isProxy) {
-            text = PromptUtils.getLocalizedString("EnterLoginForProxy2", [realm, displayHost]);
+            text = PromptUtils.getLocalizedString("EnterLoginForProxy3", [realm, displayHost]);
         } else if (isPassOnly) {
             text = PromptUtils.getLocalizedString("EnterPasswordFor", [username, displayHost]);
         } else if (isCrossOrig) {
-            text = PromptUtils.getLocalizedString("EnterUserPasswordForCrossOrigin", [displayHost]);
+            text = PromptUtils.getLocalizedString("EnterUserPasswordForCrossOrigin2", [displayHost]);
         } else if (!realm) {
             text = PromptUtils.getLocalizedString("EnterUserPasswordFor2", [displayHost]);
         } else {
-            text = PromptUtils.getLocalizedString("EnterLoginForRealm2", [realm, displayHost]);
+            text = PromptUtils.getLocalizedString("EnterLoginForRealm3", [realm, displayHost]);
         }
 
         return text;
     },
 
     getTabModalPrompt : function (domWin) {
         var promptBox = null;
 
--- a/toolkit/components/prompts/test/test_modal_prompts.html
+++ b/toolkit/components/prompts/test/test_modal_prompts.html
@@ -1015,17 +1015,17 @@ function* runTests() {
         yield promptDone;
     }
 
 
     // =====
     // (promptAuth is only accessible from the prompt service)
     info("Starting test: promptAuth with long realm");
     state = {
-        msg : 'http://example.com is requesting your username and password.\n\nThe site '  +
+        msg : 'http://example.com is requesting your username and password. The site '  +
               'says: \u201cabcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi ' +
               'abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi '        +
               'abcdefghi \u2026\u201d',
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
@@ -1068,17 +1068,17 @@ function* runTests() {
         password : "",
         domain   : "",
         flags    : Ci. nsIAuthInformation.AUTH_HOST |
                    Ci.nsIAuthInformation.CROSS_ORIGIN_SUB_RESOURCE,
         authenticationScheme : "basic",
         realm : ""
     }
     state = {
-        msg : 'http://example.com is requesting your username and password.\n\n' +
+        msg : 'http://example.com is requesting your username and password. ' +
               'WARNING: Your password will not be sent to the website you are currently visiting!',
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
@@ -1111,17 +1111,17 @@ function* runTests() {
         username : "",
         password : "",
         domain   : "",
         flags : Ci. nsIAuthInformation.AUTH_HOST | Ci.nsIAuthInformation.CROSS_ORIGIN_SUB_RESOURCE,
         authenticationScheme : "basic",
         realm : "Something!!!"
     }
     state = {
-        msg : 'http://example.com is requesting your username and password.\n\n' +
+        msg : 'http://example.com is requesting your username and password. ' +
               'WARNING: Your password will not be sent to the website you are currently visiting!',
         title : "TestTitle",
         iconClass   : "authentication-icon question-icon",
         titleHidden : true,
         textHidden  : false,
         passHidden  : false,
         checkHidden : false,
         textValue   : "",
--- a/toolkit/components/prompts/test/test_subresources_prompts.html
+++ b/toolkit/components/prompts/test/test_subresources_prompts.html
@@ -114,17 +114,17 @@ add_task(function* runTestAuth()
   // cross-origin subresources load
 
   // Force parent to not look for tab-modal prompts, as they're not
   // used for auth prompts.
   isTabModal = false;
 
   state = {
     msg         : "http://mochi.test:8888 is requesting your username " +
-                  "and password.\n\nThe site says: “mochitest”",
+                  "and password. The site says: “mochitest”",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
     checkHidden : true,
@@ -150,17 +150,17 @@ add_task(function* runTestAuth()
   checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1"},
                       iframe_prompt.contentDocument);
 
   // Cross-origin subresourse test.
 
   // Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
   isTabModal =false;
   state = {
-    msg         : "http://example.com is requesting your username and password.\n\n" +
+    msg         : "http://example.com is requesting your username and password. " +
                   "WARNING: Your password will not be sent to the website you are currently visiting!",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "",
     iconClass   : "authentication-icon question-icon",
     titleHidden : true,
     textHidden  : false,
     passHidden  : false,
--- a/toolkit/locales/en-US/chrome/global/commonDialogs.properties
+++ b/toolkit/locales/en-US/chrome/global/commonDialogs.properties
@@ -15,18 +15,18 @@ Yes=&Yes
 No=&No
 Save=&Save
 Revert=&Revert
 DontSave=Do&n’t Save
 ScriptDlgGenericHeading=[JavaScript Application]
 ScriptDlgHeading=The page at %S says:
 ScriptDialogLabel=Prevent this page from creating additional dialogs
 ScriptDialogPreventTitle=Confirm Dialog Preference
-# LOCALIZATION NOTE (EnterLoginForRealm2, EnterLoginForProxy2):
+# LOCALIZATION NOTE (EnterLoginForRealm3, EnterLoginForProxy3):
 # %1 is an untrusted string provided by a remote server. It could try to
 # take advantage of sentence structure in order to mislead the user (see
 # bug 244273). %1 should be integrated into the translated sentences as
 # little as possible. %2 is the url of the site being accessed.
-EnterLoginForRealm2=%2$S is requesting your username and password.\n\nThe site says: “%1$S”
-EnterLoginForProxy2=The proxy %2$S is requesting a username and password.\n\nThe site says: “%1$S”
+EnterLoginForRealm3=%2$S is requesting your username and password. The site says: “%1$S”
+EnterLoginForProxy3=The proxy %2$S is requesting a username and password. The site says: “%1$S”
 EnterUserPasswordFor2=%1$S is requesting your username and password.
-EnterUserPasswordForCrossOrigin=%1$S is requesting your username and password.\n\nWARNING: Your password will not be sent to the website you are currently visiting!
+EnterUserPasswordForCrossOrigin2=%1$S is requesting your username and password. WARNING: Your password will not be sent to the website you are currently visiting!
 EnterPasswordFor=Enter password for %1$S on %2$S