Updated checkup page tests

1. check that /api/config is reachable from the sandbox domain
2. check that interest-cohort rules are present rather than strict comparison of expected headers
pull/1/head
ansuz 3 years ago
parent 86bc75a590
commit 5835721322

@ -420,9 +420,11 @@ define([
$.ajax('/?'+ (+new Date()), { $.ajax('/?'+ (+new Date()), {
complete: function (xhr) { complete: function (xhr) {
var header = xhr.getResponseHeader('permissions-policy'); var header = xhr.getResponseHeader('permissions-policy') || '';
var rules = header.split(',');
if (rules.includes('interest-cohort=()')) { return void cb(true); }
printMessage(JSON.stringify(header)); printMessage(JSON.stringify(header));
cb(header === 'interest-cohort=()' || header); cb(header);
}, },
}); });
}); });
@ -896,6 +898,18 @@ define([
}); });
}); });
assert(function (cb, msg) {
msg.appendChild(h('span', 'pewpew'));
deferredPostMessage({
command: 'CHECK_HTTP_STATUS',
content: {
url: cacheBuster('/api/config'),
},
}, function (content) {
cb(content === 200 || content);
});
});
/* /*
assert(function (cb, msg) { assert(function (cb, msg) {
setWarningClass(msg); setWarningClass(msg);

@ -48,6 +48,15 @@ define([
}); });
}; };
COMMANDS.CHECK_HTTP_STATUS = function (content, cb) {
$.ajax(content.url, {
dataType: 'text',
complete: function (xhr) {
cb(xhr.status);
},
});
};
window.addEventListener("message", function (event) { window.addEventListener("message", function (event) {
var txid, command; var txid, command;
if (event && event.data) { if (event && event.data) {

Loading…
Cancel
Save