<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that the value returned from a beforeunload event handler gets converted to a string, even if the returnValue property was already set.");
jsTestIsAsync = true;

const iframe = document.createElement("iframe");
iframe.onload = function() {
    iframe.onload = null;
    iframe.contentWindow.runTest();
};

iframe.src = "resources/before-unload-return-string-conversion-frame.html";
document.body.appendChild(iframe);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
