Bug 1518746: Add additional logging to test_accept_header.html. r=valentin
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 14 Jan 2019 19:36:26 +0000
changeset 453790 837ae1da7e4de5ba8ae3b4dfce0e4576dcd0adbb
parent 453789 0ee33312ad446d950b54b62cdc3cb1a4cf48cc87
child 453791 bb6af9b92cdf9aa3becad03e149ee1c265805452
push id35374
push usercbrindusan@mozilla.com
push dateTue, 15 Jan 2019 04:37:11 +0000
treeherdermozilla-central@a01a559aa611 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1518746
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518746: Add additional logging to test_accept_header.html. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D16485
netwerk/test/mochitests/test_accept_header.html
netwerk/test/mochitests/test_accept_header.sjs
--- a/netwerk/test/mochitests/test_accept_header.html
+++ b/netwerk/test/mochitests/test_accept_header.html
@@ -2,34 +2,34 @@
 <html>
 <head>
   <title>Accept header</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <script>
+SimpleTest.requestCompleteLog();
 
 // All the requests are sent to test_accept_header.sjs which will return
 // different content based on the queryString. When the queryString is 'get',
 // test_accept_header.sjs returns a JSON object with the latest request and its
 // accept header value.
 
 function test_last_request_and_continue(query, expected) {
   fetch("test_accept_header.sjs?get").then(r => r.json()).then(json => {
     is(json.type, query, "Expected: " + query);
     is(json.accept, expected, "Accept header: " + expected);
     next();
   });
 }
 
 function test_iframe() {
   let observer = new PerformanceObserver(function(list, obj) {
-    obj.disconnect();
-
+    list.getEntries().forEach(entry => info(entry.name));
     list.getEntries().forEach(entry => {
       if (entry.name.endsWith("test_accept_header.sjs?iframe")) {
         obj.disconnect();
         test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
       }
     });
   });
 
@@ -46,18 +46,17 @@ function test_image() {
   i.onload = function() {
     // Fetch spec says we should have: "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
     test_last_request_and_continue("image", "image/webp,*/*");
   }
 }
 
 function test_style() {
   let observer = new PerformanceObserver(function(list, obj) {
-    obj.disconnect();
-
+    list.getEntries().forEach(entry => info(entry.name));
     list.getEntries().forEach(entry => {
       if (entry.name.endsWith("test_accept_header.sjs?style")) {
         obj.disconnect();
         test_last_request_and_continue("style", "text/css,*/*;q=0.1");
       }
     });
   });
 
--- a/netwerk/test/mochitests/test_accept_header.sjs
+++ b/netwerk/test/mochitests/test_accept_header.sjs
@@ -1,13 +1,14 @@
 function handleRequest(request, response) {
   response.setStatusLine(request.httpVersion, "200", "OK");
+  dump(`test_accept_header ${request.path}?${request.queryString}\n`);
 
   if (request.queryString == "worker") {
-    response.setHeader("Content-Type", "application/json", false);
+    response.setHeader("Content-Type", "text/javascript", false);
     response.write("postMessage(42)");
 
     setState("data", JSON.stringify({type: "worker", accept: request.getHeader("Accept") }));
     return;
   }
 
   if (request.queryString == "image") {
     // A 1x1 PNG image.
@@ -34,15 +35,15 @@ function handleRequest(request, response
     response.setHeader("Content-Type", "text/html", false);
     response.write("<h1>Hello world!</h1>");
 
     setState("data", JSON.stringify({type: "iframe", accept: request.getHeader("Accept") }));
     return;
   }
 
   if (request.queryString == "get") {
-    response.setHeader("Content-Type", "text/javascript", false);
+    response.setHeader("Content-Type", "application/json", false);
     response.write(getState("data"));
 
     setState("data", "");
     return;
   }
 }