Commit 42e02834 authored by Jonathan Hao's avatar Jonathan Hao Committed by Georg Koppen
Browse files

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

--HG--
extra : rebase_source : 8964090126795ed45650e76c4f9e02b2e60f62cf
parent 1f6a69c3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -68,3 +68,4 @@ support-files =
[browser_sharedworker.js]
[browser_httpauth.js]
[browser_clientAuth.js]
[browser_cacheAPI.js]
+18 −0
Original line number Diff line number Diff line
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);
+5 −2
Original line number Diff line number Diff line
@@ -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}
                      ];