Merge pull request #2212 from joedf/regression-fix-2201

Undefined check for object descriptor
This commit is contained in:
Ian Gilman 2022-10-24 14:16:21 -07:00 committed by GitHub
commit af564547f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1102,12 +1102,18 @@ function OpenSeadragon( options ){
// Extend the base object // Extend the base object
for ( name in options ) { for ( name in options ) {
var descriptor = Object.getOwnPropertyDescriptor(options, name); var descriptor = Object.getOwnPropertyDescriptor(options, name);
if (descriptor !== undefined) {
if (descriptor.get || descriptor.set) { if (descriptor.get || descriptor.set) {
Object.defineProperty(target, name, descriptor); Object.defineProperty(target, name, descriptor);
continue; continue;
} }
copy = descriptor.value; copy = descriptor.value;
} else {
$.console.warn('Could not copy inherited property "' + name + '".');
continue;
}
// Prevent never-ending loop // Prevent never-ending loop
if ( target === copy ) { if ( target === copy ) {