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
@ -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…
x
Reference in New Issue
Block a user