Backed out changeset 2ab63d0cea9f (bug 1267474)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 11 May 2016 16:10:27 +0200
changeset 296983 5b8f356e9556
parent 296982 bb36d2769fe3
child 296984 be7b95b5e548
push id76545
push usercbook@mozilla.com
push date2016-05-11 14:11 +0000
treeherdermozilla-inbound@e12666c3fccb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1267474
milestone49.0a1
backs out2ab63d0cea9f
Backed out changeset 2ab63d0cea9f (bug 1267474)
netwerk/test/unit/test_immutable.js
netwerk/test/unit/xpcshell.ini
testing/xpcshell/moz-http2/moz-http2.js
deleted file mode 100644
--- a/netwerk/test/unit/test_immutable.js
+++ /dev/null
@@ -1,180 +0,0 @@
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
-var prefs;
-var spdypref;
-var http2pref;
-var tlspref;
-var origin;
-
-function run_test() {
-  var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
-  var h2Port = env.get("MOZHTTP2_PORT");
-  do_check_neq(h2Port, null);
-  do_check_neq(h2Port, "");
-
-  // Set to allow the cert presented by our H2 server
-  do_get_profile();
-  prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
-
-  spdypref = prefs.getBoolPref("network.http.spdy.enabled");
-  http2pref = prefs.getBoolPref("network.http.spdy.enabled.http2");
-  tlspref = prefs.getBoolPref("network.http.spdy.enforce-tls-profile");
-
-  prefs.setBoolPref("network.http.spdy.enabled", true);
-  prefs.setBoolPref("network.http.spdy.enabled.http2", true);
-  prefs.setBoolPref("network.http.spdy.enforce-tls-profile", false);
-  prefs.setCharPref("network.dns.localDomains", "foo.example.com, bar.example.com");
-
-  // The moz-http2 cert is for foo.example.com and is signed by CA.cert.der
-  // so add that cert to the trust list as a signing cert.  // the foo.example.com domain name.
-  let certdb = Cc["@mozilla.org/security/x509certdb;1"]
-                  .getService(Ci.nsIX509CertDB);
-  addCertFromFile(certdb, "CA.cert.der", "CTu,u,u");
-
-  origin = "https://foo.example.com:" + h2Port;
-  dump ("origin - " + origin + "\n");
-  doTest1();
-}
-
-function resetPrefs() {
-  prefs.setBoolPref("network.http.spdy.enabled", spdypref);
-  prefs.setBoolPref("network.http.spdy.enabled.http2", http2pref);
-  prefs.setBoolPref("network.http.spdy.enforce-tls-profile", tlspref);
-  prefs.clearUserPref("network.dns.localDomains");
-}
-
-function readFile(file) {
-  let fstream = Cc["@mozilla.org/network/file-input-stream;1"]
-                  .createInstance(Ci.nsIFileInputStream);
-  fstream.init(file, -1, 0, 0);
-  let data = NetUtil.readInputStreamToString(fstream, fstream.available());
-  fstream.close();
-  return data;
-}
-
-function addCertFromFile(certdb, filename, trustString) {
-  let certFile = do_get_file(filename, false);
-  let der = readFile(certFile);
-  certdb.addCert(der, trustString, null);
-}
-
-function makeChan(origin, path) {
-  return NetUtil.newChannel({
-    uri: origin + path,
-    loadUsingSystemPrincipal: true
-  }).QueryInterface(Ci.nsIHttpChannel);
-}
-
-var nextTest;
-var expectPass = true;
-var expectConditional = false;
-
-var Listener = function() {};
-Listener.prototype = {
-  onStartRequest: function testOnStartRequest(request, ctx) {
-    do_check_true(request instanceof Components.interfaces.nsIHttpChannel);
-
-    if (expectPass) {
-      if (!Components.isSuccessCode(request.status)) {
-        do_throw("Channel should have a success code! (" + request.status + ")");
-      }
-      do_check_eq(request.responseStatus, 200);
-    } else {
-      do_check_eq(Components.isSuccessCode(request.status), false);
-    }
-  },
-
-  onDataAvailable: function testOnDataAvailable(request, ctx, stream, off, cnt) {
-    read_stream(stream, cnt);
-  },
-
-  onStopRequest: function testOnStopRequest(request, ctx, status) {
-      if (expectConditional) {
-        do_check_eq(request.getResponseHeader("x-conditional"), "true");
-      } else {
-	  try { do_check_neq(request.getResponseHeader("x-conditional"), "true"); }
-	  catch (e) { do_check_true(true); }
-    }
-    nextTest();
-    do_test_finished();
-  }
-};
-
-function testsDone()
-{
-  dump("testDone\n");
-  resetPrefs();
-}
-
-function doTest1()
-{
-  dump("execute doTest1 - resource without immutable. initial request\n");
-  do_test_pending();
-  expectConditional = false;
-  var chan = makeChan(origin, "/immutable-test-without-attribute");
-  var listener = new Listener();
-  nextTest = doTest2;
-  chan.asyncOpen2(listener);
-}
-
-function doTest2()
-{
-  dump("execute doTest2 - resource without immutable. reload\n");
-  do_test_pending();
-  expectConditional = true;
-  var chan = makeChan(origin, "/immutable-test-without-attribute");
-  var listener = new Listener();
-  nextTest = doTest3;
-  chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
-  chan.asyncOpen2(listener);
-}
-
-function doTest3()
-{
-  dump("execute doTest3 - resource without immutable. shift reload\n");
-  do_test_pending();
-  expectConditional = false;
-  var chan = makeChan(origin, "/immutable-test-without-attribute");
-  var listener = new Listener();
-  nextTest = doTest4;
-  chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
-  chan.asyncOpen2(listener);
-}
-
-function doTest4()
-{
-  dump("execute doTest1 - resource with immutable. initial request\n");
-  do_test_pending();
-  expectConditional = false;
-  var chan = makeChan(origin, "/immutable-test-with-attribute");
-  var listener = new Listener();
-  nextTest = doTest5;
-  chan.asyncOpen2(listener);
-}
-
-function doTest5()
-{
-  dump("execute doTest5 - resource with immutable. reload\n");
-  do_test_pending();
-  expectConditional = false;
-  var chan = makeChan(origin, "/immutable-test-with-attribute");
-  var listener = new Listener();
-  nextTest = doTest6;
-  chan.loadFlags = Ci.nsIRequest.VALIDATE_ALWAYS;
-  chan.asyncOpen2(listener);
-}
-
-function doTest6()
-{
-  dump("execute doTest3 - resource with immutable. shift reload\n");
-  do_test_pending();
-  expectConditional = false;
-  var chan = makeChan(origin, "/immutable-test-with-attribute");
-  var listener = new Listener();
-  nextTest = testsDone;
-  chan.loadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE;
-  chan.asyncOpen2(listener);
-}
-
-
--- a/netwerk/test/unit/xpcshell.ini
+++ b/netwerk/test/unit/xpcshell.ini
@@ -219,17 +219,16 @@ skip-if = bits != 32
 [test_httpResponseTimeout.js]
 [test_httpsuspend.js]
 [test_idnservice.js]
 [test_idn_blacklist.js]
 [test_idn_urls.js]
 [test_idna2008.js]
 # IDNA2008 depends on ICU, not available on android
 skip-if = os == "android"
-[test_immutable.js]
 [test_invalidport.js]
 [test_localstreams.js]
 [test_mismatch_last-modified.js]
 [test_MIME_params.js]
 [test_mozTXTToHTMLConv.js]
 [test_multipart_byteranges.js]
 [test_multipart_streamconv.js]
 [test_multipart_streamconv_missing_lead_boundary.js]
--- a/testing/xpcshell/moz-http2/moz-http2.js
+++ b/testing/xpcshell/moz-http2/moz-http2.js
@@ -710,34 +710,16 @@ function handleRequest(req, res) {
 
   else if (u.pathname === "/emptydata") {
     // Overwrite the original transform with our version that will insert an
     // empty DATA frame at the beginning of the stream response, then fall
     // through to the default response behavior.
     Serializer.prototype._transform = newTransform;
   }
 
-  // for use with test_immutable.js
-  else if (u.pathname === "/immutable-test-without-attribute") {
-     res.setHeader('Cache-Control', 'max-age=100000');
-     res.setHeader('Etag', '1');
-     if (req.headers["if-none-match"]) {
-       res.setHeader("x-conditional", "true");
-     }
-    // default response from here
-  }
-  else if (u.pathname === "/immutable-test-with-attribute") {
-    res.setHeader('Cache-Control', 'max-age=100000, immutable');
-    res.setHeader('Etag', '2');
-     if (req.headers["if-none-match"]) {
-       res.setHeader("x-conditional", "true");
-     }
-   // default response from here
-  }
-
   res.setHeader('Content-Type', 'text/html');
   if (req.httpVersionMajor != 2) {
     res.setHeader('Connection', 'close');
   }
   res.writeHead(200);
   res.end(content);
 }