Backed out changeset 7978f68a5355 (bug 1585055) for multiple mochitest-plain-chunked failures. on a CLOSED TREE
authorOana Pop Rus <opoprus@mozilla.com>
Wed, 02 Oct 2019 02:26:13 +0300
changeset 495875 e9322fe03f361013b4dfcf72e134a05d0ac34252
parent 495874 8003680668ad9d8858d06ced667683f15e80b824
child 495876 e7e97d7a6a43d7012dc5517b088122bb7b543a65
push id114140
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 18:04:51 +0000
treeherdermozilla-inbound@32eb0ea893f3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1585055
milestone71.0a1
backs out7978f68a53554de5a679c49e48719a7ac0eff4dc
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 7978f68a5355 (bug 1585055) for multiple mochitest-plain-chunked failures. on a CLOSED TREE
dom/security/test/general/mochitest.ini
dom/security/test/general/test_nosniff_navigation.html
dom/security/test/general/window_nosniff_navigation.html
modules/libpref/init/StaticPrefList.yaml
--- a/dom/security/test/general/mochitest.ini
+++ b/dom/security/test/general/mochitest.ini
@@ -21,17 +21,16 @@ support-files =
   file_same_site_cookies_blob_iframe_inclusion.html
   file_same_site_cookies_iframe.html
   file_same_site_cookies_iframe.sjs
   file_same_site_cookies_about_navigation.html
   file_same_site_cookies_about_inclusion.html
   file_same_site_cookies_about.sjs
   file_cache_splitting_server.sjs
   file_cache_splitting_window.html
-  window_nosniff_navigation.html
 
 
 [test_contentpolicytype_targeted_link_iframe.html]
 [test_nosniff.html]
 [test_cache_split.html]
 skip-if = fission || verify
 [test_nosniff_navigation.html]
 [test_block_script_wrong_mime.html]
--- a/dom/security/test/general/test_nosniff_navigation.html
+++ b/dom/security/test/general/test_nosniff_navigation.html
@@ -1,41 +1,92 @@
 <!DOCTYPE HTML>
 <html>
-
 <head>
   <title>Bug 1428473 Support X-Content-Type-Options: nosniff when navigating</title>
   <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <style>
+    iframe{
+      border: 1px solid orange;
+    }
+  </style>
+
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs?xml"> </iframe>
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs?html"></iframe>
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs?css" ></iframe>
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs?json"></iframe>
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs?img"></iframe>
+  <iframe class="no-mime" src="file_nosniff_navigation.sjs"></iframe>
+ 
+  <hr>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?html"></iframe>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?xml"></iframe>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?css"></iframe>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?json"></iframe>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?img"></iframe>
+  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs"></iframe>
+  <hr>
+
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?xml"> </iframe>
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?html"></iframe>
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?css" ></iframe>
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?json"></iframe>
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?img"></iframe>
+  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs"></iframe>
+ 
+
 </head>
-
 <body>
 
-  <!-- add the two script tests -->
-  <script id="scriptCorrectType"></script>
-  <script id="scriptWrongType"></script>
+<!-- add the two script tests -->
+<script id="scriptCorrectType"></script>
+<script id="scriptWrongType"></script>
 
-  <script class="testbody" type="text/javascript">
-    /* Description of the test:
-     * We're testing if Firefox respects the nosniff Header for Top-Level 
-     * Navigations.
-     * If Firefox cant Display the Page, it will prompt a download 
-     * and the URL of the Page will be about:blank.
-     * So we will try to open different content send with
-     * no-mime, mismatched-mime and garbage-mime types.
-     * 
-     */
+<script class="testbody" type="text/javascript">
+/* Description of the test:
+ * We're testing if Firefox respects the nosniff Header for Top-Level 
+ * Navigations.
+ * If Firefox cant Display the Page, it will prompt a download 
+ * and the URL of the Page will be about:blank.
+ * So we will try to open different content send with
+ * no-mime, mismatched-mime and garbage-mime types.
+ * 
+ */
+
+SimpleTest.waitForExplicitFinish();
+
+window.addEventListener("load", ()=>{
+  let noMimeFrames = Array.from(document.querySelectorAll(".no-mime"));
 
-    SimpleTest.waitForExplicitFinish();
+  noMimeFrames.forEach( frame => {
+    // In case of no Provided Content Type, not rendering or assuming text/plain is valid
+    let result = frame.contentWindow.document.URL == "about:blank" || frame.contentWindow.document.contentType == "text/plain";
+    let sniffTarget = (new URL(frame.src)).search;
+    ok(result, `${sniffTarget} without MIME - was not Sniffed`);
+  });
+
+  let mismatchedMimes = Array.from(document.querySelectorAll(".mismatch-mime"));
+  mismatchedMimes.forEach(frame => {
+    // In case the Server mismatches the Mime Type (sends content X as image/png)
+    // assert that we do not sniff and correct this.
+    let result = frame.contentWindow.document.contentType == "image/png";
+    let sniffTarget = (new URL(frame.src)).search;
+    ok(result, `${sniffTarget} send as image/png - was not Sniffed`);
+  });
 
-    window.addEventListener("load", async () => {
-      await SpecialPowers.pushPrefEnv(
-      {
-          set: [["dom.security.respect_document_nosniff", true]],
-        }
-    );
-    window.open("window_nosniff_navigation.html");
+  let badMimeFrames = Array.from(document.querySelectorAll(".garbage-mime"));
+
+  badMimeFrames.forEach( frame => {
+    // In the case we got a bogous mime, assert that we dont sniff. 
+    // We must not default here to text/plain
+    // as the Server at least provided a mime type. 
+    let result = frame.contentWindow.document.URL == "about:blank";
+    let sniffTarget = (new URL(frame.src)).search;
+    ok(result, `${sniffTarget} send as garbage/garbage - was not Sniffed`);
+  });
+  
+  SimpleTest.finish();
 });
-  </script>
+</script>
 </body>
-
-</html>
\ No newline at end of file
+</html>
deleted file mode 100644
--- a/dom/security/test/general/window_nosniff_navigation.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Bug 1428473 Support X-Content-Type-Options: nosniff when navigating</title>
-  <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-  <style>
-    iframe{
-      border: 1px solid orange;
-    }
-  </style>
-
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs?xml"> </iframe>
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs?html"></iframe>
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs?css" ></iframe>
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs?json"></iframe>
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs?img"></iframe>
-  <iframe class="no-mime" src="file_nosniff_navigation.sjs"></iframe>
- 
-  <hr>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?html"></iframe>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?xml"></iframe>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?css"></iframe>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?json"></iframe>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs?img"></iframe>
-  <iframe class="mismatch-mime" src="file_nosniff_navigation_mismatch.sjs"></iframe>
-  <hr>
-
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?xml"> </iframe>
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?html"></iframe>
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?css" ></iframe>
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?json"></iframe>
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs?img"></iframe>
-  <iframe class="garbage-mime" src="file_nosniff_navigation_garbage.sjs"></iframe>
- 
-
-</head>
-
-<body>
-
-<!-- add the two script tests -->
-<script id="scriptCorrectType"></script>
-<script id="scriptWrongType"></script>
-
-<script class="testbody" type="text/javascript">
-/* Description of the test:
- * We're testing if Firefox respects the nosniff Header for Top-Level 
- * Navigations.
- * If Firefox cant Display the Page, it will prompt a download 
- * and the URL of the Page will be about:blank.
- * So we will try to open different content send with
- * no-mime, mismatched-mime and garbage-mime types.
- * 
- */
-
-SimpleTest.waitForExplicitFinish();
-
-window.addEventListener("load", ()=>{
-  let noMimeFrames = Array.from(document.querySelectorAll(".no-mime"));
-
-  noMimeFrames.forEach( frame => {
-    // In case of no Provided Content Type, not rendering or assuming text/plain is valid
-    let result = frame.contentWindow.document.URL == "about:blank" || frame.contentWindow.document.contentType == "text/plain";
-    let sniffTarget = (new URL(frame.src)).search;
-    ok(result, `${sniffTarget} without MIME - was not Sniffed`);
-  });
-
-  let mismatchedMimes = Array.from(document.querySelectorAll(".mismatch-mime"));
-  mismatchedMimes.forEach(frame => {
-    // In case the Server mismatches the Mime Type (sends content X as image/png)
-    // assert that we do not sniff and correct this.
-    let result = frame.contentWindow.document.contentType == "image/png";
-    let sniffTarget = (new URL(frame.src)).search;
-    ok(result, `${sniffTarget} send as image/png - was not Sniffed`);
-  });
-
-  let badMimeFrames = Array.from(document.querySelectorAll(".garbage-mime"));
-
-  badMimeFrames.forEach( frame => {
-    // In the case we got a bogous mime, assert that we dont sniff. 
-    // We must not default here to text/plain
-    // as the Server at least provided a mime type. 
-    let result = frame.contentWindow.document.URL == "about:blank";
-    let sniffTarget = (new URL(frame.src)).search;
-    ok(result, `${sniffTarget} send as garbage/garbage - was not Sniffed`);
-  });
-  
-  SimpleTest.finish();
-});
-</script>
-</body>
-
-</html>
\ No newline at end of file
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2077,17 +2077,17 @@
 # This pref enables the featurePolicy header support.
 - name: dom.security.featurePolicy.header.enabled
   type: bool
   value: @IS_NIGHTLY_BUILD@
   mirror: always
 
 - name: dom.security.respect_document_nosniff
   type: RelaxedAtomicBool
-  value: false
+  value: true
   mirror: always
 
 # Expose the 'policy' attribute in document and HTMLIFrameElement
 - name: dom.security.featurePolicy.webidl.enabled
   type: bool
   value: @IS_NIGHTLY_BUILD@
   mirror: always