Bug 1311645 - Test that ocsp is not separated for containers. r=keeler draft
authorJonathan Hao <jhao@mozilla.com>
Tue, 24 Jan 2017 18:06:25 +0800
changeset 465578 3d234e076bfe8bf625574ec46731f706561f514b
parent 465467 a124b81302f936a6fd5989ed90308fb65c7927c9
child 543178 3071136cdc9aeffac0ee7dc116752779f098399d
push id42632
push userbmo:jhao@mozilla.com
push dateTue, 24 Jan 2017 10:09:58 +0000
reviewerskeeler
bugs1311645
milestone53.0a1
Bug 1311645 - Test that ocsp is not separated for containers. r=keeler
security/manager/ssl/tests/unit/test_ocsp_caching.js
--- a/security/manager/ssl/tests/unit/test_ocsp_caching.js
+++ b/security/manager/ssl/tests/unit/test_ocsp_caching.js
@@ -291,9 +291,34 @@ function add_tests() {
     gObservedCnt = 0;
     run_next_test();
   });
 
   //---------------------------------------------------------------------------
 
   // Reset state
   add_test(function() { clearOCSPCache(); run_next_test(); });
+
+  // Test that the OCSP cache is not isolated by userContextId.
+
+  // A good OCSP response will be cached.
+  add_ocsp_test("ocsp-stapling-none.example.com", PRErrorCodeSuccess,
+                [respondWithGoodOCSP],
+                "No stapled response (userContextId = 1) -> a fetch " +
+                "should have been attempted", { userContextId: 1 });
+
+  // The cache will prevent a fetch from happening.
+  add_ocsp_test("ocsp-stapling-none.example.com", PRErrorCodeSuccess, [],
+                "Noted OCSP server failure (userContextId = 1) -> a " +
+                "fetch should not have been attempted",
+                { userContextId: 1 });
+
+  // Fetching is prevented even if in a different userContextId.
+  add_ocsp_test("ocsp-stapling-none.example.com", PRErrorCodeSuccess, [],
+                "Noted OCSP server failure (userContextId = 2) -> a " +
+                "fetch should not have been attempted",
+                { userContextId: 2 });
+
+  //---------------------------------------------------------------------------
+
+  // Reset state
+  add_test(function() { clearOCSPCache(); run_next_test(); });
 }