<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
<script src="../../../fast/js/resources/js-test-pre.js"></script>
<script>
if (window.layoutTestController) {
    layoutTestController.overridePreference("WebKitJavaEnabled", "1");
    layoutTestController.waitUntilDone();
}
</script>
</head>
<body onload="onload()">

<div id="console"></div>

<object
  classid="clsid:CAFEEFAC-0015-0000-0000-ABCDEFFEDCBA"
  width=500
  height=200
  <param name="codebase" value="../../../java">
  <param name="code" value="lc3.class">
  <param name="archive" value="jstests.jar">
  <comment>
    <embed
      code="lc3.class"
      codebase="../../../java"
      archive="jstests.jar"
      type="application/x-java-applet"
      width=500
      height=200>
    <noembed>
      No Java Support.
    </noembed>
  </comment>
</object>


<script>
function startTest()
{
    window.applet = document.getElementsByTagName("embed")[0];
    if (!applet.createQAObject)
        window.applet = document.getElementsByTagName("object")[0];

    debug(TITLE + "\n");
}

function shouldBeWithErrorCheck(_a, _b)
{
    // Don't want full stack traces from Java exceptions.
    if (window.layoutTestController) {
        try {
            eval(_a);
        } catch (ex) {
            if (/Caused by: /.test(ex)) {
                testFailed(_a + ": Exception raised");
                return;
            }
        }
    }

    var b_eval;
    try {
        b_eval = eval(_b);
    } catch (ex) {
        testFailed(_b + ": " + ex);
        return;
    }

    if (b_eval == "error")
        shouldThrow(_a);
    else
        shouldBe(_a, _b);
}

function wkTestStringToJavaByteArray(string)
{
    return applet.stringToByteArray(string);
}

function appendScript(text)
{
    var el = document.createElement("script")
    el.appendChild = document.createTextNode(text);
    document.body.appendChild(el);
}

function onload()
{
    try {
        var req = new XMLHttpRequest();
        req.open("GET", window.location.pathname.replace(/html$/, "js"), false);
        if (req.overrideMimeType)
            req.overrideMimeType("text/plain");
        req.send();

        if (!req.responseText.length)
            throw "could not load test script";

        var scriptElement = document.createElement("script")
        scriptElement.appendChild(document.createTextNode(
            req.responseText + "\n" + 
            "successfullyParsed = true;\n"));
        document.body.appendChild(scriptElement);
    } catch (ex) {
        testFailed("Could not run test: " + ex);
    }

    scriptElement = document.createElement("script")
    scriptElement.src = '../../../fast/js/resources/js-test-post-async.js'
    document.body.appendChild(scriptElement);
}
</script>
</body>
</html>
