[api-minor] Use the new URL constructor when validating URLs in annotations and the outline, as a complement to only checking the protocol, and add a bit more validation to Catalog_parseDestDictionary

Note that this will automatically reject any relative URL.
To make the API more useful to consumers, URLs that are rejected will be available via the `unsafeUrl` property in the data object returned by `PDFPageProxy_getAnnotations`.

The patch also adds a bit more validation of the data for `Named` actions.
This commit is contained in:
Jonas Jenwald 2016-09-30 16:32:22 +02:00
parent e64bc1fd13
commit 42f07c6262
3 changed files with 73 additions and 13 deletions

View file

@ -643,7 +643,7 @@ describe('api', function() {
var outlineItemTwo = outline[2];
expect(typeof outlineItemTwo.title).toEqual('string');
expect(outlineItemTwo.dest).toEqual(null);
expect(outlineItemTwo.url).toEqual('http://google.com');
expect(outlineItemTwo.url).toEqual('http://google.com/');
expect(outlineItemTwo.newWindow).toBeUndefined();
var outlineItemOne = outline[1];