summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/the-select-element/resources/show-picker-child-iframe.html
blob: bba39898249d508b5e01741b3fb631a327d86858 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<title>Test showPicker() in an iframe</title>
<script type=module>
    const urlParams = new URLSearchParams(location.search);
    const documentDomain = urlParams.get('documentDomain');
    if (documentDomain) {
        document.domain = documentDomain;
    }

    let securityErrors = [];
    const select = document.createElement("select");
    try {
        select.showPicker();
    } catch (error) {
        if (error instanceof DOMException && error.name == 'SecurityError') {
            securityErrors.push("select");
        }
    }
    parent.postMessage(securityErrors.join(','), "*");
</script>