Files
firefox/devtools/shared/webconsole/test/browser/network_requests_iframe.html
T
Alexandre Poirot 7b12165a46 Bug 1520782 - Convert console tests using chrome documents and using server references directly to browser mochitests. r=nchevobbe
These two tests were using chrome mochitest which forces the test page to be running in chrome and in parent process.
This doesn't reflect typical setup where the page runs unprivileged in content process.
Also, with the current bug, the pages running in system principal will be debugged with a special setup.
Actors will be run with modules loaded in a distinct loader in order to be executed
in a distinct compartment, distinct from the shared system principal compartment.
That a prerequisite for the Debugger API. It has to run in a distinct compartment than its debuggee.

Depends on D16826

Differential Revision: https://phabricator.services.mozilla.com/D16827
2019-01-23 08:53:06 +00:00

67 lines
2.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Console HTTP test page</title>
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<script type="text/javascript"><!--
"use strict";
let setAllowAllCookies = false;
function makeXhr(method, url, requestBody, callback) {
// On the first call, allow all cookies and set cookies, then resume the actual test
if (!setAllowAllCookies) {
SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]},
function() {
setAllowAllCookies = true;
setCookies();
makeXhrCallback(method, url, requestBody, callback);
});
} else {
makeXhrCallback(method, url, requestBody, callback);
}
}
function makeXhrCallback(method, url, requestBody, callback) {
const xmlhttp = new XMLHttpRequest();
xmlhttp.open(method, url, true);
if (callback) {
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
callback();
}
};
}
xmlhttp.send(requestBody);
}
/* exported testXhrGet */
function testXhrGet(callback) {
makeXhr("get", "data.json", null, callback);
}
/* exported testXhrPost */
function testXhrPost(callback) {
const body = "Hello world! " + "foobaz barr".repeat(50);
makeXhr("post", "data.json", body, callback);
}
function setCookies() {
document.cookie = "foobar=fooval";
document.cookie = "omgfoo=bug768096";
document.cookie = "badcookie=bug826798=st3fan";
}
</script>
</head>
<body>
<h1>Web Console HTTP Logging Testpage</h1>
<h2>This page is used to test the HTTP logging.</h2>
<form action="?" method="post">
<input name="name" type="text" value="foo bar"><br>
<input name="age" type="text" value="144"><br>
</form>
</body>
</html>