From 990bfd2e3eaf0f0c977a7af7330ac4ad54f768cb Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 17 Aug 2023 11:30:23 -0700 Subject: [PATCH] Don't access "document" in WebWorker Fixes https://github.com/google/mediapipe/issues/4694 PiperOrigin-RevId: 557885230 --- mediapipe/web/graph_runner/platform_utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mediapipe/web/graph_runner/platform_utils.ts b/mediapipe/web/graph_runner/platform_utils.ts index 7e1decf3..d86e002d 100644 --- a/mediapipe/web/graph_runner/platform_utils.ts +++ b/mediapipe/web/graph_runner/platform_utils.ts @@ -32,5 +32,6 @@ export function isIOS() { // tslint:disable-next-line:deprecation ].includes(navigator.platform) // iPad on iOS 13 detection - || (navigator.userAgent.includes('Mac') && 'ontouchend' in document); + || (navigator.userAgent.includes('Mac') && + (typeof document !== undefined && 'ontouchend' in document)); }