Bug 1291024 - Avoid caching safebrowsing testcase resources. r?francois draft
authordimi <dlee@mozilla.com>
Tue, 23 Aug 2016 15:51:29 +0800
changeset 404321 b62c0347bbe84d1e4884ac8a55a2ab0da09467c5
parent 404131 24763f58772d45279a935790f732d80851924b46
child 529148 2763c3b6ecacada58d3b8f0ad1a22320166e99db
push id27172
push userdlee@mozilla.com
push dateTue, 23 Aug 2016 07:51:55 +0000
reviewersfrancois
bugs1291024
milestone51.0a1
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_bug1254766.html
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_bug1254766.html
+++ b/toolkit/components/url-classifier/tests/mochitest/test_bug1254766.html
@@ -284,16 +284,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>
--- 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>