// Reload to have one request in the list
let waitForEvents = waitForNetworkEvents(monitor, 1);
await navigateTo(HTTPS_SIMPLE_URL);
await waitForEvents;
// Capture normal request
let normalRequestState;
let normalRequestSize;
let normalHeadersSectionSize;
let normalFirstHeaderSectionTitle;
{ // Wait for the response and request header sections const waitForHeaderSections = waitForDOM(
document, "#headers-panel .accordion-item",
2
);
info("Wait for selected request to be blocked");
await onRequestBlocked;
info("Selected request is now blocked");
}
// Reload to have one request in the list
info("Reloading to check block"); // We can't use the normal waiting methods because a canceled request won't send all // the extra update packets.
waitForEvents = waitForNetworkEvents(monitor, 1);
tab.linkedBrowser.reload();
await waitForEvents;
// Capture blocked request, then unblock
let blockedRequestState;
let blockedRequestSize;
let blockedHeadersSectionSize;
let blockedFirstHeaderSectionTitle;
{ const waitForHeaderSections = waitForDOM(
document, "#headers-panel .accordion-item",
1
);
info("Wait for selected request to be unblocked");
await onRequestUnblocked;
info("Selected request is now unblocked");
}
// Reload to have one request in the list
info("Reloading to check unblock");
waitForEvents = waitForNetworkEvents(monitor, 1);
await reloadBrowser();
await waitForEvents;
ok(!normalRequestState.blockedReason, "Normal request is not blocked");
ok(!normalRequestSize.includes("Blocked"), "Normal request has a size"); Assert.equal(normalHeadersSectionSize, 2, "Both header sections are showing");
ok(
normalFirstHeaderSectionTitle.includes("Response"), "The response header section is visible for normal requests"
);
ok(blockedRequestState.blockedReason, "Blocked request is blocked");
ok(
blockedRequestSize.includes("Blocked"), "Blocked request shows reason as size"
); Assert.equal(
blockedHeadersSectionSize,
1, "Only one header section is showing"
);
ok(
blockedFirstHeaderSectionTitle.includes("Request"), "The response header section is not visible for blocked requests"
);
ok(!unblockedRequestState.blockedReason, "Unblocked request is not blocked");
ok(!unblockedRequestSize.includes("Blocked"), "Unblocked request has a size");
return teardown(monitor);
});
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet)
¤
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 ist noch experimentell.