@lwrjs/client-modules 0.22.14 → 0.22.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -582,6 +582,7 @@ const {
582
582
  indexOf: StringProtoIndexOf$LWS,
583
583
  lastIndexOf: StringProtoLastIndexOf$LWS,
584
584
  match: StringProtoMatch$LWS,
585
+ normalize: StringProtoNormalize$LWS,
585
586
  replace: StringProtoReplace$LWS,
586
587
  slice: StringProtoSlice$LWS$1,
587
588
  split: StringProtoSplit$LWS,
@@ -1509,7 +1510,7 @@ const {
1509
1510
  const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
1510
1511
  const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
1511
1512
  const trustedResources$LWS = toSafeSet$LWS(new SetCtor$LWS$1());
1512
- /*! version: 0.26.4 */
1513
+ /*! version: 0.27.5 */
1513
1514
 
1514
1515
  /*!
1515
1516
  * Copyright (C) 2019 salesforce.com, inc.
@@ -1571,86 +1572,6 @@ const {
1571
1572
  append: DocumentFragmentProtoAppend$LWS,
1572
1573
  getElementById: DocumentFragmentProtoGetElementById$LWS
1573
1574
  } = DocumentFragment.prototype;
1574
- const {
1575
- prototype: ElementProto$LWS
1576
- } = Element;
1577
- const ElementAriaAttributesToPropertyName$LWS = {
1578
- __proto__: null,
1579
- 'aria-activedescendant': 'ariaActiveDescendant',
1580
- 'aria-atomic': 'ariaAtomic',
1581
- 'aria-autocomplete': 'ariaAutoComplete',
1582
- 'aria-busy': 'ariaBusy',
1583
- 'aria-checked': 'ariaChecked',
1584
- 'aria-colcount': 'ariaColCount',
1585
- 'aria-colindex': 'ariaColIndex',
1586
- 'aria-colspan': 'ariaColSpan',
1587
- 'aria-controls': 'ariaControls',
1588
- 'aria-current': 'ariaCurrent',
1589
- 'aria-describedby': 'ariaDescribedBy',
1590
- 'aria-details': 'ariaDetails',
1591
- 'aria-disabled': 'ariaDisabled',
1592
- 'aria-errormessage': 'ariaErrorMessage',
1593
- 'aria-expanded': 'ariaExpanded',
1594
- 'aria-flowto': 'ariaFlowTo',
1595
- 'aria-haspopup': 'ariaHasPopup',
1596
- 'aria-hidden': 'ariaHidden',
1597
- 'aria-invalid': 'ariaInvalid',
1598
- 'aria-keyshortcuts': 'ariaKeyShortcuts',
1599
- 'aria-label': 'ariaLabel',
1600
- 'aria-labelledby': 'ariaLabelledBy',
1601
- 'aria-level': 'ariaLevel',
1602
- 'aria-live': 'ariaLive',
1603
- 'aria-modal': 'ariaModal',
1604
- 'aria-multiline': 'ariaMultiLine',
1605
- 'aria-multiselectable': 'ariaMultiSelectable',
1606
- 'aria-orientation': 'ariaOrientation',
1607
- 'aria-owns': 'ariaOwns',
1608
- 'aria-placeholder': 'ariaPlaceholder',
1609
- 'aria-posinset': 'ariaPosInSet',
1610
- 'aria-pressed': 'ariaPressed',
1611
- 'aria-readonly': 'ariaReadOnly',
1612
- 'aria-relevant': 'ariaRelevant',
1613
- 'aria-required': 'ariaRequired',
1614
- 'aria-roledescription': 'ariaRoleDescription',
1615
- 'aria-rowcount': 'ariaRowCount',
1616
- 'aria-rowindex': 'ariaRowIndex',
1617
- 'aria-rowspan': 'ariaRowSpan',
1618
- 'aria-selected': 'ariaSelected',
1619
- 'aria-setsize': 'ariaSetSize',
1620
- 'aria-sort': 'ariaSort',
1621
- 'aria-valuemax': 'ariaValueMax',
1622
- 'aria-valuemin': 'ariaValueMin',
1623
- 'aria-valuenow': 'ariaValueNow',
1624
- 'aria-valuetext': 'ariaValueText'
1625
- };
1626
- // Used by '@locker/near-membrane-dom'.
1627
- const {
1628
- remove: ElementProtoRemove$LWS$1
1629
- } = ElementProto$LWS;
1630
- const {
1631
- closest: ElementProtoClosest$LWS,
1632
- getAttribute: ElementProtoGetAttribute$LWS,
1633
- getAttributeNode: ElementProtoGetAttributeNode$LWS,
1634
- getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1635
- hasAttribute: ElementProtoHasAttribute$LWS,
1636
- querySelector: ElementProtoQuerySelector$LWS,
1637
- querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1638
- removeAttribute: ElementProtoRemoveAttribute$LWS,
1639
- removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1640
- removeAttributeNS: ElementProtoRemoveAttributeNS$LWS,
1641
- setAttribute: ElementProtoSetAttribute$LWS$1,
1642
- setAttributeNS: ElementProtoSetAttributeNS$LWS,
1643
- toggleAttribute: ElementProtoToggleAttribute$LWS
1644
- } = ElementProto$LWS;
1645
- const {
1646
- get: ElementProtoInnerHTMLGetter$LWS,
1647
- set: ElementProtoInnerHTMLSetter$LWS
1648
- } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'innerHTML');
1649
- const ElementProtoNamespaceURIGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'namespaceURI');
1650
- const {
1651
- get: ElementProtoOuterHTMLGetter$LWS
1652
- } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
1653
- const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
1654
1575
 
1655
1576
  // Check for the noopener feature being enabled:
1656
1577
  // - noopener
@@ -1730,17 +1651,9 @@ function initWindowOpenChildWindow$LWS(win$LWS, url$LWS) {
1730
1651
  }
1731
1652
  return win$LWS;
1732
1653
  }
1733
- // This is only used by window.open() and document.open(x, y, z) distortions to
1734
- // block access to unsafe properties of the child window that's returned by those
1735
- // APIs. These properties must be otherwise available directly on the sandbox window,
1736
- // or via iframe.contentWindow created within the sandbox.
1737
- // To be effective, we mark the blocked thing with a symbol, so that can be detected by
1738
- // the distortion, otherwise the distortion will replace whatever we define here with
1739
- // whatever it provides.
1740
1654
  const CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS = SymbolFor$LWS$1('@@lwsChildWindowBlockedProperty');
1741
1655
  const CHILD_WINDOW_BLOCKED_PROPERTIES$LWS = ['eval', 'Function', 'setInterval', 'setTimeout'];
1742
1656
  function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1743
- // If this function somehow receives the rootWindow, just return it.
1744
1657
  if (!childWindow$LWS || childWindow$LWS === rootWindow$LWS$1) {
1745
1658
  return childWindow$LWS;
1746
1659
  }
@@ -1759,23 +1672,11 @@ function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1759
1672
  if (typeof childWindow$LWS[blocked$LWS] === 'function') {
1760
1673
  descriptor$LWS.value = replacement$LWS;
1761
1674
  }
1762
- /* Eventually there will be other types of blocked properties
1763
- else {
1764
- descriptor.get = replacement;
1765
- }
1766
- */
1767
1675
  ReflectDefineProperty$LWS$1(childWindow$LWS, blocked$LWS, descriptor$LWS);
1768
1676
  }
1769
1677
  return childWindow$LWS;
1770
1678
  }
1771
1679
  function throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, name$LWS) {
1772
- // This seemingly strange approach is necessary because this distortion will
1773
- // otherwise replace whatever was force-assigned to the childWindow property
1774
- // by markForUnsafePropertyBlocking with this distortion, effectively acting
1775
- // as an UNDO of markForUnsafePropertyBlocking(). We have to dig into
1776
- // the sandbox's global object and look at the actual property to see if it was
1777
- // marked for unsafe property blocking, because indirect property (ie. eval) will bypass
1778
- // any "this" property lookups.
1779
1680
  const getPossiblyBlockedPropertyFromSandbox$LWS = virtualEnvironmentEvaluator$LWS(`() => globalThis.${name$LWS}`);
1780
1681
  // istanbul ignore else: it is unnecessary to cover the else path here
1781
1682
  if (getPossiblyBlockedPropertyFromSandbox$LWS()[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
@@ -1845,6 +1746,153 @@ function normalizeWindowOpenArguments$LWS(args$LWS) {
1845
1746
  }
1846
1747
  return normalizedArgs$LWS;
1847
1748
  }
1749
+ const {
1750
+ // We don't cherry-pick the 'userAgent' property from `navigator` here
1751
+ // to avoid triggering its getter.
1752
+ navigator: navigator$LWS$1,
1753
+ navigator: {
1754
+ userAgentData: userAgentData$LWS$1
1755
+ }
1756
+ } = rootWindow$LWS$1;
1757
+ // The user-agent client hints API is experimental and subject to change.
1758
+ // https://caniuse.com/mdn-api_navigator_useragentdata
1759
+ // istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
1760
+ const brands$LWS$1 = userAgentData$LWS$1 == null ? void 0 : userAgentData$LWS$1.brands;
1761
+ // Note: Chromium identifies itself as Chrome in its user-agent string.
1762
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
1763
+ const chromiumUserAgentRegExp$LWS$1 = / (?:Headless)?Chrome\/\d+/;
1764
+ const webKitUserAgentRegExp$LWS = /WebKit/i;
1765
+ let userAgent$LWS$1;
1766
+ function getUserAgent$LWS$1() {
1767
+ if (userAgent$LWS$1 === undefined) {
1768
+ userAgent$LWS$1 = navigator$LWS$1.userAgent;
1769
+ }
1770
+ return userAgent$LWS$1;
1771
+ }
1772
+ const CUSTOM_ELEMENT_REGISTRY_ATTRIBUTE_NAME$LWS = LOCKER_SERVICE_KEY_LOWERED$LWS;
1773
+ // Used by '@locker/near-membrane-dom'.
1774
+ const IS_CHROMIUM_BROWSER$LWS$1 =
1775
+ // While experimental, `navigator.userAgentData.brands` may be defined as an
1776
+ // empty array in headless Chromium based browsers.
1777
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ?
1778
+ // Use user-agent client hints API if available to avoid deprecation
1779
+ // warnings.
1780
+ // https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
1781
+ // istanbul ignore next: this code is not reachable in the coverage run.
1782
+ ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1783
+ // prettier-ignore
1784
+ // istanbul ignore next: this code is not reachable in the coverage run.
1785
+ item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined :
1786
+ // Fallback to a standard user-agent string sniff.
1787
+ ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]);
1788
+ const IS_WEBKIT_BROWSER$LWS = !IS_CHROMIUM_BROWSER$LWS$1 && (
1789
+ // istanbul ignore next: this code is not reachable in the coverage run.
1790
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1791
+ // istanbul ignore next
1792
+ item$LWS => {
1793
+ const brand$LWS = item$LWS == null ? void 0 : item$LWS.brand;
1794
+ return typeof brand$LWS === 'string' && ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [brand$LWS]);
1795
+ }]) !== undefined : ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [getUserAgent$LWS$1()]));
1796
+ // Pattern to match CSP nonce values, e.g., 'nonce-abc123'
1797
+ // The nonce value is base64 encoded and may contain alphanumeric characters, +, /, and =
1798
+ const NONCE_PATTERN$LWS = /'nonce-[A-Za-z0-9+/=]+'/g;
1799
+ const BLOCKED_ELEMENTS$LWS = toSafeSet$LWS(new SetCtor$LWS$1(['base']));
1800
+ function isBlockedElement$LWS(tagName$LWS) {
1801
+ return BLOCKED_ELEMENTS$LWS.has(tagName$LWS);
1802
+ }
1803
+ const {
1804
+ prototype: ElementProto$LWS
1805
+ } = Element;
1806
+ const ElementAriaAttributesToPropertyName$LWS = {
1807
+ __proto__: null,
1808
+ 'aria-activedescendant': 'ariaActiveDescendant',
1809
+ 'aria-atomic': 'ariaAtomic',
1810
+ 'aria-autocomplete': 'ariaAutoComplete',
1811
+ 'aria-busy': 'ariaBusy',
1812
+ 'aria-checked': 'ariaChecked',
1813
+ 'aria-colcount': 'ariaColCount',
1814
+ 'aria-colindex': 'ariaColIndex',
1815
+ 'aria-colspan': 'ariaColSpan',
1816
+ 'aria-controls': 'ariaControls',
1817
+ 'aria-current': 'ariaCurrent',
1818
+ 'aria-describedby': 'ariaDescribedBy',
1819
+ 'aria-details': 'ariaDetails',
1820
+ 'aria-disabled': 'ariaDisabled',
1821
+ 'aria-errormessage': 'ariaErrorMessage',
1822
+ 'aria-expanded': 'ariaExpanded',
1823
+ 'aria-flowto': 'ariaFlowTo',
1824
+ 'aria-haspopup': 'ariaHasPopup',
1825
+ 'aria-hidden': 'ariaHidden',
1826
+ 'aria-invalid': 'ariaInvalid',
1827
+ 'aria-keyshortcuts': 'ariaKeyShortcuts',
1828
+ 'aria-label': 'ariaLabel',
1829
+ 'aria-labelledby': 'ariaLabelledBy',
1830
+ 'aria-level': 'ariaLevel',
1831
+ 'aria-live': 'ariaLive',
1832
+ 'aria-modal': 'ariaModal',
1833
+ 'aria-multiline': 'ariaMultiLine',
1834
+ 'aria-multiselectable': 'ariaMultiSelectable',
1835
+ 'aria-orientation': 'ariaOrientation',
1836
+ 'aria-owns': 'ariaOwns',
1837
+ 'aria-placeholder': 'ariaPlaceholder',
1838
+ 'aria-posinset': 'ariaPosInSet',
1839
+ 'aria-pressed': 'ariaPressed',
1840
+ 'aria-readonly': 'ariaReadOnly',
1841
+ 'aria-relevant': 'ariaRelevant',
1842
+ 'aria-required': 'ariaRequired',
1843
+ 'aria-roledescription': 'ariaRoleDescription',
1844
+ 'aria-rowcount': 'ariaRowCount',
1845
+ 'aria-rowindex': 'ariaRowIndex',
1846
+ 'aria-rowspan': 'ariaRowSpan',
1847
+ 'aria-selected': 'ariaSelected',
1848
+ 'aria-setsize': 'ariaSetSize',
1849
+ 'aria-sort': 'ariaSort',
1850
+ 'aria-valuemax': 'ariaValueMax',
1851
+ 'aria-valuemin': 'ariaValueMin',
1852
+ 'aria-valuenow': 'ariaValueNow',
1853
+ 'aria-valuetext': 'ariaValueText'
1854
+ };
1855
+ // Used by '@locker/near-membrane-dom'.
1856
+ const {
1857
+ remove: ElementProtoRemove$LWS$1
1858
+ } = ElementProto$LWS;
1859
+ const {
1860
+ closest: ElementProtoClosest$LWS,
1861
+ getAttribute: ElementProtoGetAttribute$LWS,
1862
+ getAttributeNode: ElementProtoGetAttributeNode$LWS,
1863
+ getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1864
+ hasAttribute: ElementProtoHasAttribute$LWS,
1865
+ querySelector: ElementProtoQuerySelector$LWS,
1866
+ querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1867
+ removeAttribute: ElementProtoRemoveAttribute$LWS,
1868
+ removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1869
+ removeAttributeNS: ElementProtoRemoveAttributeNS$LWS,
1870
+ setAttribute: ElementProtoSetAttribute$LWS$1,
1871
+ setAttributeNS: ElementProtoSetAttributeNS$LWS,
1872
+ toggleAttribute: ElementProtoToggleAttribute$LWS
1873
+ } = ElementProto$LWS;
1874
+ const {
1875
+ get: ElementProtoInnerHTMLGetter$LWS,
1876
+ set: ElementProtoInnerHTMLSetter$LWS
1877
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'innerHTML');
1878
+ const ElementProtoNamespaceURIGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'namespaceURI');
1879
+ const {
1880
+ get: ElementProtoOuterHTMLGetter$LWS
1881
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
1882
+ const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
1883
+ /**
1884
+ * Removes CSP nonce patterns from a string.
1885
+ *
1886
+ * CSP nonces (e.g., 'nonce-abc123') are cryptographic tokens used to allowlist
1887
+ * inline scripts/styles. This function strips them from serialized content to
1888
+ * prevent nonce exfiltration attacks.
1889
+ *
1890
+ * @param content - The string to sanitize (e.g., innerHTML, CSP content attribute)
1891
+ * @returns The string with all 'nonce-xxx' patterns removed
1892
+ */
1893
+ function removeNoncePatterns$LWS(content$LWS) {
1894
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, content$LWS, [NONCE_PATTERN$LWS, '']);
1895
+ }
1848
1896
  const HTMLElement$LWS = getUnmaskedFunction$LWS(rootWindow$LWS$1.HTMLElement);
1849
1897
  const {
1850
1898
  prototype: HTMLElementProto$LWS
@@ -1880,6 +1928,32 @@ ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'parentNode');
1880
1928
  ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
1881
1929
  const rootDocumentDetachedFragment$LWS = ReflectApply$LWS$1(DocumentProtoCreateDocumentFragment$LWS, rootDocument$LWS, []);
1882
1930
  const rootDocumentDetachedContainer$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['div']);
1931
+ // Regex to match null bytes and zero-width characters that browsers may strip or ignore
1932
+ // \x00 - Null byte
1933
+ // \u00AD - Soft Hyphen
1934
+ // \u034F - Combining Grapheme Joiner
1935
+ // \u200B - Zero Width Space
1936
+ // \u200C - Zero Width Non-Joiner
1937
+ // \u200D - Zero Width Joiner
1938
+ // \u2060 - Word Joiner
1939
+ // \uFEFF - Zero Width No-Break Space (BOM)
1940
+ // eslint-disable-next-line no-control-regex, no-misleading-character-class
1941
+ const INVISIBLE_CHARS_REGEX$LWS = /[\x00\u00AD\u034F\u200B\u200C\u200D\u2060\uFEFF]/g;
1942
+ function normalizeInput$LWS(input$LWS, replacement$LWS = '') {
1943
+ // Replace invisible characters with space (not remove) to preserve token boundaries
1944
+ // This ensures DOCTYPE and the root element name remain separate tokens
1945
+ const lowerCasedInput$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, toSafeStringValue$LWS(input$LWS), []);
1946
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, lowerCasedInput$LWS, [INVISIBLE_CHARS_REGEX$LWS, replacement$LWS]);
1947
+ }
1948
+ // Regex to detect DOCTYPE with internal DTD subset containing entity definitions.
1949
+ // Matches: <!DOCTYPE root [...anything...]>
1950
+ // The internal subset can contain ENTITY, ELEMENT, ATTLIST, NOTATION declarations.
1951
+ // This is an XXE attack vector where entities can contain malicious script content.
1952
+ const DOCTYPE_WITH_INTERNAL_SUBSET_REGEX$LWS = /<!doctype\s+\S+\s*\[/;
1953
+ // Regex to detect DOCTYPE with SYSTEM or PUBLIC external entity references.
1954
+ // Matches: <!DOCTYPE root SYSTEM "..."> or <!DOCTYPE root PUBLIC "..." "...">
1955
+ // External DTDs can define entities that get expanded with malicious content.
1956
+ const DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /<!doctype\s+\S+\s+(?:system|public)\s/;
1883
1957
  /* eslint-disable no-underscore-dangle */
1884
1958
  class Validator$LWS {
1885
1959
  constructor(document$LWS, {
@@ -1893,10 +1967,32 @@ class Validator$LWS {
1893
1967
  ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, this._templates.right, [rightString$LWS]);
1894
1968
  return deepIsEqualNode$LWS(this._templates.left, this._templates.right);
1895
1969
  };
1970
+ // Detect XML External Entity (XXE) injection attacks via DOCTYPE declarations.
1971
+ // Attackers can embed malicious script content inside ENTITY definitions that
1972
+ // get expanded when the XML/SVG is rendered, bypassing DOMPurify sanitization.
1973
+ // eslint-disable-next-line class-methods-use-this
1974
+ this.isXMLEntityAttack = input$LWS => {
1975
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS, ' ');
1976
+ // Block DOCTYPE with:
1977
+ // - Internal DTD subset (e.g., <!DOCTYPE svg [<!ENTITY foo "...">]>)
1978
+ // - SYSTEM or PUBLIC external entity references
1979
+ return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, DOCTYPE_WITH_INTERNAL_SUBSET_REGEX$LWS, [normalizedInput$LWS]) || ReflectApply$LWS$1(RegExpProtoTest$LWS$1, DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS, [normalizedInput$LWS]);
1980
+ };
1981
+ // Detect namespaced script elements that execute in XML contexts.
1982
+ // HTML-mode sanitizers treat <prefix:script> as an inert unknown element,
1983
+ // but XML parsers resolve the namespace and create an executable script
1984
+ // when the namespace is XHTML or SVG. The namespace URL itself can be
1985
+ // obfuscated with XML character entities in attribute values, but the
1986
+ // xmlns attribute name cannot, so checking for "xmlns" is reliable.
1987
+ // eslint-disable-next-line class-methods-use-this
1988
+ this.isXMLNamespacedScriptAttack = input$LWS => {
1989
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
1990
+ return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
1991
+ };
1896
1992
  // There is no reason to ever allow any HTML or XML that contains all three of these substrings.
1897
1993
  // eslint-disable-next-line class-methods-use-this
1898
- this.isInherentlyUnsecure = input$LWS => {
1899
- const normalizedInput$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, toSafeStringValue$LWS(input$LWS), []);
1994
+ this.isIframeSrcdocScriptAttack = input$LWS => {
1995
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
1900
1996
  const hasIframe$LWS = hasTag$LWS(normalizedInput$LWS, 'iframe') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['srcdoc']);
1901
1997
  const hasScript$LWS = hasTag$LWS(normalizedInput$LWS, 'script');
1902
1998
  // If neither an iframe or a script was detected, then this input is safe.
@@ -1928,7 +2024,14 @@ class Validator$LWS {
1928
2024
  ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
1929
2025
  // If innerHTML contains "script", but innerText does not, then the string
1930
2026
  // was hiding a script element through some kind of obfuscation, and is unsecure.
1931
- return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(innerText$LWS, 'script');
2027
+ let checkableInnerText$LWS = innerText$LWS;
2028
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2029
+ // Strip < > : from innerText before checking, because HTML entities like
2030
+ // &lt;script&gt; decode to <script> in text content and would otherwise
2031
+ // trick hasTag into thinking visible text contains a script tag.
2032
+ checkableInnerText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, innerText$LWS, [/[<>:]/g, '']);
2033
+ }
2034
+ return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableInnerText$LWS, 'script');
1932
2035
  };
1933
2036
  this.isSharedElement = element$LWS => element$LWS === ReflectApply$LWS$1(DocumentProtoHeadGetter$LWS, this._document, []) || element$LWS === ReflectApply$LWS$1(DocumentProtoBodyGetter$LWS$1, this._document, []) || element$LWS === ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, this._document, []);
1934
2037
  this._constructors = {
@@ -1965,10 +2068,13 @@ function deepIsEqualNode$LWS(leftRoot$LWS, rightRoot$LWS) {
1965
2068
  function hasTag$LWS(input$LWS, tag$LWS) {
1966
2069
  let checkableInput$LWS = input$LWS;
1967
2070
  if (isGaterEnabledFeature$LWS('changesSince.256')) {
1968
- const lowerCasedInput$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, input$LWS, []);
1969
- checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, lowerCasedInput$LWS, [/\s+/g, ' ']);
2071
+ // Input is already lowercased and invisible chars stripped by caller
2072
+ checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, input$LWS, [/\s+/g, ' ']);
1970
2073
  }
1971
- return ReflectApply$LWS$1(StringProtoIncludes$LWS, checkableInput$LWS, [`<${tag$LWS} `]) || ReflectApply$LWS$1(StringProtoIncludes$LWS, checkableInput$LWS, [`:${tag$LWS} `]) || ReflectApply$LWS$1(StringProtoIncludes$LWS, checkableInput$LWS, [`<${tag$LWS}>`]) || ReflectApply$LWS$1(StringProtoIncludes$LWS, checkableInput$LWS, [`:${tag$LWS}>`]);
2074
+ // Match <tag or :tag (namespaced) followed by whitespace, >, /
2075
+ // Also match when directly followed by src or srcdoc (null byte was stripped)
2076
+ const tagPattern$LWS = new RegExpCtor$LWS$1(`[<:]${tag$LWS}(?:[\\s>/]|(?=src))`);
2077
+ return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, tagPattern$LWS, [checkableInput$LWS]);
1972
2078
  }
1973
2079
  const rootValidator$LWS = new Validator$LWS(rootDocument$LWS, rootWindow$LWS$1);
1974
2080
  const documentToValidatorMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1([[rootDocument$LWS, rootValidator$LWS]]));
@@ -1996,53 +2102,6 @@ const {
1996
2102
  } = BlobProto$LWS;
1997
2103
  const BlobProtoSizeGetter$LWS = ObjectLookupOwnGetter$LWS$1(BlobProto$LWS, 'size');
1998
2104
  const BlobProtoTypeGetter$LWS = ObjectLookupOwnGetter$LWS$1(BlobProto$LWS, 'type');
1999
- const {
2000
- // We don't cherry-pick the 'userAgent' property from `navigator` here
2001
- // to avoid triggering its getter.
2002
- navigator: navigator$LWS$1,
2003
- navigator: {
2004
- userAgentData: userAgentData$LWS$1
2005
- }
2006
- } = rootWindow$LWS$1;
2007
- // The user-agent client hints API is experimental and subject to change.
2008
- // https://caniuse.com/mdn-api_navigator_useragentdata
2009
- // istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
2010
- const brands$LWS$1 = userAgentData$LWS$1 == null ? void 0 : userAgentData$LWS$1.brands;
2011
- // Note: Chromium identifies itself as Chrome in its user-agent string.
2012
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
2013
- const chromiumUserAgentRegExp$LWS$1 = / (?:Headless)?Chrome\/\d+/;
2014
- const webKitUserAgentRegExp$LWS = /WebKit/i;
2015
- let userAgent$LWS$1;
2016
- function getUserAgent$LWS$1() {
2017
- if (userAgent$LWS$1 === undefined) {
2018
- userAgent$LWS$1 = navigator$LWS$1.userAgent;
2019
- }
2020
- return userAgent$LWS$1;
2021
- }
2022
- const CUSTOM_ELEMENT_REGISTRY_ATTRIBUTE_NAME$LWS = LOCKER_SERVICE_KEY_LOWERED$LWS;
2023
- // Used by '@locker/near-membrane-dom'.
2024
- const IS_CHROMIUM_BROWSER$LWS$1 =
2025
- // While experimental, `navigator.userAgentData.brands` may be defined as an
2026
- // empty array in headless Chromium based browsers.
2027
- ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ?
2028
- // Use user-agent client hints API if available to avoid deprecation
2029
- // warnings.
2030
- // https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
2031
- // istanbul ignore next: this code is not reachable in the coverage run.
2032
- ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
2033
- // prettier-ignore
2034
- // istanbul ignore next: this code is not reachable in the coverage run.
2035
- item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined :
2036
- // Fallback to a standard user-agent string sniff.
2037
- ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]);
2038
- const IS_WEBKIT_BROWSER$LWS = !IS_CHROMIUM_BROWSER$LWS$1 && (
2039
- // istanbul ignore next: this code is not reachable in the coverage run.
2040
- ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
2041
- // istanbul ignore next
2042
- item$LWS => {
2043
- const brand$LWS = item$LWS == null ? void 0 : item$LWS.brand;
2044
- return typeof brand$LWS === 'string' && ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [brand$LWS]);
2045
- }]) !== undefined : ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [getUserAgent$LWS$1()]));
2046
2105
 
2047
2106
  // Used by '@locker/near-membrane-shared-dom'.
2048
2107
  // The DOMException constructor was exposed in Edge 12 but wasn't invocable
@@ -2087,6 +2146,20 @@ const {
2087
2146
  } = ReflectGetOwnPropertyDescriptor$LWS(HTMLAnchorElementProto$LWS, 'href');
2088
2147
  const HTMLAnchorElementProtoPathnameGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'pathname');
2089
2148
  const HTMLAnchorElementProtoProtocolGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'protocol');
2149
+ const {
2150
+ prototype: HTMLButtonElementProto$LWS
2151
+ } = HTMLButtonElement;
2152
+ const {
2153
+ get: HTMLButtonElementProtoFormActionGetter$LWS,
2154
+ set: HTMLButtonElementProtoFormActionSetter$LWS
2155
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLButtonElementProto$LWS, 'formAction');
2156
+ const {
2157
+ prototype: HTMLFormElementProto$LWS
2158
+ } = HTMLFormElement;
2159
+ const {
2160
+ get: HTMLFormElementProtoActionGetter$LWS,
2161
+ set: HTMLFormElementProtoActionSetter$LWS
2162
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLFormElementProto$LWS, 'action');
2090
2163
  const {
2091
2164
  prototype: HTMLIFrameElementProto$LWS
2092
2165
  } = HTMLIFrameElement;
@@ -2096,6 +2169,13 @@ const HTMLIFrameElementProtoSandboxGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTML
2096
2169
  const HTMLIFrameElementProtoSandboxSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'sandbox');
2097
2170
  const HTMLIFrameElementProtoSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLIFrameElementProto$LWS, 'src');
2098
2171
  const HTMLIFrameElementProtoSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'src');
2172
+ const {
2173
+ prototype: HTMLInputElementProto$LWS
2174
+ } = HTMLInputElement;
2175
+ const {
2176
+ get: HTMLInputElementProtoFormActionGetter$LWS,
2177
+ set: HTMLInputElementProtoFormActionSetter$LWS
2178
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLInputElementProto$LWS, 'formAction');
2099
2179
  const HTMLScriptElementCtor$LWS = HTMLScriptElement;
2100
2180
  const {
2101
2181
  prototype: HTMLScriptElementProto$LWS
@@ -2175,6 +2255,13 @@ function getOriginalScriptProperty$LWS(script$LWS) {
2175
2255
  function isScriptEvaluated$LWS(script$LWS) {
2176
2256
  return evaluatedScriptElements$LWS.has(script$LWS);
2177
2257
  }
2258
+ function isUnknownScriptElement$LWS(element$LWS, globalObject$LWS) {
2259
+ const {
2260
+ HTMLScriptElement: HTMLScriptElement$LWS,
2261
+ SVGScriptElement: SVGScriptElement$LWS
2262
+ } = globalObject$LWS;
2263
+ return (element$LWS instanceof HTMLScriptElement$LWS || element$LWS instanceof SVGScriptElement$LWS) && !originalScriptPropertyCache$LWS.has(element$LWS) && !evaluatedScriptElements$LWS.has(element$LWS);
2264
+ }
2178
2265
  function isScriptPropertyEvaluatorHookDefined$LWS(script$LWS) {
2179
2266
  return originalScriptPropertyCache$LWS.has(script$LWS);
2180
2267
  }
@@ -2290,7 +2377,7 @@ const {
2290
2377
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2291
2378
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2292
2379
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2293
- /*! version: 0.26.4 */
2380
+ /*! version: 0.27.5 */
2294
2381
 
2295
2382
  /*!
2296
2383
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2312,6 +2399,10 @@ function isMIMETypeAllowed$LWS(mimeType$LWS) {
2312
2399
  return false;
2313
2400
  }
2314
2401
  const DISALLOWED_ENDPOINTS_LIST$LWS = ['/aura', '/webruntime'];
2402
+ // Endpoints that should not be used as browsing context targets (window.open, iframe.src)
2403
+ // because they return manipulable content. Unlike fetch/XHR which just return data,
2404
+ // browsing contexts can be manipulated by attackers to inject malicious DOM.
2405
+ const DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS = ['/chatter'];
2315
2406
  const TRUSTED_DOMAINS_REG_EXP$LWS = /\.(force|salesforce|visualforce|documentforce|my\.site|salesforce-sites)\.com$/;
2316
2407
  const URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'http:', 'https:']);
2317
2408
  const newlinesAndTabsRegExp$LWS = /[\u2028\u2029\n\r\t]/g;
@@ -2332,9 +2423,21 @@ function isSameOriginURL$LWS(resourceValue$LWS) {
2332
2423
  // then it can be treated as a same-origin URL.
2333
2424
  return resourceUrlOrigin$LWS && resourceUrlOrigin$LWS === rootWindow$LWS$1.location.origin;
2334
2425
  }
2426
+ // Detects exploit patterns that abuse the current page context
2427
+ function isAttemptingToExploitURL$LWS(resourceValue$LWS) {
2428
+ const loweredResourceValue$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, resourceValue$LWS, []);
2429
+ const locationHref$LWS = rootWindow$LWS$1.location.href;
2430
+ return loweredResourceValue$LWS === '/' || loweredResourceValue$LWS[0] === '#' || loweredResourceValue$LWS[0] === '?' || ReflectApply$LWS$1(StringProtoStartsWith$LWS, loweredResourceValue$LWS, [`${locationHref$LWS}#`]) || ReflectApply$LWS$1(StringProtoStartsWith$LWS, loweredResourceValue$LWS, [`${locationHref$LWS}?`]);
2431
+ }
2432
+ // Validates that a URL doesn't target disallowed endpoints
2335
2433
  // @TODO: W-7302311 Make paths and domains configurable.
2336
- function isValidURL$LWS(parsedURL$LWS) {
2434
+ function isAllowedEndpointURL$LWS(parsedURL$LWS) {
2337
2435
  const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2436
+ // This MUST be done inside the function because the gate may not be enabled when the
2437
+ // module code is loaded and evaluated (as would be the case for test environments)
2438
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2439
+ DISALLOWED_ENDPOINTS_LIST$LWS.push('/_nc_external', '/force', '/setup');
2440
+ }
2338
2441
  for (let i$LWS = 0, {
2339
2442
  length: length$LWS
2340
2443
  } = DISALLOWED_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -2344,6 +2447,26 @@ function isValidURL$LWS(parsedURL$LWS) {
2344
2447
  }
2345
2448
  return true;
2346
2449
  }
2450
+ // Validates that a URL is safe for browsing context targets (window.open, iframe.src).
2451
+ // Unlike fetch/XHR which just return response data, browsing contexts can be
2452
+ // manipulated by attackers to inject malicious content.
2453
+ // This includes all endpoints blocked by isAllowedEndpointURL plus browsing-context-specific ones.
2454
+ function isValidBrowsingContextURL$LWS(parsedURL$LWS) {
2455
+ // First check against the general disallowed endpoints
2456
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
2457
+ return false;
2458
+ }
2459
+ // Then check against browsing-context-specific disallowed endpoints
2460
+ const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2461
+ for (let i$LWS = 0, {
2462
+ length: length$LWS
2463
+ } = DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
2464
+ if (ReflectApply$LWS$1(StringProtoEndsWith$LWS, loweredPathname$LWS, [DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS[i$LWS]]) || ReflectApply$LWS$1(StringProtoIncludes$LWS, loweredPathname$LWS, [`${DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS[i$LWS]}/`])) {
2465
+ return false;
2466
+ }
2467
+ }
2468
+ return true;
2469
+ }
2347
2470
  function isValidURLScheme$LWS(url$LWS) {
2348
2471
  ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
2349
2472
  return URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
@@ -2365,7 +2488,7 @@ function sanitizeURLForElement$LWS(url$LWS) {
2365
2488
  function sanitizeURLString$LWS(urlString$LWS) {
2366
2489
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
2367
2490
  }
2368
- /*! version: 0.26.4 */
2491
+ /*! version: 0.27.5 */
2369
2492
 
2370
2493
  /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
2371
2494
 
@@ -3777,7 +3900,7 @@ try {
3777
3900
  // swallow
3778
3901
  }
3779
3902
  const trusted = createPolicy('trusted', policyOptions);
3780
- /*! version: 0.26.4 */
3903
+ /*! version: 0.27.5 */
3781
3904
 
3782
3905
  /*!
3783
3906
  * Copyright (C) 2019 salesforce.com, inc.
@@ -3838,7 +3961,7 @@ var CONFIG$LWS = /*#__PURE__*/Object.freeze({
3838
3961
  const instancesBySandboxKeyRegistry$LWS = {
3839
3962
  __proto__: null
3840
3963
  };
3841
- const SANITIZE_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
3964
+ const SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
3842
3965
  const SHARED_SVG_SANITIZER_KEY$LWS = 'SHARED_SVG_SANITIZER_KEY';
3843
3966
  ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
3844
3967
  // Queue for managing pending XHR requests.
@@ -4022,9 +4145,20 @@ function uponSanitizeAttribute$LWS(node$LWS, data$LWS, _config$LWS) {
4022
4145
  attrValue: attrValue$LWS,
4023
4146
  attrName: attrName$LWS
4024
4147
  } = data$LWS;
4025
- if (attrValue$LWS && ReflectApply$LWS$1(StringProtoToUpperCase$LWS, ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, []), []) === 'USE' && SANITIZE_ATTRIBUTES_LIST$LWS.includes(attrName$LWS)) {
4148
+ const nodeName$LWS = ReflectApply$LWS$1(StringProtoToUpperCase$LWS, ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, []), []);
4149
+ if (attrValue$LWS && nodeName$LWS === 'USE' && SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS.includes(attrName$LWS)) {
4026
4150
  data$LWS.attrValue = sanitizeSvgHref$LWS(attrValue$LWS);
4027
4151
  }
4152
+ // Remove action/formaction attributes pointing to disallowed endpoints.
4153
+ // Using keepAttr=false rather than blanking the value so that formaction
4154
+ // removal falls back to the form's own (already validated) action attribute
4155
+ // instead of overriding it with the current page URL.
4156
+ if (isGaterEnabledFeature$LWS('changesSince.262') && attrValue$LWS && (attrName$LWS === 'action' || attrName$LWS === 'formaction') && (nodeName$LWS === 'FORM' || nodeName$LWS === 'BUTTON' || nodeName$LWS === 'INPUT')) {
4157
+ const parsedURL$LWS = parseURL$LWS(attrValue$LWS);
4158
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
4159
+ data$LWS.keepAttr = false;
4160
+ }
4161
+ }
4028
4162
  // To support Lit, we must tell DOMPurify that attributes starting with "@", ".", or "?" are allowed.
4029
4163
  // Ref:
4030
4164
  // https://lit.dev/docs/components/events/
@@ -4042,7 +4176,7 @@ function blobSanitizer$LWS(sandboxKey$LWS) {
4042
4176
  }
4043
4177
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
4044
4178
  }
4045
- /*! version: 0.26.4 */
4179
+ /*! version: 0.27.5 */
4046
4180
 
4047
4181
  /*!
4048
4182
  * Copyright (C) 2023 salesforce.com, inc.
@@ -4096,7 +4230,8 @@ var ContentType$LWS;
4096
4230
  (function (ContentType$LWS) {
4097
4231
  ContentType$LWS[ContentType$LWS["HTML"] = 0] = "HTML";
4098
4232
  ContentType$LWS[ContentType$LWS["SVG"] = 1] = "SVG";
4099
- ContentType$LWS[ContentType$LWS["XML"] = 2] = "XML";
4233
+ ContentType$LWS[ContentType$LWS["XHTML"] = 2] = "XHTML";
4234
+ ContentType$LWS[ContentType$LWS["XML"] = 3] = "XML";
4100
4235
  })(ContentType$LWS || (ContentType$LWS = {}));
4101
4236
  const evaluatedScripts$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
4102
4237
  const scriptURLsCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
@@ -4121,11 +4256,22 @@ const policyOptions$LWS = {
4121
4256
  }
4122
4257
  case ContentType$LWS.SVG:
4123
4258
  {
4124
- const tplElement$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
4125
- ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, tplElement$LWS, [trusted.createHTML(dirty$LWS)]);
4126
- const wrappedDirty$LWS = ReflectApply$LWS$1(DocumentProtoCreateElementNS$LWS, document, [NAMESPACE_SVG$LWS, 'svg']);
4127
- ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, wrappedDirty$LWS, [trusted.createHTML(dirty$LWS)]);
4128
- const sanitized$LWS = getSanitizerForConfig$LWS('SHARED_SVG_SANITIZER_KEY', 'NODE_SVG').sanitize(wrappedDirty$LWS);
4259
+ let svgWrapper$LWS;
4260
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
4261
+ // Use template element to parse SVG content - template content is inert,
4262
+ // meaning images won't load and event handlers won't fire during parsing.
4263
+ // This prevents TOCTOU attacks where onload fires before sanitization.
4264
+ const tplElement$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
4265
+ // Wrap dirty content in SVG to ensure proper SVG namespace parsing
4266
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, tplElement$LWS, [trusted.createHTML(`<svg xmlns="${NAMESPACE_SVG$LWS}">${dirty$LWS}</svg>`)]);
4267
+ const content$LWS = ReflectApply$LWS$1(HTMLTemplateElementProtoContentGetter$LWS, tplElement$LWS, []);
4268
+ svgWrapper$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, content$LWS, []);
4269
+ } else {
4270
+ // Original behavior: create live SVG element (vulnerable to TOCTOU)
4271
+ svgWrapper$LWS = ReflectApply$LWS$1(DocumentProtoCreateElementNS$LWS, document, [NAMESPACE_SVG$LWS, 'svg']);
4272
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, svgWrapper$LWS, [trusted.createHTML(dirty$LWS)]);
4273
+ }
4274
+ const sanitized$LWS = getSanitizerForConfig$LWS('SHARED_SVG_SANITIZER_KEY', 'NODE_SVG').sanitize(svgWrapper$LWS);
4129
4275
  const firstChild$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, sanitized$LWS, []);
4130
4276
  return ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, firstChild$LWS, []);
4131
4277
  }
@@ -4239,7 +4385,7 @@ function createScriptSrcURLSetter$LWS(targetElement$LWS) {
4239
4385
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
4240
4386
  };
4241
4387
  }
4242
- /*! version: 0.26.4 */
4388
+ /*! version: 0.27.5 */
4243
4389
 
4244
4390
  /*!
4245
4391
  * Copyright (C) 2019 salesforce.com, inc.
@@ -4986,6 +5132,28 @@ function setCustomElementsRegistry$LWS(document$LWS, key$LWS) {
4986
5132
  currentRegistry$LWS = getSandboxCustomElementRegistry$LWS(document$LWS, key$LWS);
4987
5133
  }
4988
5134
  const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
5135
+
5136
+ /**
5137
+ * Blocks read access to the 'nonce' attribute.
5138
+ *
5139
+ * The 'nonce' attribute contains a cryptographic token used by Content Security Policy
5140
+ * to allow specific inline scripts/styles to execute. If malicious code can read this
5141
+ * value, it can bypass CSP by injecting scripts with the stolen nonce.
5142
+ *
5143
+ * This function is intentionally separate from the general attribute distortion registry
5144
+ * (registerAttributeDistortion/getAttributeDistortion) because that registry is designed
5145
+ * for setter distortions that validate/sanitize values being set. Most blocked attributes
5146
+ * (like 'srcdoc' on iframes) only need to block writes while allowing reads. The 'nonce'
5147
+ * attribute is unique in that it must block both reads AND writes.
5148
+ *
5149
+ * By using a dedicated function, we avoid incorrectly applying setter distortions when
5150
+ * reading attributes, which would cause errors for attributes like 'src' and 'href'.
5151
+ */
5152
+ function blockAccessToNonce$LWS(attrName$LWS) {
5153
+ if (attrName$LWS === 'nonce') {
5154
+ throw new LockerSecurityError$LWS("Attribute 'nonce' not accessible");
5155
+ }
5156
+ }
4989
5157
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
4990
5158
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4991
5159
  function finalizeAttributeDistortions$LWS(record$LWS) {
@@ -5016,11 +5184,7 @@ function finalizeAttributeDistortions$LWS(record$LWS) {
5016
5184
  attributeFactories$LWS[i$LWS](attributeDistortionRegistry$LWS);
5017
5185
  }
5018
5186
  }
5019
- function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS = NAMESPACE_DEFAULT$LWS) {
5020
- const {
5021
- document: document$LWS,
5022
- key: key$LWS
5023
- } = record$LWS;
5187
+ function lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS) {
5024
5188
  const sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS);
5025
5189
  // istanbul ignore if: currently unreachable via tests
5026
5190
  if (sandboxAttributeDistortionRegistry$LWS === undefined) {
@@ -5052,6 +5216,29 @@ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attri
5052
5216
  }
5053
5217
  return undefined;
5054
5218
  }
5219
+ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS = NAMESPACE_DEFAULT$LWS) {
5220
+ const {
5221
+ document: document$LWS,
5222
+ key: key$LWS
5223
+ } = record$LWS;
5224
+ const result$LWS = lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5225
+ if (result$LWS !== undefined) {
5226
+ return result$LWS;
5227
+ }
5228
+ // When an element is passed to a setAttribute function from a different
5229
+ // realm (e.g. cross-realm setAttribute obtained via a navigated iframe),
5230
+ // the instanceof check fails because the registry's constructors belong
5231
+ // to the function's realm, not the element's. Fall back to the element's
5232
+ // ownerDocument registry where constructors match the element's prototype
5233
+ // chain.
5234
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
5235
+ const elementDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, element$LWS, []);
5236
+ if (elementDocument$LWS && elementDocument$LWS !== document$LWS) {
5237
+ return lookupAttributeDistortion$LWS(elementDocument$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5238
+ }
5239
+ }
5240
+ return undefined;
5241
+ }
5055
5242
  // Utility for normalizing namespaces which default to HTML behavior.
5056
5243
  // script.setAttributeNS(null, 'src', 'foo.js') has the same behavior as
5057
5244
  // script.setAttribute('src', 'foo.js').
@@ -5805,9 +5992,13 @@ function initDistortionDocumentCreateElement$LWS({
5805
5992
  const {
5806
5993
  0: tagName$LWS
5807
5994
  } = args$LWS;
5995
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
5996
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
5997
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
5998
+ }
5808
5999
  // Slow path for potential custom elements that might be registered
5809
6000
  // in the sandbox's virtual custom element registry.
5810
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6001
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5811
6002
  // This must be called to signal to the virtual
5812
6003
  // CustomElementRegistry that the next thing created will be
5813
6004
  // a custom element and it must be marked for association to
@@ -5835,17 +6026,71 @@ function initDistortionDocumentCreateElementNS$LWS({
5835
6026
  const {
5836
6027
  1: tagName$LWS
5837
6028
  } = args$LWS;
6029
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
6030
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
6031
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
6032
+ }
5838
6033
  // Slow path for potential custom elements that might
5839
6034
  // be registered in the sandbox's virtual custom element registry.
5840
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6035
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5841
6036
  // This must be called to signal to the virtual
5842
6037
  // CustomElementRegistry that the next thing created will be
5843
6038
  // a custom element and it must be marked for association to
5844
6039
  // this sandbox.
5845
6040
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
5846
6041
  }
5847
- return ReflectApply$LWS$1(originalDocumentCreateElementNS$LWS, this, args$LWS);
5848
- }];
6042
+ return ReflectApply$LWS$1(originalDocumentCreateElementNS$LWS, this, args$LWS);
6043
+ }];
6044
+ };
6045
+ }
6046
+ const {
6047
+ isSharedElement: isSharedElement$C$LWS
6048
+ } = rootValidator$LWS;
6049
+ function initDistortionDocumentCreateNodeIterator$LWS({
6050
+ globalObject: {
6051
+ Document: {
6052
+ prototype: {
6053
+ createNodeIterator: originalCreateNodeIterator$LWS
6054
+ }
6055
+ }
6056
+ }
6057
+ }) {
6058
+ const distortionEntry$LWS = [originalCreateNodeIterator$LWS, function createNodeIterator$LWS(...args$LWS) {
6059
+ const {
6060
+ 0: root$LWS
6061
+ } = args$LWS;
6062
+ if (isGaterEnabledFeature$LWS('changesSince.262') && root$LWS && isSharedElement$C$LWS(root$LWS)) {
6063
+ throw new LockerSecurityError$LWS(`Cannot create NodeIterator rooted at shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, root$LWS, [])}.`);
6064
+ }
6065
+ return ReflectApply$LWS$1(originalCreateNodeIterator$LWS, this, args$LWS);
6066
+ }];
6067
+ return function distortionDocumentCreateNodeIterator$LWS() {
6068
+ return distortionEntry$LWS;
6069
+ };
6070
+ }
6071
+ const {
6072
+ isSharedElement: isSharedElement$B$LWS
6073
+ } = rootValidator$LWS;
6074
+ function initDistortionDocumentCreateTreeWalker$LWS({
6075
+ globalObject: {
6076
+ Document: {
6077
+ prototype: {
6078
+ createTreeWalker: originalCreateTreeWalker$LWS
6079
+ }
6080
+ }
6081
+ }
6082
+ }) {
6083
+ const distortionEntry$LWS = [originalCreateTreeWalker$LWS, function createTreeWalker$LWS(...args$LWS) {
6084
+ const {
6085
+ 0: root$LWS
6086
+ } = args$LWS;
6087
+ if (isGaterEnabledFeature$LWS('changesSince.262') && root$LWS && isSharedElement$B$LWS(root$LWS)) {
6088
+ throw new LockerSecurityError$LWS(`Cannot create TreeWalker rooted at shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, root$LWS, [])}.`);
6089
+ }
6090
+ return ReflectApply$LWS$1(originalCreateTreeWalker$LWS, this, args$LWS);
6091
+ }];
6092
+ return function distortionDocumentCreateTreeWalker$LWS() {
6093
+ return distortionEntry$LWS;
5849
6094
  };
5850
6095
  }
5851
6096
  function domain$LWS() {
@@ -5863,8 +6108,13 @@ function initDistortionDocumentDomainSetter$LWS({
5863
6108
  };
5864
6109
  }
5865
6110
  const {
5866
- isSharedElement: isSharedElement$s$LWS
6111
+ isSharedElement: isSharedElement$A$LWS
5867
6112
  } = rootValidator$LWS;
6113
+ // Regex to strip non-ASCII characters after NFKD normalization.
6114
+ // This handles Unicode normalization attacks like using Turkish "İ" (U+0130)
6115
+ // which Firefox normalizes to "I" in execCommand, bypassing lowercase checks.
6116
+ // eslint-disable-next-line no-control-regex
6117
+ const nonASCIIRegExp$LWS = /[^\x00-\x7F]/g;
5868
6118
  function throwLockerSecurityError$LWS(command$LWS, target$LWS) {
5869
6119
  throw new LockerSecurityError$LWS(`Cannot execute command '${command$LWS}' on ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, target$LWS, [])}.`);
5870
6120
  }
@@ -5891,7 +6141,20 @@ function initDistortionDocumentExecCommand$LWS({
5891
6141
  } = args$LWS;
5892
6142
  if (length$LWS >= 1) {
5893
6143
  const command$LWS = toSafeStringValue$LWS(args$LWS[0]);
5894
- const loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6144
+ let loweredCommand$LWS;
6145
+ // istanbul ignore else: ungated else is not reachable in coverage runs
6146
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6147
+ // Normalize the command using NFKD (Compatibility Decomposition)
6148
+ // to handle Unicode normalization attacks. For example, Turkish "İ"
6149
+ // (U+0130) decomposes to "I" + combining dot above, and we then
6150
+ // strip non-ASCII characters to get a clean ASCII string for comparison.
6151
+ // This matches Firefox's internal behavior which normalizes commands.
6152
+ const normalizedCommand$LWS = ReflectApply$LWS$1(StringProtoNormalize$LWS, command$LWS, ['NFKD']);
6153
+ const asciiOnlyCommand$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, normalizedCommand$LWS, [nonASCIIRegExp$LWS, '']);
6154
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, asciiOnlyCommand$LWS, []);
6155
+ } else {
6156
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6157
+ }
5895
6158
  if (loweredCommand$LWS === 'selectall' && this === rootDocument$LWS) {
5896
6159
  throwLockerSecurityError$LWS(command$LWS, this);
5897
6160
  }
@@ -5909,7 +6172,7 @@ function initDistortionDocumentExecCommand$LWS({
5909
6172
  // istanbul ignore else: external is the default sandbox type for coverage runs
5910
6173
  if (type$LWS === 0 /* SandboxType.External */) {
5911
6174
  const activeElement$LWS = ReflectApply$LWS$1(originalActiveElement$LWS, this, []);
5912
- if (isSharedElement$s$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
6175
+ if (isSharedElement$A$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
5913
6176
  throwLockerSecurityError$LWS(command$LWS, activeElement$LWS);
5914
6177
  }
5915
6178
  }
@@ -5961,25 +6224,23 @@ function initDistortionDocumentOpen$LWS({
5961
6224
  // for window.open
5962
6225
  // https://developer.mozilla.org/en-US/docs/Web/API/Document/open#three-argument_document.open
5963
6226
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
5964
- const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6227
+ // istanbul ignore next: resourceUrl default is not reachable via tests
5965
6228
  const {
5966
6229
  0: resourceUrl$LWS = ''
5967
6230
  } = normalizedArgs$LWS;
5968
- // In 256, limit this restriction to urls that can be treated as same-origin
5969
- // istanbul ignore else: previous behavior will not be tested in collection coverage
5970
- if (isGaterEnabledFeature$LWS('changesSince.256')) {
5971
- // This CANNOT be combined with the above condition, because doing so
5972
- // will result in the else consequent body being executed in the case
5973
- // where the gate is enabled and the url is not same origin,
5974
- // which is counter to the goals of this change!!
5975
- if (isSameOriginURL$LWS(resourceUrl$LWS)) {
5976
- // W-16032332
5977
- // Block access to unsafe child window properties
6231
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
6232
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
6233
+ }
6234
+ const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6235
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
6236
+ // istanbul ignore else: previous behavior will not be tested in collection coverage
6237
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
6238
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
6239
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
6240
+ }
6241
+ } else {
5978
6242
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5979
6243
  }
5980
- } else {
5981
- // When the gate is disabled, mark all child windows
5982
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5983
6244
  }
5984
6245
  if (childWindow$LWS) {
5985
6246
  initWindowOpenChildWindow$LWS(childWindow$LWS, resourceUrl$LWS);
@@ -6029,7 +6290,9 @@ function initDistortionDOMParserParseFromString$LWS({
6029
6290
  }) {
6030
6291
  return [originalParseFromString$LWS, function parseFromString$LWS(...args$LWS) {
6031
6292
  const {
6032
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
6293
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
6294
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
6295
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
6033
6296
  } = getValidator$LWS(document$LWS, globalObject$LWS);
6034
6297
  // DOMParser.prototype.parseFromString can only be called with
6035
6298
  // exactly two arguments. If it receives one argument, it will fail.
@@ -6045,8 +6308,12 @@ function initDistortionDOMParserParseFromString$LWS({
6045
6308
  let contentType$LWS;
6046
6309
  switch (mimeType$LWS) {
6047
6310
  case 'application/xhtml+xml':
6311
+ // XHTML is HTML in XML syntax - sanitize as HTML
6312
+ contentType$LWS = ContentType$LWS.XHTML;
6313
+ break;
6048
6314
  case 'application/xml':
6049
6315
  case 'text/xml':
6316
+ // Generic XML is not sanitized (may contain non-HTML tags)
6050
6317
  contentType$LWS = ContentType$LWS.XML;
6051
6318
  break;
6052
6319
  case 'image/svg+xml':
@@ -6055,17 +6322,19 @@ function initDistortionDOMParserParseFromString$LWS({
6055
6322
  default:
6056
6323
  contentType$LWS = ContentType$LWS.HTML;
6057
6324
  }
6325
+ // For XML/XHTML types, check for iframe/script attacks BEFORE sanitization.
6326
+ // This ensures we throw on dangerous content rather than silently removing it.
6327
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (contentType$LWS === ContentType$LWS.XML || contentType$LWS === ContentType$LWS.XHTML)) {
6328
+ if (isIframeSrcdocScriptAttack$LWS(string$LWS) || isXMLEntityAttack$LWS(string$LWS) || isXMLNamespacedScriptAttack$LWS(string$LWS)) {
6329
+ throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
6330
+ }
6331
+ }
6058
6332
  // This must be called to signal to the virtual
6059
6333
  // CustomElementRegistry that the next thing created
6060
6334
  // MAY CONTAIN a custom element, which must be marked for
6061
6335
  // association to this sandbox.
6062
6336
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6063
6337
  const trustedHtml$LWS = lwsInternalPolicy$LWS.createHTML(string$LWS, key$LWS, contentType$LWS);
6064
- if (contentType$LWS === ContentType$LWS.XML) {
6065
- if (isInherentlyUnsecure$LWS(trustedHtml$LWS)) {
6066
- throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(trustedHtml$LWS)}.`);
6067
- }
6068
- }
6069
6338
  // Reassign args with sanitized string
6070
6339
  args$LWS[0] = trustedHtml$LWS;
6071
6340
  // Prevent shapeshifting arg from manipulating the
@@ -6077,7 +6346,7 @@ function initDistortionDOMParserParseFromString$LWS({
6077
6346
  };
6078
6347
  }
6079
6348
  const {
6080
- isSharedElement: isSharedElement$r$LWS,
6349
+ isSharedElement: isSharedElement$z$LWS,
6081
6350
  isAllowedSharedElementChild: isAllowedSharedElementChild$6$LWS
6082
6351
  } = rootValidator$LWS;
6083
6352
  function initDistortionElementAfter$LWS({
@@ -6092,7 +6361,7 @@ function initDistortionElementAfter$LWS({
6092
6361
  }) {
6093
6362
  const distortionEntry$LWS = [originalAfter$LWS, function after$LWS(...args$LWS) {
6094
6363
  // istanbul ignore else: needs default platform behavior test
6095
- if (isSharedElement$r$LWS(this)) {
6364
+ if (isSharedElement$z$LWS(this)) {
6096
6365
  for (let i$LWS = 0, {
6097
6366
  length: length$LWS
6098
6367
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -6110,7 +6379,7 @@ function initDistortionElementAfter$LWS({
6110
6379
  };
6111
6380
  }
6112
6381
  const {
6113
- isSharedElement: isSharedElement$q$LWS,
6382
+ isSharedElement: isSharedElement$y$LWS,
6114
6383
  isAllowedSharedElementChild: isAllowedSharedElementChild$5$LWS
6115
6384
  } = rootValidator$LWS;
6116
6385
  function initDistortionElementAppend$LWS({
@@ -6125,7 +6394,7 @@ function initDistortionElementAppend$LWS({
6125
6394
  }) {
6126
6395
  const distortionEntry$LWS = [originalAppend$LWS, function append$LWS(...args$LWS) {
6127
6396
  // istanbul ignore else: needs default platform behavior test
6128
- if (isSharedElement$q$LWS(this)) {
6397
+ if (isSharedElement$y$LWS(this)) {
6129
6398
  // Element.prototype.append(...args) accepts an arbitrary number
6130
6399
  // of arguments which can be comprised of Nodes and DOMStrings.
6131
6400
  for (let i$LWS = 0, {
@@ -6222,7 +6491,7 @@ function initDistortionElementAttributesGetter$LWS({
6222
6491
  };
6223
6492
  }
6224
6493
  const {
6225
- isSharedElement: isSharedElement$p$LWS,
6494
+ isSharedElement: isSharedElement$x$LWS,
6226
6495
  isAllowedSharedElementChild: isAllowedSharedElementChild$4$LWS
6227
6496
  } = rootValidator$LWS;
6228
6497
  function initDistortionElementBefore$LWS({
@@ -6237,7 +6506,7 @@ function initDistortionElementBefore$LWS({
6237
6506
  }) {
6238
6507
  const distortionEntry$LWS = [originalBefore$LWS, function before$LWS(...args$LWS) {
6239
6508
  // istanbul ignore else: needs default platform behavior test
6240
- if (isSharedElement$p$LWS(this)) {
6509
+ if (isSharedElement$x$LWS(this)) {
6241
6510
  for (let i$LWS = 0, {
6242
6511
  length: length$LWS
6243
6512
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -6255,6 +6524,90 @@ function initDistortionElementBefore$LWS({
6255
6524
  return distortionEntry$LWS;
6256
6525
  };
6257
6526
  }
6527
+ function initDistortionElementGetAttribute$LWS({
6528
+ globalObject: {
6529
+ Element: {
6530
+ prototype: {
6531
+ getAttribute: originalGetAttribute$LWS
6532
+ }
6533
+ }
6534
+ }
6535
+ }) {
6536
+ return function distortionElementGetAttribute$LWS() {
6537
+ return [originalGetAttribute$LWS, function getAttribute$LWS(...args$LWS) {
6538
+ const {
6539
+ length: length$LWS
6540
+ } = args$LWS;
6541
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6542
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6543
+ }
6544
+ return ReflectApply$LWS$1(originalGetAttribute$LWS, this, args$LWS);
6545
+ }];
6546
+ };
6547
+ }
6548
+ function initDistortionElementGetAttributeNode$LWS({
6549
+ globalObject: {
6550
+ Element: {
6551
+ prototype: {
6552
+ getAttributeNode: originalGetAttributeNode$LWS
6553
+ }
6554
+ }
6555
+ }
6556
+ }) {
6557
+ return function distortionElementGetAttributeNode$LWS() {
6558
+ return [originalGetAttributeNode$LWS, function getAttributeNode$LWS(...args$LWS) {
6559
+ const {
6560
+ length: length$LWS
6561
+ } = args$LWS;
6562
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6563
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6564
+ }
6565
+ return ReflectApply$LWS$1(originalGetAttributeNode$LWS, this, args$LWS);
6566
+ }];
6567
+ };
6568
+ }
6569
+ function initDistortionElementGetAttributeNodeNS$LWS({
6570
+ globalObject: {
6571
+ Element: {
6572
+ prototype: {
6573
+ getAttributeNodeNS: originalGetAttributeNodeNS$LWS
6574
+ }
6575
+ }
6576
+ }
6577
+ }) {
6578
+ return function distortionElementGetAttributeNodeNS$LWS() {
6579
+ return [originalGetAttributeNodeNS$LWS, function getAttributeNodeNS$LWS(...args$LWS) {
6580
+ const {
6581
+ length: length$LWS
6582
+ } = args$LWS;
6583
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6584
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6585
+ }
6586
+ return ReflectApply$LWS$1(originalGetAttributeNodeNS$LWS, this, args$LWS);
6587
+ }];
6588
+ };
6589
+ }
6590
+ function initDistortionElementGetAttributeNS$LWS({
6591
+ globalObject: {
6592
+ Element: {
6593
+ prototype: {
6594
+ getAttributeNS: originalGetAttributeNS$LWS
6595
+ }
6596
+ }
6597
+ }
6598
+ }) {
6599
+ return function distortionElementGetAttributeNS$LWS() {
6600
+ return [originalGetAttributeNS$LWS, function getAttributeNS$LWS(...args$LWS) {
6601
+ const {
6602
+ length: length$LWS
6603
+ } = args$LWS;
6604
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6605
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6606
+ }
6607
+ return ReflectApply$LWS$1(originalGetAttributeNS$LWS, this, args$LWS);
6608
+ }];
6609
+ };
6610
+ }
6258
6611
 
6259
6612
  // TODO: this has been deprecated and is no longer implemented in any browser
6260
6613
  function initDistortionElementGetInnerHTML$LWS({
@@ -6301,6 +6654,28 @@ function initDistortionElementGetInnerHTML$LWS({
6301
6654
  return distortionEntry$LWS;
6302
6655
  };
6303
6656
  }
6657
+ function initDistortionElementInnerHTMLGetter$LWS({
6658
+ globalObject: globalObject$LWS
6659
+ }) {
6660
+ const {
6661
+ Element: Element$LWS
6662
+ } = globalObject$LWS;
6663
+ const originalInnerHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'innerHTML');
6664
+ const distortionEntry$LWS = [originalInnerHTMLGetter$LWS, function innerHTML$LWS() {
6665
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6666
+ var _getOriginalScriptPro$LWS;
6667
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
6668
+ return '';
6669
+ }
6670
+ return (_getOriginalScriptPro$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro$LWS : removeNoncePatterns$LWS(ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []));
6671
+ }
6672
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6673
+ return ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []);
6674
+ }];
6675
+ return function distortionElementInnerHTMLGetter$LWS() {
6676
+ return distortionEntry$LWS;
6677
+ };
6678
+ }
6304
6679
  function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTrustedString$LWS, originalScriptPropertyGetter$LWS, originalScriptPropertySetter$LWS, distortions$LWS, sandboxEvaluator$LWS, signedScriptHookSourceText$LWS) {
6305
6680
  const valueAsString$LWS = toSafeStringValue$LWS(valueAsTrustedString$LWS);
6306
6681
  if (!isScriptPropertyEvaluatorHookDefined$LWS(incomingThis$LWS)) {
@@ -6332,8 +6707,8 @@ function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTruste
6332
6707
  return false;
6333
6708
  }
6334
6709
  const {
6335
- isInherentlyUnsecure: isInherentlyUnsecure$4$LWS,
6336
- isSharedElement: isSharedElement$o$LWS
6710
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$5$LWS,
6711
+ isSharedElement: isSharedElement$w$LWS
6337
6712
  } = rootValidator$LWS;
6338
6713
  function initDistortionElementInnerHTMLSetter$LWS({
6339
6714
  document: document$LWS,
@@ -6357,9 +6732,15 @@ function initDistortionElementInnerHTMLSetter$LWS({
6357
6732
  }) {
6358
6733
  return [originalInnerHTMLSetter$LWS, function innerHTML$LWS(value$LWS) {
6359
6734
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6360
- if (!isOwnerXMLDocument$LWS) {
6735
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
6736
+ // even when inside an XMLDocument, so they must always be sanitized.
6737
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
6738
+ // Sanitize if:
6739
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
6740
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
6741
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6361
6742
  // istanbul ignore else: needs default platform behavior test
6362
- if (isSharedElement$o$LWS(this)) {
6743
+ if (isSharedElement$w$LWS(this)) {
6363
6744
  throw new LockerSecurityError$LWS(`Cannot set innerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6364
6745
  }
6365
6746
  if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement) {
@@ -6373,10 +6754,10 @@ function initDistortionElementInnerHTMLSetter$LWS({
6373
6754
  // MAY CONTAIN a custom element, which must be marked for
6374
6755
  // association to this sandbox.
6375
6756
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6376
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6757
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6377
6758
  value$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, contentType$LWS);
6378
6759
  }
6379
- if (isInherentlyUnsecure$4$LWS(value$LWS)) {
6760
+ if (isIframeSrcdocScriptAttack$5$LWS(value$LWS)) {
6380
6761
  throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6381
6762
  }
6382
6763
  ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
@@ -6384,7 +6765,7 @@ function initDistortionElementInnerHTMLSetter$LWS({
6384
6765
  };
6385
6766
  }
6386
6767
  const {
6387
- isSharedElement: isSharedElement$n$LWS,
6768
+ isSharedElement: isSharedElement$v$LWS,
6388
6769
  isAllowedSharedElementChild: isAllowedSharedElementChild$3$LWS
6389
6770
  } = rootValidator$LWS;
6390
6771
  function initDistortionElementInsertAdjacentElement$LWS({
@@ -6403,7 +6784,7 @@ function initDistortionElementInsertAdjacentElement$LWS({
6403
6784
  1: element$LWS
6404
6785
  } = args$LWS;
6405
6786
  // istanbul ignore else: needs default platform behavior test
6406
- if (isSharedElement$n$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6787
+ if (isSharedElement$v$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6407
6788
  throw new LockerSecurityError$LWS(`Cannot insert ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, element$LWS, [])} adjacent to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6408
6789
  }
6409
6790
  }
@@ -6414,8 +6795,8 @@ function initDistortionElementInsertAdjacentElement$LWS({
6414
6795
  };
6415
6796
  }
6416
6797
  const {
6417
- isInherentlyUnsecure: isInherentlyUnsecure$3$LWS,
6418
- isSharedElement: isSharedElement$m$LWS
6798
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$4$LWS,
6799
+ isSharedElement: isSharedElement$u$LWS
6419
6800
  } = rootValidator$LWS;
6420
6801
  const allowedElementHTMLRegExp$LWS = /^\s*<(link|script|style)/i;
6421
6802
  function initDistortionElementInsertAdjacentHTML$LWS({
@@ -6435,7 +6816,7 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6435
6816
  // istanbul ignore else: needs default platform behavior test
6436
6817
  if (args$LWS.length > 1) {
6437
6818
  const match$LWS = ReflectApply$LWS$1(StringProtoMatch$LWS, args$LWS[1], [allowedElementHTMLRegExp$LWS]);
6438
- if (isSharedElement$m$LWS(this) && match$LWS === null) {
6819
+ if (isSharedElement$u$LWS(this) && match$LWS === null) {
6439
6820
  throw new LockerSecurityError$LWS(`Cannot insert adjacent HTML to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}`);
6440
6821
  }
6441
6822
  // This must be called to signal to the virtual
@@ -6446,7 +6827,7 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6446
6827
  const contentType$LWS = this instanceof SVGElement ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6447
6828
  args$LWS[1] = lwsInternalPolicy$LWS.createHTML(args$LWS[1], key$LWS, contentType$LWS);
6448
6829
  // If the sanitized string is still insecure, throw an exception
6449
- if (isInherentlyUnsecure$3$LWS(args$LWS[1])) {
6830
+ if (isIframeSrcdocScriptAttack$4$LWS(args$LWS[1])) {
6450
6831
  throw new LockerSecurityError$LWS(`Cannot set 'insertAdjacentHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[1])}.`);
6451
6832
  }
6452
6833
  }
@@ -6454,9 +6835,27 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6454
6835
  }];
6455
6836
  };
6456
6837
  }
6838
+ function initDistortionElementOuterHTMLGetter$LWS({
6839
+ globalObject: {
6840
+ Element: Element$LWS
6841
+ }
6842
+ }) {
6843
+ const originalOuterHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'outerHTML');
6844
+ const distortionEntry$LWS = [originalOuterHTMLGetter$LWS, function outerHTML$LWS() {
6845
+ const html$LWS = ReflectApply$LWS$1(originalOuterHTMLGetter$LWS, this, []);
6846
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6847
+ return removeNoncePatterns$LWS(html$LWS);
6848
+ }
6849
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6850
+ return html$LWS;
6851
+ }];
6852
+ return function distortionElementOuterHTMLGetter$LWS() {
6853
+ return distortionEntry$LWS;
6854
+ };
6855
+ }
6457
6856
  const {
6458
- isInherentlyUnsecure: isInherentlyUnsecure$2$LWS,
6459
- isSharedElement: isSharedElement$l$LWS
6857
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$3$LWS,
6858
+ isSharedElement: isSharedElement$t$LWS
6460
6859
  } = rootValidator$LWS;
6461
6860
  function initDistortionElementOuterHTMLSetter$LWS({
6462
6861
  document: document$LWS,
@@ -6470,7 +6869,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6470
6869
  }) {
6471
6870
  return [originalOuterHTMLSetter$LWS, function outerHTML$LWS(value$LWS) {
6472
6871
  // istanbul ignore else: needs default platform behavior test
6473
- if (isSharedElement$l$LWS(this)) {
6872
+ if (isSharedElement$t$LWS(this)) {
6474
6873
  throw new LockerSecurityError$LWS(`Cannot set outerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6475
6874
  }
6476
6875
  // This must be called to signal to the virtual
@@ -6481,7 +6880,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6481
6880
  const html$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML);
6482
6881
  // Ensure that the created html snippet is secure (no mXSS)
6483
6882
  if (isGaterEnabledFeature$LWS('changesSince.260')) {
6484
- if (isInherentlyUnsecure$2$LWS(html$LWS)) {
6883
+ if (isIframeSrcdocScriptAttack$3$LWS(html$LWS)) {
6485
6884
  throw new LockerSecurityError$LWS(`Cannot set 'outerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6486
6885
  }
6487
6886
  }
@@ -6490,7 +6889,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6490
6889
  };
6491
6890
  }
6492
6891
  const {
6493
- isSharedElement: isSharedElement$k$LWS,
6892
+ isSharedElement: isSharedElement$s$LWS,
6494
6893
  isAllowedSharedElementChild: isAllowedSharedElementChild$2$LWS
6495
6894
  } = rootValidator$LWS;
6496
6895
  function initDistortionElementPrepend$LWS({
@@ -6505,7 +6904,7 @@ function initDistortionElementPrepend$LWS({
6505
6904
  }) {
6506
6905
  const distortionEntry$LWS = [originalPrepend$LWS, function prepend$LWS(...args$LWS) {
6507
6906
  // istanbul ignore else: needs default platform behavior test
6508
- if (isSharedElement$k$LWS(this)) {
6907
+ if (isSharedElement$s$LWS(this)) {
6509
6908
  // Element.prototype.prepend(...args) accepts an arbitrary
6510
6909
  // number of arguments which can be comprised of Nodes and
6511
6910
  // DOMStrings.
@@ -6529,7 +6928,7 @@ function initDistortionElementPrepend$LWS({
6529
6928
  };
6530
6929
  }
6531
6930
  const {
6532
- isSharedElement: isSharedElement$j$LWS
6931
+ isSharedElement: isSharedElement$r$LWS
6533
6932
  } = rootValidator$LWS;
6534
6933
  function initDistortionElementRemove$LWS({
6535
6934
  globalObject: {
@@ -6542,7 +6941,7 @@ function initDistortionElementRemove$LWS({
6542
6941
  }) {
6543
6942
  const distortionEntry$LWS = [originalRemove$LWS, function remove$LWS() {
6544
6943
  // istanbul ignore else: needs default platform behavior test
6545
- if (isSharedElement$j$LWS(this)) {
6944
+ if (isSharedElement$r$LWS(this)) {
6546
6945
  throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6547
6946
  }
6548
6947
  ReflectApply$LWS$1(originalRemove$LWS, this, []);
@@ -6552,7 +6951,7 @@ function initDistortionElementRemove$LWS({
6552
6951
  };
6553
6952
  }
6554
6953
  const {
6555
- isSharedElement: isSharedElement$i$LWS
6954
+ isSharedElement: isSharedElement$q$LWS
6556
6955
  } = rootValidator$LWS;
6557
6956
  function initDistortionElementReplaceChildren$LWS({
6558
6957
  globalObject: {
@@ -6565,7 +6964,7 @@ function initDistortionElementReplaceChildren$LWS({
6565
6964
  }) {
6566
6965
  const distortionEntry$LWS = [originalReplaceChildren$LWS, function replaceChildren$LWS(...args$LWS) {
6567
6966
  // istanbul ignore else: needs default platform behavior test
6568
- if (isSharedElement$i$LWS(this)) {
6967
+ if (isSharedElement$q$LWS(this)) {
6569
6968
  throw new LockerSecurityError$LWS(`Cannot replace children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6570
6969
  }
6571
6970
  return ReflectApply$LWS$1(originalReplaceChildren$LWS, this, args$LWS);
@@ -6575,7 +6974,7 @@ function initDistortionElementReplaceChildren$LWS({
6575
6974
  };
6576
6975
  }
6577
6976
  const {
6578
- isSharedElement: isSharedElement$h$LWS
6977
+ isSharedElement: isSharedElement$p$LWS
6579
6978
  } = rootValidator$LWS;
6580
6979
  function initDistortionElementReplaceWith$LWS({
6581
6980
  globalObject: {
@@ -6588,7 +6987,7 @@ function initDistortionElementReplaceWith$LWS({
6588
6987
  }) {
6589
6988
  const distortionEntry$LWS = [originalReplaceWith$LWS, function replaceWith$LWS(...args$LWS) {
6590
6989
  // istanbul ignore else: needs default platform behavior test
6591
- if (isSharedElement$h$LWS(this)) {
6990
+ if (isSharedElement$p$LWS(this)) {
6592
6991
  throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6593
6992
  }
6594
6993
  return ReflectApply$LWS$1(originalReplaceWith$LWS, this, args$LWS);
@@ -6794,8 +7193,8 @@ function initDistortionElementSetAttributeNS$LWS({
6794
7193
  };
6795
7194
  }
6796
7195
  const {
6797
- isInherentlyUnsecure: isInherentlyUnsecure$1$LWS,
6798
- isSharedElement: isSharedElement$g$LWS
7196
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$2$LWS,
7197
+ isSharedElement: isSharedElement$o$LWS
6799
7198
  } = rootValidator$LWS;
6800
7199
  function initDistortionElementSetHTML$LWS({
6801
7200
  document: document$LWS,
@@ -6819,10 +7218,16 @@ function initDistortionElementSetHTML$LWS({
6819
7218
  }) {
6820
7219
  return [originalSetHTML$LWS, function setHTML$LWS(...args$LWS) {
6821
7220
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6822
- if (!isOwnerXMLDocument$LWS) {
7221
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7222
+ // even when inside an XMLDocument, so they must always be sanitized.
7223
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7224
+ // Sanitize if:
7225
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7226
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7227
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6823
7228
  const normalizedValue$LWS = toSafeStringValue$LWS(args$LWS[0]);
6824
7229
  // istanbul ignore else: needs default platform behavior test
6825
- if (isSharedElement$g$LWS(this)) {
7230
+ if (isSharedElement$o$LWS(this)) {
6826
7231
  throw new LockerSecurityError$LWS(`Cannot setHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6827
7232
  }
6828
7233
  // This must be called to signal to the virtual
@@ -6832,9 +7237,9 @@ function initDistortionElementSetHTML$LWS({
6832
7237
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6833
7238
  // If options not specified, the default Sanitizer object is used.
6834
7239
  // This will be in addition to the sanitization we have.
6835
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7240
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6836
7241
  args$LWS[0] = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6837
- if (isInherentlyUnsecure$1$LWS(args$LWS[0])) {
7242
+ if (isIframeSrcdocScriptAttack$2$LWS(args$LWS[0])) {
6838
7243
  throw new LockerSecurityError$LWS(`Cannot 'setHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[0])}.`);
6839
7244
  }
6840
7245
  }
@@ -6843,8 +7248,8 @@ function initDistortionElementSetHTML$LWS({
6843
7248
  };
6844
7249
  }
6845
7250
  const {
6846
- isInherentlyUnsecure: isInherentlyUnsecure$LWS,
6847
- isSharedElement: isSharedElement$f$LWS
7251
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$1$LWS,
7252
+ isSharedElement: isSharedElement$n$LWS
6848
7253
  } = rootValidator$LWS;
6849
7254
  function initDistortionElementSetHTMLUnsafe$LWS({
6850
7255
  document: document$LWS,
@@ -6878,9 +7283,15 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6878
7283
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
6879
7284
  let normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
6880
7285
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6881
- if (!isOwnerXMLDocument$LWS) {
7286
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7287
+ // even when inside an XMLDocument, so they must always be sanitized.
7288
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7289
+ // Sanitize if:
7290
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7291
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7292
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6882
7293
  // istanbul ignore else: needs default platform behavior test
6883
- if (isSharedElement$f$LWS(this)) {
7294
+ if (isSharedElement$n$LWS(this)) {
6884
7295
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6885
7296
  }
6886
7297
  // This is necessary to support script.setHTMLUnsafe(...)
@@ -6895,10 +7306,10 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6895
7306
  // MAY CONTAIN a custom element, which must be marked for
6896
7307
  // association to this sandbox.
6897
7308
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6898
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7309
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6899
7310
  normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6900
7311
  }
6901
- if (isInherentlyUnsecure$LWS(normalizedValue$LWS)) {
7312
+ if (isIframeSrcdocScriptAttack$1$LWS(normalizedValue$LWS)) {
6902
7313
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
6903
7314
  }
6904
7315
  ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
@@ -6976,7 +7387,9 @@ function initDistortionEval$LWS({
6976
7387
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
6977
7388
  }) {
6978
7389
  return [originalEval$LWS, function (sourceText$LWS) {
6979
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7390
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7391
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7392
+ }
6980
7393
  return sandboxEvaluator$LWS(transformSourceText$LWS(toSafeStringValue$LWS(sourceText$LWS)), UNCOMPILED_CONTEXT$LWS);
6981
7394
  }];
6982
7395
  };
@@ -7084,7 +7497,9 @@ function initDistortionFunction$LWS({
7084
7497
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
7085
7498
  }) {
7086
7499
  return [originalFunction$LWS, function Function$LWS(...args$LWS) {
7087
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7500
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7501
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7502
+ }
7088
7503
  // The `arguments` object has `Symbol.iterator` as an own
7089
7504
  // property, not inherited, so it avoids prototype pollution
7090
7505
  // attacks.
@@ -7168,6 +7583,52 @@ function initDistortionHistoryReplaceState$LWS({
7168
7583
  return distortionEntry$LWS;
7169
7584
  };
7170
7585
  }
7586
+
7587
+ // Anchor elements allow blob: URLs in addition to standard schemes for download links
7588
+ const ANCHOR_URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'blob:', 'http:', 'https:']);
7589
+ function isValidAnchorURLScheme$LWS(url$LWS) {
7590
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
7591
+ return ANCHOR_URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
7592
+ }
7593
+ function initDistortionHTMLAnchorElementHrefSetter$LWS({
7594
+ globalObject: {
7595
+ HTMLAnchorElement: HTMLAnchorElement$LWS
7596
+ }
7597
+ }) {
7598
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLAnchorElement$LWS.prototype, 'href');
7599
+ function href$LWS(value$LWS) {
7600
+ const urlString$LWS = sanitizeURLForElement$LWS(value$LWS);
7601
+ if (isGaterEnabledFeature$LWS('htmlAnchorElementHrefValidation') && !isValidAnchorURLScheme$LWS(urlString$LWS)) {
7602
+ throw new LockerSecurityError$LWS('HTMLAnchorElement.href supports http://, https://, blob: schemes, relative urls and about:blank.');
7603
+ }
7604
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, this, [urlString$LWS]);
7605
+ }
7606
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7607
+ return function distortionHTMLAnchorElementHrefSetter$LWS(record$LWS) {
7608
+ if (isGaterEnabledFeature$LWS('htmlAnchorElementHrefValidation')) {
7609
+ registerAttributeDistortion$LWS(record$LWS, HTMLAnchorElement$LWS, 'href', NAMESPACE_DEFAULT$LWS, href$LWS);
7610
+ }
7611
+ // This will fall back to the original href setter if the gate is not enabled
7612
+ return distortionEntry$LWS;
7613
+ };
7614
+ }
7615
+ function initDistortionHTMLBaseElementHrefSetter$LWS({
7616
+ globalObject: {
7617
+ HTMLBaseElement: HTMLBaseElement$LWS
7618
+ }
7619
+ }) {
7620
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLBaseElement$LWS.prototype, 'href');
7621
+ function href$LWS(...args$LWS) {
7622
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7623
+ throw new LockerSecurityError$LWS('Cannot set HTMLBaseElement.href.');
7624
+ }
7625
+ return ReflectApply$LWS$1(originalHrefSetter$LWS, this, args$LWS);
7626
+ }
7627
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7628
+ return function distortionHTMLBaseElementHrefSetter$LWS() {
7629
+ return distortionEntry$LWS;
7630
+ };
7631
+ }
7171
7632
  function initDistortionHTMLBodyElementOnrejectionhandled$LWS({
7172
7633
  globalObject: {
7173
7634
  HTMLBodyElement: HTMLBodyElement$LWS
@@ -7189,6 +7650,36 @@ function initDistortionHTMLBodyElementOnunhandledrejection$LWS({
7189
7650
  }) {
7190
7651
  return createEventDistortionFactory$LWS(HTMLBodyElement$LWS.prototype, HTMLBodyElement$LWS, 'unhandledrejection');
7191
7652
  }
7653
+ function initDistortionHTMLButtonElementFormActionSetter$LWS({
7654
+ globalObject: {
7655
+ HTMLButtonElement: HTMLButtonElement$LWS
7656
+ }
7657
+ }) {
7658
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLButtonElement$LWS.prototype, 'formAction');
7659
+ return function distortionHTMLButtonElementFormActionSetter$LWS(record$LWS) {
7660
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7661
+ function formAction$LWS(value$LWS) {
7662
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
7663
+ let urlString$LWS = '';
7664
+ if (normalizedValue$LWS !== '') {
7665
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
7666
+ const {
7667
+ normalizedURL: normalizedURL$LWS
7668
+ } = parsedURL$LWS;
7669
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7670
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7671
+ }
7672
+ urlString$LWS = normalizedURL$LWS;
7673
+ }
7674
+ ReflectApply$LWS$1(HTMLButtonElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
7675
+ }
7676
+ registerAttributeDistortion$LWS(record$LWS, HTMLButtonElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
7677
+ return [originalFormActionSetter$LWS, formAction$LWS];
7678
+ }
7679
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7680
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
7681
+ };
7682
+ }
7192
7683
  function initDistortionHTMLElementCtor$LWS({
7193
7684
  document: document$LWS,
7194
7685
  globalObject: {
@@ -7228,8 +7719,26 @@ function initDistortionHTMLElementDatasetGetter$LWS({
7228
7719
  return distortionEntry$LWS;
7229
7720
  };
7230
7721
  }
7722
+ function initDistortionHTMLElementInnerTextGetter$LWS({
7723
+ globalObject: globalObject$LWS
7724
+ }) {
7725
+ const originalInnerTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(globalObject$LWS.HTMLElement.prototype, 'innerText');
7726
+ // istanbul ignore if: currently unreachable via tests
7727
+ if (typeof originalInnerTextGetter$LWS !== 'function') {
7728
+ return noop$LWS$1;
7729
+ }
7730
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
7731
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
7732
+ return '';
7733
+ }
7734
+ return ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
7735
+ }];
7736
+ return function distortionHTMLElementInnerTextGetter$LWS() {
7737
+ return distortionEntry$LWS;
7738
+ };
7739
+ }
7231
7740
  const {
7232
- isSharedElement: isSharedElement$e$LWS
7741
+ isSharedElement: isSharedElement$m$LWS
7233
7742
  } = rootValidator$LWS;
7234
7743
  function initDistortionHTMLElementInnerTextSetter$LWS({
7235
7744
  globalObject: {
@@ -7243,7 +7752,7 @@ function initDistortionHTMLElementInnerTextSetter$LWS({
7243
7752
  }
7244
7753
  const distortionEntry$LWS = [originalInnerTextSetter$LWS, function innerText$LWS(value$LWS) {
7245
7754
  // istanbul ignore else: needs default platform behavior test
7246
- if (isSharedElement$e$LWS(this)) {
7755
+ if (isSharedElement$m$LWS(this)) {
7247
7756
  throw new LockerSecurityError$LWS(`Cannot set innerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7248
7757
  }
7249
7758
  ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [value$LWS]);
@@ -7263,7 +7772,7 @@ function initDistortionHTMLElementOnsecuritypolicyviolation$LWS({
7263
7772
  return createEventDistortionFactory$LWS(HTMLElementProto$LWS, HTMLElement$LWS, 'securitypolicyviolation');
7264
7773
  }
7265
7774
  const {
7266
- isSharedElement: isSharedElement$d$LWS
7775
+ isSharedElement: isSharedElement$l$LWS
7267
7776
  } = rootValidator$LWS;
7268
7777
  // The outerText property is non-standard, so the descriptor could be undefined,
7269
7778
  // like in the case of Firefox.
@@ -7280,7 +7789,7 @@ function initDistortionHTMLElementOuterTextSetter$LWS({
7280
7789
  }
7281
7790
  const distortionEntry$LWS = [originalOuterTextSetter$LWS, function outerText$LWS(value$LWS) {
7282
7791
  // istanbul ignore else: needs default platform behavior test
7283
- if (isSharedElement$d$LWS(this)) {
7792
+ if (isSharedElement$l$LWS(this)) {
7284
7793
  throw new LockerSecurityError$LWS(`Cannot set outerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7285
7794
  }
7286
7795
  ReflectApply$LWS$1(originalOuterTextSetter$LWS, this, [value$LWS]);
@@ -7302,6 +7811,36 @@ function initDistortionHTMLElementStyleGetter$LWS({
7302
7811
  return distortionEntry$LWS;
7303
7812
  };
7304
7813
  }
7814
+ function initDistortionHTMLFormElementActionSetter$LWS({
7815
+ globalObject: {
7816
+ HTMLFormElement: HTMLFormElement$LWS
7817
+ }
7818
+ }) {
7819
+ const originalActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLFormElement$LWS.prototype, 'action');
7820
+ return function distortionHTMLFormElementActionSetter$LWS(record$LWS) {
7821
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7822
+ function action$LWS(value$LWS) {
7823
+ const normalizedActionValue$LWS = toSafeStringValue$LWS(value$LWS);
7824
+ let urlString$LWS = '';
7825
+ if (normalizedActionValue$LWS !== '') {
7826
+ const parsedURL$LWS = parseURL$LWS(normalizedActionValue$LWS);
7827
+ const {
7828
+ normalizedURL: normalizedURL$LWS
7829
+ } = parsedURL$LWS;
7830
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7831
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7832
+ }
7833
+ urlString$LWS = normalizedURL$LWS;
7834
+ }
7835
+ ReflectApply$LWS$1(HTMLFormElementProtoActionSetter$LWS, this, [urlString$LWS]);
7836
+ }
7837
+ registerAttributeDistortion$LWS(record$LWS, HTMLFormElement$LWS, 'action', NAMESPACE_DEFAULT$LWS, action$LWS);
7838
+ return [originalActionSetter$LWS, action$LWS];
7839
+ }
7840
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7841
+ return [originalActionSetter$LWS, originalActionSetter$LWS];
7842
+ };
7843
+ }
7305
7844
  function initDistortionHTMLFrameSetElementOnrejectionhandled$LWS({
7306
7845
  globalObject: {
7307
7846
  HTMLFrameSetElement: HTMLFrameSetElement$LWS
@@ -7431,6 +7970,13 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7431
7970
  return function distortionHTMLIFrameElementSrcSetter$LWS(record$LWS) {
7432
7971
  function src$LWS(value$LWS) {
7433
7972
  const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
7973
+ // This must be done on the raw value before sanitization, because sanitization can
7974
+ // remove the exploit pattern.
7975
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7976
+ if (isAttemptingToExploitURL$LWS(normalizedSrcValue$LWS)) {
7977
+ throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(normalizedSrcValue$LWS)}"`);
7978
+ }
7979
+ }
7434
7980
  // If the string being set to iframe.src is not an empty string, sanitize it for assignment
7435
7981
  // to iframe.src. If it is an empty string, let it be and proceed.
7436
7982
  // Otherwise, take no action.
@@ -7440,7 +7986,7 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7440
7986
  }
7441
7987
  if (isGaterEnabledFeature$LWS('changesSince.258')) {
7442
7988
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7443
- if (!isValidURL$LWS(parsedURL$LWS)) {
7989
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7444
7990
  const {
7445
7991
  normalizedURL: normalizedURL$LWS
7446
7992
  } = parsedURL$LWS;
@@ -7473,6 +8019,36 @@ function initDistortionHTMLIFrameElementSandboxSetter$LWS({
7473
8019
  return [originalSandboxSetter$LWS, sandbox$LWS];
7474
8020
  };
7475
8021
  }
8022
+ function initDistortionHTMLInputElementFormActionSetter$LWS({
8023
+ globalObject: {
8024
+ HTMLInputElement: HTMLInputElement$LWS
8025
+ }
8026
+ }) {
8027
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLInputElement$LWS.prototype, 'formAction');
8028
+ return function distortionHTMLInputElementFormActionSetter$LWS(record$LWS) {
8029
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8030
+ function formAction$LWS(value$LWS) {
8031
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
8032
+ let urlString$LWS = '';
8033
+ if (normalizedValue$LWS !== '') {
8034
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
8035
+ const {
8036
+ normalizedURL: normalizedURL$LWS
8037
+ } = parsedURL$LWS;
8038
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
8039
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
8040
+ }
8041
+ urlString$LWS = normalizedURL$LWS;
8042
+ }
8043
+ ReflectApply$LWS$1(HTMLInputElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
8044
+ }
8045
+ registerAttributeDistortion$LWS(record$LWS, HTMLInputElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
8046
+ return [originalFormActionSetter$LWS, formAction$LWS];
8047
+ }
8048
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8049
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
8050
+ };
8051
+ }
7476
8052
  const importRegExp$LWS = /import/i;
7477
8053
  const WARN_MESSAGE$LWS = 'Lightning Web Security: HTMLLinkElement does not allow setting "rel" property to "import" value.';
7478
8054
  function isValidRelValue$LWS(value$LWS) {
@@ -7517,6 +8093,24 @@ function initDistortionHTMLLinkElementRelListSetter$LWS({
7517
8093
  return distortionEntry$LWS;
7518
8094
  };
7519
8095
  }
8096
+ function initDistortionHTMLMetaElementContentGetter$LWS({
8097
+ globalObject: {
8098
+ HTMLMetaElement: HTMLMetaElement$LWS
8099
+ }
8100
+ }) {
8101
+ const originalContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLMetaElement$LWS.prototype, 'content');
8102
+ const distortionEntry$LWS = [originalContentGetter$LWS, function content$LWS() {
8103
+ const originalContent$LWS = ReflectApply$LWS$1(originalContentGetter$LWS, this, []);
8104
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8105
+ return removeNoncePatterns$LWS(originalContent$LWS);
8106
+ }
8107
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8108
+ return originalContent$LWS;
8109
+ }];
8110
+ return function distortionHTMLMetaElementContentGetter$LWS() {
8111
+ return distortionEntry$LWS;
8112
+ };
8113
+ }
7520
8114
  function initDistortionHTMLObjectElementDataSetter$LWS({
7521
8115
  globalObject: {
7522
8116
  HTMLObjectElement: HTMLObjectElement$LWS
@@ -7529,7 +8123,7 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7529
8123
  throw new LockerSecurityError$LWS('HTMLObjectElement.data supports http://, https:// schemes, relative urls and about:blank.');
7530
8124
  }
7531
8125
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7532
- if (!isValidURL$LWS(parsedURL$LWS)) {
8126
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7533
8127
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7534
8128
  }
7535
8129
  ReflectApply$LWS$1(originalDataSetter$LWS, this, [trusted.createScriptURL(urlString$LWS)]);
@@ -7540,6 +8134,35 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7540
8134
  return distortionEntry$LWS;
7541
8135
  };
7542
8136
  }
8137
+ function initDistortionHTMLScriptElementInnerTextGetter$LWS({
8138
+ globalObject: globalObject$LWS
8139
+ }) {
8140
+ const {
8141
+ HTMLScriptElement: HTMLScriptElement$LWS
8142
+ } = globalObject$LWS;
8143
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'innerText');
8144
+ // This may not be implemented in all browsers.
8145
+ // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
8146
+ if (!isGaterEnabledFeature$LWS('changesSince.262') || !descriptor$LWS) {
8147
+ return noop$LWS$1;
8148
+ }
8149
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8150
+ const {
8151
+ get: originalInnerTextGetter$LWS
8152
+ } = descriptor$LWS;
8153
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8154
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
8155
+ var _getOriginalScriptPro2$LWS;
8156
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8157
+ return '';
8158
+ }
8159
+ return (_getOriginalScriptPro2$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro2$LWS : ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
8160
+ }];
8161
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8162
+ return function distortionHTMLScriptElementInnerTextGetter$LWS() {
8163
+ return distortionEntry$LWS;
8164
+ };
8165
+ }
7543
8166
  const descriptorCaches$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7544
8167
  function createBlockedAttributeDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
7545
8168
  return function initDistortionBlockedAttribute$LWS() {
@@ -7672,6 +8295,14 @@ function addBlockedPropertyDistortionFactoryInitializers$LWS({
7672
8295
  }
7673
8296
  }
7674
8297
  }
8298
+ // @ts-ignore value and eval/Function have different type defs, but that's ok for identity comparison
8299
+ function throwIfUnsafeCallbackReference$LWS(value$LWS) {
8300
+ if (typeof value$LWS === 'function' && (
8301
+ // @ts-ignore
8302
+ value$LWS === eval || value$LWS === Function)) {
8303
+ throw new LockerSecurityError$LWS('Cannot pass unsafe eval or Function reference.');
8304
+ }
8305
+ }
7675
8306
  const scriptURLs$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7676
8307
  function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7677
8308
  scriptURLs$LWS.set(targetElement$LWS, url$LWS);
@@ -7679,6 +8310,13 @@ function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7679
8310
  function getScriptURL$LWS(targetElement$LWS) {
7680
8311
  return scriptURLs$LWS.get(targetElement$LWS);
7681
8312
  }
8313
+ const svgAnimatedStringOwners$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8314
+ function trackSVGAnimatedStringOwner$LWS(animatedString$LWS, owner$LWS) {
8315
+ svgAnimatedStringOwners$LWS.set(animatedString$LWS, owner$LWS);
8316
+ }
8317
+ function getSVGAnimatedStringOwner$LWS(animatedString$LWS) {
8318
+ return svgAnimatedStringOwners$LWS.get(animatedString$LWS);
8319
+ }
7682
8320
  function createScriptDistortion$LWS({
7683
8321
  sandboxEvaluator: sandboxEvaluator$LWS
7684
8322
  }, attributeName$LWS) {
@@ -7735,6 +8373,24 @@ function initDistortionHTMLScriptElementSrcSetter$LWS({
7735
8373
  return [originalSrcSetter$LWS, src$LWS];
7736
8374
  };
7737
8375
  }
8376
+ function initDistortionHTMLScriptElementTextGetter$LWS({
8377
+ globalObject: globalObject$LWS
8378
+ }) {
8379
+ const {
8380
+ HTMLScriptElement: HTMLScriptElement$LWS
8381
+ } = globalObject$LWS;
8382
+ const originalTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLScriptElement$LWS.prototype, 'text');
8383
+ const distortionEntry$LWS = [originalTextGetter$LWS, function text$LWS() {
8384
+ var _getOriginalScriptPro3$LWS;
8385
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8386
+ return '';
8387
+ }
8388
+ return (_getOriginalScriptPro3$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro3$LWS : ReflectApply$LWS$1(originalTextGetter$LWS, this, []);
8389
+ }];
8390
+ return function distortionHTMLScriptElementTextGetter$LWS() {
8391
+ return distortionEntry$LWS;
8392
+ };
8393
+ }
7738
8394
  function initDistortionHTMLScriptElementTextSetter$LWS({
7739
8395
  globalObject: {
7740
8396
  HTMLScriptElement: HTMLScriptElement$LWS
@@ -7765,10 +8421,11 @@ function initDistortionHTMLScriptElementTextSetter$LWS({
7765
8421
  };
7766
8422
  }
7767
8423
  function initDistortionHTMLScriptElementTextContentGetter$LWS({
7768
- globalObject: {
7769
- HTMLScriptElement: HTMLScriptElement$LWS
7770
- }
8424
+ globalObject: globalObject$LWS
7771
8425
  }) {
8426
+ const {
8427
+ HTMLScriptElement: HTMLScriptElement$LWS
8428
+ } = globalObject$LWS;
7772
8429
  const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'textContent');
7773
8430
  // This may not be implemented in all browsers.
7774
8431
  // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
@@ -7781,8 +8438,11 @@ function initDistortionHTMLScriptElementTextContentGetter$LWS({
7781
8438
  } = descriptor$LWS;
7782
8439
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7783
8440
  const distortionEntry$LWS = [originalTextContentGetter$LWS, function textContent$LWS() {
7784
- var _getOriginalScriptPro$LWS;
7785
- return (_getOriginalScriptPro$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8441
+ var _getOriginalScriptPro4$LWS;
8442
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8443
+ return '';
8444
+ }
8445
+ return (_getOriginalScriptPro4$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro4$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
7786
8446
  }];
7787
8447
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7788
8448
  return function distortionHTMLScriptElementSrcGetter$LWS() {
@@ -7823,6 +8483,88 @@ function initDistortionHTMLScriptElementTextContentSetter$LWS({
7823
8483
  }];
7824
8484
  };
7825
8485
  }
8486
+ function initDistortionIDBFactoryDatabases$LWS({
8487
+ globalObject: {
8488
+ IDBFactory: IDBFactory$LWS
8489
+ }
8490
+ }) {
8491
+ var _IDBFactory$prototype$LWS;
8492
+ const originalDatabases$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype$LWS.databases;
8493
+ if (typeof originalDatabases$LWS !== 'function') {
8494
+ return noop$LWS$1;
8495
+ }
8496
+ return function distortionIDBFactoryDatabases$LWS({
8497
+ key: key$LWS
8498
+ }) {
8499
+ return [originalDatabases$LWS, function databases$LWS() {
8500
+ const databasesResultPromise$LWS = ReflectApply$LWS$1(originalDatabases$LWS, this, []);
8501
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
8502
+ return databasesResultPromise$LWS;
8503
+ }
8504
+ return ReflectApply$LWS$1(PromiseProtoThen$LWS, databasesResultPromise$LWS, [result$LWS => {
8505
+ const sandboxedDatabases$LWS = [];
8506
+ let sandboxedDatabasesOffset$LWS = 0;
8507
+ for (let i$LWS = 0, {
8508
+ length: length$LWS
8509
+ } = result$LWS; i$LWS < length$LWS; i$LWS += 1) {
8510
+ const dbInfo$LWS = result$LWS[i$LWS];
8511
+ const {
8512
+ name: name$LWS
8513
+ } = dbInfo$LWS;
8514
+ if (name$LWS !== undefined && startsWithNamespaceMarker$LWS(name$LWS, key$LWS)) {
8515
+ sandboxedDatabases$LWS[sandboxedDatabasesOffset$LWS++] = {
8516
+ name: removeNamespaceMarker$LWS(name$LWS, key$LWS),
8517
+ version: dbInfo$LWS.version
8518
+ };
8519
+ }
8520
+ }
8521
+ return sandboxedDatabases$LWS;
8522
+ }]);
8523
+ }];
8524
+ };
8525
+ }
8526
+ function initDistortionIDBFactoryDeleteDatabase$LWS({
8527
+ globalObject: {
8528
+ IDBFactory: IDBFactory$LWS
8529
+ }
8530
+ }) {
8531
+ var _IDBFactory$prototype2$LWS;
8532
+ const originalDeleteDatabase$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype2$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype2$LWS.deleteDatabase;
8533
+ if (typeof originalDeleteDatabase$LWS !== 'function') {
8534
+ return noop$LWS$1;
8535
+ }
8536
+ return function distortionIDBFactoryDeleteDatabase$LWS({
8537
+ key: key$LWS
8538
+ }) {
8539
+ return [originalDeleteDatabase$LWS, function deleteDatabase$LWS(...args$LWS) {
8540
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8541
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8542
+ }
8543
+ return ReflectApply$LWS$1(originalDeleteDatabase$LWS, this, args$LWS);
8544
+ }];
8545
+ };
8546
+ }
8547
+ function initDistortionIDBFactoryOpen$LWS({
8548
+ globalObject: {
8549
+ IDBFactory: IDBFactory$LWS
8550
+ }
8551
+ }) {
8552
+ var _IDBFactory$prototype3$LWS;
8553
+ const originalOpen$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype3$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype3$LWS.open;
8554
+ if (typeof originalOpen$LWS !== 'function') {
8555
+ return noop$LWS$1;
8556
+ }
8557
+ return function distortionIDBFactoryOpen$LWS({
8558
+ key: key$LWS
8559
+ }) {
8560
+ return [originalOpen$LWS, function open$LWS(...args$LWS) {
8561
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8562
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8563
+ }
8564
+ return ReflectApply$LWS$1(originalOpen$LWS, this, args$LWS);
8565
+ }];
8566
+ };
8567
+ }
7826
8568
  function initDistortionIDBObjectStoreAdd$LWS({
7827
8569
  globalObject: {
7828
8570
  DOMException: DOMException$LWS,
@@ -7930,6 +8672,31 @@ function initDistortionMessagePortPostMessage$LWS({
7930
8672
  return distortionEntry$LWS;
7931
8673
  };
7932
8674
  }
8675
+ const {
8676
+ isSharedElement: isSharedElement$k$LWS
8677
+ } = rootValidator$LWS;
8678
+ function initDistortionMutationObserverObserve$LWS({
8679
+ globalObject: {
8680
+ MutationObserver: {
8681
+ prototype: {
8682
+ observe: originalObserve$LWS
8683
+ }
8684
+ }
8685
+ }
8686
+ }) {
8687
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(...args$LWS) {
8688
+ const {
8689
+ 0: target$LWS
8690
+ } = args$LWS;
8691
+ if (isGaterEnabledFeature$LWS('changesSince.262') && target$LWS && isSharedElement$k$LWS(target$LWS)) {
8692
+ throw new LockerSecurityError$LWS(`Cannot observe mutations on shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, target$LWS, [])}.`);
8693
+ }
8694
+ return ReflectApply$LWS$1(originalObserve$LWS, this, args$LWS);
8695
+ }];
8696
+ return function distortionMutationObserverObserve$LWS() {
8697
+ return distortionEntry$LWS;
8698
+ };
8699
+ }
7933
8700
  function initDistortionNamedNodeMapSetNamedItem$LWS({
7934
8701
  globalObject: {
7935
8702
  Attr: Attr$LWS,
@@ -7982,7 +8749,7 @@ function initDistortionNavigatorSendBeacon$LWS({
7982
8749
  const distortionEntry$LWS = [originalSendBeacon$LWS, function sendBeacon$LWS(...args$LWS) {
7983
8750
  if (args$LWS.length) {
7984
8751
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(args$LWS[0]));
7985
- if (!isValidURL$LWS(parsedURL$LWS)) {
8752
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7986
8753
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7987
8754
  }
7988
8755
  args$LWS[0] = parsedURL$LWS.normalizedURL;
@@ -8009,7 +8776,7 @@ function initDistortionNavigatorServiceWorkerGetter$LWS({
8009
8776
  };
8010
8777
  }
8011
8778
  const {
8012
- isSharedElement: isSharedElement$c$LWS,
8779
+ isSharedElement: isSharedElement$j$LWS,
8013
8780
  isAllowedSharedElementChild: isAllowedSharedElementChild$1$LWS
8014
8781
  } = rootValidator$LWS;
8015
8782
  function initDistortionNodeInsertBefore$LWS({
@@ -8032,7 +8799,7 @@ function initDistortionNodeInsertBefore$LWS({
8032
8799
  0: node$LWS
8033
8800
  } = args$LWS;
8034
8801
  // istanbul ignore else: needs default platform behavior test
8035
- if (isSharedElement$c$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8802
+ if (isSharedElement$j$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8036
8803
  throw new LockerSecurityError$LWS(`Cannot insert child ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])} into ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])},`);
8037
8804
  }
8038
8805
  }
@@ -8077,7 +8844,7 @@ function initDistortionNodeValueSetter$LWS({
8077
8844
  };
8078
8845
  }
8079
8846
  const {
8080
- isSharedElement: isSharedElement$b$LWS
8847
+ isSharedElement: isSharedElement$i$LWS
8081
8848
  } = rootValidator$LWS;
8082
8849
  function initDistortionNodeRemoveChild$LWS({
8083
8850
  globalObject: {
@@ -8098,7 +8865,7 @@ function initDistortionNodeRemoveChild$LWS({
8098
8865
  0: child$LWS
8099
8866
  } = args$LWS;
8100
8867
  // istanbul ignore else: needs default platform behavior test
8101
- if (isSharedElement$b$LWS(child$LWS)) {
8868
+ if (isSharedElement$i$LWS(child$LWS)) {
8102
8869
  throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
8103
8870
  }
8104
8871
  }
@@ -8110,7 +8877,7 @@ function initDistortionNodeRemoveChild$LWS({
8110
8877
  };
8111
8878
  }
8112
8879
  const {
8113
- isSharedElement: isSharedElement$a$LWS
8880
+ isSharedElement: isSharedElement$h$LWS
8114
8881
  } = rootValidator$LWS;
8115
8882
  function initDistortionNodeReplaceChild$LWS({
8116
8883
  globalObject: {
@@ -8134,7 +8901,7 @@ function initDistortionNodeReplaceChild$LWS({
8134
8901
  1: child$LWS
8135
8902
  } = args$LWS;
8136
8903
  // istanbul ignore else: needs default platform behavior test
8137
- if (isSharedElement$a$LWS(child$LWS)) {
8904
+ if (isSharedElement$h$LWS(child$LWS)) {
8138
8905
  throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
8139
8906
  }
8140
8907
  }
@@ -8146,19 +8913,18 @@ function initDistortionNodeReplaceChild$LWS({
8146
8913
  };
8147
8914
  }
8148
8915
  function initDistortionNodeTextContentGetter$LWS({
8916
+ globalObject: globalObject$LWS,
8149
8917
  globalObject: {
8150
- HTMLScriptElement: HTMLScriptElement$LWS,
8151
- Node: Node$LWS,
8152
- SVGScriptElement: SVGScriptElement$LWS
8918
+ Node: Node$LWS
8153
8919
  }
8154
8920
  }) {
8155
8921
  const originalTextContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(Node$LWS.prototype, 'textContent');
8156
8922
  const distortionEntry$LWS = [originalTextContentGetter$LWS, function textContent$LWS() {
8157
- if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement$LWS) {
8158
- var _getOriginalScriptPro2$LWS;
8159
- return (_getOriginalScriptPro2$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro2$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8923
+ var _getOriginalScriptPro5$LWS;
8924
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8925
+ return '';
8160
8926
  }
8161
- return ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8927
+ return (_getOriginalScriptPro5$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro5$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8162
8928
  }];
8163
8929
  return function distortionHTMLScriptElementSrcGetter$LWS() {
8164
8930
  return distortionEntry$LWS;
@@ -8173,7 +8939,7 @@ function initDistortionNodeTextContentGetter$LWS({
8173
8939
  // magenta global object, which would erroneously prevent code from interacting
8174
8940
  // with that document's <html>, <head> and <body>.
8175
8941
  const {
8176
- isSharedElement: isSharedElement$9$LWS
8942
+ isSharedElement: isSharedElement$g$LWS
8177
8943
  } = rootValidator$LWS;
8178
8944
  function initDistortionNodeTextContentSetter$LWS({
8179
8945
  globalObject: {
@@ -8228,7 +8994,7 @@ function initDistortionNodeTextContentSetter$LWS({
8228
8994
  }
8229
8995
  }
8230
8996
  // istanbul ignore else: needs default platform behavior test
8231
- else if (isSharedElement$9$LWS(this)) {
8997
+ else if (isSharedElement$g$LWS(this)) {
8232
8998
  throw new LockerSecurityError$LWS(`Cannot set textContent of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])} elements.`);
8233
8999
  }
8234
9000
  ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
@@ -8274,6 +9040,70 @@ function initDistortionNotificationCtor$LWS({
8274
9040
  return distortionEntry$LWS;
8275
9041
  };
8276
9042
  }
9043
+ function initDistortionObservableForEach$LWS({
9044
+ globalObject: {
9045
+ Observable: OriginalObservable$LWS
9046
+ }
9047
+ }) {
9048
+ var _OriginalObservable$p$LWS;
9049
+ const originalForEach$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p$LWS.forEach;
9050
+ if (typeof originalForEach$LWS !== 'function') {
9051
+ return noop$LWS$1;
9052
+ }
9053
+ const distortionEntry$LWS = [originalForEach$LWS, function forEach$LWS(...args$LWS) {
9054
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9055
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9056
+ }
9057
+ return ReflectApply$LWS$1(originalForEach$LWS, this, args$LWS);
9058
+ }];
9059
+ return function distortionObservableForEach$LWS() {
9060
+ return distortionEntry$LWS;
9061
+ };
9062
+ }
9063
+ function initDistortionObservableSubscribe$LWS({
9064
+ globalObject: {
9065
+ Observable: OriginalObservable$LWS
9066
+ }
9067
+ }) {
9068
+ var _OriginalObservable$p2$LWS;
9069
+ const originalSubscribe$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p2$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p2$LWS.subscribe;
9070
+ if (typeof originalSubscribe$LWS !== 'function') {
9071
+ return noop$LWS$1;
9072
+ }
9073
+ const distortionEntry$LWS = [originalSubscribe$LWS, function subscribe$LWS(...args$LWS) {
9074
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9075
+ const {
9076
+ 0: observerOrNext$LWS
9077
+ } = args$LWS;
9078
+ if (observerOrNext$LWS !== null && observerOrNext$LWS !== undefined) {
9079
+ if (typeof observerOrNext$LWS === 'function') {
9080
+ throwIfUnsafeCallbackReference$LWS(observerOrNext$LWS);
9081
+ } else if (typeof observerOrNext$LWS === 'object') {
9082
+ // Snapshot properties to prevent TOCTOU: attacker-controlled
9083
+ // getters could return a safe value during the check but
9084
+ // return eval when Observable reads them internally.
9085
+ const {
9086
+ next: next$LWS,
9087
+ error,
9088
+ complete: complete$LWS
9089
+ } = observerOrNext$LWS;
9090
+ throwIfUnsafeCallbackReference$LWS(next$LWS);
9091
+ throwIfUnsafeCallbackReference$LWS(error);
9092
+ throwIfUnsafeCallbackReference$LWS(complete$LWS);
9093
+ args$LWS[0] = {
9094
+ next: next$LWS,
9095
+ error,
9096
+ complete: complete$LWS
9097
+ };
9098
+ }
9099
+ }
9100
+ }
9101
+ return ReflectApply$LWS$1(originalSubscribe$LWS, this, args$LWS);
9102
+ }];
9103
+ return function distortionObservableSubscribe$LWS() {
9104
+ return distortionEntry$LWS;
9105
+ };
9106
+ }
8277
9107
  function initDistortionPerformanceMark$LWS({
8278
9108
  globalObject: {
8279
9109
  Performance: {
@@ -8334,51 +9164,342 @@ function initDistortionPerformanceMarkCtor$LWS({
8334
9164
  PerformanceMark: originalPerformanceMarkCtor$LWS
8335
9165
  }
8336
9166
  }) {
8337
- // istanbul ignore if: needs default platform behavior test
8338
- if (typeof originalPerformanceMarkCtor$LWS !== 'function') {
8339
- return noop$LWS$1;
8340
- }
8341
- const distortionEntry$LWS = [originalPerformanceMarkCtor$LWS, function PerformanceMark$LWS(...args$LWS) {
8342
- try {
8343
- return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
8344
- } catch (error) {
8345
- if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
8346
- const providedOptions$LWS = args$LWS[1];
8347
- if (isObject$LWS$1(providedOptions$LWS)) {
8348
- args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
8349
- return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9167
+ // istanbul ignore if: needs default platform behavior test
9168
+ if (typeof originalPerformanceMarkCtor$LWS !== 'function') {
9169
+ return noop$LWS$1;
9170
+ }
9171
+ const distortionEntry$LWS = [originalPerformanceMarkCtor$LWS, function PerformanceMark$LWS(...args$LWS) {
9172
+ try {
9173
+ return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9174
+ } catch (error) {
9175
+ if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
9176
+ const providedOptions$LWS = args$LWS[1];
9177
+ if (isObject$LWS$1(providedOptions$LWS)) {
9178
+ args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
9179
+ return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9180
+ }
9181
+ }
9182
+ throw error;
9183
+ }
9184
+ }];
9185
+ return function distortionPerformanceMarkCtor$LWS() {
9186
+ return distortionEntry$LWS;
9187
+ };
9188
+ }
9189
+ function initDistortionPromiseAll$LWS({
9190
+ globalObject: {
9191
+ Promise: Promise$LWS
9192
+ }
9193
+ }) {
9194
+ const originalPromiseAll$LWS = Promise$LWS == null ? void 0 : Promise$LWS.all;
9195
+ if (typeof originalPromiseAll$LWS !== 'function') {
9196
+ return noop$LWS$1;
9197
+ }
9198
+ const distortionEntry$LWS = [originalPromiseAll$LWS, function (...args$LWS) {
9199
+ // Always use the real Promise constructor as `this` to prevent
9200
+ // malicious constructors from being passed via Promise.all.call()
9201
+ // that could inject eval as resolve/reject callbacks.
9202
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9203
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, Promise$LWS, args$LWS);
9204
+ }
9205
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, this, args$LWS);
9206
+ }];
9207
+ return function distortionPromiseAll$LWS() {
9208
+ return distortionEntry$LWS;
9209
+ };
9210
+ }
9211
+ function initDistortionPromiseAllSettled$LWS({
9212
+ globalObject: {
9213
+ Promise: Promise$LWS
9214
+ }
9215
+ }) {
9216
+ const originalPromiseAllSettled$LWS = Promise$LWS == null ? void 0 : Promise$LWS.allSettled;
9217
+ if (typeof originalPromiseAllSettled$LWS !== 'function') {
9218
+ return noop$LWS$1;
9219
+ }
9220
+ const distortionEntry$LWS = [originalPromiseAllSettled$LWS, function (...args$LWS) {
9221
+ // Always use the real Promise constructor as `this` to prevent
9222
+ // malicious constructors from being passed via Promise.allSettled.call()
9223
+ // that could inject eval as resolve/reject callbacks.
9224
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9225
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, Promise$LWS, args$LWS);
9226
+ }
9227
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, this, args$LWS);
9228
+ }];
9229
+ return function distortionPromiseAllSettled$LWS() {
9230
+ return distortionEntry$LWS;
9231
+ };
9232
+ }
9233
+ function initDistortionPromiseAny$LWS({
9234
+ globalObject: {
9235
+ Promise: Promise$LWS
9236
+ }
9237
+ }) {
9238
+ const originalPromiseAny$LWS = Promise$LWS == null ? void 0 : Promise$LWS.any;
9239
+ if (typeof originalPromiseAny$LWS !== 'function') {
9240
+ return noop$LWS$1;
9241
+ }
9242
+ const distortionEntry$LWS = [originalPromiseAny$LWS, function (...args$LWS) {
9243
+ // Always use the real Promise constructor as `this` to prevent
9244
+ // malicious constructors from being passed via Promise.any.call()
9245
+ // that could inject eval as resolve/reject callbacks.
9246
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9247
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, Promise$LWS, args$LWS);
9248
+ }
9249
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, this, args$LWS);
9250
+ }];
9251
+ return function distortionPromiseAny$LWS() {
9252
+ return distortionEntry$LWS;
9253
+ };
9254
+ }
9255
+ function initDistortionPromiseCatch$LWS({
9256
+ globalObject: {
9257
+ Promise: {
9258
+ prototype: PromiseProto$LWS
9259
+ }
9260
+ }
9261
+ }) {
9262
+ const originalPromiseCatch$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.catch;
9263
+ if (typeof originalPromiseCatch$LWS !== 'function') {
9264
+ return noop$LWS$1;
9265
+ }
9266
+ const distortionEntry$LWS = [originalPromiseCatch$LWS, function (...args$LWS) {
9267
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9268
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9269
+ }
9270
+ return ReflectApply$LWS$1(originalPromiseCatch$LWS, this, args$LWS);
9271
+ }];
9272
+ return function distortionPromiseCatch$LWS() {
9273
+ return distortionEntry$LWS;
9274
+ };
9275
+ }
9276
+ function initDistortionPromiseFinally$LWS({
9277
+ globalObject: {
9278
+ Promise: {
9279
+ prototype: PromiseProto$LWS
9280
+ }
9281
+ }
9282
+ }) {
9283
+ const originalPromiseFinally$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.finally;
9284
+ if (typeof originalPromiseFinally$LWS !== 'function') {
9285
+ return noop$LWS$1;
9286
+ }
9287
+ const distortionEntry$LWS = [originalPromiseFinally$LWS, function (...args$LWS) {
9288
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9289
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9290
+ }
9291
+ return ReflectApply$LWS$1(originalPromiseFinally$LWS, this, args$LWS);
9292
+ }];
9293
+ return function distortionPromiseFinally$LWS() {
9294
+ return distortionEntry$LWS;
9295
+ };
9296
+ }
9297
+ function initDistortionPromiseRace$LWS({
9298
+ globalObject: {
9299
+ Promise: Promise$LWS
9300
+ }
9301
+ }) {
9302
+ const originalPromiseRace$LWS = Promise$LWS == null ? void 0 : Promise$LWS.race;
9303
+ if (typeof originalPromiseRace$LWS !== 'function') {
9304
+ return noop$LWS$1;
9305
+ }
9306
+ const distortionEntry$LWS = [originalPromiseRace$LWS, function (...args$LWS) {
9307
+ // Always use the real Promise constructor as `this` to prevent
9308
+ // malicious constructors from being passed via Promise.race.call()
9309
+ // that could inject eval as resolve/reject callbacks.
9310
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9311
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, Promise$LWS, args$LWS);
9312
+ }
9313
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, this, args$LWS);
9314
+ }];
9315
+ return function distortionPromiseRace$LWS() {
9316
+ return distortionEntry$LWS;
9317
+ };
9318
+ }
9319
+ function initDistortionPromiseReject$LWS({
9320
+ globalObject: {
9321
+ Promise: Promise$LWS
9322
+ }
9323
+ }) {
9324
+ const originalPromiseReject$LWS = Promise$LWS == null ? void 0 : Promise$LWS.reject;
9325
+ if (typeof originalPromiseReject$LWS !== 'function') {
9326
+ return noop$LWS$1;
9327
+ }
9328
+ const distortionEntry$LWS = [originalPromiseReject$LWS, function (...args$LWS) {
9329
+ // Always use the real Promise constructor as `this` to prevent
9330
+ // malicious constructors from being passed via Promise.reject.call()
9331
+ // that could inject eval as resolve/reject callbacks.
9332
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9333
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, Promise$LWS, args$LWS);
9334
+ }
9335
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, this, args$LWS);
9336
+ }];
9337
+ return function distortionPromiseReject$LWS() {
9338
+ return distortionEntry$LWS;
9339
+ };
9340
+ }
9341
+ function initDistortionPromiseResolve$LWS({
9342
+ globalObject: {
9343
+ Promise: Promise$LWS
9344
+ }
9345
+ }) {
9346
+ const originalPromiseResolve$LWS = Promise$LWS == null ? void 0 : Promise$LWS.resolve;
9347
+ if (typeof originalPromiseResolve$LWS !== 'function') {
9348
+ return noop$LWS$1;
9349
+ }
9350
+ const distortionEntry$LWS = [originalPromiseResolve$LWS, function (...args$LWS) {
9351
+ // Always use the real Promise constructor as `this` to prevent
9352
+ // malicious constructors from being passed via Promise.resolve.call()
9353
+ // that could inject eval as resolve/reject callbacks.
9354
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9355
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, Promise$LWS, args$LWS);
9356
+ }
9357
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, this, args$LWS);
9358
+ }];
9359
+ return function distortionPromiseResolve$LWS() {
9360
+ return distortionEntry$LWS;
9361
+ };
9362
+ }
9363
+ function initDistortionPromiseThen$LWS({
9364
+ globalObject: {
9365
+ Promise: {
9366
+ prototype: PromiseProto$LWS
9367
+ }
9368
+ }
9369
+ }) {
9370
+ const originalPromiseThen$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.then;
9371
+ if (typeof originalPromiseThen$LWS !== 'function') {
9372
+ return noop$LWS$1;
9373
+ }
9374
+ const distortionEntry$LWS = [originalPromiseThen$LWS, function then$LWS(...args$LWS) {
9375
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9376
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9377
+ throwIfUnsafeCallbackReference$LWS(args$LWS[1]);
9378
+ }
9379
+ return ReflectApply$LWS$1(originalPromiseThen$LWS, this, args$LWS);
9380
+ }];
9381
+ return function distortionPromiseThen$LWS() {
9382
+ return distortionEntry$LWS;
9383
+ };
9384
+ }
9385
+ function initDistortionPromiseTry$LWS({
9386
+ globalObject: {
9387
+ Promise: Promise$LWS
9388
+ }
9389
+ }) {
9390
+ const originalPromiseTry$LWS = Promise$LWS == null ? void 0 : Promise$LWS.try;
9391
+ if (typeof originalPromiseTry$LWS !== 'function') {
9392
+ return noop$LWS$1;
9393
+ }
9394
+ const distortionEntry$LWS = [originalPromiseTry$LWS, function (...args$LWS) {
9395
+ if (isGaterEnabledFeature$LWS('changesSince.260')) {
9396
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9397
+ }
9398
+ // Always use the real Promise constructor as `this` to prevent
9399
+ // malicious constructors from being passed via Promise.try.call()
9400
+ // that could inject eval as resolve/reject callbacks.
9401
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9402
+ return ReflectApply$LWS$1(originalPromiseTry$LWS, Promise$LWS, args$LWS);
9403
+ }
9404
+ return ReflectApply$LWS$1(originalPromiseTry$LWS, this, args$LWS);
9405
+ }];
9406
+ return function distortionPromiseTry$LWS() {
9407
+ return distortionEntry$LWS;
9408
+ };
9409
+ }
9410
+ function initDistortionPromiseWithResolvers$LWS({
9411
+ globalObject: {
9412
+ Promise: Promise$LWS
9413
+ }
9414
+ }) {
9415
+ const originalPromiseWithResolvers$LWS = Promise$LWS == null ? void 0 : Promise$LWS.withResolvers;
9416
+ if (typeof originalPromiseWithResolvers$LWS !== 'function') {
9417
+ return noop$LWS$1;
9418
+ }
9419
+ const distortionEntry$LWS = [originalPromiseWithResolvers$LWS, function () {
9420
+ // Always use the real Promise constructor as `this` to prevent
9421
+ // malicious constructors from being passed via Promise.withResolvers.call()
9422
+ // that could leak eval as resolve/reject references.
9423
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9424
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, Promise$LWS, []);
9425
+ }
9426
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, this, []);
9427
+ }];
9428
+ return function distortionPromiseWithResolvers$LWS() {
9429
+ return distortionEntry$LWS;
9430
+ };
9431
+ }
9432
+ const {
9433
+ isSharedElement: isSharedElement$f$LWS
9434
+ } = rootValidator$LWS;
9435
+ function initDistortionRangeCloneContents$LWS({
9436
+ globalObject: {
9437
+ AbstractRange: AbstractRange$LWS,
9438
+ Range: {
9439
+ prototype: {
9440
+ cloneContents: originalCloneContents$LWS
9441
+ }
9442
+ }
9443
+ }
9444
+ }) {
9445
+ // istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
9446
+ const {
9447
+ prototype: AbstractRangeProto$LWS
9448
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9449
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9450
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9451
+ const distortionEntry$LWS = [originalCloneContents$LWS, function cloneContents$LWS(...args$LWS) {
9452
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9453
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9454
+ for (let i$LWS = 0, {
9455
+ length: length$LWS
9456
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9457
+ const container$LWS = containers$LWS[i$LWS];
9458
+ if (isSharedElement$f$LWS(container$LWS)) {
9459
+ throw new LockerSecurityError$LWS(`Cannot clone contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8350
9460
  }
8351
9461
  }
8352
- throw error;
8353
9462
  }
9463
+ return ReflectApply$LWS$1(originalCloneContents$LWS, this, args$LWS);
8354
9464
  }];
8355
- return function distortionPerformanceMarkCtor$LWS() {
9465
+ return function distortionRangeCloneContents$LWS() {
8356
9466
  return distortionEntry$LWS;
8357
9467
  };
8358
9468
  }
8359
- function initDistortionPromiseTry$LWS({
9469
+ const {
9470
+ isSharedElement: isSharedElement$e$LWS
9471
+ } = rootValidator$LWS;
9472
+ function initDistortionRangeCloneRange$LWS({
8360
9473
  globalObject: {
8361
- Promise: Promise$LWS
9474
+ AbstractRange: AbstractRange$LWS,
9475
+ Range: {
9476
+ prototype: {
9477
+ cloneRange: originalCloneRange$LWS
9478
+ }
9479
+ }
8362
9480
  }
8363
9481
  }) {
8364
- const originalPromiseTry$LWS = Promise$LWS == null ? void 0 : Promise$LWS.try;
8365
- if (typeof originalPromiseTry$LWS !== 'function') {
8366
- return noop$LWS$1;
8367
- }
8368
- const distortionEntry$LWS = [originalPromiseTry$LWS, function (...args$LWS) {
8369
- const {
8370
- 0: callback$LWS
8371
- } = args$LWS;
8372
- if (typeof callback$LWS === 'function') {
8373
- if (isGaterEnabledFeature$LWS('changesSince.260') &&
8374
- // @ts-ignore callback and eval have different type defs, but that's ok for this condition
8375
- callback$LWS === eval) {
8376
- throw new LockerSecurityError$LWS('Cannot pass unsafe eval reference.');
9482
+ // istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
9483
+ const {
9484
+ prototype: AbstractRangeProto$LWS
9485
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9486
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9487
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9488
+ const distortionEntry$LWS = [originalCloneRange$LWS, function cloneRange$LWS(...args$LWS) {
9489
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9490
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9491
+ for (let i$LWS = 0, {
9492
+ length: length$LWS
9493
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9494
+ const container$LWS = containers$LWS[i$LWS];
9495
+ if (isSharedElement$e$LWS(container$LWS)) {
9496
+ throw new LockerSecurityError$LWS(`Cannot clone range of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9497
+ }
8377
9498
  }
8378
9499
  }
8379
- return ReflectApply$LWS$1(originalPromiseTry$LWS, this, args$LWS);
9500
+ return ReflectApply$LWS$1(originalCloneRange$LWS, this, args$LWS);
8380
9501
  }];
8381
- return function distortionPromiseTry$LWS() {
9502
+ return function distortionRangeCloneRange$LWS() {
8382
9503
  return distortionEntry$LWS;
8383
9504
  };
8384
9505
  }
@@ -8414,7 +9535,7 @@ function initDistortionRangeCreateContextualFragment$LWS({
8414
9535
  };
8415
9536
  }
8416
9537
  const {
8417
- isSharedElement: isSharedElement$8$LWS
9538
+ isSharedElement: isSharedElement$d$LWS
8418
9539
  } = rootValidator$LWS;
8419
9540
  function initDistortionRangeDeleteContents$LWS({
8420
9541
  globalObject: {
@@ -8443,7 +9564,7 @@ function initDistortionRangeDeleteContents$LWS({
8443
9564
  length: length$LWS
8444
9565
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8445
9566
  const container$LWS = containers$LWS[i$LWS];
8446
- if (isSharedElement$8$LWS(container$LWS)) {
9567
+ if (isSharedElement$d$LWS(container$LWS)) {
8447
9568
  throw new LockerSecurityError$LWS(`Cannot delete contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8448
9569
  }
8449
9570
  }
@@ -8454,7 +9575,7 @@ function initDistortionRangeDeleteContents$LWS({
8454
9575
  };
8455
9576
  }
8456
9577
  const {
8457
- isSharedElement: isSharedElement$7$LWS
9578
+ isSharedElement: isSharedElement$c$LWS
8458
9579
  } = rootValidator$LWS;
8459
9580
  function initDistortionRangeExtractContents$LWS({
8460
9581
  globalObject: {
@@ -8483,7 +9604,7 @@ function initDistortionRangeExtractContents$LWS({
8483
9604
  length: length$LWS
8484
9605
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8485
9606
  const container$LWS = containers$LWS[i$LWS];
8486
- if (isSharedElement$7$LWS(container$LWS)) {
9607
+ if (isSharedElement$c$LWS(container$LWS)) {
8487
9608
  throw new LockerSecurityError$LWS(`Cannot extract contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8488
9609
  }
8489
9610
  }
@@ -8494,7 +9615,44 @@ function initDistortionRangeExtractContents$LWS({
8494
9615
  };
8495
9616
  }
8496
9617
  const {
8497
- isSharedElement: isSharedElement$6$LWS,
9618
+ isSharedElement: isSharedElement$b$LWS
9619
+ } = rootValidator$LWS;
9620
+ function initDistortionRangeGetBoundingClientRect$LWS({
9621
+ globalObject: {
9622
+ AbstractRange: AbstractRange$LWS,
9623
+ Range: {
9624
+ prototype: {
9625
+ getBoundingClientRect: originalGetBoundingClientRect$LWS
9626
+ }
9627
+ }
9628
+ }
9629
+ }) {
9630
+ // istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
9631
+ const {
9632
+ prototype: AbstractRangeProto$LWS
9633
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9634
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9635
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9636
+ const distortionEntry$LWS = [originalGetBoundingClientRect$LWS, function getBoundingClientRect$LWS(...args$LWS) {
9637
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9638
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9639
+ for (let i$LWS = 0, {
9640
+ length: length$LWS
9641
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9642
+ const container$LWS = containers$LWS[i$LWS];
9643
+ if (isSharedElement$b$LWS(container$LWS)) {
9644
+ throw new LockerSecurityError$LWS(`Cannot get bounding client rect of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9645
+ }
9646
+ }
9647
+ }
9648
+ return ReflectApply$LWS$1(originalGetBoundingClientRect$LWS, this, args$LWS);
9649
+ }];
9650
+ return function distortionRangeGetBoundingClientRect$LWS() {
9651
+ return distortionEntry$LWS;
9652
+ };
9653
+ }
9654
+ const {
9655
+ isSharedElement: isSharedElement$a$LWS,
8498
9656
  isAllowedSharedElementChild: isAllowedSharedElementChild$LWS
8499
9657
  } = rootValidator$LWS;
8500
9658
  function initDistortionRangeInsertNode$LWS({
@@ -8514,7 +9672,7 @@ function initDistortionRangeInsertNode$LWS({
8514
9672
  // istanbul ignore else: needs default platform behavior test
8515
9673
  if (args$LWS.length) {
8516
9674
  const commonAncestorContainer$LWS = ReflectApply$LWS$1(originalCommonAncestorContainerGetter$LWS, this, []);
8517
- if (commonAncestorContainer$LWS && isSharedElement$6$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
9675
+ if (commonAncestorContainer$LWS && isSharedElement$a$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
8518
9676
  throw new LockerSecurityError$LWS(`Cannot insert a new child node of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, commonAncestorContainer$LWS, [])}.`);
8519
9677
  }
8520
9678
  }
@@ -8525,7 +9683,7 @@ function initDistortionRangeInsertNode$LWS({
8525
9683
  };
8526
9684
  }
8527
9685
  const {
8528
- isSharedElement: isSharedElement$5$LWS
9686
+ isSharedElement: isSharedElement$9$LWS
8529
9687
  } = rootValidator$LWS;
8530
9688
  function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS) {
8531
9689
  return function initDistortionRangeProtoMethod$LWS({
@@ -8550,7 +9708,7 @@ function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS)
8550
9708
  0: node$LWS
8551
9709
  } = args$LWS;
8552
9710
  // istanbul ignore else: needs default platform behavior test
8553
- if (isSharedElement$5$LWS(node$LWS)) {
9711
+ if (isSharedElement$9$LWS(node$LWS)) {
8554
9712
  throw new LockerSecurityError$LWS(`Cannot call ${methodName$LWS} with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}.`);
8555
9713
  }
8556
9714
  }
@@ -8573,7 +9731,66 @@ const initDistortionRangeSetStartAfter$LWS = createRangeProtoMethodDistortionFac
8573
9731
  const initDistortionRangeSetStartBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartBefore');
8574
9732
  const initDistortionRangeSurroundContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('surroundContents');
8575
9733
  const {
8576
- isSharedElement: isSharedElement$4$LWS
9734
+ isSharedElement: isSharedElement$8$LWS
9735
+ } = rootValidator$LWS;
9736
+ function initDistortionRangeToString$LWS({
9737
+ globalObject: {
9738
+ AbstractRange: AbstractRange$LWS,
9739
+ Range: {
9740
+ prototype: {
9741
+ toString: originalRangeToString$LWS
9742
+ }
9743
+ }
9744
+ }
9745
+ }) {
9746
+ // istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
9747
+ const {
9748
+ prototype: AbstractRangeProto$LWS
9749
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9750
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9751
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9752
+ const distortionEntry$LWS = [originalRangeToString$LWS, function toString$LWS(...args$LWS) {
9753
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9754
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9755
+ for (let i$LWS = 0, {
9756
+ length: length$LWS
9757
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9758
+ const container$LWS = containers$LWS[i$LWS];
9759
+ if (isSharedElement$8$LWS(container$LWS)) {
9760
+ throw new LockerSecurityError$LWS(`Cannot read contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9761
+ }
9762
+ }
9763
+ }
9764
+ return ReflectApply$LWS$1(originalRangeToString$LWS, this, args$LWS);
9765
+ }];
9766
+ return function distortionRangeToString$LWS() {
9767
+ return distortionEntry$LWS;
9768
+ };
9769
+ }
9770
+ const {
9771
+ isSharedElement: isSharedElement$7$LWS
9772
+ } = rootValidator$LWS;
9773
+ function initDistortionSelectionAnchorNodeGetter$LWS({
9774
+ globalObject: {
9775
+ Selection: Selection$LWS
9776
+ }
9777
+ }) {
9778
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'anchorNode');
9779
+ const distortionEntry$LWS = [originalAnchorNodeGetter$LWS, function anchorNode$LWS() {
9780
+ const node$LWS = ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []);
9781
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9782
+ if (node$LWS && isSharedElement$7$LWS(node$LWS)) {
9783
+ return null;
9784
+ }
9785
+ }
9786
+ return node$LWS;
9787
+ }];
9788
+ return function distortionSelectionAnchorNodeGetter$LWS() {
9789
+ return distortionEntry$LWS;
9790
+ };
9791
+ }
9792
+ const {
9793
+ isSharedElement: isSharedElement$6$LWS
8577
9794
  } = rootValidator$LWS;
8578
9795
  function initDistortionSelectionCollapse$LWS({
8579
9796
  globalObject: {
@@ -8590,7 +9807,7 @@ function initDistortionSelectionCollapse$LWS({
8590
9807
  0: node$LWS
8591
9808
  } = args$LWS;
8592
9809
  // The first arg to Selection.prototype.collapse is "Node | null"
8593
- if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
9810
+ if (node$LWS && isSharedElement$6$LWS(node$LWS)) {
8594
9811
  throw new LockerSecurityError$LWS(`Cannot collapse selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8595
9812
  }
8596
9813
  }
@@ -8601,7 +9818,7 @@ function initDistortionSelectionCollapse$LWS({
8601
9818
  };
8602
9819
  }
8603
9820
  const {
8604
- isSharedElement: isSharedElement$3$LWS
9821
+ isSharedElement: isSharedElement$5$LWS
8605
9822
  } = rootValidator$LWS;
8606
9823
  function initDistortionSelectionExtend$LWS({
8607
9824
  globalObject: {
@@ -8617,7 +9834,7 @@ function initDistortionSelectionExtend$LWS({
8617
9834
  const {
8618
9835
  0: node$LWS
8619
9836
  } = args$LWS;
8620
- if (isSharedElement$3$LWS(node$LWS)) {
9837
+ if (isSharedElement$5$LWS(node$LWS)) {
8621
9838
  throw new LockerSecurityError$LWS(`Cannot extend selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8622
9839
  }
8623
9840
  }
@@ -8628,7 +9845,29 @@ function initDistortionSelectionExtend$LWS({
8628
9845
  };
8629
9846
  }
8630
9847
  const {
8631
- isSharedElement: isSharedElement$2$LWS
9848
+ isSharedElement: isSharedElement$4$LWS
9849
+ } = rootValidator$LWS;
9850
+ function initDistortionSelectionFocusNodeGetter$LWS({
9851
+ globalObject: {
9852
+ Selection: Selection$LWS
9853
+ }
9854
+ }) {
9855
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'focusNode');
9856
+ const distortionEntry$LWS = [originalFocusNodeGetter$LWS, function focusNode$LWS() {
9857
+ const node$LWS = ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, []);
9858
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9859
+ if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
9860
+ return null;
9861
+ }
9862
+ }
9863
+ return node$LWS;
9864
+ }];
9865
+ return function distortionSelectionFocusNodeGetter$LWS() {
9866
+ return distortionEntry$LWS;
9867
+ };
9868
+ }
9869
+ const {
9870
+ isSharedElement: isSharedElement$3$LWS
8632
9871
  } = rootValidator$LWS;
8633
9872
  function initDistortionSelectionSelectAllChildren$LWS({
8634
9873
  globalObject: {
@@ -8644,7 +9883,7 @@ function initDistortionSelectionSelectAllChildren$LWS({
8644
9883
  const {
8645
9884
  0: node$LWS
8646
9885
  } = args$LWS;
8647
- if (isSharedElement$2$LWS(node$LWS)) {
9886
+ if (isSharedElement$3$LWS(node$LWS)) {
8648
9887
  throw new LockerSecurityError$LWS(`Cannot select all children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8649
9888
  }
8650
9889
  }
@@ -8655,7 +9894,7 @@ function initDistortionSelectionSelectAllChildren$LWS({
8655
9894
  };
8656
9895
  }
8657
9896
  const {
8658
- isSharedElement: isSharedElement$1$LWS
9897
+ isSharedElement: isSharedElement$2$LWS
8659
9898
  } = rootValidator$LWS;
8660
9899
  function initDistortionSelectionSetBaseAndExtent$LWS({
8661
9900
  globalObject: {
@@ -8674,8 +9913,8 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8674
9913
  0: anchorNode$LWS,
8675
9914
  2: focusNode$LWS
8676
9915
  } = args$LWS;
8677
- const anchorNodeIsShared$LWS = isSharedElement$1$LWS(anchorNode$LWS);
8678
- const focusNodeIsShared$LWS = isSharedElement$1$LWS(focusNode$LWS);
9916
+ const anchorNodeIsShared$LWS = isSharedElement$2$LWS(anchorNode$LWS);
9917
+ const focusNodeIsShared$LWS = isSharedElement$2$LWS(focusNode$LWS);
8679
9918
  if (anchorNodeIsShared$LWS || focusNodeIsShared$LWS) {
8680
9919
  const subject$LWS = anchorNodeIsShared$LWS ? anchorNode$LWS : focusNode$LWS;
8681
9920
  throw new LockerSecurityError$LWS(`Cannot set selection with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, subject$LWS, [])}`);
@@ -8688,7 +9927,7 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8688
9927
  };
8689
9928
  }
8690
9929
  const {
8691
- isSharedElement: isSharedElement$LWS
9930
+ isSharedElement: isSharedElement$1$LWS
8692
9931
  } = rootValidator$LWS;
8693
9932
  function initDistortionSelectionSetPosition$LWS({
8694
9933
  globalObject: {
@@ -8705,7 +9944,7 @@ function initDistortionSelectionSetPosition$LWS({
8705
9944
  0: node$LWS
8706
9945
  } = args$LWS;
8707
9946
  // The first arg to Selection.prototype.setPosition is "Node | null"
8708
- if (node$LWS && isSharedElement$LWS(node$LWS)) {
9947
+ if (node$LWS && isSharedElement$1$LWS(node$LWS)) {
8709
9948
  throw new LockerSecurityError$LWS(`Cannot set position with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8710
9949
  }
8711
9950
  }
@@ -8715,6 +9954,38 @@ function initDistortionSelectionSetPosition$LWS({
8715
9954
  return distortionEntry$LWS;
8716
9955
  };
8717
9956
  }
9957
+ const {
9958
+ isSharedElement: isSharedElement$LWS
9959
+ } = rootValidator$LWS;
9960
+ function initDistortionSelectionToString$LWS({
9961
+ globalObject: {
9962
+ Selection: {
9963
+ prototype: {
9964
+ toString: originalSelectionToString$LWS
9965
+ }
9966
+ }
9967
+ }
9968
+ }) {
9969
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'anchorNode');
9970
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'focusNode');
9971
+ const distortionEntry$LWS = [originalSelectionToString$LWS, function toString$LWS(...args$LWS) {
9972
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9973
+ const nodes$LWS = [ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []), ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, [])];
9974
+ for (let i$LWS = 0, {
9975
+ length: length$LWS
9976
+ } = nodes$LWS; i$LWS < length$LWS; i$LWS += 1) {
9977
+ const node$LWS = nodes$LWS[i$LWS];
9978
+ if (node$LWS && isSharedElement$LWS(node$LWS)) {
9979
+ throw new LockerSecurityError$LWS(`Cannot read selection content of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}.`);
9980
+ }
9981
+ }
9982
+ }
9983
+ return ReflectApply$LWS$1(originalSelectionToString$LWS, this, args$LWS);
9984
+ }];
9985
+ return function distortionSelectionToString$LWS() {
9986
+ return distortionEntry$LWS;
9987
+ };
9988
+ }
8718
9989
  function initDistortionServiceWorkerContainerProto$LWS({
8719
9990
  globalObject: {
8720
9991
  ServiceWorkerContainer: ServiceWorkerContainer$LWS
@@ -8752,6 +10023,9 @@ function initDistortionShadowRootInnerHTMLSetter$LWS({
8752
10023
  }];
8753
10024
  };
8754
10025
  }
10026
+ const {
10027
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS
10028
+ } = rootValidator$LWS;
8755
10029
  function initDistortionShadowRootSetHTMLUnsafe$LWS({
8756
10030
  document: document$LWS,
8757
10031
  globalObject: {
@@ -8770,12 +10044,16 @@ function initDistortionShadowRootSetHTMLUnsafe$LWS({
8770
10044
  key: key$LWS
8771
10045
  }) {
8772
10046
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
10047
+ const normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(toSafeStringValue$LWS(value$LWS), key$LWS, ContentType$LWS.HTML);
10048
+ if (isIframeSrcdocScriptAttack$LWS(normalizedValue$LWS)) {
10049
+ throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
10050
+ }
8773
10051
  // This must be called to signal to the virtual
8774
10052
  // CustomElementRegistry that the next thing created
8775
10053
  // MAY CONTAIN a custom element, which must be marked for
8776
10054
  // association to this sandbox.
8777
10055
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
8778
- ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML)]);
10056
+ ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
8779
10057
  }];
8780
10058
  };
8781
10059
  }
@@ -9166,6 +10444,27 @@ function initDistortionStorage$LWS({
9166
10444
  }
9167
10445
  const initDistortionLocalStorage$LWS = createDistortionStorageFactoryInitializer$LWS('localStorage');
9168
10446
  const initDistortionSessionStorage$LWS = createDistortionStorageFactoryInitializer$LWS('sessionStorage');
10447
+ function initDistortionSVGAnimatedStringBaseValSetter$LWS({
10448
+ globalObject: {
10449
+ SVGAnimatedString: SVGAnimatedString$LWS
10450
+ }
10451
+ }) {
10452
+ const originalBaseValSetter$LWS = ObjectLookupOwnSetter$LWS(SVGAnimatedString$LWS.prototype, 'baseVal');
10453
+ return function distortionSVGAnimatedStringBaseValSetter$LWS(record$LWS) {
10454
+ const scriptHrefDistortion$LWS = createScriptDistortion$LWS(record$LWS, 'href');
10455
+ const distortionEntry$LWS = [originalBaseValSetter$LWS, function baseVal$LWS(value$LWS) {
10456
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10457
+ const ownerElement$LWS = getSVGAnimatedStringOwner$LWS(this);
10458
+ if (ownerElement$LWS) {
10459
+ ReflectApply$LWS$1(scriptHrefDistortion$LWS, ownerElement$LWS, [value$LWS]);
10460
+ return;
10461
+ }
10462
+ }
10463
+ ReflectApply$LWS$1(originalBaseValSetter$LWS, this, [value$LWS]);
10464
+ }];
10465
+ return distortionEntry$LWS;
10466
+ };
10467
+ }
9169
10468
  function initDistortionSVGAnimateElementAttributeNameAttribute$LWS({
9170
10469
  globalObject: {
9171
10470
  Element: {
@@ -9318,13 +10617,18 @@ function initDistortionSVGScriptElementHrefGetter$LWS({
9318
10617
  const originalHrefGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGScriptElement$LWS.prototype, 'href');
9319
10618
  const distortionEntry$LWS = [originalHrefGetter$LWS, function href$LWS() {
9320
10619
  const url$LWS = getScriptURL$LWS(this);
10620
+ let result$LWS;
9321
10621
  // istanbul ignore else: needs default platform behavior test
9322
10622
  if (typeof url$LWS === 'string') {
9323
10623
  ReflectApply$LWS$1(originalSetAttribute$LWS, script$LWS, ['href', trusted.createScriptURL(url$LWS)]);
9324
- return ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10624
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10625
+ } else {
10626
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
9325
10627
  }
9326
- // istanbul ignore next: needs default platform behavior test
9327
- return ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
10628
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10629
+ trackSVGAnimatedStringOwner$LWS(result$LWS, this);
10630
+ }
10631
+ return result$LWS;
9328
10632
  }];
9329
10633
  return function distortionSVGScriptElementHrefGetter$LWS() {
9330
10634
  return distortionEntry$LWS;
@@ -9479,7 +10783,9 @@ function initDistortionURLCreateObjectURL$LWS({
9479
10783
  // user-code created global objects).
9480
10784
  const {
9481
10785
  isEqualDomString: isEqualDomString$LWS,
9482
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
10786
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
10787
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
10788
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
9483
10789
  } = getValidator$LWS(document$LWS, globalObject$LWS);
9484
10790
  return function distortionURLCreateObjectURL$LWS({
9485
10791
  key: key$LWS
@@ -9526,7 +10832,11 @@ function initDistortionURLCreateObjectURL$LWS({
9526
10832
  }
9527
10833
  const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
9528
10834
  const sanitized$LWS = sanitizer$LWS.sanitize(responseText$LWS);
9529
- if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isInherentlyUnsecure$LWS(responseText$LWS)) {
10835
+ if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isIframeSrcdocScriptAttack$LWS(responseText$LWS)) {
10836
+ URLRevokeObjectURL$LWS(outURL$LWS);
10837
+ throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
10838
+ }
10839
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(responseText$LWS) || isXMLNamespacedScriptAttack$LWS(responseText$LWS))) {
9530
10840
  URLRevokeObjectURL$LWS(outURL$LWS);
9531
10841
  throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
9532
10842
  }
@@ -9681,7 +10991,7 @@ function initDistortionWindowFetch$LWS({
9681
10991
  url$LWS = parsedURL$LWS.normalizedURL;
9682
10992
  args$LWS[0] = url$LWS;
9683
10993
  }
9684
- if (!isValidURL$LWS(parsedURL$LWS)) {
10994
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9685
10995
  const {
9686
10996
  normalizedURL: normalizedURL$LWS
9687
10997
  } = parsedURL$LWS;
@@ -9723,7 +11033,7 @@ function initDistortionWindowFetchLater$LWS({
9723
11033
  url$LWS = parsedURL$LWS.normalizedURL;
9724
11034
  args$LWS[0] = url$LWS;
9725
11035
  }
9726
- if (!isValidURL$LWS(parsedURL$LWS)) {
11036
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9727
11037
  const {
9728
11038
  normalizedURL: normalizedURL$LWS
9729
11039
  } = parsedURL$LWS;
@@ -9963,6 +11273,42 @@ function initDistortionWindowLengthGetter$LWS({
9963
11273
  return distortionEntry$LWS;
9964
11274
  };
9965
11275
  }
11276
+ function initDistortionWindowNameGetter$LWS({
11277
+ globalObject: globalObject$LWS
11278
+ }) {
11279
+ const originalNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(globalObject$LWS, 'name');
11280
+ // istanbul ignore if: currently unreachable via tests
11281
+ if (typeof originalNameGetter$LWS !== 'function') {
11282
+ return noop$LWS$1;
11283
+ }
11284
+ const distortionEntry$LWS = [originalNameGetter$LWS, function name$LWS() {
11285
+ if (this === rootWindow$LWS$1) {
11286
+ return '';
11287
+ }
11288
+ return ReflectApply$LWS$1(originalNameGetter$LWS, this, []);
11289
+ }];
11290
+ return function distortionWindowNameGetter$LWS() {
11291
+ return distortionEntry$LWS;
11292
+ };
11293
+ }
11294
+ function initDistortionWindowNameSetter$LWS({
11295
+ globalObject: globalObject$LWS
11296
+ }) {
11297
+ const originalNameSetter$LWS = ObjectLookupOwnSetter$LWS(globalObject$LWS, 'name');
11298
+ // istanbul ignore if: currently unreachable via tests
11299
+ if (typeof originalNameSetter$LWS !== 'function') {
11300
+ return noop$LWS$1;
11301
+ }
11302
+ const distortionEntry$LWS = [originalNameSetter$LWS, function name$LWS(value$LWS) {
11303
+ if (this === rootWindow$LWS$1) {
11304
+ return;
11305
+ }
11306
+ ReflectApply$LWS$1(originalNameSetter$LWS, this, [value$LWS]);
11307
+ }];
11308
+ return function distortionWindowNameSetter$LWS() {
11309
+ return distortionEntry$LWS;
11310
+ };
11311
+ }
9966
11312
  function initDistortionWindowOnrejectionhandled$LWS({
9967
11313
  globalObject: globalObject$LWS,
9968
11314
  globalObject: {
@@ -10002,25 +11348,32 @@ function initDistortionWindowOpen$LWS({
10002
11348
  }) {
10003
11349
  const distortionEntry$LWS = [originalWindowOpen$LWS, function open$LWS(...args$LWS) {
10004
11350
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
10005
- const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11351
+ // istanbul ignore next: resourceUrl default is not reachable via tests
10006
11352
  const {
10007
11353
  0: resourceUrl$LWS = ''
10008
11354
  } = normalizedArgs$LWS;
10009
- // In 256, limit this restriction to urls that can be treated as same-origin
10010
- // istanbul ignore else: previous behavior will not be tested in collection coverage
10011
- if (isGaterEnabledFeature$LWS('changesSince.256')) {
10012
- // This CANNOT be combined with the above condition, because doing so
10013
- // will result in the else consequent body being executed in the case
10014
- // where the gate is enabled and the url is not same origin,
10015
- // which is counter to the goals of this change!!
10016
- if (isSameOriginURL$LWS(resourceUrl$LWS)) {
10017
- // W-16032332
10018
- // Block access to unsafe child window properties
11355
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
11356
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
11357
+ }
11358
+ // Validate that same-origin URLs don't target endpoints that could be exploited
11359
+ // via browsing contexts. Unlike fetch/XHR, browsing contexts (window.open, iframe)
11360
+ // can be manipulated by attackers to inject malicious content.
11361
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isSameOriginURL$LWS(resourceUrl$LWS)) {
11362
+ const parsedURL$LWS = parseURL$LWS(resourceUrl$LWS);
11363
+ if (!isValidBrowsingContextURL$LWS(parsedURL$LWS)) {
11364
+ throw new LockerSecurityError$LWS(`Cannot open disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
11365
+ }
11366
+ }
11367
+ const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11368
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11369
+ // istanbul ignore else: previous behavior will not be tested in collection coverage
11370
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
11371
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
11372
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
11373
+ }
11374
+ } else {
10019
11375
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10020
11376
  }
10021
- } else {
10022
- // When the gate is disabled, mark all child windows
10023
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10024
11377
  }
10025
11378
  // W-14218118
10026
11379
  // If the target is '_self', '_parent', or '_top', only makes one request
@@ -10093,7 +11446,9 @@ function initDistortionWindowSetInterval$LWS({
10093
11446
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10094
11447
  }) {
10095
11448
  return [originalSetInterval$LWS, function setInterval$LWS(...args$LWS) {
10096
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11449
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11450
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11451
+ }
10097
11452
  if (args$LWS.length) {
10098
11453
  const {
10099
11454
  0: callback$LWS
@@ -10107,12 +11462,8 @@ function initDistortionWindowSetInterval$LWS({
10107
11462
  // Defer transforming source text asynchronously.
10108
11463
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10109
11464
  };
10110
- } else {
10111
- if (isGaterEnabledFeature$LWS('changesSince.256') &&
10112
- // @ts-ignore callback and eval have different type defs, but that's ok for this condition
10113
- callback$LWS === eval) {
10114
- throw new LockerSecurityError$LWS('Cannot pass unsafe eval reference.');
10115
- }
11465
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11466
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10116
11467
  }
10117
11468
  }
10118
11469
  }
@@ -10131,7 +11482,9 @@ function initDistortionWindowSetTimeout$LWS({
10131
11482
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10132
11483
  }) {
10133
11484
  return [originalSetTimeout$LWS, function setTimeout$LWS(...args$LWS) {
10134
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11485
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11486
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11487
+ }
10135
11488
  if (args$LWS.length) {
10136
11489
  const {
10137
11490
  0: callback$LWS
@@ -10145,12 +11498,8 @@ function initDistortionWindowSetTimeout$LWS({
10145
11498
  // Defer transforming source text asynchronously.
10146
11499
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10147
11500
  };
10148
- } else {
10149
- if (isGaterEnabledFeature$LWS('changesSince.256') &&
10150
- // @ts-ignore callback and eval have different type defs, but that's ok for this condition
10151
- callback$LWS === eval) {
10152
- throw new LockerSecurityError$LWS('Cannot pass unsafe eval reference.');
10153
- }
11501
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11502
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10154
11503
  }
10155
11504
  }
10156
11505
  }
@@ -10246,7 +11595,7 @@ function initDistortionXMLHttpRequestOpen$LWS({
10246
11595
  const url$LWS = args$LWS.length > 1 ? args$LWS[1] : undefined;
10247
11596
  if (url$LWS !== null && url$LWS !== undefined) {
10248
11597
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(url$LWS));
10249
- if (!isValidURL$LWS(parsedURL$LWS)) {
11598
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
10250
11599
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
10251
11600
  }
10252
11601
  args$LWS[1] = parsedURL$LWS.normalizedURL;
@@ -10266,12 +11615,17 @@ function replaceDocumentContent$LWS(doc$LWS, content$LWS) {
10266
11615
  }
10267
11616
  function initDistortionXMLHttpRequestResponseGetter$LWS({
10268
11617
  document: document$LWS,
11618
+ globalObject: globalObject$LWS,
10269
11619
  globalObject: {
10270
11620
  Document: Document$LWS,
10271
11621
  XMLHttpRequest: XMLHttpRequest$LWS
10272
11622
  }
10273
11623
  }) {
10274
11624
  const originalResponseGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'response');
11625
+ const {
11626
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11627
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11628
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10275
11629
  return function distortionXMLHttpRequestResponseGetter$LWS({
10276
11630
  key: key$LWS
10277
11631
  }) {
@@ -10285,6 +11639,9 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10285
11639
  if (rawResponse$LWS instanceof Document$LWS) {
10286
11640
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
10287
11641
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11642
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11643
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest response using an unsecure ${toSafeTemplateStringValue$LWS(rawResponse$LWS)}.`);
11644
+ }
10288
11645
  return replaceDocumentContent$LWS(rawResponse$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10289
11646
  }
10290
11647
  return rawResponse$LWS;
@@ -10293,11 +11650,16 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10293
11650
  }
10294
11651
  function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10295
11652
  document: document$LWS,
11653
+ globalObject: globalObject$LWS,
10296
11654
  globalObject: {
10297
11655
  XMLHttpRequest: XMLHttpRequest$LWS
10298
11656
  }
10299
11657
  }) {
10300
11658
  const originalResponseXMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'responseXML');
11659
+ const {
11660
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11661
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11662
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10301
11663
  return function distortionXMLHttpRequestResponseXMLGetter$LWS({
10302
11664
  key: key$LWS
10303
11665
  }) {
@@ -10310,6 +11672,9 @@ function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10310
11672
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
10311
11673
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponseXML$LWS, []);
10312
11674
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11675
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11676
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest responseXML using an unsecure ${toSafeTemplateStringValue$LWS(rawResponseXML$LWS)}.`);
11677
+ }
10313
11678
  return replaceDocumentContent$LWS(rawResponseXML$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10314
11679
  }];
10315
11680
  };
@@ -10329,29 +11694,35 @@ initDistortionBroadcastChannelPostMessage$LWS,
10329
11694
  // CSSStyleRule
10330
11695
  initDistortionCSSStyleRuleStyleGetter$LWS,
10331
11696
  // Document
10332
- initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
11697
+ initDistortionDocumentCreateNodeIterator$LWS, initDistortionDocumentCreateTreeWalker$LWS, initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
10333
11698
  // Element
10334
- initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
11699
+ initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementInnerHTMLGetter$LWS, initDistortionElementOuterHTMLGetter$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
10335
11700
  // Function
10336
11701
  initDistortionFunction$LWS,
10337
11702
  // History
10338
11703
  initDistortionHistoryPushState$LWS, initDistortionHistoryReplaceState$LWS,
10339
11704
  // HTMLElement
10340
- initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
11705
+ initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
10341
11706
  // HTMLIFrameElement
10342
11707
  initDistortionIFrameElementContentDocumentGetter$LWS, initDistortionIFrameElementContentWindowGetter$LWS, initDistortionHTMLIFrameElementSandboxGetter$LWS, initDistortionHTMLIFrameElementSandboxSetter$LWS, initDistortionHTMLIFrameElementSrcSetter$LWS,
10343
11708
  // HTMLLinkElement
10344
11709
  initDistortionHTMLLinkElementRelSetter$LWS, initDistortionHTMLLinkElementRelListSetter$LWS,
11710
+ // HTMLMetaElement
11711
+ initDistortionHTMLMetaElementContentGetter$LWS,
10345
11712
  // HTMLObjectElement
10346
11713
  initDistortionHTMLObjectElementDataSetter$LWS,
10347
11714
  // HTMLScriptElement
10348
- initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11715
+ initDistortionHTMLScriptElementInnerTextGetter$LWS, initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextGetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
10349
11716
  // IDBObjectStore
10350
11717
  initDistortionIDBObjectStoreAdd$LWS, initDistortionIDBObjectStorePut$LWS,
10351
11718
  // MessagePort
10352
11719
  initDistortionMessagePortPostMessage$LWS,
11720
+ // MutationObserver
11721
+ initDistortionMutationObserverObserve$LWS,
10353
11722
  // Navigator
10354
11723
  initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
11724
+ // Observable
11725
+ initDistortionObservableForEach$LWS, initDistortionObservableSubscribe$LWS,
10355
11726
  // Node
10356
11727
  initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
10357
11728
  // Performance
@@ -10359,19 +11730,21 @@ initDistortionPerformanceMark$LWS, initDistortionPerformanceMeasure$LWS,
10359
11730
  // PerformanceMark
10360
11731
  initDistortionPerformanceMarkCtor$LWS,
10361
11732
  // Promise
10362
- initDistortionPromiseTry$LWS,
11733
+ initDistortionPromiseAll$LWS, initDistortionPromiseAllSettled$LWS, initDistortionPromiseAny$LWS, initDistortionPromiseCatch$LWS, initDistortionPromiseFinally$LWS, initDistortionPromiseRace$LWS, initDistortionPromiseReject$LWS, initDistortionPromiseResolve$LWS, initDistortionPromiseThen$LWS, initDistortionPromiseTry$LWS, initDistortionPromiseWithResolvers$LWS,
10363
11734
  // Notification
10364
11735
  initDistortionNotificationCtor$LWS,
10365
11736
  // Range
10366
- initDistortionRangeDeleteContents$LWS, initDistortionRangeExtractContents$LWS, initDistortionRangeInsertNode$LWS, initDistortionRangeSelectNode$LWS, initDistortionRangeSelectNodeContents$LWS, initDistortionRangeSetEnd$LWS, initDistortionRangeSetEndAfter$LWS, initDistortionRangeSetEndBefore$LWS, initDistortionRangeSetStart$LWS, initDistortionRangeSetStartAfter$LWS, initDistortionRangeSetStartBefore$LWS, initDistortionRangeSurroundContents$LWS,
11737
+ initDistortionRangeCloneContents$LWS, initDistortionRangeCloneRange$LWS, initDistortionRangeDeleteContents$LWS, initDistortionRangeExtractContents$LWS, initDistortionRangeGetBoundingClientRect$LWS, initDistortionRangeInsertNode$LWS, initDistortionRangeSelectNode$LWS, initDistortionRangeSelectNodeContents$LWS, initDistortionRangeSetEnd$LWS, initDistortionRangeSetEndAfter$LWS, initDistortionRangeSetEndBefore$LWS, initDistortionRangeSetStart$LWS, initDistortionRangeSetStartAfter$LWS, initDistortionRangeSetStartBefore$LWS, initDistortionRangeSurroundContents$LWS, initDistortionRangeToString$LWS,
10367
11738
  // Selection
10368
- initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS,
11739
+ initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
10369
11740
  // ServiceWorkerContainer
10370
11741
  initDistortionServiceWorkerContainerProto$LWS,
10371
11742
  // SharedWorker
10372
11743
  initDistortionSharedWorkerCtor$LWS, initDistortionSharedWorkerProto$LWS,
10373
11744
  // Storage
10374
11745
  initDistortionStorage$LWS, initDistortionStorageClear$LWS, initDistortionStorageGetItem$LWS, initDistortionStorageKey$LWS, initDistortionStorageLength$LWS, initDistortionStorageRemoveItem$LWS, initDistortionStorageSetItem$LWS,
11746
+ // SVGAnimatedString
11747
+ initDistortionSVGAnimatedStringBaseValSetter$LWS,
10375
11748
  // SVGAnimateElement
10376
11749
  initDistortionSVGAnimateElementFromAttribute$LWS, initDistortionSVGAnimateElementToAttribute$LWS, initDistortionSVGAnimateElementValuesAttribute$LWS,
10377
11750
  // SVGElement
@@ -10383,7 +11756,7 @@ initDistortionSVGUseElementHrefAttribute$LWS, initDistortionSVGUseElementXlinkHr
10383
11756
  // TrustedTypePolicyFactory
10384
11757
  initDistortionTrustedTypePolicyFactoryCreatePolicy$LWS,
10385
11758
  // Window
10386
- initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
11759
+ initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
10387
11760
  // Worker
10388
11761
  initDistortionWorkerCtor$LWS, initDistortionWorkerProto$LWS,
10389
11762
  // XHR
@@ -10404,21 +11777,33 @@ initDistortionDocumentCookieGetter$LWS, initDistortionDocumentCookieSetter$LWS,
10404
11777
  // DOMParser
10405
11778
  initDistortionDOMParserParseFromString$LWS,
10406
11779
  // Element
10407
- initDistortionElementAttachShadow$LWS, initDistortionElementInnerHTMLSetter$LWS, initDistortionElementInsertAdjacentHTML$LWS, initDistortionElementOuterHTMLSetter$LWS, initDistortionElementSetAttribute$LWS, initDistortionElementSetAttributeNode$LWS, initDistortionElementSetAttributeNodeNS$LWS, initDistortionElementSetAttributeNS$LWS, initDistortionElementSetHTML$LWS, initDistortionElementSetHTMLUnsafe$LWS, initDistortionElementShadowRootGetter$LWS, initDistortionElementToggleAttribute$LWS,
11780
+ initDistortionElementAttachShadow$LWS, initDistortionElementInnerHTMLSetter$LWS, initDistortionElementInsertAdjacentHTML$LWS, initDistortionElementOuterHTMLSetter$LWS, initDistortionElementGetAttribute$LWS, initDistortionElementGetAttributeNode$LWS, initDistortionElementGetAttributeNodeNS$LWS, initDistortionElementGetAttributeNS$LWS, initDistortionElementSetAttribute$LWS, initDistortionElementSetAttributeNode$LWS, initDistortionElementSetAttributeNodeNS$LWS, initDistortionElementSetAttributeNS$LWS, initDistortionElementSetHTML$LWS, initDistortionElementSetHTMLUnsafe$LWS, initDistortionElementShadowRootGetter$LWS, initDistortionElementToggleAttribute$LWS,
10408
11781
  // Eval
10409
11782
  initDistortionEval$LWS,
10410
11783
  // Event
10411
11784
  initDistortionEventComposedPath$LWS, initDistortionEventPathGetter$LWS,
10412
11785
  // EventTarget
10413
11786
  initDistortionEventTargetAddEventListener$LWS,
11787
+ // HTMLAnchorElement
11788
+ initDistortionHTMLAnchorElementHrefSetter$LWS,
11789
+ // HTMLBaseElement
11790
+ initDistortionHTMLBaseElementHrefSetter$LWS,
10414
11791
  // HTMLBodyElement
10415
11792
  initDistortionHTMLBodyElementOnrejectionhandled$LWS, initDistortionHTMLBodyElementOnstorage$LWS, initDistortionHTMLBodyElementOnunhandledrejection$LWS,
10416
11793
  // HTMLElement
10417
11794
  initDistortionHTMLElementCtor$LWS, initDistortionHTMLElementOnsecuritypolicyviolation$LWS,
11795
+ // HTMLButtonElement
11796
+ initDistortionHTMLButtonElementFormActionSetter$LWS,
11797
+ // HTMLFormElement
11798
+ initDistortionHTMLFormElementActionSetter$LWS,
11799
+ // HTMLInputElement
11800
+ initDistortionHTMLInputElementFormActionSetter$LWS,
10418
11801
  // HTMLFrameSetElement
10419
11802
  initDistortionHTMLFrameSetElementOnrejectionhandled$LWS, initDistortionHTMLFrameSetElementOnstorage$LWS, initDistortionHTMLFrameSetElementOnunhandledrejection$LWS,
10420
11803
  // HTMLScriptElement,
10421
11804
  initDistortionHTMLScriptElementSrcSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11805
+ // IDBFactory
11806
+ initDistortionIDBFactoryDatabases$LWS, initDistortionIDBFactoryDeleteDatabase$LWS, initDistortionIDBFactoryOpen$LWS,
10422
11807
  // MathMLElement
10423
11808
  initDistortionMathMLElementOnsecuritypolicyviolation$LWS,
10424
11809
  // NamedNodeMap
@@ -10454,7 +11839,7 @@ initDistortionElementAfter$LWS, initDistortionElementAppend$LWS, initDistortionE
10454
11839
  // initDistortionNodeAppendChild,
10455
11840
  initDistortionNodeInsertBefore$LWS]);
10456
11841
  const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
10457
- const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionCacheStorageDelete$LWS, 'caches'], [initDistortionCacheStorageHas$LWS, 'caches'], [initDistortionCacheStorageKeys$LWS, 'caches'], [initDistortionCacheStorageMatch$LWS, 'caches'], [initDistortionCacheStorageOpen$LWS, 'caches'], [initDistortionCookieStoreDelete$LWS, 'cookieStore'], [initDistortionCookieStoreGet$LWS, 'cookieStore'], [initDistortionCookieStoreGetAll$LWS, 'cookieStore'], [initDistortionCookieStoreOnChange$LWS, 'cookieStore'], [initDistortionCookieStoreSet$LWS, 'cookieStore'], [initDistortionCSSStyleRuleStyleGetter$LWS, 'style'], [initDistortionCustomElementRegistryDefine$LWS, 'customElements'], [initDistortionCustomElementRegistryGet$LWS, 'customElements'], [initDistortionCustomElementRegistryUpgrade$LWS, 'customElements'], [initDistortionCustomElementRegistryWhenDefined$LWS, 'customElements'], [initDistortionDocumentCookieGetter$LWS, 'documentCookie'], [initDistortionDocumentCookieSetter$LWS, 'documentCookie'], [initDistortionDocumentDomainSetter$LWS, 'documentDomain'], [initDistortionDocumentExecCommand$LWS, 'documentExecCommand'], [initDistortionDOMParserParseFromString$LWS, 'domParserParseFromString'], [initDistortionElementAfter$LWS, 'element'], [initDistortionElementAppend$LWS, 'element'], [initDistortionElementAttributesGetter$LWS, 'attributes'], [initDistortionElementBefore$LWS, 'element'], [initDistortionElementGetInnerHTML$LWS, 'innerHTML'], [initDistortionElementInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionElementInsertAdjacentElement$LWS, 'element'], [initDistortionElementInsertAdjacentHTML$LWS, 'element'], [initDistortionElementOuterHTMLSetter$LWS, 'element'], [initDistortionElementPrepend$LWS, 'element'], [initDistortionElementRemove$LWS, 'element'], [initDistortionElementReplaceChildren$LWS, 'element'], [initDistortionElementReplaceWith$LWS, 'element'], [initDistortionElementSetAttribute$LWS, 'attributes'], [initDistortionElementSetAttributeNode$LWS, 'attributes'], [initDistortionElementSetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementSetAttributeNS$LWS, 'attributes'], [initDistortionElementSetHTML$LWS, 'element'], [initDistortionElementToggleAttribute$LWS, 'attributes'], [initDistortionHistoryPushState$LWS, 'history'], [initDistortionHistoryReplaceState$LWS, 'history'], [initDistortionHTMLElementDatasetGetter$LWS, 'dataset'], [initDistortionHTMLElementStyleGetter$LWS, 'style'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeRemoveChild$LWS, 'node'], [initDistortionNodeReplaceChild$LWS, 'node'], [initDistortionNodeTextContentGetter$LWS, 'node'], [initDistortionNodeTextContentSetter$LWS, 'node'], [initDistortionNodeValueSetter$LWS, 'node'], [initDistortionNotificationCtor$LWS, 'notification'], [initDistortionPerformanceMark$LWS, 'performance'], [initDistortionPerformanceMarkCtor$LWS, 'performance'], [initDistortionPerformanceMeasure$LWS, 'performance'], [initDistortionRangeCreateContextualFragment$LWS, 'range'], [initDistortionRangeDeleteContents$LWS, 'range'], [initDistortionRangeExtractContents$LWS, 'range'], [initDistortionRangeInsertNode$LWS, 'range'], [initDistortionRangeSelectNode$LWS, 'range'], [initDistortionRangeSelectNodeContents$LWS, 'range'], [initDistortionRangeSetEnd$LWS, 'range'], [initDistortionRangeSetEndAfter$LWS, 'range'], [initDistortionRangeSetEndBefore$LWS, 'range'], [initDistortionRangeSetStart$LWS, 'range'], [initDistortionRangeSetStartAfter$LWS, 'range'], [initDistortionRangeSetStartBefore$LWS, 'range'], [initDistortionRangeSurroundContents$LWS, 'range'], [initDistortionSelectionCollapse$LWS, 'selection'], [initDistortionSelectionExtend$LWS, 'selection'], [initDistortionSelectionSelectAllChildren$LWS, 'selection'], [initDistortionSelectionSetBaseAndExtent$LWS, 'selection'], [initDistortionSelectionSetPosition$LWS, 'selection'], [initDistortionSessionStorage$LWS, 'storage'], [initDistortionShadowRootInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionStorage$LWS, 'storage'], [initDistortionStorageClear$LWS, 'storage'], [initDistortionStorageGetItem$LWS, 'storage'], [initDistortionStorageKey$LWS, 'storage'], [initDistortionStorageLength$LWS, 'storage'], [initDistortionStorageRemoveItem$LWS, 'storage'], [initDistortionStorageSetItem$LWS, 'storage'], [initDistortionSVGElementDatasetGetter$LWS, 'dataset'], [initDistortionSVGElementStyleGetter$LWS, 'style'], [initDistortionSVGScriptElementHrefGetter$LWS, 'script'], [initDistortionSVGScriptElementHrefSetter$LWS, 'script'], [initDistortionWindowFetch$LWS, 'windowFetch'], [initDistortionWindowFetchLater$LWS, 'windowFetchLater'], [initDistortionWindowFramesGetter$LWS, 'windowFrames'], [initDistortionWindowGetComputedStyle$LWS, 'style'], [initDistortionWindowLengthGetter$LWS, 'windowFrames'], [initDistortionWindowPostMessage$LWS, 'postMessage'], [initDistortionWindowSetInterval$LWS, 'setInterval'], [initDistortionWindowSetTimeout$LWS, 'setTimeout'], [initDistortionXMLHttpRequestResponseGetter$LWS, 'xhr'], [initDistortionXMLHttpRequestResponseXMLGetter$LWS, 'xhr']]));
11842
+ const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionCacheStorageDelete$LWS, 'caches'], [initDistortionCacheStorageHas$LWS, 'caches'], [initDistortionCacheStorageKeys$LWS, 'caches'], [initDistortionCacheStorageMatch$LWS, 'caches'], [initDistortionCacheStorageOpen$LWS, 'caches'], [initDistortionCookieStoreDelete$LWS, 'cookieStore'], [initDistortionCookieStoreGet$LWS, 'cookieStore'], [initDistortionCookieStoreGetAll$LWS, 'cookieStore'], [initDistortionCookieStoreOnChange$LWS, 'cookieStore'], [initDistortionCookieStoreSet$LWS, 'cookieStore'], [initDistortionCSSStyleRuleStyleGetter$LWS, 'style'], [initDistortionCustomElementRegistryDefine$LWS, 'customElements'], [initDistortionCustomElementRegistryGet$LWS, 'customElements'], [initDistortionCustomElementRegistryUpgrade$LWS, 'customElements'], [initDistortionCustomElementRegistryWhenDefined$LWS, 'customElements'], [initDistortionDocumentCookieGetter$LWS, 'documentCookie'], [initDistortionDocumentCookieSetter$LWS, 'documentCookie'], [initDistortionDocumentDomainSetter$LWS, 'documentDomain'], [initDistortionDocumentExecCommand$LWS, 'documentExecCommand'], [initDistortionDOMParserParseFromString$LWS, 'domParserParseFromString'], [initDistortionElementAfter$LWS, 'element'], [initDistortionElementAppend$LWS, 'element'], [initDistortionElementAttributesGetter$LWS, 'attributes'], [initDistortionElementBefore$LWS, 'element'], [initDistortionElementGetInnerHTML$LWS, 'innerHTML'], [initDistortionElementInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionElementInsertAdjacentElement$LWS, 'element'], [initDistortionElementInsertAdjacentHTML$LWS, 'element'], [initDistortionElementOuterHTMLSetter$LWS, 'element'], [initDistortionElementPrepend$LWS, 'element'], [initDistortionElementRemove$LWS, 'element'], [initDistortionElementReplaceChildren$LWS, 'element'], [initDistortionElementReplaceWith$LWS, 'element'], [initDistortionElementGetAttribute$LWS, 'attributes'], [initDistortionElementGetAttributeNode$LWS, 'attributes'], [initDistortionElementGetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementGetAttributeNS$LWS, 'attributes'], [initDistortionElementSetAttribute$LWS, 'attributes'], [initDistortionElementSetAttributeNode$LWS, 'attributes'], [initDistortionElementSetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementSetAttributeNS$LWS, 'attributes'], [initDistortionElementSetHTML$LWS, 'element'], [initDistortionElementToggleAttribute$LWS, 'attributes'], [initDistortionHTMLButtonElementFormActionSetter$LWS, 'form'], [initDistortionHTMLFormElementActionSetter$LWS, 'form'], [initDistortionHTMLInputElementFormActionSetter$LWS, 'form'], [initDistortionHistoryPushState$LWS, 'history'], [initDistortionHistoryReplaceState$LWS, 'history'], [initDistortionHTMLElementDatasetGetter$LWS, 'dataset'], [initDistortionHTMLElementStyleGetter$LWS, 'style'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeRemoveChild$LWS, 'node'], [initDistortionNodeReplaceChild$LWS, 'node'], [initDistortionNodeTextContentGetter$LWS, 'node'], [initDistortionNodeTextContentSetter$LWS, 'node'], [initDistortionNodeValueSetter$LWS, 'node'], [initDistortionNotificationCtor$LWS, 'notification'], [initDistortionPerformanceMark$LWS, 'performance'], [initDistortionPerformanceMarkCtor$LWS, 'performance'], [initDistortionPerformanceMeasure$LWS, 'performance'], [initDistortionRangeCloneContents$LWS, 'range'], [initDistortionRangeCloneRange$LWS, 'range'], [initDistortionRangeCreateContextualFragment$LWS, 'range'], [initDistortionRangeDeleteContents$LWS, 'range'], [initDistortionRangeExtractContents$LWS, 'range'], [initDistortionRangeGetBoundingClientRect$LWS, 'range'], [initDistortionRangeInsertNode$LWS, 'range'], [initDistortionRangeSelectNode$LWS, 'range'], [initDistortionRangeSelectNodeContents$LWS, 'range'], [initDistortionRangeSetEnd$LWS, 'range'], [initDistortionRangeSetEndAfter$LWS, 'range'], [initDistortionRangeSetEndBefore$LWS, 'range'], [initDistortionRangeSetStart$LWS, 'range'], [initDistortionRangeSetStartAfter$LWS, 'range'], [initDistortionRangeSetStartBefore$LWS, 'range'], [initDistortionRangeSurroundContents$LWS, 'range'], [initDistortionRangeToString$LWS, 'range'], [initDistortionSelectionAnchorNodeGetter$LWS, 'selection'], [initDistortionSelectionCollapse$LWS, 'selection'], [initDistortionSelectionExtend$LWS, 'selection'], [initDistortionSelectionFocusNodeGetter$LWS, 'selection'], [initDistortionSelectionSelectAllChildren$LWS, 'selection'], [initDistortionSelectionSetBaseAndExtent$LWS, 'selection'], [initDistortionSelectionSetPosition$LWS, 'selection'], [initDistortionSelectionToString$LWS, 'selection'], [initDistortionSessionStorage$LWS, 'storage'], [initDistortionShadowRootInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionStorage$LWS, 'storage'], [initDistortionStorageClear$LWS, 'storage'], [initDistortionStorageGetItem$LWS, 'storage'], [initDistortionStorageKey$LWS, 'storage'], [initDistortionStorageLength$LWS, 'storage'], [initDistortionStorageRemoveItem$LWS, 'storage'], [initDistortionStorageSetItem$LWS, 'storage'], [initDistortionSVGElementDatasetGetter$LWS, 'dataset'], [initDistortionSVGElementStyleGetter$LWS, 'style'], [initDistortionSVGAnimatedStringBaseValSetter$LWS, 'script'], [initDistortionSVGScriptElementHrefGetter$LWS, 'script'], [initDistortionSVGScriptElementHrefSetter$LWS, 'script'], [initDistortionWindowFetch$LWS, 'windowFetch'], [initDistortionWindowFetchLater$LWS, 'windowFetchLater'], [initDistortionWindowFramesGetter$LWS, 'windowFrames'], [initDistortionWindowGetComputedStyle$LWS, 'style'], [initDistortionWindowLengthGetter$LWS, 'windowFrames'], [initDistortionWindowNameGetter$LWS, 'windowName'], [initDistortionWindowNameSetter$LWS, 'windowName'], [initDistortionWindowPostMessage$LWS, 'postMessage'], [initDistortionWindowSetInterval$LWS, 'setInterval'], [initDistortionWindowSetTimeout$LWS, 'setTimeout'], [initDistortionXMLHttpRequestResponseGetter$LWS, 'xhr'], [initDistortionXMLHttpRequestResponseXMLGetter$LWS, 'xhr']]));
10458
11843
  const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
10459
11844
  const DocumentProtoBlockedProperties$LWS = ['createProcessingInstruction', 'exitFullscreen', 'fullscreen', 'fullscreenElement', 'fullscreenEnabled', 'mozCancelFullScreen', 'mozFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'onfullscreenchange', 'onfullscreenerror', 'onmozfullscreenchange', 'onmozfullscreenerror', 'onrejectionhandled', 'onunhandledrejection', 'parseHTMLUnsafe', 'releaseCapture', 'releaseEvents', 'requestStorageAccess', 'webkitFullScreenKeyboardInputAllowed', 'write', 'writeln'];
10460
11845
  const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
@@ -10474,7 +11859,7 @@ const SVGElementProtoBlockedProperties$LWS = ['nonce'];
10474
11859
  const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
10475
11860
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
10476
11861
  const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
10477
- /*! version: 0.26.4 */
11862
+ /*! version: 0.27.5 */
10478
11863
 
10479
11864
  /*!
10480
11865
  * Copyright (C) 2021 salesforce.com, inc.
@@ -10483,7 +11868,7 @@ let pdpSchema$LWS;
10483
11868
  function getPdpSchema$LWS() {
10484
11869
  return pdpSchema$LWS;
10485
11870
  }
10486
- /*! version: 0.26.4 */
11871
+ /*! version: 0.27.5 */
10487
11872
 
10488
11873
  /*!
10489
11874
  * Copyright (C) 2019 salesforce.com, inc.
@@ -10682,15 +12067,10 @@ function createDistortionEntries$LWS(record$LWS, factories$LWS) {
10682
12067
  let distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = proxyMaskedFunctionDistortion$LWS;
10683
12068
  if (ENABLE_DISTORTION_TOGGLE_SWITCHES$LWS && toggleSwitchName$LWS) {
10684
12069
  distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = createDistortionToggleSwitchWrapper$LWS(record$LWS.key, toggleSwitchName$LWS, proxyMaskedFunctionDistortion$LWS, originalValue$LWS);
10685
- // If the distorted API originated in a window created via window.open or
10686
- // document.open, it may be marked as an unsafe property. If so, we need
10687
- // to transfer the original value's marker to the wrapped toggle switch
10688
- // function to ensure that the distortion itself can find the marker when
10689
- // checking if it needs to be blocked.
10690
- if (originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
10691
- const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
10692
- ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10693
- }
12070
+ }
12071
+ if (!isGaterEnabledFeature$LWS('changesSince.262') && originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
12072
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
12073
+ ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10694
12074
  }
10695
12075
  entries$LWS[entries$LWS.length] = [originalValue$LWS, toggleSwitchName$LWS ? distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS : proxyMaskedFunctionDistortion$LWS];
10696
12076
  } else {
@@ -15835,7 +17215,7 @@ function toSourceText$LWS(value$LWS, sourceType$LWS) {
15835
17215
  // tools from mistaking the regexp or the replacement string for an
15836
17216
  // actual source mapping URL.
15837
17217
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15838
- sourceText$LWS = `\n//# LWS Version = "0.26.4"\n${sourceText$LWS}`;
17218
+ sourceText$LWS = `\n//# LWS Version = "0.27.5"\n${sourceText$LWS}`;
15839
17219
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
15840
17220
  // Append "'use strict'" to the extracted function body so it is
15841
17221
  // evaluated in strict mode.
@@ -15849,6 +17229,14 @@ const IFRAME_KEEP_ALIVE_FLAG$LWS = LOCKER_UNMINIFIED_FLAG$LWS$1 && !false;
15849
17229
  // created distortion map.
15850
17230
  const rootDistortionMapSeedEntries$LWS = [[rootDocument$LWS, rootDocument$LWS], [rootWindowLocation$LWS, rootWindowLocation$LWS], [rootWindow$LWS$1, rootWindow$LWS$1]];
15851
17231
  const seenGlobalObjects$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
17232
+ // Tracks child windows and the last document for which distortions were
17233
+ // created. Unlike the non-iterable WeakSet above, this Map can be walked in
17234
+ // distortionCallback to eagerly detect navigations that the event-based
17235
+ // detection (unload → microtask → DOMContentLoaded) may have missed due to
17236
+ // timing: the microtask can run before the browser has replaced the document,
17237
+ // causing the check to bail out and the DOMContentLoaded listener to never be
17238
+ // attached.
17239
+ const childWindowDocuments$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
15852
17240
  function createGetVirtualEnvironment$LWS(record$LWS) {
15853
17241
  let virtualEnvironment$LWS;
15854
17242
  return () => {
@@ -15947,9 +17335,73 @@ function createVirtualEnvironment$LWS(record$LWS) {
15947
17335
  distortionCallback(originalTarget$LWS) {
15948
17336
  const distortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
15949
17337
  if (distortedTarget$LWS) {
17338
+ // The WindowProxy maintains identity across navigations, but
17339
+ // each navigation replaces the inner window and all its
17340
+ // realm-specific prototypes. Detect this by checking whether
17341
+ // the WindowProxy's current document has been registered in
17342
+ // the distortion map. If not, the inner window has been
17343
+ // replaced and we must create a secondary sandbox record for
17344
+ // the new realm before its undistorted prototypes can be
17345
+ // reached by sandboxed code.
17346
+ if (isGaterEnabledFeature$LWS('changesSince.262') && distortedTarget$LWS === originalTarget$LWS && seenGlobalObjects$LWS.has(originalTarget$LWS)) {
17347
+ try {
17348
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
17349
+ if (!distortions$LWS.has(currentDoc$LWS)) {
17350
+ createSecondaryWindowSandboxRecord$LWS({
17351
+ context: EMPTY_OBJECT$LWS,
17352
+ document: currentDoc$LWS,
17353
+ globalObject: originalTarget$LWS,
17354
+ key: key$LWS,
17355
+ type: type$LWS
17356
+ }, _root$LWS);
17357
+ }
17358
+ } catch (_unused1$LWS) {
17359
+ // Cross-origin window — document access throws.
17360
+ // Opaque sandbox record was already created on first
17361
+ // encounter; nothing more to do.
17362
+ }
17363
+ }
15950
17364
  return distortedTarget$LWS;
15951
17365
  }
15952
17366
  if (typeof originalTarget$LWS === 'function') {
17367
+ // When a child window navigates, the browser replaces the
17368
+ // inner window and all its realm-specific built-ins (eval,
17369
+ // Function, Document.prototype, etc.). Near-membrane caches
17370
+ // the WindowProxy's proxy pointer, so distortionCallback is
17371
+ // never re-invoked for the WindowProxy itself — but the NEW
17372
+ // built-ins ARE seen as unknown objects here. Walk the child
17373
+ // window map and, for any window whose document has changed
17374
+ // since we last created distortions, eagerly create a
17375
+ // secondary sandbox record. This populates the distortion
17376
+ // map with entries for the new realm's objects so the
17377
+ // re-lookup below can succeed.
17378
+ if (isGaterEnabledFeature$LWS('changesSince.262') && childWindowDocuments$LWS.size > 0) {
17379
+ for (const [childGlobalObject$LWS, lastDocument$LWS] of childWindowDocuments$LWS) {
17380
+ // Only process child windows belonging to this
17381
+ // sandbox (each sandbox has its own distortion map).
17382
+ if (!distortions$LWS.has(childGlobalObject$LWS)) {
17383
+ continue;
17384
+ }
17385
+ try {
17386
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, childGlobalObject$LWS, []);
17387
+ if (currentDoc$LWS !== lastDocument$LWS) {
17388
+ createSecondaryWindowSandboxRecord$LWS({
17389
+ context: EMPTY_OBJECT$LWS,
17390
+ document: currentDoc$LWS,
17391
+ globalObject: childGlobalObject$LWS,
17392
+ key: key$LWS,
17393
+ type: type$LWS
17394
+ }, _root$LWS);
17395
+ const newDistortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
17396
+ if (newDistortedTarget$LWS) {
17397
+ return newDistortedTarget$LWS;
17398
+ }
17399
+ }
17400
+ } catch (_unused35$LWS) {
17401
+ // Cross-origin window — document access throws.
17402
+ }
17403
+ }
17404
+ }
15953
17405
  return originalTarget$LWS;
15954
17406
  }
15955
17407
  // Perform the first own property check in a try-catch to avoid
@@ -15962,7 +17414,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15962
17414
  if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
15963
17415
  return originalTarget$LWS;
15964
17416
  }
15965
- } catch (_unused1$LWS) {
17417
+ } catch (_unused36$LWS) {
15966
17418
  // Likely an opaque object of a cross-origin window.
15967
17419
  // istanbul ignore next: an access of property iframe.contentWindow.location.href on an opaque window, that should reach this catch clause IS tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
15968
17420
  return originalTarget$LWS;
@@ -15978,7 +17430,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15978
17430
  // not a window object, or if it is an opaque cross-origin window.
15979
17431
  originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
15980
17432
  originalTargetWindow$LWS = originalTarget$LWS;
15981
- } catch (_unused35$LWS) {
17433
+ } catch (_unused37$LWS) {
15982
17434
  try {
15983
17435
  // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
15984
17436
  if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
@@ -15990,7 +17442,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15990
17442
  return originalTarget$LWS;
15991
17443
  }
15992
17444
  // eslint-disable-next-line no-empty
15993
- } catch (_unused36$LWS) {}
17445
+ } catch (_unused38$LWS) {}
15994
17446
  }
15995
17447
  // Check if originalTarget is a document and get its defaultView.
15996
17448
  } else if ('defaultView' in originalTarget$LWS) {
@@ -16004,7 +17456,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
16004
17456
  // This will throw if `originalTarget` is not a document object.
16005
17457
  defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []);
16006
17458
  // eslint-disable-next-line no-empty
16007
- } catch (_unused37$LWS) {}
17459
+ } catch (_unused39$LWS) {}
16008
17460
  if (defaultView$LWS) {
16009
17461
  originalTargetDocument$LWS = originalTarget$LWS;
16010
17462
  originalTargetWindow$LWS = defaultView$LWS;
@@ -16240,6 +17692,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16240
17692
  // virtual environment distortion callback by adding them to the root window's
16241
17693
  // distortion map.
16242
17694
  distortions$LWS.set(document$LWS, document$LWS);
17695
+ childWindowDocuments$LWS.set(globalObject$LWS, document$LWS);
16243
17696
  distortions$LWS.set(location$LWS, location$LWS);
16244
17697
  const seenGlobalObject$LWS = seenGlobalObjects$LWS.has(globalObject$LWS);
16245
17698
  if (!seenGlobalObject$LWS) {
@@ -16293,7 +17746,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16293
17746
  type: type$LWS
16294
17747
  }, _root$LWS);
16295
17748
  }
16296
- } catch (_unused38$LWS) {
17749
+ } catch (_unused40$LWS) {
16297
17750
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16298
17751
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16299
17752
  globalObject: globalObject$LWS,
@@ -16332,7 +17785,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16332
17785
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
16333
17786
  // istanbul ignore next: currently unreachable via tests
16334
17787
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
16335
- } catch (_unused39$LWS) {
17788
+ } catch (_unused41$LWS) {
16336
17789
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16337
17790
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16338
17791
  globalObject: globalObject$LWS,
@@ -16558,7 +18011,7 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
16558
18011
  depRegistry$LWS.set(dep$LWS, secureDep$LWS);
16559
18012
  return secureDep$LWS;
16560
18013
  }
16561
- /*! version: 0.26.4 */
18014
+ /*! version: 0.27.5 */
16562
18015
 
16563
18016
  const loaderDefine = (globalThis ).LWR.define;
16564
18017