diff --git a/packages/babel-plugin-transform-unforgeables/src/plugin.ts b/packages/babel-plugin-transform-unforgeables/src/plugin.ts index db333de..9f8b158 100644 --- a/packages/babel-plugin-transform-unforgeables/src/plugin.ts +++ b/packages/babel-plugin-transform-unforgeables/src/plugin.ts @@ -66,23 +66,23 @@ export function transformUnforgeables() { MemberExpression(path: NodePath) { const { node } = path; if (isLocationProperty(path)) { - const objectPath = path.get('object'); - // Skip transforming location in members like `window.top.location` - // letting the transform to `window.top` carry it. - if (isTopProperty(objectPath)) { - return; - } - const alternatePath = objectPath.isConditionalExpression() - ? objectPath.get('alternate') - : undefined; - // Skip re-transforming location in members like - // `(window === GLOBAL_THIS ? TOP : window.top).location`. - if ( - alternatePath && - isTopProperty(alternatePath) && - topMemberTransformBuilder.isTransformed(alternatePath) - ) { - return; + let currentNode = node.object; + // For scenarios with `window.top.location`, + // We want to have nested transformations. + if (isTopProperty(path.get('object'))) { + let currPath; + let nextPath = path; + do { + currPath = nextPath; + currPath.skip(); + // Walk into nested top member expressions like + // window.top.top -> window.top -> window + nextPath = currPath.get('object') as NodePath; + } while (isTopProperty(nextPath)); + currentNode = topMemberTransformBuilder({ + EXPRESSION: node.object, + NODE: currPath.node.object, + }); } if (isLeftOfAssignment(path)) { const parent = path.parent as BabelTypes.AssignmentExpression; @@ -96,12 +96,11 @@ export function transformUnforgeables() { const { parentPath } = path; // Skip re-transforming location. if (!builder.isTransformed(parentPath)) { - // Both transform variations have the same - // placeholder replacements. parentPath.replaceWith( builder({ - EXPRESSION: parent, - NODE: node.object, + EXPRESSION_OBJECT: currentNode, + EXPRESSION_PROPERTY: node.property, + NODE: currentNode, VALUE: parent.right, }) ); @@ -116,8 +115,9 @@ export function transformUnforgeables() { ) { path.replaceWith( locationMemberTransformBuilder({ - EXPRESSION: node, - NODE: node.object, + EXPRESSION_OBJECT: currentNode, + EXPRESSION_PROPERTY: node.property, + NODE: currentNode, }) ); path.skip(); diff --git a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-assign.ts b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-assign.ts index 62321ac..b745a63 100644 --- a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-assign.ts +++ b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-assign.ts @@ -9,7 +9,7 @@ export const locationMemberAssignTransform = () => // NODE.location = VALUE Builder.create( ` - (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION.assign(VALUE) : EXPRESSION + (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION.assign(VALUE) : EXPRESSION_OBJECT.EXPRESSION_PROPERTY = VALUE `, { name: 'locationMemberAssignTransform', diff --git a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-concat.ts b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-concat.ts index 41beb10..97a389d 100644 --- a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-concat.ts +++ b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member-concat.ts @@ -9,7 +9,7 @@ export const locationMemberConcatTransform = () => // NODE.location += VALUE Builder.create( ` - (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION.assign(LOCATION.href + VALUE) : EXPRESSION + (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION.assign(LOCATION.href + VALUE) : EXPRESSION_OBJECT.EXPRESSION_PROPERTY += VALUE `, { name: 'locationMemberConcatTransform', diff --git a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member.ts b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member.ts index 3aa0305..e945db2 100644 --- a/packages/babel-plugin-transform-unforgeables/src/transforms/location-member.ts +++ b/packages/babel-plugin-transform-unforgeables/src/transforms/location-member.ts @@ -9,7 +9,7 @@ export const locationMemberTransform = () => // NODE.location Builder.create( ` - (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION : EXPRESSION + (NODE === GLOBAL_THIS || NODE === DOCUMENT) ? LOCATION : EXPRESSION_OBJECT.EXPRESSION_PROPERTY `, { name: 'locationMemberTransform', diff --git a/packages/babel-plugin-transform-unforgeables/test/index.spec.js b/packages/babel-plugin-transform-unforgeables/test/index.spec.js index 4a15d4e..ee85da9 100644 --- a/packages/babel-plugin-transform-unforgeables/test/index.spec.js +++ b/packages/babel-plugin-transform-unforgeables/test/index.spec.js @@ -383,91 +383,91 @@ describe('Babel transformation', () => { location, location = value, location += value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign( _location2.href + value) : document.defaultView.location += value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), - (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), - (frames === _globalThis2 || frames === _document2 ? _location2.assign( _location2.href + value) : frames.location += value), - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign( _location2.href + value) : globalThis.location += value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location), - (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), - (self === _globalThis2 || self === _document2 ? _location2.assign( _location2.href + value) : self.location += value), - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location), - (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), - (top === _globalThis2 || top === _document2 ? _location2.assign( _location2.href + value) : top.location += value), - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location), - (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), - (window === _globalThis2 || window === _document2 ? _location2.assign( _location2.href + value) : window.location += value), - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location), - (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), - (document === _globalThis2 || document === _document2 ? _location2.assign( _location2.href + value) : document.location += value), - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign( _location2.href + value) : el.ownerDocument.location += value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, - function nestedShadowedLocationPatterns(el, value, _document, _globalThis, _location) { + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(_location2.href + value) : document.defaultView.location += value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(_location2.href + value) : frames.location += value), + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(_location2.href + value) : globalThis.location += value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location), + (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), + (self === _globalThis2 || self === _document2 ? _location2.assign(_location2.href + value) : self.location += value), + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location), + (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), + (top === _globalThis2 || top === _document2 ? _location2.assign(_location2.href + value) : top.location += value), + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location), + (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), + (window === _globalThis2 || window === _document2 ? _location2.assign(_location2.href + value) : window.location += value), + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location), + (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), + (document === _globalThis2 || document === _document2 ? _location2.assign(_location2.href + value) : document.location += value), + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(_location2.href + value) : el.ownerDocument.location += value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, + function nestedShadowedLocationPatterns(el, value, _document, _globalThis, _location) { return [ _location, _location = value, _location += value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign( _location2.href + value) : document.defaultView.location += value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), - (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), - (frames === _globalThis2 || frames === _document2 ? _location2.assign( _location2.href + value) : frames.location += value), - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign( _location2.href + value) : globalThis.location += value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location), - (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), - (self === _globalThis2 || self === _document2 ? _location2.assign( _location2.href + value) : self.location += value), - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location), - (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), - (top === _globalThis2 || top === _document2 ? _location2.assign( _location2.href + value) : top.location += value), - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location), - (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), - (window === _globalThis2 || window === _document2 ? _location2.assign( _location2.href + value) : window.location += value), - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location), - (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), - (document === _globalThis2 || document === _document2 ? _location2.assign( _location2.href + value) : document.location += value), - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign( _location2.href + value) : el.ownerDocument.location += value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(_location2.href + value) : document.defaultView.location += value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(_location2.href + value) : frames.location += value), + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(_location2.href + value) : globalThis.location += value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location), + (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), + (self === _globalThis2 || self === _document2 ? _location2.assign(_location2.href + value) : self.location += value), + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location), + (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), + (top === _globalThis2 || top === _document2 ? _location2.assign(_location2.href + value) : top.location += value), + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location), + (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), + (window === _globalThis2 || window === _document2 ? _location2.assign(_location2.href + value) : window.location += value), + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location), + (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), + (document === _globalThis2 || document === _document2 ? _location2.assign(_location2.href + value) : document.location += value), + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(_location2.href + value) : el.ownerDocument.location += value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value ]; } ]; @@ -1601,16 +1601,16 @@ describe('Babel transformation', () => { (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(_location2.href + value) : el.ownerDocument.location += value), (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, - (window === _globalThis2 ? _top2 : window.top).location, - (window === _globalThis2 ? _top2 : window.top).location = value, - (window === _globalThis2 ? _top2 : window.top).location += value, - (window === _globalThis2 ? _top2 : window.top).location.href = value, - (window === _globalThis2 ? _top2 : window.top).location.href += value, - (window === _globalThis2 ? _top2 : window.top.top).location, - (window === _globalThis2 ? _top2 : window.top.top).location = value, - (window === _globalThis2 ? _top2 : window.top.top).location += value, - (window === _globalThis2 ? _top2 : window.top.top).location.href = value, - (window === _globalThis2 ? _top2 : window.top.top).location.href += value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(value) : (window === _globalThis2 ? _top2 : window.top).location = value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(_location2.href + value) : (window === _globalThis2 ? _top2 : window.top).location += value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href = value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href += value, + ((window === _globalThis2 ? _top2 : window.top.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top.top).location), + ((window === _globalThis2 ? _top2 : window.top.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top.top) === _document2 ? _location2.assign(value) : (window === _globalThis2 ? _top2 : window.top.top).location = value), + ((window === _globalThis2 ? _top2 : window.top.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top.top) === _document2 ? _location2.assign(_location2.href + value) : (window === _globalThis2 ? _top2 : window.top.top).location += value), + ((window === _globalThis2 ? _top2 : window.top.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top.top).location).href = value, + ((window === _globalThis2 ? _top2 : window.top.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top.top).location).href += value, (window === _globalThis2 ? _top2 : window.top), (document.defaultView === _globalThis2 ? _top2 : document.defaultView.top), (frames === _globalThis2 ? _top2 : frames.top), @@ -1749,51 +1749,51 @@ describe('Babel transformation', () => { $d = top; function shadowedCombinedPatterns(el, value, document, globalThis, location, top) { return [ - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign( _location2.href + value) : document.defaultView.location += value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), - (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), - (frames === _globalThis2 || frames === _document2 ? _location2.assign( _location2.href + value) : frames.location += value), - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign( _location2.href + value) : globalThis.location += value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location), - (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), - (self === _globalThis2 || self === _document2 ? _location2.assign( _location2.href + value) : self.location += value), - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location), - (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), - (top === _globalThis2 || top === _document2 ? _location2.assign( _location2.href + value) : top.location += value), - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location), - (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), - (window === _globalThis2 || window === _document2 ? _location2.assign( _location2.href + value) : window.location += value), - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location), - (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), - (document === _globalThis2 || document === _document2 ? _location2.assign( _location2.href + value) : document.location += value), - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign( _location2.href + value) : el.ownerDocument.location += value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, - (window === _globalThis2 ? _top2 : window.top).location, - (window === _globalThis2 ? _top2 : window.top).location = value, - (window === _globalThis2 ? _top2 : window.top).location += value, - (window === _globalThis2 ? _top2 : window.top).location.href = value, - (window === _globalThis2 ? _top2 : window.top).location.href += value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(_location2.href + value) : document.defaultView.location += value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(_location2.href + value) : frames.location += value), + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(_location2.href + value) : globalThis.location += value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location), + (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), + (self === _globalThis2 || self === _document2 ? _location2.assign(_location2.href + value) : self.location += value), + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location), + (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), + (top === _globalThis2 || top === _document2 ? _location2.assign(_location2.href + value) : top.location += value), + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location), + (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), + (window === _globalThis2 || window === _document2 ? _location2.assign(_location2.href + value) : window.location += value), + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location), + (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), + (document === _globalThis2 || document === _document2 ? _location2.assign(_location2.href + value) : document.location += value), + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(_location2.href + value) : el.ownerDocument.location += value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(value) : (window === _globalThis2 ? _top2 : window.top).location = value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(_location2.href + value) : (window === _globalThis2 ? _top2 : window.top).location += value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href = value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href += value, (window === _globalThis2 ? _top2 : window.top), (document.defaultView === _globalThis2 ? _top2 : document.defaultView.top), (frames === _globalThis2 ? _top2 : frames.top), @@ -1801,53 +1801,53 @@ describe('Babel transformation', () => { (parent === _globalThis2 ? _top2 : parent.top), (self === _globalThis2 ? _top2 : self.top), (top === _globalThis2 ? _top2 : top.top), - function nestedShadowedCombinedPatterns(el, value, _document, _globalThis, _location, _top) { + function nestedShadowedCombinedPatterns(el, value, _document, _globalThis, _location, _top) { return [ - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign( _location2.href + value) : document.defaultView.location += value), - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, - (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), - (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), - (frames === _globalThis2 || frames === _document2 ? _location2.assign( _location2.href + value) : frames.location += value), - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, - (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign( _location2.href + value) : globalThis.location += value), - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, - (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location), - (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), - (self === _globalThis2 || self === _document2 ? _location2.assign( _location2.href + value) : self.location += value), - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, - (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location), - (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), - (top === _globalThis2 || top === _document2 ? _location2.assign( _location2.href + value) : top.location += value), - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, - (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location), - (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), - (window === _globalThis2 || window === _document2 ? _location2.assign( _location2.href + value) : window.location += value), - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, - (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location), - (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), - (document === _globalThis2 || document === _document2 ? _location2.assign( _location2.href + value) : document.location += value), - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, - (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign( _location2.href + value) : el.ownerDocument.location += value), - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, - (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, - (window === _globalThis2 ? _top2 : window.top).location, - (window === _globalThis2 ? _top2 : window.top).location = value, - (window === _globalThis2 ? _top2 : window.top).location += value, - (window === _globalThis2 ? _top2 : window.top).location.href = value, - (window === _globalThis2 ? _top2 : window.top).location.href += value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(value) : document.defaultView.location = value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2.assign(_location2.href + value) : document.defaultView.location += value), + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href = value, + (document.defaultView === _globalThis2 || document.defaultView === _document2 ? _location2 : document.defaultView.location).href += value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(value) : frames.location = value), + (frames === _globalThis2 || frames === _document2 ? _location2.assign(_location2.href + value) : frames.location += value), + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href = value, + (frames === _globalThis2 || frames === _document2 ? _location2 : frames.location).href += value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(value) : globalThis.location = value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2.assign(_location2.href + value) : globalThis.location += value), + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href = value, + (globalThis === _globalThis2 || globalThis === _document2 ? _location2 : globalThis.location).href += value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location), + (self === _globalThis2 || self === _document2 ? _location2.assign(value) : self.location = value), + (self === _globalThis2 || self === _document2 ? _location2.assign(_location2.href + value) : self.location += value), + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href = value, + (self === _globalThis2 || self === _document2 ? _location2 : self.location).href += value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location), + (top === _globalThis2 || top === _document2 ? _location2.assign(value) : top.location = value), + (top === _globalThis2 || top === _document2 ? _location2.assign(_location2.href + value) : top.location += value), + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href = value, + (top === _globalThis2 || top === _document2 ? _location2 : top.location).href += value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location), + (window === _globalThis2 || window === _document2 ? _location2.assign(value) : window.location = value), + (window === _globalThis2 || window === _document2 ? _location2.assign(_location2.href + value) : window.location += value), + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href = value, + (window === _globalThis2 || window === _document2 ? _location2 : window.location).href += value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location), + (document === _globalThis2 || document === _document2 ? _location2.assign(value) : document.location = value), + (document === _globalThis2 || document === _document2 ? _location2.assign(_location2.href + value) : document.location += value), + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href = value, + (document === _globalThis2 || document === _document2 ? _location2 : document.location).href += value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(value) : el.ownerDocument.location = value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2.assign(_location2.href + value) : el.ownerDocument.location += value), + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href = value, + (el.ownerDocument === _globalThis2 || el.ownerDocument === _document2 ? _location2 : el.ownerDocument.location).href += value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(value) : (window === _globalThis2 ? _top2 : window.top).location = value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2.assign(_location2.href + value) : (window === _globalThis2 ? _top2 : window.top).location += value), + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href = value, + ((window === _globalThis2 ? _top2 : window.top) === _globalThis2 || (window === _globalThis2 ? _top2 : window.top) === _document2 ? _location2 : (window === _globalThis2 ? _top2 : window.top).location).href += value, (window === _globalThis2 ? _top2 : window.top), (document.defaultView === _globalThis2 ? _top2 : document.defaultView.top), (frames === _globalThis2 ? _top2 : frames.top),