How will the Chakra Jscript engine be exposed to Scripting Hosts?

1.6k Views Asked by At

Anybody has experience with the upcoming IE9 Chakra engine? I am currently considering whether to incorporate the Microsoft's JScript engine through the Window Script Interface or using one of those open source javascript engines (tracemonkey/v8 etc).

The JScript engine is a bit too slow and Chakra looks promising. But I am not sure if it will be accessible the same way as before since Active Scripting should be deprecated.

Anybody get some idea?

2

There are 2 best solutions below

0
On BEST ANSWER

I'm not aware that ActiveScripting is deprecated - I've seen no statement from Microsoft along those lines.

Microsoft's documentation suggests that IE9's Javascript engine (code-named "chakra") still gets loaded by IActiveScript. Though MS does not document a ProgId or CLSID, there is a CLSID you can use:

{16d51579-a30b-4c8b-a276-0ff4dc41e755}

The C# code to load the Chakra scripting engine looks like this:

    var guid = new System.Guid("{16d51579-a30b-4c8b-a276-0ff4dc41e755}");
    Type engineType = Type.GetTypeFromCLSID(guid, true);
    var engine = Activator.CreateInstance(engineType) as IActiveScript;

In my limited tests in various micro-benchmarks, Chakra is about 2x the speed of JScript v5.8.

See also:
What is the ProgId or CLSID for IE9's Javascript engine (code-named "Chakra")

0
On

You may be interested in checking this out too: JavaScript Runtime Hosting

It's not ActiveScript but it gives you very low level access to Chakra in a very nice new API.