Bug 976073 - Part 2: Modify errors from try server, r=jdm
authoramy <amchung@mozilla.com>
Wed, 09 Nov 2016 17:26:03 +0800
changeset 351856 b86094c4eafc59ef953655fa6996ca242bd55320
parent 351855 97a0b004f799c39c7f7c9876d1110a3fa642ab41
child 351857 eac5fd08280a9cfa83925050cd70facc8252eac9
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs976073
milestone52.0a1
Bug 976073 - Part 2: Modify errors from try server, r=jdm
devtools/client/storage/test/storage-listings.html
devtools/client/storage/test/storage-unsecured-iframe.html
devtools/server/tests/browser/browser_storage_listings.js
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/cookies/secure/set-from-dom.sub.html.ini
testing/web-platform/meta/cookies/secure/set-from-http.sub.html.ini
testing/web-platform/tests/cookies/secure/set-from-dom.sub.html
testing/web-platform/tests/cookies/secure/set-from-http.sub.html
--- a/devtools/client/storage/test/storage-listings.html
+++ b/devtools/client/storage/test/storage-listings.html
@@ -14,17 +14,17 @@ Bug 970517 - Storage inspector front end
 "use strict";
 let partialHostname = location.hostname.match(/^[^.]+(\..*)$/)[1];
 let cookieExpiresTime1 = 2000000000000;
 let cookieExpiresTime2 = 2000000001000;
 // Setting up some cookies to eat.
 document.cookie = "c1=foobar; expires=" +
   new Date(cookieExpiresTime1).toGMTString() + "; path=/browser";
 document.cookie = "cs2=sessionCookie; path=/; domain=" + partialHostname;
-document.cookie = "c3=foobar-2; secure=true; expires=" +
+document.cookie = "c3=foobar-2; expires=" +
   new Date(cookieExpiresTime2).toGMTString() + "; path=/";
 // ... and some local storage items ..
 localStorage.setItem("ls1", "foobar");
 localStorage.setItem("ls2", "foobar-2");
 // ... and finally some session storage items too
 sessionStorage.setItem("ss1", "foobar-3");
 dump("added cookies and storage from main page\n");
 
--- a/devtools/client/storage/test/storage-unsecured-iframe.html
+++ b/devtools/client/storage/test/storage-unsecured-iframe.html
@@ -4,16 +4,16 @@
 Iframe for testing multiple host detetion in storage actor
 -->
 <head>
   <meta charset="utf-8">
 </head>
 <body>
 <script>
 "use strict";
-document.cookie = "uc1=foobar; domain=.example.org; path=/; secure=true";
+document.cookie = "uc1=foobar; domain=.example.org; path=/";
 localStorage.setItem("iframe-u-ls1", "foobar");
 sessionStorage.setItem("iframe-u-ss1", "foobar1");
 sessionStorage.setItem("iframe-u-ss2", "foobar2");
 dump("added cookies and storage from unsecured iframe\n");
 </script>
 </body>
 </html>
--- a/devtools/server/tests/browser/browser_storage_listings.js
+++ b/devtools/server/tests/browser/browser_storage_listings.js
@@ -30,17 +30,17 @@ const storeMap = {
       },
       {
         name: "c3",
         value: "foobar-2",
         expires: 2000000001000,
         path: "/",
         host: "test1.example.org",
         isDomain: false,
-        isSecure: true,
+        isSecure: false,
       },
       {
         name: "uc1",
         value: "foobar",
         host: ".example.org",
         path: "/",
         expires: 0,
         isDomain: true,
@@ -339,17 +339,24 @@ function* testStores(data) {
 function testCookies(cookiesActor) {
   is(Object.keys(cookiesActor.hosts).length, 2, "Correct number of host entries for cookies");
   return testCookiesObjects(0, cookiesActor.hosts, cookiesActor);
 }
 
 var testCookiesObjects = Task.async(function* (index, hosts, cookiesActor) {
   let host = Object.keys(hosts)[index];
   let matchItems = data => {
-    is(data.total, storeMap.cookies[host].length,
+    let cookiesLength = 0;
+    for (let secureCookie of storeMap.cookies[host]) {
+       if (secureCookie.isSecure) {
+          ++cookiesLength;
+       }
+    }
+    // Any secure cookies did not get stored in the database.
+    is(data.total, storeMap.cookies[host].length - cookiesLength,
        "Number of cookies in host " + host + " matches");
     for (let item of data.data) {
       let found = false;
       for (let toMatch of storeMap.cookies[host]) {
         if (item.name == toMatch.name) {
           found = true;
           ok(true, "Found cookie " + item.name + " in response");
           is(item.value.str, toMatch.value, "The value matches.");
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -14811,28 +14811,20 @@
         "path": "content-security-policy/svg/svg-policy-with-resource.html",
         "url": "/content-security-policy/svg/svg-policy-with-resource.html"
       },
       {
         "path": "cookies/secure/set-from-dom.https.sub.html",
         "url": "/cookies/secure/set-from-dom.https.sub.html"
       },
       {
-        "path": "cookies/secure/set-from-dom.sub.html",
-        "url": "/cookies/secure/set-from-dom.sub.html"
-      },
-      {
         "path": "cookies/secure/set-from-http.https.sub.html",
         "url": "/cookies/secure/set-from-http.https.sub.html"
       },
       {
-        "path": "cookies/secure/set-from-http.sub.html",
-        "url": "/cookies/secure/set-from-http.sub.html"
-      },
-      {
         "path": "cookies/secure/set-from-ws.https.sub.html",
         "url": "/cookies/secure/set-from-ws.https.sub.html"
       },
       {
         "path": "cookies/secure/set-from-wss.https.sub.html",
         "url": "/cookies/secure/set-from-wss.https.sub.html"
       },
       {
deleted file mode 100644
--- a/testing/web-platform/meta/cookies/secure/set-from-dom.sub.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[set-from-dom.sub.html]
-  type: testharness
-  ['secure' cookie not sent in HTTP request]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/meta/cookies/secure/set-from-http.sub.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[set-from-http.sub.html]
-  type: testharness
-  ['secure' cookie not sent in HTTP request]
-    expected: FAIL
-
deleted file mode 100644
--- a/testing/web-platform/tests/cookies/secure/set-from-dom.sub.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <meta charset=utf-8>
-  <title>Set 'secure' cookie from `document.cookie` on a non-secure page</title>
-  <meta name=help href="https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone">
-  <script src="/resources/testharness.js"></script>
-  <script src="/resources/testharnessreport.js"></script>
-  <script src="/cookies/resources/testharness-helpers.js"></script>
-</head>
-<body>
-<div id=log></div>
-<script>
-  var tests = [
-    [
-      "'secure' cookie not set in `document.cookie`",
-      function () {
-        var originalCookie = document.cookie;
-        document.cookie = "secure_from_nonsecure_dom=1; secure; path=/";
-        assert_equals(document.cookie, originalCookie);
-        this.done();
-      }
-    ],
-    [
-      "'secure' cookie not sent in HTTP request",
-      function () {
-        document.cookie = "secure_from_nonsecure_dom=1; secure; path=/";
-        fetch("https://{{host}}:{{ports[https][0]}}/cookies/resources/echo-json.py", { "credentials": "include" })
-          .then(this.step_func(function (r) {
-              return r.json();
-          }))
-          .then(this.step_func_done(function (j) {
-              assert_equals(j["secure_from_nonsecure_dom"], undefined);
-          }));
-      }
-    ]
-  ];
-
-  function clearKnownCookie() {
-    document.cookie = "secure_from_nonsecure_dom=0; Secure; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
-  }
-
-  executeTestsSerially(tests, clearKnownCookie, clearKnownCookie);
-</script>
-</body>
-</html>
-
deleted file mode 100644
--- a/testing/web-platform/tests/cookies/secure/set-from-http.sub.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!doctype html>
-<html>
-<head>
-  <meta charset=utf-8>
-  <title>Set 'secure' cookie from `Set-Cookie` HTTP header on a non-secure page</title>
-  <meta name=help href="https://tools.ietf.org/html/draft-west-leave-secure-cookies-alone">
-  <script src="/resources/testharness.js"></script>
-  <script src="/resources/testharnessreport.js"></script>
-  <script src="/cookies/resources/testharness-helpers.js"></script>
-</head>
-<body>
-<div id=log></div>
-<script>
-  function clearKnownCookie() {
-    document.cookie = "secure_from_nonsecure_http=0; Secure; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
-  }
-
-  test(function () {
-    assert_equals(document.cookie.match(/secure_from_nonsecure_http=1/), null);
-  }, "'secure' cookie not present in `document.cookie`");
-
-  promise_test(function (t) {
-    t.add_cleanup(clearKnownCookie);
-    return fetch("https://{{host}}:{{ports[https][0]}}/cookies/resources/echo-json.py",
-                 { "credentials": "include" })
-      .then(function (r) {
-        return r.json();
-      })
-      .then(function (j) {
-        assert_equals(j["secure_from_nonsecure_http"], undefined);
-      });
-  }, "'secure' cookie not sent in HTTP request");
-</script>
-</body>
-</html>
-