<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../resources/inspector-test.js"></script>
<script>
function test()
{
    let suite = InspectorTest.createAsyncSuite("Target.PSON");

    suite.addTestCase({
        name: "InlineDebuggerStatement",
        description: "Check that new provisional page can be paused before navigation.",
        async test() {
            const url = "http://localhost:8000/inspector/target/resources/inline-debugger-statement.html";
            WI.mainTarget.PageAgent.navigate(url);

            await WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused);

            // Wait for page reload event to avoid race between test results flushing and the test completion.
            await Promise.all([
                InspectorTest.awaitEvent(FrontendTestHarness.Event.TestPageDidLoad),
                WI.debuggerManager.resume()
            ]);

            InspectorTest.pass(`Should pause on debugger statement.`);
        }
    });

    suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Test that execution will break on inline 'debugger' statement after cross-origin navigation.</p>
</body>
</html>
