зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1424076 - P4 Update sendBeacon origin header test r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D33386 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b2fcce7a1e
Коммит
5e98826855
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1280692 - navigator.sendBeacon() should not send origin header</title>
|
||||
<title>Bug 1280692 - navigator.sendBeacon() should send origin header</title>
|
||||
<!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
@ -17,13 +17,12 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const BEACON_URL = "http://example.com/tests/dom/tests/mochitest/beacon/beacon-originheader-handler.sjs";
|
||||
// no origin header should be sent with sendBeacon request;
|
||||
// server returns any origin-header or 'no-header' if there is no header sent.
|
||||
const ORIGIN_HEADER = "no-header";
|
||||
const ORIGIN_HEADER = "http://mochi.test:8888";
|
||||
|
||||
/* Description of the test:
|
||||
* We call sendBeacon() cross origin and make sure that the
|
||||
* origin header is actually *not* set in the request.
|
||||
* origin header is actually set in the request.
|
||||
*
|
||||
* Since sendBeacon() does not expect any response, we are storing any
|
||||
* header on the server (*.sjs) and use an XMLHttpRequest to actually
|
||||
|
@ -41,7 +40,7 @@ function queryHeaderFromServer() {
|
|||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "beacon-originheader-handler.sjs?queryheader", true);
|
||||
xhr.onload = function() {
|
||||
is(xhr.responseText, ORIGIN_HEADER, "SendBeacon should not send origin header");
|
||||
is(xhr.responseText, ORIGIN_HEADER, "SendBeacon should send origin header");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче