diff -ur 41.0/mozilla-release/browser/app/blocklist.xml 41.0.2/mozilla-release/browser/app/blocklist.xml
--- 41.0/mozilla-release/browser/app/blocklist.xml	2015-09-18 06:13:23.000000000 +0800
+++ 41.0.2/mozilla-release/browser/app/blocklist.xml	2015-10-15 05:41:35.000000000 +0800
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1441833117000">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1444248774000">
   <emItems>
       <emItem  blockID="i58" id="webmaster@buzzzzvideos.info">
                         <versionRange  minVersion="0" maxVersion="*">
@@ -218,6 +218,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1040" id="frhegnejkgner@grhjgewfewf.com">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i98" id="youtubeeing@youtuberie.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
@@ -319,6 +325,17 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i916" os="WINNT" id="{97E22097-9A2F-45b1-8DAF-36AD648C7EF4}">
+                        <versionRange  minVersion="0" maxVersion="15.0.5" severity="1">
+                    </versionRange>
+                                <versionRange  minVersion="0" maxVersion="*" severity="3">
+                      <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+                              <versionRange  minVersion="39.0a1" maxVersion="*" />
+                          </targetApplication>
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i620" id="{21EAF666-26B3-4A3C-ABD0-CA2F5A326744}">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -331,7 +348,7 @@
                     <prefs>
               </prefs>
     </emItem>
-      <emItem  blockID="i856" id="/^({94d62e35-4b43-494c-bf52-ba5935df36ef}|firefox@advanceelite\.com|{bb7b7a60-f574-47c2-8a0b-4c56f2da9802})$/">
+      <emItem  blockID="i376" id="{9e09ac65-43c0-4b9d-970f-11e2e9616c55}">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
                     <prefs>
@@ -419,6 +436,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1038" id="344141-fasf9jas08hasoiesj9ia8ws@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i344" id="lrcsTube@hansanddeta.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
@@ -507,13 +530,8 @@
                     <prefs>
               </prefs>
     </emItem>
-      <emItem  blockID="i916" os="WINNT" id="{97E22097-9A2F-45b1-8DAF-36AD648C7EF4}">
-                        <versionRange  minVersion="0" maxVersion="15.0.5" severity="1">
-                    </versionRange>
-                                <versionRange  minVersion="0" maxVersion="*" severity="3">
-                      <targetApplication  id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
-                              <versionRange  minVersion="39.0a1" maxVersion="*" />
-                          </targetApplication>
+      <emItem  blockID="i1036" id="HxLVJK1ioigz9WEWo8QgCs3evE7uW6LEExAniBGG@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
                     <prefs>
               </prefs>
@@ -536,6 +554,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1034" id="a88a77ahjjfjakckmmabsy278djasi@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i431" id="chinaescapeone@facebook.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -939,7 +963,7 @@
                     <prefs>
               </prefs>
     </emItem>
-      <emItem  blockID="i376" id="{9e09ac65-43c0-4b9d-970f-11e2e9616c55}">
+      <emItem  blockID="i856" id="/^({94d62e35-4b43-494c-bf52-ba5935df36ef}|firefox@advanceelite\.com|{bb7b7a60-f574-47c2-8a0b-4c56f2da9802})$/">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
                     <prefs>
@@ -1047,6 +1071,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i694" id="59D317DB041748fdB89B47E6F96058F3@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="1">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i804" id="{ad7ce998-a77b-4062-9ffb-1d0b7cb23183}">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -1283,6 +1313,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1030" id="support@todoist.com">
+                        <versionRange  minVersion="0" maxVersion="3.9" severity="1">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i65" id="activity@facebook.com">
                         <versionRange  minVersion="0" maxVersion="*">
                     </versionRange>
@@ -1560,6 +1596,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1012" id="wxtui502n2xce9j@no14">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i692" id="/^(j003-lqgrmgpcekslhg|SupraSavings|j003-dkqonnnthqjnkq|j003-kaggrpmirxjpzh)@jetpack$/">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
@@ -1805,6 +1847,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1022" id="g99hiaoekjoasiijdkoleabsy278djasi@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i746" id="{58d2a791-6199-482f-a9aa-9b725ec61362}">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
@@ -1855,6 +1903,12 @@
                   <pref>browser.search.defaultenginename</pref>
               </prefs>
     </emItem>
+      <emItem  blockID="i1018" id="grjkntbhr@hgergerherg.com">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i780" id="{b6ef1336-69bb-45b6-8cba-e578fc0e4433}">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -1979,6 +2033,12 @@
                   <pref>browser.search.defaultenginename</pref>
               </prefs>
     </emItem>
+      <emItem  blockID="i1042" id="gjhrjenrengoe@jfdnkwelfwkm.com">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i174" id="info@thebflix.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -2074,6 +2134,16 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1024" id="{458fb825-2370-4973-bf66-9d7142141847}">
+                        <versionRange  minVersion="0" maxVersion="*" severity="1">
+                    </versionRange>
+                    <prefs>
+                  <pref>app.update.auto</pref>
+                  <pref>app.update.enabled</pref>
+                  <pref>app.update.interval</pref>
+                  <pref>app.update.url</pref>
+              </prefs>
+    </emItem>
       <emItem  blockID="i476" id="mbroctone@facebook.com">
                         <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
@@ -2338,8 +2408,8 @@
                   <pref>browser.startup.homepage</pref>
               </prefs>
     </emItem>
-      <emItem  blockID="i694" id="59D317DB041748fdB89B47E6F96058F3@jetpack">
-                        <versionRange  minVersion="0" maxVersion="*" severity="1">
+      <emItem  blockID="i1032" id="KSqOiTeSJEDZtTGuvc18PdPmYodROmYzfpoyiCr2@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
                     </versionRange>
                     <prefs>
               </prefs>
@@ -2511,6 +2581,12 @@
                     <prefs>
               </prefs>
     </emItem>
+      <emItem  blockID="i1016" id="jid1-uabu5A9hduqzCw@jetpack">
+                        <versionRange  minVersion="0" maxVersion="*" severity="3">
+                    </versionRange>
+                    <prefs>
+              </prefs>
+    </emItem>
       <emItem  blockID="i226" id="{462be121-2b54-4218-bf00-b9bf8135b23f}">
                         <versionRange  minVersion="0" maxVersion="*" severity="1">
                     </versionRange>
@@ -3183,6 +3259,18 @@
       <pluginItem  blockID="p1004">
             <match name="description" exp="^($|Unity Web Player version 5.0(\.([0-2]|3f1))?[^0-9.])" />      <match name="filename" exp="Unity Web Player\.plugin" />                      <versionRange  severity="0" vulnerabilitystatus="1"></versionRange>
                         </pluginItem>
+      <pluginItem  blockID="p1020">
+                  <match name="filename" exp="(NPSWF32.*\.dll)|(NPSWF64.*\.dll)|(Flash\ Player\.plugin)" />                      <versionRange  minVersion="13.0" maxVersion="13.*" severity="0" vulnerabilitystatus="1"></versionRange>
+                            <infoURL>https://get.adobe.com/flashplayer/</infoURL>
+          </pluginItem>
+      <pluginItem  blockID="p1026">
+                  <match name="filename" exp="(NPSWF32.*\.dll)|(NPSWF64.*\.dll)|(Flash\ Player\.plugin)" />                      <versionRange  minVersion="18.0.0.204" maxVersion="18.0.0.232" severity="0" vulnerabilitystatus="1"></versionRange>
+                            <infoURL>https://get.adobe.com/flashplayer/</infoURL>
+          </pluginItem>
+      <pluginItem  os="Linux" blockID="p1028">
+                  <match name="filename" exp="libflashplayer\.so" />                      <versionRange  minVersion="11.2.202.482" maxVersion="11.2.202.508" severity="0" vulnerabilitystatus="1"></versionRange>
+                            <infoURL>https://get.adobe.com/flashplayer/</infoURL>
+          </pluginItem>
     </pluginItems>
 
   <gfxItems>
@@ -3298,6 +3386,9 @@
         <certItem issuerName="MDcxJDAiBgNVBAMTG1JDUyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEPMA0GA1UEChMGSFQgc3Js">
       <serialNumber>AN9bfYOvlR1t</serialNumber>
     </certItem>
+        <certItem issuerName="MEQxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwx0aGF3dGUsIEluYy4xHjAcBgNVBAMTFXRoYXd0ZSBFViBTU0wgQ0EgLSBHMw==">
+      <serialNumber>CrTHPEE6AZSfI3jysin2bA==</serialNumber>
+    </certItem>
       </certItems>
 
 
diff -ur 41.0/mozilla-release/browser/components/places/content/bookmarkProperties.js 41.0.2/mozilla-release/browser/components/places/content/bookmarkProperties.js
--- 41.0/mozilla-release/browser/components/places/content/bookmarkProperties.js	2015-09-18 06:13:24.000000000 +0800
+++ 41.0.2/mozilla-release/browser/components/places/content/bookmarkProperties.js	2015-10-15 05:41:36.000000000 +0800
@@ -607,7 +607,7 @@
     let folderGuid = yield PlacesUtils.promiseItemGuid(container);
     let bm = yield PlacesUtils.bookmarks.fetch({
       parentGuid: folderGuid,
-      index: PlacesUtils.bookmarks.DEFAULT_INDEX
+      index: index
     });
     this._itemId = yield PlacesUtils.promiseItemId(bm.guid);
 
diff -ur 41.0/mozilla-release/browser/config/version_display.txt 41.0.2/mozilla-release/browser/config/version_display.txt
--- 41.0/mozilla-release/browser/config/version_display.txt	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/browser/config/version_display.txt	2015-10-15 05:41:37.000000000 +0800
@@ -1 +1 @@
-41.0
+41.0.2
diff -ur 41.0/mozilla-release/browser/config/version.txt 41.0.2/mozilla-release/browser/config/version.txt
--- 41.0/mozilla-release/browser/config/version.txt	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/browser/config/version.txt	2015-10-15 05:41:37.000000000 +0800
@@ -1 +1 @@
-41.0
+41.0.2
diff -ur 41.0/mozilla-release/caps/nsNullPrincipal.cpp 41.0.2/mozilla-release/caps/nsNullPrincipal.cpp
--- 41.0/mozilla-release/caps/nsNullPrincipal.cpp	2015-09-18 06:13:29.000000000 +0800
+++ 41.0.2/mozilla-release/caps/nsNullPrincipal.cpp	2015-10-15 05:41:41.000000000 +0800
@@ -173,6 +173,9 @@
 NS_IMETHODIMP
 nsNullPrincipal::Write(nsIObjectOutputStream* aStream)
 {
+  NS_ENSURE_TRUE(mOriginAttributes.mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
+                 NS_ERROR_INVALID_ARG);
+
   nsAutoCString suffix;
   OriginAttributesRef().CreateSuffix(suffix);
 
diff -ur 41.0/mozilla-release/caps/nsPrincipal.cpp 41.0.2/mozilla-release/caps/nsPrincipal.cpp
--- 41.0/mozilla-release/caps/nsPrincipal.cpp	2015-09-18 06:13:29.000000000 +0800
+++ 41.0.2/mozilla-release/caps/nsPrincipal.cpp	2015-10-15 05:41:41.000000000 +0800
@@ -395,6 +395,8 @@
 nsPrincipal::Write(nsIObjectOutputStream* aStream)
 {
   NS_ENSURE_STATE(mCodebase);
+  NS_ENSURE_TRUE(mOriginAttributes.mAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
+                 NS_ERROR_INVALID_ARG);
 
   nsresult rv = NS_WriteOptionalCompoundObject(aStream, mCodebase, NS_GET_IID(nsIURI),
                                                true);
diff -ur 41.0/mozilla-release/caps/tests/unit/test_origin.js 41.0.2/mozilla-release/caps/tests/unit/test_origin.js
--- 41.0/mozilla-release/caps/tests/unit/test_origin.js	2015-09-18 06:13:29.000000000 +0800
+++ 41.0.2/mozilla-release/caps/tests/unit/test_origin.js	2015-10-15 05:41:41.000000000 +0800
@@ -94,6 +94,19 @@
   var simplePrin = ssm.getSimpleCodebasePrincipal(makeURI('http://example.com'));
   try { simplePrin.origin; do_check_true(false); } catch (e) { do_check_true(true); }
 
+  // Make sure we don't crash when serializing them either.
+  try {
+    let binaryStream = Cc["@mozilla.org/binaryoutputstream;1"].
+                       createInstance(Ci.nsIObjectOutputStream);
+    let pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
+    pipe.init(false, false, 0, 0xffffffff, null);
+    binaryStream.setOutputStream(pipe.outputStream);
+    binaryStream.writeCompoundObject(simplePrin, Ci.nsISupports, true);
+    binaryStream.close();
+  } catch (e) {
+    do_check_true(true);
+  }
+
   // Check that all of the above are cross-origin.
   checkCrossOrigin(exampleOrg_app, exampleOrg);
   checkCrossOrigin(exampleOrg_app, nullPrin_app);
diff -ur 41.0/mozilla-release/config/milestone.txt 41.0.2/mozilla-release/config/milestone.txt
--- 41.0/mozilla-release/config/milestone.txt	2015-09-18 06:13:29.000000000 +0800
+++ 41.0.2/mozilla-release/config/milestone.txt	2015-10-15 05:41:41.000000000 +0800
@@ -10,4 +10,4 @@
 # hardcoded milestones in the tree from these two files.
 #--------------------------------------------------------
 
-41.0
+41.0.2
diff -ur 41.0/mozilla-release/dom/fetch/FetchDriver.cpp 41.0.2/mozilla-release/dom/fetch/FetchDriver.cpp
--- 41.0/mozilla-release/dom/fetch/FetchDriver.cpp	2015-09-18 06:13:32.000000000 +0800
+++ 41.0.2/mozilla-release/dom/fetch/FetchDriver.cpp	2015-10-15 05:41:44.000000000 +0800
@@ -28,6 +28,7 @@
 
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/workers/Workers.h"
+#include "mozilla/unused.h"
 
 #include "Fetch.h"
 #include "InternalRequest.h"
@@ -46,6 +47,7 @@
   , mLoadGroup(aLoadGroup)
   , mRequest(aRequest)
   , mFetchRecursionCount(0)
+  , mCORSFlagEverSet(false)
   , mResponseAvailableCalled(false)
 {
 }
@@ -91,8 +93,8 @@
   MOZ_CRASH("Synchronous fetch not supported");
 }
 
-nsresult
-FetchDriver::ContinueFetch(bool aCORSFlag)
+FetchDriver::MainFetchOp
+FetchDriver::SetTaintingAndGetNextOp(bool aCORSFlag)
 {
   workers::AssertIsOnMainThread();
 
@@ -102,7 +104,7 @@
   nsresult rv = NS_NewURI(getter_AddRefs(requestURI), url,
                           nullptr, nullptr);
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    return FailWithNetworkError();
+    return MainFetchOp(NETWORK_ERROR);
   }
 
   // CSP/mixed content checks.
@@ -120,46 +122,92 @@
                                  nsContentUtils::GetSecurityManager());
   if (NS_WARN_IF(NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad))) {
     // Disallowed by content policy.
-    return FailWithNetworkError();
+    return MainFetchOp(NETWORK_ERROR);
   }
 
-  // Begin Step 4 of the Fetch algorithm
+  // Begin Step 8 of the Main Fetch algorithm
   // https://fetch.spec.whatwg.org/#fetching
 
   nsAutoCString scheme;
   rv = requestURI->GetScheme(scheme);
   if (NS_WARN_IF(NS_FAILED(rv))) {
-    return FailWithNetworkError();
+    return MainFetchOp(NETWORK_ERROR);
   }
 
-  rv = mPrincipal->CheckMayLoad(requestURI, false /* report */, false /* allowIfInheritsPrincipal */);
+  // request's current url's origin is request's origin and the CORS flag is unset
+  // request's current url's scheme is "data" and request's same-origin data-URL flag is set
+  // request's current url's scheme is "about"
+  rv = mPrincipal->CheckMayLoad(requestURI, false /* report */,
+                                false /* allowIfInheritsPrincipal */);
   if ((!aCORSFlag && NS_SUCCEEDED(rv)) ||
       (scheme.EqualsLiteral("data") && mRequest->SameOriginDataURL()) ||
       scheme.EqualsLiteral("about")) {
-    return BasicFetch();
+    return MainFetchOp(BASIC_FETCH);
   }
 
+  // request's mode is "same-origin"
   if (mRequest->Mode() == RequestMode::Same_origin) {
-    return FailWithNetworkError();
+    return MainFetchOp(NETWORK_ERROR);
   }
 
+  // request's mode is "no-cors"
   if (mRequest->Mode() == RequestMode::No_cors) {
     mRequest->SetResponseTainting(InternalRequest::RESPONSETAINT_OPAQUE);
-    return BasicFetch();
+    return MainFetchOp(BASIC_FETCH);
   }
 
+  // request's current url's scheme is not one of "http" and "https"
   if (!scheme.EqualsLiteral("http") && !scheme.EqualsLiteral("https")) {
-    return FailWithNetworkError();
+    return MainFetchOp(NETWORK_ERROR);
   }
 
-  bool corsPreflight = false;
+  // request's mode is "cors-with-forced-preflight"
+  // request's unsafe-request flag is set and either request's method is not
+  // a simple method or a header in request's header list is not a simple header
   if (mRequest->Mode() == RequestMode::Cors_with_forced_preflight ||
-      (mRequest->UnsafeRequest() && (!mRequest->HasSimpleMethod() || !mRequest->Headers()->HasOnlySimpleHeaders()))) {
-    corsPreflight = true;
+      (mRequest->UnsafeRequest() && (!mRequest->HasSimpleMethod() ||
+                                     !mRequest->Headers()->HasOnlySimpleHeaders()))) {
+    mRequest->SetResponseTainting(InternalRequest::RESPONSETAINT_CORS);
+
+    // We block cross-origin redirects that require preflight in
+    // AsyncOnChannelRedirect() instead of using "error" redirect mode.
+
+    // Note, the following text from Main Fetch step 8 is handled in
+    // nsCORSListenerProxy when CheckRequestApproved() fails:
+    //
+    //  The result of performing an HTTP fetch using request with the CORS
+    //  flag and CORS-preflight flag set. If the result is a network error,
+    //  clear cache entries using request.
+
+    return MainFetchOp(HTTP_FETCH, true /* cors */, true /* preflight */);
   }
 
+  // Otherwise
   mRequest->SetResponseTainting(InternalRequest::RESPONSETAINT_CORS);
-  return HttpFetch(true /* aCORSFlag */, corsPreflight);
+  return MainFetchOp(HTTP_FETCH, true /* cors */, false /* preflight */);
+}
+
+nsresult
+FetchDriver::ContinueFetch(bool aCORSFlag)
+{
+  workers::AssertIsOnMainThread();
+
+  MainFetchOp nextOp = SetTaintingAndGetNextOp(aCORSFlag);
+
+  if (nextOp.mType == NETWORK_ERROR) {
+    return FailWithNetworkError();
+  }
+
+  if (nextOp.mType == BASIC_FETCH) {
+    return BasicFetch();
+  }
+
+  if (nextOp.mType == HTTP_FETCH) {
+    return HttpFetch(nextOp.mCORSFlag, nextOp.mCORSPreflightFlag);
+  }
+
+  MOZ_ASSERT_UNREACHABLE("Unexpected main fetch operation!");
+  return FailWithNetworkError();
 }
 
 nsresult
@@ -311,6 +359,11 @@
   mResponse = nullptr;
   nsresult rv;
 
+  // We need to track the CORS flag through redirects.  Since there is no way
+  // for us to go from CORS mode to non-CORS mode, we just need to remember
+  // if it has ever been set.
+  mCORSFlagEverSet = mCORSFlagEverSet || aCORSFlag;
+
   nsCOMPtr<nsIIOService> ios = do_GetIOService(&rv);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     FailWithNetworkError();
@@ -467,6 +520,12 @@
     // Auth may require prompting, we don't support it yet.
     // The next patch in this same bug prevents this from aborting the request.
     // Credentials checks for CORS are handled by nsCORSListenerProxy,
+
+    nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
+
+    // Conversion between enumerations is safe due to static asserts in
+    // dom/workers/ServiceWorkerManager.cpp
+    internalChan->SetCorsMode(static_cast<uint32_t>(mRequest->Mode()));
   }
 
   // Step 5. Proxy authentication will be handled by Necko.
@@ -514,10 +573,10 @@
 
   nsCOMPtr<nsIStreamListener> listener = this;
 
-  // Unless the cors mode is explicitly no-cors, we set up a cors proxy even in
-  // the same-origin case, since the proxy does not enforce cors header checks
-  // in the same-origin case.
-  if (mRequest->Mode() != RequestMode::No_cors) {
+  // Only use nsCORSListenerProxy if we are in CORS mode.  Otherwise it
+  // will overwrite the CorsMode flag unconditionally to "cors" or
+  // "cors-with-forced-preflight".
+  if (mRequest->Mode() == RequestMode::Cors) {
     // Set up a CORS proxy that will handle the various requirements of the CORS
     // protocol. It handles the preflight cache and CORS response headers.
     // If the request is allowed, it will start our original request
@@ -673,8 +732,11 @@
                             nsISupports* aContext)
 {
   workers::AssertIsOnMainThread();
-  MOZ_ASSERT(!mPipeOutputStream);
-  MOZ_ASSERT(mObserver);
+
+  // Note, this can be called multiple times if we are doing an opaqueredirect.
+  // In that case we will get a simulated OnStartRequest() and then the real
+  // channel will call in with an errored OnStartRequest().
+
   nsresult rv;
   aRequest->GetStatus(&rv);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -682,6 +744,10 @@
     return rv;
   }
 
+  // We should only get to the following code once.
+  MOZ_ASSERT(!mPipeOutputStream);
+  MOZ_ASSERT(mObserver);
+
   nsRefPtr<InternalResponse> response;
   nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
   if (httpChannel) {
@@ -813,12 +879,17 @@
 
   nsresult rv;
 
-  // Section 4.2, Step 4.6-4.7, enforcing a redirect count is done by Necko.
-  // The pref used is "network.http.redirection-limit" which is set to 20 by
-  // default.
-  //
-  // Step 4.8. We only unset this for spec compatibility. Any actions we take
-  // on mRequest here do not affect what the channel does.
+  // HTTP Fetch step 5, "redirect status", steps 2 through 6 are automatically
+  // handled by necko before calling AsyncOnChannelRedirect() with the new
+  // nsIChannel.
+
+  // HTTP Fetch step 5, "redirect status", steps 7 and 8 enforcing a redirect
+  // count are done by Necko.  The pref used is "network.http.redirection-limit"
+  // which is set to 20 by default.
+
+  // HTTP Fetch Step 9, "redirect status". We only unset this for spec
+  // compatibility. Any actions we take on mRequest here do not affect what the
+  //channel does.
   mRequest->UnsetSameOriginDataURL();
 
   //
@@ -840,6 +911,10 @@
     }
   }
 
+  // HTTP Fetch step 5, "redirect status", steps 11.1 and 11.2 block redirecting
+  // to a URL with credentials in CORS mode.  This is implemented in
+  // nsCORSListenerProxy.
+
   mRedirectCallback = aCallback;
   mOldRedirectChannel = aOldChannel;
   mNewRedirectChannel = aNewChannel;
@@ -926,12 +1001,12 @@
 NS_IMETHODIMP
 FetchDriver::OnRedirectVerifyCallback(nsresult aResult)
 {
-  // On a successful redirect we perform the following substeps of Section 4.2,
-  // step 4.10.
+  // On a successful redirect we perform the following substeps of HTTP Fetch,
+  // step 5, "redirect status", step 11.
   if (NS_SUCCEEDED(aResult)) {
-    // Step 4.10.3 "Set request's url to locationURL." so that when we set the
-    // Response's URL from the Request's URL in Section 4, step 6, we get the
-    // final value.
+    // Step 11.5 "Append locationURL to request's url list." so that when we set the
+    // Response's URL from the Request's URL in Main Fetch, step 15, we get the
+    // final value. Note, we still use a single URL value instead of a list.
     nsCOMPtr<nsIURI> newURI;
     nsresult rv = NS_GetFinalChannelURI(mNewRedirectChannel, getter_AddRefs(newURI));
     if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -948,6 +1023,22 @@
     mOldRedirectChannel->Cancel(aResult);
   }
 
+  // Implement Main Fetch step 8 again on redirect.
+  MainFetchOp nextOp = SetTaintingAndGetNextOp(mCORSFlagEverSet);
+
+  if (nextOp.mType == NETWORK_ERROR) {
+    // Cancel the channel if Main Fetch blocks the redirect from continuing.
+    aResult = NS_ERROR_DOM_BAD_URI;
+    mOldRedirectChannel->Cancel(aResult);
+  } else {
+    // Otherwise, we rely on necko and the CORS proxy to do the right thing
+    // as the redirect is followed.  In general this means basic or http
+    // fetch.  If we've ever been CORS, we need to stay CORS.
+    MOZ_ASSERT(nextOp.mType == BASIC_FETCH || nextOp.mType == HTTP_FETCH);
+    MOZ_ASSERT_IF(mCORSFlagEverSet, nextOp.mType == HTTP_FETCH);
+    MOZ_ASSERT_IF(mCORSFlagEverSet, nextOp.mCORSFlag);
+  }
+
   mOldRedirectChannel = nullptr;
   mNewRedirectChannel = nullptr;
   mRedirectCallback->OnRedirectVerifyCallback(aResult);
diff -ur 41.0/mozilla-release/dom/fetch/FetchDriver.h 41.0.2/mozilla-release/dom/fetch/FetchDriver.h
--- 41.0/mozilla-release/dom/fetch/FetchDriver.h	2015-09-18 06:13:32.000000000 +0800
+++ 41.0.2/mozilla-release/dom/fetch/FetchDriver.h	2015-10-15 05:41:44.000000000 +0800
@@ -74,6 +74,7 @@
   nsCOMPtr<nsIChannel> mNewRedirectChannel;
   nsCOMPtr<nsIDocument> mDocument;
   uint32_t mFetchRecursionCount;
+  bool mCORSFlagEverSet;
 
   DebugOnly<bool> mResponseAvailableCalled;
 
@@ -82,7 +83,29 @@
   FetchDriver& operator=(const FetchDriver&) = delete;
   ~FetchDriver();
 
+  enum MainFetchOpType
+  {
+    NETWORK_ERROR,
+    BASIC_FETCH,
+    HTTP_FETCH,
+    NUM_MAIN_FETCH_OPS
+  };
+
+  struct MainFetchOp
+  {
+    explicit MainFetchOp(MainFetchOpType aType, bool aCORSFlag = false,
+                         bool aCORSPreflightFlag = false)
+      : mType(aType), mCORSFlag(aCORSFlag),
+        mCORSPreflightFlag(aCORSPreflightFlag)
+    { }
+
+    MainFetchOpType mType;
+    bool mCORSFlag;
+    bool mCORSPreflightFlag;
+  };
+
   nsresult Fetch(bool aCORSFlag);
+  MainFetchOp SetTaintingAndGetNextOp(bool aCORSFlag);
   nsresult ContinueFetch(bool aCORSFlag);
   nsresult BasicFetch();
   nsresult HttpFetch(bool aCORSFlag = false, bool aCORSPreflightFlag = false, bool aAuthenticationFlag = false);
diff -ur 41.0/mozilla-release/dom/fetch/InternalResponse.cpp 41.0.2/mozilla-release/dom/fetch/InternalResponse.cpp
--- 41.0/mozilla-release/dom/fetch/InternalResponse.cpp	2015-09-18 06:13:32.000000000 +0800
+++ 41.0.2/mozilla-release/dom/fetch/InternalResponse.cpp	2015-10-15 05:41:44.000000000 +0800
@@ -92,7 +92,6 @@
   nsRefPtr<InternalResponse> response = new InternalResponse(0, EmptyCString());
   response->mType = ResponseType::Opaque;
   response->mTerminationReason = mTerminationReason;
-  response->mURL = mURL;
   response->mChannelInfo = mChannelInfo;
   if (mPrincipalInfo) {
     response->mPrincipalInfo = MakeUnique<mozilla::ipc::PrincipalInfo>(*mPrincipalInfo);
diff -ur 41.0/mozilla-release/dom/workers/test/serviceworkers/mochitest.ini 41.0.2/mozilla-release/dom/workers/test/serviceworkers/mochitest.ini
--- 41.0/mozilla-release/dom/workers/test/serviceworkers/mochitest.ini	2015-09-18 06:13:28.000000000 +0800
+++ 41.0.2/mozilla-release/dom/workers/test/serviceworkers/mochitest.ini	2015-10-15 05:41:52.000000000 +0800
@@ -150,6 +150,7 @@
 [test_close.html]
 [test_controller.html]
 [test_cross_origin_url_after_redirect.html]
+skip-if = true
 [test_empty_serviceworker.html]
 [test_eval_allowed.html]
 [test_eval_not_allowed.html]
@@ -159,7 +160,9 @@
 [test_https_fetch.html]
 [test_https_fetch_cloned_response.html]
 [test_https_origin_after_redirect.html]
+skip-if = true
 [test_https_origin_after_redirect_cached.html]
+skip-if = true
 [test_https_synth_fetch_from_cached_sw.html]
 [test_importscript.html]
 [test_install_event.html]
@@ -171,9 +174,13 @@
 [test_match_all_client_properties.html]
 [test_navigator.html]
 [test_origin_after_redirect.html]
+skip-if = true
 [test_origin_after_redirect_cached.html]
+skip-if = true
 [test_origin_after_redirect_to_https.html]
+skip-if = true
 [test_origin_after_redirect_to_https_cached.html]
+skip-if = true
 [test_periodic_https_update.html]
 [test_periodic_update.html]
 [test_post_message.html]
diff -ur 41.0/mozilla-release/gfx/gl/GLBlitHelper.cpp 41.0.2/mozilla-release/gfx/gl/GLBlitHelper.cpp
--- 41.0/mozilla-release/gfx/gl/GLBlitHelper.cpp	2015-09-18 06:13:31.000000000 +0800
+++ 41.0.2/mozilla-release/gfx/gl/GLBlitHelper.cpp	2015-10-15 05:41:53.000000000 +0800
@@ -899,10 +899,8 @@
                                  OriginPos destOrigin)
 {
     ScopedFramebufferForTexture autoFBForTex(mGL, destTex, destTarget);
-
-    if (!autoFBForTex.IsComplete()) {
-        MOZ_CRASH("ScopedFramebufferForTexture failed.");
-    }
+    if (!autoFBForTex.IsComplete())
+        return false;
 
     return BlitImageToFramebuffer(srcImage, destSize, autoFBForTex.FB(), destOrigin);
 }
diff -ur 41.0/mozilla-release/ipc/glue/MessageChannel.cpp 41.0.2/mozilla-release/ipc/glue/MessageChannel.cpp
--- 41.0/mozilla-release/ipc/glue/MessageChannel.cpp	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/ipc/glue/MessageChannel.cpp	2015-10-15 05:41:38.000000000 +0800
@@ -853,6 +853,7 @@
 
 #ifdef OS_WIN
     SyncStackFrame frame(this, false);
+    NeuteredWindowRegion neuteredRgn(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION);
 #endif
 
     CxxStackFrame f(*this, OUT_MESSAGE, msg);
@@ -1032,6 +1033,19 @@
             return false;
         }
 
+#ifdef OS_WIN
+        // We need to limit the scoped of neuteredRgn to this spot in the code.
+        // Window neutering can't be enabled during some plugin calls because
+        // we then risk the neutered window procedure being subclassed by a
+        // plugin.
+        {
+            NeuteredWindowRegion neuteredRgn(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION);
+            /* We should pump messages at this point to ensure that the IPC peer
+               does not become deadlocked on a pending inter-thread SendMessage() */
+            neuteredRgn.PumpOnce();
+        }
+#endif
+
         // Now might be the time to process a message deferred because of race
         // resolution.
         MaybeUndeferIncall();
@@ -1148,6 +1162,7 @@
 {
 #ifdef OS_WIN
     SyncStackFrame frame(this, true);
+    NeuteredWindowRegion neuteredRgn(mFlags & REQUIRE_DEFERRED_MESSAGE_PROTECTION);
 #endif
 
     { // Scope for lock
diff -ur 41.0/mozilla-release/ipc/glue/MessageChannel.h 41.0.2/mozilla-release/ipc/glue/MessageChannel.h
--- 41.0/mozilla-release/ipc/glue/MessageChannel.h	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/ipc/glue/MessageChannel.h	2015-10-15 05:41:38.000000000 +0800
@@ -15,6 +15,9 @@
 #include "mozilla/Monitor.h"
 #include "mozilla/Vector.h"
 #include "mozilla/WeakPtr.h"
+#if defined(OS_WIN)
+#include "mozilla/ipc/Neutering.h"
+#endif // defined(OS_WIN)
 #include "mozilla/ipc/Transport.h"
 #include "MessageLink.h"
 #include "nsAutoPtr.h"
diff -ur 41.0/mozilla-release/ipc/glue/moz.build 41.0.2/mozilla-release/ipc/glue/moz.build
--- 41.0/mozilla-release/ipc/glue/moz.build	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/ipc/glue/moz.build	2015-10-15 05:41:38.000000000 +0800
@@ -25,6 +25,7 @@
     'IOThreadChild.h',
     'MessageChannel.h',
     'MessageLink.h',
+    'Neutering.h',
     'ProcessChild.h',
     'ProtocolUtils.h',
     'ScopedXREEmbed.h',
Only in 41.0.2/mozilla-release/ipc/glue: Neutering.h
diff -ur 41.0/mozilla-release/ipc/glue/WindowsMessageLoop.cpp 41.0.2/mozilla-release/ipc/glue/WindowsMessageLoop.cpp
--- 41.0/mozilla-release/ipc/glue/WindowsMessageLoop.cpp	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/ipc/glue/WindowsMessageLoop.cpp	2015-10-15 05:41:38.000000000 +0800
@@ -8,6 +8,7 @@
 #include "mozilla/DebugOnly.h"
 
 #include "WindowsMessageLoop.h"
+#include "Neutering.h"
 #include "MessageChannel.h"
 
 #include "nsAutoPtr.h"
@@ -862,6 +863,86 @@
     (aTimeout <= (PR_IntervalNow() - aStart));
 }
 
+static HHOOK gWindowHook;
+
+static inline void
+StartNeutering()
+{
+  MOZ_ASSERT(gUIThreadId);
+  MOZ_ASSERT(!gWindowHook);
+  NS_ASSERTION(!MessageChannel::IsPumpingMessages(),
+               "Shouldn't be pumping already!");
+  MessageChannel::SetIsPumpingMessages(true);
+  gWindowHook = ::SetWindowsHookEx(WH_CALLWNDPROC, CallWindowProcedureHook,
+                                   nullptr, gUIThreadId);
+  NS_ASSERTION(gWindowHook, "Failed to set hook!");
+}
+
+static void
+StopNeutering()
+{
+  MOZ_ASSERT(MessageChannel::IsPumpingMessages());
+  ::UnhookWindowsHookEx(gWindowHook);
+  gWindowHook = NULL;
+  ::UnhookNeuteredWindows();
+  // Before returning we need to set a hook to run any deferred messages that
+  // we received during the IPC call. The hook will unset itself as soon as
+  // someone else calls GetMessage, PeekMessage, or runs code that generates
+  // a "nonqueued" message.
+  ::ScheduleDeferredMessageRun();
+  MessageChannel::SetIsPumpingMessages(false);
+}
+
+NeuteredWindowRegion::NeuteredWindowRegion(bool aDoNeuter MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
+  : mNeuteredByThis(!gWindowHook && aDoNeuter)
+{
+  MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+  if (mNeuteredByThis) {
+    StartNeutering();
+  }
+}
+
+NeuteredWindowRegion::~NeuteredWindowRegion()
+{
+  if (gWindowHook && mNeuteredByThis) {
+    StopNeutering();
+  }
+}
+
+void
+NeuteredWindowRegion::PumpOnce()
+{
+  if (!gWindowHook) {
+    // This should be a no-op if nothing has been neutered.
+    return;
+  }
+
+  MSG msg = {0};
+  // Pump any COM messages so that we don't hang due to STA marshaling.
+  if (gCOMWindow && ::PeekMessageW(&msg, gCOMWindow, 0, 0, PM_REMOVE)) {
+      ::TranslateMessage(&msg);
+      ::DispatchMessageW(&msg);
+  }
+  // Expunge any nonqueued messages on the current thread.
+  ::PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE);
+}
+
+DeneuteredWindowRegion::DeneuteredWindowRegion(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
+  : mReneuter(gWindowHook != NULL)
+{
+  MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+  if (mReneuter) {
+    StopNeutering();
+  }
+}
+
+DeneuteredWindowRegion::~DeneuteredWindowRegion()
+{
+  if (mReneuter) {
+    StartNeutering();
+  }
+}
+
 bool
 MessageChannel::WaitForSyncNotify()
 {
@@ -916,15 +997,6 @@
     NS_ASSERTION(timerId, "SetTimer failed!");
   }
 
-  // Setup deferred processing of native events while we wait for a response.
-  NS_ASSERTION(!MessageChannel::IsPumpingMessages(),
-               "Shouldn't be pumping already!");
-
-  MessageChannel::SetIsPumpingMessages(true);
-  HHOOK windowHook = SetWindowsHookEx(WH_CALLWNDPROC, CallWindowProcedureHook,
-                                      nullptr, gUIThreadId);
-  NS_ASSERTION(windowHook, "Failed to set hook!");
-
   {
     while (1) {
       MSG msg = { 0 };
@@ -998,25 +1070,11 @@
     }
   }
 
-  // Unhook the neutered window procedure hook.
-  UnhookWindowsHookEx(windowHook);
-
-  // Unhook any neutered windows procedures so messages can be delivered
-  // normally.
-  UnhookNeuteredWindows();
-
-  // Before returning we need to set a hook to run any deferred messages that
-  // we received during the IPC call. The hook will unset itself as soon as
-  // someone else calls GetMessage, PeekMessage, or runs code that generates
-  // a "nonqueued" message.
-  ScheduleDeferredMessageRun();
-
   if (timerId) {
     KillTimer(nullptr, timerId);
+    timerId = 0;
   }
 
-  MessageChannel::SetIsPumpingMessages(false);
-
   return WaitResponse(timedout);
 }
 
@@ -1050,56 +1108,28 @@
   UINT_PTR timerId = 0;
   TimeoutData timeoutData = { 0 };
 
-  // windowHook is used as a flag variable for the loop below: if it is set
+  // gWindowHook is used as a flag variable for the loop below: if it is set
   // and we start to spin a nested event loop, we need to clear the hook and
   // process deferred/pending messages.
-  // If windowHook is nullptr, MessageChannel::IsPumpingMessages should be false.
-  HHOOK windowHook = nullptr;
-
   while (1) {
-    NS_ASSERTION((!!windowHook) == MessageChannel::IsPumpingMessages(),
-                 "windowHook out of sync with reality");
+    NS_ASSERTION((!!gWindowHook) == MessageChannel::IsPumpingMessages(),
+                 "gWindowHook out of sync with reality");
 
     if (mTopFrame->mSpinNestedEvents) {
-      if (windowHook) {
-        UnhookWindowsHookEx(windowHook);
-        windowHook = nullptr;
-
-        if (timerId) {
-          KillTimer(nullptr, timerId);
-          timerId = 0;
-        }
-
-        // Used by widget to assert on incoming native events
-        MessageChannel::SetIsPumpingMessages(false);
-
-        // Unhook any neutered windows procedures so messages can be delievered
-        // normally.
-        UnhookNeuteredWindows();
-
-        // Send all deferred "nonqueued" message to the intended receiver.
-        // We're dropping into SpinInternalEventLoop so we should be fairly
-        // certain these will get delivered soohn.
-        ScheduleDeferredMessageRun();
+      if (gWindowHook && timerId) {
+        KillTimer(nullptr, timerId);
+        timerId = 0;
       }
+      DeneuteredWindowRegion deneuteredRgn;
       SpinInternalEventLoop();
       ResetEvent(mEvent);
       return true;
     }
 
-    if (!windowHook) {
-      MessageChannel::SetIsPumpingMessages(true);
-      windowHook = SetWindowsHookEx(WH_CALLWNDPROC, CallWindowProcedureHook,
-                                    nullptr, gUIThreadId);
-      NS_ASSERTION(windowHook, "Failed to set hook!");
-
-      NS_ASSERTION(!timerId, "Timer already initialized?");
-
-      if (mTimeoutMs != kNoTimeout) {
-        InitTimeoutData(&timeoutData, mTimeoutMs);
-        timerId = SetTimer(nullptr, 0, mTimeoutMs, nullptr);
-        NS_ASSERTION(timerId, "SetTimer failed!");
-      }
+    if (mTimeoutMs != kNoTimeout && !timerId) {
+      InitTimeoutData(&timeoutData, mTimeoutMs);
+      timerId = SetTimer(nullptr, 0, mTimeoutMs, nullptr);
+      NS_ASSERTION(timerId, "SetTimer failed!");
     }
 
     MSG msg = { 0 };
@@ -1151,27 +1181,11 @@
     }
   }
 
-  if (windowHook) {
-    // Unhook the neutered window procedure hook.
-    UnhookWindowsHookEx(windowHook);
-
-    // Unhook any neutered windows procedures so messages can be delivered
-    // normally.
-    UnhookNeuteredWindows();
-
-    // Before returning we need to set a hook to run any deferred messages that
-    // we received during the IPC call. The hook will unset itself as soon as
-    // someone else calls GetMessage, PeekMessage, or runs code that generates
-    // a "nonqueued" message.
-    ScheduleDeferredMessageRun();
-
-    if (timerId) {
-      KillTimer(nullptr, timerId);
-    }
+  if (timerId) {
+    KillTimer(nullptr, timerId);
+    timerId = 0;
   }
 
-  MessageChannel::SetIsPumpingMessages(false);
-
   return WaitResponse(timedout);
 }
 
diff -ur 41.0/mozilla-release/layout/style/nsStyleSet.cpp 41.0.2/mozilla-release/layout/style/nsStyleSet.cpp
--- 41.0/mozilla-release/layout/style/nsStyleSet.cpp	2015-09-18 06:13:29.000000000 +0800
+++ 41.0.2/mozilla-release/layout/style/nsStyleSet.cpp	2015-10-15 05:41:40.000000000 +0800
@@ -385,6 +385,8 @@
 nsresult
 nsStyleSet::GatherRuleProcessors(sheetType aType)
 {
+  NS_ENSURE_FALSE(mInShutdown, NS_ERROR_FAILURE);
+
   nsCOMPtr<nsIStyleRuleProcessor> oldRuleProcessor(mRuleProcessors[aType]);
   nsTArray<nsCOMPtr<nsIStyleRuleProcessor>> oldScopedDocRuleProcessors;
   if (aType == eAgentSheet || aType == eUserSheet) {
diff -ur 41.0/mozilla-release/mobile/android/confvars.sh 41.0.2/mozilla-release/mobile/android/confvars.sh
--- 41.0/mozilla-release/mobile/android/confvars.sh	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/mobile/android/confvars.sh	2015-10-15 05:41:47.000000000 +0800
@@ -5,7 +5,7 @@
 MOZ_APP_BASENAME=Fennec
 MOZ_APP_VENDOR=Mozilla
 
-MOZ_APP_VERSION=41.0
+MOZ_APP_VERSION=41.0.2
 MOZ_APP_UA_NAME=Firefox
 
 MOZ_BRANDING_DIRECTORY=mobile/android/branding/unofficial
Binary files 41.0/mozilla-release/python/psutil/build/lib.linux-x86_64-2.7/_psutil_linux.so and 41.0.2/mozilla-release/python/psutil/build/lib.linux-x86_64-2.7/_psutil_linux.so differ
Binary files 41.0/mozilla-release/python/psutil/build/lib.linux-x86_64-2.7/_psutil_posix.so and 41.0.2/mozilla-release/python/psutil/build/lib.linux-x86_64-2.7/_psutil_posix.so differ
Binary files 41.0/mozilla-release/python/psutil/build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o and 41.0.2/mozilla-release/python/psutil/build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o differ
Binary files 41.0/mozilla-release/python/psutil/build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o and 41.0.2/mozilla-release/python/psutil/build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o differ
Binary files 41.0/mozilla-release/python/psutil/_psutil_linux.so and 41.0.2/mozilla-release/python/psutil/_psutil_linux.so differ
Binary files 41.0/mozilla-release/python/psutil/_psutil_posix.so and 41.0.2/mozilla-release/python/psutil/_psutil_posix.so differ
Only in 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla: checksums.py
diff -ur 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/release.py 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/release.py
--- 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/release.py	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/release.py	2015-10-15 05:41:37.000000000 +0800
@@ -40,6 +40,7 @@
             self.release_config['ftp_server'] = rc['stagingServer']
             self.release_config['ftp_user'] = c.get('ftp_user', rc['hgUsername'])
             self.release_config['ftp_ssh_key'] = c.get('ftp_ssh_key', rc['hgSshKey'])
+            self.release_config['release_channel'] = rc['releaseChannel']
         else:
             self.info("No release config file; using default config.")
             for key in ('version', 'buildnum',
diff -ur 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/signing.py 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/signing.py
--- 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/signing.py	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/signing.py	2015-10-15 05:41:37.000000000 +0800
@@ -35,7 +35,7 @@
 
 class SigningMixin(BaseSigningMixin):
     """Generic signing helper methods."""
-    def query_moz_sign_cmd(self, formats='gpg'):
+    def query_moz_sign_cmd(self, formats=['gpg']):
         if 'MOZ_SIGNING_SERVERS' not in os.environ:
             self.fatal("MOZ_SIGNING_SERVERS not in env; no MOZ_SIGN_CMD for you!")
         dirs = self.query_abs_dirs()
@@ -54,7 +54,8 @@
             '-c', host_cert,
         ]
         if formats:
-            cmd += ['-f', formats]
+            for f in formats:
+                cmd += ['-f', f]
         for h in os.environ['MOZ_SIGNING_SERVERS'].split(","):
             cmd += ['-H', h]
         return cmd
diff -ur 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/updates/balrog.py 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/updates/balrog.py
--- 41.0/mozilla-release/testing/mozharness/mozharness/mozilla/updates/balrog.py	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/testing/mozharness/mozharness/mozilla/updates/balrog.py	2015-10-15 05:41:37.000000000 +0800
@@ -90,6 +90,7 @@
         cmd.extend(["--buildbot-configs", "https://hg.mozilla.org/build/buildbot-configs"])
         cmd.extend(["--release-config", os.path.join(dirs['build_dir'], self.config.get("release_config_file"))])
         cmd.extend(["--credentials-file", os.path.join(dirs['base_work_dir'], self.config.get("balrog_credentials_file"))])
+        cmd.extend(["--release-channel", self.query_release_config()['release_channel']])
 
         return_codes = []
         for server in self.config["balrog_servers"]:
diff -ur 41.0/mozilla-release/testing/mozharness/scripts/b2g_build.py 41.0.2/mozilla-release/testing/mozharness/scripts/b2g_build.py
--- 41.0/mozilla-release/testing/mozharness/scripts/b2g_build.py	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/testing/mozharness/scripts/b2g_build.py	2015-10-15 05:41:37.000000000 +0800
@@ -628,7 +628,7 @@
             return
 
         self.checkout_tools()
-        cmd = self.query_moz_sign_cmd(formats='b2gmar')
+        cmd = self.query_moz_sign_cmd(formats=['b2gmar'])
         cmd.append(self.query_marfile_path())
 
         retval = self.run_command(cmd)
diff -ur 41.0/mozilla-release/testing/mozharness/scripts/mobile_l10n.py 41.0.2/mozilla-release/testing/mozharness/scripts/mobile_l10n.py
--- 41.0/mozilla-release/testing/mozharness/scripts/mobile_l10n.py	2015-09-18 06:13:26.000000000 +0800
+++ 41.0.2/mozilla-release/testing/mozharness/scripts/mobile_l10n.py	2015-10-15 05:41:37.000000000 +0800
@@ -148,7 +148,7 @@
             rc = self.query_release_config()
             repack_env['EN_US_BINARY_URL'] = c['base_en_us_binary_url'] % replace_dict
         if 'MOZ_SIGNING_SERVERS' in os.environ:
-            repack_env['MOZ_SIGN_CMD'] = subprocess.list2cmdline(self.query_moz_sign_cmd(formats='jar'))
+            repack_env['MOZ_SIGN_CMD'] = subprocess.list2cmdline(self.query_moz_sign_cmd(formats=['jar']))
         self.repack_env = repack_env
         return self.repack_env
 
Only in 41.0.2/mozilla-release/testing/mozharness/scripts: release
diff -ur 41.0/mozilla-release/widget/GfxDriverInfo.cpp 41.0.2/mozilla-release/widget/GfxDriverInfo.cpp
--- 41.0/mozilla-release/widget/GfxDriverInfo.cpp	2015-09-18 06:13:31.000000000 +0800
+++ 41.0.2/mozilla-release/widget/GfxDriverInfo.cpp	2015-10-15 05:41:51.000000000 +0800
@@ -266,6 +266,12 @@
     case Bug1155608:
       APPEND_DEVICE(0x2e22); /* IntelG45_1 */
       break;
+    case Bug1207665:
+      APPEND_DEVICE(0xa001); /* Intel Media Accelerator 3150 */
+      APPEND_DEVICE(0xa002);
+      APPEND_DEVICE(0xa011);
+      APPEND_DEVICE(0xa012);
+      break;
     case AMDRadeonHD5800:
       APPEND_DEVICE(0x6899);
       break;
diff -ur 41.0/mozilla-release/widget/GfxDriverInfo.h 41.0.2/mozilla-release/widget/GfxDriverInfo.h
--- 41.0/mozilla-release/widget/GfxDriverInfo.h	2015-09-18 06:13:31.000000000 +0800
+++ 41.0.2/mozilla-release/widget/GfxDriverInfo.h	2015-10-15 05:41:51.000000000 +0800
@@ -92,6 +92,7 @@
   Bug1137716,
   Bug1116812,
   Bug1155608,
+  Bug1207665,
   DeviceFamilyMax
 };
 
diff -ur 41.0/mozilla-release/widget/windows/GfxInfo.cpp 41.0.2/mozilla-release/widget/windows/GfxInfo.cpp
--- 41.0/mozilla-release/widget/windows/GfxInfo.cpp	2015-09-18 06:13:31.000000000 +0800
+++ 41.0.2/mozilla-release/widget/windows/GfxInfo.cpp	2015-10-15 05:41:51.000000000 +0800
@@ -1084,6 +1084,18 @@
       nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
       DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
 
+    /* Disable D3D11 layers on Intel GMA 3150 for failing to allocate a shared handle for textures.
+     * See bug 1207665. Additionally block D2D so we don't accidentally use WARP.
+     */
+    APPEND_TO_DRIVER_BLOCKLIST2(DRIVER_OS_ALL,
+        (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Bug1207665),
+        nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
+      DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
+    APPEND_TO_DRIVER_BLOCKLIST2(DRIVER_OS_ALL,
+        (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorIntel), (GfxDeviceFamily*) GfxDriverInfo::GetDeviceFamily(Bug1207665),
+        nsIGfxInfo::FEATURE_DIRECT2D, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
+      DRIVER_LESS_THAN, GfxDriverInfo::allDriverVersions );
+
     /* Disable D2D on AMD Catalyst 14.4 until 14.6
      * See bug 984488
      */
