Bug 1546509 - Add back the script test case to browser_referrerDefaultPolicy.js; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D28565

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-04-24 12:27:23 +00:00
Родитель b949ce10fd
Коммит 8a23f4f295
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -1,4 +1,4 @@
requestLongerTimeout(4);
requestLongerTimeout(8);
const CHROME_BASE = "chrome://mochitests/content/browser/browser/base/content/test/general/";
Services.scriptloader.loadSubScript(CHROME_BASE + "head.js", this);
@ -14,6 +14,17 @@ async function testOnWindow(private, expectedReferrer, rp) {
info("Loading tracking scripts and tracking images");
await ContentTask.spawn(b, {rp}, async function({rp}) {
{
let src = content.document.createElement("script");
let p = new content.Promise(resolve => { src.onload = resolve; });
content.document.body.appendChild(src);
if (rp) {
src.referrerPolicy = rp;
}
src.src = "https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/referrer.sjs?what=script";
await p;
}
{
let img = content.document.createElement("img");
let p = new content.Promise(resolve => { img.onload = resolve; });
@ -26,6 +37,12 @@ async function testOnWindow(private, expectedReferrer, rp) {
}
});
await fetch("https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/referrer.sjs?result&what=script")
.then(r => r.text())
.then(text => {
is(text, expectedReferrer, "We sent the correct Referer header");
});
await fetch("https://tracking.example.org/browser/toolkit/components/antitracking/test/browser/referrer.sjs?result&what=image")
.then(r => r.text())
.then(text => {