commit df2cdeb77b7133ea672920caa8c2eac5d69f71c6 Author: Arthur Edelstein arthuredelstein@gmail.com Date: Wed Feb 17 22:19:31 2016 -0800
squash! Bug #13749.2: Regression tests for first-party isolation of cache
Also checks first-party isolation of favicons: https://bugs.torproject.org/16728 --- netwerk/test/browser/browser.ini | 1 + netwerk/test/browser/browser_cacheFirstParty.js | 21 ++++++++++++--------- netwerk/test/browser/firstPartyGrandParent.html | 4 +++- netwerk/test/browser/firstPartyParent.html | 4 +++- netwerk/test/browser/thirdPartyChild.favicon.ico | Bin 0 -> 1150 bytes 5 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/netwerk/test/browser/browser.ini b/netwerk/test/browser/browser.ini index ca711b7..5ab1546 100644 --- a/netwerk/test/browser/browser.ini +++ b/netwerk/test/browser/browser.ini @@ -14,6 +14,7 @@ support-files = 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 c23f669..c1b5ee6 100644 --- a/netwerk/test/browser/browser_cacheFirstParty.js +++ b/netwerk/test/browser/browser_cacheFirstParty.js @@ -4,12 +4,13 @@ // ("privacy.thirdparty.isolate" pref is set to 2) then when a loaded file is cached, // it is indexed by the URL-bar domain.
-// In this test, a number of files are loaded (via IFRAME, LINK, SCRIPT, IMG, OBJECT, -// EMBED, AUDIO, VIDEO, TRACK and XMLHttpRequest) by parent pages with different URL bar -// domains. When isolation is active, we test to confirm that a separate copy of each file -// is cached for each different parent domain. We also test to make sure that when -// isolation is inactive, a single copy of the child page is cached and reused for all -// parent domains. +// In this test, a number of files are loaded (via IFRAME, LINK [both CSS +// and Favicon], SCRIPT, IMG, OBJECT, EMBED, AUDIO, VIDEO, TRACK and +// XMLHttpRequest) by parent pages with different URL bar domains. When +// isolation is active, we test to confirm that a separate copy of each file is +// cached for each different parent domain. We also test to make sure that when +// isolation is inactive, a single copy of the child page is cached +// and reused for all parent domains.
// In this file, functions are defined in call stack order (later functions call earlier // functions). Comments are formatted for docco. @@ -104,13 +105,15 @@ let privacyPref = "privacy.thirdparty.isolate", // share cached embedded objects. duplicatedDomains = [].concat(domains, domains), // We will check cache for example.net content from - // iframe, link, script, img, object, embed, xhr, audio, video, track + // iframe, link (css), script, img, object, embed, xhr, audio, video, + // track, favicon suffixes = ["iframe.html", "link.css", "script.js", "img.png", "object.png", - "embed.png", "xhr.html", "worker.xhr.html", "audio.ogg", "video.ogv", "track.vtt" ]; + "embed.png", "xhr.html", "worker.xhr.html", "audio.ogg", + "video.ogv", "track.vtt", "favicon.ico" ];
// __checkCachePopulation(pref, numberOfDomains)__. // Check if the number of entries found in the cache for each -// embedded file type matches the number we expect, given the +// embedded file type matches the number we expect, given the // number of domains and the isolation state. let checkCachePopulation = function* (pref, numberOfDomains) { let expectedEntryCount = (pref === 2) ? numberOfDomains : 1; diff --git a/netwerk/test/browser/firstPartyGrandParent.html b/netwerk/test/browser/firstPartyGrandParent.html index c990831..969b429 100644 --- a/netwerk/test/browser/firstPartyGrandParent.html +++ b/netwerk/test/browser/firstPartyGrandParent.html @@ -1,7 +1,9 @@ <!DOCTYPE html> <html> <head> -<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> + <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> + <link rel="icon" type="image/ico" + href="http://example.net/browser/netwerk/test/browser/thirdPartyChild.favicon.ico%... </head> <frameset cols="50%,50%"> <frame src="http://example.net/browser/netwerk/test/browser/firstPartyParent.html"> diff --git a/netwerk/test/browser/firstPartyParent.html b/netwerk/test/browser/firstPartyParent.html index 7f2f5c8..fa29a74 100644 --- a/netwerk/test/browser/firstPartyParent.html +++ b/netwerk/test/browser/firstPartyParent.html @@ -5,6 +5,8 @@ <head> <link rel="stylesheet" type="text/css" href="http://example.net/browser/netwerk/test/browser/thirdPartyChild.link.css"> + <link rel="icon" type="image/ico" + href="http://example.net/browser/netwerk/test/browser/thirdPartyChild.favicon.ico%... </head> <body> <div>firstPartyParent.html</div> @@ -26,7 +28,7 @@ <source src="http://example.net/browser/netwerk/test/browser/thirdPartyChild.audio.ogg" type="audio/ogg"> <track src="http://example.net/browser/netwerk/test/browser/thirdPartyChild.track.vtt" - kind="subtitles"> + kind="subtitles"> </audio>
<video id="video" diff --git a/netwerk/test/browser/thirdPartyChild.favicon.ico b/netwerk/test/browser/thirdPartyChild.favicon.ico new file mode 100644 index 0000000..48060b1 Binary files /dev/null and b/netwerk/test/browser/thirdPartyChild.favicon.ico differ
tbb-commits@lists.torproject.org