Bug 1274020 - Tests that shows the Cache Web API is separated by origin attributes. r=baku

--HG--
extra : rebase_source : 8964090126795ed45650e76c4f9e02b2e60f62cf
This commit is contained in:
Jonathan Hao 2016-12-13 11:44:59 +08:00
Родитель a1ed52af55
Коммит 12cb9f331a
3 изменённых файлов: 24 добавлений и 2 удалений

Просмотреть файл

@ -68,3 +68,4 @@ support-files =
[browser_sharedworker.js]
[browser_httpauth.js]
[browser_clientAuth.js]
[browser_cacheAPI.js]

Просмотреть файл

@ -0,0 +1,18 @@
const requestURL = "https://test1.example.com";
function getResult(aBrowser) {
return ContentTask.spawn(aBrowser, requestURL, function* (url) {
let cache = yield content.caches.open("TEST_CACHE");
let response = yield cache.match(url);
if (response) {
return response.statusText;
}
let result = Math.random().toString();
response = new content.Response("", { statusText: result });
yield cache.put(url, response);
return result;
});
}
IsolationTestTools.runTests("https://test2.example.com", getResult, null, null,
false, /* aUseHttps */ true);

Просмотреть файл

@ -279,7 +279,7 @@ this.IsolationTestTools = {
* An optional boolean to ensure we get results before the next tab is opened.
*/
runTests(aURL, aGetResultFuncs, aCompareResultFunc, aBeforeFunc,
aGetResultImmediately) {
aGetResultImmediately, aUseHttps) {
let pageURL;
let firstFrameSetting;
let secondFrameSetting;
@ -301,7 +301,10 @@ this.IsolationTestTools = {
aGetResultFuncs = [aGetResultFuncs];
}
let tabSettings = [
let tabSettings = aUseHttps ? [
{ firstPartyDomain: "https://example.com", userContextId: 1},
{ firstPartyDomain: "https://example.org", userContextId: 2}
] : [
{ firstPartyDomain: "http://example.com", userContextId: 1},
{ firstPartyDomain: "http://example.org", userContextId: 2}
];