diff options
Diffstat (limited to 'devtools/client/netmonitor/test/browser_net_send-beacon.js')
-rw-r--r-- | devtools/client/netmonitor/test/browser_net_send-beacon.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/test/browser_net_send-beacon.js b/devtools/client/netmonitor/test/browser_net_send-beacon.js index d47299ca7f..9d1f078bf5 100644 --- a/devtools/client/netmonitor/test/browser_net_send-beacon.js +++ b/devtools/client/netmonitor/test/browser_net_send-beacon.js @@ -7,6 +7,8 @@ * Tests if beacons are handled correctly. */ +const IFRAME_URL = EXAMPLE_URL + "html_send-beacon-late-iframe-request.html"; + add_task(async function () { const { tab, monitor } = await initNetMonitor(SEND_BEACON_URL, { requestCount: 1, @@ -40,5 +42,26 @@ add_task(async function () { is(request.status, "404", "The status is correct."); is(request.blockedReason, 0, "The request is not blocked"); + const onNetworkEvents = waitForNetworkEvents(monitor, 2); + await SpecialPowers.spawn( + tab.linkedBrowser, + [IFRAME_URL], + async function (url) { + const iframe = content.document.createElement("iframe"); + iframe.src = url; + content.document.body.appendChild(iframe); + await new Promise(resolve => (iframe.onload = resolve)); + iframe.remove(); + } + ); + await onNetworkEvents; + + // Request at index 1 will be the HTML page of the iframe + const lateRequest = getSortedRequests(store.getState())[2]; + is(lateRequest.method, "POST", "The method is correct."); + ok(lateRequest.url.endsWith("beacon_late_request"), "The URL is correct."); + is(lateRequest.status, "404", "The status is correct."); + is(lateRequest.blockedReason, 0, "The request is not blocked"); + return teardown(monitor); }); |