From 87a2b36792a9fa878b4ea803f5628072e19cfde9 Mon Sep 17 00:00:00 2001 From: dimi Date: Thu, 2 Jun 2016 16:33:13 +0800 Subject: [PATCH] Bug 1258033 - Part 4: Testcase for DNT. r=francois MozReview-Commit-ID: IqPIMwDQluy --HG-- extra : rebase_source : 1124e9f6e0e436caccfe3233fa68065caac62e70 --- .../url-classifier/tests/mochitest/chrome.ini | 1 + .../url-classifier/tests/mochitest/dnt.html | 31 ++++ .../url-classifier/tests/mochitest/dnt.sjs | 9 ++ .../tests/mochitest/mochitest.ini | 2 + .../tests/mochitest/test_donottrack.html | 150 ++++++++++++++++++ 5 files changed, 193 insertions(+) create mode 100644 toolkit/components/url-classifier/tests/mochitest/dnt.html create mode 100644 toolkit/components/url-classifier/tests/mochitest/dnt.sjs create mode 100644 toolkit/components/url-classifier/tests/mochitest/test_donottrack.html diff --git a/toolkit/components/url-classifier/tests/mochitest/chrome.ini b/toolkit/components/url-classifier/tests/mochitest/chrome.ini index 5f8347787a10..7555ecef20e2 100644 --- a/toolkit/components/url-classifier/tests/mochitest/chrome.ini +++ b/toolkit/components/url-classifier/tests/mochitest/chrome.ini @@ -17,3 +17,4 @@ tags = trackingprotection tags = trackingprotection [test_trackingprotection_whitelist.html] tags = trackingprotection +[test_donottrack.html] diff --git a/toolkit/components/url-classifier/tests/mochitest/dnt.html b/toolkit/components/url-classifier/tests/mochitest/dnt.html new file mode 100644 index 000000000000..effc3a4f8ce4 --- /dev/null +++ b/toolkit/components/url-classifier/tests/mochitest/dnt.html @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/toolkit/components/url-classifier/tests/mochitest/dnt.sjs b/toolkit/components/url-classifier/tests/mochitest/dnt.sjs new file mode 100644 index 000000000000..bbb836482ada --- /dev/null +++ b/toolkit/components/url-classifier/tests/mochitest/dnt.sjs @@ -0,0 +1,9 @@ +function handleRequest(request, response) { + var dnt = "unspecified"; + if (request.hasHeader("DNT")) { + dnt = "1"; + } + + response.setHeader("Content-Type", "text/plain", false); + response.write(dnt); +} diff --git a/toolkit/components/url-classifier/tests/mochitest/mochitest.ini b/toolkit/components/url-classifier/tests/mochitest/mochitest.ini index f829c23a04ed..167a235bee96 100644 --- a/toolkit/components/url-classifier/tests/mochitest/mochitest.ini +++ b/toolkit/components/url-classifier/tests/mochitest/mochitest.ini @@ -20,6 +20,8 @@ support-files = workerFrame.html ping.sjs basic.vtt + dnt.html + dnt.sjs [test_classifier.html] skip-if = (os == 'linux' && debug) #Bug 1199778 diff --git a/toolkit/components/url-classifier/tests/mochitest/test_donottrack.html b/toolkit/components/url-classifier/tests/mochitest/test_donottrack.html new file mode 100644 index 000000000000..56003e7eb60d --- /dev/null +++ b/toolkit/components/url-classifier/tests/mochitest/test_donottrack.html @@ -0,0 +1,150 @@ + + + + Bug 1258033 - Fix the DNT loophole for tracking protection + + + + + +

+ +
+
+
+
+
+ +