Skip to content

Commit

Permalink
[JS] [atoms] update fragment wrapper to apply window object to fragme…
Browse files Browse the repository at this point in the history
…nts (#12557)

fix #12549

Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
  • Loading branch information
jlipps and AutomatedTester committed Aug 16, 2023
1 parent 5230208 commit c39c7fb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions javascript/private/fragment.bzl
Expand Up @@ -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 = {
Expand Down

0 comments on commit c39c7fb

Please sign in to comment.