mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 02:05:37 +02:00
[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:
parent
e64bc1fd13
commit
42f07c6262
3 changed files with 73 additions and 13 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue