In terms of Windows 10, probably the biggest thing to happen to the JsRT APIs in Windows was the IE/Edge browser split.
For anyone who’s been living under a rock, Microsoft introduced a new browser in Windows 10 called Edge (neé Project Spartan). Edge basically represents a fork in the road for the web browser codebase at Microsoft: down one path the IE code will continue on, largely unchanged and preserving all that crufty backwards compatibility we all love to hate, and down another path will go Edge, discarding all the legacy shackles of IE and committing to a thoroughly modern browser experience.
And, just as the browser now splits into IE and Edge, so does the underlying JavaScript engine, Chakra. There are now two (yes, two!) JsRT APIs:
- The “legacy” JsRT APIs that are exposed by jscript9.dll (the one that IE uses), have not changed since Windows 8.1, and will not be added to.
- The “Edge” JsRT APIs that are exposed by chakra.dll (the one that Edge uses), have some breaking changes since Windows 8.1, and will be updated as the Edge browser moves forward.
You can find more details on the breaking changes that were made to the Edge JsRT on MSDN, but in a nutshell they are:
- In C++ you #define USE_EDGEMODE_JSRT before including jsrt.h, and you link against chakrart.lib instead of jsrt.lib.
- In C# and VB, you target your PInvoke declarations at chakra.dll instead of jscript9.dll.
- The “version” parameter of JsCreateRuntime disappears (since there will only ever be one evergreen version of the Edge Chakra).
- The debugging no longer requires an IDebugApplication. Thus, JsStartDebugging and JsCreateContext lose a parameter.
The last bullet point may seem a little odd and arbitrary. The reason is that the Edge version of the JsRT API is now supported as a part of the UWP (Universal Windows Platform). That means that a “modern” UWP application can host the Edge Chakra runtime and still qualify for the Windows Store (i.e. it won’t be rejected for using non-UWP APIs). To get there, though, the Chakra team needed to remove things that don’t work on the UWP, namely talking to the PDM (Process Debug Manager), which is what you need to get an IDebugApplication. Since it turns out in almost every possible case you don’t need to be able to supply your own IDebugApplication, Chakra now just acquires one on your behalf.
I’ve updated my chakra-host sample on GitHub to include samples that show hosting both “legacy” and “edge” JsRT on Windows 10. I’ve also added a new sample to the Windows Samples showing this. The Chakra team also now has a GitHub repo where they host their own samples.
You should also follow me on Twitter here.