Bug 1291024 - Avoid caching safebrowsing testcase resources. r=francois
authordimi <dlee@mozilla.com>
Tue, 23 Aug 2016 15:51:29 +0800
changeset 347854 b6d35508be5b9bb4049e3902cd371751993cb86a
parent 347853 0801ef134cad49e7da4011ff04ba9f7c0738bf1a
child 347855 f23d8ea54ced4980a8c375f41fce8afe5b2bdcab
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1291024
milestone50.0a2
Bug 1291024 - Avoid caching safebrowsing testcase resources. r=francois MozReview-Commit-ID: 9SB5diTrr5F
toolkit/components/url-classifier/tests/mochitest/bad.css^headers^
toolkit/components/url-classifier/tests/mochitest/evil.css^headers^
toolkit/components/url-classifier/tests/mochitest/evil.js^headers^
toolkit/components/url-classifier/tests/mochitest/mochitest.ini
toolkit/components/url-classifier/tests/mochitest/test_gethash.html
new file mode 100644
--- /dev/null
+++ b/toolkit/components/url-classifier/tests/mochitest/bad.css^headers^
@@ -0,0 +1,1 @@
+Cache-Control: no-store
new file mode 100644
--- /dev/null
+++ b/toolkit/components/url-classifier/tests/mochitest/evil.css^headers^
@@ -0,0 +1,1 @@
+Cache-Control: no-store
--- a/toolkit/components/url-classifier/tests/mochitest/evil.js^headers^
+++ b/toolkit/components/url-classifier/tests/mochitest/evil.js^headers^
@@ -1,1 +1,2 @@
 Access-Control-Allow-Origin: *
+Cache-Control: no-store
--- a/toolkit/components/url-classifier/tests/mochitest/mochitest.ini
+++ b/toolkit/components/url-classifier/tests/mochitest/mochitest.ini
@@ -3,32 +3,34 @@ skip-if = buildapp == 'b2g'
 support-files =
   classifiedAnnotatedPBFrame.html
   classifierCommon.js
   classifierFrame.html
   classifierHelper.js
   cleanWorker.js
   good.js
   evil.css
+  evil.css^headers^
   evil.js
   evil.js^headers^
   evilWorker.js
   import.css
   raptor.jpg
   track.html
   unwantedWorker.js
   vp9.webm
   whitelistFrame.html
   workerFrame.html
   ping.sjs
   basic.vtt
   dnt.html
   dnt.sjs
   update.sjs
   bad.css
+  bad.css^headers^
   gethash.sjs
   gethashFrame.html
 
 [test_classifier.html]
 skip-if = (os == 'linux' && debug) #Bug 1199778
 [test_classifier_worker.html]
 [test_classify_ping.html]
 [test_classify_track.html]
--- a/toolkit/components/url-classifier/tests/mochitest/test_gethash.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_gethash.html
@@ -135,16 +135,21 @@ function runTest() {
       SimpleTest.finish();
     }).catch(function(e) {
       ok(false, "Some test failed with error " + e);
       SimpleTest.finish();
     });
 }
 
 SimpleTest.waitForExplicitFinish();
+
+// 'network.predictor.enabled' is disabled because if other testcase load
+// evil.js, evil.css ...etc resources, it may cause we load them from cache
+// directly and bypass classifier check
 SpecialPowers.pushPrefEnv({"set": [
-  ["browser.safebrowsing.malware.enabled", true]
+  ["browser.safebrowsing.malware.enabled", true],
+  ["network.predictor.enabled", false],
 ]}, runTest);
 
 </script>
 </pre>
 </body>
 </html>