Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/cors/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 3 kB image not shown  

Quelle  remote-origin.htm

  Sprache: HTML
 

 products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/cors/remote-origin.htm


<!DOCTYPE html>
<meta charset=utf-8>
<title>Access-Control-Allow-Origin handling</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=support.js?pipe=sub></script>

<h1>Access-Control-Allow-Origin handling</h1>

<div id=log></div>

<script>

var remote_tests = [];
var iframe = document.createElement("iframe")
iframe.src = CROSSDOMAIN + 'resources/remote-xhrer.html';
document.body.appendChild(iframe);

function reverseOrigin(expect_pass, origin)
{
    var real_origin = origin.replace("<host>", REMOTE_HOST)
                        .replace("<remote_origin>", location.protocol + "//" + location.host)
                        .replace("<origin>", REMOTE_ORIGIN)
                        .replace("<protocol>", REMOTE_PROTOCOL)
                        .replace("<HOST>", REMOTE_HOST.toUpperCase())
                        .replace("<ORIGIN>", REMOTE_ORIGIN.toUpperCase())
                        .replace("<PROTOCOL>", REMOTE_PROTOCOL.toUpperCase());

    var t = async_test((expect_pass ? 'Allow origin: ' : 'Disallow origin: ') + real_origin
                            .replace(/\0/g, "\\0")
                            .replace(/\t/g, "[tab]")
                            .replace(/ /g, '_'));
    t.step(function() {
        this.test_url = dirname(location.href)
                            + 'resources/cors-makeheader.py?origin='
                            + encodeURIComponent(real_origin);
        iframe.contentWindow.postMessage({ url: this.test_url, origin: origin }, "*");
    });

    if (expect_pass)
    {
        t.callback = t.step_func(function(e) {
            assert_equals(e.state, "load");
            r = JSON.parse(e.response)
            assert_equals(r['origin'], REMOTE_ORIGIN, 'Request Origin: should be ' + REMOTE_ORIGIN)
            this.done();
        });
    }
    else
    {
        t.callback = t.step_func(function(e) {
            assert_equals(e.state, "error");
            assert_equals(e.response, "");
            this.done();
        });
    }

    remote_tests[origin] = t;
}

function shouldPass(origin) { reverseOrigin(true, origin); }
function shouldFail(origin) { reverseOrigin(false, origin); }


iframe.onload = function() {
    shouldPass('*');
    shouldPass(' *  ');
    shouldPass(' *');
    shouldPass("<origin>");
    shouldPass(" <origin>");
    shouldPass(" <origin>     ");
    shouldPass(" <origin>");

    shouldFail("<remote_origin>")
    shouldFail("//" + "<host>")
    shouldFail("://" + "<host>")
    shouldFail("ftp://" + "<host>")
    shouldFail("http:://" + "<host>")
    shouldFail("http:/" + "<host>")
    shouldFail("http:" + "<host>")
    shouldFail("<host>")
    shouldFail("<origin>" + "?")
    shouldFail("<origin>" + "/")
    shouldFail("<origin>" + " /")
    shouldFail("<origin>" + "#")
    shouldFail("<origin>" + "%23")
    shouldFail("<origin>" + ":80")
    shouldFail("<origin>" + ", *")
    shouldFail("<origin>" + "\0")
    shouldFail(("<ORIGIN>"))
    shouldFail("<PROTOCOL>//<host>")
    shouldFail("<protocol>//<HOST>")
    shouldFail("-")
    shouldFail("**")
    shouldFail("\0*")
    shouldFail("*\0")
    shouldFail("'*'")
    shouldFail('"*"')
    shouldFail("* *")
    shouldFail("*" + "<protocol>" + "//" + "*")
    shouldFail("*" + "<origin>")
    shouldFail("* " + "<origin>")
    shouldFail("*, " + "<origin>")
    shouldFail("\0" + "<origin>")
    shouldFail("null " + "<origin>")
    shouldFail('http://example.net')
    shouldFail('null')
    shouldFail('')
    shouldFail(location.href)
    shouldFail(dirname(location.href))
    shouldFail(CROSSDOMAIN)
}

window.addEventListener("message", function(e) {
    remote_tests[e.data.origin].callback(e.data);
});

add_completion_callback(function() {
    iframe.parentElement.removeChild(iframe);
});
</script>

Messung V0.5 in Prozent
C=99 H=100 G=99

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-06-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.