Merge inbound to m-c. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 27 Apr 2015 15:13:19 -0400
changeset 241268 4b3dcb5f7309797d05d50ea697cbf40382ed63ed
parent 241267 2f60ba22839a3beb8259c05171ffc51c5e05c750 (current diff)
parent 241219 9f379f300faa449a663c8e6a642f2e6ae0d4822d (diff)
child 241269 caf25344f73e491409e16dff59e5599858c87e32
push id59066
push userryanvm@gmail.com
push dateMon, 27 Apr 2015 19:20:17 +0000
treeherdermozilla-inbound@92cfbfb1a464 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to m-c. a=merge
dom/media/test/bipbop-frag-cenc-audio.xml
dom/media/test/bipbop-frag-cenc-video.xml
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -3102,16 +3102,22 @@ this.DOMApplicationRegistry = {
     let appObject = this._cloneApp(aData, app, manifest, jsonManifest, id, localId);
 
     this.webapps[id] = appObject;
 
     // For package apps, the permissions are not in the mini-manifest, so
     // don't update the permissions yet.
     if (!aData.isPackage) {
       if (supportUseCurrentProfile()) {
+        try {
+          if (Services.prefs.getBoolPref("dom.apps.developer_mode")) {
+            this.webapps[id].appStatus =
+              AppsUtils.getAppManifestStatus(app.manifest);
+          }
+        } catch(e) {};
         PermissionsInstaller.installPermissions(
           {
             origin: appObject.origin,
             manifestURL: appObject.manifestURL,
             manifest: jsonManifest,
             kind: appObject.kind
           },
           isReinstall,
--- a/dom/archivereader/ArchiveReader.cpp
+++ b/dom/archivereader/ArchiveReader.cpp
@@ -100,17 +100,17 @@ ArchiveReader::GetInputStream(nsIInputSt
   return NS_OK;
 }
 
 nsresult
 ArchiveReader::GetSize(uint64_t* aSize)
 {
   ErrorResult rv;
   *aSize = mFileImpl->GetSize(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Here we open the archive:
 nsresult
 ArchiveReader::OpenArchive()
 {
   mStatus = WORKING;
   nsresult rv;
--- a/dom/archivereader/ArchiveZipFile.cpp
+++ b/dom/archivereader/ArchiveZipFile.cpp
@@ -360,17 +360,17 @@ ArchiveZipFileImpl::GetInternalStream(ns
 {
   if (mLength > INT32_MAX) {
     return NS_ERROR_FAILURE;
   }
 
   ErrorResult rv;
   uint64_t size = mFileImpl->GetSize(rv);
   if (NS_WARN_IF(rv.Failed())) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   nsCOMPtr<nsIInputStream> inputStream;
   rv = mFileImpl->GetInternalStream(getter_AddRefs(inputStream));
   if (NS_WARN_IF(rv.Failed()) || !inputStream) {
     return NS_ERROR_UNEXPECTED;
   }
 
--- a/dom/base/Attr.cpp
+++ b/dom/base/Attr.cpp
@@ -210,17 +210,17 @@ Attr::SetValue(const nsAString& aValue, 
                          true);
 }
 
 NS_IMETHODIMP
 Attr::SetValue(const nsAString& aValue)
 {
   ErrorResult rv;
   SetValue(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 Attr::Specified() const
 {
   return true;
 }
 
--- a/dom/base/DOMCursor.cpp
+++ b/dom/base/DOMCursor.cpp
@@ -52,17 +52,17 @@ DOMCursor::GetDone(bool *aDone)
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMCursor::Continue()
 {
   ErrorResult rv;
   Continue(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DOMCursor::Continue(ErrorResult& aRv)
 {
   MOZ_ASSERT(mCallback, "If you're creating your own cursor class with no callback, you should override Continue()");
 
   // We need to have a result here because we must be in a 'success' state.
--- a/dom/base/DOMImplementation.cpp
+++ b/dom/base/DOMImplementation.cpp
@@ -85,17 +85,17 @@ NS_IMETHODIMP
 DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
                                       const nsAString& aPublicId,
                                       const nsAString& aSystemId,
                                       nsIDOMDocumentType** aReturn)
 {
   ErrorResult rv;
   *aReturn =
     CreateDocumentType(aQualifiedName, aPublicId, aSystemId, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsresult
 DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
                                   const nsAString& aQualifiedName,
                                   nsIDOMDocumentType* aDoctype,
                                   nsIDocument** aDocument,
                                   nsIDOMDocument** aDOMDocument)
--- a/dom/base/DocumentType.cpp
+++ b/dom/base/DocumentType.cpp
@@ -24,17 +24,17 @@ NS_NewDOMDocumentType(nsIDOMDocumentType
                       const nsAString& aPublicId,
                       const nsAString& aSystemId,
                       const nsAString& aInternalSubset)
 {
   NS_ENSURE_ARG_POINTER(aDocType);
   mozilla::ErrorResult rv;
   *aDocType = NS_NewDOMDocumentType(aNodeInfoManager, aName, aPublicId,
                                     aSystemId, aInternalSubset, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<mozilla::dom::DocumentType>
 NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
                       nsIAtom *aName,
                       const nsAString& aPublicId,
                       const nsAString& aSystemId,
                       const nsAString& aInternalSubset,
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1351,17 +1351,17 @@ nsresult
 Element::GetElementsByTagNameNS(const nsAString& namespaceURI,
                                 const nsAString& localName,
                                 nsIDOMHTMLCollection** aResult)
 {
   mozilla::ErrorResult rv;
   nsCOMPtr<nsIHTMLCollection> list =
     GetElementsByTagNameNS(namespaceURI, localName, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   list.forget(aResult);
   return NS_OK;
 }
 
 bool
 Element::HasAttributeNS(const nsAString& aNamespaceURI,
                         const nsAString& aLocalName) const
@@ -3004,17 +3004,17 @@ Element::GetTokenList(nsIAtom* aAtom, ns
 nsresult
 Element::SetTokenList(nsIAtom* aAtom, nsIVariant* aValue)
 {
   nsDOMSettableTokenList* itemType = GetTokenList(aAtom);
   nsAutoString string;
   aValue->GetAsAString(string);
   ErrorResult rv;
   itemType->SetValue(string, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Element*
 Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
 {
   nsCSSSelectorList* selectorList = ParseSelectorList(aSelector, aResult);
   if (!selectorList) {
     // Either we failed (and aResult already has the exception), or this
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -1513,39 +1513,39 @@ NS_IMETHOD GetAttributeNS(const nsAStrin
   Element::GetAttributeNS(namespaceURI, localName, _retval);                  \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD SetAttribute(const nsAString& name,                                \
                         const nsAString& value) override                      \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   Element::SetAttribute(name, value, rv);                                     \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                  \
 }                                                                             \
 NS_IMETHOD SetAttributeNS(const nsAString& namespaceURI,                      \
                           const nsAString& qualifiedName,                     \
                           const nsAString& value) final override              \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   Element::SetAttributeNS(namespaceURI, qualifiedName, value, rv);            \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 using Element::RemoveAttribute;                                               \
 NS_IMETHOD RemoveAttribute(const nsAString& name) final override              \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   RemoveAttribute(name, rv);                                                  \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD RemoveAttributeNS(const nsAString& namespaceURI,                   \
                              const nsAString& localName) final override       \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   Element::RemoveAttributeNS(namespaceURI, localName, rv);                    \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 using Element::HasAttribute;                                                  \
 NS_IMETHOD HasAttribute(const nsAString& name,                                \
                            bool* _retval) final override                      \
 {                                                                             \
   *_retval = HasAttribute(name);                                              \
   return NS_OK;                                                               \
 }                                                                             \
@@ -1571,44 +1571,44 @@ NS_IMETHOD SetAttributeNode(nsIDOMAttr* 
                             nsIDOMAttr** _retval) final override              \
 {                                                                             \
   if (!newAttr) {                                                             \
     return NS_ERROR_INVALID_POINTER;                                          \
   }                                                                           \
   mozilla::ErrorResult rv;                                                    \
   mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(newAttr);       \
   *_retval = Element::SetAttributeNode(*attr, rv).take();                     \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD RemoveAttributeNode(nsIDOMAttr* oldAttr,                           \
                                nsIDOMAttr** _retval) final override           \
 {                                                                             \
   if (!oldAttr) {                                                             \
     return NS_ERROR_INVALID_POINTER;                                          \
   }                                                                           \
   mozilla::ErrorResult rv;                                                    \
   mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(oldAttr);       \
   *_retval = Element::RemoveAttributeNode(*attr, rv).take();                  \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD GetAttributeNodeNS(const nsAString& namespaceURI,                  \
                               const nsAString& localName,                     \
                               nsIDOMAttr** _retval) final override            \
 {                                                                             \
   NS_IF_ADDREF(*_retval = Element::GetAttributeNodeNS(namespaceURI,           \
                                                       localName));            \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD SetAttributeNodeNS(nsIDOMAttr* newAttr,                            \
                               nsIDOMAttr** _retval) final override            \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   mozilla::dom::Attr* attr = static_cast<mozilla::dom::Attr*>(newAttr);       \
   *_retval = Element::SetAttributeNodeNS(*attr, rv).take();                   \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD GetElementsByTagName(const nsAString& name,                        \
                                 nsIDOMHTMLCollection** _retval) final         \
                                                                 override      \
 {                                                                             \
   Element::GetElementsByTagName(name, _retval);                               \
   return NS_OK;                                                               \
 }                                                                             \
@@ -1751,33 +1751,33 @@ NS_IMETHOD GetScrollTopMax(int32_t* aScr
   *aScrollTopMax = Element::ScrollTopMax();                                   \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD MozMatchesSelector(const nsAString& selector,                      \
                               bool* _retval) final override                   \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   *_retval = Element::MozMatchesSelector(selector, rv);                       \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD SetCapture(bool retargetToElement) final override                  \
 {                                                                             \
   Element::SetCapture(retargetToElement);                                     \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD ReleaseCapture(void) final override                                \
 {                                                                             \
   Element::ReleaseCapture();                                                  \
   return NS_OK;                                                               \
 }                                                                             \
 NS_IMETHOD MozRequestFullScreen(void) final override                          \
 {                                                                             \
   mozilla::ErrorResult rv;                                                    \
   Element::MozRequestFullScreen(nullptr, JS::UndefinedHandleValue, rv);       \
-  return rv.ErrorCode();                                                      \
+  return rv.StealNSResult();                                                      \
 }                                                                             \
 NS_IMETHOD MozRequestPointerLock(void) final override                         \
 {                                                                             \
   Element::MozRequestPointerLock();                                           \
   return NS_OK;                                                               \
 }                                                                             \
 using nsINode::QuerySelector;                                                 \
 NS_IMETHOD QuerySelector(const nsAString& aSelector,                          \
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -156,17 +156,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(File)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(File)
 
 /* static */ already_AddRefed<File>
 File::Create(nsISupports* aParent, const nsAString& aName,
              const nsAString& aContentType, uint64_t aLength,
-             uint64_t aLastModifiedDate)
+             int64_t aLastModifiedDate)
 {
   nsRefPtr<File> file = new File(aParent,
     new FileImplBase(aName, aContentType, aLength, aLastModifiedDate));
   return file.forget();
 }
 
 /* static */ already_AddRefed<File>
 File::Create(nsISupports* aParent, const nsAString& aName,
@@ -194,17 +194,17 @@ File::Create(nsISupports* aParent, const
     new FileImplBase(aContentType, aStart, aLength));
   return file.forget();
 }
 
 /* static */ already_AddRefed<File>
 File::CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer,
                        uint64_t aLength, const nsAString& aName,
                        const nsAString& aContentType,
-                       uint64_t aLastModifiedDate)
+                       int64_t aLastModifiedDate)
 {
   nsRefPtr<File> file = new File(aParent,
     new FileImplMemory(aMemoryBuffer, aLength, aName,
                        aContentType, aLastModifiedDate));
   return file.forget();
 }
 
 /* static */ already_AddRefed<File>
@@ -342,17 +342,17 @@ File::GetPath(nsAString& aPath)
 
 NS_IMETHODIMP
 File::GetLastModifiedDate(JSContext* aCx,
                           JS::MutableHandle<JS::Value> aDate)
 {
   ErrorResult rv;
   Date value = GetLastModifiedDate(rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   if (!value.ToDateObject(aCx, aDate)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
@@ -374,64 +374,64 @@ File::GetLastModified(ErrorResult& aRv)
   return mImpl->GetLastModified(aRv);
 }
 
 NS_IMETHODIMP
 File::GetMozFullPath(nsAString& aFileName)
 {
   ErrorResult rv;
   GetMozFullPath(aFileName, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 File::GetMozFullPath(nsAString& aFilename, ErrorResult& aRv)
 {
   mImpl->GetMozFullPath(aFilename, aRv);
 }
 
 NS_IMETHODIMP
 File::GetMozFullPathInternal(nsAString& aFileName)
 {
   ErrorResult rv;
   mImpl->GetMozFullPathInternal(aFileName, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 File::GetSize(uint64_t* aSize)
 {
   MOZ_ASSERT(aSize);
 
   ErrorResult rv;
   *aSize = GetSize(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 uint64_t
 File::GetSize(ErrorResult& aRv)
 {
   return mImpl->GetSize(aRv);
 }
 
 NS_IMETHODIMP
 File::GetType(nsAString &aType)
 {
   mImpl->GetType(aType);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-File::GetMozLastModifiedDate(uint64_t* aDate)
+File::GetMozLastModifiedDate(int64_t* aDate)
 {
   MOZ_ASSERT(aDate);
 
   ErrorResult rv;
   *aDate = GetLastModified(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Makes sure that aStart and aEnd is less then or equal to aSize and greater
 // than 0
 static void
 ParseSize(int64_t aSize, int64_t& aStart, int64_t& aEnd)
 {
   CheckedInt64 newStartOffset = aStart;
@@ -479,17 +479,17 @@ File::Slice(int64_t aStart, int64_t aEnd
   Optional<int64_t> end;
   if (aArgc > 1) {
     end.Construct(aEnd);
   }
 
   ErrorResult rv;
   nsRefPtr<File> file = Slice(start, end, aContentType, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   file.forget(aBlob);
   return NS_OK;
 }
 
 already_AddRefed<File>
 File::Slice(const Optional<int64_t>& aStart,
@@ -898,17 +898,17 @@ FileImplBase::GetSendInfo(nsIInputStream
 
   nsCOMPtr<nsIInputStream> stream;
   rv = GetInternalStream(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   ErrorResult error;
   *aContentLength = GetSize(error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   nsAutoString contentType;
   GetType(contentType);
 
   CopyUTF16toUTF8(contentType, aContentType);
 
   aCharset.Truncate();
@@ -934,17 +934,17 @@ FileImplBase::SetMutable(bool aMutable)
   if (!mImmutable && !aMutable) {
     // Force the content type and size to be cached
     nsAutoString dummyString;
     GetType(dummyString);
 
     ErrorResult error;
     GetSize(error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
   }
 
   mImmutable = !aMutable;
   return rv;
 }
 
 ////////////////////////////////////////////////////////////////////////////
--- a/dom/base/File.h
+++ b/dom/base/File.h
@@ -62,17 +62,17 @@ public:
   NS_DECL_NSIMUTABLE
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(File, nsIDOMFile)
 
   static already_AddRefed<File>
   Create(nsISupports* aParent, const nsAString& aName,
          const nsAString& aContentType, uint64_t aLength,
-         uint64_t aLastModifiedDate);
+         int64_t aLastModifiedDate);
 
   static already_AddRefed<File>
   Create(nsISupports* aParent, const nsAString& aName,
          const nsAString& aContentType, uint64_t aLength);
 
   static already_AddRefed<File>
   Create(nsISupports* aParent, const nsAString& aContentType,
          uint64_t aLength);
@@ -82,17 +82,17 @@ public:
          uint64_t aLength);
 
   // The returned File takes ownership of aMemoryBuffer. aMemoryBuffer will be
   // freed by free so it must be allocated by malloc or something
   // compatible with it.
   static already_AddRefed<File>
   CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength,
                    const nsAString& aName, const nsAString& aContentType,
-                   uint64_t aLastModifiedDate);
+                   int64_t aLastModifiedDate);
 
   // The returned File takes ownership of aMemoryBuffer. aMemoryBuffer will be
   // freed by free so it must be allocated by malloc or something
   // compatible with it.
   static already_AddRefed<File>
   CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength,
                    const nsAString& aContentType);
 
@@ -271,17 +271,17 @@ public:
 
   virtual nsresult GetMutable(bool* aMutable) const = 0;
 
   virtual nsresult SetMutable(bool aMutable) = 0;
 
   virtual void SetLazyData(const nsAString& aName,
                            const nsAString& aContentType,
                            uint64_t aLength,
-                           uint64_t aLastModifiedDate) = 0;
+                           int64_t aLastModifiedDate) = 0;
 
   virtual bool IsMemoryFile() const = 0;
 
   virtual bool IsSizeUnknown() const = 0;
 
   virtual bool IsDateUnknown() const = 0;
 
   virtual bool IsFile() const = 0;
@@ -297,17 +297,17 @@ protected:
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(FileImpl, FILEIMPL_IID)
 
 class FileImplBase : public FileImpl
 {
 public:
   FileImplBase(const nsAString& aName, const nsAString& aContentType,
-               uint64_t aLength, uint64_t aLastModifiedDate)
+               uint64_t aLength, int64_t aLastModifiedDate)
     : mIsFile(true)
     , mImmutable(false)
     , mContentType(aContentType)
     , mName(aName)
     , mStart(0)
     , mLength(aLength)
     , mLastModificationDate(aLastModifiedDate)
   {
@@ -318,42 +318,42 @@ public:
   FileImplBase(const nsAString& aName, const nsAString& aContentType,
                uint64_t aLength)
     : mIsFile(true)
     , mImmutable(false)
     , mContentType(aContentType)
     , mName(aName)
     , mStart(0)
     , mLength(aLength)
-    , mLastModificationDate(UINT64_MAX)
+    , mLastModificationDate(INT64_MAX)
   {
     // Ensure non-null mContentType by default
     mContentType.SetIsVoid(false);
   }
 
   FileImplBase(const nsAString& aContentType, uint64_t aLength)
     : mIsFile(false)
     , mImmutable(false)
     , mContentType(aContentType)
     , mStart(0)
     , mLength(aLength)
-    , mLastModificationDate(UINT64_MAX)
+    , mLastModificationDate(INT64_MAX)
   {
     // Ensure non-null mContentType by default
     mContentType.SetIsVoid(false);
   }
 
   FileImplBase(const nsAString& aContentType, uint64_t aStart,
                uint64_t aLength)
     : mIsFile(false)
     , mImmutable(false)
     , mContentType(aContentType)
     , mStart(aStart)
     , mLength(aLength)
-    , mLastModificationDate(UINT64_MAX)
+    , mLastModificationDate(INT64_MAX)
   {
     NS_ASSERTION(aLength != UINT64_MAX,
                  "Must know length when creating slice");
     // Ensure non-null mContentType by default
     mContentType.SetIsVoid(false);
   }
 
   virtual void GetName(nsAString& aName) override;
@@ -407,17 +407,17 @@ public:
                                nsACString& aCharset) override;
 
   virtual nsresult GetMutable(bool* aMutable) const override;
 
   virtual nsresult SetMutable(bool aMutable) override;
 
   virtual void
   SetLazyData(const nsAString& aName, const nsAString& aContentType,
-              uint64_t aLength, uint64_t aLastModifiedDate) override
+              uint64_t aLength, int64_t aLastModifiedDate) override
   {
     NS_ASSERTION(aLength, "must have length");
 
     mName = aName;
     mContentType = aContentType;
     mLength = aLength;
     mLastModificationDate = aLastModifiedDate;
     mIsFile = !aName.IsVoid();
@@ -425,17 +425,17 @@ public:
 
   virtual bool IsMemoryFile() const override
   {
     return false;
   }
 
   virtual bool IsDateUnknown() const override
   {
-    return mIsFile && mLastModificationDate == UINT64_MAX;
+    return mIsFile && mLastModificationDate == INT64_MAX;
   }
 
   virtual bool IsFile() const override
   {
     return mIsFile;
   }
 
   virtual bool IsStoredFile() const
@@ -475,33 +475,33 @@ protected:
 
   nsString mContentType;
   nsString mName;
   nsString mPath; // The path relative to a directory chosen by the user
 
   uint64_t mStart;
   uint64_t mLength;
 
-  uint64_t mLastModificationDate;
+  int64_t mLastModificationDate;
 
   // Protected by IndexedDatabaseManager::FileMutex()
   nsTArray<nsRefPtr<indexedDB::FileInfo>> mFileInfos;
 };
 
 /**
  * This class may be used off the main thread, and in particular, its
  * constructor and destructor may not run on the same thread.  Be careful!
  */
 class FileImplMemory final : public FileImplBase
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   FileImplMemory(void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
-                 const nsAString& aContentType, uint64_t aLastModifiedDate)
+                 const nsAString& aContentType, int64_t aLastModifiedDate)
     : FileImplBase(aName, aContentType, aLength, aLastModifiedDate)
     , mDataOwner(new DataOwner(aMemoryBuffer, aLength))
   {
     NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
   }
 
   FileImplMemory(void* aMemoryBuffer, uint64_t aLength,
                  const nsAString& aContentType)
@@ -620,30 +620,30 @@ private:
 
 class FileImplFile : public FileImplBase
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // Create as a file
   explicit FileImplFile(nsIFile* aFile, bool aTemporary = false)
-    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
+    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, INT64_MAX)
     , mFile(aFile)
     , mWholeFile(true)
     , mStoredFile(false)
     , mIsTemporary(aTemporary)
   {
     NS_ASSERTION(mFile, "must have file");
     // Lazily get the content type and size
     mContentType.SetIsVoid(true);
     mFile->GetLeafName(mName);
   }
 
   FileImplFile(nsIFile* aFile, indexedDB::FileInfo* aFileInfo)
-    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
+    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, INT64_MAX)
     , mFile(aFile)
     , mWholeFile(true)
     , mStoredFile(true)
     , mIsTemporary(false)
   {
     NS_ASSERTION(mFile, "must have file");
     NS_ASSERTION(aFileInfo, "must have file info");
     // Lazily get the content type and size
@@ -662,30 +662,30 @@ public:
     , mStoredFile(false)
     , mIsTemporary(false)
   {
     NS_ASSERTION(mFile, "must have file");
   }
 
   FileImplFile(const nsAString& aName, const nsAString& aContentType,
                uint64_t aLength, nsIFile* aFile,
-               uint64_t aLastModificationDate)
+               int64_t aLastModificationDate)
     : FileImplBase(aName, aContentType, aLength, aLastModificationDate)
     , mFile(aFile)
     , mWholeFile(true)
     , mStoredFile(false)
     , mIsTemporary(false)
   {
     NS_ASSERTION(mFile, "must have file");
   }
 
   // Create as a file with custom name
   FileImplFile(nsIFile* aFile, const nsAString& aName,
                const nsAString& aContentType)
-    : FileImplBase(aName, aContentType, UINT64_MAX, UINT64_MAX)
+    : FileImplBase(aName, aContentType, UINT64_MAX, INT64_MAX)
     , mFile(aFile)
     , mWholeFile(true)
     , mStoredFile(false)
     , mIsTemporary(false)
   {
     NS_ASSERTION(mFile, "must have file");
     if (aContentType.IsEmpty()) {
       // Lazily get the content type and size
@@ -717,17 +717,17 @@ public:
     , mIsTemporary(false)
   {
     NS_ASSERTION(mFile, "must have file");
     mFileInfos.AppendElement(aFileInfo);
   }
 
   // Create as a file to be later initialized
   FileImplFile()
-    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
+    : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, INT64_MAX)
     , mWholeFile(true)
     , mStoredFile(false)
     , mIsTemporary(false)
   {
     // Lazily get the content type and size
     mContentType.SetIsVoid(true);
     mName.SetIsVoid(true);
   }
--- a/dom/base/MultipartFileImpl.cpp
+++ b/dom/base/MultipartFileImpl.cpp
@@ -182,20 +182,20 @@ MultipartFileImpl::InitializeBlob(
   mBlobImpls = blobSet.GetBlobImpls();
   SetLengthAndModifiedDate();
 }
 
 void
 MultipartFileImpl::SetLengthAndModifiedDate()
 {
   MOZ_ASSERT(mLength == UINT64_MAX);
-  MOZ_ASSERT(mLastModificationDate == UINT64_MAX);
+  MOZ_ASSERT(mLastModificationDate == INT64_MAX);
 
   uint64_t totalLength = 0;
-  uint64_t lastModified = 0;
+  int64_t lastModified = 0;
   bool lastModifiedSet = false;
 
   for (uint32_t index = 0, count = mBlobImpls.Length(); index < count; index++) {
     nsRefPtr<FileImpl>& blob = mBlobImpls[index];
 
 #ifdef DEBUG
     MOZ_ASSERT(!blob->IsSizeUnknown());
     MOZ_ASSERT(!blob->IsDateUnknown());
@@ -204,17 +204,17 @@ MultipartFileImpl::SetLengthAndModifiedD
     ErrorResult error;
     uint64_t subBlobLength = blob->GetSize(error);
     MOZ_ALWAYS_TRUE(!error.Failed());
 
     MOZ_ASSERT(UINT64_MAX - subBlobLength >= totalLength);
     totalLength += subBlobLength;
 
     if (blob->IsFile()) {
-      uint64_t partLastModified = blob->GetLastModified(error);
+      int64_t partLastModified = blob->GetLastModified(error);
       MOZ_ALWAYS_TRUE(!error.Failed());
 
       if (lastModified < partLastModified) {
         lastModified = partLastModified;
         lastModifiedSet = true;
       }
     }
   }
@@ -360,17 +360,18 @@ MultipartFileImpl::InitializeChromeFile(
   // Pre-cache size.
   uint64_t unused;
   aRv = blob->GetSize(&unused);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   // Pre-cache modified date.
-  aRv = blob->GetMozLastModifiedDate(&unused);
+  int64_t unusedDate;
+  aRv = blob->GetMozLastModifiedDate(&unusedDate);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
   // XXXkhuey this is terrible
   if (mContentType.IsEmpty()) {
     blob->GetType(mContentType);
   }
--- a/dom/base/NodeIterator.h
+++ b/dom/base/NodeIterator.h
@@ -95,17 +95,17 @@ private:
 
     // Implementation for some of our XPCOM getters
     typedef already_AddRefed<nsINode> (NodeIterator::*NodeGetter)(ErrorResult&);
     inline nsresult ImplNodeGetter(NodeGetter aGetter, nsIDOMNode** aRetval)
     {
         mozilla::ErrorResult rv;
         nsCOMPtr<nsINode> node = (this->*aGetter)(rv);
         if (rv.Failed()) {
-            return rv.ErrorCode();
+            return rv.StealNSResult();
         }
         *aRetval = node ? node.forget().take()->AsDOMNode() : nullptr;
         return NS_OK;
     }
 
     // Have to return a strong ref, because the act of testing the node can
     // remove it from the DOM so we're holding the only ref to it.
     already_AddRefed<nsINode>
--- a/dom/base/TreeWalker.cpp
+++ b/dom/base/TreeWalker.cpp
@@ -101,17 +101,17 @@ NS_IMETHODIMP TreeWalker::SetCurrentNode
     NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     NS_ENSURE_TRUE(mRoot, NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentNode);
     NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
 
     ErrorResult rv;
     SetCurrentNode(*node, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 void
 TreeWalker::SetCurrentNode(nsINode& aNode, ErrorResult& aResult)
 {
     aResult = nsContentUtils::CheckSameOrigin(mRoot, &aNode);
     if (aResult.Failed()) {
         return;
--- a/dom/base/TreeWalker.h
+++ b/dom/base/TreeWalker.h
@@ -92,17 +92,17 @@ private:
 
     // Implementation for our various XPCOM getters
     typedef already_AddRefed<nsINode> (TreeWalker::*NodeGetter)(ErrorResult&);
     inline nsresult ImplNodeGetter(NodeGetter aGetter, nsIDOMNode** aRetval)
     {
         mozilla::ErrorResult rv;
         nsCOMPtr<nsINode> node = (this->*aGetter)(rv);
         if (rv.Failed()) {
-            return rv.ErrorCode();
+            return rv.StealNSResult();
         }
         *aRetval = node ? node.forget().take()->AsDOMNode() : nullptr;
         return NS_OK;
     }
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3769,17 +3769,17 @@ nsContentUtils::ConvertStringFromEncodin
   }
 
   ErrorResult rv;
   nsAutoPtr<TextDecoder> decoder(new TextDecoder());
   decoder->InitWithEncoding(encoding, false);
 
   decoder->Decode(aInput.BeginReading(), aInput.Length(), false,
                   aOutput, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* static */
 bool
 nsContentUtils::CheckForBOM(const unsigned char* aBuffer, uint32_t aLength,
                             nsACString& aCharset)
 {
   bool found = true;
@@ -4106,17 +4106,17 @@ nsresult
 nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
                                          const nsAString& aFragment,
                                          bool aPreventScriptExecution,
                                          nsIDOMDocumentFragment** aReturn)
 {
   ErrorResult rv;
   *aReturn = CreateContextualFragment(aContextNode, aFragment,
                                       aPreventScriptExecution, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DocumentFragment>
 nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
                                          const nsAString& aFragment,
                                          bool aPreventScriptExecution,
                                          ErrorResult& aRv)
 {
--- a/dom/base/nsDOMAttributeMap.cpp
+++ b/dom/base/nsDOMAttributeMap.cpp
@@ -245,28 +245,28 @@ nsDOMAttributeMap::GetNamedItem(const ns
 NS_IMETHODIMP
 nsDOMAttributeMap::SetNamedItem(nsIDOMAttr* aAttr, nsIDOMAttr** aReturn)
 {
   Attr* attribute = static_cast<Attr*>(aAttr);
   NS_ENSURE_ARG(attribute);
 
   ErrorResult rv;
   *aReturn = SetNamedItem(*attribute, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMAttributeMap::SetNamedItemNS(nsIDOMAttr* aAttr, nsIDOMAttr** aReturn)
 {
   Attr* attribute = static_cast<Attr*>(aAttr);
   NS_ENSURE_ARG(attribute);
 
   ErrorResult rv;
   *aReturn = SetNamedItemNS(*attribute, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Attr>
 nsDOMAttributeMap::SetNamedItemInternal(Attr& aAttr,
                                         bool aWithNS,
                                         ErrorResult& aError)
 {
   NS_ENSURE_TRUE(mContent, nullptr);
@@ -373,17 +373,17 @@ nsDOMAttributeMap::RemoveNamedItem(NodeI
 NS_IMETHODIMP
 nsDOMAttributeMap::RemoveNamedItem(const nsAString& aName,
                                    nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
   ErrorResult rv;
   *aReturn = RemoveNamedItem(aName, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Attr>
 nsDOMAttributeMap::RemoveNamedItem(const nsAString& aName, ErrorResult& aError)
 {
   if (!mContent) {
     aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
     return nullptr;
@@ -511,17 +511,17 @@ nsDOMAttributeMap::GetAttrNodeInfo(const
 NS_IMETHODIMP
 nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
                                      const nsAString& aLocalName,
                                      nsIDOMAttr** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   ErrorResult rv;
   *aReturn = RemoveNamedItemNS(aNamespaceURI, aLocalName, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Attr>
 nsDOMAttributeMap::RemoveNamedItemNS(const nsAString& aNamespaceURI,
                                      const nsAString& aLocalName,
                                      ErrorResult& aError)
 {
   nsRefPtr<mozilla::dom::NodeInfo> ni = GetAttrNodeInfo(aNamespaceURI, aLocalName);
--- a/dom/base/nsDOMFileReader.cpp
+++ b/dom/base/nsDOMFileReader.cpp
@@ -183,56 +183,56 @@ nsDOMFileReader::GetError(nsISupports** 
 
 NS_IMETHODIMP
 nsDOMFileReader::ReadAsArrayBuffer(nsIDOMBlob* aFile, JSContext* aCx)
 {
   NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
   ErrorResult rv;
   nsRefPtr<File> file = static_cast<File*>(aFile);
   ReadAsArrayBuffer(aCx, *file, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMFileReader::ReadAsBinaryString(nsIDOMBlob* aFile)
 {
   NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
   ErrorResult rv;
   nsRefPtr<File> file = static_cast<File*>(aFile);
   ReadAsBinaryString(*file, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMFileReader::ReadAsText(nsIDOMBlob* aFile,
                             const nsAString &aCharset)
 {
   NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
   ErrorResult rv;
   nsRefPtr<File> file = static_cast<File*>(aFile);
   ReadAsText(*file, aCharset, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMFileReader::ReadAsDataURL(nsIDOMBlob* aFile)
 {
   NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
   ErrorResult rv;
   nsRefPtr<File> file = static_cast<File*>(aFile);
   ReadAsDataURL(*file, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMFileReader::Abort()
 {
   ErrorResult rv;
   FileIOObject::Abort(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* virtual */ void
 nsDOMFileReader::DoAbort(nsAString& aEvent)
 {
   // Revert status and result attributes
   SetDOMStringToNull(mResult);
   mResultArrayBuffer = nullptr;
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -3467,17 +3467,17 @@ nsDOMWindowUtils::GetOMTAStyle(nsIDOMEle
     }
   }
 
   if (cssValue) {
     nsString text;
     ErrorResult rv;
     cssValue->GetCssText(text, rv);
     aResult.Assign(text);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   } else {
     aResult.Truncate();
   }
 
   return NS_OK;
 }
 
 namespace {
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3335,17 +3335,17 @@ nsDocument::Timeline()
 
 /* Return true if the document is in the focused top-level window, and is an
  * ancestor of the focused DOMWindow. */
 NS_IMETHODIMP
 nsDocument::HasFocus(bool* aResult)
 {
   ErrorResult rv;
   *aResult = nsIDocument::HasFocus(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsIDocument::HasFocus(ErrorResult& rv) const
 {
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
   if (!fm) {
     rv.Throw(NS_ERROR_NOT_AVAILABLE);
@@ -5456,17 +5456,17 @@ nsDocument::GetDoctype(nsIDOMDocumentTyp
 
 NS_IMETHODIMP
 nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
 {
   ErrorResult rv;
   *aImplementation = GetImplementation(rv);
   if (rv.Failed()) {
     MOZ_ASSERT(!*aImplementation);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_ADDREF(*aImplementation);
   return NS_OK;
 }
 
 DOMImplementation*
 nsDocument::GetImplementation(ErrorResult& rv)
 {
@@ -5508,17 +5508,17 @@ nsDocument::GetDocumentElement(nsIDOMEle
 
 NS_IMETHODIMP
 nsDocument::CreateElement(const nsAString& aTagName,
                           nsIDOMElement** aReturn)
 {
   *aReturn = nullptr;
   ErrorResult rv;
   nsCOMPtr<Element> element = nsIDocument::CreateElement(aTagName, rv);
-  NS_ENSURE_FALSE(rv.Failed(), rv.ErrorCode());
+  NS_ENSURE_FALSE(rv.Failed(), rv.StealNSResult());
   return CallQueryInterface(element, aReturn);
 }
 
 bool IsLowercaseASCII(const nsAString& aValue)
 {
   int32_t len = aValue.Length();
   for (int32_t i = 0; i < len; ++i) {
     char16_t c = aValue[i];
@@ -5615,17 +5615,17 @@ NS_IMETHODIMP
 nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
                             const nsAString& aQualifiedName,
                             nsIDOMElement** aReturn)
 {
   *aReturn = nullptr;
   ErrorResult rv;
   nsCOMPtr<Element> element =
     nsIDocument::CreateElementNS(aNamespaceURI, aQualifiedName, rv);
-  NS_ENSURE_FALSE(rv.Failed(), rv.ErrorCode());
+  NS_ENSURE_FALSE(rv.Failed(), rv.StealNSResult());
   return CallQueryInterface(element, aReturn);
 }
 
 already_AddRefed<Element>
 nsIDocument::CreateElementNS(const nsAString& aNamespaceURI,
                              const nsAString& aQualifiedName,
                              ErrorResult& rv)
 {
@@ -5728,17 +5728,17 @@ nsIDocument::CreateComment(const nsAStri
 
 NS_IMETHODIMP
 nsDocument::CreateCDATASection(const nsAString& aData,
                                nsIDOMCDATASection** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   ErrorResult rv;
   *aReturn = nsIDocument::CreateCDATASection(aData, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<CDATASection>
 nsIDocument::CreateCDATASection(const nsAString& aData,
                                 ErrorResult& rv)
 {
   if (IsHTMLDocument()) {
     rv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
@@ -5761,17 +5761,17 @@ nsIDocument::CreateCDATASection(const ns
 NS_IMETHODIMP
 nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
                                         const nsAString& aData,
                                         nsIDOMProcessingInstruction** aReturn)
 {
   ErrorResult rv;
   *aReturn =
     nsIDocument::CreateProcessingInstruction(aTarget, aData, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<ProcessingInstruction>
 nsIDocument::CreateProcessingInstruction(const nsAString& aTarget,
                                          const nsAString& aData,
                                          ErrorResult& rv) const
 {
   nsresult res = nsContentUtils::CheckQName(aTarget, false);
@@ -5792,17 +5792,17 @@ nsIDocument::CreateProcessingInstruction
 }
 
 NS_IMETHODIMP
 nsDocument::CreateAttribute(const nsAString& aName,
                             nsIDOMAttr** aReturn)
 {
   ErrorResult rv;
   *aReturn = nsIDocument::CreateAttribute(aName, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Attr>
 nsIDocument::CreateAttribute(const nsAString& aName, ErrorResult& rv)
 {
   WarnOnceAbout(eCreateAttribute);
 
   if (!mNodeInfoManager) {
@@ -5833,17 +5833,17 @@ nsIDocument::CreateAttribute(const nsASt
 NS_IMETHODIMP
 nsDocument::CreateAttributeNS(const nsAString & aNamespaceURI,
                               const nsAString & aQualifiedName,
                               nsIDOMAttr **aResult)
 {
   ErrorResult rv;
   *aResult =
     nsIDocument::CreateAttributeNS(aNamespaceURI, aQualifiedName, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Attr>
 nsIDocument::CreateAttributeNS(const nsAString& aNamespaceURI,
                                const nsAString& aQualifiedName,
                                ErrorResult& rv)
 {
   WarnOnceAbout(eCreateAttributeNS);
@@ -6527,17 +6527,17 @@ NS_IMETHODIMP
 nsDocument::GetElementsByTagNameNS(const nsAString& aNamespaceURI,
                                    const nsAString& aLocalName,
                                    nsIDOMNodeList** aReturn)
 {
   ErrorResult rv;
   nsRefPtr<nsContentList> list =
     nsIDocument::GetElementsByTagNameNS(aNamespaceURI, aLocalName, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // transfer ref to aReturn
   list.forget(aReturn);
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -6751,17 +6751,17 @@ nsDocument::ImportNode(nsIDOMNode* aImpo
   *aResult = nullptr;
 
   nsCOMPtr<nsINode> imported = do_QueryInterface(aImportedNode);
   NS_ENSURE_TRUE(imported, NS_ERROR_UNEXPECTED);
 
   ErrorResult rv;
   nsCOMPtr<nsINode> result = nsIDocument::ImportNode(*imported, aDeep, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   NS_ADDREF(*aResult = result->AsDOMNode());
   return NS_OK;
 }
 
 already_AddRefed<nsINode>
 nsIDocument::ImportNode(nsINode& aNode, bool aDeep, ErrorResult& rv) const
@@ -6798,17 +6798,17 @@ nsIDocument::ImportNode(nsINode& aNode, 
   return nullptr;
 }
 
 NS_IMETHODIMP
 nsDocument::LoadBindingDocument(const nsAString& aURI)
 {
   ErrorResult rv;
   nsIDocument::LoadBindingDocument(aURI, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsIDocument::LoadBindingDocument(const nsAString& aURI, ErrorResult& rv)
 {
   nsCOMPtr<nsIURI> uri;
   rv = NS_NewURI(getter_AddRefs(uri), aURI,
                  mCharacterSet.get(),
@@ -6941,17 +6941,17 @@ nsIDocument::GetAnonymousNodes(Element& 
   return BindingManager()->GetAnonymousNodesFor(&aElement);
 }
 
 NS_IMETHODIMP
 nsDocument::CreateRange(nsIDOMRange** aReturn)
 {
   ErrorResult rv;
   *aReturn = nsIDocument::CreateRange(rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<nsRange>
 nsIDocument::CreateRange(ErrorResult& rv)
 {
   nsRefPtr<nsRange> range = new nsRange(this);
   nsresult res = range->Set(this, 0, this, 0);
   if (NS_FAILED(res)) {
@@ -6981,17 +6981,17 @@ nsDocument::CreateNodeIterator(nsIDOMNod
 
   nsCOMPtr<nsINode> root = do_QueryInterface(aRoot);
   NS_ENSURE_TRUE(root, NS_ERROR_UNEXPECTED);
 
   ErrorResult rv;
   NodeFilterHolder holder(aFilter);
   *_retval = nsIDocument::CreateNodeIterator(*root, aWhatToShow, holder,
                                              rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<NodeIterator>
 nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
                                 NodeFilter* aFilter,
                                 ErrorResult& rv) const
 {
   NodeFilterHolder holder(aFilter);
@@ -7024,17 +7024,17 @@ nsDocument::CreateTreeWalker(nsIDOMNode 
 
   nsCOMPtr<nsINode> root = do_QueryInterface(aRoot);
   NS_ENSURE_TRUE(root, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
 
   ErrorResult rv;
   NodeFilterHolder holder(aFilter);
   *_retval = nsIDocument::CreateTreeWalker(*root, aWhatToShow, holder,
                                            rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<TreeWalker>
 nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
                               NodeFilter* aFilter,
                               ErrorResult& rv) const
 {
   NodeFilterHolder holder(aFilter);
@@ -7746,17 +7746,17 @@ nsDocument::AdoptNode(nsIDOMNode *aAdopt
   *aResult = nullptr;
 
   nsCOMPtr<nsINode> adoptedNode = do_QueryInterface(aAdoptedNode);
   NS_ENSURE_TRUE(adoptedNode, NS_ERROR_UNEXPECTED);
 
   ErrorResult rv;
   nsINode* result = nsIDocument::AdoptNode(*adoptedNode, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   NS_ADDREF(*aResult = result->AsDOMNode());
   return NS_OK;
 }
 
 nsINode*
 nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
@@ -8191,17 +8191,17 @@ nsDocument::PreHandleEvent(EventChainPre
 }
 
 NS_IMETHODIMP
 nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
   ErrorResult rv;
   *aReturn = nsIDocument::CreateEvent(aEventType, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Event>
 nsIDocument::CreateEvent(const nsAString& aEventType, ErrorResult& rv) const
 {
   nsIPresShell *shell = GetShell();
 
   nsPresContext *presContext = nullptr;
@@ -11904,17 +11904,17 @@ nsDocument::RequestFullScreen(Element* a
 }
 
 NS_IMETHODIMP
 nsDocument::GetMozFullScreenElement(nsIDOMElement **aFullScreenElement)
 {
   ErrorResult rv;
   Element* el = GetMozFullScreenElement(rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   nsCOMPtr<nsIDOMElement> retval = do_QueryInterface(el);
   retval.forget(aFullScreenElement);
   return NS_OK;
 }
 
 Element*
 nsDocument::GetMozFullScreenElement(ErrorResult& rv)
--- a/dom/base/nsGenericDOMDataNode.cpp
+++ b/dom/base/nsGenericDOMDataNode.cpp
@@ -197,17 +197,17 @@ nsGenericDOMDataNode::GetLength(uint32_t
 }
 
 nsresult
 nsGenericDOMDataNode::SubstringData(uint32_t aStart, uint32_t aCount,
                                     nsAString& aReturn)
 {
   ErrorResult rv;
   SubstringData(aStart, aCount, aReturn, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGenericDOMDataNode::SubstringData(uint32_t aStart, uint32_t aCount,
                                     nsAString& aReturn, ErrorResult& rv)
 {
   aReturn.Truncate();
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3520,17 +3520,17 @@ nsGlobalWindow::Window()
 {
   return this;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetWindow(nsIDOMWindow** aWindow)
 {
   ErrorResult rv;
-  FORWARD_TO_OUTER_OR_THROW(GetWindow, (aWindow), rv, rv.ErrorCode());
+  FORWARD_TO_OUTER_OR_THROW(GetWindow, (aWindow), rv, rv.StealNSResult());
 
   nsCOMPtr<nsIDOMWindow> window = Window();
   window.forget(aWindow);
 
   return NS_OK;
 }
 
 nsIDOMWindow*
@@ -3543,17 +3543,17 @@ nsGlobalWindow::GetSelf(ErrorResult& aEr
 
 NS_IMETHODIMP
 nsGlobalWindow::GetSelf(nsIDOMWindow** aWindow)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMWindow> window = GetSelf(rv);
   window.forget(aWindow);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Navigator*
 nsGlobalWindow::GetNavigator(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetNavigator, (aError), aError, nullptr);
 
   if (!mNavigator) {
@@ -3565,17 +3565,17 @@ nsGlobalWindow::GetNavigator(ErrorResult
 
 NS_IMETHODIMP
 nsGlobalWindow::GetNavigator(nsIDOMNavigator** aNavigator)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMNavigator> navigator = GetNavigator(rv);
   navigator.forget(aNavigator);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsScreen*
 nsGlobalWindow::GetScreen(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetScreen, (aError), aError, nullptr);
 
   if (!mScreen) {
@@ -3591,17 +3591,17 @@ nsGlobalWindow::GetScreen(ErrorResult& a
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScreen(nsIDOMScreen** aScreen)
 {
   ErrorResult rv;
   nsRefPtr<nsScreen> screen = GetScreen(rv);
   screen.forget(aScreen);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsHistory*
 nsGlobalWindow::GetHistory(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetHistory, (aError), aError, nullptr);
 
   if (!mHistory) {
@@ -3613,17 +3613,17 @@ nsGlobalWindow::GetHistory(ErrorResult& 
 
 NS_IMETHODIMP
 nsGlobalWindow::GetHistory(nsISupports** aHistory)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> history = GetHistory(rv);
   history.forget(aHistory);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsPerformance*
 nsGlobalWindow::GetPerformance()
 {
   FORWARD_TO_INNER(GetPerformance, (), nullptr);
 
   return nsPIDOMWindow::GetPerformance();
@@ -3809,17 +3809,17 @@ nsGlobalWindow::GetParent(ErrorResult& a
  */
 NS_IMETHODIMP
 nsGlobalWindow::GetScriptableParent(nsIDOMWindow** aParent)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMWindow> parent = GetParent(rv);
   parent.forget(aParent);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /**
  * nsIDOMWindow::GetParent (when called from C++) is just a wrapper around
  * GetRealParent.
  */
 NS_IMETHODIMP
 nsGlobalWindow::GetRealParent(nsIDOMWindow** aParent)
@@ -3996,17 +3996,17 @@ nsGlobalWindow::GetContentInternal(Error
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetContent(nsIDOMWindow** aContent)
 {
   ErrorResult rv;
   *aContent = GetContentInternal(rv).take();
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 MozSelfSupport*
 nsGlobalWindow::GetMozSelfSupport(ErrorResult& aError)
 {
   if (mMozSelfSupport) {
     return mMozSelfSupport;
   }
@@ -4022,17 +4022,17 @@ nsGlobalWindow::GetScriptableContent(JSC
 {
   ErrorResult rv;
   JS::Rooted<JSObject*> content(aCx);
   GetContent(aCx, &content, rv);
   if (!rv.Failed()) {
     aVal.setObjectOrNull(content);
   }
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetPrompter(nsIPrompt** aPrompt)
 {
   if (IsInnerWindow()) {
     nsGlobalWindow* outer = GetOuterWindowInternal();
     if (!outer) {
@@ -4066,17 +4066,17 @@ nsGlobalWindow::GetMenubar(ErrorResult& 
 
 NS_IMETHODIMP
 nsGlobalWindow::GetMenubar(nsISupports** aMenubar)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> menubar = GetMenubar(rv);
   menubar.forget(aMenubar);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 BarProp*
 nsGlobalWindow::GetToolbar(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetToolbar, (aError), aError, nullptr);
 
   if (!mToolbar) {
@@ -4088,17 +4088,17 @@ nsGlobalWindow::GetToolbar(ErrorResult& 
 
 NS_IMETHODIMP
 nsGlobalWindow::GetToolbar(nsISupports** aToolbar)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> toolbar = GetToolbar(rv);
   toolbar.forget(aToolbar);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 BarProp*
 nsGlobalWindow::GetLocationbar(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetLocationbar, (aError), aError, nullptr);
 
   if (!mLocationbar) {
@@ -4109,17 +4109,17 @@ nsGlobalWindow::GetLocationbar(ErrorResu
 
 NS_IMETHODIMP
 nsGlobalWindow::GetLocationbar(nsISupports** aLocationbar)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> locationbar = GetLocationbar(rv);
   locationbar.forget(aLocationbar);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 BarProp*
 nsGlobalWindow::GetPersonalbar(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetPersonalbar, (aError), aError, nullptr);
 
   if (!mPersonalbar) {
@@ -4130,17 +4130,17 @@ nsGlobalWindow::GetPersonalbar(ErrorResu
 
 NS_IMETHODIMP
 nsGlobalWindow::GetPersonalbar(nsISupports** aPersonalbar)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> personalbar = GetPersonalbar(rv);
   personalbar.forget(aPersonalbar);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 BarProp*
 nsGlobalWindow::GetStatusbar(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetStatusbar, (aError), aError, nullptr);
 
   if (!mStatusbar) {
@@ -4151,17 +4151,17 @@ nsGlobalWindow::GetStatusbar(ErrorResult
 
 NS_IMETHODIMP
 nsGlobalWindow::GetStatusbar(nsISupports** aStatusbar)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> statusbar = GetStatusbar(rv);
   statusbar.forget(aStatusbar);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 BarProp*
 nsGlobalWindow::GetScrollbars(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetScrollbars, (aError), aError, nullptr);
 
   if (!mScrollbars) {
@@ -4173,17 +4173,17 @@ nsGlobalWindow::GetScrollbars(ErrorResul
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollbars(nsISupports** aScrollbars)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> scrollbars = GetScrollbars(rv);
   scrollbars.forget(aScrollbars);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsGlobalWindow::GetClosed(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetClosed, (aError), aError, false);
 
   // If someone called close(), or if we don't have a docshell, we're closed.
@@ -4191,17 +4191,17 @@ nsGlobalWindow::GetClosed(ErrorResult& a
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetClosed(bool* aClosed)
 {
   ErrorResult rv;
   *aClosed = GetClosed(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsDOMWindowList*
 nsGlobalWindow::GetWindowList()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mFrames && mDocShell) {
@@ -4377,17 +4377,17 @@ nsGlobalWindow::GetApplicationCache(Erro
 NS_IMETHODIMP
 nsGlobalWindow::GetApplicationCache(nsIDOMOfflineResourceList **aApplicationCache)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMOfflineResourceList> applicationCache =
     GetApplicationCache(rv);
   applicationCache.forget(aApplicationCache);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Crypto*
 nsGlobalWindow::GetCrypto(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetCrypto, (aError), aError, nullptr);
 
   if (!mCrypto) {
@@ -4399,17 +4399,17 @@ nsGlobalWindow::GetCrypto(ErrorResult& a
 
 NS_IMETHODIMP
 nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMCrypto> crypto = GetCrypto(rv);
   crypto.forget(aCrypto);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIControllers*
 nsGlobalWindow::GetControllers(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetControllers, (aError), aError, nullptr);
 
   if (!mControllers) {
@@ -4443,17 +4443,17 @@ nsGlobalWindow::GetControllers(ErrorResu
 
 NS_IMETHODIMP
 nsGlobalWindow::GetControllers(nsIControllers** aResult)
 {
   ErrorResult rv;
   nsCOMPtr<nsIControllers> controllers = GetControllers(rv);
   controllers.forget(aResult);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIDOMWindow*
 nsGlobalWindow::GetOpenerWindow(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetOpenerWindow, (aError), aError, nullptr);
 
   nsCOMPtr<nsPIDOMWindow> opener = do_QueryReferent(mOpener);
@@ -4514,26 +4514,26 @@ nsGlobalWindow::GetOpener(JSContext* aCx
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScriptableOpener(JSContext* aCx,
                                     JS::MutableHandle<JS::Value> aOpener)
 {
   ErrorResult rv;
   GetOpener(aCx, aOpener, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetOpener(nsIDOMWindow** aOpener)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMWindow> opener = GetOpenerWindow(rv);
   opener.forget(aOpener);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
                           ErrorResult& aError)
 {
   // Check if we were called from a privileged chrome script.  If not, and if
   // aOpener is not null, just define aOpener on our inner window's JS object,
@@ -4582,17 +4582,17 @@ nsGlobalWindow::SetOpener(JSContext* aCx
 
 NS_IMETHODIMP
 nsGlobalWindow::SetScriptableOpener(JSContext* aCx,
                                     JS::Handle<JS::Value> aOpener)
 {
   ErrorResult rv;
   SetOpener(aCx, aOpener, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SetOpener(nsIDOMWindow* aOpener)
 {
   SetOpenerWindow(aOpener, false);
   return NS_OK;
 }
@@ -4606,17 +4606,17 @@ nsGlobalWindow::GetStatus(nsAString& aSt
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetStatus(nsAString& aStatus)
 {
   ErrorResult rv;
   GetStatus(aStatus, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetStatus(const nsAString& aStatus, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetStatus, (aStatus, aError), aError, );
 
   mStatus = aStatus;
@@ -4638,17 +4638,17 @@ nsGlobalWindow::SetStatus(const nsAStrin
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SetStatus(const nsAString& aStatus)
 {
   ErrorResult rv;
   SetStatus(aStatus, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::GetName(nsAString& aName, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetName, (aName, aError), aError, );
 
   if (mDocShell) {
@@ -4657,17 +4657,17 @@ nsGlobalWindow::GetName(nsAString& aName
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetName(nsAString& aName)
 {
   ErrorResult rv;
   GetName(aName, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetName(const nsAString& aName, mozilla::ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetName, (aName, aError), aError, );
 
   if (mDocShell) {
@@ -4676,17 +4676,17 @@ nsGlobalWindow::SetName(const nsAString&
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SetName(const nsAString& aName)
 {
   ErrorResult rv;
   SetName(aName, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Helper functions used by many methods below.
 int32_t
 nsGlobalWindow::DevToCSSIntPixels(int32_t px)
 {
   if (!mDocShell)
     return px; // assume 1:1
@@ -4804,17 +4804,17 @@ nsGlobalWindow::GetInnerWidth(JSContext*
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetInnerWidth(int32_t* aInnerWidth)
 {
   ErrorResult rv;
   *aInnerWidth = GetInnerWidth(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetInnerWidth(int32_t aInnerWidth, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetInnerWidth, (aInnerWidth, aError), aError, );
 
   if (!mDocShell) {
@@ -4861,17 +4861,17 @@ nsGlobalWindow::SetInnerWidth(int32_t aI
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetInnerWidth(aInnerWidth, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::GetInnerHeight(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetInnerHeight, (aError), aError, 0);
 
   CSSIntSize size;
@@ -4889,17 +4889,17 @@ nsGlobalWindow::GetInnerHeight(JSContext
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetInnerHeight(int32_t* aInnerHeight)
 {
   ErrorResult rv;
   *aInnerHeight = GetInnerHeight(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetInnerHeight(int32_t aInnerHeight, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetInnerHeight, (aInnerHeight, aError), aError, );
 
   if (!mDocShell) {
@@ -4945,17 +4945,17 @@ nsGlobalWindow::SetInnerHeight(int32_t a
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetInnerHeight(aInnerHeight, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIntSize
 nsGlobalWindow::GetOuterSize(ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
@@ -4996,17 +4996,17 @@ nsGlobalWindow::GetOuterWidth(JSContext*
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetOuterWidth(int32_t* aOuterWidth)
 {
   ErrorResult rv;
   *aOuterWidth = GetOuterWidth(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::GetOuterHeight(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetOuterHeight, (aError), aError, 0);
   return GetOuterSize(aError).height;
 }
@@ -5021,17 +5021,17 @@ nsGlobalWindow::GetOuterHeight(JSContext
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetOuterHeight(int32_t* aOuterHeight)
 {
   ErrorResult rv;
   *aOuterHeight = GetOuterHeight(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
                              ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
@@ -5080,17 +5080,17 @@ nsGlobalWindow::SetOuterWidth(int32_t aO
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetOuterWidth(aOuterWidth, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetOuterHeight(int32_t aOuterHeight, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetOuterHeight, (aOuterHeight, aError), aError, );
 
   SetOuterSize(aOuterHeight, false, aError);
@@ -5109,17 +5109,17 @@ nsGlobalWindow::SetOuterHeight(int32_t a
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetOuterHeight(aOuterHeight, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIntPoint
 nsGlobalWindow::GetScreenXY(ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
@@ -5151,17 +5151,17 @@ nsGlobalWindow::GetScreenX(JSContext* aC
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScreenX(int32_t* aScreenX)
 {
   ErrorResult rv;
   *aScreenX = GetScreenX(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsRect
 nsGlobalWindow::GetInnerScreenRect()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
@@ -5200,17 +5200,17 @@ nsGlobalWindow::GetMozInnerScreenX(Error
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetMozInnerScreenX(float* aScreenX)
 {
   ErrorResult rv;
   *aScreenX = GetMozInnerScreenX(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 float
 nsGlobalWindow::GetMozInnerScreenY(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetMozInnerScreenY, (aError), aError, 0);
 
   nsRect r = GetInnerScreenRect();
@@ -5218,17 +5218,17 @@ nsGlobalWindow::GetMozInnerScreenY(Error
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetMozInnerScreenY(float* aScreenY)
 {
   ErrorResult rv;
   *aScreenY = GetMozInnerScreenY(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 float
 nsGlobalWindow::GetDevicePixelRatio(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetDevicePixelRatio, (aError), aError, 0.0);
 
   if (!mDocShell) {
@@ -5246,17 +5246,17 @@ nsGlobalWindow::GetDevicePixelRatio(Erro
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetDevicePixelRatio(float* aRatio)
 {
   ErrorResult rv;
   *aRatio = GetDevicePixelRatio(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 uint64_t
 nsGlobalWindow::GetMozPaintCount(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetMozPaintCount, (aError), aError, 0);
 
   if (!mDocShell) {
@@ -5268,17 +5268,17 @@ nsGlobalWindow::GetMozPaintCount(ErrorRe
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetMozPaintCount(uint64_t* aResult)
 {
   ErrorResult rv;
   *aResult = GetMozPaintCount(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::MozRequestAnimationFrame(nsIFrameRequestCallback* aCallback,
                                          int32_t *aHandle)
 {
   if (!aCallback) {
     if (mDoc) {
@@ -5286,17 +5286,17 @@ nsGlobalWindow::MozRequestAnimationFrame
     }
     return NS_ERROR_XPC_BAD_CONVERT_JS;
   }
 
   ErrorResult rv;
   nsIDocument::FrameRequestCallbackHolder holder(aCallback);
   *aHandle = RequestAnimationFrame(holder, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::RequestAnimationFrame(FrameRequestCallback& aCallback,
                                       ErrorResult& aError)
 {
   nsIDocument::FrameRequestCallbackHolder holder(&aCallback);
   return RequestAnimationFrame(holder, aError);
@@ -5341,17 +5341,17 @@ nsGlobalWindow::RequestAnimationFrame(JS
 
   JS::Rooted<JSObject*> callbackObj(cx, &aCallback.toObject());
   nsRefPtr<FrameRequestCallback> callback =
     new FrameRequestCallback(callbackObj, GetIncumbentGlobal());
 
   ErrorResult rv;
   *aHandle = RequestAnimationFrame(*callback, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::MozCancelRequestAnimationFrame(int32_t aHandle)
 {
   return CancelAnimationFrame(aHandle);
 }
 
@@ -5374,17 +5374,17 @@ nsGlobalWindow::CancelAnimationFrame(int
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::CancelAnimationFrame(int32_t aHandle)
 {
   ErrorResult rv;
   CancelAnimationFrame(aHandle, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int64_t
 nsGlobalWindow::GetMozAnimationStartTime(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetMozAnimationStartTime, (aError), aError, 0);
 
   if (mDoc) {
@@ -5400,17 +5400,17 @@ nsGlobalWindow::GetMozAnimationStartTime
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetMozAnimationStartTime(int64_t *aTime)
 {
   ErrorResult rv;
   *aTime = GetMozAnimationStartTime(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<MediaQueryList>
 nsGlobalWindow::MatchMedia(const nsAString& aMediaQueryList,
                            ErrorResult& aError)
 {
   // FIXME: This whole forward-to-outer and then get a pres
   // shell/context off the docshell dance is sort of silly; it'd make
@@ -5429,17 +5429,17 @@ nsGlobalWindow::MatchMedia(const nsAStri
 NS_IMETHODIMP
 nsGlobalWindow::MatchMedia(const nsAString& aMediaQueryList,
                            nsISupports** aResult)
 {
   ErrorResult rv;
   nsRefPtr<MediaQueryList> mediaQueryList = MatchMedia(aMediaQueryList, rv);
   mediaQueryList.forget(aResult);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetScreenX(int32_t aScreenX, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetScreenX, (aScreenX, aError), aError, );
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
@@ -5473,34 +5473,34 @@ nsGlobalWindow::SetScreenX(int32_t aScre
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetScreenX(aScreenX, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::GetScreenY(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetScreenY, (aError), aError, 0);
 
   return DevToCSSIntPixels(GetScreenXY(aError).y);
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScreenY(int32_t* aScreenY)
 {
   ErrorResult rv;
   *aScreenY = GetScreenY(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::GetScreenY(JSContext* aCx,
                            JS::MutableHandle<JS::Value> aValue,
                            ErrorResult& aError)
 {
   GetReplaceableWindowCoord(aCx, &nsGlobalWindow::GetScreenY, aValue,
@@ -5543,17 +5543,17 @@ nsGlobalWindow::SetScreenY(int32_t aScre
 {
   if (IsFrame()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetScreenY(aScreenY, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // NOTE: Arguments to this function should have values scaled to
 // CSS pixels, not device pixels.
 void
 nsGlobalWindow::CheckSecurityWidthAndHeight(int32_t* aWidth, int32_t* aHeight)
 {
   MOZ_ASSERT(IsOuterWindow());
@@ -5743,17 +5743,17 @@ nsGlobalWindow::GetScrollMaxX(ErrorResul
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollMaxX(int32_t* aScrollMaxX)
 {
   NS_ENSURE_ARG_POINTER(aScrollMaxX);
   ErrorResult rv;
   *aScrollMaxX = GetScrollMaxX(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::GetScrollMaxY(ErrorResult& aError)
 {
   int32_t scrollMaxY = 0;
   GetScrollMaxXY(nullptr, &scrollMaxY, aError);
   return scrollMaxY;
@@ -5761,17 +5761,17 @@ nsGlobalWindow::GetScrollMaxY(ErrorResul
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollMaxY(int32_t* aScrollMaxY)
 {
   NS_ENSURE_ARG_POINTER(aScrollMaxY);
   ErrorResult rv;
   *aScrollMaxY = GetScrollMaxY(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 CSSIntPoint
 nsGlobalWindow::GetScrollXY(bool aDoFlush)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (aDoFlush) {
@@ -5804,33 +5804,33 @@ nsGlobalWindow::GetScrollX(ErrorResult& 
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollX(int32_t* aScrollX)
 {
   NS_ENSURE_ARG_POINTER(aScrollX);
   ErrorResult rv;
   *aScrollX = GetScrollX(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 nsGlobalWindow::GetScrollY(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetScrollY, (aError), aError, 0);
   return GetScrollXY(false).y;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetScrollY(int32_t* aScrollY)
 {
   NS_ENSURE_ARG_POINTER(aScrollY);
   ErrorResult rv;
   *aScrollY = GetScrollY(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 uint32_t
 nsGlobalWindow::Length()
 {
   FORWARD_TO_OUTER(Length, (), 0);
 
   nsDOMWindowList* windows = GetWindowList();
@@ -6079,17 +6079,17 @@ nsGlobalWindow::SetFullScreenInternal(bo
     nsRefPtr<power::PowerManagerService> pmService =
       power::PowerManagerService::GetInstance();
     NS_ENSURE_TRUE(pmService, NS_OK);
 
     ErrorResult rv;
     mWakeLock = pmService->NewWakeLock(NS_LITERAL_STRING("DOM_Fullscreen"),
                                        this, rv);
     if (rv.Failed()) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
   } else if (mWakeLock && !mFullScreen) {
     ErrorResult rv;
     mWakeLock->Unlock(rv);
     NS_WARN_IF_FALSE(!rv.Failed(), "Failed to unlock the wakelock.");
     mWakeLock = nullptr;
   }
@@ -6127,17 +6127,17 @@ nsGlobalWindow::GetFullScreen(ErrorResul
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetFullScreen(bool* aFullScreen)
 {
   ErrorResult rv;
   *aFullScreen = GetFullScreen(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Dump(const nsAString& aStr)
 {
   if (!nsContentUtils::DOMWindowDumpEnabled()) {
     return NS_OK;
   }
@@ -6427,34 +6427,34 @@ nsGlobalWindow::Alert(const nsAString& a
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Alert(const nsAString& aString)
 {
   ErrorResult rv;
   Alert(aString, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsGlobalWindow::Confirm(const nsAString& aMessage, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Confirm, (aMessage, aError), aError, false);
 
   return AlertOrConfirm(/* aAlert = */ false, aMessage, aError);
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Confirm(const nsAString& aString, bool* aReturn)
 {
   ErrorResult rv;
   *aReturn = Confirm(aString, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<Promise>
 nsGlobalWindow::Fetch(const RequestOrUSVString& aInput,
                       const RequestInit& aInit, ErrorResult& aRv)
 {
   return FetchRequest(this, aInput, aInit, aRv);
 }
@@ -6545,17 +6545,17 @@ nsGlobalWindow::Prompt(const nsAString& 
 
 NS_IMETHODIMP
 nsGlobalWindow::Prompt(const nsAString& aMessage, const nsAString& aInitial,
                        nsAString& aReturn)
 {
   ErrorResult rv;
   Prompt(aMessage, aInitial, aReturn, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Focus(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Focus, (aError), aError, );
 
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
@@ -6665,17 +6665,17 @@ nsGlobalWindow::Focus(ErrorResult& aErro
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Focus()
 {
   ErrorResult rv;
   Focus(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Blur(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Blur, (aError), aError, );
 
   // If dom.disable_window_flip == true, then content should not be allowed
@@ -6706,17 +6706,17 @@ nsGlobalWindow::Blur(ErrorResult& aError
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Blur()
 {
   ErrorResult rv;
   Blur(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Back(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Back, (aError), aError, );
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
@@ -6729,17 +6729,17 @@ nsGlobalWindow::Back(ErrorResult& aError
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Back()
 {
   ErrorResult rv;
   Back(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Forward(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Forward, (aError), aError, );
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
@@ -6752,17 +6752,17 @@ nsGlobalWindow::Forward(ErrorResult& aEr
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Forward()
 {
   ErrorResult rv;
   Forward(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Home(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Home, (aError), aError, );
 
   if (!mDocShell) {
@@ -6813,17 +6813,17 @@ nsGlobalWindow::Home(ErrorResult& aError
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Home()
 {
   ErrorResult rv;
   Home(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Stop(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(Stop, (aError), aError, );
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
@@ -6833,17 +6833,17 @@ nsGlobalWindow::Stop(ErrorResult& aError
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Stop()
 {
   ErrorResult rv;
   Stop(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Print(ErrorResult& aError)
 {
 #ifdef NS_PRINTING
   FORWARD_TO_OUTER_OR_THROW(Print, (aError), aError, );
 
@@ -6919,17 +6919,17 @@ nsGlobalWindow::Print(ErrorResult& aErro
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Print()
 {
   ErrorResult rv;
   Print(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::MoveTo(int32_t aXPos, int32_t aYPos, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(MoveTo, (aXPos, aYPos, aError), aError, );
 
   /*
@@ -6957,17 +6957,17 @@ nsGlobalWindow::MoveTo(int32_t aXPos, in
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::MoveTo(int32_t aXPos, int32_t aYPos)
 {
   ErrorResult rv;
   MoveTo(aXPos, aYPos, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::MoveBy(int32_t aXDif, int32_t aYDif, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(MoveBy, (aXDif, aYDif, aError), aError, );
 
   /*
@@ -7009,17 +7009,17 @@ nsGlobalWindow::MoveBy(int32_t aXDif, in
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::MoveBy(int32_t aXDif, int32_t aYDif)
 {
   ErrorResult rv;
   MoveBy(aXDif, aYDif, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::ResizeTo(int32_t aWidth, int32_t aHeight, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(ResizeTo, (aWidth, aHeight, aError), aError, );
 
   /*
@@ -7059,17 +7059,17 @@ nsGlobalWindow::ResizeTo(int32_t aWidth,
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::ResizeTo(int32_t aWidth, int32_t aHeight)
 {
   ErrorResult rv;
   ResizeTo(aWidth, aHeight, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
                          ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(ResizeBy, (aWidthDif, aHeightDif, aError), aError, );
 
@@ -7131,17 +7131,17 @@ nsGlobalWindow::ResizeBy(int32_t aWidthD
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::ResizeBy(int32_t aWidthDif, int32_t aHeightDif)
 {
   ErrorResult rv;
   ResizeBy(aWidthDif, aHeightDif, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SizeToContent(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SizeToContent, (aError), aError, );
 
   if (!mDocShell) {
@@ -7190,17 +7190,17 @@ nsGlobalWindow::SizeToContent(ErrorResul
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SizeToContent()
 {
   ErrorResult rv;
   SizeToContent(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetWindowRoot(nsIDOMEventTarget **aWindowRoot)
 {
   nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
   return CallQueryInterface(root, aWindowRoot);
 }
@@ -7439,34 +7439,34 @@ nsGlobalWindow::ClearTimeout(int32_t aHa
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::ClearTimeout(int32_t aHandle)
 {
   ErrorResult rv;
   ClearTimeout(aHandle, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::ClearInterval(int32_t aHandle, ErrorResult& aError)
 {
   if (aHandle > 0) {
     ClearTimeoutOrInterval(aHandle, aError);
   }
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::ClearInterval(int32_t aHandle)
 {
   ErrorResult rv;
   ClearInterval(aHandle, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SetTimeout(int32_t *_retval)
 {
   return SetTimeoutOrInterval(false, _retval);
 }
 
@@ -7863,17 +7863,17 @@ nsGlobalWindow::GetFrames(ErrorResult& a
 
 NS_IMETHODIMP
 nsGlobalWindow::GetFrames(nsIDOMWindow** aFrames)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMWindow> frames = GetFrames(rv);
   frames.forget(aFrames);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsGlobalWindow*
 nsGlobalWindow::CallerInnerWindow()
 {
   JSContext *cx = nsContentUtils::GetCurrentJSContext();
   NS_ENSURE_TRUE(cx, nullptr);
   nsIGlobalObject* global = GetIncumbentGlobal();
@@ -8443,17 +8443,17 @@ NS_IMETHODIMP
 nsGlobalWindow::PostMessageMoz(JS::Handle<JS::Value> aMessage,
                                const nsAString& aOrigin,
                                JS::Handle<JS::Value> aTransfer,
                                JSContext* aCx)
 {
   ErrorResult rv;
   PostMessageMoz(aCx, aMessage, aOrigin, aTransfer, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 class nsCloseEvent : public nsRunnable {
 
   nsRefPtr<nsGlobalWindow> mWindow;
   bool mIndirect;
 
   nsCloseEvent(nsGlobalWindow *aWindow, bool aIndirect)
@@ -8589,17 +8589,17 @@ nsGlobalWindow::Close(ErrorResult& aErro
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Close()
 {
   ErrorResult rv;
   Close(rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::ForceClose()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (IsFrame() || !mDocShell) {
@@ -9037,17 +9037,17 @@ nsGlobalWindow::CacheXBLPrototypeHandler
  * boundary).
  */
 NS_IMETHODIMP
 nsGlobalWindow::GetScriptableFrameElement(nsIDOMElement** aFrameElement)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMElement> frameElement = do_QueryInterface(GetFrameElement(rv));
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   frameElement.forget(aFrameElement);
 
   return NS_OK;
 }
 
 Element*
@@ -9099,17 +9099,17 @@ nsGlobalWindow::GetRealFrameElement(Erro
 NS_IMETHODIMP
 nsGlobalWindow::GetRealFrameElement(nsIDOMElement** aFrameElement)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMElement> frameElement =
     do_QueryInterface(GetRealFrameElement(rv));
   frameElement.forget(aFrameElement);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Helper for converting window.showModalDialog() options (list of ';'
 // separated name (:|=) value pairs) to a format that's parsable by
 // our normal window opening code.
 
 void
 ConvertDialogOptions(const nsAString& aOptions, nsAString& aResult)
@@ -9346,17 +9346,17 @@ nsGlobalWindow::ShowModalDialog(const ns
   if (aArgc < 1) {
     aArgs = CreateVoidVariant();
   }
 
   ErrorResult rv;
   nsCOMPtr<nsIVariant> retVal = ShowModalDialog(aURI, aArgs, aOptions, rv);
   retVal.forget(aRetVal);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 class ChildCommandDispatcher : public nsRunnable
 {
 public:
   ChildCommandDispatcher(nsGlobalWindow* aWindow,
                          nsITabChild* aTabChild,
                          const nsAString& aAction)
@@ -9450,17 +9450,17 @@ nsGlobalWindow::GetSelection(ErrorResult
 
 NS_IMETHODIMP
 nsGlobalWindow::GetSelection(nsISelection** aSelection)
 {
   ErrorResult rv;
   nsCOMPtr<nsISelection> selection = GetSelection(rv);
   selection.forget(aSelection);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsGlobalWindow::Find(const nsAString& aString, bool aCaseSensitive,
                      bool aBackwards, bool aWrapAround, bool aWholeWord,
                      bool aSearchInFrames, bool aShowDialog,
                      ErrorResult& aError)
 {
@@ -9540,51 +9540,51 @@ nsGlobalWindow::Find(const nsAString& aS
                      bool aBackwards, bool aWrapAround, bool aWholeWord,
                      bool aSearchInFrames, bool aShowDialog,
                      bool *aDidFind)
 {
   ErrorResult rv;
   *aDidFind = Find(aStr, aCaseSensitive, aBackwards, aWrapAround, aWholeWord,
                    aSearchInFrames, aShowDialog, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Atob(const nsAString& aAsciiBase64String,
                      nsAString& aBinaryData, ErrorResult& aError)
 {
   aError = nsContentUtils::Atob(aAsciiBase64String, aBinaryData);
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Atob(const nsAString& aAsciiBase64String,
                      nsAString& aBinaryData)
 {
   ErrorResult rv;
   Atob(aAsciiBase64String, aBinaryData, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Btoa(const nsAString& aBinaryData,
                      nsAString& aAsciiBase64String, ErrorResult& aError)
 {
   aError = nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Btoa(const nsAString& aBinaryData,
                      nsAString& aAsciiBase64String)
 {
   ErrorResult rv;
   Btoa(aBinaryData, aAsciiBase64String, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 //*****************************************************************************
 // nsGlobalWindow::nsIDOMEventTarget
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsGlobalWindow::RemoveEventListener(const nsAString& aType,
@@ -9823,17 +9823,17 @@ nsGlobalWindow::GetLocation(ErrorResult&
 
 NS_IMETHODIMP
 nsGlobalWindow::GetLocation(nsIDOMLocation ** aLocation)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMLocation> location = GetLocation(rv);
   location.forget(aLocation);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::ActivateOrDeactivate(bool aActivate)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mDoc) {
@@ -10435,17 +10435,17 @@ nsGlobalWindow::GetComputedStyleHelper(n
     return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
   }
 
   ErrorResult rv;
   nsCOMPtr<nsIDOMCSSStyleDeclaration> declaration =
     GetComputedStyleHelper(*element, aPseudoElt, aDefaultStylesOnly, rv);
   declaration.forget(aReturn);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<nsICSSDeclaration>
 nsGlobalWindow::GetComputedStyleHelper(Element& aElt,
                                        const nsAString& aPseudoElt,
                                        bool aDefaultStylesOnly,
                                        ErrorResult& aError)
 {
@@ -10578,17 +10578,17 @@ nsGlobalWindow::GetSessionStorage(ErrorR
 
 NS_IMETHODIMP
 nsGlobalWindow::GetSessionStorage(nsISupports** aSessionStorage)
 {
   ErrorResult rv;
   nsCOMPtr<nsIDOMStorage> storage = GetSessionStorage(rv);
   storage.forget(aSessionStorage);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 DOMStorage*
 nsGlobalWindow::GetLocalStorage(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetLocalStorage, (aError), aError, nullptr);
 
   if (!Preferences::GetBool(kStorageEnabled)) {
@@ -10648,17 +10648,17 @@ NS_IMETHODIMP
 nsGlobalWindow::GetLocalStorage(nsISupports** aLocalStorage)
 {
   NS_ENSURE_ARG(aLocalStorage);
 
   ErrorResult rv;
   nsCOMPtr<nsIDOMStorage> storage = GetLocalStorage(rv);
   storage.forget(aLocalStorage);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 IDBFactory*
 nsGlobalWindow::GetIndexedDB(ErrorResult& aError)
 {
   if (!mIndexedDB) {
     // This may keep mIndexedDB null without setting an error.
     aError = IDBFactory::CreateForWindow(this, getter_AddRefs(mIndexedDB));
@@ -10669,17 +10669,17 @@ nsGlobalWindow::GetIndexedDB(ErrorResult
 
 NS_IMETHODIMP
 nsGlobalWindow::GetIndexedDB(nsISupports** _retval)
 {
   ErrorResult rv;
   nsCOMPtr<nsISupports> request(GetIndexedDB(rv));
   request.forget(_retval);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 //*****************************************************************************
 // nsGlobalWindow::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsGlobalWindow::GetInterface(const nsIID & aIID, void **aSink)
@@ -11522,17 +11522,17 @@ nsGlobalWindow::Observe(nsISupports* aSu
     // to dispatch clones rather than the original event.
     ErrorResult error;
     nsRefPtr<StorageEvent> newEvent =
       CloneStorageEvent(fireMozStorageChanged ?
                           NS_LITERAL_STRING("MozStorageChanged") :
                           NS_LITERAL_STRING("storage"),
                         event, error);
     if (error.Failed()) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
 
     newEvent->SetTrusted(true);
 
     if (fireMozStorageChanged) {
       WidgetEvent* internalEvent = newEvent->GetInternalNSEvent();
       internalEvent->mFlags.mOnlyChromeDispatch = true;
     }
@@ -13553,17 +13553,17 @@ nsGlobalWindow::WindowState()
   return nsIDOMChromeWindow::STATE_NORMAL;
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::Maximize()
 {
   ErrorResult rv;
   Maximize(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Maximize(ErrorResult& aError)
 {
   nsCOMPtr<nsIWidget> widget = GetMainWidget();
 
   if (widget) {
@@ -13571,17 +13571,17 @@ nsGlobalWindow::Maximize(ErrorResult& aE
   }
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::Minimize()
 {
   ErrorResult rv;
   Minimize(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Minimize(ErrorResult& aError)
 {
   nsCOMPtr<nsIWidget> widget = GetMainWidget();
 
   if (widget) {
@@ -13589,17 +13589,17 @@ nsGlobalWindow::Minimize(ErrorResult& aE
   }
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::Restore()
 {
   ErrorResult rv;
   Restore(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::Restore(ErrorResult& aError)
 {
   nsCOMPtr<nsIWidget> widget = GetMainWidget();
 
   if (widget) {
@@ -13607,31 +13607,31 @@ nsGlobalWindow::Restore(ErrorResult& aEr
   }
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::GetAttention()
 {
   ErrorResult rv;
   GetAttention(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::GetAttention(ErrorResult& aResult)
 {
   return GetAttentionWithCycleCount(-1, aResult);
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::GetAttentionWithCycleCount(int32_t aCycleCount)
 {
   ErrorResult rv;
   GetAttentionWithCycleCount(aCycleCount, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::GetAttentionWithCycleCount(int32_t aCycleCount,
                                            ErrorResult& aError)
 {
   nsCOMPtr<nsIWidget> widget = GetMainWidget();
 
@@ -13647,17 +13647,17 @@ nsGlobalChromeWindow::BeginWindowMove(ns
   Event* mouseDownEvent = aMouseDownEvent->InternalDOMEvent();
   NS_ENSURE_TRUE(mouseDownEvent, NS_ERROR_FAILURE);
 
   nsCOMPtr<Element> panel = do_QueryInterface(aPanel);
   NS_ENSURE_TRUE(panel || !aPanel, NS_ERROR_FAILURE);
 
   ErrorResult rv;
   BeginWindowMove(*mouseDownEvent, panel, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::BeginWindowMove(Event& aMouseDownEvent, Element* aPanel,
                                 ErrorResult& aError)
 {
   nsCOMPtr<nsIWidget> widget;
 
@@ -13702,17 +13702,17 @@ nsGlobalWindow::GetWindowRoot(mozilla::E
 
 //Note: This call will lock the cursor, it will not change as it moves.
 //To unlock, the cursor must be set back to CURSOR_AUTO.
 NS_IMETHODIMP
 nsGlobalChromeWindow::SetCursor(const nsAString& aCursor)
 {
   ErrorResult rv;
   SetCursor(aCursor, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetCursor(const nsAString& aCursor, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetCursor, (aCursor, aError), aError, );
 
   int32_t cursor;
@@ -13765,34 +13765,34 @@ nsGlobalWindow::SetCursor(const nsAStrin
   }
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::GetBrowserDOMWindow(nsIBrowserDOMWindow **aBrowserWindow)
 {
   ErrorResult rv;
   NS_IF_ADDREF(*aBrowserWindow = GetBrowserDOMWindow(rv));
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIBrowserDOMWindow*
 nsGlobalWindow::GetBrowserDOMWindow(ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetBrowserDOMWindow, (aError), aError, nullptr);
 
   MOZ_ASSERT(IsChromeWindow());
   return static_cast<nsGlobalChromeWindow*>(this)->mBrowserDOMWindow;
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::SetBrowserDOMWindow(nsIBrowserDOMWindow *aBrowserWindow)
 {
   ErrorResult rv;
   SetBrowserDOMWindow(aBrowserWindow, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserWindow,
                                     ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(SetBrowserDOMWindow, (aBrowserWindow, aError),
                             aError, );
@@ -13803,17 +13803,17 @@ nsGlobalWindow::SetBrowserDOMWindow(nsIB
 NS_IMETHODIMP
 nsGlobalChromeWindow::NotifyDefaultButtonLoaded(nsIDOMElement* aDefaultButton)
 {
   nsCOMPtr<Element> defaultButton = do_QueryInterface(aDefaultButton);
   NS_ENSURE_ARG(defaultButton);
 
   ErrorResult rv;
   NotifyDefaultButtonLoaded(*defaultButton, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindow::NotifyDefaultButtonLoaded(Element& aDefaultButton,
                                           ErrorResult& aError)
 {
 #ifdef MOZ_XUL
   // Don't snap to a disabled button.
@@ -13860,17 +13860,17 @@ nsGlobalWindow::NotifyDefaultButtonLoade
 #endif
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::GetMessageManager(nsIMessageBroadcaster** aManager)
 {
   ErrorResult rv;
   NS_IF_ADDREF(*aManager = GetMessageManager(rv));
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIMessageBroadcaster*
 nsGlobalWindow::GetMessageManager(ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetMessageManager, (aError), aError, nullptr);
   MOZ_ASSERT(IsChromeWindow());
   nsGlobalChromeWindow* myself = static_cast<nsGlobalChromeWindow*>(this);
@@ -13886,17 +13886,17 @@ nsGlobalWindow::GetMessageManager(ErrorR
 }
 
 NS_IMETHODIMP
 nsGlobalChromeWindow::GetGroupMessageManager(const nsAString& aGroup,
                                              nsIMessageBroadcaster** aManager)
 {
   ErrorResult rv;
   NS_IF_ADDREF(*aManager = GetGroupMessageManager(aGroup, rv));
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIMessageBroadcaster*
 nsGlobalWindow::GetGroupMessageManager(const nsAString& aGroup,
                                        ErrorResult& aError)
 {
   FORWARD_TO_INNER_OR_THROW(GetGroupMessageManager, (aGroup, aError), aError, nullptr);
   MOZ_ASSERT(IsChromeWindow());
@@ -14062,32 +14062,32 @@ nsGlobalWindow::IsModalContentWindow(JSC
 
 NS_IMETHODIMP
 nsGlobalWindow::GetConsole(JSContext* aCx,
                            JS::MutableHandle<JS::Value> aConsole)
 {
   ErrorResult rv;
   nsRefPtr<Console> console = GetConsole(rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   if (!GetOrCreateDOMReflector(aCx, console, aConsole)) {
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::SetConsole(JSContext* aCx, JS::Handle<JS::Value> aValue)
 {
   ErrorResult rv;
   RedefineProperty(aCx, "console", aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Console*
 nsGlobalWindow::GetConsole(ErrorResult& aRv)
 {
   FORWARD_TO_INNER_OR_THROW(GetConsole, (aRv), aRv, nullptr);
 
   if (!mConsole) {
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -1301,17 +1301,17 @@ public:
                                int32_t aTimeout, bool aIsInterval,
                                mozilla::ErrorResult& aError);
   void ClearTimeoutOrInterval(int32_t aTimerID,
                                   mozilla::ErrorResult& aError);
   nsresult ClearTimeoutOrInterval(int32_t aTimerID) override
   {
     mozilla::ErrorResult rv;
     ClearTimeoutOrInterval(aTimerID, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // JS specific timeout functions (JS args grabbed from context).
   nsresult SetTimeoutOrInterval(bool aIsInterval, int32_t* aReturn);
   nsresult ResetTimersForNonBackgroundWindow();
 
   // The timeout implementation functions.
   void RunTimeout(nsTimeout *aTimeout);
--- a/dom/base/nsHostObjectProtocolHandler.cpp
+++ b/dom/base/nsHostObjectProtocolHandler.cpp
@@ -564,17 +564,17 @@ nsHostObjectProtocolHandler::NewChannel2
     nsString filename;
     blob->GetName(filename);
     channel->SetContentDispositionFilename(filename);
   }
 
   ErrorResult error;
   uint64_t size = blob->GetSize(error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   channel->SetOriginalURI(uri);
   channel->SetContentType(NS_ConvertUTF16toUTF8(type));
   channel->SetContentLength(size);
 
   channel.forget(result);
 
--- a/dom/base/nsIDOMFile.idl
+++ b/dom/base/nsIDOMFile.idl
@@ -49,25 +49,25 @@ interface nsIDOMBlob : nsISupports
   // Called before the blob is stored in a database to decide if it can be
   // shared or needs to be copied. It can be called on any thread.
   [notxpcom] FileInfo getFileInfo(in FileManager aFileManager);
 
   // Return true if this blob is a memory file.
   [notxpcom] bool isMemoryFile();
 };
 
-[scriptable, builtinclass, uuid(4e7d1a8b-e2d5-4304-a753-4affb731660c)]
+[scriptable, builtinclass, uuid(74657f92-aa61-492b-8649-fd1cca62e255)]
 interface nsIDOMFile : nsIDOMBlob
 {
   readonly attribute DOMString name;
 
   readonly attribute DOMString path;
 
   [implicit_jscontext]
   readonly attribute jsval lastModifiedDate;
 
   readonly attribute DOMString mozFullPath;
 
   // This performs no security checks!
   [noscript] readonly attribute DOMString mozFullPathInternal;
 
-  [noscript] readonly attribute uint64_t mozLastModifiedDate;
+  [noscript] readonly attribute int64_t mozLastModifiedDate;
 };
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -546,17 +546,17 @@ nsINode::RemoveChild(nsIDOMNode* aOldChi
     return NS_ERROR_NULL_POINTER;
   }
 
   ErrorResult rv;
   RemoveChild(*oldChild, rv);
   if (!rv.Failed()) {
     NS_ADDREF(*aReturn = aOldChild);
   }
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsINode::Normalize()
 {
   // First collect list of nodes to be removed
   nsAutoTArray<nsCOMPtr<nsIContent>, 50> nodes;
 
@@ -2220,17 +2220,17 @@ nsINode::ReplaceOrInsertBefore(bool aRep
     return NS_NOINTERFACE;
   }
 
   ErrorResult rv;
   nsINode* result = ReplaceOrInsertBefore(aReplace, newChild, refChild, rv);
   if (result) {
     NS_ADDREF(*aReturn = result->AsDOMNode());
   }
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsresult
 nsINode::CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aReturn)
 {
   nsCOMPtr<nsINode> other = do_QueryInterface(aOther);
   NS_ENSURE_ARG(other);
   *aReturn = CompareDocumentPosition(*other);
@@ -2407,17 +2407,17 @@ nsINode::ParseSelectorList(const nsAStri
   aRv = parser.ParseSelectorString(aSelectorString,
                                    doc->GetDocumentURI(),
                                    0, // XXXbz get the line number!
                                    &selectorList);
   if (aRv.Failed()) {
     // We hit this for syntax errors, which are quite common, so don't
     // use NS_ENSURE_SUCCESS.  (For example, jQuery has an extended set
     // of selectors, but it sees if we can parse them first.)
-    MOZ_ASSERT(aRv.ErrorCode() == NS_ERROR_DOM_SYNTAX_ERR,
+    MOZ_ASSERT(aRv.ErrorCodeIs(NS_ERROR_DOM_SYNTAX_ERR),
                "Unexpected error, so cached version won't return it");
     cache.CacheList(aSelectorString, nullptr);
     return nullptr;
   }
 
   // Filter out pseudo-element selectors from selectorList
   nsCSSSelectorList** slot = &selectorList;
   do {
@@ -2615,29 +2615,29 @@ nsINode::QuerySelectorAll(const nsAStrin
 }
 
 nsresult
 nsINode::QuerySelector(const nsAString& aSelector, nsIDOMElement **aReturn)
 {
   ErrorResult rv;
   Element* result = nsINode::QuerySelector(aSelector, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   nsCOMPtr<nsIDOMElement> elt = do_QueryInterface(result);
   elt.forget(aReturn);
   return NS_OK;
 }
 
 nsresult
 nsINode::QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aReturn)
 {
   ErrorResult rv;
   *aReturn = nsINode::QuerySelectorAll(aSelector, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Element*
 nsINode::GetElementById(const nsAString& aId)
 {
   MOZ_ASSERT(IsElement() || IsNodeOfType(eDOCUMENT_FRAGMENT),
              "Bogus this object for GetElementById call");
   if (IsInDoc()) {
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -1792,17 +1792,17 @@ public:
   // Helper method to remove this node from its parent. This is not exposed
   // through WebIDL.
   // Only call this if the node has a parent node.
   nsresult RemoveFromParent()
   {
     nsINode* parent = GetParentNode();
     mozilla::ErrorResult rv;
     parent->RemoveChild(*this, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // ChildNode methods
   mozilla::dom::Element* GetPreviousElementSibling() const;
   mozilla::dom::Element* GetNextElementSibling() const;
   /**
    * Remove this node from its parent, if any.
    */
@@ -2044,17 +2044,17 @@ ToCanonicalSupports(nsINode* aPointer)
   { \
     nsINode::GetNodeValue(aNodeValue); \
     return NS_OK; \
   } \
   NS_IMETHOD SetNodeValue(const nsAString& aNodeValue) __VA_ARGS__ override \
   { \
     mozilla::ErrorResult rv; \
     nsINode::SetNodeValue(aNodeValue, rv); \
-    return rv.ErrorCode(); \
+    return rv.StealNSResult(); \
   } \
   NS_IMETHOD GetNodeType(uint16_t* aNodeType) __VA_ARGS__ override \
   { \
     *aNodeType = nsINode::NodeType(); \
     return NS_OK; \
   } \
   NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode) __VA_ARGS__ override \
   { \
@@ -2112,17 +2112,17 @@ ToCanonicalSupports(nsINode* aPointer)
   NS_IMETHOD CloneNode(bool aDeep, uint8_t aArgc, nsIDOMNode** aResult) __VA_ARGS__ override \
   { \
     if (aArgc == 0) { \
       aDeep = true; \
     } \
     mozilla::ErrorResult rv; \
     nsCOMPtr<nsINode> clone = nsINode::CloneNode(aDeep, rv); \
     if (rv.Failed()) { \
-      return rv.ErrorCode(); \
+      return rv.StealNSResult(); \
     } \
     *aResult = clone.forget().take()->AsDOMNode(); \
     return NS_OK; \
   } \
   NS_IMETHOD Normalize() __VA_ARGS__ override \
   { \
     nsINode::Normalize(); \
     return NS_OK; \
@@ -2155,23 +2155,23 @@ ToCanonicalSupports(nsINode* aPointer)
   NS_IMETHOD CompareDocumentPosition(nsIDOMNode* aOther, uint16_t* aResult) __VA_ARGS__ override \
   { \
     return nsINode::CompareDocumentPosition(aOther, aResult); \
   } \
   NS_IMETHOD GetTextContent(nsAString& aTextContent) __VA_ARGS__ override \
   { \
     mozilla::ErrorResult rv; \
     nsINode::GetTextContent(aTextContent, rv); \
-    return rv.ErrorCode(); \
+    return rv.StealNSResult(); \
   } \
   NS_IMETHOD SetTextContent(const nsAString& aTextContent) __VA_ARGS__ override \
   { \
     mozilla::ErrorResult rv; \
     nsINode::SetTextContent(aTextContent, rv); \
-    return rv.ErrorCode(); \
+    return rv.StealNSResult(); \
   } \
   NS_IMETHOD LookupPrefix(const nsAString& aNamespaceURI, nsAString& aResult) __VA_ARGS__ override \
   { \
     nsINode::LookupPrefix(aNamespaceURI, aResult); \
     return NS_OK; \
   } \
   NS_IMETHOD IsDefaultNamespace(const nsAString& aNamespaceURI, bool* aResult) __VA_ARGS__ override \
   { \
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -485,17 +485,17 @@ NS_IMETHODIMP
 nsImageLoadingContent::GetRequest(int32_t aRequestType,
                                   imgIRequest** aRequest)
 {
   NS_ENSURE_ARG_POINTER(aRequest);
 
   ErrorResult result;
   *aRequest = GetRequest(aRequestType, result).take();
 
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 NS_IMETHODIMP_(bool)
 nsImageLoadingContent::CurrentRequestHasSize()
 {
   return HaveSize(mCurrentRequest);
 }
 
@@ -597,17 +597,17 @@ nsImageLoadingContent::GetRequestType(im
 NS_IMETHODIMP
 nsImageLoadingContent::GetRequestType(imgIRequest* aRequest,
                                       int32_t* aRequestType)
 {
   NS_PRECONDITION(aRequestType, "Null out param");
 
   ErrorResult result;
   *aRequestType = GetRequestType(aRequest, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 already_AddRefed<nsIURI>
 nsImageLoadingContent::GetCurrentURI(ErrorResult& aError)
 {
   nsCOMPtr<nsIURI> uri;
   if (mCurrentRequest) {
     mCurrentRequest->GetURI(getter_AddRefs(uri));
@@ -623,17 +623,17 @@ nsImageLoadingContent::GetCurrentURI(Err
 
 NS_IMETHODIMP
 nsImageLoadingContent::GetCurrentURI(nsIURI** aURI)
 {
   NS_ENSURE_ARG_POINTER(aURI);
 
   ErrorResult result;
   *aURI = GetCurrentURI(result).take();
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 already_AddRefed<nsIStreamListener>
 nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
                                             ErrorResult& aError)
 {
   imgLoader* loader =
     nsContentUtils::GetImgLoaderForChannel(aChannel, GetOurOwnerDoc());
@@ -680,17 +680,17 @@ nsImageLoadingContent::LoadImageWithChan
 NS_IMETHODIMP
 nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
                                             nsIStreamListener** aListener)
 {
   NS_ENSURE_ARG_POINTER(aListener);
 
   ErrorResult result;
   *aListener = LoadImageWithChannel(aChannel, result).take();
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 nsImageLoadingContent::ForceReload(const mozilla::dom::Optional<bool>& aNotify,
                                    mozilla::ErrorResult& aError)
 {
   nsCOMPtr<nsIURI> currentURI;
   GetCurrentURI(getter_AddRefs(currentURI));
@@ -720,17 +720,17 @@ nsImageLoadingContent::ForceReload(bool 
 {
   mozilla::dom::Optional<bool> notify;
   if (aArgc >= 1) {
     notify.Construct() = aNotify;
   }
 
   ErrorResult result;
   ForceReload(notify, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsImageLoadingContent::BlockOnload(imgIRequest* aRequest)
 {
   if (aRequest == mCurrentRequest) {
     NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD),
                  "Double BlockOnload!?");
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -335,17 +335,17 @@ nsJSScriptTimeoutHandler::Init(nsGlobalW
   }
 
   if (expr) {
     // if CSP is enabled, and setTimeout/setInterval was called with a string,
     // disable the registration and log an error
     ErrorResult error;
     *aAllowEval = CheckCSPForEval(cx, aWindow, error);
     if (error.Failed() || !*aAllowEval) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
 
     MOZ_ASSERT(mExpr.IsEmpty());
     AssignJSFlatString(mExpr, expr);
 
     // Get the calling location.
     nsJSUtils::GetCallingLocation(cx, mFileName, &mLineNo);
   } else if (funobj) {
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -711,43 +711,43 @@ nsRange::IsPointInRange(nsIDOMNode* aPar
 {
   nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
   if (!parent) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   *aResult = IsPointInRange(*parent, aOffset, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsRange::IsPointInRange(nsINode& aParent, uint32_t aOffset, ErrorResult& aRv)
 {
   uint16_t compareResult = ComparePoint(aParent, aOffset, aRv);
   // If the node isn't in the range's document, it clearly isn't in the range.
-  if (aRv.ErrorCode() == NS_ERROR_DOM_WRONG_DOCUMENT_ERR) {
-    aRv = NS_OK;
+  if (aRv.ErrorCodeIs(NS_ERROR_DOM_WRONG_DOCUMENT_ERR)) {
+    aRv.SuppressException();
     return false;
   }
 
   return compareResult == 0;
 }
 
 // returns -1 if point is before range, 0 if point is in range,
 // 1 if point is after range.
 NS_IMETHODIMP
 nsRange::ComparePoint(nsIDOMNode* aParent, int32_t aOffset, int16_t* aResult)
 {
   nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
   NS_ENSURE_TRUE(parent, NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
 
   ErrorResult rv;
   *aResult = ComparePoint(*parent, aOffset, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int16_t
 nsRange::ComparePoint(nsINode& aParent, uint32_t aOffset, ErrorResult& aRv)
 {
   // our range is in a good state?
   if (!mIsPositioned) {
     aRv.Throw(NS_ERROR_NOT_INITIALIZED);
@@ -789,17 +789,17 @@ nsRange::IntersectsNode(nsIDOMNode* aNod
   *aResult = false;
 
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   // TODO: This should throw a TypeError.
   NS_ENSURE_ARG(node);
 
   ErrorResult rv;
   *aResult = IntersectsNode(*node, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsRange::IntersectsNode(nsINode& aNode, ErrorResult& aRv)
 {
   if (!mIsPositioned) {
     aRv.Throw(NS_ERROR_NOT_INITIALIZED);
     return false;
@@ -1045,17 +1045,17 @@ nsRange::GetCommonAncestorContainer(nsID
   ErrorResult rv;
   nsINode* commonAncestor = GetCommonAncestorContainer(rv);
   if (commonAncestor) {
     NS_ADDREF(*aCommonParent = commonAncestor->AsDOMNode());
   } else {
     *aCommonParent = nullptr;
   }
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsINode*
 nsRange::IsValidBoundary(nsINode* aNode)
 {
   if (!aNode) {
     return nullptr;
   }
@@ -1116,17 +1116,17 @@ nsRange::SetStart(nsIDOMNode* aParent, i
 {
   nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
   if (!parent) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetStart(*parent, aOffset, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* virtual */ nsresult
 nsRange::SetStart(nsINode* aParent, int32_t aOffset)
 {
   nsINode* newRoot = IsValidBoundary(aParent);
   NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
@@ -1166,17 +1166,17 @@ nsRange::SetStartBefore(nsIDOMNode* aSib
 {
   nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
   if (!sibling) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetStartBefore(*sibling, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SetStartAfter(nsINode& aNode, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -1191,17 +1191,17 @@ nsRange::SetStartAfter(nsIDOMNode* aSibl
 {
   nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
   if (!sibling) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetStartAfter(*sibling, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SetEnd(nsINode& aNode, uint32_t aOffset, ErrorResult& aRv)
 {
  if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -1215,17 +1215,17 @@ nsRange::SetEnd(nsIDOMNode* aParent, int
 {
   nsCOMPtr<nsINode> parent = do_QueryInterface(aParent);
   if (!parent) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetEnd(*parent, aOffset, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* virtual */ nsresult
 nsRange::SetEnd(nsINode* aParent, int32_t aOffset)
 {
   nsINode* newRoot = IsValidBoundary(aParent);
   NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
@@ -1265,17 +1265,17 @@ nsRange::SetEndBefore(nsIDOMNode* aSibli
 {
   nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
   if (!sibling) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetEndBefore(*sibling, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SetEndAfter(nsINode& aNode, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -1290,17 +1290,17 @@ nsRange::SetEndAfter(nsIDOMNode* aSiblin
 {
   nsCOMPtr<nsINode> sibling = do_QueryInterface(aSibling);
   if (!sibling) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   SetEndAfter(*sibling, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsRange::Collapse(bool aToStart)
 {
   if (!mIsPositioned)
     return NS_ERROR_NOT_INITIALIZED;
 
@@ -1316,17 +1316,17 @@ nsRange::Collapse(bool aToStart)
 NS_IMETHODIMP
 nsRange::SelectNode(nsIDOMNode* aN)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aN);
   NS_ENSURE_TRUE(node, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
   ErrorResult rv;
   SelectNode(*node, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SelectNode(nsINode& aNode, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -1352,17 +1352,17 @@ nsRange::SelectNode(nsINode& aNode, Erro
 NS_IMETHODIMP
 nsRange::SelectNodeContents(nsIDOMNode* aN)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aN);
   NS_ENSURE_TRUE(node, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
   ErrorResult rv;
   SelectNodeContents(*node, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SelectNodeContents(nsINode& aNode, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -1647,22 +1647,22 @@ CollapseRangeAfterDelete(nsRange* aRange
     return NS_OK;
   }
 
   // aRange isn't collapsed so figure out the appropriate place to collapse!
   // First get both end points and their common ancestor.
 
   ErrorResult rv;
   nsCOMPtr<nsINode> commonAncestor = aRange->GetCommonAncestorContainer(rv);
-  if (rv.Failed()) return rv.ErrorCode();
+  if (rv.Failed()) return rv.StealNSResult();
 
   nsCOMPtr<nsINode> startContainer = aRange->GetStartContainer(rv);
-  if (rv.Failed()) return rv.ErrorCode();
+  if (rv.Failed()) return rv.StealNSResult();
   nsCOMPtr<nsINode> endContainer = aRange->GetEndContainer(rv);
-  if (rv.Failed()) return rv.ErrorCode();
+  if (rv.Failed()) return rv.StealNSResult();
 
   // Collapse to one of the end points if they are already in the
   // commonAncestor. This should work ok since this method is called
   // immediately after a delete or extract that leaves no content
   // between the 2 end points!
 
   if (startContainer == commonAncestor)
     return aRange->Collapse(true);
@@ -1683,17 +1683,17 @@ CollapseRangeAfterDelete(nsRange* aRange
 
     nodeToSelect = parent;
   }
 
   if (!nodeToSelect)
     return NS_ERROR_FAILURE; // This should never happen!
 
   aRange->SelectNode(*nodeToSelect, rv);
-  if (rv.Failed()) return rv.ErrorCode();
+  if (rv.Failed()) return rv.StealNSResult();
 
   return aRange->Collapse(false);
 }
 
 /**
  * Split a data node into two parts.
  *
  * @param aStartNode          The original node we are trying to split.
@@ -1720,17 +1720,17 @@ static nsresult SplitDataNode(nsIDOMChar
 }
 
 NS_IMETHODIMP
 PrependChild(nsINode* aParent, nsINode* aChild)
 {
   nsCOMPtr<nsINode> first = aParent->GetFirstChild();
   ErrorResult rv;
   aParent->InsertBefore(*aChild, first, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Helper function for CutContents, making sure that the current node wasn't
 // removed by mutation events (bug 766426)
 static bool
 ValidateCurrentNode(nsRange* aRange, RangeSubtreeIterator& aIter)
 {
   bool before, after;
@@ -1752,17 +1752,17 @@ nsRange::CutContents(DocumentFragment** 
   if (aFragment) {
     *aFragment = nullptr;
   }
 
   nsCOMPtr<nsIDocument> doc = mStartParent->OwnerDoc();
 
   ErrorResult res;
   nsCOMPtr<nsINode> commonAncestor = GetCommonAncestorContainer(res);
-  NS_ENSURE_SUCCESS(res.ErrorCode(), res.ErrorCode());
+  NS_ENSURE_TRUE(!res.Failed(), res.StealNSResult());
 
   // If aFragment isn't null, create a temporary fragment to hold our return.
   nsRefPtr<DocumentFragment> retval;
   if (aFragment) {
     retval = new DocumentFragment(doc->NodeInfoManager());
   }
   nsCOMPtr<nsINode> commonCloneAncestor = retval.get();
 
@@ -1926,17 +1926,17 @@ nsRange::CutContents(DocumentFragment** 
       if (node && node->IsElement() &&
           ((node == endContainer && endOffset == 0) ||
            (node == startContainer &&
             int32_t(node->AsElement()->GetChildCount()) == startOffset)))
       {
         if (retval) {
           ErrorResult rv;
           nodeToResult = node->CloneNode(false, rv);
-          NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+          NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
         }
         handled = true;
       }
     }
 
     if (!handled)
     {
       // node was not handled above, so it must be completely contained
@@ -1990,17 +1990,17 @@ nsRange::CutContents(DocumentFragment** 
                       ValidateCurrentNode(this, iter));
     } else if (nodeToResult) {
       nsMutationGuard guard;
       nsCOMPtr<nsINode> node = nodeToResult;
       nsINode* parent = node->GetParentNode();
       if (parent) {
         mozilla::ErrorResult error;
         parent->RemoveChild(*node, error);
-        NS_ENSURE_FALSE(error.Failed(), error.ErrorCode());
+        NS_ENSURE_FALSE(error.Failed(), error.StealNSResult());
       }
       NS_ENSURE_STATE(!guard.Mutated(1) ||
                       ValidateCurrentNode(this, iter));
     }
 
     if (!iter.IsDone() && retval) {
       // Find the equivalent of commonAncestor in the cloned tree.
       nsCOMPtr<nsINode> newCloneAncestor = nodeToResult;
@@ -2054,17 +2054,17 @@ NS_IMETHODIMP
 nsRange::CompareBoundaryPoints(uint16_t aHow, nsIDOMRange* aOtherRange,
                                int16_t* aCmpRet)
 {
   nsRange* otherRange = static_cast<nsRange*>(aOtherRange);
   NS_ENSURE_TRUE(otherRange, NS_ERROR_NULL_POINTER);
 
   ErrorResult rv;
   *aCmpRet = CompareBoundaryPoints(aHow, *otherRange, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int16_t
 nsRange::CompareBoundaryPoints(uint16_t aHow, nsRange& aOtherRange,
                                ErrorResult& rv)
 {
   if (!mIsPositioned || !aOtherRange.IsPositioned()) {
     rv.Throw(NS_ERROR_NOT_INITIALIZED);
@@ -2132,27 +2132,27 @@ nsRange::CloneParentsBetween(nsINode *aA
   nsCOMPtr<nsINode> parent = aNode->GetParentNode();
 
   while(parent && parent != aAncestor)
   {
     ErrorResult rv;
     nsCOMPtr<nsINode> clone = parent->CloneNode(false, rv);
 
     if (rv.Failed()) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
     if (!clone) {
       return NS_ERROR_FAILURE;
     }
 
     if (! firstParent) {
       firstParent = lastParent = clone;
     } else {
       clone->AppendChild(*lastParent, rv);
-      if (rv.Failed()) return rv.ErrorCode();
+      if (rv.Failed()) return rv.StealNSResult();
 
       lastParent = clone;
     }
 
     parent = parent->GetParentNode();
   }
 
   *aClosestAncestor  = firstParent;
@@ -2164,17 +2164,17 @@ nsRange::CloneParentsBetween(nsINode *aA
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsRange::CloneContents(nsIDOMDocumentFragment** aReturn)
 {
   ErrorResult rv;
   *aReturn = CloneContents(rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DocumentFragment>
 nsRange::CloneContents(ErrorResult& aRv)
 {
   nsCOMPtr<nsINode> commonAncestor = GetCommonAncestorContainer(aRv);
   MOZ_ASSERT(!aRv.Failed(), "GetCommonAncestorContainer() shouldn't fail!");
 
@@ -2400,17 +2400,17 @@ nsRange::InsertNode(nsIDOMNode* aNode)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   if (!node) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
 
   ErrorResult rv;
   InsertNode(*node, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::InsertNode(nsINode& aNode, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNode)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
@@ -2497,17 +2497,17 @@ NS_IMETHODIMP
 nsRange::SurroundContents(nsIDOMNode* aNewParent)
 {
   nsCOMPtr<nsINode> node = do_QueryInterface(aNewParent);
   if (!node) {
     return NS_ERROR_DOM_NOT_OBJECT_ERR;
   }
   ErrorResult rv;
   SurroundContents(*node, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsRange::SurroundContents(nsINode& aNewParent, ErrorResult& aRv)
 {
   if (!nsContentUtils::CanCallerAccess(&aNewParent)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -80,17 +80,17 @@ nsScreen::GetPixelDepth(ErrorResult& aRv
 }
 
 #define FORWARD_LONG_GETTER(_name)                                              \
   NS_IMETHODIMP                                                                 \
   nsScreen::Get ## _name(int32_t* aOut)                                         \
   {                                                                             \
     ErrorResult rv;                                                             \
     *aOut = Get ## _name(rv);                                                   \
-    return rv.ErrorCode();                                                      \
+    return rv.StealNSResult();                                                  \
   }
 
 FORWARD_LONG_GETTER(AvailWidth)
 FORWARD_LONG_GETTER(AvailHeight)
 FORWARD_LONG_GETTER(Width)
 FORWARD_LONG_GETTER(Height)
 
 FORWARD_LONG_GETTER(Top)
--- a/dom/base/nsXMLHttpRequest.cpp
+++ b/dom/base/nsXMLHttpRequest.cpp
@@ -593,17 +593,17 @@ static void LogMessage(const char* aWarn
 
 /* readonly attribute nsIDOMDocument responseXML; */
 NS_IMETHODIMP
 nsXMLHttpRequest::GetResponseXML(nsIDOMDocument **aResponseXML)
 {
   ErrorResult rv;
   nsIDocument* responseXML = GetResponseXML(rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   if (!responseXML) {
     *aResponseXML = nullptr;
     return NS_OK;
   }
 
   return CallQueryInterface(responseXML, aResponseXML);
@@ -701,17 +701,17 @@ nsXMLHttpRequest::AppendToResponseText(c
 /* readonly attribute AString responseText; */
 NS_IMETHODIMP
 nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
 {
   ErrorResult rv;
   nsString responseText;
   GetResponseText(responseText, rv);
   aResponseText = responseText;
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::GetResponseText(nsString& aResponseText, ErrorResult& aRv)
 {
   aResponseText.Truncate();
 
   if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
@@ -900,17 +900,17 @@ NS_IMETHODIMP nsXMLHttpRequest::SetRespo
   } else if (aResponseType.EqualsLiteral("moz-blob")) {
     responseType = XML_HTTP_RESPONSE_TYPE_MOZ_BLOB;
   } else {
     return NS_OK;
   }
 
   ErrorResult rv;
   SetResponseType(responseType, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::SetResponseType(XMLHttpRequestResponseType aType,
                                   ErrorResult& aRv)
 {
   SetResponseType(ResponseTypeEnum(static_cast<int>(aType)), aRv);
 }
@@ -947,17 +947,17 @@ nsXMLHttpRequest::SetResponseType(nsXMLH
 }
 
 /* readonly attribute jsval response; */
 NS_IMETHODIMP
 nsXMLHttpRequest::GetResponse(JSContext *aCx, JS::MutableHandle<JS::Value> aResult)
 {
   ErrorResult rv;
   GetResponse(aCx, aResult, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::GetResponse(JSContext* aCx,
                               JS::MutableHandle<JS::Value> aResponse,
                               ErrorResult& aRv)
 {
   switch (mResponseType) {
@@ -1358,17 +1358,17 @@ nsXMLHttpRequest::GetAllResponseHeaders(
 }
 
 NS_IMETHODIMP
 nsXMLHttpRequest::GetResponseHeader(const nsACString& aHeader,
                                     nsACString& aResult)
 {
   ErrorResult rv;
   GetResponseHeader(aHeader, aResult, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::GetResponseHeader(const nsACString& header,
                                     nsACString& _retval, ErrorResult& aRv)
 {
   _retval.SetIsVoid(true);
 
@@ -1420,20 +1420,20 @@ nsXMLHttpRequest::GetResponseHeader(cons
   }
 
   // Check for dangerous headers
   if (!IsSafeHeader(header, httpChannel)) {
     return;
   }
 
   aRv = httpChannel->GetResponseHeader(header, _retval);
-  if (aRv.ErrorCode() == NS_ERROR_NOT_AVAILABLE) {
+  if (aRv.ErrorCodeIs(NS_ERROR_NOT_AVAILABLE)) {
     // Means no header
     _retval.SetIsVoid(true);
-    aRv = NS_OK;
+    aRv.SuppressException();
   }
 }
 
 already_AddRefed<nsILoadGroup>
 nsXMLHttpRequest::GetLoadGroup() const
 {
   if (mState & XML_HTTP_REQUEST_BACKGROUND) {                 
     return nullptr;
@@ -3179,17 +3179,17 @@ nsXMLHttpRequest::GetTimeout(uint32_t *a
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXMLHttpRequest::SetTimeout(uint32_t aTimeout)
 {
   ErrorResult rv;
   SetTimeout(aTimeout, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::SetTimeout(uint32_t aTimeout, ErrorResult& aRv)
 {
   if (!(mState & (XML_HTTP_REQUEST_ASYNC | XML_HTTP_REQUEST_UNSENT)) &&
       HasOrHasHadOwner()) {
     /* Timeout is not supported for synchronous requests with an owning window,
@@ -3328,17 +3328,17 @@ nsXMLHttpRequest::WithCredentials()
   return !!(mState & XML_HTTP_REQUEST_AC_WITH_CREDENTIALS);
 }
 
 NS_IMETHODIMP
 nsXMLHttpRequest::SetWithCredentials(bool aWithCredentials)
 {
   ErrorResult rv;
   SetWithCredentials(aWithCredentials, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsXMLHttpRequest::SetWithCredentials(bool aWithCredentials, ErrorResult& aRv)
 {
   // Return error if we're already processing a request.  Note that we can't use
   // ReadyState() here, because it can't differentiate between "opened" and
   // "sent", so we use mState directly.
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -776,8 +776,9 @@ skip-if = true # bug 1107443 - code for 
 [test_root_iframe.html]
 [test_performance_user_timing.html]
 [test_bug1126851.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 [test_bug1118689.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g'
 [test_integer_attr_with_leading_zero.html]
 [test_script_loader_crossorigin_data_url.html]
+[test_file_negative_date.html]
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_file_negative_date.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1158437
+-->
+<head>
+  <title>Test for negative date in File (Bug 1158437)</title>
+  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="text/javascript" src="fileutils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1158437">Mozilla Bug 1158437</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript;version=1.7">
+"use strict";
+
+var blob = new Blob(['hello world']);
+var f1 = new File([blob], 'f1.txt', { lastModified: 0 });
+var f2 = new File([blob], 'f2.txt', { lastModified: -1 });
+var f3 = new File([blob], 'f3.txt', { lastModified: -1000 });
+
+is(f1.lastModified, 0, "lastModified == 0 is supported");
+ok(f1.lastModifiedDate.toString(), (new Date(0)).toString(), "Correct f1.lastModifiedDate value");
+is(f2.lastModified, -1, "lastModified == -1 is supported");
+ok(f2.lastModifiedDate.toString(), (new Date(-1)).toString(), "Correct f2.lastModifiedDate value");
+is(f3.lastModified, -1000, "lastModified == -1000 is supported");
+ok(f3.lastModifiedDate.toString(), (new Date(-1000)).toString(), "Correct f3.lastModifiedDate value");
+
+</script>
+</pre>
+</body>
+</html>
+
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -334,16 +334,24 @@ ErrorResult::ReportNotEnoughArgsError(JS
                                       const char* memberName)
 {
   MOZ_ASSERT(ErrorCode() == NS_ERROR_XPC_NOT_ENOUGH_ARGS);
 
   nsPrintfCString errorMessage("%s.%s", ifaceName, memberName);
   ThrowErrorMessage(cx, dom::MSG_MISSING_ARGUMENTS, errorMessage.get());
 }
 
+void
+ErrorResult::ReportGenericError(JSContext* cx)
+{
+  MOZ_ASSERT(!IsErrorWithMessage());
+  MOZ_ASSERT(!IsJSException());
+  dom::Throw(cx, ErrorCode());
+}
+
 ErrorResult&
 ErrorResult::operator=(ErrorResult&& aRHS)
 {
 #ifdef DEBUG
   mMightHaveUnreportedJSException = aRHS.mMightHaveUnreportedJSException;
   aRHS.mMightHaveUnreportedJSException = false;
 #endif
   if (aRHS.IsErrorWithMessage()) {
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -122,17 +122,18 @@ ThrowMethodFailedWithDetails(JSContext* 
       rv.ReportJSException(cx);
     }
     return false;
   }
   if (rv.IsNotEnoughArgsError()) {
     rv.ReportNotEnoughArgsError(cx, ifaceName, memberName);
     return false;
   }
-  return Throw(cx, rv.ErrorCode());
+  rv.ReportGenericError(cx);
+  return false;
 }
 
 // Returns true if the JSClass is used for DOM objects.
 inline bool
 IsDOMClass(const JSClass* clasp)
 {
   return clasp->flags & JSCLASS_IS_DOMJSCLASS;
 }
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -114,27 +114,31 @@ public:
   bool IsJSException() const { return ErrorCode() == NS_ERROR_DOM_JS_EXCEPTION; }
 
   void ThrowNotEnoughArgsError() { mResult = NS_ERROR_XPC_NOT_ENOUGH_ARGS; }
   void ReportNotEnoughArgsError(JSContext* cx,
                                 const char* ifaceName,
                                 const char* memberName);
   bool IsNotEnoughArgsError() const { return ErrorCode() == NS_ERROR_XPC_NOT_ENOUGH_ARGS; }
 
+  // Report a generic error.  This should only be used if we're not
+  // some more specific exception type.
+  void ReportGenericError(JSContext* cx);
+
   // Support for uncatchable exceptions.
   void ThrowUncatchableException() {
     Throw(NS_ERROR_UNCATCHABLE_EXCEPTION);
   }
   bool IsUncatchableException() const {
     return ErrorCode() == NS_ERROR_UNCATCHABLE_EXCEPTION;
   }
 
   // StealJSException steals the JS Exception from the object. This method must
   // be called only if IsJSException() returns true. This method also resets the
-  // ErrorCode() to NS_OK.
+  // error code to NS_OK.
   void StealJSException(JSContext* cx, JS::MutableHandle<JS::Value> value);
 
   void MOZ_ALWAYS_INLINE MightThrowJSException()
   {
 #ifdef DEBUG
     mMightHaveUnreportedJSException = true;
 #endif
   }
@@ -155,16 +159,26 @@ public:
   void operator=(nsresult rv) {
     AssignErrorCode(rv);
   }
 
   bool Failed() const {
     return NS_FAILED(mResult);
   }
 
+  bool ErrorCodeIs(nsresult rv) const {
+    return mResult == rv;
+  }
+
+  // For use in logging ONLY.
+  uint32_t ErrorCodeAsInt() const {
+    return static_cast<uint32_t>(ErrorCode());
+  }
+
+protected:
   nsresult ErrorCode() const {
     return mResult;
   }
 
 private:
   friend struct IPC::ParamTraits<ErrorResult>;
   void SerializeMessage(IPC::Message* aMsg) const;
   bool DeserializeMessage(const IPC::Message* aMsg, void** aIter);
@@ -216,28 +230,28 @@ private:
  ** Macros for checking results
  ******************************************************************************/
 
 #define ENSURE_SUCCESS(res, ret)                                          \
   do {                                                                    \
     if (res.Failed()) {                                                   \
       nsCString msg;                                                      \
       msg.AppendPrintf("ENSURE_SUCCESS(%s, %s) failed with "              \
-                       "result 0x%X", #res, #ret, res.ErrorCode());       \
+                       "result 0x%X", #res, #ret, res.ErrorCodeAsInt());  \
       NS_WARNING(msg.get());                                              \
       return ret;                                                         \
     }                                                                     \
   } while(0)
 
 #define ENSURE_SUCCESS_VOID(res)                                          \
   do {                                                                    \
     if (res.Failed()) {                                                   \
       nsCString msg;                                                      \
       msg.AppendPrintf("ENSURE_SUCCESS_VOID(%s) failed with "             \
-                       "result 0x%X", #res, res.ErrorCode());             \
+                       "result 0x%X", #res, res.ErrorCodeAsInt());        \
       NS_WARNING(msg.get());                                              \
       return;                                                             \
     }                                                                     \
   } while(0)
 
 } // namespace mozilla
 
 #endif /* mozilla_ErrorResult_h */
--- a/dom/cache/DBSchema.cpp
+++ b/dom/cache/DBSchema.cpp
@@ -951,17 +951,17 @@ MatchByVaryHeader(mozIStorageConnection*
     rv = state->GetUTF8String(0, name);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     rv = state->GetUTF8String(1, value);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
     ErrorResult errorResult;
 
     cachedHeaders->Append(name, value, errorResult);
-    if (errorResult.Failed()) { return errorResult.ErrorCode(); };
+    if (errorResult.Failed()) { return errorResult.StealNSResult(); };
   }
   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
   nsRefPtr<InternalHeaders> queryHeaders =
     TypeUtils::ToInternalHeaders(aRequest.headers());
 
   // Assume the vary headers match until we find a conflict
   bool varyHeadersMatch = true;
--- a/dom/cache/Manager.cpp
+++ b/dom/cache/Manager.cpp
@@ -125,16 +125,34 @@ private:
 };
 
 } // anonymous namespace
 
 namespace mozilla {
 namespace dom {
 namespace cache {
 
+namespace {
+
+bool IsHeadRequest(CacheRequest aRequest, CacheQueryParams aParams)
+{
+  return !aParams.ignoreMethod() && aRequest.method().LowerCaseEqualsLiteral("head");
+}
+
+bool IsHeadRequest(CacheRequestOrVoid aRequest, CacheQueryParams aParams)
+{
+  if (aRequest.type() == CacheRequestOrVoid::TCacheRequest) {
+    return !aParams.ignoreMethod() &&
+           aRequest.get_CacheRequest().method().LowerCaseEqualsLiteral("head");
+  }
+  return false;
+}
+
+} // anonymous namespace
+
 // ----------------------------------------------------------------------------
 
 // Singleton class to track Manager instances and ensure there is only
 // one for each unique ManagerId.
 class Manager::Factory
 {
 public:
   friend class StaticAutoPtr<Manager::Factory>;
@@ -505,17 +523,19 @@ public:
   virtual nsresult
   RunSyncWithDBOnTarget(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
                         mozIStorageConnection* aConn) override
   {
     nsresult rv = db::CacheMatch(aConn, mCacheId, mArgs.request(),
                                  mArgs.params(), &mFoundResponse, &mResponse);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
-    if (!mFoundResponse || !mResponse.mHasBodyId) {
+    if (!mFoundResponse || !mResponse.mHasBodyId
+                        || IsHeadRequest(mArgs.request(), mArgs.params())) {
+      mResponse.mHasBodyId = false;
       return rv;
     }
 
     nsCOMPtr<nsIInputStream> stream;
     rv = BodyOpen(aQuotaInfo, aDBDir, mResponse.mBodyId, getter_AddRefs(stream));
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
 
@@ -568,17 +588,19 @@ public:
   RunSyncWithDBOnTarget(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
                         mozIStorageConnection* aConn) override
   {
     nsresult rv = db::CacheMatchAll(aConn, mCacheId, mArgs.requestOrVoid(),
                                     mArgs.params(), mSavedResponses);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
     for (uint32_t i = 0; i < mSavedResponses.Length(); ++i) {
-      if (!mSavedResponses[i].mHasBodyId) {
+      if (!mSavedResponses[i].mHasBodyId
+          || IsHeadRequest(mArgs.requestOrVoid(), mArgs.params())) {
+        mSavedResponses[i].mHasBodyId = false;
         continue;
       }
 
       nsCOMPtr<nsIInputStream> stream;
       rv = BodyOpen(aQuotaInfo, aDBDir, mSavedResponses[i].mBodyId,
                     getter_AddRefs(stream));
       if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
       if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
@@ -1057,17 +1079,19 @@ public:
   RunSyncWithDBOnTarget(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
                         mozIStorageConnection* aConn) override
   {
     nsresult rv = db::CacheKeys(aConn, mCacheId, mArgs.requestOrVoid(),
                                 mArgs.params(), mSavedRequests);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
     for (uint32_t i = 0; i < mSavedRequests.Length(); ++i) {
-      if (!mSavedRequests[i].mHasBodyId) {
+      if (!mSavedRequests[i].mHasBodyId
+          || IsHeadRequest(mArgs.requestOrVoid(), mArgs.params())) {
+        mSavedRequests[i].mHasBodyId = false;
         continue;
       }
 
       nsCOMPtr<nsIInputStream> stream;
       rv = BodyOpen(aQuotaInfo, aDBDir, mSavedRequests[i].mBodyId,
                     getter_AddRefs(stream));
       if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
       if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
@@ -1119,17 +1143,19 @@ public:
   RunSyncWithDBOnTarget(const QuotaInfo& aQuotaInfo, nsIFile* aDBDir,
                         mozIStorageConnection* aConn) override
   {
     nsresult rv = db::StorageMatch(aConn, mNamespace, mArgs.request(),
                                    mArgs.params(), &mFoundResponse,
                                    &mSavedResponse);
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
 
-    if (!mFoundResponse || !mSavedResponse.mHasBodyId) {
+    if (!mFoundResponse || !mSavedResponse.mHasBodyId
+                        || IsHeadRequest(mArgs.request(), mArgs.params())) {
+      mSavedResponse.mHasBodyId = false;
       return rv;
     }
 
     nsCOMPtr<nsIInputStream> stream;
     rv = BodyOpen(aQuotaInfo, aDBDir, mSavedResponse.mBodyId,
                   getter_AddRefs(stream));
     if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     if (NS_WARN_IF(!stream)) { return NS_ERROR_FILE_NOT_FOUND; }
--- a/dom/cache/test/mochitest/test_cache_matchAll_request.js
+++ b/dom/cache/test/mochitest/test_cache_matchAll_request.js
@@ -73,16 +73,21 @@ function testRequest(request1, request2,
     return c.matchAll(request1);
   }).then(function(r) {
     is(r.length, 1, "Should only find 1 item");
     return checkResponse(r[0], response1, response1Text);
   }).then(function() {
     return c.matchAll(new Request(request1, {method: "HEAD"}));
   }).then(function(r) {
     is(r.length, 1, "Should only find 1 item");
+    return checkResponse(r[0], response1, "");
+  }).then(function() {
+    return c.matchAll(new Request(request1, {method: "HEAD"}), {ignoreMethod: true});
+  }).then(function(r) {
+    is(r.length, 1, "Should only find 1 item");
     return checkResponse(r[0], response1, response1Text);
   }).then(function() {
     return Promise.all(
       ["POST", "PUT", "DELETE", "OPTIONS"]
         .map(function(method) {
           var req = new Request(request1, {method: method});
           return c.matchAll(req)
             .then(function(r) {
--- a/dom/cache/test/mochitest/test_cache_match_request.js
+++ b/dom/cache/test/mochitest/test_cache_match_request.js
@@ -1,28 +1,31 @@
 var request = new Request("//mochi.test:8888/?" + context + "#fragment");
 var requestWithAltQS = new Request("//mochi.test:8888/?queryString");
 var unknownRequest = new Request("//mochi.test:8888/non/existing/path?" + context);
 var response;
 var c;
 var responseText;
 var name = "match-request" + context;
 
-function checkResponse(r) {
+function checkResponse(r, expectedBody) {
+  if (expectedBody === undefined) {
+    expectedBody = responseText;
+  }
   ok(r !== response, "The objects should not be the same");
   is(r.url, response.url.replace("#fragment", ""),
      "The URLs should be the same");
   is(r.status, response.status, "The status codes should be the same");
   is(r.type, response.type, "The response types should be the same");
   is(r.ok, response.ok, "Both responses should have succeeded");
   is(r.statusText, response.statusText,
      "Both responses should have the same status text");
   return r.text().then(function(text) {
     // Avoid dumping out the large response text to the log if they're equal.
-    if (text !== responseText) {
+    if (text !== expectedBody) {
       is(text, responseText, "The response body should be correct");
     }
   });
 }
 
 fetch(new Request(request)).then(function(r) {
   response = r;
   return response.text();
@@ -58,16 +61,20 @@ function testRequest(request, unknownReq
     );
   }).then(function() {
     return c.match(request);
   }).then(function(r) {
     return checkResponse(r);
   }).then(function() {
     return c.match(new Request(request, {method: "HEAD"}));
   }).then(function(r) {
+    return checkResponse(r, '');
+  }).then(function() {
+    return c.match(new Request(request, {method: "HEAD"}), {ignoreMethod: true});
+  }).then(function(r) {
     return checkResponse(r);
   }).then(function() {
     return Promise.all(
       ["POST", "PUT", "DELETE", "OPTIONS"]
         .map(function(method) {
           var req = new Request(request, {method: method});
           return c.match(req)
             .then(function(r) {
--- a/dom/datastore/DataStoreDB.cpp
+++ b/dom/datastore/DataStoreDB.cpp
@@ -149,17 +149,17 @@ DataStoreDB::Open(IDBTransactionMode aMo
   nsresult rv = CreateFactoryIfNeeded();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   ErrorResult error;
   mRequest = mFactory->Open(mDatabaseName, DATASTOREDB_VERSION, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   rv = AddEventListeners();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   mState = Active;
@@ -229,17 +229,17 @@ DataStoreDB::UpgradeSchema(nsIDOMEvent* 
 #endif
 
   AutoSafeJSContext cx;
 
   ErrorResult error;
   JS::Rooted<JS::Value> result(cx);
   mRequest->GetResult(&result, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   MOZ_ASSERT(result.isObject());
 
   IDBDatabase* database = nullptr;
   nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), database);
   if (NS_FAILED(rv)) {
     NS_WARNING("Didn't get the object we expected!");
@@ -248,42 +248,42 @@ DataStoreDB::UpgradeSchema(nsIDOMEvent* 
 
   {
     IDBObjectStoreParameters params;
     params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true }"));
     nsRefPtr<IDBObjectStore> store =
       database->CreateObjectStore(NS_LITERAL_STRING(DATASTOREDB_NAME),
                                   params, error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
   }
 
   nsRefPtr<IDBObjectStore> store;
 
   {
     IDBObjectStoreParameters params;
     params.Init(NS_LITERAL_STRING("{ \"autoIncrement\": true, \"keyPath\": \"internalRevisionId\" }"));
 
     store =
       database->CreateObjectStore(NS_LITERAL_STRING(DATASTOREDB_REVISION),
                                   params, error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
   }
 
   {
     IDBIndexParameters params;
     params.Init(NS_LITERAL_STRING("{ \"unique\": true }"));
     nsRefPtr<IDBIndex> index =
       store->CreateIndex(NS_LITERAL_STRING(DATASTOREDB_REVISION_INDEX),
                          NS_LITERAL_STRING("revisionId"), params, error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
   }
 
   return NS_OK;
 }
 
 nsresult
 DataStoreDB::DatabaseOpened()
@@ -291,17 +291,17 @@ DataStoreDB::DatabaseOpened()
   MOZ_ASSERT(NS_IsMainThread());
 
   AutoSafeJSContext cx;
 
   ErrorResult error;
   JS::Rooted<JS::Value> result(cx);
   mRequest->GetResult(&result, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   MOZ_ASSERT(result.isObject());
 
   nsresult rv = UNWRAP_OBJECT(IDBDatabase, &result.toObject(), mDatabase);
   if (NS_FAILED(rv)) {
     NS_WARNING("Didn't get the object we expected!");
     return rv;
@@ -318,17 +318,17 @@ DataStoreDB::DatabaseOpened()
   StringOrStringSequence objectStores;
   objectStores.RawSetAsStringSequence().AppendElements(mObjectStores);
 
   nsRefPtr<IDBTransaction> txn;
   error = mDatabase->Transaction(objectStores,
                                  mTransactionMode,
                                  getter_AddRefs(txn));
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   mTransaction = txn.forget();
   return NS_OK;
 }
 
 nsresult
 DataStoreDB::Delete()
@@ -346,17 +346,17 @@ DataStoreDB::Delete()
     mDatabase->Close();
     mDatabase = nullptr;
   }
 
   ErrorResult error;
   nsRefPtr<IDBOpenDBRequest> request =
     mFactory->DeleteDatabase(mDatabaseName, IDBOpenDBOptions(), error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   return NS_OK;
 }
 
 indexedDB::IDBTransaction*
 DataStoreDB::Transaction() const
 {
--- a/dom/datastore/DataStoreRevision.cpp
+++ b/dom/datastore/DataStoreRevision.cpp
@@ -60,17 +60,17 @@ DataStoreRevision::AddRevision(JSContext
   JS::Rooted<JS::Value> value(aCx);
   if (!ToJSValue(aCx, data, &value)) {
     return NS_ERROR_FAILURE;
   }
 
   ErrorResult error;
   mRequest = aStore->Put(aCx, value, JS::UndefinedHandleValue, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   rv = mRequest->EventTarget::AddEventListener(NS_LITERAL_STRING("success"),
                                                this, false);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
--- a/dom/datastore/DataStoreService.cpp
+++ b/dom/datastore/DataStoreService.cpp
@@ -610,17 +610,17 @@ public:
   CreateFirstRevision(IDBTransaction* aTxn)
   {
     MOZ_ASSERT(aTxn);
 
     ErrorResult error;
     nsRefPtr<IDBObjectStore> store =
       aTxn->ObjectStore(NS_LITERAL_STRING(DATASTOREDB_REVISION), error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
     MOZ_ASSERT(store);
 
     nsRefPtr<RevisionAddedEnableStoreCallback> callback =
       new RevisionAddedEnableStoreCallback(mAppId, mName, mManifestURL);
 
     // Note: this cx is only used for rooting and AddRevision, neither of which
     // actually care which compartment we're in.
@@ -664,17 +664,17 @@ public:
 #endif
 
     AutoSafeJSContext cx;
 
     ErrorResult error;
     JS::Rooted<JS::Value> result(cx);
     request->GetResult(cx, &result, error);
     if (NS_WARN_IF(error.Failed())) {
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
 
     // This means that the content is a IDBCursor, so the first revision already
     // exists.
     if (result.isObject()) {
 #ifdef DEBUG
       IDBCursor* cursor = nullptr;
       error = UNWRAP_OBJECT(IDBCursor, &result.toObject(), cursor);
@@ -955,17 +955,17 @@ DataStoreService::GetDataStores(nsIDOMWi
   if (!window) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
   ErrorResult rv;
   nsRefPtr<Promise> promise = Promise::Create(global, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   nsCOMPtr<nsIDocument> document = window->GetDoc();
   MOZ_ASSERT(document);
 
   nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
   MOZ_ASSERT(principal);
 
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -3700,17 +3700,17 @@ nsDOMDeviceStorage::IsAvailable()
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Add(nsIDOMBlob *aBlob, nsIDOMDOMRequest * *_retval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = Add(aBlob, rv);
   request.forget(_retval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::Add(nsIDOMBlob* aBlob, ErrorResult& aRv)
 {
   if (!aBlob) {
     return nullptr;
   }
@@ -3749,17 +3749,17 @@ nsDOMDeviceStorage::Add(nsIDOMBlob* aBlo
 NS_IMETHODIMP
 nsDOMDeviceStorage::AddNamed(nsIDOMBlob *aBlob,
                              const nsAString & aPath,
                              nsIDOMDOMRequest * *_retval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = AddNamed(aBlob, aPath, rv);
   request.forget(_retval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::AddNamed(nsIDOMBlob* aBlob, const nsAString& aPath,
                              ErrorResult& aRv)
 {
   return AddOrAppendNamed(aBlob, aPath,
                           DEVICE_STORAGE_REQUEST_CREATE, aRv);
@@ -3845,27 +3845,27 @@ nsDOMDeviceStorage::AddOrAppendNamed(nsI
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Get(const nsAString& aPath, nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = Get(aPath, rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::GetEditable(const nsAString& aPath,
                                 nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = GetEditable(aPath, rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::GetInternal(const nsAString& aPath, bool aEditable,
                                 ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -3922,17 +3922,17 @@ nsDOMDeviceStorage::GetInternal(nsPIDOMW
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Delete(const nsAString& aPath, nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = Delete(aPath, rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::Delete(const nsAString& aPath, ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsPIDOMWindow> win = GetOwner();
@@ -3984,17 +3984,17 @@ nsDOMDeviceStorage::DeleteInternal(nsPID
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::FreeSpace(nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = FreeSpace(rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::FreeSpace(ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsPIDOMWindow> win = GetOwner();
@@ -4018,17 +4018,17 @@ nsDOMDeviceStorage::FreeSpace(ErrorResul
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::UsedSpace(nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = UsedSpace(rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::UsedSpace(ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsPIDOMWindow> win = GetOwner();
@@ -4056,17 +4056,17 @@ nsDOMDeviceStorage::UsedSpace(ErrorResul
 }
 
 NS_IMETHODIMP
 nsDOMDeviceStorage::Available(nsIDOMDOMRequest** aRetval)
 {
   ErrorResult rv;
   nsRefPtr<DOMRequest> request = Available(rv);
   request.forget(aRetval);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMRequest>
 nsDOMDeviceStorage::Available(ErrorResult& aRv)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsPIDOMWindow> win = GetOwner();
--- a/dom/events/ClipboardEvent.cpp
+++ b/dom/events/ClipboardEvent.cpp
@@ -39,17 +39,17 @@ ClipboardEvent::InitClipboardEvent(const
                                    nsIDOMDataTransfer* aClipboardData)
 {
   nsCOMPtr<DataTransfer> clipboardData = do_QueryInterface(aClipboardData);
   // Null clipboardData is OK
 
   ErrorResult rv;
   InitClipboardEvent(aType, aCanBubble, aCancelable, clipboardData, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 ClipboardEvent::InitClipboardEvent(const nsAString& aType, bool aCanBubble,
                                    bool aCancelable,
                                    DataTransfer* aClipboardData,
                                    ErrorResult& aError)
 {
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -321,17 +321,17 @@ DataTransfer::GetFiles(ErrorResult& aRv)
   return mFiles;
 }
 
 NS_IMETHODIMP
 DataTransfer::GetFiles(nsIDOMFileList** aFileList)
 {
   ErrorResult rv;
   NS_IF_ADDREF(*aFileList = GetFiles(rv));
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<DOMStringList>
 DataTransfer::Types()
 {
   nsRefPtr<DOMStringList> types = new DOMStringList();
   if (mItems.Length()) {
     bool addFile = false;
@@ -414,17 +414,17 @@ DataTransfer::GetData(const nsAString& a
   }
 }
 
 NS_IMETHODIMP
 DataTransfer::GetData(const nsAString& aFormat, nsAString& aData)
 {
   ErrorResult rv;
   GetData(aFormat, aData, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DataTransfer::SetData(const nsAString& aFormat, const nsAString& aData,
                       ErrorResult& aRv)
 {
   nsCOMPtr<nsIWritableVariant> variant = do_CreateInstance(NS_VARIANT_CONTRACTID);
   if (!variant) {
@@ -437,17 +437,17 @@ DataTransfer::SetData(const nsAString& a
   aRv = MozSetDataAt(aFormat, variant, 0);
 }
 
 NS_IMETHODIMP
 DataTransfer::SetData(const nsAString& aFormat, const nsAString& aData)
 {
   ErrorResult rv;
   SetData(aFormat, aData, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DataTransfer::ClearData(const Optional<nsAString>& aFormat, ErrorResult& aRv)
 {
   if (mReadOnly) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
@@ -466,17 +466,17 @@ DataTransfer::ClearData(const Optional<n
 
 NS_IMETHODIMP
 DataTransfer::ClearData(const nsAString& aFormat)
 {
   Optional<nsAString> format;
   format = &aFormat;
   ErrorResult rv;
   ClearData(format, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 DataTransfer::GetMozItemCount(uint32_t* aCount)
 {
   *aCount = MozItemCount();
   return NS_OK;
 }
@@ -551,17 +551,17 @@ DataTransfer::MozTypesAt(uint32_t aIndex
 }
 
 NS_IMETHODIMP
 DataTransfer::MozTypesAt(uint32_t aIndex, nsISupports** aTypes)
 {
   ErrorResult rv;
   nsRefPtr<DOMStringList> types = MozTypesAt(aIndex, rv);
   types.forget(aTypes);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 DataTransfer::MozGetDataAt(const nsAString& aFormat, uint32_t aIndex,
                            nsIVariant** aData)
 {
   *aData = nullptr;
 
@@ -784,17 +784,17 @@ DataTransfer::MozClearDataAtHelper(const
      mItems.RemoveElementAt(aIndex);
 }
 
 NS_IMETHODIMP
 DataTransfer::MozClearDataAt(const nsAString& aFormat, uint32_t aIndex)
 {
   ErrorResult rv;
   MozClearDataAt(aFormat, aIndex, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DataTransfer::SetDragImage(Element& aImage, int32_t aX, int32_t aY,
                            ErrorResult& aRv)
 {
   if (mReadOnly) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
@@ -809,17 +809,17 @@ DataTransfer::SetDragImage(Element& aIma
 NS_IMETHODIMP
 DataTransfer::SetDragImage(nsIDOMElement* aImage, int32_t aX, int32_t aY)
 {
   ErrorResult rv;
   nsCOMPtr<Element> image = do_QueryInterface(aImage);
   if (image) {
     SetDragImage(*image, aX, aY, rv);
   }
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DataTransfer::AddElement(Element& aElement, ErrorResult& aRv)
 {
   if (mReadOnly) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
@@ -833,17 +833,17 @@ DataTransfer::AddElement(nsIDOMElement* 
 {
   NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<Element> element = do_QueryInterface(aElement);
   NS_ENSURE_TRUE(element, NS_ERROR_INVALID_ARG);
 
   ErrorResult rv;
   AddElement(*element, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsresult
 DataTransfer::Clone(nsISupports* aParent, uint32_t aEventType,
                     bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
                     DataTransfer** aNewDataTransfer)
 {
   DataTransfer* newDataTransfer =
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -955,17 +955,17 @@ EventListenerManager::HandleEventSubType
     if (mIsMainThreadELM) {
       nsContentUtils::EnterMicroTask();
     }
     // nsIDOMEvent::currentTarget is set in EventDispatcher.
     if (listenerHolder.HasWebIDLCallback()) {
       ErrorResult rv;
       listenerHolder.GetWebIDLCallback()->
         HandleEvent(aCurrentTarget, *(aDOMEvent->InternalDOMEvent()), rv);
-      result = rv.ErrorCode();
+      result = rv.StealNSResult();
     } else {
       result = listenerHolder.GetXPCOMCallback()->HandleEvent(aDOMEvent);
     }
     if (mIsMainThreadELM) {
       nsContentUtils::LeaveMicroTask();
     }
   }
 
--- a/dom/events/JSEventHandler.cpp
+++ b/dom/events/JSEventHandler.cpp
@@ -161,17 +161,17 @@ JSEventHandler::HandleEvent(nsIDOMEvent*
     }
 
     nsRefPtr<OnErrorEventHandlerNonNull> handler =
       mTypedHandler.OnErrorEventHandler();
     ErrorResult rv;
     bool handled = handler->Call(mTarget, msgOrEvent, fileName, lineNumber,
                                  columnNumber, error, rv);
     if (rv.Failed()) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     if (handled) {
       event->PreventDefaultInternal(isChromeHandler);
     }
     return NS_OK;
   }
 
@@ -179,17 +179,17 @@ JSEventHandler::HandleEvent(nsIDOMEvent*
     MOZ_ASSERT(mEventName == nsGkAtoms::onbeforeunload);
 
     nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handler =
       mTypedHandler.OnBeforeUnloadEventHandler();
     ErrorResult rv;
     nsString retval;
     handler->Call(mTarget, *(aEvent->InternalDOMEvent()), retval, rv);
     if (rv.Failed()) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     nsCOMPtr<nsIDOMBeforeUnloadEvent> beforeUnload = do_QueryInterface(aEvent);
     NS_ENSURE_STATE(beforeUnload);
 
     if (!DOMStringIsNull(retval)) {
       event->PreventDefaultInternal(isChromeHandler);
 
@@ -208,17 +208,17 @@ JSEventHandler::HandleEvent(nsIDOMEvent*
   }
 
   MOZ_ASSERT(mTypedHandler.Type() == TypedEventHandler::eNormal);
   ErrorResult rv;
   nsRefPtr<EventHandlerNonNull> handler = mTypedHandler.NormalEventHandler();
   JS::Rooted<JS::Value> retval(CycleCollectedJSRuntime::Get()->Runtime());
   handler->Call(mTarget, *(aEvent->InternalDOMEvent()), &retval, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // If the handler returned false and its sense is not reversed,
   // or the handler returned true and its sense is reversed from
   // the usual (false means cancel), then prevent default.
   if (retval.isBoolean() &&
       retval.toBoolean() == (mEventName == nsGkAtoms::onerror ||
                              mEventName == nsGkAtoms::onmouseover)) {
--- a/dom/events/MessageEvent.cpp
+++ b/dom/events/MessageEvent.cpp
@@ -65,17 +65,17 @@ MessageEvent::WrapObjectInternal(JSConte
   return mozilla::dom::MessageEventBinding::Wrap(aCx, this, aGivenProto);
 }
 
 NS_IMETHODIMP
 MessageEvent::GetData(JSContext* aCx, JS::MutableHandle<JS::Value> aData)
 {
   ErrorResult rv;
   GetData(aCx, aData, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 MessageEvent::GetData(JSContext* aCx, JS::MutableHandle<JS::Value> aData,
                       ErrorResult& aRv)
 {
   JS::ExposeValueToActiveJS(mData);
   aData.set(mData);
--- a/dom/events/SpeechRecognitionError.cpp
+++ b/dom/events/SpeechRecognitionError.cpp
@@ -37,17 +37,17 @@ void
 SpeechRecognitionError::InitSpeechRecognitionError(const nsAString& aType,
                                                    bool aCanBubble,
                                                    bool aCancelable,
                                                    SpeechRecognitionErrorCode aError,
                                                    const nsAString& aMessage,
                                                    ErrorResult& aRv)
 {
   aRv = Event::InitEvent(aType, aCanBubble, aCancelable);
-  NS_ENSURE_SUCCESS_VOID(aRv.ErrorCode());
+  NS_ENSURE_TRUE_VOID(!aRv.Failed());
 
   mError = aError;
   mMessage = aMessage;
   return;
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/fetch/FetchDriver.cpp
+++ b/dom/fetch/FetchDriver.cpp
@@ -215,33 +215,33 @@ FetchDriver::BasicFetch()
     }
 
     nsRefPtr<InternalResponse> response = new InternalResponse(200, NS_LITERAL_CSTRING("OK"));
     {
       ErrorResult result;
       uint64_t size = blob->GetSize(result);
       if (NS_WARN_IF(result.Failed())) {
         FailWithNetworkError();
-        return result.ErrorCode();
+        return result.StealNSResult();
       }
 
       nsAutoString sizeStr;
       sizeStr.AppendInt(size);
       response->Headers()->Append(NS_LITERAL_CSTRING("Content-Length"), NS_ConvertUTF16toUTF8(sizeStr), result);
       if (NS_WARN_IF(result.Failed())) {
         FailWithNetworkError();
-        return result.ErrorCode();
+        return result.StealNSResult();
       }
 
       nsAutoString type;
       blob->GetType(type);
       response->Headers()->Append(NS_LITERAL_CSTRING("Content-Type"), NS_ConvertUTF16toUTF8(type), result);
       if (NS_WARN_IF(result.Failed())) {
         FailWithNetworkError();
-        return result.ErrorCode();
+        return result.StealNSResult();
       }
     }
 
     nsCOMPtr<nsIInputStream> stream;
     rv = blob->GetInternalStream(getter_AddRefs(stream));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       FailWithNetworkError();
       return rv;
--- a/dom/filehandle/FileHandle.cpp
+++ b/dom/filehandle/FileHandle.cpp
@@ -469,17 +469,17 @@ FileHandleBase::OpenInputStream(bool aWh
 {
   MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
   MOZ_ASSERT(mRequestMode == PARALLEL,
              "Don't call me in other than parallel mode!");
 
   // Common state checking
   ErrorResult error;
   if (!CheckState(error)) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   // Do nothing if the window is closed
   if (!CheckWindow()) {
     return NS_OK;
   }
 
   nsRefPtr<OpenStreamHelper> helper =
--- a/dom/filesystem/FileSystemTaskBase.cpp
+++ b/dom/filesystem/FileSystemTaskBase.cpp
@@ -161,17 +161,17 @@ FileSystemTaskBase::GetBlobParent(nsIDOM
   MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
   MOZ_ASSERT(aFile);
 
   // Load the lazy dom file data from the parent before sending to the child.
   nsString mimeType;
   aFile->GetType(mimeType);
   uint64_t fileSize;
   aFile->GetSize(&fileSize);
-  uint64_t lastModifiedDate;
+  int64_t lastModifiedDate;
   aFile->GetMozLastModifiedDate(&lastModifiedDate);
 
   ContentParent* cp = static_cast<ContentParent*>(mRequestParent->Manager());
   return cp->GetOrCreateActorForBlob(static_cast<File*>(aFile));
 }
 
 void
 FileSystemTaskBase::SetError(const nsresult& aErrorValue)
--- a/dom/html/HTMLBodyElement.cpp
+++ b/dom/html/HTMLBodyElement.cpp
@@ -199,102 +199,102 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLBodyElem
 
 NS_IMPL_ELEMENT_CLONE(HTMLBodyElement)
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetBackground(const nsAString& aBackground)
 {
   ErrorResult rv;
   SetBackground(aBackground, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetBackground(nsAString& aBackground)
 {
   DOMString background;
   GetBackground(background);
   background.ToString(aBackground);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetVLink(const nsAString& aVLink)
 {
   ErrorResult rv;
   SetVLink(aVLink, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetVLink(nsAString& aVLink)
 {
   DOMString vLink;
   GetVLink(vLink);
   vLink.ToString(aVLink);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetALink(const nsAString& aALink)
 {
   ErrorResult rv;
   SetALink(aALink, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetALink(nsAString& aALink)
 {
   DOMString aLink;
   GetALink(aLink);
   aLink.ToString(aALink);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetLink(const nsAString& aLink)
 {
   ErrorResult rv;
   SetLink(aLink, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetLink(nsAString& aLink)
 {
   DOMString link;
   GetLink(link);
   link.ToString(aLink);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetText(const nsAString& aText)
 {
   ErrorResult rv;
   SetText(aText, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetText(nsAString& aText)
 {
   DOMString text;
   GetText(text);
   text.ToString(aText);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLBodyElement::SetBgColor(const nsAString& aBgColor)
 {
   ErrorResult rv;
   SetBgColor(aBgColor, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLBodyElement::GetBgColor(nsAString& aBgColor)
 {
   DOMString bgColor;
   GetBgColor(bgColor);
   bgColor.ToString(aBgColor);
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -281,17 +281,17 @@ HTMLCanvasElement::CopyInnerTo(Element* 
     nsRefPtr<CanvasRenderingContext2D> context2d =
       static_cast<CanvasRenderingContext2D*>(cxt.get());
     if (context2d && !mPrintCallback) {
       HTMLImageOrCanvasOrVideoElement element;
       element.SetAsHTMLCanvasElement() = this;
       ErrorResult err;
       context2d->DrawImage(element,
                            0.0, 0.0, err);
-      rv = err.ErrorCode();
+      rv = err.StealNSResult();
     }
   }
   return rv;
 }
 
 nsresult HTMLCanvasElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
 {
   if (aVisitor.mEvent->mClass == eMouseEventClass) {
@@ -569,17 +569,17 @@ HTMLCanvasElement::ToBlob(JSContext* aCx
       nsRefPtr<File> newBlob = new File(mGlobal, blob->Impl());
 
       mozilla::ErrorResult error;
       mFileCallback->Call(*newBlob, error);
 
       mGlobal = nullptr;
       mFileCallback = nullptr;
 
-      return error.ErrorCode();
+      return error.StealNSResult();
     }
 
     nsCOMPtr<nsIGlobalObject> mGlobal;
     nsRefPtr<FileCallback> mFileCallback;
   };
 
   nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
   MOZ_ASSERT(global);
@@ -723,17 +723,17 @@ CreateContextForCanvas(CanvasContextType
 }
 
 nsresult
 HTMLCanvasElement::GetContext(const nsAString& aContextId,
                               nsISupports** aContext)
 {
   ErrorResult rv;
   *aContext = GetContext(nullptr, aContextId, JS::NullHandleValue, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<nsISupports>
 HTMLCanvasElement::GetContext(JSContext* aCx,
                               const nsAString& aContextId,
                               JS::Handle<JS::Value> aContextOptions,
                               ErrorResult& rv)
 {
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -265,17 +265,17 @@ HTMLFormElement::Submit(ErrorResult& aRv
   aRv = DoSubmitOrReset(nullptr, NS_FORM_SUBMIT);
 }
 
 NS_IMETHODIMP
 HTMLFormElement::Submit()
 {
   ErrorResult rv;
   Submit(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLFormElement::Reset()
 {
   InternalFormEvent event(true, NS_FORM_RESET);
   EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
   return NS_OK;
--- a/dom/html/HTMLFrameSetElement.cpp
+++ b/dom/html/HTMLFrameSetElement.cpp
@@ -28,34 +28,34 @@ NS_IMPL_ISUPPORTS_INHERITED(HTMLFrameSet
 
 NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement)
 
 NS_IMETHODIMP 
 HTMLFrameSetElement::SetCols(const nsAString& aCols)
 {
   ErrorResult rv;
   SetCols(aCols, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLFrameSetElement::GetCols(nsAString& aCols)
 {
   DOMString cols;
   GetCols(cols);
   cols.ToString(aCols);
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 HTMLFrameSetElement::SetRows(const nsAString& aRows)
 {
   ErrorResult rv;
   SetRows(aRows, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLFrameSetElement::GetRows(nsAString& aRows)
 {
   DOMString rows;
   GetRows(rows);
   rows.ToString(aRows);
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -275,33 +275,33 @@ HTMLImageElement::GetHeight(uint32_t* aH
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLImageElement::SetHeight(uint32_t aHeight)
 {
   ErrorResult rv;
   SetHeight(aHeight, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLImageElement::GetWidth(uint32_t* aWidth)
 {
   *aWidth = Width();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLImageElement::SetWidth(uint32_t aWidth)
 {
   ErrorResult rv;
   SetWidth(aWidth, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
                                  nsIAtom* aAttribute,
                                  const nsAString& aValue,
                                  nsAttrValue& aResult)
 {
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1605,17 +1605,17 @@ HTMLInputElement::GetHeight(uint32_t* aH
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetHeight(uint32_t aHeight)
 {
   ErrorResult rv;
   SetHeight(aHeight, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetIndeterminate(bool* aValue)
 {
   *aValue = Indeterminate();
   return NS_OK;
 }
@@ -1659,17 +1659,17 @@ HTMLInputElement::GetWidth(uint32_t* aWi
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetWidth(uint32_t aWidth)
 {
   ErrorResult rv;
   SetWidth(aWidth, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetValue(nsAString& aValue)
 {
   GetValueInternal(aValue);
 
   // Don't return non-sanitized value for types that are experimental on mobile.
@@ -1870,17 +1870,17 @@ HTMLInputElement::SetValue(const nsAStri
   }
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetValue(const nsAString& aValue)
 {
   ErrorResult rv;
   SetValue(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsGenericHTMLElement*
 HTMLInputElement::GetList() const
 {
   nsAutoString dataListId;
   GetAttr(kNameSpaceID_None, nsGkAtoms::list, dataListId);
   if (dataListId.IsEmpty()) {
@@ -2084,17 +2084,17 @@ HTMLInputElement::SetValueAsNumber(doubl
   SetValue(Decimal::fromDouble(aValueAsNumber));
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetValueAsNumber(double aValueAsNumber)
 {
   ErrorResult rv;
   SetValueAsNumber(aValueAsNumber, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Decimal
 HTMLInputElement::GetMinimum() const
 {
   MOZ_ASSERT(DoesValueAsNumberApply(),
              "GetMinimum() should only be used for types that allow .valueAsNumber");
 
@@ -2400,17 +2400,17 @@ HTMLInputElement::MozSetFileNameArray(co
 
   Sequence<nsString> list;
   for (uint32_t i = 0; i < aLength; ++i) {
     list.AppendElement(nsDependentString(aFileNames[i]));
   }
 
   ErrorResult rv;
   MozSetFileNameArray(list, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 HTMLInputElement::MozIsTextField(bool aExcludePassword)
 {
   // TODO: temporary until bug 773205 is fixed.
   if (IsExperimentalMobileType(mType)) {
     return false;
@@ -2449,17 +2449,17 @@ HTMLInputElement::SetUserInput(const nsA
   }
 
   if (mType == NS_FORM_INPUT_FILE)
   {
     Sequence<nsString> list;
     list.AppendElement(aValue);
     ErrorResult rv;
     MozSetFileNameArray(list, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   } else {
     nsresult rv = SetValueInternal(aValue, true, true);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
                                        static_cast<nsIDOMHTMLInputElement*>(this),
                                        NS_LITERAL_STRING("input"), true,
@@ -5182,33 +5182,33 @@ HTMLInputElement::GetControllers(ErrorRe
 NS_IMETHODIMP
 HTMLInputElement::GetControllers(nsIControllers** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   ErrorResult rv;
   nsRefPtr<nsIControllers> controller = GetControllers(rv);
   controller.forget(aResult);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 HTMLInputElement::GetTextLength(ErrorResult& aRv)
 {
   nsAutoString val;
   GetValue(val);
   return val.Length();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetTextLength(int32_t* aTextLength)
 {
   ErrorResult rv;
   *aTextLength = GetTextLength(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLInputElement::SetSelectionRange(int32_t aSelectionStart,
                                     int32_t aSelectionEnd,
                                     const Optional<nsAString>& aDirection,
                                     ErrorResult& aRv)
 {
@@ -5239,17 +5239,17 @@ HTMLInputElement::SetSelectionRange(int3
                                     int32_t aSelectionEnd,
                                     const nsAString& aDirection)
 {
   ErrorResult rv;
   Optional<nsAString> direction;
   direction = &aDirection;
 
   SetSelectionRange(aSelectionStart, aSelectionEnd, direction, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLInputElement::SetRangeText(const nsAString& aReplacement, ErrorResult& aRv)
 {
   if (!SupportsSetRangeText()) {
     aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
     return;
@@ -5381,17 +5381,17 @@ HTMLInputElement::GetSelectionStart(Erro
 
 NS_IMETHODIMP
 HTMLInputElement::GetSelectionStart(int32_t* aSelectionStart)
 {
   NS_ENSURE_ARG_POINTER(aSelectionStart);
 
   ErrorResult rv;
   *aSelectionStart = GetSelectionStart(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLInputElement::SetSelectionStart(int32_t aSelectionStart, ErrorResult& aRv)
 {
   nsTextEditorState* state = GetEditorState();
   if (state && state->IsSelectionCached()) {
     state->GetSelectionProperties().mStart = aSelectionStart;
@@ -5418,17 +5418,17 @@ HTMLInputElement::SetSelectionStart(int3
   aRv = SetSelectionRange(start, end, direction);
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetSelectionStart(int32_t aSelectionStart)
 {
   ErrorResult rv;
   SetSelectionStart(aSelectionStart, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 int32_t
 HTMLInputElement::GetSelectionEnd(ErrorResult& aRv)
 {
   int32_t selStart, selEnd;
   aRv = GetSelectionRange(&selStart, &selEnd);
 
@@ -5445,17 +5445,17 @@ HTMLInputElement::GetSelectionEnd(ErrorR
 
 NS_IMETHODIMP
 HTMLInputElement::GetSelectionEnd(int32_t* aSelectionEnd)
 {
   NS_ENSURE_ARG_POINTER(aSelectionEnd);
 
   ErrorResult rv;
   *aSelectionEnd = GetSelectionEnd(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLInputElement::SetSelectionEnd(int32_t aSelectionEnd, ErrorResult& aRv)
 {
   nsTextEditorState* state = GetEditorState();
   if (state && state->IsSelectionCached()) {
     state->GetSelectionProperties().mEnd = aSelectionEnd;
@@ -5482,17 +5482,17 @@ HTMLInputElement::SetSelectionEnd(int32_
   aRv = SetSelectionRange(start, end, direction);
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetSelectionEnd(int32_t aSelectionEnd)
 {
   ErrorResult rv;
   SetSelectionEnd(aSelectionEnd, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetFiles(nsIDOMFileList** aFileList)
 {
   nsRefPtr<FileList> list = GetFiles();
   list.forget(aFileList);
   return NS_OK;
@@ -5552,17 +5552,17 @@ HTMLInputElement::GetSelectionDirection(
   }
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetSelectionDirection(nsAString& aDirection)
 {
   ErrorResult rv;
   GetSelectionDirection(aDirection, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLInputElement::SetSelectionDirection(const nsAString& aDirection, ErrorResult& aRv)
 {
   nsTextEditorState* state = GetEditorState();
   if (state && state->IsSelectionCached()) {
     nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
@@ -5582,17 +5582,17 @@ HTMLInputElement::SetSelectionDirection(
   }
 }
 
 NS_IMETHODIMP
 HTMLInputElement::SetSelectionDirection(const nsAString& aDirection)
 {
   ErrorResult rv;
   SetSelectionDirection(aDirection, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetPhonetic(nsAString& aPhonetic)
 {
   aPhonetic.Truncate();
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
   nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
--- a/dom/html/HTMLLabelElement.cpp
+++ b/dom/html/HTMLLabelElement.cpp
@@ -54,17 +54,17 @@ HTMLLabelElement::GetControl(nsIDOMHTMLE
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLLabelElement::SetHtmlFor(const nsAString& aHtmlFor)
 {
   ErrorResult rv;
   SetHtmlFor(aHtmlFor, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLLabelElement::GetHtmlFor(nsAString& aHtmlFor)
 {
   nsString htmlFor;
   GetHtmlFor(htmlFor);
   aHtmlFor = htmlFor;
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1570,17 +1570,17 @@ NS_IMETHODIMP HTMLMediaElement::SetCurre
   // Detect for a NaN and invalid values.
   if (mozilla::IsNaN(aCurrentTime)) {
     LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime));
     return NS_ERROR_FAILURE;
   }
 
   ErrorResult rv;
   SetCurrentTime(aCurrentTime, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* readonly attribute double duration; */
 double
 HTMLMediaElement::Duration() const
 {
   if (mSrcStream) {
     return std::numeric_limits<double>::infinity();
@@ -1693,17 +1693,17 @@ HTMLMediaElement::Pause(ErrorResult& aRv
     DispatchAsyncEvent(NS_LITERAL_STRING("pause"));
   }
 }
 
 NS_IMETHODIMP HTMLMediaElement::Pause()
 {
   ErrorResult rv;
   Pause(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* attribute double volume; */
 NS_IMETHODIMP HTMLMediaElement::GetVolume(double* aVolume)
 {
   *aVolume = Volume();
   return NS_OK;
 }
@@ -1726,17 +1726,17 @@ HTMLMediaElement::SetVolume(double aVolu
 
   DispatchAsyncEvent(NS_LITERAL_STRING("volumechange"));
 }
 
 NS_IMETHODIMP HTMLMediaElement::SetVolume(double aVolume)
 {
   ErrorResult rv;
   SetVolume(aVolume, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 // Helper struct with arguments for our hash iterator.
 typedef struct MOZ_STACK_CLASS {
   JSContext* cx;
   JS::Handle<JSObject*> tags;
   bool error;
 } MetadataIterCx;
@@ -1798,17 +1798,17 @@ HTMLMediaElement::MozGetMetadata(JSConte
   ErrorResult rv;
   JS::Rooted<JSObject*> obj(cx);
   MozGetMetadata(cx, &obj, rv);
   if (!rv.Failed()) {
     MOZ_ASSERT(obj);
     aValue.setObject(*obj);
   }
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* attribute boolean muted; */
 NS_IMETHODIMP HTMLMediaElement::GetMuted(bool* aMuted)
 {
   *aMuted = Muted();
   return NS_OK;
 }
@@ -2267,17 +2267,17 @@ HTMLMediaElement::Play(ErrorResult& aRv)
   AddRemoveSelfReference();
   UpdatePreloadAction();
 }
 
 NS_IMETHODIMP HTMLMediaElement::Play()
 {
   ErrorResult rv;
   Play(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 HTMLMediaElement::WakeLockBoolWrapper&
 HTMLMediaElement::WakeLockBoolWrapper::operator=(bool val)
 {
   if (mValue == val) {
     return *this;
   }
@@ -4314,17 +4314,17 @@ HTMLMediaElement::SetDefaultPlaybackRate
   mDefaultPlaybackRate = ClampPlaybackRate(aDefaultPlaybackRate);
   DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
 }
 
 NS_IMETHODIMP HTMLMediaElement::SetDefaultPlaybackRate(double aDefaultPlaybackRate)
 {
   ErrorResult rv;
   SetDefaultPlaybackRate(aDefaultPlaybackRate, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* attribute double playbackRate; */
 NS_IMETHODIMP HTMLMediaElement::GetPlaybackRate(double* aPlaybackRate)
 {
   *aPlaybackRate = PlaybackRate();
   return NS_OK;
 }
@@ -4354,17 +4354,17 @@ HTMLMediaElement::SetPlaybackRate(double
   }
   DispatchAsyncEvent(NS_LITERAL_STRING("ratechange"));
 }
 
 NS_IMETHODIMP HTMLMediaElement::SetPlaybackRate(double aPlaybackRate)
 {
   ErrorResult rv;
   SetPlaybackRate(aPlaybackRate, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 /* attribute bool mozPreservesPitch; */
 NS_IMETHODIMP HTMLMediaElement::GetMozPreservesPitch(bool* aPreservesPitch)
 {
   *aPreservesPitch = MozPreservesPitch();
   return NS_OK;
 }
--- a/dom/html/HTMLOptionsCollection.cpp
+++ b/dom/html/HTMLOptionsCollection.cpp
@@ -171,17 +171,17 @@ HTMLOptionsCollection::SetOption(uint32_
     nsRefPtr<HTMLOptionElement> refChild = ItemAsOption(index);
     NS_ENSURE_TRUE(refChild, NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsINode> parent = refChild->GetParent();
     if (parent) {
       nsCOMPtr<nsINode> node = do_QueryInterface(aOption);
       ErrorResult res;
       parent->ReplaceChild(*node, *refChild, res);
-      rv = res.ErrorCode();
+      rv = res.StealNSResult();
     }
   }
 
   return rv;
 }
 
 int32_t
 HTMLOptionsCollection::GetSelectedIndex(ErrorResult& aError)
@@ -196,17 +196,17 @@ HTMLOptionsCollection::GetSelectedIndex(
   return selectedIndex;
 }
 
 NS_IMETHODIMP
 HTMLOptionsCollection::GetSelectedIndex(int32_t* aSelectedIndex)
 {
   ErrorResult rv;
   *aSelectedIndex = GetSelectedIndex(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex,
                                         ErrorResult& aError)
 {
   if (!mSelect) {
     aError.Throw(NS_ERROR_UNEXPECTED);
@@ -216,17 +216,17 @@ HTMLOptionsCollection::SetSelectedIndex(
   aError = mSelect->SetSelectedIndex(aSelectedIndex);
 }
 
 NS_IMETHODIMP
 HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex)
 {
   ErrorResult rv;
   SetSelectedIndex(aSelectedIndex, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLOptionsCollection::Item(uint32_t aIndex, nsIDOMNode** aReturn)
 {
   nsISupports* item = GetElementAt(aIndex);
   if (!item) {
     *aReturn = nullptr;
@@ -366,13 +366,13 @@ HTMLOptionsCollection::Remove(int32_t aI
   aError = mSelect->Remove(aIndex);
 }
 
 NS_IMETHODIMP
 HTMLOptionsCollection::Remove(int32_t aIndex)
 {
   ErrorResult rv;
   Remove(aIndex, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/html/HTMLScriptElement.cpp
+++ b/dom/html/HTMLScriptElement.cpp
@@ -116,17 +116,17 @@ HTMLScriptElement::GetText(nsAString& aV
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLScriptElement::SetText(const nsAString& aValue)
 {
   ErrorResult rv;
   SetText(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLScriptElement::SetText(const nsAString& aValue, ErrorResult& rv)
 {
   rv = nsContentUtils::SetNodeTextContent(this, aValue, true);
 }
 
@@ -193,17 +193,17 @@ HTMLScriptElement::Async()
   return mForceAsync || GetBoolAttr(nsGkAtoms::async);
 }
 
 nsresult
 HTMLScriptElement::SetAsync(bool aValue)
 {
   ErrorResult rv;
   SetAsync(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLScriptElement::SetAsync(bool aValue, ErrorResult& rv)
 {
   mForceAsync = false;
   SetHTMLBoolAttr(nsGkAtoms::async, aValue, rv);
 }
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -657,42 +657,42 @@ HTMLSelectElement::Add(nsIDOMHTMLElement
     return NS_ERROR_NULL_POINTER;
   }
 
   // aBefore is omitted, undefined or null
   if (dataType == nsIDataType::VTYPE_EMPTY ||
       dataType == nsIDataType::VTYPE_VOID) {
     ErrorResult error;
     Add(*htmlElement, (nsGenericHTMLElement*)nullptr, error);
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   nsCOMPtr<nsISupports> supports;
   nsCOMPtr<nsIDOMHTMLElement> beforeElement;
 
   // whether aBefore is nsIDOMHTMLElement...
   if (NS_SUCCEEDED(aBefore->GetAsISupports(getter_AddRefs(supports)))) {
     nsCOMPtr<nsIContent> beforeElement = do_QueryInterface(supports);
     nsGenericHTMLElement* beforeHTMLElement =
       nsGenericHTMLElement::FromContentOrNull(beforeElement);
 
     NS_ENSURE_TRUE(beforeHTMLElement, NS_ERROR_DOM_SYNTAX_ERR);
 
     ErrorResult error;
     Add(*htmlElement, beforeHTMLElement, error);
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   // otherwise, whether aBefore is long
   int32_t index;
   NS_ENSURE_SUCCESS(aBefore->GetAsInt32(&index), NS_ERROR_DOM_SYNTAX_ERR);
 
   ErrorResult error;
   Add(*htmlElement, index, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLSelectElement::Remove(int32_t aIndex)
 {
   nsCOMPtr<nsINode> option = Item(static_cast<uint32_t>(aIndex));
   if (!option) {
     return NS_OK;
@@ -731,17 +731,17 @@ HTMLSelectElement::GetLength(uint32_t* a
 
 #define MAX_DYNAMIC_SELECT_LENGTH 10000
 
 NS_IMETHODIMP
 HTMLSelectElement::SetLength(uint32_t aLength)
 {
   ErrorResult rv;
   SetLength(aLength, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 HTMLSelectElement::SetLength(uint32_t aLength, ErrorResult& aRv)
 {
   uint32_t curlen = Length();
 
   if (curlen > aLength) { // Remove extra options
--- a/dom/html/HTMLTableCellElement.cpp
+++ b/dom/html/HTMLTableCellElement.cpp
@@ -116,234 +116,234 @@ HTMLTableCellElement::WalkContentStyleRu
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetAbbr(const nsAString& aAbbr)
 {
   ErrorResult rv;
   SetAbbr(aAbbr, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetAbbr(nsAString& aAbbr)
 {
   DOMString abbr;
   GetAbbr(abbr);
   abbr.ToString(aAbbr);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetAxis(const nsAString& aAxis)
 {
   ErrorResult rv;
   SetAxis(aAxis, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetAxis(nsAString& aAxis)
 {
   DOMString axis;
   GetAxis(axis);
   axis.ToString(aAxis);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetAlign(const nsAString& aAlign)
 {
   ErrorResult rv;
   SetAlign(aAlign, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetAlign(nsAString& aAlign)
 {
   DOMString align;
   GetAlign(align);
   align.ToString(aAlign);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetVAlign(const nsAString& aVAlign)
 {
   ErrorResult rv;
   SetVAlign(aVAlign, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetVAlign(nsAString& aVAlign)
 {
   DOMString vAlign;
   GetVAlign(vAlign);
   vAlign.ToString(aVAlign);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetCh(const nsAString& aCh)
 {
   ErrorResult rv;
   SetCh(aCh, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetCh(nsAString& aCh)
 {
   DOMString ch;
   GetCh(ch);
   ch.ToString(aCh);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetChOff(const nsAString& aChOff)
 {
   ErrorResult rv;
   SetChOff(aChOff, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetChOff(nsAString& aChOff)
 {
   DOMString chOff;
   GetChOff(chOff);
   chOff.ToString(aChOff);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetBgColor(const nsAString& aBgColor)
 {
   ErrorResult rv;
   SetBgColor(aBgColor, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetBgColor(nsAString& aBgColor)
 {
   DOMString bgColor;
   GetBgColor(bgColor);
   bgColor.ToString(aBgColor);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetHeight(const nsAString& aHeight)
 {
   ErrorResult rv;
   SetHeight(aHeight, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetHeight(nsAString& aHeight)
 {
   DOMString height;
   GetHeight(height);
   height.ToString(aHeight);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetWidth(const nsAString& aWidth)
 {
   ErrorResult rv;
   SetWidth(aWidth, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetWidth(nsAString& aWidth)
 {
   DOMString width;
   GetWidth(width);
   width.ToString(aWidth);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetNoWrap(bool aNoWrap)
 {
   ErrorResult rv;
   SetNoWrap(aNoWrap, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetNoWrap(bool* aNoWrap)
 {
   *aNoWrap = NoWrap();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetScope(const nsAString& aScope)
 {
   ErrorResult rv;
   SetScope(aScope, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetScope(nsAString& aScope)
 {
   DOMString scope;
   GetScope(scope);
   scope.ToString(aScope);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetHeaders(const nsAString& aHeaders)
 {
   ErrorResult rv;
   SetHeaders(aHeaders, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetHeaders(nsAString& aHeaders)
 {
   DOMString headers;
   GetHeaders(headers);
   headers.ToString(aHeaders);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetColSpan(int32_t aColSpan)
 {
   ErrorResult rv;
   SetColSpan(aColSpan, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetColSpan(int32_t* aColSpan)
 {
   *aColSpan = ColSpan();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::SetRowSpan(int32_t aRowSpan)
 {
   ErrorResult rv;
   SetRowSpan(aRowSpan, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 HTMLTableCellElement::GetRowSpan(int32_t* aRowSpan)
 {
   *aRowSpan = RowSpan();
   return NS_OK;
 }
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -368,17 +368,17 @@ HTMLTextAreaElement::GetDefaultValue(nsA
   return NS_OK;
 }  
 
 NS_IMETHODIMP
 HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
 {
   ErrorResult error;
   SetDefaultValue(aDefaultValue, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError)
 {
   nsresult rv = nsContentUtils::SetNodeTextContent(this, aDefaultValue, true);
   if (NS_SUCCEEDED(rv) && !mValueChanged) {
     Reset();
@@ -627,17 +627,17 @@ NS_IMETHODIMP
 HTMLTextAreaElement::GetControllers(nsIControllers** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   ErrorResult error;
   *aResult = GetControllers(error);
   NS_IF_ADDREF(*aResult);
 
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 uint32_t
 HTMLTextAreaElement::GetTextLength()
 {
   nsAutoString val;
   GetValue(val);
   return val.Length();
@@ -654,17 +654,17 @@ HTMLTextAreaElement::GetTextLength(int32
 
 NS_IMETHODIMP
 HTMLTextAreaElement::GetSelectionStart(int32_t *aSelectionStart)
 {
   NS_ENSURE_ARG_POINTER(aSelectionStart);
 
   ErrorResult error;
   *aSelectionStart = GetSelectionStart(error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 uint32_t
 HTMLTextAreaElement::GetSelectionStart(ErrorResult& aError)
 {
   int32_t selStart, selEnd;
   nsresult rv = GetSelectionRange(&selStart, &selEnd);
 
@@ -677,17 +677,17 @@ HTMLTextAreaElement::GetSelectionStart(E
   return selStart;
 }
 
 NS_IMETHODIMP
 HTMLTextAreaElement::SetSelectionStart(int32_t aSelectionStart)
 {
   ErrorResult error;
   SetSelectionStart(aSelectionStart, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::SetSelectionStart(uint32_t aSelectionStart, ErrorResult& aError)
 {
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().mStart = aSelectionStart;
     return;
@@ -717,17 +717,17 @@ HTMLTextAreaElement::SetSelectionStart(u
 
 NS_IMETHODIMP
 HTMLTextAreaElement::GetSelectionEnd(int32_t *aSelectionEnd)
 {
   NS_ENSURE_ARG_POINTER(aSelectionEnd);
 
   ErrorResult error;
   *aSelectionEnd = GetSelectionEnd(error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 uint32_t
 HTMLTextAreaElement::GetSelectionEnd(ErrorResult& aError)
 {
   int32_t selStart, selEnd;
   nsresult rv = GetSelectionRange(&selStart, &selEnd);
 
@@ -740,17 +740,17 @@ HTMLTextAreaElement::GetSelectionEnd(Err
   return selEnd;
 }
 
 NS_IMETHODIMP
 HTMLTextAreaElement::SetSelectionEnd(int32_t aSelectionEnd)
 {
   ErrorResult error;
   SetSelectionEnd(aSelectionEnd, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::SetSelectionEnd(uint32_t aSelectionEnd, ErrorResult& aError)
 {
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().mEnd = aSelectionEnd;
     return;
@@ -805,17 +805,17 @@ DirectionToName(nsITextControlFrame::Sel
   }
 }
 
 nsresult
 HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
 {
   ErrorResult error;
   GetSelectionDirection(aDirection, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection, ErrorResult& aError)
 {
   nsresult rv = NS_ERROR_FAILURE;
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
   nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
@@ -836,17 +836,17 @@ HTMLTextAreaElement::GetSelectionDirecti
   }
 }
 
 NS_IMETHODIMP
 HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection)
 {
   ErrorResult error;
   SetSelectionDirection(aDirection, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError)
 {
   if (mState.IsSelectionCached()) {
     nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
     if (aDirection.EqualsLiteral("forward")) {
@@ -872,17 +872,17 @@ NS_IMETHODIMP
 HTMLTextAreaElement::SetSelectionRange(int32_t aSelectionStart,
                                        int32_t aSelectionEnd,
                                        const nsAString& aDirection)
 {
   ErrorResult error;
   Optional<nsAString> dir;
   dir = &aDirection;
   SetSelectionRange(aSelectionStart, aSelectionEnd, dir, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 void
 HTMLTextAreaElement::SetSelectionRange(uint32_t aSelectionStart,
                                        uint32_t aSelectionEnd,
                                        const Optional<nsAString>& aDirection,
                                        ErrorResult& aError)
 {
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -320,17 +320,17 @@ ImageDocument::GetImageRequest(ErrorResu
   return imageRequest.forget();
 }
 
 NS_IMETHODIMP
 ImageDocument::GetImageRequest(imgIRequest** aImageRequest)
 {
   ErrorResult rv;
   *aImageRequest = GetImageRequest(rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 ImageDocument::ShrinkToFit()
 {
   if (!mImageContent) {
     return;
   }
--- a/dom/html/TimeRanges.cpp
+++ b/dom/html/TimeRanges.cpp
@@ -42,17 +42,17 @@ TimeRanges::Start(uint32_t aIndex, Error
   return mRanges[aIndex].mStart;
 }
 
 NS_IMETHODIMP
 TimeRanges::Start(uint32_t aIndex, double* aTime)
 {
   ErrorResult rv;
   *aTime = Start(aIndex, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 double
 TimeRanges::End(uint32_t aIndex, ErrorResult& aRv)
 {
   if (aIndex >= mRanges.Length()) {
     aRv = NS_ERROR_DOM_INDEX_SIZE_ERR;
     return 0;
@@ -61,17 +61,17 @@ TimeRanges::End(uint32_t aIndex, ErrorRe
   return mRanges[aIndex].mEnd;
 }
 
 NS_IMETHODIMP
 TimeRanges::End(uint32_t aIndex, double* aTime)
 {
   ErrorResult rv;
   *aTime = End(aIndex, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 TimeRanges::Add(double aStart, double aEnd)
 {
   if (aStart > aEnd) {
     NS_WARNING("Can't add a range if the end is older that the start.");
     return;
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -148,17 +148,17 @@ public:
       return NS_OK;
     }
 
     // If something is focused in the same document, ignore autofocus.
     if (!fm->GetFocusedContent() ||
         fm->GetFocusedContent()->OwnerDoc() != document) {
       mozilla::ErrorResult rv;
       mElement->Focus(rv);
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     return NS_OK;
   }
 private:
   // NOTE: nsGenericHTMLFormElement is saved as a nsGenericHTMLElement
   // because AddRef/Release are ambiguous with nsGenericHTMLFormElement
   // and Focus() is declared (and defined) in nsGenericHTMLElement class.
@@ -426,17 +426,17 @@ nsGenericHTMLElement::GetOffsetRect(CSSI
 }
 
 NS_IMETHODIMP
 nsGenericHTMLElement::InsertAdjacentHTML(const nsAString& aPosition,
                                          const nsAString& aText)
 {
   ErrorResult rv;
   Element::InsertAdjacentHTML(aPosition, aText, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsGenericHTMLElement::Spellcheck()
 {
   // Has the state has been explicitly set?
   nsIContent* node;
   for (node = this; node; node = node->GetParent()) {
@@ -1854,22 +1854,22 @@ nsGenericHTMLElement::SetUndoScopeIntern
     }
   } else {
     nsDOMSlots* slots = GetExistingDOMSlots();
     if (slots && slots->mUndoManager) {
       // Clear transaction history and disconnect.
       ErrorResult rv;
       slots->mUndoManager->ClearRedo(rv);
       if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
       }
 
       slots->mUndoManager->ClearUndo(rv);
       if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
       }
 
       slots->mUndoManager->Disconnect();
       slots->mUndoManager = nullptr;
     }
   }
   return NS_OK;
 }
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -352,17 +352,17 @@ public:
     mozilla::dom::DOMString dir;
     GetDir(dir);
     dir.ToString(aDir);
     return NS_OK;
   }
   NS_IMETHOD SetDir(const nsAString& aDir) final override {
     mozilla::ErrorResult rv;
     SetDir(aDir, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetDOMClassName(nsAString& aClassName) final {
     GetHTMLAttr(nsGkAtoms::_class, aClassName);
     return NS_OK;
   }
   NS_IMETHOD SetDOMClassName(const nsAString& aClassName) final {
     SetClassName(aClassName);
     return NS_OK;
@@ -370,31 +370,31 @@ public:
   NS_IMETHOD GetDataset(nsISupports** aDataset) final override;
   NS_IMETHOD GetHidden(bool* aHidden) final override {
     *aHidden = Hidden();
     return NS_OK;
   }
   NS_IMETHOD SetHidden(bool aHidden) final override {
     mozilla::ErrorResult rv;
     SetHidden(aHidden, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD DOMBlur() final override {
     mozilla::ErrorResult rv;
     Blur(rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetItemScope(bool* aItemScope) final override {
     *aItemScope = ItemScope();
     return NS_OK;
   }
   NS_IMETHOD SetItemScope(bool aItemScope) final override {
     mozilla::ErrorResult rv;
     SetItemScope(aItemScope, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetItemType(nsIVariant** aType) final override {
     GetTokenList(nsGkAtoms::itemtype, aType);
     return NS_OK;
   }
   NS_IMETHOD SetItemType(nsIVariant* aType) final override {
     return SetTokenList(nsGkAtoms::itemtype, aType);
   }
@@ -402,17 +402,17 @@ public:
     nsString id;
     GetItemId(id);
     aId.Assign(aId);
     return NS_OK;
   }
   NS_IMETHOD SetItemId(const nsAString& aId) final override {
     mozilla::ErrorResult rv;
     SetItemId(aId, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetProperties(nsISupports** aReturn) final override;
   NS_IMETHOD GetItemValue(nsIVariant** aValue) final override;
   NS_IMETHOD SetItemValue(nsIVariant* aValue) final override;
   NS_IMETHOD GetItemRef(nsIVariant** aRef) final override {
     GetTokenList(nsGkAtoms::itemref, aRef);
     return NS_OK;
   }
@@ -430,68 +430,68 @@ public:
     nsString accessKey;
     GetAccessKey(accessKey);
     aAccessKey.Assign(accessKey);
     return NS_OK;
   }
   NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) final override {
     mozilla::ErrorResult rv;
     SetAccessKey(aAccessKey, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel)
     final override {
     nsString accessKeyLabel;
     GetAccessKeyLabel(accessKeyLabel);
     aAccessKeyLabel.Assign(accessKeyLabel);
     return NS_OK;
   }
   NS_IMETHOD SetDraggable(bool aDraggable) final override {
     mozilla::ErrorResult rv;
     SetDraggable(aDraggable, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetContentEditable(nsAString& aContentEditable)
     final override {
     nsString contentEditable;
     GetContentEditable(contentEditable);
     aContentEditable.Assign(contentEditable);
     return NS_OK;
   }
   NS_IMETHOD SetContentEditable(const nsAString& aContentEditable)
     final override {
     mozilla::ErrorResult rv;
     SetContentEditable(aContentEditable, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable)
     final override {
     *aIsContentEditable = IsContentEditable();
     return NS_OK;
   }
   NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu)
     final override;
   NS_IMETHOD GetSpellcheck(bool* aSpellcheck) final override {
     *aSpellcheck = Spellcheck();
     return NS_OK;
   }
   NS_IMETHOD SetSpellcheck(bool aSpellcheck) final override {
     mozilla::ErrorResult rv;
     SetSpellcheck(aSpellcheck, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) final override {
     mozilla::dom::Element::GetOuterHTML(aOuterHTML);
     return NS_OK;
   }
   NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) final override {
     mozilla::ErrorResult rv;
     mozilla::dom::Element::SetOuterHTML(aOuterHTML, rv);
-    return rv.ErrorCode();
-  }                                                                            \
+    return rv.StealNSResult();
+  }
   NS_IMETHOD InsertAdjacentHTML(const nsAString& position,
                                 const nsAString& text) final override;
   NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) final override {
     if (!_argc) {
       top = true;
     }
     mozilla::dom::Element::ScrollIntoView(top);
     return NS_OK;
@@ -527,35 +527,35 @@ public:
   }
   NS_IMETHOD GetTabIndex(int32_t* aTabIndex) final override {
     *aTabIndex = TabIndex();
     return NS_OK;
   }
   NS_IMETHOD SetTabIndex(int32_t aTabIndex) final override {
     mozilla::ErrorResult rv;
     SetTabIndex(aTabIndex, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD Focus() final override {
     mozilla::ErrorResult rv;
     Focus(rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
   NS_IMETHOD GetDraggable(bool* aDraggable) final override {
     *aDraggable = Draggable();
     return NS_OK;
   }
   NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) override {
     return mozilla::dom::Element::GetInnerHTML(aInnerHTML);
   }
   using mozilla::dom::Element::SetInnerHTML;
   NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) final override {
     mozilla::ErrorResult rv;
     SetInnerHTML(aInnerHTML, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   using nsGenericHTMLElementBase::GetOwnerDocument;
 
   virtual nsIDOMNode* AsDOMNode() override { return this; }
 
 public:
   // Implementation for nsIContent
@@ -1522,17 +1522,17 @@ protected:
     *aValue = GetUnsignedIntAttr(nsGkAtoms::_atom, _default);             \
     return NS_OK;                                                         \
   }                                                                       \
   NS_IMETHODIMP                                                           \
   _class::Set##_method(uint32_t aValue)                                   \
   {                                                                       \
     mozilla::ErrorResult rv;                                              \
     SetUnsignedIntAttr(nsGkAtoms::_atom, aValue, rv);                     \
-    return rv.ErrorCode();                                                \
+    return rv.StealNSResult();                                            \
   }
 
 /**
  * A macro to implement the getter and setter for a given unsigned integer
  * valued content property. The method uses GetUnsignedIntAttr and
  * SetUnsignedIntAttr methods. This macro is similar to NS_IMPL_UINT_ATTR except
  * that it throws an exception if the set value is null.
  */
@@ -1549,17 +1549,17 @@ protected:
   NS_IMETHODIMP                                                           \
   _class::Set##_method(uint32_t aValue)                                   \
   {                                                                       \
     if (aValue == 0) {                                                    \
       return NS_ERROR_DOM_INDEX_SIZE_ERR;                                 \
     }                                                                     \
     mozilla::ErrorResult rv;                                              \
     SetUnsignedIntAttr(nsGkAtoms::_atom, aValue, rv);                     \
-    return rv.ErrorCode();                                                \
+    return rv.StealNSResult();                                            \
   }
 
 /**
  * A macro to implement the getter and setter for a given content
  * property that needs to return a URI in string form.  The method
  * uses the generic GetAttr and SetAttr methods.  This macro is much
  * like the NS_IMPL_STRING_ATTR macro, except we make sure the URI is
  * absolute.
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -921,17 +921,17 @@ nsHTMLDocument::GetDomain(nsAString& aDo
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::SetDomain(const nsAString& aDomain)
 {
   ErrorResult rv;
   SetDomain(aDomain, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
 {
   if (mSandboxFlags & SANDBOXED_DOMAIN) {
     // We're sandboxed; disallow setting domain
     rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
@@ -1042,17 +1042,17 @@ nsHTMLDocument::GetBody(nsIDOMHTMLElemen
 NS_IMETHODIMP
 nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
 {
   nsCOMPtr<nsIContent> newBody = do_QueryInterface(aBody);
   MOZ_ASSERT(!newBody || newBody->IsHTMLElement(),
              "How could we be an nsIContent but not actually HTML here?");
   ErrorResult rv;
   SetBody(static_cast<nsGenericHTMLElement*>(newBody.get()), rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
 {
   Element* root = GetRootElement();
 
   // The body element must be either a body tag or a frameset tag. And we must
@@ -1221,17 +1221,17 @@ nsHTMLDocument::Scripts()
   return mScripts;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::GetCookie(nsAString& aCookie)
 {
   ErrorResult rv;
   GetCookie(aCookie, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<nsIChannel>
 nsHTMLDocument::CreateDummyChannelForCookies(nsIURI* aCodebaseURI)
 {
   // The cookie service reads the privacy status of the channel we pass to it in
   // order to determine which cookie database to query.  In some cases we don't
   // have a proper channel to hand it to the cookie service though.  This
@@ -1304,17 +1304,17 @@ nsHTMLDocument::GetCookie(nsAString& aCo
   }
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::SetCookie(const nsAString& aCookie)
 {
   ErrorResult rv;
   SetCookie(aCookie, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::SetCookie(const nsAString& aCookie, ErrorResult& rv)
 {
   if (mDisableCookieAccess) {
     return;
   }
@@ -1360,32 +1360,32 @@ nsHTMLDocument::Open(const nsAString& aC
                      JSContext* cx, uint8_t aOptionalArgCount,
                      nsISupports** aReturn)
 {
   // When called with 3 or more arguments, document.open() calls window.open().
   if (aOptionalArgCount > 2) {
     ErrorResult rv;
     *aReturn = Open(cx, aContentTypeOrUrl, aReplaceOrName, aFeatures,
                     false, rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   nsString type;
   if (aOptionalArgCount > 0) {
     type = aContentTypeOrUrl;
   } else {
     type.AssignLiteral("text/html");
   }
   nsString replace;
   if (aOptionalArgCount > 1) {
     replace = aReplaceOrName;
   }
   ErrorResult rv;
   *aReturn = Open(cx, type, replace, rv).take();
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 already_AddRefed<nsIDOMWindow>
 nsHTMLDocument::Open(JSContext* /* unused */,
                      const nsAString& aURL,
                      const nsAString& aName,
                      const nsAString& aFeatures,
                      bool aReplace,
@@ -1749,17 +1749,17 @@ nsHTMLDocument::Clear()
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::Close()
 {
   ErrorResult rv;
   Close(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::Close(ErrorResult& rv)
 {
   if (!IsHTMLDocument()) {
     // No calling document.close() on XHTML!
 
@@ -2223,17 +2223,17 @@ nsHTMLDocument::Embeds()
   return mEmbeds;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::GetSelection(nsISelection** aReturn)
 {
   ErrorResult rv;
   NS_IF_ADDREF(*aReturn = GetSelection(rv));
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 Selection*
 nsHTMLDocument::GetSelection(ErrorResult& aRv)
 {
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetScopeObject());
   if (!window) {
     return nullptr;
@@ -2952,17 +2952,17 @@ nsHTMLDocument::EditingStateChanged()
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
 {
   ErrorResult rv;
   SetDesignMode(aDesignMode, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::SetDesignMode(const nsAString& aDesignMode, ErrorResult& rv)
 {
   if (!nsContentUtils::SubjectPrincipal()->Subsumes(NodePrincipal())) {
     rv.Throw(NS_ERROR_DOM_PROP_ACCESS_DENIED);
     return;
@@ -3233,17 +3233,17 @@ ConvertToMidasInternalCommand(const nsAS
 NS_IMETHODIMP
 nsHTMLDocument::ExecCommand(const nsAString& commandID,
                             bool doShowUI,
                             const nsAString& value,
                             bool* _retval)
 {
   ErrorResult rv;
   *_retval = ExecCommand(commandID, doShowUI, value, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsHTMLDocument::ExecCommand(const nsAString& commandID,
                             bool doShowUI,
                             const nsAString& value,
                             ErrorResult& rv)
 {
@@ -3344,17 +3344,17 @@ nsHTMLDocument::ExecCommand(const nsAStr
 
 /* boolean queryCommandEnabled(in DOMString commandID); */
 NS_IMETHODIMP
 nsHTMLDocument::QueryCommandEnabled(const nsAString& commandID,
                                     bool* _retval)
 {
   ErrorResult rv;
   *_retval = QueryCommandEnabled(commandID, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsHTMLDocument::QueryCommandEnabled(const nsAString& commandID, ErrorResult& rv)
 {
   nsAutoCString cmdToDispatch;
   if (!ConvertToMidasInternalCommand(commandID, cmdToDispatch)) {
     return false;
@@ -3387,17 +3387,17 @@ nsHTMLDocument::QueryCommandEnabled(cons
 
 /* boolean queryCommandIndeterm (in DOMString commandID); */
 NS_IMETHODIMP
 nsHTMLDocument::QueryCommandIndeterm(const nsAString & commandID,
                                      bool *_retval)
 {
   ErrorResult rv;
   *_retval = QueryCommandIndeterm(commandID, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsHTMLDocument::QueryCommandIndeterm(const nsAString& commandID, ErrorResult& rv)
 {
   nsAutoCString cmdToDispatch;
   if (!ConvertToMidasInternalCommand(commandID, cmdToDispatch)) {
     return false;
@@ -3445,17 +3445,17 @@ nsHTMLDocument::QueryCommandIndeterm(con
 }
 
 /* boolean queryCommandState(in DOMString commandID); */
 NS_IMETHODIMP
 nsHTMLDocument::QueryCommandState(const nsAString & commandID, bool *_retval)
 {
   ErrorResult rv;
   *_retval = QueryCommandState(commandID, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 nsHTMLDocument::QueryCommandState(const nsAString& commandID, ErrorResult& rv)
 {
   nsAutoCString cmdToDispatch, paramToCheck;
   bool dummy, dummy2;
   if (!ConvertToMidasInternalCommand(commandID, commandID,
@@ -3548,17 +3548,17 @@ nsHTMLDocument::QueryCommandSupported(co
 
 /* DOMString queryCommandValue(in DOMString commandID); */
 NS_IMETHODIMP
 nsHTMLDocument::QueryCommandValue(const nsAString & commandID,
                                   nsAString &_retval)
 {
   ErrorResult rv;
   QueryCommandValue(commandID, _retval, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 nsHTMLDocument::QueryCommandValue(const nsAString& commandID,
                                   nsAString& aValue,
                                   ErrorResult& rv)
 {
   aValue.Truncate();
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -154,22 +154,22 @@ struct MOZ_STACK_CLASS MutableFileData f
 };
 
 struct MOZ_STACK_CLASS BlobOrFileData final
 {
   uint32_t tag;
   uint64_t size;
   nsString type;
   nsString name;
-  uint64_t lastModifiedDate;
+  int64_t lastModifiedDate;
 
   BlobOrFileData()
     : tag(0)
     , size(0)
-    , lastModifiedDate(UINT64_MAX)
+    , lastModifiedDate(INT64_MAX)
   {
     MOZ_COUNT_CTOR(BlobOrFileData);
   }
 
   ~BlobOrFileData()
   {
     MOZ_COUNT_DTOR(BlobOrFileData);
   }
@@ -328,17 +328,17 @@ StructuredCloneWriteCallback(JSContext* 
                               index) ||
           !JS_WriteBytes(aWriter, &size, sizeof(size)) ||
           !JS_WriteBytes(aWriter, &convTypeLength, sizeof(convTypeLength)) ||
           !JS_WriteBytes(aWriter, convType.get(), convType.Length())) {
         return false;
       }
 
       if (blob->IsFile()) {
-        uint64_t lastModifiedDate;
+        int64_t lastModifiedDate;
         MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
           blob->GetMozLastModifiedDate(&lastModifiedDate)));
 
         lastModifiedDate = NativeEndian::swapToLittleEndian(lastModifiedDate);
 
         nsString name;
         MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blob->GetName(name)));
 
@@ -536,19 +536,19 @@ ReadBlobOrFile(JSStructuredCloneReader* 
   // Blobs are done.
   if (aTag == SCTAG_DOM_BLOB) {
     return true;
   }
 
   MOZ_ASSERT(aTag == SCTAG_DOM_FILE ||
              aTag == SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE);
 
-  uint64_t lastModifiedDate;
+  int64_t lastModifiedDate;
   if (aTag == SCTAG_DOM_FILE_WITHOUT_LASTMODIFIEDDATE) {
-    lastModifiedDate = UINT64_MAX;
+    lastModifiedDate = INT64_MAX;
   } else {
     if (NS_WARN_IF(!JS_ReadBytes(aReader, &lastModifiedDate,
                                 sizeof(lastModifiedDate)))) {
       return false;
     }
     lastModifiedDate = NativeEndian::swapFromLittleEndian(lastModifiedDate);
   }
 
--- a/dom/inputport/InputPortManager.cpp
+++ b/dom/inputport/InputPortManager.cpp
@@ -181,22 +181,22 @@ InputPortManager::NotifySuccess(nsIArray
       break;
     }
     MOZ_ASSERT(port);
 
     ports.AppendElement(port);
   }
 
   if (NS_WARN_IF(erv.Failed())) {
-    return erv.ErrorCode();
+    return erv.StealNSResult();
   }
 
   erv = SetInputPorts(ports);
 
-  return erv.ErrorCode();
+  return erv.StealNSResult();
 }
 
 NS_IMETHODIMP
 InputPortManager::NotifyError(uint16_t aErrorCode)
 {
   switch (aErrorCode) {
   case nsIInputPortServiceCallback::INPUTPORT_ERROR_FAILURE:
   case nsIInputPortServiceCallback::INPUTPORT_ERROR_INVALID_ARG:
--- a/dom/interfaces/base/nsIServiceWorkerManager.idl
+++ b/dom/interfaces/base/nsIServiceWorkerManager.idl
@@ -28,17 +28,17 @@ interface nsIServiceWorkerInfo : nsISupp
   readonly attribute DOMString scope;
   readonly attribute DOMString scriptSpec;
   readonly attribute DOMString currentWorkerURL;
 
   readonly attribute DOMString activeCacheName;
   readonly attribute DOMString waitingCacheName;
 };
 
-[scriptable, builtinclass, uuid(ff6e13ae-ae34-4941-a81e-a82f3e0e7b6b)]
+[scriptable, builtinclass, uuid(ff13ee00-5485-4551-af6f-1ab6de843365)]
 interface nsIServiceWorkerManager : nsISupports
 {
   /**
    * Registers a ServiceWorker with script loaded from `aScriptURI` to act as
    * the ServiceWorker for aScope.  Requires a valid entry settings object on
    * the stack. This means you must call this from content code 'within'
    * a window.
    *
@@ -114,16 +114,16 @@ interface nsIServiceWorkerManager : nsIS
   // Testing
   DOMString getScopeForUrl(in DOMString path);
 
   // This is meant to be used only by about:serviceworkers. It returns an array
   // of nsIServiceWorkerInfo.
   nsIArray getAllRegistrations();
 
   void sendPushEvent(in ACString scope, in DOMString data);
-  void sendPushSubscriptionChangedEvent(in ACString scope);
+  void sendPushSubscriptionChangeEvent(in ACString scope);
 
   void updateAllRegistrations();
 };
 
 %{ C++
 #define SERVICEWORKERMANAGER_CONTRACTID "@mozilla.org/serviceworkers/manager;1"
 %}
--- a/dom/ipc/Blob.cpp
+++ b/dom/ipc/Blob.cpp
@@ -662,17 +662,17 @@ public:
   explicit EmptyBlobImpl(const nsAString& aContentType)
     : FileImplBase(aContentType, 0)
   {
     mImmutable = true;
   }
 
   EmptyBlobImpl(const nsAString& aName,
                 const nsAString& aContentType,
-                uint64_t aLastModifiedDate)
+                int64_t aLastModifiedDate)
     : FileImplBase(aName, aContentType, 0, aLastModifiedDate)
   {
     mImmutable = true;
   }
 
 private:
   virtual already_AddRefed<FileImpl>
   CreateSlice(uint64_t /* aStart */,
@@ -723,23 +723,23 @@ public:
     MOZ_ASSERT(aInputStream);
 
     mImmutable = true;
   }
 
   SameProcessInputStreamBlobImpl(const nsAString& aName,
                                  const nsAString& aContentType,
                                  uint64_t aLength,
-                                 uint64_t aLastModifiedDate,
+                                 int64_t aLastModifiedDate,
                                  nsIInputStream* aInputStream)
     : FileImplBase(aName, aContentType, aLength, aLastModifiedDate)
     , mInputStream(aInputStream)
   {
     MOZ_ASSERT(aLength != UINT64_MAX);
-    MOZ_ASSERT(aLastModifiedDate != UINT64_MAX);
+    MOZ_ASSERT(aLastModifiedDate != INT64_MAX);
     MOZ_ASSERT(aInputStream);
 
     mImmutable = true;
   }
 
 private:
   virtual already_AddRefed<FileImpl>
   CreateSlice(uint64_t /* aStart */,
@@ -761,17 +761,17 @@ private:
   }
 };
 
 struct MOZ_STACK_CLASS CreateBlobImplMetadata final
 {
   nsString mContentType;
   nsString mName;
   uint64_t mLength;
-  uint64_t mLastModifiedDate;
+  int64_t mLastModifiedDate;
   bool mHasRecursed;
   const bool mIsSameProcessActor;
 
   explicit CreateBlobImplMetadata(bool aIsSameProcessActor)
     : mLength(0)
     , mLastModifiedDate(0)
     , mHasRecursed(false)
     , mIsSameProcessActor(aIsSameProcessActor)
@@ -1035,17 +1035,17 @@ CreateBlobImpl(const ParentBlobConstruct
     const FileBlobConstructorParams& params =
       aParams.blobParams().get_FileBlobConstructorParams();
 
     if (NS_WARN_IF(params.length() == UINT64_MAX)) {
       ASSERT_UNLESS_FUZZING();
       return nullptr;
     }
 
-    if (NS_WARN_IF(params.modDate() == UINT64_MAX)) {
+    if (NS_WARN_IF(params.modDate() == INT64_MAX)) {
       ASSERT_UNLESS_FUZZING();
       return nullptr;
     }
 
     metadata.mContentType = params.contentType();
     metadata.mName = params.name();
     metadata.mLength = params.length();
     metadata.mLastModifiedDate = params.modDate();
@@ -1337,17 +1337,17 @@ RemoteInputStream::Available(uint64_t* a
 
   // Otherwise fake it...
   NS_WARNING("Available() called before real stream has been delivered, "
               "guessing the amount of data available!");
 
   ErrorResult error;
   *aAvailable = mBlobImpl->GetSize(error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 RemoteInputStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aResult)
 {
@@ -1844,30 +1844,30 @@ protected:
   const bool mIsSlice;
 
 public:
   // For File.
   RemoteBlobImpl(BlobChild* aActor,
                  const nsAString& aName,
                  const nsAString& aContentType,
                  uint64_t aLength,
-                 uint64_t aModDate);
+                 int64_t aModDate);
 
   // For Blob.
   RemoteBlobImpl(BlobChild* aActor,
                  const nsAString& aContentType,
                  uint64_t aLength);
 
   // For same-process blobs.
   RemoteBlobImpl(BlobChild* aActor,
                  FileImpl* aSameProcessBlobImpl,
                  const nsAString& aName,
                  const nsAString& aContentType,
                  uint64_t aLength,
-                 uint64_t aModDate);
+                 int64_t aModDate);
 
   // For same-process blobs.
   RemoteBlobImpl(BlobChild* aActor,
                  FileImpl* aSameProcessBlobImpl,
                  const nsAString& aContentType,
                  uint64_t aLength);
 
   // For mystery blobs.
@@ -2115,17 +2115,17 @@ public:
 
   virtual nsresult
   SetMutable(bool aMutable) override;
 
   virtual void
   SetLazyData(const nsAString& aName,
               const nsAString& aContentType,
               uint64_t aLength,
-              uint64_t aLastModifiedDate) override;
+              int64_t aLastModifiedDate) override;
 
   virtual bool
   IsMemoryFile() const override;
 
   virtual bool
   IsSizeUnknown() const override;
 
   virtual bool
@@ -2158,17 +2158,17 @@ private:
  * BlobChild::RemoteBlobImpl
  ******************************************************************************/
 
 BlobChild::
 RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
                                const nsAString& aName,
                                const nsAString& aContentType,
                                uint64_t aLength,
-                               uint64_t aModDate)
+                               int64_t aModDate)
   : FileImplBase(aName, aContentType, aLength, aModDate)
   , mIsSlice(false)
 {
   CommonInit(aActor);
 }
 
 BlobChild::
 RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
@@ -2181,17 +2181,17 @@ RemoteBlobImpl::RemoteBlobImpl(BlobChild
 }
 
 BlobChild::
 RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
                                FileImpl* aSameProcessBlobImpl,
                                const nsAString& aName,
                                const nsAString& aContentType,
                                uint64_t aLength,
-                               uint64_t aModDate)
+                               int64_t aModDate)
   : FileImplBase(aName, aContentType, aLength, aModDate)
   , mSameProcessFileImpl(aSameProcessBlobImpl)
   , mIsSlice(false)
 {
   MOZ_ASSERT(aSameProcessBlobImpl);
   MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
 
   CommonInit(aActor);
@@ -2209,17 +2209,17 @@ RemoteBlobImpl::RemoteBlobImpl(BlobChild
   MOZ_ASSERT(aSameProcessBlobImpl);
   MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
 
   CommonInit(aActor);
 }
 
 BlobChild::
 RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor)
-  : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
+  : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, INT64_MAX)
   , mIsSlice(false)
 {
   CommonInit(aActor);
 }
 
 BlobChild::
 RemoteBlobImpl::RemoteBlobImpl(const nsAString& aContentType, uint64_t aLength)
   : FileImplBase(aContentType, aLength)
@@ -2861,17 +2861,17 @@ RemoteBlobImpl::SetMutable(bool aMutable
   return mBlobImpl->SetMutable(aMutable);
 }
 
 void
 BlobParent::
 RemoteBlobImpl::SetLazyData(const nsAString& aName,
                             const nsAString& aContentType,
                             uint64_t aLength,
-                            uint64_t aLastModifiedDate)
+                            int64_t aLastModifiedDate)
 {
   MOZ_CRASH("This should never be called!");
 }
 
 bool
 BlobParent::
 RemoteBlobImpl::IsMemoryFile() const
 {
@@ -3081,17 +3081,17 @@ BlobChild::CommonInit(BlobChild* aOther,
   uint64_t length = otherImpl->GetSize(rv);
   MOZ_ASSERT(!rv.Failed());
 
   nsRefPtr<RemoteBlobImpl> remoteBlob;
   if (otherImpl->IsFile()) {
     nsString name;
     otherImpl->GetName(name);
 
-    uint64_t modDate = otherImpl->GetLastModified(rv);
+    int64_t modDate = otherImpl->GetLastModified(rv);
     MOZ_ASSERT(!rv.Failed());
 
     remoteBlob = new RemoteBlobImpl(this, name, contentType, length, modDate);
   } else {
     remoteBlob = new RemoteBlobImpl(this, contentType, length);
   }
 
   CommonInit(aOther->ParentID(), remoteBlob);
@@ -3151,17 +3151,17 @@ BlobChild::CommonInit(const ChildBlobCon
 
       nsString contentType;
       blobImpl->GetType(contentType);
 
       if (blobImpl->IsFile()) {
         nsString name;
         blobImpl->GetName(name);
 
-        uint64_t lastModifiedDate = blobImpl->GetLastModified(rv);
+        int64_t lastModifiedDate = blobImpl->GetLastModified(rv);
         MOZ_ASSERT(!rv.Failed());
 
         remoteBlob =
           new RemoteBlobImpl(this,
                              blobImpl,
                              name,
                              contentType,
                              size,
@@ -3340,17 +3340,17 @@ BlobChild::GetOrCreateFromImpl(ChildMana
     ErrorResult rv;
     uint64_t length = aBlobImpl->GetSize(rv);
     MOZ_ASSERT(!rv.Failed());
 
     if (aBlobImpl->IsFile()) {
       nsString name;
       aBlobImpl->GetName(name);
 
-      uint64_t modDate = aBlobImpl->GetLastModified(rv);
+      int64_t modDate = aBlobImpl->GetLastModified(rv);
       MOZ_ASSERT(!rv.Failed());
 
       blobParams =
         FileBlobConstructorParams(name, contentType, length, modDate, blobData);
     } else {
       blobParams = NormalBlobConstructorParams(contentType, length, blobData);
     }
   }
@@ -3517,22 +3517,22 @@ BlobChild::GetBlobImpl()
 
   return blobImpl.forget();
 }
 
 bool
 BlobChild::SetMysteryBlobInfo(const nsString& aName,
                               const nsString& aContentType,
                               uint64_t aLength,
-                              uint64_t aLastModifiedDate)
+                              int64_t aLastModifiedDate)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mBlobImpl);
   MOZ_ASSERT(mRemoteBlobImpl);
-  MOZ_ASSERT(aLastModifiedDate != UINT64_MAX);
+  MOZ_ASSERT(aLastModifiedDate != INT64_MAX);
 
   mBlobImpl->SetLazyData(aName, aContentType, aLength, aLastModifiedDate);
 
   FileBlobConstructorParams params(aName,
                                    aContentType,
                                    aLength,
                                    aLastModifiedDate,
                                    void_t() /* optionalBlobData */);
@@ -3544,17 +3544,17 @@ BlobChild::SetMysteryBlobInfo(const nsSt
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mBlobImpl);
   MOZ_ASSERT(mRemoteBlobImpl);
 
   nsString voidString;
   voidString.SetIsVoid(true);
 
-  mBlobImpl->SetLazyData(voidString, aContentType, aLength, UINT64_MAX);
+  mBlobImpl->SetLazyData(voidString, aContentType, aLength, INT64_MAX);
 
   NormalBlobConstructorParams params(aContentType,
                                      aLength,
                                      void_t() /* optionalBlobData */);
   return SendResolveMystery(params);
 }
 
 void
@@ -3882,17 +3882,17 @@ BlobParent::GetOrCreateFromImpl(ParentMa
       ErrorResult rv;
       uint64_t length = aBlobImpl->GetSize(rv);
       MOZ_ASSERT(!rv.Failed());
 
       if (aBlobImpl->IsFile()) {
         nsString name;
         aBlobImpl->GetName(name);
 
-        uint64_t modDate = aBlobImpl->GetLastModified(rv);
+        int64_t modDate = aBlobImpl->GetLastModified(rv);
         MOZ_ASSERT(!rv.Failed());
 
         blobParams =
           FileBlobConstructorParams(name, contentType, length, modDate, void_t());
       } else {
         blobParams = NormalBlobConstructorParams(contentType, length, void_t());
       }
     }
@@ -4364,34 +4364,34 @@ BlobParent::RecvResolveMystery(const Res
       }
 
       nsString voidString;
       voidString.SetIsVoid(true);
 
       mBlobImpl->SetLazyData(voidString,
                              params.contentType(),
                              params.length(),
-                             UINT64_MAX);
+                             INT64_MAX);
       return true;
     }
 
     case ResolveMysteryParams::TFileBlobConstructorParams: {
       const FileBlobConstructorParams& params =
         aParams.get_FileBlobConstructorParams();
       if (NS_WARN_IF(params.name().IsVoid())) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
 
       if (NS_WARN_IF(params.length() == UINT64_MAX)) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
 
-      if (NS_WARN_IF(params.modDate() == UINT64_MAX)) {
+      if (NS_WARN_IF(params.modDate() == INT64_MAX)) {
         ASSERT_UNLESS_FUZZING();
         return false;
       }
 
       mBlobImpl->SetLazyData(params.name(),
                              params.contentType(),
                              params.length(),
                              params.modDate());
--- a/dom/ipc/BlobChild.h
+++ b/dom/ipc/BlobChild.h
@@ -107,17 +107,17 @@ public:
   already_AddRefed<FileImpl>
   GetBlobImpl();
 
   // Use this for files.
   bool
   SetMysteryBlobInfo(const nsString& aName,
                      const nsString& aContentType,
                      uint64_t aLength,
-                     uint64_t aLastModifiedDate);
+                     int64_t aLastModifiedDate);
 
   // Use this for non-file blobs.
   bool
   SetMysteryBlobInfo(const nsString& aContentType, uint64_t aLength);
 
   void
   AssertIsOnOwningThread() const
 #ifdef DEBUG
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -61,17 +61,17 @@ struct NormalBlobConstructorParams
   OptionalBlobData optionalBlobData;
 };
 
 struct FileBlobConstructorParams
 {
   nsString name;
   nsString contentType;
   uint64_t length;
-  uint64_t modDate;
+  int64_t modDate;
 
   // This must be of type BlobData in a child->parent message, and will always
   // be of type void_t in a parent->child message.
   OptionalBlobData optionalBlobData;
 };
 
 struct SlicedBlobConstructorParams
 {
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -345,27 +345,17 @@ IsDirectShowSupportedType(const nsACStri
 }
 #endif
 
 #ifdef MOZ_FMP4
 static bool
 IsMP4SupportedType(const nsACString& aType,
                    const nsAString& aCodecs = EmptyString())
 {
-// Currently on B2G, FMP4 is only working for MSE playback.
-// For other normal MP4, it still uses current omx decoder.
-// Bug 1061034 is a follow-up bug to enable all MP4s with MOZ_FMP4
-#ifdef MOZ_OMX_DECODER
-  // Use MP4Decoder when blank-decoder is enabled so that we can run EME
-  // mochitests on B2G platforms. This will be removed once bug 1146729 is
-  // fixed when we don't need blank-decoder to play mp4 on B2G.
-  if (!Preferences::GetBool("media.fragmented-mp4.use-blank-decoder", false)) {
-    return false;
-  }
-#endif
+  // MP4Decoder/Reader is currently used for MSE and mp4 files local playback.
   bool haveAAC, haveMP3, haveH264;
   return Preferences::GetBool("media.fragmented-mp4.exposed", false) &&
          MP4Decoder::CanHandleMediaType(aType, aCodecs, haveAAC, haveH264, haveMP3);
 }
 #endif
 
 #ifdef MOZ_APPLEMEDIA
 static const char * const gAppleMP3Types[] = {
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -210,17 +210,21 @@ IsAndroidAvailable()
   // We need android.media.MediaCodec which exists in API level 16 and higher.
   return AndroidBridge::Bridge()->GetAPIVersion() >= 16;
 #endif
 }
 
 static bool
 IsGonkMP4DecoderAvailable()
 {
+#ifndef MOZ_GONK_MEDIACODEC
+  return false;
+#else
   return Preferences::GetBool("media.fragmented-mp4.gonk.enabled", false);
+#endif
 }
 
 static bool
 IsGMPDecoderAvailable()
 {
   return Preferences::GetBool("media.fragmented-mp4.gmp.enabled", false);
 }
 
--- a/dom/media/webaudio/AudioProcessingEvent.cpp
+++ b/dom/media/webaudio/AudioProcessingEvent.cpp
@@ -50,15 +50,15 @@ AudioProcessingEvent::LazilyCreateBuffer
     return nullptr;
   }
   JSContext* cx = jsapi.cx();
 
   nsRefPtr<AudioBuffer> buffer =
     AudioBuffer::Create(mNode->Context(), aNumberOfChannels,
                         mNode->BufferSize(),
                         mNode->Context()->SampleRate(), cx, aRv);
-  MOZ_ASSERT(buffer || aRv.ErrorCode() == NS_ERROR_OUT_OF_MEMORY);
+  MOZ_ASSERT(buffer || aRv.ErrorCodeIs(NS_ERROR_OUT_OF_MEMORY));
   return buffer.forget();
 }
 
 }
 }
 
--- a/dom/media/webaudio/ScriptProcessorNode.cpp
+++ b/dom/media/webaudio/ScriptProcessorNode.cpp
@@ -49,18 +49,18 @@ private:
 
       return amount;
     }
 
     Mutex& Lock() const { return const_cast<OutputQueue*>(this)->mMutex; }
 
     size_t ReadyToConsume() const
     {
+      // Accessed on both main thread and media graph thread.
       mMutex.AssertCurrentThreadOwns();
-      MOZ_ASSERT(!NS_IsMainThread());
       return mBufferList.size();
     }
 
     // Produce one buffer
     AudioChunk& Produce()
     {
       mMutex.AssertCurrentThreadOwns();
       MOZ_ASSERT(NS_IsMainThread());
@@ -125,44 +125,44 @@ public:
   {
     MOZ_ASSERT(NS_IsMainThread());
 
     TimeStamp now = TimeStamp::Now();
 
     if (mLastEventTime.IsNull()) {
       mLastEventTime = now;
     } else {
-      // When the main thread is blocked, and all the event are processed in a
-      // burst after the main thread unblocks, the |(now - mLastEventTime)|
-      // interval will be very short. |latency - bufferDuration| will be
-      // negative, effectively moving back mLatency to a smaller and smaller
-      // value, until it crosses zero, at which point we stop dropping buffers
-      // and resume normal operation. This does not work if at the same time,
-      // the MSG thread was also slowed down, so if the latency on the MSG
-      // thread is normal, and we are still dropping buffers, and mLatency is
-      // still more than twice the duration of a buffer, we reset it and stop
-      // dropping buffers.
+      // When main thread blocking has built up enough so
+      // |mLatency > MAX_LATENCY_S|, frame dropping starts. It continues until
+      // the output buffer is completely empty, at which point the accumulated
+      // latency is also reset to 0.
+      // It could happen that the output queue becomes empty before the input
+      // node has fully caught up. In this case there will be events where
+      // |(now - mLastEventTime)| is very short, making mLatency negative.
+      // As this happens and the size of |mLatency| becomes greater than
+      // MAX_LATENCY_S, frame dropping starts again to maintain an as short
+      // output queue as possible.
       float latency = (now - mLastEventTime).ToSeconds();
       float bufferDuration = aBufferSize / mSampleRate;
       mLatency += latency - bufferDuration;
       mLastEventTime = now;
-      if (mLatency > MAX_LATENCY_S ||
-          (mDroppingBuffers && mLatency > 0.0 &&
-           fabs(latency - bufferDuration) < bufferDuration)) {
+      if (fabs(mLatency) > MAX_LATENCY_S) {
         mDroppingBuffers = true;
-        return;
-      } else {
-        if (mDroppingBuffers) {
-          mLatency = 0;
-        }
-        mDroppingBuffers = false;
       }
     }
 
     MutexAutoLock lock(mOutputQueue.Lock());
+    if (mDroppingBuffers) {
+      if (mOutputQueue.ReadyToConsume()) {
+        return;
+      }
+      mDroppingBuffers = false;
+      mLatency = 0;
+    }
+
     for (uint32_t offset = 0; offset < aBufferSize; offset += WEBAUDIO_BLOCK_SIZE) {
       AudioChunk& chunk = mOutputQueue.Produce();
       if (aBuffer) {
         chunk.mDuration = WEBAUDIO_BLOCK_SIZE;
         chunk.mBuffer = aBuffer;
         chunk.mChannelData.SetLength(aBuffer->GetChannels());
         for (uint32_t i = 0; i < aBuffer->GetChannels(); ++i) {
           chunk.mChannelData[i] = aBuffer->GetData(i) + offset;
--- a/dom/mobilemessage/MmsMessage.cpp
+++ b/dom/mobilemessage/MmsMessage.cpp
@@ -385,17 +385,17 @@ MmsMessage::GetData(ContentParent* aPare
     mma.id().Assign(element.id);
     mma.location().Assign(element.location);
 
     // This is a workaround. Sometimes the blob we get from the database
     // doesn't have a valid last modified date, making the ContentParent
     // send a "Mystery Blob" to the ContentChild. Attempting to get the
     // last modified date of blob can force that value to be initialized.
     if (element.content->IsDateUnknown()) {
-      uint64_t date;
+      int64_t date;
       if (NS_FAILED(element.content->GetMozLastModifiedDate(&date))) {
         NS_WARNING("Failed to get last modified date!");
       }
     }
 
     mma.contentParent() = aParent->GetOrCreateActorForBlob(element.content);
     if (!mma.contentParent()) {
       return false;
--- a/dom/network/UDPSocket.cpp
+++ b/dom/network/UDPSocket.cpp
@@ -287,17 +287,17 @@ UDPSocket::DoPendingMcastCommand()
       }
       case MulticastCommand::Leave: {
         LeaveMulticastGroup(command.mAddress, rv);
         break;
       }
     }
 
     if (NS_WARN_IF(rv.Failed())) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
   }
 
   mPendingMcastCommands.Clear();
   return NS_OK;
 }
 
 bool
@@ -522,22 +522,22 @@ UDPSocket::Init(const nsString& aLocalAd
   mAddressReuse = aAddressReuse;
   mLoopback = aLoopback;
 
   ErrorResult rv;
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
 
   mOpened = Promise::Create(global, rv);
   if (NS_WARN_IF(rv.Failed())) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   mClosed = Promise::Create(global, rv);
   if (NS_WARN_IF(rv.Failed())) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   class OpenSocketRunnable final : public nsRunnable
   {
   public:
     explicit OpenSocketRunnable(UDPSocket* aSocket) : mSocket(aSocket)
     { }
 
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -78,17 +78,17 @@ public:
     nsRefPtr<Notification> notification;
     notification = Notification::CreateInternal(mWindow,
                                                 aID,
                                                 aTitle,
                                                 options);
     ErrorResult rv;
     notification->InitFromBase64(aCx, aData, rv);
     if (rv.Failed()) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     notification->SetStoredState(true);
 
     JSAutoCompartment ac(aCx, mGlobal);
     JS::Rooted<JSObject*> element(aCx, notification->WrapObject(aCx, JS::NullPtr()));
     NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
 
@@ -333,17 +333,17 @@ NotificationPermissionRequest::DispatchC
   return NS_DispatchToMainThread(callbackRunnable);
 }
 
 nsresult
 NotificationPermissionRequest::CallCallback()
 {
   ErrorResult rv;
   mCallback->Call(mPermission, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 NotificationPermissionRequest::GetTypes(nsIArray** aTypes)
 {
   nsTArray<nsString> emptyOptions;
   return nsContentPermissionUtils::CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
 							 NS_LITERAL_CSTRING("unused"),
--- a/dom/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/offline/nsDOMOfflineResourceList.cpp
@@ -219,17 +219,17 @@ nsDOMOfflineResourceList::GetMozItems(Er
 }
 
 NS_IMETHODIMP
 nsDOMOfflineResourceList::GetMozItems(nsISupports** aItems)
 {
   ErrorResult rv;
   nsRefPtr<DOMStringList> items = GetMozItems(rv);
   items.forget(aItems);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 nsDOMOfflineResourceList::MozHasItem(const nsAString& aURI, bool* aExists)
 {
   if (IS_CHILD_PROCESS()) 
     return NS_ERROR_NOT_IMPLEMENTED;
 
--- a/dom/power/PowerManagerService.cpp
+++ b/dom/power/PowerManagerService.cpp
@@ -224,17 +224,17 @@ PowerManagerService::NewWakeLock(const n
 NS_IMETHODIMP
 PowerManagerService::NewWakeLock(const nsAString &aTopic,
                                  nsIDOMWindow *aWindow,
                                  nsISupports **aWakeLock)
 {
   mozilla::ErrorResult rv;
   nsRefPtr<WakeLock> wakelock = NewWakeLock(aTopic, aWindow, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   nsCOMPtr<nsIDOMEventListener> eventListener = wakelock.get();
   eventListener.forget(aWakeLock);
   return NS_OK;
 }
 
 already_AddRefed<WakeLock>
--- a/dom/push/PushService.jsm
+++ b/dom/push/PushService.jsm
@@ -1371,17 +1371,16 @@ this.PushService = {
         let globalMM = Cc['@mozilla.org/globalmessagemanager;1'].getService(Ci.nsIMessageListenerManager);
         for (let scope of scopes) {
           // Notify XPCOM observers.
           Services.obs.notifyObservers(
             null,
             "push-subscription-change",
             scope
           );
-          // TODO -- test needed.  E10s support needed.
           globalMM.broadcastAsyncMessage('pushsubscriptionchanged', scope);
         }
         resolve();
       }, reject);
     });
   },
 
   _notifyApp: function(aPushRecord) {
--- a/dom/push/PushServiceChildPreload.js
+++ b/dom/push/PushServiceChildPreload.js
@@ -8,11 +8,11 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "swm",
                                    "@mozilla.org/serviceworkers/manager;1",
                                    "nsIServiceWorkerManager");
 
 addMessageListener("push", function (aMessage) {
   swm.sendPushEvent(aMessage.data.scope, aMessage.data.payload);
 });
 
-addMessageListener("pushsubscriptionchanged", function (aMessage) {
-  swm.sendPushSubscriptionChangedEvent(aMessage.data);
-});
\ No newline at end of file
+addMessageListener("pushsubscriptionchange", function (aMessage) {
+  swm.sendPushSubscriptionChangeEvent(aMessage.data);
+});
--- a/dom/storage/DOMStorage.cpp
+++ b/dom/storage/DOMStorage.cpp
@@ -124,17 +124,17 @@ DOMStorage::SetItem(const nsAString& aKe
   }
 
   nsString old;
   aRv = mCache->SetItem(this, aKey, data, old);
   if (aRv.Failed()) {
     return;
   }
 
-  if (aRv.ErrorCode() != NS_SUCCESS_DOM_NO_OPERATION) {
+  if (!aRv.ErrorCodeIs(NS_SUCCESS_DOM_NO_OPERATION)) {
     BroadcastChangeNotification(aKey, old, aData);
   }
 }
 
 void
 DOMStorage::RemoveItem(const nsAString& aKey, ErrorResult& aRv)
 {
   if (!CanUseStorage(this)) {
@@ -143,17 +143,17 @@ DOMStorage::RemoveItem(const nsAString& 
   }
 
   nsAutoString old;
   aRv = mCache->RemoveItem(this, aKey, old);
   if (aRv.Failed()) {
     return;
   }
 
-  if (aRv.ErrorCode() != NS_SUCCESS_DOM_NO_OPERATION) {
+  if (!aRv.ErrorCodeIs(NS_SUCCESS_DOM_NO_OPERATION)) {
     BroadcastChangeNotification(aKey, old, NullString());
   }
 }
 
 void
 DOMStorage::Clear(ErrorResult& aRv)
 {
   if (!CanUseStorage(this)) {
@@ -161,17 +161,17 @@ DOMStorage::Clear(ErrorResult& aRv)
     return;
   }
 
   aRv = mCache->Clear(this);
   if (NS_WARN_IF(aRv.Failed())) {
     return;
   }
 
-  if (aRv.ErrorCode() != NS_SUCCESS_DOM_NO_OPERATION) {
+  if (!aRv.ErrorCodeIs(NS_SUCCESS_DOM_NO_OPERATION)) {
     BroadcastChangeNotification(NullString(), NullString(), NullString());
   }
 }
 
 namespace {
 
 class StorageNotifierRunnable : public nsRunnable
 {
--- a/dom/storage/DOMStorage.h
+++ b/dom/storage/DOMStorage.h
@@ -104,17 +104,17 @@ public:
   }
 
   void RemoveItem(const nsAString& aKey, ErrorResult& aRv);
 
   void NamedDeleter(const nsAString& aKey, bool& aFound, ErrorResult& aRv)
   {
     RemoveItem(aKey, aRv);
 
-    aFound = (aRv.ErrorCode() != NS_SUCCESS_DOM_NO_OPERATION);
+    aFound = !aRv.ErrorCodeIs(NS_SUCCESS_DOM_NO_OPERATION);
   }
 
   void Clear(ErrorResult& aRv);
 
   // The method checks whether the caller can use a storage.
   // CanUseStorage is called before any DOM initiated operation
   // on a storage is about to happen and ensures that the storage's
   // session-only flag is properly set according the current settings.
--- a/dom/svg/DOMSVGLength.cpp
+++ b/dom/svg/DOMSVGLength.cpp
@@ -240,17 +240,17 @@ DOMSVGLength::GetValue(ErrorResult& aRv)
   return 0.0f;
 }
 
 NS_IMETHODIMP
 DOMSVGLength::GetValue(float* aValue)
 {
   ErrorResult rv;
   *aValue = GetValue(rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DOMSVGLength::SetValue(float aUserUnitValue, ErrorResult& aRv)
 {
   if (mIsAnimValItem) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
@@ -294,17 +294,17 @@ NS_IMETHODIMP
 DOMSVGLength::SetValue(float aUserUnitValue)
 {
   if (!IsFinite(aUserUnitValue)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   ErrorResult rv;
   SetValue(aUserUnitValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 float
 DOMSVGLength::ValueInSpecifiedUnits()
 {
   if (mVal) {
     if (mIsAnimValItem) {
       mSVGElement->FlushAnimations();
@@ -354,17 +354,17 @@ NS_IMETHODIMP
 DOMSVGLength::SetValueInSpecifiedUnits(float aValue)
 {
   if (!IsFinite(aValue)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   ErrorResult rv;
   SetValueInSpecifiedUnits(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DOMSVGLength::SetValueAsString(const nsAString& aValue, ErrorResult& aRv)
 {
   if (mIsAnimValItem) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
@@ -392,17 +392,17 @@ DOMSVGLength::SetValueAsString(const nsA
   mUnit = value.GetUnit();
 }
 
 NS_IMETHODIMP
 DOMSVGLength::SetValueAsString(const nsAString& aValue)
 {
   ErrorResult rv;
   SetValueAsString(aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 DOMSVGLength::GetValueAsString(nsAString& aValue)
 {
   if (mVal) {
     if (mIsAnimValItem) {
       mSVGElement->FlushAnimations();
@@ -459,17 +459,17 @@ NS_IMETHODIMP
 DOMSVGLength::NewValueSpecifiedUnits(uint16_t aUnit, float aValue)
 {
   if (!IsFinite(aValue)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   ErrorResult rv;
   NewValueSpecifiedUnits(aUnit, aValue, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 void
 DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit, ErrorResult& aRv)
 {
   if (mIsAnimValItem) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
@@ -509,17 +509,17 @@ DOMSVGLength::ConvertToSpecifiedUnits(ui
   aRv.Throw(NS_ERROR_FAILURE);
 }
 
 NS_IMETHODIMP
 DOMSVGLength::ConvertToSpecifiedUnits(uint16_t aUnit)
 {
   ErrorResult rv;
   ConvertToSpecifiedUnits(aUnit, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 JSObject*
 DOMSVGLength::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return dom::SVGLengthBinding::Wrap(aCx, this, aGivenProto);
 }
 
--- a/dom/system/gonk/nsVolumeMountLock.cpp
+++ b/dom/system/gonk/nsVolumeMountLock.cpp
@@ -155,17 +155,17 @@ nsVolumeMountLock::Lock(nsIVolume* aVolu
   NS_ENSURE_TRUE(pmService, NS_ERROR_FAILURE);
 
   nsString mountLockName;
   aVolume->GetMountLockName(mountLockName);
 
   ErrorResult err;
   mWakeLock = pmService->NewWakeLock(mountLockName, nullptr, err);
   if (err.Failed()) {
-    return err.ErrorCode();
+    return err.StealNSResult();
   }
 
   LOG("nsVolumeMountLock acquired for '%s' gen %d",
       NS_LossyConvertUTF16toASCII(mVolumeName).get(), mVolumeGeneration);
   return NS_OK;
 }
 
 } // namespace system
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2425,17 +2425,17 @@ RuntimeService::CreateSharedWorkerFromLo
   nsCOMPtr<nsPIDOMWindow> window = aLoadInfo->mWindow;
 
   bool created = false;
   if (!workerPrivate) {
     ErrorResult rv;
     workerPrivate =
       WorkerPrivate::Constructor(aCx, aScriptURL, false,
                                  aType, aName, aLoadInfo, rv);
-    NS_ENSURE_TRUE(workerPrivate, rv.ErrorCode());
+    NS_ENSURE_TRUE(workerPrivate, rv.StealNSResult());
 
     created = true;
   } else {
     // If we're attaching to an existing SharedWorker private, then we
     // must update the overriden load group to account for our document's
     // load group.
     workerPrivate->UpdateOverridenLoadGroup(aLoadInfo->mLoadGroup);
   }
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -810,18 +810,19 @@ private:
       MOZ_ASSERT(!loadInfo.mFullURL.IsEmpty());
       request.SetAsUSVString().Rebind(loadInfo.mFullURL.Data(),
                                       loadInfo.mFullURL.Length());
 
       ErrorResult error;
       nsRefPtr<Promise> cachePromise =
         mCacheCreator->Cache_()->Put(request, *response, error);
       if (NS_WARN_IF(error.Failed())) {
-        channel->Cancel(error.ErrorCode());
-        return error.ErrorCode();
+        nsresult rv = error.StealNSResult();
+        channel->Cancel(rv);
+        return rv;
       }
 
       nsRefPtr<CachePromiseHandler> promiseHandler =
         new CachePromiseHandler(this, loadInfo, aIndex);
       cachePromise->AppendNativeHandler(promiseHandler);
 
       loadInfo.mCachePromise.swap(cachePromise);
       loadInfo.mCacheStatus = ScriptLoadInfo::WritingToCache;
@@ -1161,17 +1162,17 @@ CacheCreator::CreateCacheStorage(nsIPrin
   }
 
   ErrorResult error;
   mCacheStorage =
     CacheStorage::CreateOnMainThread(cache::CHROME_ONLY_NAMESPACE,
                                      mSandboxGlobalObject,
                                      aPrincipal, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   return NS_OK;
 }
 
 nsresult
 CacheCreator::Load(nsIPrincipal* aPrincipal)
 {
@@ -1182,17 +1183,17 @@ CacheCreator::Load(nsIPrincipal* aPrinci
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   ErrorResult error;
   MOZ_ASSERT(!mCacheName.IsEmpty());
   nsRefPtr<Promise> promise = mCacheStorage->Open(mCacheName, error);
   if (NS_WARN_IF(error.Failed())) {
-    return error.ErrorCode();
+    return error.StealNSResult();
   }
 
   promise->AppendNativeHandler(this);
   return NS_OK;
 }
 
 void
 CacheCreator::FailLoaders(nsresult aRv)
@@ -1317,17 +1318,17 @@ CacheScriptLoader::Load(Cache* aCache)
   request.SetAsUSVString().Rebind(mLoadInfo.mFullURL.Data(),
                                   mLoadInfo.mFullURL.Length());
 
   CacheQueryOptions params;
 
   ErrorResult error;
   nsRefPtr<Promise> promise = aCache->Match(request, params, error);
   if (NS_WARN_IF(error.Failed())) {
-    Fail(error.ErrorCode());
+    Fail(error.StealNSResult());
     return;
   }
 
   promise->AppendNativeHandler(this);
 }
 
 void
 CacheScriptLoader::RejectedCallback(JSContext* aCx,
--- a/dom/workers/ServiceWorkerClient.cpp
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -87,17 +87,17 @@ public:
     nsGlobalWindow* window = nsGlobalWindow::GetOuterWindowWithId(mWindowId);
     if (!window) {
       return NS_ERROR_FAILURE;
     }
 
     ErrorResult result;
     dom::Navigator* navigator = window->GetNavigator(result);
     if (NS_WARN_IF(result.Failed())) {
-      return result.ErrorCode();
+      return result.StealNSResult();
     }
 
     nsRefPtr<ServiceWorkerContainer> container = navigator->ServiceWorker();
     AutoJSAPI jsapi;
     jsapi.Init(window);
     JSContext* cx = jsapi.cx();
 
     return DispatchDOMEvent(cx, container);
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -991,17 +991,17 @@ ServiceWorkerManager::Register(nsIDOMWin
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   nsCOMPtr<nsIGlobalObject> sgo = do_QueryInterface(window);
   ErrorResult result;
   nsRefPtr<Promise> promise = Promise::Create(sgo, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
 
   ServiceWorkerJobQueue* queue = GetOrCreateJobQueue(cleanedScope);
   MOZ_ASSERT(queue);
 
   nsRefPtr<ServiceWorkerResolveWindowPromiseOnUpdateCallback> cb =
     new ServiceWorkerResolveWindowPromiseOnUpdateCallback(window, promise);
 
@@ -1312,17 +1312,17 @@ ServiceWorkerManager::GetRegistrations(n
   if (!window) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIGlobalObject> sgo = do_QueryInterface(window);
   ErrorResult result;
   nsRefPtr<Promise> promise = Promise::Create(sgo, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
 
   nsCOMPtr<nsIRunnable> runnable =
     new GetRegistrationsRunnable(window, promise);
   promise.forget(aPromise);
   return NS_DispatchToCurrentThread(runnable);
 }
 
@@ -1413,17 +1413,17 @@ ServiceWorkerManager::GetRegistration(ns
   if (!window) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIGlobalObject> sgo = do_QueryInterface(window);
   ErrorResult result;
   nsRefPtr<Promise> promise = Promise::Create(sgo, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
 
   nsCOMPtr<nsIRunnable> runnable =
     new GetRegistrationRunnable(window, promise, aDocumentURL);
   promise.forget(aPromise);
   return NS_DispatchToCurrentThread(runnable);
 }
 
@@ -1526,21 +1526,33 @@ public:
     MOZ_ASSERT(aWorkerPrivate->IsServiceWorker());
   }
 
   bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
   {
     MOZ_ASSERT(aWorkerPrivate);
 
-    nsRefPtr<EventTarget> target = do_QueryObject(aWorkerPrivate->GlobalScope());
-
-    nsContentUtils::DispatchTrustedEvent(nullptr, target,
-                                         NS_LITERAL_STRING("pushsubscriptionchange"),
-                                         true, true);
+    WorkerGlobalScope* globalScope = aWorkerPrivate->GlobalScope();
+
+    nsCOMPtr<nsIDOMEvent> event;
+    nsresult rv =
+      NS_NewDOMEvent(getter_AddRefs(event), globalScope, nullptr, nullptr);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return false;
+    }
+
+    rv = event->InitEvent(NS_LITERAL_STRING("pushsubscriptionchange"), false, false);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return false;
+    }
+
+    event->SetTrusted(true);
+
+    globalScope->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
     return true;
   }
 };
 
 #endif /* ! MOZ_SIMPLEPUSH */
 
 NS_IMETHODIMP
 ServiceWorkerManager::SendPushEvent(const nsACString& aScope, const nsAString& aData)
@@ -1565,17 +1577,17 @@ ServiceWorkerManager::SendPushEvent(cons
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 #endif
 }
 
 NS_IMETHODIMP
-ServiceWorkerManager::SendPushSubscriptionChangedEvent(const nsACString& aScope)
+ServiceWorkerManager::SendPushSubscriptionChangeEvent(const nsACString& aScope)
 {
 #ifdef MOZ_SIMPLEPUSH
   return NS_ERROR_NOT_AVAILABLE;
 #else
   nsRefPtr<ServiceWorker> serviceWorker = CreateServiceWorkerForScope(aScope);
   if (!serviceWorker) {
     return NS_ERROR_FAILURE;
   }
@@ -1612,17 +1624,17 @@ ServiceWorkerManager::GetReadyPromise(ns
   }
 
   MOZ_ASSERT(!mPendingReadyPromises.Contains(window));
 
   nsCOMPtr<nsIGlobalObject> sgo = do_QueryInterface(window);
   ErrorResult result;
   nsRefPtr<Promise> promise = Promise::Create(sgo, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
 
   nsCOMPtr<nsIRunnable> runnable =
     new GetReadyPromiseRunnable(window, promise);
   promise.forget(aPromise);
   return NS_DispatchToCurrentThread(runnable);
 }
 
--- a/dom/workers/ServiceWorkerScriptCache.cpp
+++ b/dom/workers/ServiceWorkerScriptCache.cpp
@@ -178,22 +178,22 @@ public:
     MOZ_ASSERT(aPrincipal);
     AssertIsOnMainThread();
 
     mURL = aURL;
 
     ErrorResult rv;
     nsRefPtr<CacheStorage> cacheStorage = CreateCacheStorage(aPrincipal, rv);
     if (NS_WARN_IF(rv.Failed())) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     nsRefPtr<Promise> promise = cacheStorage->Open(aCacheName, rv);
     if (NS_WARN_IF(rv.Failed())) {
-      return rv.ErrorCode();
+      return rv.StealNSResult();
     }
 
     promise->AppendNativeHandler(this);
     return NS_OK;
   }
 
   void
   Abort()
@@ -523,17 +523,17 @@ CompareCache::ManageCacheResult(JSContex
   }
 
   RequestOrUSVString request;
   request.SetAsUSVString().Rebind(mURL.Data(), mURL.Length());
   ErrorResult error;
   CacheQueryOptions params;
   nsRefPtr<Promise> promise = cache->Match(request, params, error);
   if (NS_WARN_IF(error.Failed())) {
-    mManager->CacheFinished(error.ErrorCode(), false);
+    mManager->CacheFinished(error.StealNSResult(), false);
     return;
   }
 
   promise->AppendNativeHandler(this);
   mState = WaitingForValue;
 }
 
 void
@@ -612,24 +612,24 @@ PurgeCache(nsIPrincipal* aPrincipal, con
 
   if (aCacheName.IsEmpty()) {
     return NS_OK;
   }
 
   ErrorResult rv;
   nsRefPtr<CacheStorage> cacheStorage = CreateCacheStorage(aPrincipal, rv);
   if (NS_WARN_IF(rv.Failed())) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // We use the ServiceWorker scope as key for the cacheStorage.
   nsRefPtr<Promise> promise =
     cacheStorage->Delete(aCacheName, rv);
   if (NS_WARN_IF(rv.Failed())) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // We don't actually care about the result of the delete operation.
   return NS_OK;
 }
 
 nsresult
 GenerateCacheName(nsAString& aName)
--- a/dom/workers/ServiceWorkerWindowClient.cpp
+++ b/dom/workers/ServiceWorkerWindowClient.cpp
@@ -140,13 +140,13 @@ ServiceWorkerWindowClient::Focus(ErrorRe
     // Don't dispatch if adding the worker feature failed.
     return promise.forget();
   }
 
   nsRefPtr<ClientFocusRunnable> r = new ClientFocusRunnable(mWindowId,
                                                             promiseProxy);
   aRv = NS_DispatchToMainThread(r);
   if (NS_WARN_IF(aRv.Failed())) {
-    promise->MaybeReject(aRv.ErrorCode());
+    promise->MaybeReject(aRv);
   }
 
   return promise.forget();
 }
--- a/dom/workers/WorkerThread.cpp
+++ b/dom/workers/WorkerThread.cpp
@@ -285,17 +285,17 @@ WorkerThread::Dispatch(nsIRunnable* aRun
   return NS_OK;
 }
 
 uint32_t
 WorkerThread::RecursionDepth(const WorkerThreadFriendKey& /* aKey */) const
 {
   MOZ_ASSERT(PR_GetCurrentThread() == mThread);
 
-  return mRunningEvent;
+  return mNestedEventLoopDepth;
 }
 
 NS_IMPL_ISUPPORTS(WorkerThread::Observer, nsIThreadObserver)
 
 NS_IMETHODIMP
 WorkerThread::Observer::OnDispatchedEvent(nsIThreadInternal* /* aThread */)
 {
   MOZ_CRASH("OnDispatchedEvent() should never be called!");
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -1488,17 +1488,17 @@ OpenRunnable::MainThreadRunInternal()
 
   ErrorResult rv2;
   mProxy->mXHR->Open(mMethod, mURL, true, mUser, mPassword, rv2);
 
   MOZ_ASSERT(mProxy->mInOpen);
   mProxy->mInOpen = false;
 
   if (rv2.Failed()) {
-    return rv2.ErrorCode();
+    return rv2.StealNSResult();
   }
 
   return mProxy->mXHR->SetResponseType(NS_LITERAL_STRING("text"));
 }
 
 
 nsresult
 SendRunnable::MainThreadRun()
--- a/dom/xml/XMLDocument.cpp
+++ b/dom/xml/XMLDocument.cpp
@@ -280,17 +280,17 @@ XMLDocument::SetAsync(bool aAsync)
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
 {
   ErrorResult rv;
   *aReturn = Load(aUrl, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 bool
 XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
 {
   bool hasHadScriptObject = true;
   nsIScriptGlobalObject* scriptObject =
     GetScriptHandlingObject(hasHadScriptObject);
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -90,30 +90,30 @@ XPathEvaluator::Evaluate(const nsAString
                          nsISupports *aInResult,
                          nsISupports **aResult)
 {
     nsCOMPtr<nsINode> resolver = do_QueryInterface(aResolver);
     ErrorResult rv;
     nsAutoPtr<XPathExpression> expression(CreateExpression(aExpression,
                                                            resolver, rv));
     if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
     }
 
     nsCOMPtr<nsINode> node = do_QueryInterface(aContextNode);
     if (!node) {
         return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsIXPathResult> inResult = do_QueryInterface(aInResult);
     nsRefPtr<XPathResult> result =
         expression->Evaluate(*node, aType,
                              static_cast<XPathResult*>(inResult.get()), rv);
     if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
     }
 
     *aResult = ToSupports(result.forget().take());
 
     return NS_OK;
 }
 
 XPathExpression*
@@ -145,17 +145,18 @@ XPathEvaluator::CreateExpression(const n
     if (!mRecycler) {
         mRecycler = new txResultRecycler;
     }
 
     nsAutoPtr<Expr> expression;
     aRv = txExprParser::createExpr(PromiseFlatString(aExpression), aContext,
                                    getter_Transfers(expression));
     if (aRv.Failed()) {
-        if (aRv.ErrorCode() != NS_ERROR_DOM_NAMESPACE_ERR) {
+        if (!aRv.ErrorCodeIs(NS_ERROR_DOM_NAMESPACE_ERR)) {
+            aRv.SuppressException();
             aRv.Throw(NS_ERROR_DOM_INVALID_EXPRESSION_ERR);
         }
 
         return nullptr;
     }
 
     return new XPathExpression(Move(expression), mRecycler, aDocument);
 }
@@ -211,17 +212,17 @@ nsresult XPathEvaluatorParseContext::res
         aPrefix->ToString(prefix);
     }
 
     nsVoidableString ns;
     if (mResolver) {
         ErrorResult rv;
         mResolver->LookupNamespaceURI(prefix, ns, rv);
         if (rv.Failed()) {
-            return rv.ErrorCode();
+            return rv.StealNSResult();
         }
     } else {
         if (aPrefix == nsGkAtoms::xml) {
             ns.AssignLiteral("http://www.w3.org/XML/1998/namespace");
         } else {
             mResolverNode->LookupNamespaceURI(prefix, ns);
         }
     }
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -732,17 +732,17 @@ XULDocument::AddBroadcastListenerFor(nsI
                                      nsIDOMElement* aListener,
                                      const nsAString& aAttr)
 {
     ErrorResult rv;
     nsCOMPtr<Element> broadcaster = do_QueryInterface(aBroadcaster);
     nsCOMPtr<Element> listener = do_QueryInterface(aListener);
     NS_ENSURE_ARG(broadcaster && listener);
     AddBroadcastListenerFor(*broadcaster, *listener, aAttr, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 void
 XULDocument::AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
                                      const nsAString& aAttr, ErrorResult& aRv)
 {
     nsresult rv =
         nsContentUtils::CheckSameOrigin(this, &aBroadcaster);
@@ -1215,17 +1215,17 @@ NS_IMETHODIMP
 XULDocument::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
                                       const nsAString& aAttribute,
                                       const nsAString& aValue,
                                       nsIDOMNodeList** aReturn)
 {
     ErrorResult rv;
     *aReturn = GetElementsByAttributeNS(aNamespaceURI, aAttribute,
                                         aValue, rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 already_AddRefed<nsINodeList>
 XULDocument::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
                                       const nsAString& aAttribute,
                                       const nsAString& aValue,
                                       ErrorResult& aRv)
 {
@@ -1521,17 +1521,17 @@ XULDocument::GetPopupRangeParent(ErrorRe
 
 // Returns the rangeOffset element from the XUL Popup Manager. We check the
 // rangeParent to determine if the caller has rights to access to the data.
 NS_IMETHODIMP
 XULDocument::GetPopupRangeOffset(int32_t* aRangeOffset)
 {
     ErrorResult rv;
     *aRangeOffset = GetPopupRangeOffset(rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 int32_t
 XULDocument::GetPopupRangeOffset(ErrorResult& aRv)
 {
     nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
     if (!pm) {
         aRv.Throw(NS_ERROR_FAILURE);
@@ -4301,17 +4301,17 @@ XULDocument::CheckBroadcasterHookup(Elem
         default:
             return rv;
     }
 
     NS_ENSURE_ARG(broadcaster && listener);
     ErrorResult domRv;
     AddBroadcastListenerFor(*broadcaster, *listener, attribute, domRv);
     if (domRv.Failed()) {
-        return domRv.ErrorCode();
+        return domRv.StealNSResult();
     }
 
 #ifdef PR_LOGGING
     // Tell the world we succeeded
     if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) {
         nsCOMPtr<nsIContent> content =
             do_QueryInterface(listener);
 
@@ -4652,17 +4652,17 @@ XULDocument::GetDocumentLWTheme()
 }
 
 NS_IMETHODIMP
 XULDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
 {
     ErrorResult rv;
     nsCOMPtr<Element> el = do_QueryInterface(aElement);
     *aResult = GetBoxObjectFor(el, rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 JSObject*
 XULDocument::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return XULDocumentBinding::Wrap(aCx, this, aGivenProto);
 }
 
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -460,17 +460,17 @@ NS_IMETHODIMP
 nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
                                        const nsAString& aAttribute,
                                        const nsAString& aValue,
                                        nsIDOMNodeList** aReturn)
 {
     ErrorResult rv;
     *aReturn =
         GetElementsByAttributeNS(aNamespaceURI, aAttribute, aValue, rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 already_AddRefed<nsINodeList>
 nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
                                        const nsAString& aAttribute,
                                        const nsAString& aValue,
                                        ErrorResult& rv)
 {
@@ -1365,17 +1365,17 @@ nsXULElement::PreHandleEvent(EventChainP
 }
 
 // XXX This _should_ be an implementation method, _not_ publicly exposed :-(
 NS_IMETHODIMP
 nsXULElement::GetResource(nsIRDFResource** aResource)
 {
     ErrorResult rv;
     *aResource = GetResource(rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 already_AddRefed<nsIRDFResource>
 nsXULElement::GetResource(ErrorResult& rv)
 {
     nsAutoString id;
     GetAttr(kNameSpaceID_None, nsGkAtoms::ref, id);
     if (id.IsEmpty()) {
@@ -1478,44 +1478,43 @@ nsXULElement::IsAttributeMapped(const ns
 }
 
 // Controllers Methods
 NS_IMETHODIMP
 nsXULElement::GetControllers(nsIControllers** aResult)
 {
     ErrorResult rv;
     NS_IF_ADDREF(*aResult = GetControllers(rv));
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 nsIControllers*
 nsXULElement::GetControllers(ErrorResult& rv)
 {
     if (! Controllers()) {
         nsDOMSlots* slots = DOMSlots();
 
         rv = NS_NewXULControllers(nullptr, NS_GET_IID(nsIControllers),
                                   reinterpret_cast<void**>(&slots->mControllers));
 
-        NS_ASSERTION(NS_SUCCEEDED(rv.ErrorCode()),
-                     "unable to create a controllers");
+        NS_ASSERTION(!rv.Failed(), "unable to create a controllers");
         if (rv.Failed()) {
             return nullptr;
         }
     }
 
     return Controllers();
 }
 
 NS_IMETHODIMP
 nsXULElement::GetBoxObject(nsIBoxObject** aResult)
 {
     ErrorResult rv;
     *aResult = GetBoxObject(rv).take();
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 already_AddRefed<BoxObject>
 nsXULElement::GetBoxObject(ErrorResult& rv)
 {
     // XXX sXBL/XBL2 issue! Owner or current document?
     return OwnerDoc()->GetBoxObjectFor(this, rv);
 }
@@ -1643,17 +1642,17 @@ nsXULElement::SwapFrameLoaders(nsIFrameL
     nsCOMPtr<nsIContent> otherContent(do_QueryInterface(aOtherOwner));
     NS_ENSURE_TRUE(otherContent, NS_ERROR_NOT_IMPLEMENTED);
 
     nsXULElement* otherEl = FromContent(otherContent);
     NS_ENSURE_TRUE(otherEl, NS_ERROR_NOT_IMPLEMENTED);
 
     ErrorResult rv;
     SwapFrameLoaders(*otherEl, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 void
 nsXULElement::SwapFrameLoaders(nsXULElement& aOtherElement, ErrorResult& rv)
 {
     if (&aOtherElement == this) {
         // nothing to do
         return;
@@ -1692,17 +1691,17 @@ nsXULElement::GetParentTree(nsIDOMXULMul
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULElement::Focus()
 {
     ErrorResult rv;
     Focus(rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 void
 nsXULElement::Focus(ErrorResult& rv)
 {
     nsIFocusManager* fm = nsFocusManager::GetFocusManager();
     nsCOMPtr<nsIDOMElement> elem = do_QueryObject(this);
     if (fm) {
@@ -1710,17 +1709,17 @@ nsXULElement::Focus(ErrorResult& rv)
     }
 }
 
 NS_IMETHODIMP
 nsXULElement::Blur()
 {
     ErrorResult rv;
     Blur(rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
 }
 
 void
 nsXULElement::Blur(ErrorResult& rv)
 {
     if (!ShouldBlur(this))
       return;
 
--- a/dom/xul/templates/nsXULTemplateQueryProcessorXML.cpp
+++ b/dom/xul/templates/nsXULTemplateQueryProcessorXML.cpp
@@ -50,17 +50,17 @@ nsXULTemplateResultSetXML::HasMoreElemen
 }
 
 NS_IMETHODIMP
 nsXULTemplateResultSetXML::GetNext(nsISupports **aResult)
 {
     ErrorResult rv;
     nsINode* node = mResults->SnapshotItem(mPosition, rv);
     if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
     }
 
     nsXULTemplateResultXML* result =
         new nsXULTemplateResultXML(mQuery, node->AsContent(), mBindingSet);
 
     ++mPosition;
     *aResult = result;
     NS_ADDREF(result);
@@ -247,17 +247,17 @@ nsXULTemplateQueryProcessorXML::CompileQ
     if (expr.IsEmpty())
         expr.Assign('*');
 
     ErrorResult rv;
     nsAutoPtr<XPathExpression> compiledexpr;
     compiledexpr = CreateExpression(expr, content, rv);
     if (rv.Failed()) {
         nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_BAD_XPATH);
-        return rv.ErrorCode();
+        return rv.StealNSResult();
     }
 
     nsRefPtr<nsXMLQuery> query =
         new nsXMLQuery(this, aMemberVariable, Move(compiledexpr));
 
     for (nsIContent* condition = content->GetFirstChild();
          condition;
          condition = condition->GetNextSibling()) {
@@ -270,17 +270,17 @@ nsXULTemplateQueryProcessorXML::CompileQ
             nsAutoString expr;
             condition->GetAttr(kNameSpaceID_None, nsGkAtoms::expr, expr);
 
             // ignore assignments without a variable or an expression
             if (!var.IsEmpty() && !expr.IsEmpty()) {
                 compiledexpr = CreateExpression(expr, condition, rv);
                 if (rv.Failed()) {
                     nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_BAD_ASSIGN_XPATH);
-                    return rv.ErrorCode();
+                    return rv.StealNSResult();
                 }
 
                 nsCOMPtr<nsIAtom> varatom = do_GetAtom(var);
 
                 query->AddBinding(varatom, Move(compiledexpr));
             }
         }
     }
@@ -318,17 +318,17 @@ nsXULTemplateQueryProcessorXML::Generate
     if (!expr)
         return NS_ERROR_FAILURE;
 
     ErrorResult rv;
     nsRefPtr<XPathResult> exprresults =
         expr->Evaluate(*context, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
                        nullptr, rv);
     if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
     }
 
     nsRefPtr<nsXULTemplateResultSetXML> results =
         new nsXULTemplateResultSetXML(xmlquery, exprresults.forget(),
                                       xmlquery->GetBindingSet());
 
     results.forget(aResults);
 
--- a/editor/libeditor/CreateElementTxn.cpp
+++ b/editor/libeditor/CreateElementTxn.cpp
@@ -68,27 +68,27 @@ CreateElementTxn::DoTransaction()
 
   // Try to insert formatting whitespace for the new node:
   mEditor->MarkNodeDirty(GetAsDOMNode(mNewNode));
 
   // Insert the new node
   ErrorResult rv;
   if (mOffsetInParent == -1) {
     mParent->AppendChild(*mNewNode, rv);
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   mOffsetInParent = std::min(mOffsetInParent,
                              static_cast<int32_t>(mParent->GetChildCount()));
 
   // Note, it's ok for mRefNode to be null. That means append
   mRefNode = mParent->GetChildAt(mOffsetInParent);
 
   mParent->InsertBefore(*mNewNode, mRefNode, rv);
-  NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
 
   // Only set selection to insertion point if editor gives permission
   if (!mEditor->GetShouldTxnSetSelection()) {
     // Do nothing - DOM range gravity will adjust selection
     return NS_OK;
   }
 
   nsRefPtr<Selection> selection = mEditor->GetSelection();
@@ -103,32 +103,32 @@ CreateElementTxn::DoTransaction()
 NS_IMETHODIMP
 CreateElementTxn::UndoTransaction()
 {
   MOZ_ASSERT(mEditor && mParent);
 
   ErrorResult rv;
   mParent->RemoveChild(*mNewNode, rv);
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 CreateElementTxn::RedoTransaction()
 {
   MOZ_ASSERT(mEditor && mParent);
 
   // First, reset mNewNode so it has no attributes or content
   // XXX We never actually did this, we only cleared mNewNode's contents if it
   // was a CharacterData node (which it's not, it's an Element)
 
   // Now, reinsert mNewNode
   ErrorResult rv;
   mParent->InsertBefore(*mNewNode, mRefNode, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 CreateElementTxn::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("CreateElementTxn: ");
   aString += nsDependentAtomString(mTag);
   return NS_OK;
--- a/editor/libeditor/DeleteNodeTxn.cpp
+++ b/editor/libeditor/DeleteNodeTxn.cpp
@@ -67,33 +67,33 @@ DeleteNodeTxn::DoTransaction()
   // *before* we do the action, unlike some of the other nsRangeStore update
   // methods.
   if (mRangeUpdater) {
     mRangeUpdater->SelAdjDeleteNode(mNode->AsDOMNode());
   }
 
   ErrorResult error;
   mParent->RemoveChild(*mNode, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 NS_IMETHODIMP
 DeleteNodeTxn::UndoTransaction()
 {
   if (!mParent) {
     // this is a legal state, the txn is a no-op
     return NS_OK;
   }
   if (!mNode) {
     return NS_ERROR_NULL_POINTER;
   }
 
   ErrorResult error;
   mParent->InsertBefore(*mNode, mRefNode, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 NS_IMETHODIMP
 DeleteNodeTxn::RedoTransaction()
 {
   if (!mParent) {
     // this is a legal state, the txn is a no-op
     return NS_OK;
@@ -103,17 +103,17 @@ DeleteNodeTxn::RedoTransaction()
   }
 
   if (mRangeUpdater) {
     mRangeUpdater->SelAdjDeleteNode(mNode->AsDOMNode());
   }
 
   ErrorResult error;
   mParent->RemoveChild(*mNode, error);
-  return error.ErrorCode();
+  return error.StealNSResult();
 }
 
 NS_IMETHODIMP
 DeleteNodeTxn::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("DeleteNodeTxn");
   return NS_OK;
 }
--- a/editor/libeditor/InsertNodeTxn.cpp
+++ b/editor/libeditor/InsertNodeTxn.cpp
@@ -55,17 +55,17 @@ InsertNodeTxn::DoTransaction()
 
   // Note, it's ok for ref to be null. That means append.
   nsCOMPtr<nsIContent> ref = mParent->GetChildAt(mOffset);
 
   mEditor.MarkNodeDirty(GetAsDOMNode(mNode));
 
   ErrorResult rv;
   mParent->InsertBefore(*mNode, ref, rv);
-  NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
 
   // Only set selection to insertion point if editor gives permission
   if (mEditor.GetShouldTxnSetSelection()) {
     nsRefPtr<Selection> selection = mEditor.GetSelection();
     NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
     // Place the selection just after the inserted element
     selection->Collapse(mParent, mOffset + 1);
   } else {
@@ -76,17 +76,17 @@ InsertNodeTxn::DoTransaction()
 
 NS_IMETHODIMP
 InsertNodeTxn::UndoTransaction()
 {
   MOZ_ASSERT(mNode && mParent);
 
   ErrorResult rv;
   mParent->RemoveChild(*mNode, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 InsertNodeTxn::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("InsertNodeTxn");
   return NS_OK;
 }
--- a/editor/libeditor/JoinNodeTxn.cpp
+++ b/editor/libeditor/JoinNodeTxn.cpp
@@ -77,29 +77,29 @@ JoinNodeTxn::UndoTransaction()
   // First, massage the existing node so it is in its post-split state
   ErrorResult rv;
   if (mRightNode->GetAsText()) {
     rv = mRightNode->GetAsText()->DeleteData(0, mOffset);
   } else {
     nsCOMPtr<nsIContent> child = mRightNode->GetFirstChild();
     for (uint32_t i = 0; i < mOffset; i++) {
       if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
       }
       if (!child) {
         return NS_ERROR_NULL_POINTER;
       }
       nsCOMPtr<nsIContent> nextSibling = child->GetNextSibling();
       mLeftNode->AppendChild(*child, rv);
       child = nextSibling;
     }
   }
   // Second, re-insert the left node into the tree
   mParent->InsertBefore(*mLeftNode, mRightNode, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 JoinNodeTxn::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("JoinNodeTxn");
   return NS_OK;
 }
--- a/editor/libeditor/SplitNodeTxn.cpp
+++ b/editor/libeditor/SplitNodeTxn.cpp
@@ -43,32 +43,32 @@ NS_INTERFACE_MAP_END_INHERITING(EditTxn)
 NS_IMETHODIMP
 SplitNodeTxn::DoTransaction()
 {
   // Create a new node
   ErrorResult rv;
   // Don't use .downcast directly because AsContent has an assertion we want
   nsCOMPtr<nsINode> clone = mExistingRightNode->CloneNode(false, rv);
   NS_ASSERTION(!rv.Failed() && clone, "Could not create clone");
-  NS_ENSURE_TRUE(!rv.Failed() && clone, rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed() && clone, rv.StealNSResult());
   mNewLeftNode = dont_AddRef(clone.forget().take()->AsContent());
   mEditor.MarkNodeDirty(mExistingRightNode->AsDOMNode());
 
   // Get the parent node
   mParent = mExistingRightNode->GetParentNode();
   NS_ENSURE_TRUE(mParent, NS_ERROR_NULL_POINTER);
 
   // Insert the new node
   rv = mEditor.SplitNodeImpl(*mExistingRightNode, mOffset, *mNewLeftNode);
   if (mEditor.GetShouldTxnSetSelection()) {
     nsRefPtr<Selection> selection = mEditor.GetSelection();
     NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
     rv = selection->Collapse(mNewLeftNode, mOffset);
   }
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 NS_IMETHODIMP
 SplitNodeTxn::UndoTransaction()
 {
   MOZ_ASSERT(mNewLeftNode && mParent);
 
   // This assumes Do inserted the new node in front of the prior existing node
@@ -83,38 +83,38 @@ NS_IMETHODIMP
 SplitNodeTxn::RedoTransaction()
 {
   MOZ_ASSERT(mNewLeftNode && mParent);
 
   ErrorResult rv;
   // First, massage the existing node so it is in its post-split state
   if (mExistingRightNode->GetAsText()) {
     rv = mExistingRightNode->GetAsText()->DeleteData(0, mOffset);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+    NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
   } else {
     nsCOMPtr<nsIContent> child = mExistingRightNode->GetFirstChild();
     nsCOMPtr<nsIContent> nextSibling;
     for (int32_t i=0; i < mOffset; i++) {
       if (rv.Failed()) {
-        return rv.ErrorCode();
+        return rv.StealNSResult();
       }
       if (!child) {
         return NS_ERROR_NULL_POINTER;
       }
       nextSibling = child->GetNextSibling();
       mExistingRightNode->RemoveChild(*child, rv);
       if (!rv.Failed()) {
         mNewLeftNode->AppendChild(*child, rv);
       }
       child = nextSibling;
     }
   }
   // Second, re-insert the left node into the tree
   mParent->InsertBefore(*mNewLeftNode, mExistingRightNode, rv);
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 
 NS_IMETHODIMP
 SplitNodeTxn::GetTxnDescription(nsAString& aString)
 {
   aString.AssignLiteral("SplitNodeTxn");
   return NS_OK;
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -1419,17 +1419,17 @@ nsEditor::SplitNode(nsIDOMNode* aNode,
                     int32_t aOffset,
                     nsIDOMNode** aNewLeftNode)
 {
   nsCOMPtr<nsIContent> node = do_QueryInterface(aNode);
   NS_ENSURE_STATE(node);
   ErrorResult rv;
   nsCOMPtr<nsIContent> newNode = SplitNode(*node, aOffset, rv);
   *aNewLeftNode = GetAsDOMNode(newNode.forget().take());
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 nsIContent*
 nsEditor::SplitNode(nsIContent& aNode, int32_t aOffset, ErrorResult& aResult)
 {
   nsAutoRules beginRulesSniffing(this, EditAction::splitNode,
                                  nsIEditor::eNext);
 
@@ -1440,20 +1440,24 @@ nsEditor::SplitNode(nsIContent& aNode, i
   nsRefPtr<SplitNodeTxn> txn = CreateTxnForSplitNode(aNode, aOffset);
   aResult = DoTransaction(txn);
 
   nsCOMPtr<nsIContent> newNode = aResult.Failed() ? nullptr
                                                   : txn->GetNewNode();
 
   mRangeUpdater.SelAdjSplitNode(aNode, aOffset, newNode);
 
+  nsresult result = aResult.StealNSResult();
   for (auto& listener : mActionListeners) {
     listener->DidSplitNode(aNode.AsDOMNode(), aOffset, GetAsDOMNode(newNode),
-                           aResult.ErrorCode());
+                           result);
   }
+  // Note: result might be a success code, so we can't use Throw() to
+  // set it on aResult.
+  aResult = result;
 
   return newNode;
 }
 
 
 NS_IMETHODIMP
 nsEditor::JoinNodes(nsIDOMNode* aLeftNode,
                     nsIDOMNode* aRightNode,
@@ -2619,17 +2623,17 @@ nsEditor::SplitNodeImpl(nsIContent& aExi
     }
   }
 
   nsCOMPtr<nsINode> parent = aExistingRightNode.GetParentNode();
   NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
 
   ErrorResult rv;
   parent->InsertBefore(aNewLeftNode, &aExistingRightNode, rv);
-  NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
 
   // Split the children between the two nodes.  At this point,
   // aExistingRightNode has all the children.  Move all the children whose
   // index is < aOffset to aNewLeftNode.
   if (aOffset < 0) {
     // This means move no children
     return NS_OK;
   }
@@ -2806,17 +2810,17 @@ nsEditor::JoinNodesImpl(nsINode* aNodeTo
 
     // Have to go through the list backwards to keep deletes from interfering with iteration.
     for (uint32_t i = childNodes->Length(); i > 0; --i) {
       nsCOMPtr<nsIContent> childNode = childNodes->Item(i - 1);
       if (childNode) {
         // prepend children of aNodeToJoin
         ErrorResult err;
         aNodeToKeep->InsertBefore(*childNode, firstNode, err);
-        NS_ENSURE_SUCCESS(err.ErrorCode(), err.ErrorCode());
+        NS_ENSURE_TRUE(!err.Failed(), err.StealNSResult());
         firstNode = childNode.forget();
       }
     }
   }
 
   // Delete the extra node.
   ErrorResult err;
   aParent->RemoveChild(*aNodeToJoin, err);
@@ -2868,17 +2872,17 @@ nsEditor::JoinNodesImpl(nsINode* aNodeTo
 
   if (shouldSetSelection) {
     // Editor wants us to set selection at join point.
     nsRefPtr<Selection> selection = GetSelection();
     NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
     selection->Collapse(aNodeToKeep, AssertedCast<int32_t>(firstNodeLength));
   }
 
-  return err.ErrorCode();
+  return err.StealNSResult();
 }
 
 
 int32_t
 nsEditor::GetChildOffset(nsIDOMNode* aChild, nsIDOMNode* aParent)
 {
   MOZ_ASSERT(aChild && aParent);
 
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -629,33 +629,33 @@ nsHTMLEditor::CheckPositionedElementBGan
     if (bgColorStr.EqualsLiteral("transparent")) {
       nsRefPtr<nsComputedDOMStyle> cssDecl =
         mHTMLCSSUtils->GetComputedStyle(element);
       NS_ENSURE_STATE(cssDecl);
 
       // from these declarations, get the one we want and that one only
       ErrorResult error;
       nsRefPtr<dom::CSSValue> cssVal = cssDecl->GetPropertyCSSValue(NS_LITERAL_STRING("color"), error);
-      NS_ENSURE_SUCCESS(error.ErrorCode(), error.ErrorCode());
+      NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
 
       nsROCSSPrimitiveValue* val = cssVal->AsPrimitiveValue();
       NS_ENSURE_TRUE(val, NS_ERROR_FAILURE);
 
       if (nsIDOMCSSPrimitiveValue::CSS_RGBCOLOR == val->PrimitiveType()) {
         nsDOMCSSRGBColor* rgbVal = val->GetRGBColorValue(error);
-        NS_ENSURE_SUCCESS(error.ErrorCode(), error.ErrorCode());
+        NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float r = rgbVal->Red()->
           GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
-        NS_ENSURE_SUCCESS(error.ErrorCode(), error.ErrorCode());
+        NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float g = rgbVal->Green()->
           GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
-        NS_ENSURE_SUCCESS(error.ErrorCode(), error.ErrorCode());
+        NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         float b = rgbVal->Blue()->
           GetFloatValue(nsIDOMCSSPrimitiveValue::CSS_NUMBER, error);
-        NS_ENSURE_SUCCESS(error.ErrorCode(), error.ErrorCode());
+        NS_ENSURE_TRUE(!error.Failed(), error.StealNSResult());
         if (r >= BLACK_BG_RGB_TRIGGER &&
             g >= BLACK_BG_RGB_TRIGGER &&
             b >= BLACK_BG_RGB_TRIGGER)
           aReturn.AssignLiteral("black");
         else
           aReturn.AssignLiteral("white");
         return NS_OK;
       }
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -1217,17 +1217,17 @@ nsresult nsHTMLEditor::InsertFromDataTra
                                               nsIDOMDocument *aSourceDoc,
                                               nsIDOMNode *aDestinationNode,
                                               int32_t aDestOffset,
                                               bool aDoDeleteSelection)
 {
   ErrorResult rv;
   nsRefPtr<DOMStringList> types = aDataTransfer->MozTypesAt(aIndex, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   bool hasPrivateHTMLFlavor = types->Contains(NS_LITERAL_STRING(kHTMLContext));
 
   bool isText = IsPlaintextEditor();
   bool isSafe = IsSafeToInsertData(aSourceDoc);
 
   uint32_t length = types->Length();
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -1204,19 +1204,19 @@ nsHTMLEditor::ReplaceHeadContentsWithHTM
     range->CreateContextualFragment(inputString, err);
 
   // XXXX BUG 50965: This is not returning the text between <title>...</title>
   // Special code is needed in JS to handle title anyway, so it doesn't matter!
 
   if (err.Failed()) {
 #ifdef DEBUG
     printf("Couldn't create contextual fragment: error was %X\n",
-           static_cast<uint32_t>(err.ErrorCode()));
+           err.ErrorCodeAsInt());
 #endif
-    return err.ErrorCode();
+    return err.StealNSResult();
   }
   NS_ENSURE_TRUE(docfrag, NS_ERROR_NULL_POINTER);
 
   // First delete all children in head
   while (nsCOMPtr<nsIContent> child = headNode->GetFirstChild()) {
     nsresult res = DeleteNode(child);
     NS_ENSURE_SUCCESS(res, res);
   }
@@ -1367,17 +1367,17 @@ nsHTMLEditor::RebuildDocumentFromSource(
   bodyTag.Append(Substring(endbody, endclosebody));
 
   nsRefPtr<nsRange> range = selection->GetRangeAt(0);
   NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
 
   ErrorResult rv;
   nsRefPtr<DocumentFragment> docfrag =
     range->CreateContextualFragment(bodyTag, rv);
-  NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
   NS_ENSURE_TRUE(docfrag, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<nsIContent> child = docfrag->GetFirstChild();
   NS_ENSURE_TRUE(child && child->IsElement(), NS_ERROR_NULL_POINTER);
   
   // Copy all attributes from the div child to current body element
   CloneAttributes(bodyElement, child->AsElement());
   
@@ -2533,23 +2533,32 @@ nsHTMLEditor::CreateElementWithDefaults(
   // Mark the new element dirty, so it will be formatted
   ErrorResult rv;
   newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), EmptyString(), rv);
 
   // Set default values for new elements
   if (tagName.EqualsLiteral("table")) {
     newElement->SetAttribute(NS_LITERAL_STRING("cellpadding"),
                              NS_LITERAL_STRING("2"), rv);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), nullptr);
+    if (NS_WARN_IF(rv.Failed())) {
+      rv.SuppressException();
+      return nullptr;
+    }
     newElement->SetAttribute(NS_LITERAL_STRING("cellspacing"),
                              NS_LITERAL_STRING("2"), rv);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), nullptr);
+    if (NS_WARN_IF(rv.Failed())) {
+      rv.SuppressException();
+      return nullptr;
+    }
     newElement->SetAttribute(NS_LITERAL_STRING("border"),
                              NS_LITERAL_STRING("1"), rv);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), nullptr);
+    if (NS_WARN_IF(rv.Failed())) {
+      rv.SuppressException();
+      return nullptr;
+    }
   } else if (tagName.EqualsLiteral("td")) {
     nsresult res = SetAttributeOrEquivalent(
         static_cast<nsIDOMElement*>(newElement->AsDOMNode()),
         NS_LITERAL_STRING("valign"), NS_LITERAL_STRING("top"), true);
     NS_ENSURE_SUCCESS(res, nullptr);
   }
   // ADD OTHER TAGS HERE
 
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -334,23 +334,23 @@ nsHTMLEditor::SetInlinePropertyOnTextNod
   }
 
   // Do we need to split the text node?
   ErrorResult rv;
   nsRefPtr<Text> text = &aText;
   if (uint32_t(aEndOffset) != aText.Length()) {
     // We need to split off back of text node
     text = SplitNode(aText, aEndOffset, rv)->GetAsText();
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+    NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
   }
 
   if (aStartOffset) {
     // We need to split off front of text node
     SplitNode(*text, aStartOffset, rv);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+    NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
   }
 
   if (aAttribute) {
     // Look for siblings that are correct type of node
     nsIContent* sibling = GetPriorHTMLSibling(text);
     if (IsSimpleModifiableNode(sibling, &aProperty, aAttribute, &aValue)) {
       // Previous sib is already right kind of inline node; slide this over
       return MoveNode(text, sibling, -1);
--- a/editor/libeditor/nsHTMLObjectResizer.cpp
+++ b/editor/libeditor/nsHTMLObjectResizer.cpp
@@ -679,17 +679,17 @@ nsHTMLEditor::SetResizingInfoPosition(in
                                       infoXPosition + mouseCursorOffset);
   mHTMLCSSUtils->SetCSSPropertyPixels(*mResizingInfo, *nsGkAtoms::top,
                                       infoYPosition + mouseCursorOffset);
 
   nsCOMPtr<nsIContent> textInfo = mResizingInfo->GetFirstChild();
   ErrorResult rv;
   if (textInfo) {
     mResizingInfo->RemoveChild(*textInfo, rv);
-    NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+    NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
     textInfo = nullptr;
   }
 
   nsAutoString widthStr, heightStr, diffWidthStr, diffHeightStr;
   widthStr.AppendInt(aW);
   heightStr.AppendInt(aH);
   int32_t diffWidth  = aW - mResizedObjectWidth;
   int32_t diffHeight = aH - mResizedObjectHeight;
@@ -705,17 +705,17 @@ nsHTMLEditor::SetResizingInfoPosition(in
                     NS_LITERAL_STRING(", ") + diffHeightStr +
                     NS_LITERAL_STRING(")"));
 
   nsCOMPtr<nsIDOMText> nodeAsText;
   nsresult res = domdoc->CreateTextNode(info, getter_AddRefs(nodeAsText));
   NS_ENSURE_SUCCESS(res, res);
   textInfo = do_QueryInterface(nodeAsText);
   mResizingInfo->AppendChild(*textInfo, rv);
-  NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
+  NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
 
   res = mResizingInfo->UnsetAttr(kNameSpaceID_None, nsGkAtoms::_class, true);
 
   return res;
 }
 
 nsresult
 nsHTMLEditor::SetShadowPosition(Element* aShadow,
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -1507,17 +1507,17 @@ nsresult mozInlineSpellChecker::DoSpellC
     if (originalRangeCount > 0) {
       // likewise, if this word is inside new text, we won't bother testing
       if (!aStatus->mCreatedRange ||
           !aStatus->mCreatedRange->IsPointInRange(*beginNode, beginOffset, erv)) {
         nsTArray<nsRefPtr<nsRange>> ranges;
         aSpellCheckSelection->GetRangesForInterval(*beginNode, beginOffset,
                                                    *endNode, endOffset,
                                                    true, ranges, erv);
-        ENSURE_SUCCESS(erv, erv.ErrorCode());
+        ENSURE_SUCCESS(erv, erv.StealNSResult());
         for (uint32_t i = 0; i < ranges.Length(); i++)
           RemoveRange(aSpellCheckSelection, ranges[i]);
       }
     }
 
     // some words are special and don't need checking
     if (dontCheckWord)
       continue;
@@ -1747,17 +1747,17 @@ mozInlineSpellChecker::RemoveRange(Selec
   NS_ENSURE_ARG_POINTER(aSpellCheckSelection);
   NS_ENSURE_ARG_POINTER(aRange);
 
   ErrorResult rv;
   aSpellCheckSelection->RemoveRange(*aRange, rv);
   if (!rv.Failed() && mNumWordsInSpellSelection)
     mNumWordsInSpellSelection--;
 
-  return rv.ErrorCode();
+  return rv.StealNSResult();
 }
 
 
 // mozInlineSpellChecker::AddRange
 //
 //    For performance reasons, we have an upper bound on the number of word
 //    ranges we'll add to the spell check selection. Once we reach that upper
 //    bound, stop adding the ranges
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -450,16 +450,17 @@ BasicCompositor::DrawQuad(const gfx::Rec
     RefPtr<DataSourceSurface> source = snapshot->GetDataSurface();
     RefPtr<DataSourceSurface> temp =
       Factory::CreateDataSourceSurface(RoundOut(transformBounds).Size(), SurfaceFormat::B8G8R8A8
 #ifdef MOZ_ENABLE_SKIA
         , true
 #endif
         );
     if (NS_WARN_IF(!temp)) {
+      buffer->PopClip();
       return;
     }
 
     Transform(temp, source, new3DTransform, transformBounds.TopLeft());
 
     transformBounds.MoveTo(0, 0);
     buffer->DrawSurface(temp, transformBounds, transformBounds);
   }
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2119,18 +2119,18 @@ bool
 gfxFont::IsSpaceGlyphInvisible(gfxContext *aRefContext, gfxTextRun *aTextRun)
 {
     if (!mFontEntry->mSpaceGlyphIsInvisibleInitialized &&
         GetAdjustedSize() >= 1.0) {
         gfxGlyphExtents *extents =
             GetOrCreateGlyphExtents(aTextRun->GetAppUnitsPerDevUnit());
         gfxRect glyphExtents;
         mFontEntry->mSpaceGlyphIsInvisible =
-            extents->GetTightGlyphExtentsAppUnits(this, eHorizontal,
-                aRefContext, GetSpaceGlyph(), &glyphExtents) &&
+            extents->GetTightGlyphExtentsAppUnits(this, aRefContext,
+                GetSpaceGlyph(), &glyphExtents) &&
             glyphExtents.IsEmpty();
         mFontEntry->mSpaceGlyphIsInvisibleInitialized = true;
     }
     return mFontEntry->mSpaceGlyphIsInvisible;
 }
 
 gfxFont::RunMetrics
 gfxFont::Measure(gfxTextRun *aTextRun,
@@ -2227,21 +2227,24 @@ gfxFont::Measure(gfxTextRun *aTextRun,
                 uint16_t extentsWidth = extents->GetContainedGlyphWidthAppUnits(glyphIndex);
                 if (extentsWidth != gfxGlyphExtents::INVALID_WIDTH &&
                     aBoundingBoxType == LOOSE_INK_EXTENTS) {
                     UnionRange(x, &advanceMin, &advanceMax);
                     UnionRange(x + direction*extentsWidth, &advanceMin, &advanceMax);
                 } else {
                     gfxRect glyphRect;
                     if (!extents->GetTightGlyphExtentsAppUnits(this,
-                            orientation,
                             aRefContext, glyphIndex, &glyphRect)) {
                         glyphRect = gfxRect(0, metrics.mBoundingBox.Y(),
                             advance, metrics.mBoundingBox.Height());
                     }
+                    if (orientation == eVertical) {
+                        Swap(glyphRect.x, glyphRect.y);
+                        Swap(glyphRect.width, glyphRect.height);
+                    }
                     if (isRTL) {
                         glyphRect -= gfxPoint(advance, 0);
                     }
                     glyphRect += gfxPoint(x, 0);
                     metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
                 }
             }
             x += direction*advance;
@@ -2256,23 +2259,26 @@ gfxFont::Measure(gfxTextRun *aTextRun,
                 uint32_t j;
                 for (j = 0; j < glyphCount; ++j, ++details) {
                     uint32_t glyphIndex = details->mGlyphID;
                     gfxPoint glyphPt(x + details->mXOffset, details->mYOffset);
                     double advance = details->mAdvance;
                     gfxRect glyphRect;
                     if (glyphData->IsMissing() || !extents ||
                         !extents->GetTightGlyphExtentsAppUnits(this,
-                                orientation,
                                 aRefContext, glyphIndex, &glyphRect)) {
                         // We might have failed to get glyph extents due to
                         // OOM or something
                         glyphRect = gfxRect(0, -metrics.mAscent,
                             advance, metrics.mAscent + metrics.mDescent);
                     }
+                    if (orientation == eVertical) {
+                        Swap(glyphRect.x, glyphRect.y);
+                        Swap(glyphRect.width, glyphRect.height);
+                    }
                     if (isRTL) {
                         glyphRect -= gfxPoint(advance, 0);
                     }
                     glyphRect += glyphPt;
                     metrics.mBoundingBox = metrics.mBoundingBox.Union(glyphRect);
                     x += direction*advance;
                 }
             }
@@ -3123,17 +3129,17 @@ gfxFont::GetOrCreateGlyphExtents(int32_t
         // Initialize the extents of a space glyph, assuming that spaces don't
         // render anything!
         glyphExtents->SetContainedGlyphWidthAppUnits(GetSpaceGlyph(), 0);
     }
     return glyphExtents;
 }
 
 void
-gfxFont::SetupGlyphExtents(gfxContext *aContext, Orientation aOrientation, 
+gfxFont::SetupGlyphExtents(gfxContext *aContext,
                            uint32_t aGlyphID, bool aNeedTight,
                            gfxGlyphExtents *aExtents)
 {
     gfxContextMatrixAutoSaveRestore matrixRestore(aContext);
     aContext->SetMatrix(gfxMatrix());
 
     gfxRect svgBounds;
     if (mFontEntry->TryGetSVGData(this) && mFontEntry->HasSVGGlyph(aGlyphID) &&
@@ -3149,17 +3155,17 @@ gfxFont::SetupGlyphExtents(gfxContext *a
 
     cairo_glyph_t glyph;
     glyph.index = aGlyphID;
     glyph.x = 0;
     glyph.y = 0;
     cairo_text_extents_t extents;
     cairo_glyph_extents(aContext->GetCairo(), &glyph, 1, &extents);
 
-    const Metrics& fontMetrics = GetMetrics(aOrientation);
+    const Metrics& fontMetrics = GetMetrics(eHorizontal);
     int32_t appUnitsPerDevUnit = aExtents->GetAppUnitsPerDevUnit();
     if (!aNeedTight && extents.x_bearing >= 0 &&
         extents.y_bearing >= -fontMetrics.maxAscent &&
         extents.height + extents.y_bearing <= fontMetrics.maxDescent) {
         uint32_t appUnitsWidth =
             uint32_t(ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
         if (appUnitsWidth < gfxGlyphExtents::INVALID_WIDTH) {
             aExtents->SetContainedGlyphWidthAppUnits(aGlyphID, uint16_t(appUnitsWidth));
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -1614,18 +1614,17 @@ public:
     nsExpirationState *GetExpirationState() { return &mExpirationState; }
 
     // Get the glyphID of a space
     virtual uint32_t GetSpaceGlyph() = 0;
 
     gfxGlyphExtents *GetOrCreateGlyphExtents(int32_t aAppUnitsPerDevUnit);
 
     // You need to call SetupCairoFont on the aCR just before calling this
-    virtual void SetupGlyphExtents(gfxContext *aContext,
-                                   Orientation aOrientation, uint32_t aGlyphID,
+    virtual void SetupGlyphExtents(gfxContext *aContext, uint32_t aGlyphID,
                                    bool aNeedTight, gfxGlyphExtents *aExtents);
 
     // This is called by the default Draw() implementation above.
     virtual bool SetupCairoFont(gfxContext *aContext) = 0;
 
     virtual bool AllowSubpixelAA() { return true; }
 
     bool IsSyntheticBold() { return mApplySyntheticBold; }
--- a/gfx/thebes/gfxGlyphExtents.cpp
+++ b/gfx/thebes/gfxGlyphExtents.cpp
@@ -31,32 +31,30 @@ gfxGlyphExtents::~gfxGlyphExtents()
         mContainedGlyphWidths.SizeOfExcludingThis(&FontCacheMallocSizeOf);
     gGlyphExtentsCount++;
 #endif
     MOZ_COUNT_DTOR(gfxGlyphExtents);
 }
 
 bool
 gfxGlyphExtents::GetTightGlyphExtentsAppUnits(gfxFont *aFont,
-    gfxFont::Orientation aOrientation,
     gfxContext *aContext, uint32_t aGlyphID, gfxRect *aExtents)
 {
     HashEntry *entry = mTightGlyphExtents.GetEntry(aGlyphID);
     if (!entry) {
         if (!aContext) {
             NS_WARNING("Could not get glyph extents (no aContext)");
             return false;
         }
 
         if (aFont->SetupCairoFont(aContext)) {
 #ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
             ++gGlyphExtentsSetupLazyTight;
 #endif
-            aFont->SetupGlyphExtents(aContext, aOrientation, aGlyphID, true,
-                                     this);
+            aFont->SetupGlyphExtents(aContext, aGlyphID, true, this);
             entry = mTightGlyphExtents.GetEntry(aGlyphID);
         }
         if (!entry) {
             NS_WARNING("Could not get glyph extents");
             return false;
         }
     }
 
--- a/gfx/thebes/gfxGlyphExtents.h
+++ b/gfx/thebes/gfxGlyphExtents.h
@@ -58,17 +58,16 @@ public:
     bool IsGlyphKnownWithTightExtents(uint32_t aGlyphID) const {
         return mTightGlyphExtents.GetEntry(aGlyphID) != nullptr;
     }
 
     // Get glyph extents; a rectangle relative to the left baseline origin
     // Returns true on success. Can fail on OOM or when aContext is null
     // and extents were not (successfully) prefetched.
     bool GetTightGlyphExtentsAppUnits(gfxFont *aFont,
-            gfxFont::Orientation aOrientation,
             gfxContext *aContext, uint32_t aGlyphID, gfxRect *aExtents);
 
     void SetContainedGlyphWidthAppUnits(uint32_t aGlyphID, uint16_t aWidth) {
         mContainedGlyphWidths.Set(aGlyphID, aWidth);
     }
     void SetTightGlyphExtents(uint32_t aGlyphID, const gfxRect& aExtentsAppUnits);
 
     int32_t GetAppUnitsPerDevUnit() { return mAppUnitsPerDevUnit; }
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -1368,35 +1368,33 @@ gfxTextRun::FetchGlyphExtents(gfxContext
         uint32_t end = i + 1 < runCount ?
             mGlyphRuns[i + 1].mCharacterOffset : GetLength();
         bool fontIsSetup = false;
         uint32_t j;
         gfxGlyphExtents *extents = font->GetOrCreateGlyphExtents(mAppUnitsPerDevUnit);
   
         for (j = start; j < end; ++j) {
             const gfxTextRun::CompressedGlyph *glyphData = &charGlyphs[j];
-            gfxFont::Orientation orientation =
-                IsVertical() ? gfxFont::eVertical : gfxFont::eHorizontal;
             if (glyphData->IsSimpleGlyph()) {
                 // If we're in speed mode, don't set up glyph extents here; we'll
                 // just return "optimistic" glyph bounds later
                 if (needsGlyphExtents) {
                     uint32_t glyphIndex = glyphData->GetSimpleGlyph();
                     if (!extents->IsGlyphKnown(glyphIndex)) {
                         if (!fontIsSetup) {
                             if (!font->SetupCairoFont(aRefContext)) {
                                 NS_WARNING("failed to set up font for glyph extents");
                                 break;
                             }
                             fontIsSetup = true;
                         }
 #ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
                         ++gGlyphExtentsSetupEagerSimple;
 #endif
-                        font->SetupGlyphExtents(aRefContext, orientation,
+                        font->SetupGlyphExtents(aRefContext,
                                                 glyphIndex, false, extents);
                     }
                 }
             } else if (!glyphData->IsMissing()) {
                 uint32_t glyphCount = glyphData->GetGlyphCount();
                 if (glyphCount == 0) {
                     continue;
                 }
@@ -1412,17 +1410,17 @@ gfxTextRun::FetchGlyphExtents(gfxContext
                                 NS_WARNING("failed to set up font for glyph extents");
                                 break;
                             }
                             fontIsSetup = true;
                         }
 #ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
                         ++gGlyphExtentsSetupEagerTight;
 #endif
-                        font->SetupGlyphExtents(aRefContext, orientation,
+                        font->SetupGlyphExtents(aRefContext,
                                                 glyphIndex, true, extents);
                     }
                 }
             }
         }
     }
 }
 
--- a/intl/unicharutil/tools/genUnicodePropertyData.pl
+++ b/intl/unicharutil/tools/genUnicodePropertyData.pl
@@ -301,17 +301,21 @@ my %bidicategoryCode = (
   "ON"  => "10", # Other Neutrals
   "LRE" => "11", # Left-to-Right Embedding
   "LRO" => "12", # Left-to-Right Override
   "AL"  => "13", # Right-to-Left Arabic
   "RLE" => "14", # Right-to-Left Embedding
   "RLO" => "15", # Right-to-Left Override
   "PDF" => "16", # Pop Directional Format
   "NSM" => "17", # Non-Spacing Mark
-  "BN"  => "18"  # Boundary Neutral
+  "BN"  => "18", # Boundary Neutral
+  "LRI" => "19", # Left-to-Right Isolate
+  "RLI" => "20", # Right-to-left Isolate
+  "FSI" => "21", # First Strong Isolate
+  "PDI" => "22"  # Pop Direcitonal Isolate
 );
 
 my %verticalOrientationCode = (
   'U' => 0,  #   U - Upright, the same orientation as in the code charts
   'R' => 1,  #   R - Rotated 90 degrees clockwise compared to the code charts
   'Tu' => 2, #   Tu - Transformed typographically, with fallback to Upright
   'Tr' => 3  #   Tr - Transformed typographically, with fallback to Rotated
 );
--- a/intl/unicharutil/util/nsBidiUtils.h
+++ b/intl/unicharutil/util/nsBidiUtils.h
@@ -32,16 +32,20 @@ enum nsCharType   {
   eCharType_LeftToRightEmbedding     = 11,
   eCharType_LeftToRightOverride      = 12,
   eCharType_RightToLeftArabic        = 13,
   eCharType_RightToLeftEmbedding     = 14,
   eCharType_RightToLeftOverride      = 15,
   eCharType_PopDirectionalFormat     = 16,
   eCharType_DirNonSpacingMark        = 17,
   eCharType_BoundaryNeutral          = 18,
+  eCharType_LeftToRightIsolate       = 19,
+  eCharType_RightToLeftIsolate       = 20,
+  eCharType_FirstStrongIsolate       = 21,
+  eCharType_PopDirectionalIsolate    = 22,
   eCharType_CharTypeCount
 };
 
 /**
  * This specifies the language directional property of a character set.
  */
 typedef enum nsCharType nsCharType;
 
--- a/intl/unicharutil/util/nsUnicodePropertyData.cpp
+++ b/intl/unicharutil/util/nsUnicodePropertyData.cpp
@@ -6,17 +6,17 @@
 
 /*
  * Derived from the Unicode Character Database by genUnicodePropertyData.pl
  *
  * For Unicode terms of use, see http://www.unicode.org/terms_of_use.html
  */
 
 /*
- * Created on Tue Sep 23 08:31:06 2014 from UCD data files with version info:
+ * Created on Tue Apr  7 00:14:33 2015 from UCD data files with version info:
  *
 
 # Date: 2014-06-12, 20:18:00 GMT [KW]
 #
 # Unicode Character Database
 # Copyright (c) 1991-2014 Unicode, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
@@ -39,19 +39,19 @@ Standard.
 # Date: 2014-02-28, 23:15:00 GMT [KW, LI]
 
 # BidiMirroring-7.0.0.txt
 # Date: 2013-12-17, 00:00:00 GMT [KW, LI]
 
 # HangulSyllableType-7.0.0.txt
 # Date: 2013-11-27, 09:54:39 GMT [MD]
 
-# File: xidmodifications.txt
-# Version: 7.0.0
-# Generated: 2014-07-23, 12:42:33 GMT
+# File: xidmodifications.txt
+# Version: 7.0.0
+# Generated: 2014-09-09, 13:36:12 GMT
 
 #
 # Unihan_Variants.txt
 # Date: 2014-05-09 18:17:02 GMT [JHJ]
 
 # VerticalOrientation-13.txt
 # Date: 2014-09-03, 17:30:00 GMT [EM, KI, LI]
 
@@ -428,25 +428,25 @@ static const nsCharProps2 sCharProp2Valu
   {{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{5,3,24,10,6,-1,0},{5,3,24,10,6,-1,0},{0,3,6,10,1,-1,1},{0,3,24,10,6,-1,1},{0,3,6,0,8,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1},{0,3,24,10,6,-1,1}},
   {{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1}},
   {{1,0,12,17,8,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1}},
   {{1,0,12,17,5,-1,1},{1,0,12,17,5,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,5,-1,1},{1,0,12,17,5,-1,1},{1,0,12,17,1,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,2,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,4,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1}},
   {{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,8,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{1,0,12,17,3,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{0,3,6,10,5,-1,1},{14,3,24,10,0,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{14,3,6,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{0,3,21,10,5,-1,1},{14,3,9,0,3,-1,1}},
   {{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{14,3,24,10,5,-1,1},{0,3,24,10,5,-1,1},{14,3,9,0,1,-1,1},{0,3,21,10,5,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{61,0,2,0,9,-1,1},{14,3,9,0,1,-1,1},{61,0,2,0,9,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,5,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1}},
   {{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{61,0,2,0,9,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,0,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1}},
   {{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,0,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,8,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,8,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1}},
-  {{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,8,-1,1},{14,3,9,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,25,10,6,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1}},
+  {{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{7,3,9,0,3,-1,1},{7,3,5,0,3,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,5,-1,1},{14,3,5,0,5,-1,1},{14,3,25,10,6,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,3,-1,1},{14,3,5,0,3,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1}},
   {{8,3,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1}},
   {{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,9,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1}},
   {{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,0,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1}},
   {{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1}},
   {{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,26,0,6,-1,1},{8,3,12,17,3,-1,1},{8,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{8,3,12,17,3,-1,1},{8,3,11,17,6,-1,1},{8,3,11,17,6,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1}},
   {{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1}},
   {{8,3,9,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1}},
-  {{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,4,-1,1},{8,3,5,0,4,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,4,-1,1},{8,3,5,0,4,-1,1},{61,0,2,0,9,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1}},
+  {{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,3,-1,1},{8,3,5,0,3,-1,1},{8,3,9,0,1,-1,1},{8,3,5,0,1,-1,1},{61,0,2,0,9,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1}},
   {{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{3,3,9,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{3,3,6,0,1,-1,1},{3,3,21,0,6,-1,1},{3,3,21,0,6,-1,1},{3,3,21,0,6,-1,1},{3,3,21,0,6,-1,1},{3,3,21,0,6,-1,1},{3,3,21,0,6,-1,1}},
   {{61,0,2,0,9,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1}},
   {{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,1,-1,1},{3,3,5,0,5,-1,1},{61,0,2,0,9,-1,1},{0,3,21,0,6,-1,1},{3,3,17,10,0,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{3,3,26,10,6,-1,1},{3,3,26,10,6,-1,1},{3,3,23,4,6,-1,1},{61,0,2,1,9,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1}},
   {{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,1,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,17,1,6,-1,1},{19,3,12,17,4,-1,1}},
   {{19,3,21,1,6,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,21,1,6,-1,1},{19,3,12,17,4,-1,1},{19,3,12,17,4,-1,1},{19,3,21,1,6,-1,1},{19,3,12,17,4,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1}},
   {{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,7,1,1,-1,1},{19,3,21,1,0,-1,1},{19,3,21,1,0,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1}},
   {{2,3,1,5,6,-1,1},{2,3,1,5,6,-1,1},{2,3,1,5,6,-1,1},{2,3,1,5,6,-1,1},{2,3,1,5,6,-1,1},{0,3,1,5,6,-1,1},{2,3,25,10,6,-1,1},{2,3,25,10,6,-1,1},{2,3,25,13,6,-1,1},{2,3,21,4,6,-1,1},{2,3,21,4,6,-1,1},{2,3,23,13,6,-1,1},{0,3,21,6,6,-1,1},{2,3,21,13,6,-1,1},{2,3,26,10,6,-1,1},{2,3,26,10,6,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{0,3,21,13,6,-1,1},{0,3,1,13,2,-1,1},{61,0,2,13,9,-1,1},{2,3,21,13,6,-1,1},{0,3,21,13,6,-1,1}},
   {{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1}},
@@ -461,17 +461,17 @@ static const nsCharProps2 sCharProp2Valu
   {{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1}},
   {{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,7,13,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,12,17,1,-1,1},{37,3,7,13,1,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1}},
   {{66,3,13,1,4,0,1},{66,3,13,1,4,1,1},{66,3,13,1,4,2,1},{66,3,13,1,4,3,1},{66,3,13,1,4,4,1},{66,3,13,1,4,5,1},{66,3,13,1,4,6,1},{66,3,13,1,4,7,1},{66,3,13,1,4,8,1},{66,3,13,1,4,9,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1}},
   {{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,7,1,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,12,17,4,-1,1},{66,3,6,1,4,-1,1},{66,3,6,1,4,-1,1},{66,3,26,10,6,-1,1},{66,3,21,10,6,-1,1},{66,3,21,10,6,-1,1},{66,3,21,10,6,-1,1},{66,3,6,1,4,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1}},
   {{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,7,1,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,6,1,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1}},
   {{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,6,1,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,6,1,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{90,3,12,17,3,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{90,3,21,1,6,-1,1},{61,0,2,1,9,-1,1}},
   {{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,7,1,4,-1,1},{95,3,12,17,4,-1,1},{95,3,12,17,4,-1,1},{95,3,12,17,4,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{95,3,21,1,6,-1,1},{61,0,2,1,9,-1,1}},
   {{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1},{61,0,2,1,9,-1,1}},
-  {{2,3,7,13,1,-1,1},{2,3,7,13,4,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,4,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1}},
+  {{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,1,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,3,-1,1},{2,3,7,13,1,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1}},
   {{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1}},
   {{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{61,0,2,13,9,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1},{2,3,12,17,4,-1,1}},
   {{10,3,12,17,4,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,10,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1}},
   {{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,12,17,1,-1,1},{10,3,10,0,1,-1,1},{10,3,12,17,1,-1,1},{10,3,7,0,1,-1,1},{10,3,10,0,1,-1,1},{10,3,10,0,1,-1,1}},
   {{10,3,10,0,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,10,0,1,-1,1},{10,3,10,0,1,-1,1},{10,3,10,0,1,-1,1},{10,3,10,0,1,-1,1},{10,3,12,17,1,-1,1},{10,3,10,0,3,-1,1},{10,3,10,0,1,-1,1},{10,3,7,0,1,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{10,3,12,17,8,-1,1},{10,3,12,17,8,-1,1},{10,3,12,17,4,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1},{10,3,7,0,5,-1,1}},
   {{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,12,17,1,-1,1},{10,3,12,17,1,-1,1},{0,3,21,0,6,-1,1},{0,3,21,0,6,-1,1},{10,3,13,0,1,0,1},{10,3,13,0,1,1,1},{10,3,13,0,1,2,1},{10,3,13,0,1,3,1},{10,3,13,0,1,4,1},{10,3,13,0,1,5,1},{10,3,13,0,1,6,1},{10,3,13,0,1,7,1},{10,3,13,0,1,8,1},{10,3,13,0,1,9,1},{10,3,21,0,6,-1,1},{10,3,6,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1},{10,3,7,0,1,-1,1}},
   {{4,3,7,0,3,-1,1},{4,3,12,17,1,-1,1},{4,3,10,0,1,-1,1},{4,3,10,0,1,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1}},
   {{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{4,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{4,3,12,17,1,-1,1},{4,3,7,0,1,-1,1},{4,3,10,0,1,-1,1},{4,3,10,0,1,-1,1}},
@@ -612,17 +612,17 @@ static const nsCharProps2 sCharProp2Valu
   {{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1}},
   {{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,8,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{61,0,2,0,9,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,8,0,1,-1,1},{14,3,24,10,5,-1,1},{14,3,5,0,5,-1,1},{14,3,24,10,5,-1,1}},
   {{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{61,0,2,0,9,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,8,0,1,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{61,0,2,0,9,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1}},
   {{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,5,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,1,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{61,0,2,0,9,-1,1},{14,3,5,0,1,-1,1},{14,3,5,0,1,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,9,0,1,-1,1},{14,3,9,0,5,-1,1},{14,3,8,0,1,-1,1},{14,3,24,10,5,-1,1},{14,3,24,10,5,-1,1},{61,0,2,0,9,-1,1}},
   {{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,29,9,5,-1,1},{0,3,1,18,2,-1,1},{1,3,1,18,0,-1,1},{1,3,1,18,0,-1,1},{0,3,1,0,2,-1,1},{0,3,1,1,2,-1,1},{0,0,17,10,0,-1,1},{0,3,17,10,5,-1,1},{0,3,17,10,6,-1,1},{0,0,17,10,6,-1,1},{0,0,17,10,6,-1,1},{0,0,17,10,6,-1,1},{0,0,21,10,6,-1,0},{0,3,21,10,5,-1,1},{0,0,20,10,6,-1,1},{0,0,19,10,0,-1,1},{0,3,22,10,6,-1,1},{0,3,20,10,6,-1,1},{0,0,20,10,6,-1,1},{0,0,19,10,6,-1,1},{0,3,22,10,6,-1,1},{0,3,20,10,6,-1,1}},
   {{0,0,21,10,6,-1,0},{0,0,21,10,6,-1,0},{0,0,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,0,21,10,5,-1,1},{0,0,21,10,5,-1,1},{0,0,21,10,5,-1,1},{0,0,21,10,0,-1,1},{0,3,27,9,6,-1,1},{0,3,28,7,6,-1,1},{0,3,1,11,2,-1,1},{0,3,1,14,2,-1,1},{0,3,1,16,2,-1,1},{0,3,1,12,2,-1,1},{0,3,1,15,2,-1,1},{0,3,29,6,5,-1,1},{0,0,21,4,6,-1,0},{0,3,21,4,6,-1,0},{0,0,21,4,6,-1,1},{0,0,21,4,5,-1,1},{0,3,21,4,5,-1,1},{0,0,21,10,6,-1,1},{0,3,21,10,5,-1,1},{0,3,21,10,5,-1,1},{0,3,21,10,6,-1,1},{0,3,20,10,6,-1,1},{0,3,19,10,6,-1,1},{0,0,21,10,6,-1,0},{0,3,21,10,5,-1,0},{0,3,21,10,6,-1,1},{0,0,21,10,5,-1,1},{0,3,16,10,8,-1,1}},
   {{0,3,16,10,8,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,0},{0,3,21,10,6,-1,1},{0,3,25,6,6,-1,1},{0,3,22,10,6,-1,1},{0,3,18,10,6,-1,1},{0,3,21,10,5,-1,0},{0,3,21,10,5,-1,0},{0,3,21,10,5,-1,0},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,0},{0,3,25,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,16,10,4,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,5,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,21,10,6,-1,1},{0,3,29,9,5,-1,1}},
-  {{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{61,0,2,0,2,-1,0},{0,3,1,0,2,-1,1},{0,3,1,0,2,-1,1},{0,3,1,0,2,-1,1},{0,3,1,0,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,15,2,5,0,1},{25,3,6,0,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{0,0,15,2,5,4,1},{0,3,15,2,5,5,1},{0,3,15,2,5,6,1},{0,3,15,2,5,7,1},{0,3,15,2,5,8,1},{0,3,15,2,5,9,1},{0,3,25,3,5,-1,1},{0,3,25,3,5,-1,1},{0,3,25,10,5,-1,1},{0,3,22,10,5,-1,1},{0,3,18,10,5,-1,1},{25,0,6,0,5,-1,1}},
+  {{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{61,0,2,0,2,-1,0},{0,3,1,19,2,-1,1},{0,3,1,20,2,-1,1},{0,3,1,21,2,-1,1},{0,3,1,22,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,1,18,2,-1,1},{0,3,15,2,5,0,1},{25,3,6,0,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{0,0,15,2,5,4,1},{0,3,15,2,5,5,1},{0,3,15,2,5,6,1},{0,3,15,2,5,7,1},{0,3,15,2,5,8,1},{0,3,15,2,5,9,1},{0,3,25,3,5,-1,1},{0,3,25,3,5,-1,1},{0,3,25,10,5,-1,1},{0,3,22,10,5,-1,1},{0,3,18,10,5,-1,1},{25,0,6,0,5,-1,1}},
   {{0,3,15,2,5,0,1},{0,0,15,2,5,1,1},{0,0,15,2,5,2,1},{0,0,15,2,5,3,1},{0,0,15,2,5,4,1},{0,3,15,2,5,5,1},{0,3,15,2,5,6,1},{0,3,15,2,5,7,1},{0,3,15,2,5,8,1},{0,3,15,2,5,9,1},{0,3,25,3,5,-1,1},{0,3,25,3,5,-1,1},{0,3,25,10,5,-1,1},{0,3,22,10,5,-1,1},{0,3,18,10,5,-1,1},{61,0,2,0,9,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,5,-1,1},{0,2,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,0,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{0,3,23,4,6,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1}},
   {{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{61,0,2,4,9,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,11,17,6,-1,0},{1,3,11,17,6,-1,0},{1,3,11,17,6,-1,0}},
   {{1,3,11,17,6,-1,0},{1,3,12,17,3,-1,1},{1,3,11,17,6,-1,0},{1,3,11,17,6,-1,0},{1,3,11,17,6,-1,0},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{1,3,12,17,3,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{0,3,26,10,5,-1,0},{0,3,26,10,5,-1,0},{0,3,9,0,5,-1,1},{0,0,26,10,5,-1,0},{0,3,26,10,6,-1,0},{0,0,26,10,5,-1,0},{0,3,26,10,5,-1,0},{0,3,9,0,5,-1,0},{0,3,26,10,6,-1,0},{0,0,26,10,5,-1,0},{0,3,5,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,5,0,5,-1,1},{0,3,5,0,5,-1,0},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,0,5,0,5,-1,0},{0,3,26,10,6,-1,0},{0,3,9,0,5,-1,1},{0,0,26,10,5,-1,0},{0,3,26,10,6,-1,0},{0,3,25,10,8,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,26,10,6,-1,0},{0,3,26,10,6,-1,0}},
   {{0,3,26,10,5,-1,0},{0,0,26,10,5,-1,0},{0,0,26,10,5,-1,0},{0,3,26,10,6,-1,0},{0,3,9,0,5,-1,1},{0,3,26,10,6,-1,0},{14,0,9,0,5,-1,1},{0,3,26,10,6,-1,0},{0,3,9,0,5,-1,1},{0,3,26,10,6,-1,0},{25,3,9,0,5,-1,1},{25,0,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,26,4,8,-1,0},{0,3,5,0,5,-1,1},{0,3,9,0,5,-1,1},{0,3,9,0,5,-1,1},{25,3,9,0,3,-1,1},{0,3,9,0,5,-1,1},{0,3,5,0,5,-1,1},{0,3,7,0,5,-1,0},{0,3,7,0,5,-1,0},{0,3,7,0,5,-1,0},{0,3,7,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,26,10,6,-1,0},{0,3,26,10,5,-1,0},{0,3,5,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,9,0,5,-1,0},{0,3,9,0,5,-1,0}},
   {{0,3,25,10,5,-1,1},{0,3,25,10,6,-1,1},{0,3,25,10,6,-1,1},{0,3,25,10,6,-1,1},{0,3,25,10,6,-1,1},{0,3,9,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,5,0,5,-1,0},{0,3,26,10,6,-1,0},{0,3,25,10,6,-1,1},{0,3,26,10,6,-1,0},{0,3,26,10,6,-1,0},{25,3,5,0,3,-1,1},{0,3,26,0,6,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,3,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,0,15,10,5,-1,0},{0,3,15,10,5,-1,0}},
   {{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,0,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0},{25,3,14,0,5,-1,0}},
@@ -773,21 +773,21 @@ static const nsCharProps2 sCharProp2Valu
   {{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,12,17,3,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,3,-1,1},{10,3,7,0,3,-1,1},{10,3,21,0,6,-1,1},{10,3,21,0,6,-1,1},{10,3,21,0,6,-1,1},{10,3,7,0,3,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{67,3,13,0,4,0,1},{67,3,13,0,4,1,1},{67,3,13,0,4,2,1},{67,3,13,0,4,3,1},{67,3,13,0,4,4,1},{67,3,13,0,4,5,1},{67,3,13,0,4,6,1},{67,3,13,0,4,7,1},{67,3,13,0,4,8,1},{67,3,13,0,4,9,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1}},
   {{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,7,0,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{67,3,12,17,4,-1,1},{0,3,21,0,6,-1,1},{67,3,21,0,6,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1}},
   {{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,7,0,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,12,17,3,-1,1},{69,3,10,0,3,-1,1},{69,3,10,0,3,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{69,3,21,0,6,-1,1}},
   {{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{18,5,7,0,3,-1,0},{61,0,2,0,9,-1,0},{61,0,2,0,9,-1,0},{61,0,2,0,9,-1,0}},
   {{84,3,12,17,4,-1,1},{84,3,12,17,4,-1,1},{84,3,12,17,4,-1,1},{84,3,10,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1}},
   {{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,7,0,4,-1,1},{84,3,12,17,4,-1,1},{84,3,10,0,4,-1,1},{84,3,10,0,4,-1,1},{84,3,12,17,4,-1,1},{84,3,12,17,4,-1,1},{84,3,12,17,4,-1,1},{84,3,12,17,4,-1,1},{84,3,10,0,4,-1,1},{84,3,10,0,4,-1,1},{84,3,12,17,4,-1,1},{84,3,10,0,4,-1,1},{84,3,10,0,4,-1,1},{84,3,10,0,4,-1,1}},
   {{84,3,10,0,4,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1},{61,0,2,0,9,-1,1},{0,3,6,0,3,-1,1},{84,3,13,0,4,0,1},{84,3,13,0,4,1,1},{84,3,13,0,4,2,1},{84,3,13,0,4,3,1},{84,3,13,0,4,4,1},{84,3,13,0,4,5,1},{84,3,13,0,4,6,1},{84,3,13,0,4,7,1},{84,3,13,0,4,8,1},{84,3,13,0,4,9,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{84,3,21,0,6,-1,1},{84,3,21,0,6,-1,1}},
-  {{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,12,17,3,-1,1},{28,3,6,0,3,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,13,0,4,0,1},{28,3,13,0,4,1,1},{28,3,13,0,4,2,1},{28,3,13,0,4,3,1},{28,3,13,0,4,4,1},{28,3,13,0,4,5,1},{28,3,13,0,4,6,1},{28,3,13,0,4,7,1},{28,3,13,0,4,8,1},{28,3,13,0,4,9,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1},{61,0,2,0,9,-1,1}},
+  {{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,7,0,3,-1,1},{28,3,12,17,3,-1,1},{28,3,6,0,3,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,13,0,1,0,1},{28,3,13,0,1,1,1},{28,3,13,0,1,2,1},{28,3,13,0,1,3,1},{28,3,13,0,1,4,1},{28,3,13,0,1,5,1},{28,3,13,0,1,6,1},{28,3,13,0,1,7,1},{28,3,13,0,1,8,1},{28,3,13,0,1,9,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{61,0,2,0,9,-1,1}},
   {{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1}},
   {{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,10,0,4,-1,1},{72,3,10,0,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{72,3,10,0,4,-1,1},{72,3,10,0,4,-1,1},{72,3,12,17,4,-1,1},{72,3,12,17,4,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,12,17,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,7,0,4,-1,1},{72,3,12,17,4,-1,1},{72,3,10,0,4,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{72,3,13,0,4,0,1},{72,3,13,0,4,1,1},{72,3,13,0,4,2,1},{72,3,13,0,4,3,1},{72,3,13,0,4,4,1},{72,3,13,0,4,5,1},{72,3,13,0,4,6,1},{72,3,13,0,4,7,1},{72,3,13,0,4,8,1},{72,3,13,0,4,9,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{72,3,21,0,6,-1,1},{72,3,21,0,6,-1,1},{72,3,21,0,6,-1,1},{72,3,21,0,6,-1,1}},
-  {{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,6,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,26,0,6,-1,1},{28,3,26,0,6,-1,1},{28,3,26,0,6,-1,1},{28,3,7,0,1,-1,1},{28,3,10,0,1,-1,1},{28,3,12,17,4,-1,1},{28,3,10,0,4,-1,1},{28,3,7,0,4,-1,1},{28,3,7,0,4,-1,1}},
+  {{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,6,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,26,0,6,-1,1},{28,3,26,0,6,-1,1},{28,3,26,0,6,-1,1},{28,3,7,0,1,-1,1},{28,3,10,0,1,-1,1},{28,3,12,17,1,-1,1},{28,3,10,0,1,-1,1},{28,3,7,0,1,-1,1},{28,3,7,0,1,-1,1}},
   {{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1}},
   {{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,12,17,4,-1,1},{92,3,7,0,4,-1,1},{92,3,12,17,4,-1,1},{92,3,12,17,4,-1,1},{92,3,12,17,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,12,17,4,-1,1},{92,3,12,17,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,12,17,4,-1,1},{92,3,12,17,4,-1,1}},
   {{92,3,7,0,4,-1,1},{92,3,12,17,4,-1,1},{92,3,7,0,4,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{92,3,7,0,4,-1,1},{92,3,7,0,4,-1,1},{92,3,6,0,4,-1,1},{92,3,21,0,6,-1,1},{92,3,21,0,6,-1,1}},
   {{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,7,0,4,-1,1},{87,3,10,0,4,-1,1},{87,3,12,17,4,-1,1},{87,3,12,17,4,-1,1},{87,3,10,0,4,-1,1},{87,3,10,0,4,-1,1},{87,3,21,0,6,-1,1},{87,3,21,0,6,-1,1},{87,3,7,0,4,-1,1},{87,3,6,0,4,-1,1},{87,3,6,0,4,-1,1},{87,3,10,0,4,-1,1},{87,3,12,17,4,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{61,0,2,0,9,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
   {{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{11,3,7,0,1,-1,1},{61,0,2,0,9,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1}},
   {{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{25,3,5,0,3,-1,1},{0,3,24,0,6,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1},{25,3,6,0,5,-1,1}},
   {{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{25,3,5,0,3,-1,1},{14,3,5,0,3,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1},{61,0,2,0,9,-1,1}},
--- a/intl/unicharutil/util/nsUnicodeScriptCodes.h
+++ b/intl/unicharutil/util/nsUnicodeScriptCodes.h
@@ -6,17 +6,17 @@
 
 /*
  * Derived from the Unicode Character Database by genUnicodePropertyData.pl
  *
  * For Unicode terms of use, see http://www.unicode.org/terms_of_use.html
  */
 
 /*
- * Created on Tue Sep 23 08:31:06 2014 from UCD data files with version info:
+ * Created on Tue Apr  7 00:14:33 2015 from UCD data files with version info:
  *
 
 # Date: 2014-06-12, 20:18:00 GMT [KW]
 #
 # Unicode Character Database
 # Copyright (c) 1991-2014 Unicode, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
@@ -39,19 +39,19 @@ Standard.
 # Date: 2014-02-28, 23:15:00 GMT [KW, LI]
 
 # BidiMirroring-7.0.0.txt
 # Date: 2013-12-17, 00:00:00 GMT [KW, LI]
 
 # HangulSyllableType-7.0.0.txt
 # Date: 2013-11-27, 09:54:39 GMT [MD]
 
-# File: xidmodifications.txt
-# Version: 7.0.0
-# Generated: 2014-07-23, 12:42:33 GMT
+# File: xidmodifications.txt
+# Version: 7.0.0
+# Generated: 2014-09-09, 13:36:12 GMT
 
 #
 # Unihan_Variants.txt
 # Date: 2014-05-09 18:17:02 GMT [JHJ]
 
 # VerticalOrientation-13.txt
 # Date: 2014-09-03, 17:30:00 GMT [EM, KI, LI]
 
--- a/js/src/builtin/SIMD.cpp
+++ b/js/src/builtin/SIMD.cpp
@@ -58,25 +58,44 @@ js::IsVectorObject(HandleValue v)
 {
     return CheckVectorObject(v, V::type);
 }
 
 template bool js::IsVectorObject<Int32x4>(HandleValue v);
 template bool js::IsVectorObject<Float32x4>(HandleValue v);
 template bool js::IsVectorObject<Float64x2>(HandleValue v);
 
+static inline bool
+ErrorBadArgs(JSContext* cx)
+{
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
+    return false;
+}
+
+static inline bool
+ErrorWrongTypeArg(JSContext* cx, size_t argIndex, Handle<TypeDescr*> typeDescr)
+{
+    MOZ_ASSERT(argIndex < 10);
+    char charArgIndex[2];
+    JS_snprintf(charArgIndex, sizeof charArgIndex, "%d", argIndex);
+
+    HeapSlot& typeNameSlot = typeDescr->getReservedSlotRef(JS_DESCR_SLOT_STRING_REPR);
+    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR,
+                         JS_EncodeString(cx, typeNameSlot.toString()), charArgIndex);
+    return false;
+}
+
 template<typename V>
 bool
 js::ToSimdConstant(JSContext* cx, HandleValue v, jit::SimdConstant* out)
 {
     typedef typename V::Elem Elem;
-    if (!IsVectorObject<V>(v)) {
-        JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_SIMD_NOT_A_VECTOR);
-        return false;
-    }
+    Rooted<TypeDescr*> typeDescr(cx, &V::GetTypeDescr(*cx->global()));
+    if (!IsVectorObject<V>(v))
+        return ErrorWrongTypeArg(cx, 1, typeDescr);
 
     Elem* mem = reinterpret_cast<Elem*>(v.toObject().as<TypedObject>().typedMem());
     *out = jit::SimdConstant::CreateX4(mem);
     return true;
 }
 
 template bool js::ToSimdConstant<Int32x4>(JSContext* cx, HandleValue v, jit::SimdConstant* out);
 template bool js::ToSimdConstant<Float32x4>(JSContext* cx, HandleValue v, jit::SimdConstant* out);
@@ -617,23 +636,16 @@ struct ShiftRightArithmetic {
 };
 struct ShiftRightLogical {
     static int32_t apply(int32_t v, int32_t bits) {
         return uint32_t(bits) >= 32 ? 0 : uint32_t(v) >> bits;
     }
 };
 }
 
-static inline bool
-ErrorBadArgs(JSContext* cx)
-{
-    JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_TYPED_ARRAY_BAD_ARGS);
-    return false;
-}
-
 template<typename Out>
 static bool
 StoreResult(JSContext* cx, CallArgs& args, typename Out::Elem* result)
 {
     RootedObject obj(cx, CreateSimd<Out>(cx, result));
     if (!obj)
         return false;
     args.rval().setObject(*obj);
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -304,17 +304,17 @@ MSG_DEF(JSMSG_SEMI_AFTER_FOR_COND,     0
 MSG_DEF(JSMSG_SEMI_AFTER_FOR_INIT,     0, JSEXN_SYNTAXERR, "missing ; after for-loop initializer")
 MSG_DEF(JSMSG_SEMI_BEFORE_STMNT,       0, JSEXN_SYNTAXERR, "missing ; before statement")
 MSG_DEF(JSMSG_SOURCE_TOO_LONG,         0, JSEXN_RANGEERR, "source is too long")
 MSG_DEF(JSMSG_STMT_AFTER_SEMI_LESS,    0, JSEXN_SYNTAXERR, "unreachable expression after semicolon-less return statement")
 MSG_DEF(JSMSG_STRICT_CODE_LET_EXPR_STMT, 0, JSEXN_ERR, "strict mode code may not contain unparenthesized let expression statements")
 MSG_DEF(JSMSG_STRICT_CODE_WITH,        0, JSEXN_SYNTAXERR, "strict mode code may not contain 'with' statements")
 MSG_DEF(JSMSG_STRICT_FUNCTION_STATEMENT, 0, JSEXN_SYNTAXERR, "in strict mode code, functions may be declared only at top level or immediately within another function")
 MSG_DEF(JSMSG_TEMPLSTR_UNTERM_EXPR,    0, JSEXN_SYNTAXERR, "missing } in template string")
-MSG_DEF(JSMSG_SIMD_NOT_A_VECTOR,       0, JSEXN_TYPEERR, "value isn't a SIMD value object")
+MSG_DEF(JSMSG_SIMD_NOT_A_VECTOR,       2, JSEXN_TYPEERR, "expecting a SIMD {0} object as argument {1}")
 MSG_DEF(JSMSG_TOO_MANY_CASES,          0, JSEXN_INTERNALERR, "too many switch cases")
 MSG_DEF(JSMSG_TOO_MANY_CATCH_VARS,     0, JSEXN_SYNTAXERR, "too many catch variables")
 MSG_DEF(JSMSG_TOO_MANY_CON_ARGS,       0, JSEXN_SYNTAXERR, "too many constructor arguments")
 MSG_DEF(JSMSG_TOO_MANY_DEFAULTS,       0, JSEXN_SYNTAXERR, "more than one switch default")
 MSG_DEF(JSMSG_TOO_MANY_FUN_ARGS,       0, JSEXN_SYNTAXERR, "too many function arguments")
 MSG_DEF(JSMSG_TOO_MANY_LOCALS,         0, JSEXN_SYNTAXERR, "too many local variables")
 MSG_DEF(JSMSG_TOO_MANY_YIELDS,         0, JSEXN_SYNTAXERR, "too many yield expressions")
 MSG_DEF(JSMSG_TOUGH_BREAK,             0, JSEXN_SYNTAXERR, "unlabeled break must be inside loop or switch")
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -1292,31 +1292,19 @@ pre_call_clean_up:
 
         if (type_tag == nsXPTType::T_INTERFACE) {
             if (NS_FAILED(GetInterfaceInfo()->
                           GetIIDForParamNoAlloc(methodIndex, &param,
                                                 &param_iid)))
                 break;
         }
 
-// see bug #961488
-#if (defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(_AIX)) && \
-    ((defined(__sparc) && !defined(__sparcv9) && !defined(__sparcv9__)) || \
-    (defined(__powerpc__) && !defined (__powerpc64__)))
-        if (type_tag == nsXPTType::T_JSVAL) {
-            if (!XPCConvert::JSData2Native(*(void**)(&pv->val), val, type,
-                                           &param_iid, nullptr))
-                break;
-        } else
-#endif
-        {
-            if (!XPCConvert::JSData2Native(&pv->val, val, type,
-                                           &param_iid, nullptr))
-                break;
-        }
+        if (!XPCConvert::JSData2Native(&pv->val, val, type,
+                                       &param_iid, nullptr))
+            break;
     }
 
     // if any params were dependent, then we must iterate again to convert them.
     if (foundDependentParam && i == paramCount) {
         for (i = 0; i < paramCount; i++) {
             const nsXPTParamInfo& param = info->params[i];
             if (!param.IsOut())
                 continue;
--- a/layout/base/nsBidi.cpp
+++ b/layout/base/nsBidi.cpp
@@ -32,16 +32,20 @@ enum {
     LRE = eCharType_LeftToRightEmbedding,
     LRO = eCharType_LeftToRightOverride,
     AL =  eCharType_RightToLeftArabic,
     RLE = eCharType_RightToLeftEmbedding,
     RLO = eCharType_RightToLeftOverride,
     PDF = eCharType_PopDirectionalFormat,
     NSM = eCharType_DirNonSpacingMark,
     BN =  eCharType_BoundaryNeutral,
+    LRI = eCharType_LeftToRightIsolate,
+    RLI = eCharType_RightToLeftIsolate,
+    FSI = eCharType_FirstStrongIsolate,
+    PDI = eCharType_PopDirectionalIsolate,
     dirPropCount
 };
 
 /* to avoid some conditional statements, use tiny constant arrays */
 static Flags flagLR[2]={ DIRPROP_FLAG(L), DIRPROP_FLAG(R) };
 static Flags flagE[2]={ DIRPROP_FLAG(LRE), DIRPROP_FLAG(RLE) };
 static Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
 
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1552,19 +1552,19 @@ nsBlockFrame::ComputeFinalSize(const nsH
       // height in the current frame, not whether it's last-in-flow.
     }
 
     // Don't carry out a block-end margin when our BSize is fixed.
     aMetrics.mCarriedOutBEndMargin.Zero();
   }
   else if (NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
     nscoord contentBSize = blockEndEdgeOfChildren - borderPadding.BStart(wm);
-    nscoord autoBSize = aReflowState.ApplyMinMaxHeight(contentBSize);
+    nscoord autoBSize = aReflowState.ApplyMinMaxBSize(contentBSize);
     if (autoBSize != contentBSize) {
-      // Our min-height or max-height made our height change.  Don't carry out
+      // Our min- or max-bsize value made our bsize change.  Don't carry out
       // our kids' block-end margins.
       aMetrics.mCarriedOutBEndMargin.Zero();
     }
     autoBSize += borderPadding.BStart(wm) + borderPadding.BEnd(wm);
     finalSize.BSize(wm) = autoBSize;
   }
   else {
     NS_ASSERTION(aReflowState.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -35,16 +35,20 @@ using namespace mozilla::gfx;
 nsPageFrame*
 NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsPageFrame(aContext);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPageFrame)
 
+NS_QUERYFRAME_HEAD(nsPageFrame)
+  NS_QUERYFRAME_ENTRY(nsPageFrame)
+NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
+
 nsPageFrame::nsPageFrame(nsStyleContext* aContext)
 : nsContainerFrame(aContext)
 {
 }
 
 nsPageFrame::~nsPageFrame()
 {
 }
@@ -475,43 +479,47 @@ static gfx::Matrix4x4 ComputePageTransfo
 {
   float scale = aFrame->PresContext()->GetPageScale();
   return gfx::Matrix4x4::Scaling(scale, scale, 1);
 }
 
 class nsDisplayHeaderFooter : public nsDisplayItem {
 public:
   nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame *aFrame)
-    : nsDisplayItem(aBuilder, aFrame), mFrame(aFrame)
+    : nsDisplayItem(aBuilder, aFrame)
     , mDisableSubpixelAA(false)
   {
     MOZ_COUNT_CTOR(nsDisplayHeaderFooter);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayHeaderFooter() {
     MOZ_COUNT_DTOR(nsDisplayHeaderFooter);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      nsRenderingContext* aCtx) override {
-    mFrame->PaintHeaderFooter(*aCtx, ToReferenceFrame(), mDisableSubpixelAA);
+#ifdef DEBUG
+    nsPageFrame* pageFrame = do_QueryFrame(mFrame);
+    MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
+#endif
+    static_cast<nsPageFrame*>(mFrame)->
+      PaintHeaderFooter(*aCtx, ToReferenceFrame(), mDisableSubpixelAA);
   }
   NS_DISPLAY_DECL_NAME("HeaderFooter", nsDisplayItem::TYPE_HEADER_FOOTER)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) override {
     bool snap;
     return GetBounds(aBuilder, &snap);
   }
 
   virtual void DisableComponentAlpha() override {
     mDisableSubpixelAA = true;
   }
 protected:
-  nsPageFrame* mFrame;
   bool mDisableSubpixelAA;
 };
 
 //------------------------------------------------------------------------------
 void
 nsPageFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists)
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -11,16 +11,18 @@
 
 class nsFontMetrics;
 class nsSharedPageData;
 
 // Page frame class used by the simple page sequence frame
 class nsPageFrame final : public nsContainerFrame {
 
 public:
+  NS_DECL_QUERYFRAME_TARGET(nsPageFrame)
+  NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,
                                       nsStyleContext* aContext);
 
   virtual void Reflow(nsPresContext*      aPresContext,
                       nsHTMLReflowMetrics& aDesiredSize,
                       const nsHTMLReflowState& aMaxSize,
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -1079,17 +1079,17 @@ Selection::Stringify(nsAString& aResult)
 NS_IMETHODIMP
 Selection::ToStringWithFormat(const char* aFormatType, uint32_t aFlags,
                               int32_t aWrapCol, nsAString& aReturn)
 {
   ErrorResult result;
   NS_ConvertUTF8toUTF16 format(aFormatType);
   ToStringWithFormat(format, aFlags, aWrapCol, aReturn, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 void
 Selection::ToStringWithFormat(const nsAString& aFormatType, uint32_t aFlags,
                               int32_t aWrapCol, nsAString& aReturn,
                               ErrorResult& aRv)
@@ -1136,17 +1136,17 @@ Selection::ToStringWithFormat(const nsAS
 }
 
 NS_IMETHODIMP
 Selection::SetInterlinePosition(bool aHintRight)
 {
   ErrorResult result;
   SetInterlinePosition(aHintRight, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 void
 Selection::SetInterlinePosition(bool aHintRight, ErrorResult& aRv)
 {
   if (!mFrameSelection) {
@@ -1157,17 +1157,17 @@ Selection::SetInterlinePosition(bool aHi
 }
 
 NS_IMETHODIMP
 Selection::GetInterlinePosition(bool* aHintRight)
 {
   ErrorResult result;
   *aHintRight = GetInterlinePosition(result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 bool
 Selection::GetInterlinePosition(ErrorResult& aRv)
 {
   if (!mFrameSelection) {
@@ -3866,17 +3866,17 @@ Selection::GetRangesForInterval(nsIDOMNo
   nsTArray<nsRefPtr<nsRange>> results;
   ErrorResult result;
   nsCOMPtr<nsINode> beginNode = do_QueryInterface(aBeginNode);
   nsCOMPtr<nsINode> endNode = do_QueryInterface(aEndNode);
   NS_ENSURE_TRUE(beginNode && endNode, NS_ERROR_NULL_POINTER);
   GetRangesForInterval(*beginNode, aBeginOffset, *endNode, aEndOffset,
                        aAllowAdjacent, results, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   *aResultCount = results.Length();
   if (*aResultCount == 0) {
     return NS_OK;
   }
 
   *aResults = static_cast<nsIDOMRange**>
                          (moz_xmalloc(sizeof(nsIDOMRange*) * *aResultCount));
@@ -4569,17 +4569,17 @@ Selection::DoAutoScroll(nsIFrame* aFrame
 
 /** RemoveAllRanges zeroes the selection
  */
 NS_IMETHODIMP
 Selection::RemoveAllRanges()
 {
   ErrorResult result;
   RemoveAllRanges(result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::RemoveAllRanges(ErrorResult& aRv)
 {
   if (!mFrameSelection)
     return; // nothing to do
   nsRefPtr<nsPresContext>  presContext = GetPresContext();
@@ -4607,17 +4607,17 @@ NS_IMETHODIMP
 Selection::AddRange(nsIDOMRange* aDOMRange)
 {
   if (!aDOMRange) {
     return NS_ERROR_NULL_POINTER;
   }
   nsRange* range = static_cast<nsRange*>(aDOMRange);
   ErrorResult result;
   AddRange(*range, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::AddRange(nsRange& aRange, ErrorResult& aRv)
 {
   // This inserts a table cell range in proper document order
   // and returns NS_OK if range doesn't contain just one table cell
   bool didAddRange;
@@ -4674,17 +4674,17 @@ nsresult
 Selection::RemoveRange(nsIDOMRange* aDOMRange)
 {
   if (!aDOMRange) {
     return NS_ERROR_INVALID_ARG;
   }
   nsRange* range = static_cast<nsRange*>(aDOMRange);
   ErrorResult result;
   RemoveRange(*range, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::RemoveRange(nsRange& aRange, ErrorResult& aRv)
 {
   nsresult rv = RemoveItem(&aRange);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
@@ -4772,17 +4772,17 @@ Selection::CollapseNative(nsINode* aPare
 nsresult
 Selection::Collapse(nsINode* aParentNode, int32_t aOffset)
 {
   if (!aParentNode)
     return NS_ERROR_INVALID_ARG;
 
   ErrorResult result;
   Collapse(*aParentNode, static_cast<uint32_t>(aOffset), result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::Collapse(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
 {
   if (!mFrameSelection) {
     aRv.Throw(NS_ERROR_NOT_INITIALIZED); // Can't do selection
     return;
@@ -4848,17 +4848,17 @@ Selection::Collapse(nsINode& aParentNode
  * Sets the whole selection to be one point
  * at the start of the current selection
  */
 NS_IMETHODIMP
 Selection::CollapseToStart()
 {
   ErrorResult result;
   CollapseToStart(result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::CollapseToStart(ErrorResult& aRv)
 {
   int32_t cnt;
   nsresult rv = GetRangeCount(&cnt);
   if (NS_FAILED(rv) || cnt <= 0) {
@@ -4889,17 +4889,17 @@ Selection::CollapseToStart(ErrorResult& 
  * Sets the whole selection to be one point
  * at the end of the current selection
  */
 NS_IMETHODIMP
 Selection::CollapseToEnd()
 {
   ErrorResult result;
   CollapseToEnd(result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::CollapseToEnd(ErrorResult& aRv)
 {
   int32_t cnt;
   nsresult rv = GetRangeCount(&cnt);
   if (NS_FAILED(rv) || cnt <= 0) {
@@ -4969,17 +4969,17 @@ Selection::GetRangeCount(int32_t* aRange
 }
 
 NS_IMETHODIMP
 Selection::GetRangeAt(int32_t aIndex, nsIDOMRange** aReturn)
 {
   ErrorResult result;
   *aReturn = GetRangeAt(aIndex, result);
   NS_IF_ADDREF(*aReturn);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 nsRange*
 Selection::GetRangeAt(uint32_t aIndex, ErrorResult& aRv)
 {
   nsRange* range = GetRangeAt(aIndex);
   if (!range) {
     aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
@@ -5100,17 +5100,17 @@ Selection::ExtendNative(nsINode* aParent
 nsresult
 Selection::Extend(nsINode* aParentNode, int32_t aOffset)
 {
   if (!aParentNode)
     return NS_ERROR_INVALID_ARG;
 
   ErrorResult result;
   Extend(*aParentNode, static_cast<uint32_t>(aOffset), result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::Extend(nsINode& aParentNode, uint32_t aOffset, ErrorResult& aRv)
 {
   // First, find the range containing the old focus point:
   if (!mAnchorFocusRange) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
@@ -5400,17 +5400,17 @@ Selection::Extend(nsINode& aParentNode, 
 
 NS_IMETHODIMP
 Selection::SelectAllChildren(nsIDOMNode* aParentNode)
 {
   ErrorResult result;
   nsCOMPtr<nsINode> node = do_QueryInterface(aParentNode);
   NS_ENSURE_TRUE(node, NS_ERROR_INVALID_ARG);
   SelectAllChildren(*node, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::SelectAllChildren(nsINode& aNode, ErrorResult& aRv)
 {
   if (mFrameSelection)
   {
     mFrameSelection->PostReason(nsISelectionListener::SELECTALL_REASON);
@@ -5436,17 +5436,17 @@ Selection::ContainsNode(nsIDOMNode* aNod
   *aYes = false;
 
   nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
   if (!node) {
     return NS_ERROR_NULL_POINTER;
   }
   ErrorResult result;
   *aYes = ContainsNode(*node, aAllowPartial, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 bool
 Selection::ContainsNode(nsINode& aNode, bool aAllowPartial, ErrorResult& aRv)
 {
   nsresult rv;
   if (mRanges.Length() == 0) {
     return false;
@@ -5678,17 +5678,17 @@ Selection::PostScrollSelectionIntoViewEv
 
 NS_IMETHODIMP
 Selection::ScrollIntoView(SelectionRegion aRegion, bool aIsSynchronous,
                           int16_t aVPercent, int16_t aHPercent)
 {
   ErrorResult result;
   ScrollIntoView(aRegion, aIsSynchronous, aVPercent, aHPercent, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 void
 Selection::ScrollIntoView(int16_t aRegion, bool aIsSynchronous,
                           int16_t aVPercent, int16_t aHPercent,
                           ErrorResult& aRv)
@@ -5774,17 +5774,17 @@ Selection::ScrollIntoView(SelectionRegio
 NS_IMETHODIMP
 Selection::AddSelectionListener(nsISelectionListener* aNewListener)
 {
   if (!aNewListener)
     return NS_ERROR_NULL_POINTER;
   ErrorResult result;
   AddSelectionListener(aNewListener, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 void
 Selection::AddSelectionListener(nsISelectionListener* aNewListener,
                                 ErrorResult& aRv)
 {
@@ -5797,17 +5797,17 @@ Selection::AddSelectionListener(nsISelec
 NS_IMETHODIMP
 Selection::RemoveSelectionListener(nsISelectionListener* aListenerToRemove)
 {
   if (!aListenerToRemove)
     return NS_ERROR_NULL_POINTER;
   ErrorResult result;
   RemoveSelectionListener(aListenerToRemove, result);
   if (result.Failed()) {
-    return result.ErrorCode();
+    return result.StealNSResult();
   }
   return NS_OK;
 }
 
 void
 Selection::RemoveSelectionListener(nsISelectionListener* aListenerToRemove,
                                    ErrorResult& aRv)
 {
@@ -5868,17 +5868,17 @@ Selection::EndBatchChanges()
 
 
 
 NS_IMETHODIMP
 Selection::DeleteFromDocument()
 {
   ErrorResult result;
   DeleteFromDocument(result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::DeleteFromDocument(ErrorResult& aRv)
 {
   if (!mFrameSelection)
     return;//nothing to do
   nsresult rv = mFrameSelection->DeleteFromDocument();
@@ -5888,17 +5888,17 @@ Selection::DeleteFromDocument(ErrorResul
 }
 
 NS_IMETHODIMP
 Selection::Modify(const nsAString& aAlter, const nsAString& aDirection,
                   const nsAString& aGranularity)
 {
   ErrorResult result;
   Modify(aAlter, aDirection, aGranularity, result);
-  return result.ErrorCode();
+  return result.StealNSResult();
 }
 
 void
 Selection::Modify(const nsAString& aAlter, const nsAString& aDirection,
                   const nsAString& aGranularity, ErrorResult& aRv)
 {
   // Silently exit if there's no selection or no focus node.
   if (!mFrameSelection || !GetAnchorFocusRange() || !GetFocusNode()) {
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -5532,16 +5532,19 @@ AddHyphenToMetrics(nsTextFrame* aTextFra
   nsAutoPtr<gfxTextRun> hyphenTextRun(
     GetHyphenTextRun(aBaseTextRun, aContext, aTextFrame));
   if (!hyphenTextRun.get())
     return;
 
   gfxTextRun::Metrics hyphenMetrics =
     hyphenTextRun->MeasureText(0, hyphenTextRun->GetLength(),
                                aBoundingBoxType, aContext, nullptr);
+  if (aTextFrame->GetWritingMode().IsLineInverted()) {
+    hyphenMetrics.mBoundingBox.y = -hyphenMetrics.mBoundingBox.YMost();
+  }
   aMetrics->CombineWith(hyphenMetrics, aBaseTextRun->IsRightToLeft());
 }
 
 void
 nsTextFrame::PaintOneShadow(uint32_t aOffset, uint32_t aLength,
                             nsCSSShadowItem* aShadowDetails,
                             PropertyProvider* aProvider, const nsRect& aDirtyRect,
                             const gfxPoint& aFramePt, const gfxPoint& aTextBaselinePt,
@@ -5554,18 +5557,35 @@ nsTextFrame::PaintOneShadow(uint32_t aOf
     js::ProfileEntry::Category::GRAPHICS);
 
   gfxPoint shadowOffset(aShadowDetails->mXOffset, aShadowDetails->mYOffset);
   nscoord blurRadius = std::max(aShadowDetails->mRadius, 0);
 
   // This rect is the box which is equivalent to where the shadow will be painted.
   // The origin of aBoundingBox is the text baseline left, so we must translate it by
   // that much in order to make the origin the top-left corner of the text bounding box.
-  gfxRect shadowGfxRect = aBoundingBox +
-    gfxPoint(aFramePt.x + aLeftSideOffset, aTextBaselinePt.y) + shadowOffset;
+  // Note that aLeftSideOffset is line-left, so actually means top offset in
+  // vertical writing modes.
+  gfxRect shadowGfxRect;
+  WritingMode wm = GetWritingMode();
+  if (wm.IsVertical()) {
+    shadowGfxRect = aBoundingBox;
+    if (wm.IsVerticalRL()) {
+      // for vertical-RL, reverse direction of x-coords of bounding box
+      shadowGfxRect.x = -shadowGfxRect.XMost();
+    }
+    shadowGfxRect +=
+      gfxPoint(aTextBaselinePt.x, aFramePt.y + aLeftSideOffset);
+  } else {
+    shadowGfxRect =
+      aBoundingBox + gfxPoint(aFramePt.x + aLeftSideOffset,
+                              aTextBaselinePt.y);
+  }
+  shadowGfxRect += shadowOffset;
+
   nsRect shadowRect(NSToCoordRound(shadowGfxRect.X()),
                     NSToCoordRound(shadowGfxRect.Y()),
                     NSToCoordRound(shadowGfxRect.Width()),
                     NSToCoordRound(shadowGfxRect.Height()));
 
   nsContextBoxBlur contextBoxBlur;
   gfxContext* shadowContext = contextBoxBlur.Init(shadowRect, 0, blurRadius,
                                                   PresContext()->AppUnitsPerDevPixel(),
@@ -6068,16 +6088,20 @@ nsTextFrame::PaintShadows(nsCSSShadowArr
 {
   if (!aShadow) {
     return;
   }
 
   gfxTextRun::Metrics shadowMetrics =
     mTextRun->MeasureText(aOffset, aLength, gfxFont::LOOSE_INK_EXTENTS,
                           nullptr, &aProvider);
+  if (GetWritingMode().IsLineInverted()) {
+    Swap(shadowMetrics.mAscent, shadowMetrics.mDescent);
+    shadowMetrics.mBoundingBox.y = -shadowMetrics.mBoundingBox.YMost();
+  }
   if (GetStateBits() & TEXT_HYPHEN_BREAK) {
     AddHyphenToMetrics(this, mTextRun, &shadowMetrics,
                        gfxFont::LOOSE_INK_EXTENTS, aCtx);
   }
   // Add bounds of text decorations
   gfxRect decorationRect(0, -shadowMetrics.mAscent,
       shadowMetrics.mAdvanceWidth, shadowMetrics.mAscent + shadowMetrics.mDescent);
   shadowMetrics.mBoundingBox.UnionRect(shadowMetrics.mBoundingBox,
@@ -6091,16 +6115,21 @@ nsTextFrame::PaintShadows(nsCSSShadowArr
   while (numGlyphRuns-- > 0) {
     if (run->mFont->AlwaysNeedsMaskForShadow()) {
       blurFlags = nsContextBoxBlur::FORCE_MASK;
       break;
     }
     run++;
   }
 
+  if (mTextRun->IsVertical()) {
+    Swap(shadowMetrics.mBoundingBox.x, shadowMetrics.mBoundingBox.y);
+    Swap(shadowMetrics.mBoundingBox.width, shadowMetrics.mBoundingBox.height);
+  }
+
   for (uint32_t i = aShadow->Length(); i > 0; --i) {
     PaintOneShadow(aOffset, aLength,
                    aShadow->ShadowAt(i - 1), &aProvider,
                    aDirtyRect, aFramePt, aTextBaselinePt, aCtx,
                    aForegroundColor, aClipEdges,
                    aLeftEdgeOffset,
                    shadowMetrics.mBoundingBox,
                    blurFlags);
@@ -7734,22 +7763,22 @@ nsTextFrame::ComputeTightBounds(gfxConte
   // Trim trailing whitespace
   provider.InitializeForDisplay(true);
 
   gfxTextRun::Metrics metrics =
         mTextRun->MeasureText(provider.GetStart().GetSkippedOffset(),
                               ComputeTransformedLength(provider),
                               gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS,
                               aContext, &provider);
+  if (GetWritingMode().IsLineInverted()) {
+    metrics.mBoundingBox.y = -metrics.mBoundingBox.YMost();
+  }
   // mAscent should be the same as metrics.mAscent, but it's what we use to
   // paint so that's the one we'll use.
   nsRect boundingBox = RoundOut(metrics.mBoundingBox);
-  if (GetWritingMode().IsLineInverted()) {
-    boundingBox.y = -boundingBox.YMost();
-  }
   boundingBox += nsPoint(0, mAscent);
   if (mTextRun->IsVertical()) {
     // Swap line-relative textMetrics dimensions to physical coordinates.
     Swap(boundingBox.x, boundingBox.y);
     Swap(boundingBox.width, boundingBox.height);
   }
   return boundingBox;
 }
@@ -8329,16 +8358,20 @@ nsTextFrame::ReflowText(nsLineLayout& aL
     // If we're measuring a zero-length piece of text, update
     // the height manually.
     nsFontMetrics* fm = provider.GetFontMetrics();
     if (fm) {
       textMetrics.mAscent = gfxFloat(fm->MaxAscent());
       textMetrics.mDescent = gfxFloat(fm->MaxDescent());
     }
   }
+  if (GetWritingMode().IsLineInverted()) {
+    Swap(textMetrics.mAscent, textMetrics.mDescent);
+    textMetrics.mBoundingBox.y = -textMetrics.mBoundingBox.YMost();
+  }
   // The "end" iterator points to the first character after the string mapped
   // by this frame. Basically, its original-string offset is offset+charsFit
   // after we've computed charsFit.
   gfxSkipCharsIterator end(provider.GetEndHint());
   end.SetSkippedOffset(transformedOffset + transformedCharsFit);
   int32_t charsFit = end.GetOriginalOffset() - offset;
   if (offset + charsFit == newLineOffset) {
     // We broke before a trailing preformatted '\n'. The newline should
@@ -8434,62 +8467,56 @@ nsTextFrame::ReflowText(nsLineLayout& aL
   finalSize.ISize(wm) = NSToCoordCeil(std::max(gfxFloat(0.0),
                                                textMetrics.mAdvanceWidth));
 
   if (transformedCharsFit == 0 && !usedHyphenation) {
     aMetrics.SetBlockStartAscent(0);
     finalSize.BSize(wm) = 0;
   } else if (boundingBoxType != gfxFont::LOOSE_INK_EXTENTS) {
     // Use actual text metrics for floating first letter frame.
-    if (wm.IsLineInverted()) {
-      aMetrics.SetBlockStartAscent(NSToCoordCeil(textMetrics.mDescent));
-      finalSize.BSize(wm) = aMetrics.BlockStartAscent() +
-        NSToCoordCeil(textMetrics.mAscent);
-    } else {
-      aMetrics.SetBlockStartAscent(NSToCoordCeil(textMetrics.mAscent));
-      finalSize.BSize(wm) = aMetrics.BlockStartAscent() +
-        NSToCoordCeil(textMetrics.mDescent);
-    }
+    aMetrics.SetBlockStartAscent(NSToCoordCeil(textMetrics.mAscent));
+    finalSize.BSize(wm) = aMetrics.BlockStartAscent() +
+      NSToCoordCeil(textMetrics.mDescent);
   } else {
     // Otherwise, ascent should contain the overline drawable area.
     // And also descent should contain the underline drawable area.
     // nsFontMetrics::GetMaxAscent/GetMaxDescent contains them.
     nsFontMetrics* fm = provider.GetFontMetrics();
-    nscoord fontAscent = fm->MaxAscent();
-    nscoord fontDescent = fm->MaxDescent();
-    if (wm.IsLineInverted()) {
-      aMetrics.SetBlockStartAscent(std::max(NSToCoordCeil(textMetrics.mDescent), fontDescent));
-      nscoord descent = std::max(NSToCoordCeil(textMetrics.mAscent), fontAscent);
-      finalSize.BSize(wm) = aMetrics.BlockStartAscent() + descent;
-    } else {
-      aMetrics.SetBlockStartAscent(std::max(NSToCoordCeil(textMetrics.mAscent), fontAscent));
-      nscoord descent = std::max(NSToCoordCeil(textMetrics.mDescent), fontDescent);
-      finalSize.BSize(wm) = aMetrics.BlockStartAscent() + descent;
-    }
+    nscoord fontAscent =
+      wm.IsLineInverted() ? fm->MaxDescent() : fm->MaxAscent();
+    nscoord fontDescent =
+      wm.IsLineInverted() ? fm->MaxAscent() : fm->MaxDescent();
+    aMetrics.SetBlockStartAscent(std::max(NSToCoordCeil(textMetrics.mAscent), fontAscent));
+    nscoord descent = std::max(NSToCoordCeil(textMetrics.mDescent), fontDescent);
+    finalSize.BSize(wm) = aMetrics.BlockStartAscent() + descent;
   }
   aMetrics.SetSize(wm, finalSize);
 
   NS_ASSERTION(aMetrics.BlockStartAscent() >= 0,
                "Negative ascent???");
   NS_ASSERTION(aMetrics.BSize(aMetrics.GetWritingMode()) -
                aMetrics.BlockStartAscent() >= 0,
                "Negative descent???");
 
   mAscent = aMetrics.BlockStartAscent();
 
   // Handle text that runs outside its normal bounds.
   nsRect boundingBox = RoundOut(textMetrics.mBoundingBox);
-  if (wm.IsLineInverted()) {
-    boundingBox.y = -boundingBox.YMost();
-  }
-  boundingBox += nsPoint(0, mAscent);
   if (mTextRun->IsVertical()) {
     // Swap line-relative textMetrics dimensions to physical coordinates.
     Swap(boundingBox.x, boundingBox.y);
     Swap(boundingBox.width, boundingBox.height);
+    if (GetWritingMode().IsVerticalRL()) {
+      boundingBox.x = -boundingBox.XMost();
+      boundingBox.x += aMetrics.Width() - mAscent;
+    } else {
+      boundingBox.x += mAscent;
+    }
+  } else {
+    boundingBox.y += mAscent;
   }
   aMetrics.SetOverflowAreasToDesiredBounds();
   aMetrics.VisualOverflow().UnionRect(aMetrics.VisualOverflow(), boundingBox);
 
   // When we have text decorations, we don't need to compute their overflow now
   // because we're guaranteed to do it later
   // (see nsLineLayout::RelativePositionFrames)
   UnionAdditionalOverflow(presContext, aLineLayout.LineContainerRS()->frame,
@@ -8701,20 +8728,20 @@ nsTextFrame::RecomputeOverflow(nsIFrame*
   // Don't trim trailing space, in case we need to paint it as selected.
   provider.InitializeForDisplay(false);
 
   gfxTextRun::Metrics textMetrics =
     mTextRun->MeasureText(provider.GetStart().GetSkippedOffset(),
                           ComputeTransformedLength(provider),
                           gfxFont::LOOSE_INK_EXTENTS, nullptr,
                           &provider);
+  if (GetWritingMode().IsLineInverted()) {
+    textMetrics.mBoundingBox.y = -textMetrics.mBoundingBox.YMost();
+  }
   nsRect boundingBox = RoundOut(textMetrics.mBoundingBox);
-  if (GetWritingMode().IsLineInverted()) {
-    boundingBox.y = -boundingBox.YMost();
-  }
   boundingBox += nsPoint(0, mAscent);
   if (mTextRun->IsVertical()) {
     // Swap line-relative textMetrics dimensions to physical coordinates.
     Swap(boundingBox.x, boundingBox.y);
     Swap(boundingBox.width, boundingBox.height);
   }
   nsRect &vis = result.VisualOverflow();
   vis.UnionRect(vis, boundingBox);
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -290,17 +290,17 @@ inDOMUtils::GetRuleColumn(nsIDOMCSSRule*
 }
 
 NS_IMETHODIMP
 inDOMUtils::GetSelectorCount(nsIDOMCSSStyleRule* aRule, uint32_t *aCount)
 {
   ErrorResult rv;
   nsRefPtr<StyleRule> rule = GetRuleFromDOMRule(aRule, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   uint32_t count = 0;
   for (nsCSSSelectorList* sel = rule->Selector(); sel; sel = sel->mNext) {
     ++count;
   }
   *aCount = count;
   return NS_OK;
@@ -329,17 +329,17 @@ GetSelectorAtIndex(nsIDOMCSSStyleRule* a
 NS_IMETHODIMP
 inDOMUtils::GetSelectorText(nsIDOMCSSStyleRule* aRule,
                             uint32_t aSelectorIndex,
                             nsAString& aText)
 {
   ErrorResult rv;
   nsCSSSelectorList* sel = GetSelectorAtIndex(aRule, aSelectorIndex, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   nsRefPtr<StyleRule> rule = GetRuleFromDOMRule(aRule, rv);
   MOZ_ASSERT(!rv.Failed(), "How could we get a selector but not a rule?");
 
   sel->mSelectors->ToString(aText, rule->GetStyleSheet(), false);
   return NS_OK;
 }
@@ -347,17 +347,17 @@ inDOMUtils::GetSelectorText(nsIDOMCSSSty
 NS_IMETHODIMP
 inDOMUtils::GetSpecificity(nsIDOMCSSStyleRule* aRule,
                             uint32_t aSelectorIndex,
                             uint64_t* aSpecificity)
 {
   ErrorResult rv;
   nsCSSSelectorList* sel = GetSelectorAtIndex(aRule, aSelectorIndex, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   *aSpecificity = sel->mWeight;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
@@ -367,17 +367,17 @@ inDOMUtils::SelectorMatchesElement(nsIDO
                                    bool* aMatches)
 {
   nsCOMPtr<Element> element = do_QueryInterface(aElement);
   NS_ENSURE_ARG_POINTER(element);
 
   ErrorResult rv;
   nsCSSSelectorList* tail = GetSelectorAtIndex(aRule, aSelectorIndex, rv);
   if (rv.Failed()) {
-    return rv.ErrorCode();
+    return rv.StealNSResult();
   }
 
   // We want just the one list item, not the whole list tail
   nsAutoPtr<nsCSSSelectorList> sel(tail->Clone(false));
 
   // Do not attempt to match if a pseudo element is requested and this is not
   // a pseudo element selector, or vice versa.
   if (aPseudo.IsEmpty() == sel->mSelectors->IsPseudoElement()) {
--- a/layout/reftests/css-grid/reftest.list
+++ b/layout/reftests/css-grid/reftest.list
@@ -10,12 +10,12 @@ fails == grid-whitespace-handling-1b.xht
 == grid-placement-auto-col-sparse-001.html grid-placement-auto-col-sparse-001-ref.html
 == grid-placement-auto-col-dense-001.html grid-placement-auto-col-dense-001-ref.html
 == grid-track-sizing-001.html grid-track-sizing-001-ref.html
 == grid-abspos-items-001.html grid-abspos-items-001-ref.html
 == grid-abspos-items-002.html grid-abspos-items-002-ref.html
 == grid-order-abspos-items-001.html grid-order-abspos-items-001-ref.html
 == grid-order-placement-auto-001.html grid-order-placement-auto-001-ref.html
 == grid-order-placement-definite-001.html grid-order-placement-definite-001-ref.html
-== rtl-grid-placement-definite-001.html rtl-grid-placement-definite-001-ref.html
-== rtl-grid-placement-auto-row-sparse-001.html rtl-grid-placement-auto-row-sparse-001-ref.html
-== vlr-grid-placement-auto-row-sparse-001.html vlr-grid-placement-auto-row-sparse-001-ref.html
-== vrl-grid-placement-auto-row-sparse-001.html vrl-grid-placement-auto-row-sparse-001-ref.html
+pref(layout.css.vertical-text.enabled,true) == rtl-grid-placement-definite-001.html rtl-grid-placement-definite-001-ref.html
+pref(layout.css.vertical-text.enabled,true) == rtl-grid-placement-auto-row-sparse-001.html rtl-grid-placement-auto-row-sparse-001-ref.html
+pref(layout.css.vertical-text.enabled,true) == vlr-grid-placement-auto-row-sparse-001.html vlr-grid-placement-auto-row-sparse-001-ref.html
+pref(layout.css.vertical-text.enabled,true) == vrl-grid-placement-auto-row-sparse-001.html vrl-grid-placement-auto-row-sparse-001-ref.html
--- a/layout/reftests/floats/reftest.list
+++ b/layout/reftests/floats/reftest.list
@@ -30,12 +30,12 @@ fails == 345369-2.html 345369-2-ref.html
 == float-in-rtl-3a.html float-in-rtl-3-ref.html
 == float-in-rtl-3b.html float-in-rtl-3-ref.html
 == float-in-rtl-3c.html float-in-rtl-3-ref.html
 == float-in-rtl-3d.html float-in-rtl-3-ref.html
 == float-in-rtl-4a.html float-in-rtl-4-ref.html
 == float-in-rtl-4b.html float-in-rtl-4-ref.html
 == float-in-rtl-4c.html float-in-rtl-4-ref.html
 == float-in-rtl-4d.html float-in-rtl-4-ref.html
-fuzzy-if(OSX==1010,26,7) fuzzy-if(Android,16,2) == orthogonal-floats-1a.html orthogonal-floats-1-ref.html
-fuzzy-if(OSX==1010,26,7) == orthogonal-floats-1b.html orthogonal-floats-1-ref.html
-fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,116,700) HTTP(..) == orthogonal-floats-1c.html orthogonal-floats-1-ref.html
-fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,116,700) HTTP(..) == orthogonal-floats-1d.html orthogonal-floats-1-ref.html
+pref(layout.css.vertical-text.enabled,true) fuzzy-if(OSX==1010,26,7) fuzzy-if(Android,16,2) == orthogonal-floats-1a.html orthogonal-floats-1-ref.html
+pref(layout.css.vertical-text.enabled,true) fuzzy-if(OSX==1010,26,7) == orthogonal-floats-1b.html orthogonal-floats-1-ref.html
+pref(layout.css.vertical-text.enabled,true) fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,116,700) HTTP(..) == orthogonal-floats-1c.html orthogonal-floats-1-ref.html
+pref(layout.css.vertical-text.enabled,true) fuzzy-if(OSX==1010,103,802) fuzzy-if(winWidget,116,700) HTTP(..) == orthogonal-floats-1d.html orthogonal-floats-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+  font: 16px/20px sans-serif;
+  width: 600px;
+  height: 500px;
+  padding: 5px;
+  border: 1px solid gray;
+}
+blockquote {
+  background: #eee;
+  -webkit-writing-mode: vertical-rl;
+  writing-mode: vertical-rl;
+  width: 600px;
+  height: 200px;
+  margin: 0;
+  padding: 10px 0;
+}
+</style>
+</head>
+
+<body>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+eu ultricies augue. Aliquam ante orci, egestas eu pulvinar eget, ullamcorper eu
+elit. Phasellus tristique vulputate odio, quis ultricies justo rutrum in. Mauris
+auctor est in sagittis eleifend.</p>
+
+<blockquote>
+<p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+elementum. Fusce eros eros, eleifend eget eros at, convallis tempor tortor. Cras
+at gravida leo. Proin ultricies ipsum vitae felis suscipit, a tincidunt orci
+mattis. Cras in suscipit mauris.</p>
+</blockquote>
+
+<p>Vivamus lobortis hendrerit vehicula. Nullam dapibus ante et commodo lacinia.
+Sed tincidunt pretium ligula, eget porta metus pharetra eget. Mauris pharetra
+tortor convallis nisi varius facilisis.</p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/writing-mode/1158549-1-vertical-block-size-constraints.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+body {
+  font: 16px/20px sans-serif;
+  width: 600px;
+  height: 500px;
+  padding: 5px;
+  border: 1px solid gray;
+}
+blockquote {
+  background: #eee;
+  -webkit-writing-mode: vertical-rl;
+  writing-mode: vertical-rl;
+  min-width: 100%;
+  max-height: 40%;
+  margin: 0;
+  padding: 10px 0;
+}
+</style>
+</head>
+
+<body>
+<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac fringilla quam,
+eu ultricies augue. Aliquam ante orci, egestas eu pulvinar eget, ullamcorper eu
+elit. Phasellus tristique vulputate odio, quis ultricies justo rutrum in. Mauris
+auctor est in sagittis eleifend.</p>
+
+<blockquote>
+<p>Ut accumsan dui eu elit dapibus rutrum. Nunc tristique urna eget ex dictum
+placerat. Nunc venenatis enim sed odio iaculis, consequat consectetur sem
+elementum. Fusce eros eros, eleifend eget eros at, convallis tempor tortor. Cras
+at gravida leo. Proin ultricies ipsum vitae felis suscipit, a tincidunt orci
+mattis. Cras in suscipit mauris.</p>
+</blockquote>
+
+<p>Vivamus lobortis hendrerit vehicula. Nullam dapibus ante et commodo lacinia.
+Sed tincidunt pretium ligula, eget porta metus pharetra eget. Mauris pharetra
+tortor convallis nisi varius facilisis.</p>
+
+</body>
+</html>
--- a/layout/reftests/writing-mode/reftest.list
+++ b/layout/reftests/writing-mode/reftest.list
@@ -124,8 +124,9 @@ test-pref(dom.meta-viewport.enabled,true
 pref(dom.meta-viewport.enabled,true) pref(font.size.inflation.emPerLine,15) pref(font.size.inflation.forceEnabled,true) pref(font.size.inflation.lineThreshold,0) != font-inflation-1c.html font-inflation-1d.html
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1c.html font-inflation-1c-ref.html
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1d.html font-inflation-1d-ref.html
 
 == 1144501-1a-block-end-margin-orthogonal-size.html 1144501-1-block-end-margin-orthogonal-size-ref.html
 == 1144501-1b-block-end-margin-orthogonal-size.html 1144501-1-block-end-margin-orthogonal-size-ref.html
 == 1151993-1-orthogonal-block-size.html 1151993-1-orthogonal-block-size-ref.html
 == 1156021-text-indent-percent.html 1156021-text-indent-percent-ref.html
+== 1158549-1-vertical-block-size-constraints.html 1158549-1-vertical-block-size-constraints-ref.html
--- a/layout/style/CSSStyleSheet.cpp
+++ b/layout/style/CSSStyleSheet.cpp
@@ -1765,17 +1765,17 @@ CSSStyleSheet::GetDOMOwnerRule() const
 }
 
 NS_IMETHODIMP    
 CSSStyleSheet::GetCssRules(nsIDOMCSSRuleList** aCssRules)
 {
   Err