merge mozilla-inbound to mozilla-central a=merge
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 02 Apr 2015 14:09:15 +0200
changeset 237261 35046df9df1faafc1d711f9c4d1f15d51bdac5d4
parent 237260 cf8864126c58f90e76a6dce89cec4bdd17586eb9 (current diff)
parent 237185 8762f2f5da1649d09cb0abe470d3d1523f16e9c5 (diff)
child 237262 63c87250946e31ecb88a1165981220b49cc5167b
child 237348 e43800b15d2d209b5ba1ded8a18d6841decf83d3
child 237421 40cbc1892b3a41beff391abb31400ddc4286c808
push id57898
push usercbook@mozilla.com
push dateThu, 02 Apr 2015 12:14:17 +0000
treeherdermozilla-inbound@63c87250946e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone40.0a1
first release with
nightly linux32
35046df9df1f / 40.0a1 / 20150402115822 / files
nightly linux64
35046df9df1f / 40.0a1 / 20150402115824 / files
nightly mac
35046df9df1f / 40.0a1 / 20150402115823 / files
nightly win32
35046df9df1f / 40.0a1 / 20150402115824 / files
nightly win64
35046df9df1f / 40.0a1 / 20150402115826 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central a=merge
security/pkix/include/pkix/stdkeywords.h
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -327,16 +327,17 @@ skip-if = buildapp == 'mulet' || e10s ||
 [browser_fxa_profile_channel.js]
 [browser_gestureSupport.js]
 skip-if = e10s # Bug 863514 - no gesture support.
 [browser_getshortcutoruri.js]
 [browser_hide_removing.js]
 [browser_homeDrop.js]
 skip-if = buildapp == 'mulet'
 [browser_identity_UI.js]
+skip-if = e10s && debug # Seeing lots of timeouts (bug 1095517)
 [browser_keywordBookmarklets.js]
 skip-if = e10s # Bug 1102025 - different principals for the bookmarklet only in e10s mode (unclear if test or 'real' issue)
 [browser_keywordSearch.js]
 skip-if = e10s # Bug 921957 - remote webprogress doesn't supply cancel method on the request object
 [browser_keywordSearch_postData.js]
 [browser_lastAccessedTab.js]
 skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (bug 969405)
 [browser_locationBarCommand.js]
@@ -416,17 +417,17 @@ skip-if = buildapp == 'mulet' || e10s
 skip-if = buildapp == 'mulet'
 [browser_tabMatchesInAwesomebar.js]
 [browser_tabMatchesInAwesomebar_perwindowpb.js]
 skip-if = e10s || os == 'linux' # Bug 1093373, bug 1104755
 [browser_tab_detach_restore.js]
 [browser_tab_drag_drop_perwindow.js]
 skip-if = buildapp == 'mulet'
 [browser_tab_dragdrop.js]
-skip-if = buildapp == 'mulet'
+skip-if = buildapp == 'mulet' || (e10s && debug) # Bug 1150036: In e10s, content process crashes, main process leaks!
 [browser_tab_dragdrop2.js]
 skip-if = buildapp == 'mulet'
 [browser_tabbar_big_widgets.js]
 skip-if = os == "linux" || os == "mac" # No tabs in titlebar on linux
                                        # Disabled on OS X because of bug 967917
 [browser_tabfocus.js]
 [browser_tabkeynavigation.js]
 skip-if = e10s
--- a/browser/base/content/test/social/browser.ini
+++ b/browser/base/content/test/social/browser.ini
@@ -24,32 +24,35 @@ support-files =
   social_sidebar_empty.html
   social_window.html
   social_worker.js
   unchecked.jpg
 
 [browser_aboutHome_activation.js]
 skip-if = e10s # Bug 1053965 "cw.ensureSnippetsMapThen is not a function", also see general/browser.ini about:home comments
 [browser_addons.js]
+skip-if = e10s && debug # Leaking docshells (bug 1150147)
 [browser_blocklist.js]
+skip-if = e10s && debug # Leaking docshells (bug 1150147)
 [browser_share.js]
 skip-if = true # bug 1115131
 [browser_social_activation.js]
 skip-if = e10s # Bug 933103 synthesizeMouseAtCenter not e10s friendly
 [browser_social_chatwindow.js]
 [browser_social_chatwindow_resize.js]
 [browser_social_chatwindowfocus.js]
 skip-if = e10s # tab crash on data url used in this test
 [browser_social_contextmenu.js]
 skip-if = e10s # Bug 1072669 context menu relies on target element
 [browser_social_errorPage.js]
 [browser_social_flyout.js]
 skip-if = e10s # when we backed out bug 1047603, this test broke.
 [browser_social_isVisible.js]
 [browser_social_marks.js]
+skip-if = e10s && debug # Leaking docshells (bug 1150147)
 [browser_social_multiprovider.js]
 skip-if = e10s # Bug 1069162 - lots of orange
 [browser_social_multiworker.js]
 [browser_social_perwindowPB.js]
 [browser_social_sidebar.js]
 [browser_social_status.js]
 [browser_social_window.js]
 [browser_social_workercrash.js]
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1,14 +1,16 @@
 <?xml version="1.0"?>
 
-# -*- Mode: HTML -*-
-# 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/.
+<!--
+-*- Mode: HTML -*-
+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/.
+-->
 
 <!DOCTYPE bindings [
 <!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
 %notificationDTD;
 <!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
 %browserDTD;
 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
 %brandDTD;
@@ -44,16 +46,19 @@
                       allowevents="true"
                       xbl:inherits="open,enablehistory,parentfocused=focused"/>
       <xul:popupset anonid="popupset"
                     class="autocomplete-result-popupset"/>
       <children includes="toolbarbutton"/>
     </content>
 
     <implementation implements="nsIObserver, nsIDOMEventListener">
+      <field name="AppConstants" readonly="true">
+        (Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
+      </field>
       <constructor><![CDATA[
         this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
                                 .getService(Components.interfaces.nsIPrefService)
                                 .getBranch("browser.urlbar.");
 
         this._prefs.addObserver("", this, false);
         this.clickSelectsAll = this._prefs.getBoolPref("clickSelectsAll");
         this.doubleClickSelectsAll = this._prefs.getBoolPref("doubleClickSelectsAll");
@@ -398,21 +403,19 @@
             aCallback(["", null, false]);
             return;
           }
 
           // Only add the suffix when the URL bar value isn't already "URL-like",
           // and only if we get a keyboard event, to match user expectations.
           if (/^\s*[^.:\/\s]+(?:\/.*|\s*)$/i.test(url) &&
               (aTriggeringEvent instanceof KeyEvent)) {
-#ifdef XP_MACOSX
-            let accel = aTriggeringEvent.metaKey;
-#else
-            let accel = aTriggeringEvent.ctrlKey;
-#endif
+            let accel = this.AppConstants.platform == "macosx" ?
+                        aTriggeringEvent.metaKey :
+                        aTriggeringEvent.ctrlKey;
             let shift = aTriggeringEvent.shiftKey;
 
             let suffix = "";
 
             switch (true) {
               case (accel && shift):
                 suffix = ".org/";
                 break;
@@ -932,16 +935,20 @@
       ]]></handler>
     </handlers>
 
   </binding>
 
   <!-- Note: this binding is applied to the autocomplete popup used in the Search bar and in web page content -->
   <binding id="browser-autocomplete-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
     <implementation>
+      <field name="AppConstants" readonly="true">
+        (Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
+      </field>
+
       <method name="openAutocompletePopup">
         <parameter name="aInput"/>
         <parameter name="aElement"/>
         <body>
           <![CDATA[
           // initially the panel is hidden
           // to avoid impacting startup / new window performance
           aInput.popup.hidden = false;
@@ -984,23 +991,21 @@
             // close the autocomplete popup and revert the entered search term
             this.closePopup();
             controller.handleEscape();
 
             // open the search results according to the clicking subtlety
             var where = whereToOpenLink(aEvent, false, true);
 
             // But open ctrl/cmd clicks on autocomplete items in a new background tab.
+            let modifier = this.AppConstants.platform == "macosx" ?
+                           aEvent.metaKey :
+                           aEvent.ctrlKey;
             if (where == "tab" && (aEvent instanceof MouseEvent) &&
-                (aEvent.button == 1 ||
-#ifdef XP_MACOSX
-                 aEvent.metaKey))
-#else
-                 aEvent.ctrlKey))
-#endif
+                (aEvent.button == 1 || modifier))
               where = "tab-background";
 
             searchBar.doSearch(search, where);
             if (where == "tab-background")
               searchBar.focus();
             else
               searchBar.value = search;
           }
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -139,17 +139,17 @@ browser.jar:
 *       content/browser/sanitize.js                   (content/sanitize.js)
 *       content/browser/sanitize.xul                  (content/sanitize.xul)
 *       content/browser/sanitizeDialog.js             (content/sanitizeDialog.js)
         content/browser/sanitizeDialog.css            (content/sanitizeDialog.css)
         content/browser/searchSuggestionUI.js         (content/searchSuggestionUI.js)
         content/browser/searchSuggestionUI.css        (content/searchSuggestionUI.css)
         content/browser/tabbrowser.css                (content/tabbrowser.css)
         content/browser/tabbrowser.xml                (content/tabbrowser.xml)
-*       content/browser/urlbarBindings.xml            (content/urlbarBindings.xml)
+        content/browser/urlbarBindings.xml            (content/urlbarBindings.xml)
 *       content/browser/utilityOverlay.js             (content/utilityOverlay.js)
         content/browser/web-panels.js                 (content/web-panels.js)
 *       content/browser/web-panels.xul                (content/web-panels.xul)
 *       content/browser/baseMenuOverlay.xul           (content/baseMenuOverlay.xul)
 *       content/browser/nsContextMenu.js              (content/nsContextMenu.js)
 # XXX: We should exclude this one as well (bug 71895)
 *       content/browser/hiddenWindow.xul              (content/hiddenWindow.xul)
 #ifdef XP_MACOSX
--- a/browser/components/sessionstore/test/browser_crashedTabs.js
+++ b/browser/components/sessionstore/test/browser_crashedTabs.js
@@ -31,16 +31,17 @@ function crashBrowser(browser) {
   // intentionally crash the tab. We crash by using js-ctypes and dereferencing
   // a bad pointer. The crash should happen immediately upon loading this
   // frame script.
   let frame_script = () => {
     const Cu = Components.utils;
     Cu.import("resource://gre/modules/ctypes.jsm");
 
     let dies = function() {
+      privateNoteIntentionalCrash();
       let zero = new ctypes.intptr_t(8);
       let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t));
       badptr.contents
     };
 
     dump("Et tu, Brute?");
     dies();
   }
--- a/dom/animation/AnimationPlayer.cpp
+++ b/dom/animation/AnimationPlayer.cpp
@@ -401,17 +401,17 @@ AnimationPlayer::CanThrottle() const
     // Unfinished animations can be throttled.
     return true;
   }
 
   // The animation has finished but, if this is the first sample since
   // finishing, we need an unthrottled sample so we can apply the correct
   // end-of-animation behavior on the main thread (either removing the
   // animation style or applying the fill mode).
-  return mIsPreviousStateFinished;
+  return mFinishedAtLastComposeStyle;
 }
 
 void
 AnimationPlayer::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
                               nsCSSPropertySet& aSetProperties,
                               bool& aNeedsRefreshes)
 {
   if (!mSource || mSource->IsFinishedTransition()) {
@@ -457,17 +457,19 @@ AnimationPlayer::ComposeStyle(nsRefPtr<c
   // To address each of these cases we temporarily tweak the hold time
   // immediately before updating the style rule and then restore it immediately
   // afterwards. This is purely to prevent visual flicker. Other behavior
   // such as dispatching events continues to rely on the regular timeline time.
   {
     AutoRestore<Nullable<TimeDuration>> restoreHoldTime(mHoldTime);
     bool updatedHoldTime = false;
 
-    if (PlayState() == AnimationPlayState::Pending &&
+    AnimationPlayState playState = PlayState();
+
+    if (playState == AnimationPlayState::Pending &&
         mHoldTime.IsNull() &&
         !mStartTime.IsNull()) {
       Nullable<TimeDuration> timeToUse = mPendingReadyTime;
       if (timeToUse.IsNull() &&
           mTimeline &&
           !mTimeline->IsUnderTestControl()) {
         timeToUse = mTimeline->ToTimelineTime(TimeStamp::Now());
       }
@@ -480,16 +482,18 @@ AnimationPlayer::ComposeStyle(nsRefPtr<c
       }
     }
 
     mSource->ComposeStyle(aStyleRule, aSetProperties);
 
     if (updatedHoldTime) {
       UpdateTiming();
     }
+
+    mFinishedAtLastComposeStyle = (playState == AnimationPlayState::Finished);
   }
 }
 
 void
 AnimationPlayer::DoPlay(LimitBehavior aLimitBehavior)
 {
   bool abortedPause = mPendingState == PendingState::PausePending;
 
--- a/dom/animation/AnimationPlayer.h
+++ b/dom/animation/AnimationPlayer.h
@@ -52,16 +52,17 @@ protected:
 
 public:
   explicit AnimationPlayer(AnimationTimeline* aTimeline)
     : mTimeline(aTimeline)
     , mPlaybackRate(1.0)
     , mPendingState(PendingState::NotPending)
     , mIsRunningOnCompositor(false)
     , mIsPreviousStateFinished(false)
+    , mFinishedAtLastComposeStyle(false)
     , mIsRelevant(false)
   {
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AnimationPlayer)
 
   AnimationTimeline* GetParentObject() const { return mTimeline; }
@@ -228,18 +229,21 @@ public:
    * still running but we only consider it playing when it is in its active
    * interval. This definition is used for fetching the animations that are
    * are candidates for running on the compositor (since we don't ship
    * animations to the compositor when they are in their delay phase or
    * paused).
    */
   bool IsPlaying() const
   {
-    return HasInPlaySource() && // Check we are in the active interval
-           PlayState() == AnimationPlayState::Running; // And not paused
+    // We need to have a source animation in its active interval, and
+    // be either running or waiting to run.
+    return HasInPlaySource() &&
+           (PlayState() == AnimationPlayState::Running ||
+            mPendingState == PendingState::PlayPending);
   }
 
   bool IsRelevant() const { return mIsRelevant; }
   void UpdateRelevance();
 
   void SetIsRunningOnCompositor() { mIsRunningOnCompositor = true; }
   void ClearIsRunningOnCompositor() { mIsRunningOnCompositor = false; }
 
@@ -327,16 +331,17 @@ protected:
   // (see TriggerOnNextTick for details).
   enum class PendingState { NotPending, PlayPending, PausePending };
   PendingState mPendingState;
 
   bool mIsRunningOnCompositor;
   // Indicates whether we were in the finished state during our
   // most recent unthrottled sample (our last ComposeStyle call).
   bool mIsPreviousStateFinished; // Spec calls this "previous finished state"
+  bool mFinishedAtLastComposeStyle;
   // Indicates that the animation should be exposed in an element's
   // getAnimations() list.
   bool mIsRelevant;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/animation/test/chrome/test_animation_observers.html
+++ b/dom/animation/test/chrome/test_animation_observers.html
@@ -310,19 +310,19 @@ function assert_records(expected, desc) 
     var firstAnimation = animations[0];
 
     // Wait for the single MutationRecord for the Animation addition to
     // be delivered.
     yield await_frame();
     assert_records([{ added: [firstAnimation], changed: [], removed: [] }],
                    "records after transition start");
 
-    // Wait for the Animation to get going, then seek well into
+    // Wait for the Animation to be playing, then seek well into
     // the transition.
-    yield await_frame();
+    yield firstAnimation.ready;
     firstAnimation.currentTime = 50000;
 
     // Reverse the transition by setting the background-color back to its
     // original value.
     e.style.backgroundColor = "yellow";
 
     // The reversal should cause the creation of a new Animation.
     animations = e.getAnimations();
@@ -359,40 +359,28 @@ function assert_records(expected, desc) 
     e.style = "transition-duration: 100s; " +
               "transition-property: color, background-color, line-height; " +
               "color: blue; background-color: lime; line-height: 24px;";
 
     // The transitions should cause the creation of three Animations.
     var animations = e.getAnimations();
     is(animations.length, 3, "getAnimations().length after transition starts");
 
-    info("animation states: " + animations.map(p => p.playState));
-    info("animation times:  " + animations.map(p => p.currentTime));
-
     // Wait for the single MutationRecord for the Animation additions to
     // be delivered.
     yield await_frame();
     assert_records([{ added: animations, changed: [], removed: [] }],
                    "records after transition starts");
 
-    info("animation states: " + animations.map(p => p.playState));
-    info("animation times:  " + animations.map(p => p.currentTime));
-
     // Wait for the Animations to get going, then seek well into
     // the transitions.
-    yield await_frame();
-
-    info("animation states: " + animations.map(p => p.playState));
-    info("animation times:  " + animations.map(p => p.currentTime));
+    yield animations[0].ready;
 
     animations.forEach(p => p.currentTime = 50000);
 
-    info("animation states: " + animations.map(p => p.playState));
-    info("animation times:  " + animations.map(p => p.currentTime));
-
     is(animations.filter(p => p.playState == "running").length, 3, "number of running Animations");
 
     // Cancel one of the transitions by setting transition-property.
     e.style.transitionProperty = "background-color, line-height";
 
     var colorAnimation  = animations.filter(p => p.playState != "running");
     var otherAnimations = animations.filter(p => p.playState == "running");
 
--- a/dom/filehandle/FileStreamWrappers.cpp
+++ b/dom/filehandle/FileStreamWrappers.cpp
@@ -258,41 +258,32 @@ FileInputStreamWrapper::Deserialize(cons
 }
 
 FileOutputStreamWrapper::FileOutputStreamWrapper(nsISupports* aFileStream,
                                                  FileHelper* aFileHelper,
                                                  uint64_t aOffset,
                                                  uint64_t aLimit,
                                                  uint32_t aFlags)
 : FileStreamWrapper(aFileStream, aFileHelper, aOffset, aLimit, aFlags)
-#ifdef DEBUG
-, mWriteThread(nullptr)
-#endif
 {
   mOutputStream = do_QueryInterface(mFileStream);
   NS_ASSERTION(mOutputStream, "This should always succeed!");
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(FileOutputStreamWrapper,
                             FileStreamWrapper,
                             nsIOutputStream)
 
 NS_IMETHODIMP
 FileOutputStreamWrapper::Close()
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   nsresult rv = NS_OK;
 
-  if (!mFirstTime) {
-    NS_ASSERTION(PR_GetCurrentThread() == mWriteThread,
-                 "Unsetting thread locals on wrong thread!");
-    mFileHelper->mMutableFile->UnsetThreadLocals();
-  }
-
   if (mFlags & NOTIFY_CLOSE) {
     nsCOMPtr<nsIRunnable> runnable = new CloseRunnable(mFileHelper);
 
     if (NS_FAILED(NS_DispatchToMainThread(runnable))) {
       NS_WARNING("Failed to dispatch to the main thread!");
     }
   }
 
@@ -308,21 +299,16 @@ FileOutputStreamWrapper::Write(const cha
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
   nsresult rv;
 
   if (mFirstTime) {
     mFirstTime = false;
 
-#ifdef DEBUG
-    mWriteThread = PR_GetCurrentThread();
-#endif
-    mFileHelper->mMutableFile->SetThreadLocals();
-
     nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mOutputStream);
     if (seekable) {
       if (mOffset == UINT64_MAX) {
         rv = seekable->Seek(nsISeekableStream::NS_SEEK_END, 0);
       }
       else {
         rv = seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
       }
--- a/dom/filehandle/FileStreamWrappers.h
+++ b/dom/filehandle/FileStreamWrappers.h
@@ -89,17 +89,14 @@ public:
                           uint32_t aFlags);
 
 protected:
   virtual ~FileOutputStreamWrapper()
   { }
 
 private:
   nsCOMPtr<nsIOutputStream> mOutputStream;
-#ifdef DEBUG
-  void* mWriteThread;
-#endif
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_FileStreamWrappers_h
--- a/dom/filehandle/MutableFile.h
+++ b/dom/filehandle/MutableFile.h
@@ -15,18 +15,17 @@ class nsIOfflineStorage;
 
 namespace mozilla {
 namespace dom {
 
 class FileService;
 
 /**
  * This class provides a base for MutableFile implementations.
- * The subclasses can override implementation of IsInvalid, CreateStream,
- * SetThreadLocals and UnsetThreadLocals.
+ * The subclasses can override implementation of IsInvalid and CreateStream.
  * (for example IDBMutableFile provides IndexedDB specific implementation).
  */
 class MutableFileBase
 {
   friend class FileService;
 
 public:
   NS_IMETHOD_(MozExternalRefCountType)
@@ -44,25 +43,16 @@ public:
   // A temporary method that will be removed along with nsIOfflineStorage
   // interface.
   virtual nsIOfflineStorage*
   Storage() = 0;
 
   virtual already_AddRefed<nsISupports>
   CreateStream(bool aReadOnly);
 
-  virtual void
-  SetThreadLocals()
-  {
-  }
-
-  virtual void
-  UnsetThreadLocals()
-  {
-  }
 
 protected:
   MutableFileBase();
 
   virtual ~MutableFileBase();
 
   nsCOMPtr<nsIFile> mFile;
 
--- a/dom/indexedDB/IDBMutableFile.cpp
+++ b/dom/indexedDB/IDBMutableFile.cpp
@@ -270,33 +270,16 @@ IDBMutableFile::CreateStream(bool aReadO
 
   if (NS_WARN_IF(!result)) {
     return nullptr;
   }
 
   return result.forget();
 }
 
-void
-IDBMutableFile::SetThreadLocals()
-{
-  MOZ_ASSERT(IndexedDatabaseManager::IsMainProcess());
-  MOZ_ASSERT(mDatabase->GetOwner(), "Should have owner!");
-
-  QuotaManager::SetCurrentWindow(mDatabase->GetOwner());
-}
-
-void
-IDBMutableFile::UnsetThreadLocals()
-{
-  MOZ_ASSERT(IndexedDatabaseManager::IsMainProcess());
-
-  QuotaManager::SetCurrentWindow(nullptr);
-}
-
 JSObject*
 IDBMutableFile::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   MOZ_ASSERT(IndexedDatabaseManager::IsMainProcess());
   MOZ_ASSERT(NS_IsMainThread());
 
   return IDBMutableFileBinding::Wrap(aCx, this, aGivenProto);
 }
--- a/dom/indexedDB/IDBMutableFile.h
+++ b/dom/indexedDB/IDBMutableFile.h
@@ -97,22 +97,16 @@ public:
   IsInvalid() override;
 
   virtual nsIOfflineStorage*
   Storage() override;
 
   virtual already_AddRefed<nsISupports>
   CreateStream(bool aReadOnly) override;
 
-  virtual void
-  SetThreadLocals() override;
-
-  virtual void
-  UnsetThreadLocals() override;
-
   // nsWrapperCache
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // WebIDL
   nsPIDOMWindow*
   GetParentObject() const
   {
--- a/dom/media/gstreamer/GStreamerFunctionList.h
+++ b/dom/media/gstreamer/GStreamerFunctionList.h
@@ -43,16 +43,17 @@ GST_FUNC(LIBGSTREAMER, gst_element_get_s
 GST_FUNC(LIBGSTREAMER, gst_element_get_type)
 GST_FUNC(LIBGSTREAMER, gst_element_query_convert)
 GST_FUNC(LIBGSTREAMER, gst_element_query_duration)
 GST_FUNC(LIBGSTREAMER, gst_element_seek_simple)
 GST_FUNC(LIBGSTREAMER, gst_element_set_state)
 GST_FUNC(LIBGSTREAMER, gst_flow_get_name)
 GST_FUNC(LIBGSTREAMER, gst_init)
 GST_FUNC(LIBGSTREAMER, gst_init_check)
+GST_FUNC(LIBGSTREAMER, gst_iterator_free)
 GST_FUNC(LIBGSTREAMER, gst_iterator_next)
 GST_FUNC(LIBGSTREAMER, gst_message_parse_error)
 GST_FUNC(LIBGSTREAMER, gst_message_type_get_name)
 GST_FUNC(LIBGSTREAMER, gst_mini_object_ref)
 GST_FUNC(LIBGSTREAMER, gst_mini_object_unref)
 GST_FUNC(LIBGSTREAMER, gst_object_get_name)
 GST_FUNC(LIBGSTREAMER, gst_object_get_parent)
 GST_FUNC(LIBGSTREAMER, gst_object_unref)
--- a/dom/media/gstreamer/GStreamerReader.cpp
+++ b/dom/media/gstreamer/GStreamerReader.cpp
@@ -591,27 +591,28 @@ nsresult GStreamerReader::CheckSupported
 #else
         gst_object_unref(element);
 #endif
         done = unsupported;
         break;
       }
       case GST_ITERATOR_RESYNC:
         unsupported = false;
-        done = false;
         break;
       case GST_ITERATOR_ERROR:
         done = true;
         break;
       case GST_ITERATOR_DONE:
         done = true;
         break;
     }
   }
 
+  gst_iterator_free(it);
+
   return unsupported ? NS_ERROR_FAILURE : NS_OK;
 }
 
 nsresult GStreamerReader::ResetDecode()
 {
   nsresult res = NS_OK;
 
   LOG(PR_LOG_DEBUG, "reset decode");
--- a/dom/media/mediasource/ResourceQueue.h
+++ b/dom/media/mediasource/ResourceQueue.h
@@ -191,17 +191,17 @@ private:
   }
 
   // Returns the index of the resource that contains the given
   // logical offset. aResourceOffset will contain the offset into
   // the resource at the given index returned if it is not null.  If
   // no such resource exists, returns GetSize() and aOffset is
   // untouched.
   uint32_t GetAtOffset(uint64_t aOffset, uint32_t *aResourceOffset) {
-    MOZ_ASSERT(aOffset >= mOffset);
+    MOZ_RELEASE_ASSERT(aOffset >= mOffset);
     uint64_t offset = mOffset;
     for (uint32_t i = 0; i < uint32_t(GetSize()); ++i) {
       ResourceItem* item = ResourceAt(i);
       // If the item contains the start of the offset we want to
       // break out of the loop.
       if (item->mData->Length() + offset > aOffset) {
         if (aResourceOffset) {
           *aResourceOffset = aOffset - offset;
--- a/dom/media/mediasource/SourceBufferResource.cpp
+++ b/dom/media/mediasource/SourceBufferResource.cpp
@@ -64,16 +64,21 @@ SourceBufferResource::ReadInternal(char*
   // sanely. :-(
   uint64_t readOffset = mOffset;
 
   while (aMayBlock &&
          !mEnded &&
          readOffset + aCount > static_cast<uint64_t>(GetLength())) {
     SBR_DEBUGV("waiting for data");
     mMonitor.Wait();
+    // The callers of this function should have checked this, but it's
+    // possible that we had an eviction while waiting on the monitor.
+    if (readOffset < mInputBuffer.GetOffset()) {
+      return NS_ERROR_FAILURE;
+    }
   }
 
   uint32_t available = GetLength() - readOffset;
   uint32_t count = std::min(aCount, available);
   SBR_DEBUGV("readOffset=%llu GetLength()=%u available=%u count=%u mEnded=%d",
              readOffset, GetLength(), available, count, mEnded);
   if (available == 0) {
     SBR_DEBUGV("reached EOF");
@@ -174,28 +179,37 @@ SourceBufferResource::ReadFromCache(char
 }
 
 uint32_t
 SourceBufferResource::EvictData(uint64_t aPlaybackOffset, uint32_t aThreshold)
 {
   SBR_DEBUG("EvictData(aPlaybackOffset=%llu,"
             "aThreshold=%u)", aPlaybackOffset, aThreshold);
   ReentrantMonitorAutoEnter mon(mMonitor);
-  return mInputBuffer.Evict(aPlaybackOffset, aThreshold);
+  uint32_t result = mInputBuffer.Evict(aPlaybackOffset, aThreshold);
+  if (result > 0) {
+    // Wake up any waiting threads in case a ReadInternal call
+    // is now invalid.
+    mon.NotifyAll();
+  }
+  return result;
 }
 
 void
 SourceBufferResource::EvictBefore(uint64_t aOffset)
 {
   SBR_DEBUG("EvictBefore(aOffset=%llu)", aOffset);
   ReentrantMonitorAutoEnter mon(mMonitor);
   // If aOffset is past the current playback offset we don't evict.
   if (aOffset < mOffset) {
     mInputBuffer.EvictBefore(aOffset);
   }
+  // Wake up any waiting threads in case a ReadInternal call
+  // is now invalid.
+  mon.NotifyAll();
 }
 
 uint32_t
 SourceBufferResource::EvictAll()
 {
   SBR_DEBUG("EvictAll()");
   ReentrantMonitorAutoEnter mon(mMonitor);
   return mInputBuffer.EvictAll();
--- a/dom/quota/QuotaManager.cpp
+++ b/dom/quota/QuotaManager.cpp
@@ -53,18 +53,16 @@
 
 #include "OriginCollection.h"
 #include "OriginOrPatternString.h"
 #include "QuotaObject.h"
 #include "StorageMatcher.h"
 #include "UsageInfo.h"
 #include "Utilities.h"
 
-#define BAD_TLS_INDEX ((uint32_t) -1)
-
 // The amount of time, in milliseconds, that our IO thread will stay alive
 // after the last event it processes.
 #define DEFAULT_THREAD_TIMEOUT_MS 30000
 
 // The amount of time, in milliseconds, that we will wait for active storage
 // transactions on shutdown before aborting them.
 #define DEFAULT_SHUTDOWN_TIMER_MS 30000
 
@@ -1255,18 +1253,17 @@ GetTemporaryStorageLimit(nsIFile* aDirec
 
   *aLimit = resultKB * 1024;
   return NS_OK;
 }
 
 } // anonymous namespace
 
 QuotaManager::QuotaManager()
-: mCurrentWindowIndex(BAD_TLS_INDEX),
-  mQuotaMutex("QuotaManager.mQuotaMutex"),
+: mQuotaMutex("QuotaManager.mQuotaMutex"),
   mTemporaryStorageLimit(0),
   mTemporaryStorageUsage(0),
   mTemporaryStorageInitialized(false),
   mStorageAreaInitialized(false)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(!gInstance, "More than one instance!");
 }
@@ -1333,25 +1330,16 @@ bool
 QuotaManager::IsShuttingDown()
 {
   return gShutdown;
 }
 
 nsresult
 QuotaManager::Init()
 {
-  // We need a thread-local to hold the current window.
-  NS_ASSERTION(mCurrentWindowIndex == BAD_TLS_INDEX, "Huh?");
-
-  if (PR_NewThreadPrivateIndex(&mCurrentWindowIndex, nullptr) != PR_SUCCESS) {
-    NS_ERROR("PR_NewThreadPrivateIndex failed, QuotaManager disabled");
-    mCurrentWindowIndex = BAD_TLS_INDEX;
-    return NS_ERROR_FAILURE;
-  }
-
   nsresult rv;
   if (IsMainProcess()) {
     nsCOMPtr<nsIFile> baseDir;
     rv = NS_GetSpecialDirectory(NS_APP_INDEXEDDB_PARENT_DIR,
                                 getter_AddRefs(baseDir));
     if (NS_FAILED(rv)) {
       rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                                   getter_AddRefs(baseDir));
@@ -2998,34 +2986,16 @@ QuotaManager::Observe(nsISupports* aSubj
 
     return NS_OK;
   }
 
   NS_NOTREACHED("Unknown topic!");
   return NS_ERROR_UNEXPECTED;
 }
 
-void
-QuotaManager::SetCurrentWindowInternal(nsPIDOMWindow* aWindow)
-{
-  NS_ASSERTION(mCurrentWindowIndex != BAD_TLS_INDEX,
-               "Should have a valid TLS storage index!");
-
-  if (aWindow) {
-    NS_ASSERTION(!PR_GetThreadPrivate(mCurrentWindowIndex),
-                 "Somebody forgot to clear the current window!");
-    PR_SetThreadPrivate(mCurrentWindowIndex, aWindow);
-  }
-  else {
-    // We cannot assert PR_GetThreadPrivate(mCurrentWindowIndex) here because
-    // there are some cases where we did not already have a window.
-    PR_SetThreadPrivate(mCurrentWindowIndex, nullptr);
-  }
-}
-
 uint64_t
 QuotaManager::LockedCollectOriginsForEviction(
                                             uint64_t aMinSizeToBeFreed,
                                             nsTArray<OriginInfo*>& aOriginInfos)
 {
   mQuotaMutex.AssertCurrentThreadOwns();
 
   nsRefPtr<CollectOriginsHelper> helper =
--- a/dom/quota/QuotaManager.h
+++ b/dom/quota/QuotaManager.h
@@ -150,27 +150,16 @@ public:
                  nsIFile* aFile);
 
   already_AddRefed<QuotaObject>
   GetQuotaObject(PersistenceType aPersistenceType,
                  const nsACString& aGroup,
                  const nsACString& aOrigin,
                  const nsAString& aPath);
 
-  // Set the Window that the current thread is doing operations for.
-  // The caller is responsible for ensuring that aWindow is held alive.
-  static void
-  SetCurrentWindow(nsPIDOMWindow* aWindow)
-  {
-    QuotaManager* quotaManager = Get();
-    NS_ASSERTION(quotaManager, "Must have a manager here!");
-
-    quotaManager->SetCurrentWindowInternal(aWindow);
-  }
-
   // Called when a storage is created.
   bool
   RegisterStorage(nsIOfflineStorage* aStorage);
 
   // Called when a storage is being unlinked or destroyed.
   void
   UnregisterStorage(nsIOfflineStorage* aStorage);
 
@@ -328,19 +317,16 @@ public:
 private:
   QuotaManager();
 
   virtual ~QuotaManager();
 
   nsresult
   Init();
 
-  void
-  SetCurrentWindowInternal(nsPIDOMWindow* aWindow);
-
   uint64_t
   LockedCollectOriginsForEviction(uint64_t aMinSizeToBeFreed,
                                   nsTArray<OriginInfo*>& aOriginInfos);
 
   void
   LockedRemoveQuotaForOrigin(PersistenceType aPersistenceType,
                              const nsACString& aGroup,
                              const nsACString& aOrigin);
@@ -441,19 +427,16 @@ private:
                         nsTArray<nsIOfflineStorage*>* aValue,
                         void* aUserArg);
 
   static PLDHashOperator
   GetInactiveTemporaryStorageOrigins(const nsACString& aKey,
                                      GroupInfoPair* aValue,
                                      void* aUserArg);
 
-  // TLS storage index for the current thread's window.
-  unsigned int mCurrentWindowIndex;
-
   mozilla::Mutex mQuotaMutex;
 
   nsClassHashtable<nsCStringHashKey, GroupInfoPair> mGroupInfoPairs;
 
   // Maintains a list of live storages per origin.
   nsClassHashtable<nsCStringHashKey,
                    ArrayCluster<nsIOfflineStorage*> > mLiveStorages;
 
@@ -483,25 +466,11 @@ private:
 
   uint64_t mTemporaryStorageLimit;
   uint64_t mTemporaryStorageUsage;
   bool mTemporaryStorageInitialized;
 
   bool mStorageAreaInitialized;
 };
 
-class AutoEnterWindow
-{
-public:
-  explicit AutoEnterWindow(nsPIDOMWindow* aWindow)
-  {
-    QuotaManager::SetCurrentWindow(aWindow);
-  }
-
-  ~AutoEnterWindow()
-  {
-    QuotaManager::SetCurrentWindow(nullptr);
-  }
-};
-
 END_QUOTA_NAMESPACE
 
 #endif /* mozilla_dom_quota_quotamanager_h__ */
--- a/gfx/angle/src/common/angleutils.h
+++ b/gfx/angle/src/common/angleutils.h
@@ -140,17 +140,17 @@ inline std::string Str(int i)
     return strstr.str();
 }
 
 size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector<char>& buffer);
 
 std::string FormatString(const char *fmt, va_list vararg);
 std::string FormatString(const char *fmt, ...);
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER < 1900
 #define snprintf _snprintf
 #endif
 
 #define VENDOR_ID_AMD 0x1002
 #define VENDOR_ID_INTEL 0x8086
 #define VENDOR_ID_NVIDIA 0x10DE
 
 #define GL_BGRA4_ANGLEX 0x6ABC
--- a/gfx/thebes/gfxGDIFontList.cpp
+++ b/gfx/thebes/gfxGDIFontList.cpp
@@ -855,32 +855,32 @@ gfxGDIFontList::FindFamily(const nsAStri
 }
 
 gfxFontFamily*
 gfxGDIFontList::GetDefaultFont(const gfxFontStyle* aStyle)
 {
     gfxFontFamily *ff = nullptr;
 
     // this really shouldn't fail to find a font....
-    HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
-    LOGFONTW logFont;
-    if (hGDI && ::GetObjectW(hGDI, sizeof(logFont), &logFont)) {
-        ff = FindFamily(nsDependentString(logFont.lfFaceName));
-        if (ff) {
-            return ff;
-        }
-    }
-
-    // ...but just in case, try another approach as well
     NONCLIENTMETRICSW ncm;
     ncm.cbSize = sizeof(ncm);
     BOOL status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 
                                           sizeof(ncm), &ncm, 0);
     if (status) {
         ff = FindFamily(nsDependentString(ncm.lfMessageFont.lfFaceName));
+        if (ff) {
+            return ff;
+        }
+    }
+
+    // ...but just in case, try another (long-deprecated) approach as well
+    HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
+    LOGFONTW logFont;
+    if (hGDI && ::GetObjectW(hGDI, sizeof(logFont), &logFont)) {
+        ff = FindFamily(nsDependentString(logFont.lfFaceName));
     }
 
     return ff;
 }
 
 void
 gfxGDIFontList::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
                                        FontListSizes* aSizes) const
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1867,17 +1867,27 @@ gfxWindowsPlatform::InitD3D11Devices()
   // is not blacklisted for D3D11 layers. This will first attempt to create a
   // hardware accelerated device. If this creation fails or the hardware is
   // blacklisted, then this function will abort if WARP is disabled, causing us
   // to fallback to D3D9 or Basic layers. If WARP is not disabled it will use
   // a WARP device which should always be available on Windows 7 and higher.
 
   mD3D11DeviceInitialized = true;
 
-  MOZ_ASSERT(!mD3D11Device);
+  MOZ_ASSERT(!mD3D11Device); 
+
+  bool safeMode = false;
+  nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
+  if (xr) {
+    xr->GetInSafeMode(&safeMode);
+  }
+
+  if (safeMode) {
+    return;
+  }
 
   bool useWARP = false;
 
   nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
   if (gfxInfo) {
     int32_t status;
     if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {
       if (status != nsIGfxInfo::FEATURE_STATUS_OK) {
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -802,45 +802,58 @@ MessageChannel::Send(Message* aMsg, Mess
 
         // See if we've received a reply.
         if (mRecvdErrors) {
             mRecvdErrors--;
             return false;
         }
 
         if (mRecvd) {
-            MOZ_ASSERT(mRecvd->is_reply(), "expected reply");
-            MOZ_ASSERT(!mRecvd->is_reply_error());
-            MOZ_ASSERT(mRecvd->type() == replyType, "wrong reply type");
-            MOZ_ASSERT(mRecvd->seqno() == seqno);
-            MOZ_ASSERT(mRecvd->is_sync());
-
-            *aReply = Move(*mRecvd);
-            mRecvd = nullptr;
-            return true;
+            break;
         }
 
         MOZ_ASSERT(!mTimedOutMessageSeqno);
 
         bool maybeTimedOut = !WaitForSyncNotify();
 
         if (!Connected()) {
             ReportConnectionError("MessageChannel::SendAndWait");
             return false;
         }
 
         // We only time out a message if it initiated a new transaction (i.e.,
         // if neither side has any other message Sends on the stack).
         bool canTimeOut = transaction == seqno;
         if (maybeTimedOut && canTimeOut && !ShouldContinueFromTimeout()) {
+            // We might have received a reply during WaitForSyncNotify or inside
+            // ShouldContinueFromTimeout (which drops the lock). We need to make
+            // sure not to set mTimedOutMessageSeqno if that happens, since then
+            // there would be no way to unset it.
+            if (mRecvdErrors) {
+                mRecvdErrors--;
+                return false;
+            }
+            if (mRecvd) {
+                break;
+            }
+
             mTimedOutMessageSeqno = seqno;
             return false;
         }
     }
 
+    MOZ_ASSERT(mRecvd);
+    MOZ_ASSERT(mRecvd->is_reply(), "expected reply");
+    MOZ_ASSERT(!mRecvd->is_reply_error());
+    MOZ_ASSERT(mRecvd->type() == replyType, "wrong reply type");
+    MOZ_ASSERT(mRecvd->seqno() == seqno);
+    MOZ_ASSERT(mRecvd->is_sync());
+
+    *aReply = Move(*mRecvd);
+    mRecvd = nullptr;
     return true;
 }
 
 bool
 MessageChannel::Call(Message* aMsg, Message* aReply)
 {
     AssertWorkerThread();
     mMonitor->AssertNotCurrentThreadOwns();
--- a/js/src/devtools/automation/cgc-jittest-timeouts.txt
+++ b/js/src/devtools/automation/cgc-jittest-timeouts.txt
@@ -11,9 +11,10 @@ basic/testTypedArrayInit.js
 gc/bug-1014972.js
 gc/bug-906236.js
 gc/bug-906241.js
 ion/bug787921.js
 parallel/alloc-many-objs.js
 parallel/alloc-too-many-objs.js
 self-test/assertDeepEq.js
 v8-v5/check-earley-boyer.js
+v8-v5/check-raytrace.js
 v8-v5/check-splay.js
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -7362,16 +7362,22 @@ Parser<ParseHandler>::comprehensionFor(G
     // FIXME: Destructuring binding (bug 980828).
 
     MUST_MATCH_TOKEN(TOK_NAME, JSMSG_NO_VARIABLE_NAME);
     RootedPropertyName name(context, tokenStream.currentName());
     if (name == context->names().let) {
         report(ParseError, false, null(), JSMSG_LET_COMP_BINDING);
         return null();
     }
+    Node assignLhs = newName(name);
+    if (!assignLhs)
+        return null();
+    Node lhs = newName(name);
+    if (!lhs)
+        return null();
     bool matched;
     if (!tokenStream.matchContextualKeyword(&matched, context->names().of))
         return null();
     if (!matched) {
         report(ParseError, false, null(), JSMSG_OF_AFTER_FOR_NAME);
         return null();
     }
 
@@ -7384,33 +7390,27 @@ Parser<ParseHandler>::comprehensionFor(G
     TokenPos headPos(begin, pos().end);
 
     StmtInfoPC stmtInfo(context);
     BindData<ParseHandler> data(context);
     RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context));
     if (!blockObj)
         return null();
     data.initLexical(DontHoistVars, blockObj, JSMSG_TOO_MANY_LOCALS);
-    Node lhs = newName(name);
-    if (!lhs)
-        return null();
     Node decls = handler.newList(PNK_LET, lhs);
     if (!decls)
         return null();
     data.pn = lhs;
     if (!data.binder(&data, name, this))
         return null();
     Node letScope = pushLetScope(blockObj, &stmtInfo);
     if (!letScope)
         return null();
     handler.setLexicalScopeBody(letScope, decls);
 
-    Node assignLhs = newName(name);
-    if (!assignLhs)
-        return null();
     if (!noteNameUse(name, assignLhs))
         return null();
     handler.setOp(assignLhs, JSOP_SETNAME);
 
     Node head = handler.newForHead(PNK_FOROF, letScope, assignLhs, rhs, headPos);
     if (!head)
         return null();
 
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -3493,29 +3493,36 @@ bool
 ASTSerializer::functionArgs(ParseNode* pn, ParseNode* pnargs, ParseNode* pndestruct,
                             ParseNode* pnbody, NodeVector& args, NodeVector& defaults,
                             MutableHandleValue rest)
 {
     uint32_t i = 0;
     ParseNode* arg = pnargs ? pnargs->pn_head : nullptr;
     ParseNode* destruct = pndestruct ? pndestruct->pn_head : nullptr;
     RootedValue node(cx);
+    bool defaultsNull = true;
+    MOZ_ASSERT(defaults.empty(),
+               "must be initially empty for it to be proper to clear this "
+               "when there are no defaults");
 
     /*
      * Arguments are found in potentially two different places: 1) the
      * argsbody sequence (which ends with the body node), or 2) a
      * destructuring initialization at the beginning of the body. Loop
      * |arg| through the argsbody and |destruct| through the initial
      * destructuring assignments, stopping only when we've exhausted
      * both.
      */
     while ((arg && arg != pnbody) || destruct) {
         if (destruct && destruct->pn_right->frameSlot() == i) {
-            if (!pattern(destruct->pn_left, &node) || !args.append(node))
+            if (!pattern(destruct->pn_left, &node) ||
+                !args.append(node) || !defaults.append(NullValue()))
+            {
                 return false;
+            }
             destruct = destruct->pn_next;
         } else if (arg && arg != pnbody) {
             /*
              * We don't check that arg->frameSlot() == i since we
              * can't call that method if the arg def has been turned
              * into a use, e.g.:
              *
              *     function(a) { function a() { } }
@@ -3528,29 +3535,36 @@ ASTSerializer::functionArgs(ParseNode* p
             ParseNode* argName = arg->isKind(PNK_NAME) ? arg : arg->pn_left;
             if (!identifier(argName, &node))
                 return false;
             if (rest.isUndefined() && arg->pn_next == pnbody)
                 rest.setObject(node.toObject());
             else if (!args.append(node))
                 return false;
             if (arg->pn_dflags & PND_DEFAULT) {
+                defaultsNull = false;
                 ParseNode* expr = arg->expr();
                 RootedValue def(cx);
                 if (!expression(expr, &def) || !defaults.append(def))
                     return false;
+            } else {
+                if (!defaults.append(NullValue()))
+                    return false;
             }
             arg = arg->pn_next;
         } else {
             LOCAL_NOT_REACHED("missing function argument");
         }
         ++i;
     }
     MOZ_ASSERT(!rest.isUndefined());
 
+    if (defaultsNull)
+        defaults.clear();
+
     return true;
 }
 
 bool
 ASTSerializer::functionBody(ParseNode* pn, TokenPos* pos, MutableHandleValue dst)
 {
     NodeVector elts(cx);
 
--- a/js/src/tests/js1_8_5/extensions/reflect-parse.js
+++ b/js/src/tests/js1_8_5/extensions/reflect-parse.js
@@ -247,19 +247,19 @@ assertDecl("function foo() { }",
            funDecl(ident("foo"), [], blockStmt([])));
 assertDecl("function foo() { return 42 }",
            funDecl(ident("foo"), [], blockStmt([returnStmt(lit(42))])));
 
 assertDecl("function foo(...rest) { }",
            funDecl(ident("foo"), [], blockStmt([]), [], ident("rest")));
 
 assertDecl("function foo(a=4) { }", funDecl(ident("foo"), [ident("a")], blockStmt([]), [lit(4)]));
-assertDecl("function foo(a, b=4) { }", funDecl(ident("foo"), [ident("a"), ident("b")], blockStmt([]), [lit(4)]));
+assertDecl("function foo(a, b=4) { }", funDecl(ident("foo"), [ident("a"), ident("b")], blockStmt([]), [null, lit(4)]));
 assertDecl("function foo(a, b=4, ...rest) { }",
-           funDecl(ident("foo"), [ident("a"), ident("b")], blockStmt([]), [lit(4)], ident("rest")));
+           funDecl(ident("foo"), [ident("a"), ident("b")], blockStmt([]), [null, lit(4), null], ident("rest")));
 assertDecl("function foo(a=(function () {})) { function a() {} }",
            funDecl(ident("foo"), [ident("a")], blockStmt([funDecl(ident("a"), [], blockStmt([]))]),
                    [funExpr(null, [], blockStmt([]))]));
 
 
 // Bug 591437: rebound args have their defs turned into uses
 assertDecl("function f(a) { function a() { } }",
            funDecl(ident("f"), [ident("a")], blockStmt([funDecl(ident("a"), [], blockStmt([]))])));
@@ -1457,16 +1457,18 @@ Pattern({ source: null, start: { line: 1
 Pattern({ source: "foo.js", start: { line: 1, column: 0 }, end: { line: 2, column: 3 } }).match(withFile2.loc);
 Pattern({ source: "foo.js", start: { line: 111, column: 0 }, end: { line: 112, column: 3 } }).match(withFileAndLine2.loc);
 
 var nested = Reflect.parse("(-b + sqrt(sqr(b) - 4 * a * c)) / (2 * a)", {source:"quad.js"});
 var fourAC = nested.body[0].expression.left.right.arguments[0].right;
 
 Pattern({ source: "quad.js", start: { line: 1, column: 20 }, end: { line: 1, column: 29 } }).match(fourAC.loc);
 
+var generator = Reflect.parse("[ for \n(x of a) x+1 ]");
+Pattern({ start: { line: 2, column: 1 }, end: { line: 2, column: 2 } }).match(generator.body[0].expression.blocks[0].left.loc);
 
 // No source location
 
 assertEq(Reflect.parse("42", {loc:false}).loc, null);
 program([exprStmt(lit(42))]).assert(Reflect.parse("42", {loc:false}));
 
 
 // Builder tests
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6640,18 +6640,29 @@ nsBlockFrame::Init(nsIContent*       aCo
     // Copy over the inherited block frame bits from the prev-in-flow.
     SetFlags(aPrevInFlow->GetStateBits() &
              (NS_BLOCK_FLAGS_MASK & ~NS_BLOCK_FLAGS_NON_INHERITED_MASK));
   }
 
   nsBlockFrameSuper::Init(aContent, aParent, aPrevInFlow);
 
   if (!aPrevInFlow ||
-      aPrevInFlow->GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
+      aPrevInFlow->GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION) {
     AddStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
+  }
+
+  // If a box has a different block flow direction than its containing block:
+  // ...
+  //   If the box is a block container, then it establishes a new block
+  //   formatting context.
+  // (http://dev.w3.org/csswg/css-writing-modes/#block-flow)
+  if (GetParent() && StyleVisibility()->mWritingMode !=
+                     GetParent()->StyleVisibility()->mWritingMode) {
+    AddStateBits(NS_BLOCK_FLOAT_MGR | NS_BLOCK_MARGIN_ROOT);
+  }
 
   if ((GetStateBits() &
        (NS_FRAME_FONT_INFLATION_CONTAINER | NS_BLOCK_FLOAT_MGR)) ==
       (NS_FRAME_FONT_INFLATION_CONTAINER | NS_BLOCK_FLOAT_MGR)) {
     AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
   }
 }
 
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -34,17 +34,20 @@ PSArenaFreeCB(size_t aSize, void* aPtr, 
   static_cast<nsIPresShell*>(aClosure)->FreeMisc(aSize, aPtr);
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // nsFloatManager
 
 nsFloatManager::nsFloatManager(nsIPresShell* aPresShell,
                                mozilla::WritingMode aWM)
-  : mWritingMode(aWM),
+  :
+#ifdef DEBUG
+    mWritingMode(aWM),
+#endif
     mLineLeft(0), mBlockStart(0),
     mFloatDamage(PSArenaAllocCB, PSArenaFreeCB, aPresShell),
     mPushedLeftFloatPastBreak(false),
     mPushedRightFloatPastBreak(false),
     mSplitLeftFloatAcrossBreak(false),
     mSplitRightFloatAcrossBreak(false)
 {
   MOZ_COUNT_CTOR(nsFloatManager);
@@ -106,22 +109,27 @@ void nsFloatManager::Shutdown()
     if (floatManager)
       free(floatManager);
   }
 
   // Disable further caching.
   sCachedFloatManagerCount = -1;
 }
 
+#define CHECK_BLOCK_DIR(aWM) \
+  NS_ASSERTION(aWM.GetBlockDir() == mWritingMode.value.GetBlockDir(), \
+  "incompatible writing modes")
+
 nsFlowAreaRect
 nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
                             BandInfoType aInfoType, nscoord aBSize,
                             LogicalRect aContentArea, SavedState* aState,
                             nscoord aContainerWidth) const
 {
+  CHECK_BLOCK_DIR(aWM);
   NS_ASSERTION(aBSize >= 0, "unexpected max block size");
   NS_ASSERTION(aContentArea.ISize(aWM) >= 0,
                "unexpected content area inline size");
 
   nscoord blockStart = aBOffset + mBlockStart;
   if (blockStart < nscoord_MIN) {
     NS_WARNING("bad value");
     blockStart = nscoord_MIN;
@@ -241,16 +249,17 @@ nsFloatManager::GetFlowArea(WritingMode 
   return nsFlowAreaRect(aWM, inlineStart, blockStart - mBlockStart,
                         lineRight - lineLeft, blockSize, haveFloats);
 }
 
 nsresult
 nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
                          WritingMode aWM, nscoord aContainerWidth)
 {
+  CHECK_BLOCK_DIR(aWM);
   NS_ASSERTION(aMarginRect.ISize(aWM) >= 0, "negative inline size!");
   NS_ASSERTION(aMarginRect.BSize(aWM) >= 0, "negative block size!");
 
   FloatInfo info(aFloatFrame,
                  aMarginRect.LineLeft(aWM, aContainerWidth) + mLineLeft,
                  aMarginRect.BStart(aWM) + mBlockStart,
                  aMarginRect.ISize(aWM),
                  aMarginRect.BSize(aWM));
@@ -400,32 +409,30 @@ nsFloatManager::PushState(SavedState* aS
   // It should also be noted that the state for mFloatDamage is
   // intentionally not saved or restored in PushState() and PopState(),
   // since that could lead to bugs where damage is missed/dropped when
   // we move from position A to B (during the intermediate incremental
   // reflow mentioned above) and then from B to C during the subsequent
   // reflow. In the typical case A and C will be the same, but not always.
   // Allowing mFloatDamage to accumulate the damage incurred during both
   // reflows ensures that nothing gets missed.
-  aState->mWritingMode = mWritingMode;
   aState->mLineLeft = mLineLeft;
   aState->mBlockStart = mBlockStart;
   aState->mPushedLeftFloatPastBreak = mPushedLeftFloatPastBreak;
   aState->mPushedRightFloatPastBreak = mPushedRightFloatPastBreak;
   aState->mSplitLeftFloatAcrossBreak = mSplitLeftFloatAcrossBreak;
   aState->mSplitRightFloatAcrossBreak = mSplitRightFloatAcrossBreak;
   aState->mFloatInfoCount = mFloats.Length();
 }
 
 void
 nsFloatManager::PopState(SavedState* aState)
 {
   NS_PRECONDITION(aState, "No state to restore?");
 
-  mWritingMode = aState->mWritingMode;
   mLineLeft = aState->mLineLeft;
   mBlockStart = aState->mBlockStart;
   mPushedLeftFloatPastBreak = aState->mPushedLeftFloatPastBreak;
   mPushedRightFloatPastBreak = aState->mPushedRightFloatPastBreak;
   mSplitLeftFloatAcrossBreak = aState->mSplitLeftFloatAcrossBreak;
   mSplitRightFloatAcrossBreak = aState->mSplitRightFloatAcrossBreak;
 
   NS_ASSERTION(aState->mFloatInfoCount <= mFloats.Length(),
--- a/layout/generic/nsFloatManager.h
+++ b/layout/generic/nsFloatManager.h
@@ -83,17 +83,16 @@ public:
                              nscoord aContainerWidth);
 
   // Structure that stores the current state of a frame manager for
   // Save/Restore purposes.
   struct SavedState {
     explicit SavedState() {}
   private:
     uint32_t mFloatInfoCount;
-    mozilla::WritingMode mWritingMode;
     nscoord mLineLeft, mBlockStart;
     bool mPushedLeftFloatPastBreak;
     bool mPushedRightFloatPastBreak;
     bool mSplitLeftFloatAcrossBreak;
     bool mSplitRightFloatAcrossBreak;
 
     friend class nsFloatManager;
   };
@@ -282,18 +281,17 @@ public:
   /**
    * Checks if clear would pass into the floats' BFC's next-in-flow,
    * i.e. whether floats affecting this clear have continuations.
    */
   bool ClearContinues(uint8_t aBreakType) const;
 
   void AssertStateMatches(SavedState *aState) const
   {
-    NS_ASSERTION(aState->mWritingMode == mWritingMode &&
-                 aState->mLineLeft == mLineLeft &&
+    NS_ASSERTION(aState->mLineLeft == mLineLeft &&
                  aState->mBlockStart == mBlockStart &&
                  aState->mPushedLeftFloatPastBreak ==
                    mPushedLeftFloatPastBreak &&
                  aState->mPushedRightFloatPastBreak ==
                    mPushedRightFloatPastBreak &&
                  aState->mSplitLeftFloatAcrossBreak ==
                    mSplitLeftFloatAcrossBreak &&
                  aState->mSplitRightFloatAcrossBreak ==
@@ -338,17 +336,17 @@ private:
     // placing floats, which is not necessarily the actual writing mode
     // either of the block which created the frame manager or the block
     // that is calling the frame manager. The inline coordinates are in
     // the line-relative axis of the frame manager and its block
     // coordinates are in the frame manager's real block direction.
     nsRect mRect;
   };
 
-  mozilla::WritingMode mWritingMode;
+  mozilla::DebugOnly<mozilla::WritingMode> mWritingMode;
 
   // Translation from local to global coordinate space.
   nscoord mLineLeft, mBlockStart;
   nsTArray<FloatInfo> mFloats;
   nsIntervalSet   mFloatDamage;
 
   // Did we try to place a float that could not fit at all and had to be
   // pushed to the next page/column?  If so, we can't place any more
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -552,19 +552,19 @@ fails-if(OSX) != 359903-1.html 359903-1-
 skip-if(Android) == 363706-1.html 363706-1-ref.html
 != 363706-1.html about:blank
 == 363728-1.html 363728-1-ref.html
 == 363728-2.html 363728-2-ref.html
 skip-if(B2G||Mulet) == 363858-1.html 363858-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) == 363858-2.html 363858-2-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) == 363858-3.html 363858-3-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) == 363858-4.html 363858-4-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
-fuzzy-if(OSX>=1008,45,2) == 363858-5a.html 363858-5-ref.html
+fuzzy-if(OSX>=1008,45,2) fuzzy-if(winWidget,37,1) == 363858-5a.html 363858-5-ref.html
 == 363858-5b.html 363858-5-ref.html
-fuzzy-if(OSX>=1008,45,2) == 363858-6a.html 363858-6-ref.html
+fuzzy-if(OSX>=1008,45,2) fuzzy-if(winWidget,37,1) == 363858-6a.html 363858-6-ref.html
 == 363858-6b.html 363858-6-ref.html
 == 363874.html 363874-ref.html
 == 363874-max-width.html 363874-max-width-ref.html
 == 364066-1.html 364066-1-ref.html
 == 364079-1.html 364079-1-ref.html
 == 364318-1.xhtml 364318-1-ref.xhtml
 == 364861-1.html 364861-1-ref.html
 skip-if(B2G||Mulet) == 364862-1.html 364862-1-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
--- a/layout/reftests/forms/placeholder/reftest.list
+++ b/layout/reftests/forms/placeholder/reftest.list
@@ -11,17 +11,17 @@
 == placeholder-1-text.html placeholder-visible-ref.html
 == placeholder-1-password.html placeholder-visible-ref.html
 == placeholder-1-textarea.html placeholder-visible-textarea-ref.html
 == placeholder-2.html placeholder-visible-ref.html
 == placeholder-2-textarea.html placeholder-visible-textarea-ref.html
 == placeholder-3.html placeholder-overridden-ref.html
 == placeholder-4.html placeholder-overridden-ref.html
 == placeholder-5.html placeholder-visible-ref.html
-fuzzy-if(winWidget,160,6) == placeholder-6.html placeholder-overflow-ref.html
+fuzzy-if(winWidget,160,7) == placeholder-6.html placeholder-overflow-ref.html
 skip-if(B2G||Mulet) == placeholder-6-textarea.html placeholder-overflow-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 # needs-focus == placeholder-7.html placeholder-focus-ref.html
 # needs-focus == placeholder-8.html placeholder-focus-ref.html
 # needs-focus == placeholder-9.html placeholder-focus-ref.html
 needs-focus == placeholder-10.html placeholder-visible-ref.html
 == placeholder-11.html placeholder-visible-ref.html
 == placeholder-12.html placeholder-visible-ref.html
 == placeholder-13.html placeholder-visible-ref.html
--- a/layout/reftests/writing-mode/reftest.list
+++ b/layout/reftests/writing-mode/reftest.list
@@ -103,19 +103,19 @@ HTTP(..) == 1127488-align-start-vertical
 HTTP(..) == 1127488-align-end-vertical-lr-ltr.html 1127488-align-bottom-left-ref.html
 HTTP(..) == 1127488-align-left-vertical-lr-ltr.html 1127488-align-top-left-ref.html
 HTTP(..) == 1127488-align-right-vertical-lr-ltr.html 1127488-align-bottom-left-ref.html
 == 1131013-vertical-bidi.html 1131013-vertical-bidi-ref.html
 == 1133945-1-vertical-align.html 1133945-1-vertical-align-ref.html
 == 1134744-radio-checkbox-baseline-1.html 1134744-radio-checkbox-baseline-1-ref.html
 == 1134849-orthogonal-inline.html 1134849-orthogonal-inline-ref.html
 fails-if(B2G||Mulet) == 1135361-ruby-justify-1.html 1135361-ruby-justify-1-ref.html # bug 1136067 # Initial mulet triage: parity with B2G/B2G Desktop
-skip-if(Mulet) == 1136557-1-nested-spans.html 1136557-1-nested-spans-ref.html # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
-skip-if(Mulet) fuzzy-if(winWidget,255,69) == 1136557-2-nested-spans.html 1136557-2-nested-spans-ref.html # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
-skip-if(Mulet) == 1136557-3-nested-spans.html 1136557-3-nested-spans-ref.html # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
+skip-if(Mulet) fuzzy-if(winWidget,255,163) == 1136557-1-nested-spans.html 1136557-1-nested-spans-ref.html # Bug 1150250 for Windows fuzz # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
+skip-if(Mulet) fuzzy-if(winWidget,255,199) == 1136557-2-nested-spans.html 1136557-2-nested-spans-ref.html # Bug 1150250 for Windows fuzz # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
+skip-if(Mulet) fuzzy-if(winWidget,255,58) == 1136557-3-nested-spans.html 1136557-3-nested-spans-ref.html # Bug 1150250 for Windows fuzz # TC: Bug 1144079 - Re-enable Mulet mochitests and reftests taskcluster-specific disables.
 == 1138356-1-button-contents-alignment.html 1138356-1-button-contents-alignment-ref.html
 != 1138356-2-button-contents-alignment.html 1138356-2-button-contents-alignment-notref.html
 
 # Font inflation behaves wrong in vertical writing mode: bug 1138495
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1a.html font-inflation-1-ref.html
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) == font-inflation-1b.html font-inflation-1-ref.html
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) != font-inflation-1c.html font-inflation-1-ref.html
 test-pref(dom.meta-viewport.enabled,true) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.forceEnabled,true) test-pref(font.size.inflation.lineThreshold,0) != font-inflation-1d.html font-inflation-1-ref.html
--- a/layout/style/test/test_animations_omta.html
+++ b/layout/style/test/test_animations_omta.html
@@ -196,16 +196,17 @@ window.new_div = function(style) {
 };
 var originalDoneDiv = window.done_div;
 window.done_div = function() {
   originalDoneDiv();
   gDiv = null;
 };
 
 SimpleTest.waitForExplicitFinish();
+SimpleTest.requestLongerTimeout(2);
 runOMTATest(function() {
   var onAbort = function() {
     if (gDiv) {
       done_div();
     }
   };
   runAllAsyncAnimTests(onAbort).then(function() {
     SimpleTest.finish();
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -808,17 +808,20 @@ class ReftestOptions(OptionParser):
         self.error("cannot specify logfile with parallel tests")
       if options.totalChunks is not None and options.thisChunk is None:
         self.error("cannot specify thisChunk or totalChunks with parallel tests")
       if options.focusFilterMode != "all":
         self.error("cannot specify focusFilterMode with parallel tests")
       if options.debugger is not None:
         self.error("cannot specify a debugger with parallel tests")
 
-    options.leakThresholds = {"default": options.defaultLeakThreshold}
+    options.leakThresholds = {
+        "default": options.defaultLeakThreshold,
+        "tab": 25000,  # See dependencies of bug 1051230.
+    }
 
     return options
 
 def main():
   parser = ReftestOptions()
   reftest = RefTest()
 
   options, args = parser.parse_args()
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -1150,16 +1150,19 @@ void close_wasapi_stream(cubeb_stream * 
   stm->stream_reset_lock->assert_current_thread_owns();
 
   SafeRelease(stm->client);
   stm->client = NULL;
 
   SafeRelease(stm->render_client);
   stm->render_client = NULL;
 
+  SafeRelease(stm->audio_stream_volume);
+  stm->audio_stream_volume = NULL;
+
   if (stm->resampler) {
     cubeb_resampler_destroy(stm->resampler);
     stm->resampler = NULL;
   }
 
   free(stm->mix_buffer);
   stm->mix_buffer = NULL;
 }
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4647,22 +4647,17 @@ pref("reader.toolbar.vertical", true);
 pref("media.gmp.insecure.allow", false);
 #endif
 
 // Use vsync aligned rendering. b2g prefs are in b2g.js
 // Only supported on windows, os x, and b2g
 #if defined(XP_MACOSX) || defined(XP_WIN)
 pref("gfx.vsync.hw-vsync.enabled", true);
 pref("gfx.vsync.compositor", true);
-#endif
-
-#if defined(XP_MACOSX)
 pref("gfx.vsync.refreshdriver", true);
-#else
-pref("gfx.vsync.refreshdriver", false);
 #endif
 
 #if defined(XP_LINUX)
 pref("gfx.vsync.hw-vsync.enabled", true);
 pref("gfx.vsync.compositor", true);
 #endif
 
 // Secure Element API
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -8,16 +8,17 @@ TEST_DIRS += ['httpserver']
 
 FAIL_ON_WARNINGS = True
 
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
 MOCHITEST_MANIFESTS += ['mochitests/mochitest.ini']
 
 XPCSHELL_TESTS_MANIFESTS += [
     'unit/xpcshell.ini',
+    'unit/xpcshell_b2g.ini',
     'unit_ipc/xpcshell.ini',
 ]
 
 GeckoSimplePrograms([
     'PropertiesTest',
     'ReadNTLM',
     'TestBlockingSocket',
     'TestCallbacks',
--- a/netwerk/test/unit/xpcshell.ini
+++ b/netwerk/test/unit/xpcshell.ini
@@ -1,12 +1,12 @@
 [DEFAULT]
 head = head_channels.js head_cache.js head_cache2.js
 tail =
-skip-if = toolkit == 'gonk'
+skip-if = buildapp == 'b2g'
 support-files =
   data/image.png
   data/system_root.lnk
   data/test_psl.txt
   data/test_readline1.txt
   data/test_readline2.txt
   data/test_readline3.txt
   data/test_readline4.txt
@@ -215,17 +215,16 @@ skip-if = bits != 32
 [test_multipart_streamconv.js]
 [test_multipart_streamconv_missing_lead_boundary.js]
 [test_nestedabout_serialize.js]
 [test_net_addr.js]
 # Bug 732363: test fails on windows for unknown reasons.
 skip-if = os == "win"
 [test_nojsredir.js]
 [test_offline_status.js]
-[test_pac_generator.js]
 [test_parse_content_type.js]
 [test_permmgr.js]
 [test_plaintext_sniff.js]
 [test_post.js]
 [test_private_necko_channel.js]
 [test_private_cookie_changed.js]
 [test_progress.js]
 [test_protocolproxyservice.js]
new file mode 100644
--- /dev/null
+++ b/netwerk/test/unit/xpcshell_b2g.ini
@@ -0,0 +1,8 @@
+[DEFAULT]
+head = head_channels.js head_cache.js head_cache2.js
+tail =
+skip-if = buildapp != 'b2g'
+
+# For bug 1148503.  This is to accommodate non-mozilla-central that didn't
+# include required files for this test.
+[test_pac_generator.js]
--- a/security/certverifier/ExtendedValidation.cpp
+++ b/security/certverifier/ExtendedValidation.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ExtendedValidation.h"
 
 #include "cert.h"
 #include "certdb.h"
 #include "base64.h"
 #include "hasht.h"
-#include "pkix/stdkeywords.h"
 #include "pkix/pkixtypes.h"
 #include "pk11pub.h"
 #include "secerr.h"
 #include "prerror.h"
 #include "prinit.h"
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gPIPNSSLog;
--- a/security/manager/boot/src/PublicKeyPinningService.cpp
+++ b/security/manager/boot/src/PublicKeyPinningService.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/Base64.h"
 #include "mozilla/Telemetry.h"
 #include "nsISiteSecurityService.h"
 #include "nssb64.h"
 #include "nsServiceManagerUtils.h"
 #include "nsSiteSecurityService.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "pkix/stdkeywords.h"
 #include "pkix/pkixtypes.h"
 #include "prlog.h"
 #include "RootCertificateTelemetryUtils.h"
 #include "ScopedNSSTypes.h"
 #include "seccomon.h"
 #include "sechash.h"
 #include "StaticHPKPins.h" // autogenerated by genHPKPStaticpins.js
 
--- a/security/manager/ssl/tests/unit/xpcshell.ini
+++ b/security/manager/ssl/tests/unit/xpcshell.ini
@@ -101,15 +101,18 @@ run-sequentially = hardcoded ports
 run-sequentially = hardcoded ports
 [test_ocsp_fetch_method.js]
 run-sequentially = hardcoded ports
 [test_ocsp_no_hsts_upgrade.js]
 run-sequentially = hardcoded ports
 [test_add_preexisting_cert.js]
 [test_keysize.js]
 [test_keysize_ev.js]
+# OCSP requests in this test time out on slow B2G Emulator debug builds.
+# See Bug 1147726.
+skip-if = toolkit == 'gonk' && debug
 run-sequentially = hardcoded ports
 [test_cert_chains.js]
 run-sequentially = hardcoded ports
 [test_client_cert.js]
 run-sequentially = hardcoded ports
 [test_nsCertType.js]
 run-sequentially = hardcoded ports
--- a/security/pkix/include/pkix/Input.h
+++ b/security/pkix/include/pkix/Input.h
@@ -22,17 +22,16 @@
  * limitations under the License.
  */
 
 #ifndef mozilla_pkix_Input_h
 #define mozilla_pkix_Input_h
 
 #include <cstring>
 
-#include "pkix/stdkeywords.h"
 #include "pkix/Result.h"
 #include "stdint.h"
 
 namespace mozilla { namespace pkix {
 
 class Reader;
 
 // An Input is a safety-oriented immutable weak reference to a array of bytes
--- a/security/pkix/include/pkix/ScopedPtr.h
+++ b/security/pkix/include/pkix/ScopedPtr.h
@@ -20,18 +20,16 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #ifndef mozilla_pkix_ScopedPtr_h
 #define mozilla_pkix_ScopedPtr_h
 
-#include "pkix/stdkeywords.h"
-
 namespace mozilla { namespace pkix {
 
 // Similar to boost::scoped_ptr and std::unique_ptr. Does not support copying
 // or assignment.
 template <typename T, void (&Destroyer)(T*)>
 class ScopedPtr final
 {
 public:
--- a/security/pkix/include/pkix/Time.h
+++ b/security/pkix/include/pkix/Time.h
@@ -25,17 +25,16 @@
 #ifndef mozilla_pkix_Time_h
 #define mozilla_pkix_Time_h
 
 #include <ctime>
 #include <limits>
 #include <stdint.h>
 
 #include "pkix/Result.h"
-#include "pkix/stdkeywords.h"
 
 namespace mozilla { namespace pkix {
 
 // Time with a range from the first second of year 0 (AD) through at least the
 // last second of year 9999, which is the range of legal times in X.509 and
 // OCSP. This type has second-level precision. The time zone is always UTC.
 //
 // Pass by value, not by reference.
deleted file mode 100644
--- a/security/pkix/include/pkix/stdkeywords.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This code is made available to you under your choice of the following sets
- * of licensing terms:
- */
-/* 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/.
- */
-/* Copyright 2013 Mozilla Contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef mozilla_pkix_stdkeywords_h
-#define mozilla_pkix_stdkeywords_h
-
-#if defined(__GNUC__) && !defined(__clang__)
-
-// GCC does not understand final/override until 4.7
-#if __GNUC__ * 100 + __GNUC_MINOR__ < 407
-#define final
-#define override
-#endif
-
-#endif // defined(__GNUC__) && !defined(__clang__)
-
-#endif // mozilla_pkix_stdkeywords_h
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -825,19 +825,19 @@ GeckoDriver.prototype.getContext = funct
  */
 GeckoDriver.prototype.createExecuteSandbox = function(win, mn, sp) {
   let sb = new Cu.Sandbox(win,
       {sandboxPrototype: win, wantXrays: false, sandboxName: ""});
   sb.global = sb;
   sb.testUtils = utils;
 
   mn.exports.forEach(function(fn) {
-    try {
+    if (typeof mn[fn] === 'function') {
       sb[fn] = mn[fn].bind(mn);
-    } catch(e) {
+    } else {
       sb[fn] = mn[fn];
     }
   });
 
   sb.isSystemMessageListenerReady = () => systemMessageListenerReady;
 
   if (sp) {
     let pow = [
--- a/toolkit/components/social/test/browser/browser.ini
+++ b/toolkit/components/social/test/browser/browser.ini
@@ -11,15 +11,16 @@ support-files =
   relative_import.js
   worker_social.js
   worker_eventsource.js
   eventsource.resource
   eventsource.resource^headers^
 
 [browser_workerAPI.js]
 [browser_SocialProvider.js]
+skip-if = e10s && debug # Leaking docshells (bug 1150147)
 [browser_notifications.js]
 
 # These tests are currently unreliable on ASAN builds with remote frameworkers.
 [browser_frameworker.js]
 skip-if = asan || (os == 'linux' && debug) || (os == 'mac' && debug) # Bug 994798 for Linux debug disabling, bug 994300 for Mac debug disabling
 [browser_frameworker_sandbox.js]
 skip-if = asan || (os == 'linux' && debug) || (os == 'mac' && debug) # Bug 994798 for Linux debug disabling, bug 994300 for Mac debug disabling
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -348,25 +348,25 @@
   },
   "JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1, LegacyGenerator=2, ExpressionClosure=3, LetBlock=4, LetExpression=5, NoSuchMethod=6, FlagsArgument=7"
   },
   "TELEMETRY_PING": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Time taken to submit telemetry info (ms)"
   },
   "TELEMETRY_SUCCESS": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "boolean",
     "description": "Successful telemetry submission"
   },
   "XUL_CACHE_DISABLED": {
     "expires_in_version": "default",
     "kind": "flag",
     "description": "XUL cache was disabled"
   },
@@ -4526,106 +4526,106 @@
     "low": 1024,
     "high": "32768",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "DOM storage: size of values stored in sessionStorage"
   },
   "RANGE_CHECKSUM_ERRORS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "40",
+    "expires_in_version": "never",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Number of histograms with range checksum errors"
   },
   "BUCKET_ORDER_ERRORS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "40",
+    "expires_in_version": "never",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Number of histograms with bucket order errors"
   },
   "TOTAL_COUNT_HIGH_ERRORS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "40",
+    "expires_in_version": "never",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Number of histograms with total count high errors"
   },
   "TOTAL_COUNT_LOW_ERRORS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "40",
+    "expires_in_version": "never",
     "kind": "exponential",
     "high": "3000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Number of histograms with total count low errors"
   },
   "TELEMETRY_DISCARDED_CONTENT_PINGS_COUNT": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "count",
     "description": "Count of discarded content payloads."
   },
   "TELEMETRY_FILES_EVICTED": {
-    "alert_emails": ["rvitillo@mozilla.com"],
-    "expires_in_version": "36",
+    "alert_emails": ["perf-telemetry-alerts@mozilla.com", "rvitillo@mozilla.com"],
+    "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 30,
     "description": "Number of telemetry pings evicted at startup"
   },
   "TELEMETRY_TEST_FLAG": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_COUNT": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "count",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_KEYED_FLAG": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "keyed": true,
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_KEYED_COUNT": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "count",
     "keyed": true,
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_RELEASE_OPTOUT": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "releaseChannelCollection": "opt-out",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_RELEASE_OPTIN": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "releaseChannelCollection": "opt-in",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_KEYED_RELEASE_OPTIN": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "keyed": true,
     "releaseChannelCollection": "opt-in",
     "description": "a testing histogram; not meant to be touched"
   },
   "TELEMETRY_TEST_KEYED_RELEASE_OPTOUT": {
-    "expires_in_version": "default",
+    "expires_in_version": "never",
     "kind": "flag",
     "keyed": true,
     "releaseChannelCollection": "opt-out",
     "description": "a testing histogram; not meant to be touched"
   },
   "STARTUP_CRASH_DETECTED": {
     "expires_in_version": "never",
     "kind": "flag",
@@ -4941,17 +4941,17 @@
   },
   "ENABLE_PRIVILEGE_EVER_CALLED": {
     "expires_in_version": "never",
     "kind": "flag",
     "description": "Whether enablePrivilege has ever been called during the current session"
   },
   "READ_SAVED_PING_SUCCESS": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
-    "expires_in_version": "40",
+    "expires_in_version": "never",
     "kind": "boolean",
     "description": "Successfully reading a saved ping file"
   },
   "TOUCH_ENABLED_DEVICE": {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "The device supports touch input",
     "cpp_guard": "XP_WIN"
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -1815,21 +1815,33 @@ mHashMutex("Telemetry::mHashMutex"),
 mHangReportsMutex("Telemetry::mHangReportsMutex"),
 mThreadHangStatsMutex("Telemetry::mThreadHangStatsMutex"),
 mCachedTelemetryData(false),
 mLastShutdownTime(0),
 mFailedLockCount(0)
 {
   // A whitelist to prevent Telemetry reporting on Addon & Thunderbird DBs
   const char *trackedDBs[] = {
-    "addons.sqlite", "content-prefs.sqlite", "cookies.sqlite",
-    "downloads.sqlite", "extensions.sqlite", "formhistory.sqlite",
-    "index.sqlite", "healthreport.sqlite", "netpredictions.sqlite",
-    "permissions.sqlite", "places.sqlite", "search.sqlite", "signons.sqlite",
-    "urlclassifier3.sqlite", "webappsstore.sqlite"
+    "818200132aebmoouht.sqlite", // IndexedDB for about:home, see aboutHome.js
+    "addons.sqlite",
+    "content-prefs.sqlite",
+    "cookies.sqlite",
+    "downloads.sqlite",
+    "extensions.sqlite",
+    "formhistory.sqlite",
+    "healthreport.sqlite",
+    "index.sqlite",
+    "netpredictions.sqlite",
+    "permissions.sqlite",
+    "places.sqlite",
+    "reading-list.sqlite",
+    "search.sqlite",
+    "signons.sqlite",
+    "urlclassifier3.sqlite",
+    "webappsstore.sqlite"
   };
 
   for (size_t i = 0; i < ArrayLength(trackedDBs); i++)
     mTrackedDBs.PutEntry(nsDependentCString(trackedDBs[i]));
 
 #ifdef DEBUG
   // Mark immutable to prevent asserts on simultaneous access from multiple threads
   mTrackedDBs.MarkImmutable();
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -530,80 +530,67 @@ nsLookAndFeel::GetFloatImpl(FloatID aID,
 static bool
 GetSysFontInfo(HDC aHDC, LookAndFeel::FontID anID,
                nsString &aFontName,
                gfxFontStyle &aFontStyle)
 {
   LOGFONTW* ptrLogFont = nullptr;
   LOGFONTW logFont;
   NONCLIENTMETRICSW ncm;
-  HGDIOBJ hGDI;
   char16_t name[LF_FACESIZE];
+  bool useShellDlg = false;
 
-  // Depending on which stock font we want, there are three different
+  // Depending on which stock font we want, there are a couple of
   // places we might have to look it up.
   switch (anID) {
   case LookAndFeel::eFont_Icon:
     if (!::SystemParametersInfoW(SPI_GETICONTITLELOGFONT,
                                  sizeof(logFont), (PVOID)&logFont, 0))
       return false;
 
     ptrLogFont = &logFont;
     break;
 
-  case LookAndFeel::eFont_Menu:
-  case LookAndFeel::eFont_MessageBox:
-  case LookAndFeel::eFont_SmallCaption:
-  case LookAndFeel::eFont_StatusBar:
-  case LookAndFeel::eFont_Tooltips:
+  default:
     ncm.cbSize = sizeof(NONCLIENTMETRICSW);
     if (!::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
                                  sizeof(ncm), (PVOID)&ncm, 0))
       return false;
 
     switch (anID) {
     case LookAndFeel::eFont_Menu:
+    case LookAndFeel::eFont_PullDownMenu:
       ptrLogFont = &ncm.lfMenuFont;
       break;
-    case LookAndFeel::eFont_MessageBox:
-      ptrLogFont = &ncm.lfMessageFont;
+    case LookAndFeel::eFont_Caption:
+      ptrLogFont = &ncm.lfCaptionFont;
       break;
     case LookAndFeel::eFont_SmallCaption:
       ptrLogFont = &ncm.lfSmCaptionFont;
       break;
     case LookAndFeel::eFont_StatusBar:
     case LookAndFeel::eFont_Tooltips:
       ptrLogFont = &ncm.lfStatusFont;
       break;
+    case LookAndFeel::eFont_Widget:
+    case LookAndFeel::eFont_Dialog:
+    case LookAndFeel::eFont_Button:
+      // XXX It's not clear to me whether this is exactly the right
+      // set of LookAndFeel values to map to the dialog font; we may
+      // want to add or remove cases here after reviewing the visual
+      // results under various Windows versions.
+      useShellDlg = true;
+      // Fall through so that we can get size from lfMessageFont;
+      // but later we'll use the (virtual) "MS Shell Dlg 2" font name
+      // instead of the LOGFONT's.
     default:
-      MOZ_CRASH();
+      ptrLogFont = &ncm.lfMessageFont;
+      break;
     }
     break;
-
-  case LookAndFeel::eFont_Widget:
-  case LookAndFeel::eFont_Window:      // css3
-  case LookAndFeel::eFont_Document:
-  case LookAndFeel::eFont_Workspace:
-  case LookAndFeel::eFont_Desktop:
-  case LookAndFeel::eFont_Info:
-  case LookAndFeel::eFont_Dialog:
-  case LookAndFeel::eFont_Button:
-  case LookAndFeel::eFont_PullDownMenu:
-  case LookAndFeel::eFont_List:
-  case LookAndFeel::eFont_Field:
-  case LookAndFeel::eFont_Caption:
-    hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
-    if (!hGDI)
-      return false;
-
-    if (::GetObjectW(hGDI, sizeof(logFont), &logFont) <= 0)
-      return false;
-
-    ptrLogFont = &logFont;
-    break;
   }
 
   // Get scaling factor from physical to logical pixels
   float pixelScale = 1.0f / gfxWindowsPlatform::GetPlatform()->GetDPIScale();
 
   // The lfHeight is in pixels, and it needs to be adjusted for the
   // device it will be displayed on.
   // Screens and Printers will differ in DPI
@@ -646,19 +633,22 @@ GetSysFontInfo(HDC aHDC, LookAndFeel::Fo
     (ptrLogFont->lfWeight == FW_BOLD ?
         NS_FONT_WEIGHT_BOLD : NS_FONT_WEIGHT_NORMAL);
 
   // FIXME: Set aFontStyle->stretch correctly!
   aFontStyle.stretch = NS_FONT_STRETCH_NORMAL;
 
   aFontStyle.systemFont = true;
 
-  name[0] = 0;
-  memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(char16_t));
-  aFontName = name;
+  if (useShellDlg) {
+    aFontName = NS_LITERAL_STRING("MS Shell Dlg 2");
+  } else {
+    memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(char16_t));
+    aFontName = name;
+  }
 
   return true;
 }
 
 bool
 nsLookAndFeel::GetFontImpl(FontID anID, nsString &aFontName,
                            gfxFontStyle &aFontStyle,
                            float aDevPixPerCSSPixel)