From 9ba4246f11973a28d9f60691e6aa6e0dc4b88614 Mon Sep 17 00:00:00 2001
From: Jonathan Lipps <jlipps@gmail.com>
Date: Tue, 15 Aug 2023 15:06:00 -0700
Subject: [PATCH] [JS] [atoms] update fragment wrapper to apply window object
 to fragments fix #12549

---
 javascript/private/fragment.bzl | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/javascript/private/fragment.bzl b/javascript/private/fragment.bzl
index d5d6ed1b1d7cb..05cc0f24dc1f2 100644
--- a/javascript/private/fragment.bzl
+++ b/javascript/private/fragment.bzl
@@ -51,18 +51,11 @@ def closure_fragment(
 
     # Wrap the output in two functions. The outer function ensures the
     # compiled fragment never pollutes the global scope by using its
-    # own scope on each invocation. We must import window.navigator into
-    # this unique scope since Closure's goog.userAgent package assumes
-    # navigator and document are defined on goog.global. Normally, this
-    # would be window, but we are explicitly defining the fragment so that
-    # goog.global is _not_ window.
-    #     See http://code.google.com/p/selenium/issues/detail?id=1333
+    # own scope on each invocation.
     wrapper = (
         "function(){" +
-        "return (function(){%output%; return this._.apply(null,arguments);}).apply({" +
-        "navigator:typeof window!='undefined'?window.navigator:null," +
-        "document:typeof window!='undefined'?window.document:null" +
-        "}, arguments);}"
+        "return (function(){%output%; return this._.apply(null,arguments);}).apply(" +
+        "window, arguments);}"
     )
 
     browser_defs = {