mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #14341 from Snuffleupagus/shadow-prop-assert
Ensure that the `shadow` helper function is passed a valid property (PR 14152 follow-up)
This commit is contained in:
commit
bceed26e67
1 changed files with 9 additions and 0 deletions
|
@ -488,6 +488,15 @@ function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
|
|||
}
|
||||
|
||||
function shadow(obj, prop, value) {
|
||||
if (
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || TESTING")
|
||||
) {
|
||||
assert(
|
||||
prop in obj,
|
||||
`shadow: Property "${prop && prop.toString()}" not found in object.`
|
||||
);
|
||||
}
|
||||
Object.defineProperty(obj, prop, {
|
||||
value,
|
||||
enumerable: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue