summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/preload/resources/modulepreload-iframe.html
blob: 1d3d21f4d953ee1eac4fbc93e91f4a404d5f0c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<body>
    <script>
        const m = new URL('module1.js', location.href).toString();
        const observer = new PerformanceObserver(l => {
            const entries = l.getEntriesByName(m);
            if (entries.length === 1) {
                import(m).then(() => {
                    observer.disconnect();
                    const all = performance.getEntriesByName(m);
                    window.parent.postMessage(all.length, '*');
                });
            }
        });

        observer.observe({type: 'resource', buffered: true});


    </script>
</body>