conditional reference to HTMLIFrameElement

This will prevent an exception being thrown in workers.
This commit is contained in:
David Reed 2022-11-23 13:57:14 -05:00
parent 26d17cd241
commit 602414a586
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F

View file

@ -700,10 +700,13 @@ function __uvHook(window, config = {}, bare = '/bare/') {
},
});
const contentWindowGet = Object.getOwnPropertyDescriptor(
HTMLIFrameElement.prototype,
'contentWindow'
).get;
// HTMLIFrameElement may not be defined (workers)
const contentWindowGet =
HTMLIFrameElement &&
Object.getOwnPropertyDescriptor(
HTMLIFrameElement.prototype,
'contentWindow'
).get;
function uvInject(that) {
const win = contentWindowGet.call(that);