mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Reject getDestination
, in the API, for non-string inputs
Note how e.g. the `getPage` method does basic validation of the input.
This commit is contained in:
parent
b74c813353
commit
1179584fd6
2 changed files with 30 additions and 1 deletions
|
@ -627,7 +627,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
|||
return this.transport.getDestinations();
|
||||
},
|
||||
/**
|
||||
* @param {string} id The named destination to get.
|
||||
* @param {string} id - The named destination to get.
|
||||
* @return {Promise} A promise that is resolved with all information
|
||||
* of the given named destination.
|
||||
*/
|
||||
|
@ -2119,6 +2119,9 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
},
|
||||
|
||||
getDestination: function WorkerTransport_getDestination(id) {
|
||||
if (typeof id !== 'string') {
|
||||
return Promise.reject(new Error('Invalid destination request.'));
|
||||
}
|
||||
return this.messageHandler.sendWithPromise('GetDestination', {
|
||||
id,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue