mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Deprecate the isValidUrl
utility function and replace it with createValidAbsoluteUrl
/isValidProtocal
functions instead, since the main URL validation is now done using the new URL
constructor
This commit is contained in:
parent
42f07c6262
commit
71a781ee5c
7 changed files with 49 additions and 31 deletions
|
@ -28,6 +28,8 @@
|
|||
|
||||
var removeNullCharacters = sharedUtil.removeNullCharacters;
|
||||
var warn = sharedUtil.warn;
|
||||
var deprecated = sharedUtil.deprecated;
|
||||
var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl;
|
||||
|
||||
/**
|
||||
* Optimised CSS custom property getter/setter.
|
||||
|
@ -229,9 +231,16 @@ function isExternalLinkTargetSet() {
|
|||
}
|
||||
}
|
||||
|
||||
function isValidUrl(url, allowRelative) {
|
||||
deprecated('isValidUrl(), please use createValidAbsoluteUrl() instead.');
|
||||
var baseUrl = allowRelative ? 'http://example.com' : null;
|
||||
return createValidAbsoluteUrl(url, baseUrl) !== null;
|
||||
}
|
||||
|
||||
exports.CustomStyle = CustomStyle;
|
||||
exports.addLinkAttributes = addLinkAttributes;
|
||||
exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
|
||||
exports.isValidUrl = isValidUrl;
|
||||
exports.getFilenameFromUrl = getFilenameFromUrl;
|
||||
exports.LinkTarget = LinkTarget;
|
||||
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue