From 602414a5860393894deb5079a3918f19f24a7a86 Mon Sep 17 00:00:00 2001 From: David Reed Date: Wed, 23 Nov 2022 13:57:14 -0500 Subject: [PATCH] conditional reference to HTMLIFrameElement This will prevent an exception being thrown in workers. --- src/uv.handler.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/uv.handler.js b/src/uv.handler.js index 64bf3bb..4ba612c 100644 --- a/src/uv.handler.js +++ b/src/uv.handler.js @@ -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);