Forum Bugs

Ajax Errors

gtolenti
Hi,

I am currently experimenting with the AJAX capabilities of Prince. Every time I call xhr.open this appears in the console "prince: error: TypeError: invalid this value"

Sample Code:
xhReq.open("GET", "http://www.princexml.com", false);
xhReq.send();

No matter what URL I use the result is always the same.

I am also using a NodeJS Prince wrapper (https://www.npmjs.com/package/prince) which fails because of the TypeError.

When I run from the command line the PDF still gets generated despite the error, but when using the NodeJS wrapper it is considered an error condition and halts execution. Are there settings that will make this error go away? Am I calling open with the wrong parameters? Is this error really just a warning and not a real error?

I am using Prince 10 rev 6 on mac-osx and on the Amazon Web Services version of Linux through AWS Lambda (https://aws.amazon.com/lambda)

Thanks
mikeday
Prince doesn't have full support for AJAX yet. That said this is a bug relating to the onreadystatechange event dispatch not being handled properly and triggering a spurious error message. Sorry about that, we will fix this in the next release.
gtolenti
Thanks for the quick reply!
mikeday
This issue is now fixed in the latest build. However, Prince still only supports a small subset of AJAX, eg. only GET, all requests are synchronous, not all object methods are supported, etc.
gtolenti
That's great, thanks for the update.