[tbb-commits] [tor-browser/tor-browser-45.0.2esr-6.x-1] squash! Bug #13749.2: Regression tests for first-party isolation of cache

gk at torproject.org gk at torproject.org
Fri Apr 22 19:48:06 UTC 2016


commit 3560a0c1a998f1e875e06bea15fb3d1203da385e
Author: Arthur Edelstein <arthuredelstein at gmail.com>
Date:   Tue Apr 19 15:39:00 2016 -0700

    squash! Bug #13749.2: Regression tests for first-party isolation of cache
    
    Bug #16326: Add regression test for isolating fetch and request in page scripts and workers
---
 netwerk/test/browser/browser.ini                         | 16 ++++++++++------
 netwerk/test/browser/browser_cacheFirstParty.js          |  8 ++++++--
 netwerk/test/browser/thirdPartyChild.fetch.html          |  8 ++++++++
 netwerk/test/browser/thirdPartyChild.iframe.html         |  3 +++
 netwerk/test/browser/thirdPartyChild.request.html        |  8 ++++++++
 netwerk/test/browser/thirdPartyChild.worker.fetch.html   |  8 ++++++++
 netwerk/test/browser/thirdPartyChild.worker.js           |  4 ++++
 netwerk/test/browser/thirdPartyChild.worker.request.html |  8 ++++++++
 8 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/netwerk/test/browser/browser.ini b/netwerk/test/browser/browser.ini
index 5ab1546..9bc3361 100644
--- a/netwerk/test/browser/browser.ini
+++ b/netwerk/test/browser/browser.ini
@@ -2,19 +2,23 @@
 support-files =
   firstPartyGrandParent.html
   firstPartyParent.html
-  thirdPartyChild.link.css
-  thirdPartyChild.iframe.html
-  thirdPartyChild.script.js
   thirdPartyChild.audio.ogg
-  thirdPartyChild.video.ogv
   thirdPartyChild.embed.png
+  thirdPartyChild.favicon.ico
+  thirdPartyChild.fetch.html
+  thirdPartyChild.iframe.html
   thirdPartyChild.img.png
+  thirdPartyChild.link.css
   thirdPartyChild.object.png
+  thirdPartyChild.request.html
+  thirdPartyChild.script.js
+  thirdPartyChild.track.vtt
+  thirdPartyChild.video.ogv
+  thirdPartyChild.worker.fetch.html
   thirdPartyChild.worker.js
+  thirdPartyChild.worker.request.html
   thirdPartyChild.worker.xhr.html
   thirdPartyChild.xhr.html
-  thirdPartyChild.track.vtt
-  thirdPartyChild.favicon.ico
 
 [browser_cacheFirstParty.js]
 [browser_NetUtil.js]
diff --git a/netwerk/test/browser/browser_cacheFirstParty.js b/netwerk/test/browser/browser_cacheFirstParty.js
index 79abffb..970043d 100644
--- a/netwerk/test/browser/browser_cacheFirstParty.js
+++ b/netwerk/test/browser/browser_cacheFirstParty.js
@@ -106,10 +106,12 @@ let privacyPref = "privacy.thirdparty.isolate",
     duplicatedDomains = [].concat(domains, domains),
     // We will check cache for example.net content from
     // iframe, link (css), script, img, object, embed, xhr, audio, video,
-    // track, favicon
+    // track, favicon, fetch, request
     suffixes = ["iframe.html", "link.css", "script.js", "img.png", "object.png",
                 "embed.png", "xhr.html", "worker.xhr.html", "audio.ogg",
-                "video.ogv", "track.vtt", "favicon.ico" ];
+                "video.ogv", "track.vtt", "favicon.ico",
+                "fetch.html", "worker.fetch.html",
+                "request.html", "worker.request.html"];
 
 // __checkCachePopulation(pref, numberOfDomains)__.
 // Check if the number of entries found in the cache for each
@@ -120,6 +122,8 @@ let checkCachePopulation = function* (pref, numberOfDomains) {
   // Collect cache data.
   let data = yield cacheDataForContext(LoadContextInfo.default, 2000);
   data = data.concat(yield cacheDataForContext(LoadContextInfo.private, 2000));
+  // `fetch` is cached in storage where both private and anonymous flags are set to true.
+  data = data.concat(yield cacheDataForContext(LoadContextInfo.custom(true, true, {appid : null}), 2000));
 /*
   // Uncomment to log all of the cache entries (useful for debugging).
   for (let cacheEntry of data) {
diff --git a/netwerk/test/browser/thirdPartyChild.fetch.html b/netwerk/test/browser/thirdPartyChild.fetch.html
new file mode 100644
index 0000000..65a9bbd
--- /dev/null
+++ b/netwerk/test/browser/thirdPartyChild.fetch.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
+<!-- The child page, used by browser_cacheFirstParty.js -->
+<body>
+<div>thirdPartyChild.fetch.html</div>
+</body>
+</html>
diff --git a/netwerk/test/browser/thirdPartyChild.iframe.html b/netwerk/test/browser/thirdPartyChild.iframe.html
index bbd6043..56f6df2 100644
--- a/netwerk/test/browser/thirdPartyChild.iframe.html
+++ b/netwerk/test/browser/thirdPartyChild.iframe.html
@@ -9,6 +9,9 @@
   xhr.open("GET", "http://example.net/browser/netwerk/test/browser/thirdPartyChild.xhr.html", true);
   xhr.send();
   var worker = new Worker("http://example.net/browser/netwerk/test/browser/thirdPartyChild.worker.js");
+
+  fetch("thirdPartyChild.fetch.html", {cache: "force-cache"} );
+  fetch(new Request("thirdPartyChild.request.html"), {cache: "force-cache"} );
 </script>
 </body>
 </html>
diff --git a/netwerk/test/browser/thirdPartyChild.request.html b/netwerk/test/browser/thirdPartyChild.request.html
new file mode 100644
index 0000000..46fffde0
--- /dev/null
+++ b/netwerk/test/browser/thirdPartyChild.request.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
+<!-- The child page, used by browser_cacheFirstParty.js -->
+<body>
+<div>thirdPartyChild.request.html</div>
+</body>
+</html>
diff --git a/netwerk/test/browser/thirdPartyChild.worker.fetch.html b/netwerk/test/browser/thirdPartyChild.worker.fetch.html
new file mode 100644
index 0000000..b44bc7d
--- /dev/null
+++ b/netwerk/test/browser/thirdPartyChild.worker.fetch.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
+<!-- The child page, used by browser_cacheFirstParty.js -->
+<body>
+<div>thirdPartyChild.worker.fetch.html</div>
+</body>
+</html>
diff --git a/netwerk/test/browser/thirdPartyChild.worker.js b/netwerk/test/browser/thirdPartyChild.worker.js
index 49154b7..34627b2 100644
--- a/netwerk/test/browser/thirdPartyChild.worker.js
+++ b/netwerk/test/browser/thirdPartyChild.worker.js
@@ -1,3 +1,7 @@
 var xhr = new XMLHttpRequest();
 xhr.open("GET", "http://example.net/browser/netwerk/test/browser/thirdPartyChild.worker.xhr.html", true);
 xhr.send();
+
+fetch("http://example.net/browser/netwerk/test/browser/thirdPartyChild.worker.fetch.html", {cache: "force-cache"} );
+var myRequest = new Request("http://example.net/browser/netwerk/test/browser/thirdPartyChild.worker.request.html");
+fetch(myRequest, {cache: "force-cache"} );
diff --git a/netwerk/test/browser/thirdPartyChild.worker.request.html b/netwerk/test/browser/thirdPartyChild.worker.request.html
new file mode 100644
index 0000000..c0306b7
--- /dev/null
+++ b/netwerk/test/browser/thirdPartyChild.worker.request.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
+<!-- The child page, used by browser_cacheFirstParty.js -->
+<body>
+<div>thirdPartyChild.worker.request.html</div>
+</body>
+</html>





More information about the tbb-commits mailing list