Merge inbound to m-c. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 27 Aug 2015 11:43:16 -0400
changeset 293880 638ac65d9b3f49590d00ad6d18e45930c4fdc7ea
parent 293836 b33eae31bd7188024b54228e0c0345800a65e595 (current diff)
parent 293879 c0665c2bd0ce9d141f145b9b99963b5e6f26c0a2 (diff)
child 293904 ca086f9ef8bca2d6cdfa79bfc4c854f56a59859e
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone43.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/base/nsGlobalWindow.cpp
dom/ipc/TabChild.cpp
dom/workers/WorkerStructuredClone.h
testing/web-platform/meta/selection/dir.manual.html.ini
testing/web-platform/meta/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html.ini
testing/web-platform/meta/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html.ini
testing/web-platform/meta/shadow-dom/events/event-dispatch/test-001.html.ini
testing/web-platform/meta/shadow-dom/events/event-retargeting/test-004.html.ini
testing/web-platform/tests/XMLHttpRequest/send-content-type-charset.htm
testing/web-platform/tests/animation-timing/callback-invoked.html
testing/web-platform/tests/animation-timing/cancel-invoked.html
testing/web-platform/tests/animation-timing/idlharness.html
testing/web-platform/tests/animation-timing/same-dispatch-time.html
testing/web-platform/tests/selection/dir.manual.html
testing/web-platform/tests/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html
testing/web-platform/tests/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html
--- a/accessible/mac/mozAccessible.h
+++ b/accessible/mac/mozAccessible.h
@@ -107,26 +107,23 @@ static const uintptr_t IS_PROXY = 1;
 - (NSString*)subrole;
 
 // Return the role description, as there are a few exceptions.
 - (NSString*)roleDescription;
 
 // returns the native window we're inside.
 - (NSWindow*)window;
 
-// the accessible description of this particular instance.
-- (NSString*)customDescription;
-
 // the value of this element.
 - (id)value;
 
 // name that is associated with this accessible (for buttons, etc)
 - (NSString*)title;
 
-// help text associated with this element.
+// the accessible description (help text) of this particular instance.
 - (NSString*)help;
 
 - (BOOL)isEnabled;
 
 // information about focus.
 - (BOOL)isFocused;
 - (BOOL)canBeFocused;
 
--- a/accessible/mac/mozAccessible.mm
+++ b/accessible/mac/mozAccessible.mm
@@ -297,17 +297,16 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
                                                            NSAccessibilityPositionAttribute,
                                                            NSAccessibilityEnabledAttribute,
                                                            NSAccessibilitySizeAttribute,
                                                            NSAccessibilityWindowAttribute,
                                                            NSAccessibilityFocusedAttribute,
                                                            NSAccessibilityHelpAttribute,
                                                            NSAccessibilityTitleUIElementAttribute,
                                                            NSAccessibilityTopLevelUIElementAttribute,
-                                                           NSAccessibilityDescriptionAttribute,
 #if DEBUG
                                                            @"AXMozDescription",
 #endif
                                                            nil];
   }
 
   if (!tableAttrs) {
     tempArray = [[NSMutableArray alloc] initWithArray:generalAttributes];
@@ -398,18 +397,16 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
   if ([attribute isEqualToString:NSAccessibilitySubroleAttribute])
     return [self subrole];
   if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
     return [NSNumber numberWithBool:[self isEnabled]];
   if ([attribute isEqualToString:NSAccessibilityValueAttribute])
     return [self value];
   if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
     return [self roleDescription];
-  if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
-    return [self customDescription];
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
     return [NSNumber numberWithBool:[self isFocused]];
   if ([attribute isEqualToString:NSAccessibilitySizeAttribute])
     return [self size];
   if ([attribute isEqualToString:NSAccessibilityWindowAttribute])
     return [self window];
   if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute])
     return [self window];
@@ -1194,42 +1191,27 @@ struct RoleDescrComparator
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)selectedTextDidChange
 {
   // Do nothing. mozTextAccessible will.
 }
 
-- (NSString*)customDescription
-{
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
-
-  nsAutoString desc;
-  if (AccessibleWrap* accWrap = [self getGeckoAccessible])
-    accWrap->Description(desc);
-  else if (ProxyAccessible* proxy = [self getProxyAccessible])
-    proxy->Description(desc);
-  else
-    return nil;
-
-  return nsCocoaUtils::ToNSString(desc);
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
-}
-
 - (NSString*)help
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
+  // What needs to go here is actually the accDescription of an item.
+  // The MSAA acc_help method has nothing to do with this one.
   nsAutoString helpText;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
-    accWrap->Help(helpText);
+    accWrap->Description(helpText);
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
-    proxy->Help(helpText);
+    proxy->Description(helpText);
 
   return nsCocoaUtils::ToNSString(helpText);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 // objc-style description (from NSObject); not to be confused with the accessible description above.
 - (NSString*)description
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -29,17 +29,17 @@
                 </xul:stack>
               </xul:vbox>
             </xul:hbox>
           </xul:notificationbox>
         </xul:tabpanels>
       </xul:tabbox>
       <children/>
     </content>
-    <implementation implements="nsIDOMEventListener, nsIMessageListener">
+    <implementation implements="nsIDOMEventListener, nsIMessageListener, nsIObserver">
 
       <property name="tabContextMenu" readonly="true"
                 onget="return this.tabContainer.contextMenu;"/>
 
       <field name="tabContainer" readonly="true">
         document.getElementById(this.getAttribute("tabcontainer"));
       </field>
       <field name="tabs" readonly="true">
@@ -97,16 +97,19 @@
         null
       </field>
       <field name="mCurrentBrowser">
         null
       </field>
       <field name="mProgressListeners">
         []
       </field>
+      <field name="mActiveResizeDisplayportSuppression">
+        null
+      </field>
       <field name="mTabsProgressListeners">
         []
       </field>
       <field name="mTabListeners">
         []
       </field>
       <field name="mTabFilters">
         []
@@ -4065,22 +4068,50 @@
                 return gFindBar.receiveMessage(aMessage);
               }
               break;
 
           }
         ]]></body>
       </method>
 
+      <method name="observe">
+        <parameter name="aSubject"/>
+        <parameter name="aTopic"/>
+        <parameter name="aData"/>
+        <body><![CDATA[
+          if (aTopic == "live-resize-start") {
+            let browser = this.mCurrentTab.linkedBrowser;
+            let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
+            if (fl && fl.tabParent && !this.mActiveResizeDisplayportSuppression) {
+              fl.tabParent.suppressDisplayport(true);
+              this.mActiveResizeDisplayportSuppression = browser;
+            }
+          } else if (aTopic == "live-resize-end") {
+            let browser = this.mActiveResizeDisplayportSuppression;
+            if (browser) {
+              let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
+              if (fl && fl.tabParent) {
+                fl.tabParent.suppressDisplayport(false);
+                this.mActiveResizeDisplayportSuppression = null;
+              }
+            }
+          }
+        ]]></body>
+      </method>
+
       <constructor>
         <![CDATA[
           let browserStack = document.getAnonymousElementByAttribute(this, "anonid", "browserStack");
           this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
           this.mCurrentBrowser.permanentKey = {};
 
+          Services.obs.addObserver(this, "live-resize-start", false);
+          Services.obs.addObserver(this, "live-resize-end", false);
+
           this.mCurrentTab = this.tabContainer.firstChild;
           const nsIEventListenerService =
             Components.interfaces.nsIEventListenerService;
           let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
                               .getService(nsIEventListenerService);
           els.addSystemEventListener(document, "keydown", this, false);
           if (this.AppConstants.platform == "macosx") {
             els.addSystemEventListener(document, "keypress", this, false);
@@ -4156,16 +4187,19 @@
           // window ID. We switched to a monotonic counter as Date.now() lead
           // to random failures because of colliding IDs.
           return "panel-" + outerID + "-" + (++this._uniquePanelIDCounter);
         ]]></body>
       </method>
 
       <destructor>
         <![CDATA[
+          Services.obs.removeObserver(this, "live-resize-start", false);
+          Services.obs.removeObserver(this, "live-resize-end", false);
+
           for (var i = 0; i < this.mTabListeners.length; ++i) {
             let browser = this.getBrowserAtIndex(i);
             if (browser.registeredOpenURI) {
               this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
               this._unifiedComplete.unregisterOpenPage(browser.registeredOpenURI);
               delete browser.registeredOpenURI;
             }
             browser.webProgress.removeProgressListener(this.mTabFilters[i]);
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11626,17 +11626,94 @@ FullscreenRequest::~FullscreenRequest()
   }
 }
 
 // Any fullscreen request waiting for the widget to finish being full-
 // screen is queued here. This is declared static instead of a member
 // of nsDocument because in the majority of time, there would be at most
 // one document requesting fullscreen. We shouldn't waste the space to
 // hold for it in every document.
-static LinkedList<FullscreenRequest> sPendingFullscreenRequests;
+class PendingFullscreenRequestList
+{
+public:
+  static void Add(UniquePtr<FullscreenRequest>&& aRequest)
+  {
+    sList.insertBack(aRequest.release());
+  }
+
+  static const FullscreenRequest* GetLast()
+  {
+    return sList.getLast();
+  }
+
+  class Iterator
+  {
+  public:
+    explicit Iterator(nsIDocument* aDoc)
+      : mCurrent(PendingFullscreenRequestList::sList.getFirst())
+    {
+      if (mCurrent) {
+        mRootShell = GetRootShell(aDoc);
+        SkipToNextMatch();
+      }
+    }
+
+    void DeleteAndNext()
+    {
+      DeleteAndNextInternal();
+      SkipToNextMatch();
+    }
+    bool AtEnd() const { return mCurrent == nullptr; }
+    const FullscreenRequest& Get() const { return *mCurrent; }
+
+  private:
+    already_AddRefed<nsIDocShellTreeItem> GetRootShell(nsIDocument* aDoc)
+    {
+      if (nsIDocShellTreeItem* shell = aDoc->GetDocShell()) {
+        nsCOMPtr<nsIDocShellTreeItem> rootShell;
+        shell->GetRootTreeItem(getter_AddRefs(rootShell));
+        return rootShell.forget();
+      }
+      return nullptr;
+    }
+
+    void DeleteAndNextInternal()
+    {
+      FullscreenRequest* thisRequest = mCurrent;
+      mCurrent = mCurrent->getNext();
+      delete thisRequest;
+    }
+    void SkipToNextMatch()
+    {
+      while (mCurrent) {
+        nsCOMPtr<nsIDocShellTreeItem>
+          rootShell = GetRootShell(mCurrent->GetDocument());
+        if (!rootShell) {
+          // Always automatically drop documents which has been
+          // detached from the doc shell.
+          DeleteAndNextInternal();
+        } else if (rootShell != mRootShell) {
+          mCurrent = mCurrent->getNext();
+        } else {
+          break;
+        }
+      }
+    }
+
+    FullscreenRequest* mCurrent;
+    nsCOMPtr<nsIDocShellTreeItem> mRootShell;
+  };
+
+private:
+  PendingFullscreenRequestList() = delete;
+
+  static LinkedList<FullscreenRequest> sList;
+};
+
+/* static */ LinkedList<FullscreenRequest> PendingFullscreenRequestList::sList;
 
 static nsCOMPtr<nsPIDOMWindow>
 GetRootWindow(nsIDocument* aDoc)
 {
   nsIDocShell* docShell = aDoc->GetDocShell();
   if (!docShell) {
     return nullptr;
   }
@@ -11651,120 +11728,73 @@ nsDocument::RequestFullScreen(UniquePtr<
   nsCOMPtr<nsPIDOMWindow> rootWin = GetRootWindow(this);
   if (!rootWin) {
     return;
   }
 
   // If we have been in fullscreen, apply the new state directly.
   // Note that we should check both condition, because if we are in
   // child process, our window may not report to be in fullscreen.
-  if (static_cast<nsGlobalWindow*>(rootWin.get())->FullScreen() ||
+  // Also, it is possible that the root window reports that it is in
+  // fullscreen while there exists pending fullscreen request because
+  // of ongoing fullscreen transition. In that case, we shouldn't
+  // apply the state before any previous request.
+  if ((static_cast<nsGlobalWindow*>(rootWin.get())->FullScreen() &&
+       // The iterator being at end at the beginning indicates there is
+       // no pending fullscreen request which relates to this document.
+       PendingFullscreenRequestList::Iterator(this).AtEnd()) ||
       nsContentUtils::GetRootDocument(this)->IsFullScreenDoc()) {
     ApplyFullscreen(*aRequest);
     return;
   }
 
   // We don't need to check element ready before this point, because
   // if we called ApplyFullscreen, it would check that for us.
   Element* elem = aRequest->GetElement();
   if (!FullscreenElementReadyCheck(elem, aRequest->mIsCallerChrome)) {
     return;
   }
 
-  sPendingFullscreenRequests.insertBack(aRequest.release());
+  PendingFullscreenRequestList::Add(Move(aRequest));
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     // If we are not the top level process, dispatch an event to make
     // our parent process go fullscreen first.
     nsContentUtils::DispatchEventOnlyToChrome(
       this, ToSupports(this), NS_LITERAL_STRING("MozDOMFullscreen:Request"),
       /* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
   } else {
     // Make the window fullscreen.
-    FullscreenRequest* lastRequest = sPendingFullscreenRequests.getLast();
+    const FullscreenRequest*
+      lastRequest = PendingFullscreenRequestList::GetLast();
     rootWin->SetFullscreenInternal(nsPIDOMWindow::eForFullscreenAPI, true,
                                    lastRequest->mVRHMDDevice);
   }
 }
 
 /* static */ bool
-nsIDocument::HandlePendingFullscreenRequest(const FullscreenRequest& aRequest,
-                                            nsIDocShellTreeItem* aRootShell,
-                                            bool* aHandled)
-{
-  nsDocument* doc = aRequest.GetDocument();
-  nsIDocShellTreeItem* shell = doc->GetDocShell();
-  if (!shell) {
-    return true;
-  }
-  nsCOMPtr<nsIDocShellTreeItem> rootShell;
-  shell->GetRootTreeItem(getter_AddRefs(rootShell));
-  if (rootShell != aRootShell) {
-    return false;
-  }
-
-  if (doc->ApplyFullscreen(aRequest)) {
-    *aHandled = true;
-  }
-  return true;
-}
-
-/* static */ bool
 nsIDocument::HandlePendingFullscreenRequests(nsIDocument* aDoc)
 {
-  if (sPendingFullscreenRequests.isEmpty()) {
-    return false;
-  }
-
   bool handled = false;
-  nsIDocShellTreeItem* shell = aDoc->GetDocShell();
-  nsCOMPtr<nsIDocShellTreeItem> rootShell;
-  if (shell) {
-    shell->GetRootTreeItem(getter_AddRefs(rootShell));
-  }
-  FullscreenRequest* request = sPendingFullscreenRequests.getFirst();
-  while (request) {
-    if (HandlePendingFullscreenRequest(*request, rootShell, &handled)) {
-      // Drop requests, which either have been detached from document/
-      // document shell, or are handled by HandleFullscreenRequest.
-      FullscreenRequest* thisRequest = request;
-      request = request->getNext();
-      delete thisRequest;
-    } else {
-      request = request->getNext();
-    }
+  PendingFullscreenRequestList::Iterator iter(aDoc);
+  while (!iter.AtEnd()) {
+    const FullscreenRequest& request = iter.Get();
+    if (request.GetDocument()->ApplyFullscreen(request)) {
+      handled = true;
+    }
+    iter.DeleteAndNext();
   }
   return handled;
 }
 
 static void
 ClearPendingFullscreenRequests(nsIDocument* aDoc)
 {
-  nsIDocShellTreeItem* shell = aDoc->GetDocShell();
-  if (!shell) {
-    return;
-  }
-
-  FullscreenRequest* request = sPendingFullscreenRequests.getFirst();
-  while (request) {
-    nsIDocument* doc = request->GetDocument();
-    bool shouldRemove = false;
-    for (nsCOMPtr<nsIDocShellTreeItem> docShell = doc->GetDocShell();
-         docShell; docShell->GetParent(getter_AddRefs(docShell))) {
-      if (docShell == shell) {
-        shouldRemove = true;
-        break;
-      }
-    }
-    if (shouldRemove) {
-      FullscreenRequest* thisRequest = request;
-      request = request->getNext();
-      delete thisRequest;
-    } else {
-      request = request->getNext();
-    }
+  PendingFullscreenRequestList::Iterator iter(aDoc);
+  while (!iter.AtEnd()) {
+    iter.DeleteAndNext();
   }
 }
 
 bool
 nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest)
 {
   Element* elem = aRequest.GetElement();
   if (!FullscreenElementReadyCheck(elem, aRequest.mIsCallerChrome)) {
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -95,16 +95,17 @@ namespace dom {
 class BoxObject;
 class UndoManager;
 struct LifecycleCallbacks;
 class CallbackFunction;
 
 struct FullscreenRequest : public LinkedListElement<FullscreenRequest>
 {
   explicit FullscreenRequest(Element* aElement);
+  FullscreenRequest(const FullscreenRequest&) = delete;
   ~FullscreenRequest();
 
   Element* GetElement() const { return mElement; }
   nsDocument* GetDocument() const { return mDocument; }
 
 private:
   nsRefPtr<Element> mElement;
   nsRefPtr<nsDocument> mDocument;
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -1180,25 +1180,16 @@ public:
    * to perform fullscreen transition first if any.
    *
    * If aDocument is null, it will exit fullscreen from all documents
    * in all windows.
    */
   static void AsyncExitFullscreen(nsIDocument* aDocument);
 
   /**
-   * Handles one single fullscreen request, updates `aHandled` if the request
-   * is handled, and returns whether this request should be removed from the
-   * request queue.
-   */
-  static bool HandlePendingFullscreenRequest(const FullscreenRequest& aRequest,
-                                             nsIDocShellTreeItem* aRootShell,
-                                             bool* aHandled);
-
-  /**
    * Handles any pending fullscreen in aDocument or its subdocuments.
    *
    * Returns whether there is any fullscreen request handled.
    */
   static bool HandlePendingFullscreenRequests(nsIDocument* aDocument);
 
   virtual void RequestPointerLock(Element* aElement) = 0;
 
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -11,16 +11,17 @@
 
 #include "mozilla/Mutex.h"
 #include "nsDebug.h"
 #include "MediaDecoder.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "nsIFile.h"
 #include "nsIFileChannel.h"
+#include "nsIFileStreams.h"
 #include "nsIHttpChannel.h"
 #include "nsISeekableStream.h"
 #include "nsIInputStream.h"
 #include "nsIRequestObserver.h"
 #include "nsIStreamListener.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsCORSListenerProxy.h"
 #include "mozilla/dom/HTMLMediaElement.h"
@@ -1362,17 +1363,18 @@ nsresult FileMediaResource::Open(nsIStre
     // implements nsISeekableStream, so we have to find the underlying
     // file and reopen it
     nsCOMPtr<nsIFileChannel> fc(do_QueryInterface(mChannel));
     if (fc) {
       nsCOMPtr<nsIFile> file;
       rv = fc->GetFile(getter_AddRefs(file));
       NS_ENSURE_SUCCESS(rv, rv);
 
-      rv = NS_NewLocalFileInputStream(getter_AddRefs(mInput), file);
+      rv = NS_NewLocalFileInputStream(
+        getter_AddRefs(mInput), file, -1, -1, nsIFileInputStream::SHARE_DELETE);
     } else if (IsBlobURI(mURI)) {
       rv = NS_GetStreamForBlobURI(mURI, getter_AddRefs(mInput));
     }
   } else {
     // Ensure that we never load a local file from some page on a
     // web server.
     MediaDecoderOwner* owner = mDecoder->GetMediaOwner();
     NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -40,19 +40,29 @@ extern PRLogModuleInfo* gNesteggLog;
 static int webmdemux_read(void* aBuffer, size_t aLength, void* aUserData)
 {
   MOZ_ASSERT(aUserData);
   MOZ_ASSERT(aLength < UINT32_MAX);
   WebMDemuxer* demuxer = reinterpret_cast<WebMDemuxer*>(aUserData);
   int64_t length = demuxer->GetEndDataOffset();
   uint32_t count = aLength;
   int64_t position = demuxer->GetResource()->Tell();
+  if (position >= length) {
+    // GetLastBlockOffset was calculated after we had read past it.
+    // This condition can only occurs with plain webm, as with MSE,
+    // EnsureUpdateIndex would have been called first.
+    // Continue reading to the end instead.
+    length = demuxer->GetResource()->GetLength();
+  }
+  MOZ_ASSERT(position <= demuxer->GetResource()->GetLength());
+  MOZ_ASSERT(position <= length);
   if (length >= 0 && count + position > length) {
     count = length - position;
   }
+  MOZ_ASSERT(count <= aLength);
 
   uint32_t bytes = 0;
   nsresult rv =
     demuxer->GetResource()->Read(static_cast<char*>(aBuffer), count, &bytes);
   bool eof = bytes < aLength;
   return NS_FAILED(rv) ? -1 : eof ? 0 : 1;
 }
 
@@ -441,16 +451,17 @@ WebMDemuxer::EnsureUpToDateIndex()
     return;
   }
   mBufferedState->UpdateIndex(byteRanges, resource);
   if (!mInitData && mBufferedState->GetInitEndOffset() != -1) {
     mInitData = mResource.MediaReadAt(0, mBufferedState->GetInitEndOffset());
   }
   mLastWebMBlockOffset = mBufferedState->GetLastBlockOffset();
   mIsExpectingMoreData = mResource.GetResource()->IsExpectingMoreData();
+  MOZ_ASSERT(mLastWebMBlockOffset <= mResource.GetLength());
   mNeedReIndex = false;
 }
 
 void
 WebMDemuxer::NotifyDataArrived(uint32_t aLength, int64_t aOffset)
 {
   WEBM_DEBUG("length: %ld offset: %ld", aLength, aOffset);
   mNeedReIndex = true;
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
@@ -531,34 +531,36 @@ nsNPAPIPluginStreamListener::OnDataAvail
     // and some plugins (e.g. acrobat) can fail. 
     if ((int32_t)mNPStreamWrapper->mNPStream.end < streamOffset)
       mNPStreamWrapper->mNPStream.end = streamOffset;
   }
   
   nsresult rv = NS_OK;
   while (NS_SUCCEEDED(rv) && length > 0) {
     if (input && length) {
-      if (mStreamBufferSize < mStreamBufferByteCount + length && mIsSuspended) {
+      if (mStreamBufferSize < mStreamBufferByteCount + length) {
         // We're in the ::OnDataAvailable() call that we might get
         // after suspending a request, or we suspended the request
         // from within this ::OnDataAvailable() call while there's
-        // still data in the input, and we don't have enough space to
-        // store what we got off the network. Reallocate our internal
-        // buffer.
+        // still data in the input, or we have resumed a previously
+        // suspended request and our buffer is already full, and we
+        // don't have enough space to store what we got off the network.
+        // Reallocate our internal buffer.
         mStreamBufferSize = mStreamBufferByteCount + length;
         char *buf = (char*)PR_Realloc(mStreamBuffer, mStreamBufferSize);
         if (!buf)
           return NS_ERROR_OUT_OF_MEMORY;
         
         mStreamBuffer = buf;
       }
-      
+
       uint32_t bytesToRead =
       std::min(length, mStreamBufferSize - mStreamBufferByteCount);
-      
+      MOZ_ASSERT(bytesToRead > 0);
+
       uint32_t amountRead = 0;
       rv = input->Read(mStreamBuffer + mStreamBufferByteCount, bytesToRead,
                        &amountRead);
       NS_ENSURE_SUCCESS(rv, rv);
       
       if (amountRead == 0) {
         NS_NOTREACHED("input->Read() returns no data, it's almost impossible "
                       "to get here");
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -232,17 +232,19 @@ GLXLibrary::EnsureInitialized()
         mUseTextureFromPixmap = true;
 #endif
     } else {
         mUseTextureFromPixmap = false;
         NS_WARNING("Texture from pixmap disabled");
     }
 
     if (HasExtension(extensionsStr, "GLX_ARB_create_context_robustness") &&
-        GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_robustness)) {
+        GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_robustness,
+                                     (GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
+    {
         mHasRobustness = true;
     }
 
     mIsATI = serverVendor && DoesStringMatch(serverVendor, "ATI");
     mIsNVIDIA = serverVendor && DoesStringMatch(serverVendor, "NVIDIA Corporation");
     mClientIsMesa = clientVendor && DoesStringMatch(clientVendor, "Mesa");
 
     mInitialized = true;
--- a/gfx/layers/basic/X11TextureSourceBasic.h
+++ b/gfx/layers/basic/X11TextureSourceBasic.h
@@ -3,43 +3,46 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZILLA_GFX_X11TEXTURESOURCEBASIC__H
 #define MOZILLA_GFX_X11TEXTURESOURCEBASIC__H
 
 #include "mozilla/layers/BasicCompositor.h"
 #include "mozilla/layers/TextureHostBasic.h"
+#include "mozilla/layers/X11TextureHost.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
 class BasicCompositor;
 
 // TextureSource for Xlib-backed surfaces.
 class X11TextureSourceBasic
   : public TextureSourceBasic
-  , public TextureSource
+  , public X11TextureSource
 {
 public:
   X11TextureSourceBasic(BasicCompositor* aCompositor, gfxXlibSurface* aSurface);
 
   virtual X11TextureSourceBasic* AsSourceBasic() override { return this; }
 
   virtual gfx::IntSize GetSize() const override;
 
   virtual gfx::SurfaceFormat GetFormat() const override;
 
   virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
 
   virtual void DeallocateDeviceData() override { }
 
   virtual void SetCompositor(Compositor* aCompositor) override;
 
+  virtual void Updated() override { }
+
   static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
 
 protected:
   RefPtr<BasicCompositor> mCompositor;
   RefPtr<gfxXlibSurface> mSurface;
   RefPtr<gfx::SourceSurface> mSourceSurface;
 };
 
--- a/gfx/layers/composite/X11TextureHost.h
+++ b/gfx/layers/composite/X11TextureHost.h
@@ -10,16 +10,24 @@
 #include "mozilla/layers/LayersSurfaces.h"
 #include "mozilla/gfx/Types.h"
 
 #include "gfxXlibSurface.h"
 
 namespace mozilla {
 namespace layers {
 
+class X11TextureSource : public TextureSource
+{
+public:
+  // Called when the underlying X surface has been changed.
+  // Useful for determining whether to rebind a GLXPixmap to a texture.
+  virtual void Updated() = 0;
+};
+
 // TextureHost for Xlib-backed TextureSources.
 class X11TextureHost : public TextureHost
 {
 public:
   X11TextureHost(TextureFlags aFlags,
                  const SurfaceDescriptorX11& aDescriptor);
 
   virtual void SetCompositor(Compositor* aCompositor) override;
@@ -38,17 +46,23 @@ public:
 
   virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() override { return "X11TextureHost"; }
 #endif
 
 protected:
+  virtual void UpdatedInternal(const nsIntRegion*) override
+  {
+    if (mTextureSource)
+      mTextureSource->Updated();
+  }
+
   RefPtr<Compositor> mCompositor;
-  RefPtr<TextureSource> mTextureSource;
+  RefPtr<X11TextureSource> mTextureSource;
   RefPtr<gfxXlibSurface> mSurface;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // MOZILLA_GFX_X11TEXTUREHOST__H
--- a/gfx/layers/opengl/X11TextureSourceOGL.cpp
+++ b/gfx/layers/opengl/X11TextureSourceOGL.cpp
@@ -13,16 +13,17 @@ namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
 X11TextureSourceOGL::X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface)
   : mCompositor(aCompositor)
   , mSurface(aSurface)
   , mTexture(0)
+  , mUpdated(false)
 {
 }
 
 X11TextureSourceOGL::~X11TextureSourceOGL()
 {
   DeallocateDeviceData();
 }
 
@@ -46,17 +47,20 @@ X11TextureSourceOGL::BindTexture(GLenum 
   if (!mTexture) {
     gl()->fGenTextures(1, &mTexture);
 
     gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
 
     gl::sGLXLibrary.BindTexImage(mSurface->XDisplay(), mSurface->GetGLXPixmap());
   } else {
     gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
-    gl::sGLXLibrary.UpdateTexImage(mSurface->XDisplay(), mSurface->GetGLXPixmap());
+    if (mUpdated) {
+      gl::sGLXLibrary.UpdateTexImage(mSurface->XDisplay(), mSurface->GetGLXPixmap());
+      mUpdated = false;
+    }
   }
 
   ApplyFilterToBoundTexture(gl(), aFilter, LOCAL_GL_TEXTURE_2D);
 }
 
 IntSize
 X11TextureSourceOGL::GetSize() const
 {
--- a/gfx/layers/opengl/X11TextureSourceOGL.h
+++ b/gfx/layers/opengl/X11TextureSourceOGL.h
@@ -5,25 +5,26 @@
 
 #ifndef MOZILLA_GFX_X11TEXTURESOURCEOGL__H
 #define MOZILLA_GFX_X11TEXTURESOURCEOGL__H
 
 #ifdef GL_PROVIDER_GLX
 
 #include "mozilla/layers/CompositorOGL.h"
 #include "mozilla/layers/TextureHostOGL.h"
+#include "mozilla/layers/X11TextureHost.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
 // TextureSource for Xlib-backed surfaces.
 class X11TextureSourceOGL
   : public TextureSourceOGL
-  , public TextureSource
+  , public X11TextureSource
 {
 public:
   X11TextureSourceOGL(CompositorOGL* aCompositor, gfxXlibSurface* aSurface);
   ~X11TextureSourceOGL();
 
   virtual X11TextureSourceOGL* AsSourceOGL() override { return this; }
 
   virtual bool IsValid() const override { return !!gl(); } ;
@@ -37,25 +38,28 @@ public:
   virtual gfx::SurfaceFormat GetFormat() const override;
 
   virtual GLenum GetWrapMode() const override { return LOCAL_GL_CLAMP_TO_EDGE; }
 
   virtual void DeallocateDeviceData() override;
 
   virtual void SetCompositor(Compositor* aCompositor) override;
 
+  virtual void Updated() override { mUpdated = true; }
+
   gl::GLContext* gl() const;
 
   static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
 
 protected:
   RefPtr<CompositorOGL> mCompositor;
   nsRefPtr<gfxXlibSurface> mSurface;
   RefPtr<gfx::SourceSurface> mSourceSurface;
   GLuint mTexture;
+  bool mUpdated;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif
 
 #endif // MOZILLA_GFX_X11TEXTURESOURCEOGL__H
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -1365,16 +1365,25 @@ gfxContext::GetRoundOffsetsToPixels(bool
     }
 
     // All raster backends snap glyphs to pixels vertically.
     // Print backends set CAIRO_HINT_METRICS_OFF.
     *aRoundY = true;
 
     cairo_t *cr = GetCairo();
     cairo_scaled_font_t *scaled_font = cairo_get_scaled_font(cr);
+
+    // bug 1198921 - this sometimes fails under Windows for whatver reason
+    NS_ASSERTION(scaled_font, "null cairo scaled font should never be returned "
+                 "by cairo_get_scaled_font");
+    if (!scaled_font) {
+        *aRoundX = true; // default to the same as the fallback path below
+        return;
+    }
+
     // Sometimes hint metrics gets set for us, most notably for printing.
     cairo_font_options_t *font_options = cairo_font_options_create();
     cairo_scaled_font_get_font_options(scaled_font, font_options);
     cairo_hint_metrics_t hint_metrics =
         cairo_font_options_get_hint_metrics(font_options);
     cairo_font_options_destroy(font_options);
 
     switch (hint_metrics) {
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -2516,21 +2516,33 @@ GetConstructorName(JSContext* cx, unsign
     return true;
 }
 
 static bool
 AllocationMarker(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    static const JSClass cls = { "AllocationMarker" };
-
-    RootedObject obj(cx, JS_NewObject(cx, &cls));
+    bool allocateInsideNursery = true;
+    if (args.length() > 0 && args[0].isObject()) {
+        RootedObject options(cx, &args[0].toObject());
+
+        RootedValue nurseryVal(cx);
+        if (!JS_GetProperty(cx, options, "nursery", &nurseryVal))
+            return false;
+        allocateInsideNursery = ToBoolean(nurseryVal);
+    }
+
+    static const Class cls = { "AllocationMarker" };
+
+    auto newKind = allocateInsideNursery ? GenericObject : TenuredObject;
+    RootedObject obj(cx, NewObjectWithGivenProto(cx, &cls, nullptr, newKind));
     if (!obj)
         return false;
+
     args.rval().setObject(*obj);
     return true;
 }
 
 namespace gcCallback {
 
 struct MajorGC {
     int32_t depth;
@@ -3117,21 +3129,23 @@ gc::ZealModeHelpText),
 "  source discarding is not explicitly enabled."),
 
     JS_FN_HELP("getConstructorName", GetConstructorName, 1, 0,
 "getConstructorName(object)",
 "  If the given object was created with `new Ctor`, return the constructor's display name. "
 "  Otherwise, return null."),
 
     JS_FN_HELP("allocationMarker", AllocationMarker, 0, 0,
-"allocationMarker()",
+"allocationMarker([options])",
 "  Return a freshly allocated object whose [[Class]] name is\n"
 "  \"AllocationMarker\". Such objects are allocated only by calls\n"
 "  to this function, never implicitly by the system, making them\n"
-"  suitable for use in allocation tooling tests.\n"),
+"  suitable for use in allocation tooling tests. Takes an optional\n"
+"  options object which may contain the following properties:\n"
+"    * nursery: bool, whether to allocate the object in the nursery\n"),
 
     JS_FN_HELP("setGCCallback", SetGCCallback, 1, 0,
 "setGCCallback({action:\"...\", options...})",
 "  Set the GC callback. action may be:\n"
 "    'minorGC' - run a nursery collection\n"
 "    'majorGC' - run a major collection, nesting up to a given 'depth'\n"),
 
     JS_FN_HELP("setARMHwCapFlags", SetARMHwCapFlags, 1, 0,
--- a/js/src/doc/Debugger/Debugger.Memory.md
+++ b/js/src/doc/Debugger/Debugger.Memory.md
@@ -219,16 +219,20 @@ compartment.
         string describing the reason it determined the full GC was necessary.
         Otherwise, `null` is returned. Known values include the following:
 
         * "GC mode"
         * "malloc bytes trigger"
         * "allocation trigger"
         * "requested"
 
+    `gcCycleNumber`
+    :   The GC cycle's "number". Does not correspond to the number
+        of GC cycles that have run, but is guaranteed to be monotonically
+        increasing.
 
 Function Properties of the `Debugger.Memory.prototype` Object
 -------------------------------------------------------------
 
 <code id='drain-alloc-log'>drainAllocationsLog()</code>
 :   When `trackingAllocationSites` is `true`, this method returns an array of
     recent `Object` allocations within the set of debuggees. *Recent* is
     defined as the `maxAllocationsLogLength` most recent `Object` allocations
@@ -239,16 +243,17 @@ Function Properties of the `Debugger.Mem
 
     <pre class='language-js'><code>
     {
       "timestamp": <i>timestamp</i>,
       "frame": <i>allocationSite</i>,
       "class": <i>className</i>,
       "constructor": <i>constructorName</i>,
       "size": <i>byteSize</i>,
+      "inNursery": <i>inNursery</i>,
     }
     </code></pre>
 
     Where
 
     * *timestamp* is the [timestamp][timestamps] of the allocation event.
 
     * *allocationSite* is an allocation site (as a
@@ -260,16 +265,19 @@ Function Properties of the `Debugger.Mem
     commonly) "Object".
 
     * *constructorName* is the constructor function's display name for objects
       created by `new Ctor`. If that data is not available, or the object was
       not created with a `new` expression, this property is `null`.
 
     * *byteSize* is the size of the object in bytes.
 
+    * *inNursery* is true if the allocation happened inside the nursery. False
+      if the allocation skipped the nursery and started in the tenured heap.
+
     When `trackingAllocationSites` is `false`, `drainAllocationsLog()` throws an
     `Error`.
 
 <code id='drain-tenure-log'>drainTenurePromotionsLog</code>
 :   When `trackingTenurePromotions` is `true`, this method returns an array of
     recent promotions from the nursery to the tenured heap within this
     Debugger's set of debuggees. *Recent* is defined as the
     `maxTenurePromotionsLogLength` most recent promotions since the last call to
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-18.js
@@ -0,0 +1,27 @@
+// Test drainAllocationsLog() entries' inNursery flag.
+
+const root = newGlobal();
+const dbg = new Debugger();
+const wrappedRoot = dbg.addDebuggee(root);
+
+dbg.memory.trackingAllocationSites = true;
+
+root.eval(
+  `
+  for (let i = 0; i < 10; i++)
+    allocationMarker({ nursery: true });
+
+  for (let i = 0; i < 10; i++)
+    allocationMarker({ nursery: false });
+  `
+);
+
+let entries = dbg.memory.drainAllocationsLog().filter(e => e.class == "AllocationMarker");
+
+assertEq(entries.length, 20);
+
+for (let i = 0; i < 10; i++)
+  assertEq(entries[i].inNursery, true);
+
+for (let i = 10; i < 20; i++)
+  assertEq(entries[i].inNursery, false);
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -464,16 +464,18 @@ PrepareForDebuggerOnIonCompilationHook(J
         scripts->resize(info->scriptIndex);
         info->numBlocks = 0;
     }
 }
 
 void
 jit::FinishOffThreadBuilder(JSContext* cx, IonBuilder* builder)
 {
+    MOZ_ASSERT(HelperThreadState().isLocked());
+
     // Clean the references to the pending IonBuilder, if we just finished it.
     if (builder->script()->baselineScript()->hasPendingIonBuilder() &&
         builder->script()->baselineScript()->pendingIonBuilder() == builder)
     {
         builder->script()->baselineScript()->removePendingIonBuilder(builder->script());
     }
 
     // If the builder is still in one of the helper thread list, then remove it.
@@ -569,42 +571,51 @@ LinkBackgroundCodeGen(JSContext* cx, Ion
     codegen->masm.constructRoot(cx);
 
     return LinkCodeGen(cx, builder, codegen, scripts, info);
 }
 
 void
 jit::LazyLink(JSContext* cx, HandleScript calleeScript)
 {
-    // Get the pending builder from the Ion frame.
-    MOZ_ASSERT(calleeScript->hasBaselineScript());
-    IonBuilder* builder = calleeScript->baselineScript()->pendingIonBuilder();
-    calleeScript->baselineScript()->removePendingIonBuilder(calleeScript);
+    IonBuilder* builder;
+
+    {
+        AutoLockHelperThreadState lock;
+
+        // Get the pending builder from the Ion frame.
+        MOZ_ASSERT(calleeScript->hasBaselineScript());
+        builder = calleeScript->baselineScript()->pendingIonBuilder();
+        calleeScript->baselineScript()->removePendingIonBuilder(calleeScript);
+
+        // Remove from pending.
+        builder->removeFrom(HelperThreadState().ionLazyLinkList());
+    }
 
     // See PrepareForDebuggerOnIonCompilationHook
     AutoScriptVector debugScripts(cx);
     OnIonCompilationInfo info(builder->alloc().lifoAlloc());
 
-    // Remove from pending.
-    builder->removeFrom(HelperThreadState().ionLazyLinkList());
-
     {
         AutoEnterAnalysis enterTypes(cx);
         if (!LinkBackgroundCodeGen(cx, builder, &debugScripts, &info)) {
             // Silently ignore OOM during code generation. The assembly code
             // doesn't has code to handle it after linking happened. So it's
             // not OK to throw a catchable exception from there.
             cx->clearPendingException();
         }
     }
 
     if (info.filled())
         Debugger::onIonCompilation(cx, debugScripts, info.graph);
 
-    FinishOffThreadBuilder(cx, builder);
+    {
+        AutoLockHelperThreadState lock;
+        FinishOffThreadBuilder(cx, builder);
+    }
 
     MOZ_ASSERT(calleeScript->hasBaselineScript());
     MOZ_ASSERT(calleeScript->baselineOrIonRawPointer());
 }
 
 uint8_t*
 jit::LazyLinkTopActivation(JSContext* cx)
 {
@@ -2585,25 +2596,25 @@ jit::SetEnterJitData(JSContext* cx, Ente
         data.calleeToken = CalleeToToken(state.script());
 
         if (state.script()->isForEval() &&
             !(state.asExecute()->type() & InterpreterFrame::GLOBAL))
         {
             ScriptFrameIter iter(cx);
             if (iter.isFunctionFrame())
                 data.calleeToken = CalleeToToken(iter.callee(cx), /* constructing = */ false);
-                
+
             // Push newTarget onto the stack, as well as Argv.
             if (!vals.reserve(2))
                 return false;
-            
+
             data.maxArgc = 2;
             data.maxArgv = vals.begin();
             vals.infallibleAppend(state.asExecute()->thisv());
-            if (iter.isFunctionFrame()) { 
+            if (iter.isFunctionFrame()) {
                 if (state.asExecute()->newTarget().isNull())
                     vals.infallibleAppend(iter.newTarget());
                 else
                     vals.infallibleAppend(state.asExecute()->newTarget());
             } else {
                 vals.infallibleAppend(NullValue());
             }
         }
--- a/js/src/vm/CommonPropertyNames.h
+++ b/js/src/vm/CommonPropertyNames.h
@@ -87,32 +87,34 @@
     macro(float32x4, float32x4, "Float32x4") \
     macro(float64, float64, "float64") \
     macro(float64x2, float64x2, "Float64x2") \
     macro(forceInterpreter, forceInterpreter, "forceInterpreter") \
     macro(forEach, forEach, "forEach") \
     macro(format, format, "format") \
     macro(frame, frame, "frame") \
     macro(from, from, "from") \
+    macro(gcCycleNumber, gcCycleNumber, "gcCycleNumber") \
     macro(get, get, "get") \
     macro(getInternals, getInternals, "getInternals") \
     macro(getOwnPropertyDescriptor, getOwnPropertyDescriptor, "getOwnPropertyDescriptor") \
     macro(getOwnPropertyNames, getOwnPropertyNames, "getOwnPropertyNames") \
     macro(getPropertyDescriptor, getPropertyDescriptor, "getPropertyDescriptor") \
     macro(global, global, "global") \
     macro(Handle, Handle, "Handle") \
     macro(has, has, "has") \
     macro(hasOwn, hasOwn, "hasOwn") \
     macro(hasOwnProperty, hasOwnProperty, "hasOwnProperty") \
     macro(ignoreCase, ignoreCase, "ignoreCase") \
     macro(ignorePunctuation, ignorePunctuation, "ignorePunctuation") \
     macro(index, index, "index") \
     macro(InitializeCollator, InitializeCollator, "InitializeCollator") \
     macro(InitializeDateTimeFormat, InitializeDateTimeFormat, "InitializeDateTimeFormat") \
     macro(InitializeNumberFormat, InitializeNumberFormat, "InitializeNumberFormat") \
+    macro(inNursery, inNursery, "inNursery") \
     macro(innermost, innermost, "innermost") \
     macro(input, input, "input") \
     macro(int8x16, int8x16, "Int8x16") \
     macro(int16x8, int16x8, "Int16x8") \
     macro(int32x4, int32x4, "Int32x4") \
     macro(isFinite, isFinite, "isFinite") \
     macro(isNaN, isNaN, "isNaN") \
     macro(isPrototypeOf, isPrototypeOf, "isPrototypeOf") \
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1738,18 +1738,19 @@ Debugger::appendAllocationSite(JSContext
     {
         AutoCompartment ac(cx, obj);
         if (!obj->constructorDisplayAtom(cx, &ctorName))
             return false;
     }
 
     auto className = obj->getClass()->name;
     auto size = JS::ubi::Node(obj.get()).size(cx->runtime()->debuggerMallocSizeOf);
-
-    if (!allocationsLog.emplaceBack(wrappedFrame, when, className, ctorName, size)) {
+    auto inNursery = gc::IsInsideNursery(obj);
+
+    if (!allocationsLog.emplaceBack(wrappedFrame, when, className, ctorName, size, inNursery)) {
         ReportOutOfMemory(cx);
         return false;
     }
 
     if (allocationsLog.length() > maxAllocationsLogLength) {
         if (!allocationsLog.popFront()) {
             ReportOutOfMemory(cx);
             return false;
@@ -8177,19 +8178,21 @@ DefineStringProperty(JSContext* cx, Hand
     }
     return DefineProperty(cx, obj, propName, val);
 }
 
 JSObject*
 GarbageCollectionEvent::toJSObject(JSContext* cx) const
 {
     RootedObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
+    RootedValue gcCycleNumberVal(cx, NumberValue(majorGCNumber_));
     if (!obj ||
         !DefineStringProperty(cx, obj, cx->names().nonincrementalReason, nonincrementalReason) ||
-        !DefineStringProperty(cx, obj, cx->names().reason, reason))
+        !DefineStringProperty(cx, obj, cx->names().reason, reason) ||
+        !DefineProperty(cx, obj, cx->names().gcCycleNumber, gcCycleNumberVal))
     {
         return nullptr;
     }
 
     RootedArrayObject slicesArray(cx, NewDenseEmptyArray(cx));
     if (!slicesArray)
         return nullptr;
 
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -302,31 +302,33 @@ class Debugger : private mozilla::Linked
             if (e->frame)
                 TraceEdge(trc, &e->frame, "Debugger::TenurePromotionsLogEntry::frame");
         }
     };
 
     struct AllocationsLogEntry : public JS::Traceable
     {
         AllocationsLogEntry(HandleObject frame, double when, const char* className,
-                            HandleAtom ctorName, size_t size)
+                            HandleAtom ctorName, size_t size, bool inNursery)
             : frame(frame),
               when(when),
               className(className),
               ctorName(ctorName),
-              size(size)
+              size(size),
+              inNursery(inNursery)
         {
             MOZ_ASSERT_IF(frame, UncheckedUnwrap(frame)->is<SavedFrame>());
         };
 
         RelocatablePtrObject frame;
         double when;
         const char* className;
         RelocatablePtrAtom ctorName;
         size_t size;
+        bool inNursery;
 
         static void trace(AllocationsLogEntry* e, JSTracer* trc) {
             if (e->frame)
                 TraceEdge(trc, &e->frame, "Debugger::AllocationsLogEntry::frame");
             if (e->ctorName)
                 TraceEdge(trc, &e->ctorName, "Debugger::AllocationsLogEntry::ctorName");
         }
     };
--- a/js/src/vm/DebuggerMemory.cpp
+++ b/js/src/vm/DebuggerMemory.cpp
@@ -223,16 +223,20 @@ DebuggerMemory::drainAllocationsLog(JSCo
             ctorName.setString(entry.ctorName);
         if (!DefineProperty(cx, obj, cx->names().constructor, ctorName))
             return false;
 
         RootedValue size(cx, NumberValue(entry.size));
         if (!DefineProperty(cx, obj, cx->names().size, size))
             return false;
 
+        RootedValue inNursery(cx, BooleanValue(entry.inNursery));
+        if (!DefineProperty(cx, obj, cx->names().inNursery, inNursery))
+            return false;
+
         result->setDenseElement(i, ObjectValue(*obj));
 
         // Pop the front queue entry, and delete it immediately, so that the GC
         // sees the AllocationsLogEntry's RelocatablePtr barriers run atomically
         // with the change to the graph (the queeue link).
         if (!dbg->allocationsLog.popFront()) {
             ReportOutOfMemory(cx);
             return false;
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/unit/test_onGarbageCollection-05.js
@@ -0,0 +1,37 @@
+// Test that the onGarbageCollection hook reports its gc cycle's number (aka the
+// major GC number) and that it is monotonically increasing.
+
+const root = newGlobal();
+const dbg = new Debugger();
+const wrappedRoot = dbg.addDebuggee(root)
+
+function run_test() {
+  do_test_pending();
+
+  let numFired = 0;
+  let lastGCCycleNumber = undefined;
+
+  (function loop() {
+    if (numFired == 10) {
+      dbg.memory.onGarbageCollection = undefined;
+      dbg.enabled = false;
+      return void do_test_finished();
+    }
+
+    dbg.memory.onGarbageCollection = data => {
+      print("onGarbageCollection: " + uneval(data));
+
+      if (numFired != 0) {
+        equal(typeof lastGCCycleNumber, "number");
+        equal(data.gcCycleNumber - lastGCCycleNumber, 1);
+      }
+
+      numFired++;
+      lastGCCycleNumber = data.gcCycleNumber;
+
+      executeSoon(loop);
+    };
+
+    root.eval("gc(this)");
+  }());
+}
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -75,16 +75,18 @@ support-files =
 [test_onGarbageCollection-01.js]
 head = head_ongc.js
 [test_onGarbageCollection-02.js]
 head = head_ongc.js
 [test_onGarbageCollection-03.js]
 head = head_ongc.js
 [test_onGarbageCollection-04.js]
 head = head_ongc.js
+[test_onGarbageCollection-05.js]
+head = head_ongc.js
 [test_reflect_parse.js]
 [test_localeCompare.js]
 # Bug 676965: test fails consistently on Android
 fail-if = os == "android"
 [test_recursive_import.js]
 [test_xpcomutils.js]
 [test_unload.js]
 [test_attributes.js]
new file mode 100644
--- /dev/null
+++ b/layout/style/CSSVariableImageTable.h
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* A global table that tracks images referenced by CSS variables. */
+
+#ifndef mozilla_CSSVariableImageTable_h
+#define mozilla_CSSVariableImageTable_h
+
+#include "nsClassHashtable.h"
+#include "nsCSSProperty.h"
+#include "nsCSSValue.h"
+#include "nsStyleContext.h"
+#include "nsTArray.h"
+
+/**
+ * CSSVariableImageTable maintains a global mapping
+ *   (nsStyleContext, nsCSSProperty) -> nsTArray<ImageValue>
+ * which allows us to track the relationship between CSS property values
+ * involving variables and any images they may reference.
+ *
+ * When properties like background-image contain a normal url(), the
+ * Declaration's data block will hold a reference to the ImageValue.  When a
+ * token stream is used, the Declaration only holds on to an
+ * nsCSSValueTokenStream object, and the ImageValue would only exist for the
+ * duration of nsRuleNode::WalkRuleTree, in the AutoCSSValueArray.  So instead
+ * when we re-parse a token stream and get an ImageValue, we record it in the
+ * CSSVariableImageTable to keep the ImageValue alive. Such ImageValues are
+ * eventually freed the next time the token stream is re-parsed, or when the
+ * associated style context is destroyed.
+ *
+ * To add ImageValues to the CSSVariableImageTable, callers should pass a lambda
+ * to CSSVariableImageTable::ReplaceAll() that calls
+ * CSSVariableImageTable::Add() for each ImageValue that needs to be added to
+ * the table. When callers are sure that the ImageValues for a given
+ * nsStyleContext won't be needed anymore, they can call
+ * CSSVariableImageTable::RemoveAll() to release them.
+ */
+
+namespace mozilla {
+namespace CSSVariableImageTable {
+
+namespace detail {
+
+typedef nsTArray<nsRefPtr<css::ImageValue>> ImageValueArray;
+typedef nsClassHashtable<nsGenericHashKey<nsCSSProperty>, ImageValueArray>
+        PerPropertyImageHashtable;
+typedef nsClassHashtable<nsPtrHashKey<nsStyleContext>, PerPropertyImageHashtable>
+        CSSVariableImageHashtable;
+
+inline CSSVariableImageHashtable& GetTable()
+{
+  static CSSVariableImageHashtable imageTable;
+  return imageTable;
+}
+
+#ifdef DEBUG
+inline bool& IsReplacing()
+{
+  static bool isReplacing = false;
+  return isReplacing;
+}
+#endif
+
+} // namespace detail
+
+/**
+ * ReplaceAll() allows callers to replace the ImageValues associated with a
+ * (nsStyleContext, nsCSSProperty) pair. The memory used by the previous list of
+ * ImageValues is automatically released.
+ *
+ * @param aContext The style context the ImageValues are associated with.
+ * @param aProp    The CSS property the ImageValues are associated with.
+ * @param aFunc    A lambda that calls CSSVariableImageTable::Add() to add new
+ *                 ImageValues which will replace the old ones.
+ */
+template <typename Lambda>
+inline void ReplaceAll(nsStyleContext* aContext,
+                       nsCSSProperty aProp,
+                       Lambda aFunc)
+{
+  MOZ_ASSERT(aContext);
+
+  auto& imageTable = detail::GetTable();
+
+  // Clear the existing image array, if any, for this property.
+  {
+    auto* perPropertyImageTable = imageTable.Get(aContext);
+    auto* imageList = perPropertyImageTable ? perPropertyImageTable->Get(aProp)
+                                            : nullptr;
+    if (imageList) {
+      imageList->ClearAndRetainStorage();
+    }
+  }
+
+#ifdef DEBUG
+  MOZ_ASSERT(!detail::IsReplacing());
+  detail::IsReplacing() = true;
+#endif
+
+  aFunc();
+
+#ifdef DEBUG
+  detail::IsReplacing() = false;
+#endif
+
+  // Clean up.
+  auto* perPropertyImageTable = imageTable.Get(aContext);
+  auto* imageList = perPropertyImageTable ? perPropertyImageTable->Get(aProp)
+                                          : nullptr;
+  if (imageList) {
+    if (imageList->IsEmpty()) {
+      // We used to have an image array for this property, but now we don't.
+      // Remove the entry in the per-property image table for this property.
+      // That may then allow us to remove the entire per-property image table.
+      perPropertyImageTable->Remove(aProp);
+      if (perPropertyImageTable->Count() == 0) {
+        imageTable.Remove(aContext);
+      }
+    } else {
+      // We still have a non-empty image array for this property. Compact the
+      // storage it's using if possible.
+      imageList->Compact();
+    }
+  }
+}
+
+/**
+ * Adds a new ImageValue @aValue to the CSSVariableImageTable, which will be
+ * associated with @aContext and @aProp.
+ *
+ * It's illegal to call this function outside of a lambda passed to
+ * CSSVariableImageTable::ReplaceAll().
+ */
+inline void
+Add(nsStyleContext* aContext, nsCSSProperty aProp, css::ImageValue* aValue)
+{
+  MOZ_ASSERT(aValue);
+  MOZ_ASSERT(aContext);
+  MOZ_ASSERT(detail::IsReplacing());
+
+  auto& imageTable = detail::GetTable();
+
+  // Ensure there's a per-property image table for this style context.
+  auto* perPropertyImageTable = imageTable.Get(aContext);
+  if (!perPropertyImageTable) {
+    perPropertyImageTable = new detail::PerPropertyImageHashtable();
+    imageTable.Put(aContext, perPropertyImageTable);
+  }
+
+  // Ensure there's an image array for this property.
+  auto* imageList = perPropertyImageTable->Get(aProp);
+  if (!imageList) {
+    imageList = new detail::ImageValueArray();
+    perPropertyImageTable->Put(aProp, imageList);
+  }
+
+  // Append the provided ImageValue to the list.
+  imageList->AppendElement(aValue);
+}
+
+/**
+ * Removes all ImageValues stored in the CSSVariableImageTable for the provided
+ * @aContext.
+ */
+inline void
+RemoveAll(nsStyleContext* aContext)
+{
+  detail::GetTable().Remove(aContext);
+}
+
+} // namespace CSSVariableImageTable
+} // namespace mozilla
+
+#endif // mozilla_CSSVariableImageTable_h
--- a/layout/style/nsCSSDataBlock.cpp
+++ b/layout/style/nsCSSDataBlock.cpp
@@ -5,26 +5,28 @@
 
 /*
  * compact representation of the property-value pairs within a CSS
  * declaration, and the code for expanding and compacting it
  */
 
 #include "nsCSSDataBlock.h"
 
+#include "CSSVariableImageTable.h"
 #include "mozilla/css/Declaration.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/WritingModes.h"
 #include "nsIDocument.h"
 #include "nsRuleData.h"
 #include "nsStyleContext.h"
 #include "nsStyleSet.h"
 
 using namespace mozilla;
+using namespace mozilla::css;
 
 /**
  * Does a fast move of aSource to aDest.  The previous value in
  * aDest is cleanly destroyed, and aSource is cleared.  Returns
  * true if, before the copy, the value at aSource compared unequal
  * to the value at aDest; false otherwise.
  */
 static bool
@@ -46,64 +48,69 @@ ShouldIgnoreColors(nsRuleData *aRuleData
 }
 
 /**
  * Tries to call |nsCSSValue::StartImageLoad()| on an image source.
  * Image sources are specified by |url()| or |-moz-image-rect()| function.
  */
 static void
 TryToStartImageLoadOnValue(const nsCSSValue& aValue, nsIDocument* aDocument,
-                           nsCSSValueTokenStream* aTokenStream)
+                           nsStyleContext* aContext, nsCSSProperty aProperty,
+                           bool aForTokenStream)
 {
   MOZ_ASSERT(aDocument);
 
   if (aValue.GetUnit() == eCSSUnit_URL) {
     aValue.StartImageLoad(aDocument);
-    if (aTokenStream) {
-      aTokenStream->mImageValues.PutEntry(aValue.GetImageStructValue());
+    if (aForTokenStream && aContext) {
+      CSSVariableImageTable::Add(aContext, aProperty,
+                                 aValue.GetImageStructValue());
     }
   }
   else if (aValue.GetUnit() == eCSSUnit_Image) {
     // If we already have a request, see if this document needs to clone it.
     imgIRequest* request = aValue.GetImageValue(nullptr);
 
     if (request) {
-      mozilla::css::ImageValue* imageValue = aValue.GetImageStructValue();
+      ImageValue* imageValue = aValue.GetImageStructValue();
       aDocument->StyleImageLoader()->MaybeRegisterCSSImage(imageValue);
-      if (aTokenStream) {
-        aTokenStream->mImageValues.PutEntry(imageValue);
+      if (aForTokenStream && aContext) {
+        CSSVariableImageTable::Add(aContext, aProperty, imageValue);
       }
     }
   }
   else if (aValue.EqualsFunction(eCSSKeyword__moz_image_rect)) {
     nsCSSValue::Array* arguments = aValue.GetArrayValue();
     MOZ_ASSERT(arguments->Count() == 6, "unexpected num of arguments");
 
     const nsCSSValue& image = arguments->Item(1);
-    TryToStartImageLoadOnValue(image, aDocument, aTokenStream);
+    TryToStartImageLoadOnValue(image, aDocument, aContext, aProperty,
+                               aForTokenStream);
   }
 }
 
 static void
 TryToStartImageLoad(const nsCSSValue& aValue, nsIDocument* aDocument,
-                    nsCSSProperty aProperty,
-                    nsCSSValueTokenStream* aTokenStream)
+                    nsStyleContext* aContext, nsCSSProperty aProperty,
+                    bool aForTokenStream)
 {
   if (aValue.GetUnit() == eCSSUnit_List) {
     for (const nsCSSValueList* l = aValue.GetListValue(); l; l = l->mNext) {
-      TryToStartImageLoad(l->mValue, aDocument, aProperty, aTokenStream);
+      TryToStartImageLoad(l->mValue, aDocument, aContext, aProperty,
+                          aForTokenStream);
     }
   } else if (nsCSSProps::PropHasFlags(aProperty,
                                       CSS_PROPERTY_IMAGE_IS_IN_ARRAY_0)) {
     if (aValue.GetUnit() == eCSSUnit_Array) {
       TryToStartImageLoadOnValue(aValue.GetArrayValue()->Item(0), aDocument,
-                                 aTokenStream);
+                                 aContext, aProperty, aForTokenStream);
     }
   } else {
-    TryToStartImageLoadOnValue(aValue, aDocument, aTokenStream);
+    TryToStartImageLoadOnValue(aValue, aDocument, aContext, aProperty,
+                               aForTokenStream);
   }
 }
 
 static inline bool
 ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSProperty aProperty)
 {
   // Don't initiate image loads for if-visited styles.  This is
   // important because:
@@ -124,32 +131,27 @@ MapSinglePropertyInto(nsCSSProperty aPro
 {
     MOZ_ASSERT(aValue->GetUnit() != eCSSUnit_Null, "oops");
 
     // Although aTarget is the nsCSSValue we are going to write into,
     // we also look at its value before writing into it.  This is done
     // when aTarget is a token stream value, which is the case when we
     // have just re-parsed a property that had a variable reference (in
     // nsCSSParser::ParsePropertyWithVariableReferences).  TryToStartImageLoad
-    // then records any resulting ImageValue objects on the
-    // nsCSSValueTokenStream object we found on aTarget.  See the comment
-    // above nsCSSValueTokenStream::mImageValues for why.
+    // then records any resulting ImageValue objects in the
+    // CSSVariableImageTable, to give them the appropriate lifetime.
     MOZ_ASSERT(aTarget->GetUnit() == eCSSUnit_TokenStream ||
                aTarget->GetUnit() == eCSSUnit_Null,
                "aTarget must only be a token stream (when re-parsing "
                "properties with variable references) or null");
 
-    nsCSSValueTokenStream* tokenStream =
-        aTarget->GetUnit() == eCSSUnit_TokenStream ?
-            aTarget->GetTokenStreamValue() :
-            nullptr;
-
     if (ShouldStartImageLoads(aRuleData, aProp)) {
         nsIDocument* doc = aRuleData->mPresContext->Document();
-        TryToStartImageLoad(*aValue, doc, aProp, tokenStream);
+        TryToStartImageLoad(*aValue, doc, aRuleData->mStyleContext, aProp,
+                            aTarget->GetUnit() == eCSSUnit_TokenStream);
     }
     *aTarget = *aValue;
     if (nsCSSProps::PropHasFlags(aProp,
             CSS_PROPERTY_IGNORED_WHEN_COLORS_DISABLED) &&
         ShouldIgnoreColors(aRuleData))
     {
         if (aProp == eCSSProperty_background_color) {
             // Force non-'transparent' background
@@ -708,17 +710,19 @@ nsCSSExpandedDataBlock::MapRuleInfoInto(
     uint8_t wm = WritingMode(aRuleData->mStyleContext).GetBits();
     aRuleData->mConditions.SetWritingModeDependency(wm);
   }
 
   nsCSSValue* dest = aRuleData->ValueFor(physicalProp);
   MOZ_ASSERT(dest->GetUnit() == eCSSUnit_TokenStream &&
              dest->GetTokenStreamValue()->mPropertyID == aPropID);
 
-  MapSinglePropertyInto(physicalProp, src, dest, aRuleData);
+  CSSVariableImageTable::ReplaceAll(aRuleData->mStyleContext, aPropID, [=] {
+    MapSinglePropertyInto(physicalProp, src, dest, aRuleData);
+  });
 }
 
 #ifdef DEBUG
 void
 nsCSSExpandedDataBlock::DoAssertInitialState()
 {
     mPropertiesSet.AssertIsEmpty("not initial state");
     mPropertiesImportant.AssertIsEmpty("not initial state");
--- a/layout/style/nsCSSProperty.h
+++ b/layout/style/nsCSSProperty.h
@@ -3,16 +3,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* enum types for CSS properties and their values */
  
 #ifndef nsCSSProperty_h___
 #define nsCSSProperty_h___
 
+#include <nsHashKeys.h>
+
 /*
    Declare the enum list using the magic of preprocessing
    enum values are "eCSSProperty_foo" (where foo is the property)
 
    To change the list of properties, see nsCSSPropList.h
 
  */
 enum nsCSSProperty {
@@ -59,16 +61,27 @@ enum nsCSSProperty {
   // Extra dummy values for nsCSSParser internal use.
   eCSSPropertyExtra_x_none_value,
   eCSSPropertyExtra_x_auto_value,
 
   // Extra value to represent custom properties (--*).
   eCSSPropertyExtra_variable
 };
 
+namespace mozilla {
+
+template<>
+inline PLDHashNumber
+Hash<nsCSSProperty>(const nsCSSProperty& aValue)
+{
+  return uint32_t(aValue);
+}
+
+} // namespace mozilla
+
 // The "descriptors" that can appear in a @font-face rule.
 // They have the syntax of properties but different value rules.
 enum nsCSSFontDesc {
   eCSSFontDesc_UNKNOWN = -1,
 #define CSS_FONT_DESC(name_, method_) eCSSFontDesc_##method_,
 #include "nsCSSFontDescList.h"
 #undef CSS_FONT_DESC
   eCSSFontDesc_COUNT
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -1537,28 +1537,16 @@ public:
   nsCOMPtr<nsIURI> mBaseURI;
   nsCOMPtr<nsIURI> mSheetURI;
   nsCOMPtr<nsIPrincipal> mSheetPrincipal;
   // XXX Should store sheet here (see Bug 952338)
   // mozilla::CSSStyleSheet* mSheet;
   uint32_t mLineNumber;
   uint32_t mLineOffset;
 
-  // This table is used to hold a reference on to any ImageValue that results
-  // from re-parsing this token stream at computed value time.  When properties
-  // like background-image contain a normal url(), the Declaration's data block
-  // will hold a reference to the ImageValue.  When a token stream is used,
-  // the Declaration only holds on to this nsCSSValueTokenStream object, and
-  // the ImageValue would only exist for the duration of
-  // nsRuleNode::WalkRuleTree, in the AutoCSSValueArray.  So instead when
-  // we re-parse a token stream and get an ImageValue, we record it in this
-  // table so that the Declaration can be the object that keeps holding
-  // a reference to it.
-  nsTHashtable<nsRefPtrHashKey<mozilla::css::ImageValue> > mImageValues;
-
 private:
   nsCSSValueTokenStream(const nsCSSValueTokenStream& aOther) = delete;
   nsCSSValueTokenStream& operator=(const nsCSSValueTokenStream& aOther) = delete;
 };
 
 class nsCSSValueFloatColor final {
 public:
   nsCSSValueFloatColor(float aComponent1, float aComponent2, float aComponent3,
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  
 /* the interface (to internal code) for retrieving computed style data */
 
+#include "CSSVariableImageTable.h"
 #include "mozilla/DebugOnly.h"
 
 #include "nsCSSAnonBoxes.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsPresContext.h"
 #include "nsIStyleRule.h"
 
@@ -160,16 +161,19 @@ nsStyleContext::~nsStyleContext()
     mParent->Release();
   }
 
   // Free up our data structs.
   mCachedInheritedData.DestroyStructs(mBits, presContext);
   if (mCachedResetData) {
     mCachedResetData->Destroy(mBits, presContext);
   }
+
+  // Free any ImageValues we were holding on to for CSS variable values.
+  CSSVariableImageTable::RemoveAll(this);
 }
 
 #ifdef DEBUG
 void
 nsStyleContext::AssertStructsNotUsedElsewhere(
                                        nsStyleContext* aDestroyingContext,
                                        int32_t aLevels) const
 {
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -465,18 +465,19 @@ class PushToTry(MachCommandBase):
         builds, platforms = self.validate_args(paths, tests, tags, builds, platforms)
         resolver = self._spawn(TestResolver)
 
         at = AutoTry(self.topsrcdir, resolver, self._mach_context)
         if at.find_uncommited_changes():
             print('ERROR please commit changes before continuing')
             sys.exit(1)
 
-        driver = self._spawn(BuildDriver)
-        driver.install_tests(remove=False)
+        if paths or tags:
+            driver = self._spawn(BuildDriver)
+            driver.install_tests(remove=False)
 
         manifests_by_flavor = at.resolve_manifests(paths=paths, tags=tags)
 
         if not manifests_by_flavor and not tests:
             print("No tests were found when attempting to resolve paths:\n\n\t%s" %
                   paths)
             sys.exit(1)
 
--- a/testing/marionette/client/marionette/tests/unit/test_findelement.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement.py
@@ -154,8 +154,18 @@ class TestElements(MarionetteTestCase):
         fbody = self.marionette.find_element(By.TAG_NAME, 'body')
         abody = self.marionette.get_active_element()
         self.assertEqual(fbody, abody)
 
     def test_throws_error_when_trying_to_use_invalid_selector_type(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         self.assertRaises(InvalidSelectorException, self.marionette.find_element, "Brie Search Type", "doesn't matter")
+
+    def test_element_id_is_valid_uuid(self):
+        import re
+        test_html = self.marionette.absolute_url("test.html")
+        self.marionette.navigate(test_html)
+        el = self.marionette.find_element(By.TAG_NAME, "body")
+        uuid_regex = re.compile('^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$')
+        self.assertIsNotNone(re.search(uuid_regex, el.id),
+                             'UUID for the WebElement is not valid. ID is {}'\
+                             .format(el.id))
--- a/testing/marionette/elements.js
+++ b/testing/marionette/elements.js
@@ -228,17 +228,18 @@ ElementManager.prototype = {
         if (XPCNativeWrapper(foundEl) == XPCNativeWrapper(element)) {
           return i;
         }
       } else {
         // cleanup reference to GC'd element
         delete this.seenItems[i];
       }
     }
-    let id = uuidGen.generateUUID().toString();
+    let uuid = uuidGen.generateUUID().toString();
+    let id = uuid.substring(1, uuid.length - 1);
     this.seenItems[id] = Components.utils.getWeakReference(element);
     return id;
   },
 
   /**
    * Retrieve element from its unique ID
    *
    * @param String id
--- a/testing/mozbase/mozprofile/setup.py
+++ b/testing/mozbase/mozprofile/setup.py
@@ -1,17 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import sys
 from setuptools import setup
 
 PACKAGE_NAME = 'mozprofile'
-PACKAGE_VERSION = '0.26'
+PACKAGE_VERSION = '0.27'
 
 # we only support python 2 right now
 assert sys.version_info[0] == 2
 
 deps = ['mozfile >= 1.0', 'mozlog >= 3.0']
 
 setup(name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
--- a/testing/web-platform/harness/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/harness/wptrunner/browsers/firefox.py
@@ -38,17 +38,18 @@ def check_args(**kwargs):
 
 def browser_kwargs(**kwargs):
     return {"binary": kwargs["binary"],
             "prefs_root": kwargs["prefs_root"],
             "debug_info": kwargs["debug_info"],
             "symbols_path": kwargs["symbols_path"],
             "stackwalk_binary": kwargs["stackwalk_binary"],
             "certutil_binary": kwargs["certutil_binary"],
-            "ca_certificate_path": kwargs["ssl_env"].ca_cert_path()}
+            "ca_certificate_path": kwargs["ssl_env"].ca_cert_path(),
+            "e10s": kwargs["gecko_e10s"]}
 
 
 def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
                     **kwargs):
     executor_kwargs = base_executor_kwargs(test_type, server_config,
                                            cache_manager, **kwargs)
     executor_kwargs["close_after_done"] = True
     if run_info_data["debug"] and kwargs["timeout_multiplier"] is None:
@@ -64,28 +65,29 @@ def env_options():
             "supports_debugger": True}
 
 
 class FirefoxBrowser(Browser):
     used_ports = set()
 
     def __init__(self, logger, binary, prefs_root, debug_info=None,
                  symbols_path=None, stackwalk_binary=None, certutil_binary=None,
-                 ca_certificate_path=None):
+                 ca_certificate_path=None, e10s=False):
         Browser.__init__(self, logger)
         self.binary = binary
         self.prefs_root = prefs_root
         self.marionette_port = None
         self.runner = None
         self.debug_info = debug_info
         self.profile = None
         self.symbols_path = symbols_path
         self.stackwalk_binary = stackwalk_binary
         self.ca_certificate_path = ca_certificate_path
         self.certutil_binary = certutil_binary
+        self.e10s = e10s
 
     def start(self):
         self.marionette_port = get_free_port(2828, exclude=self.used_ports)
         self.used_ports.add(self.marionette_port)
 
         env = os.environ.copy()
         env["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "1"
 
@@ -94,16 +96,18 @@ class FirefoxBrowser(Browser):
         preferences = self.load_prefs()
 
         self.profile = FirefoxProfile(locations=locations,
                                       preferences=preferences)
         self.profile.set_preferences({"marionette.defaultPrefs.enabled": True,
                                       "marionette.defaultPrefs.port": self.marionette_port,
                                       "dom.disable_open_during_load": False,
                                       "network.dns.localDomains": ",".join(hostnames)})
+        if self.e10s:
+            self.profile.set_preferences({"browser.tabs.remote.autostart": True})
 
         if self.ca_certificate_path is not None:
             self.setup_ssl()
 
         debug_args, cmd = browser_command(self.binary, [cmd_arg("marionette"), "about:blank"],
                                           self.debug_info)
 
         self.runner = FirefoxRunner(profile=self.profile,
--- a/testing/web-platform/harness/wptrunner/wptcommandline.py
+++ b/testing/web-platform/harness/wptrunner/wptcommandline.py
@@ -149,16 +149,18 @@ def create_parser(product_choices=None):
     ssl_group.add_argument("--host-key-path", action="store", type=abs_path,
                         help="Path to host private key when using pregenerated ssl certificates")
     ssl_group.add_argument("--host-cert-path", action="store", type=abs_path,
                         help="Path to host certificate when using pregenerated ssl certificates")
 
     gecko_group = parser.add_argument_group("Gecko-specific")
     gecko_group.add_argument("--prefs-root", dest="prefs_root", action="store", type=abs_path,
                              help="Path to the folder containing browser prefs")
+    gecko_group.add_argument("--e10s", dest="gecko_e10s", action="store_true",
+                             help="Path to the folder containing browser prefs")
 
     b2g_group = parser.add_argument_group("B2G-specific")
     b2g_group.add_argument("--b2g-no-backup", action="store_true", default=False,
                            help="Don't backup device before testrun with --product=b2g")
 
     servo_group = parser.add_argument_group("Servo-specific")
     servo_group.add_argument("--user-stylesheet",
                              default=[], action="append", dest="user_stylesheets",
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -1045,16 +1045,20 @@
         "path": "quirks-mode/active-and-hover-manual.html",
         "url": "/quirks-mode/active-and-hover-manual.html"
       },
       {
         "path": "screen-orientation/page-visibility-manual.html",
         "url": "/screen-orientation/page-visibility-manual.html"
       },
       {
+        "path": "selection/dir-manual.html",
+        "url": "/selection/dir-manual.html"
+      },
+      {
         "path": "svg/import/animate-dom-01-f-manual.svg",
         "url": "/svg/import/animate-dom-01-f-manual.svg"
       },
       {
         "path": "svg/import/animate-dom-02-f-manual.svg",
         "url": "/svg/import/animate-dom-02-f-manual.svg"
       },
       {
@@ -12139,32 +12143,16 @@
         "path": "XMLHttpRequest/xmlhttprequest-unsent.htm",
         "url": "/XMLHttpRequest/xmlhttprequest-unsent.htm"
       },
       {
         "path": "ambient-light/idlharness.html",
         "url": "/ambient-light/idlharness.html"
       },
       {
-        "path": "animation-timing/callback-invoked.html",
-        "url": "/animation-timing/callback-invoked.html"
-      },
-      {
-        "path": "animation-timing/cancel-invoked.html",
-        "url": "/animation-timing/cancel-invoked.html"
-      },
-      {
-        "path": "animation-timing/idlharness.html",
-        "url": "/animation-timing/idlharness.html"
-      },
-      {
-        "path": "animation-timing/same-dispatch-time.html",
-        "url": "/animation-timing/same-dispatch-time.html"
-      },
-      {
         "path": "battery-status/battery-interface-idlharness.html",
         "url": "/battery-status/battery-interface-idlharness.html"
       },
       {
         "path": "battery-status/battery-interface.html",
         "url": "/battery-status/battery-interface.html"
       },
       {
@@ -13007,16 +12995,20 @@
         "path": "custom-elements/registering-custom-elements/unresolved-elements-interface-svg-element.html",
         "url": "/custom-elements/registering-custom-elements/unresolved-elements-interface-svg-element.html"
       },
       {
         "path": "dom/collections/HTMLCollection-empty-name.html",
         "url": "/dom/collections/HTMLCollection-empty-name.html"
       },
       {
+        "path": "dom/collections/HTMLCollection-supported-property-names.html",
+        "url": "/dom/collections/HTMLCollection-supported-property-names.html"
+      },
+      {
         "path": "dom/events/Event-constants.html",
         "url": "/dom/events/Event-constants.html"
       },
       {
         "path": "dom/events/Event-constructors.html",
         "url": "/dom/events/Event-constructors.html"
       },
       {
@@ -15407,16 +15399,20 @@
         "path": "html/dom/elements/global-attributes/the-translate-attribute-011.html",
         "url": "/html/dom/elements/global-attributes/the-translate-attribute-011.html"
       },
       {
         "path": "html/dom/elements/global-attributes/the-translate-attribute-012.html",
         "url": "/html/dom/elements/global-attributes/the-translate-attribute-012.html"
       },
       {
+        "path": "html/editing/activation/click.html",
+        "url": "/html/editing/activation/click.html"
+      },
+      {
         "path": "html/editing/dnd/dom/draggable.html",
         "url": "/html/editing/dnd/dom/draggable.html"
       },
       {
         "path": "html/editing/dnd/dom/events.html",
         "url": "/html/editing/dnd/dom/events.html"
       },
       {
@@ -17775,16 +17771,36 @@
         "path": "html/syntax/parsing/the-end.html",
         "url": "/html/syntax/parsing/the-end.html"
       },
       {
         "path": "html/syntax/serializing-html-fragments/outerHTML.html",
         "url": "/html/syntax/serializing-html-fragments/outerHTML.html"
       },
       {
+        "path": "html/webappapis/animation-frames/callback-exception.html",
+        "url": "/html/webappapis/animation-frames/callback-exception.html"
+      },
+      {
+        "path": "html/webappapis/animation-frames/callback-invoked.html",
+        "url": "/html/webappapis/animation-frames/callback-invoked.html"
+      },
+      {
+        "path": "html/webappapis/animation-frames/cancel-invoked.html",
+        "url": "/html/webappapis/animation-frames/cancel-invoked.html"
+      },
+      {
+        "path": "html/webappapis/animation-frames/idlharness.html",
+        "url": "/html/webappapis/animation-frames/idlharness.html"
+      },
+      {
+        "path": "html/webappapis/animation-frames/same-dispatch-time.html",
+        "url": "/html/webappapis/animation-frames/same-dispatch-time.html"
+      },
+      {
         "path": "html/webappapis/atob/base64.html",
         "url": "/html/webappapis/atob/base64.html"
       },
       {
         "path": "html/webappapis/scripting/events/body-onload.html",
         "url": "/html/webappapis/scripting/events/body-onload.html"
       },
       {
@@ -18007,16 +18023,20 @@
         "path": "js/builtins/Math.min.html",
         "url": "/js/builtins/Math.min.html"
       },
       {
         "path": "js/builtins/Object.prototype.freeze.html",
         "url": "/js/builtins/Object.prototype.freeze.html"
       },
       {
+        "path": "js/builtins/Object.prototype.getOwnPropertyNames.html",
+        "url": "/js/builtins/Object.prototype.getOwnPropertyNames.html"
+      },
+      {
         "path": "js/builtins/Object.prototype.hasOwnProperty-order.html",
         "url": "/js/builtins/Object.prototype.hasOwnProperty-order.html"
       },
       {
         "path": "js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html",
         "url": "/js/builtins/Object.prototype.hasOwnProperty-prototype-chain.html"
       },
       {
@@ -24899,36 +24919,28 @@
         "path": "screen-orientation/orientation-reading.html",
         "url": "/screen-orientation/orientation-reading.html"
       },
       {
         "path": "selection/Document-open.html",
         "url": "/selection/Document-open.html"
       },
       {
-        "path": "selection/addRange.html",
-        "url": "/selection/addRange.html"
-      },
-      {
         "path": "selection/collapse.html",
         "url": "/selection/collapse.html"
       },
       {
         "path": "selection/collapseToStartEnd.html",
         "url": "/selection/collapseToStartEnd.html"
       },
       {
         "path": "selection/deleteFromDocument.html",
         "url": "/selection/deleteFromDocument.html"
       },
       {
-        "path": "selection/dir.manual.html",
-        "url": "/selection/dir.manual.html"
-      },
-      {
         "path": "selection/extend.html",
         "url": "/selection/extend.html"
       },
       {
         "path": "selection/getRangeAt.html",
         "url": "/selection/getRangeAt.html"
       },
       {
@@ -25067,40 +25079,32 @@
         "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-002.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-002.html"
       },
       {
         "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-003.html"
       },
       {
-        "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html",
-        "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html"
-      },
-      {
         "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-005.html"
       },
       {
         "path": "shadow-dom/elements-and-dom-objects/the-content-html-element/test-006.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-content-html-element/test-006.html"
       },
       {
         "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-001.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-001.html"
       },
       {
         "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-002.html"
       },
       {
-        "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html",
-        "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html"
-      },
-      {
         "path": "shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html",
         "url": "/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-004.html"
       },
       {
         "path": "shadow-dom/events/event-dispatch/test-001.html",
         "url": "/shadow-dom/events/event-dispatch/test-001.html"
       },
       {
@@ -27487,16 +27491,20 @@
         "path": "workers/semantics/encodings/003.html",
         "url": "/workers/semantics/encodings/003.html"
       },
       {
         "path": "workers/semantics/encodings/004.html",
         "url": "/workers/semantics/encodings/004.html"
       },
       {
+        "path": "workers/semantics/encodings/004.worker.js",
+        "url": "/workers/semantics/encodings/004.worker"
+      },
+      {
         "path": "workers/semantics/interface-objects/001.worker.js",
         "url": "/workers/semantics/interface-objects/001.worker"
       },
       {
         "path": "workers/semantics/interface-objects/002.worker.js",
         "url": "/workers/semantics/interface-objects/002.worker"
       },
       {
@@ -28763,16 +28771,21 @@
         "url": "/media-source/mediasource-redundant-seek.html"
       },
       {
         "path": "quirks-mode/hashless-hex-color.html",
         "timeout": "long",
         "url": "/quirks-mode/hashless-hex-color.html"
       },
       {
+        "path": "selection/addRange.html",
+        "timeout": "long",
+        "url": "/selection/addRange.html"
+      },
+      {
         "path": "service-workers/cache-storage/common.https.html",
         "timeout": "long",
         "url": "/service-workers/cache-storage/common.https.html"
       },
       {
         "path": "service-workers/cache-storage/serviceworker/cache-add.https.html",
         "timeout": "long",
         "url": "/service-workers/cache-storage/serviceworker/cache-add.https.html"
@@ -29029,27 +29042,17 @@
       },
       {
         "path": "webdriver/user_input/clear_test.py"
       }
     ]
   },
   "local_changes": {
     "deleted": [],
-    "items": {
-      "testharness": {
-        "selection/addRange.html": [
-          {
-            "path": "selection/addRange.html",
-            "timeout": "long",
-            "url": "/selection/addRange.html"
-          }
-        ]
-      }
-    },
+    "items": {},
     "reftest_nodes": {}
   },
   "reftest_nodes": {
     "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm": [
       {
         "path": "2dcontext/building-paths/canvas_complexshapes_arcto_001.htm",
         "references": [
           [
@@ -34444,12 +34447,12 @@
             "/webvtt/rendering/cues-with-video/processing-model/too_many_cues_wrapped-ref.html",
             "=="
           ]
         ],
         "url": "/webvtt/rendering/cues-with-video/processing-model/too_many_cues_wrapped.html"
       }
     ]
   },
-  "rev": "b54dddfdcc4761d2f8a892fd783d60353949992d",
+  "rev": "4600b7dbae996754fe52f48bc9c225834f11a686",
   "url_base": "/",
   "version": 2
 }
\ No newline at end of file
--- a/testing/web-platform/meta/XMLHttpRequest/send-content-type-charset.htm.ini
+++ b/testing/web-platform/meta/XMLHttpRequest/send-content-type-charset.htm.ini
@@ -16,8 +16,38 @@
     expected: FAIL
 
   [XMLHttpRequest: send() - charset parameter of Content-Type 6]
     expected: FAIL
 
   [XMLHttpRequest: send() - charset parameter of Content-Type 7]
     expected: FAIL
 
+  [header with invalid MIME type is not changed]
+    expected: FAIL
+
+  [known charset but bogus header - missing MIME type]
+    expected: FAIL
+
+  [bogus charset and bogus header - missing MIME type]
+    expected: FAIL
+
+  [If no charset= param is given, implementation should not add one - unknown MIME]
+    expected: FAIL
+
+  [If no charset= param is given, implementation should not add one - known MIME]
+    expected: FAIL
+
+  [charset given but wrong, fix it (unknown MIME, bogus charset)]
+    expected: FAIL
+
+  [charset given but wrong, fix it (known MIME, bogus charset)]
+    expected: FAIL
+
+  [charset given but wrong, fix it (known MIME, actual charset)]
+    expected: FAIL
+
+  [If multiple charset parameters are given, all should be rewritten]
+    expected: FAIL
+
+  [No content type set, give MIME and charset]
+    expected: FAIL
+
--- a/testing/web-platform/meta/battery-status/battery-interface-idlharness.html.ini
+++ b/testing/web-platform/meta/battery-status/battery-interface-idlharness.html.ini
@@ -45,8 +45,9 @@
   [EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on navigator.getBattery() with too few arguments must throw TypeError]
     expected: FAIL
 
   [EventTarget interface: navigator.getBattery() must inherit property "dispatchEvent" with the proper type (2)]
     expected: FAIL
 
   [EventTarget interface: calling dispatchEvent(Event) on navigator.getBattery() with too few arguments must throw TypeError]
     expected: FAIL
+
--- a/testing/web-platform/meta/battery-status/battery-interface.html.ini
+++ b/testing/web-platform/meta/battery-status/battery-interface.html.ini
@@ -30,8 +30,9 @@
   [onlevelchange: treat object as null]
     expected: FAIL
 
   [onlevelchange: treat object with non-callable call property as null]
     expected: FAIL
 
   [onlevelchange: treat array as null]
     expected: FAIL
+
--- a/testing/web-platform/meta/dom/nodes/Node-cloneNode.html.ini
+++ b/testing/web-platform/meta/dom/nodes/Node-cloneNode.html.ini
@@ -1,8 +1,5 @@
 [Node-cloneNode.html]
   type: testharness
   [Node.cloneNode]
     expected: FAIL
 
-  [implementation.createHTMLDocument]
-    expected: FAIL
-
--- a/testing/web-platform/meta/editing/event.html.ini
+++ b/testing/web-platform/meta/editing/event.html.ini
@@ -1,3 +1,872 @@
 [event.html]
   type: testharness
-  expected: CRASH
+  [Simple editable div: beforeinput event, canceled]
+    expected: FAIL
+
+  [Simple editable div: input event, canceled]
+    expected: FAIL
+
+  [Simple editable div: beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Simple editable div: input event, uncanceled]
+    expected: FAIL
+
+  [Editable b: execCommand() must not throw, canceled]
+    expected: FAIL
+
+  [Editable b: beforeinput event, canceled]
+    expected: FAIL
+
+  [Editable b: input event, canceled]
+    expected: FAIL
+
+  [Editable b: execCommand() must not throw, uncanceled]
+    expected: FAIL
+
+  [Editable b: beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Editable b: input event, uncanceled]
+    expected: FAIL
+
+  [Changing selection from handler: beforeinput event, canceled]
+    expected: FAIL
+
+  [Changing selection from handler: input event, canceled]
+    expected: FAIL
+
+  [Changing selection from handler: beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Changing selection from handler: input event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command backColor, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command backColor, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command backColor, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "green": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command backColor, value "green": input event, canceled]
+    expected: FAIL
+
+  [Command backColor, value "green": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command backColor, value "green": input event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command createLink, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command createLink, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command createLink, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "http://www.w3.org/community/editing/": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command createLink, value "http://www.w3.org/community/editing/": input event, canceled]
+    expected: FAIL
+
+  [Command createLink, value "http://www.w3.org/community/editing/": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command createLink, value "http://www.w3.org/community/editing/": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "serif": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "serif": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "serif": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "Helvetica": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "Helvetica": input event, canceled]
+    expected: FAIL
+
+  [Command fontName, value "Helvetica": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontName, value "Helvetica": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "6": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "6": input event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "6": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "6": input event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "15px": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "15px": input event, canceled]
+    expected: FAIL
+
+  [Command fontSize, value "15px": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command fontSize, value "15px": input event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command foreColor, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command foreColor, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command foreColor, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "green": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command foreColor, value "green": input event, canceled]
+    expected: FAIL
+
+  [Command foreColor, value "green": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command foreColor, value "green": input event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "green": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "green": input event, canceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "green": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command hiliteColor, value "green": input event, uncanceled]
+    expected: FAIL
+
+  [Command italic, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command italic, value "": input event, canceled]
+    expected: FAIL
+
+  [Command italic, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command italic, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command italic, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command italic, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command italic, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command italic, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command removeFormat, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command removeFormat, value "": input event, canceled]
+    expected: FAIL
+
+  [Command removeFormat, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command removeFormat, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command removeFormat, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command removeFormat, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command removeFormat, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command removeFormat, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "": input event, canceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command strikeThrough, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command subscript, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command subscript, value "": input event, canceled]
+    expected: FAIL
+
+  [Command subscript, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command subscript, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command subscript, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command subscript, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command subscript, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command subscript, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command superscript, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command superscript, value "": input event, canceled]
+    expected: FAIL
+
+  [Command superscript, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command superscript, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command superscript, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command superscript, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command superscript, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command superscript, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command underline, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command underline, value "": input event, canceled]
+    expected: FAIL
+
+  [Command underline, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command underline, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command underline, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command underline, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command underline, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command underline, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command unlink, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command unlink, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command unlink, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command unlink, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command unlink, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command unlink, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command delete, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command delete, value "": input event, canceled]
+    expected: FAIL
+
+  [Command delete, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command delete, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command delete, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command delete, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command delete, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command delete, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command formatBlock, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command formatBlock, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "p": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command formatBlock, value "p": input event, canceled]
+    expected: FAIL
+
+  [Command formatBlock, value "p": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command formatBlock, value "p": input event, uncanceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "": input event, canceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command forwardDelete, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command indent, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command indent, value "": input event, canceled]
+    expected: FAIL
+
+  [Command indent, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command indent, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command indent, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command indent, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command indent, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command indent, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "": input event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "id": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "id": input event, canceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "id": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHorizontalRule, value "id": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "": input event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "<b>hi</b>": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "<b>hi</b>": input event, canceled]
+    expected: FAIL
+
+  [Command insertHTML, value "<b>hi</b>": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertHTML, value "<b>hi</b>": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertImage, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertImage, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertImage, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "../images/green.png": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertImage, value "../images/green.png": input event, canceled]
+    expected: FAIL
+
+  [Command insertImage, value "../images/green.png": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertImage, value "../images/green.png": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertLineBreak, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "": input event, canceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertOrderedList, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "": input event, canceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertParagraph, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "": execCommand() must not throw, canceled]
+    expected: FAIL
+
+  [Command insertText, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertText, value "": execCommand() must not throw, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertText, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertText, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "abc": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertText, value "abc": input event, canceled]
+    expected: FAIL
+
+  [Command insertText, value "abc": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertText, value "abc": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "": input event, canceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command insertUnorderedList, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "": input event, canceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyCenter, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyFull, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyFull, value "": input event, canceled]
+    expected: FAIL
+
+  [Command justifyFull, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyFull, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyFull, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyFull, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command justifyFull, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyFull, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "": input event, canceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyLeft, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyRight, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyRight, value "": input event, canceled]
+    expected: FAIL
+
+  [Command justifyRight, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyRight, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command justifyRight, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command justifyRight, value "quasit": input event, canceled]
+    expected: FAIL
+
+  [Command justifyRight, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command justifyRight, value "quasit": input event, uncanceled]
+    expected: FAIL
+
+  [Command outdent, value "": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command outdent, value "": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command outdent, value "": input event, uncanceled]
+    expected: FAIL
+
+  [Command outdent, value "quasit": beforeinput event, canceled]
+    expected: FAIL
+
+  [Command outdent, value "quasit": beforeinput event, uncanceled]
+    expected: FAIL
+
+  [Command outdent, value "quasit": input event, uncanceled]
+    expected: FAIL
+
--- a/testing/web-platform/meta/media-source/mediasource-buffered.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-buffered.html.ini
@@ -1,14 +1,16 @@
 [mediasource-buffered.html]
   type: testharness
   prefs: [media.mediasource.enabled:true]
   [Demuxed content with different lengths]
-    expected: FAIL
+    expected:
+      if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS
+      if debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): PASS
+      if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): PASS
+      if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): PASS
+      if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): PASS
+      if not debug and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): PASS
+      FAIL
 
   [Muxed content with different lengths]
     expected: FAIL
 
-  [Demuxed content with an empty buffered range on one SourceBuffer]
-    expected:
-      if os == "linux": FAIL
-      if (os == "win") and (version == "5.1.2600"): FAIL
-
--- a/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini
+++ b/testing/web-platform/meta/mixed-content/blockable/http-csp/same-host-http/picture-tag/top-level/no-redirect/opt-in-blocks.https.html.ini
@@ -1,11 +1,11 @@
 [opt-in-blocks.https.html]
   type: testharness
   disabled:
-    if debug and os == "linux": https://bugzilla.mozilla.org/show_bug.cgi?id=1184351
+    if debug and (os == "linux"): https://bugzilla.mozilla.org/show_bug.cgi?id=1184351
   [opt_in_method: http-csp\n                                 origin: same-host-http\n                                 source_scheme: https\n                                 context_nesting: top-level\n                                 redirection: no-redirect\n                                 subresource: picture-tag\n                                 expectation: blocked]
     expected:
       if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): FAIL
       if debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): FAIL
       if debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): FAIL
       if debug and (os == "mac") and (version == "OS X 10.10.2") and (processor == "x86_64") and (bits == 64): FAIL
 
--- a/testing/web-platform/meta/mozilla-sync
+++ b/testing/web-platform/meta/mozilla-sync
@@ -1,1 +1,1 @@
-3fd466ba1167bbba529769448e96dd900b827296
\ No newline at end of file
+ec39b5e1f451d12030abbb2bc95ea506a73aef73
\ No newline at end of file
deleted file mode 100644
--- a/testing/web-platform/meta/selection/dir.manual.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[dir.manual.html]
-  type: testharness
-  expected: TIMEOUT
--- a/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini
@@ -1,6 +1,7 @@
 [cache-match.https.html]
   type: testharness
   prefs: [dom.serviceWorkers.enabled: true, dom.serviceWorkers.interception.enabled: true, dom.serviceWorkers.exemptFromPerDomainMax:true, dom.caches.enabled:true]
   [Cache.match and Cache.matchAll]
     expected: FAIL
     bug: https://github.com/w3c/web-platform-tests/issues/2098
+
--- a/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-put.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-put.https.html.ini
@@ -1,6 +1,25 @@
 [cache-put.https.html]
   type: testharness
   prefs: [dom.serviceWorkers.enabled: true, dom.serviceWorkers.interception.enabled: true, dom.serviceWorkers.exemptFromPerDomainMax:true, dom.caches.enabled:true]
   [Cache.put with request URLs containing embedded credentials]
     expected: FAIL
     bug: https://github.com/w3c/web-platform-tests/issues/2098
+
+  [Cache.put called with Request and Response from fetch()]
+    expected: FAIL
+
+  [Cache.put with a Response containing an empty URL]
+    expected: FAIL
+
+  [Cache.put with HTTP 500 response]
+    expected: FAIL
+
+  [Cache.put called twice with matching Requests and different Responses]
+    expected: FAIL
+
+  [Cache.put called twice with request URLs that differ only by a fragment]
+    expected: FAIL
+
+  [Cache.put with a relative URL]
+    expected: FAIL
+
--- a/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-storage-match.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-storage-match.https.html.ini
@@ -1,3 +1,15 @@
 [cache-storage-match.https.html]
   type: testharness
   prefs: [dom.serviceWorkers.enabled: true, dom.serviceWorkers.interception.enabled: true, dom.serviceWorkers.exemptFromPerDomainMax:true, dom.caches.enabled:true]
+  [CacheStorageMatch with no cache name provided]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches by name]
+    expected: FAIL
+
+  [CacheStorageMatch a string request]
+    expected: FAIL
+
--- a/testing/web-platform/meta/service-workers/cache-storage/window/cache-put.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/window/cache-put.https.html.ini
@@ -1,6 +1,25 @@
 [cache-put.https.html]
   type: testharness
   prefs: [dom.caches.enabled:true]
   [Cache.put with request URLs containing embedded credentials]
     expected: FAIL
     bug: https://github.com/w3c/web-platform-tests/issues/2098
+
+  [Cache.put called with Request and Response from fetch()]
+    expected: FAIL
+
+  [Cache.put with a Response containing an empty URL]
+    expected: FAIL
+
+  [Cache.put with HTTP 500 response]
+    expected: FAIL
+
+  [Cache.put called twice with matching Requests and different Responses]
+    expected: FAIL
+
+  [Cache.put called twice with request URLs that differ only by a fragment]
+    expected: FAIL
+
+  [Cache.put with a relative URL]
+    expected: FAIL
+
--- a/testing/web-platform/meta/service-workers/cache-storage/window/cache-storage-match.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/window/cache-storage-match.https.html.ini
@@ -1,3 +1,15 @@
 [cache-storage-match.https.html]
   type: testharness
   prefs: [dom.caches.enabled:true]
+  [CacheStorageMatch with no cache name provided]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches by name]
+    expected: FAIL
+
+  [CacheStorageMatch a string request]
+    expected: FAIL
+
--- a/testing/web-platform/meta/service-workers/cache-storage/worker/cache-put.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/worker/cache-put.https.html.ini
@@ -1,6 +1,25 @@
 [cache-put.https.html]
   type: testharness
   prefs: [dom.caches.enabled:true]
   [Cache.put with request URLs containing embedded credentials]
     expected: FAIL
     bug: https://github.com/w3c/web-platform-tests/issues/2098
+
+  [Cache.put called with Request and Response from fetch()]
+    expected: FAIL
+
+  [Cache.put with a Response containing an empty URL]
+    expected: FAIL
+
+  [Cache.put with HTTP 500 response]
+    expected: FAIL
+
+  [Cache.put called twice with matching Requests and different Responses]
+    expected: FAIL
+
+  [Cache.put called twice with request URLs that differ only by a fragment]
+    expected: FAIL
+
+  [Cache.put with a relative URL]
+    expected: FAIL
+
--- a/testing/web-platform/meta/service-workers/cache-storage/worker/cache-storage-match.https.html.ini
+++ b/testing/web-platform/meta/service-workers/cache-storage/worker/cache-storage-match.https.html.ini
@@ -1,3 +1,15 @@
 [cache-storage-match.https.html]
   type: testharness
   prefs: [dom.caches.enabled:true]
+  [CacheStorageMatch with no cache name provided]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches]
+    expected: FAIL
+
+  [CacheStorageMatch from one of many caches by name]
+    expected: FAIL
+
+  [CacheStorageMatch a string request]
+    expected: FAIL
+
deleted file mode 100644
--- a/testing/web-platform/meta/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[test-004.html]
-  type: testharness
-  [A_10_04_04_T01]
-    expected: FAIL
-
-  [A_10_04_04_T02]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html.ini
+++ /dev/null
@@ -1,8 +0,0 @@
-[test-003.html]
-  type: testharness
-  [A_10_05_03_T01]
-    expected: FAIL
-
-  [A_10_05_03_T02]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/shadow-dom/events/event-dispatch/test-001.html.ini
+++ /dev/null
@@ -1,17 +0,0 @@
-[test-001.html]
-  type: testharness
-  [A_05_05_01_T03]
-    expected: FAIL
-
-  [A_05_05_01_T04]
-    expected: FAIL
-
-  [A_05_05_01_T05]
-    expected: FAIL
-
-  [A_05_05_01_T06]
-    expected: FAIL
-
-  [A_05_05_01_T07]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/shadow-dom/events/event-retargeting/test-004.html.ini
+++ /dev/null
@@ -1,20 +0,0 @@
-[test-004.html]
-  type: testharness
-  [A_05_01_04_T03]
-    expected: FAIL
-
-  [A_05_01_04_T04]
-    expected: FAIL
-
-  [A_05_01_04_T05]
-    expected: FAIL
-
-  [A_05_01_04_T06]
-    expected: FAIL
-
-  [A_05_01_04_T07]
-    expected: FAIL
-
-  [A_05_01_04_T12]
-    expected: FAIL
-
--- a/testing/web-platform/meta/typedarrays/ArrayBuffer_constructor.html.ini
+++ b/testing/web-platform/meta/typedarrays/ArrayBuffer_constructor.html.ini
@@ -1,6 +1,9 @@
 [ArrayBuffer_constructor.html]
   type: testharness
   [The argument -4043309056 should be interpreted as 251658240 for ArrayBuffer constructor.10]
     disabled:
       if not debug and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): https://bugzilla.mozilla.org/show_bug.cgi?id=1125161
 
+  [The argument -4043309056 should be interpreted as 0 for ArrayBuffer constructor.10]
+    expected: FAIL
+
--- a/testing/web-platform/meta/typedarrays/constructors.html.ini
+++ b/testing/web-platform/meta/typedarrays/constructors.html.ini
@@ -430,8 +430,35 @@
     expected: FAIL
 
   [The argument true (16) should be interpreted as 1 for interface Float64Array.]
     expected: FAIL
 
   [The argument object "[object Object\]" (18) should be interpreted as 0 for interface Float64Array.]
     expected: FAIL
 
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Int8Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Uint8Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Uint8ClampedArray.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Int16Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Uint16Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Int32Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Uint32Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Float32Array.]
+    expected: FAIL
+
+  [The argument -4043309056 (10) should be interpreted as 0 for interface Float64Array.]
+    expected: FAIL
+
--- a/testing/web-platform/meta/url/a-element.html.ini
+++ b/testing/web-platform/meta/url/a-element.html.ini
@@ -496,8 +496,11 @@
     expected: FAIL
 
   [Parsing: <sc://ñ.test/> against <about:blank>]
     expected: FAIL
 
   [Parsing: <sc:\\../> against <about:blank>]
     expected: FAIL
 
+  [Parsing: <file:..> against <http://www.example.com/test>]
+    expected: FAIL
+
--- a/testing/web-platform/meta/url/a-element.xhtml.ini
+++ b/testing/web-platform/meta/url/a-element.xhtml.ini
@@ -514,8 +514,11 @@
     expected: FAIL
 
   [Parsing: <sc://ñ.test/> against <about:blank>]
     expected: FAIL
 
   [Parsing: <sc:\\../> against <about:blank>]
     expected: FAIL
 
+  [Parsing: <file:..> against <http://www.example.com/test>]
+    expected: FAIL
+
--- a/testing/web-platform/meta/url/url-constructor.html.ini
+++ b/testing/web-platform/meta/url/url-constructor.html.ini
@@ -415,8 +415,11 @@
     expected: FAIL
 
   [Parsing: <sc://ñ.test/> against <about:blank>]
     expected: FAIL
 
   [Parsing: <sc:\\../> against <about:blank>]
     expected: FAIL
 
+  [Parsing: <file:..> against <http://www.example.com/test>]
+    expected: FAIL
+
--- a/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini
+++ b/testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-async-respond-with.https.html.ini
@@ -1,6 +1,5 @@
 [fetch-event-async-respond-with.https.html]
   type: testharness
-  expected: OK
   [Calling respondWith asynchronously throws an exception]
     expected: FAIL
 
--- a/testing/web-platform/tests/DOMEvents/constructors.html
+++ b/testing/web-platform/tests/DOMEvents/constructors.html
@@ -139,9 +139,15 @@ Object.keys(expected).forEach(function(i
 
     var dictionary = {};
     fill_in(iface, dictionary);
 
     var event = new self[iface]("type", dictionary);
     assert_props(iface, event, false);
   }, iface + " constructor (argument with non-default values)");
 });
+
+test(function () {
+  assert_throws(new TypeError(), function() {
+    new UIEvent("x", { view: 7 })
+  });
+}, "UIEvent constructor (view argument with wrong type)")
 </script>
--- a/testing/web-platform/tests/README.md
+++ b/testing/web-platform/tests/README.md
@@ -161,17 +161,17 @@ detailed in the [Contributing Guidelines
 too small or too simple, especially if it corresponds to something for
 which you've noted an interoperability bug in a browser.
 
 The way to contribute is just as usual:
 
 * Fork this repository (and make sure you're still relatively in sync
   with it if you forked a while ago).
 * Create a branch for your changes:
-  `git checkout -b your-name/topic`.
+  `git checkout -b topic`.
 * Make your changes.
 * Run the lint script described below.
 * Commit locally and push that to your repo.
 * Send in a pull request based on the above.
 
 Lint tool
 ---------
 
old mode 100644
new mode 100755
--- a/testing/web-platform/tests/XMLHttpRequest/send-content-type-charset.htm
+++ b/testing/web-platform/tests/XMLHttpRequest/send-content-type-charset.htm
@@ -5,54 +5,79 @@
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
     <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4]/p/code[contains(text(),'Content-Type')]/.. following::ol[1]/li[4]/p/code[contains(text(),'Content-Type')]/../following-sibling::p" />
     <link rel="help" href="https://xhr.spec.whatwg.org/#dom-XMLHttpRequest-send-a-string" data-tested-assertations="following::p[2]" />
   </head>
   <body>
     <div id="log"></div>
     <script>
-      function request(input, output) {
+      function request(input, output, title) {
+        title = title || document.title + ' - ' + input;
         test(function() {
         var client = new XMLHttpRequest()
         client.open("POST", "resources/content.py", false)
         if(input)
           client.setRequestHeader("Content-Type", input)
         client.send("TEST")
         assert_equals(client.responseText, "TEST")
         assert_equals(client.getResponseHeader("x-request-content-type"), output)
-        })
+        }, title)
       }
-      request(
-        "text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
-        "text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8"
-      )
+
       request(
         "text; charset=ascii",
-        "text; charset=ascii"
+        "text; charset=ascii",
+        "header with invalid MIME type is not changed"
       )
       request(
         "charset=ascii",
-        "charset=ascii"
+        "charset=ascii",
+        "known charset but bogus header - missing MIME type"
+      )
+      request(
+        "charset=bogus",
+        "charset=bogus",
+        "bogus charset and bogus header - missing MIME type"
+      )
+      request(
+        "text/plain;charset=utf-8",
+        "text/plain;charset=utf-8",
+        "Correct text/plain MIME with charset"
+      )
+      request(
+        "text/x-pink-unicorn",
+        "text/x-pink-unicorn",
+        "If no charset= param is given, implementation should not add one - unknown MIME"
+      )
+      request(
+        "text/plain",
+        "text/plain",
+        "If no charset= param is given, implementation should not add one - known MIME"
       )
       request(
         "text/x-thepiano;charset= waddup",
-        "text/x-thepiano;charset=UTF-8"
+        "text/x-thepiano;charset=UTF-8",
+        "charset given but wrong, fix it (unknown MIME, bogus charset)"
       )
-      request(
-        "text/x-pink-unicorn",
-        "text/x-pink-unicorn"
+      request( /**/
+        "text/plain;charset=utf-8;charset=waddup",
+        "text/plain;charset=UTF-8;charset=UTF-8",
+        "charset given but wrong, fix it (known MIME, bogus charset)"
       )
       request(
-        "text/plain;charset=utf-8",
-        "text/plain;charset=utf-8"
+        "text/plain;charset=shift-jis",
+        "text/plain;charset=UTF-8",
+        "charset given but wrong, fix it (known MIME, actual charset)"
       )
       request(
-        "text/plain;charset=utf-8;charset=waddup",
-        "text/plain;charset=UTF-8;charset=UTF-8"
+        "text/x-pink-unicorn; charset=windows-1252; charset=bogus; notrelated; charset=ascii",
+        "text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8",
+        "If multiple charset parameters are given, all should be rewritten"
       )
       request(
         null,
-        "text/plain;charset=UTF-8"
+        "text/plain;charset=UTF-8",
+        "No content type set, give MIME and charset"
       )
     </script>
   </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/dom/collections/HTMLCollection-supported-property-names.html
@@ -0,0 +1,54 @@
+<!doctype html>
+<meta charset=utf-8>
+<link rel=help href=https://dom.spec.whatwg.org/#interface-htmlcollection>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+
+<div id=log></div>
+
+<!-- with no attribute -->
+<span></span>
+
+<!-- with `id` attribute -->
+<span id=''></span>
+<span id='some-id'></span>
+<span id='some-id'></span><!-- to ensure no duplicates -->
+
+<!-- with `name` attribute -->
+<span name=''></span>
+<span name='some-name'></span>
+<span name='some-name'></span><!-- to ensure no duplicates -->
+
+<!-- with `name` and `id` attribute -->
+<span id='another-id' name='another-name'></span>
+
+<script>
+test(function () {
+  var elements = document.getElementsByTagName("span");
+  assert_array_equals(
+    Object.getOwnPropertyNames(elements),
+    ['0', '1', '2', '3', '4', '5', '6', '7', 'some-id', 'some-name', 'another-id', 'another-name']
+  );
+}, 'Object.getOwnPropertyNames on HTMLCollection');
+
+test(function () {
+  var elem = document.createElementNS('some-random-namespace', 'foo');
+  this.add_cleanup(function () {elem.remove();});
+  elem.setAttribute("name", "some-name");
+  document.body.appendChild(elem);
+
+  var elements = document.getElementsByTagName("foo");
+  assert_array_equals(Object.getOwnPropertyNames(elements), ['0']);
+}, 'Object.getOwnPropertyNames on HTMLCollection with non-HTML namespace');
+
+test(function () {
+  var elem = document.createElement('foo');
+  this.add_cleanup(function () {elem.remove();});
+  document.body.appendChild(elem);
+
+  var elements = document.getElementsByTagName("foo");
+  elements.someProperty = "some value";
+
+  assert_array_equals(Object.getOwnPropertyNames(elements), ['0', 'someProperty']);
+}, 'Object.getOwnPropertyNames on HTMLCollection with expando object');
+</script>
--- a/testing/web-platform/tests/dom/nodes/Node-cloneNode.html
+++ b/testing/web-platform/tests/dom/nodes/Node-cloneNode.html
@@ -232,17 +232,17 @@ test(function() {
     check_copy(doc, copy, Document);
     assert_equals(doc.contentType, copy.contentType);
 }, "implementation.createDocument");
 
 test(function() {
     var html = document.implementation.createHTMLDocument("title");
     var copy = html.cloneNode();
     check_copy(html, copy, Document);
-    assert_equals(html.title, copy.title);
+    assert_equals(copy.title, "");
 }, "implementation.createHTMLDocument");
 
 test(function() {
     var parent = document.createElement("div");
     var child1 = document.createElement("div");
     var child2 = document.createElement("div");
     var grandChild = document.createElement("div");
 
--- a/testing/web-platform/tests/editing/event.html
+++ b/testing/web-platform/tests/editing/event.html
@@ -124,17 +124,17 @@ var commandTests = {
     underline: [],
     unlink: [],
     delete: [],
     formatBlock: ["p"],
     forwardDelete: [],
     indent: [],
     insertHorizontalRule: ["id"],
     insertHTML: ["<b>hi</b>"],
-    insertImage: ["http://example.com/some-image"],
+    insertImage: ["../images/green.png"],
     insertLineBreak: [],
     insertOrderedList: [],
     insertParagraph: [],
     insertText: ["abc"],
     insertUnorderedList: [],
     justifyCenter: [],
     justifyFull: [],
     justifyLeft: [],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/activation/click.html
@@ -0,0 +1,18 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>HTMLElement#click</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function() {
+  var element = document.createElement("div");
+  var received = false;
+  element.addEventListener("click", this.step_func(function(e) {
+    received = true;
+    assert_false(e.isTrusted, "Event should not be trusted")
+  }));
+  element.click();
+  assert_true(received, "click event should have been dispatched synchronously");
+})
+</script>
--- a/testing/web-platform/tests/html/infrastructure/urls/terminology-0/document-base-url.html
+++ b/testing/web-platform/tests/html/infrastructure/urls/terminology-0/document-base-url.html
@@ -20,16 +20,20 @@
 
     var t1 = async_test("The document base URL of a document containing one or more base elements with href attributes is the frozen base URL of the first base element in the document that has an href attribute, in tree order.");
 
     function on_load() {
       t1.step(function () {
         var base = document.createElement("base");
         base.setAttribute("href", "/foo/bar");
         document.head.appendChild(base);
+        t1.add_cleanup(function () {
+          document.head.removeChild(base);
+        });
+
         assert_resolve_url(document, location.href.replace(location.pathname, "/foo"));
         assert_equals(document.baseURI, base.href, "The document base URL should be URL of the first base element that has an href attribute.");
       });
       t1.done();
     }
 
     async_test(function() {
       var iframe = document.createElement("iframe");
@@ -50,20 +54,20 @@
       iframe.setAttribute("src", "about:blank");
       document.body.appendChild(iframe);
     }, "The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.");
 
     async_test(function () {
       var iframe = document.createElement("iframe");
       iframe.onload = this.step_func_done(function () {
         var doc = iframe.contentDocument;
-        var base = doc.body.appendChild(document.createElement("base"));
+        var base = doc.body.appendChild(doc.createElement("base"));
         base.href = "sub/";
         assert_resolve_url(doc, location.href.replace("/document-base-url.html", "/sub"));
-        assert_equals(doc.baseURI, document.baseURI);
+        assert_equals(doc.baseURI, document.baseURI.replace("/document-base-url.html", "/sub/"));
       });
       iframe.setAttribute("src", "about:blank");
       document.body.appendChild(iframe);
     }, "about:blank with a base element.");
 
     async_test(function () {
       var iframe = document.createElement("iframe");
       iframe.onload = this.step_func_done(function () {
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/animation-frames/callback-exception.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<html>
+  <head>
+    <title>requestAnimationFrame callback exception reported to error handler</title>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+    <link rel="help" href="https://w3c.github.io/web-performance/specs/RequestAnimationFrame/Overview.html#dom-windowanimationtiming-requestanimationframe"/>
+  </head>
+  <body>
+    <div id="log"></div>
+    <script>
+      var custom_exception = 'requestAnimationFrameException';
+      setup({allow_uncaught_exception : true});
+      async_test(function (t) {
+        addEventListener("error",function(e) {
+          t.step(function() {
+             assert_equals(e.error.message, custom_exception);
+             t.done();
+          })
+        });
+        window.requestAnimationFrame(function () {
+          throw new Error(custom_exception);
+        });
+      }, "requestAnimationFrame callback exceptions are reported to error handler");
+    </script>
+  </body>
+</html>
rename from testing/web-platform/tests/animation-timing/callback-invoked.html
rename to testing/web-platform/tests/html/webappapis/animation-frames/callback-invoked.html
rename from testing/web-platform/tests/animation-timing/cancel-invoked.html
rename to testing/web-platform/tests/html/webappapis/animation-frames/cancel-invoked.html
rename from testing/web-platform/tests/animation-timing/idlharness.html
rename to testing/web-platform/tests/html/webappapis/animation-frames/idlharness.html
rename from testing/web-platform/tests/animation-timing/same-dispatch-time.html
rename to testing/web-platform/tests/html/webappapis/animation-frames/same-dispatch-time.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/js/builtins/Object.prototype.getOwnPropertyNames.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<title>Object.prototype.getOwnPropertyNames</title>
+<link rel=help href=http://es5.github.io/#x15.2.3.4>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+
+<div id=log></div>
+<script>
+test(function () {
+  var obj = {0: 'a', 1: 'b', 2: 'c'};
+  assert_array_equals(
+    Object.getOwnPropertyNames(obj).sort(),
+    ['0', '1', '2']
+  );
+}, "object");
+
+test(function () {
+  var arr = ['a', 'b', 'c'];
+  assert_array_equals(
+    Object.getOwnPropertyNames(arr).sort(),
+    ['0', '1', '2', 'length']
+  );
+}, "array-like");
+
+test(function () {
+  var obj = Object.create({}, {
+    getFoo: {
+      value: function() { return this.foo; },
+      enumerable: false
+    }
+  });
+  obj.foo = 1;
+  assert_array_equals(
+    Object.getOwnPropertyNames(obj).sort(),
+    ['foo', 'getFoo']
+  );
+}, "non-enumerable property");
+
+test(function() {
+  function ParentClass() {}
+  ParentClass.prototype.inheritedMethod = function() {};
+
+  function ChildClass() {
+    this.prop = 5;
+    this.method = function() {};
+  }
+  ChildClass.prototype = new ParentClass;
+  ChildClass.prototype.prototypeMethod = function() {};
+
+  var obj = new ChildClass;
+  assert_array_equals(
+    Object.getOwnPropertyNames(obj).sort(),
+    ['method', 'prop']
+  );
+}, 'items on the prototype chain are not listed');
+</script>
--- a/testing/web-platform/tests/media-source/mediasource-buffered.html
+++ b/testing/web-platform/tests/media-source/mediasource-buffered.html
@@ -10,22 +10,22 @@
         <div id="log"></div>
         <script>
             var subType = MediaSourceUtil.getSubType(MediaSourceUtil.AUDIO_ONLY_TYPE);
 
             var manifestFilenameA = subType + "/test-a-128k-44100Hz-1ch-manifest.json";
             var manifestFilenameB = subType + "/test-v-128k-320x240-30fps-10kfr-manifest.json";
 
             var expectationsA = {
-              webm: "{ [0.000, 2.022) }",
+              webm: "{ [0.000, 2.023) }",
               mp4: "{ [0.000, 2.043) }",
             };
 
             var expectationsB = {
-              webm: "{ [0.000, 2.000) }",
+              webm: "{ [0.000, 2.001) }",
               mp4: "{ [0.000, 2.000) }",
             };
 
             function mediaSourceDemuxedTest(callback, description)
             {
                 mediasource_test(function(test, mediaElement, mediaSource)
                 {
                     mediaElement.pause();
@@ -94,17 +94,17 @@
                     var sourceBuffer = mediaSource.addSourceBuffer(type);
                     test.expectEvent(sourceBuffer, "update");
                     test.expectEvent(sourceBuffer, "updateend");
                     sourceBuffer.appendBuffer(data);
 
                     test.waitForExpectedEvents(function()
                     {
                         var expectationsAV = {
-                            webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.022) }"],
+                            webm: ["{ [0.000, 2.003) }", "{ [0.000, 2.023) }"],
                             mp4: ["{ [0.000, 2.000) }", "{ [0.000, 2.043) }"],
                         };
 
                         var expectedBeforeEndOfStream = expectationsAV[subType][0];
                         var expectedAfterEndOfStream = expectationsAV[subType][1];
 
                         assertBufferedEquals(mediaSource.activeSourceBuffers[0], expectedBeforeEndOfStream, "mediaSource.activeSourceBuffers[0]");
                         assertBufferedEquals(mediaElement, expectedBeforeEndOfStream, "mediaElement.buffered");
rename from testing/web-platform/tests/selection/dir.manual.html
rename to testing/web-platform/tests/selection/dir-manual.html
--- a/testing/web-platform/tests/service-workers/cache-storage/resources/testharness-helpers.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/resources/testharness-helpers.js
@@ -27,137 +27,74 @@ function assert_promise_rejects(promise,
     },
     function(e) {
       if (code !== undefined) {
         assert_throws(code, function() { throw e; }, description);
       }
     });
 }
 
-// Asserts that two objects |actual| and |expected| are weakly equal under the
-// following definition:
-//
-// |a| and |b| are weakly equal if any of the following are true:
-//   1. If |a| is not an 'object', and |a| === |b|.
-//   2. If |a| is an 'object', and all of the following are true:
-//     2.1 |a.p| is weakly equal to |b.p| for all own properties |p| of |a|.
-//     2.2 Every own property of |b| is an own property of |a|.
-//
-// This is a replacement for the the version of assert_object_equals() in
-// testharness.js. The latter doesn't handle own properties correctly. I.e. if
-// |a.p| is not an own property, it still requires that |b.p| be an own
-// property.
-//
-// Note that |actual| must not contain cyclic references.
-self.assert_object_equals = function(actual, expected, description) {
-  var object_stack = [];
-
-  function _is_equal(actual, expected, prefix) {
-    if (typeof actual !== 'object') {
-      assert_equals(actual, expected, prefix);
-      return;
-    }
-    assert_true(typeof expected === 'object', prefix);
-    assert_equals(object_stack.indexOf(actual), -1,
-                  prefix + ' must not contain cyclic references.');
-
-    object_stack.push(actual);
-
-    Object.getOwnPropertyNames(expected).forEach(function(property) {
-        assert_own_property(actual, property, prefix);
-        _is_equal(actual[property], expected[property],
-                  prefix + '.' + property);
-      });
-    Object.getOwnPropertyNames(actual).forEach(function(property) {
-        assert_own_property(expected, property, prefix);
-      });
-
-    object_stack.pop();
-  }
-
-  function _brand(object) {
-    return Object.prototype.toString.call(object).match(/^\[object (.*)\]$/)[1];
-  }
-
-  _is_equal(actual, expected,
-            (description ? description + ': ' : '') + _brand(expected));
-};
-
-// Equivalent to assert_in_array, but uses a weaker equivalence relation
-// (assert_object_equals) than '==='.
-function assert_object_in_array(actual, expected_array, description) {
-  assert_true(expected_array.some(function(element) {
-      try {
-        assert_object_equals(actual, element);
-        return true;
-      } catch (e) {
-        return false;
-      }
-    }), description);
+// Helper for testing with Headers objects. Compares Headers instances
+// by serializing |expected| and |actual| to arrays and comparing.
+function assert_header_equals(actual, expected, description) {
+    assert_class_string(actual, "Headers", description);
+    var header, actual_headers = [], expected_headers = [];
+    for (header of actual)
+        actual_headers.push(header[0] + ": " + header[1]);
+    for (header of expected)
+        expected_headers.push(header[0] + ": " + header[1]);
+    assert_array_equals(actual_headers, expected_headers,
+                        description + " Headers differ.");
 }
 
-// Assert that the two arrays |actual| and |expected| contain the same set of
-// elements as determined by assert_object_equals. The order is not significant.
+// Helper for testing with Response objects. Compares simple
+// attributes defined on the interfaces, as well as the headers. It
+// does not compare the response bodies.
+function assert_response_equals(actual, expected, description) {
+    assert_class_string(actual, "Response", description);
+    ["type", "url", "status", "ok", "statusText"].forEach(function(attribute) {
+        assert_equals(actual[attribute], expected[attribute],
+                      description + " Attributes differ: " + attribute + ".");
+    });
+    assert_header_equals(actual.headers, expected.headers, description);
+}
+
+// Assert that the two arrays |actual| and |expected| contain the same
+// set of Responses as determined by assert_response_equals. The order
+// is not significant.
 //
-// |expected| is assumed to not contain any duplicates as determined by
-// assert_object_equals().
-function assert_array_equivalent(actual, expected, description) {
-  assert_true(Array.isArray(actual), description);
-  assert_equals(actual.length, expected.length, description);
-  expected.forEach(function(expected_element) {
-      // assert_in_array treats the first argument as being 'actual', and the
-      // second as being 'expected array'. We are switching them around because
-      // we want to be resilient against the |actual| array containing
-      // duplicates.
-      assert_object_in_array(expected_element, actual, description);
+// |expected| is assumed to not contain any duplicates.
+function assert_response_array_equivalent(actual, expected, description) {
+    assert_true(Array.isArray(actual), description);
+    assert_equals(actual.length, expected.length, description);
+    expected.forEach(function(expected_element) {
+        // assert_response_in_array treats the first argument as being
+        // 'actual', and the second as being 'expected array'. We are
+        // switching them around because we want to be resilient
+        // against the |actual| array containing duplicates.
+        assert_response_in_array(expected_element, actual, description);
     });
 }
 
-// Asserts that two arrays |actual| and |expected| contain the same set of
-// elements as determined by assert_object_equals(). The corresponding elements
-// must occupy corresponding indices in their respective arrays.
-function assert_array_objects_equals(actual, expected, description) {
-  assert_true(Array.isArray(actual), description);
-  assert_equals(actual.length, expected.length, description);
-  actual.forEach(function(value, index) {
-      assert_object_equals(value, expected[index],
-                           description + ' : object[' + index + ']');
+// Asserts that two arrays |actual| and |expected| contain the same
+// set of Responses as determined by assert_response_equals(). The
+// corresponding elements must occupy corresponding indices in their
+// respective arrays.
+function assert_response_array_equals(actual, expected, description) {
+    assert_true(Array.isArray(actual), description);
+    assert_equals(actual.length, expected.length, description);
+    actual.forEach(function(value, index) {
+        assert_response_equals(value, expected[index],
+                               description + " : object[" + index + "]");
     });
 }
 
-// Asserts that |object| that is an instance of some interface has the attribute
-// |attribute_name| following the conditions specified by WebIDL, but it's
-// acceptable that the attribute |attribute_name| is an own property of the
-// object because we're in the middle of moving the attribute to a prototype
-// chain.  Once we complete the transition to prototype chains,
-// assert_will_be_idl_attribute must be replaced with assert_idl_attribute
-// defined in testharness.js.
-//
-// FIXME: Remove assert_will_be_idl_attribute once we complete the transition
-// of moving the DOM attributes to prototype chains.  (http://crbug.com/43394)
-function assert_will_be_idl_attribute(object, attribute_name, description) {
-  assert_true(typeof object === "object", description);
-
-  assert_true("hasOwnProperty" in object, description);
-
-  // Do not test if |attribute_name| is not an own property because
-  // |attribute_name| is in the middle of the transition to a prototype
-  // chain.  (http://crbug.com/43394)
-
-  assert_true(attribute_name in object, description);
+// Equivalent to assert_in_array, but uses assert_response_equals.
+function assert_response_in_array(actual, expected_array, description) {
+    assert_true(expected_array.some(function(element) {
+        try {
+            assert_response_equals(actual, element);
+            return true;
+        } catch (e) {
+            return false;
+        }
+    }), description);
 }
-
-// Stringifies a DOM object.  This function stringifies not only own properties
-// but also DOM attributes which are on a prototype chain.  Note that
-// JSON.stringify only stringifies own properties.
-function stringifyDOMObject(object)
-{
-    function deepCopy(src) {
-        if (typeof src != "object")
-            return src;
-        var dst = Array.isArray(src) ? [] : {};
-        for (var property in src) {
-            dst[property] = deepCopy(src[property]);
-        }
-        return dst;
-    }
-    return JSON.stringify(deepCopy(object));
-}
--- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-match.js
@@ -104,170 +104,170 @@ var vary_entries = [
     response: new Response('',
                            {headers: {'Vary': 'Cookies'}})
   }
 ];
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll('not-present-in-the-cache')
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result, [],
             'Cache.matchAll should resolve with an empty array on failure.');
         });
   }, 'Cache.matchAll with no matching entries');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match('not-present-in-the-cache')
       .then(function(result) {
           assert_equals(result, undefined,
                         'Cache.match failures should resolve with undefined.');
         });
   }, 'Cache.match with no matching entries');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.a.request.url)
       .then(function(result) {
-          assert_array_objects_equals(result, [entries.a.response],
-                                      'Cache.matchAll should match by URL.');
+          assert_response_array_equals(result, [entries.a.response],
+                                       'Cache.matchAll should match by URL.');
         });
   }, 'Cache.matchAll with URL');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.a.request.url)
       .then(function(result) {
-          assert_object_equals(result, entries.a.response,
-                               'Cache.match should match by URL.');
+          assert_response_equals(result, entries.a.response,
+                                 'Cache.match should match by URL.');
         });
   }, 'Cache.match with URL');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.a.request)
       .then(function(result) {
-          assert_array_objects_equals(
+          assert_response_array_equals(
             result, [entries.a.response],
             'Cache.matchAll should match by Request.');
         });
   }, 'Cache.matchAll with Request');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.a.request)
       .then(function(result) {
-          assert_object_equals(result, entries.a.response,
-                               'Cache.match should match by Request.');
+          assert_response_equals(result, entries.a.response,
+                                 'Cache.match should match by Request.');
         });
   }, 'Cache.match with Request');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(new Request(entries.a.request.url))
       .then(function(result) {
-          assert_array_objects_equals(
+          assert_response_array_equals(
             result, [entries.a.response],
             'Cache.matchAll should match by Request.');
         });
   }, 'Cache.matchAll with new Request');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(new Request(entries.a.request.url))
       .then(function(result) {
-          assert_object_equals(result, entries.a.response,
-                               'Cache.match should match by Request.');
+          assert_response_equals(result, entries.a.response,
+                                 'Cache.match should match by Request.');
         });
   }, 'Cache.match with new Request');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.a.request,
                           {ignoreSearch: true})
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
               entries.a.response,
               entries.a_with_query.response
             ],
             'Cache.matchAll with ignoreSearch should ignore the ' +
             'search parameters of cached request.');
         });
   },
   'Cache.matchAll with ignoreSearch option (request with no search ' +
   'parameters)');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.a.request,
                        {ignoreSearch: true})
       .then(function(result) {
-          assert_object_in_array(
+          assert_response_in_array(
             result,
             [
               entries.a.response,
               entries.a_with_query.response
             ],
             'Cache.match with ignoreSearch should ignore the ' +
             'search parameters of cached request.');
         });
   },
   'Cache.match with ignoreSearch option (request with no search ' +
   'parameters)');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.a_with_query.request,
                           {ignoreSearch: true})
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
               entries.a.response,
               entries.a_with_query.response
             ],
             'Cache.matchAll with ignoreSearch should ignore the ' +
             'search parameters of request.');
         });
   },
   'Cache.matchAll with ignoreSearch option (request with search parameter)');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.a_with_query.request,
                        {ignoreSearch: true})
       .then(function(result) {
-          assert_object_in_array(
+          assert_response_in_array(
             result,
             [
               entries.a.response,
               entries.a_with_query.response
             ],
             'Cache.match with ignoreSearch should ignore the ' +
             'search parameters of request.');
         });
   },
   'Cache.match with ignoreSearch option (request with search parameter)');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.cat.request.url + '#mouse')
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
               entries.cat.response,
             ],
             'Cache.matchAll should ignore URL fragment.');
         });
   }, 'Cache.matchAll with URL containing fragment');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.cat.request.url + '#mouse')
       .then(function(result) {
-          assert_object_equals(result, entries.cat.response,
-                               'Cache.match should ignore URL fragment.');
+          assert_response_equals(result, entries.cat.response,
+                                 'Cache.match should ignore URL fragment.');
         });
   }, 'Cache.match with URL containing fragment');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll('http')
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result, [],
             'Cache.matchAll should treat query as a URL and not ' +
             'just a string fragment.');
         });
   }, 'Cache.matchAll with string fragment "http" as query');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match('http')
@@ -277,90 +277,90 @@ prepopulated_cache_test(simple_entries, 
             'Cache.match should treat query as a URL and not ' +
             'just a string fragment.');
         });
   }, 'Cache.match with string fragment "http" as query');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.matchAll(entries.secret_cat.request.url)
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result, [entries.secret_cat.response],
             'Cache.matchAll should not ignore embedded credentials');
         });
   }, 'Cache.matchAll with URL containing credentials');
 
 prepopulated_cache_test(simple_entries, function(cache, entries) {
     return cache.match(entries.secret_cat.request.url)
       .then(function(result) {
-          assert_object_equals(
+          assert_response_equals(
             result, entries.secret_cat.response,
             'Cache.match should not ignore embedded credentials');
         });
   }, 'Cache.match with URL containing credentials');
 
 prepopulated_cache_test(vary_entries, function(cache, entries) {
     return cache.matchAll('http://example.com/c')
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
               entries.vary_cookie_absent.response
             ],
             'Cache.matchAll should exclude matches if a vary header is ' +
             'missing in the query request, but is present in the cached ' +
             'request.');
         })
 
       .then(function() {
           return cache.matchAll(
             new Request('http://example.com/c',
                         {headers: {'Cookies': 'none-of-the-above'}}));
         })
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
             ],
             'Cache.matchAll should exclude matches if a vary header is ' +
             'missing in the cached request, but is present in the query ' +
             'request.');
         })
 
       .then(function() {
           return cache.matchAll(
             new Request('http://example.com/c',
                         {headers: {'Cookies': 'is-for-cookie'}}));
         })
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [entries.vary_cookie_is_cookie.response],
             'Cache.matchAll should match the entire header if a vary header ' +
             'is present in both the query and cached requests.');
         });
   }, 'Cache.matchAll with responses containing "Vary" header');
 
 prepopulated_cache_test(vary_entries, function(cache, entries) {
     return cache.match('http://example.com/c')
       .then(function(result) {
-          assert_object_in_array(
+          assert_response_in_array(
             result,
             [
               entries.vary_cookie_absent.response
             ],
             'Cache.match should honor "Vary" header.');
         });
   }, 'Cache.match with responses containing "Vary" header');
 
 prepopulated_cache_test(vary_entries, function(cache, entries) {
     return cache.matchAll('http://example.com/c',
                           {ignoreVary: true})
       .then(function(result) {
-          assert_array_equivalent(
+          assert_response_array_equivalent(
             result,
             [
               entries.vary_cookie_is_cookie.response,
               entries.vary_cookie_is_good.response,
               entries.vary_cookie_absent.response,
             ],
             'Cache.matchAll should honor "ignoreVary" parameter.');
         });
@@ -378,17 +378,17 @@ cache_test(function(cache) {
             '[https://fetch.spec.whatwg.org/#dom-response-url] ' +
             'Reponse.url should return the URL of the response.');
           return cache.put(request, response.clone());
         })
       .then(function() {
           return cache.match(request.url);
         })
       .then(function(result) {
-          assert_object_equals(
+          assert_response_equals(
             result, response,
             'Cache.match should return a Response object that has the same ' +
             'properties as the stored response.');
           return cache.match(response.url);
         })
       .then(function(result) {
           assert_equals(
             result, undefined,
--- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-put.js
@@ -25,19 +25,19 @@ cache_test(function(cache) {
       .then(function(fetch_result) {
           response = fetch_result.clone();
           return cache.put(request, fetch_result);
         })
       .then(function() {
           return cache.match(test_url);
         })
       .then(function(result) {
-          assert_object_equals(result, response,
-                               'Cache.put should update the cache with ' +
-                               'new request and response.');
+          assert_response_equals(result, response,
+                                 'Cache.put should update the cache with ' +
+                                 'new request and response.');
           return result.text();
         })
       .then(function(body) {
           assert_equals(body, 'a simple text file\n',
                         'Cache.put should store response body.');
         });
   }, 'Cache.put called with Request and Response from fetch()');
 
@@ -70,19 +70,19 @@ cache_test(function(cache) {
 cache_test(function(cache) {
     var request = new Request(test_url);
     var response = new Response(test_body);
     return cache.put(request, response.clone())
       .then(function() {
           return cache.match(test_url);
         })
       .then(function(result) {
-          assert_object_equals(result, response,
-                               'Cache.put should update the cache with ' +
-                               'new Request and Response.');
+          assert_response_equals(result, response,
+                                 'Cache.put should update the cache with ' +
+                                 'new Request and Response.');
         });
   }, 'Cache.put with a Response containing an empty URL');
 
 cache_test(function(cache) {
     var request = new Request(test_url);
     var response = new Response('', {
         status: 200,
         headers: [['Content-Type', 'text/plain']]
@@ -113,19 +113,19 @@ cache_test(function(cache) {
                         'Test framework error: The status code should be 500.');
           response = fetch_result.clone();
           return cache.put(request, fetch_result);
         })
       .then(function() {
           return cache.match(test_url);
         })
       .then(function(result) {
-          assert_object_equals(result, response,
-                               'Cache.put should update the cache with ' +
-                               'new request and response.');
+          assert_response_equals(result, response,
+                                 'Cache.put should update the cache with ' +
+                                 'new request and response.');
           return result.text();
         })
       .then(function(body) {
           assert_equals(body, '',
                         'Cache.put should store response body.');
         });
   }, 'Cache.put with HTTP 500 response');
 
@@ -137,19 +137,19 @@ cache_test(function(cache) {
                      new Response('Old body', { statusText: 'Old status' }))
       .then(function() {
           return cache.put(new Request(test_url), alternate_response.clone());
         })
       .then(function() {
           return cache.match(test_url);
         })
       .then(function(result) {
-          assert_object_equals(result, alternate_response,
-                               'Cache.put should replace existing ' +
-                               'response with new response.');
+          assert_response_equals(result, alternate_response,
+                                 'Cache.put should replace existing ' +
+                                 'response with new response.');
           return result.text();
         })
       .then(function(body) {
           assert_equals(body, alternate_response_body,
                         'Cache put should store new response body.');
         });
   }, 'Cache.put called twice with matching Requests and different Responses');
 
@@ -163,19 +163,19 @@ cache_test(function(cache) {
                      new Response('Old body', { statusText: 'Old status' }))
       .then(function() {
           return cache.put(new Request(second_url), alternate_response.clone());
         })
       .then(function() {
           return cache.match(test_url);
         })
       .then(function(result) {
-          assert_object_equals(result, alternate_response,
-                               'Cache.put should replace existing ' +
-                               'response with new response.');
+          assert_response_equals(result, alternate_response,
+                                 'Cache.put should replace existing ' +
+                                 'response with new response.');
           return result.text();
         })
       .then(function(body) {
           assert_equals(body, alternate_response_body,
                         'Cache put should store new response body.');
         });
   }, 'Cache.put called twice with request URLs that differ only by a fragment');
 
@@ -243,19 +243,19 @@ cache_test(function(cache) {
 
 cache_test(function(cache) {
     var response = new Response(test_body);
     return cache.put(new Request('relative-url'), response.clone())
       .then(function() {
           return cache.match(new URL('relative-url', location.href).href);
         })
       .then(function(result) {
-          assert_object_equals(result, response,
-                               'Cache.put should accept a relative URL ' +
-                               'as the request.');
+          assert_response_equals(result, response,
+                                 'Cache.put should accept a relative URL ' +
+                                 'as the request.');
         });
   }, 'Cache.put with a relative URL');
 
 cache_test(function(cache) {
     var request = new Request('http://example.com/foo', { method: 'HEAD' });
     return assert_promise_rejects(
       cache.put(request, new Response(test_body)),
       new TypeError(),
--- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-storage-match.js
@@ -25,18 +25,18 @@ if (self.importScripts) {
 cache_test(function(cache) {
     var transaction = create_unique_transaction();
 
     return cache.put(transaction.request.clone(), transaction.response.clone())
       .then(function() {
           return self.caches.match(transaction.request);
         })
       .then(function(response) {
-          assert_object_equals(response, transaction.response,
-                               'The response should not have changed.');
+          assert_response_equals(response, transaction.response,
+                                 'The response should not have changed.');
         });
 }, 'CacheStorageMatch with no cache name provided');
 
 cache_test(function(cache) {
     var transaction = create_unique_transaction();
 
     var test_cache_list = ['a', 'b', 'c'];
     return cache.put(transaction.request.clone(), transaction.response.clone())
@@ -44,18 +44,18 @@ cache_test(function(cache) {
           return Promise.all(test_cache_list.map(function(key) {
               return self.caches.open(key);
             }));
         })
       .then(function() {
           return self.caches.match(transaction.request);
         })
       .then(function(response) {
-          assert_object_equals(response, transaction.response,
-                               'The response should not have changed.');
+          assert_response_equals(response, transaction.response,
+                                 'The response should not have changed.');
         });
 }, 'CacheStorageMatch from one of many caches');
 
 promise_test(function(test) {
     var transaction = create_unique_transaction();
 
     var test_cache_list = ['x', 'y', 'z'];
     return Promise.all(test_cache_list.map(function(key) {
@@ -65,18 +65,18 @@ promise_test(function(test) {
       .then(function(cache) {
           return cache.put(transaction.request.clone(),
                            transaction.response.clone());
         })
       .then(function() {
           return self.caches.match(transaction.request, {cacheName: 'x'});
         })
       .then(function(response) {
-          assert_object_equals(response, transaction.response,
-                               'The response should not have changed.');
+          assert_response_equals(response, transaction.response,
+                                 'The response should not have changed.');
         })
       .then(function() {
           return self.caches.match(transaction.request, {cacheName: 'y'});
         })
       .then(function(response) {
           assert_equals(response, undefined,
                         'Cache y should not have a response for the request.');
         });
@@ -84,18 +84,18 @@ promise_test(function(test) {
 
 cache_test(function(cache) {
     var transaction = create_unique_transaction();
     return cache.put(transaction.url, transaction.response.clone())
       .then(function() {
           return self.caches.match(transaction.request);
         })
       .then(function(response) {
-          assert_object_equals(response, transaction.response,
-                               'The response should not have changed.');
+          assert_response_equals(response, transaction.response,
+                                 'The response should not have changed.');
         });
 }, 'CacheStorageMatch a string request');
 
 promise_test(function(test) {
     var transaction = create_unique_transaction();
     return self.caches.match(transaction.request)
       .then(function(response) {
           assert_equals(response, undefined,
deleted file mode 100644
--- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/the-content-html-element/test-004.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<!DOCTYPE html>
-<!--
-Distributed under both the W3C Test Suite License [1] and the W3C
-3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
-policies and contribution forms [3].
-
-[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
-[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
-[3] http://www.w3.org/2004/10/27-testcases
--->
-<html>
-<head>
-<title>Shadow DOM Test: A_10_04_04</title>
-<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
-<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#content-element">
-<meta name="assert" content="The content HTML element: reset-style-inheritance attribute">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="../../testcommon.js"></script>
-<link rel="stylesheet" href="/resources/testharness.css">
-</head>
-<body>
-<div id="log"></div>
-<script>
-test(unit(function (ctx) {
-
-    var d = newRenderedHTMLDocument(ctx);
-
-    d.body.innerHTML =
-        '<ul id="shHost">' +
-            '<li id="li1" class="shadow">1</li>' +
-            '<li id="li2" class="shadow2">2</li>' +
-            '<li id="li3" class="shadow">3</li>' +
-            '<li id="li4">4</li>' +
-            '<li id="li5" class="shadow">5</li>' +
-            '<li id="li6" class="shadow2">6</li>' +
-        '</ul>';
-
-
-    var defHeight1 = d.querySelector('#li1').offsetHeight;
-    var defHeight2 = d.querySelector('#li2').offsetHeight;
-    var defHeight3 = d.querySelector('#li3').offsetHeight;
-    var defHeight4 = d.querySelector('#li4').offsetHeight;
-    var defHeight5 = d.querySelector('#li5').offsetHeight;
-    var defHeight6 = d.querySelector('#li6').offsetHeight;
-
-    assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
-    assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
-    assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
-    assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
-    assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
-    assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
-
-    var host = d.querySelector('#shHost');
-
-    d.body.setAttribute('style', 'font-size: 30px');
-
-    var height1 = d.querySelector('#li1').offsetHeight;
-    var height2 = d.querySelector('#li2').offsetHeight;
-    var height3 = d.querySelector('#li3').offsetHeight;
-    var height4 = d.querySelector('#li4').offsetHeight;
-    var height5 = d.querySelector('#li5').offsetHeight;
-    var height6 = d.querySelector('#li6').offsetHeight;
-
-
-    assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
-    assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
-    assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
-    assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
-    assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
-    assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
-
-    //Shadow root to play with
-    var s = host.createShadowRoot();
-
-    var div = d.createElement('div');
-    div.innerHTML ='<ul><content select=".shadow" reset-style-inheritance=true></content></ul>';
-    s.appendChild(div);
-
-    assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
-        'element style should be reset');
-    assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
-        'element style should be reset');
-    assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
-        'element style should be reset');
-
-    assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
-    assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
-    assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
-
-}), 'A_10_04_04_T01');
-
-
-test(unit(function (ctx) {
-
-    var d = newRenderedHTMLDocument(ctx);
-
-    d.body.innerHTML =
-        '<ul id="shHost">' +
-            '<li id="li1" class="shadow">1</li>' +
-            '<li id="li2" class="shadow2">2</li>' +
-            '<li id="li3" class="shadow">3</li>' +
-            '<li id="li4">4</li>' +
-            '<li id="li5" class="shadow">5</li>' +
-            '<li id="li6" class="shadow2">6</li>' +
-        '</ul>';
-
-
-    var defHeight1 = d.querySelector('#li1').offsetHeight;
-    var defHeight2 = d.querySelector('#li2').offsetHeight;
-    var defHeight3 = d.querySelector('#li3').offsetHeight;
-    var defHeight4 = d.querySelector('#li4').offsetHeight;
-    var defHeight5 = d.querySelector('#li5').offsetHeight;
-    var defHeight6 = d.querySelector('#li6').offsetHeight;
-
-    assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
-    assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
-    assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
-    assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
-    assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
-    assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
-
-    var host = d.querySelector('#shHost');
-
-    d.body.setAttribute('style', 'font-size: 30px');
-
-    var height1 = d.querySelector('#li1').offsetHeight;
-    var height2 = d.querySelector('#li2').offsetHeight;
-    var height3 = d.querySelector('#li3').offsetHeight;
-    var height4 = d.querySelector('#li4').offsetHeight;
-    var height5 = d.querySelector('#li5').offsetHeight;
-    var height6 = d.querySelector('#li6').offsetHeight;
-
-
-    assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
-    assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
-    assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
-    assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
-    assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
-    assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
-
-    //Shadow root to play with
-    var s = host.createShadowRoot();
-
-    var div = d.createElement('div');
-    div.innerHTML ='<ul><content select=".shadow"  reset-style-inheritance></content></ul>';
-    s.appendChild(div);
-
-    assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 21: Inherited ' +
-        'element style should be reset');
-    assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 22: Inherited ' +
-        'element style should be reset');
-    assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 23: Inherited ' +
-        'element style should be reset');
-
-    assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
-    assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
-    assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
-
-}), 'A_10_04_04_T02');
-</script>
-</body>
-</html>
deleted file mode 100644
--- a/testing/web-platform/tests/shadow-dom/elements-and-dom-objects/the-shadow-html-element/test-003.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!DOCTYPE html>
-<!--
-Distributed under both the W3C Test Suite License [1] and the W3C
-3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
-policies and contribution forms [3].
-
-[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
-[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
-[3] http://www.w3.org/2004/10/27-testcases
--->
-<html>
-<head>
-<title>Shadow DOM Test: A_10_05_03</title>
-<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
-<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#shadow-element">
-<meta name="assert" content="The shadow HTML element: reset-style-inheritance attribute">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="../../testcommon.js"></script>
-<link rel="stylesheet" href="/resources/testharness.css">
-</head>
-<body>
-<div id="log"></div>
-<script>
-// test reset-style-inheritance=true
-test(unit(function (ctx) {
-
-	var d = newRenderedHTMLDocument(ctx);
-
-    d.body.innerHTML =
-    	'<ul id="shHost">' +
-    		'<li id="li1" class="shadow">1</li>' +
-    		'<li id="li2" class="shadow2">2</li>' +
-    		'<li id="li3" class="shadow">3</li>' +
-    		'<li id="li4">4</li>' +
-    		'<li id="li5" class="shadow">5</li>' +
-    		'<li id="li6" class="shadow2">6</li>' +
-    	'</ul>';
-
-
-	var defHeight1 = d.querySelector('#li1').offsetHeight;
-	var defHeight2 = d.querySelector('#li2').offsetHeight;
-	var defHeight3 = d.querySelector('#li3').offsetHeight;
-	var defHeight4 = d.querySelector('#li4').offsetHeight;
-	var defHeight5 = d.querySelector('#li5').offsetHeight;
-	var defHeight6 = d.querySelector('#li6').offsetHeight;
-
-	assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
-	assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
-	assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
-	assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
-	assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
-	assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
-
-    var host = d.querySelector('#shHost');
-
-    d.body.setAttribute('style', 'font-size: 30px');
-
-	var height1 = d.querySelector('#li1').offsetHeight;
-	var height2 = d.querySelector('#li2').offsetHeight;
-	var height3 = d.querySelector('#li3').offsetHeight;
-	var height4 = d.querySelector('#li4').offsetHeight;
-	var height5 = d.querySelector('#li5').offsetHeight;
-	var height6 = d.querySelector('#li6').offsetHeight;
-
-
-	assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
-	assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
-	assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
-	assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
-	assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
-	assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
-
-	//Shadow root to play with
-    var s = host.createShadowRoot();
-
-	var div = d.createElement('div');
-	div.innerHTML ='<ul><content select=".shadow"></content></ul>';
-	s.appendChild(div);
-
-	assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
-	assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
-	assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
-
-	assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
-	assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
-	assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
-
-	//Young tree
-	var s2 = host.createShadowRoot();
-
-	var div2 = d.createElement('div');
-	div2.innerHTML = '<shadow reset-style-inheritance=true></shadow>';
-	s2.appendChild(div2);
-
-	//styles should be reset
-	assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
-			'element style should be reset');
-	assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
-			'element style should be reset');
-	assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
-			'element style should be reset');
-
-}), 'A_10_05_03_T01');
-
-
-//test reset-style-inheritance
-test(unit(function (ctx) {
-
-	var d = newRenderedHTMLDocument(ctx);
-
-    d.body.innerHTML =
-    	'<ul id="shHost">' +
-    		'<li id="li1" class="shadow">1</li>' +
-    		'<li id="li2" class="shadow2">2</li>' +
-    		'<li id="li3" class="shadow">3</li>' +
-    		'<li id="li4">4</li>' +
-    		'<li id="li5" class="shadow">5</li>' +
-    		'<li id="li6" class="shadow2">6</li>' +
-    	'</ul>';
-
-
-	var defHeight1 = d.querySelector('#li1').offsetHeight;
-	var defHeight2 = d.querySelector('#li2').offsetHeight;
-	var defHeight3 = d.querySelector('#li3').offsetHeight;
-	var defHeight4 = d.querySelector('#li4').offsetHeight;
-	var defHeight5 = d.querySelector('#li5').offsetHeight;
-	var defHeight6 = d.querySelector('#li6').offsetHeight;
-
-	assert_true(defHeight1 > 0, 'Point 1: Element height should be greater than zero');
-	assert_true(defHeight2 > 0, 'Point 2: Element height should be greater than zero');
-	assert_true(defHeight3 > 0, 'Point 3: Element height should be greater than zero');
-	assert_true(defHeight4 > 0, 'Point 4: Element height should be greater than zero');
-	assert_true(defHeight5 > 0, 'Point 5: Element height should be greater than zero');
-	assert_true(defHeight6 > 0, 'Point 6: Element height should be greater than zero');
-
-    var host = d.querySelector('#shHost');
-
-    d.body.setAttribute('style', 'font-size: 30px');
-
-	var height1 = d.querySelector('#li1').offsetHeight;
-	var height2 = d.querySelector('#li2').offsetHeight;
-	var height3 = d.querySelector('#li3').offsetHeight;
-	var height4 = d.querySelector('#li4').offsetHeight;
-	var height5 = d.querySelector('#li5').offsetHeight;
-	var height6 = d.querySelector('#li6').offsetHeight;
-
-
-	assert_true(height1 > defHeight1, 'Point 11: Element height should be changed');
-	assert_true(height2 > defHeight2, 'Point 12: Element height should be changed');
-	assert_true(height3 > defHeight3, 'Point 13: Element height should be changed');
-	assert_true(height4 > defHeight4, 'Point 14: Element height should be changed');
-	assert_true(height5 > defHeight5, 'Point 15: Element height should be changed');
-	assert_true(height6 > defHeight6, 'Point 16: Element height should be changed');
-
-	//Shadow root to play with
-    var s = host.createShadowRoot();
-
-	var div = d.createElement('div');
-	div.innerHTML ='<ul><content select=".shadow"></content></ul>';
-	s.appendChild(div);
-
-	assert_equals(d.querySelector('#li1').offsetHeight, height1, 'Point 21: Element height should not be changed');
-	assert_equals(d.querySelector('#li3').offsetHeight, height3, 'Point 22: Element height should not be changed');
-	assert_equals(d.querySelector('#li5').offsetHeight, height5, 'Point 23: Element height should not be changed');
-
-	assert_equals(d.querySelector('#li2').offsetHeight, 0, 'Point 24: Element shouldn\'t be rendered');
-	assert_equals(d.querySelector('#li4').offsetHeight, 0, 'Point 25: Element shouldn\'t be rendered');
-	assert_equals(d.querySelector('#li6').offsetHeight, 0, 'Point 26: Element shouldn\'t be rendered');
-
-	//Young tree
-	var s2 = host.createShadowRoot();
-
-	var div2 = d.createElement('div');
-	div2.innerHTML = '<shadow reset-style-inheritance></shadow>';
-	s2.appendChild(div2);
-
-	//styles should be reset
-	assert_equals(d.querySelector('#li1').offsetHeight, defHeight1, 'Point 31: Inherited ' +
-			'element style should be reset');
-	assert_equals(d.querySelector('#li3').offsetHeight, defHeight3, 'Point 32: Inherited ' +
-			'element style should be reset');
-	assert_equals(d.querySelector('#li5').offsetHeight, defHeight5, 'Point 33: Inherited ' +
-			'element style should be reset');
-
-}), 'A_10_05_03_T02');
-</script>
-</body>
-</html>
--- a/testing/web-platform/tests/shadow-dom/events/event-dispatch/test-001.html
+++ b/testing/web-platform/tests/shadow-dom/events/event-dispatch/test-001.html
@@ -30,17 +30,17 @@ A_05_05_01_T01.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-slider-thumb relative target	#volume-slider-thumb
+    //For #volume-slider-thumb relative target #volume-slider-thumb
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').addEventListener('click',
 	    A_05_05_01_T01.step_func(function(event) {
 	    	invoked = true;
 	    	assert_equals(event.target.getAttribute('id'), 'volume-slider-thumb',
 	    			'Point 1: Wrong target');
 	    	assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider-thumb',
 	    			'Point 1: Wrong currentTarget');
 	    }), false);
@@ -63,17 +63,17 @@ A_05_05_01_T02.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-shadow-root relative target	#volume-slider-thumb
+    //For #volume-shadow-root relative target #volume-slider-thumb
     roots.volumeShadowRoot.addEventListener('click',
     		A_05_05_01_T02.step_func(function(event) {
     			invoked = true;
 		    	assert_equals(event.target.getAttribute('id'), 'volume-slider-thumb',
 		    			'Wrong target');
 		    	assert_true(event.currentTarget == roots.volumeShadowRoot,
 		    			'Wrong currentTarget');
 	    }), false);
@@ -96,23 +96,23 @@ A_05_05_01_T03.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-slider relative target #volume-slider
+    //For #volume-slider relative target #volume-shadow-host
     roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
     		A_05_05_01_T03.step_func(function(event) {
     			invoked = true;
-		    	assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 		    			'Wrong target');
-		    	assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider',
 		    			'Wrong currentTarget');
 	    }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ('click', true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
    	assert_true(invoked, 'Event listener was not invoked');
@@ -130,23 +130,23 @@ A_05_05_01_T04.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-slider-container relative target #volume-slider
+    //For #volume-slider-container relative target #volume-shadow-host
     roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
     		A_05_05_01_T04.step_func(function(event) {
     			invoked = true;
-		    	assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 		    			'Wrong target');
-		    	assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.currentTarget.getAttribute('id'), 'volume-slider-container',
 		    			'Wrong currentTarget');
 	    }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ('click', true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
    	assert_true(invoked, 'Event listener was not invoked');
@@ -163,23 +163,23 @@ A_05_05_01_T05.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #controls relative target #volume-slider
+    //For #controls relative target #volume-shadow-host
     roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
     		A_05_05_01_T05.step_func(function(event) {
     			invoked = true;
-		    	assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 		    			'Wrong target');
-		    	assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.currentTarget.getAttribute('id'), 'controls',
 		    			'Wrong currentTarget');
 	    }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ('click', true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
    	assert_true(invoked, 'Event listener was not invoked');
@@ -196,23 +196,23 @@ A_05_05_01_T06.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #player-shadow-root relative target #volume-slider
-    roots.playerShadowRoot.addEventListener('click',
+    //For #player-shadow-host relative target #player-shadow-host
+    d.querySelector('#player-shadow-host').addEventListener('click',
     		A_05_05_01_T06.step_func(function(event) {
     			invoked = true;
-		    	assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
 		    			'Wrong target');
-		    	assert_true(event.currentTarget.getAttribute('id'), 'volume-slider',
+		    	assert_equals(event.currentTarget.getAttribute('id'), 'player-shadow-host',
 		    			'Wrong currentTarget');
 	    }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ('click', true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
    	assert_true(invoked, 'Event listener was not invoked');
@@ -230,23 +230,23 @@ A_05_05_01_T07.step(unit(function (ctx) 
 
     var invoked = false;
 
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #player relative target #player
+    //For #player relative target #player-shadow-host
     d.querySelector('#player').addEventListener('click',
     		A_05_05_01_T07.step_func(function(event) {
     			invoked = true;
-		    	assert_equals(event.target.getAttribute('id'), 'player',
+		    	assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
 		    			'Wrong target');
-		    	assert_true(event.currentTarget.getAttribute('id'), 'player',
+		    	assert_equals(event.currentTarget.getAttribute('id'), 'player',
 		    			'Wrong currentTarget');
 	    }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ('click', true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
    	assert_true(invoked, 'Event listener was not invoked');
--- a/testing/web-platform/tests/shadow-dom/events/event-retargeting/test-004.html
+++ b/testing/web-platform/tests/shadow-dom/events/event-retargeting/test-004.html
@@ -55,21 +55,21 @@ var A_05_01_04_T02 = async_test('A_05_01
 A_05_01_04_T02.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-shadow-root relative target is #volume-slider-thumb
-    roots.volumeShadowRoot.addEventListener('click',
+    //For #volume-shadow-host relative target is #volume-shadow-host
+    roots.playerShadowRoot.querySelector('#volume-shadow-host').addEventListener('click',
     	A_05_01_04_T02.step_func(function (event) {
     		invoked = true;
-	        assert_equals(event.target.getAttribute('id'), 'volume-slider-thumb',
+	        assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
         		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -85,21 +85,21 @@ var A_05_01_04_T03 = async_test('A_05_01
 A_05_01_04_T03.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-slider relative target is #volume-slider
+    //For #volume-slider relative target is #volume-shadow-host
     roots.playerShadowRoot.querySelector('#volume-slider').addEventListener('click',
     		A_05_01_04_T03.step_func(function (event) {
     			invoked = true;
-	        assert_equals(event.target.getAttribute('id'), 'volume-slider',
+	        assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
         		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -113,21 +113,21 @@ var A_05_01_04_T04 = async_test('A_05_01
 A_05_01_04_T04.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #volume-slider-container relative target is #volume-slider
+    //For #volume-slider-container relative target is #volume-shadow-host
     roots.playerShadowRoot.querySelector('#volume-slider-container').addEventListener('click',
     		A_05_01_04_T04.step_func(function (event) {
     			invoked = true;
-		        assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		        assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 	        		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -141,21 +141,21 @@ var A_05_01_04_T05 = async_test('A_05_01
 A_05_01_04_T05.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #controls relative target is #volume-slider
+    //For #controls relative target is #volume-shadow-host
     roots.playerShadowRoot.querySelector('#controls').addEventListener('click',
     		A_05_01_04_T05.step_func(function (event) {
     			invoked = true;
-		        assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		        assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 	        		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -169,21 +169,21 @@ var A_05_01_04_T06 = async_test('A_05_01
 A_05_01_04_T06.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #player-shadow-root relative target is #volume-slider
+    //For #player-shadow-host relative target is #player-shadow-host
     roots.playerShadowRoot.addEventListener('click',
     		A_05_01_04_T06.step_func(function (event) {
     			invoked = true;
-		        assert_equals(event.target.getAttribute('id'), 'volume-slider',
+		        assert_equals(event.target.getAttribute('id'), 'volume-shadow-host',
 	        		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -198,21 +198,21 @@ var A_05_01_04_T07 = async_test('A_05_01
 A_05_01_04_T07.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #player relative target is #player
+    //For #player relative target is #player-shadow-host
     d.querySelector('#player').addEventListener('click',
     		A_05_01_04_T07.step_func(function (event) {
     			invoked = true;
-		        assert_equals(event.target.getAttribute('id'), 'player',
+		        assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
 	        		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.volumeShadowRoot.querySelector('#volume-slider-thumb').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
@@ -339,21 +339,21 @@ var A_05_01_04_T12 = async_test('A_05_01
 A_05_01_04_T12.step(unit(function (ctx) {
 	var d = newRenderedHTMLDocument(ctx);
 	var invoked = false;
     roots = createTestMediaPlayer(d);
 
     //expected result of what relative target should be see
     //see at http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 
-    //For #player relative target is #player
+    //For #player relative target is #player-shadow-host
     d.querySelector('#player').addEventListener('click',
     		A_05_01_04_T12.step_func(function (event) {
     			invoked = true;
-		        assert_equals(event.target.getAttribute('id'), 'player',
+		        assert_equals(event.target.getAttribute('id'), 'player-shadow-host',
 	        		'Wrong related target');
     }), false);
 
     var event = d.createEvent('HTMLEvents');
     event.initEvent ("click", true, false);
     roots.playerShadowRoot.querySelector('#volume-slider').dispatchEvent(event);
 
     assert_true(invoked, 'Event listener was not invoked');
--- a/testing/web-platform/tests/shadow-dom/testcommon.js
+++ b/testing/web-platform/tests/shadow-dom/testcommon.js
@@ -223,40 +223,40 @@ function assert_nodelist_contents_equal_
 }
 
 
 //Example taken from http://www.w3.org/TR/shadow-dom/#event-retargeting-example
 function createTestMediaPlayer(d) {
     d.body.innerHTML = '' +
 	'<div id="player">' +
 		'<input type="checkbox" id="outside-control">' +
-		'<div id="player-shadow-root">' +
+		'<div id="player-shadow-host">' +
 	    '</div>' +
 	'</div>';
 
-	var playerShadowRoot = d.querySelector('#player-shadow-root').createShadowRoot();
+	var playerShadowRoot = d.querySelector('#player-shadow-host').createShadowRoot();
 	playerShadowRoot.innerHTML = '' +
 		'<div id="controls">' +
 			'<button class="play-button">PLAY</button>' +
-			'<input type="range" id="timeline">' +
-				'<div id="timeline-shadow-root">' +
+			'<div tabindex="0" id="timeline">' +
+				'<div id="timeline-shadow-host">' +
 				'</div>' +
-			'</input>' +
+			'</div>' +
 		    '<div class="volume-slider-container" id="volume-slider-container">' +
-		        '<input type="range" class="volume-slider" id="volume-slider">' +
-		            '<div id="volume-shadow-root">' +
+		        '<div tabindex="0" class="volume-slider" id="volume-slider">' +
+		            '<div id="volume-shadow-host">' +
 		            '</div>' +
-		        '</input>' +
+		        '</div>' +
 		    '</div>' +
 		'</div>';
 
-	var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-root').createShadowRoot();
+	var timeLineShadowRoot = playerShadowRoot.querySelector('#timeline-shadow-host').createShadowRoot();
 	timeLineShadowRoot.innerHTML =  '<div class="slider-thumb" id="timeline-slider-thumb"></div>';
 
-	var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-root').createShadowRoot();
+	var volumeShadowRoot = playerShadowRoot.querySelector('#volume-shadow-host').createShadowRoot();
 	volumeShadowRoot.innerHTML = '<div class="slider-thumb" id="volume-slider-thumb"></div>';
 
 	return {
 		'playerShadowRoot': playerShadowRoot,
 		'timeLineShadowRoot': timeLineShadowRoot,
 		'volumeShadowRoot': volumeShadowRoot
 		};
 }
--- a/testing/web-platform/tests/tools/lint/lint.py
+++ b/testing/web-platform/tests/tools/lint/lint.py
@@ -110,27 +110,33 @@ class CRRegexp(Regexp):
 class W3CTestOrgRegexp(Regexp):
     pattern = "w3c\-test\.org"
     error = "W3C-TEST.ORG"
 
 class Webidl2Regexp(Regexp):
     pattern = "webidl2\.js"
     error = "WEBIDL2.JS"
 
+class ConsoleRegexp(Regexp):
+    pattern = "console\.[a-zA-Z]+\s*\("
+    error = "CONSOLE"
+    file_extensions = [".html", ".htm", ".js", ".xht", ".html", ".svg"]
+
 class PrintRegexp(Regexp):
     pattern = "print(?:\s|\s*\()"
     error = "PRINT STATEMENT"
     file_extensions = [".py"]
 
 regexps = [item() for item in
            [TrailingWhitespaceRegexp,
             TabsRegexp,
             CRRegexp,
             W3CTestOrgRegexp,
             Webidl2Regexp,
+            ConsoleRegexp,
             PrintRegexp]]
 
 def check_regexp_line(path, f):
     errors = []
 
     applicable_regexps = [regexp for regexp in regexps if regexp.applies(path)]
 
     for i, line in enumerate(f):
--- a/testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html
+++ b/testing/web-platform/tests/typedarrays/ArrayBuffer_constructor.html
@@ -7,17 +7,17 @@
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 
 var args = [
   /* numbers */
   [NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0],
   [-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2],
-  [1, 1], [-0xF1000000, 0xF000000],
+  [1, 1], [-0xF1000000, 0],
   /* strings */
   ["1", 1], ["1e2", 100],
   /* null, undefined, booleans */
   [undefined, 0], [null, 0], [false, 0], [true, 1]
 ];
 
 args.forEach(function (arg, i) {
   test(function () {
--- a/testing/web-platform/tests/typedarrays/constructors.html
+++ b/testing/web-platform/tests/typedarrays/constructors.html
@@ -7,17 +7,17 @@
 <script src=/resources/testharnessreport.js></script>
 
 <div id=log></div>
 <script>
 var args = [
   /* numbers */
   [NaN, 0], [+Infinity, 0], [-Infinity, 0], [+0, 0], [-0, 0], // Step 2
   [-0.4, 0], [-0.9, 0], [1.1, 1], [2.9, 2], // Step 3
-  [1, 1], [-0xF1000000, 0xF000000], // Step 4
+  [1, 1], [-0xF1000000, 0], // Step 4
   /* strings */
   ["1", 1], ["1e2", 100],
   /* null, undefined, booleans */
   [undefined, 0], [null, 0], [false, 0], [true, 1],
   /* objects */
   [{}, 0], [{ length: 2, 0: 0, 1: 0 }, 0], [[0, 0], 2]
 ];
 var interfaces = [
--- a/testing/web-platform/tests/url/urltestdata.txt
+++ b/testing/web-platform/tests/url/urltestdata.txt
@@ -253,16 +253,19 @@ http://:@www.example.com  s:http pass: h
 test.txt  s:http h:www.example.com p:/test.txt
 ./test.txt  s:http h:www.example.com p:/test.txt
 ../test.txt  s:http h:www.example.com p:/test.txt
 ../aaa/test.txt  s:http h:www.example.com p:/aaa/test.txt
 ../../test.txt  s:http h:www.example.com p:/test.txt
 \u4E2D/test.txt  s:http h:www.example.com p:/%E4%B8%AD/test.txt
 http://www.example2.com  s:http h:www.example2.com p:/
 //www.example2.com  s:http h:www.example2.com p:/
+file:...  s:file h: p:/...
+file:..  s:file h: p:/
+file:a  s:file h: p:/a
 
 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html
 
 # Basic canonicalization, uppercase should be converted to lowercase
 http://ExAmPlE.CoM http://other.com/ s:http p:/ h:example.com
 
 # Spaces should fail
 http://example\sexample.com
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/workers/semantics/encodings/004.worker.js
@@ -0,0 +1,5 @@
+importScripts("/resources/testharness.js");
+test(function() {
+  assert_equals("", "\ufffd");
+}, "Decoding invalid utf-8");
+done();
--- a/tools/profiler/core/GeckoSampler.cpp
+++ b/tools/profiler/core/GeckoSampler.cpp
@@ -945,20 +945,17 @@ void GeckoSampler::doNativeBacktrace(Thr
   // Start with the current function. We use 0 as the frame number here because
   // the FramePointerStackWalk() and MozStackWalk() calls below will use 1..N.
   // This is a bit weird but it doesn't matter because StackWalkCallback()
   // doesn't use the frame number argument.
   StackWalkCallback(/* frameNumber */ 0, aSample->pc, aSample->sp, &nativeStack);
 
   uint32_t maxFrames = uint32_t(nativeStack.size - nativeStack.count);
 #ifdef XP_MACOSX
-  pthread_t pt = GetProfiledThread(aSample->threadProfile->GetPlatformData());
-  void *stackEnd = reinterpret_cast<void*>(-1);
-  if (pt)
-    stackEnd = static_cast<char*>(pthread_get_stackaddr_np(pt));
+  void *stackEnd = aSample->threadProfile->GetStackTop();
   bool rv = true;
   if (aSample->fp >= aSample->sp && aSample->fp <= stackEnd)
     rv = FramePointerStackWalk(StackWalkCallback, /* skipFrames */ 0,
                                maxFrames, &nativeStack,
                                reinterpret_cast<void**>(aSample->fp), stackEnd);
 #else
   void *platformData = nullptr;
 #ifdef XP_WIN
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -1,24 +1,38 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "ThreadInfo.h"
+#include "ThreadProfile.h"
 
 ThreadInfo::ThreadInfo(const char* aName, int aThreadId,
                        bool aIsMainThread, PseudoStack* aPseudoStack,
                        void* aStackTop)
   : mName(strdup(aName))
   , mThreadId(aThreadId)
   , mIsMainThread(aIsMainThread)
   , mPseudoStack(aPseudoStack)
   , mPlatformData(Sampler::AllocPlatformData(aThreadId))
   , mProfile(nullptr)
   , mStackTop(aStackTop)
   , mPendingDelete(false)
 {
 #ifndef SPS_STANDALONE
   mThread = NS_GetCurrentThread();
 #endif
+
+  // We don't have to guess on mac
+#ifdef XP_MACOSX
+  pthread_t self = pthread_self();
+  mStackTop = pthread_get_stackaddr_np(self);
+#endif
 }
 
 ThreadInfo::~ThreadInfo() {
   free(mName);
 
   if (mProfile)
     delete mProfile;
 
--- a/tools/profiler/core/ThreadInfo.h
+++ b/tools/profiler/core/ThreadInfo.h
@@ -42,17 +42,17 @@ class ThreadInfo {
 #endif
  private:
   char* mName;
   int mThreadId;
   const bool mIsMainThread;
   PseudoStack* mPseudoStack;
   PlatformData* mPlatformData;
   ThreadProfile* mProfile;
-  void* const mStackTop;
+  void* mStackTop;
 #ifndef SPS_STANDALONE
   nsCOMPtr<nsIThread> mThread;
 #endif
   bool mPendingDelete;
 };
 
 // Just like ThreadInfo, but owns a reference to the PseudoStack.
 class StackOwningThreadInfo : public ThreadInfo {
--- a/tools/profiler/core/platform.h
+++ b/tools/profiler/core/platform.h
@@ -276,28 +276,28 @@ void set_tls_stack_top(void* stackTop);
 
 struct PseudoStack;
 class ThreadProfile;
 
 // TickSample captures the information collected for each sample.
 class TickSample {
  public:
   TickSample()
-      :
-        pc(NULL),
-        sp(NULL),
-        fp(NULL),
+      : pc(NULL)
+      , sp(NULL)
+      , fp(NULL)
 #ifdef ENABLE_ARM_LR_SAVING
-        lr(NULL),
+      , lr(NULL)
 #endif
-        context(NULL),
-        isSamplingCurrentThread(false),
-        threadProfile(nullptr),
-        rssMemory(0),
-        ussMemory(0) {}
+      , context(NULL)
+      , isSamplingCurrentThread(false)
+      , threadProfile(nullptr)
+      , rssMemory(0)
+      , ussMemory(0)
+  {}
 
   void PopulateContext(void* aContext);
 
   Address pc;  // Instruction pointer.
   Address sp;  // Stack pointer.
   Address fp;  // Frame pointer.
 #ifdef ENABLE_ARM_LR_SAVING
   Address lr;  // ARM link register
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -275,16 +275,19 @@ typedef NSInteger NSEventGestureAxis;
 - (void)_surfaceNeedsUpdate:(NSNotification*)notification;
 
 - (void)setGLContext:(NSOpenGLContext *)aGLContext;
 - (bool)preRender:(NSOpenGLContext *)aGLContext;
 - (void)postRender:(NSOpenGLContext *)aGLContext;
 
 - (BOOL)isCoveringTitlebar;
 
+- (void)viewWillStartLiveResize;
+- (void)viewDidEndLiveResize;
+
 - (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType;
 - (NSColor*)vibrancyFontSmoothingBackgroundColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType;
 
 // Simple gestures support
 //
 // XXX - The swipeWithEvent, beginGestureWithEvent, magnifyWithEvent,
 // rotateWithEvent, and endGestureWithEvent methods are part of a
 // PRIVATE interface exported by nsResponder and reverse-engineering
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -3431,16 +3431,38 @@ NSEvent* gLastDragMouseDownEvent = nil;
 
 - (BOOL)isCoveringTitlebar
 {
   return [[self window] isKindOfClass:[BaseWindow class]] &&
          [(BaseWindow*)[self window] mainChildView] == self &&
          [(BaseWindow*)[self window] drawsContentsIntoWindowFrame];
 }
 
+- (void)viewWillStartLiveResize
+{
+  nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
+
+  if (!observerService) {
+    return;
+  }
+
+  observerService->NotifyObservers(nullptr, "live-resize-start", nullptr);
+}
+
+- (void)viewDidEndLiveResize
+{
+  nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
+
+  if (!observerService) {
+    return;
+  }
+
+  observerService->NotifyObservers(nullptr, "live-resize-end", nullptr);
+}
+
 - (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType
 {
   if (!mGeckoChild) {
     return [NSColor whiteColor];
   }
   return mGeckoChild->VibrancyFillColorForThemeGeometryType(aThemeGeometryType);
 }
 
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -332,17 +332,19 @@ static bool gIsPointerEventsEnabled = fa
  **************************************************************/
 
 /**************************************************************
  *
  * SECTION: nsWindow construction and destruction
  *
  **************************************************************/
 
-nsWindow::nsWindow() : nsWindowBase()
+nsWindow::nsWindow()
+  : nsWindowBase()
+  , mResizeState(NOT_RESIZING)
 {
   mIconSmall            = nullptr;
   mIconBig              = nullptr;
   mWnd                  = nullptr;
   mTransitionWnd        = nullptr;
   mPaintDC              = nullptr;
   mCompositeDC          = nullptr;
   mPrevWndProc          = nullptr;
@@ -5320,21 +5322,59 @@ nsWindow::ProcessMessage(UINT msg, WPARA
     case WM_NCRBUTTONDBLCLK:
       result = DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0,
                                   lParamToClient(lParam), false,
                                   WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       DispatchPendingEvents();
       break;
 
+    case WM_SIZING:
+    {
+      // When we get WM_ENTERSIZEMOVE we don't know yet if we're in a live
+      // resize or move event. Instead we wait for first VM_SIZING message
+      // within a ENTERSIZEMOVE to consider this a live resize event.
+      if (mResizeState == IN_SIZEMOVE) {
+        mResizeState = RESIZING;
+        nsCOMPtr<nsIObserverService> observerService =
+          mozilla::services::GetObserverService();
+
+        if (observerService) {
+          observerService->NotifyObservers(nullptr, "live-resize-start",
+                                           nullptr);
+        }
+      }
+      break;
+    }
+
+    case WM_ENTERSIZEMOVE:
+    {
+      if (mResizeState == NOT_RESIZING) {
+        mResizeState = IN_SIZEMOVE;
+      }
+      break;
+    }
+
     case WM_EXITSIZEMOVE:
+    {
+      if (mResizeState == RESIZING) {
+        mResizeState = NOT_RESIZING;
+        nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
+
+        if (observerService) {
+          observerService->NotifyObservers(nullptr, "live-resize-end", nullptr);
+        }
+      }
+
       if (!sIsInMouseCapture) {
         NotifySizeMoveDone();
       }
+
       break;
+    }
 
     case WM_NCLBUTTONDBLCLK:
       DispatchMouseEvent(NS_MOUSE_DOUBLECLICK, 0, lParamToClient(lParam),
                          false, WidgetMouseEvent::eLeftButton,
                          MOUSE_INPUT_SOURCE());
       result = 
         DispatchMouseEvent(NS_MOUSE_BUTTON_UP, 0, lParamToClient(lParam),
                            false, WidgetMouseEvent::eLeftButton,
@@ -7516,17 +7556,16 @@ nsWindow::DealWithPopups(HWND aWnd, UINT
       // If focus moves to other window created in different process/thread,
       // e.g., a plugin window, popups should be rolled up.
       if (IsDifferentThreadWindow(reinterpret_cast<HWND>(aWParam))) {
         break;
       }
       return false;
 
     case WM_MOVING:
-    case WM_SIZING:
     case WM_MENUSELECT:
       break;
 
     default:
       return false;
   }
 
   // Only need to deal with the last rollup for left mouse down events.
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -557,16 +557,24 @@ protected:
   static BYTE           sLastMouseButton;
 
   // Graphics
   HDC                   mPaintDC; // only set during painting
   HDC                   mCompositeDC; // only set during StartRemoteDrawing
 
   nsIntRect             mLastPaintBounds;
 
+  // Used for displayport suppression during window resize
+  enum ResizeState {
+    NOT_RESIZING,
+    IN_SIZEMOVE,
+    RESIZING,
+  };
+  ResizeState mResizeState;
+
   // Transparency
 #ifdef MOZ_XUL
   // Use layered windows to support full 256 level alpha translucency
   nsRefPtr<gfxASurface> mTransparentSurface;
   HDC                   mMemoryDC;
   nsTransparencyMode    mTransparencyMode;
   nsIntRegion           mPossiblyTransparentRegion;
   MARGINS               mGlassMargins;
--- a/xpcom/glue/nsHashKeys.h
+++ b/xpcom/glue/nsHashKeys.h
@@ -646,16 +646,27 @@ public:
   }
 
   enum { ALLOW_MEMMOVE = true };
 
 private:
   nsCOMPtr<nsIHashable> mKey;
 };
 
+namespace mozilla {
+
+template <typename T>
+PLDHashNumber
+Hash(const T& aValue)
+{
+  return aValue.Hash();
+}
+
+} // namespace mozilla
+
 /**
  * Hashtable key class to use with objects for which Hash() and operator==()
  * are defined.
  */
 template<typename T>
 class nsGenericHashKey : public PLDHashEntryHdr
 {
 public:
@@ -664,16 +675,16 @@ public:
 
   explicit nsGenericHashKey(KeyTypePointer aKey) : mKey(*aKey) {}
   nsGenericHashKey(const nsGenericHashKey<T>& aOther) : mKey(aOther.mKey) {}
 
   KeyType GetKey() const { return mKey; }
   bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mKey; }
 
   static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
-  static PLDHashNumber HashKey(KeyTypePointer aKey) { return aKey->Hash(); }
+  static PLDHashNumber HashKey(KeyTypePointer aKey) { return ::mozilla::Hash(*aKey); }
   enum { ALLOW_MEMMOVE = true };
 
 private:
   T mKey;
 };
 
 #endif // nsTHashKeys_h__
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -436,18 +436,23 @@ NS_IMETHODIMP nsXULWindow::Destroy()
 
   nsCOMPtr<nsIXULWindow> placeHolder = this;
 
   // Remove modality (if any) and hide while destroying. More than
   // a convenience, the hide prevents user interaction with the partially
   // destroyed window. This is especially necessary when the eldest window
   // in a stack of modal windows is destroyed first. It happens.
   ExitModalLoop(NS_OK);
+  // XXX: Skip unmapping the window on Linux due to GLX hangs on the compositor
+  // thread with NVIDIA driver 310.32. We don't need to worry about user
+  // interactions with destroyed windows on X11 either.
+#ifndef MOZ_WIDGET_GTK
   if (mWindow)
     mWindow->Show(false);
+#endif
 
 #if defined(XP_WIN)
   // We need to explicitly set the focus on Windows, but 
   // only if the parent is visible.
   nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
   if (parent) {
     nsCOMPtr<nsIWidget> parentWidget;
     parent->GetMainWidget(getter_AddRefs(parentWidget));