fix undefined

This commit is contained in:
David Reed 2022-11-20 01:28:51 -05:00
parent f08364edcd
commit ff527d9732
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

View file

@ -691,28 +691,29 @@ function __uvHook(window, config = {}, bare = '/bare/') {
},
});
const contentWindowGet = Object.getOwnPropertyDescriptor(
HTMLIFrameElement.prototype,
'contentWindow'
).get;
client.element.hookProperty(HTMLIFrameElement, 'contentWindow', {
get: (target, that) => {
const win = target.call(that);
try {
if (!win.__uv) __uvHook(win, config, bare);
} catch (e) {}
return win;
} catch (e) {
return win;
}
},
});
client.element.hookProperty(HTMLIFrameElement, 'contentDocument', {
get: (target, that) => {
const win = contentWindowGet.call(that);
const doc = target.call(that);
try {
const win = doc.defaultView;
if (!win.__uv) __uvHook(win, config, bare);
} catch (e) {}
return doc;
} catch (e) {
return win;
}
},
});