Bug 1232631 - Write tests for network part of
bug 1137681
Edited some formatting. Otherwise the file remains unchanged.
I wanted help modifying the function
isnot(getUA(location.origin), UA_OVERRIDE,
"User-Agent is not reverted");
since both Dylan and Olli say they are not familiar enough with the code
to propose how the function should be modified to suit the comments made
starting here: https://bugzilla.mozilla.org/show_bug.cgi?id=1232631#c3
MozReview-Commit-ID: CEKPZZAuZu4
--- a/netwerk/test/mochitests/test_user_agent_updates_reset.html
+++ b/netwerk/test/mochitests/test_user_agent_updates_reset.html
@@ -1,28 +1,29 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=942470
-->
<head>
- <title>Test for Bug 942470</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+<title>Test for Bug 942470</title>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=942470">Mozilla Bug 942470</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 942470 **/
-function getUA(host) {
+function getUA(host)
+{
var url = location.pathname;
url = host + url.slice(0, url.lastIndexOf('/')) + '/user_agent.sjs';
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false); // sync request
xhr.send();
is(xhr.status, 200, 'request failed');
is(typeof xhr.response, 'string', 'invalid response');