Chakra is the code-name of the updated Javascript engine Microsoft packaged into IE9.
It's possible to use JScript as the development language for an ASP Classic page. This normally runs on the JScript engine built-in to Windows, something that has been present in all versions of Windows since NT4 Option Pack (c.1996).
The question is, it is possible to use Javascript running on the Chakra engine, for ASP purposes?
Apparently not.
I tried with this simple sample script:
<%@ language="Javascript" %>
<script language="Javascript" runat="server" src='json2.js'></script>
<script language="Javascript" runat="server">
(function() {
scriptEngineInfo = function () {
var s = {
engine : ScriptEngine(),
version: {
major: ScriptEngineMajorVersion(),
minor:ScriptEngineMinorVersion()
},
build: ScriptEngineBuildVersion()
};
return s;
}
}());
var x = scriptEngineInfo();
x.Timestamp = (new Date()).valueOf();
Response.Write (JSON.stringify(x));
</script>
When "Javascript" is the name of the language, as above, I get this result:
{
"engine": "JScript",
"version": {
"major": 5,
"minor": 8
},
"build": 16982,
"Timestamp": 1331866901948
}
When I do as suggested in this answer and configure Chakra as a named scripting engine, then replace the three occurrences of "Javascript" in the above script with "Chakra", then run the "page", I get correct, expected results:
{
"engine": "JScript",
"version": {
"major": 9,
"minor": 0
},
"build": 16441,
"Timestamp": 1331867213695
}
The major version of 9 shows I am using Chakra.
BUT if I then re-request the same script, it fails with a 500 error, saying:
Can't execute code from a freed script
If I try again, it gives me
A trappable error (C0000005) occurred in an external object. The script cannot continue running.
If I try again, I get:
A ScriptEngine threw exception 'C0000005' in 'IActiveScript::GetScriptState()' from 'CActiveScriptEngine::ReuseEngine()'.
This is repeatable, for this script, on my machine.
From this I conclude that Chakra has not been engineered for the ASP environment.