Greetings from a sunny Guildford,
We are happy to announce a new WebVM SDK 0.16.4774 release. The API version has been updated to 0.12.
UPDATE (20090727) Linux versions of the new WebVM release for x86 are available now.
Note you will need to adjust existing module source code in order to make it compliant with the new API 0.12 version. See the updated error reporting below for further details.
This release contains several bugfixes and some major changes regarding error reporting, it also contains an updated widl2c tool.
The error reporting in the SDK has changed significantly. The WVMError type has been removed, instead errors are reported through a newly introduced isError flag in the WVMVariant type. Most <TYPE>_TO_WVMVARIANT macros have been extended with an additional isError argument that should be true (or 1) if the resulting variant value should be thrown/reported as an error to JavaScript, or false (0) otherwise.
As an example, let’s have a look at the get42 function of the simpler module:
static WVMStatus get42(WVM *instance, WVMObjectReference ref, WVMVariant *vArgs, WVMVariant *vResultArgs) {
static WVMPermissionQuery permQuery = { &features[FeatureTestGet42], NULL };
WVMDecision decision;
Instance *inst = (Instance *)instance->mData;
inst->wvcf->checkPermission(instance, &permQuery, 0, &decision);
if(decision == Decision_Permit) {
INT32_TO_WVMVARIANT(42, vResultArgs, 0);
return OK;
}
else {
STRING_TO_WVMVARIANT("Permission denied", NULL, vResultArgs, 1);
return Error_Native;
}
}
Instead of assigning a WVMError value to the vResultArgs using the removed
ERROR_TO_WVMVARIANT macro, now you assign any variant value you like to the
result variant with a true isError flag (the last argument in most conversion
macros) and return with some error code that is not 0.
Note the only exception of conversion macros that do not support the isError flag are:
NULL_TO_WVMVARIANTVOID_TO_WVMVARIANTThat’s because we don’t support raising null or undefined in JavaScript.
Also note that the error reporting is still limited by ActiveX and NPAPI limitations. Currently only strings can be thrown in a portable and platform-agnostic way. We are proposing a change to the NPAPI in order to gain full support for this new technique, which is currently under consideration.
You can re-use your WebVM SDK download URL from your mail Inbox or re-register at sdk.webvm.net. You can also check here to ensure you are running the very latest WebVM.
Did you know, that we published widlproc under an Open Source license?
Also, have you seen the blog on Initial permission persistency? It offers a good introduction to the Security Manager, which consumes security policies.